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 9 #ifndef _ASM_ARC_MMZONE_H 10 #define _ASM_ARC_MMZONE_H 11 12 #ifdef CONFIG_DISCONTIGMEM 13 14 extern struct pglist_data node_data[]; 15 #define NODE_DATA(nid) (&node_data[nid]) 16 pfn_to_nid(unsigned long pfn)17static inline int pfn_to_nid(unsigned long pfn) 18 { 19 int is_end_low = 1; 20 21 if (IS_ENABLED(CONFIG_ARC_HAS_PAE40)) 22 is_end_low = pfn <= virt_to_pfn(0xFFFFFFFFUL); 23 24 /* 25 * node 0: lowmem: 0x8000_0000 to 0xFFFF_FFFF 26 * node 1: HIGHMEM w/o PAE40: 0x0 to 0x7FFF_FFFF 27 * HIGHMEM with PAE40: 0x1_0000_0000 to ... 28 */ 29 if (pfn >= ARCH_PFN_OFFSET && is_end_low) 30 return 0; 31 32 return 1; 33 } 34 pfn_valid(unsigned long pfn)35static inline int pfn_valid(unsigned long pfn) 36 { 37 int nid = pfn_to_nid(pfn); 38 39 return (pfn <= node_end_pfn(nid)); 40 } 41 #endif /* CONFIG_DISCONTIGMEM */ 42 43 #endif 44