aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/mm/init_64.c2
-rw-r--r--arch/x86/mm/ioremap.c22
-rw-r--r--include/asm-x86/io.h1
3 files changed, 19 insertions, 6 deletions
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index dec5c775e92b..5beb89683453 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -313,7 +313,7 @@ static __ref void *alloc_low_page(unsigned long *phys)
313 if (pfn >= table_top) 313 if (pfn >= table_top)
314 panic("alloc_low_page: ran out of memory"); 314 panic("alloc_low_page: ran out of memory");
315 315
316 adr = early_ioremap(pfn * PAGE_SIZE, PAGE_SIZE); 316 adr = early_memremap(pfn * PAGE_SIZE, PAGE_SIZE);
317 memset(adr, 0, PAGE_SIZE); 317 memset(adr, 0, PAGE_SIZE);
318 *phys = pfn * PAGE_SIZE; 318 *phys = pfn * PAGE_SIZE;
319 return adr; 319 return adr;
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 43c3b6896cd6..7fb737c6b54f 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -568,12 +568,12 @@ static void __init __early_set_fixmap(enum fixed_addresses idx,
568} 568}
569 569
570static inline void __init early_set_fixmap(enum fixed_addresses idx, 570static inline void __init early_set_fixmap(enum fixed_addresses idx,
571 unsigned long phys) 571 unsigned long phys, pgprot_t prot)
572{ 572{
573 if (after_paging_init) 573 if (after_paging_init)
574 set_fixmap(idx, phys); 574 __set_fixmap(idx, phys, prot);
575 else 575 else
576 __early_set_fixmap(idx, phys, PAGE_KERNEL); 576 __early_set_fixmap(idx, phys, prot);
577} 577}
578 578
579static inline void __init early_clear_fixmap(enum fixed_addresses idx) 579static inline void __init early_clear_fixmap(enum fixed_addresses idx)
@@ -601,7 +601,7 @@ static int __init check_early_ioremap_leak(void)
601} 601}
602late_initcall(check_early_ioremap_leak); 602late_initcall(check_early_ioremap_leak);
603 603
604void __init *early_ioremap(unsigned long phys_addr, unsigned long size) 604static void __init *__early_ioremap(unsigned long phys_addr, unsigned long size, pgprot_t prot)
605{ 605{
606 unsigned long offset, last_addr; 606 unsigned long offset, last_addr;
607 unsigned int nrpages, nesting; 607 unsigned int nrpages, nesting;
@@ -650,7 +650,7 @@ void __init *early_ioremap(unsigned long phys_addr, unsigned long size)
650 idx0 = FIX_BTMAP_BEGIN - NR_FIX_BTMAPS*nesting; 650 idx0 = FIX_BTMAP_BEGIN - NR_FIX_BTMAPS*nesting;
651 idx = idx0; 651 idx = idx0;
652 while (nrpages > 0) { 652 while (nrpages > 0) {
653 early_set_fixmap(idx, phys_addr); 653 early_set_fixmap(idx, phys_addr, prot);
654 phys_addr += PAGE_SIZE; 654 phys_addr += PAGE_SIZE;
655 --idx; 655 --idx;
656 --nrpages; 656 --nrpages;
@@ -661,6 +661,18 @@ void __init *early_ioremap(unsigned long phys_addr, unsigned long size)
661 return (void *) (offset + fix_to_virt(idx0)); 661 return (void *) (offset + fix_to_virt(idx0));
662} 662}
663 663
664/* Remap an IO device */
665void __init *early_ioremap(unsigned long phys_addr, unsigned long size)
666{
667 return __early_ioremap(phys_addr, size, PAGE_KERNEL_IO);
668}
669
670/* Remap memory */
671void __init *early_memremap(unsigned long phys_addr, unsigned long size)
672{
673 return __early_ioremap(phys_addr, size, PAGE_KERNEL);
674}
675
664void __init early_iounmap(void *addr, unsigned long size) 676void __init early_iounmap(void *addr, unsigned long size)
665{ 677{
666 unsigned long virt_addr; 678 unsigned long virt_addr;
diff --git a/include/asm-x86/io.h b/include/asm-x86/io.h
index e091f3949eca..a233f835e0b5 100644
--- a/include/asm-x86/io.h
+++ b/include/asm-x86/io.h
@@ -83,6 +83,7 @@ extern void early_ioremap_init(void);
83extern void early_ioremap_clear(void); 83extern void early_ioremap_clear(void);
84extern void early_ioremap_reset(void); 84extern void early_ioremap_reset(void);
85extern void *early_ioremap(unsigned long offset, unsigned long size); 85extern void *early_ioremap(unsigned long offset, unsigned long size);
86extern void *early_memremap(unsigned long offset, unsigned long size);
86extern void early_iounmap(void *addr, unsigned long size); 87extern void early_iounmap(void *addr, unsigned long size);
87extern void __iomem *fix_ioremap(unsigned idx, unsigned long phys); 88extern void __iomem *fix_ioremap(unsigned idx, unsigned long phys);
88 89