Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
[linux/fpc-iii.git] / arch / tile / include / asm / mmzone.h
blob804f1098b6cdc4730a1d9cf852f08ecc711234d8
1 /*
2 * Copyright 2010 Tilera Corporation. All Rights Reserved.
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.
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.
15 #ifndef _ASM_TILE_MMZONE_H
16 #define _ASM_TILE_MMZONE_H
18 extern struct pglist_data node_data[];
19 #define NODE_DATA(nid) (&node_data[nid])
21 extern void get_memcfg_numa(void);
23 #ifdef CONFIG_DISCONTIGMEM
25 #include <asm/page.h>
28 * Generally, memory ranges are always doled out by the hypervisor in
29 * fixed-size, power-of-two increments. That would make computing the node
30 * very easy. We could just take a couple high bits of the PA, which
31 * denote the memory shim, and we'd be done. However, when we're doing
32 * memory striping, this may not be true; PAs with different high bit
33 * values might be in the same node. Thus, we keep a lookup table to
34 * translate the high bits of the PFN to the node number.
36 extern int highbits_to_node[];
38 static inline int pfn_to_nid(unsigned long pfn)
40 return highbits_to_node[__pfn_to_highbits(pfn)];
43 #define kern_addr_valid(kaddr) virt_addr_valid((void *)kaddr)
45 static inline int pfn_valid(unsigned long pfn)
47 int nid = pfn_to_nid(pfn);
49 if (nid >= 0)
50 return (pfn < node_end_pfn(nid));
51 return 0;
54 /* Information on the NUMA nodes that we compute early */
55 extern unsigned long node_start_pfn[];
56 extern unsigned long node_end_pfn[];
57 extern unsigned long node_memmap_pfn[];
58 extern unsigned long node_percpu_pfn[];
59 extern unsigned long node_free_pfn[];
60 #ifdef CONFIG_HIGHMEM
61 extern unsigned long node_lowmem_end_pfn[];
62 #endif
63 #ifdef CONFIG_PCI
64 extern unsigned long pci_reserve_start_pfn;
65 extern unsigned long pci_reserve_end_pfn;
66 #endif
68 #endif /* CONFIG_DISCONTIGMEM */
70 #endif /* _ASM_TILE_MMZONE_H */