Currently, this driver only supports NVRAM and eventlog information.Deprecated functions have been removed from the driver, though theirop-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 variouslimitations over time, but all are included herein.

This driver should only ever load on Google boards, identified by eithera "Google, Inc." board vendor string in DMI, or "GOOGLE" in the OEMstrings of the FADT ACPI table. This logic happens ingsmi_system_valid().

Signed-off-by: Duncan Laurie <dlaurie@google.com>Signed-off-by: Aaron Durbin <adurbin@google.com>Signed-off-by: Mike Waychison <mikew@google.com>---Changelog:v4: - Re-ordered to be before the introduction of CONFIG_GOOGLE_FIRMWAREv3: - 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.cdiff --git a/Documentation/ABI/testing/sysfs-firmware-gsmi b/Documentation/ABI/testing/sysfs-firmware-gsminew file mode 100644index 0000000..0faa0aa--- /dev/null+++ b/Documentation/ABI/testing/sysfs-firmware-gsmi@@ -0,0 +1,58 @@+What: /sys/firmware/gsmi+Date: March 2011+Contact: Mike Waychison <mikew@google.com>+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.diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfigindex 3c56afc..9b00072 100644--- a/drivers/firmware/Kconfig+++ b/drivers/firmware/Kconfig@@ -145,4 +145,6 @@ config ISCSI_IBFT detect iSCSI boot parameters dynamically during system boot, say Y. Otherwise, say N.