x86: introduce max_pfn_mapped
authorThomas Gleixner <tglx@linutronix.de>
Wed, 30 Jan 2008 12:34:05 +0000 (13:34 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 30 Jan 2008 12:34:05 +0000 (13:34 +0100)
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>
arch/x86/kernel/efi.c
arch/x86/mm/pageattr-test.c
include/asm-x86/efi.h
include/asm-x86/page.h

index 834ecfb41e974f8c6ce63d2cc89d577489003bcd..57b57778bf60d1adc74b075e83c9867beb9219b6 100644 (file)
@@ -396,7 +396,7 @@ static void __init runtime_code_page_mkexec(void)
                md = p;
                end = md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT);
                if (md->type == EFI_RUNTIME_SERVICES_CODE &&
-                   (end >> PAGE_SHIFT) <= end_pfn_map)
+                   (end >> PAGE_SHIFT) <= max_pfn_mapped)
                        change_page_attr_addr(md->virt_addr,
                                              md->num_pages,
                                              PAGE_KERNEL_EXEC_NOCACHE);
@@ -429,7 +429,7 @@ void __init efi_enter_virtual_mode(void)
                        continue;
                end = md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT);
                if ((md->attribute & EFI_MEMORY_WB) &&
-                   ((end >> PAGE_SHIFT) <= end_pfn_map))
+                   ((end >> PAGE_SHIFT) <= max_pfn_mapped))
                        md->virt_addr = (unsigned long)__va(md->phys_addr);
                else
                        md->virt_addr = (unsigned long)
index d7a93008cc12ec5598d28fc9cfd9c8e72601b3dc..6a41a0f0c14998afb5c4edca18e5a7025905c744 100644 (file)
@@ -27,13 +27,6 @@ enum {
        GPS                     = (1<<30)
 };
 
-#ifdef CONFIG_X86_64
-# include <asm/proto.h>
-# define max_mapped            end_pfn_map
-#else
-# define max_mapped            max_low_pfn
-#endif
-
 struct split_state {
        long lpg, gpg, spg, exec;
        long min_exec, max_exec;
@@ -48,7 +41,7 @@ static __init int print_split(struct split_state *s)
        s->lpg = s->gpg = s->spg = s->exec = 0;
        s->min_exec = ~0UL;
        s->max_exec = 0;
-       for (i = 0; i < max_mapped; ) {
+       for (i = 0; i < max_pfn_mapped; ) {
                unsigned long addr = (unsigned long)__va(i << PAGE_SHIFT);
                int level;
                pte_t *pte;
@@ -97,8 +90,8 @@ static __init int print_split(struct split_state *s)
 
        expected = (s->gpg*GPS + s->lpg*LPS)/PAGE_SIZE + s->spg + missed;
        if (expected != i) {
-               printk(KERN_ERR "CPA max_mapped %lu but expected %lu\n",
-                       max_mapped, expected);
+               printk(KERN_ERR "CPA max_pfn_mapped %lu but expected %lu\n",
+                       max_pfn_mapped, expected);
                return 1;
        }
        return err;
@@ -120,22 +113,22 @@ static __init int exercise_pageattr(void)
 
        printk(KERN_INFO "CPA exercising pageattr\n");
 
-       bm = vmalloc((max_mapped + 7) / 8);
+       bm = vmalloc((max_pfn_mapped + 7) / 8);
        if (!bm) {
                printk(KERN_ERR "CPA Cannot vmalloc bitmap\n");
                return -ENOMEM;
        }
-       memset(bm, 0, (max_mapped + 7) / 8);
+       memset(bm, 0, (max_pfn_mapped + 7) / 8);
 
        failed += print_split(&sa);
        srandom32(100);
 
        for (i = 0; i < NTEST; i++) {
-               unsigned long pfn = random32() % max_mapped;
+               unsigned long pfn = random32() % max_pfn_mapped;
 
                addr[i] = (unsigned long)__va(pfn << PAGE_SHIFT);
                len[i] = random32() % 100;
-               len[i] = min_t(unsigned long, len[i], max_mapped - pfn - 1);
+               len[i] = min_t(unsigned long, len[i], max_pfn_mapped - pfn - 1);
 
                if (len[i] == 0)
                        len[i] = 1;
index 9e08ae84795d1d5daca6910e1f711a6359f476e4..9c68a1f098d8cb12af04bacd1564909b179aca61 100644 (file)
@@ -35,8 +35,6 @@ extern unsigned long asmlinkage efi_call_phys(void *, ...);
 
 #define efi_ioremap(addr, size)                        ioremap(addr, size)
 
-#define end_pfn_map                            max_low_pfn
-
 #else /* !CONFIG_X86_32 */
 
 #define MAX_EFI_IO_PAGES       100
index eba88d940092549ebf13d41de7a671b008ccbd93..e2c79d8dcdcf894e0c7c875965dfb0b26fa4066c 100644 (file)
 
 #ifdef CONFIG_X86_64
 #include <asm/page_64.h>
+#define max_pfn_mapped         end_pfn_map
 #else
 #include <asm/page_32.h>
+#define max_pfn_mapped         max_low_pfn
 #endif /* CONFIG_X86_64 */
 
 #define PAGE_OFFSET            ((unsigned long)__PAGE_OFFSET)