mmzone.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Copyright 2010 Tilera Corporation. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation, version 2.
  7. *
  8. * This program is distributed in the hope that it will be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  11. * NON INFRINGEMENT. See the GNU General Public License for
  12. * more details.
  13. */
  14. #ifndef _ASM_TILE_MMZONE_H
  15. #define _ASM_TILE_MMZONE_H
  16. extern struct pglist_data node_data[];
  17. #define NODE_DATA(nid) (&node_data[nid])
  18. extern void get_memcfg_numa(void);
  19. #ifdef CONFIG_DISCONTIGMEM
  20. #include <asm/page.h>
  21. /*
  22. * Generally, memory ranges are always doled out by the hypervisor in
  23. * fixed-size, power-of-two increments. That would make computing the node
  24. * very easy. We could just take a couple high bits of the PA, which
  25. * denote the memory shim, and we'd be done. However, when we're doing
  26. * memory striping, this may not be true; PAs with different high bit
  27. * values might be in the same node. Thus, we keep a lookup table to
  28. * translate the high bits of the PFN to the node number.
  29. */
  30. extern int highbits_to_node[];
  31. static inline int pfn_to_nid(unsigned long pfn)
  32. {
  33. return highbits_to_node[__pfn_to_highbits(pfn)];
  34. }
  35. #define kern_addr_valid(kaddr) virt_addr_valid((void *)kaddr)
  36. static inline int pfn_valid(unsigned long pfn)
  37. {
  38. int nid = pfn_to_nid(pfn);
  39. if (nid >= 0)
  40. return (pfn < node_end_pfn(nid));
  41. return 0;
  42. }
  43. /* Information on the NUMA nodes that we compute early */
  44. extern unsigned long node_start_pfn[];
  45. extern unsigned long node_end_pfn[];
  46. extern unsigned long node_memmap_pfn[];
  47. extern unsigned long node_percpu_pfn[];
  48. extern unsigned long node_free_pfn[];
  49. #ifdef CONFIG_HIGHMEM
  50. extern unsigned long node_lowmem_end_pfn[];
  51. #endif
  52. #ifdef CONFIG_PCI
  53. extern unsigned long pci_reserve_start_pfn;
  54. extern unsigned long pci_reserve_end_pfn;
  55. #endif
  56. #endif /* CONFIG_DISCONTIGMEM */
  57. #endif /* _ASM_TILE_MMZONE_H */