aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/mm/ioremap.c
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@goop.org>2008-09-07 18:21:15 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-13 04:21:01 -0400
commit1494177942b23b7094ca291d37e6f6263fa60fdd (patch)
tree3248808433f4d8c5ca9f11be3ff799a448a23206 /arch/x86/mm/ioremap.c
parentefc9eb20b2f5125642fc37a1dbabadc3ce5d321c (diff)
x86: add early_memremap()
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>
Diffstat (limited to 'arch/x86/mm/ioremap.c')
-rw-r--r--arch/x86/mm/ioremap.c22
1 files changed, 17 insertions, 5 deletions
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;