summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2023-03-23 15:30:23 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-04-17 18:40:06 +0000
commit26d7d64e7423c1e6af33796c36d702fd4ee2e74f (patch)
treef4ac9366292a76f56dddff8340b6ff44969f4b31 /docs
parent5093a223cb5d29197cd498c80c157c1e0b60c389 (diff)
downloadchrome-ec-26d7d64e7423c1e6af33796c36d702fd4ee2e74f.tar.gz
docs: Add doc for ec_commands.h synchronization
Describe how ec_commands.h is shared among different code base and practices to share changes. BUG=b:187787115 BRANCH=none TEST=Check with `python3 src/chromium/src/tools/md_browser/md_browser.py -d src/platform/ec/docs` and go to http://localhost:8080/ap-ec-comm.md Change-Id: Ie9c1966002ca8f7b85bd28ddeda247467820f019 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4369568 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Rob Barnes <robbarnes@google.com>
Diffstat (limited to 'docs')
-rw-r--r--docs/ap-ec-comm.md23
1 files changed, 23 insertions, 0 deletions
diff --git a/docs/ap-ec-comm.md b/docs/ap-ec-comm.md
index 4270fca5f8..6f1292bcaf 100644
--- a/docs/ap-ec-comm.md
+++ b/docs/ap-ec-comm.md
@@ -120,6 +120,27 @@ cat /sys/kernel/debug/tracing/trace
369.421383: cros_ec_request_done: version: 0, command: EC_CMD_USB_PD_DISCOVERY, ec result: EC_RES_SUCCESS, retval: 5
```
+## API synchronization
+
+EC, coreboot, user space (`platform2)` and kernel needs to access the same
+information contained in `ec_commands.h`.
+
+* Coreboot regularly update [ec_commands.h].
+* User space/depthcharge use `ec_commands.h` installed by
+ `chromeos-base/chromeos-ec-headers` package.
+* Kernel `ec_commands.h` - named
+ `./include/linux/platform_data/cros_ec_commands.h` - is not a direct
+copy. New commands and options are added on a need-to-know basis
+alongside the kernel code that uses these commands.
+
+A copy of `ec_commands.h`, matching kernel standard is auto-generated at
+`/build/kernel/include/linux/mfd/cros_ec_commands.h` when
+`make build_cros_ec_commands` or `make buildall` is run. (It is far from
+perfect, since the kernel include file has not been updated with `clang-format` as
+`ec_commands.h` has been). Copy the necessary changes from that file to
+`include/linux/platform_data/cros_ec_commands.h` and push the changes upstream
+first following the [upstream instructions].
+
## Transport-specific details
Although the command and response formats are the same across all transports,
@@ -179,3 +200,5 @@ after receiving a host packet and before it has a response ready.
[Industrial I/O]: https://www.kernel.org/doc/html/v4.14/driver-api/iio/index.html
[host command task]: https://chromium.googlesource.com/chromiumos/platform/ec/+/HEAD/common/host_command.c
[Transport-specific details]: #Transport_specific-details
+[ec_commands.h]: https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/third_party/coreboot/src/ec/google/chromeec/ec_commands.h
+[upstream instructions]: https://chromium.googlesource.com/chromiumos/docs/+/HEAD/kernel_development.md#Upstream-development.