From 0a4cad9c11ad46662ede48d94f08ecb7cd9f6916 Mon Sep 17 00:00:00 2001 From: Enric Balletbo i Serra Date: Fri, 13 May 2022 12:52:09 +0500 Subject: platform/chrome: Add ChromeOS ACPI device driver The x86 Chromebooks have the ChromeOS ACPI device. This driver attaches to the ChromeOS ACPI device and exports the values reported by ACPI in a sysfs directory. This data isn't present in ACPI tables when read through ACPI tools, hence a driver is needed to do it. The driver gets data from firmware using the ACPI component of the kernel. The ACPI values are presented in string form (numbers as decimal values) or binary blobs, and can be accessed as the contents of the appropriate read only files in the standard ACPI device's sysfs directory tree. This data is consumed by the ChromeOS user space. Reviewed-by: Guenter Roeck Reviewed-by: Andy Shevchenko Reviewed-by: Greg Kroah-Hartman Acked-by: Rafael J. Wysocki Signed-off-by: Enric Balletbo i Serra Co-developed-by: Muhammad Usama Anjum Signed-off-by: Muhammad Usama Anjum Signed-off-by: Tzung-Bi Shih Link: https://lore.kernel.org/r/Yn4OKYrtV35Dv+nd@debian-BULLSEYE-live-builder-AMD64 --- .../ABI/testing/sysfs-driver-chromeos-acpi | 126 +++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-driver-chromeos-acpi (limited to 'Documentation/ABI') diff --git a/Documentation/ABI/testing/sysfs-driver-chromeos-acpi b/Documentation/ABI/testing/sysfs-driver-chromeos-acpi new file mode 100644 index 000000000000..5b59ef9d7b37 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-driver-chromeos-acpi @@ -0,0 +1,126 @@ +What: /sys/bus/platform/devices/GGL0001:*/BINF.2 +Date: May 2022 +KernelVersion: 5.19 +Description: + This file shows information about the current boot of + the active EC firmware. + * 0 - Read only (recovery) firmware. + * 1 - Rewritable firmware. + +What: /sys/bus/platform/devices/GGL0001:*/BINF.3 +Date: May 2022 +KernelVersion: 5.19 +Description: + This file shows information about the current boot of + the active main firmware type. + * 0 - Recovery. + * 1 - Normal. + * 2 - Developer. + * 3 - Netboot (factory installation only). + +What: /sys/bus/platform/devices/GGL0001:*/CHSW +Date: May 2022 +KernelVersion: 5.19 +Description: + This file shows the switch position for the Chrome OS specific + hardware switches. + * 0 - No changes. + * 2 - Recovery button was pressed when firmware booted. + * 4 - Recovery button was pressed when EC firmware booted. + * 32 - Developer switch was enabled when firmware booted. + * 512 - Firmware write protection was disabled when firmware + booted. + +What: /sys/bus/platform/devices/GGL0001:*/FMAP +Date: May 2022 +KernelVersion: 5.19 +Description: + This file shows the physical memory address of the start of + the main processor firmware flashmap. + +What: /sys/bus/platform/devices/GGL0001:*/FRID +Date: May 2022 +KernelVersion: 5.19 +Description: + This file shows the firmware version for the read-only portion + of the main processor firmware. + +What: /sys/bus/platform/devices/GGL0001:*/FWID +Date: May 2022 +KernelVersion: 5.19 +Description: + This file shows the firmware version for the rewritable portion + of the main processor firmware. + +What: /sys/bus/platform/devices/GGL0001:*/GPIO.X/GPIO.0 +Date: May 2022 +KernelVersion: 5.19 +Description: + This file shows the type of the GPIO signal for the Chrome OS + specific GPIO assignments. + * 1 - Recovery button. + * 2 - Developer mode switch. + * 3 - Firmware write protection switch. + * 256 to 511 - Debug header GPIO 0 to GPIO 255. + +What: /sys/bus/platform/devices/GGL0001:*/GPIO.X/GPIO.1 +Date: May 2022 +KernelVersion: 5.19 +Description: + This file shows the signal attributes of the GPIO signal. + * 0 - Signal is active low. + * 1 - Signal is active high. + +What: /sys/bus/platform/devices/GGL0001:*/GPIO.X/GPIO.2 +Date: May 2022 +KernelVersion: 5.19 +Description: + This file shows the GPIO number on the specified GPIO + controller. + +What: /sys/bus/platform/devices/GGL0001:*/GPIO.X/GPIO.3 +Date: May 2022 +KernelVersion: 5.19 +Description: + This file shows the name of the GPIO controller. + +What: /sys/bus/platform/devices/GGL0001:*/HWID +Date: May 2022 +KernelVersion: 5.19 +Description: + This file shows the hardware ID for the Chromebook. + +What: /sys/bus/platform/devices/GGL0001:*/MECK +Date: May 2022 +KernelVersion: 5.19 +Description: + This binary file returns the SHA-1 or SHA-256 hash that is + read out of the Management Engine extended registers during + boot. The hash is exported vi ACPI so the OS can verify that + the Management Engine firmware has not changed. If Management + Engine is not present, or if the firmware was unable to read the + extended registers, this buffer size can be zero. + +What: /sys/bus/platform/devices/GGL0001:*/VBNV.0 +Date: May 2022 +KernelVersion: 5.19 +Description: + This file shows the offset in CMOS bank 0 of the verified boot + non-volatile storage block, counting from the first writable + CMOS byte (that is, 'offset = 0' is the byte following the 14 + bytes of clock data). + +What: /sys/bus/platform/devices/GGL0001:*/VBNV.1 +Date: May 2022 +KernelVersion: 5.19 +Description: + This file shows the size in bytes of the verified boot + non-volatile storage block. + +What: /sys/bus/platform/devices/GGL0001:*/VDAT +Date: May 2022 +KernelVersion: 5.19 +Description: + This binary file returns the verified boot data block shared + between the firmware verification step and the kernel + verification step. -- cgit v1.2.3 From a6c13d87b4b7ae7f7f4574014f5478f7fe92540c Mon Sep 17 00:00:00 2001 From: Bagas Sanjaya Date: Wed, 18 May 2022 15:35:23 +0700 Subject: platform/chrome: Use tables for values lists of ChromeOS ACPI sysfs ABI Stephen Rothwell reported htmldocs warning when merging chrome-platform tree: Documentation/ABI/testing/sysfs-driver-chromeos-acpi:2: WARNING: Unexpected indentation. Documentation/ABI/testing/sysfs-driver-chromeos-acpi:11: WARNING: Unexpected indentation. Documentation/ABI/testing/sysfs-driver-chromeos-acpi:22: WARNING: Unexpected indentation. Documentation/ABI/testing/sysfs-driver-chromeos-acpi:56: WARNING: Unexpected indentation. The warning is due to missing blank line separator surrounding values lists. Instead of using lists, use tables to be consistent with rest of sysfs ABI documentation. Link: https://lore.kernel.org/linux-next/20220516213832.19127535@canb.auug.org.au/ Fixes: 0a4cad9c11ad ("platform/chrome: Add ChromeOS ACPI device driver") Reported-by: Stephen Rothwell Cc: Benson Leung Cc: Guenter Roeck Cc: Andy Shevchenko Cc: Greg Kroah-Hartman Cc: Rafael J. Wysocki Cc: Dmitry Torokhov Cc: Enric Balletbo i Serra Cc: Muhammad Usama Anjum Cc: Tzung-Bi Shih Cc: Linux Kernel Mailing List Cc: Linux Next Mailing List Signed-off-by: Bagas Sanjaya Reviewed-by: Muhammad Usama Anjum Signed-off-by: Tzung-Bi Shih Link: https://lore.kernel.org/r/20220518083524.37380-2-bagasdotme@gmail.com [tzungbi: fix the Fixes tag to 12-chars hash.] Signed-off-by: Tzung-Bi Shih --- .../ABI/testing/sysfs-driver-chromeos-acpi | 52 ++++++++++++++-------- 1 file changed, 33 insertions(+), 19 deletions(-) (limited to 'Documentation/ABI') diff --git a/Documentation/ABI/testing/sysfs-driver-chromeos-acpi b/Documentation/ABI/testing/sysfs-driver-chromeos-acpi index 5b59ef9d7b37..cce453951700 100644 --- a/Documentation/ABI/testing/sysfs-driver-chromeos-acpi +++ b/Documentation/ABI/testing/sysfs-driver-chromeos-acpi @@ -4,8 +4,11 @@ KernelVersion: 5.19 Description: This file shows information about the current boot of the active EC firmware. - * 0 - Read only (recovery) firmware. - * 1 - Rewritable firmware. + + == =============================== + 0 Read only (recovery) firmware. + 1 Rewritable firmware. + == =============================== What: /sys/bus/platform/devices/GGL0001:*/BINF.3 Date: May 2022 @@ -13,23 +16,28 @@ KernelVersion: 5.19 Description: This file shows information about the current boot of the active main firmware type. - * 0 - Recovery. - * 1 - Normal. - * 2 - Developer. - * 3 - Netboot (factory installation only). + + == ===================================== + 0 Recovery. + 1 Normal. + 2 Developer. + 3 Netboot (factory installation only). + == ===================================== What: /sys/bus/platform/devices/GGL0001:*/CHSW Date: May 2022 KernelVersion: 5.19 Description: This file shows the switch position for the Chrome OS specific - hardware switches. - * 0 - No changes. - * 2 - Recovery button was pressed when firmware booted. - * 4 - Recovery button was pressed when EC firmware booted. - * 32 - Developer switch was enabled when firmware booted. - * 512 - Firmware write protection was disabled when firmware - booted. + hardware switches when the firmware is booted. + + ==== =========================================== + 0 No changes. + 2 Recovery button was pressed. + 4 Recovery button was pressed (EC firmware). + 32 Developer switch was enabled. + 512 Firmware write protection was disabled. + ==== =========================================== What: /sys/bus/platform/devices/GGL0001:*/FMAP Date: May 2022 @@ -58,18 +66,24 @@ KernelVersion: 5.19 Description: This file shows the type of the GPIO signal for the Chrome OS specific GPIO assignments. - * 1 - Recovery button. - * 2 - Developer mode switch. - * 3 - Firmware write protection switch. - * 256 to 511 - Debug header GPIO 0 to GPIO 255. + + =========== ================================== + 1 Recovery button. + 2 Developer mode switch. + 3 Firmware write protection switch. + 256 to 511 Debug header GPIO 0 to GPIO 255. + =========== ================================== What: /sys/bus/platform/devices/GGL0001:*/GPIO.X/GPIO.1 Date: May 2022 KernelVersion: 5.19 Description: This file shows the signal attributes of the GPIO signal. - * 0 - Signal is active low. - * 1 - Signal is active high. + + == ======================= + 0 Signal is active low. + 1 Signal is active high. + == ======================= What: /sys/bus/platform/devices/GGL0001:*/GPIO.X/GPIO.2 Date: May 2022 -- cgit v1.2.3 From abd4fd43f2af03e2e852e6b1b98faeee9e3eae55 Mon Sep 17 00:00:00 2001 From: Bagas Sanjaya Date: Wed, 18 May 2022 15:35:24 +0700 Subject: platform/chrome: Use imperative mood for ChromeOS ACPI sysfs ABI descriptions The current descriptions all begin with ("This file shows something") clause, which is incorrect wording since these mean return value from sysfs. Use imperative mood ("Returns something") instead, in line with corresponding ACPI documentation at firmware-guide/. Cc: Benson Leung Cc: Guenter Roeck Cc: Andy Shevchenko Cc: Greg Kroah-Hartman Cc: Rafael J. Wysocki Cc: Dmitry Torokhov Cc: Enric Balletbo i Serra Cc: Muhammad Usama Anjum Cc: Tzung-Bi Shih Cc: Linux Kernel Mailing List Cc: Linux Next Mailing List Signed-off-by: Bagas Sanjaya Reviewed-by: Muhammad Usama Anjum Signed-off-by: Tzung-Bi Shih Link: https://lore.kernel.org/r/20220518083524.37380-3-bagasdotme@gmail.com --- .../ABI/testing/sysfs-driver-chromeos-acpi | 63 +++++++++++----------- 1 file changed, 30 insertions(+), 33 deletions(-) (limited to 'Documentation/ABI') diff --git a/Documentation/ABI/testing/sysfs-driver-chromeos-acpi b/Documentation/ABI/testing/sysfs-driver-chromeos-acpi index cce453951700..c308926e1568 100644 --- a/Documentation/ABI/testing/sysfs-driver-chromeos-acpi +++ b/Documentation/ABI/testing/sysfs-driver-chromeos-acpi @@ -2,8 +2,7 @@ What: /sys/bus/platform/devices/GGL0001:*/BINF.2 Date: May 2022 KernelVersion: 5.19 Description: - This file shows information about the current boot of - the active EC firmware. + Returns active EC firmware of current boot (boolean). == =============================== 0 Read only (recovery) firmware. @@ -14,8 +13,7 @@ What: /sys/bus/platform/devices/GGL0001:*/BINF.3 Date: May 2022 KernelVersion: 5.19 Description: - This file shows information about the current boot of - the active main firmware type. + Returns main firmware type for current boot (integer). == ===================================== 0 Recovery. @@ -28,8 +26,8 @@ What: /sys/bus/platform/devices/GGL0001:*/CHSW Date: May 2022 KernelVersion: 5.19 Description: - This file shows the switch position for the Chrome OS specific - hardware switches when the firmware is booted. + Returns switch position for Chrome OS specific hardware + switches when the firmware is booted (integer). ==== =========================================== 0 No changes. @@ -43,29 +41,29 @@ What: /sys/bus/platform/devices/GGL0001:*/FMAP Date: May 2022 KernelVersion: 5.19 Description: - This file shows the physical memory address of the start of - the main processor firmware flashmap. + Returns physical memory address of the start of the main + processor firmware flashmap. What: /sys/bus/platform/devices/GGL0001:*/FRID Date: May 2022 KernelVersion: 5.19 Description: - This file shows the firmware version for the read-only portion - of the main processor firmware. + Returns firmware version for the read-only portion of the + main processor firmware. What: /sys/bus/platform/devices/GGL0001:*/FWID Date: May 2022 KernelVersion: 5.19 Description: - This file shows the firmware version for the rewritable portion - of the main processor firmware. + Returns firmware version for the rewritable portion of the + main processor firmware. What: /sys/bus/platform/devices/GGL0001:*/GPIO.X/GPIO.0 Date: May 2022 KernelVersion: 5.19 Description: - This file shows the type of the GPIO signal for the Chrome OS - specific GPIO assignments. + Returns type of the GPIO signal for the Chrome OS specific + GPIO assignments (integer). =========== ================================== 1 Recovery button. @@ -78,7 +76,7 @@ What: /sys/bus/platform/devices/GGL0001:*/GPIO.X/GPIO.1 Date: May 2022 KernelVersion: 5.19 Description: - This file shows the signal attributes of the GPIO signal. + Returns signal attributes of the GPIO signal (integer bitfield). == ======================= 0 Signal is active low. @@ -89,52 +87,51 @@ What: /sys/bus/platform/devices/GGL0001:*/GPIO.X/GPIO.2 Date: May 2022 KernelVersion: 5.19 Description: - This file shows the GPIO number on the specified GPIO + Returns the GPIO number on the specified GPIO controller. What: /sys/bus/platform/devices/GGL0001:*/GPIO.X/GPIO.3 Date: May 2022 KernelVersion: 5.19 Description: - This file shows the name of the GPIO controller. + Returns name of the GPIO controller. What: /sys/bus/platform/devices/GGL0001:*/HWID Date: May 2022 KernelVersion: 5.19 Description: - This file shows the hardware ID for the Chromebook. + Returns hardware ID for the Chromebook. What: /sys/bus/platform/devices/GGL0001:*/MECK Date: May 2022 KernelVersion: 5.19 Description: - This binary file returns the SHA-1 or SHA-256 hash that is - read out of the Management Engine extended registers during - boot. The hash is exported vi ACPI so the OS can verify that - the Management Engine firmware has not changed. If Management - Engine is not present, or if the firmware was unable to read the - extended registers, this buffer size can be zero. + Returns the SHA-1 or SHA-256 hash that is read out of the + Management Engine extended registers during boot. The hash + is exported via ACPI so the OS can verify that the Management + Engine firmware has not changed. If Management Engine is not + present, or if the firmware was unable to read the extended registers, this buffer size can be zero. What: /sys/bus/platform/devices/GGL0001:*/VBNV.0 Date: May 2022 KernelVersion: 5.19 Description: - This file shows the offset in CMOS bank 0 of the verified boot - non-volatile storage block, counting from the first writable - CMOS byte (that is, 'offset = 0' is the byte following the 14 - bytes of clock data). + Returns offset in CMOS bank 0 of the verified boot non-volatile + storage block, counting from the first writable CMOS byte + (that is, 'offset = 0' is the byte following the 14 bytes of + clock data). What: /sys/bus/platform/devices/GGL0001:*/VBNV.1 Date: May 2022 KernelVersion: 5.19 Description: - This file shows the size in bytes of the verified boot - non-volatile storage block. + Return the size in bytes of the verified boot non-volatile + storage block. What: /sys/bus/platform/devices/GGL0001:*/VDAT Date: May 2022 KernelVersion: 5.19 Description: - This binary file returns the verified boot data block shared - between the firmware verification step and the kernel - verification step. + Returns the verified boot data block shared between the + firmware verification step and the kernel verification step + (binary). -- cgit v1.2.3