x86 32-bit boot: rename bt_ioremap() to early_ioremap()

This patch renames bt_ioremap to early_ioremap, which is used in
x86_64. This makes it easier to merge i386 and x86_64 usage.

[ mingo@elte.hu: fix ]

Signed-off-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
Huang, Ying 2008-01-30 13:33:44 +01:00 committed by Ingo Molnar
parent 4716e79c99
commit beacfaac3f
9 changed files with 50 additions and 61 deletions

View File

@ -256,12 +256,12 @@ void __init efi_init(void)
memmap.desc_version = boot_params.efi_info.efi_memdesc_version; memmap.desc_version = boot_params.efi_info.efi_memdesc_version;
memmap.desc_size = boot_params.efi_info.efi_memdesc_size; memmap.desc_size = boot_params.efi_info.efi_memdesc_size;
efi.systab = efi_early_ioremap((unsigned long)efi_phys.systab, efi.systab = early_ioremap((unsigned long)efi_phys.systab,
sizeof(efi_system_table_t)); sizeof(efi_system_table_t));
if (efi.systab == NULL) if (efi.systab == NULL)
printk(KERN_ERR "Couldn't map the EFI system table!\n"); printk(KERN_ERR "Couldn't map the EFI system table!\n");
memcpy(&efi_systab, efi.systab, sizeof(efi_system_table_t)); memcpy(&efi_systab, efi.systab, sizeof(efi_system_table_t));
efi_early_iounmap(efi.systab, sizeof(efi_system_table_t)); early_iounmap(efi.systab, sizeof(efi_system_table_t));
efi.systab = &efi_systab; efi.systab = &efi_systab;
/* /*
@ -278,14 +278,14 @@ void __init efi_init(void)
/* /*
* Show what we know for posterity * Show what we know for posterity
*/ */
c16 = tmp = efi_early_ioremap(efi.systab->fw_vendor, 2); c16 = tmp = early_ioremap(efi.systab->fw_vendor, 2);
if (c16) { if (c16) {
for (i = 0; i < sizeof(vendor) && *c16; ++i) for (i = 0; i < sizeof(vendor) && *c16; ++i)
vendor[i] = *c16++; vendor[i] = *c16++;
vendor[i] = '\0'; vendor[i] = '\0';
} else } else
printk(KERN_ERR PFX "Could not map the firmware vendor!\n"); printk(KERN_ERR PFX "Could not map the firmware vendor!\n");
efi_early_iounmap(tmp, 2); early_iounmap(tmp, 2);
printk(KERN_INFO "EFI v%u.%.02u by %s \n", printk(KERN_INFO "EFI v%u.%.02u by %s \n",
efi.systab->hdr.revision >> 16, efi.systab->hdr.revision >> 16,
@ -294,7 +294,7 @@ void __init efi_init(void)
/* /*
* Let's see what config tables the firmware passed to us. * Let's see what config tables the firmware passed to us.
*/ */
config_tables = efi_early_ioremap( config_tables = early_ioremap(
efi.systab->tables, efi.systab->tables,
efi.systab->nr_tables * sizeof(efi_config_table_t)); efi.systab->nr_tables * sizeof(efi_config_table_t));
if (config_tables == NULL) if (config_tables == NULL)
@ -328,7 +328,7 @@ void __init efi_init(void)
} }
} }
printk("\n"); printk("\n");
efi_early_iounmap(config_tables, early_iounmap(config_tables,
efi.systab->nr_tables * sizeof(efi_config_table_t)); efi.systab->nr_tables * sizeof(efi_config_table_t));
/* /*
@ -337,8 +337,8 @@ void __init efi_init(void)
* address of several of the EFI runtime functions, needed to * address of several of the EFI runtime functions, needed to
* set the firmware into virtual mode. * set the firmware into virtual mode.
*/ */
runtime = efi_early_ioremap((unsigned long)efi.systab->runtime, runtime = early_ioremap((unsigned long)efi.systab->runtime,
sizeof(efi_runtime_services_t)); sizeof(efi_runtime_services_t));
if (runtime != NULL) { if (runtime != NULL) {
/* /*
* We will only need *early* access to the following * We will only need *early* access to the following
@ -357,11 +357,11 @@ void __init efi_init(void)
} else } else
printk(KERN_ERR "Could not map the EFI runtime service " printk(KERN_ERR "Could not map the EFI runtime service "
"table!\n"); "table!\n");
efi_early_iounmap(runtime, sizeof(efi_runtime_services_t)); early_iounmap(runtime, sizeof(efi_runtime_services_t));
/* Map the EFI memory map */ /* Map the EFI memory map */
memmap.map = efi_early_ioremap((unsigned long)memmap.phys_map, memmap.map = early_ioremap((unsigned long)memmap.phys_map,
memmap.nr_map * memmap.desc_size); memmap.nr_map * memmap.desc_size);
if (memmap.map == NULL) if (memmap.map == NULL)
printk(KERN_ERR "Could not map the EFI memory map!\n"); printk(KERN_ERR "Could not map the EFI memory map!\n");
memmap.map_end = memmap.map + (memmap.nr_map * memmap.desc_size); memmap.map_end = memmap.map + (memmap.nr_map * memmap.desc_size);

View File

@ -117,7 +117,7 @@ void __init efi_map_memmap(void)
{ {
memmap.map = NULL; memmap.map = NULL;
memmap.map = bt_ioremap((unsigned long) memmap.phys_map, memmap.map = early_ioremap((unsigned long) memmap.phys_map,
(memmap.nr_map * memmap.desc_size)); (memmap.nr_map * memmap.desc_size));
if (memmap.map == NULL) if (memmap.map == NULL)
printk(KERN_ERR "Could not remap the EFI memmap!\n"); printk(KERN_ERR "Could not remap the EFI memmap!\n");

View File

@ -577,9 +577,9 @@ static void __init relocate_initrd(void)
if (clen > MAX_MAP_CHUNK-slop) if (clen > MAX_MAP_CHUNK-slop)
clen = MAX_MAP_CHUNK-slop; clen = MAX_MAP_CHUNK-slop;
mapaddr = ramdisk_image & PAGE_MASK; mapaddr = ramdisk_image & PAGE_MASK;
p = bt_ioremap(mapaddr, clen+slop); p = early_ioremap(mapaddr, clen+slop);
memcpy(q, p+slop, clen); memcpy(q, p+slop, clen);
bt_iounmap(p, clen+slop); early_iounmap(p, clen+slop);
q += clen; q += clen;
ramdisk_image += clen; ramdisk_image += clen;
ramdisk_size -= clen; ramdisk_size -= clen;
@ -697,7 +697,7 @@ void __init setup_arch(char **cmdline_p)
memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data)); memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data));
pre_setup_arch_hook(); pre_setup_arch_hook();
early_cpu_init(); early_cpu_init();
bt_ioremap_init(); early_ioremap_init();
#ifdef CONFIG_EFI #ifdef CONFIG_EFI
if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature, if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,

View File

@ -297,7 +297,7 @@ int __init get_memcfg_from_srat(void)
} }
rsdt = (struct acpi_table_rsdt *) rsdt = (struct acpi_table_rsdt *)
bt_ioremap(rsdp->rsdt_physical_address, sizeof(struct acpi_table_rsdt)); early_ioremap(rsdp->rsdt_physical_address, sizeof(struct acpi_table_rsdt));
if (!rsdt) { if (!rsdt) {
printk(KERN_WARNING printk(KERN_WARNING
@ -337,11 +337,11 @@ int __init get_memcfg_from_srat(void)
for (i = 0; i < tables; i++) { for (i = 0; i < tables; i++) {
/* Map in header, then map in full table length. */ /* Map in header, then map in full table length. */
header = (struct acpi_table_header *) header = (struct acpi_table_header *)
bt_ioremap(saved_rsdt.table.table_offset_entry[i], sizeof(struct acpi_table_header)); early_ioremap(saved_rsdt.table.table_offset_entry[i], sizeof(struct acpi_table_header));
if (!header) if (!header)
break; break;
header = (struct acpi_table_header *) header = (struct acpi_table_header *)
bt_ioremap(saved_rsdt.table.table_offset_entry[i], header->length); early_ioremap(saved_rsdt.table.table_offset_entry[i], header->length);
if (!header) if (!header)
break; break;

View File

@ -429,11 +429,11 @@ static void __init pagetable_init (void)
* Fixed mappings, only the page table structure has to be * Fixed mappings, only the page table structure has to be
* created - mappings will be set by set_fixmap(): * created - mappings will be set by set_fixmap():
*/ */
bt_ioremap_clear(); early_ioremap_clear();
vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK; vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK;
end = (FIXADDR_TOP + PMD_SIZE - 1) & PMD_MASK; end = (FIXADDR_TOP + PMD_SIZE - 1) & PMD_MASK;
page_table_range_init(vaddr, end, pgd_base); page_table_range_init(vaddr, end, pgd_base);
bt_ioremap_reset(); early_ioremap_reset();
permanent_kmaps_init(pgd_base); permanent_kmaps_init(pgd_base);

View File

@ -212,36 +212,36 @@ static __initdata int after_paging_init;
static __initdata unsigned long bm_pte[1024] static __initdata unsigned long bm_pte[1024]
__attribute__((aligned(PAGE_SIZE))); __attribute__((aligned(PAGE_SIZE)));
static inline unsigned long * __init bt_ioremap_pgd(unsigned long addr) static inline unsigned long * __init early_ioremap_pgd(unsigned long addr)
{ {
return (unsigned long *)swapper_pg_dir + ((addr >> 22) & 1023); return (unsigned long *)swapper_pg_dir + ((addr >> 22) & 1023);
} }
static inline unsigned long * __init bt_ioremap_pte(unsigned long addr) static inline unsigned long * __init early_ioremap_pte(unsigned long addr)
{ {
return bm_pte + ((addr >> PAGE_SHIFT) & 1023); return bm_pte + ((addr >> PAGE_SHIFT) & 1023);
} }
void __init bt_ioremap_init(void) void __init early_ioremap_init(void)
{ {
unsigned long *pgd; unsigned long *pgd;
pgd = bt_ioremap_pgd(fix_to_virt(FIX_BTMAP_BEGIN)); pgd = early_ioremap_pgd(fix_to_virt(FIX_BTMAP_BEGIN));
*pgd = __pa(bm_pte) | _PAGE_TABLE; *pgd = __pa(bm_pte) | _PAGE_TABLE;
memset(bm_pte, 0, sizeof(bm_pte)); memset(bm_pte, 0, sizeof(bm_pte));
BUG_ON(pgd != bt_ioremap_pgd(fix_to_virt(FIX_BTMAP_END))); BUG_ON(pgd != early_ioremap_pgd(fix_to_virt(FIX_BTMAP_END)));
} }
void __init bt_ioremap_clear(void) void __init early_ioremap_clear(void)
{ {
unsigned long *pgd; unsigned long *pgd;
pgd = bt_ioremap_pgd(fix_to_virt(FIX_BTMAP_BEGIN)); pgd = early_ioremap_pgd(fix_to_virt(FIX_BTMAP_BEGIN));
*pgd = 0; *pgd = 0;
__flush_tlb_all(); __flush_tlb_all();
} }
void __init bt_ioremap_reset(void) void __init early_ioremap_reset(void)
{ {
enum fixed_addresses idx; enum fixed_addresses idx;
unsigned long *pte, phys, addr; unsigned long *pte, phys, addr;
@ -249,7 +249,7 @@ void __init bt_ioremap_reset(void)
after_paging_init = 1; after_paging_init = 1;
for (idx = FIX_BTMAP_BEGIN; idx <= FIX_BTMAP_END; idx--) { for (idx = FIX_BTMAP_BEGIN; idx <= FIX_BTMAP_END; idx--) {
addr = fix_to_virt(idx); addr = fix_to_virt(idx);
pte = bt_ioremap_pte(addr); pte = early_ioremap_pte(addr);
if (!*pte & _PAGE_PRESENT) { if (!*pte & _PAGE_PRESENT) {
phys = *pte & PAGE_MASK; phys = *pte & PAGE_MASK;
set_fixmap(idx, phys); set_fixmap(idx, phys);
@ -257,7 +257,7 @@ void __init bt_ioremap_reset(void)
} }
} }
static void __init __bt_set_fixmap(enum fixed_addresses idx, static void __init __early_set_fixmap(enum fixed_addresses idx,
unsigned long phys, pgprot_t flags) unsigned long phys, pgprot_t flags)
{ {
unsigned long *pte, addr = __fix_to_virt(idx); unsigned long *pte, addr = __fix_to_virt(idx);
@ -266,7 +266,7 @@ static void __init __bt_set_fixmap(enum fixed_addresses idx,
BUG(); BUG();
return; return;
} }
pte = bt_ioremap_pte(addr); pte = early_ioremap_pte(addr);
if (pgprot_val(flags)) if (pgprot_val(flags))
*pte = (phys & PAGE_MASK) | pgprot_val(flags); *pte = (phys & PAGE_MASK) | pgprot_val(flags);
else else
@ -274,24 +274,24 @@ static void __init __bt_set_fixmap(enum fixed_addresses idx,
__flush_tlb_one(addr); __flush_tlb_one(addr);
} }
static inline void __init bt_set_fixmap(enum fixed_addresses idx, static inline void __init early_set_fixmap(enum fixed_addresses idx,
unsigned long phys) unsigned long phys)
{ {
if (after_paging_init) if (after_paging_init)
set_fixmap(idx, phys); set_fixmap(idx, phys);
else else
__bt_set_fixmap(idx, phys, PAGE_KERNEL); __early_set_fixmap(idx, phys, PAGE_KERNEL);
} }
static inline void __init bt_clear_fixmap(enum fixed_addresses idx) static inline void __init early_clear_fixmap(enum fixed_addresses idx)
{ {
if (after_paging_init) if (after_paging_init)
clear_fixmap(idx); clear_fixmap(idx);
else else
__bt_set_fixmap(idx, 0, __pgprot(0)); __early_set_fixmap(idx, 0, __pgprot(0));
} }
void __init *bt_ioremap(unsigned long phys_addr, unsigned long size) void __init *early_ioremap(unsigned long phys_addr, unsigned long size)
{ {
unsigned long offset, last_addr; unsigned long offset, last_addr;
unsigned int nrpages; unsigned int nrpages;
@ -327,7 +327,7 @@ void __init *bt_ioremap(unsigned long phys_addr, unsigned long size)
*/ */
idx = FIX_BTMAP_BEGIN; idx = FIX_BTMAP_BEGIN;
while (nrpages > 0) { while (nrpages > 0) {
bt_set_fixmap(idx, phys_addr); early_set_fixmap(idx, phys_addr);
phys_addr += PAGE_SIZE; phys_addr += PAGE_SIZE;
--idx; --idx;
--nrpages; --nrpages;
@ -335,7 +335,7 @@ void __init *bt_ioremap(unsigned long phys_addr, unsigned long size)
return (void*) (offset + fix_to_virt(FIX_BTMAP_BEGIN)); return (void*) (offset + fix_to_virt(FIX_BTMAP_BEGIN));
} }
void __init bt_iounmap(void *addr, unsigned long size) void __init early_iounmap(void *addr, unsigned long size)
{ {
unsigned long virt_addr; unsigned long virt_addr;
unsigned long offset; unsigned long offset;
@ -350,7 +350,7 @@ void __init bt_iounmap(void *addr, unsigned long size)
idx = FIX_BTMAP_BEGIN; idx = FIX_BTMAP_BEGIN;
while (nrpages > 0) { while (nrpages > 0) {
bt_clear_fixmap(idx); early_clear_fixmap(idx);
--idx; --idx;
--nrpages; --nrpages;
} }

View File

@ -5,9 +5,6 @@
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
/* Use early IO mappings for DMI because it's initialized early */
#define dmi_ioremap bt_ioremap
#define dmi_iounmap bt_iounmap
#define dmi_alloc alloc_bootmem #define dmi_alloc alloc_bootmem
#else /* CONFIG_X86_32 */ #else /* CONFIG_X86_32 */
@ -28,9 +25,9 @@ static inline void *dmi_alloc(unsigned len)
return dmi_alloc_data + idx; return dmi_alloc_data + idx;
} }
#endif
#define dmi_ioremap early_ioremap #define dmi_ioremap early_ioremap
#define dmi_iounmap early_iounmap #define dmi_iounmap early_iounmap
#endif #endif
#endif

View File

@ -33,9 +33,6 @@ extern unsigned long asmlinkage efi_call_phys(void *, ...);
#define efi_call_virt6(f, a1, a2, a3, a4, a5, a6) \ #define efi_call_virt6(f, a1, a2, a3, a4, a5, a6) \
efi_call_virt(f, a1, a2, a3, a4, a5, a6) efi_call_virt(f, a1, a2, a3, a4, a5, a6)
#define efi_early_ioremap(addr, size) bt_ioremap(addr, size)
#define efi_early_iounmap(vaddr, size) bt_iounmap(vaddr, size)
#define efi_ioremap(addr, size) ioremap(addr, size) #define efi_ioremap(addr, size) ioremap(addr, size)
#define end_pfn_map max_low_pfn #define end_pfn_map max_low_pfn
@ -91,13 +88,8 @@ extern u64 efi_call6(void *fp, u64 arg1, u64 arg2, u64 arg3,
efi_call6((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \ efi_call6((void *)(efi.systab->runtime->f), (u64)(a1), (u64)(a2), \
(u64)(a3), (u64)(a4), (u64)(a5), (u64)(a6)) (u64)(a3), (u64)(a4), (u64)(a5), (u64)(a6))
#define efi_early_ioremap(addr, size) early_ioremap(addr, size)
#define efi_early_iounmap(vaddr, size) early_iounmap(vaddr, size)
extern void *efi_ioremap(unsigned long offset, unsigned long size); extern void *efi_ioremap(unsigned long offset, unsigned long size);
extern int efi_time;
#endif /* CONFIG_X86_32 */ #endif /* CONFIG_X86_32 */
extern void efi_reserve_bootmem(void); extern void efi_reserve_bootmem(void);

View File

@ -135,20 +135,20 @@ static inline void __iomem * ioremap(unsigned long offset, unsigned long size)
extern void iounmap(volatile void __iomem *addr); extern void iounmap(volatile void __iomem *addr);
/* /*
* bt_ioremap() and bt_iounmap() are for temporary early boot-time * early_ioremap() and early_iounmap() are for temporary early boot-time
* mappings, before the real ioremap() is functional. * mappings, before the real ioremap() is functional.
* A boot-time mapping is currently limited to at most 16 pages. * A boot-time mapping is currently limited to at most 16 pages.
*/ */
extern void bt_ioremap_init(void); extern void early_ioremap_init(void);
extern void bt_ioremap_clear(void); extern void early_ioremap_clear(void);
extern void bt_ioremap_reset(void); extern void early_ioremap_reset(void);
extern void *bt_ioremap(unsigned long offset, unsigned long size); extern void *early_ioremap(unsigned long offset, unsigned long size);
extern void bt_iounmap(void *addr, unsigned long size); extern void early_iounmap(void *addr, unsigned long size);
extern void __iomem *fix_ioremap(unsigned idx, unsigned long phys); extern void __iomem *fix_ioremap(unsigned idx, unsigned long phys);
/* Use early IO mappings for DMI because it's initialized early */ /* Use early IO mappings for DMI because it's initialized early */
#define dmi_ioremap bt_ioremap #define dmi_ioremap early_ioremap
#define dmi_iounmap bt_iounmap #define dmi_iounmap early_iounmap
#define dmi_alloc alloc_bootmem #define dmi_alloc alloc_bootmem
/* /*