platform/chrome: wilco_ec: Fix documentation for debugfs raw attribute
PATCH v4 1/2 platform/chrome: wilco_ec: Fix documentation for debugfs raw attribute
In a previous refactor [repo chrome-platform, branch for-next, commit 9cced499d6fdb60434ffa94f8f4b5087ad35802b ("platform/chrome: wilco_ec: Standardize mailbox interface")], the documentation for the raw debugfs attribute became incorrect, but I forgot to fix it. This patch fixes it, as well as de-duplicates the documentation by removing it from the source file header comment.
--- Documentation/ABI/testing/debugfs-wilco-ec | 32 ++++++++++++++-------- drivers/platform/chrome/wilco_ec/debugfs.c | 27 +----------------- 2 files changed, 22 insertions(+), 37 deletions(-)
Documentation/ABI/testing/debugfs-wilco-ec +21 -11
@@ -4,20 +4,30 @@ KernelVersion: 5.1 Description: Write and read raw mailbox commands to the EC. - For writing: - Bytes 0-1 indicate the message type: - 00 F0 = Execute Legacy Command - 00 F2 = Read/Write NVRAM Property - Byte 2 provides the command code - Bytes 3+ consist of the data passed in the request + You can write a hexadecimal sentence to raw, and that series of + bytes will be sent to the EC. Then, you can read the bytes of + response by reading from raw. - At least three bytes are required, for the msg type and command, - with additional bytes optional for additional data. + For writing, bytes 0-1 indicate the message type, one of enum + wilco_ec_msg_type. Byte 2+ consist of the data passed in the + request, starting at MBOX[0] + + At least three bytes are required for writing, two for the type + and at least a single byte of data. Only the first + EC_MAILBOX_DATA_SIZE bytes of MBOX will be used. Example: // Request EC info type 3 (EC firmware build date) - $ echo 00 f0 38 00 03 00 > raw + // Corresponds with sending type 0x00f0 with + // MBOX = [38, 00, 03, 00] + $ echo 00 f0 38 00 03 00 > /sys/kernel/debug/wilco_ec/raw // View the result. The decoded ASCII result "12/21/18" is // included after the raw hex. - $ cat raw - 00 31 32 2f 32 31 2f 31 38 00 38 00 01 00 2f 00 .12/21/18.8... + // Corresponds with MBOX = [00, 00, 31, 32, 2f, 32, 31, 38, ...] + $ cat /sys/kernel/debug/wilco_ec/raw + 00 00 31 32 2f 32 31 2f 31 38 00 38 00 01 00 2f 00 ..12/21/18.8... + + Note that the first 32 bytes of the received MBOX[] will be + printed, even if some of the data is junk. It is up to you to + know how many of the first bytes of data are the actual + response.
drivers/platform/chrome/wilco_ec/debugfs.c +1 -26
@@ -4,32 +4,7 @@* * Copyright 2019 Google LLC * -* There is only one attribute used for debugging, called raw. -* You can write a hexadecimal sentence to raw, and that series of bytes -* will be sent to the EC. Then, you can read the bytes of response -* by reading from raw. -* -* For writing: -* Bytes 0-1 indicate the message type, one of enum wilco_ec_msg_type -* Byte 2+ consist of the data passed in the request, starting at MBOX[0] -* -* At least three bytes are required for writing, two for the type and at -* least a single byte of data. Only the first EC_MAILBOX_DATA_SIZE bytes -* of MBOX will be used. -* -* Example: -* // Request EC info type 3 (EC firmware build date) -* // Corresponds with sending type 0x00f0 with MBOX = [38, 00, 03, 00] -* $ echo 00 f0 38 00 03 00 > /sys/kernel/debug/wilco_ec/raw -* // View the result. The decoded ASCII result "12/21/18" is -* // included after the raw hex. -* // Corresponds with MBOX = [00, 00, 31, 32, 2f, 32, 31, ...] -* $ cat /sys/kernel/debug/wilco_ec/raw -* 00 00 31 32 2f 32 31 2f 31 38 00 38 00 01 00 2f 00 ..12/21/18.8... -* -* Note that the first 32 bytes of the received MBOX[] will be printed, -* even if some of the data is junk. It is up to you to know how many of -* the first bytes of data are the actual response. +* See Documentation/ABI/testing/debugfs-wilco-ec for usage. */ #include <linux/ctype.h>
Signature · 1 line
2.20.1
PATCH v4 2/2 platform/chrome: wilco_ec: Add h1_gpio status to debugfs
As part of Chrome OS's FAFT (Fully Automated Firmware Testing) tests, we need to ensure that the H1 chip is properly setting some GPIO lines. The h1_gpio attribute exposes the state of the lines:
- ENTRY_TO_FACT_MODE in BIT(0)
- SPI_CHROME_SEL in BIT(1)
There are two reasons that I am exposing this in debugfs, and not as a GPIO:
1. This is only useful for testing, so end users shouldn't ever care about this. In fact, if it passes the tests, then the value of h1_gpio will always be 2, so it would be really uninteresting for users.
2. This GPIO is not connected to, controlled by, or really even related to the AP. The GPIO runs between the EC and the H1 security chip.
Changes in v4:
- Use "0x02x\n" instead of "02x\n" for format string
- Use DEFINE_DEBUGFS_ATTRIBUTE()
- Add documentation
Changes in v3:
- Fix documentation to correspond with formatting change in v2. Changes in v2:
- Zero out the unused fields in the request.
- Format result as "%02x\n" instead of as a decimal.
--- Documentation/ABI/testing/debugfs-wilco-ec | 13 ++++++ drivers/platform/chrome/wilco_ec/debugfs.c | 47 ++++++++++++++++++++++ 2 files changed, 60 insertions(+)
Documentation/ABI/testing/debugfs-wilco-ec +13 -0
@@ -1,3 +1,16 @@ +What: /sys/kernel/debug/wilco_ec/h1_gpio +Date: April 2019 +KernelVersion: 5.2 +Description: + As part of Chrome OS's FAFT (Fully Automated Firmware Testing) + tests, we need to ensure that the H1 chip is properly setting + some GPIO lines. The h1_gpio attribute exposes the state + of the lines: + - ENTRY_TO_FACT_MODE in BIT(0) + - SPI_CHROME_SEL in BIT(1) + + Output will formatted with "0x%02x\n". + What: /sys/kernel/debug/wilco_ec/raw Date: January 2019 KernelVersion: 5.1
drivers/platform/chrome/wilco_ec/debugfs.c +47 -0
59 lines not on this page · raw message
Signature · 1 line
2.20.1
Re: [PATCH v4 2/2] platform/chrome: wilco_ec: Add h1_gpio status to debugfs
Quoted 25 lines · Nick Crews
As part of Chrome OS's FAFT (Fully Automated Firmware Testing) tests, we need to ensure that the H1 chip is properly setting some GPIO lines. The
h1_gpioattribute exposes the state of the lines:
-ENTRY_TO_FACT_MODEin BIT(0)
-SPI_CHROME_SELin BIT(1)There are two reasons that I am exposing this in debugfs, and not as a GPIO:
1. This is only useful for testing, so end users shouldn't ever care about this. In fact, if it passes the tests, then the value ofh1_gpiowill always be 2, so it would be really uninteresting for users.
2. This GPIO is not connected to, controlled by, or really even related to the AP. The GPIO runs between the EC and the H1 security chip.Changes in v4:
- Use "0x02x\n" instead of "02x\n" for format string
- UseDEFINE_DEBUGFS_ATTRIBUTE()
- Add documentation
Changes in v3:
- Fix documentation to correspond with formatting change in v2. Changes in v2:
- Zero out the unused fields in the request.
- Format result as "%02x\n" instead of as a decimal.
Quoted 1 line
Signed-off-by Nick Crews <[email protected]>
Applied for 5.2
Thanks
Hi Nick,
Quoted 7 lines · Nick Crews
In a previous refactor [repo chrome-platform, branch for-next, commit
9cced499d6fdb60434ffa94f8f4b5087ad35802b("platform/chrome:wilco_ec: Standardize mailbox interface")], the documentation for the raw debugfs attribute became incorrect, but I forgot to fix it. This patch fixes it, as well as de-duplicates the documentation by removing it from the source file header comment.
Quoted 5 lines
Signed-off-by Nick Crews <[email protected]>--- Documentation/ABI/testing/debugfs-wilco-ec | 32 ++++++++++++++-------- drivers/platform/chrome/wilco_ec/debugfs.c | 27 +----------------- 2 files changed, 22 insertions(+), 37 deletions(-)
I'm going to squash this commit and queue for 5.2.
Thanks,
Enric