mmzone_32.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. #endif /* CONFIG_NUMA */
  12. #ifdef CONFIG_DISCONTIGMEM
  13. /*
  14. * generic node memory support, the following assumptions apply:
  15. *
  16. * 1) memory comes in 64Mb contiguous chunks which are either present or not
  17. * 2) we will not have more than 64Gb in total
  18. *
  19. * for now assume that 64Gb is max amount of RAM for whole system
  20. * 64Gb / 4096bytes/page = 16777216 pages
  21. */
  22. #define MAX_NR_PAGES 16777216
  23. #define MAX_SECTIONS 1024
  24. #define PAGES_PER_SECTION (MAX_NR_PAGES/MAX_SECTIONS)
  25. extern s8 physnode_map[];
  26. static inline int pfn_to_nid(unsigned long pfn)
  27. {
  28. #ifdef CONFIG_NUMA
  29. return((int) physnode_map[(pfn) / PAGES_PER_SECTION]);
  30. #else
  31. return 0;
  32. #endif
  33. }
  34. static inline int pfn_valid(int pfn)
  35. {
  36. int nid = pfn_to_nid(pfn);
  37. if (nid >= 0)
  38. return (pfn < node_end_pfn(nid));
  39. return 0;
  40. }
  41. #define early_pfn_valid(pfn) pfn_valid((pfn))
  42. #endif /* CONFIG_DISCONTIGMEM */
  43. #endif /* _ASM_X86_MMZONE_32_H */