Skip to content

Commit d31655b

Browse files
Duncan Lauriegregkh
authored andcommitted
gsmi: Remove autoselected dependency on EFI and EFI_VARS
Instead of selecting EFI and EFI_VARS automatically when GSMI is enabled let that portion of the driver be conditionally compiled if EFI and EFI_VARS are enabled. This allows the rest of the driver (specifically event log) to be used if EFI_VARS is not enabled. To test: 1) verify that EFI_VARS is not automatically selected when CONFIG_GOOGLE_GSMI is enabled 2) verify that the kernel boots on Link and that GSMI event log is still available and functional 3) specifically boot the kernel on Alex to ensure it does not try to load efivars and that gsmi also does not load because it is not in the supported DMI table Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Olof Johansson <olofj@chromium.org> Signed-off-by: Benson Leung <bleung@chromium.org> Signed-off-by: Ben Zhang <benzh@chromium.org> Signed-off-by: Filipe Brandenburger <filbranden@chromium.org> Signed-off-by: Furquan Shaikh <furquan@google.com> Tested-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> [zwisler: update changelog for upstream] Signed-off-by: Ross Zwisler <zwisler@google.com> Reviewed-by: Guenter Roeck <groeck@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 255d744 commit d31655b

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

drivers/firmware/google/Kconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ if GOOGLE_FIRMWARE
1010

1111
config GOOGLE_SMI
1212
tristate "SMI interface for Google platforms"
13-
depends on X86 && ACPI && DMI && EFI
14-
select EFI_VARS
13+
depends on X86 && ACPI && DMI
1514
help
1615
Say Y here if you want to enable SMI callbacks for Google
1716
platforms. This provides an interface for writing to and
18-
clearing the EFI event log and reading and writing NVRAM
17+
clearing the event log. If EFI_VARS is also enabled this
18+
driver provides an interface for reading and writing NVRAM
1919
variables.
2020

2121
config GOOGLE_COREBOOT_TABLE

drivers/firmware/google/gsmi.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,10 @@ static int gsmi_exec(u8 func, u8 sub)
289289
return rc;
290290
}
291291

292+
#ifdef CONFIG_EFI_VARS
293+
294+
static struct efivars efivars;
295+
292296
static efi_status_t gsmi_get_variable(efi_char16_t *name,
293297
efi_guid_t *vendor, u32 *attr,
294298
unsigned long *data_size,
@@ -466,6 +470,8 @@ static const struct efivar_operations efivar_ops = {
466470
.get_next_variable = gsmi_get_next_variable,
467471
};
468472

473+
#endif /* CONFIG_EFI_VARS */
474+
469475
static ssize_t eventlog_write(struct file *filp, struct kobject *kobj,
470476
struct bin_attribute *bin_attr,
471477
char *buf, loff_t pos, size_t count)
@@ -767,7 +773,6 @@ static __init int gsmi_system_valid(void)
767773
}
768774

769775
static struct kobject *gsmi_kobj;
770-
static struct efivars efivars;
771776

772777
static const struct platform_device_info gsmi_dev_info = {
773778
.name = "gsmi",
@@ -891,11 +896,14 @@ static __init int gsmi_init(void)
891896
goto out_remove_bin_file;
892897
}
893898

899+
#ifdef CONFIG_EFI_VARS
894900
ret = efivars_register(&efivars, &efivar_ops, gsmi_kobj);
895901
if (ret) {
896902
printk(KERN_INFO "gsmi: Failed to register efivars\n");
897-
goto out_remove_sysfs_files;
903+
sysfs_remove_files(gsmi_kobj, gsmi_attrs);
904+
goto out_remove_bin_file;
898905
}
906+
#endif
899907

900908
register_reboot_notifier(&gsmi_reboot_notifier);
901909
register_die_notifier(&gsmi_die_notifier);
@@ -906,8 +914,6 @@ static __init int gsmi_init(void)
906914

907915
return 0;
908916

909-
out_remove_sysfs_files:
910-
sysfs_remove_files(gsmi_kobj, gsmi_attrs);
911917
out_remove_bin_file:
912918
sysfs_remove_bin_file(gsmi_kobj, &eventlog_bin_attr);
913919
out_err:
@@ -927,7 +933,9 @@ static void __exit gsmi_exit(void)
927933
unregister_die_notifier(&gsmi_die_notifier);
928934
atomic_notifier_chain_unregister(&panic_notifier_list,
929935
&gsmi_panic_notifier);
936+
#ifdef CONFIG_EFI_VARS
930937
efivars_unregister(&efivars);
938+
#endif
931939

932940
sysfs_remove_files(gsmi_kobj, gsmi_attrs);
933941
sysfs_remove_bin_file(gsmi_kobj, &eventlog_bin_attr);

0 commit comments

Comments
 (0)