abs_addr.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef _ASM_POWERPC_ABS_ADDR_H
  2. #define _ASM_POWERPC_ABS_ADDR_H
  3. #ifdef __KERNEL__
  4. /*
  5. * c 2001 PPC 64 Team, IBM Corp
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version
  10. * 2 of the License, or (at your option) any later version.
  11. */
  12. #include <linux/memblock.h>
  13. #include <asm/types.h>
  14. #include <asm/page.h>
  15. #include <asm/prom.h>
  16. struct mschunks_map {
  17. unsigned long num_chunks;
  18. unsigned long chunk_size;
  19. unsigned long chunk_shift;
  20. unsigned long chunk_mask;
  21. u32 *mapping;
  22. };
  23. extern struct mschunks_map mschunks_map;
  24. /* Chunks are 256 KB */
  25. #define MSCHUNKS_CHUNK_SHIFT (18)
  26. #define MSCHUNKS_CHUNK_SIZE (1UL << MSCHUNKS_CHUNK_SHIFT)
  27. #define MSCHUNKS_OFFSET_MASK (MSCHUNKS_CHUNK_SIZE - 1)
  28. static inline unsigned long chunk_to_addr(unsigned long chunk)
  29. {
  30. return chunk << MSCHUNKS_CHUNK_SHIFT;
  31. }
  32. static inline unsigned long addr_to_chunk(unsigned long addr)
  33. {
  34. return addr >> MSCHUNKS_CHUNK_SHIFT;
  35. }
  36. static inline unsigned long phys_to_abs(unsigned long pa)
  37. {
  38. return pa;
  39. }
  40. /* Convenience macros */
  41. #define virt_to_abs(va) phys_to_abs(__pa(va))
  42. #define abs_to_virt(aa) __va(aa)
  43. #endif /* __KERNEL__ */
  44. #endif /* _ASM_POWERPC_ABS_ADDR_H */