mmzone.h 989 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright (C) 2016 Synopsys, Inc. (www.synopsys.com)
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. #ifndef _ASM_ARC_MMZONE_H
  9. #define _ASM_ARC_MMZONE_H
  10. #ifdef CONFIG_DISCONTIGMEM
  11. extern struct pglist_data node_data[];
  12. #define NODE_DATA(nid) (&node_data[nid])
  13. static inline int pfn_to_nid(unsigned long pfn)
  14. {
  15. int is_end_low = 1;
  16. if (IS_ENABLED(CONFIG_ARC_HAS_PAE40))
  17. is_end_low = pfn <= virt_to_pfn(0xFFFFFFFFUL);
  18. /*
  19. * node 0: lowmem: 0x8000_0000 to 0xFFFF_FFFF
  20. * node 1: HIGHMEM w/o PAE40: 0x0 to 0x7FFF_FFFF
  21. * HIGHMEM with PAE40: 0x1_0000_0000 to ...
  22. */
  23. if (pfn >= ARCH_PFN_OFFSET && is_end_low)
  24. return 0;
  25. return 1;
  26. }
  27. static inline int pfn_valid(unsigned long pfn)
  28. {
  29. int nid = pfn_to_nid(pfn);
  30. return (pfn <= node_end_pfn(nid));
  31. }
  32. #endif /* CONFIG_DISCONTIGMEM */
  33. #endif