From 8308c54d7e312f7a03e2ce2057d0837e6fe3843f Mon Sep 17 00:00:00 2001 From: Jeremy Fitzhardinge Date: Thu, 11 Sep 2008 01:31:50 -0700 Subject: generic: redefine resource_size_t as phys_addr_t There's no good reason why a resource_size_t shouldn't just be a physical address, so simply redefine it in terms of phys_addr_t. Signed-off-by: Jeremy Fitzhardinge Signed-off-by: Ingo Molnar --- drivers/pci/setup-bus.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'drivers') diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 1aad599816f..f250a90ee45 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -378,11 +378,10 @@ static int pbus_size_mem(struct pci_bus *bus, unsigned long mask, unsigned long align = 0; min_align = 0; for (order = 0; order <= max_order; order++) { -#ifdef CONFIG_RESOURCES_64BIT - resource_size_t align1 = 1ULL << (order + 20); -#else - resource_size_t align1 = 1U << (order + 20); -#endif + resource_size_t align1 = 1; + + align1 <<= (order + 20); + if (!align) min_align = align1; else if (ALIGN(align + min_align, min_align) < align1) -- cgit v1.2.3 From 9a22b6e76ba75fa0f3963cdec7829156d00a7173 Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Thu, 18 Sep 2008 12:50:18 +0200 Subject: dmi scan: warn about too early calls to dmi_check_system() It happened to me recently that i added a dmi_check_system() quirk in a too early codepath, and it was silently ignored because all the DMI tables and strings were still empty. As this situation is clearly a programming error / kernel bug, warn when it happens, instead of silently ignoring quirks. Signed-off-by: Ingo Molnar --- drivers/firmware/dmi_scan.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'drivers') diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index 455575be356..3e526b6d00c 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c @@ -15,6 +15,11 @@ */ static char dmi_empty_string[] = " "; +/* + * Catch too early calls to dmi_check_system(): + */ +static int dmi_initialized; + static const char * __init dmi_string_nosave(const struct dmi_header *dm, u8 s) { const u8 *bp = ((u8 *) dm) + dm->length; @@ -366,7 +371,7 @@ void __init dmi_scan_machine(void) if (efi_enabled) { if (efi.smbios == EFI_INVALID_TABLE_ADDR) - goto out; + goto error; /* This is called as a core_initcall() because it isn't * needed during early boot. This also means we can @@ -374,13 +379,13 @@ void __init dmi_scan_machine(void) */ p = dmi_ioremap(efi.smbios, 32); if (p == NULL) - goto out; + goto error; rc = dmi_present(p + 0x10); /* offset of _DMI_ string */ dmi_iounmap(p, 32); if (!rc) { dmi_available = 1; - return; + goto out; } } else { @@ -391,19 +396,22 @@ void __init dmi_scan_machine(void) */ p = dmi_ioremap(0xF0000, 0x10000); if (p == NULL) - goto out; + goto error; for (q = p; q < p + 0x10000; q += 16) { rc = dmi_present(q); if (!rc) { dmi_available = 1; dmi_iounmap(p, 0x10000); - return; + goto out; } } dmi_iounmap(p, 0x10000); } - out: printk(KERN_INFO "DMI not present or invalid.\n"); + error: + printk(KERN_INFO "DMI not present or invalid.\n"); + out: + dmi_initialized = 1; } /** @@ -424,6 +432,8 @@ int dmi_check_system(const struct dmi_system_id *list) int i, count = 0; const struct dmi_system_id *d = list; + WARN(!dmi_initialized, KERN_ERR "dmi check: not initialized yet.\n"); + while (d->ident) { for (i = 0; i < ARRAY_SIZE(d->matches); i++) { int s = d->matches[i].slot; -- cgit v1.2.3 From 15160716eea5591eb31f40fd4dba56d83bea4209 Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Fri, 26 Sep 2008 11:40:53 +0200 Subject: x86, pci-hotplug, calgary / rio: fix EBDA ioremap() IO resource and ioremap debugging uncovered this ioremap() done by drivers/pci/hotplug/ibmphp_ebda.c: initcall pci_hotplug_init+0x0/0x41 returned 0 after 3 msecs calling ibmphp_init+0x0/0x360 @ 1 ibmphpd: IBM Hot Plug PCI Controller Driver version: 0.6 resource map sanity check conflict: 0x9f800 0xaf5e7 0x9f800 0x9ffff reserved ------------[ cut here ]------------ WARNING: at arch/x86/mm/ioremap.c:175 __ioremap_caller+0x5c/0x226() Pid: 1, comm: swapper Not tainted 2.6.27-rc7-tip-00914-g347b10f-dirty #36038 [] warn_on_slowpath+0x41/0x68 [] ? __lock_acquire+0x9ba/0xa7f [] ? do_flush_tlb_all+0x0/0x59 [] ? smp_call_function_mask+0x74/0x17d [] ? do_flush_tlb_all+0x0/0x59 [] ? printk+0x1a/0x1c [] ? iomem_map_sanity_check+0x82/0x8c [] ? _read_unlock+0x22/0x25 [] ? iomem_map_sanity_check+0x82/0x8c [] ? trace_hardirqs_off+0xb/0xd [] __ioremap_caller+0x5c/0x226 [] ? trace_hardirqs_on+0xb/0xd [] ? iounmap+0x9d/0xa5 [] ioremap_nocache+0x15/0x17 [] ? ioremap+0xd/0xf [] ioremap+0xd/0xf [] ibmphp_access_ebda+0x60/0xa0e [] ibmphp_init+0xb5/0x360 [] do_one_initcall+0x57/0x138 [] ? ibmphp_init+0x0/0x360 [] ? trace_hardirqs_on+0xb/0xd [] ? __queue_work+0x2b/0x30 [] ? ibmphp_init+0x0/0x360 [] kernel_init+0x17b/0x1e2 [] ? kernel_init+0x0/0x1e2 [] kernel_thread_helper+0x7/0x10 ======================= ---[ end trace a7919e7f17c0a725 ]--- initcall ibmphp_init+0x0/0x360 returned -19 after 144 msecs calling zt5550_init+0x0/0x6a @ 1 the problem is this code: io_mem = ioremap (ebda_seg<<4, 65000); it assumes that the EBDA is 65000 bytes. But BIOS EBDA pointers are at most 1K large. _if_ the Rio code truly extends upon the customary EBDA size it needs to iounmap() this memory and ioremap() it larger, once it knows it from the generic descriptors that a Rio system is around. Signed-off-by: Ingo Molnar --- drivers/pci/hotplug/ibmphp_ebda.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/pci/hotplug/ibmphp_ebda.c b/drivers/pci/hotplug/ibmphp_ebda.c index 8467d028732..7d27631e6e6 100644 --- a/drivers/pci/hotplug/ibmphp_ebda.c +++ b/drivers/pci/hotplug/ibmphp_ebda.c @@ -276,7 +276,7 @@ int __init ibmphp_access_ebda (void) iounmap (io_mem); debug ("returned ebda segment: %x\n", ebda_seg); - io_mem = ioremap (ebda_seg<<4, 65000); + io_mem = ioremap(ebda_seg<<4, 1024); if (!io_mem ) return -ENOMEM; next_offset = 0x180; -- cgit v1.2.3