Extracted from an earlier patch by Eric Biederman.

Signed-off-by: Ian Campbell <[EMAIL PROTECTED]>
Cc: Thomas Gleixner <[EMAIL PROTECTED]>
Cc: Ingo Molnar <[EMAIL PROTECTED]>
Cc: H. Peter Anvin <[EMAIL PROTECTED]>
CC: James Bottomley <[EMAIL PROTECTED]>
Cc: Eric W. Biederman <[EMAIL PROTECTED]>
---
 arch/x86/mach-voyager/voyager_basic.c |   19 +++++++------------
 1 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/arch/x86/mach-voyager/voyager_basic.c 
b/arch/x86/mach-voyager/voyager_basic.c
index 6a949e4..ed41fd8 100644
--- a/arch/x86/mach-voyager/voyager_basic.c
+++ b/arch/x86/mach-voyager/voyager_basic.c
@@ -110,8 +110,9 @@ typedef struct ClickMap {
        } Entry[CLICK_ENTRIES];
 } ClickMap_t;
 
-/* This routine is pretty much an awful hack to read the bios clickmap by
- * mapping it into page 0.  There are usually three regions in the map:
+/*
+ * This routine reads the bios clickmap.  There are usually three
+ * regions in the map:
  *     Base Memory
  *     Extended Memory
  *     zero length marker for end of map
@@ -125,7 +126,6 @@ int __init voyager_memory_detect(int region, __u32 * start, 
__u32 * length)
        __u8 cmos[4];
        ClickMap_t *map;
        unsigned long map_addr;
-       unsigned long old;
 
        if (region >= CLICK_ENTRIES) {
                printk("Voyager: Illegal ClickMap region %d\n", region);
@@ -138,12 +138,8 @@ int __init voyager_memory_detect(int region, __u32 * 
start, __u32 * length)
 
        map_addr = *(unsigned long *)cmos;
 
-       /* steal page 0 for this */
-       old = pg0[0];
-       pg0[0] = ((map_addr & PAGE_MASK) | _PAGE_RW | _PAGE_PRESENT);
-       local_flush_tlb();
-       /* now clear everything out but page 0 */
-       map = (ClickMap_t *) (map_addr & (~PAGE_MASK));
+       /* Setup a temporary mapping for the clickmap */
+       map = early_ioremap(map_addr, sizeof(*map));
 
        /* zero length is the end of the clickmap */
        if (map->Entry[region].Length != 0) {
@@ -152,9 +148,8 @@ int __init voyager_memory_detect(int region, __u32 * start, 
__u32 * length)
                retval = 1;
        }
 
-       /* replace the mapping */
-       pg0[0] = old;
-       local_flush_tlb();
+       /* undo the mapping */
+       early_iounmap(map, sizeof(*map));
        return retval;
 }
 
-- 
1.5.3.8

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to