]>
Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
1da177e4 LT |
2 | /* |
3 | * Written by Pat Gaughen (gone@us.ibm.com) Mar 2002 | |
4 | * | |
5 | */ | |
6 | ||
1965aae3 PA |
7 | #ifndef _ASM_X86_MMZONE_32_H |
8 | #define _ASM_X86_MMZONE_32_H | |
1da177e4 LT |
9 | |
10 | #include <asm/smp.h> | |
11 | ||
8ff8b27b | 12 | #ifdef CONFIG_NUMA |
05b79bdc AW |
13 | extern struct pglist_data *node_data[]; |
14 | #define NODE_DATA(nid) (node_data[nid]) | |
05b79bdc AW |
15 | #endif /* CONFIG_NUMA */ |
16 | ||
17 | #ifdef CONFIG_DISCONTIGMEM | |
1da177e4 LT |
18 | |
19 | /* | |
20 | * generic node memory support, the following assumptions apply: | |
21 | * | |
af901ca1 | 22 | * 1) memory comes in 64Mb contiguous chunks which are either present or not |
1da177e4 LT |
23 | * 2) we will not have more than 64Gb in total |
24 | * | |
25 | * for now assume that 64Gb is max amount of RAM for whole system | |
26 | * 64Gb / 4096bytes/page = 16777216 pages | |
27 | */ | |
28 | #define MAX_NR_PAGES 16777216 | |
d0ead157 TH |
29 | #define MAX_SECTIONS 1024 |
30 | #define PAGES_PER_SECTION (MAX_NR_PAGES/MAX_SECTIONS) | |
1da177e4 LT |
31 | |
32 | extern s8 physnode_map[]; | |
33 | ||
34 | static inline int pfn_to_nid(unsigned long pfn) | |
35 | { | |
36 | #ifdef CONFIG_NUMA | |
d0ead157 | 37 | return((int) physnode_map[(pfn) / PAGES_PER_SECTION]); |
1da177e4 LT |
38 | #else |
39 | return 0; | |
40 | #endif | |
41 | } | |
42 | ||
1da177e4 LT |
43 | static inline int pfn_valid(int pfn) |
44 | { | |
45 | int nid = pfn_to_nid(pfn); | |
46 | ||
47 | if (nid >= 0) | |
48 | return (pfn < node_end_pfn(nid)); | |
49 | return 0; | |
50 | } | |
05b79bdc | 51 | |
a26474e8 TH |
52 | #define early_pfn_valid(pfn) pfn_valid((pfn)) |
53 | ||
05b79bdc AW |
54 | #endif /* CONFIG_DISCONTIGMEM */ |
55 | ||
1965aae3 | 56 | #endif /* _ASM_X86_MMZONE_32_H */ |