All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Expose underlying UEFI firmware platform size to userland
@ 2015-01-09 15:29 Steve McIntyre
       [not found] ` <1420817394-12922-1-git-send-email-steve-nt0JYOx6u4DQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Steve McIntyre @ 2015-01-09 15:29 UTC (permalink / raw)
  To: linux-efi-u79uwXL29TY76Z2rM5mHXA
  Cc: matt.fleming-ral2JQCrhuEAvxtiuMwx3w,
	mjg59-1xO5oi07KQx4cg9Nei1l7Q, Steve McIntyre

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-nt0JYOx6u4DQT0dZR+AlfA@public.gmane.org>
---
 drivers/firmware/efi/efi.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index 9035c1b..4495e3e 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -115,15 +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,
 };
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Expose underlying UEFI firmware platform size to userland
       [not found] ` <1420817394-12922-1-git-send-email-steve-nt0JYOx6u4DQT0dZR+AlfA@public.gmane.org>
@ 2015-01-12 11:50   ` Matt Fleming
  0 siblings, 0 replies; 2+ messages in thread
From: Matt Fleming @ 2015-01-12 11:50 UTC (permalink / raw)
  To: Steve McIntyre
  Cc: linux-efi-u79uwXL29TY76Z2rM5mHXA,
	matt.fleming-ral2JQCrhuEAvxtiuMwx3w,
	mjg59-1xO5oi07KQx4cg9Nei1l7Q

On Fri, 09 Jan, at 03:29:53PM, Steve McIntyre wrote:
> 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-nt0JYOx6u4DQT0dZR+AlfA@public.gmane.org>
> ---
>  drivers/firmware/efi/efi.c |    9 +++++++++
>  1 file changed, 9 insertions(+)
 
Looks good to me, Steve! Applied to 'next' for v3.20.

-- 
Matt Fleming, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-12 11:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-09 15:29 [PATCH] Expose underlying UEFI firmware platform size to userland Steve McIntyre
     [not found] ` <1420817394-12922-1-git-send-email-steve-nt0JYOx6u4DQT0dZR+AlfA@public.gmane.org>
2015-01-12 11:50   ` Matt Fleming

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.