]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
x86: add early_memremap()
authorJeremy Fitzhardinge <jeremy@goop.org>
Sun, 7 Sep 2008 22:21:15 +0000 (15:21 -0700)
committerIngo Molnar <mingo@elte.hu>
Mon, 13 Oct 2008 08:21:01 +0000 (10:21 +0200)
early_ioremap() is also used to map normal memory when constructing
the linear memory mapping.  However, since we sometimes need to be able
to distinguish between actual IO mappings and normal memory mappings,
add a early_memremap() call, which maps with PAGE_KERNEL (as opposed
to PAGE_KERNEL_IO for early_ioremap()), and use it when constructing
pagetables.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/mm/init_64.c
arch/x86/mm/ioremap.c
include/asm-x86/io.h

index dec5c775e92b14208b3010c0744950c5b912ac0c..5beb89683453472b3aff8674888ef3528ac05fb8 100644 (file)
@@ -313,7 +313,7 @@ static __ref void *alloc_low_page(unsigned long *phys)
        if (pfn >= table_top)
                panic("alloc_low_page: ran out of memory");
 
-       adr = early_ioremap(pfn * PAGE_SIZE, PAGE_SIZE);
+       adr = early_memremap(pfn * PAGE_SIZE, PAGE_SIZE);
        memset(adr, 0, PAGE_SIZE);
        *phys  = pfn * PAGE_SIZE;
        return adr;
index 43c3b6896cd66ef8538daae143fa847d84e4607a..7fb737c6b54f1b6edb005cbfa28a55da45556e8d 100644 (file)
@@ -568,12 +568,12 @@ static void __init __early_set_fixmap(enum fixed_addresses idx,
 }
 
 static inline void __init early_set_fixmap(enum fixed_addresses idx,
-                                       unsigned long phys)
+                                          unsigned long phys, pgprot_t prot)
 {
        if (after_paging_init)
-               set_fixmap(idx, phys);
+               __set_fixmap(idx, phys, prot);
        else
-               __early_set_fixmap(idx, phys, PAGE_KERNEL);
+               __early_set_fixmap(idx, phys, prot);
 }
 
 static inline void __init early_clear_fixmap(enum fixed_addresses idx)
@@ -601,7 +601,7 @@ static int __init check_early_ioremap_leak(void)
 }
 late_initcall(check_early_ioremap_leak);
 
-void __init *early_ioremap(unsigned long phys_addr, unsigned long size)
+static void __init *__early_ioremap(unsigned long phys_addr, unsigned long size, pgprot_t prot)
 {
        unsigned long offset, last_addr;
        unsigned int nrpages, nesting;
@@ -650,7 +650,7 @@ void __init *early_ioremap(unsigned long phys_addr, unsigned long size)
        idx0 = FIX_BTMAP_BEGIN - NR_FIX_BTMAPS*nesting;
        idx = idx0;
        while (nrpages > 0) {
-               early_set_fixmap(idx, phys_addr);
+               early_set_fixmap(idx, phys_addr, prot);
                phys_addr += PAGE_SIZE;
                --idx;
                --nrpages;
@@ -661,6 +661,18 @@ void __init *early_ioremap(unsigned long phys_addr, unsigned long size)
        return (void *) (offset + fix_to_virt(idx0));
 }
 
+/* Remap an IO device */
+void __init *early_ioremap(unsigned long phys_addr, unsigned long size)
+{
+       return __early_ioremap(phys_addr, size, PAGE_KERNEL_IO);
+}
+
+/* Remap memory */
+void __init *early_memremap(unsigned long phys_addr, unsigned long size)
+{
+       return __early_ioremap(phys_addr, size, PAGE_KERNEL);
+}
+
 void __init early_iounmap(void *addr, unsigned long size)
 {
        unsigned long virt_addr;
index e091f3949eca2ce80a426357fdd70f97e26e43a2..a233f835e0b52a49ed02077409a7e52de22aa9a0 100644 (file)
@@ -83,6 +83,7 @@ extern void early_ioremap_init(void);
 extern void early_ioremap_clear(void);
 extern void early_ioremap_reset(void);
 extern void *early_ioremap(unsigned long offset, unsigned long size);
+extern void *early_memremap(unsigned long offset, unsigned long size);
 extern void early_iounmap(void *addr, unsigned long size);
 extern void __iomem *fix_ioremap(unsigned idx, unsigned long phys);