From 4f6b1c0dcf9f9cb734f71b277af913e0d58c503f Mon Sep 17 00:00:00 2001 From: Patrick Williams Date: Thu, 15 Jun 2023 16:18:34 -0500 Subject: subtree updates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit poky: ddb298ce89..fc25449687: Alex Kiernan (1): rust: Upgrade 1.68.1 -> 1.68.2 Alexander Kanavin (5): selftest/distrodata: clean up exception lists in recipe maintainers test dhcpcd: use git instead of tarballs perl: patch out build paths from native binaries libgcrypt: update 1.10.1 -> 1.10.2 rpm: update 4.18.0 -> 4.18.1 Andrew Jeffery (1): Revert "ipk: Decode byte data to string in manifest handling" Archana Polampalli (1): git: ignore CVE-2023-25815 Arslan Ahmad (1): kernel-fitimage: Fix the default dtb config check Bruce Ashfield (9): kernel: improve initramfs bundle processing time yocto-bsps: update to v5.15.106 linux-yocto/5.15: update to v5.15.109 linux-yocto/5.15: update to v5.15.110 linux-yocto/5.15: update to v5.15.111 linux-yocto/5.15: update to v5.15.112 linux-yocto/5.15: update to v5.15.113 kernel: don't force PAHOLE=false linux-yocto: move build / debug dependencies to .inc Chen Qi (1): staging.bbclass: do not add extend_recipe_sysroot to prefuncs of prepare_recipe_sysroot Chi Xu (1): expect: Add ptest support Daniel Ammann (1): overview-manual: concepts.rst: Fix a typo Deepthi Hemraj (1): binutils: stable 2.40 branch updates Denys Dmytriyenko (1): xz: upgrade 5.4.2 -> 5.4.3 Dmitry Baryshkov (1): linux-firmware: upgrade 20230210 -> 20230404 Eero Aaltonen (1): avahi: fix D-Bus introspection Enrico Jörns (1): package_manager/ipk: fix config path generation in _create_custom_config() Jan Vermaete (1): cve-update-nvd2-native: added the missing http import Joe Slater (1): ghostscript: fix CVE-2023-28879 Johannes Schrimpf (1): python3targetconfig.bbclass: Extend PYTHONPATH instead of overwriting Kai Kang (1): libnotify: remove dependency dbus Khem Raj (10): cargo: Fix build on musl/riscv gawk: Disable known ptest fails on musl gawk: Remove redundant patch gawk: Add skipped.txt to emit test to ignore libxml2: Disable icu tests on musl quilt: Fix merge.test race condition piglit: Fix c++11-narrowing warnings in tests cpio: Run ptests under ptest user go: Upgrade 1.20.1 -> 1.20.4 go: Use -no-pie to build target cgo Lee Chee Yang (3): release-notes-4.2: update known issues and Repositories/Downloads migration-guides: add release-notes for 4.1.4 migration-guides: add release notes for 4.2.1 Lorenzo Arena (1): conf: add nice level to the hash config ignred variables Luca Ceresoli (2): ref-manual: classes: kernel: remove incorrect sentence opening ref-manual: classes: kernel: document automatic defconfig usage Markus Volk (1): gtk4: update 4.10.0 -> 4.10.3 Martin Jansa (7): populate_sdk_ext.bbclass: set METADATA_REVISION with an DISTRO override populate_sdk_ext.bbclass: redirect stderr to stdout so that both end in LOGFILE populate_sdk_base.bbclass: respect MLPREFIX for ptest-pkgs's ptest-runner binutils: package static libs from gprofng go.bbclass: don't use test to check output from ls image-live.bbclass: respect IMAGE_MACHINE_SUFFIX rpm: drop unused 0001-Rip-out-partial-support-for-unused-MD2-and-RIPEMD160.patch Martin Siegumfeldt (1): systemd-systemctl: fix instance template WantedBy symlink construction Michael Halstead (2): uninative: Upgrade to 3.10 to support gcc 13 uninative: Upgrade to 4.0 to include latest gcc 13.1.1 Michael Opdenacker (2): migration-guides: release-notes-4.2: add doc improvement highlights releases.svg: fix and explain duration of Hardknott 3.3 Mikko Rapeli (1): qemurunner: avoid leaking server_socket Ming Liu (1): weston: add xwayland to DEPENDS for PACKAGECONFIG xwayland Otavio Salvador (1): mesa: 23.0.2 -> 23.0.3 Pablo Saavedra (1): gstreamer1.0: upgrade 1.22.0 -> 1.22.2 Paul Gortmaker (1): scripts: fix buildstats diff/summary hard bound to host python3 Pavel Zhukov (1): lib/terminal.py: Add urxvt terminal Pawan Badganchi (1): tiff: Add fix for CVE-2022-4645 Peter Bergin (1): update-alternatives.bbclass: fix old override syntax Peter Kjellerstedt (3): license.bbclass: Include LICENSE in the output when it fails to parse musl: Correct SRC_URI xf86-video-intel: Use the HTTPS protocol to fetch the Git repositories Piotr Łobacz (1): libarchive: Enable acls, xattr for native as well as target Qiu Tingting (2): e2fsprogs: fix ptest bug for second running e2fsprogs: Fix error SRCDIR when using usrmerge DISTRO_FEATURES Randy MacLeod (1): vim: upgrade 9.0.1429 -> 9.0.1527 Ranjitsinh Rathod (2): libbsd: Add correct license for all packages kmscube: Correct DEPENDS to avoid overwrite Richard Purdie (8): qemu: Add fix for powerpc instruction fallback issue qemu: Update ppc instruction fix to match revised upstream version glib-networking: Add test retry to avoid failures glib-networking: Correct glib error handling in test patch maintainers.inc: Fix email address typo maintainers.inc: Move repo to unassigned recipes: Default to https git protocol where possible selftest/reproducible: Allow native/cross reuse in test Ross Burton (5): connman: backport fix for CVE-2023-28488 cpio: fix appending to archives larger than 2GB machine/qemuarm*: don't explicitly set vmalloc gdb: fix crashes when debugging threads with Arm Pointer Authentication enabled meta: depend on autoconf-archive-native, not autoconf-archive Steve Sakoman (3): Revert "xserver-xorg: backport fix for CVE-2023-1393" poky.conf: bump version for 4.2.1 release build-appliance-image: Update to mickledore head revision Sudip Mukherjee (4): libxfixes: Upgrade to v6.0.1 xwininfo: upgrade to v1.1.6 xinput: upgrade to v1.6.4 libxi: upgrade to v1.8.1 Thomas Roos (3): oeqa/utils/metadata.py: Fix running oe-selftest running with no distro set oeqa/selftest/cases/devtool.py: skip all tests require folder a git repo oeqa: adding selftest-hello and use it to speed up tests Tim Orling (1): libmodule-build-perl: upgrade 0.4232 -> 0.4234 Tom Hochstein (1): piglit: Add missing glslang dependencies Ulrich Ölmann (1): ref-manual: classes.rst: fix typo Upgrade Helper (1): waffle: upgrade 1.7.0 -> 1.7.2 Virendra Thakur (1): qemu: Whitelist CVE-2023-0664 Wang Mingyu (18): apr: upgrade 1.7.2 -> 1.7.3 bind: upgrade 9.18.12 -> 9.18.13 cracklib: upgrade 2.9.10 -> 2.9.11 libhandy: upgrade 1.8.1 -> 1.8.2 libpcap: upgrade 1.10.3 -> 1.10.4 libsdl2: upgrade 2.26.3 -> 2.26.5 mpg123: upgrade 1.31.2 -> 1.31.3 man-pages: upgrade 6.03 -> 6.04 mtools: upgrade 4.0.42 -> 4.0.43 pango: upgrade 1.50.13 -> 1.50.14 ruby: upgrade 3.2.1 -> 3.2.2 texinfo: upgrade 7.0.2 -> 7.0.3 wpebackend-fdo: upgrade 1.14.0 -> 1.14.2 xserver-xorg: upgrade 21.1.7 -> 21.1.8 xwayland: upgrade 22.1.8 -> 23.1.1 vala: upgrade 0.56.4 -> 0.56.6 mesa: upgrade 23.0.0 -> 23.0.2 iso-codes: upgrade 4.13.0 -> 4.15.0 Xiangyu Chen (1): sysstat: Fix CVE-2023-33204 Yoann Congal (1): cve-extra-exclusions: linux-yocto: ignore fixed CVE-2023-1652 & CVE-2023-1829 Zhixiong Chi (1): libpam: Fix the xtests/tst-pam_motd[1|3] failures bkylerussell@gmail.com (1): kernel-devsrc: depend on python3-core instead of python3 hen Qi (1): unfs3: fix symlink time setting issue nikhil (1): tiff: Remove unused patch from tiff meta-raspberrypi: bf948e0aa8..aa0aed9a08: Florin Sarbu (1): udev-rules-rpi: Use 99-com.rules directly from upstream Martin Jansa (3): rpi-libcamera-apps: fix flags used in aarch64 builds rpi-libcamera-apps: fix version generation on hosts with older python rpi-libcamera-apps: bump to latest SRCREV and set PV meta-openembedded: 2d89a469e5..9286582126: Alexander Amelkin (1): ipmitool: Update links Arsalan H. Awan (1): meta-networking/licenses/netperf: remove unused license Bartosz Golaszewski (2): python3-gpiod: add missing run-time dependencies libgpiod: install the libgpiosim header Bergin, Peter (1): freediameter: fix typo and old overide syntax Bhargav Das (2): tslib: Add native & nativestdk package support pointercal: Add native & nativestdk package support Changqing Li (1): redis: upgrade 6.2.11 -> 6.2.12 Chen Qi (1): frr: add CVE_PRODUCT Jasper Orschulko (1): python3-gcovr: Add missing runtime dependency Joe Slater (1): bats: use baselib Khem Raj (48): fwupd: Do not emit build time paths into generated headers libcereal: Fix TMPDIR leaking into debug_str section libtimezonemap: Point to a working SRC_URI unixODBC: Update SRC_URI to use updated location of tarball unicode-ucd: Update license URI to reflect renamed license libx86: Point to working SRC_URI ctapi-common: Point to working SRC_URI locations netkit-ftp: Update to debian patch 34 nicstat: Use SOURCEFORGE_MIRROR in SRC_URI rp-pppoe: Point SRC_URI to valid location ttf-mplus: Point to valid download location for SRC_URI ttf-lklug: Point SRC_URI to a working location radiusclient-ng: Point SRC_URI to archive.ubuntu.com httpfs2: Do not use S during compile/install tasks p910nd: Switch to using github for SRC_URI mosh: Point SRC_URI to https://mosh.org/ debootstrap: Update SRC_URI to point to valid URL debootstrap: Use DEBIAN_MIRROR for SRC_URI ttf-gentium: Switch to debian archive mirror for SRC_URI nfacct: Update SRC_URI to point to valid URL libencode-perl: Remove buildpaths from generated .exh files enca: Remove buildpaths from target scripts libirecovery: Add missing build dependency on readline fftw: Remove hardcoded sysroot into binaries lmdb: Pass CFLAGS to Makefile php: Remove buildpaths from scripts and generated headers uw-imap: Pass CFLAGS from environment libmad: Add a patch to pass cflags to build libpeas: Fix reference to TMPDIR in tests lirc: Define SH_PATH=/bin/sh mce-inject: Pass CFLAGS to make nbdkit: Remove buildpaths from binaries mpv: Remove references to builddir from mpv binary libnice: Remove buildpaths from binaries curlpp: Remove references to buildpaths e.g. TMPDIR unbound: Remove references to buildpaths uml-utilities: Fix references to TMPDIR openct: Fix buildpaths being emitted into generated types.h minifi-cpp: Remove references to buildpaths in generated files freerdp: Fix reference to TMPDIR in libfreerdp2.so nautilus: Fix buildpath QA errors cgdb: Fix buildpaths emitted into cgdb binary ibus: Point python interpreter to target location gimp: Fix buildpaths in binaries and scripts libgphoto2: Edit out sysroot from CC variable in configure vlan: Pass CFLAGS via CCFLAGS sgpio: Pass CFLAGS to make x265: Pass --debug-prefix-map to nasm Markus Volk (1): polkit: update SRC_URI Martin Jansa (16): lirc: fix do_install with multilib dleyna-{server,renderer}: fix dev-so QA issue with multilib libreport: add dependency on libarchive libxmlb: add missing dependency on glib-2.0 and xz geoclue: fix build without gobject-introspection-data appstream: fix build without gobject-introspection-data ostree: fix build without gobject-introspection-data rdfind: fix build with -Werror=return-type spice-gtk: respect gobject-introspection-data cpulimit: fix do_install with multilib libnfs: fix installed-vs-shipped issues with multilib btrfsmaintenance: install to ${datadir}/${BPN} libtomcrypt: pass LIBPATH to fix installed-vs-shipped with multilib nanopb: fix installed-vs-shipped with multilib nv-codec-headers: fix installed-vs-shipped with multilib zfs: fix installation paths for multilib Ming Liu (2): libusbgx: drop hard-coded /usr/bin,/etc libusbgx: check scripts in /etc/usbgx.d Mingli Yu (2): php: Link with libatomic on rv64 minicoredumper: correct the sysvinit service file attribute Peter Marko (1): ntp: whitelist CVE-2019-11331 Petr Gotthard (1): gensio: fix QA issue: non -staticdev package with .a libraries Valeria Petrov (1): apache2: upgrade 2.4.56 -> 2.4.57 Virendra Thakur (2): p7zip: fix for CVE-2018-5996 p7zip: Fix for CVE-2016-9296 Wang Mingyu (6): redis: upgrade 7.0.10 -> 7.0.11 hdf5: Fix install conflict when enable multilib. php: upgrade 8.2.4 -> 8.2.5 postgresql: upgrade 15.2 -> 15.3 php: upgrade 8.2.5 -> 8.2.6 nautilus: upgrade 44.0 -> 44.1 Yogita Urade (1): dlt-daemon: fix CVE-2023-26257 schitrod=cisco.com@lists.openembedded.org (1): gnulib: Update recipe name to 2018-12-18 meta-security: 53c5cc794f..d7db0a3bd1: Peter Hoyes (1): meta-parsec/layer.conf: Insert addpylib declaration meta-arm: 0b5724266a..8db460fa5d: Abdellatif El Khlifi (2): kas: corstone1000: set branches to mickledore arm-bsp/u-boot: corstone1000: upgrade NVMXIP support Emekcan Aras (3): arm-bsp/trusted-firmware-m: Align Capsule Update with GPT changes arm-bsp/wic: corstone1000: Fix and limit the partition size for corstone1000 arm-bsp/u-boot: corstone1000: enable PSCI reset Signed-off-by: Patrick Williams Change-Id: Id8a293d03f6c2320ff407a7aaed4416038ba04ed --- ...rstone1000-Increase-BL2-size-in-flash-lay.patch | 29 + ...tform-Corstone1000-Increase-BL2_DATA_SIZE.patch | 33 ++ ...rstone1000-Calculate-the-new-CRC32-value-.patch | 71 +++ .../trusted-firmware-m-1.7.0-corstone1000.inc | 3 + ...-add-support-for-SMCCCv1.2-x0-x17-registe.patch | 12 +- ...uid-introduce-uuid_str_to_le_bin-function.patch | 10 +- ...m_ffa-introduce-Arm-FF-A-low-level-driver.patch | 30 +- .../0004-arm_ffa-efi-unmap-RX-TX-buffers.patch | 8 +- .../0005-arm_ffa-introduce-armffa-command.patch | 16 +- ...arm_ffa-introduce-the-FF-A-Sandbox-driver.patch | 30 +- ...troduce-Sandbox-test-cases-for-UCLASS_FFA.patch | 12 +- ...ffa-introduce-armffa-command-Sandbox-test.patch | 12 +- ...m_ffa-efi-introduce-FF-A-MM-communication.patch | 12 +- ...-efi-corstone1000-enable-MM-communication.patch | 10 +- ...corstone1000-introduce-EFI-capsule-update.patch | 20 +- ...tone1000-fix-unrecognized-filesystem-type.patch | 8 +- ...-corstone1000-pass-interface-id-and-buffe.patch | 10 +- ...e-corstone1000-pass-interface-id-and-kern.patch | 8 +- ...corstone1000-remove-guid-check-from-corst.patch | 8 +- ...populate-ESRT-table-if-EFI_ESRT-config-op.patch | 8 +- ...mware-add-get_image_info-for-corstone1000.patch | 8 +- ...send-bootcomplete-message-to-secure-encla.patch | 14 +- ...fix-null-pointer-exception-with-get_image.patch | 8 +- .../0020-arm-corstone1000-add-mmc-for-fvp.patch | 12 +- ...orstone1000-add-compressed-kernel-support.patch | 8 +- ...roduce-external-sys-driver-to-device-tree.patch | 8 +- ...hu-and-rpmsg-client-to-u-boot-device-tree.patch | 8 +- .../0024-arm-corstone1000-esrt-support.patch | 12 +- ...iscover-FF-A-bus-before-raising-EFI-start.patch | 8 +- ...orstone1000-enable-distro-booting-command.patch | 8 +- ...-nvmxip-introduce-NVM-XIP-block-storage-e.patch | 455 ++++++++++++++++ ...xip-introduce-NVM-XIP-block-storage-emula.patch | 595 --------------------- ...vers-mtd-nvmxip-introduce-QSPI-XIP-driver.patch | 271 ++++++++++ ...ndbox64-fix-return-unsigned-long-in-readq.patch | 46 -- ...029-sandbox64-add-support-for-NVMXIP-QSPI.patch | 113 ---- ...ndbox64-fix-return-unsigned-long-in-readq.patch | 45 ++ ...one1000-add-NVM-XIP-QSPI-device-tree-node.patch | 35 -- ...030-sandbox64-add-support-for-NVMXIP-QSPI.patch | 161 ++++++ ...one1000-add-NVM-XIP-QSPI-device-tree-node.patch | 42 ++ ...31-corstone1000-enable-NVM-XIP-QSPI-flash.patch | 29 - ...ndbox64-add-a-test-case-for-UCLASS_NVMXIP.patch | 125 +++-- ...-corstone1000-add-fwu-metadata-store-info.patch | 42 ++ ...vmxip-provide-a-u-boot-shell-test-command.patch | 135 ----- ...-corstone1000-add-fwu-metadata-store-info.patch | 42 -- ...boottime-allow-to-reset-a-path-after-boot.patch | 31 ++ ..._metadata-make-sure-structures-are-packed.patch | 50 ++ .../0035-nvmxip-shorter-block-device-name.patch | 44 -- .../0036-corstone1000-add-boot-index.patch | 33 ++ ...boottime-allow-to-reset-a-path-after-boot.patch | 31 -- ...1000-adjust-boot-bank-and-kernel-location.patch | 36 ++ ..._metadata-make-sure-structures-are-packed.patch | 50 -- .../0038-corstone1000-add-boot-index.patch | 33 -- ...1000-add-nvmxip-fwu-mdata-and-gpt-options.patch | 100 ++++ ...1000-adjust-boot-bank-and-kernel-location.patch | 36 -- .../0039-nvmxip-move-header-to-include.patch | 42 ++ ...1000-add-nvmxip-fwu-mdata-and-gpt-options.patch | 103 ---- ...one1000-set-kernel_addr-based-on-boot_idx.patch | 133 +++++ .../0041-corstone1000-boot-index-from-active.patch | 42 ++ .../0041-nvmxip-move-header-to-include.patch | 42 -- .../0042-corstone1000-enable-PSCI-reset.patch | 30 ++ ...one1000-set-kernel_addr-based-on-boot_idx.patch | 133 ----- .../0043-corstone1000-boot-index-from-active.patch | 42 -- .../recipes-bsp/u-boot/u-boot_%.bbappend | 85 ++- 63 files changed, 1930 insertions(+), 1746 deletions(-) create mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0013-Platform-corstone1000-Increase-BL2-size-in-flash-lay.patch create mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0014-Platform-Corstone1000-Increase-BL2_DATA_SIZE.patch create mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0015-Platform-Corstone1000-Calculate-the-new-CRC32-value-.patch create mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0027-drivers-mtd-nvmxip-introduce-NVM-XIP-block-storage-e.patch delete mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0027-drivers-nvmxip-introduce-NVM-XIP-block-storage-emula.patch create mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0028-drivers-mtd-nvmxip-introduce-QSPI-XIP-driver.patch delete mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0028-sandbox64-fix-return-unsigned-long-in-readq.patch delete mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0029-sandbox64-add-support-for-NVMXIP-QSPI.patch create mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0029-sandbox64-fix-return-unsigned-long-in-readq.patch delete mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0030-corstone1000-add-NVM-XIP-QSPI-device-tree-node.patch create mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0030-sandbox64-add-support-for-NVMXIP-QSPI.patch create mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0031-corstone1000-add-NVM-XIP-QSPI-device-tree-node.patch delete mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0031-corstone1000-enable-NVM-XIP-QSPI-flash.patch create mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0033-corstone1000-add-fwu-metadata-store-info.patch delete mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0033-nvmxip-provide-a-u-boot-shell-test-command.patch delete mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0034-corstone1000-add-fwu-metadata-store-info.patch create mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0034-efi_boottime-allow-to-reset-a-path-after-boot.patch create mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0035-fwu_metadata-make-sure-structures-are-packed.patch delete mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0035-nvmxip-shorter-block-device-name.patch create mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0036-corstone1000-add-boot-index.patch delete mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0036-efi_boottime-allow-to-reset-a-path-after-boot.patch create mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0037-corstone1000-adjust-boot-bank-and-kernel-location.patch delete mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0037-fwu_metadata-make-sure-structures-are-packed.patch delete mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0038-corstone1000-add-boot-index.patch create mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0038-corstone1000-add-nvmxip-fwu-mdata-and-gpt-options.patch delete mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0039-corstone1000-adjust-boot-bank-and-kernel-location.patch create mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0039-nvmxip-move-header-to-include.patch delete mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0040-corstone1000-add-nvmxip-fwu-mdata-and-gpt-options.patch create mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0040-corstone1000-set-kernel_addr-based-on-boot_idx.patch create mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0041-corstone1000-boot-index-from-active.patch delete mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0041-nvmxip-move-header-to-include.patch create mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0042-corstone1000-enable-PSCI-reset.patch delete mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0042-corstone1000-set-kernel_addr-based-on-boot_idx.patch delete mode 100644 meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0043-corstone1000-boot-index-from-active.patch (limited to 'meta-arm/meta-arm-bsp/recipes-bsp') diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0013-Platform-corstone1000-Increase-BL2-size-in-flash-lay.patch b/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0013-Platform-corstone1000-Increase-BL2-size-in-flash-lay.patch new file mode 100644 index 0000000000..92d17cc0db --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0013-Platform-corstone1000-Increase-BL2-size-in-flash-lay.patch @@ -0,0 +1,29 @@ +From 77c5a3bd090955e48ffca92bf9535185d26e9017 Mon Sep 17 00:00:00 2001 +From: Emekcan Aras +Date: Mon, 15 May 2023 10:42:23 +0100 +Subject: [PATCH 2/4] Platform: corstone1000: Increase BL2 size in flash layout + +Increases BL2 size to align with the flash page size in corstone1000. + +Signed-off-by: Emekcan Aras +Upstream-Status: Pending [Not submitted to upstream yet] +--- + platform/ext/target/arm/corstone1000/partition/flash_layout.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/platform/ext/target/arm/corstone1000/partition/flash_layout.h b/platform/ext/target/arm/corstone1000/partition/flash_layout.h +index 41b4c6323f..bfe8c4fb3c 100644 +--- a/platform/ext/target/arm/corstone1000/partition/flash_layout.h ++++ b/platform/ext/target/arm/corstone1000/partition/flash_layout.h +@@ -89,7 +89,7 @@ + #endif + + /* Static Configurations of the Flash */ +-#define SE_BL2_PARTITION_SIZE (0x18800) /* 98 KB */ ++#define SE_BL2_PARTITION_SIZE (0x19000) /* 98 KB */ + #define SE_BL2_BANK_0_OFFSET (0x9000) /* 72nd LBA */ + #define SE_BL2_BANK_1_OFFSET (0x1002000) /* 32784th LBA */ + +-- +2.17.1 + diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0014-Platform-Corstone1000-Increase-BL2_DATA_SIZE.patch b/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0014-Platform-Corstone1000-Increase-BL2_DATA_SIZE.patch new file mode 100644 index 0000000000..e2844bacc0 --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0014-Platform-Corstone1000-Increase-BL2_DATA_SIZE.patch @@ -0,0 +1,33 @@ +From 17244ac692495c23008ff784611d0ee1d42c83dc Mon Sep 17 00:00:00 2001 +From: Emekcan Aras +Date: Mon, 15 May 2023 10:46:18 +0100 +Subject: [PATCH 3/4] Platform: Corstone1000: Increase BL2_DATA_SIZE + +Increases BL2_DATA_SIZE to accommodate the changes in +metadata_write/read. + +Signed-off-by: Emekcan Aras +Upstream-Status: Pending [Not submitted to upstream yet] +--- + platform/ext/target/arm/corstone1000/partition/region_defs.h | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/platform/ext/target/arm/corstone1000/partition/region_defs.h b/platform/ext/target/arm/corstone1000/partition/region_defs.h +index abfac39b62..e7f0bad2ba 100644 +--- a/platform/ext/target/arm/corstone1000/partition/region_defs.h ++++ b/platform/ext/target/arm/corstone1000/partition/region_defs.h +@@ -90,9 +90,10 @@ + #define BL2_CODE_SIZE (IMAGE_BL2_CODE_SIZE) + #define BL2_CODE_LIMIT (BL2_CODE_START + BL2_CODE_SIZE - 1) + ++#define BL2_DATA_ADDITIONAL 448 /* To increase the BL2_DATA_SIZE more than the default value */ + #define BL2_DATA_START (BOOT_TFM_SHARED_DATA_BASE + \ + BOOT_TFM_SHARED_DATA_SIZE) +-#define BL2_DATA_SIZE (BL2_CODE_START - BL2_HEADER_SIZE - BL2_DATA_START) ++#define BL2_DATA_SIZE (BL2_CODE_START - BL2_HEADER_SIZE - BL2_DATA_START + BL2_DATA_ADDITIONAL) + #define BL2_DATA_LIMIT (BL2_DATA_START + BL2_DATA_SIZE - 1) + + /* SE BL1 regions */ +-- +2.17.1 + diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0015-Platform-Corstone1000-Calculate-the-new-CRC32-value-.patch b/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0015-Platform-Corstone1000-Calculate-the-new-CRC32-value-.patch new file mode 100644 index 0000000000..fd977ac2fd --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/files/corstone1000/0015-Platform-Corstone1000-Calculate-the-new-CRC32-value-.patch @@ -0,0 +1,71 @@ +From 83e423497afecc202a3a50c3e472161390056ebd Mon Sep 17 00:00:00 2001 +From: Emekcan Aras +Date: Mon, 15 May 2023 10:47:27 +0100 +Subject: [PATCH 4/4] Platform: Corstone1000: Calculate the new CRC32 value + after changing the metadata + +Calculates the new CRC32 value for the metadata struct after chaing a value +during the capsule update. It also updates the CRC32 field in the metadata +so it doesn't fail the CRC check after a succesfull capsule update. +It also skips doing a sanity check the BL2 nv counter after the capsule +update since the tfm bl1 does not sync metadata and nv counters in OTP during +the boot anymore. + +Signed-off-by: Emekcan Aras +Upstream-Status: Pending [Not submitted to upstream yet] +--- + .../arm/corstone1000/fw_update_agent/fwu_agent.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/platform/ext/target/arm/corstone1000/fw_update_agent/fwu_agent.c b/platform/ext/target/arm/corstone1000/fw_update_agent/fwu_agent.c +index afd8d66e42..f564f2902c 100644 +--- a/platform/ext/target/arm/corstone1000/fw_update_agent/fwu_agent.c ++++ b/platform/ext/target/arm/corstone1000/fw_update_agent/fwu_agent.c +@@ -802,6 +802,8 @@ static enum fwu_agent_error_t flash_full_capsule( + } + metadata->active_index = previous_active_index; + metadata->previous_active_index = active_index; ++ metadata->crc_32 = crc32((uint8_t *)&metadata->version, ++ sizeof(struct fwu_metadata) - sizeof(uint32_t)); + + ret = metadata_write(metadata); + if (ret) { +@@ -913,6 +915,8 @@ static enum fwu_agent_error_t accept_full_capsule( + if (ret) { + return ret; + } ++ metadata->crc_32 = crc32((uint8_t *)&metadata->version, ++ sizeof(struct fwu_metadata) - sizeof(uint32_t)); + + ret = metadata_write(metadata); + if (ret) { +@@ -1007,6 +1011,8 @@ static enum fwu_agent_error_t fwu_select_previous( + if (ret) { + return ret; + } ++ metadata->crc_32 = crc32((uint8_t *)&metadata->version, ++ sizeof(struct fwu_metadata) - sizeof(uint32_t)); + + ret = metadata_write(metadata); + if (ret) { +@@ -1119,8 +1125,7 @@ static enum fwu_agent_error_t update_nv_counters( + + FWU_LOG_MSG("%s: enter\n\r", __func__); + +- for (int i = 0; i <= FWU_MAX_NV_COUNTER_INDEX; i++) { +- ++ for (int i = 1; i <= FWU_MAX_NV_COUNTER_INDEX; i++) { + switch (i) { + case FWU_BL2_NV_COUNTER: + tfm_nv_counter_i = PLAT_NV_COUNTER_BL1_0; +@@ -1141,7 +1146,6 @@ static enum fwu_agent_error_t update_nv_counters( + if (err != TFM_PLAT_ERR_SUCCESS) { + return FWU_AGENT_ERROR; + } +- + if (priv_metadata->nv_counter[i] < security_cnt) { + return FWU_AGENT_ERROR; + } else if (priv_metadata->nv_counter[i] > security_cnt) { +-- +2.17.1 + diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-1.7.0-corstone1000.inc b/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-1.7.0-corstone1000.inc index 68845cf93a..23c8c127bc 100644 --- a/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-1.7.0-corstone1000.inc +++ b/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m-1.7.0-corstone1000.inc @@ -48,6 +48,9 @@ SRC_URI:append:corstone1000 = " \ file://0010-Platform-corstone1000-Adds-compiler-flags-to-FWU-age.patch \ file://0011-Platform-corstone1000-adjust-PS-asset-configuration.patch \ file://0012-Platform-corstone1000-Increase-number-of-assets.patch \ + file://0013-Platform-corstone1000-Increase-BL2-size-in-flash-lay.patch \ + file://0014-Platform-Corstone1000-Increase-BL2_DATA_SIZE.patch \ + file://0015-Platform-Corstone1000-Calculate-the-new-CRC32-value-.patch \ file://corstone1000/rwx.patch \ " diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0001-arm64-smccc-add-support-for-SMCCCv1.2-x0-x17-registe.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0001-arm64-smccc-add-support-for-SMCCCv1.2-x0-x17-registe.patch index 64c1b95bbc..23f50198af 100644 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0001-arm64-smccc-add-support-for-SMCCCv1.2-x0-x17-registe.patch +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0001-arm64-smccc-add-support-for-SMCCCv1.2-x0-x17-registe.patch @@ -1,7 +1,7 @@ -From f1f1780630302e1d7cab95d1c6dc32e2fc0bdd70 Mon Sep 17 00:00:00 2001 +From 5ce8bf4ad1aeb2657a7ab83c46eeb2cdaa56cfd4 Mon Sep 17 00:00:00 2001 From: Abdellatif El Khlifi Date: Fri, 29 Jul 2022 13:06:19 +0100 -Subject: [PATCH 01/27] arm64: smccc: add support for SMCCCv1.2 x0-x17 +Subject: [PATCH 01/42] arm64: smccc: add support for SMCCCv1.2 x0-x17 registers add support for x0-x17 registers used by the SMC calls @@ -48,7 +48,7 @@ Signed-off-by: Rui Miguel Silva 3 files changed, 110 insertions(+) diff --git a/arch/arm/cpu/armv8/smccc-call.S b/arch/arm/cpu/armv8/smccc-call.S -index dc92b28777c3..ec6f299bc929 100644 +index dc92b28777..ec6f299bc9 100644 --- a/arch/arm/cpu/armv8/smccc-call.S +++ b/arch/arm/cpu/armv8/smccc-call.S @@ -1,6 +1,8 @@ @@ -116,7 +116,7 @@ index dc92b28777c3..ec6f299bc929 100644 + +#endif diff --git a/arch/arm/lib/asm-offsets.c b/arch/arm/lib/asm-offsets.c -index 22fd541f9a28..db6d7ed23428 100644 +index 22fd541f9a..db6d7ed234 100644 --- a/arch/arm/lib/asm-offsets.c +++ b/arch/arm/lib/asm-offsets.c @@ -9,6 +9,9 @@ @@ -148,7 +148,7 @@ index 22fd541f9a28..db6d7ed23428 100644 return 0; diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h -index e1d09884a1c5..9105031d55d3 100644 +index e1d09884a1..9105031d55 100644 --- a/include/linux/arm-smccc.h +++ b/include/linux/arm-smccc.h @@ -1,6 +1,8 @@ @@ -209,5 +209,5 @@ index e1d09884a1c5..9105031d55d3 100644 * struct arm_smccc_quirk - Contains quirk information * @id: quirk identification -- -2.39.1 +2.25.1 diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0002-lib-uuid-introduce-uuid_str_to_le_bin-function.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0002-lib-uuid-introduce-uuid_str_to_le_bin-function.patch index 4cba24ddba..5c0c61e585 100644 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0002-lib-uuid-introduce-uuid_str_to_le_bin-function.patch +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0002-lib-uuid-introduce-uuid_str_to_le_bin-function.patch @@ -1,7 +1,7 @@ -From 9fe30f542939824f731fda3991a1d4f66fbf3b4b Mon Sep 17 00:00:00 2001 +From 1dcebf6f57e3490f7b3e2464b4114b993dd70c7c Mon Sep 17 00:00:00 2001 From: Abdellatif El Khlifi Date: Thu, 4 Aug 2022 16:46:47 +0100 -Subject: [PATCH 02/27] lib: uuid: introduce uuid_str_to_le_bin function +Subject: [PATCH 02/42] lib: uuid: introduce uuid_str_to_le_bin function convert UUID string to little endian binary data @@ -42,7 +42,7 @@ Signed-off-by: Rui Miguel Silva 2 files changed, 54 insertions(+) diff --git a/include/uuid.h b/include/uuid.h -index 4a4883d3b5b6..293a8eb0a579 100644 +index 4a4883d3b5..293a8eb0a5 100644 --- a/include/uuid.h +++ b/include/uuid.h @@ -2,6 +2,8 @@ @@ -66,7 +66,7 @@ index 4a4883d3b5b6..293a8eb0a579 100644 + #endif diff --git a/lib/uuid.c b/lib/uuid.c -index 465e1ac38f57..d29f561a70df 100644 +index 465e1ac38f..d29f561a70 100644 --- a/lib/uuid.c +++ b/lib/uuid.c @@ -1,6 +1,8 @@ @@ -130,5 +130,5 @@ index 465e1ac38f57..d29f561a70df 100644 * uuid_bin_to_str() - convert big endian binary data to string UUID or GUID. * -- -2.39.1 +2.25.1 diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0003-arm_ffa-introduce-Arm-FF-A-low-level-driver.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0003-arm_ffa-introduce-Arm-FF-A-low-level-driver.patch index dd55a73b7d..f76c74b699 100644 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0003-arm_ffa-introduce-Arm-FF-A-low-level-driver.patch +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0003-arm_ffa-introduce-Arm-FF-A-low-level-driver.patch @@ -1,7 +1,7 @@ -From 69cfd14c37bee479eb3cb7e6dd2df23f460f0713 Mon Sep 17 00:00:00 2001 +From 77cf1f517f6d92d5e3efb40d8335adb03b289525 Mon Sep 17 00:00:00 2001 From: Abdellatif El Khlifi Date: Tue, 29 Nov 2022 14:40:05 +0000 -Subject: [PATCH 03/27] arm_ffa: introduce Arm FF-A low-level driver +Subject: [PATCH 03/42] arm_ffa: introduce Arm FF-A low-level driver Add the core driver implementing Arm Firmware Framework for Armv8-A v1.0 @@ -134,7 +134,7 @@ Signed-off-by: Rui Miguel Silva create mode 100644 include/arm_ffa.h diff --git a/MAINTAINERS b/MAINTAINERS -index 3fc4cd0f12d3..509619d31ce6 100644 +index 3fc4cd0f12..509619d31c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -264,6 +264,13 @@ F: drivers/net/cortina_ni.h @@ -153,7 +153,7 @@ index 3fc4cd0f12d3..509619d31ce6 100644 M: Fabio Estevam diff --git a/doc/arch/arm64.ffa.rst b/doc/arch/arm64.ffa.rst new file mode 100644 -index 000000000000..dfcec82e456e +index 0000000000..dfcec82e45 --- /dev/null +++ b/doc/arch/arm64.ffa.rst @@ -0,0 +1,218 @@ @@ -376,7 +376,7 @@ index 000000000000..dfcec82e456e +------------ + * Abdellatif El Khlifi diff --git a/doc/arch/index.rst b/doc/arch/index.rst -index b3e85f9bf347..cf1cfc9287c2 100644 +index b3e85f9bf3..cf1cfc9287 100644 --- a/doc/arch/index.rst +++ b/doc/arch/index.rst @@ -8,6 +8,7 @@ Architecture-specific doc @@ -388,7 +388,7 @@ index b3e85f9bf347..cf1cfc9287c2 100644 mips nios2 diff --git a/drivers/Kconfig b/drivers/Kconfig -index 75ac149d3118..ff75b7c3f883 100644 +index 75ac149d31..ff75b7c3f8 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -6,6 +6,8 @@ source "drivers/core/Kconfig" @@ -401,7 +401,7 @@ index 75ac149d3118..ff75b7c3f883 100644 source "drivers/axi/Kconfig" diff --git a/drivers/Makefile b/drivers/Makefile -index 6f1de58e0030..28c8f538c83a 100644 +index 6f1de58e00..28c8f538c8 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -112,6 +112,7 @@ obj-y += iommu/ @@ -414,7 +414,7 @@ index 6f1de58e0030..28c8f538c83a 100644 obj-$(CONFIG_W1) += w1/ diff --git a/drivers/firmware/arm-ffa/Kconfig b/drivers/firmware/arm-ffa/Kconfig new file mode 100644 -index 000000000000..e4914b9bc779 +index 0000000000..e4914b9bc7 --- /dev/null +++ b/drivers/firmware/arm-ffa/Kconfig @@ -0,0 +1,30 @@ @@ -450,7 +450,7 @@ index 000000000000..e4914b9bc779 + diff --git a/drivers/firmware/arm-ffa/Makefile b/drivers/firmware/arm-ffa/Makefile new file mode 100644 -index 000000000000..043a8915bec5 +index 0000000000..043a8915be --- /dev/null +++ b/drivers/firmware/arm-ffa/Makefile @@ -0,0 +1,6 @@ @@ -462,7 +462,7 @@ index 000000000000..043a8915bec5 +obj-y += arm-ffa-uclass.o core.o diff --git a/drivers/firmware/arm-ffa/arm-ffa-uclass.c b/drivers/firmware/arm-ffa/arm-ffa-uclass.c new file mode 100644 -index 000000000000..7d9695d28922 +index 0000000000..7d9695d289 --- /dev/null +++ b/drivers/firmware/arm-ffa/arm-ffa-uclass.c @@ -0,0 +1,16 @@ @@ -484,7 +484,7 @@ index 000000000000..7d9695d28922 +}; diff --git a/drivers/firmware/arm-ffa/arm_ffa_prv.h b/drivers/firmware/arm-ffa/arm_ffa_prv.h new file mode 100644 -index 000000000000..4eea7dc03604 +index 0000000000..4eea7dc036 --- /dev/null +++ b/drivers/firmware/arm-ffa/arm_ffa_prv.h @@ -0,0 +1,200 @@ @@ -690,7 +690,7 @@ index 000000000000..4eea7dc03604 +#endif diff --git a/drivers/firmware/arm-ffa/core.c b/drivers/firmware/arm-ffa/core.c new file mode 100644 -index 000000000000..0b1f8e6a078d +index 0000000000..0b1f8e6a07 --- /dev/null +++ b/drivers/firmware/arm-ffa/core.c @@ -0,0 +1,1315 @@ @@ -2011,7 +2011,7 @@ index 000000000000..0b1f8e6a078d +}; diff --git a/include/arm_ffa.h b/include/arm_ffa.h new file mode 100644 -index 000000000000..74b16174c292 +index 0000000000..74b16174c2 --- /dev/null +++ b/include/arm_ffa.h @@ -0,0 +1,97 @@ @@ -2113,7 +2113,7 @@ index 000000000000..74b16174c292 + +#endif diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h -index 376f741cc2bb..fa08a66ac8e0 100644 +index 376f741cc2..fa08a66ac8 100644 --- a/include/dm/uclass-id.h +++ b/include/dm/uclass-id.h @@ -4,6 +4,9 @@ @@ -2135,5 +2135,5 @@ index 376f741cc2bb..fa08a66ac8e0 100644 UCLASS_FPGA, /* FPGA device */ UCLASS_FUZZING_ENGINE, /* Fuzzing engine */ -- -2.39.1 +2.25.1 diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0004-arm_ffa-efi-unmap-RX-TX-buffers.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0004-arm_ffa-efi-unmap-RX-TX-buffers.patch index d619a66fd4..3a3dae834d 100644 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0004-arm_ffa-efi-unmap-RX-TX-buffers.patch +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0004-arm_ffa-efi-unmap-RX-TX-buffers.patch @@ -1,7 +1,7 @@ -From 7d2c73749107a5859c7158a859a62c3e8b2d33e2 Mon Sep 17 00:00:00 2001 +From b09b391e33e024a18842dfdc99282d0050cc5fcb Mon Sep 17 00:00:00 2001 From: Abdellatif El Khlifi Date: Thu, 6 Oct 2022 15:04:25 +0100 -Subject: [PATCH 04/27] arm_ffa: efi: unmap RX/TX buffers +Subject: [PATCH 04/42] arm_ffa: efi: unmap RX/TX buffers unmap RX/TX buffers at ExitBootServices() @@ -32,7 +32,7 @@ Signed-off-by: Rui Miguel Silva 1 file changed, 13 insertions(+) diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c -index e65ca6a4cbee..3481f2afe7a9 100644 +index e65ca6a4cb..3481f2afe7 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -3,6 +3,9 @@ @@ -70,5 +70,5 @@ index e65ca6a4cbee..3481f2afe7a9 100644 efi_runtime_detach(); -- -2.39.1 +2.25.1 diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0005-arm_ffa-introduce-armffa-command.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0005-arm_ffa-introduce-armffa-command.patch index cbf8c101a7..b00e3d9f77 100644 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0005-arm_ffa-introduce-armffa-command.patch +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0005-arm_ffa-introduce-armffa-command.patch @@ -1,7 +1,7 @@ -From c6b116c4793449775064a8fc949a3b607b7ade27 Mon Sep 17 00:00:00 2001 +From f3bc86a7ec63c0454577cb6712395c577b2cfd66 Mon Sep 17 00:00:00 2001 From: Abdellatif El Khlifi Date: Mon, 6 Jun 2022 12:46:38 +0100 -Subject: [PATCH 05/27] arm_ffa: introduce armffa command +Subject: [PATCH 05/42] arm_ffa: introduce armffa command Provide armffa command showcasing the use of the FF-A driver @@ -59,7 +59,7 @@ Signed-off-by: Rui Miguel Silva create mode 100644 cmd/armffa.c diff --git a/MAINTAINERS b/MAINTAINERS -index 509619d31ce6..61ce6c436fe1 100644 +index 509619d31c..61ce6c436f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -267,6 +267,7 @@ F: configs/cortina_presidio-asic-pnand_defconfig @@ -71,7 +71,7 @@ index 509619d31ce6..61ce6c436fe1 100644 F: drivers/firmware/arm-ffa/ F: include/arm_ffa.h diff --git a/cmd/Kconfig b/cmd/Kconfig -index b2d75987170e..7d0a40e8acb4 100644 +index b2d7598717..7d0a40e8ac 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -924,6 +924,16 @@ endmenu @@ -92,7 +92,7 @@ index b2d75987170e..7d0a40e8acb4 100644 #depends on FLASH_CFI_DRIVER bool "armflash" diff --git a/cmd/Makefile b/cmd/Makefile -index 0b6a96c1d914..c757f1647da6 100644 +index 0b6a96c1d9..c757f1647d 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -12,6 +12,8 @@ obj-y += panic.o @@ -106,7 +106,7 @@ index 0b6a96c1d914..c757f1647da6 100644 obj-$(CONFIG_CMD_AES) += aes.o diff --git a/cmd/armffa.c b/cmd/armffa.c new file mode 100644 -index 000000000000..d2e8687bfb1f +index 0000000000..d2e8687bfb --- /dev/null +++ b/cmd/armffa.c @@ -0,0 +1,237 @@ @@ -348,7 +348,7 @@ index 000000000000..d2e8687bfb1f + "devlist\n" + " - displays the arm_ffa device info\n"); diff --git a/drivers/firmware/arm-ffa/Kconfig b/drivers/firmware/arm-ffa/Kconfig -index e4914b9bc779..be4df89d23fa 100644 +index e4914b9bc7..be4df89d23 100644 --- a/drivers/firmware/arm-ffa/Kconfig +++ b/drivers/firmware/arm-ffa/Kconfig @@ -4,6 +4,7 @@ config ARM_FFA_TRANSPORT @@ -360,5 +360,5 @@ index e4914b9bc779..be4df89d23fa 100644 select DEVRES help -- -2.39.1 +2.25.1 diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0006-arm_ffa-introduce-the-FF-A-Sandbox-driver.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0006-arm_ffa-introduce-the-FF-A-Sandbox-driver.patch index 99ff617dae..8c3892f043 100644 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0006-arm_ffa-introduce-the-FF-A-Sandbox-driver.patch +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0006-arm_ffa-introduce-the-FF-A-Sandbox-driver.patch @@ -1,7 +1,7 @@ -From 49ed44c01f7e93d614483fc2d3cc7034808e9c07 Mon Sep 17 00:00:00 2001 +From 301430b7c8dceebe349b82c598097628da733090 Mon Sep 17 00:00:00 2001 From: Abdellatif El Khlifi Date: Tue, 29 Nov 2022 14:44:36 +0000 -Subject: [PATCH 06/27] arm_ffa: introduce the FF-A Sandbox driver +Subject: [PATCH 06/42] arm_ffa: introduce the FF-A Sandbox driver Provide a Sandbox driver to emulate the FF-A ABIs @@ -53,7 +53,7 @@ Signed-off-by: Rui Miguel Silva create mode 100644 include/sandbox_arm_ffa.h diff --git a/MAINTAINERS b/MAINTAINERS -index 61ce6c436fe1..297d165f8401 100644 +index 61ce6c436f..297d165f84 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -271,6 +271,7 @@ F: cmd/armffa.c @@ -65,7 +65,7 @@ index 61ce6c436fe1..297d165f8401 100644 ARM FREESCALE IMX M: Stefano Babic diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig -index ba45ac0b71c1..4b8a1ec42bda 100644 +index ba45ac0b71..4b8a1ec42b 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -259,3 +259,5 @@ CONFIG_FWU_MULTI_BANK_UPDATE=y @@ -76,7 +76,7 @@ index ba45ac0b71c1..4b8a1ec42bda 100644 +CONFIG_SANDBOX_FFA=y \ No newline at end of file diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig -index be46cae7aad7..650f06ae61f7 100644 +index be46cae7aa..650f06ae61 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -334,3 +334,5 @@ CONFIG_TEST_FDTDEC=y @@ -87,7 +87,7 @@ index be46cae7aad7..650f06ae61f7 100644 +CONFIG_SANDBOX_FFA=y \ No newline at end of file diff --git a/drivers/firmware/arm-ffa/Kconfig b/drivers/firmware/arm-ffa/Kconfig -index be4df89d23fa..b86f16d7785d 100644 +index be4df89d23..b86f16d778 100644 --- a/drivers/firmware/arm-ffa/Kconfig +++ b/drivers/firmware/arm-ffa/Kconfig @@ -2,8 +2,8 @@ @@ -111,7 +111,7 @@ index be4df89d23fa..b86f16d7785d 100644 + help + This emulates the FF-A handling under Sandbox and allows to test the FF-A driver diff --git a/drivers/firmware/arm-ffa/Makefile b/drivers/firmware/arm-ffa/Makefile -index 043a8915bec5..0d21d6b47ab9 100644 +index 043a8915be..0d21d6b47a 100644 --- a/drivers/firmware/arm-ffa/Makefile +++ b/drivers/firmware/arm-ffa/Makefile @@ -4,3 +4,4 @@ @@ -120,7 +120,7 @@ index 043a8915bec5..0d21d6b47ab9 100644 obj-y += arm-ffa-uclass.o core.o +obj-$(CONFIG_SANDBOX_FFA) += sandbox.o diff --git a/drivers/firmware/arm-ffa/arm_ffa_prv.h b/drivers/firmware/arm-ffa/arm_ffa_prv.h -index 4eea7dc03604..bbc8b87069ff 100644 +index 4eea7dc036..bbc8b87069 100644 --- a/drivers/firmware/arm-ffa/arm_ffa_prv.h +++ b/drivers/firmware/arm-ffa/arm_ffa_prv.h @@ -19,6 +19,16 @@ @@ -153,7 +153,7 @@ index 4eea7dc03604..bbc8b87069ff 100644 * struct ffa_partition_uuid - 16 bytes UUID transmitted by FFA_PARTITION_INFO_GET * @a1-4: 32-bit words access to the UUID data diff --git a/drivers/firmware/arm-ffa/core.c b/drivers/firmware/arm-ffa/core.c -index 0b1f8e6a078d..560603b28bcc 100644 +index 0b1f8e6a07..560603b28b 100644 --- a/drivers/firmware/arm-ffa/core.c +++ b/drivers/firmware/arm-ffa/core.c @@ -1072,6 +1072,7 @@ static int ffa_msg_send_direct_req(struct udevice *dev, u16 dst_part_id, @@ -223,7 +223,7 @@ index 0b1f8e6a078d..560603b28bcc 100644 diff --git a/drivers/firmware/arm-ffa/sandbox.c b/drivers/firmware/arm-ffa/sandbox.c new file mode 100644 -index 000000000000..16f1ca926ee2 +index 0000000000..16f1ca926e --- /dev/null +++ b/drivers/firmware/arm-ffa/sandbox.c @@ -0,0 +1,659 @@ @@ -888,7 +888,7 @@ index 000000000000..16f1ca926ee2 +}; diff --git a/drivers/firmware/arm-ffa/sandbox_arm_ffa_prv.h b/drivers/firmware/arm-ffa/sandbox_arm_ffa_prv.h new file mode 100644 -index 000000000000..4db57f5092f8 +index 0000000000..4db57f5092 --- /dev/null +++ b/drivers/firmware/arm-ffa/sandbox_arm_ffa_prv.h @@ -0,0 +1,144 @@ @@ -1037,7 +1037,7 @@ index 000000000000..4db57f5092f8 + +#endif diff --git a/include/arm_ffa.h b/include/arm_ffa.h -index 74b16174c292..b88904fe50b0 100644 +index 74b16174c2..b88904fe50 100644 --- a/include/arm_ffa.h +++ b/include/arm_ffa.h @@ -90,7 +90,7 @@ struct ffa_bus_ops { @@ -1051,7 +1051,7 @@ index 74b16174c292..b88904fe50b0 100644 diff --git a/include/sandbox_arm_ffa.h b/include/sandbox_arm_ffa.h new file mode 100644 -index 000000000000..d5df16f2828c +index 0000000000..d5df16f282 --- /dev/null +++ b/include/sandbox_arm_ffa.h @@ -0,0 +1,91 @@ @@ -1147,7 +1147,7 @@ index 000000000000..d5df16f2828c + +#endif diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c -index 3481f2afe7a9..fea4eb7a342e 100644 +index 3481f2afe7..fea4eb7a34 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -2185,7 +2185,7 @@ static efi_status_t EFIAPI efi_exit_boot_services(efi_handle_t image_handle, @@ -1160,5 +1160,5 @@ index 3481f2afe7a9..fea4eb7a342e 100644 if (ffa_bus_ops_get()->rxtx_unmap(NULL)) log_err("Can't unmap FF-A RX/TX buffers\n"); -- -2.39.1 +2.25.1 diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0007-arm_ffa-introduce-Sandbox-test-cases-for-UCLASS_FFA.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0007-arm_ffa-introduce-Sandbox-test-cases-for-UCLASS_FFA.patch index a998de35f8..d248e8b0d9 100644 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0007-arm_ffa-introduce-Sandbox-test-cases-for-UCLASS_FFA.patch +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0007-arm_ffa-introduce-Sandbox-test-cases-for-UCLASS_FFA.patch @@ -1,7 +1,7 @@ -From fcc5de7e0e618fa4ec82d37f5f0687af837e6f54 Mon Sep 17 00:00:00 2001 +From 3664fe7503cbc4348bbd7bcb8fbf7e1db332ac5d Mon Sep 17 00:00:00 2001 From: Abdellatif El Khlifi Date: Mon, 6 Jun 2022 17:26:06 +0100 -Subject: [PATCH 07/27] arm_ffa: introduce Sandbox test cases for UCLASS_FFA +Subject: [PATCH 07/42] arm_ffa: introduce Sandbox test cases for UCLASS_FFA Add functional test cases for the FF-A core driver @@ -38,7 +38,7 @@ Signed-off-by: Rui Miguel Silva create mode 100644 test/dm/ffa.c diff --git a/MAINTAINERS b/MAINTAINERS -index 297d165f8401..c1d3d4ae1c56 100644 +index 297d165f84..c1d3d4ae1c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -272,6 +272,7 @@ F: doc/arch/arm64.ffa.rst @@ -50,7 +50,7 @@ index 297d165f8401..c1d3d4ae1c56 100644 ARM FREESCALE IMX M: Stefano Babic diff --git a/test/dm/Makefile b/test/dm/Makefile -index 7a79b6e1a25d..85e99e1c120e 100644 +index 7a79b6e1a2..85e99e1c12 100644 --- a/test/dm/Makefile +++ b/test/dm/Makefile @@ -1,6 +1,7 @@ @@ -71,7 +71,7 @@ index 7a79b6e1a25d..85e99e1c120e 100644 obj-y += regmap.o diff --git a/test/dm/ffa.c b/test/dm/ffa.c new file mode 100644 -index 000000000000..128d8626a761 +index 0000000000..128d8626a7 --- /dev/null +++ b/test/dm/ffa.c @@ -0,0 +1,392 @@ @@ -468,5 +468,5 @@ index 000000000000..128d8626a761 + +DM_TEST(dm_test_ffa_nack, UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC); -- -2.39.1 +2.25.1 diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0008-arm_ffa-introduce-armffa-command-Sandbox-test.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0008-arm_ffa-introduce-armffa-command-Sandbox-test.patch index fed806e6af..d5842827a4 100644 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0008-arm_ffa-introduce-armffa-command-Sandbox-test.patch +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0008-arm_ffa-introduce-armffa-command-Sandbox-test.patch @@ -1,7 +1,7 @@ -From 5816c61212f9710a5c7310cd7c57cc349e852152 Mon Sep 17 00:00:00 2001 +From 5af272d2bb2a7a8c8a4732c8d598dd1713856949 Mon Sep 17 00:00:00 2001 From: Abdellatif El Khlifi Date: Tue, 29 Nov 2022 14:48:34 +0000 -Subject: [PATCH 08/27] arm_ffa: introduce armffa command Sandbox test +Subject: [PATCH 08/42] arm_ffa: introduce armffa command Sandbox test Add Sandbox test for the armffa command @@ -27,7 +27,7 @@ Signed-off-by: Rui Miguel Silva create mode 100644 test/cmd/armffa.c diff --git a/MAINTAINERS b/MAINTAINERS -index c1d3d4ae1c56..a2f60a3b93a6 100644 +index c1d3d4ae1c..a2f60a3b93 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -272,6 +272,7 @@ F: doc/arch/arm64.ffa.rst @@ -39,7 +39,7 @@ index c1d3d4ae1c56..a2f60a3b93a6 100644 ARM FREESCALE IMX diff --git a/test/cmd/Makefile b/test/cmd/Makefile -index bc961df3dcee..21aa6d740ee8 100644 +index bc961df3dc..21aa6d740e 100644 --- a/test/cmd/Makefile +++ b/test/cmd/Makefile @@ -1,6 +1,7 @@ @@ -60,7 +60,7 @@ index bc961df3dcee..21aa6d740ee8 100644 obj-$(CONFIG_CMD_WGET) += wget.o diff --git a/test/cmd/armffa.c b/test/cmd/armffa.c new file mode 100644 -index 000000000000..e04363ba63f9 +index 0000000000..e04363ba63 --- /dev/null +++ b/test/cmd/armffa.c @@ -0,0 +1,39 @@ @@ -104,5 +104,5 @@ index 000000000000..e04363ba63f9 + +DM_TEST(dm_test_armffa_cmd, UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC); -- -2.39.1 +2.25.1 diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0009-arm_ffa-efi-introduce-FF-A-MM-communication.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0009-arm_ffa-efi-introduce-FF-A-MM-communication.patch index 0847cee02e..574b7df958 100644 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0009-arm_ffa-efi-introduce-FF-A-MM-communication.patch +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0009-arm_ffa-efi-introduce-FF-A-MM-communication.patch @@ -1,7 +1,7 @@ -From e371b2d29aa447c1a186ab25b37b99fded967b77 Mon Sep 17 00:00:00 2001 +From ca1ae0e78ee3476090919459ec5d08187d5eefbc Mon Sep 17 00:00:00 2001 From: Abdellatif El Khlifi Date: Mon, 15 Aug 2022 15:12:49 +0100 -Subject: [PATCH 09/27] arm_ffa: efi: introduce FF-A MM communication +Subject: [PATCH 09/42] arm_ffa: efi: introduce FF-A MM communication Add MM communication support using FF-A transport @@ -88,7 +88,7 @@ Signed-off-by: Rui Miguel Silva 3 files changed, 307 insertions(+), 6 deletions(-) diff --git a/include/mm_communication.h b/include/mm_communication.h -index e65fbde60d0a..d409bed77714 100644 +index e65fbde60d..d409bed777 100644 --- a/include/mm_communication.h +++ b/include/mm_communication.h @@ -6,6 +6,8 @@ @@ -111,7 +111,7 @@ index e65fbde60d0a..d409bed77714 100644 * Interface to the pseudo Trusted Application (TA), which provides a * communication channel with the Standalone MM (Management Mode) diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig -index b498c72206fd..ca7390848125 100644 +index b498c72206..ca73908481 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -55,13 +55,23 @@ config EFI_VARIABLE_FILE_STORE @@ -141,7 +141,7 @@ index b498c72206fd..ca7390848125 100644 bool "Don't persist non-volatile UEFI variables" help diff --git a/lib/efi_loader/efi_variable_tee.c b/lib/efi_loader/efi_variable_tee.c -index dfef18435dfa..3933a24e8cdc 100644 +index dfef18435d..3933a24e8c 100644 --- a/lib/efi_loader/efi_variable_tee.c +++ b/lib/efi_loader/efi_variable_tee.c @@ -4,9 +4,12 @@ @@ -496,5 +496,5 @@ index dfef18435dfa..3933a24e8cdc 100644 /* -- -2.39.1 +2.25.1 diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0010-arm_ffa-efi-corstone1000-enable-MM-communication.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0010-arm_ffa-efi-corstone1000-enable-MM-communication.patch index e182d9cdaf..4fe1405cbb 100644 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0010-arm_ffa-efi-corstone1000-enable-MM-communication.patch +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0010-arm_ffa-efi-corstone1000-enable-MM-communication.patch @@ -1,7 +1,7 @@ -From a5d70b9bf23b38fbc8c6b4c3f384278aeca3bbce Mon Sep 17 00:00:00 2001 +From a595dfd91d3e226eaa39e324673871c73ae0aa29 Mon Sep 17 00:00:00 2001 From: Abdellatif El Khlifi Date: Fri, 23 Sep 2022 15:17:21 +0100 -Subject: [PATCH 10/27] arm_ffa: efi: corstone1000: enable MM communication +Subject: [PATCH 10/42] arm_ffa: efi: corstone1000: enable MM communication turn on EFI MM communication @@ -44,7 +44,7 @@ Signed-off-by: Rui Miguel Silva 2 files changed, 12 insertions(+) diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig -index dddfa2750762..d1dc06c86c2c 100644 +index dddfa27507..d1dc06c86c 100644 --- a/configs/corstone1000_defconfig +++ b/configs/corstone1000_defconfig @@ -52,3 +52,5 @@ CONFIG_DM_SERIAL=y @@ -54,7 +54,7 @@ index dddfa2750762..d1dc06c86c2c 100644 +CONFIG_EFI_MM_COMM_TEE=y +CONFIG_ARM_FFA_TRANSPORT=y diff --git a/include/configs/corstone1000.h b/include/configs/corstone1000.h -index 8e0230c135e3..b6226fa12af3 100644 +index 8e0230c135..b6226fa12a 100644 --- a/include/configs/corstone1000.h +++ b/include/configs/corstone1000.h @@ -14,6 +14,15 @@ @@ -82,5 +82,5 @@ index 8e0230c135e3..b6226fa12af3 100644 #define BOOT_TARGET_DEVICES(func) \ -- -2.39.1 +2.25.1 diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0011-efi-corstone1000-introduce-EFI-capsule-update.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0011-efi-corstone1000-introduce-EFI-capsule-update.patch index 37877c908a..c526626dc7 100644 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0011-efi-corstone1000-introduce-EFI-capsule-update.patch +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0011-efi-corstone1000-introduce-EFI-capsule-update.patch @@ -1,7 +1,7 @@ -From 6a73345662d53ebaa9750c70aa8fc7f40d3f8524 Mon Sep 17 00:00:00 2001 +From b9c44c396f9ad9588184272cdc5ed98e19e82c0a Mon Sep 17 00:00:00 2001 From: Abdellatif El Khlifi Date: Tue, 29 Nov 2022 15:11:27 +0000 -Subject: [PATCH 11/27] efi: corstone1000: introduce EFI capsule update +Subject: [PATCH 11/42] efi: corstone1000: introduce EFI capsule update This commit provides capsule update feature for Corstone1000. @@ -32,7 +32,7 @@ Upstream-Status: Pending [Not submitted to upstream yet] 7 files changed, 200 insertions(+), 4 deletions(-) diff --git a/board/armltd/corstone1000/corstone1000.c b/board/armltd/corstone1000/corstone1000.c -index 4f4b96a095c2..76816f8f4ea1 100644 +index 4f4b96a095..76816f8f4e 100644 --- a/board/armltd/corstone1000/corstone1000.c +++ b/board/armltd/corstone1000/corstone1000.c @@ -66,6 +66,10 @@ static struct mm_region corstone1000_mem_map[] = { @@ -47,7 +47,7 @@ index 4f4b96a095c2..76816f8f4ea1 100644 { return 0; diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig -index d1dc06c86c2c..06eac3e041fe 100644 +index d1dc06c86c..06eac3e041 100644 --- a/configs/corstone1000_defconfig +++ b/configs/corstone1000_defconfig @@ -54,3 +54,6 @@ CONFIG_USB_ISP1760=y @@ -58,7 +58,7 @@ index d1dc06c86c2c..06eac3e041fe 100644 +CONFIG_EFI_CAPSULE_FIRMWARE_FIT=y +CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y diff --git a/include/configs/corstone1000.h b/include/configs/corstone1000.h -index b6226fa12af3..cd30499e3c9c 100644 +index b6226fa12a..cd30499e3c 100644 --- a/include/configs/corstone1000.h +++ b/include/configs/corstone1000.h @@ -14,6 +14,24 @@ @@ -87,7 +87,7 @@ index b6226fa12af3..cd30499e3c9c 100644 /* diff --git a/include/efi_loader.h b/include/efi_loader.h -index f9e427f09059..26981141c228 100644 +index f9e427f090..26981141c2 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -1032,11 +1032,11 @@ extern const struct efi_firmware_management_protocol efi_fmp_fit; @@ -105,7 +105,7 @@ index f9e427f09059..26981141c228 100644 efi_uintn_t capsule_count, u64 *maximum_capsule_size, diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c -index fea4eb7a342e..faab74474d77 100644 +index fea4eb7a34..faab74474d 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -2103,6 +2103,33 @@ static void efi_exit_caches(void) @@ -159,7 +159,7 @@ index fea4eb7a342e..faab74474d77 100644 efi_set_watchdog(0); schedule(); diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c -index 0997cd248fe3..9e8ddaac7f03 100644 +index 0997cd248f..9e8ddaac7f 100644 --- a/lib/efi_loader/efi_capsule.c +++ b/lib/efi_loader/efi_capsule.c @@ -26,6 +26,14 @@ @@ -329,7 +329,7 @@ index 0997cd248fe3..9e8ddaac7f03 100644 efi_uintn_t capsule_count, u64 *maximum_capsule_size, diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c -index 543764113530..1ad2fa52d7e9 100644 +index 5437641135..1ad2fa52d7 100644 --- a/lib/efi_loader/efi_setup.c +++ b/lib/efi_loader/efi_setup.c @@ -16,6 +16,13 @@ @@ -362,5 +362,5 @@ index 543764113530..1ad2fa52d7e9 100644 ret = efi_set_variable_int(u"CapsuleMax", &efi_guid_capsule_report, -- -2.39.1 +2.25.1 diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0012-arm-corstone1000-fix-unrecognized-filesystem-type.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0012-arm-corstone1000-fix-unrecognized-filesystem-type.patch index 740f87830b..6fe10eb2cc 100644 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0012-arm-corstone1000-fix-unrecognized-filesystem-type.patch +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0012-arm-corstone1000-fix-unrecognized-filesystem-type.patch @@ -1,7 +1,7 @@ -From 2f76fd5cf66a983f68bc115463b9ea5714b3c221 Mon Sep 17 00:00:00 2001 +From ac738fa33edec9ff712dee6d10491cb2eb7cfe3a Mon Sep 17 00:00:00 2001 From: Rui Miguel Silva Date: Fri, 4 Mar 2022 15:56:09 +0000 -Subject: [PATCH 12/27] arm: corstone1000: fix unrecognized filesystem type +Subject: [PATCH 12/42] arm: corstone1000: fix unrecognized filesystem type Some usb sticks are not recognized by usb, just add a delay before checking status. @@ -13,7 +13,7 @@ Upstream-Status: Pending [Not submitted to upstream yet] 1 file changed, 3 insertions(+) diff --git a/common/usb_storage.c b/common/usb_storage.c -index ac6427577379..1d2680c3cd33 100644 +index ac64275773..1d2680c3cd 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -785,6 +785,9 @@ static int usb_stor_BBB_transport(struct scsi_cmd *srb, struct us_data *us) @@ -27,5 +27,5 @@ index ac6427577379..1d2680c3cd33 100644 result = usb_bulk_msg(us->pusb_dev, pipein, csw, UMASS_BBB_CSW_SIZE, &actlen, USB_CNTL_TIMEOUT*5); -- -2.39.1 +2.25.1 diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0013-efi_capsule-corstone1000-pass-interface-id-and-buffe.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0013-efi_capsule-corstone1000-pass-interface-id-and-buffe.patch index a86e0c8ce3..bc03035c99 100644 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0013-efi_capsule-corstone1000-pass-interface-id-and-buffe.patch +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0013-efi_capsule-corstone1000-pass-interface-id-and-buffe.patch @@ -1,7 +1,7 @@ -From 8727a1b34fb500ca5cce6fc1c30a1d73bf23aaba Mon Sep 17 00:00:00 2001 +From baa961b6050508710e1c6b572f2e93ac5c488201 Mon Sep 17 00:00:00 2001 From: Vishnu Banavath Date: Fri, 10 Dec 2021 20:03:35 +0000 -Subject: [PATCH 13/27] efi_capsule: corstone1000: pass interface id and buffer +Subject: [PATCH 13/42] efi_capsule: corstone1000: pass interface id and buffer event id using register w4 Initially the interface/event IDs are passed to the SP using register @@ -23,7 +23,7 @@ Upstream-Status: Pending [Not submitted to upstream yet] 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/include/configs/corstone1000.h b/include/configs/corstone1000.h -index cd30499e3c9c..e4c7bcb96f27 100644 +index cd30499e3c..e4c7bcb96f 100644 --- a/include/configs/corstone1000.h +++ b/include/configs/corstone1000.h @@ -24,6 +24,12 @@ @@ -40,7 +40,7 @@ index cd30499e3c9c..e4c7bcb96f27 100644 #define CORSTONE1000_CAPSULE_BUFFER_SIZE (8192) /* 32 MB */ diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c -index 9e8ddaac7f03..bd4cc8d27285 100644 +index 9e8ddaac7f..bd4cc8d272 100644 --- a/lib/efi_loader/efi_capsule.c +++ b/lib/efi_loader/efi_capsule.c @@ -29,6 +29,8 @@ @@ -70,5 +70,5 @@ index 9e8ddaac7f03..bd4cc8d27285 100644 return ffa_bus_ops_get()->sync_send_receive(NULL, CORSTONE1000_SEPROXY_PART_ID, &msg, 0); } -- -2.39.1 +2.25.1 diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0014-efi_boottime-corstone1000-pass-interface-id-and-kern.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0014-efi_boottime-corstone1000-pass-interface-id-and-kern.patch index 8559c9cb9f..658e21f04c 100644 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0014-efi_boottime-corstone1000-pass-interface-id-and-kern.patch +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0014-efi_boottime-corstone1000-pass-interface-id-and-kern.patch @@ -1,7 +1,7 @@ -From 80273f9bcab14059ec92e5c05826ae52113cebe6 Mon Sep 17 00:00:00 2001 +From d761d59dd251ae93980f659d253576fc872f2c5f Mon Sep 17 00:00:00 2001 From: Vishnu Banavath Date: Fri, 10 Dec 2021 20:10:41 +0000 -Subject: [PATCH 14/27] efi_boottime: corstone1000: pass interface id and +Subject: [PATCH 14/42] efi_boottime: corstone1000: pass interface id and kernel event id using register w4 Initially the interface/event IDs are passed to the SP using register @@ -22,7 +22,7 @@ Upstream-Status: Pending [Not submitted to upstream yet] 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c -index faab74474d77..36a0be7ba104 100644 +index faab74474d..36a0be7ba1 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -30,6 +30,11 @@ @@ -54,5 +54,5 @@ index faab74474d77..36a0be7ba104 100644 return ffa_bus_ops_get()->sync_send_receive(CORSTONE1000_SEPROXY_PART_ID, &msg, 0); } -- -2.39.1 +2.25.1 diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0015-efi_loader-corstone1000-remove-guid-check-from-corst.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0015-efi_loader-corstone1000-remove-guid-check-from-corst.patch index 98e85056d6..e57b944122 100644 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0015-efi_loader-corstone1000-remove-guid-check-from-corst.patch +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0015-efi_loader-corstone1000-remove-guid-check-from-corst.patch @@ -1,7 +1,7 @@ -From 315d4eb0f5be4ed844bf6c7496d2ea62e518aa5c Mon Sep 17 00:00:00 2001 +From 5e09d349ec8af6585bce777acbfd2d218fc2e8d4 Mon Sep 17 00:00:00 2001 From: Vishnu Banavath Date: Sat, 11 Dec 2021 13:23:55 +0000 -Subject: [PATCH 15/27] efi_loader: corstone1000: remove guid check from +Subject: [PATCH 15/42] efi_loader: corstone1000: remove guid check from corstone1000 config option Use generic fmp guid and no separte check is required for @@ -15,7 +15,7 @@ Upstream-Status: Pending [Not submitted to upstream yet] 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c -index bd4cc8d27285..ef7b358ddba9 100644 +index bd4cc8d272..ef7b358ddb 100644 --- a/lib/efi_loader/efi_capsule.c +++ b/lib/efi_loader/efi_capsule.c @@ -830,12 +830,6 @@ efi_status_t __efi_runtime EFIAPI efi_update_capsule( @@ -49,5 +49,5 @@ index bd4cc8d27285..ef7b358ddba9 100644 goto out; } -- -2.39.1 +2.25.1 diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0016-efi_loader-populate-ESRT-table-if-EFI_ESRT-config-op.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0016-efi_loader-populate-ESRT-table-if-EFI_ESRT-config-op.patch index 8c31a5abae..1b88d7f1c3 100644 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0016-efi_loader-populate-ESRT-table-if-EFI_ESRT-config-op.patch +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0016-efi_loader-populate-ESRT-table-if-EFI_ESRT-config-op.patch @@ -1,7 +1,7 @@ -From 978d2b92a2ae1f2be71c85271c2d79a5eaf74815 Mon Sep 17 00:00:00 2001 +From e3ccad1cf9e905ec15ff772dcf53972fafcf54ee Mon Sep 17 00:00:00 2001 From: Vishnu Banavath Date: Fri, 17 Dec 2021 19:49:02 +0000 -Subject: [PATCH 16/27] efi_loader: populate ESRT table if EFI_ESRT config +Subject: [PATCH 16/42] efi_loader: populate ESRT table if EFI_ESRT config option is set This change is to call efi_esrt_populate function if CONFIG_EFI_ESRT @@ -15,7 +15,7 @@ Upstream-Status: Pending [Not submitted to upstream yet] 1 file changed, 7 insertions(+) diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c -index ef7b358ddba9..8eb8fc406adf 100644 +index ef7b358ddb..8eb8fc406a 100644 --- a/lib/efi_loader/efi_capsule.c +++ b/lib/efi_loader/efi_capsule.c @@ -852,6 +852,13 @@ efi_status_t __efi_runtime EFIAPI efi_update_capsule( @@ -33,5 +33,5 @@ index ef7b358ddba9..8eb8fc406adf 100644 #endif -- -2.39.1 +2.25.1 diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0017-efi_firmware-add-get_image_info-for-corstone1000.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0017-efi_firmware-add-get_image_info-for-corstone1000.patch index 0a9696d0d9..7087315e45 100644 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0017-efi_firmware-add-get_image_info-for-corstone1000.patch +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0017-efi_firmware-add-get_image_info-for-corstone1000.patch @@ -1,7 +1,7 @@ -From 03f0a1ac1450223ff2aa9be116e918230371048e Mon Sep 17 00:00:00 2001 +From d8f79ab37bae283599e40018055ff9d5648fb647 Mon Sep 17 00:00:00 2001 From: Vishnu Banavath Date: Fri, 17 Dec 2021 19:50:25 +0000 -Subject: [PATCH 17/27] efi_firmware: add get_image_info for corstone1000 +Subject: [PATCH 17/42] efi_firmware: add get_image_info for corstone1000 This change is to populate get_image_info which eventually will be populated in ESRT table @@ -14,7 +14,7 @@ Upstream-Status: Pending [Not submitted to upstream yet] 1 file changed, 71 insertions(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c -index 93e2b01c07a6..0a38a96351ff 100644 +index 93e2b01c07..0a38a96351 100644 --- a/lib/efi_loader/efi_firmware.c +++ b/lib/efi_loader/efi_firmware.c @@ -18,11 +18,69 @@ @@ -119,5 +119,5 @@ index 93e2b01c07a6..0a38a96351ff 100644 NULL, NULL)) return EFI_EXIT(EFI_DEVICE_ERROR); -- -2.39.1 +2.25.1 diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0018-efi_loader-send-bootcomplete-message-to-secure-encla.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0018-efi_loader-send-bootcomplete-message-to-secure-encla.patch index e6a2a55624..1fbad386de 100644 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0018-efi_loader-send-bootcomplete-message-to-secure-encla.patch +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0018-efi_loader-send-bootcomplete-message-to-secure-encla.patch @@ -1,7 +1,7 @@ -From 5866edd29215e939eaad38956886df6c7af5ab96 Mon Sep 17 00:00:00 2001 +From a6fee840a411a6a7b6c276d0a7b1d5445039e6c2 Mon Sep 17 00:00:00 2001 From: Vishnu Banavath Date: Mon, 15 Aug 2022 15:46:18 +0100 -Subject: [PATCH 18/27] efi_loader: send bootcomplete message to secure enclave +Subject: [PATCH 18/42] efi_loader: send bootcomplete message to secure enclave On corstone1000 platform, Secure Enclave will be expecting an event from uboot when it performs capsule update. Previously, @@ -21,7 +21,7 @@ Upstream-Status: Pending [Not submitted to upstream yet] 4 files changed, 41 insertions(+), 45 deletions(-) diff --git a/include/configs/corstone1000.h b/include/configs/corstone1000.h -index e4c7bcb96f27..be13b98d4829 100644 +index e4c7bcb96f..be13b98d48 100644 --- a/include/configs/corstone1000.h +++ b/include/configs/corstone1000.h @@ -22,7 +22,7 @@ @@ -34,7 +34,7 @@ index e4c7bcb96f27..be13b98d4829 100644 #define PREP_SEPROXY_SVC_ID_MASK GENMASK(31, 16) #define PREP_SEPROXY_SVC_ID(x) (FIELD_PREP(PREP_SEPROXY_SVC_ID_MASK, (x))) diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c -index 36a0be7ba104..fea4eb7a342e 100644 +index 36a0be7ba1..fea4eb7a34 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -30,11 +30,6 @@ @@ -102,7 +102,7 @@ index 36a0be7ba104..fea4eb7a342e 100644 efi_set_watchdog(0); schedule(); diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c -index 0a38a96351ff..70568f22909e 100644 +index 0a38a96351..70568f2290 100644 --- a/lib/efi_loader/efi_firmware.c +++ b/lib/efi_loader/efi_firmware.c @@ -48,7 +48,7 @@ static efi_status_t efi_corstone1000_img_info_get ( @@ -115,7 +115,7 @@ index 0a38a96351ff..70568f22909e 100644 } diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c -index 1ad2fa52d7e9..89f988b09c44 100644 +index 1ad2fa52d7..89f988b09c 100644 --- a/lib/efi_loader/efi_setup.c +++ b/lib/efi_loader/efi_setup.c @@ -17,6 +17,9 @@ @@ -179,5 +179,5 @@ index 1ad2fa52d7e9..89f988b09c44 100644 if (ret != EFI_SUCCESS) { printf("EFI: Corstone-1000: cannot allocate caspsule shared buffer\n"); -- -2.39.1 +2.25.1 diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0019-efi_loader-fix-null-pointer-exception-with-get_image.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0019-efi_loader-fix-null-pointer-exception-with-get_image.patch index eef436c13c..24e5b46a5b 100644 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0019-efi_loader-fix-null-pointer-exception-with-get_image.patch +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0019-efi_loader-fix-null-pointer-exception-with-get_image.patch @@ -1,7 +1,7 @@ -From 56c14cd9a96d0c0907b2cb9c1b95a5debff97f75 Mon Sep 17 00:00:00 2001 +From 3d28467e447f12c5aa276827aa742e7eed1d577a Mon Sep 17 00:00:00 2001 From: Vishnu Banavath Date: Fri, 14 Jan 2022 15:24:18 +0000 -Subject: [PATCH 19/27] efi_loader: fix null pointer exception with +Subject: [PATCH 19/42] efi_loader: fix null pointer exception with get_image_info get_img_info API implemented for corstone1000 target does not @@ -17,7 +17,7 @@ Upstream-Status: Pending [Not submitted to upstream yet] 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c -index 70568f22909e..c883e2ff0aa9 100644 +index 70568f2290..c883e2ff0a 100644 --- a/lib/efi_loader/efi_firmware.c +++ b/lib/efi_loader/efi_firmware.c @@ -39,26 +39,29 @@ static efi_status_t efi_corstone1000_img_info_get ( @@ -59,5 +59,5 @@ index 70568f22909e..c883e2ff0aa9 100644 IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED; image_info[i].attributes_setting = IMAGE_ATTRIBUTE_IMAGE_UPDATABLE; -- -2.39.1 +2.25.1 diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0020-arm-corstone1000-add-mmc-for-fvp.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0020-arm-corstone1000-add-mmc-for-fvp.patch index b8d7897d58..93da253666 100644 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0020-arm-corstone1000-add-mmc-for-fvp.patch +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0020-arm-corstone1000-add-mmc-for-fvp.patch @@ -1,7 +1,7 @@ -From 0a4aa2a03a208996e7448c79edd0adef9a697255 Mon Sep 17 00:00:00 2001 +From d6c183a99a7d232ef5dbf886c49e7fb75b50ecf9 Mon Sep 17 00:00:00 2001 From: Rui Miguel Silva Date: Wed, 30 Nov 2022 15:37:22 +0000 -Subject: [PATCH 20/27] arm:corstone1000: add mmc for fvp +Subject: [PATCH 20/42] arm:corstone1000: add mmc for fvp Enable support mmc/sdcard for the corstone1000 FVP. @@ -15,7 +15,7 @@ Upstream-Status: Pending [Not submitted to upstream yet] 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/board/armltd/corstone1000/corstone1000.c b/board/armltd/corstone1000/corstone1000.c -index 76816f8f4ea1..d6ca6e896140 100644 +index 76816f8f4e..d6ca6e8961 100644 --- a/board/armltd/corstone1000/corstone1000.c +++ b/board/armltd/corstone1000/corstone1000.c @@ -38,19 +38,35 @@ static struct mm_region corstone1000_mem_map[] = { @@ -61,7 +61,7 @@ index 76816f8f4ea1..d6ca6e896140 100644 /* OCVM */ .virt = 0x80000000UL, diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig -index 06eac3e041fe..f7c276a10a6e 100644 +index 06eac3e041..f7c276a10a 100644 --- a/configs/corstone1000_defconfig +++ b/configs/corstone1000_defconfig @@ -40,7 +40,13 @@ CONFIG_VERSION_VARIABLE=y @@ -80,7 +80,7 @@ index 06eac3e041fe..f7c276a10a6e 100644 CONFIG_PHY_SMSC=y CONFIG_SMC911X=y diff --git a/include/configs/corstone1000.h b/include/configs/corstone1000.h -index be13b98d4829..a015a1630e2c 100644 +index be13b98d48..a015a1630e 100644 --- a/include/configs/corstone1000.h +++ b/include/configs/corstone1000.h @@ -59,7 +59,9 @@ @@ -95,5 +95,5 @@ index be13b98d4829..a015a1630e2c 100644 #include -- -2.39.1 +2.25.1 diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0021-corstone1000-add-compressed-kernel-support.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0021-corstone1000-add-compressed-kernel-support.patch index a7e24e377d..7797880c3e 100644 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0021-corstone1000-add-compressed-kernel-support.patch +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0021-corstone1000-add-compressed-kernel-support.patch @@ -1,7 +1,7 @@ -From c9503083c042e453be3178a79ba3ff81e8d7ca17 Mon Sep 17 00:00:00 2001 +From 155f20028ad5f3ba5d2362ec48abb7804eaade00 Mon Sep 17 00:00:00 2001 From: Jon Mason Date: Wed, 30 Nov 2022 18:59:59 +0000 -Subject: [PATCH 21/27] corstone1000: add compressed kernel support +Subject: [PATCH 21/42] corstone1000: add compressed kernel support The corstone1000 kernel has become too large to fit in the available storage. Swtiching to a compressed kernel avoids the problem, but @@ -17,7 +17,7 @@ Signed-off-by: Rui Miguel Silva 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig -index f7c276a10a6e..1179bf5f3bfd 100644 +index f7c276a10a..1179bf5f3b 100644 --- a/configs/corstone1000_defconfig +++ b/configs/corstone1000_defconfig @@ -15,7 +15,7 @@ CONFIG_FIT=y @@ -30,5 +30,5 @@ index f7c276a10a6e..1179bf5f3bfd 100644 CONFIG_LOGLEVEL=7 # CONFIG_DISPLAY_CPUINFO is not set -- -2.39.1 +2.25.1 diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0022-Introduce-external-sys-driver-to-device-tree.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0022-Introduce-external-sys-driver-to-device-tree.patch index 4fb3979446..c74e17fb90 100644 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0022-Introduce-external-sys-driver-to-device-tree.patch +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0022-Introduce-external-sys-driver-to-device-tree.patch @@ -1,7 +1,7 @@ -From 2229a66346fb16f092d79fc2e9756ec34ff041a4 Mon Sep 17 00:00:00 2001 +From 984c431cd594c112d71ea1378bc1ac3b72806baa Mon Sep 17 00:00:00 2001 From: Emekcan Date: Wed, 30 Nov 2022 19:02:26 +0000 -Subject: [PATCH 22/27] Introduce external sys driver to device-tree +Subject: [PATCH 22/42] Introduce external sys driver to device-tree It adds external sys driver binding to u-boot device tree. @@ -14,7 +14,7 @@ Signed-off-by: Rui Miguel Silva 1 file changed, 7 insertions(+) diff --git a/arch/arm/dts/corstone1000.dtsi b/arch/arm/dts/corstone1000.dtsi -index 4e46826f883a..2c7185e1391a 100644 +index 4e46826f88..2c7185e139 100644 --- a/arch/arm/dts/corstone1000.dtsi +++ b/arch/arm/dts/corstone1000.dtsi @@ -160,5 +160,12 @@ @@ -31,5 +31,5 @@ index 4e46826f883a..2c7185e1391a 100644 }; }; -- -2.39.1 +2.25.1 diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0023-Add-mhu-and-rpmsg-client-to-u-boot-device-tree.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0023-Add-mhu-and-rpmsg-client-to-u-boot-device-tree.patch index f144c63a7b..5747d782d5 100644 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0023-Add-mhu-and-rpmsg-client-to-u-boot-device-tree.patch +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0023-Add-mhu-and-rpmsg-client-to-u-boot-device-tree.patch @@ -1,7 +1,7 @@ -From aef33222f500c91badd301aecefd153c6d0eb834 Mon Sep 17 00:00:00 2001 +From 4167fe9079b64aaaf3eefc53063d242af8d2badd Mon Sep 17 00:00:00 2001 From: Emekcan Date: Mon, 12 Sep 2022 15:47:06 +0100 -Subject: [PATCH 23/27] Add mhu and rpmsg client to u-boot device tree +Subject: [PATCH 23/42] Add mhu and rpmsg client to u-boot device tree Adds external system controller and mhu driver to u-boot device tree. This enables communication between host and @@ -15,7 +15,7 @@ Signed-off-by: Rui Miguel Silva 1 file changed, 50 insertions(+) diff --git a/arch/arm/dts/corstone1000.dtsi b/arch/arm/dts/corstone1000.dtsi -index 2c7185e1391a..61e0c33247ce 100644 +index 2c7185e139..61e0c33247 100644 --- a/arch/arm/dts/corstone1000.dtsi +++ b/arch/arm/dts/corstone1000.dtsi @@ -161,6 +161,56 @@ @@ -76,5 +76,5 @@ index 2c7185e1391a..61e0c33247ce 100644 compatible = "arm,extsys_ctrl"; reg = <0x1A010310 0x4>, -- -2.39.1 +2.25.1 diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0024-arm-corstone1000-esrt-support.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0024-arm-corstone1000-esrt-support.patch index 87551e9a87..9d569be9ca 100644 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0024-arm-corstone1000-esrt-support.patch +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0024-arm-corstone1000-esrt-support.patch @@ -1,7 +1,7 @@ -From 34f363f9d1c13abecd06ec37567704d0dfc05e77 Mon Sep 17 00:00:00 2001 +From f924535544515cdb350b2979b8c413cf221124b6 Mon Sep 17 00:00:00 2001 From: Satish Kumar Date: Wed, 30 Nov 2022 19:11:43 +0000 -Subject: [PATCH 24/27] arm/corstone1000: esrt support +Subject: [PATCH 24/42] arm/corstone1000: esrt support The implementation is platform specific and would require change in future. @@ -20,7 +20,7 @@ Signed-off-by: Rui Miguel Silva 3 files changed, 143 insertions(+), 9 deletions(-) diff --git a/include/efi_api.h b/include/efi_api.h -index 9bd70b0f18ce..23e427236a8f 100644 +index 9bd70b0f18..23e427236a 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -2030,7 +2030,7 @@ struct efi_firmware_image_descriptor { @@ -33,7 +33,7 @@ index 9bd70b0f18ce..23e427236a8f 100644 struct efi_firmware_management_protocol { efi_status_t (EFIAPI *get_image_info)( diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c -index c883e2ff0aa9..c6ab6e2182dd 100644 +index c883e2ff0a..c6ab6e2182 100644 --- a/lib/efi_loader/efi_firmware.c +++ b/lib/efi_loader/efi_firmware.c @@ -15,6 +15,7 @@ @@ -186,7 +186,7 @@ index c883e2ff0aa9..c6ab6e2182dd 100644 .set_image = efi_firmware_fit_set_image, .check_image = efi_firmware_check_image_unsupported, diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c -index 89f988b09c44..08c742edbd12 100644 +index 89f988b09c..08c742edbd 100644 --- a/lib/efi_loader/efi_setup.c +++ b/lib/efi_loader/efi_setup.c @@ -167,14 +167,6 @@ static efi_status_t efi_init_capsule(void) @@ -221,5 +221,5 @@ index 89f988b09c44..08c742edbd12 100644 ret = efi_init_variables(); if (ret != EFI_SUCCESS) -- -2.39.1 +2.25.1 diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0025-efi_setup-discover-FF-A-bus-before-raising-EFI-start.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0025-efi_setup-discover-FF-A-bus-before-raising-EFI-start.patch index d903ab4c35..568d9464c9 100644 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0025-efi_setup-discover-FF-A-bus-before-raising-EFI-start.patch +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0025-efi_setup-discover-FF-A-bus-before-raising-EFI-start.patch @@ -1,7 +1,7 @@ -From 61f17cf403e2c1108b76556c879aa21945b31dcb Mon Sep 17 00:00:00 2001 +From 1f165f5b6e7d82611b55260b7254fee5fbebe539 Mon Sep 17 00:00:00 2001 From: Abdellatif El Khlifi Date: Wed, 30 Nov 2022 19:14:52 +0000 -Subject: [PATCH 25/27] efi_setup: discover FF-A bus before raising EFI started +Subject: [PATCH 25/42] efi_setup: discover FF-A bus before raising EFI started event add FF-A discovery to efi_corstone1000_uboot_efi_started_event() @@ -14,7 +14,7 @@ Signed-off-by: Rui Miguel Silva 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c -index 08c742edbd12..65bd626e49b4 100644 +index 08c742edbd..65bd626e49 100644 --- a/lib/efi_loader/efi_setup.c +++ b/lib/efi_loader/efi_setup.c @@ -142,9 +142,16 @@ static efi_status_t efi_init_secure_boot(void) @@ -47,5 +47,5 @@ index 08c742edbd12..65bd626e49b4 100644 /* Initialize variable services */ -- -2.39.1 +2.25.1 diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0026-corstone1000-enable-distro-booting-command.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0026-corstone1000-enable-distro-booting-command.patch index b3a8d14b6c..57751b19be 100644 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0026-corstone1000-enable-distro-booting-command.patch +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0026-corstone1000-enable-distro-booting-command.patch @@ -1,7 +1,7 @@ -From 646269a92824f3e9b4145848e42ad3ba555e8931 Mon Sep 17 00:00:00 2001 +From 2a281a45b7dfc5c0e78f6256bf0ac122d825ce82 Mon Sep 17 00:00:00 2001 From: Abdellatif El Khlifi Date: Mon, 5 Dec 2022 17:02:32 +0000 -Subject: [PATCH 26/27] corstone1000: enable distro booting command +Subject: [PATCH 26/42] corstone1000: enable distro booting command enable distro_bootcmd @@ -13,7 +13,7 @@ Signed-off-by: Rui Miguel Silva 1 file changed, 1 insertion(+) diff --git a/include/configs/corstone1000.h b/include/configs/corstone1000.h -index a015a1630e2c..c30a7bfa0c0b 100644 +index a015a1630e..c30a7bfa0c 100644 --- a/include/configs/corstone1000.h +++ b/include/configs/corstone1000.h @@ -65,5 +65,6 @@ @@ -24,5 +24,5 @@ index a015a1630e2c..c30a7bfa0c0b 100644 #endif -- -2.39.1 +2.25.1 diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0027-drivers-mtd-nvmxip-introduce-NVM-XIP-block-storage-e.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0027-drivers-mtd-nvmxip-introduce-NVM-XIP-block-storage-e.patch new file mode 100644 index 0000000000..721ee15665 --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0027-drivers-mtd-nvmxip-introduce-NVM-XIP-block-storage-e.patch @@ -0,0 +1,455 @@ +From c7567aaf75a66e204d492a8f6e2a3b4bfb8a7e45 Mon Sep 17 00:00:00 2001 +From: Abdellatif El Khlifi +Date: Fri, 14 Apr 2023 13:23:25 +0100 +Subject: [PATCH 27/42] drivers/mtd/nvmxip: introduce NVM XIP block storage + emulation + +add block storage emulation for NVM XIP flash devices + +Some paltforms such as Corstone-1000 need to see NVM XIP raw flash +as a block storage device with read only capability. + +Here NVM flash devices are devices with addressable +memory (e.g: QSPI NOR flash). + +The implementation is generic and can be used by different platforms. + +Two drivers are provided as follows. + + nvmxip-blk : + + a generic block driver allowing to read from the XIP flash + + nvmxip Uclass driver : + + When a device is described in the DT and associated with + UCLASS_NVMXIP, the Uclass creates a block device and binds it with + the nvmxip-blk. + +Platforms can use multiple NVM XIP devices at the same time by defining a +DT node for each one of them. + +Signed-off-by: Abdellatif El Khlifi +Upstream-Status: Backport [https://github.com/u-boot/u-boot/commit/c9c2c95d4cd27fe0cd41fe13a863899d268f973c] +--- + MAINTAINERS | 6 ++ + doc/develop/driver-model/index.rst | 1 + + doc/develop/driver-model/nvmxip.rst | 48 +++++++++++ + drivers/block/blk-uclass.c | 1 + + drivers/mtd/Kconfig | 2 + + drivers/mtd/Makefile | 1 + + drivers/mtd/nvmxip/Kconfig | 13 +++ + drivers/mtd/nvmxip/Makefile | 7 ++ + drivers/mtd/nvmxip/nvmxip-uclass.c | 67 ++++++++++++++++ + drivers/mtd/nvmxip/nvmxip.c | 119 ++++++++++++++++++++++++++++ + drivers/mtd/nvmxip/nvmxip.h | 32 ++++++++ + include/dm/uclass-id.h | 1 + + 12 files changed, 298 insertions(+) + create mode 100644 doc/develop/driver-model/nvmxip.rst + create mode 100644 drivers/mtd/nvmxip/Kconfig + create mode 100644 drivers/mtd/nvmxip/Makefile + create mode 100644 drivers/mtd/nvmxip/nvmxip-uclass.c + create mode 100644 drivers/mtd/nvmxip/nvmxip.c + create mode 100644 drivers/mtd/nvmxip/nvmxip.h + +diff --git a/MAINTAINERS b/MAINTAINERS +index a2f60a3b93..1dbfab5f43 100644 +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -1202,6 +1202,12 @@ F: cmd/nvme.c + F: include/nvme.h + F: doc/develop/driver-model/nvme.rst + ++NVMXIP ++M: Abdellatif El Khlifi ++S: Maintained ++F: doc/develop/driver-model/nvmxip.rst ++F: drivers/mtd/nvmxip/ ++ + NVMEM + M: Sean Anderson + S: Maintained +diff --git a/doc/develop/driver-model/index.rst b/doc/develop/driver-model/index.rst +index 7366ef818c..8e12bbd936 100644 +--- a/doc/develop/driver-model/index.rst ++++ b/doc/develop/driver-model/index.rst +@@ -20,6 +20,7 @@ subsystems + livetree + migration + nvme ++ nvmxip + of-plat + pci-info + pmic-framework +diff --git a/doc/develop/driver-model/nvmxip.rst b/doc/develop/driver-model/nvmxip.rst +new file mode 100644 +index 0000000000..fe087b13d2 +--- /dev/null ++++ b/doc/develop/driver-model/nvmxip.rst +@@ -0,0 +1,48 @@ ++.. SPDX-License-Identifier: GPL-2.0+ ++ ++NVM XIP Block Storage Emulation Driver ++======================================= ++ ++Summary ++------- ++ ++Non-Volatile Memory devices with addressable memory (e.g: QSPI NOR flash) could ++be used for block storage needs (e.g: parsing a GPT layout in a raw QSPI NOR flash). ++ ++The NVMXIP Uclass provides this functionality and can be used for any 64-bit platform. ++ ++The NVMXIP Uclass provides the following drivers: ++ ++ nvmxip-blk block driver: ++ ++ A generic block driver allowing to read from the XIP flash. ++ The driver belongs to UCLASS_BLK. ++ The driver implemented by drivers/mtd/nvmxip/nvmxip.c ++ ++ nvmxip Uclass driver: ++ ++ When a device is described in the DT and associated with UCLASS_NVMXIP, ++ the Uclass creates a block device and binds it with the nvmxip-blk. ++ The Uclass driver implemented by drivers/mtd/nvmxip/nvmxip-uclass.c ++ ++ The implementation is generic and can be used by different platforms. ++ ++Supported hardware ++-------------------------------- ++ ++Any 64-bit plaform. ++ ++Configuration ++---------------------- ++ ++config NVMXIP ++ This option allows the emulation of a block storage device ++ on top of a direct access non volatile memory XIP flash devices. ++ This support provides the read operation. ++ This option provides the block storage driver nvmxip-blk which ++ handles the read operation. This driver is HW agnostic and can support ++ multiple flash devices at the same time. ++ ++Contributors ++------------ ++ * Abdellatif El Khlifi +diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c +index c69fc4d518..e8ab576c32 100644 +--- a/drivers/block/blk-uclass.c ++++ b/drivers/block/blk-uclass.c +@@ -28,6 +28,7 @@ static struct { + { UCLASS_AHCI, "sata" }, + { UCLASS_HOST, "host" }, + { UCLASS_NVME, "nvme" }, ++ { UCLASS_NVMXIP, "nvmxip" }, + { UCLASS_EFI_MEDIA, "efi" }, + { UCLASS_EFI_LOADER, "efiloader" }, + { UCLASS_VIRTIO, "virtio" }, +diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig +index fcdb450f77..0537ac64e3 100644 +--- a/drivers/mtd/Kconfig ++++ b/drivers/mtd/Kconfig +@@ -224,4 +224,6 @@ source "drivers/mtd/spi/Kconfig" + + source "drivers/mtd/ubi/Kconfig" + ++source "drivers/mtd/nvmxip/Kconfig" ++ + endmenu +diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile +index 3a78590aaa..c638980ea2 100644 +--- a/drivers/mtd/Makefile ++++ b/drivers/mtd/Makefile +@@ -25,6 +25,7 @@ obj-y += nand/ + obj-y += onenand/ + obj-y += spi/ + obj-$(CONFIG_MTD_UBI) += ubi/ ++obj-$(CONFIG_NVMXIP) += nvmxip/ + + #SPL/TPL build + else +diff --git a/drivers/mtd/nvmxip/Kconfig b/drivers/mtd/nvmxip/Kconfig +new file mode 100644 +index 0000000000..ef53fc3c79 +--- /dev/null ++++ b/drivers/mtd/nvmxip/Kconfig +@@ -0,0 +1,13 @@ ++# SPDX-License-Identifier: GPL-2.0+ ++# ++# Copyright 2023 Arm Limited and/or its affiliates ++# Authors: ++# Abdellatif El Khlifi ++ ++config NVMXIP ++ bool "NVM XIP devices support" ++ select BLK ++ help ++ This option allows the emulation of a block storage device ++ on top of a direct access non volatile memory XIP flash devices. ++ This support provides the read operation. +diff --git a/drivers/mtd/nvmxip/Makefile b/drivers/mtd/nvmxip/Makefile +new file mode 100644 +index 0000000000..07890982c7 +--- /dev/null ++++ b/drivers/mtd/nvmxip/Makefile +@@ -0,0 +1,7 @@ ++# SPDX-License-Identifier: GPL-2.0+ ++# ++# Copyright 2023 Arm Limited and/or its affiliates ++# Authors: ++# Abdellatif El Khlifi ++ ++obj-y += nvmxip-uclass.o nvmxip.o +diff --git a/drivers/mtd/nvmxip/nvmxip-uclass.c b/drivers/mtd/nvmxip/nvmxip-uclass.c +new file mode 100644 +index 0000000000..9f96041e3d +--- /dev/null ++++ b/drivers/mtd/nvmxip/nvmxip-uclass.c +@@ -0,0 +1,67 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * Copyright 2023 Arm Limited and/or its affiliates ++ * ++ * Authors: ++ * Abdellatif El Khlifi ++ */ ++ ++#include ++#include ++#include ++#include ++#include "nvmxip.h" ++ ++/* LBA Macros */ ++ ++#define DEFAULT_LBA_SHIFT 10 /* 1024 bytes per block */ ++#define DEFAULT_LBA_COUNT 1024 /* block count */ ++ ++#define DEFAULT_LBA_SZ BIT(DEFAULT_LBA_SHIFT) ++ ++/** ++ * nvmxip_post_bind() - post binding treatments ++ * @dev: the NVMXIP device ++ * ++ * Create and probe a child block device. ++ * ++ * Return: ++ * ++ * 0 on success. Otherwise, failure ++ */ ++static int nvmxip_post_bind(struct udevice *udev) ++{ ++ int ret; ++ struct udevice *bdev = NULL; ++ char bdev_name[NVMXIP_BLKDEV_NAME_SZ + 1]; ++ int devnum; ++ ++ devnum = uclass_id_count(UCLASS_NVMXIP); ++ snprintf(bdev_name, NVMXIP_BLKDEV_NAME_SZ, "blk#%d", devnum); ++ ++ ret = blk_create_devicef(udev, NVMXIP_BLKDRV_NAME, bdev_name, UCLASS_NVMXIP, ++ devnum, DEFAULT_LBA_SZ, ++ DEFAULT_LBA_COUNT, &bdev); ++ if (ret) { ++ log_err("[%s]: failure during creation of the block device %s, error %d\n", ++ udev->name, bdev_name, ret); ++ return ret; ++ } ++ ++ ret = blk_probe_or_unbind(bdev); ++ if (ret) { ++ log_err("[%s]: failure during probing the block device %s, error %d\n", ++ udev->name, bdev_name, ret); ++ return ret; ++ } ++ ++ log_info("[%s]: the block device %s ready for use\n", udev->name, bdev_name); ++ ++ return 0; ++} ++ ++UCLASS_DRIVER(nvmxip) = { ++ .name = "nvmxip", ++ .id = UCLASS_NVMXIP, ++ .post_bind = nvmxip_post_bind, ++}; +diff --git a/drivers/mtd/nvmxip/nvmxip.c b/drivers/mtd/nvmxip/nvmxip.c +new file mode 100644 +index 0000000000..a359e3b482 +--- /dev/null ++++ b/drivers/mtd/nvmxip/nvmxip.c +@@ -0,0 +1,119 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * Copyright 2023 Arm Limited and/or its affiliates ++ * ++ * Authors: ++ * Abdellatif El Khlifi ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "nvmxip.h" ++ ++/** ++ * nvmxip_mmio_rawread() - read from the XIP flash ++ * @address: address of the data ++ * @value: pointer to where storing the value read ++ * ++ * Read raw data from the XIP flash. ++ * ++ * Return: ++ * ++ * Always return 0. ++ */ ++static int nvmxip_mmio_rawread(const phys_addr_t address, u64 *value) ++{ ++ *value = readq(address); ++ return 0; ++} ++ ++/** ++ * nvmxip_blk_read() - block device read operation ++ * @dev: the block device ++ * @blknr: first block number to read from ++ * @blkcnt: number of blocks to read ++ * @buffer: destination buffer ++ * ++ * Read data from the block storage device. ++ * ++ * Return: ++ * ++ * number of blocks read on success. Otherwise, failure ++ */ ++static ulong nvmxip_blk_read(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, void *buffer) ++{ ++ struct nvmxip_plat *plat = dev_get_plat(dev->parent); ++ struct blk_desc *desc = dev_get_uclass_plat(dev); ++ /* number of the u64 words to read */ ++ u32 qwords = (blkcnt * desc->blksz) / sizeof(u64); ++ /* physical address of the first block to read */ ++ phys_addr_t blkaddr = plat->phys_base + blknr * desc->blksz; ++ u64 *virt_blkaddr; ++ u64 *pdst = buffer; ++ uint qdata_idx; ++ ++ if (!pdst) ++ return -EINVAL; ++ ++ log_debug("[%s]: reading from blknr: %lu , blkcnt: %lu\n", dev->name, blknr, blkcnt); ++ ++ virt_blkaddr = map_sysmem(blkaddr, 0); ++ ++ /* assumption: the data is virtually contiguous */ ++ ++ for (qdata_idx = 0 ; qdata_idx < qwords ; qdata_idx++) ++ nvmxip_mmio_rawread((phys_addr_t)(virt_blkaddr + qdata_idx), pdst++); ++ ++ log_debug("[%s]: src[0]: 0x%llx , dst[0]: 0x%llx , src[-1]: 0x%llx , dst[-1]: 0x%llx\n", ++ dev->name, ++ *virt_blkaddr, ++ *(u64 *)buffer, ++ *(u64 *)((u8 *)virt_blkaddr + desc->blksz * blkcnt - sizeof(u64)), ++ *(u64 *)((u8 *)buffer + desc->blksz * blkcnt - sizeof(u64))); ++ ++ unmap_sysmem(virt_blkaddr); ++ ++ return blkcnt; ++} ++ ++/** ++ * nvmxip_blk_probe() - block storage device probe ++ * @dev: the block storage device ++ * ++ * Initialize the block storage descriptor. ++ * ++ * Return: ++ * ++ * Always return 0. ++ */ ++static int nvmxip_blk_probe(struct udevice *dev) ++{ ++ struct nvmxip_plat *plat = dev_get_plat(dev->parent); ++ struct blk_desc *desc = dev_get_uclass_plat(dev); ++ ++ desc->lba = plat->lba; ++ desc->log2blksz = plat->lba_shift; ++ desc->blksz = BIT(plat->lba_shift); ++ desc->bdev = dev; ++ ++ log_debug("[%s]: block storage layout\n lbas: %lu , log2blksz: %d, blksz: %lu\n", ++ dev->name, desc->lba, desc->log2blksz, desc->blksz); ++ ++ return 0; ++} ++ ++static const struct blk_ops nvmxip_blk_ops = { ++ .read = nvmxip_blk_read, ++}; ++ ++U_BOOT_DRIVER(nvmxip_blk) = { ++ .name = NVMXIP_BLKDRV_NAME, ++ .id = UCLASS_BLK, ++ .probe = nvmxip_blk_probe, ++ .ops = &nvmxip_blk_ops, ++}; +diff --git a/drivers/mtd/nvmxip/nvmxip.h b/drivers/mtd/nvmxip/nvmxip.h +new file mode 100644 +index 0000000000..f4ef37725d +--- /dev/null ++++ b/drivers/mtd/nvmxip/nvmxip.h +@@ -0,0 +1,32 @@ ++/* SPDX-License-Identifier: GPL-2.0+ */ ++/* ++ * Copyright 2023 Arm Limited and/or its affiliates ++ * ++ * Authors: ++ * Abdellatif El Khlifi ++ */ ++ ++#ifndef __DRIVER_NVMXIP_H__ ++#define __DRIVER_NVMXIP_H__ ++ ++#include ++ ++#define NVMXIP_BLKDRV_NAME "nvmxip-blk" ++#define NVMXIP_BLKDEV_NAME_SZ 20 ++ ++/** ++ * struct nvmxip_plat - the NVMXIP driver plat ++ * ++ * @phys_base: NVM XIP device base address ++ * @lba_shift: block size shift count ++ * @lba: number of blocks ++ * ++ * The NVMXIP information read from the DT. ++ */ ++struct nvmxip_plat { ++ phys_addr_t phys_base; ++ u32 lba_shift; ++ lbaint_t lba; ++}; ++ ++#endif /* __DRIVER_NVMXIP_H__ */ +diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h +index fa08a66ac8..f3564a49d9 100644 +--- a/include/dm/uclass-id.h ++++ b/include/dm/uclass-id.h +@@ -92,6 +92,7 @@ enum uclass_id { + UCLASS_NOP, /* No-op devices */ + UCLASS_NORTHBRIDGE, /* Intel Northbridge / SDRAM controller */ + UCLASS_NVME, /* NVM Express device */ ++ UCLASS_NVMXIP, /* NVM XIP devices */ + UCLASS_P2SB, /* (x86) Primary-to-Sideband Bus */ + UCLASS_PANEL, /* Display panel, such as an LCD */ + UCLASS_PANEL_BACKLIGHT, /* Backlight controller for panel */ +-- +2.25.1 + diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0027-drivers-nvmxip-introduce-NVM-XIP-block-storage-emula.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0027-drivers-nvmxip-introduce-NVM-XIP-block-storage-emula.patch deleted file mode 100644 index 30baf6826f..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0027-drivers-nvmxip-introduce-NVM-XIP-block-storage-emula.patch +++ /dev/null @@ -1,595 +0,0 @@ -From 1d277bc8c275fae8e8cd400344bdacbdce3a6b46 Mon Sep 17 00:00:00 2001 -From: Abdellatif El Khlifi -Date: Tue, 13 Dec 2022 19:47:49 +0000 -Subject: [PATCH 27/43] drivers/nvmxip: introduce NVM XIP block storage - emulation - -add block storage emulation for NVM XIP flash devices - -Some paltforms such as Corstone-1000 need to see NVM XIP raw flash -as a block storage device with read only capability. - -Here NVM flash devices are devices with addressable -memory (e.g: QSPI NOR flash). - -The implementation is generic and can be used by different platforms. - -Two drivers are provided as follows. - - nvmxip-blk : - - a generic block driver allowing to read from the XIP flash - - nvmxip_qspi : - - The driver probed with the DT and parent of the nvmxip-blk device. - nvmxip_qspi can be reused by other platforms. If the platform - has custom settings to apply before using the flash, then the platform - can provide its own parent driver belonging to UCLASS_NVMXIP and reuse - nvmxip-blk. The custom driver can be implmented like nvmxip_qspi in - addition to the platform custom settings. - -Platforms can use multiple NVM XIP devices at the same time by defining a -DT node for each one of them. - -For more details please refer to doc/develop/driver-model/nvmxip.rst - -Upstream-Status: Submitted -Signed-off-by: Abdellatif El Khlifi -Signed-off-by: Rui Miguel Silva ---- - MAINTAINERS | 7 ++ - doc/develop/driver-model/index.rst | 1 + - doc/develop/driver-model/nvmxip.rst | 70 ++++++++++++ - doc/device-tree-bindings/nvmxip/nvmxip.txt | 56 +++++++++ - drivers/Kconfig | 2 + - drivers/Makefile | 1 + - drivers/block/blk-uclass.c | 1 + - drivers/nvmxip/Kconfig | 17 +++ - drivers/nvmxip/Makefile | 7 ++ - drivers/nvmxip/nvmxip-uclass.c | 13 +++ - drivers/nvmxip/nvmxip.c | 127 +++++++++++++++++++++ - drivers/nvmxip/nvmxip.h | 46 ++++++++ - drivers/nvmxip/nvmxip_qspi.c | 65 +++++++++++ - include/dm/uclass-id.h | 1 + - 14 files changed, 414 insertions(+) - create mode 100644 doc/develop/driver-model/nvmxip.rst - create mode 100644 doc/device-tree-bindings/nvmxip/nvmxip.txt - create mode 100644 drivers/nvmxip/Kconfig - create mode 100644 drivers/nvmxip/Makefile - create mode 100644 drivers/nvmxip/nvmxip-uclass.c - create mode 100644 drivers/nvmxip/nvmxip.c - create mode 100644 drivers/nvmxip/nvmxip.h - create mode 100644 drivers/nvmxip/nvmxip_qspi.c - -diff --git a/MAINTAINERS b/MAINTAINERS -index 9feaf0502f5b..ba15dd02d58d 100644 ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -1204,6 +1204,13 @@ F: cmd/nvme.c - F: include/nvme.h - F: doc/develop/driver-model/nvme.rst - -+NVMXIP -+M: Abdellatif El Khlifi -+S: Maintained -+F: doc/develop/driver-model/nvmxip.rst -+F: doc/device-tree-bindings/nvmxip/nvmxip.txt -+F: drivers/nvmxip/ -+ - NVMEM - M: Sean Anderson - S: Maintained -diff --git a/doc/develop/driver-model/index.rst b/doc/develop/driver-model/index.rst -index 7366ef818c5a..8e12bbd9366a 100644 ---- a/doc/develop/driver-model/index.rst -+++ b/doc/develop/driver-model/index.rst -@@ -20,6 +20,7 @@ subsystems - livetree - migration - nvme -+ nvmxip - of-plat - pci-info - pmic-framework -diff --git a/doc/develop/driver-model/nvmxip.rst b/doc/develop/driver-model/nvmxip.rst -new file mode 100644 -index 000000000000..91b24e4e50d2 ---- /dev/null -+++ b/doc/develop/driver-model/nvmxip.rst -@@ -0,0 +1,70 @@ -+.. SPDX-License-Identifier: GPL-2.0+ -+ -+NVM XIP Block Storage Emulation Driver -+======================================= -+ -+Summary -+------- -+ -+Non-Volatile Memory devices with addressable memory (e.g: QSPI NOR flash) could -+be used for block storage needs (e.g: parsing a GPT layout in a raw QSPI NOR flash). -+ -+The NVMXIP class provides this functionality and can be used for any 64-bit platform. -+ -+The NVMXIP class provides the following drivers: -+ -+ nvmxip-blk : -+ -+ A generic block driver allowing to read from the XIP flash. -+ The driver belongs to UCLASS_BLK. -+ The driver implemented by drivers/nvmxip/nvmxip.c -+ -+ nvmxip_qspi : -+ -+ The driver probed with the DT and parent of the nvmxip-blk device. -+ nvmxip_qspi can be reused by other platforms. If the platform -+ has custom settings to apply before using the flash, then the platform -+ can provide its own parent driver belonging to UCLASS_NVMXIP and reuse -+ nvmxip-blk. The custom driver can be implmented like nvmxip_qspi in -+ addition to the platform custom settings. -+ The nvmxip_qspi driver belongs to UCLASS_NVMXIP. -+ The driver implemented by drivers/nvmxip/nvmxip_qspi.c -+ -+ The implementation is generic and can be used by different platforms. -+ -+Supported hardware -+-------------------------------- -+ -+Any 64-bit plaform. -+ -+Configuration -+---------------------- -+ -+config NVMXIP -+ This option allows the emulation of a block storage device -+ on top of a direct access non volatile memory XIP flash devices. -+ This support provides the read operation. -+ This option provides the block storage driver nvmxip-blk which -+ handles the read operation. This driver is HW agnostic and can support -+ multiple flash devices at the same time. -+ -+config NVMXIP_QSPI -+ This option allows the emulation of a block storage device on top of a QSPI XIP flash. -+ Any platform that needs to emulate one or multiple XIP flash devices can turn this -+ option on to enable the functionality. NVMXIP config is selected automatically. -+ Platforms that need to add custom treatments before accessing to the flash, can -+ write their own driver (same as nvmxip_qspi in addition to the custom settings). -+ -+Device Tree nodes -+-------------------- -+ -+Multiple XIP flash devices can be used at the same time by describing them through DT -+nodes. -+ -+Please refer to the documentation of the DT binding at: -+ -+doc/device-tree-bindings/nvmxip/nvmxip.txt -+ -+Contributors -+------------ -+ * Abdellatif El Khlifi -diff --git a/doc/device-tree-bindings/nvmxip/nvmxip.txt b/doc/device-tree-bindings/nvmxip/nvmxip.txt -new file mode 100644 -index 000000000000..7c4b03f66b57 ---- /dev/null -+++ b/doc/device-tree-bindings/nvmxip/nvmxip.txt -@@ -0,0 +1,56 @@ -+Specifying NVMXIP information for devices -+====================================== -+ -+NVM XIP flash device nodes -+--------------------------- -+ -+Each flash device should have its own node. -+ -+Each node must specify the following fields: -+ -+1) -+ compatible = "nvmxip,qspi"; -+ -+This allows to bind the flash device with the nvmxip_qspi driver -+If a platform has its own driver, please provide your own compatible -+string. -+ -+2) -+ reg = <0x0 0x08000000 0x0 0x00200000>; -+ -+The start address and size of the flash device. The values give here are an -+example (when the cell size is 2). -+ -+When cell size is 1, the reg field looks like this: -+ -+ reg = <0x08000000 0x00200000>; -+ -+3) -+ -+ lba_shift = <9>; -+ -+The number of bit shifts used to calculate the size in bytes of one block. -+In this example the block size is 1 << 9 = 2 ^ 9 = 512 bytes -+ -+4) -+ -+ lba = <4096>; -+ -+The number of blocks. -+ -+Example of multiple flash devices -+---------------------------------------------------- -+ -+ nvmxip-qspi1@08000000 { -+ compatible = "nvmxip,qspi"; -+ reg = <0x0 0x08000000 0x0 0x00200000>; -+ lba_shift = <9>; -+ lba = <4096>; -+ }; -+ -+ nvmxip-qspi2@08200000 { -+ compatible = "nvmxip,qspi"; -+ reg = <0x0 0x08200000 0x0 0x00100000>; -+ lba_shift = <9>; -+ lba = <2048>; -+ }; -diff --git a/drivers/Kconfig b/drivers/Kconfig -index e51f0547c3da..d425ff1e76c7 100644 ---- a/drivers/Kconfig -+++ b/drivers/Kconfig -@@ -78,6 +78,8 @@ source "drivers/net/Kconfig" - - source "drivers/nvme/Kconfig" - -+source "drivers/nvmxip/Kconfig" -+ - source "drivers/pci/Kconfig" - - source "drivers/pci_endpoint/Kconfig" -diff --git a/drivers/Makefile b/drivers/Makefile -index f0a7530295c5..fb1b62cbd6ff 100644 ---- a/drivers/Makefile -+++ b/drivers/Makefile -@@ -89,6 +89,7 @@ obj-$(CONFIG_FWU_MDATA) += fwu-mdata/ - obj-y += misc/ - obj-$(CONFIG_MMC) += mmc/ - obj-$(CONFIG_NVME) += nvme/ -+obj-$(CONFIG_NVMXIP) += nvmxip/ - obj-$(CONFIG_PCI_ENDPOINT) += pci_endpoint/ - obj-y += dfu/ - obj-$(CONFIG_PCH) += pch/ -diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c -index c69fc4d51829..e8ab576c3253 100644 ---- a/drivers/block/blk-uclass.c -+++ b/drivers/block/blk-uclass.c -@@ -28,6 +28,7 @@ static struct { - { UCLASS_AHCI, "sata" }, - { UCLASS_HOST, "host" }, - { UCLASS_NVME, "nvme" }, -+ { UCLASS_NVMXIP, "nvmxip" }, - { UCLASS_EFI_MEDIA, "efi" }, - { UCLASS_EFI_LOADER, "efiloader" }, - { UCLASS_VIRTIO, "virtio" }, -diff --git a/drivers/nvmxip/Kconfig b/drivers/nvmxip/Kconfig -new file mode 100644 -index 000000000000..6a23acaf1895 ---- /dev/null -+++ b/drivers/nvmxip/Kconfig -@@ -0,0 +1,17 @@ -+# SPDX-License-Identifier: GPL-2.0+ -+# -+# Copyright (C) 2022, Abdellatif El Khlifi -+ -+config NVMXIP -+ bool "NVM XIP devices support" -+ select BLK -+ help -+ This option allows the emulation of a block storage device -+ on top of a direct access non volatile memory XIP flash devices. -+ This support provides the read operation. -+ -+config NVMXIP_QSPI -+ bool "QSPI XIP support" -+ select NVMXIP -+ help -+ This option allows the emulation of a block storage device on top of a QSPI XIP flash -diff --git a/drivers/nvmxip/Makefile b/drivers/nvmxip/Makefile -new file mode 100644 -index 000000000000..d8ad2a160b47 ---- /dev/null -+++ b/drivers/nvmxip/Makefile -@@ -0,0 +1,7 @@ -+# SPDX-License-Identifier: GPL-2.0+ -+# -+# (C) Copyright 2022 -+# Abdellatif El Khlifi, Arm Limited, abdellatif.elkhlifi@arm.com. -+ -+obj-y += nvmxip-uclass.o nvmxip.o -+obj-$(CONFIG_NVMXIP_QSPI) += nvmxip_qspi.o -diff --git a/drivers/nvmxip/nvmxip-uclass.c b/drivers/nvmxip/nvmxip-uclass.c -new file mode 100644 -index 000000000000..0f7e47b8af86 ---- /dev/null -+++ b/drivers/nvmxip/nvmxip-uclass.c -@@ -0,0 +1,13 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+/* -+ * (C) Copyright 2022 ARM Limited -+ * Abdellatif El Khlifi -+ */ -+ -+#include -+#include -+ -+UCLASS_DRIVER(nvmxip) = { -+ .name = "nvmxip", -+ .id = UCLASS_NVMXIP, -+}; -diff --git a/drivers/nvmxip/nvmxip.c b/drivers/nvmxip/nvmxip.c -new file mode 100644 -index 000000000000..6ba48183c575 ---- /dev/null -+++ b/drivers/nvmxip/nvmxip.c -@@ -0,0 +1,127 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+/* -+ * (C) Copyright 2022 ARM Limited -+ * Abdellatif El Khlifi -+ */ -+ -+#include -+#include -+#include -+#include "nvmxip.h" -+ -+static u32 nvmxip_bdev_max_devs; -+ -+static int nvmxip_mmio_rawread(const phys_addr_t address, u64 *value) -+{ -+ *value = readq(address); -+ return 0; -+} -+ -+static ulong nvmxip_blk_read(struct udevice *udev, lbaint_t blknr, lbaint_t blkcnt, void *buffer) -+{ -+ struct nvmxip_blk_priv *bpriv_data = dev_get_priv(udev); -+ struct blk_desc *desc = dev_get_uclass_plat(udev); -+ -+ /* size of 1 block */ -+ /* number of the u64 words to read */ -+ u32 qwords = (blkcnt * desc->blksz) / sizeof(u64); -+ /* physical address of the first block to read */ -+ phys_addr_t blkaddr = bpriv_data->pplat_data->phys_base + blknr * desc->blksz; -+ u64 *virt_blkaddr; -+ u64 *pdst = buffer; -+ u32 qdata_idx; -+ -+ if (!pdst) -+ return -EINVAL; -+ -+ pr_debug("[%s]: reading from blknr: %lu , blkcnt: %lu\n", udev->name, blknr, blkcnt); -+ -+ virt_blkaddr = map_sysmem(blkaddr, 0); -+ -+ /* assumption: the data is virtually contiguous */ -+ -+ for (qdata_idx = 0 ; qdata_idx < qwords ; qdata_idx++) -+ nvmxip_mmio_rawread((phys_addr_t)(virt_blkaddr + qdata_idx), pdst++); -+ -+ pr_debug("[%s]: src[0]: 0x%llx , dst[0]: 0x%llx , src[-1]: 0x%llx , dst[-1]: 0x%llx\n", -+ udev->name, -+ *virt_blkaddr, -+ *(u64 *)buffer, -+ *(u64 *)((u8 *)virt_blkaddr + desc->blksz * blkcnt - sizeof(u64)), -+ *(u64 *)((u8 *)buffer + desc->blksz * blkcnt - sizeof(u64))); -+ -+ unmap_sysmem(virt_blkaddr); -+ -+ return blkcnt; -+} -+ -+static int nvmxip_blk_probe(struct udevice *udev) -+{ -+ struct nvmxip_priv *ppriv_data = dev_get_priv(udev->parent); -+ struct blk_desc *desc = dev_get_uclass_plat(udev); -+ struct nvmxip_blk_priv *bpriv_data = dev_get_priv(udev); -+ -+ bpriv_data->bdev = udev; -+ bpriv_data->pplat_data = ppriv_data->plat_data; -+ desc->lba = bpriv_data->pplat_data->lba; -+ desc->log2blksz = bpriv_data->pplat_data->lba_shift; -+ desc->blksz = 1 << bpriv_data->pplat_data->lba_shift; -+ desc->bdev = bpriv_data->bdev; -+ -+ pr_debug("[%s]: block storage layout\n lbas: %lu , log2blksz: %d, blksz: %lu\n", -+ udev->name, desc->lba, desc->log2blksz, desc->blksz); -+ -+ return 0; -+} -+ -+int nvmxip_init(struct udevice *udev) -+{ -+ struct nvmxip_plat *plat_data = dev_get_plat(udev); -+ struct nvmxip_priv *priv_data = dev_get_priv(udev); -+ int ret; -+ struct udevice *bdev = NULL; -+ char bdev_name[NVMXIP_BLKDEV_NAME_SZ + 1] = {0}; -+ -+ priv_data->udev = udev; -+ priv_data->plat_data = plat_data; -+ -+ nvmxip_bdev_max_devs++; -+ -+ snprintf(bdev_name, NVMXIP_BLKDEV_NAME_SZ, "nvmxip-blk#%d", nvmxip_bdev_max_devs); -+ -+ ret = blk_create_devicef(udev, NVMXIP_BLKDRV_NAME, bdev_name, UCLASS_NVMXIP, -+ nvmxip_bdev_max_devs, NVMXIP_DEFAULT_LBA_SZ, -+ NVMXIP_DEFAULT_LBA_COUNT, &bdev); -+ if (ret) { -+ pr_err("[%s]: failure during creation of the block device %s, error %d\n", -+ udev->name, bdev_name, ret); -+ goto blkdev_setup_error; -+ } -+ -+ ret = blk_probe_or_unbind(bdev); -+ if (ret) { -+ pr_err("[%s]: failure during probing the block device %s, error %d\n", -+ udev->name, bdev_name, ret); -+ goto blkdev_setup_error; -+ } -+ -+ pr_info("[%s]: the block device %s ready for use\n", udev->name, bdev_name); -+ -+ return 0; -+ -+blkdev_setup_error: -+ nvmxip_bdev_max_devs--; -+ return ret; -+} -+ -+static const struct blk_ops nvmxip_blk_ops = { -+ .read = nvmxip_blk_read, -+}; -+ -+U_BOOT_DRIVER(nvmxip_blk) = { -+ .name = NVMXIP_BLKDRV_NAME, -+ .id = UCLASS_BLK, -+ .probe = nvmxip_blk_probe, -+ .ops = &nvmxip_blk_ops, -+ .priv_auto = sizeof(struct nvmxip_blk_priv), -+}; -diff --git a/drivers/nvmxip/nvmxip.h b/drivers/nvmxip/nvmxip.h -new file mode 100644 -index 000000000000..393172cc2f86 ---- /dev/null -+++ b/drivers/nvmxip/nvmxip.h -@@ -0,0 +1,46 @@ -+/* SPDX-License-Identifier: GPL-2.0+ */ -+/* -+ * (C) Copyright 2022 ARM Limited -+ * Abdellatif El Khlifi -+ */ -+ -+#ifndef __DRIVER_NVMXIP_H__ -+#define __DRIVER_NVMXIP_H__ -+ -+#include -+#include -+#include -+#include -+#include -+ -+#define NVMXIP_BLKDRV_NAME "nvmxip-blk" -+ -+#define NVMXIP_BLKDEV_NAME_SZ 20 -+ -+#define NVMXIP_DEFAULT_LBA_SHIFT 10 /* 1024 bytes per block */ -+#define NVMXIP_DEFAULT_LBA_COUNT 1024 /* block count */ -+ -+#define NVMXIP_DEFAULT_LBA_SZ BIT(NVMXIP_DEFAULT_LBA_SHIFT) -+ -+/* NVM XIP device platform data */ -+struct nvmxip_plat { -+ phys_addr_t phys_base; /* NVM XIP device base address */ -+ u32 lba_shift; /* block size shift count (read from device tree) */ -+ lbaint_t lba; /* number of blocks (read from device tree) */ -+}; -+ -+/* NVM XIP device private data */ -+struct nvmxip_priv { -+ struct udevice *udev; -+ struct nvmxip_plat *plat_data; -+}; -+ -+/* Private data of the block device associated with the NVM XIP device (the parent) */ -+struct nvmxip_blk_priv { -+ struct udevice *bdev; -+ struct nvmxip_plat *pplat_data; /* parent device platform data */ -+}; -+ -+int nvmxip_init(struct udevice *udev); -+ -+#endif /* __DRIVER_NVMXIP_H__ */ -diff --git a/drivers/nvmxip/nvmxip_qspi.c b/drivers/nvmxip/nvmxip_qspi.c -new file mode 100644 -index 000000000000..749625134acd ---- /dev/null -+++ b/drivers/nvmxip/nvmxip_qspi.c -@@ -0,0 +1,65 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+/* -+ * (C) Copyright 2022 ARM Limited -+ * Abdellatif El Khlifi -+ */ -+ -+#include -+#include -+#include -+#include "nvmxip.h" -+ -+#include -+DECLARE_GLOBAL_DATA_PTR; -+ -+#define NVMXIP_QSPI_DRV_NAME "nvmxip_qspi" -+ -+static int nvmxip_qspi_probe(struct udevice *dev) -+{ -+ pr_debug("[%s][%s]\n", __func__, dev->name); -+ return nvmxip_init(dev); -+} -+ -+static int nvmxip_qspi_of_to_plat(struct udevice *dev) -+{ -+ struct nvmxip_plat *plat_data = dev_get_plat(dev); -+ int ret; -+ -+ plat_data->phys_base = (phys_addr_t)dev_read_addr(dev); -+ if (plat_data->phys_base == FDT_ADDR_T_NONE) { -+ pr_err("[%s]: can not get base address from device tree\n", dev->name); -+ return -EINVAL; -+ } -+ -+ ret = dev_read_u32(dev, "lba_shift", &plat_data->lba_shift); -+ if (ret) { -+ pr_err("[%s]: can not get lba_shift from device tree\n", dev->name); -+ return -EINVAL; -+ } -+ -+ ret = dev_read_u32(dev, "lba", (u32 *)&plat_data->lba); -+ if (ret) { -+ pr_err("[%s]: can not get lba from device tree\n", dev->name); -+ return -EINVAL; -+ } -+ -+ pr_debug("[%s]: XIP device base addr: 0x%llx , lba_shift: %d , lbas: %lu\n", -+ dev->name, plat_data->phys_base, plat_data->lba_shift, plat_data->lba); -+ -+ return 0; -+} -+ -+static const struct udevice_id nvmxip_qspi_ids[] = { -+ { .compatible = "nvmxip,qspi" }, -+ { /* sentinel */ } -+}; -+ -+U_BOOT_DRIVER(nvmxip_qspi) = { -+ .name = NVMXIP_QSPI_DRV_NAME, -+ .id = UCLASS_NVMXIP, -+ .of_match = nvmxip_qspi_ids, -+ .of_to_plat = nvmxip_qspi_of_to_plat, -+ .priv_auto = sizeof(struct nvmxip_priv), -+ .plat_auto = sizeof(struct nvmxip_plat), -+ .probe = nvmxip_qspi_probe, -+}; -diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h -index fa08a66ac8e0..f3564a49d912 100644 ---- a/include/dm/uclass-id.h -+++ b/include/dm/uclass-id.h -@@ -92,6 +92,7 @@ enum uclass_id { - UCLASS_NOP, /* No-op devices */ - UCLASS_NORTHBRIDGE, /* Intel Northbridge / SDRAM controller */ - UCLASS_NVME, /* NVM Express device */ -+ UCLASS_NVMXIP, /* NVM XIP devices */ - UCLASS_P2SB, /* (x86) Primary-to-Sideband Bus */ - UCLASS_PANEL, /* Display panel, such as an LCD */ - UCLASS_PANEL_BACKLIGHT, /* Backlight controller for panel */ --- -2.39.2 - diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0028-drivers-mtd-nvmxip-introduce-QSPI-XIP-driver.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0028-drivers-mtd-nvmxip-introduce-QSPI-XIP-driver.patch new file mode 100644 index 0000000000..aa3db9cb5e --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0028-drivers-mtd-nvmxip-introduce-QSPI-XIP-driver.patch @@ -0,0 +1,271 @@ +From 4b71ade0e8e5ad3692b1decb5c1d0c9472827535 Mon Sep 17 00:00:00 2001 +From: Abdellatif El Khlifi +Date: Fri, 14 Apr 2023 13:44:25 +0100 +Subject: [PATCH 28/42] drivers/mtd/nvmxip: introduce QSPI XIP driver + +add nvmxip_qspi driver under UCLASS_NVMXIP + +The device associated with this driver is the parent of the blk# device +nvmxip_qspi can be reused by other platforms. If the platform +has custom settings to apply before using the flash, then the platform +can provide its own parent driver belonging to UCLASS_NVMXIP and reuse +nvmxip-blk driver. The custom driver can be implemented like nvmxip_qspi in +addition to the platform custom settings. + +Platforms can use multiple NVM XIP devices at the same time by defining a +DT node for each one of them. + +For more details please refer to doc/develop/driver-model/nvmxip_qspi.rst + +Signed-off-by: Abdellatif El Khlifi +Upstream-Status: Backport [https://github.com/u-boot/u-boot/commit/c9c2c95d4cd27fe0cd41fe13a863899d268f973c] +--- + MAINTAINERS | 1 + + doc/develop/driver-model/nvmxip.rst | 45 +++++++++++- + .../nvmxip/nvmxip_qspi.txt | 56 +++++++++++++++ + drivers/mtd/nvmxip/Kconfig | 6 ++ + drivers/mtd/nvmxip/Makefile | 1 + + drivers/mtd/nvmxip/nvmxip_qspi.c | 70 +++++++++++++++++++ + 6 files changed, 178 insertions(+), 1 deletion(-) + create mode 100644 doc/device-tree-bindings/nvmxip/nvmxip_qspi.txt + create mode 100644 drivers/mtd/nvmxip/nvmxip_qspi.c + +diff --git a/MAINTAINERS b/MAINTAINERS +index 1dbfab5f43..f81654346e 100644 +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -1206,6 +1206,7 @@ NVMXIP + M: Abdellatif El Khlifi + S: Maintained + F: doc/develop/driver-model/nvmxip.rst ++F: doc/device-tree-bindings/nvmxip/nvmxip_qspi.txt + F: drivers/mtd/nvmxip/ + + NVMEM +diff --git a/doc/develop/driver-model/nvmxip.rst b/doc/develop/driver-model/nvmxip.rst +index fe087b13d2..09afdbcccf 100644 +--- a/doc/develop/driver-model/nvmxip.rst ++++ b/doc/develop/driver-model/nvmxip.rst +@@ -25,7 +25,33 @@ The NVMXIP Uclass provides the following drivers: + the Uclass creates a block device and binds it with the nvmxip-blk. + The Uclass driver implemented by drivers/mtd/nvmxip/nvmxip-uclass.c + +- The implementation is generic and can be used by different platforms. ++ nvmxip_qspi driver : ++ ++ The driver probed with the DT and is the parent of the blk# device. ++ nvmxip_qspi can be reused by other platforms. If the platform ++ has custom settings to apply before using the flash, then the platform ++ can provide its own parent driver belonging to UCLASS_NVMXIP and reuse ++ nvmxip-blk. The custom driver can be implemented like nvmxip_qspi in ++ addition to the platform custom settings. ++ The nvmxip_qspi driver belongs to UCLASS_NVMXIP. ++ The driver implemented by drivers/mtd/nvmxip/nvmxip_qspi.c ++ ++ For example, if we have two NVMXIP devices described in the DT ++ The devices hierarchy is as follows: ++ ++:: ++ ++ => dm tree ++ ++ Class Index Probed Driver Name ++ ----------------------------------------------------------- ++ ... ++ nvmxip 0 [ + ] nvmxip_qspi |-- nvmxip-qspi1@08000000 ++ blk 3 [ + ] nvmxip-blk | `-- nvmxip-qspi1@08000000.blk#1 ++ nvmxip 1 [ + ] nvmxip_qspi |-- nvmxip-qspi2@08200000 ++ blk 4 [ + ] nvmxip-blk | `-- nvmxip-qspi2@08200000.blk#2 ++ ++The implementation is generic and can be used by different platforms. + + Supported hardware + -------------------------------- +@@ -43,6 +69,23 @@ config NVMXIP + handles the read operation. This driver is HW agnostic and can support + multiple flash devices at the same time. + ++config NVMXIP_QSPI ++ This option allows the emulation of a block storage device on top of a QSPI XIP flash. ++ Any platform that needs to emulate one or multiple QSPI XIP flash devices can turn this ++ option on to enable the functionality. NVMXIP config is selected automatically. ++ Platforms that need to add custom treatments before accessing to the flash, can ++ write their own driver (same as nvmxip_qspi in addition to the custom settings). ++ ++Device Tree nodes ++-------------------- ++ ++Multiple QSPI XIP flash devices can be used at the same time by describing them through DT ++nodes. ++ ++Please refer to the documentation of the DT binding at: ++ ++doc/device-tree-bindings/nvmxip/nvmxip_qspi.txt ++ + Contributors + ------------ + * Abdellatif El Khlifi +diff --git a/doc/device-tree-bindings/nvmxip/nvmxip_qspi.txt b/doc/device-tree-bindings/nvmxip/nvmxip_qspi.txt +new file mode 100644 +index 0000000000..cc60e9efdc +--- /dev/null ++++ b/doc/device-tree-bindings/nvmxip/nvmxip_qspi.txt +@@ -0,0 +1,56 @@ ++Specifying NVMXIP information for devices ++====================================== ++ ++QSPI XIP flash device nodes ++--------------------------- ++ ++Each flash device should have its own node. ++ ++Each node must specify the following fields: ++ ++1) ++ compatible = "nvmxip,qspi"; ++ ++This allows to bind the flash device with the nvmxip_qspi driver ++If a platform has its own driver, please provide your own compatible ++string. ++ ++2) ++ reg = <0x0 0x08000000 0x0 0x00200000>; ++ ++The start address and size of the flash device. The values give here are an ++example (when the cell size is 2). ++ ++When cell size is 1, the reg field looks like this: ++ ++ reg = <0x08000000 0x00200000>; ++ ++3) ++ ++ lba_shift = <9>; ++ ++The number of bit shifts used to calculate the size in bytes of one block. ++In this example the block size is 1 << 9 = 2 ^ 9 = 512 bytes ++ ++4) ++ ++ lba = <4096>; ++ ++The number of blocks. ++ ++Example of multiple flash devices ++---------------------------------------------------- ++ ++ nvmxip-qspi1@08000000 { ++ compatible = "nvmxip,qspi"; ++ reg = <0x0 0x08000000 0x0 0x00200000>; ++ lba_shift = <9>; ++ lba = <4096>; ++ }; ++ ++ nvmxip-qspi2@08200000 { ++ compatible = "nvmxip,qspi"; ++ reg = <0x0 0x08200000 0x0 0x00100000>; ++ lba_shift = <9>; ++ lba = <2048>; ++ }; +diff --git a/drivers/mtd/nvmxip/Kconfig b/drivers/mtd/nvmxip/Kconfig +index ef53fc3c79..3ef7105026 100644 +--- a/drivers/mtd/nvmxip/Kconfig ++++ b/drivers/mtd/nvmxip/Kconfig +@@ -11,3 +11,9 @@ config NVMXIP + This option allows the emulation of a block storage device + on top of a direct access non volatile memory XIP flash devices. + This support provides the read operation. ++ ++config NVMXIP_QSPI ++ bool "QSPI XIP support" ++ select NVMXIP ++ help ++ This option allows the emulation of a block storage device on top of a QSPI XIP flash +diff --git a/drivers/mtd/nvmxip/Makefile b/drivers/mtd/nvmxip/Makefile +index 07890982c7..54eacc102e 100644 +--- a/drivers/mtd/nvmxip/Makefile ++++ b/drivers/mtd/nvmxip/Makefile +@@ -5,3 +5,4 @@ + # Abdellatif El Khlifi + + obj-y += nvmxip-uclass.o nvmxip.o ++obj-$(CONFIG_NVMXIP_QSPI) += nvmxip_qspi.o +diff --git a/drivers/mtd/nvmxip/nvmxip_qspi.c b/drivers/mtd/nvmxip/nvmxip_qspi.c +new file mode 100644 +index 0000000000..7221fd1cb4 +--- /dev/null ++++ b/drivers/mtd/nvmxip/nvmxip_qspi.c +@@ -0,0 +1,70 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * Copyright 2023 Arm Limited and/or its affiliates ++ * ++ * Authors: ++ * Abdellatif El Khlifi ++ */ ++ ++#include ++#include ++#include ++#include ++#include "nvmxip.h" ++ ++#include ++DECLARE_GLOBAL_DATA_PTR; ++ ++#define NVMXIP_QSPI_DRV_NAME "nvmxip_qspi" ++ ++/** ++ * nvmxip_qspi_of_to_plat() -read from DT ++ * @dev: the NVMXIP device ++ * ++ * Read from the DT the NVMXIP information. ++ * ++ * Return: ++ * ++ * 0 on success. Otherwise, failure ++ */ ++static int nvmxip_qspi_of_to_plat(struct udevice *dev) ++{ ++ struct nvmxip_plat *plat = dev_get_plat(dev); ++ int ret; ++ ++ plat->phys_base = (phys_addr_t)dev_read_addr(dev); ++ if (plat->phys_base == FDT_ADDR_T_NONE) { ++ log_err("[%s]: can not get base address from device tree\n", dev->name); ++ return -EINVAL; ++ } ++ ++ ret = dev_read_u32(dev, "lba_shift", &plat->lba_shift); ++ if (ret) { ++ log_err("[%s]: can not get lba_shift from device tree\n", dev->name); ++ return -EINVAL; ++ } ++ ++ ret = dev_read_u32(dev, "lba", (u32 *)&plat->lba); ++ if (ret) { ++ log_err("[%s]: can not get lba from device tree\n", dev->name); ++ return -EINVAL; ++ } ++ ++ log_debug("[%s]: XIP device base addr: 0x%llx , lba_shift: %d , lbas: %lu\n", ++ dev->name, plat->phys_base, plat->lba_shift, plat->lba); ++ ++ return 0; ++} ++ ++static const struct udevice_id nvmxip_qspi_ids[] = { ++ { .compatible = "nvmxip,qspi" }, ++ { /* sentinel */ } ++}; ++ ++U_BOOT_DRIVER(nvmxip_qspi) = { ++ .name = NVMXIP_QSPI_DRV_NAME, ++ .id = UCLASS_NVMXIP, ++ .of_match = nvmxip_qspi_ids, ++ .of_to_plat = nvmxip_qspi_of_to_plat, ++ .plat_auto = sizeof(struct nvmxip_plat), ++}; +-- +2.25.1 + diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0028-sandbox64-fix-return-unsigned-long-in-readq.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0028-sandbox64-fix-return-unsigned-long-in-readq.patch deleted file mode 100644 index b0e83667da..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0028-sandbox64-fix-return-unsigned-long-in-readq.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 3262ee6a5300221969e61eff7a8f18336a135a73 Mon Sep 17 00:00:00 2001 -From: Abdellatif El Khlifi -Date: Fri, 16 Dec 2022 17:20:58 +0000 -Subject: [PATCH 28/43] sandbox64: fix: return unsigned long in readq() - -make readq return unsigned long - -readq should return 64-bit data - -Upstream-Status: Submitted -Signed-off-by: Abdellatif El Khlifi -Signed-off-by: Rui Miguel Silva ---- - arch/sandbox/cpu/cpu.c | 2 +- - arch/sandbox/include/asm/io.h | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c -index 636d3545b954..248d17a85c82 100644 ---- a/arch/sandbox/cpu/cpu.c -+++ b/arch/sandbox/cpu/cpu.c -@@ -230,7 +230,7 @@ phys_addr_t map_to_sysmem(const void *ptr) - return mentry->tag; - } - --unsigned int sandbox_read(const void *addr, enum sandboxio_size_t size) -+unsigned long sandbox_read(const void *addr, enum sandboxio_size_t size) - { - struct sandbox_state *state = state_get_current(); - -diff --git a/arch/sandbox/include/asm/io.h b/arch/sandbox/include/asm/io.h -index ad6c29a4e26c..31ab7289b4bd 100644 ---- a/arch/sandbox/include/asm/io.h -+++ b/arch/sandbox/include/asm/io.h -@@ -45,7 +45,7 @@ static inline void unmap_sysmem(const void *vaddr) - /* Map from a pointer to our RAM buffer */ - phys_addr_t map_to_sysmem(const void *ptr); - --unsigned int sandbox_read(const void *addr, enum sandboxio_size_t size); -+unsigned long sandbox_read(const void *addr, enum sandboxio_size_t size); - void sandbox_write(void *addr, unsigned int val, enum sandboxio_size_t size); - - #define readb(addr) sandbox_read((const void *)addr, SB_SIZE_8) --- -2.39.2 - diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0029-sandbox64-add-support-for-NVMXIP-QSPI.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0029-sandbox64-add-support-for-NVMXIP-QSPI.patch deleted file mode 100644 index d6168b998e..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0029-sandbox64-add-support-for-NVMXIP-QSPI.patch +++ /dev/null @@ -1,113 +0,0 @@ -From 2b0606f603de13524ce9b63578f4c3358c3ac6df Mon Sep 17 00:00:00 2001 -From: Abdellatif El Khlifi -Date: Thu, 22 Dec 2022 12:15:42 +0000 -Subject: [PATCH 29/43] sandbox64: add support for NVMXIP QSPI - -enable NVMXIP QSPI for sandbox 64-bit - -Adding two NVM XIP QSPI storage devices. - -Upstream-Status: Submitted -Signed-off-by: Abdellatif El Khlifi -Signed-off-by: Rui Miguel Silva ---- - arch/sandbox/dts/sandbox64.dts | 13 +++++++++++++ - arch/sandbox/dts/test.dts | 14 ++++++++++++++ - configs/sandbox_defconfig | 1 + - drivers/nvmxip/nvmxip.c | 4 ++++ - drivers/nvmxip/nvmxip.h | 3 +++ - 5 files changed, 35 insertions(+) - -diff --git a/arch/sandbox/dts/sandbox64.dts b/arch/sandbox/dts/sandbox64.dts -index a9cd7908f83e..aed3801af8a9 100644 ---- a/arch/sandbox/dts/sandbox64.dts -+++ b/arch/sandbox/dts/sandbox64.dts -@@ -89,6 +89,19 @@ - cs-gpios = <0>, <&gpio_a 0>; - }; - -+ nvmxip-qspi1@08000000 { -+ compatible = "nvmxip,qspi"; -+ reg = <0x0 0x08000000 0x0 0x00200000>; -+ lba_shift = <9>; -+ lba = <4096>; -+ }; -+ -+ nvmxip-qspi2@08200000 { -+ compatible = "nvmxip,qspi"; -+ reg = <0x0 0x08200000 0x0 0x00100000>; -+ lba_shift = <9>; -+ lba = <2048>; -+ }; - }; - - #include "sandbox.dtsi" -diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts -index 2e580f980fc6..54f2b308e793 100644 ---- a/arch/sandbox/dts/test.dts -+++ b/arch/sandbox/dts/test.dts -@@ -1756,6 +1756,20 @@ - compatible = "u-boot,fwu-mdata-gpt"; - fwu-mdata-store = <&mmc0>; - }; -+ -+ nvmxip-qspi1@08000000 { -+ compatible = "nvmxip,qspi"; -+ reg = <0x08000000 0x00200000>; -+ lba_shift = <9>; -+ lba = <4096>; -+ }; -+ -+ nvmxip-qspi2@08200000 { -+ compatible = "nvmxip,qspi"; -+ reg = <0x08200000 0x00100000>; -+ lba_shift = <9>; -+ lba = <2048>; -+ }; - }; - - #include "sandbox_pmic.dtsi" -diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig -index e6ea96a6b924..f22230b5cce2 100644 ---- a/configs/sandbox_defconfig -+++ b/configs/sandbox_defconfig -@@ -138,6 +138,7 @@ CONFIG_NETCONSOLE=y - CONFIG_IP_DEFRAG=y - CONFIG_BOOTP_SERVERIP=y - CONFIG_IPV6=y -+CONFIG_NVMXIP_QSPI=y - CONFIG_DM_DMA=y - CONFIG_DEVRES=y - CONFIG_DEBUG_DEVRES=y -diff --git a/drivers/nvmxip/nvmxip.c b/drivers/nvmxip/nvmxip.c -index 6ba48183c575..af9c9a3b7270 100644 ---- a/drivers/nvmxip/nvmxip.c -+++ b/drivers/nvmxip/nvmxip.c -@@ -85,6 +85,10 @@ int nvmxip_init(struct udevice *udev) - priv_data->udev = udev; - priv_data->plat_data = plat_data; - -+#if CONFIG_IS_ENABLED(SANDBOX64) -+ sandbox_set_enable_memio(true); -+#endif -+ - nvmxip_bdev_max_devs++; - - snprintf(bdev_name, NVMXIP_BLKDEV_NAME_SZ, "nvmxip-blk#%d", nvmxip_bdev_max_devs); -diff --git a/drivers/nvmxip/nvmxip.h b/drivers/nvmxip/nvmxip.h -index 393172cc2f86..0384ce2e2b47 100644 ---- a/drivers/nvmxip/nvmxip.h -+++ b/drivers/nvmxip/nvmxip.h -@@ -8,6 +8,9 @@ - #define __DRIVER_NVMXIP_H__ - - #include -+#if CONFIG_IS_ENABLED(SANDBOX64) -+#include -+#endif - #include - #include - #include --- -2.39.2 - diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0029-sandbox64-fix-return-unsigned-long-in-readq.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0029-sandbox64-fix-return-unsigned-long-in-readq.patch new file mode 100644 index 0000000000..c90bcc7834 --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0029-sandbox64-fix-return-unsigned-long-in-readq.patch @@ -0,0 +1,45 @@ +From 1b80dfbefd59c8ddff77960552d6c0cc2747758c Mon Sep 17 00:00:00 2001 +From: Abdellatif El Khlifi +Date: Fri, 16 Dec 2022 17:20:58 +0000 +Subject: [PATCH 29/42] sandbox64: fix: return unsigned long in readq() + +make readq return unsigned long + +readq should return 64-bit data + +Signed-off-by: Abdellatif El Khlifi +Upstream-Status: Backport [https://github.com/u-boot/u-boot/commit/c9c2c95d4cd27fe0cd41fe13a863899d268f973c] +--- + arch/sandbox/cpu/cpu.c | 2 +- + arch/sandbox/include/asm/io.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c +index 636d3545b9..248d17a85c 100644 +--- a/arch/sandbox/cpu/cpu.c ++++ b/arch/sandbox/cpu/cpu.c +@@ -230,7 +230,7 @@ phys_addr_t map_to_sysmem(const void *ptr) + return mentry->tag; + } + +-unsigned int sandbox_read(const void *addr, enum sandboxio_size_t size) ++unsigned long sandbox_read(const void *addr, enum sandboxio_size_t size) + { + struct sandbox_state *state = state_get_current(); + +diff --git a/arch/sandbox/include/asm/io.h b/arch/sandbox/include/asm/io.h +index ad6c29a4e2..31ab7289b4 100644 +--- a/arch/sandbox/include/asm/io.h ++++ b/arch/sandbox/include/asm/io.h +@@ -45,7 +45,7 @@ static inline void unmap_sysmem(const void *vaddr) + /* Map from a pointer to our RAM buffer */ + phys_addr_t map_to_sysmem(const void *ptr); + +-unsigned int sandbox_read(const void *addr, enum sandboxio_size_t size); ++unsigned long sandbox_read(const void *addr, enum sandboxio_size_t size); + void sandbox_write(void *addr, unsigned int val, enum sandboxio_size_t size); + + #define readb(addr) sandbox_read((const void *)addr, SB_SIZE_8) +-- +2.25.1 + diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0030-corstone1000-add-NVM-XIP-QSPI-device-tree-node.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0030-corstone1000-add-NVM-XIP-QSPI-device-tree-node.patch deleted file mode 100644 index 21ad2109cc..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0030-corstone1000-add-NVM-XIP-QSPI-device-tree-node.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 3f72e390fc8e1a0d774d80c3ccd21be38c9af1db Mon Sep 17 00:00:00 2001 -From: Abdellatif El Khlifi -Date: Mon, 19 Dec 2022 13:20:19 +0000 -Subject: [PATCH 30/43] corstone1000: add NVM XIP QSPI device tree node - -add QSPI flash device node for block storage access - -Upstream-Status: Submitted -Signed-off-by: Abdellatif El Khlifi -Signed-off-by: Rui Miguel Silva ---- - arch/arm/dts/corstone1000.dtsi | 7 +++++++ - 1 file changed, 7 insertions(+) - -diff --git a/arch/arm/dts/corstone1000.dtsi b/arch/arm/dts/corstone1000.dtsi -index 61e0c33247ce..faf4e12bab2a 100644 ---- a/arch/arm/dts/corstone1000.dtsi -+++ b/arch/arm/dts/corstone1000.dtsi -@@ -38,6 +38,13 @@ - reg = <0x88200000 0x77e00000>; - }; - -+ nvmxip-qspi@08000000 { -+ compatible = "nvmxip,qspi"; -+ reg = <0x08000000 0x2000000>; -+ lba_shift = <9>; -+ lba = <65536>; -+ }; -+ - gic: interrupt-controller@1c000000 { - compatible = "arm,gic-400"; - #interrupt-cells = <3>; --- -2.39.2 - diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0030-sandbox64-add-support-for-NVMXIP-QSPI.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0030-sandbox64-add-support-for-NVMXIP-QSPI.patch new file mode 100644 index 0000000000..941e9d10b8 --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0030-sandbox64-add-support-for-NVMXIP-QSPI.patch @@ -0,0 +1,161 @@ +From 25467e433f02f40f5999ed6e6b0d3adb4c9cf16d Mon Sep 17 00:00:00 2001 +From: Abdellatif El Khlifi +Date: Fri, 9 Jun 2023 13:08:37 +0100 +Subject: [PATCH 30/42] sandbox64: add support for NVMXIP QSPI + +enable NVMXIP QSPI for sandbox 64-bit + +Adding two NVM XIP QSPI storage devices. + +Signed-off-by: Abdellatif El Khlifi +Reviewed-by: Simon Glass +Upstream-Status: Backport [https://github.com/u-boot/u-boot/commit/c9c2c95d4cd27fe0cd41fe13a863899d268f973c] + +Changelog: +=============== + +v2: + +* address nits +--- + arch/sandbox/dts/sandbox64.dts | 13 +++++++++++++ + arch/sandbox/dts/test.dts | 14 ++++++++++++++ + configs/sandbox64_defconfig | 3 ++- + doc/develop/driver-model/nvmxip.rst | 2 +- + doc/device-tree-bindings/nvmxip/nvmxip_qspi.txt | 6 +++--- + drivers/mtd/nvmxip/nvmxip-uclass.c | 7 +++++++ + 6 files changed, 40 insertions(+), 5 deletions(-) + +diff --git a/arch/sandbox/dts/sandbox64.dts b/arch/sandbox/dts/sandbox64.dts +index 3eb0457089..c9a2f4b4a4 100644 +--- a/arch/sandbox/dts/sandbox64.dts ++++ b/arch/sandbox/dts/sandbox64.dts +@@ -89,6 +89,19 @@ + cs-gpios = <0>, <&gpio_a 0>; + }; + ++ nvmxip-qspi1@08000000 { ++ compatible = "nvmxip,qspi"; ++ reg = /bits/ 64 <0x08000000 0x00200000>; ++ lba_shift = <9>; ++ lba = <4096>; ++ }; ++ ++ nvmxip-qspi2@08200000 { ++ compatible = "nvmxip,qspi"; ++ reg = /bits/ 64 <0x08200000 0x00100000>; ++ lba_shift = <9>; ++ lba = <2048>; ++ }; + }; + + #include "sandbox.dtsi" +diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts +index dffe10adbf..c3ba0a225e 100644 +--- a/arch/sandbox/dts/test.dts ++++ b/arch/sandbox/dts/test.dts +@@ -1745,6 +1745,20 @@ + compatible = "u-boot,fwu-mdata-gpt"; + fwu-mdata-store = <&mmc0>; + }; ++ ++ nvmxip-qspi1@08000000 { ++ compatible = "nvmxip,qspi"; ++ reg = <0x08000000 0x00200000>; ++ lba_shift = <9>; ++ lba = <4096>; ++ }; ++ ++ nvmxip-qspi2@08200000 { ++ compatible = "nvmxip,qspi"; ++ reg = <0x08200000 0x00100000>; ++ lba_shift = <9>; ++ lba = <2048>; ++ }; + }; + + #include "sandbox_pmic.dtsi" +diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig +index 4b8a1ec42b..2dca176ae3 100644 +--- a/configs/sandbox64_defconfig ++++ b/configs/sandbox64_defconfig +@@ -260,4 +260,5 @@ CONFIG_UNIT_TEST=y + CONFIG_UT_TIME=y + CONFIG_UT_DM=y + CONFIG_ARM_FFA_TRANSPORT=y +-CONFIG_SANDBOX_FFA=y +\ No newline at end of file ++CONFIG_SANDBOX_FFA=y ++CONFIG_NVMXIP_QSPI=y +\ No newline at end of file +diff --git a/doc/develop/driver-model/nvmxip.rst b/doc/develop/driver-model/nvmxip.rst +index 09afdbcccf..e85dc220b9 100644 +--- a/doc/develop/driver-model/nvmxip.rst ++++ b/doc/develop/driver-model/nvmxip.rst +@@ -56,7 +56,7 @@ The implementation is generic and can be used by different platforms. + Supported hardware + -------------------------------- + +-Any 64-bit plaform. ++Any plaform supporting readq(). + + Configuration + ---------------------- +diff --git a/doc/device-tree-bindings/nvmxip/nvmxip_qspi.txt b/doc/device-tree-bindings/nvmxip/nvmxip_qspi.txt +index cc60e9efdc..882728d541 100644 +--- a/doc/device-tree-bindings/nvmxip/nvmxip_qspi.txt ++++ b/doc/device-tree-bindings/nvmxip/nvmxip_qspi.txt +@@ -16,7 +16,7 @@ If a platform has its own driver, please provide your own compatible + string. + + 2) +- reg = <0x0 0x08000000 0x0 0x00200000>; ++ reg = /bits/ 64 <0x08000000 0x00200000>; + + The start address and size of the flash device. The values give here are an + example (when the cell size is 2). +@@ -43,14 +43,14 @@ Example of multiple flash devices + + nvmxip-qspi1@08000000 { + compatible = "nvmxip,qspi"; +- reg = <0x0 0x08000000 0x0 0x00200000>; ++ reg = /bits/ 64 <0x08000000 0x00200000>; + lba_shift = <9>; + lba = <4096>; + }; + + nvmxip-qspi2@08200000 { + compatible = "nvmxip,qspi"; +- reg = <0x0 0x08200000 0x0 0x00100000>; ++ reg = /bits/ 64 <0x08200000 0x00100000>; + lba_shift = <9>; + lba = <2048>; + }; +diff --git a/drivers/mtd/nvmxip/nvmxip-uclass.c b/drivers/mtd/nvmxip/nvmxip-uclass.c +index 9f96041e3d..6d8eb177b5 100644 +--- a/drivers/mtd/nvmxip/nvmxip-uclass.c ++++ b/drivers/mtd/nvmxip/nvmxip-uclass.c +@@ -9,6 +9,9 @@ + #include + #include + #include ++#if CONFIG_IS_ENABLED(SANDBOX64) ++#include ++#endif + #include + #include "nvmxip.h" + +@@ -36,6 +39,10 @@ static int nvmxip_post_bind(struct udevice *udev) + char bdev_name[NVMXIP_BLKDEV_NAME_SZ + 1]; + int devnum; + ++#if CONFIG_IS_ENABLED(SANDBOX64) ++ sandbox_set_enable_memio(true); ++#endif ++ + devnum = uclass_id_count(UCLASS_NVMXIP); + snprintf(bdev_name, NVMXIP_BLKDEV_NAME_SZ, "blk#%d", devnum); + +-- +2.25.1 + diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0031-corstone1000-add-NVM-XIP-QSPI-device-tree-node.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0031-corstone1000-add-NVM-XIP-QSPI-device-tree-node.patch new file mode 100644 index 0000000000..08e9d31749 --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0031-corstone1000-add-NVM-XIP-QSPI-device-tree-node.patch @@ -0,0 +1,42 @@ +From 635848c90343a1b8a268519e3fc78ef7af2e4819 Mon Sep 17 00:00:00 2001 +From: Abdellatif El Khlifi +Date: Mon, 19 Dec 2022 13:20:19 +0000 +Subject: [PATCH 31/42] corstone1000: add NVM XIP QSPI device tree node + +add QSPI flash device node for block storage access + +Signed-off-by: Abdellatif El Khlifi +Upstream-Status: Backport [https://github.com/u-boot/u-boot/commit/c9c2c95d4cd27fe0cd41fe13a863899d268f973c] +--- + arch/arm/dts/corstone1000.dtsi | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/dts/corstone1000.dtsi b/arch/arm/dts/corstone1000.dtsi +index 61e0c33247..18c4d1e19a 100644 +--- a/arch/arm/dts/corstone1000.dtsi ++++ b/arch/arm/dts/corstone1000.dtsi +@@ -1,6 +1,6 @@ + // SPDX-License-Identifier: GPL-2.0 or MIT + /* +- * Copyright (c) 2022, Arm Limited. All rights reserved. ++ * Copyright 2022-2023 Arm Limited and/or its affiliates + * Copyright (c) 2022, Linaro Limited. All rights reserved. + * + */ +@@ -38,6 +38,13 @@ + reg = <0x88200000 0x77e00000>; + }; + ++ nvmxip-qspi@08000000 { ++ compatible = "nvmxip,qspi"; ++ reg = <0x08000000 0x2000000>; ++ lba_shift = <9>; ++ lba = <65536>; ++ }; ++ + gic: interrupt-controller@1c000000 { + compatible = "arm,gic-400"; + #interrupt-cells = <3>; +-- +2.25.1 + diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0031-corstone1000-enable-NVM-XIP-QSPI-flash.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0031-corstone1000-enable-NVM-XIP-QSPI-flash.patch deleted file mode 100644 index 64bf97d1f3..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0031-corstone1000-enable-NVM-XIP-QSPI-flash.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 0c3d61d499039ff0828376bb21b4fb1de071b8d2 Mon Sep 17 00:00:00 2001 -From: Abdellatif El Khlifi -Date: Mon, 19 Dec 2022 13:25:23 +0000 -Subject: [PATCH 31/43] corstone1000: enable NVM XIP QSPI flash - -add the QSPI flash device with block storage capability - -Upstream-Status: Submitted -Signed-off-by: Abdellatif El Khlifi -Signed-off-by: Rui Miguel Silva ---- - configs/corstone1000_defconfig | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig -index 1179bf5f3bfd..2986cc95932f 100644 ---- a/configs/corstone1000_defconfig -+++ b/configs/corstone1000_defconfig -@@ -58,6 +58,7 @@ CONFIG_DM_SERIAL=y - CONFIG_USB=y - CONFIG_USB_ISP1760=y - CONFIG_ERRNO_STR=y -+CONFIG_NVMXIP_QSPI=y - CONFIG_EFI_MM_COMM_TEE=y - CONFIG_ARM_FFA_TRANSPORT=y - CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y --- -2.39.2 - diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0032-sandbox64-add-a-test-case-for-UCLASS_NVMXIP.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0032-sandbox64-add-a-test-case-for-UCLASS_NVMXIP.patch index 5724283494..923eac9bba 100644 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0032-sandbox64-add-a-test-case-for-UCLASS_NVMXIP.patch +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0032-sandbox64-add-a-test-case-for-UCLASS_NVMXIP.patch @@ -1,7 +1,7 @@ -From 3be91bde755c376a38c3affb9640b39df1acdd9c Mon Sep 17 00:00:00 2001 +From 0ecb61da60febc66e589d6fbf439478af1c88283 Mon Sep 17 00:00:00 2001 From: Abdellatif El Khlifi -Date: Thu, 22 Dec 2022 11:30:16 +0000 -Subject: [PATCH 32/43] sandbox64: add a test case for UCLASS_NVMXIP +Date: Mon, 12 Jun 2023 17:33:54 +0100 +Subject: [PATCH 32/42] sandbox64: add a test case for UCLASS_NVMXIP provide a test for NVM XIP devices @@ -11,32 +11,47 @@ The test case allows to make sure of the following: - The DT entries are read correctly - the data read from the flash by the NVMXIP block driver is correct -Upstream-Status: Submitted Signed-off-by: Abdellatif El Khlifi -Signed-off-by: Rui Miguel Silva +Upstream-Status: Backport [https://github.com/u-boot/u-boot/commit/c9c2c95d4cd27fe0cd41fe13a863899d268f973c] + +Changelog: +=============== + +v2: + +* address nits --- MAINTAINERS | 1 + - test/dm/Makefile | 4 ++ - test/dm/nvmxip.c | 115 +++++++++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 120 insertions(+) + test/dm/Makefile | 6 +- + test/dm/nvmxip.c | 145 +++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 test/dm/nvmxip.c diff --git a/MAINTAINERS b/MAINTAINERS -index ba15dd02d58d..82cb6075cb32 100644 +index f81654346e..6692ce9974 100644 --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -1210,6 +1210,7 @@ S: Maintained +@@ -1208,6 +1208,7 @@ S: Maintained F: doc/develop/driver-model/nvmxip.rst - F: doc/device-tree-bindings/nvmxip/nvmxip.txt - F: drivers/nvmxip/ + F: doc/device-tree-bindings/nvmxip/nvmxip_qspi.txt + F: drivers/mtd/nvmxip/ +F: test/dm/nvmxip.c NVMEM M: Sean Anderson diff --git a/test/dm/Makefile b/test/dm/Makefile -index 85e99e1c120e..bc8214da2da2 100644 +index 85e99e1c12..963fa927f7 100644 --- a/test/dm/Makefile +++ b/test/dm/Makefile +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: GPL-2.0+ + # + # Copyright (c) 2013 Google, Inc +-# (C) Copyright 2022 ARM Limited ++# Copyright 2022-2023 Arm Limited and/or its affiliates + + obj-$(CONFIG_UT_DM) += test-dm.o + @@ -18,6 +18,10 @@ obj-$(CONFIG_UT_DM) += test-uclass.o obj-$(CONFIG_UT_DM) += core.o obj-$(CONFIG_UT_DM) += read.o @@ -50,28 +65,32 @@ index 85e99e1c120e..bc8214da2da2 100644 obj-y += acpi.o diff --git a/test/dm/nvmxip.c b/test/dm/nvmxip.c new file mode 100644 -index 000000000000..484e6077b4a9 +index 0000000000..e934748eb5 --- /dev/null +++ b/test/dm/nvmxip.c -@@ -0,0 +1,115 @@ +@@ -0,0 +1,145 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Functional tests for UCLASS_FFA class + * -+ * (C) Copyright 2022 ARM Limited -+ * Abdellatif El Khlifi ++ * Copyright 2023 Arm Limited and/or its affiliates ++ * ++ * Authors: ++ * Abdellatif El Khlifi + */ + +#include -+#include +#include ++#include +#include ++#include +#include -+#include "../../drivers/nvmxip/nvmxip.h" ++#include +#include +#include ++#include "../../drivers/mtd/nvmxip/nvmxip.h" + -+/* NVMXIP devices described in the device tree */ ++/* NVMXIP devices described in the device tree */ +#define SANDBOX_NVMXIP_DEVICES 2 + +/* reference device tree data for the probed devices */ @@ -82,37 +101,56 @@ index 000000000000..484e6077b4a9 +#define NVMXIP_BLK_START_PATTERN 0x1122334455667788ULL +#define NVMXIP_BLK_END_PATTERN 0xa1a2a3a4a5a6a7a8ULL + -+static int dm_nvmxip_flash_sanity(u8 device_idx, void *buffer) ++/** ++ * dm_nvmxip_flash_sanity() - check flash data ++ * @uts: test state ++ * @device_idx: the NVMXIP device index ++ * @buffer: the user buffer where the blocks data is copied to ++ * ++ * Mode 1: When buffer is NULL, initialize the flash with pattern data at the start ++ * and at the end of each block. This pattern data will be used to check data consistency ++ * when verifying the data read. ++ * Mode 2: When the user buffer is provided in the argument (not NULL), compare the data ++ * of the start and the end of each block in the user buffer with the expected pattern data. ++ * Return an error when the check fails. ++ * ++ * Return: ++ * ++ * 0 on success. Otherwise, failure ++ */ ++static int dm_nvmxip_flash_sanity(struct unit_test_state *uts, u8 device_idx, void *buffer) +{ + int i; -+ u64 *ptr = NULL; -+ u8 *base = NULL; ++ u64 *ptr; ++ u8 *base; + unsigned long blksz; + -+ blksz = 1 << nvmqspi_refdata[device_idx].lba_shift; ++ blksz = BIT(nvmqspi_refdata[device_idx].lba_shift); + -+ /* if buffer not NULL, init the flash with the pattern data*/ -+ if (!buffer) ++ if (!buffer) { ++ /* Mode 1: point at the flash start address. Pattern data will be written */ + base = map_sysmem(nvmqspi_refdata[device_idx].phys_base, 0); -+ else ++ } else { ++ /* Mode 2: point at the user buffer containing the data read and to be verified */ + base = buffer; ++ } + + for (i = 0; i < nvmqspi_refdata[device_idx].lba ; i++) { + ptr = (u64 *)(base + i * blksz); + -+ /* write an 8 bytes pattern at the start of the current block*/ ++ /* write an 8 bytes pattern at the start of the current block */ + if (!buffer) + *ptr = NVMXIP_BLK_START_PATTERN; -+ else if (*ptr != NVMXIP_BLK_START_PATTERN) -+ return -EINVAL; ++ else ++ ut_asserteq_64(NVMXIP_BLK_START_PATTERN, *ptr); + + ptr = (u64 *)((u8 *)ptr + blksz - sizeof(u64)); + -+ /* write an 8 bytes pattern at the end of the current block*/ ++ /* write an 8 bytes pattern at the end of the current block */ + if (!buffer) + *ptr = NVMXIP_BLK_END_PATTERN; -+ else if (*ptr != NVMXIP_BLK_END_PATTERN) -+ return -EINVAL; ++ else ++ ut_asserteq_64(NVMXIP_BLK_END_PATTERN, *ptr); + } + + if (!buffer) @@ -121,6 +159,13 @@ index 000000000000..484e6077b4a9 + return 0; +} + ++/** ++ * dm_test_nvmxip() - check flash data ++ * @uts: test state ++ * Return: ++ * ++ * CMD_RET_SUCCESS on success. Otherwise, failure ++ */ +static int dm_test_nvmxip(struct unit_test_state *uts) +{ + struct nvmxip_plat *plat_data = NULL; @@ -130,10 +175,10 @@ index 000000000000..484e6077b4a9 + unsigned long flashsz; + + /* set the flash content first for both devices */ -+ dm_nvmxip_flash_sanity(0, NULL); -+ dm_nvmxip_flash_sanity(1, NULL); ++ dm_nvmxip_flash_sanity(uts, 0, NULL); ++ dm_nvmxip_flash_sanity(uts, 1, NULL); + -+ /* probing all NVM XIP QSPI devices */ ++ /* probing all NVM XIP QSPI devices */ + for (device_idx = 0, uclass_first_device(UCLASS_NVMXIP, &dev); + dev; + uclass_next_device(&dev), device_idx++) { @@ -151,14 +196,14 @@ index 000000000000..484e6077b4a9 + buffer = calloc(flashsz, 1); + ut_assertok(!buffer); + -+ /* the block device is the child of the parent device probed with DT*/ ++ /* the block device is the child of the parent device probed with DT */ + ut_assertok(device_find_first_child(dev, &bdev)); + -+ /* reading all the flash blocks*/ ++ /* reading all the flash blocks */ + ut_asserteq(plat_data->lba, blk_read(bdev, 0, plat_data->lba, buffer)); + + /* compare the data read from flash with the expected data */ -+ ut_assertok(dm_nvmxip_flash_sanity(device_idx, buffer)); ++ dm_nvmxip_flash_sanity(uts, device_idx, buffer); + + free(buffer); + } @@ -170,5 +215,5 @@ index 000000000000..484e6077b4a9 + +DM_TEST(dm_test_nvmxip, UT_TESTF_SCAN_FDT | UT_TESTF_CONSOLE_REC); -- -2.39.2 +2.25.1 diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0033-corstone1000-add-fwu-metadata-store-info.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0033-corstone1000-add-fwu-metadata-store-info.patch new file mode 100644 index 0000000000..d4ed91216a --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0033-corstone1000-add-fwu-metadata-store-info.patch @@ -0,0 +1,42 @@ +From e2fb90ab15babd146dd47b7c946674cd5a5260a1 Mon Sep 17 00:00:00 2001 +From: Rui Miguel Silva +Date: Wed, 1 Feb 2023 15:58:07 +0000 +Subject: [PATCH 33/42] corstone1000: add fwu-metadata store info + +Add fwu-mdata node and handle for the reference +nvmxip-qspi. + +Upstream-Status: Submitted +Signed-off-by: Rui Miguel Silva +--- + arch/arm/dts/corstone1000.dtsi | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/dts/corstone1000.dtsi b/arch/arm/dts/corstone1000.dtsi +index 18c4d1e19a..25a032b6b3 100644 +--- a/arch/arm/dts/corstone1000.dtsi ++++ b/arch/arm/dts/corstone1000.dtsi +@@ -38,7 +38,7 @@ + reg = <0x88200000 0x77e00000>; + }; + +- nvmxip-qspi@08000000 { ++ nvmxip: nvmxip-qspi@08000000 { + compatible = "nvmxip,qspi"; + reg = <0x08000000 0x2000000>; + lba_shift = <9>; +@@ -106,6 +106,11 @@ + method = "smc"; + }; + ++ fwu-mdata { ++ compatible = "u-boot,fwu-mdata-gpt"; ++ fwu-mdata-store = <&nvmxip>; ++ }; ++ + soc { + compatible = "simple-bus"; + #address-cells = <1>; +-- +2.25.1 + diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0033-nvmxip-provide-a-u-boot-shell-test-command.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0033-nvmxip-provide-a-u-boot-shell-test-command.patch deleted file mode 100644 index e8adbc121a..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0033-nvmxip-provide-a-u-boot-shell-test-command.patch +++ /dev/null @@ -1,135 +0,0 @@ -From 560ebe3eb6197322b9d00c8e3cf30fb7e679d8b2 Mon Sep 17 00:00:00 2001 -From: Abdellatif El Khlifi -Date: Thu, 22 Dec 2022 16:20:46 +0000 -Subject: [PATCH 33/43] nvmxip: provide a u-boot shell test command - -nvmxip command allows probing the NVM XIP devices manually - -The command is provided for test purposes only. - -Use: - -nvmxip probe - -Upstream-Status: Submitted -Signed-off-by: Abdellatif El Khlifi -Signed-off-by: Rui Miguel Silva ---- - cmd/Kconfig | 7 +++++ - cmd/Makefile | 1 + - cmd/nvmxip.c | 47 ++++++++++++++++++++++++++++++++++ - configs/corstone1000_defconfig | 1 + - configs/sandbox_defconfig | 1 + - 5 files changed, 57 insertions(+) - create mode 100644 cmd/nvmxip.c - -diff --git a/cmd/Kconfig b/cmd/Kconfig -index 5e278ecb1597..b6a3e5908534 100644 ---- a/cmd/Kconfig -+++ b/cmd/Kconfig -@@ -938,6 +938,13 @@ config CMD_ARMFFA - - Sending a data pattern to the specified partition - - Displaying the arm_ffa device info - -+config CMD_NVMXIP -+ bool "NVM XIP probe command" -+ depends on NVMXIP -+ help -+ Probes all NVM XIP devices. The command is for -+ test purposes only (not to be upstreamed) -+ - config CMD_ARMFLASH - #depends on FLASH_CFI_DRIVER - bool "armflash" -diff --git a/cmd/Makefile b/cmd/Makefile -index c757f1647da6..0a3d98100703 100644 ---- a/cmd/Makefile -+++ b/cmd/Makefile -@@ -154,6 +154,7 @@ obj-$(CONFIG_CMD_RTC) += rtc.o - obj-$(CONFIG_SANDBOX) += host.o - obj-$(CONFIG_CMD_SATA) += sata.o - obj-$(CONFIG_CMD_NVME) += nvme.o -+obj-$(CONFIG_CMD_NVMXIP) += nvmxip.o - obj-$(CONFIG_SANDBOX) += sb.o - obj-$(CONFIG_CMD_SF) += sf.o - obj-$(CONFIG_CMD_SCSI) += scsi.o disk.o -diff --git a/cmd/nvmxip.c b/cmd/nvmxip.c -new file mode 100644 -index 000000000000..3eb0d84afc04 ---- /dev/null -+++ b/cmd/nvmxip.c -@@ -0,0 +1,47 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+/* -+ * (C) Copyright 2022 ARM Limited -+ * Abdellatif El Khlifi -+ */ -+ -+#include -+#include -+#include -+ -+int do_nvmxip_probe(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) -+{ -+ struct udevice *dev = NULL; -+ for (uclass_first_device(UCLASS_NVMXIP, &dev); dev; uclass_next_device(&dev)); -+ -+ return 0; -+} -+ -+static struct cmd_tbl nvmxip_commands[] = { -+ U_BOOT_CMD_MKENT(probe, 1, 1, do_nvmxip_probe, "", ""), -+}; -+ -+static int do_nvmxip(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) -+{ -+ struct cmd_tbl *nvmxip_cmd; -+ int ret; -+ -+ if (argc < 2) -+ return CMD_RET_USAGE; -+ -+ nvmxip_cmd = find_cmd_tbl(argv[1], nvmxip_commands, ARRAY_SIZE(nvmxip_commands)); -+ -+ argc -= 2; -+ argv += 2; -+ -+ if (!nvmxip_cmd || argc > nvmxip_cmd->maxargs) -+ return CMD_RET_USAGE; -+ -+ ret = nvmxip_cmd->cmd(nvmxip_cmd, flag, argc, argv); -+ -+ return cmd_process_error(nvmxip_cmd, ret); -+} -+ -+U_BOOT_CMD(nvmxip, 4, 1, do_nvmxip, -+ "NVM XIP probe command", -+ "probe\n" -+ " - probes all NVM XIP devices\n"); -diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig -index 2986cc95932f..e009faee0252 100644 ---- a/configs/corstone1000_defconfig -+++ b/configs/corstone1000_defconfig -@@ -59,6 +59,7 @@ CONFIG_USB=y - CONFIG_USB_ISP1760=y - CONFIG_ERRNO_STR=y - CONFIG_NVMXIP_QSPI=y -+CONFIG_CMD_NVMXIP=y - CONFIG_EFI_MM_COMM_TEE=y - CONFIG_ARM_FFA_TRANSPORT=y - CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y -diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig -index f22230b5cce2..3b895be9e4ba 100644 ---- a/configs/sandbox_defconfig -+++ b/configs/sandbox_defconfig -@@ -139,6 +139,7 @@ CONFIG_IP_DEFRAG=y - CONFIG_BOOTP_SERVERIP=y - CONFIG_IPV6=y - CONFIG_NVMXIP_QSPI=y -+CONFIG_CMD_NVMXIP=y - CONFIG_DM_DMA=y - CONFIG_DEVRES=y - CONFIG_DEBUG_DEVRES=y --- -2.39.2 - diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0034-corstone1000-add-fwu-metadata-store-info.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0034-corstone1000-add-fwu-metadata-store-info.patch deleted file mode 100644 index facd19b3c9..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0034-corstone1000-add-fwu-metadata-store-info.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 9ef889ff89e6d2e2e40edecbd4ab7601c3d68052 Mon Sep 17 00:00:00 2001 -From: Rui Miguel Silva -Date: Wed, 1 Feb 2023 15:58:07 +0000 -Subject: [PATCH 34/43] corstone1000: add fwu-metadata store info - -Add fwu-mdata node and handle for the reference -nvmxip-qspi. - -Upstream-Status: Submitted -Signed-off-by: Rui Miguel Silva ---- - arch/arm/dts/corstone1000.dtsi | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/arch/arm/dts/corstone1000.dtsi b/arch/arm/dts/corstone1000.dtsi -index faf4e12bab2a..b1d83b5ba861 100644 ---- a/arch/arm/dts/corstone1000.dtsi -+++ b/arch/arm/dts/corstone1000.dtsi -@@ -38,7 +38,7 @@ - reg = <0x88200000 0x77e00000>; - }; - -- nvmxip-qspi@08000000 { -+ nvmxip: nvmxip-qspi@08000000 { - compatible = "nvmxip,qspi"; - reg = <0x08000000 0x2000000>; - lba_shift = <9>; -@@ -106,6 +106,11 @@ - method = "smc"; - }; - -+ fwu-mdata { -+ compatible = "u-boot,fwu-mdata-gpt"; -+ fwu-mdata-store = <&nvmxip>; -+ }; -+ - soc { - compatible = "simple-bus"; - #address-cells = <1>; --- -2.39.2 - diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0034-efi_boottime-allow-to-reset-a-path-after-boot.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0034-efi_boottime-allow-to-reset-a-path-after-boot.patch new file mode 100644 index 0000000000..5c053974d1 --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0034-efi_boottime-allow-to-reset-a-path-after-boot.patch @@ -0,0 +1,31 @@ +From eb8e224290149fd39ca4b3a774abef2e31237943 Mon Sep 17 00:00:00 2001 +From: Rui Miguel Silva +Date: Wed, 1 Feb 2023 16:11:25 +0000 +Subject: [PATCH 34/42] efi_boottime: allow to reset a path after boot + +Allow to install multiple protocol interfaces in an +already installed root interface. +This may need to be fix in other way, but for now +looks like the get away fix. + +Upstream-Status: Pending +Signed-off-by: Rui Miguel Silva +--- + lib/efi_loader/efi_boottime.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c +index fea4eb7a34..90f43ff9a6 100644 +--- a/lib/efi_loader/efi_boottime.c ++++ b/lib/efi_loader/efi_boottime.c +@@ -2669,7 +2669,6 @@ efi_install_multiple_protocol_interfaces_int(efi_handle_t *handle, + EFI_PRINT("Path %pD already installed\n", + protocol_interface); + ret = EFI_ALREADY_STARTED; +- break; + } + } + ret = EFI_CALL(efi_install_protocol_interface(handle, protocol, +-- +2.25.1 + diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0035-fwu_metadata-make-sure-structures-are-packed.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0035-fwu_metadata-make-sure-structures-are-packed.patch new file mode 100644 index 0000000000..fedc1f2e1b --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0035-fwu_metadata-make-sure-structures-are-packed.patch @@ -0,0 +1,50 @@ +From ac77679ffcb4b7fac01414c1492d3e1aae13f9be Mon Sep 17 00:00:00 2001 +From: Rui Miguel Silva +Date: Wed, 1 Feb 2023 16:13:24 +0000 +Subject: [PATCH 35/42] fwu_metadata: make sure structures are packed + +The fwu metadata in the metadata partitions +should/are packed to guarantee that the info is +correct in all platforms. Also the size of them +are used to calculate the crc32 and that is important +to get it right. + +Upstream-Status: Pending +Signed-off-by: Rui Miguel Silva +--- + include/fwu_mdata.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/include/fwu_mdata.h b/include/fwu_mdata.h +index 8fda4f4ac2..c61221a917 100644 +--- a/include/fwu_mdata.h ++++ b/include/fwu_mdata.h +@@ -22,7 +22,7 @@ struct fwu_image_bank_info { + efi_guid_t image_uuid; + uint32_t accepted; + uint32_t reserved; +-}; ++} __packed; + + /** + * struct fwu_image_entry - information for a particular type of image +@@ -38,7 +38,7 @@ struct fwu_image_entry { + efi_guid_t image_type_uuid; + efi_guid_t location_uuid; + struct fwu_image_bank_info img_bank_info[CONFIG_FWU_NUM_BANKS]; +-}; ++} __packed; + + /** + * struct fwu_mdata - FWU metadata structure for multi-bank updates +@@ -62,6 +62,6 @@ struct fwu_mdata { + uint32_t previous_active_index; + + struct fwu_image_entry img_entry[CONFIG_FWU_NUM_IMAGES_PER_BANK]; +-}; ++} __packed; + + #endif /* _FWU_MDATA_H_ */ +-- +2.25.1 + diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0035-nvmxip-shorter-block-device-name.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0035-nvmxip-shorter-block-device-name.patch deleted file mode 100644 index 74e4ccb875..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0035-nvmxip-shorter-block-device-name.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 83823733015998702e4dc0365764fe7dde4a321f Mon Sep 17 00:00:00 2001 -From: Rui Miguel Silva -Date: Wed, 1 Feb 2023 15:59:36 +0000 -Subject: [PATCH 35/43] nvmxip: shorter block device name - -Make the block device name shorter, so it will be set and presented -inside the array limits. - -Upstream-Status: Pending -Signed-off-by: Rui Miguel Silva ---- - drivers/nvmxip/nvmxip.c | 2 +- - drivers/nvmxip/nvmxip_qspi.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/drivers/nvmxip/nvmxip.c b/drivers/nvmxip/nvmxip.c -index af9c9a3b7270..91fe995f2d4d 100644 ---- a/drivers/nvmxip/nvmxip.c -+++ b/drivers/nvmxip/nvmxip.c -@@ -91,7 +91,7 @@ int nvmxip_init(struct udevice *udev) - - nvmxip_bdev_max_devs++; - -- snprintf(bdev_name, NVMXIP_BLKDEV_NAME_SZ, "nvmxip-blk#%d", nvmxip_bdev_max_devs); -+ snprintf(bdev_name, NVMXIP_BLKDEV_NAME_SZ, "blk#%d", nvmxip_bdev_max_devs); - - ret = blk_create_devicef(udev, NVMXIP_BLKDRV_NAME, bdev_name, UCLASS_NVMXIP, - nvmxip_bdev_max_devs, NVMXIP_DEFAULT_LBA_SZ, -diff --git a/drivers/nvmxip/nvmxip_qspi.c b/drivers/nvmxip/nvmxip_qspi.c -index 749625134acd..f6f5435e6377 100644 ---- a/drivers/nvmxip/nvmxip_qspi.c -+++ b/drivers/nvmxip/nvmxip_qspi.c -@@ -43,7 +43,7 @@ static int nvmxip_qspi_of_to_plat(struct udevice *dev) - return -EINVAL; - } - -- pr_debug("[%s]: XIP device base addr: 0x%llx , lba_shift: %d , lbas: %lu\n", -+ log_err("[%s]: XIP device base addr: 0x%llx , lba_shift: %d , lbas: %lu\n", - dev->name, plat_data->phys_base, plat_data->lba_shift, plat_data->lba); - - return 0; --- -2.39.2 - diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0036-corstone1000-add-boot-index.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0036-corstone1000-add-boot-index.patch new file mode 100644 index 0000000000..d9568563e6 --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0036-corstone1000-add-boot-index.patch @@ -0,0 +1,33 @@ +From 92948559987d02baf9f690d9bbdc96d1179264ef Mon Sep 17 00:00:00 2001 +From: Rui Miguel Silva +Date: Wed, 1 Feb 2023 16:15:30 +0000 +Subject: [PATCH 36/42] corstone1000: add boot index + +it is expected that the firmware that runs before +u-boot somehow provide the information of the bank +(index) of it is booting. +We will need to extend tf-a to pass that info, +meanwhile just set it to the default bank. + +Upstream-Status: Pending +Signed-off-by: Rui Miguel Silva +--- + board/armltd/corstone1000/corstone1000.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/board/armltd/corstone1000/corstone1000.c b/board/armltd/corstone1000/corstone1000.c +index d6ca6e8961..0a58ccd99c 100644 +--- a/board/armltd/corstone1000/corstone1000.c ++++ b/board/armltd/corstone1000/corstone1000.c +@@ -106,6 +106,7 @@ int dram_init_banksize(void) + return 0; + } + +-void reset_cpu(ulong addr) ++void fwu_plat_get_bootidx(int *boot_idx) + { ++ *boot_idx = 0; + } +-- +2.25.1 + diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0036-efi_boottime-allow-to-reset-a-path-after-boot.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0036-efi_boottime-allow-to-reset-a-path-after-boot.patch deleted file mode 100644 index 59a60af668..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0036-efi_boottime-allow-to-reset-a-path-after-boot.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 53d29d35cdbcf493f6a9046458947d3e91f01add Mon Sep 17 00:00:00 2001 -From: Rui Miguel Silva -Date: Wed, 1 Feb 2023 16:11:25 +0000 -Subject: [PATCH 36/43] efi_boottime: allow to reset a path after boot - -Allow to install multiple protocol interfaces in an -already installed root interface. -This may need to be fix in other way, but for now -looks like the get away fix. - -Upstream-Status: Pending -Signed-off-by: Rui Miguel Silva ---- - lib/efi_loader/efi_boottime.c | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c -index fea4eb7a342e..90f43ff9a62f 100644 ---- a/lib/efi_loader/efi_boottime.c -+++ b/lib/efi_loader/efi_boottime.c -@@ -2669,7 +2669,6 @@ efi_install_multiple_protocol_interfaces_int(efi_handle_t *handle, - EFI_PRINT("Path %pD already installed\n", - protocol_interface); - ret = EFI_ALREADY_STARTED; -- break; - } - } - ret = EFI_CALL(efi_install_protocol_interface(handle, protocol, --- -2.39.2 - diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0037-corstone1000-adjust-boot-bank-and-kernel-location.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0037-corstone1000-adjust-boot-bank-and-kernel-location.patch new file mode 100644 index 0000000000..277e988b3f --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0037-corstone1000-adjust-boot-bank-and-kernel-location.patch @@ -0,0 +1,36 @@ +From 1a54c12aa6eed28a1a4e4f50d1aeb92a31cf6f52 Mon Sep 17 00:00:00 2001 +From: Rui Miguel Silva +Date: Wed, 1 Feb 2023 16:17:21 +0000 +Subject: [PATCH 37/42] corstone1000: adjust boot bank and kernel location + +Adjust in the env boot script the address of the +bootbank with the new gpt layout, and also the +kernel partition address. Please be aware that +this is hack and needs a proper fix, since the +offset of the kernel partition is not fixed, +but for the propose of PoC it is enough for testing. + +Upstream-Status: Pending +Signed-off-by: Rui Miguel Silva +--- + board/armltd/corstone1000/corstone1000.env | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/board/armltd/corstone1000/corstone1000.env b/board/armltd/corstone1000/corstone1000.env +index b24ff07fc6..a6ee496221 100644 +--- a/board/armltd/corstone1000/corstone1000.env ++++ b/board/armltd/corstone1000/corstone1000.env +@@ -1,8 +1,8 @@ + /* SPDX-License-Identifier: GPL-2.0+ */ + + usb_pgood_delay=250 +-boot_bank_flag=0x08002000 +-kernel_addr_bank_0=0x083EE000 ++boot_bank_flag=0x08005006 ++kernel_addr_bank_0=0x08280000 + kernel_addr_bank_1=0x0936E000 + retrieve_kernel_load_addr= + if itest.l *${boot_bank_flag} == 0; then +-- +2.25.1 + diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0037-fwu_metadata-make-sure-structures-are-packed.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0037-fwu_metadata-make-sure-structures-are-packed.patch deleted file mode 100644 index 7781a1edab..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0037-fwu_metadata-make-sure-structures-are-packed.patch +++ /dev/null @@ -1,50 +0,0 @@ -From a8142be9b32a769040b6238ff611c22cb31c8cb5 Mon Sep 17 00:00:00 2001 -From: Rui Miguel Silva -Date: Wed, 1 Feb 2023 16:13:24 +0000 -Subject: [PATCH 37/43] fwu_metadata: make sure structures are packed - -The fwu metadata in the metadata partitions -should/are packed to guarantee that the info is -correct in all platforms. Also the size of them -are used to calculate the crc32 and that is important -to get it right. - -Upstream-Status: Pending -Signed-off-by: Rui Miguel Silva ---- - include/fwu_mdata.h | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/include/fwu_mdata.h b/include/fwu_mdata.h -index 8fda4f4ac225..c61221a91735 100644 ---- a/include/fwu_mdata.h -+++ b/include/fwu_mdata.h -@@ -22,7 +22,7 @@ struct fwu_image_bank_info { - efi_guid_t image_uuid; - uint32_t accepted; - uint32_t reserved; --}; -+} __packed; - - /** - * struct fwu_image_entry - information for a particular type of image -@@ -38,7 +38,7 @@ struct fwu_image_entry { - efi_guid_t image_type_uuid; - efi_guid_t location_uuid; - struct fwu_image_bank_info img_bank_info[CONFIG_FWU_NUM_BANKS]; --}; -+} __packed; - - /** - * struct fwu_mdata - FWU metadata structure for multi-bank updates -@@ -62,6 +62,6 @@ struct fwu_mdata { - uint32_t previous_active_index; - - struct fwu_image_entry img_entry[CONFIG_FWU_NUM_IMAGES_PER_BANK]; --}; -+} __packed; - - #endif /* _FWU_MDATA_H_ */ --- -2.39.2 - diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0038-corstone1000-add-boot-index.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0038-corstone1000-add-boot-index.patch deleted file mode 100644 index afaf967348..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0038-corstone1000-add-boot-index.patch +++ /dev/null @@ -1,33 +0,0 @@ -From ceae4ec0d459b1ef12e544f4e36d6043a09d3b05 Mon Sep 17 00:00:00 2001 -From: Rui Miguel Silva -Date: Wed, 1 Feb 2023 16:15:30 +0000 -Subject: [PATCH 38/43] corstone1000: add boot index - -it is expected that the firmware that runs before -u-boot somehow provide the information of the bank -(index) of it is booting. -We will need to extend tf-a to pass that info, -meanwhile just set it to the default bank. - -Upstream-Status: Pending -Signed-off-by: Rui Miguel Silva ---- - board/armltd/corstone1000/corstone1000.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/board/armltd/corstone1000/corstone1000.c b/board/armltd/corstone1000/corstone1000.c -index d6ca6e896140..0a58ccd99cdd 100644 ---- a/board/armltd/corstone1000/corstone1000.c -+++ b/board/armltd/corstone1000/corstone1000.c -@@ -106,6 +106,7 @@ int dram_init_banksize(void) - return 0; - } - --void reset_cpu(ulong addr) -+void fwu_plat_get_bootidx(int *boot_idx) - { -+ *boot_idx = 0; - } --- -2.39.2 - diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0038-corstone1000-add-nvmxip-fwu-mdata-and-gpt-options.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0038-corstone1000-add-nvmxip-fwu-mdata-and-gpt-options.patch new file mode 100644 index 0000000000..a0f2bb16f5 --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0038-corstone1000-add-nvmxip-fwu-mdata-and-gpt-options.patch @@ -0,0 +1,100 @@ +From 5e0b7e40c4702d5494378d3e120fce0136f69a79 Mon Sep 17 00:00:00 2001 +From: Rui Miguel Silva +Date: Fri, 9 Jun 2023 13:28:06 +0100 +Subject: [PATCH 38/42] corstone1000: add nvmxip, fwu-mdata and gpt options + +Enable the newest features: nvmxip, fwu-metadata and +gpt. Commands to print the partition info, gpt info +and fwu metadata will be available. + +Upstream-Status: Pending +Signed-off-by: Rui Miguel Silva +--- + configs/corstone1000_defconfig | 29 +++++++++++++++++++---------- + 1 file changed, 19 insertions(+), 10 deletions(-) + +diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig +index 1179bf5f3b..c38113ce95 100644 +--- a/configs/corstone1000_defconfig ++++ b/configs/corstone1000_defconfig +@@ -4,18 +4,20 @@ CONFIG_TARGET_CORSTONE1000=y + CONFIG_TEXT_BASE=0x80000000 + CONFIG_SYS_MALLOC_LEN=0x2000000 + CONFIG_NR_DRAM_BANKS=1 ++CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y ++CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x83f00000 ++CONFIG_DM_GPIO=y + CONFIG_DEFAULT_DEVICE_TREE="corstone1000-mps3" + CONFIG_SYS_PROMPT="corstone1000# " + CONFIG_IDENT_STRING=" corstone1000 aarch64 " + CONFIG_SYS_LOAD_ADDR=0x82100000 ++CONFIG_FWU_NUM_IMAGES_PER_BANK=4 + CONFIG_DISTRO_DEFAULTS=y +-CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y +-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x83f00000 + CONFIG_FIT=y + CONFIG_BOOTDELAY=3 + CONFIG_USE_BOOTARGS=y + CONFIG_BOOTARGS="console=ttyAMA0 loglevel=9 ip=dhcp earlyprintk" +-CONFIG_BOOTCOMMAND="run retrieve_kernel_load_addr; echo Loading kernel from $kernel_addr to memory ... ; unzip $kernel_addr 0x90000000; loadm 0x90000000 $kernel_addr_r 0xf00000; usb start; usb reset; run distro_bootcmd; bootefi $kernel_addr_r $fdtcontroladdr;" ++CONFIG_BOOTCOMMAND="echo Loading kernel from $kernel_addr to memory ... ; unzip $kernel_addr 0x90000000; loadm 0x90000000 $kernel_addr_r 0xf00000; usb start; usb reset; run distro_bootcmd; bootefi $kernel_addr_r $fdtcontroladdr;" + CONFIG_CONSOLE_RECORD=y + CONFIG_LOGLEVEL=7 + # CONFIG_DISPLAY_CPUINFO is not set +@@ -23,11 +25,15 @@ CONFIG_LOGLEVEL=7 + CONFIG_SYS_MAXARGS=64 + CONFIG_SYS_CBSIZE=512 + # CONFIG_CMD_CONSOLE is not set ++CONFIG_CMD_FWU_METADATA=y + CONFIG_CMD_BOOTZ=y + CONFIG_SYS_BOOTM_LEN=0x800000 + # CONFIG_CMD_XIMG is not set ++CONFIG_CMD_GPT=y ++# CONFIG_RANDOM_UUID is not set + CONFIG_CMD_LOADM=y + # CONFIG_CMD_LOADS is not set ++CONFIG_CMD_MMC=y + CONFIG_CMD_USB=y + # CONFIG_CMD_SETEXPR is not set + # CONFIG_CMD_NFS is not set +@@ -39,27 +45,30 @@ CONFIG_OF_CONTROL=y + CONFIG_VERSION_VARIABLE=y + CONFIG_NET_RANDOM_ETHADDR=y + CONFIG_REGMAP=y +-CONFIG_MISC=y ++CONFIG_ARM_FFA_TRANSPORT=y + CONFIG_CLK=y +-CONFIG_CMD_MMC=y +-CONFIG_DM_MMC=y ++CONFIG_FWU_MDATA=y ++CONFIG_FWU_MDATA_GPT_BLK=y ++CONFIG_MISC=y + CONFIG_ARM_PL180_MMCI=y +-CONFIG_MMC_SDHCI_ADMA_HELPERS=y +-CONFIG_MMC_WRITE=y +-CONFIG_DM_GPIO=y + CONFIG_PHYLIB=y + CONFIG_PHY_SMSC=y + CONFIG_SMC911X=y ++CONFIG_NVMXIP_QSPI=y + CONFIG_PHY=y + CONFIG_RAM=y + CONFIG_DM_RTC=y + CONFIG_RTC_EMULATION=y + CONFIG_DM_SERIAL=y ++CONFIG_SYSRESET=y + CONFIG_USB=y + CONFIG_USB_ISP1760=y + CONFIG_ERRNO_STR=y + CONFIG_EFI_MM_COMM_TEE=y + CONFIG_ARM_FFA_TRANSPORT=y + CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y ++CONFIG_EFI_CAPSULE_ON_DISK=y ++CONFIG_EFI_IGNORE_OSINDICATIONS=y + CONFIG_EFI_CAPSULE_FIRMWARE_FIT=y +-CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y ++CONFIG_FWU_MULTI_BANK_UPDATE=y ++# CONFIG_TOOLS_MKEFICAPSULE is not set +-- +2.25.1 + diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0039-corstone1000-adjust-boot-bank-and-kernel-location.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0039-corstone1000-adjust-boot-bank-and-kernel-location.patch deleted file mode 100644 index a42b3a25ee..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0039-corstone1000-adjust-boot-bank-and-kernel-location.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 80a2910370b0acc35f6fb2fbe3a7e56fecb1a08a Mon Sep 17 00:00:00 2001 -From: Rui Miguel Silva -Date: Wed, 1 Feb 2023 16:17:21 +0000 -Subject: [PATCH 39/43] corstone1000: adjust boot bank and kernel location - -Adjust in the env boot script the address of the -bootbank with the new gpt layout, and also the -kernel partition address. Please be aware that -this is hack and needs a proper fix, since the -offset of the kernel partition is not fixed, -but for the propose of PoC it is enough for testing. - -Upstream-Status: Pending -Signed-off-by: Rui Miguel Silva ---- - board/armltd/corstone1000/corstone1000.env | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/board/armltd/corstone1000/corstone1000.env b/board/armltd/corstone1000/corstone1000.env -index b24ff07fc6bd..a6ee4962211b 100644 ---- a/board/armltd/corstone1000/corstone1000.env -+++ b/board/armltd/corstone1000/corstone1000.env -@@ -1,8 +1,8 @@ - /* SPDX-License-Identifier: GPL-2.0+ */ - - usb_pgood_delay=250 --boot_bank_flag=0x08002000 --kernel_addr_bank_0=0x083EE000 -+boot_bank_flag=0x08005006 -+kernel_addr_bank_0=0x08280000 - kernel_addr_bank_1=0x0936E000 - retrieve_kernel_load_addr= - if itest.l *${boot_bank_flag} == 0; then --- -2.39.2 - diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0039-nvmxip-move-header-to-include.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0039-nvmxip-move-header-to-include.patch new file mode 100644 index 0000000000..b745fe9b6b --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0039-nvmxip-move-header-to-include.patch @@ -0,0 +1,42 @@ +From d280414229d7bbee368f40be6cde17e4f251dd0f Mon Sep 17 00:00:00 2001 +From: Rui Miguel Silva +Date: Fri, 9 Jun 2023 13:31:53 +0100 +Subject: [PATCH 39/42] nvmxip: move header to include + +Move header to include to allow external code +to get the internal bdev structures to access +block device operations. + +as at it, just add the UCLASS_NVMXIP string +so we get the correct output in partitions +listing. + +Upstream-Status: Pending +Signed-off-by: Rui Miguel Silva +--- + disk/part.c | 3 +++ + {drivers/mtd/nvmxip => include}/nvmxip.h | 0 + 2 files changed, 3 insertions(+) + rename {drivers/mtd/nvmxip => include}/nvmxip.h (100%) + +diff --git a/disk/part.c b/disk/part.c +index 5ee60a7fb5..593dd0004f 100644 +--- a/disk/part.c ++++ b/disk/part.c +@@ -270,6 +270,9 @@ static void print_part_header(const char *type, struct blk_desc *dev_desc) + case UCLASS_NVME: + puts ("NVMe"); + break; ++ case UCLASS_NVMXIP: ++ puts ("NVMXIP"); ++ break; + case UCLASS_PVBLOCK: + puts("PV BLOCK"); + break; +diff --git a/drivers/mtd/nvmxip/nvmxip.h b/include/nvmxip.h +similarity index 100% +rename from drivers/mtd/nvmxip/nvmxip.h +rename to include/nvmxip.h +-- +2.25.1 + diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0040-corstone1000-add-nvmxip-fwu-mdata-and-gpt-options.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0040-corstone1000-add-nvmxip-fwu-mdata-and-gpt-options.patch deleted file mode 100644 index bd6b9991ec..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0040-corstone1000-add-nvmxip-fwu-mdata-and-gpt-options.patch +++ /dev/null @@ -1,103 +0,0 @@ -From 0c2bd094b7686e9497327d825470cb90aa29d10f Mon Sep 17 00:00:00 2001 -From: Rui Miguel Silva -Date: Wed, 1 Feb 2023 16:19:40 +0000 -Subject: [PATCH 40/43] corstone1000: add nvmxip, fwu-mdata and gpt options - -Enable the newest features: nvmxip, fwu-metadata and -gpt. Commands to print the partition info, gpt info -and fwu metadata will be available. - -Upstream-Status: Pending -Signed-off-by: Rui Miguel Silva ---- - configs/corstone1000_defconfig | 33 ++++++++++++++++++++------------- - 1 file changed, 20 insertions(+), 13 deletions(-) - -diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig -index e009faee0252..96bb86ec91e9 100644 ---- a/configs/corstone1000_defconfig -+++ b/configs/corstone1000_defconfig -@@ -4,18 +4,20 @@ CONFIG_TARGET_CORSTONE1000=y - CONFIG_TEXT_BASE=0x80000000 - CONFIG_SYS_MALLOC_LEN=0x2000000 - CONFIG_NR_DRAM_BANKS=1 -+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y -+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x83f00000 -+CONFIG_DM_GPIO=y - CONFIG_DEFAULT_DEVICE_TREE="corstone1000-mps3" - CONFIG_SYS_PROMPT="corstone1000# " - CONFIG_IDENT_STRING=" corstone1000 aarch64 " - CONFIG_SYS_LOAD_ADDR=0x82100000 -+CONFIG_FWU_NUM_IMAGES_PER_BANK=4 - CONFIG_DISTRO_DEFAULTS=y --CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y --CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x83f00000 - CONFIG_FIT=y - CONFIG_BOOTDELAY=3 - CONFIG_USE_BOOTARGS=y - CONFIG_BOOTARGS="console=ttyAMA0 loglevel=9 ip=dhcp earlyprintk" --CONFIG_BOOTCOMMAND="run retrieve_kernel_load_addr; echo Loading kernel from $kernel_addr to memory ... ; unzip $kernel_addr 0x90000000; loadm 0x90000000 $kernel_addr_r 0xf00000; usb start; usb reset; run distro_bootcmd; bootefi $kernel_addr_r $fdtcontroladdr;" -+CONFIG_BOOTCOMMAND="echo Loading kernel from $kernel_addr to memory ... ; unzip $kernel_addr 0x90000000; loadm 0x90000000 $kernel_addr_r 0xf00000; usb start; usb reset; run distro_bootcmd; bootefi $kernel_addr_r $fdtcontroladdr;" - CONFIG_CONSOLE_RECORD=y - CONFIG_LOGLEVEL=7 - # CONFIG_DISPLAY_CPUINFO is not set -@@ -23,11 +25,16 @@ CONFIG_LOGLEVEL=7 - CONFIG_SYS_MAXARGS=64 - CONFIG_SYS_CBSIZE=512 - # CONFIG_CMD_CONSOLE is not set -+CONFIG_CMD_FWU_METADATA=y - CONFIG_CMD_BOOTZ=y - CONFIG_SYS_BOOTM_LEN=0x800000 - # CONFIG_CMD_XIMG is not set -+CONFIG_CMD_NVMXIP=y -+CONFIG_CMD_GPT=y -+# CONFIG_RANDOM_UUID is not set - CONFIG_CMD_LOADM=y - # CONFIG_CMD_LOADS is not set -+CONFIG_CMD_MMC=y - CONFIG_CMD_USB=y - # CONFIG_CMD_SETEXPR is not set - # CONFIG_CMD_NFS is not set -@@ -39,29 +46,29 @@ CONFIG_OF_CONTROL=y - CONFIG_VERSION_VARIABLE=y - CONFIG_NET_RANDOM_ETHADDR=y - CONFIG_REGMAP=y --CONFIG_MISC=y -+CONFIG_ARM_FFA_TRANSPORT=y - CONFIG_CLK=y --CONFIG_CMD_MMC=y --CONFIG_DM_MMC=y -+CONFIG_FWU_MDATA=y -+CONFIG_FWU_MDATA_GPT_BLK=y -+CONFIG_MISC=y - CONFIG_ARM_PL180_MMCI=y --CONFIG_MMC_SDHCI_ADMA_HELPERS=y --CONFIG_MMC_WRITE=y --CONFIG_DM_GPIO=y - CONFIG_PHYLIB=y - CONFIG_PHY_SMSC=y - CONFIG_SMC911X=y -+CONFIG_NVMXIP_QSPI=y - CONFIG_PHY=y - CONFIG_RAM=y - CONFIG_DM_RTC=y - CONFIG_RTC_EMULATION=y - CONFIG_DM_SERIAL=y -+CONFIG_SYSRESET=y - CONFIG_USB=y - CONFIG_USB_ISP1760=y - CONFIG_ERRNO_STR=y --CONFIG_NVMXIP_QSPI=y --CONFIG_CMD_NVMXIP=y - CONFIG_EFI_MM_COMM_TEE=y --CONFIG_ARM_FFA_TRANSPORT=y - CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y -+CONFIG_EFI_CAPSULE_ON_DISK=y -+CONFIG_EFI_IGNORE_OSINDICATIONS=y - CONFIG_EFI_CAPSULE_FIRMWARE_FIT=y --CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y -+CONFIG_FWU_MULTI_BANK_UPDATE=y -+# CONFIG_TOOLS_MKEFICAPSULE is not set --- -2.40.0 - diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0040-corstone1000-set-kernel_addr-based-on-boot_idx.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0040-corstone1000-set-kernel_addr-based-on-boot_idx.patch new file mode 100644 index 0000000000..ba2e5e17fe --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0040-corstone1000-set-kernel_addr-based-on-boot_idx.patch @@ -0,0 +1,133 @@ +From e7cb997fd59c883572994b504dbc77bc670de8f7 Mon Sep 17 00:00:00 2001 +From: Rui Miguel Silva +Date: Thu, 23 Feb 2023 10:35:00 +0000 +Subject: [PATCH 40/42] corstone1000: set kernel_addr based on boot_idx + +We need to distinguish between boot banks and from which +partition to load the kernel+initramfs to memory. + +For that, fetch the boot index, fetch the correspondent +partition, calculate the correct kernel address and +then set the env variable kernel_addr with that value. + +Upstream-Status: Pending +Signed-off-by: Rui Miguel Silva +--- + board/armltd/corstone1000/corstone1000.c | 58 +++++++++++++++++++++- + board/armltd/corstone1000/corstone1000.env | 8 --- + configs/corstone1000_defconfig | 1 + + 3 files changed, 58 insertions(+), 9 deletions(-) + +diff --git a/board/armltd/corstone1000/corstone1000.c b/board/armltd/corstone1000/corstone1000.c +index 0a58ccd99c..b767195ccc 100644 +--- a/board/armltd/corstone1000/corstone1000.c ++++ b/board/armltd/corstone1000/corstone1000.c +@@ -5,13 +5,23 @@ + * Rui Miguel Silva + */ + ++#include + #include + #include ++#include + #include ++#include ++#include + #include + #include + #include + ++#define CORSTONE1000_KERNEL_PARTS 2 ++#define CORSTONE1000_KERNEL_PRIMARY "kernel_primary" ++#define CORSTONE1000_KERNEL_SECONDARY "kernel_secondary" ++ ++static int corstone1000_boot_idx; ++ + static struct mm_region corstone1000_mem_map[] = { + { + /* CVM */ +@@ -108,5 +118,51 @@ int dram_init_banksize(void) + + void fwu_plat_get_bootidx(int *boot_idx) + { +- *boot_idx = 0; ++ *boot_idx = corstone1000_boot_idx; ++} ++ ++int board_late_init(void) ++{ ++ struct disk_partition part_info; ++ struct udevice *dev, *bdev; ++ struct nvmxip_plat *plat; ++ struct blk_desc *desc; ++ int ret; ++ ++ ret = uclass_first_device_err(UCLASS_NVMXIP, &dev); ++ if (ret < 0) { ++ log_err("Cannot find kernel device\n"); ++ return ret; ++ } ++ ++ plat = dev_get_plat(dev); ++ device_find_first_child(dev, &bdev); ++ desc = dev_get_uclass_plat(bdev); ++ ret = fwu_get_active_index(&corstone1000_boot_idx); ++ if (ret < 0) ++ log_err("corstone1000: failed to read boot index\n"); ++ ++ if (!corstone1000_boot_idx) ++ ret = part_get_info_by_name(desc, CORSTONE1000_KERNEL_PRIMARY, ++ &part_info); ++ else ++ ret = part_get_info_by_name(desc, CORSTONE1000_KERNEL_SECONDARY, ++ &part_info); ++ ++ if (ret < 0) { ++ log_err("failed to fetch kernel partition index: %d\n", ++ corstone1000_boot_idx); ++ return ret; ++ } ++ ++ ret = 0; ++ ++ ret |= env_set_hex("kernel_addr", plat->phys_base + ++ (part_info.start * part_info.blksz)); ++ ret |= env_set_hex("kernel_size", part_info.size * part_info.blksz); ++ ++ if (ret < 0) ++ log_err("failed to setup kernel addr and size\n"); ++ ++ return ret; + } +diff --git a/board/armltd/corstone1000/corstone1000.env b/board/armltd/corstone1000/corstone1000.env +index a6ee496221..ee318b1b1c 100644 +--- a/board/armltd/corstone1000/corstone1000.env ++++ b/board/armltd/corstone1000/corstone1000.env +@@ -2,12 +2,4 @@ + + usb_pgood_delay=250 + boot_bank_flag=0x08005006 +-kernel_addr_bank_0=0x08280000 +-kernel_addr_bank_1=0x0936E000 +-retrieve_kernel_load_addr= +- if itest.l *${boot_bank_flag} == 0; then +- setenv kernel_addr $kernel_addr_bank_0; +- else +- setenv kernel_addr $kernel_addr_bank_1; +- fi; + kernel_addr_r=0x88200000 +diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig +index c38113ce95..20359cb181 100644 +--- a/configs/corstone1000_defconfig ++++ b/configs/corstone1000_defconfig +@@ -22,6 +22,7 @@ CONFIG_CONSOLE_RECORD=y + CONFIG_LOGLEVEL=7 + # CONFIG_DISPLAY_CPUINFO is not set + # CONFIG_DISPLAY_BOARDINFO is not set ++CONFIG_BOARD_LATE_INIT=y + CONFIG_SYS_MAXARGS=64 + CONFIG_SYS_CBSIZE=512 + # CONFIG_CMD_CONSOLE is not set +-- +2.25.1 + diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0041-corstone1000-boot-index-from-active.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0041-corstone1000-boot-index-from-active.patch new file mode 100644 index 0000000000..f0e14942ad --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0041-corstone1000-boot-index-from-active.patch @@ -0,0 +1,42 @@ +From ab07a26290e44fb198403b658b8f1550e959a0cc Mon Sep 17 00:00:00 2001 +From: Rui Miguel Silva +Date: Mon, 27 Feb 2023 14:40:13 +0000 +Subject: [PATCH 41/42] corstone1000: boot index from active + +In our platform, the Secure Enclave is the one who control +all the boot tries and status, so, every time we get here +we know that the we are booting from the active index. + +Upstream-Status: Pending +Signed-off-by: Rui Miguel Silva +--- + board/armltd/corstone1000/corstone1000.c | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/board/armltd/corstone1000/corstone1000.c b/board/armltd/corstone1000/corstone1000.c +index b767195ccc..db508ac3cb 100644 +--- a/board/armltd/corstone1000/corstone1000.c ++++ b/board/armltd/corstone1000/corstone1000.c +@@ -118,7 +118,18 @@ int dram_init_banksize(void) + + void fwu_plat_get_bootidx(int *boot_idx) + { +- *boot_idx = corstone1000_boot_idx; ++ int ret; ++ ++ /* ++ * in our platform, the Secure Enclave is the one who control ++ * all the boot tries and status, so, every time we get here ++ * we know that the we are booting from the active index ++ */ ++ ret = fwu_get_active_index(boot_idx); ++ if (ret < 0) ++ log_err("corstone1000: failed to read active index\n"); ++ ++ return ret; + } + + int board_late_init(void) +-- +2.25.1 + diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0041-nvmxip-move-header-to-include.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0041-nvmxip-move-header-to-include.patch deleted file mode 100644 index 4e4ae17216..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0041-nvmxip-move-header-to-include.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 37b3c73d9307d1de3b78e3ccba0ba6ba0867d6b8 Mon Sep 17 00:00:00 2001 -From: Rui Miguel Silva -Date: Thu, 23 Feb 2023 10:32:04 +0000 -Subject: [PATCH 41/43] nvmxip: move header to include - -Move header to include to allow external code -to get the internal bdev structures to access -block device operations. - -as at it, just add the UCLASS_NVMXIP string -so we get the correct output in partitions -listing. - -Upstream-Status: Pending -Signed-off-by: Rui Miguel Silva ---- - disk/part.c | 3 +++ - {drivers/nvmxip => include}/nvmxip.h | 0 - 2 files changed, 3 insertions(+) - rename {drivers/nvmxip => include}/nvmxip.h (100%) - -diff --git a/disk/part.c b/disk/part.c -index 5ee60a7fb591..593dd0004fa4 100644 ---- a/disk/part.c -+++ b/disk/part.c -@@ -270,6 +270,9 @@ static void print_part_header(const char *type, struct blk_desc *dev_desc) - case UCLASS_NVME: - puts ("NVMe"); - break; -+ case UCLASS_NVMXIP: -+ puts ("NVMXIP"); -+ break; - case UCLASS_PVBLOCK: - puts("PV BLOCK"); - break; -diff --git a/drivers/nvmxip/nvmxip.h b/include/nvmxip.h -similarity index 100% -rename from drivers/nvmxip/nvmxip.h -rename to include/nvmxip.h --- -2.39.2 - diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0042-corstone1000-enable-PSCI-reset.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0042-corstone1000-enable-PSCI-reset.patch new file mode 100644 index 0000000000..cad830f4c8 --- /dev/null +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0042-corstone1000-enable-PSCI-reset.patch @@ -0,0 +1,30 @@ +From 8bf48a56aa014146a8950532906b06e191754daa Mon Sep 17 00:00:00 2001 +From: Emekcan Aras +Date: Wed, 24 May 2023 09:12:11 +0100 +Subject: [PATCH 42/42] corstone1000: enable PSCI reset + +Even though corstone1000 does not implement entire PSCI APIs,it relies on +PSCI reset interface for the system reset. U-boot change the config name, so we +need to enable it again. + +Upstream-Status: Pending [Not submitted to upstream yet] +Signed-off-by: Emekcan Aras +--- + configs/corstone1000_defconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig +index 20359cb181..19fe1432ae 100644 +--- a/configs/corstone1000_defconfig ++++ b/configs/corstone1000_defconfig +@@ -62,6 +62,7 @@ CONFIG_DM_RTC=y + CONFIG_RTC_EMULATION=y + CONFIG_DM_SERIAL=y + CONFIG_SYSRESET=y ++CONFIG_SYSRESET_PSCI=y + CONFIG_USB=y + CONFIG_USB_ISP1760=y + CONFIG_ERRNO_STR=y +-- +2.25.1 + diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0042-corstone1000-set-kernel_addr-based-on-boot_idx.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0042-corstone1000-set-kernel_addr-based-on-boot_idx.patch deleted file mode 100644 index 547ea954a2..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0042-corstone1000-set-kernel_addr-based-on-boot_idx.patch +++ /dev/null @@ -1,133 +0,0 @@ -From d736c596f7a8446955d35bef5adae22de24ab9ab Mon Sep 17 00:00:00 2001 -From: Rui Miguel Silva -Date: Thu, 23 Feb 2023 10:35:00 +0000 -Subject: [PATCH 42/43] corstone1000: set kernel_addr based on boot_idx - -We need to distinguish between boot banks and from which -partition to load the kernel+initramfs to memory. - -For that, fetch the boot index, fetch the correspondent -partition, calculate the correct kernel address and -then set the env variable kernel_addr with that value. - -Upstream-Status: Pending -Signed-off-by: Rui Miguel Silva ---- - board/armltd/corstone1000/corstone1000.c | 58 +++++++++++++++++++++- - board/armltd/corstone1000/corstone1000.env | 8 --- - configs/corstone1000_defconfig | 1 + - 3 files changed, 58 insertions(+), 9 deletions(-) - -diff --git a/board/armltd/corstone1000/corstone1000.c b/board/armltd/corstone1000/corstone1000.c -index 0a58ccd99cdd..b767195cccb6 100644 ---- a/board/armltd/corstone1000/corstone1000.c -+++ b/board/armltd/corstone1000/corstone1000.c -@@ -5,13 +5,23 @@ - * Rui Miguel Silva - */ - -+#include - #include - #include -+#include - #include -+#include -+#include - #include - #include - #include - -+#define CORSTONE1000_KERNEL_PARTS 2 -+#define CORSTONE1000_KERNEL_PRIMARY "kernel_primary" -+#define CORSTONE1000_KERNEL_SECONDARY "kernel_secondary" -+ -+static int corstone1000_boot_idx; -+ - static struct mm_region corstone1000_mem_map[] = { - { - /* CVM */ -@@ -108,5 +118,51 @@ int dram_init_banksize(void) - - void fwu_plat_get_bootidx(int *boot_idx) - { -- *boot_idx = 0; -+ *boot_idx = corstone1000_boot_idx; -+} -+ -+int board_late_init(void) -+{ -+ struct disk_partition part_info; -+ struct udevice *dev, *bdev; -+ struct nvmxip_plat *plat; -+ struct blk_desc *desc; -+ int ret; -+ -+ ret = uclass_first_device_err(UCLASS_NVMXIP, &dev); -+ if (ret < 0) { -+ log_err("Cannot find kernel device\n"); -+ return ret; -+ } -+ -+ plat = dev_get_plat(dev); -+ device_find_first_child(dev, &bdev); -+ desc = dev_get_uclass_plat(bdev); -+ ret = fwu_get_active_index(&corstone1000_boot_idx); -+ if (ret < 0) -+ log_err("corstone1000: failed to read boot index\n"); -+ -+ if (!corstone1000_boot_idx) -+ ret = part_get_info_by_name(desc, CORSTONE1000_KERNEL_PRIMARY, -+ &part_info); -+ else -+ ret = part_get_info_by_name(desc, CORSTONE1000_KERNEL_SECONDARY, -+ &part_info); -+ -+ if (ret < 0) { -+ log_err("failed to fetch kernel partition index: %d\n", -+ corstone1000_boot_idx); -+ return ret; -+ } -+ -+ ret = 0; -+ -+ ret |= env_set_hex("kernel_addr", plat->phys_base + -+ (part_info.start * part_info.blksz)); -+ ret |= env_set_hex("kernel_size", part_info.size * part_info.blksz); -+ -+ if (ret < 0) -+ log_err("failed to setup kernel addr and size\n"); -+ -+ return ret; - } -diff --git a/board/armltd/corstone1000/corstone1000.env b/board/armltd/corstone1000/corstone1000.env -index a6ee4962211b..ee318b1b1c30 100644 ---- a/board/armltd/corstone1000/corstone1000.env -+++ b/board/armltd/corstone1000/corstone1000.env -@@ -2,12 +2,4 @@ - - usb_pgood_delay=250 - boot_bank_flag=0x08005006 --kernel_addr_bank_0=0x08280000 --kernel_addr_bank_1=0x0936E000 --retrieve_kernel_load_addr= -- if itest.l *${boot_bank_flag} == 0; then -- setenv kernel_addr $kernel_addr_bank_0; -- else -- setenv kernel_addr $kernel_addr_bank_1; -- fi; - kernel_addr_r=0x88200000 -diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig -index 96bb86ec91e9..23e9e6ae5bd3 100644 ---- a/configs/corstone1000_defconfig -+++ b/configs/corstone1000_defconfig -@@ -22,6 +22,7 @@ CONFIG_CONSOLE_RECORD=y - CONFIG_LOGLEVEL=7 - # CONFIG_DISPLAY_CPUINFO is not set - # CONFIG_DISPLAY_BOARDINFO is not set -+CONFIG_BOARD_LATE_INIT=y - CONFIG_SYS_MAXARGS=64 - CONFIG_SYS_CBSIZE=512 - # CONFIG_CMD_CONSOLE is not set --- -2.40.0 - diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0043-corstone1000-boot-index-from-active.patch b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0043-corstone1000-boot-index-from-active.patch deleted file mode 100644 index 9080ecb288..0000000000 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0043-corstone1000-boot-index-from-active.patch +++ /dev/null @@ -1,42 +0,0 @@ -From b32aee10c66a9c2a3b6b948ad957deca3391c4bf Mon Sep 17 00:00:00 2001 -From: Rui Miguel Silva -Date: Mon, 27 Feb 2023 14:40:13 +0000 -Subject: [PATCH 43/43] corstone1000: boot index from active - -In our platform, the Secure Enclave is the one who control -all the boot tries and status, so, every time we get here -we know that the we are booting from the active index. - -Upstream-Status: Pending -Signed-off-by: Rui Miguel Silva ---- - board/armltd/corstone1000/corstone1000.c | 13 ++++++++++++- - 1 file changed, 12 insertions(+), 1 deletion(-) - -diff --git a/board/armltd/corstone1000/corstone1000.c b/board/armltd/corstone1000/corstone1000.c -index 0923ca6e8c5b..e949edb79745 100644 ---- a/board/armltd/corstone1000/corstone1000.c -+++ b/board/armltd/corstone1000/corstone1000.c -@@ -118,7 +118,18 @@ int dram_init_banksize(void) - - void fwu_plat_get_bootidx(int *boot_idx) - { -- *boot_idx = corstone1000_boot_idx; -+ int ret; -+ -+ /* -+ * in our platform, the Secure Enclave is the one who control -+ * all the boot tries and status, so, every time we get here -+ * we know that the we are booting from the active index -+ */ -+ ret = fwu_get_active_index(boot_idx); -+ if (ret < 0) -+ log_err("corstone1000: failed to read active index\n"); -+ -+ return ret; - } - - int board_late_init(void) --- -2.39.2 - diff --git a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot_%.bbappend b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot_%.bbappend index 6e68a421c1..d16aca1430 100644 --- a/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot_%.bbappend +++ b/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot_%.bbappend @@ -18,49 +18,48 @@ EXTRA_OEMAKE:append:corstone1000 = ' DEVICE_TREE=${CORSTONE1000_DEVICE_TREE}' SYSROOT_DIRS:append:corstone1000 = " /boot" SRC_URI:append:corstone1000 = " \ - file://0001-arm64-smccc-add-support-for-SMCCCv1.2-x0-x17-registe.patch \ - file://0002-lib-uuid-introduce-uuid_str_to_le_bin-function.patch \ - file://0003-arm_ffa-introduce-Arm-FF-A-low-level-driver.patch \ - file://0004-arm_ffa-efi-unmap-RX-TX-buffers.patch \ - file://0005-arm_ffa-introduce-armffa-command.patch \ - file://0006-arm_ffa-introduce-the-FF-A-Sandbox-driver.patch \ - file://0007-arm_ffa-introduce-Sandbox-test-cases-for-UCLASS_FFA.patch \ - file://0008-arm_ffa-introduce-armffa-command-Sandbox-test.patch \ - file://0009-arm_ffa-efi-introduce-FF-A-MM-communication.patch \ - file://0010-arm_ffa-efi-corstone1000-enable-MM-communication.patch \ - file://0011-efi-corstone1000-introduce-EFI-capsule-update.patch \ - file://0012-arm-corstone1000-fix-unrecognized-filesystem-type.patch \ - file://0013-efi_capsule-corstone1000-pass-interface-id-and-buffe.patch \ - file://0014-efi_boottime-corstone1000-pass-interface-id-and-kern.patch \ - file://0015-efi_loader-corstone1000-remove-guid-check-from-corst.patch \ - file://0016-efi_loader-populate-ESRT-table-if-EFI_ESRT-config-op.patch \ - file://0017-efi_firmware-add-get_image_info-for-corstone1000.patch \ - file://0018-efi_loader-send-bootcomplete-message-to-secure-encla.patch \ - file://0019-efi_loader-fix-null-pointer-exception-with-get_image.patch \ - file://0020-arm-corstone1000-add-mmc-for-fvp.patch \ - file://0021-corstone1000-add-compressed-kernel-support.patch \ - file://0022-Introduce-external-sys-driver-to-device-tree.patch \ - file://0023-Add-mhu-and-rpmsg-client-to-u-boot-device-tree.patch \ - file://0024-arm-corstone1000-esrt-support.patch \ - file://0025-efi_setup-discover-FF-A-bus-before-raising-EFI-start.patch \ - file://0026-corstone1000-enable-distro-booting-command.patch \ - file://0027-drivers-nvmxip-introduce-NVM-XIP-block-storage-emula.patch \ - file://0028-sandbox64-fix-return-unsigned-long-in-readq.patch \ - file://0029-sandbox64-add-support-for-NVMXIP-QSPI.patch \ - file://0030-corstone1000-add-NVM-XIP-QSPI-device-tree-node.patch \ - file://0031-corstone1000-enable-NVM-XIP-QSPI-flash.patch \ - file://0032-sandbox64-add-a-test-case-for-UCLASS_NVMXIP.patch \ - file://0033-nvmxip-provide-a-u-boot-shell-test-command.patch \ - file://0034-corstone1000-add-fwu-metadata-store-info.patch \ - file://0035-nvmxip-shorter-block-device-name.patch \ - file://0036-efi_boottime-allow-to-reset-a-path-after-boot.patch \ - file://0037-fwu_metadata-make-sure-structures-are-packed.patch \ - file://0038-corstone1000-add-boot-index.patch \ - file://0039-corstone1000-adjust-boot-bank-and-kernel-location.patch \ - file://0040-corstone1000-add-nvmxip-fwu-mdata-and-gpt-options.patch \ - file://0041-nvmxip-move-header-to-include.patch \ - file://0042-corstone1000-set-kernel_addr-based-on-boot_idx.patch \ - file://0043-corstone1000-boot-index-from-active.patch \ + file://0001-arm64-smccc-add-support-for-SMCCCv1.2-x0-x17-registe.patch \ + file://0002-lib-uuid-introduce-uuid_str_to_le_bin-function.patch \ + file://0003-arm_ffa-introduce-Arm-FF-A-low-level-driver.patch \ + file://0004-arm_ffa-efi-unmap-RX-TX-buffers.patch \ + file://0005-arm_ffa-introduce-armffa-command.patch \ + file://0006-arm_ffa-introduce-the-FF-A-Sandbox-driver.patch \ + file://0007-arm_ffa-introduce-Sandbox-test-cases-for-UCLASS_FFA.patch \ + file://0008-arm_ffa-introduce-armffa-command-Sandbox-test.patch \ + file://0009-arm_ffa-efi-introduce-FF-A-MM-communication.patch \ + file://0010-arm_ffa-efi-corstone1000-enable-MM-communication.patch \ + file://0011-efi-corstone1000-introduce-EFI-capsule-update.patch \ + file://0012-arm-corstone1000-fix-unrecognized-filesystem-type.patch \ + file://0013-efi_capsule-corstone1000-pass-interface-id-and-buffe.patch \ + file://0014-efi_boottime-corstone1000-pass-interface-id-and-kern.patch \ + file://0015-efi_loader-corstone1000-remove-guid-check-from-corst.patch \ + file://0016-efi_loader-populate-ESRT-table-if-EFI_ESRT-config-op.patch \ + file://0017-efi_firmware-add-get_image_info-for-corstone1000.patch \ + file://0018-efi_loader-send-bootcomplete-message-to-secure-encla.patch \ + file://0019-efi_loader-fix-null-pointer-exception-with-get_image.patch \ + file://0020-arm-corstone1000-add-mmc-for-fvp.patch \ + file://0021-corstone1000-add-compressed-kernel-support.patch \ + file://0022-Introduce-external-sys-driver-to-device-tree.patch \ + file://0023-Add-mhu-and-rpmsg-client-to-u-boot-device-tree.patch \ + file://0024-arm-corstone1000-esrt-support.patch \ + file://0025-efi_setup-discover-FF-A-bus-before-raising-EFI-start.patch \ + file://0026-corstone1000-enable-distro-booting-command.patch \ + file://0027-drivers-mtd-nvmxip-introduce-NVM-XIP-block-storage-e.patch \ + file://0028-drivers-mtd-nvmxip-introduce-QSPI-XIP-driver.patch \ + file://0029-sandbox64-fix-return-unsigned-long-in-readq.patch \ + file://0030-sandbox64-add-support-for-NVMXIP-QSPI.patch \ + file://0031-corstone1000-add-NVM-XIP-QSPI-device-tree-node.patch \ + file://0032-sandbox64-add-a-test-case-for-UCLASS_NVMXIP.patch \ + file://0033-corstone1000-add-fwu-metadata-store-info.patch \ + file://0034-efi_boottime-allow-to-reset-a-path-after-boot.patch \ + file://0035-fwu_metadata-make-sure-structures-are-packed.patch \ + file://0036-corstone1000-add-boot-index.patch \ + file://0037-corstone1000-adjust-boot-bank-and-kernel-location.patch \ + file://0038-corstone1000-add-nvmxip-fwu-mdata-and-gpt-options.patch \ + file://0039-nvmxip-move-header-to-include.patch \ + file://0040-corstone1000-set-kernel_addr-based-on-boot_idx.patch \ + file://0041-corstone1000-boot-index-from-active.patch \ + file://0042-corstone1000-enable-PSCI-reset.patch \ " # -- cgit v1.2.3