From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jose Marinho Date: Tue, 2 Mar 2021 12:13:51 +0000 Subject: [PATCH 0/3 v5] Add ESRT and test ESRT creation Message-ID: <20210302121354.23009-1-jose.marinho@arm.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de The following 3 commits add the ESRT and provide a test of the functionality. The first commit adds the ESRT as defined in the UEFI 2.8 specification. An empty ESRT is created during the execution of the efi_init_obj_list(). The ESRT is updated when: 1) a FMP protocol is installed in the system: this will add the corresponding entries to the ESRT. 2) a capsule is installed via UpdateCapsule: this should update entries already present in the ESRT. This implementation of the ESRT creation takes input from FMP only. It is assumed that the FMP will maintain the following values across reboot: - LastAttemptVersion. - LastAttemptStatus. The second commit introduces a helper cmd function to print the ESRT in the u-boot shell. The third commit enables testing the ESRT creation in the sandbox platform. That commit is composed of 2 tests. - Test 1 executes from the u-boot shell with "bootefi selftest". - Test 2 executes in the pytest environment. Patch v5: - Address v4 comments. - split the v4 2/2 commit into the v5 2/3 (debug print ESRT) and 3/3 ESRT tests. Patch v4: - update stale [Patch 1/2 v3] commit message. Patch v3: - Address v2 comments. Patch v2: - The ESRT is now regenerated from scratch at every FMP EVT_NOTIFY_SIGNAL and whenever a capsule is updated. - Extended TestEfiCapsuleFirmwareFit::test_efi_capsule_fw3 to verify that the ESRT is correctly populated after an UpdateCapsule. - Addressed v1 comments. Patch v1: - reworked the ESRT creation code, allowing table to resize as FMPs are installed. - registered a callback for the FMP protocol install. - Created a unit test running on the sandbox platform. rfc: initial patch submission CC: Heinrich Schuchardt CC: Sughosh Ganu CC: AKASHI Takahiro CC: Ilias Apalodimas CC: Andre Przywara CC: Alexander Graf CC: nd at arm.com Jose Marinho (3): efi: Add ESRT to the EFI system table cmd: efi: ESRT table debug print efi: ESRT creation tests cmd/efidebug.c | 68 +++ include/efi_api.h | 21 + include/efi_loader.h | 24 + lib/efi_loader/Kconfig | 7 + lib/efi_loader/Makefile | 1 + lib/efi_loader/efi_boottime.c | 7 +- lib/efi_loader/efi_capsule.c | 8 + lib/efi_loader/efi_esrt.c | 510 ++++++++++++++++++ lib/efi_loader/efi_setup.c | 6 + lib/efi_selftest/Makefile | 2 + lib/efi_selftest/efi_selftest_esrt.c | 227 ++++++++ .../test_efi_capsule/test_capsule_firmware.py | 4 + 12 files changed, 881 insertions(+), 4 deletions(-) create mode 100644 lib/efi_loader/efi_esrt.c create mode 100644 lib/efi_selftest/efi_selftest_esrt.c -- 2.17.1