mmzone_32.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Written by Pat Gaughen (gone@us.ibm.com) Mar 2002
  3. *
  4. */
  5. #ifndef _ASM_X86_MMZONE_32_H
  6. #define _ASM_X86_MMZONE_32_H
  7. #include <asm/smp.h>
  8. #ifdef CONFIG_NUMA
  9. extern struct pglist_data *node_data[];
  10. #define NODE_DATA(nid) (node_data[nid])
  11. #include <asm/numaq.h>
  12. #endif /* CONFIG_NUMA */
  13. #ifdef CONFIG_DISCONTIGMEM
  14. /*
  15. * generic node memory support, the following assumptions apply:
  16. *
  17. * 1) memory comes in 64Mb contiguous chunks which are either present or not
  18. * 2) we will not have more than 64Gb in total
  19. *
  20. * for now assume that 64Gb is max amount of RAM for whole system
  21. * 64Gb / 4096bytes/page = 16777216 pages
  22. */
  23. #define MAX_NR_PAGES 16777216
  24. #define MAX_SECTIONS 1024
  25. #define PAGES_PER_SECTION (MAX_NR_PAGES/MAX_SECTIONS)
  26. extern s8 physnode_map[];
  27. static inline int pfn_to_nid(unsigned long pfn)
  28. {
  29. #ifdef CONFIG_NUMA
  30. return((int) physnode_map[(pfn) / PAGES_PER_SECTION]);
  31. #else
  32. return 0;
  33. #endif
  34. }
  35. static inline int pfn_valid(int pfn)
  36. {
  37. int nid = pfn_to_nid(pfn);
  38. if (nid >= 0)
  39. return (pfn < node_end_pfn(nid));
  40. return 0;
  41. }
  42. #define early_pfn_valid(pfn) pfn_valid((pfn))
  43. #endif /* CONFIG_DISCONTIGMEM */
  44. #ifdef CONFIG_NEED_MULTIPLE_NODES
  45. /* always use node 0 for bootmem on this numa platform */
  46. #define bootmem_arch_preferred_node(__bdata, size, align, goal, limit) \
  47. (NODE_DATA(0)->bdata)
  48. #endif /* CONFIG_NEED_MULTIPLE_NODES */
  49. #endif /* _ASM_X86_MMZONE_32_H */