u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Paul Barker <paul.barker@sancloud.com>
To: u-boot@lists.denx.de, Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Tom Rini <trini@konsulko.com>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Paul Barker <paul.barker@sancloud.com>
Subject: [PATCH v3 0/3] Support UEFI SPI I/O protocol
Date: Wed, 21 Sep 2022 17:06:25 +0100	[thread overview]
Message-ID: <20220921160628.4166966-1-paul.barker@sancloud.com> (raw)

These patches add support for the UEFI SPI I/O protocol defined in the
UEFI Platform Initialization (PI) Specification, Version 1.7 Errata A
(April 2020). This allows a UEFI application to interact with devices
on the SPI bus.

This support is initially intended to be used to communicate with SPI
devices from "pre-boot" UEFI applications which perform setup before
the main OS is loaded. Other use cases may also be supported, however
this is not intended to be a replacement for UEFI capsule updates.

The "pre-boot" UEFI application which we are currently developing will
interact with a Micron Authenta[1] flash device, sending vendor-specific
commands over the SPI bus to make use of Authenta security features, to
verify flash integrity and to generate ephemeral keys based on the flash
contents.

The code here is self-contained and easy to enable/disable at compile
time. Compilation testing with am335x_evm_defconfig shows that the size
of u-boot.img increases by less than 2kB when CONFIG_EFI_SPI_PROTOCOL
is enabled.

[1]: https://www.micron.com/-/media/client/global/documents/products/product-flyer/authenta_technology_solutions_brief.pdf

Changes since v2:

* Added description to efi_spi_protocol.h.

* Moved definition of EFI_SPI_CONFIGURATION_GUID to efi_api.h and
  added it to the list in lib/uuid.c.

* Fixed UEFI GUID byte order in test.dts and in debug output.

* Use log_debug() instead of printf() for debug output.

* Add test cases to confirm that efi_legacy_spi_controller_protocol
  functions return EFI_UNSUPPORTED (as they are not currently
  implemented)

Changes since v1:

* Skip emulated SPI peripherals. These appear as duplicates within the
  list of devices on the bus when using the sandbox SPI drivers.

* Make most printf statements debug only.

* Add efi_seltest unit test.

* Do not enable config EFI_SPI_PROTOCOL by default.

* Mark functions with EFIAPI where necessary.

* Handle debug_transaction argument to efi_spi_io_transaction().

* Handle a value of zero for target->max_read_size &
  target->max_write_size.

* Probe inactive SPI devices when initializing the EFI SPI protocol to
  ensure that dev_get_parent_priv() returns valid data and the exported
  devices are ready to use.

Paul Barker (3):
  efi_loader: Add SPI I/O protocol support
  arm: dts: am335x-sancloud-bbe-lite: UEFI SPI export
  am335x_evm_defconfig: Enable Micron SPI flash support

 MAINTAINERS                                  |   7 +
 arch/arm/dts/am335x-sancloud-bbe-lite.dts    |  10 +-
 arch/sandbox/dts/test.dts                    |  13 +
 configs/am335x_evm_defconfig                 |   1 +
 include/efi_api.h                            |   4 +
 include/efi_loader.h                         |   4 +
 include/efi_spi_protocol.h                   | 166 +++++
 lib/efi_loader/Kconfig                       |   8 +
 lib/efi_loader/Makefile                      |   1 +
 lib/efi_loader/efi_setup.c                   |   6 +
 lib/efi_loader/efi_spi_protocol.c            | 614 +++++++++++++++++++
 lib/efi_selftest/Makefile                    |   1 +
 lib/efi_selftest/efi_selftest_spi_protocol.c | 284 +++++++++
 lib/uuid.c                                   |   4 +
 14 files changed, 1121 insertions(+), 2 deletions(-)
 create mode 100644 include/efi_spi_protocol.h
 create mode 100644 lib/efi_loader/efi_spi_protocol.c
 create mode 100644 lib/efi_selftest/efi_selftest_spi_protocol.c

-- 
2.25.1


             reply	other threads:[~2022-09-21 16:06 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-21 16:06 Paul Barker [this message]
2022-09-21 16:06 ` [PATCH v3 1/3] efi_loader: Add SPI I/O protocol support Paul Barker
2022-09-26 12:43   ` Ilias Apalodimas
2022-09-26 13:13     ` Heinrich Schuchardt
2022-09-26 13:40       ` Ilias Apalodimas
2022-10-03 12:05       ` Paul Barker
2022-10-03 12:00     ` Paul Barker
2022-09-26 13:52   ` Heinrich Schuchardt
2022-10-03 12:05     ` Paul Barker
2022-10-04 16:31       ` Paul Barker
2022-10-04 17:25         ` Heinrich Schuchardt
2022-09-21 16:06 ` [PATCH v3 2/3] arm: dts: am335x-sancloud-bbe-lite: UEFI SPI export Paul Barker
2022-09-21 16:15   ` Tom Rini
2022-09-26 11:33     ` Ilias Apalodimas
2022-09-26 13:13       ` Tom Rini
2022-09-26 13:33         ` Heinrich Schuchardt
2022-09-26 19:13           ` Tom Rini
2022-09-21 16:06 ` [PATCH v3 3/3] am335x_evm_defconfig: Enable Micron SPI flash support Paul Barker
2022-09-26 13:21   ` Heinrich Schuchardt
2022-10-03 12:07     ` Paul Barker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220921160628.4166966-1-paul.barker@sancloud.com \
    --to=paul.barker@sancloud.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).