tree-wide: fix assorted typos all over the place
[linux-2.6-block.git] / arch / x86 / include / asm / mmzone_32.h
CommitLineData
1da177e4
LT
1/*
2 * Written by Pat Gaughen (gone@us.ibm.com) Mar 2002
3 *
4 */
5
1965aae3
PA
6#ifndef _ASM_X86_MMZONE_32_H
7#define _ASM_X86_MMZONE_32_H
1da177e4
LT
8
9#include <asm/smp.h>
10
8ff8b27b 11#ifdef CONFIG_NUMA
05b79bdc
AW
12extern struct pglist_data *node_data[];
13#define NODE_DATA(nid) (node_data[nid])
1da177e4 14
d49c4288
YL
15#include <asm/numaq.h>
16/* summit or generic arch */
17#include <asm/srat.h>
1da177e4 18
7491d33d 19extern int get_memcfg_numa_flat(void);
05b79bdc
AW
20/*
21 * This allows any one NUMA architecture to be compiled
22 * for, and still fall back to the flat function if it
23 * fails.
24 */
25static inline void get_memcfg_numa(void)
26{
d49c4288 27
05b79bdc
AW
28 if (get_memcfg_numaq())
29 return;
05b79bdc
AW
30 if (get_memcfg_from_srat())
31 return;
05b79bdc
AW
32 get_memcfg_numa_flat();
33}
34
97a70e54
RW
35extern void resume_map_numa_kva(pgd_t *pgd);
36
8ff8b27b 37#else /* !CONFIG_NUMA */
91023300 38
8ff8b27b 39#define get_memcfg_numa get_memcfg_numa_flat
91023300 40
97a70e54
RW
41static inline void resume_map_numa_kva(pgd_t *pgd) {}
42
05b79bdc
AW
43#endif /* CONFIG_NUMA */
44
45#ifdef CONFIG_DISCONTIGMEM
1da177e4
LT
46
47/*
48 * generic node memory support, the following assumptions apply:
49 *
af901ca1 50 * 1) memory comes in 64Mb contiguous chunks which are either present or not
1da177e4
LT
51 * 2) we will not have more than 64Gb in total
52 *
53 * for now assume that 64Gb is max amount of RAM for whole system
54 * 64Gb / 4096bytes/page = 16777216 pages
55 */
56#define MAX_NR_PAGES 16777216
ba924c81 57#define MAX_ELEMENTS 1024
1da177e4
LT
58#define PAGES_PER_ELEMENT (MAX_NR_PAGES/MAX_ELEMENTS)
59
60extern s8 physnode_map[];
61
62static inline int pfn_to_nid(unsigned long pfn)
63{
64#ifdef CONFIG_NUMA
65 return((int) physnode_map[(pfn) / PAGES_PER_ELEMENT]);
66#else
67 return 0;
68#endif
69}
70
1da177e4
LT
71/*
72 * Following are macros that each numa implmentation must define.
73 */
74
1da177e4
LT
75#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
76#define node_end_pfn(nid) \
77({ \
78 pg_data_t *__pgdat = NODE_DATA(nid); \
79 __pgdat->node_start_pfn + __pgdat->node_spanned_pages; \
80})
81
1da177e4
LT
82static inline int pfn_valid(int pfn)
83{
84 int nid = pfn_to_nid(pfn);
85
86 if (nid >= 0)
87 return (pfn < node_end_pfn(nid));
88 return 0;
89}
05b79bdc
AW
90
91#endif /* CONFIG_DISCONTIGMEM */
92
93#ifdef CONFIG_NEED_MULTIPLE_NODES
c1329375 94/* always use node 0 for bootmem on this numa platform */
d0c4f570
TH
95#define bootmem_arch_preferred_node(__bdata, size, align, goal, limit) \
96 (NODE_DATA(0)->bdata)
05b79bdc 97#endif /* CONFIG_NEED_MULTIPLE_NODES */
b159d43f 98
1965aae3 99#endif /* _ASM_X86_MMZONE_32_H */