diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2008-01-30 07:34:05 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:34:05 -0500 |
commit | f87519e8f4f1de9b39a40e56479a7ad2443169dd (patch) | |
tree | a7397b18ae3dadde8ec6c173ffcae3948b971c44 /arch/x86 | |
parent | 3cbd09e482ade50d212511d4693bd754d4d9dd55 (diff) |
x86: introduce max_pfn_mapped
64bit uses end_pfn_map and 32bit uses max_low_pfn. There are several
files which have #ifdef'ed defines which map either to end_pfn_map or
max_low_pfn. Replace this by a universal define and clean up all the
other instances.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kernel/efi.c | 4 | ||||
-rw-r--r-- | arch/x86/mm/pageattr-test.c | 21 |
2 files changed, 9 insertions, 16 deletions
diff --git a/arch/x86/kernel/efi.c b/arch/x86/kernel/efi.c index 834ecfb41e97..57b57778bf60 100644 --- a/arch/x86/kernel/efi.c +++ b/arch/x86/kernel/efi.c | |||
@@ -396,7 +396,7 @@ static void __init runtime_code_page_mkexec(void) | |||
396 | md = p; | 396 | md = p; |
397 | end = md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT); | 397 | end = md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT); |
398 | if (md->type == EFI_RUNTIME_SERVICES_CODE && | 398 | if (md->type == EFI_RUNTIME_SERVICES_CODE && |
399 | (end >> PAGE_SHIFT) <= end_pfn_map) | 399 | (end >> PAGE_SHIFT) <= max_pfn_mapped) |
400 | change_page_attr_addr(md->virt_addr, | 400 | change_page_attr_addr(md->virt_addr, |
401 | md->num_pages, | 401 | md->num_pages, |
402 | PAGE_KERNEL_EXEC_NOCACHE); | 402 | PAGE_KERNEL_EXEC_NOCACHE); |
@@ -429,7 +429,7 @@ void __init efi_enter_virtual_mode(void) | |||
429 | continue; | 429 | continue; |
430 | end = md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT); | 430 | end = md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT); |
431 | if ((md->attribute & EFI_MEMORY_WB) && | 431 | if ((md->attribute & EFI_MEMORY_WB) && |
432 | ((end >> PAGE_SHIFT) <= end_pfn_map)) | 432 | ((end >> PAGE_SHIFT) <= max_pfn_mapped)) |
433 | md->virt_addr = (unsigned long)__va(md->phys_addr); | 433 | md->virt_addr = (unsigned long)__va(md->phys_addr); |
434 | else | 434 | else |
435 | md->virt_addr = (unsigned long) | 435 | md->virt_addr = (unsigned long) |
diff --git a/arch/x86/mm/pageattr-test.c b/arch/x86/mm/pageattr-test.c index d7a93008cc12..6a41a0f0c149 100644 --- a/arch/x86/mm/pageattr-test.c +++ b/arch/x86/mm/pageattr-test.c | |||
@@ -27,13 +27,6 @@ enum { | |||
27 | GPS = (1<<30) | 27 | GPS = (1<<30) |
28 | }; | 28 | }; |
29 | 29 | ||
30 | #ifdef CONFIG_X86_64 | ||
31 | # include <asm/proto.h> | ||
32 | # define max_mapped end_pfn_map | ||
33 | #else | ||
34 | # define max_mapped max_low_pfn | ||
35 | #endif | ||
36 | |||
37 | struct split_state { | 30 | struct split_state { |
38 | long lpg, gpg, spg, exec; | 31 | long lpg, gpg, spg, exec; |
39 | long min_exec, max_exec; | 32 | long min_exec, max_exec; |
@@ -48,7 +41,7 @@ static __init int print_split(struct split_state *s) | |||
48 | s->lpg = s->gpg = s->spg = s->exec = 0; | 41 | s->lpg = s->gpg = s->spg = s->exec = 0; |
49 | s->min_exec = ~0UL; | 42 | s->min_exec = ~0UL; |
50 | s->max_exec = 0; | 43 | s->max_exec = 0; |
51 | for (i = 0; i < max_mapped; ) { | 44 | for (i = 0; i < max_pfn_mapped; ) { |
52 | unsigned long addr = (unsigned long)__va(i << PAGE_SHIFT); | 45 | unsigned long addr = (unsigned long)__va(i << PAGE_SHIFT); |
53 | int level; | 46 | int level; |
54 | pte_t *pte; | 47 | pte_t *pte; |
@@ -97,8 +90,8 @@ static __init int print_split(struct split_state *s) | |||
97 | 90 | ||
98 | expected = (s->gpg*GPS + s->lpg*LPS)/PAGE_SIZE + s->spg + missed; | 91 | expected = (s->gpg*GPS + s->lpg*LPS)/PAGE_SIZE + s->spg + missed; |
99 | if (expected != i) { | 92 | if (expected != i) { |
100 | printk(KERN_ERR "CPA max_mapped %lu but expected %lu\n", | 93 | printk(KERN_ERR "CPA max_pfn_mapped %lu but expected %lu\n", |
101 | max_mapped, expected); | 94 | max_pfn_mapped, expected); |
102 | return 1; | 95 | return 1; |
103 | } | 96 | } |
104 | return err; | 97 | return err; |
@@ -120,22 +113,22 @@ static __init int exercise_pageattr(void) | |||
120 | 113 | ||
121 | printk(KERN_INFO "CPA exercising pageattr\n"); | 114 | printk(KERN_INFO "CPA exercising pageattr\n"); |
122 | 115 | ||
123 | bm = vmalloc((max_mapped + 7) / 8); | 116 | bm = vmalloc((max_pfn_mapped + 7) / 8); |
124 | if (!bm) { | 117 | if (!bm) { |
125 | printk(KERN_ERR "CPA Cannot vmalloc bitmap\n"); | 118 | printk(KERN_ERR "CPA Cannot vmalloc bitmap\n"); |
126 | return -ENOMEM; | 119 | return -ENOMEM; |
127 | } | 120 | } |
128 | memset(bm, 0, (max_mapped + 7) / 8); | 121 | memset(bm, 0, (max_pfn_mapped + 7) / 8); |
129 | 122 | ||
130 | failed += print_split(&sa); | 123 | failed += print_split(&sa); |
131 | srandom32(100); | 124 | srandom32(100); |
132 | 125 | ||
133 | for (i = 0; i < NTEST; i++) { | 126 | for (i = 0; i < NTEST; i++) { |
134 | unsigned long pfn = random32() % max_mapped; | 127 | unsigned long pfn = random32() % max_pfn_mapped; |
135 | 128 | ||
136 | addr[i] = (unsigned long)__va(pfn << PAGE_SHIFT); | 129 | addr[i] = (unsigned long)__va(pfn << PAGE_SHIFT); |
137 | len[i] = random32() % 100; | 130 | len[i] = random32() % 100; |
138 | len[i] = min_t(unsigned long, len[i], max_mapped - pfn - 1); | 131 | len[i] = min_t(unsigned long, len[i], max_pfn_mapped - pfn - 1); |
139 | 132 | ||
140 | if (len[i] == 0) | 133 | if (len[i] == 0) |
141 | len[i] = 1; | 134 | len[i] = 1; |