google firmware support
v3 cover google firmware support
This patchset applies to v2.6.38-rc8 with the efivars patches (1-7) from v2 of this series already applied. It also applies cleanly to gregkh's driver-core-next branch.
The following series implements some support for interfaces exposed by google's servers' firmware. As in the previous send-out, only the gsmi and memconsole driver are present. I've dropped the efivars changes as Greg has already queued them.
In order to address various concerns had with the previous patchset, I've re-worked the drivers to declare (an admittedly simple) dmi_device_id structure that only matches "Google, Inc." board vendor id strings.
As well, I've fixed the gsmi driver up to be able to be built as a module. Both drivers also now are disabled by default in the Kconfigs.
I'd like to have these small drivers included as they are required for proper use of the kernel in our infrastructure. They may not seem like much, but a lot of our health automation as well as our human debugging efforts are dependent on the functionality herein. Getting these in the public Linux tree would bring us closer to being able to easily test kernels as they are released.
Thanks,
Patchset summary
================
Patches [1] and [2] add sanity checking for accessing the EBDA.
Patch [3] introduces CONFIG_GOOGLE_FIRMWARE that is disabled by default and which gates Google-specific drivers.
Patch [4] adds the "gsmi" driver that we use to make calls into our firmware.
Patch [5] adds the "memconsole" driver that finds the firmware's logs and exposes them on /sys/firmware/log.
Diffstat
========
Documentation/ABI/testing/sysfs-firmware-gsmi | 58 + Documentation/ABI/testing/sysfs-firmware-log | 7 arch/x86/include/asm/bios_ebda.h | 28 drivers/firmware/Kconfig | 2 drivers/firmware/Makefile | 2 drivers/firmware/google/Kconfig | 31 drivers/firmware/google/Makefile | 3 drivers/firmware/google/gsmi.c | 941 ++++++++++++++++++++++++++ drivers/firmware/google/memconsole.c | 166 ++++ 9 files changed, 1236 insertions(+), 2 deletions(-)
ChangeLog:
==========
- v3
- Drivers now use dmi_system_id structures to identify matching DMI strings, and export these tables via MODULE_DEVICE_TABLE to aid autoloading.
- gsmi can now be compiled as a module.
- memconsole fixed to require matching DMI strings.
- efivars patchset dropped from this series as it is now an assumed pre-requisite.
- v2
- Efivars can now be used by other drivers.
- Documentation added for /sys/firmware/efi/vars
- Memory console no longer touches log_buf ring buffer.
- The firmware log is exported to userland as /sys/firmware/log
- Ioctls for accessing nvram variables in gsmi driver replaced with efivars at /sys/firmware/gsmi/vars.
- die_notifier is used instead of adding new notifer_lists.
- EBDA scrubbing for memconsole now checks that we aren't walking
into 0xA0000.
- Documentation added for /sys/firmware/log
- Documentation added for /sys/firmware/gsmi
- Use kernel fixed width types instead of C99 types.
- v1
- Initial public send-out.
PATCH v3 1/5 x86: get_bios_ebda_length()
Add a wrapper routine that tells us the length of the EBDA if it is present. This guy also ensures that the returned length doesn't let the EBDA run past the 640KiB mark.
--- arch/x86/include/asm/bios_ebda.h | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-)
arch/x86/include/asm/bios_ebda.h +21 -0
@@ -14,6 +14,27 @@ static inline unsigned int get_bios_ebda(void)return address;/* 0 means none */ } +/* +* Return the sanitized length of the EBDA in bytes, if it exists. +*/ +static inline unsigned int get_bios_ebda_length (void ) +{ +unsigned int address; +unsigned int length; + + address =get_bios_ebda (); +if (!address) +return 0 ; + +/* EBDA length is byte 0 of the EBDA (stored in KiB) */ + length = *(unsigned char *)phys_to_virt (address); + length <<=10 ; + +/* Trim the length if it extends beyond 640KiB */ + length = min_t(unsigned int, (640 * 1024) - address, length); +return length; +} +void reserve_ebda_region (void );#ifdef CONFIG_X86_CHECK_BIOS_CORRUPTION
Re: [PATCH v3 1/5] x86: get_bios_ebda_length()
Quoted 8 lines · Mike Waychison
Add a wrapper routine that tells us the length of the EBDA if it is present. This guy also ensures that the returned length doesn't let the EBDA run past the 640KiB mark.
Signed-off-by Mike Waychison <[email protected]>--- arch/x86/include/asm/bios_ebda.h | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-)
Again, x86 maintainers, any ack/nak for this and the second patch in this series? Any objection for me queueing this up through the driver-core tree so I can take the follow-on patches in this series?
thanks,
greg k-h
Re: [PATCH v3 1/5] x86: get_bios_ebda_length()
In reply to Mike WaychisonQuoted 8 lines · Mike Waychison
Add a wrapper routine that tells us the length of the EBDA if it is present. This guy also ensures that the returned length doesn't let the EBDA run past the 640KiB mark.
Signed-off-by Mike Waychison <[email protected]>--- arch/x86/include/asm/bios_ebda.h | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-)
Ok, due to a total lack of response from the x86 maintainers, I'm going to take this through my driver-core tree as I have no objection to it and Mike's been very patient for a while now...
thanks,
greg k-h
PATCH v3 2/5 x86: Better comments for get_bios_ebda()
In reply to Mike WaychisonMake the comments a bit clearer for get_bios_ebda so that it actually tells us what it is returning.
--- arch/x86/include/asm/bios_ebda.h | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
arch/x86/include/asm/bios_ebda.h +5 -2
@@ -4,11 +4,14 @@#include <asm/io.h> /* -* there is a real-mode segmented pointer pointing to the -* 4K EBDA area at 0x40E. +* Returns physical address of EBDA. Returns 0 if there is no EBDA. */ static inline unsigned int get_bios_ebda (void ) { +/* +* There is a real-mode segmented pointer pointing to the +* 4K EBDA area at 0x40E. +*/ unsigned int address = *(unsigned short *)phys_to_virt (0x40E ); address <<=4 ;return address;/* 0 means none */
PATCH v3 3/5 Introduce CONFIG_GOOGLE_FIRMWARE
In reply to Mike WaychisonIn order to keep Google's firmware drivers organized amongst themselves, create a new directory for them to live in. As well, all Google firmware drivers are gated on CONFIG_GOOGLE_FIRMWARE=y, which defaults to 'n' in the kernel build.
---
Changelog:
v3:
- Removed comment about 'other implementations' in Kconfig message as per gregkh.
--- drivers/firmware/Kconfig | 2 ++ drivers/firmware/Makefile | 2 ++ drivers/firmware/google/Kconfig | 13 +++++++++++++ drivers/firmware/google/Makefile | 1 + 4 files changed, 18 insertions(+), 0 deletions(-) create mode 100644 drivers/firmware/google/Kconfig create mode 100644 drivers/firmware/google/Makefile
drivers/firmware/Kconfig +2 -0
@@ -145,4 +145,6 @@ config ISCSI_IBFT detect iSCSI boot parameters dynamically during system boot, say Y. Otherwise, say N. +source "drivers/firmware/google/Kconfig" + endmenu
drivers/firmware/Makefile +2 -0
@@ -12,3 +12,5 @@ obj-$(CONFIG_DMIID) += dmi-id.o obj-$(CONFIG_ISCSI_IBFT_FIND) += iscsi_ibft_find.o obj-$(CONFIG_ISCSI_IBFT) += iscsi_ibft.o obj-$(CONFIG_FIRMWARE_MEMMAP) += memmap.o + +obj-$(CONFIG_GOOGLE_FIRMWARE) += google/
drivers/firmware/google/Kconfig new file +13 -0
@@ -0,0 +1,13 @@ +config GOOGLE_FIRMWARE + bool "Google Firmware Drivers" + depends on X86 + default n + help + These firmware drivers are used by Google's servers. They are + only useful if you are working directly on one of their + proprietary servers. If in doubt, say "N". + +menu "Google Firmware Drivers" + depends on GOOGLE_FIRMWARE + +endmenu
drivers/firmware/google/Makefile new file +1 -0
@@ -0,0 +1 @@ +
Re: [PATCH v3 3/5] Introduce CONFIG_GOOGLE_FIRMWARE
Quoted 6 lines · Mike Waychison
In order to keep Google's firmware drivers organized amongst themselves, create a new directory for them to live in. As well, all Google firmware drivers are gated on
CONFIG_GOOGLE_FIRMWARE=y, which defaults to 'n' in the kernel build.Signed-off-by Mike Waychison <[email protected]>
This patch breaks the build:
ld: cannot find drivers/firmware/google/built-in.o: No such file or directory
Care to reoder this to be the last patch in the series?
I've applied the first two, so just send the last 3, with this one being the last one, and it should be fine.
thanks,
greg k-h
PATCH v4 1/3 driver: Google EFI SMI
The "gsmi" driver bridges userland with firmware specific routines for accessing hardware.
Currently, this driver only supports NVRAM and eventlog information. Deprecated functions have been removed from the driver, though their op-codes are left in place so that they are not re-used.
This driver works by trampolining into the firmware via the smi_command outlined in the FADT table. Three protocols are used due to various limitations over time, but all are included herein.
This driver should only ever load on Google boards, identified by either a "Google, Inc." board vendor string in DMI, or "GOOGLE" in the OEM strings of the FADT ACPI table. This logic happens in gsmi_system_valid().
---
Changelog:
v4:
- Re-ordered to be before the introduction of CONFIG_GOOGLE_FIRMWARE
v3:
- Require a match on a dmi_system_id, and export table via MODULE_DEVICE_TABLE.
- Mark gsmi_system_valid as __init.
- Allow driver to be compiled as a removable module.
- Default to 'n' in Kconfig.
v2:
- Use ARRAY_SIZE() rather than open coded construct.
- Fix off-by-one in array lookup.
- Removed superfluous memset.
- Removed superfluous variable clear.
- switch from posix integer types to linux kernel integer types.
- Replaced use of dropped oops_notifier_list with die_notifier_list.
- Added dependency on CONFIG_DMI.
- Fixed a bug which crashed the kernel if no DMI tables were found.
- Replace nvram ioctls with efivars interface at /sys/firmware/gsmi/vars.
- Removed NOOP command that is unused.
- Change gsmi_dev to not be statically allocated.
- Removed ioctl interface
- Removed chardev interface
- Removed header as user ABI is all done via sysfs.
- Fix output clobber for firmware call so that we don't clobber the compiler-cached value for 'cmd'.
- Added docs to Documentation/ABI for exposed system call interface.
--- Documentation/ABI/testing/sysfs-firmware-gsmi | 58 ++ drivers/firmware/Kconfig | 2 drivers/firmware/Makefile | 2 drivers/firmware/google/Kconfig | 9 drivers/firmware/google/Makefile | 2 drivers/firmware/google/gsmi.c | 941 +++++++++++++++++++++++++ 6 files changed, 1014 insertions(+), 0 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-firmware-gsmi create mode 100644 drivers/firmware/google/Kconfig create mode 100644 drivers/firmware/google/Makefile create mode 100644 drivers/firmware/google/gsmi.c
Documentation/ABI/testing/sysfs-firmware-gsmi new file +58 -0
@@ -0,0 +1,58 @@ +What: /sys/firmware/gsmi +Date: March 2011 +Contact: Mike Waychison <[email protected]> +Description: + Some servers used internally at Google have firmware + that provides callback functionality via explicit SMI + triggers. Some of the callbacks are similar to those + provided by the EFI runtime services page, but due to + historical reasons this different entry-point has been + used. + + The gsmi driver implements the kernel's abstraction for + these firmware callbacks. Currently, this functionality + is limited to handling the system event log and getting + access to EFI-style variables stored in nvram. + + Layout: + + /sys/firmware/gsmi/vars: + + This directory has the same layout (and + underlying implementation as /sys/firmware/efi/vars. + See Documentation/ABI/*/sysfs-firmware-efi-vars + for more information on how to interact with + this structure. + + /sys/firmware/gsmi/append_to_eventlog - write-only: + + This file takes a binary blob and passes it onto + the firmware to be timestamped and appended to + the system eventlog. The binary format is + interpreted by the firmware and may change from + platform to platform. The only kernel-enforced + requirement is that the blob be prefixed with a + 32bit host-endian type used as part of the + firmware call. + + /sys/firmware/gsmi/clear_config - write-only: + + Writing any value to this file will cause the + entire firmware configuration to be reset to + "factory defaults". Callers should assume that + a reboot is required for the configuration to be + cleared. + + /sys/firmware/gsmi/clear_eventlog - write-only: + + This file is used to clear out a portion/the + whole of the system event log. Values written + should be values between 1 and 100 inclusive (in + ASCII) representing the fraction of the log to + clear. Not all platforms support fractional + clearing though, and this writes to this file + will error out if the firmware doesn't like your + submitted fraction. + + Callers should assume that a reboot is needed + for this operation to complete.
drivers/firmware/Kconfig +2 -0
@@ -145,4 +145,6 @@ config ISCSI_IBFT detect iSCSI boot parameters dynamically during system boot, say Y. Otherwise, say N. +source "drivers/firmware/google/Kconfig" + endmenu
drivers/firmware/Makefile +2 -0
@@ -12,3 +12,5 @@ obj-$(CONFIG_DMIID) += dmi-id.o obj-$(CONFIG_ISCSI_IBFT_FIND) += iscsi_ibft_find.o obj-$(CONFIG_ISCSI_IBFT) += iscsi_ibft.o obj-$(CONFIG_FIRMWARE_MEMMAP) += memmap.o + +obj-y += google/
drivers/firmware/google/Kconfig new file +9 -0
@@ -0,0 +1,9 @@ +config GOOGLE_SMI + tristate "SMI interface for Google platforms" + depends on ACPI && DMI + select EFI_VARS + 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 + variables.
drivers/firmware/google/Makefile new file +2 -0
@@ -0,0 +1,2 @@ + +obj-$(CONFIG_GOOGLE_SMI) += gsmi.o
drivers/firmware/google/gsmi.c new file +941 -0
941 lines not on this page · raw message
Re: [PATCH v4 1/3] driver: Google EFI SMI
drivers/firmware/google/gsmi.c line 665
Quoted 9 lines · On Fri, 29 Apr 2011 15:55:51 -0700 Mike Waychison wrote:
drivers/firmware/google/gsmi.c new file +9
-0+static int gsmi_die_callback (struct notifier_block *nb, +unsigned long reason,void *arg) +{ +if (reason ==DIE_NMIWATCHDOG ) +gsmi_shutdown_reason (GSMI_SHUTDOWN_NMIWDT ); +else if (reason ==DIE_OOPS ) +gsmi_shutdown_reason (GSMI_SHUTDOWN_OOPS ); +return NOTIFY_DONE ; +}
Where is DIE_NMIWATCHDOG defined?
Do I need more that patches 1,2,3/3 applied?
lnx-2639-rc5/drivers/firmware/google/gsmi.c: In function 'gsmi_die_callback':lnx-2639-rc5/drivers/firmware/google/gsmi.c:660: error: 'DIE_NMIWATCHDOG' undeclared (first use in this function) lnx-2639-rc5/drivers/firmware/google/gsmi.c:660: error: (Each undeclared identifier is reported only once lnx-2639-rc5/drivers/firmware/google/gsmi.c:660: error: for each function it appears in.)
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
Re: [PATCH v4 1/3] driver: Google EFI SMI
Quoted 15 lines · Randy Dunlap
drivers/firmware/google/gsmi.c line 665
Quoted 9 lines · On Fri, 29 Apr 2011 15:55:51 -0700 Mike Waychison wrote:
drivers/firmware/google/gsmi.c new file +9
-0+static int gsmi_die_callback (struct notifier_block *nb, + unsigned long reason, void *arg) +{ + if (reason == DIE_NMIWATCHDOG) + gsmi_shutdown_reason(GSMI_SHUTDOWN_NMIWDT); + else if (reason == DIE_OOPS) + gsmi_shutdown_reason(GSMI_SHUTDOWN_OOPS); + return NOTIFY_DONE; +}Where is
DIE_NMIWATCHDOGdefined?
My bad. I didn't rebase these 3 patches to v2.6.39-rc5 when sending out v4. Seems it got dropped in rc1 in 02ca752e. Looking at how to wire this into whatever replaced die_nmi() now.
Re: [PATCH v4 1/3] driver: Google EFI SMI
In reply to Mike WaychisonQuoted 11 lines · Mike Waychison
The "gsmi" driver bridges userland with firmware specific routines for accessing hardware.
Currently, this driver only supports NVRAM and eventlog information. Deprecated functions have been removed from the driver, though their op-codes are left in place so that they are not re-used.
This driver works by trampolining into the firmware via the
smi_commandoutlined in the FADT table. Three protocols are used due to various limitations over time, but all are included herein.
Quoted 8 lines
This driver should only ever load on Google boards, identified by either a "Google, Inc." board vendor string in DMI, or "GOOGLE" in the OEM strings of the FADT ACPI table. This logic happens in
gsmi_system_valid().Signed-off-by Duncan Laurie <[email protected]>Signed-off-by Aaron Durbin <[email protected]>Signed-off-by Mike Waychison <[email protected]>
{sigh}
I now get this build error with this patch applied:
CC [M] drivers/firmware/google/gsmi.odrivers/firmware/google/gsmi.c: In function ‘gsmi_die_callback’:drivers/firmware/google/gsmi.c:660:16: error: ‘DIE_NMIWATCHDOG’ undeclared (first use in this function) drivers/firmware/google/gsmi.c:660:16: note: each undeclared identifier is reported only once for each function it appears in make[3]: *** [drivers/firmware/google/gsmi.o] Error 1
Also, I had to hand edit the drivers/firmware/Makefile and Kconfig parts of this patch to get it to apply, care to respin it against the linux-next tree so I don't have to do that next time around?
thanks,
greg k-h
Re: [PATCH v4 1/3] driver: Google EFI SMI
Quoted 32 lines · Greg KH
Quoted 11 lines · Mike Waychison
The "gsmi" driver bridges userland with firmware specific routines for accessing hardware.
Currently, this driver only supports NVRAM and eventlog information. Deprecated functions have been removed from the driver, though their op-codes are left in place so that they are not re-used.
This driver works by trampolining into the firmware via the
smi_commandoutlined in the FADT table. Three protocols are used due to various limitations over time, but all are included herein.Quoted 8 lines
This driver should only ever load on Google boards, identified by either a "Google, Inc." board vendor string in DMI, or "GOOGLE" in the OEM strings of the FADT ACPI table. This logic happens in
gsmi_system_valid().Signed-off-by Duncan Laurie <[email protected]>Signed-off-by Aaron Durbin <[email protected]>Signed-off-by Mike Waychison <[email protected]>{sigh}
I now get this build error with this patch applied:
CC [M] drivers/firmware/google/gsmi.o
drivers/firmware/google/gsmi.c: In function ‘gsmi_die_callback’:drivers/firmware/google/gsmi.c:660:16: error: ‘DIE_NMIWATCHDOG’ undeclared (first use in this function)drivers/firmware/google/gsmi.c:660:16: note: each undeclared identifier is reported only once for each function it appears in make[3]: *** [drivers/firmware/google/gsmi.o] Error 1
Quoted 4 lines
Also, I had to hand edit the
drivers/firmware/MakefileandKconfigparts of this patch to get it to apply, care to respin it against the linux-next tree so I don't have to do that next time around?
Ya, I'm looking at these now.
Hmm :( It seems the nmi watchdog got renamed to the 'hard lockup' detector, and we lost the DIE callback in the meantime.
I think for the moment, I'm going to respin and drop the NMI bits for now. We can revisit actually calling notify_die() when we panic in watchdog_overflow_callback() as a follow on.
PATCH v5 1/3 driver: Google EFI SMI
In reply to Greg KHThe "gsmi" driver bridges userland with firmware specific routines for accessing hardware.
Currently, this driver only supports NVRAM and eventlog information. Deprecated functions have been removed from the driver, though their op-codes are left in place so that they are not re-used.
This driver works by trampolining into the firmware via the smi_command outlined in the FADT table. Three protocols are used due to various limitations over time, but all are included herein.
This driver should only ever load on Google boards, identified by either a "Google, Inc." board vendor string in DMI, or "GOOGLE" in the OEM strings of the FADT ACPI table. This logic happens in gsmi_system_valid().
---
Changelog:
v5:
- refreshed to next-20110429
- Dropped handling of DIE_NMIWATCHDOG as it was dropped in the 2.6.39 cycle.
v4:
- Re-ordered to be before the introduction of CONFIG_GOOGLE_FIRMWARE
v3:
- Require a match on a dmi_system_id, and export table via MODULE_DEVICE_TABLE.
- Mark gsmi_system_valid as __init.
- Allow driver to be compiled as a removable module.
- Default to 'n' in Kconfig.
v2:
- Use ARRAY_SIZE() rather than open coded construct.
- Fix off-by-one in array lookup.
- Removed superfluous memset.
- Removed superfluous variable clear.
- switch from posix integer types to linux kernel integer types.
- Replaced use of dropped oops_notifier_list with die_notifier_list.
- Added dependency on CONFIG_DMI.
- Fixed a bug which crashed the kernel if no DMI tables were found.
- Replace nvram ioctls with efivars interface at /sys/firmware/gsmi/vars.
- Removed NOOP command that is unused.
- Change gsmi_dev to not be statically allocated.
- Removed ioctl interface
- Removed chardev interface
- Removed header as user ABI is all done via sysfs.
- Fix output clobber for firmware call so that we don't clobber the compiler-cached value for 'cmd'.
- Added docs to Documentation/ABI for exposed system call interface.
--- Documentation/ABI/testing/sysfs-firmware-gsmi | 58 ++ drivers/firmware/Kconfig | 2 drivers/firmware/Makefile | 2 drivers/firmware/google/Kconfig | 9 drivers/firmware/google/Makefile | 2 drivers/firmware/google/gsmi.c | 940 +++++++++++++++++++++++++ 6 files changed, 1013 insertions(+), 0 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-firmware-gsmi create mode 100644 drivers/firmware/google/Kconfig create mode 100644 drivers/firmware/google/Makefile create mode 100644 drivers/firmware/google/gsmi.c
Documentation/ABI/testing/sysfs-firmware-gsmi new file +58 -0
@@ -0,0 +1,58 @@ +What: /sys/firmware/gsmi +Date: March 2011 +Contact: Mike Waychison <[email protected]> +Description: + Some servers used internally at Google have firmware + that provides callback functionality via explicit SMI + triggers. Some of the callbacks are similar to those + provided by the EFI runtime services page, but due to + historical reasons this different entry-point has been + used. + + The gsmi driver implements the kernel's abstraction for + these firmware callbacks. Currently, this functionality + is limited to handling the system event log and getting + access to EFI-style variables stored in nvram. + + Layout: + + /sys/firmware/gsmi/vars: + + This directory has the same layout (and + underlying implementation as /sys/firmware/efi/vars. + See Documentation/ABI/*/sysfs-firmware-efi-vars + for more information on how to interact with + this structure. + + /sys/firmware/gsmi/append_to_eventlog - write-only: + + This file takes a binary blob and passes it onto + the firmware to be timestamped and appended to + the system eventlog. The binary format is + interpreted by the firmware and may change from + platform to platform. The only kernel-enforced + requirement is that the blob be prefixed with a + 32bit host-endian type used as part of the + firmware call. + + /sys/firmware/gsmi/clear_config - write-only: + + Writing any value to this file will cause the + entire firmware configuration to be reset to + "factory defaults". Callers should assume that + a reboot is required for the configuration to be + cleared. + + /sys/firmware/gsmi/clear_eventlog - write-only: + + This file is used to clear out a portion/the + whole of the system event log. Values written + should be values between 1 and 100 inclusive (in + ASCII) representing the fraction of the log to + clear. Not all platforms support fractional + clearing though, and this writes to this file + will error out if the firmware doesn't like your + submitted fraction. + + Callers should assume that a reboot is needed + for this operation to complete.
drivers/firmware/Kconfig +2 -0
@@ -157,4 +157,6 @@ config SIGMA If unsure, say N here. Drivers that need these helpers will select this option automatically. +source "drivers/firmware/google/Kconfig" + endmenu
drivers/firmware/Makefile +2 -0
@@ -13,3 +13,5 @@ obj-$(CONFIG_ISCSI_IBFT_FIND) += iscsi_ibft_find.o obj-$(CONFIG_ISCSI_IBFT) += iscsi_ibft.o obj-$(CONFIG_FIRMWARE_MEMMAP) += memmap.o obj-$(CONFIG_SIGMA) += sigma.o + +obj-y += google/
drivers/firmware/google/Kconfig new file +9 -0
@@ -0,0 +1,9 @@ +config GOOGLE_SMI + tristate "SMI interface for Google platforms" + depends on ACPI && DMI + select EFI_VARS + 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 + variables.
drivers/firmware/google/Makefile new file +2 -0
@@ -0,0 +1,2 @@ + +obj-$(CONFIG_GOOGLE_SMI) += gsmi.o
drivers/firmware/google/gsmi.c new file +940 -0
940 lines not on this page · raw message
PATCH v5 2/3 driver: Google Memory Console
In reply to Greg KHThis patch introduces the 'memconsole' driver.
Our firmware gives us access to an in-memory log of the firmware's
output. This gives us visibility in a data-center of headless machines
as to what the firmware is doing.
The memory console is found by the driver by finding a header block in the EBDA. The buffer is then copied out, and is exported to userland in the file /sys/firmware/log.
---
Changelog:
v5:
- refreshed to next-20110429
v4:
- Re-ordered to be before the introduction of CONFIG_GOOGLE_FIRMWARE.
v3:
- Use dmi_check_system to only load when on a Google board.
- Use MODULE_DEVICE_TABLE to export matching DMI strings.
- Default to 'n' in the Kconfig.
- Fixed Kconfig description to reflect that this change no longer messes with the dmesg.
v2:
- Removed bits that had this driver muck with the kernel's ring dmesg buffer (log_buf).
- Introduced the log as /sys/firmware/log, a binary file that isn't interpreted by the kernel.
- Don't use C99 fixed width types; use kernel fixed width types.
- Added file to Documentation/ABI for /sys/firmware/log
--- Documentation/ABI/testing/sysfs-firmware-log | 7 + drivers/firmware/google/Kconfig | 8 + drivers/firmware/google/Makefile | 1 drivers/firmware/google/memconsole.c | 166 ++++++++++++++++++++++++++ 4 files changed, 182 insertions(+), 0 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-firmware-log create mode 100644 drivers/firmware/google/memconsole.c
Documentation/ABI/testing/sysfs-firmware-log new file +7 -0
@@ -0,0 +1,7 @@ +What: /sys/firmware/log +Date: February 2011 +Contact: Mike Waychison <[email protected]> +Description: + The /sys/firmware/log is a binary file that represents a + read-only copy of the firmware's log if one is + available.
drivers/firmware/google/Kconfig +8 -0
@@ -7,3 +7,11 @@ config GOOGLE_SMI platforms. This provides an interface for writing to and clearing the EFI event log and reading and writing NVRAM variables. + +config GOOGLE_MEMCONSOLE + tristate "Firmware Memory Console" + depends on DMI + help + This option enables the kernel to search for a firmware log in + the EBDA on Google servers. If found, this log is exported to + userland in the file /sys/firmware/log.
drivers/firmware/google/Makefile +1 -0
@@ -1,2 +1,3 @@ obj-$(CONFIG_GOOGLE_SMI) += gsmi.o +obj-$(CONFIG_GOOGLE_MEMCONSOLE) += memconsole.o
drivers/firmware/google/memconsole.c new file +166 -0
166 lines not on this page · raw message
PATCH v5 3/3 Introduce CONFIG_GOOGLE_FIRMWARE
In reply to Greg KHIn order to keep Google's firmware drivers organized amongst themselves, all Google firmware drivers are gated on CONFIG_GOOGLE_FIRMWARE=y, which defaults to 'n' in the kernel build.
---
Changelog:
v5:
- refreshed to next-20110429
v4:
- Moved to end of series.
v3:
- Removed comment about 'other implementations' in Kconfig message as per gregkh.
--- drivers/firmware/Makefile | 2 +- drivers/firmware/google/Kconfig | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletions(-)
drivers/firmware/Makefile +1 -1
@@ -14,4 +14,4 @@ obj-$(CONFIG_ISCSI_IBFT) += iscsi_ibft.o obj-$(CONFIG_FIRMWARE_MEMMAP) += memmap.o obj-$(CONFIG_SIGMA) += sigma.o -obj-y += google/ +obj-$(CONFIG_GOOGLE_FIRMWARE) += google/
drivers/firmware/google/Kconfig +14 -0
@@ -1,3 +1,15 @@ +config GOOGLE_FIRMWARE + bool "Google Firmware Drivers" + depends on X86 + default n + help + These firmware drivers are used by Google's servers. They are + only useful if you are working directly on one of their + proprietary servers. If in doubt, say "N". + +menu "Google Firmware Drivers" + depends on GOOGLE_FIRMWARE + config GOOGLE_SMI tristate "SMI interface for Google platforms" depends on ACPI && DMI
@@ -15,3 +27,5 @@ config GOOGLE_MEMCONSOLE This option enables the kernel to search for a firmware log in the EBDA on Google servers. If found, this log is exported to userland in the file /sys/firmware/log. + +endmenu
PATCH v4 2/3 driver: Google Memory Console
In reply to Greg KHThis patch introduces the 'memconsole' driver.
Our firmware gives us access to an in-memory log of the firmware's
output. This gives us visibility in a data-center of headless machines
as to what the firmware is doing.
The memory console is found by the driver by finding a header block in the EBDA. The buffer is then copied out, and is exported to userland in the file /sys/firmware/log.
---
Changelog:
v4:
- Re-ordered to be before the introduction of CONFIG_GOOGLE_FIRMWARE.
v3:
- Use dmi_check_system to only load when on a Google board.
- Use MODULE_DEVICE_TABLE to export matching DMI strings.
- Default to 'n' in the Kconfig.
- Fixed Kconfig description to reflect that this change no longer messes with the dmesg.
v2:
- Removed bits that had this driver muck with the kernel's ring dmesg buffer (log_buf).
- Introduced the log as /sys/firmware/log, a binary file that isn't interpreted by the kernel.
- Don't use C99 fixed width types; use kernel fixed width types.
- Added file to Documentation/ABI for /sys/firmware/log
--- Documentation/ABI/testing/sysfs-firmware-log | 7 + drivers/firmware/google/Kconfig | 8 + drivers/firmware/google/Makefile | 1 drivers/firmware/google/memconsole.c | 166 ++++++++++++++++++++++++++ 4 files changed, 182 insertions(+), 0 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-firmware-log create mode 100644 drivers/firmware/google/memconsole.c
Documentation/ABI/testing/sysfs-firmware-log new file +7 -0
@@ -0,0 +1,7 @@ +What: /sys/firmware/log +Date: February 2011 +Contact: Mike Waychison <[email protected]> +Description: + The /sys/firmware/log is a binary file that represents a + read-only copy of the firmware's log if one is + available.
drivers/firmware/google/Kconfig +8 -0
@@ -7,3 +7,11 @@ config GOOGLE_SMI platforms. This provides an interface for writing to and clearing the EFI event log and reading and writing NVRAM variables. + +config GOOGLE_MEMCONSOLE + tristate "Firmware Memory Console" + depends on DMI + help + This option enables the kernel to search for a firmware log in + the EBDA on Google servers. If found, this log is exported to + userland in the file /sys/firmware/log.
drivers/firmware/google/Makefile +1 -0
@@ -1,2 +1,3 @@ obj-$(CONFIG_GOOGLE_SMI) += gsmi.o +obj-$(CONFIG_GOOGLE_MEMCONSOLE) += memconsole.o
drivers/firmware/google/memconsole.c new file +166 -0
166 lines not on this page · raw message
PATCH v4 3/3 Introduce CONFIG_GOOGLE_FIRMWARE
In reply to Greg KHIn order to keep Google's firmware drivers organized amongst themselves, all Google firmware drivers are gated on CONFIG_GOOGLE_FIRMWARE=y, which defaults to 'n' in the kernel build.
---
Changelog:
v4:
- Moved to end of series.
v3:
- Removed comment about 'other implementations' in Kconfig message as per gregkh.
--- drivers/firmware/Makefile | 2 +- drivers/firmware/google/Kconfig | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletions(-)
drivers/firmware/Makefile +1 -1
@@ -13,4 +13,4 @@ obj-$(CONFIG_ISCSI_IBFT_FIND) += iscsi_ibft_find.o obj-$(CONFIG_ISCSI_IBFT) += iscsi_ibft.o obj-$(CONFIG_FIRMWARE_MEMMAP) += memmap.o -obj-y += google/ +obj-$(CONFIG_GOOGLE_FIRMWARE) += google/
drivers/firmware/google/Kconfig +14 -0
@@ -1,3 +1,15 @@ +config GOOGLE_FIRMWARE + bool "Google Firmware Drivers" + depends on X86 + default n + help + These firmware drivers are used by Google's servers. They are + only useful if you are working directly on one of their + proprietary servers. If in doubt, say "N". + +menu "Google Firmware Drivers" + depends on GOOGLE_FIRMWARE + config GOOGLE_SMI tristate "SMI interface for Google platforms" depends on ACPI && DMI
@@ -15,3 +27,5 @@ config GOOGLE_MEMCONSOLE This option enables the kernel to search for a firmware log in the EBDA on Google servers. If found, this log is exported to userland in the file /sys/firmware/log. + +endmenu
Re: [PATCH v4 3/3] Introduce CONFIG_GOOGLE_FIRMWARE
Quoted 3 lines · On Fri, 29 Apr 2011 15:56:02 -0700 Mike Waychison <[email protected]> wrote:
In order to keep Google's firmware drivers organized amongst themselves, all Google firmware drivers are gated on
CONFIG_GOOGLE_FIRMWARE=y, which defaults to 'n' in the kernel build.
All 3 Acked-by: Alan Cox <[email protected]>
drivers/firmware/google/Kconfig line 8
Quoted 3 lines
drivers/firmware/google/Kconfig +3
-0+ These firmware drivers are used by Google's servers. They are + only useful if you are working directly on one of their + proprietary servers. If in doubt, say "N".
[or until people start adding them to other devices!]
Alan
PATCH v3 4/5 driver: Google EFI SMI
In reply to Mike WaychisonThe "gsmi" driver bridges userland with firmware specific routines for accessing hardware.
Currently, this driver only supports NVRAM and eventlog information. Deprecated functions have been removed from the driver, though their op-codes are left in place so that they are not re-used.
This driver works by trampolining into the firmware via the smi_command outlined in the FADT table. Three protocols are used due to various limitations over time, but all are included herein.
This driver should only ever load on Google boards, identified by either a "Google, Inc." board vendor string in DMI, or "GOOGLE" in the OEM strings of the FADT ACPI table. This logic happens in gsmi_system_valid().
---
Changelog:
v3:
- Require a match on a dmi_system_id, and export table via MODULE_DEVICE_TABLE.
- Mark gsmi_system_valid as __init.
- Allow driver to be compiled as a removable module.
- Default to 'n' in Kconfig.
v2:
- Use ARRAY_SIZE() rather than open coded construct.
- Fix off-by-one in array lookup.
- Removed superfluous memset.
- Removed superfluous variable clear.
- switch from posix integer types to linux kernel integer types.
- Replaced use of dropped oops_notifier_list with die_notifier_list.
- Added dependency on CONFIG_DMI.
- Fixed a bug which crashed the kernel if no DMI tables were found.
- Replace nvram ioctls with efivars interface at /sys/firmware/gsmi/vars.
- Removed NOOP command that is unused.
- Change gsmi_dev to not be statically allocated.
- Removed ioctl interface
- Removed chardev interface
- Removed header as user ABI is all done via sysfs.
- Fix output clobber for firmware call so that we don't clobber the compiler-cached value for 'cmd'.
- Added docs to Documentation/ABI for exposed system call interface.
--- Documentation/ABI/testing/sysfs-firmware-gsmi | 58 ++ drivers/firmware/google/Kconfig | 10 drivers/firmware/google/Makefile | 1 drivers/firmware/google/gsmi.c | 941 +++++++++++++++++++++++++ 4 files changed, 1010 insertions(+), 0 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-firmware-gsmi create mode 100644 drivers/firmware/google/gsmi.c
Documentation/ABI/testing/sysfs-firmware-gsmi new file +58 -0
@@ -0,0 +1,58 @@ +What: /sys/firmware/gsmi +Date: March 2011 +Contact: Mike Waychison <[email protected]> +Description: + Some servers used internally at Google have firmware + that provides callback functionality via explicit SMI + triggers. Some of the callbacks are similar to those + provided by the EFI runtime services page, but due to + historical reasons this different entry-point has been + used. + + The gsmi driver implements the kernel's abstraction for + these firmware callbacks. Currently, this functionality + is limited to handling the system event log and getting + access to EFI-style variables stored in nvram. + + Layout: + + /sys/firmware/gsmi/vars: + + This directory has the same layout (and + underlying implementation as /sys/firmware/efi/vars. + See Documentation/ABI/*/sysfs-firmware-efi-vars + for more information on how to interact with + this structure. + + /sys/firmware/gsmi/append_to_eventlog - write-only: + + This file takes a binary blob and passes it onto + the firmware to be timestamped and appended to + the system eventlog. The binary format is + interpreted by the firmware and may change from + platform to platform. The only kernel-enforced + requirement is that the blob be prefixed with a + 32bit host-endian type used as part of the + firmware call. + + /sys/firmware/gsmi/clear_config - write-only: + + Writing any value to this file will cause the + entire firmware configuration to be reset to + "factory defaults". Callers should assume that + a reboot is required for the configuration to be + cleared. + + /sys/firmware/gsmi/clear_eventlog - write-only: + + This file is used to clear out a portion/the + whole of the system event log. Values written + should be values between 1 and 100 inclusive (in + ASCII) representing the fraction of the log to + clear. Not all platforms support fractional + clearing though, and this writes to this file + will error out if the firmware doesn't like your + submitted fraction. + + Callers should assume that a reboot is needed + for this operation to complete.
drivers/firmware/google/Kconfig +10 -0
@@ -10,4 +10,14 @@ config GOOGLE_FIRMWARE menu "Google Firmware Drivers" depends on GOOGLE_FIRMWARE +config GOOGLE_SMI + tristate "SMI interface for Google platforms" + depends on ACPI && DMI + select EFI_VARS + 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 + variables. + endmenu
drivers/firmware/google/Makefile +1 -0
@@ -1 +1,2 @@ +obj-$(CONFIG_GOOGLE_SMI) += gsmi.o
drivers/firmware/google/gsmi.c new file +941 -0
941 lines not on this page · raw message
PATCH v3 5/5 driver: Google Memory Console
In reply to Mike WaychisonThis patch introduces the 'memconsole' driver.
Our firmware gives us access to an in-memory log of the firmware's
output. This gives us visibility in a data-center of headless machines
as to what the firmware is doing.
The memory console is found by the driver by finding a header block in the EBDA. The buffer is then copied out, and is exported to userland in the file /sys/firmware/log.
---
Changelog:
v3:
- Use dmi_check_system to only load when on a Google board.
- Use MODULE_DEVICE_TABLE to export matching DMI strings.
- Default to 'n' in the Kconfig.
- Fixed Kconfig description to reflect that this change no longer messes with the dmesg.
v2:
- Removed bits that had this driver muck with the kernel's ring dmesg buffer (log_buf).
- Introduced the log as /sys/firmware/log, a binary file that isn't interpreted by the kernel.
- Don't use C99 fixed width types; use kernel fixed width types.
- Added file to Documentation/ABI for /sys/firmware/log
--- Documentation/ABI/testing/sysfs-firmware-log | 7 + drivers/firmware/google/Kconfig | 8 + drivers/firmware/google/Makefile | 1 drivers/firmware/google/memconsole.c | 166 ++++++++++++++++++++++++++ 4 files changed, 182 insertions(+), 0 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-firmware-log create mode 100644 drivers/firmware/google/memconsole.c
Documentation/ABI/testing/sysfs-firmware-log new file +7 -0
@@ -0,0 +1,7 @@ +What: /sys/firmware/log +Date: February 2011 +Contact: Mike Waychison <[email protected]> +Description: + The /sys/firmware/log is a binary file that represents a + read-only copy of the firmware's log if one is + available.
drivers/firmware/google/Kconfig +8 -0
@@ -20,4 +20,12 @@ config GOOGLE_SMI clearing the EFI event log and reading and writing NVRAM variables. +config GOOGLE_MEMCONSOLE + tristate "Firmware Memory Console" + depends on DMI + help + This option enables the kernel to search for a firmware log in + the EBDA on Google servers. If found, this log is exported to + userland in the file /sys/firmware/log. + endmenu
drivers/firmware/google/Makefile +1 -0
@@ -1,2 +1,3 @@ obj-$(CONFIG_GOOGLE_SMI) += gsmi.o +obj-$(CONFIG_GOOGLE_MEMCONSOLE) += memconsole.o
drivers/firmware/google/memconsole.c new file +166 -0
166 lines not on this page · raw message
Re: [PATCH v3 5/5] driver: Google Memory Console
Quoted 10 lines · Mike Waychison
drivers/firmware/google/memconsole.c new file +10
-0+static struct dmi_system_id memconsole_dmi_table[]__initdata = { + { + .ident ="Google Board" , + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"Google, Inc." ), + }, + }, + {} +}; +MODULE_DEVICE_TABLE (dmi, memconsole_dmi_table);
drivers/firmware/google/memconsole.c line 148
Quoted 10 lines
drivers/firmware/google/memconsole.c new file +10
-0+ +static int __init memconsole_init (void ) +{ +int ret; + +if (!dmi_check_system (memconsole_dmi_table)) +return -ENODEV ; + +if (!found_memconsole ()) +return -ENODEV ;
Ok, that's a much safer method of discovery.
Thanks,
Ingo