[patch 4/6] export more efi table variable to sysfs

From: dyoung
Date: Sun Oct 27 2013 - 00:01:18 EST


Export fw_vendor, runtime and config tables physical
addresses to /sys/firmware/efi/systab becaue kexec
kernel will need them.

>From EFI spec these 3 variables will be updated to
virtual address after entering virtual mode. But
kernel startup code will need the physical address.

Signed-off-by: Dave Young <dyoung@xxxxxxxxxx>
---
arch/x86/platform/efi/efi.c | 4 ++++
drivers/firmware/efi/efi.c | 9 +++++++++
include/linux/efi.h | 3 +++
3 files changed, 16 insertions(+)

--- efi.orig/drivers/firmware/efi/efi.c
+++ efi/drivers/firmware/efi/efi.c
@@ -32,6 +32,9 @@ struct efi __read_mostly efi = {
.hcdp = EFI_INVALID_TABLE_ADDR,
.uga = EFI_INVALID_TABLE_ADDR,
.uv_systab = EFI_INVALID_TABLE_ADDR,
+ .fw_vendor = EFI_INVALID_TABLE_ADDR,
+ .runtime = EFI_INVALID_TABLE_ADDR,
+ .config_tables = EFI_INVALID_TABLE_ADDR,
};
EXPORT_SYMBOL(efi);

@@ -64,6 +67,12 @@ static ssize_t systab_show(struct kobjec
str += sprintf(str, "BOOTINFO=0x%lx\n", efi.boot_info);
if (efi.uga != EFI_INVALID_TABLE_ADDR)
str += sprintf(str, "UGA=0x%lx\n", efi.uga);
+ if (efi.fw_vendor!= EFI_INVALID_TABLE_ADDR)
+ str += sprintf(str, "fw_vendor=0x%lx\n", efi.fw_vendor);
+ if (efi.runtime!= EFI_INVALID_TABLE_ADDR)
+ str += sprintf(str, "runtime=0x%lx\n", efi.runtime);
+ if (efi.config_tables != EFI_INVALID_TABLE_ADDR)
+ str += sprintf(str, "config_tables=0x%lx\n", efi.config_tables);

return str - buf;
}
--- efi.orig/include/linux/efi.h
+++ efi/include/linux/efi.h
@@ -556,6 +556,9 @@ extern struct efi {
unsigned long hcdp; /* HCDP table */
unsigned long uga; /* UGA table */
unsigned long uv_systab; /* UV system table */
+ unsigned long fw_vendor;
+ unsigned long runtime;
+ unsigned long config_tables;
efi_get_time_t *get_time;
efi_set_time_t *set_time;
efi_get_wakeup_time_t *get_wakeup_time;
--- efi.orig/arch/x86/platform/efi/efi.c
+++ efi/arch/x86/platform/efi/efi.c
@@ -670,6 +670,10 @@ void __init efi_init(void)

set_bit(EFI_SYSTEM_TABLES, &x86_efi_facility);

+ efi.fw_vendor = (unsigned long)efi.systab->fw_vendor;
+ efi.runtime = (unsigned long)efi.systab->runtime;
+ efi.config_tables = (unsigned long)efi.systab->tables;
+
/*
* Show what we know for posterity
*/

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/