Merge tag 'efi-next' of git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/efi...
authorIngo Molnar <mingo@kernel.org>
Thu, 29 Jan 2015 18:16:40 +0000 (19:16 +0100)
committerIngo Molnar <mingo@kernel.org>
Thu, 29 Jan 2015 18:16:40 +0000 (19:16 +0100)
Pull EFI updates from Matt Fleming:

" - Move efivarfs from the misc filesystem section to pseudo filesystem,
    since that's a more logical and accurate place - Leif Lindholm

  - Update efibootmgr URL in Kconfig help - Peter Jones

  - Improve accuracy of EFI guid function names - Borislav Petkov

  - Expose firmware platform size in sysfs for the benefit of EFI boot
    loader installers and other utilities - Steve McIntyre

  - Cleanup __init annotations for arm64/efi code - Ard Biesheuvel

  - Mark the UIE as unsupported for rtc-efi - Ard Biesheuvel

  - Fix memory leak in error code path of runtime map code - Dan Carpenter

  - Improve robustness of get_memory_map() by removing assumptions on the
    size of efi_memory_desc_t (which could change in future spec
    versions) and querying the firmware instead of guessing about the
    memmap size - Ard Biesheuvel

  - Remove superfluous guid unparse calls - Ivan Khoronzhuk

  - Delete unnecessary chosen@0 DT node FDT code since was duplicated
    from code in drivers/of and is entirely unnecessary - Leif Lindholm

   There's nothing super scary, mainly cleanups, and a merge from Ricardo who
   kindly picked up some patches from the linux-efi mailing list while I
   was out on annual leave in December.

   Perhaps the biggest risk is the get_memory_map() change from Ard, which
   changes the way that both the arm64 and x86 EFI boot stub build the
   early memory map. It would be good to have it bake in linux-next for a
   while.
"

Signed-off-by: Ingo Molnar <mingo@kernel.org>
1  2 
drivers/firmware/efi/efi.c
drivers/firmware/efi/libstub/arm-stub.c
drivers/rtc/rtc-efi.c
include/linux/efi.h

index 9035c1b74d5839471445facd9100b8522c2e9dd8,23f1eca92dc4b16b4f9b07012e14d8d22b306561..fccb464928c317b14850b020cc8ce5853f32e578
@@@ -30,7 -30,6 +30,7 @@@ struct efi __read_mostly efi = 
        .acpi       = EFI_INVALID_TABLE_ADDR,
        .acpi20     = EFI_INVALID_TABLE_ADDR,
        .smbios     = EFI_INVALID_TABLE_ADDR,
 +      .smbios3    = EFI_INVALID_TABLE_ADDR,
        .sal_systab = EFI_INVALID_TABLE_ADDR,
        .boot_info  = EFI_INVALID_TABLE_ADDR,
        .hcdp       = EFI_INVALID_TABLE_ADDR,
@@@ -87,8 -86,6 +87,8 @@@ static ssize_t systab_show(struct kobje
                str += sprintf(str, "ACPI=0x%lx\n", efi.acpi);
        if (efi.smbios != EFI_INVALID_TABLE_ADDR)
                str += sprintf(str, "SMBIOS=0x%lx\n", efi.smbios);
 +      if (efi.smbios3 != EFI_INVALID_TABLE_ADDR)
 +              str += sprintf(str, "SMBIOS3=0x%lx\n", efi.smbios3);
        if (efi.hcdp != EFI_INVALID_TABLE_ADDR)
                str += sprintf(str, "HCDP=0x%lx\n", efi.hcdp);
        if (efi.boot_info != EFI_INVALID_TABLE_ADDR)
@@@ -115,15 -112,24 +115,24 @@@ EFI_ATTR_SHOW(fw_vendor)
  EFI_ATTR_SHOW(runtime);
  EFI_ATTR_SHOW(config_table);
  
+ static ssize_t fw_platform_size_show(struct kobject *kobj,
+                                    struct kobj_attribute *attr, char *buf)
+ {
+       return sprintf(buf, "%d\n", efi_enabled(EFI_64BIT) ? 64 : 32);
+ }
  static struct kobj_attribute efi_attr_fw_vendor = __ATTR_RO(fw_vendor);
  static struct kobj_attribute efi_attr_runtime = __ATTR_RO(runtime);
  static struct kobj_attribute efi_attr_config_table = __ATTR_RO(config_table);
+ static struct kobj_attribute efi_attr_fw_platform_size =
+       __ATTR_RO(fw_platform_size);
  
  static struct attribute *efi_subsys_attrs[] = {
        &efi_attr_systab.attr,
        &efi_attr_fw_vendor.attr,
        &efi_attr_runtime.attr,
        &efi_attr_config_table.attr,
+       &efi_attr_fw_platform_size.attr,
        NULL,
  };
  
@@@ -263,7 -269,6 +272,7 @@@ static __initdata efi_config_table_type
        {MPS_TABLE_GUID, "MPS", &efi.mps},
        {SAL_SYSTEM_TABLE_GUID, "SALsystab", &efi.sal_systab},
        {SMBIOS_TABLE_GUID, "SMBIOS", &efi.smbios},
 +      {SMBIOS3_TABLE_GUID, "SMBIOS 3.0", &efi.smbios3},
        {UGA_IO_PROTOCOL_GUID, "UGA", &efi.uga},
        {NULL_GUID, NULL, NULL},
  };
@@@ -272,15 -277,10 +281,10 @@@ static __init int match_config_table(ef
                                     unsigned long table,
                                     efi_config_table_type_t *table_types)
  {
-       u8 str[EFI_VARIABLE_GUID_LEN + 1];
        int i;
  
        if (table_types) {
-               efi_guid_unparse(guid, str);
                for (i = 0; efi_guidcmp(table_types[i].guid, NULL_GUID); i++) {
-                       efi_guid_unparse(&table_types[i].guid, str);
                        if (!efi_guidcmp(*guid, table_types[i].guid)) {
                                *(table_types[i].ptr) = table;
                                pr_cont(" %s=0x%lx ",
@@@ -403,8 -403,7 +407,7 @@@ static int __init fdt_find_uefi_params(
        u64 val;
        int i, len;
  
-       if (depth != 1 ||
-           (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0))
+       if (depth != 1 || strcmp(uname, "chosen") != 0)
                return 0;
  
        for (i = 0; i < ARRAY_SIZE(dt_params); i++) {
index eb48a1a1a576aa38d1be8a482b6037d302d1a060,a1fda71c425a1023fed86543112d4a588ec3fdb7..2b3814702dcf4eca12d1ece9d4773a083fa9396a
  
  #include "efistub.h"
  
- static int __init efi_secureboot_enabled(efi_system_table_t *sys_table_arg)
+ static int efi_secureboot_enabled(efi_system_table_t *sys_table_arg)
  {
-       static efi_guid_t const var_guid __initconst = EFI_GLOBAL_VARIABLE_GUID;
-       static efi_char16_t const var_name[] __initconst = {
+       static efi_guid_t const var_guid = EFI_GLOBAL_VARIABLE_GUID;
+       static efi_char16_t const var_name[] = {
                'S', 'e', 'c', 'u', 'r', 'e', 'B', 'o', 'o', 't', 0 };
  
        efi_get_variable_t *f_getvar = sys_table_arg->runtime->get_variable;
@@@ -164,7 -164,7 +164,7 @@@ efi_status_t handle_kernel_image(efi_sy
   * for both archictectures, with the arch-specific code provided in the
   * handle_kernel_image() function.
   */
- unsigned long __init efi_entry(void *handle, efi_system_table_t *sys_table,
+ unsigned long efi_entry(void *handle, efi_system_table_t *sys_table,
                               unsigned long *image_addr)
  {
        efi_loaded_image_t *image;
                        goto fail_free_cmdline;
                }
        }
 -      if (!fdt_addr)
 +
 +      if (fdt_addr) {
 +              pr_efi(sys_table, "Using DTB from command line\n");
 +      } else {
                /* Look for a device tree configuration table entry. */
                fdt_addr = (uintptr_t)get_fdt(sys_table);
 +              if (fdt_addr)
 +                      pr_efi(sys_table, "Using DTB from configuration table\n");
 +      }
 +
 +      if (!fdt_addr)
 +              pr_efi(sys_table, "Generating empty DTB\n");
  
        status = handle_cmdline_files(sys_table, image, cmdline_ptr,
                                      "initrd=", dram_base + SZ_512M,
diff --combined drivers/rtc/rtc-efi.c
index b37b0c80bd5af083ff8c779602680ab4f2a432a1,d30fb65fbffac7754eb93d585c713b3af9a203e1..cb989cd00b14260f19f3034c8f49792a9ac2d564
@@@ -218,6 -218,7 +218,7 @@@ static int __init efi_rtc_probe(struct 
        if (IS_ERR(rtc))
                return PTR_ERR(rtc);
  
+       rtc->uie_unsupported = 1;
        platform_set_drvdata(dev, rtc);
  
        return 0;
  static struct platform_driver efi_rtc_driver = {
        .driver = {
                .name = "rtc-efi",
 -              .owner = THIS_MODULE,
        },
  };
  
diff --combined include/linux/efi.h
index 0238d612750e9f14b7b5d2cb15e6560061adcc0e,d762c81e62a8331a3e8bf6d76e03ff9f5ff9a833..b674837e2b98df15b34d3351e0ac477f128c5928
@@@ -547,9 -547,6 +547,9 @@@ void efi_native_runtime_setup(void)
  #define SMBIOS_TABLE_GUID    \
      EFI_GUID(  0xeb9d2d31, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d )
  
 +#define SMBIOS3_TABLE_GUID    \
 +    EFI_GUID(  0xf2fd1544, 0x9794, 0x4a2c, 0x99, 0x2e, 0xe5, 0xbb, 0xcf, 0x20, 0xe3, 0x94 )
 +
  #define SAL_SYSTEM_TABLE_GUID    \
      EFI_GUID(  0xeb9d2d32, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d )
  
@@@ -813,8 -810,7 +813,8 @@@ extern struct efi 
        unsigned long mps;              /* MPS table */
        unsigned long acpi;             /* ACPI table  (IA64 ext 0.71) */
        unsigned long acpi20;           /* ACPI table  (ACPI 2.0) */
 -      unsigned long smbios;           /* SM BIOS table */
 +      unsigned long smbios;           /* SMBIOS table (32 bit entry point) */
 +      unsigned long smbios3;          /* SMBIOS table (64 bit entry point) */
        unsigned long sal_systab;       /* SAL system table */
        unsigned long boot_info;        /* boot info table */
        unsigned long hcdp;             /* HCDP table */
@@@ -848,7 -844,7 +848,7 @@@ efi_guidcmp (efi_guid_t left, efi_guid_
  }
  
  static inline char *
- efi_guid_unparse(efi_guid_t *guid, char *out)
+ efi_guid_to_str(efi_guid_t *guid, char *out)
  {
        sprintf(out, "%pUl", guid->b);
          return out;