Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6
[pandora-kernel.git] / arch / i386 / kernel / efi.c
index 7ec6cfa..8b40648 100644 (file)
@@ -19,7 +19,6 @@
  *     Skip non-WB memory and ignore empty memory ranges.
  */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/mm.h>
@@ -66,7 +65,7 @@ static unsigned long efi_rt_eflags;
 static DEFINE_SPINLOCK(efi_rt_lock);
 static pgd_t efi_bak_pg_dir_pointer[2];
 
-static void efi_call_phys_prelog(void)
+static void efi_call_phys_prelog(void) __acquires(efi_rt_lock)
 {
        unsigned long cr4;
        unsigned long temp;
@@ -110,7 +109,7 @@ static void efi_call_phys_prelog(void)
        load_gdt(cpu_gdt_descr);
 }
 
-static void efi_call_phys_epilog(void)
+static void efi_call_phys_epilog(void) __releases(efi_rt_lock)
 {
        unsigned long cr4;
        struct Xgt_desc_struct *cpu_gdt_descr = &per_cpu(cpu_gdt_descr, 0);
@@ -361,7 +360,7 @@ void __init efi_init(void)
         */
        c16 = (efi_char16_t *) boot_ioremap(efi.systab->fw_vendor, 2);
        if (c16) {
-               for (i = 0; i < sizeof(vendor) && *c16; ++i)
+               for (i = 0; i < (sizeof(vendor) - 1) && *c16; ++i)
                        vendor[i] = *c16++;
                vendor[i] = '\0';
        } else
@@ -381,29 +380,38 @@ void __init efi_init(void)
        if (config_tables == NULL)
                printk(KERN_ERR PFX "Could not map EFI Configuration Table!\n");
 
+       efi.mps        = EFI_INVALID_TABLE_ADDR;
+       efi.acpi       = EFI_INVALID_TABLE_ADDR;
+       efi.acpi20     = EFI_INVALID_TABLE_ADDR;
+       efi.smbios     = EFI_INVALID_TABLE_ADDR;
+       efi.sal_systab = EFI_INVALID_TABLE_ADDR;
+       efi.boot_info  = EFI_INVALID_TABLE_ADDR;
+       efi.hcdp       = EFI_INVALID_TABLE_ADDR;
+       efi.uga        = EFI_INVALID_TABLE_ADDR;
+
        for (i = 0; i < num_config_tables; i++) {
                if (efi_guidcmp(config_tables[i].guid, MPS_TABLE_GUID) == 0) {
-                       efi.mps = (void *)config_tables[i].table;
+                       efi.mps = config_tables[i].table;
                        printk(KERN_INFO " MPS=0x%lx ", config_tables[i].table);
                } else
                    if (efi_guidcmp(config_tables[i].guid, ACPI_20_TABLE_GUID) == 0) {
-                       efi.acpi20 = __va(config_tables[i].table);
+                       efi.acpi20 = config_tables[i].table;
                        printk(KERN_INFO " ACPI 2.0=0x%lx ", config_tables[i].table);
                } else
                    if (efi_guidcmp(config_tables[i].guid, ACPI_TABLE_GUID) == 0) {
-                       efi.acpi = __va(config_tables[i].table);
+                       efi.acpi = config_tables[i].table;
                        printk(KERN_INFO " ACPI=0x%lx ", config_tables[i].table);
                } else
                    if (efi_guidcmp(config_tables[i].guid, SMBIOS_TABLE_GUID) == 0) {
-                       efi.smbios = (void *) config_tables[i].table;
+                       efi.smbios = config_tables[i].table;
                        printk(KERN_INFO " SMBIOS=0x%lx ", config_tables[i].table);
                } else
                    if (efi_guidcmp(config_tables[i].guid, HCDP_TABLE_GUID) == 0) {
-                       efi.hcdp = (void *)config_tables[i].table;
+                       efi.hcdp = config_tables[i].table;
                        printk(KERN_INFO " HCDP=0x%lx ", config_tables[i].table);
                } else
                    if (efi_guidcmp(config_tables[i].guid, UGA_IO_PROTOCOL_GUID) == 0) {
-                       efi.uga = (void *)config_tables[i].table;
+                       efi.uga = config_tables[i].table;
                        printk(KERN_INFO " UGA=0x%lx ", config_tables[i].table);
                }
        }
@@ -490,8 +498,7 @@ void __init efi_enter_virtual_mode(void)
                check_range_for_systab(md);
        }
 
-       if (!efi.systab)
-               BUG();
+       BUG_ON(!efi.systab);
 
        status = phys_efi_set_virtual_address_map(
                        memmap.desc_size * memmap.nr_map,
@@ -592,8 +599,10 @@ efi_initialize_iomem_resources(struct resource *code_resource,
                res->end = res->start + ((md->num_pages << EFI_PAGE_SHIFT) - 1);
                res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
                if (request_resource(&iomem_resource, res) < 0)
-                       printk(KERN_ERR PFX "Failed to allocate res %s : 0x%lx-0x%lx\n",
-                               res->name, res->start, res->end);
+                       printk(KERN_ERR PFX "Failed to allocate res %s : "
+                               "0x%llx-0x%llx\n", res->name,
+                               (unsigned long long)res->start,
+                               (unsigned long long)res->end);
                /*
                 * We don't know which region contains kernel data so we try
                 * it repeatedly and let the resource manager test it.