diff options
author | Steve McIntyre <steve@einval.com> | 2015-01-09 10:29:53 -0500 |
---|---|---|
committer | Matt Fleming <matt.fleming@intel.com> | 2015-01-12 06:51:32 -0500 |
commit | 2859dff97e54db4795b8b7d9606cb8efcec722ff (patch) | |
tree | 91836ca6535a94c9fe92972d9c01911f5e0d79ba /drivers/firmware | |
parent | 17473c32ce23568d39b076bf56159894bea1c61f (diff) |
efi: Expose underlying UEFI firmware platform size to userland
In some cases (e.g. Intel Bay Trail machines), the kernel will happily
run in 64-bit even if the underlying UEFI firmware platform is
32-bit. That's great, but it's difficult for userland utilities like
grub-install to do the right thing in such a situation.
The kernel already knows about the size of the firmware via
efi_enabled(EFI_64BIT). Add an extra sysfs interface
/sys/firmware/efi/fw_platform_size to expose that information to
userland for low-level utilities to use.
Signed-off-by: Steve McIntyre <steve@einval.com>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'drivers/firmware')
-rw-r--r-- | drivers/firmware/efi/efi.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index ff0bbe383b31..9bdbc0533627 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c | |||
@@ -112,15 +112,24 @@ EFI_ATTR_SHOW(fw_vendor); | |||
112 | EFI_ATTR_SHOW(runtime); | 112 | EFI_ATTR_SHOW(runtime); |
113 | EFI_ATTR_SHOW(config_table); | 113 | EFI_ATTR_SHOW(config_table); |
114 | 114 | ||
115 | static ssize_t fw_platform_size_show(struct kobject *kobj, | ||
116 | struct kobj_attribute *attr, char *buf) | ||
117 | { | ||
118 | return sprintf(buf, "%d\n", efi_enabled(EFI_64BIT) ? 64 : 32); | ||
119 | } | ||
120 | |||
115 | static struct kobj_attribute efi_attr_fw_vendor = __ATTR_RO(fw_vendor); | 121 | static struct kobj_attribute efi_attr_fw_vendor = __ATTR_RO(fw_vendor); |
116 | static struct kobj_attribute efi_attr_runtime = __ATTR_RO(runtime); | 122 | static struct kobj_attribute efi_attr_runtime = __ATTR_RO(runtime); |
117 | static struct kobj_attribute efi_attr_config_table = __ATTR_RO(config_table); | 123 | static struct kobj_attribute efi_attr_config_table = __ATTR_RO(config_table); |
124 | static struct kobj_attribute efi_attr_fw_platform_size = | ||
125 | __ATTR_RO(fw_platform_size); | ||
118 | 126 | ||
119 | static struct attribute *efi_subsys_attrs[] = { | 127 | static struct attribute *efi_subsys_attrs[] = { |
120 | &efi_attr_systab.attr, | 128 | &efi_attr_systab.attr, |
121 | &efi_attr_fw_vendor.attr, | 129 | &efi_attr_fw_vendor.attr, |
122 | &efi_attr_runtime.attr, | 130 | &efi_attr_runtime.attr, |
123 | &efi_attr_config_table.attr, | 131 | &efi_attr_config_table.attr, |
132 | &efi_attr_fw_platform_size.attr, | ||
124 | NULL, | 133 | NULL, |
125 | }; | 134 | }; |
126 | 135 | ||