Commit d31655ba authored by Duncan Laurie's avatar Duncan Laurie Committed by Greg Kroah-Hartman
Browse files

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: default avatarDuncan Laurie <dlaurie@chromium.org>
Reviewed-by: default avatarOlof Johansson <olofj@chromium.org>
Signed-off-by: default avatarBenson Leung <bleung@chromium.org>
Signed-off-by: default avatarBen Zhang <benzh@chromium.org>
Signed-off-by: default avatarFilipe Brandenburger <filbranden@chromium.org>
Signed-off-by: default avatarFurquan Shaikh <furquan@google.com>
Tested-by: default avatarFurquan Shaikh <furquan@chromium.org>
Reviewed-by: default avatarAaron Durbin <adurbin@chromium.org>
[zwisler: update changelog for upstream]
Signed-off-by: default avatarRoss Zwisler <zwisler@google.com>
Reviewed-by: default avatarGuenter Roeck <groeck@chromium.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 255d7447
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -10,12 +10,12 @@ if GOOGLE_FIRMWARE

config GOOGLE_SMI
	tristate "SMI interface for Google platforms"
	depends on X86 && ACPI && DMI && EFI
	select EFI_VARS
	depends on X86 && ACPI && DMI
	help
	  Say Y here if you want to enable SMI callbacks for Google
	  platforms.  This provides an interface for writing to and
	  clearing the EFI event log and reading and writing NVRAM
	  clearing the event log.  If EFI_VARS is also enabled this
	  driver provides an interface for reading and writing NVRAM
	  variables.

config GOOGLE_COREBOOT_TABLE
+12 −4
Original line number Diff line number Diff line
@@ -289,6 +289,10 @@ static int gsmi_exec(u8 func, u8 sub)
	return rc;
}

#ifdef CONFIG_EFI_VARS

static struct efivars efivars;

static efi_status_t gsmi_get_variable(efi_char16_t *name,
				      efi_guid_t *vendor, u32 *attr,
				      unsigned long *data_size,
@@ -466,6 +470,8 @@ static const struct efivar_operations efivar_ops = {
	.get_next_variable = gsmi_get_next_variable,
};

#endif /* CONFIG_EFI_VARS */

static ssize_t eventlog_write(struct file *filp, struct kobject *kobj,
			       struct bin_attribute *bin_attr,
			       char *buf, loff_t pos, size_t count)
@@ -767,7 +773,6 @@ static __init int gsmi_system_valid(void)
}

static struct kobject *gsmi_kobj;
static struct efivars efivars;

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

#ifdef CONFIG_EFI_VARS
	ret = efivars_register(&efivars, &efivar_ops, gsmi_kobj);
	if (ret) {
		printk(KERN_INFO "gsmi: Failed to register efivars\n");
		goto out_remove_sysfs_files;
		sysfs_remove_files(gsmi_kobj, gsmi_attrs);
		goto out_remove_bin_file;
	}
#endif

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

	return 0;

out_remove_sysfs_files:
	sysfs_remove_files(gsmi_kobj, gsmi_attrs);
out_remove_bin_file:
	sysfs_remove_bin_file(gsmi_kobj, &eventlog_bin_attr);
out_err:
@@ -927,7 +933,9 @@ static void __exit gsmi_exit(void)
	unregister_die_notifier(&gsmi_die_notifier);
	atomic_notifier_chain_unregister(&panic_notifier_list,
					 &gsmi_panic_notifier);
#ifdef CONFIG_EFI_VARS
	efivars_unregister(&efivars);
#endif

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