]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
Merge tag 'v2023.10-rc4' into next
authorTom Rini <trini@konsulko.com>
Mon, 4 Sep 2023 14:51:58 +0000 (10:51 -0400)
committerTom Rini <trini@konsulko.com>
Mon, 4 Sep 2023 14:51:58 +0000 (10:51 -0400)
Prepare v2023.10-rc4

426 files changed:
.azure-pipelines.yml
.gitlab-ci.yml
MAINTAINERS
arch/Kconfig
arch/arc/include/asm/sections.h
arch/arc/lib/relocate.c
arch/arm/Kconfig
arch/arm/cpu/arm926ejs/mxs/mxs.c
arch/arm/cpu/arm926ejs/mxs/spl_boot.c
arch/arm/cpu/armv7/ls102xa/Kconfig
arch/arm/cpu/armv8/fsl-layerscape/Kconfig
arch/arm/cpu/armv8/fsl-layerscape/spl.c
arch/arm/cpu/armv8/start.S
arch/arm/dts/Makefile
arch/arm/dts/at91-sam9x60_curiosity-u-boot.dtsi
arch/arm/dts/at91-sam9x60_curiosity.dts
arch/arm/dts/at91-sama5d29_curiosity-u-boot.dtsi [new file with mode: 0644]
arch/arm/dts/at91-sama5d29_curiosity.dts [new file with mode: 0644]
arch/arm/dts/k3-am64-main.dtsi
arch/arm/dts/k3-am64-mcu.dtsi
arch/arm/dts/k3-am64-thermal.dtsi [new file with mode: 0644]
arch/arm/dts/k3-am64.dtsi
arch/arm/dts/k3-am642-evm-u-boot.dtsi
arch/arm/dts/k3-am642-evm.dts
arch/arm/dts/k3-am642-r5-evm.dts
arch/arm/dts/k3-am642-r5-sk.dts
arch/arm/dts/k3-am642-sk-u-boot.dtsi
arch/arm/dts/k3-am642-sk.dts
arch/arm/dts/k3-am642.dtsi
arch/arm/dts/mt7988.dtsi
arch/arm/dts/nuvoton-npcm845-evb.dts
arch/arm/dts/sam9x60.dtsi
arch/arm/dts/sam9x60ek.dts
arch/arm/include/asm/bitops.h
arch/arm/include/asm/spl.h
arch/arm/lib/Makefile
arch/arm/lib/bitops.S [new file with mode: 0644]
arch/arm/mach-at91/Kconfig
arch/arm/mach-bcm283x/init.c
arch/arm/mach-imx/Kconfig
arch/arm/mach-imx/imx8/Kconfig
arch/arm/mach-imx/imx8/cpu.c
arch/arm/mach-imx/imx8m/soc.c
arch/arm/mach-imx/imx8ulp/soc.c
arch/arm/mach-imx/imx9/soc.c
arch/arm/mach-omap2/am33xx/board.c
arch/arm/mach-omap2/hwinit-common.c
arch/arm/mach-rockchip/Kconfig
arch/arm/mach-stm32mp/boot_params.c
arch/arm/mach-sunxi/Kconfig
arch/microblaze/include/asm/processor.h
arch/mips/lib/reloc.c
arch/mips/mach-jz47xx/jz4780/jz4780.c
arch/mips/mach-mtmips/cpu.c
arch/mips/mach-mtmips/mt7621/spl/launch.c
arch/mips/mach-mtmips/mt7621/spl/spl.c
arch/mips/mach-pic32/cpu.c
arch/nios2/cpu/cpu.c
arch/powerpc/cpu/mpc8xx/Kconfig
arch/riscv/cpu/cpu.c
arch/riscv/include/asm/system.h
arch/riscv/lib/spl.c
arch/sandbox/cpu/os.c
arch/sandbox/cpu/start.c
arch/sandbox/dts/sandbox.dtsi
arch/sandbox/dts/test.dts
arch/x86/cpu/baytrail/cpu.c
arch/x86/cpu/broadwell/cpu.c
arch/x86/cpu/coreboot/coreboot.c
arch/x86/cpu/cpu.c
arch/x86/cpu/efi/payload.c
arch/x86/cpu/ivybridge/cpu.c
arch/x86/cpu/quark/quark.c
arch/x86/include/asm/sections.h
arch/x86/include/asm/zimage.h
arch/x86/lib/fsp1/fsp_common.c
arch/x86/lib/fsp2/fsp_common.c
arch/x86/lib/fsp2/fsp_init.c
arch/x86/lib/relocate.c
arch/x86/lib/spl.c
arch/x86/lib/zimage.c
arch/xtensa/lib/relocate.c
board/CZ.NIC/turris_mox/turris_mox.c
board/Marvell/mvebu_armada-37xx/board.c
board/Marvell/octeon_nic23/board.c
board/Marvell/octeontx2/board.c
board/advantech/imx8qm_dmsse20_a1/spl.c
board/advantech/imx8qm_rom7720_a1/spl.c
board/amlogic/vim3/vim3.c
board/aristainetos/aristainetos.c
board/atmel/sam9x60_curiosity/sam9x60_curiosity.c
board/atmel/sama5d29_curiosity/Kconfig [new file with mode: 0644]
board/atmel/sama5d29_curiosity/MAINTAINERS [new file with mode: 0644]
board/atmel/sama5d29_curiosity/Makefile [new file with mode: 0644]
board/atmel/sama5d29_curiosity/sama5d29_curiosity.c [new file with mode: 0644]
board/beacon/imx8mm/spl.c
board/beacon/imx8mn/spl.c
board/bosch/acc/acc.c
board/bsh/imx8mn_smm_s2/spl.c
board/cloos/imx8mm_phg/spl.c
board/compulab/cl-som-imx7/spl.c
board/compulab/imx8mm-cl-iot-gate/spl.c
board/congatec/cgtqmx8/spl.c
board/cortina/presidio-asic/presidio.c
board/dhelectronics/dh_imx6/dh_imx6_spl.c
board/dhelectronics/dh_imx8mp/spl.c
board/emulation/qemu-arm/Kconfig
board/emulation/qemu-arm/qemu-arm.c
board/emulation/qemu-arm/qemu-arm.env
board/emulation/qemu-ppce500/qemu-ppce500.c
board/engicam/imx8mm/spl.c
board/freescale/imx8mm_evk/spl.c
board/freescale/imx8mn_evk/spl.c
board/freescale/imx8mq_evk/spl.c
board/freescale/imx8qm_mek/spl.c
board/freescale/imx8qxp_mek/spl.c
board/freescale/imx8ulp_evk/spl.c
board/freescale/imx93_evk/spl.c
board/freescale/ls1021aiot/ls1021aiot.c
board/freescale/ls1021aqds/ls1021aqds.c
board/freescale/ls1021atsn/ls1021atsn.c
board/freescale/ls1021atwr/ls1021atwr.c
board/freescale/ls1088a/ls1088a.c
board/freescale/lx2160a/lx2160a.c
board/freescale/mx6sabreauto/mx6sabreauto.c
board/freescale/mx6sabresd/mx6sabresd.c
board/freescale/mx6slevk/mx6slevk.c
board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
board/gateworks/venice/spl.c
board/gdsys/a38x/controlcenterdc.c
board/gdsys/mpc8308/gazerbeam.c
board/ge/bx50v3/bx50v3.c
board/google/chromebook_coral/coral.c
board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c
board/keymile/km83xx/km83xx.c
board/keymile/kmcent2/kmcent2.c
board/keymile/pg-wcom-ls102xa/pg-wcom-ls102xa.c
board/kontron/pitx_imx8m/spl.c
board/kontron/sl-mx6ul/spl.c
board/kontron/sl-mx8mm/spl.c
board/liebherr/display5/spl.c
board/mntre/imx8mq_reform2/spl.c
board/phytec/pcm058/pcm058.c
board/phytec/phycore_imx8mm/spl.c
board/phytium/durian/durian.c
board/phytium/pomelo/pomelo.c
board/ronetix/imx7-cm/spl.c
board/ronetix/imx8mq-cm/spl.c
board/sandbox/capsule_priv_key_bad.key [new file with mode: 0644]
board/sandbox/capsule_priv_key_good.key [new file with mode: 0644]
board/sandbox/capsule_pub_esl_good.esl [new file with mode: 0644]
board/sandbox/capsule_pub_key_bad.crt [new file with mode: 0644]
board/sandbox/capsule_pub_key_good.crt [new file with mode: 0644]
board/siemens/capricorn/spl.c
board/sifive/unleashed/unleashed.c
board/sifive/unmatched/unmatched.c
board/softing/vining_2000/vining_2000.c
board/solidrun/mx6cuboxi/mx6cuboxi.c
board/starfive/visionfive2/spl.c
board/starfive/visionfive2/starfive_visionfive2.c
board/sunxi/board.c
board/technexion/pico-imx6ul/spl.c
board/technexion/pico-imx7d/spl.c
board/technexion/pico-imx8mq/spl.c
board/ti/am64x/evm.c
board/toradex/apalis_imx6/apalis_imx6.c
board/toradex/colibri_imx6/colibri_imx6.c
board/toradex/verdin-imx8mm/spl.c
board/udoo/neo/neo.c
board/variscite/dart_6ul/spl.c
board/variscite/imx8mn_var_som/spl.c
board/xilinx/common/board.c
boot/Kconfig
boot/android_ab.c
boot/bootdev-uclass.c
boot/bootflow.c
boot/bootm.c
boot/bootmeth-uclass.c
boot/bootmeth_cros.c
boot/bootmeth_cros.h [new file with mode: 0644]
boot/cedit.c
boot/expo.c
boot/expo_build.c
boot/pxe_utils.c
boot/scene.c
boot/scene_internal.h
boot/scene_menu.c
boot/vbe_request.c
boot/vbe_simple_os.c
cmd/Kconfig
cmd/bootflow.c
cmd/cedit.c
cmd/gpt.c
cmd/mux.c
cmd/nvedit_efi.c
cmd/pxe.c
cmd/setexpr.c
cmd/tpm_test.c
common/Kconfig
common/board_f.c
common/board_r.c
common/bouncebuf.c
common/event.c
common/hash.c
common/spl/Kconfig
common/spl/Kconfig.tpl
common/spl/spl_mmc.c
common/spl/spl_semihosting.c
configs/am335x_guardian_defconfig
configs/apple_m1_defconfig
configs/bayleybay_defconfig
configs/cherryhill_defconfig
configs/chromebook_coral_defconfig
configs/chromebook_link64_defconfig
configs/chromebook_link_defconfig
configs/chromebook_samus_defconfig
configs/chromebook_samus_tpl_defconfig
configs/chromebox_panther_defconfig
configs/conga-qeval20-qa3-e3845-internal-uart_defconfig
configs/conga-qeval20-qa3-e3845_defconfig
configs/coreboot64_defconfig
configs/coreboot_defconfig
configs/cougarcanyon2_defconfig
configs/crownbay_defconfig
configs/dfi-bt700-q7x-151_defconfig
configs/edison_defconfig
configs/efi-x86_app32_defconfig
configs/efi-x86_app64_defconfig
configs/efi-x86_payload32_defconfig
configs/efi-x86_payload64_defconfig
configs/evb-rk3229_defconfig
configs/evb-rk3308_defconfig
configs/galileo_defconfig
configs/imx6q_logic_defconfig
configs/imx8mm_data_modul_edm_sbc_defconfig
configs/imx8mn_beacon_2g_defconfig
configs/imx8mn_beacon_defconfig
configs/imx8mn_beacon_fspi_defconfig
configs/imx8mp_beacon_defconfig
configs/imx8mp_data_modul_edm_sbc_defconfig
configs/imx8mp_dhcom_pdk2_defconfig
configs/imx8mp_dhcom_pdk3_defconfig
configs/j7200_evm_a72_defconfig
configs/kontron_sl28_defconfig
configs/lion-rk3368_defconfig
configs/minnowmax_defconfig
configs/qemu-x86_64_defconfig
configs/qemu-x86_defconfig
configs/qemu_arm64_defconfig
configs/qemu_arm_defconfig
configs/roc-cc-rk3308_defconfig
configs/rock-pi-s-rk3308_defconfig
configs/sam9x60_curiosity_mmc1_defconfig
configs/sam9x60_curiosity_mmc_defconfig
configs/sam9x60ek_mmc_defconfig
configs/sam9x60ek_nandflash_defconfig
configs/sam9x60ek_qspiflash_defconfig
configs/sama5d29_curiosity_mmc1_defconfig [new file with mode: 0644]
configs/sama5d29_curiosity_mmc_defconfig [new file with mode: 0644]
configs/sama5d29_curiosity_qspiflash_defconfig [new file with mode: 0644]
configs/sandbox64_defconfig
configs/sandbox_defconfig
configs/sandbox_flattree_defconfig
configs/sandbox_noinst_defconfig
configs/sandbox_spl_defconfig
configs/sandbox_vpl_defconfig
configs/snow_defconfig
configs/som-db5800-som-6867_defconfig
configs/theadorable-x86-conga-qa3-e3845-pcie-x4_defconfig
configs/theadorable-x86-conga-qa3-e3845_defconfig
configs/theadorable-x86-dfi-bt700_defconfig
configs/xilinx_versal_net_virt_defconfig
configs/xilinx_zynqmp_virt_defconfig
disk/disk-uclass.c
disk/part.c
disk/part_amiga.c
disk/part_dos.c
disk/part_efi.c
disk/part_iso.c
disk/part_mac.c
doc/board/emulation/qemu-arm.rst
doc/board/ti/am64x_evm.rst [new file with mode: 0644]
doc/board/ti/img/boot_diagram_am64.svg [new file with mode: 0644]
doc/board/ti/k3.rst
doc/develop/bootstd.rst
doc/develop/cedit.rst [new file with mode: 0644]
doc/develop/event.rst
doc/develop/expo.rst
doc/develop/index.rst
doc/develop/uefi/uefi.rst
doc/usage/cmd/bootflow.rst
doc/usage/cmd/cedit.rst
drivers/adc/adc-uclass.c
drivers/block/Kconfig
drivers/block/blk-uclass.c
drivers/core/device.c
drivers/core/ofnode.c
drivers/cpu/microblaze_cpu.c
drivers/ddr/imx/phy/helper.c
drivers/dma/ti/k3-psil-j721e.c
drivers/fastboot/Kconfig
drivers/fastboot/fb_getvar.c
drivers/gpio/gpio-uclass.c
drivers/gpio/pca953x_gpio.c
drivers/i2c/Kconfig
drivers/misc/Kconfig
drivers/misc/cros_ec.c
drivers/mmc/dw_mmc.c
drivers/mmc/mmc.c
drivers/mtd/nand/raw/atmel/nand-controller.c
drivers/mtd/nvmxip/nvmxip-uclass.c
drivers/mtd/nvmxip/nvmxip.c
drivers/mtd/nvmxip/nvmxip_qspi.c
drivers/net/ti/am65-cpsw-nuss.c
drivers/pci/Kconfig
drivers/pci/Makefile
drivers/pci/pci-uclass.c
drivers/pci/pci_ftpci100.c [new file with mode: 0644]
drivers/pci/pcie_brcmstb.c
drivers/phy/Kconfig
drivers/phy/Makefile
drivers/phy/phy-apple-atc.c [new file with mode: 0644]
drivers/phy/ti/phy-j721e-wiz.c
drivers/remoteproc/rproc-uclass.c
drivers/scsi/scsi.c
drivers/serial/Kconfig
drivers/serial/serial-uclass.c
drivers/ufs/cdns-platform.c
drivers/ufs/ufs.c
drivers/ufs/ufs.h
drivers/usb/gadget/Kconfig
drivers/usb/host/dwc2.c
drivers/usb/host/ehci-generic.c
drivers/video/Kconfig
env/Kconfig
fs/btrfs/inode.c
fs/btrfs/subvolume.c
fs/cramfs/cramfs.c
fs/fat/fat.c
fs/fat/fat_write.c
include/abuf.h
include/asm-generic/bitops/builtin-__ffs.h [new file with mode: 0644]
include/asm-generic/bitops/builtin-__fls.h [new file with mode: 0644]
include/asm-generic/bitops/builtin-ffs.h [new file with mode: 0644]
include/asm-generic/bitops/builtin-fls.h [new file with mode: 0644]
include/asm-generic/gpio.h
include/asm-generic/sections.h
include/blk.h
include/bootflow.h
include/bootm.h
include/bootmeth.h
include/cedit.h [new file with mode: 0644]
include/configs/sama5d29_curiosity.h [new file with mode: 0644]
include/event.h
include/expo.h
include/init.h
include/initcall.h
include/nvmxip.h
include/os.h
include/part.h
include/part_efi.h
include/sandbox_efi_capsule.h [new file with mode: 0644]
include/scsi.h
include/uuid.h
include/video.h
lib/Kconfig
lib/Makefile
lib/abuf.c
lib/charset.c
lib/crc32.c
lib/efi_loader/Kconfig
lib/efi_loader/capsule_esl.dtsi.in [new file with mode: 0644]
lib/fdtdec.c
lib/fwu_updates/fwu.c
lib/initcall.c [new file with mode: 0644]
lib/string.c
lib/trace.c
lib/uuid.c
net/net.c
scripts/Makefile.lib
scripts/event_dump.py
scripts/kconfig/Makefile
test/boot/Makefile
test/boot/bootflow.c
test/boot/cedit.c [new file with mode: 0644]
test/boot/expo.c
test/boot/files/expo_ids.h [new file with mode: 0644]
test/boot/files/expo_layout.dts
test/cmd_ut.c
test/common/event.c
test/dm/acpi.c
test/dm/fwu_mdata.c
test/dm/host.c
test/dm/nvmxip.c
test/lib/abuf.c
test/lib/asn1.c
test/lib/strlcat.c
test/py/tests/fs_helper.py
test/py/tests/test_efi_capsule/capsule_gen_binman.dts [new file with mode: 0644]
test/py/tests/test_efi_capsule/conftest.py
test/py/tests/test_efi_capsule/signature.dts [deleted file]
test/py/tests/test_efi_capsule/uboot_bin_env.its [deleted file]
test/py/tests/test_event_dump.py
test/py/tests/test_semihosting/conftest.py [new file with mode: 0644]
test/py/tests/test_semihosting/test_hostfs.py [new file with mode: 0644]
test/py/tests/test_trace.py
test/py/tests/test_ut.py
test/unicode_ut.c
tools/binman/bintool.py
tools/binman/btool/mkeficapsule.py [new file with mode: 0644]
tools/binman/entries.rst
tools/binman/etype/efi_capsule.py [new file with mode: 0644]
tools/binman/ftest.py
tools/binman/test/311_capsule.dts [new file with mode: 0644]
tools/binman/test/312_capsule_signed.dts [new file with mode: 0644]
tools/binman/test/313_capsule_version.dts [new file with mode: 0644]
tools/binman/test/314_capsule_signed_ver.dts [new file with mode: 0644]
tools/binman/test/315_capsule_oemflags.dts [new file with mode: 0644]
tools/binman/test/316_capsule_missing_key.dts [new file with mode: 0644]
tools/binman/test/317_capsule_missing_index.dts [new file with mode: 0644]
tools/binman/test/318_capsule_missing_guid.dts [new file with mode: 0644]
tools/buildman/toolchain.py
tools/default_image.c
tools/docker/Dockerfile
tools/expo.py
tools/image-host.c

index 0304be8a60ffa82b4d240e8c78642665a301dd73..d137d71dd5bcd0aaa820ace68a2c75520f291aa7 100644 (file)
@@ -2,7 +2,7 @@ variables:
   windows_vm: windows-2019
   ubuntu_vm: ubuntu-22.04
   macos_vm: macOS-12
-  ci_runner_image: trini/u-boot-gitlab-ci-runner:jammy-20230624-20Jul2023
+  ci_runner_image: trini/u-boot-gitlab-ci-runner:jammy-20230804-25Aug2023
   # Add '-u 0' options for Azure pipelines, otherwise we get "permission
   # denied" error when it tries to "useradd -m -u 1001 vsts_azpcontainer",
   # since our $(ci_runner_image) user is not root.
@@ -163,10 +163,10 @@ stages:
           . /tmp/venv/bin/activate
           pip install -r test/py/requirements.txt
           pip install -r tools/buildman/requirements.txt
-          export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl
+          export UBOOT_TRAVIS_BUILD_DIR=/tmp/tools-only
           export PYTHONPATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt
           export PATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}
-          ./tools/buildman/buildman -T0 -o ${UBOOT_TRAVIS_BUILD_DIR} -w --board sandbox_spl
+          ./tools/buildman/buildman -T0 -o ${UBOOT_TRAVIS_BUILD_DIR} -w --board tools-only
           set -ex
           ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test
           ./tools/buildman/buildman -t
@@ -195,7 +195,7 @@ stages:
           ln -s /opt/nokia/libc6_2.5.1-1eglibc27+0m5_armel.deb nokia_rx51_tmp/
           ln -s /opt/nokia/busybox_1.10.2.legal-1osso30+0m5_armel.deb nokia_rx51_tmp/
           ln -s /opt/nokia/qemu-system-arm nokia_rx51_tmp/
-          export PATH=/opt/gcc-13.1.0-nolibc/arm-linux-gnueabi/bin:$PATH
+          export PATH=/opt/gcc-13.2.0-nolibc/arm-linux-gnueabi/bin:$PATH
           test/nokia_rx51_test.sh
 
   - job: pylint
@@ -215,8 +215,8 @@ stages:
           export PATH=${PATH}:~/.local/bin
           echo "[MASTER]" >> .pylintrc
           echo "load-plugins=pylint.extensions.docparams" >> .pylintrc
-          export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl
-          ./tools/buildman/buildman -T0 -o ${UBOOT_TRAVIS_BUILD_DIR} -w --board sandbox_spl
+          export UBOOT_TRAVIS_BUILD_DIR=/tmp/tools-only
+          ./tools/buildman/buildman -T0 -o ${UBOOT_TRAVIS_BUILD_DIR} -w --board tools-only
           set -ex
           pylint --version
           export PYTHONPATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt
@@ -275,7 +275,7 @@ stages:
           TEST_PY_BD: "sandbox"
           BUILD_ENV: "FTRACE=1 NO_LTO=1"
           TEST_PY_TEST_SPEC: "trace"
-          OVERRIDE: "-a CONFIG_TRACE=y -a CONFIG_TRACE_EARLY=y -a CONFIG_TRACE_EARLY_SIZE=0x01000000"
+          OVERRIDE: "-a CONFIG_TRACE=y -a CONFIG_TRACE_EARLY=y -a CONFIG_TRACE_EARLY_SIZE=0x01000000 -a CONFIG_TRACE_BUFFER_SIZE=0x02000000"
         coreboot:
           TEST_PY_BD: "coreboot"
           TEST_PY_ID: "--id qemu"
index 1df13261c2d2b3bb23c8e7f2d7ed151f1529f579..6d7ffdd1bbc7338d910d5c4016e117ddecb20a15 100644 (file)
@@ -10,7 +10,7 @@ default:
 
 # Grab our configured image.  The source for this is found
 # in the u-boot tree at tools/docker/Dockerfile
-image: ${MIRROR_DOCKER}/trini/u-boot-gitlab-ci-runner:jammy-20230624-20Jul2023
+image: ${MIRROR_DOCKER}/trini/u-boot-gitlab-ci-runner:jammy-20230804-25Aug2023
 
 # We run some tests in different order, to catch some failures quicker.
 stages:
@@ -212,12 +212,12 @@ Run binman, buildman, dtoc, Kconfig and patman testsuites:
       . /tmp/venv/bin/activate;
       pip install -r test/py/requirements.txt;
       pip install -r tools/buildman/requirements.txt;
-      export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl;
+      export UBOOT_TRAVIS_BUILD_DIR=/tmp/tools-only;
       export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt";
       export PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}";
       set +e;
       ./tools/buildman/buildman -T0 -o ${UBOOT_TRAVIS_BUILD_DIR} -w
-        --board sandbox_spl;
+        --board tools-only;
       set -e;
       ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test;
       ./tools/buildman/buildman -t;
@@ -235,7 +235,7 @@ Run tests for Nokia RX-51 (aka N900):
       ln -s /opt/nokia/libc6_2.5.1-1eglibc27+0m5_armel.deb nokia_rx51_tmp/;
       ln -s /opt/nokia/busybox_1.10.2.legal-1osso30+0m5_armel.deb nokia_rx51_tmp/;
       ln -s /opt/nokia/qemu-system-arm nokia_rx51_tmp/;
-      export PATH=/opt/gcc-13.1.0-nolibc/arm-linux-gnueabi/bin:$PATH;
+      export PATH=/opt/gcc-13.2.0-nolibc/arm-linux-gnueabi/bin:$PATH;
       test/nokia_rx51_test.sh
 
 # Check for any pylint regressions
@@ -249,10 +249,10 @@ Run pylint:
     - export PATH=${PATH}:~/.local/bin
     - echo "[MASTER]" >> .pylintrc
     - echo "load-plugins=pylint.extensions.docparams" >> .pylintrc
-    - export UBOOT_TRAVIS_BUILD_DIR=/tmp/sandbox_spl
+    - export UBOOT_TRAVIS_BUILD_DIR=/tmp/tools-only
     - set +e
     - ./tools/buildman/buildman -T0 -o ${UBOOT_TRAVIS_BUILD_DIR} -w
-        --board sandbox_spl
+        --board tools-only
     - set -e
     - pylint --version
     - export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt"
@@ -315,7 +315,7 @@ sandbox trace_test.py:
     TEST_PY_BD: "sandbox"
     BUILD_ENV: "FTRACE=1 NO_LTO=1"
     TEST_PY_TEST_SPEC: "trace"
-    OVERRIDE: "-a CONFIG_TRACE=y -a CONFIG_TRACE_EARLY=y -a CONFIG_TRACE_EARLY_SIZE=0x01000000"
+    OVERRIDE: "-a CONFIG_TRACE=y -a CONFIG_TRACE_EARLY=y -a CONFIG_TRACE_EARLY_SIZE=0x01000000 -a CONFIG_TRACE_BUFFER_SIZE=0x02000000"
   <<: *buildman_and_testpy_dfn
 
 evb-ast2500 test.py:
index 17309e25f2846230ee651250bc18fccfaa21656a..536df4a8962ea7c018896a209f6d324210b6af2f 100644 (file)
@@ -123,6 +123,7 @@ F:  configs/apple_m1_defconfig
 F:     drivers/iommu/apple_dart.c
 F:     drivers/nvme/nvme_apple.c
 F:     drivers/pci/pcie_apple.c
+F:     drivers/phy/phy-apple-atc.c
 F:     drivers/pinctrl/pinctrl-apple.c
 F:     drivers/watchdog/apple_wdt.c
 F:     include/configs/apple.h
index c9a3359225288bb08bbcc7c54e39457c19630efc..90345cbee0d848397a4b8a189adc605c8b046036 100644 (file)
@@ -252,6 +252,7 @@ config X86
        imply DM_SPI
        imply DM_SPI_FLASH
        imply DM_USB
+       imply LAST_STAGE_INIT
        imply VIDEO
        imply SYSRESET
        imply SPL_SYSRESET
index 1c9c9db13868e30ad640b073607c7afa4f4b57f2..ffad4a684ef6668ee24f3c4783b6d09722a033cd 100644 (file)
@@ -8,7 +8,8 @@
 
 #include <asm-generic/sections.h>
 
-extern ulong __ivt_start;
-extern ulong __ivt_end;
+extern char __ivt_start[];
+extern char __ivt_end[];
+extern char __text_end[];
 
 #endif /* __ASM_ARC_SECTIONS_H */
index 7f531c95eec654cd11b484cbd963b25b2a61d148..fd6f4fbc9304c326063ff143d18f02033ea5f5fa 100644 (file)
@@ -6,32 +6,27 @@
 #include <common.h>
 #include <elf.h>
 #include <log.h>
-#include <asm-generic/sections.h>
+#include <asm/sections.h>
 #include <asm/global_data.h>
 
-extern ulong __image_copy_start;
-extern ulong __ivt_start;
-extern ulong __ivt_end;
-extern ulong __text_end;
-
 DECLARE_GLOBAL_DATA_PTR;
 
 int copy_uboot_to_ram(void)
 {
-       size_t len = (size_t)&__image_copy_end - (size_t)&__image_copy_start;
+       size_t len = (size_t)__image_copy_end - (size_t)__image_copy_start;
 
        if (gd->flags & GD_FLG_SKIP_RELOC)
                return 0;
 
-       memcpy((void *)gd->relocaddr, (void *)&__image_copy_start, len);
+       memcpy((void *)gd->relocaddr, (void *)__image_copy_start, len);
 
        return 0;
 }
 
 int clear_bss(void)
 {
-       ulong dst_addr = (ulong)&__bss_start + gd->reloc_off;
-       size_t len = (size_t)&__bss_end - (size_t)&__bss_start;
+       ulong dst_addr = (ulong)__bss_start + gd->reloc_off;
+       size_t len = (size_t)__bss_end - (size_t)__bss_start;
 
        memset((void *)dst_addr, 0x00, len);
 
@@ -43,8 +38,8 @@ int clear_bss(void)
  */
 int do_elf_reloc_fixups(void)
 {
-       Elf32_Rela *re_src = (Elf32_Rela *)(&__rel_dyn_start);
-       Elf32_Rela *re_end = (Elf32_Rela *)(&__rel_dyn_end);
+       Elf32_Rela *re_src = (Elf32_Rela *)__rel_dyn_start;
+       Elf32_Rela *re_end = (Elf32_Rela *)__rel_dyn_end;
 
        if (gd->flags & GD_FLG_SKIP_RELOC)
                return 0;
@@ -60,8 +55,8 @@ int do_elf_reloc_fixups(void)
                offset_ptr_rom = (Elf32_Addr *)re_src->r_offset;
 
                /* Check that the location of the relocation is in .text */
-               if (offset_ptr_rom >= (Elf32_Addr *)&__image_copy_start &&
-                   offset_ptr_rom < (Elf32_Addr *)&__image_copy_end) {
+               if (offset_ptr_rom >= (Elf32_Addr *)__image_copy_start &&
+                   offset_ptr_rom < (Elf32_Addr *)__image_copy_end) {
                        unsigned int val, do_swap = 0;
                        /* Switch to the in-RAM version */
                        offset_ptr_ram = (Elf32_Addr *)((ulong)offset_ptr_rom +
@@ -69,11 +64,11 @@ int do_elf_reloc_fixups(void)
 
 #ifdef __LITTLE_ENDIAN__
                        /* If location in ".text" section swap value */
-                       if (((u32)offset_ptr_rom >= (u32)&__text_start &&
-                            (u32)offset_ptr_rom <= (u32)&__text_end)
+                       if (((u32)offset_ptr_rom >= (u32)__text_start &&
+                            (u32)offset_ptr_rom <= (u32)__text_end)
 #if defined(__ARC700__) || defined(__ARC600__)
-                           || ((u32)offset_ptr_rom >= (u32)&__ivt_start &&
-                               (u32)offset_ptr_rom <= (u32)&__ivt_end)
+                           || ((u32)offset_ptr_rom >= (u32)__ivt_start &&
+                               (u32)offset_ptr_rom <= (u32)__ivt_end)
 #endif
                           )
                                do_swap = 1;
@@ -96,8 +91,8 @@ int do_elf_reloc_fixups(void)
                                val = (val << 16) | (val >> 16);
 
                        /* Check that the target points into executable */
-                       if (val < (unsigned int)&__image_copy_start ||
-                           val > (unsigned int)&__image_copy_end) {
+                       if (val < (unsigned int)__image_copy_start ||
+                           val > (unsigned int)__image_copy_end) {
                                /* TODO: Use panic() instead of debug()
                                 *
                                 * For some reason GCC might generate
@@ -106,7 +101,7 @@ int do_elf_reloc_fixups(void)
                                 * ----------------------->8--------------------
                                 * static int setup_mon_len(void)
                                 * {
-                                *         gd->mon_len = (ulong)&__bss_end - CONFIG_SYS_MONITOR_BASE;
+                                *         gd->mon_len = (ulong)__bss_end - CONFIG_SYS_MONITOR_BASE;
                                 *         return 0;
                                 * }
                                 * ----------------------->8--------------------
index 97c25b4f146d8d7d822c736c8160b393f7223959..71f820e443bb7ce159677fda8316bf9fdf46ff83 100644 (file)
@@ -998,6 +998,7 @@ config ARCH_APPLE
        select OF_BOARD_SETUP
        select OF_CONTROL
        select PCI
+       select PHY
        select PINCTRL
        select POSITION_INDEPENDENT
        select POWER_DOMAIN
@@ -1036,6 +1037,16 @@ config ARCH_QEMU
        imply DM_RTC
        imply RTC_PL031
        imply OF_HAS_PRIOR_STAGE
+       imply VIDEO
+       imply VIDEO_BOCHS
+       imply SYS_WHITE_ON_BLACK
+       imply SYS_CONSOLE_IS_IN_ENV
+       imply PRE_CONSOLE_BUFFER
+       imply USB
+       imply USB_XHCI_HCD
+       imply USB_XHCI_PCI
+       imply USB_KEYBOARD
+       imply CMD_USB
 
 config ARCH_RMOBILE
        bool "Renesas ARM SoCs"
index 4d21e3df76eca374609932e2f80d5b875b07c576..6d6166cb839f485a157e9718544bc72b2b7804da 100644 (file)
@@ -100,7 +100,7 @@ int arch_cpu_init(void)
        struct mxs_clkctrl_regs *clkctrl_regs =
                (struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE;
 
-       mx28_fixup_vt((uint32_t)&_start);
+       mx28_fixup_vt((uint32_t)_start);
 
        /*
         * Enable NAND clock
index 5598c552ab9b33f1d3cd4b3b0bc6c5f44619a517..5e7bdb78be1d4880598382fbbf9f1321d17078ac 100644 (file)
@@ -103,7 +103,7 @@ static void mxs_spl_fixup_vectors(void)
         */
 
        /* cppcheck-suppress nullPointer */
-       memcpy(0x0, &_start, 0x60);
+       memcpy(0x0, _start, 0x60);
 }
 
 static void mxs_spl_console_init(void)
index 3e292bf70e18daba15591d992e59a888da75573b..46ace7e5fd68d65e887dbeda665966598fcd207a 100644 (file)
@@ -98,7 +98,6 @@ config SYS_FSL_ERRATUM_A008407
 
 config SYS_FSL_QSPI_SKIP_CLKSEL
        bool "Skip setting QSPI clock during SoC init"
-       default 0
        help
           To improve startup times when booting from QSPI flash, the QSPI
           frequency can be set very early in the boot process. If this option
index a8b493e2f8753e77144d69c569c6aa0d7ed8df13..d46934c2dcff427e05b6863f47115dcc014e83e0 100644 (file)
@@ -739,7 +739,7 @@ config HAS_FSL_XHCI_USB
 config SYS_FSL_BOOTROM_BASE
        hex
        depends on FSL_LSCH2
-       default 0
+       default 0x0
 
 config SYS_FSL_BOOTROM_SIZE
        hex
index 61fced451eb5d28a194303f78dc595b49d1381d7..033f48d04b907f518f47543c2a319b0169f41fd6 100644 (file)
@@ -78,6 +78,11 @@ void tzpc_init(void)
 #endif
 }
 
+__weak int init_func_vid(void)
+{
+       return 0;
+}
+
 void board_init_f(ulong dummy)
 {
        int ret;
index f3ea8585770d461fecbc08cf7bd88f1256e518b7..6cc1d26e5e2da2571214610d0fbb65ad9451cb8e 100644 (file)
@@ -58,7 +58,7 @@ reset:
 .globl save_boot_params_ret
 save_boot_params_ret:
 
-#if CONFIG_POSITION_INDEPENDENT
+#if CONFIG_POSITION_INDEPENDENT && !defined(CONFIG_SPL_BUILD)
        /* Verify that we're 4K aligned.  */
        adr     x0, _start
        ands    x0, x0, #0xfff
index 85fd5b1157b19a14a2ee908f1c62ce1e99c241c1..928511c62b204cb63cb9bd654e4d2be7d36a67b9 100644 (file)
@@ -1201,6 +1201,9 @@ dtb-$(CONFIG_TARGET_SAMA5D27_WLSOM1_EK) += \
 dtb-$(CONFIG_TARGET_SAMA5D2_ICP) += \
        at91-sama5d2_icp.dtb
 
+dtb-$(CONFIG_TARGET_SAMA5D29_CURIOSITY) += \
+       at91-sama5d29_curiosity.dtb
+
 dtb-$(CONFIG_TARGET_SAMA5D3XEK) += \
        sama5d31ek.dtb \
        sama5d33ek.dtb \
index 0c3c0406b453c73851e66dc1231eca08065cad4e..dd4623311c9df6004c1715d406d3873bbcc254b5 100644 (file)
 
                apb {
                        bootph-all;
-
-                       pinctrl {
-                               bootph-all;
-                       };
                };
        };
 
        chosen {
                bootph-all;
        };
+
+       config {
+               u-boot,boot-led = "blue";
+       };
+
+       leds {
+               led-red {
+                       default-state = "off";
+               };
+
+               led-green {
+                       default-state = "off";
+               };
+
+               led-blue {
+                       default-state = "off";
+               };
+       };
 };
 
 &clk32 {
        bootph-all;
 };
 
+&pinctrl {
+       bootph-all;
+};
+
 &pinctrl_dbgu {
        bootph-all;
 };
index d6ae3d648daf92a3173a89f74d8c81c42b6dd88c..99867d2bf8e65d73b5ecb1252df6a171e04a9bf6 100644 (file)
@@ -7,64 +7,23 @@
  * Author: Durai Manickam KR <durai.manickamkr@microchip.com>
  */
 /dts-v1/;
+#include <dt-bindings/input/input.h>
 #include <dt-bindings/mfd/atmel-flexcom.h>
 #include "sam9x60.dtsi"
 
 / {
-       model = "Microchip SAM9X60 CURIOSITY";
+       model = "Microchip SAM9X60 Curiosity";
        compatible = "microchip,sam9x60-curiosity", "microchip,sam9x60", "atmel,at91sam9";
 
-       ahb {
-               apb {
-                       flx0: flexcom@f801c600 {
-                               atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_TWI>;
-                               status = "okay";
-
-                               i2c@600 {
-                                       compatible = "atmel,sama5d2-i2c";
-                                       reg = <0x600 0x200>;
-                                       pinctrl-names = "default";
-                                       pinctrl-0 = <&pinctrl_flx0>;
-                                       #address-cells = <1>;
-                                       #size-cells = <0>;
-                                       clocks = <&pmc PMC_TYPE_PERIPHERAL 5>;
-                                       status = "okay";
-
-                                       eeprom@53 {
-                                               compatible = "atmel,24c32";
-                                               reg = <0x53>;
-                                               pagesize = <16>;
-                                       };
-                               };
-                       };
-
-                       pinctrl {
-                                       pinctrl_flx0: flx0_default {
-                                               atmel,pins =
-                                                       <AT91_PIOA 0 AT91_PERIPH_A AT91_PINCTRL_NONE
-                                                        AT91_PIOA 1 AT91_PERIPH_A AT91_PINCTRL_NONE>;
-                                       };
-
-                                       pinctrl_onewire_tm_default: onewire_tm_default {
-                                               atmel,pins =
-                                                       <AT91_PIOD 14 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP>;
-                                       };
-
-                                       usb1 {
-                                               pinctrl_usb_default: usb_default {
-                                                       atmel,pins = <AT91_PIOD 15 AT91_PERIPH_GPIO AT91_PINCTRL_NONE
-                                                                       AT91_PIOD 18 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
-                                               };
-                                       };
-                       };
-               };
-       };
-
        chosen {
                stdout-path = &dbgu;
                i2c0 = &flx0;
        };
 
+       memory {
+               reg = <0x20000000 0x8000000>;
+       };
+
        clocks {
                slow_xtal: slow_xtal {
                        clock-frequency = <32768>;
                };
        };
 
-       memory {
-               reg = <0x20000000 0x8000000>;
+       gpio-keys {
+               compatible = "gpio-keys";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_key_gpio_default>;
+
+               button-user {
+                       label = "PB_USER";
+                       gpios = <&pioA 29 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_PROG1>;
+                       wakeup-source;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_gpio_leds>;
+
+               led-red {
+                       label = "red";
+                       gpios = <&pioD 17 GPIO_ACTIVE_HIGH>;
+               };
+
+               led-green {
+                       label = "green";
+                       gpios = <&pioD 19 GPIO_ACTIVE_HIGH>;
+               };
+
+               led-blue {
+                       label = "blue";
+                       gpios = <&pioD 21 GPIO_ACTIVE_HIGH>;
+                       linux,default-trigger = "heartbeat";
+               };
        };
 
        onewire_tm: onewire {
        };
 };
 
+&ebi {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ebi_addr_nand &pinctrl_ebi_data_0_7>;
+       status = "okay";
+
+       nand_controller: nand-controller {
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_nand_oe_we &pinctrl_nand_cs &pinctrl_nand_rb>;
+               status = "okay";
+
+               nand@3 {
+                       reg = <0x3 0x0 0x800000>;
+                       rb-gpios = <&pioD 5 GPIO_ACTIVE_HIGH>;
+                       cs-gpios = <&pioD 4 GPIO_ACTIVE_HIGH>;
+                       nand-bus-width = <8>;
+                       nand-ecc-mode = "hw";
+                       nand-ecc-strength = <8>;
+                       nand-ecc-step-size = <512>;
+                       nand-on-flash-bbt;
+                       label = "atmel_nand";
+
+                       partitions {
+                               compatible = "fixed-partitions";
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+
+                               at91bootstrap@0 {
+                                       label = "at91bootstrap";
+                                       reg = <0x0 0x40000>;
+                               };
+
+                               uboot@40000 {
+                                       label = "u-boot";
+                                       reg = <0x40000 0xc0000>;
+                               };
+
+                               ubootenvred@100000 {
+                                       label = "U-Boot Env Redundant";
+                                       reg = <0x100000 0x40000>;
+                               };
+
+                               ubootenv@140000 {
+                                       label = "U-Boot Env";
+                                       reg = <0x140000 0x40000>;
+                               };
+
+                               dtb@180000 {
+                                       label = "device tree";
+                                       reg = <0x180000 0x80000>;
+                               };
+
+                               kernel@200000 {
+                                       label = "kernel";
+                                       reg = <0x200000 0x600000>;
+                               };
+
+                               rootfs@800000 {
+                                       label = "rootfs";
+                                       reg = <0x800000 0x1f800000>;
+                               };
+                       };
+               };
+       };
+};
+
+&flx0 {
+       atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_TWI>;
+       status = "okay";
+
+       i2c@600 {
+               compatible = "microchip,sam9x60-i2c";
+               reg = <0x600 0x200>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_flx0>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+               clocks = <&pmc PMC_TYPE_PERIPHERAL 5>;
+               status = "okay";
+
+               eeprom@53 {
+                       compatible = "atmel,24c02";
+                       reg = <0x53>;
+                       pagesize = <16>;
+               };
+       };
+};
+
 &macb0 {
        phy-mode = "rmii";
        status = "okay";
 };
 
+&pinctrl {
+       ebi {
+               pinctrl_ebi_data_0_7: ebi-data-lsb-0 {
+                       atmel,pins =
+                               <AT91_PIOD 6 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS)
+                                AT91_PIOD 7 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS)
+                                AT91_PIOD 8 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS)
+                                AT91_PIOD 9 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS)
+                                AT91_PIOD 10 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS)
+                                AT91_PIOD 11 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS)
+                                AT91_PIOD 12 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS)
+                                AT91_PIOD 13 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS)>;
+               };
+
+               pinctrl_ebi_addr_nand: ebi-addr-0 {
+                       atmel,pins =
+                               <AT91_PIOD 2 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS)
+                                AT91_PIOD 3 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS)>;
+               };
+       };
+
+       flexcom {
+               pinctrl_flx0: flx0_default {
+                       atmel,pins =
+                               <AT91_PIOA 0 AT91_PERIPH_A AT91_PINCTRL_NONE
+                                AT91_PIOA 1 AT91_PERIPH_A AT91_PINCTRL_NONE>;
+               };
+       };
+
+       gpio-keys {
+               pinctrl_key_gpio_default: pinctrl-key-gpio {
+                       atmel,pins = <AT91_PIOA 29 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
+               };
+       };
+
+       leds {
+               pinctrl_gpio_leds: gpio-leds {
+                       atmel,pins = <AT91_PIOD 17 AT91_PERIPH_GPIO AT91_PINCTRL_NONE
+                                     AT91_PIOD 19 AT91_PERIPH_GPIO AT91_PINCTRL_NONE
+                                     AT91_PIOD 21 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
+               };
+       };
+
+       nand {
+               pinctrl_nand_oe_we: nand-oe-we-0 {
+                       atmel,pins =
+                               <AT91_PIOD 0 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS)
+                                AT91_PIOD 1 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS)>;
+               };
+
+               pinctrl_nand_rb: nand-rb-0 {
+                       atmel,pins =
+                               <AT91_PIOD 5 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP>;
+               };
+
+               pinctrl_nand_cs: nand-cs-0 {
+                       atmel,pins =
+                               <AT91_PIOD 4 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP>;
+               };
+       };
+
+       pinctrl_onewire_tm_default: onewire_tm_default {
+               atmel,pins =
+                       <AT91_PIOD 14 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP>;
+       };
+
+       usb1 {
+               pinctrl_usb_default: usb_default {
+                       atmel,pins = <AT91_PIOD 15 AT91_PERIPH_GPIO AT91_PINCTRL_NONE
+                                     AT91_PIOD 18 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
+               };
+       };
+};
+
 &usb1 {
        num-ports = <3>;
        atmel,vbus-gpio = <0
diff --git a/arch/arm/dts/at91-sama5d29_curiosity-u-boot.dtsi b/arch/arm/dts/at91-sama5d29_curiosity-u-boot.dtsi
new file mode 100644 (file)
index 0000000..798761c
--- /dev/null
@@ -0,0 +1,55 @@
+// SPDX-License-Identifier: GPL-2.0+ OR MIT
+/*
+ * at91-sama5d29_curiosity-u-boot.dtsi - Device Tree file for SAMA5D2 SoC u-boot properties.
+ *
+ * Copyright (c) 2023, Microchip Technology Inc. and its subsidiaries
+ *
+ * Author: Mihai Sain <mihai.sain@microchip.com>
+ *
+ */
+
+/ {
+       chosen {
+               bootph-all;
+       };
+};
+
+&pinctrl_qspi1_default {
+       bootph-all;
+};
+
+&pinctrl_sdmmc0_default {
+       bootph-all;
+};
+
+&pinctrl_sdmmc1_default {
+       bootph-all;
+};
+
+&hlcdc {
+       bootph-all;
+};
+
+&pioA {
+       bootph-all;
+};
+
+&qspi1 {
+       bootph-all;
+
+       flash@0 {
+               bootph-all;
+       };
+};
+
+&sdmmc0 {
+       bootph-all;
+};
+
+&sdmmc1 {
+       bootph-all;
+};
+
+&uart0 {
+       bootph-all;
+};
diff --git a/arch/arm/dts/at91-sama5d29_curiosity.dts b/arch/arm/dts/at91-sama5d29_curiosity.dts
new file mode 100644 (file)
index 0000000..eff0e91
--- /dev/null
@@ -0,0 +1,219 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * at91-sama5d29_curiosity.dts - Device Tree file for SAMA5D29 CURIOSITY board
+ *
+ * Copyright (C) 2023 Microchip Technology Inc. and its subsidiaries
+ *
+ * Author: Mihai Sain <mihai.sain@microchip.com>
+ *
+ */
+/dts-v1/;
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/pinctrl/at91.h>
+#include "sama5d2.dtsi"
+#include "sama5d2-pinfunc.h"
+
+/ {
+       model = "Microchip SAMA5D29-Curiosity";
+       compatible = "atmel,sama5d29-curiosity", "atmel,sama5d2", "atmel,sama5";
+
+       chosen {
+               bootargs = "console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait";
+               stdout-path = &uart0;
+       };
+
+       memory {
+               reg = <0x20000000 0x20000000>; // 512 MiB LPDDR2-333
+       };
+
+       clocks {
+               slow_xtal: slow_xtal {
+                       clock-frequency = <32768>;
+               };
+
+               main_xtal: main_xtal {
+                       clock-frequency = <24000000>;
+               };
+       };
+
+       onewire_tm: onewire {
+               gpios = <&pioA PIN_PC9 GPIO_ACTIVE_HIGH>;
+               pinctrl-names = "default";
+               pinctrl-0 = <&pinctrl_onewire_tm_default>;
+               status = "okay";
+
+               w1_eeprom: w1_eeprom@0 {
+                       compatible = "maxim,ds24b33";
+                       status = "okay";
+               };
+       };
+
+       ahb {
+               usb1: ohci@400000 {
+                       num-ports = <3>;
+                       atmel,vbus-gpio = <&pioA PIN_PB13 GPIO_ACTIVE_HIGH>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&pinctrl_usb_default>;
+                       status = "okay";
+               };
+
+               usb2: ehci@500000 {
+                       status = "okay";
+               };
+
+               sdmmc0: sdio-host@a0000000 {
+                       bus-width = <4>;
+                       disable-wp;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&pinctrl_sdmmc0_default>;
+                       status = "okay";
+               };
+
+               sdmmc1: sdio-host@b0000000 {
+                       bus-width = <4>;
+                       disable-wp;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&pinctrl_sdmmc1_default>;
+                       status = "okay";
+               };
+
+               apb {
+                       hlcdc: hlcdc@f0000000 {
+                               atmel,vl-bpix = <4>;
+                               atmel,output-mode = <24>;
+                               atmel,guard-time = <1>;
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&pinctrl_lcd_base &pinctrl_lcd_pwm &pinctrl_lcd_rgb666>;
+                               status = "okay";
+
+                               display-timings { // PDA TM5000
+                                       800x480 {
+                                               clock-frequency = <33000000>;
+                                               xres = <800>;
+                                               yres = <480>;
+                                               hactive = <800>;
+                                               vactive = <480>;
+                                               hsync-len = <64>;
+                                               hfront-porch = <1>;
+                                               hback-porch = <64>;
+                                               vfront-porch = <1>;
+                                               vback-porch = <22>;
+                                               vsync-len = <23>;
+                                       };
+                               };
+                       };
+
+                       qspi1: spi@f0024000 {
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&pinctrl_qspi1_default>;
+                               status = "okay";
+
+                               flash@0 {
+                                       compatible = "jedec,spi-nor";
+                                       reg = <0>;
+                                       spi-max-frequency = <80000000>;
+                                       spi-rx-bus-width = <4>;
+                                       spi-tx-bus-width = <4>;
+                                       m25p,fast-read;
+                               };
+                       };
+
+                       uart0: serial@f801c000 {
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&pinctrl_uart0_default>;
+                               status = "okay";
+                       };
+
+                       pioA: pinctrl@fc038000 {
+                               pinctrl_lcd_base: lcd_base {
+                                       pinmux = <PIN_PC30__LCDVSYNC>,
+                                                <PIN_PC31__LCDHSYNC>,
+                                                <PIN_PD1__LCDDEN>,
+                                                <PIN_PD0__LCDPCK>;
+                                       bias-disable;
+                               };
+
+                               pinctrl_lcd_pwm: lcd_pwm {
+                                       pinmux = <PIN_PC28__LCDPWM>;
+                                       bias-disable;
+                               };
+
+                               pinctrl_lcd_rgb666: lcd_rgb666 {
+                                       pinmux = <PIN_PC10__LCDDAT2>,
+                                                <PIN_PC11__LCDDAT3>,
+                                                <PIN_PC12__LCDDAT4>,
+                                                <PIN_PC13__LCDDAT5>,
+                                                <PIN_PC14__LCDDAT6>,
+                                                <PIN_PC15__LCDDAT7>,
+                                                <PIN_PC16__LCDDAT10>,
+                                                <PIN_PC17__LCDDAT11>,
+                                                <PIN_PC18__LCDDAT12>,
+                                                <PIN_PC19__LCDDAT13>,
+                                                <PIN_PC20__LCDDAT14>,
+                                                <PIN_PC21__LCDDAT15>,
+                                                <PIN_PC22__LCDDAT18>,
+                                                <PIN_PC23__LCDDAT19>,
+                                                <PIN_PC24__LCDDAT20>,
+                                                <PIN_PC25__LCDDAT21>,
+                                                <PIN_PC26__LCDDAT22>,
+                                                <PIN_PC27__LCDDAT23>;
+                                       bias-disable;
+                               };
+
+                               pinctrl_qspi1_default: qspi1_default {
+                                       pinmux = <PIN_PB5__QSPI1_SCK>,
+                                                <PIN_PB6__QSPI1_CS>,
+                                                <PIN_PB7__QSPI1_IO0>,
+                                                <PIN_PB8__QSPI1_IO1>,
+                                                <PIN_PB9__QSPI1_IO2>,
+                                                <PIN_PB10__QSPI1_IO3>;
+                                       bias-pull-up;
+                               };
+
+                               pinctrl_sdmmc0_default: sdmmc0_default {
+                                       pinmux = <PIN_PA0__SDMMC0_CK>,
+                                                <PIN_PA1__SDMMC0_CMD>,
+                                                <PIN_PA2__SDMMC0_DAT0>,
+                                                <PIN_PA3__SDMMC0_DAT1>,
+                                                <PIN_PA4__SDMMC0_DAT2>,
+                                                <PIN_PA5__SDMMC0_DAT3>,
+                                                <PIN_PA11__SDMMC0_VDDSEL>,
+                                                <PIN_PA13__SDMMC0_CD>;
+                                       bias-disable;
+                               };
+
+                               pinctrl_sdmmc1_default: sdmmc1_default {
+                                       pinmux = <PIN_PA18__SDMMC1_DAT0>,
+                                                <PIN_PA19__SDMMC1_DAT1>,
+                                                <PIN_PA20__SDMMC1_DAT2>,
+                                                <PIN_PA21__SDMMC1_DAT3>,
+                                                <PIN_PA22__SDMMC1_CK>,
+                                                <PIN_PA28__SDMMC1_CMD>,
+                                                <PIN_PA30__SDMMC1_CD>;
+                                       bias-disable;
+                               };
+
+                               pinctrl_uart0_default: uart0_default {
+                                       pinmux = <PIN_PB26__URXD0>,
+                                                <PIN_PB27__UTXD0>;
+                                       bias-disable;
+                               };
+
+                               pinctrl_usb_default: usb_default {
+                                       pinmux = <PIN_PA6__GPIO>;
+                                       bias-disable;
+                               };
+
+                               pinctrl_usba_vbus: usba_vbus {
+                                       pinmux = <PIN_PB13__GPIO>;
+                                       bias-disable;
+                               };
+
+                               pinctrl_onewire_tm_default: onewire_tm_default {
+                                       pinmux = <PIN_PC9__GPIO>;
+                                       bias-pull-up;
+                               };
+                       };
+               };
+       };
+};
index 5e8036f32d79dc15878a9231a74bd746f7661678..1664d9f0241c2464b329724b2c2372219da5ef60 100644 (file)
                };
        };
 
+       main_timer0: timer@2400000 {
+               compatible = "ti,am654-timer";
+               reg = <0x00 0x2400000 0x00 0x400>;
+               interrupts = <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&k3_clks 36 1>;
+               clock-names = "fck";
+               assigned-clocks = <&k3_clks 36 1>;
+               assigned-clock-parents = <&k3_clks 36 2>;
+               power-domains = <&k3_pds 36 TI_SCI_PD_EXCLUSIVE>;
+               ti,timer-pwm;
+       };
+
+       main_timer1: timer@2410000 {
+               compatible = "ti,am654-timer";
+               reg = <0x00 0x2410000 0x00 0x400>;
+               interrupts = <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&k3_clks 37 1>;
+               clock-names = "fck";
+               assigned-clocks = <&k3_clks 37 1>;
+               assigned-clock-parents = <&k3_clks 37 2>;
+               power-domains = <&k3_pds 37 TI_SCI_PD_EXCLUSIVE>;
+               ti,timer-pwm;
+       };
+
+       main_timer2: timer@2420000 {
+               compatible = "ti,am654-timer";
+               reg = <0x00 0x2420000 0x00 0x400>;
+               interrupts = <GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&k3_clks 38 1>;
+               clock-names = "fck";
+               assigned-clocks = <&k3_clks 38 1>;
+               assigned-clock-parents = <&k3_clks 38 2>;
+               power-domains = <&k3_pds 38 TI_SCI_PD_EXCLUSIVE>;
+               ti,timer-pwm;
+       };
+
+       main_timer3: timer@2430000 {
+               compatible = "ti,am654-timer";
+               reg = <0x00 0x2430000 0x00 0x400>;
+               interrupts = <GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&k3_clks 39 1>;
+               clock-names = "fck";
+               assigned-clocks = <&k3_clks 39 1>;
+               assigned-clock-parents = <&k3_clks 39 2>;
+               power-domains = <&k3_pds 39 TI_SCI_PD_EXCLUSIVE>;
+               ti,timer-pwm;
+       };
+
+       main_timer4: timer@2440000 {
+               compatible = "ti,am654-timer";
+               reg = <0x00 0x2440000 0x00 0x400>;
+               interrupts = <GIC_SPI 124 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&k3_clks 40 1>;
+               clock-names = "fck";
+               assigned-clocks = <&k3_clks 40 1>;
+               assigned-clock-parents = <&k3_clks 40 2>;
+               power-domains = <&k3_pds 40 TI_SCI_PD_EXCLUSIVE>;
+               ti,timer-pwm;
+       };
+
+       main_timer5: timer@2450000 {
+               compatible = "ti,am654-timer";
+               reg = <0x00 0x2450000 0x00 0x400>;
+               interrupts = <GIC_SPI 125 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&k3_clks 41 1>;
+               clock-names = "fck";
+               assigned-clocks = <&k3_clks 41 1>;
+               assigned-clock-parents = <&k3_clks 41 2>;
+               power-domains = <&k3_pds 41 TI_SCI_PD_EXCLUSIVE>;
+               ti,timer-pwm;
+       };
+
+       main_timer6: timer@2460000 {
+               compatible = "ti,am654-timer";
+               reg = <0x00 0x2460000 0x00 0x400>;
+               interrupts = <GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&k3_clks 42 1>;
+               clock-names = "fck";
+               assigned-clocks = <&k3_clks 42 1>;
+               assigned-clock-parents = <&k3_clks 42 2>;
+               power-domains = <&k3_pds 42 TI_SCI_PD_EXCLUSIVE>;
+               ti,timer-pwm;
+       };
+
+       main_timer7: timer@2470000 {
+               compatible = "ti,am654-timer";
+               reg = <0x00 0x2470000 0x00 0x400>;
+               interrupts = <GIC_SPI 127 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&k3_clks 43 1>;
+               clock-names = "fck";
+               assigned-clocks = <&k3_clks 43 1>;
+               assigned-clock-parents = <&k3_clks 43 2>;
+               power-domains = <&k3_pds 43 TI_SCI_PD_EXCLUSIVE>;
+               ti,timer-pwm;
+       };
+
+       main_timer8: timer@2480000 {
+               compatible = "ti,am654-timer";
+               reg = <0x00 0x2480000 0x00 0x400>;
+               interrupts = <GIC_SPI 128 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&k3_clks 44 1>;
+               clock-names = "fck";
+               assigned-clocks = <&k3_clks 44 1>;
+               assigned-clock-parents = <&k3_clks 44 2>;
+               power-domains = <&k3_pds 44 TI_SCI_PD_EXCLUSIVE>;
+               ti,timer-pwm;
+       };
+
+       main_timer9: timer@2490000 {
+               compatible = "ti,am654-timer";
+               reg = <0x00 0x2490000 0x00 0x400>;
+               interrupts = <GIC_SPI 129 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&k3_clks 45 1>;
+               clock-names = "fck";
+               assigned-clocks = <&k3_clks 45 1>;
+               assigned-clock-parents = <&k3_clks 45 2>;
+               power-domains = <&k3_pds 45 TI_SCI_PD_EXCLUSIVE>;
+               ti,timer-pwm;
+       };
+
+       main_timer10: timer@24a0000 {
+               compatible = "ti,am654-timer";
+               reg = <0x00 0x24a0000 0x00 0x400>;
+               interrupts = <GIC_SPI 130 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&k3_clks 46 1>;
+               clock-names = "fck";
+               assigned-clocks = <&k3_clks 46 1>;
+               assigned-clock-parents = <&k3_clks 46 2>;
+               power-domains = <&k3_pds 46 TI_SCI_PD_EXCLUSIVE>;
+               ti,timer-pwm;
+       };
+
+       main_timer11: timer@24b0000 {
+               compatible = "ti,am654-timer";
+               reg = <0x00 0x24b0000 0x00 0x400>;
+               interrupts = <GIC_SPI 131 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&k3_clks 47 1>;
+               clock-names = "fck";
+               assigned-clocks = <&k3_clks 47 1>;
+               assigned-clock-parents = <&k3_clks 47 2>;
+               power-domains = <&k3_pds 47 TI_SCI_PD_EXCLUSIVE>;
+               ti,timer-pwm;
+       };
+
+       main_esm: esm@420000 {
+               compatible = "ti,j721e-esm";
+               reg = <0x00 0x420000 0x00 0x1000>;
+               ti,esm-pins = <160>, <161>;
+       };
+
        main_uart0: serial@2800000 {
                compatible = "ti,am64-uart", "ti,am654-uart";
                reg = <0x00 0x02800000 0x00 0x100>;
                interrupts = <GIC_SPI 178 IRQ_TYPE_LEVEL_HIGH>;
                clock-frequency = <48000000>;
-               current-speed = <115200>;
                power-domains = <&k3_pds 146 TI_SCI_PD_EXCLUSIVE>;
                clocks = <&k3_clks 146 0>;
                clock-names = "fclk";
                reg = <0x00 0x02810000 0x00 0x100>;
                interrupts = <GIC_SPI 179 IRQ_TYPE_LEVEL_HIGH>;
                clock-frequency = <48000000>;
-               current-speed = <115200>;
                power-domains = <&k3_pds 152 TI_SCI_PD_EXCLUSIVE>;
                clocks = <&k3_clks 152 0>;
                clock-names = "fclk";
                reg = <0x00 0x02820000 0x00 0x100>;
                interrupts = <GIC_SPI 180 IRQ_TYPE_LEVEL_HIGH>;
                clock-frequency = <48000000>;
-               current-speed = <115200>;
                power-domains = <&k3_pds 153 TI_SCI_PD_EXCLUSIVE>;
                clocks = <&k3_clks 153 0>;
                clock-names = "fclk";
                reg = <0x00 0x02830000 0x00 0x100>;
                interrupts = <GIC_SPI 181 IRQ_TYPE_LEVEL_HIGH>;
                clock-frequency = <48000000>;
-               current-speed = <115200>;
                power-domains = <&k3_pds 154 TI_SCI_PD_EXCLUSIVE>;
                clocks = <&k3_clks 154 0>;
                clock-names = "fclk";
                reg = <0x00 0x02840000 0x00 0x100>;
                interrupts = <GIC_SPI 182 IRQ_TYPE_LEVEL_HIGH>;
                clock-frequency = <48000000>;
-               current-speed = <115200>;
                power-domains = <&k3_pds 155 TI_SCI_PD_EXCLUSIVE>;
                clocks = <&k3_clks 155 0>;
                clock-names = "fclk";
                reg = <0x00 0x02850000 0x00 0x100>;
                interrupts = <GIC_SPI 183 IRQ_TYPE_LEVEL_HIGH>;
                clock-frequency = <48000000>;
-               current-speed = <115200>;
                power-domains = <&k3_pds 156 TI_SCI_PD_EXCLUSIVE>;
                clocks = <&k3_clks 156 0>;
                clock-names = "fclk";
                reg = <0x00 0x02860000 0x00 0x100>;
                interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>;
                clock-frequency = <48000000>;
-               current-speed = <115200>;
                power-domains = <&k3_pds 158 TI_SCI_PD_EXCLUSIVE>;
                clocks = <&k3_clks 158 0>;
                clock-names = "fclk";
                #mbox-cells = <1>;
                ti,mbox-num-users = <4>;
                ti,mbox-num-fifos = <16>;
+               status = "disabled";
        };
 
        mailbox0_cluster3: mailbox@29030000 {
                #mbox-cells = <1>;
                ti,mbox-num-users = <4>;
                ti,mbox-num-fifos = <16>;
+               status = "disabled";
        };
 
        mailbox0_cluster4: mailbox@29040000 {
                #mbox-cells = <1>;
                ti,mbox-num-users = <4>;
                ti,mbox-num-fifos = <16>;
+               status = "disabled";
        };
 
        mailbox0_cluster5: mailbox@29050000 {
                #mbox-cells = <1>;
                ti,mbox-num-users = <4>;
                ti,mbox-num-fifos = <16>;
+               status = "disabled";
        };
 
        mailbox0_cluster6: mailbox@29060000 {
                #mbox-cells = <1>;
                ti,mbox-num-users = <4>;
                ti,mbox-num-fifos = <16>;
+               status = "disabled";
        };
 
        mailbox0_cluster7: mailbox@29070000 {
                #mbox-cells = <1>;
                ti,mbox-num-users = <4>;
                ti,mbox-num-fifos = <16>;
+               status = "disabled";
        };
 
        main_r5fss0: r5fss@78000000 {
                clock-names = "fck";
                status = "disabled";
        };
+
+       main_vtm0: temperature-sensor@b00000 {
+               compatible = "ti,j7200-vtm";
+               reg = <0x00 0xb00000 0x00 0x400>,
+                     <0x00 0xb01000 0x00 0x400>;
+               power-domains = <&k3_pds 95 TI_SCI_PD_EXCLUSIVE>;
+               #thermal-sensor-cells = <1>;
+       };
 };
index 38ddf0b3b8a0c5400c1fa6ef5080b87a42a5fa67..686d4979072188c011698b73931c696f283dbe8f 100644 (file)
@@ -6,11 +6,55 @@
  */
 
 &cbass_mcu {
+       /*
+        * The MCU domain timer interrupts are routed only to the ESM module,
+        * and not currently available for Linux. The MCU domain timers are
+        * of limited use without interrupts, and likely reserved by the ESM.
+        */
+       mcu_timer0: timer@4800000 {
+               compatible = "ti,am654-timer";
+               reg = <0x00 0x4800000 0x00 0x400>;
+               clocks = <&k3_clks 35 1>;
+               clock-names = "fck";
+               power-domains = <&k3_pds 35 TI_SCI_PD_EXCLUSIVE>;
+               ti,timer-pwm;
+               status = "reserved";
+       };
+
+       mcu_timer1: timer@4810000 {
+               compatible = "ti,am654-timer";
+               reg = <0x00 0x4810000 0x00 0x400>;
+               clocks = <&k3_clks 48 1>;
+               clock-names = "fck";
+               power-domains = <&k3_pds 48 TI_SCI_PD_EXCLUSIVE>;
+               ti,timer-pwm;
+               status = "reserved";
+       };
+
+       mcu_timer2: timer@4820000 {
+               compatible = "ti,am654-timer";
+               reg = <0x00 0x4820000 0x00 0x400>;
+               clocks = <&k3_clks 49 1>;
+               clock-names = "fck";
+               power-domains = <&k3_pds 49 TI_SCI_PD_EXCLUSIVE>;
+               ti,timer-pwm;
+               status = "reserved";
+       };
+
+       mcu_timer3: timer@4830000 {
+               compatible = "ti,am654-timer";
+               reg = <0x00 0x4830000 0x00 0x400>;
+               clocks = <&k3_clks 50 1>;
+               clock-names = "fck";
+               power-domains = <&k3_pds 50 TI_SCI_PD_EXCLUSIVE>;
+               ti,timer-pwm;
+               status = "reserved";
+       };
+
        mcu_uart0: serial@4a00000 {
                compatible = "ti,am64-uart", "ti,am654-uart";
                reg = <0x00 0x04a00000 0x00 0x100>;
                interrupts = <GIC_SPI 185 IRQ_TYPE_LEVEL_HIGH>;
-               current-speed = <115200>;
                power-domains = <&k3_pds 149 TI_SCI_PD_EXCLUSIVE>;
                clocks = <&k3_clks 149 0>;
                clock-names = "fclk";
@@ -21,7 +65,6 @@
                compatible = "ti,am64-uart", "ti,am654-uart";
                reg = <0x00 0x04a10000 0x00 0x100>;
                interrupts = <GIC_SPI 186 IRQ_TYPE_LEVEL_HIGH>;
-               current-speed = <115200>;
                power-domains = <&k3_pds 160 TI_SCI_PD_EXCLUSIVE>;
                clocks = <&k3_clks 160 0>;
                clock-names = "fclk";
                pinctrl-single,register-width = <32>;
                pinctrl-single,function-mask = <0xffffffff>;
        };
+
+       mcu_esm: esm@4100000 {
+               compatible = "ti,j721e-esm";
+               reg = <0x00 0x4100000 0x00 0x1000>;
+               ti,esm-pins = <0>, <1>;
+       };
 };
diff --git a/arch/arm/dts/k3-am64-thermal.dtsi b/arch/arm/dts/k3-am64-thermal.dtsi
new file mode 100644 (file)
index 0000000..036db56
--- /dev/null
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <dt-bindings/thermal/thermal.h>
+
+thermal_zones: thermal-zones {
+       main0_thermal: main0-thermal {
+               polling-delay-passive = <250>;  /* milliSeconds */
+               polling-delay = <500>;          /* milliSeconds */
+               thermal-sensors = <&main_vtm0 0>;
+
+               trips {
+                       main0_crit: main0-crit {
+                               temperature = <105000>; /* milliCelsius */
+                               hysteresis = <2000>;    /* milliCelsius */
+                               type = "critical";
+                       };
+               };
+       };
+
+       main1_thermal: main1-thermal {
+               polling-delay-passive = <250>;  /* milliSeconds */
+               polling-delay = <500>;          /* milliSeconds */
+               thermal-sensors = <&main_vtm0 1>;
+
+               trips {
+                       main1_crit: main1-crit {
+                               temperature = <105000>; /* milliCelsius */
+                               hysteresis = <2000>;    /* milliCelsius */
+                               type = "critical";
+                       };
+               };
+       };
+};
index c858725133af49a27cd7f1535527d530dbb42f97..8e9c2bc70f4d7ed87ad3f87f2915e73ee1dfb641 100644 (file)
@@ -8,9 +8,10 @@
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
-#include <dt-bindings/pinctrl/k3.h>
 #include <dt-bindings/soc/ti,sci_pm_domain.h>
 
+#include "k3-pinctrl.h"
+
 / {
        model = "Texas Instruments K3 AM642 SoC";
        compatible = "ti,am642";
        #address-cells = <2>;
        #size-cells = <2>;
 
-       aliases {
-               serial0 = &mcu_uart0;
-               serial1 = &mcu_uart1;
-               serial2 = &main_uart0;
-               serial3 = &main_uart1;
-               serial4 = &main_uart2;
-               serial5 = &main_uart3;
-               serial6 = &main_uart4;
-               serial7 = &main_uart5;
-               serial8 = &main_uart6;
-               ethernet0 = &cpsw_port1;
-               ethernet1 = &cpsw_port2;
-               mmc0 = &sdhci0;
-               mmc1 = &sdhci1;
-       };
-
        chosen { };
 
        firmware {
@@ -69,6 +54,7 @@
                         <0x00 0x00420000 0x00 0x00420000 0x00 0x00001000>, /* ESM0 */
                         <0x00 0x00600000 0x00 0x00600000 0x00 0x00001100>, /* GPIO */
                         <0x00 0x00a40000 0x00 0x00a40000 0x00 0x00000800>, /* Timesync router */
+                        <0x00 0x00b00000 0x00 0x00b00000 0x00 0x00002400>, /* VTM */
                         <0x00 0x01000000 0x00 0x01000000 0x00 0x02330400>, /* First peripheral window */
                         <0x00 0x08000000 0x00 0x08000000 0x00 0x00200000>, /* Main CPSW */
                         <0x00 0x0d000000 0x00 0x0d000000 0x00 0x00800000>, /* PCIE_CORE */
                        ranges = <0x00 0x04000000 0x00 0x04000000 0x00 0x01ff1400>; /* Peripheral window */
                };
        };
+
+       #include "k3-am64-thermal.dtsi"
 };
 
 /* Now include the peripherals for each bus segments */
index 73577e8cfd3730b9300e736f64686306770c2cf4..c85f57d40fe8a7a5975eaee5cf380ecdf9189ed8 100644 (file)
@@ -7,8 +7,7 @@
 
 / {
        chosen {
-               stdout-path = "serial2:115200n8";
-               tick-timer = &timer1;
+               tick-timer = &main_timer0;
        };
 
        memory@80000000 {
        };
 };
 
-&cbass_main{
+&vtt_supply {
        bootph-pre-ram;
-       timer1: timer@2400000 {
-               compatible = "ti,omap5430-timer";
-               reg = <0x0 0x2400000 0x0 0x80>;
-               ti,timer-alwon;
-               clock-frequency = <200000000>;
-               bootph-pre-ram;
-       };
+};
+
+&cbass_main {
+       bootph-pre-ram;
+};
+
+&cbass_mcu {
+       bootph-pre-ram;
+};
+
+&main_timer0 {
+       bootph-pre-ram;
+       clock-frequency = <200000000>;
 };
 
 &main_conf {
 
 &main_pmx0 {
        bootph-pre-ram;
-       main_i2c0_pins_default: main-i2c0-pins-default {
-               bootph-pre-ram;
-               pinctrl-single,pins = <
-                       AM64X_IOPAD(0x0260, PIN_INPUT_PULLUP, 0) /* (A18) I2C0_SCL */
-                       AM64X_IOPAD(0x0264, PIN_INPUT_PULLUP, 0) /* (B18) I2C0_SDA */
-               >;
-       };
+};
+
+&main_i2c0_pins_default {
+       bootph-pre-ram;
 };
 
 &main_i2c0 {
-       status = "okay";
        bootph-pre-ram;
-       pinctrl-names = "default";
-       pinctrl-0 = <&main_i2c0_pins_default>;
-       clock-frequency = <400000>;
+};
+
+&main_uart0_pins_default {
+       bootph-pre-ram;
 };
 
 &main_uart0 {
 };
 
 &cpsw3g {
-       reg = <0x0 0x8000000 0x0 0x200000>,
-             <0x0 0x43000200 0x0 0x8>;
-       reg-names = "cpsw_nuss", "mac_efuse";
-       /delete-property/ ranges;
-       pinctrl-0 = <&mdio1_pins_default        /* HACK: as MDIO driver is not DM enabled */
-                    &rgmii1_pins_default
-                    &rgmii2_pins_default>;
-
-       cpsw-phy-sel@04044 {
-               compatible = "ti,am64-phy-gmii-sel";
-               reg = <0x0 0x43004044 0x0 0x8>;
-       };
+       bootph-pre-ram;
 };
 
 &cpsw_port2 {
index 39feea78a084eeee870ae83318c2e30e470fa673..15c282c93467a6ed98274e41e05b0f3fbece25c5 100644 (file)
        model = "Texas Instruments AM642 EVM";
 
        chosen {
-               stdout-path = "serial2:115200n8";
-               bootargs = "console=ttyS2,115200n8 earlycon=ns16550a,mmio32,0x02800000";
+               stdout-path = &main_uart0;
+       };
+
+       aliases {
+               serial0 = &mcu_uart0;
+               serial1 = &main_uart1;
+               serial2 = &main_uart0;
+               serial3 = &main_uart3;
+               i2c0 = &main_i2c0;
+               i2c1 = &main_i2c1;
+               mmc0 = &sdhci0;
+               mmc1 = &sdhci1;
+               ethernet0 = &cpsw_port1;
+               ethernet1 = &cpsw_port2;
        };
 
        memory@80000000 {
                device_type = "memory";
                /* 2G RAM */
                reg = <0x00000000 0x80000000 0x00000000 0x80000000>;
-
        };
 
        reserved-memory {
                };
        };
 
-       evm_12v0: fixedregulator-evm12v0 {
+       evm_12v0: regulator-0 {
                /* main DC jack */
                compatible = "regulator-fixed";
                regulator-name = "evm_12v0";
                regulator-boot-on;
        };
 
-       vsys_5v0: fixedregulator-vsys5v0 {
+       vsys_5v0: regulator-1 {
                /* output of LM5140 */
                compatible = "regulator-fixed";
                regulator-name = "vsys_5v0";
                regulator-boot-on;
        };
 
-       vsys_3v3: fixedregulator-vsys3v3 {
+       vsys_3v3: regulator-2 {
                /* output of LM5140 */
                compatible = "regulator-fixed";
                regulator-name = "vsys_3v3";
                regulator-boot-on;
        };
 
-       vdd_mmc1: fixed-regulator-sd {
+       vdd_mmc1: regulator-3 {
                /* TPS2051BD */
                compatible = "regulator-fixed";
                regulator-name = "vdd_mmc1";
                gpio = <&exp1 6 GPIO_ACTIVE_HIGH>;
        };
 
-       vddb: fixedregulator-vddb {
+       vddb: regulator-4 {
                compatible = "regulator-fixed";
                regulator-name = "vddb_3v3_display";
                regulator-min-microvolt = <3300000>;
                regulator-boot-on;
        };
 
+       vtt_supply: regulator-5 {
+               compatible = "regulator-fixed";
+               regulator-name = "vtt";
+               pinctrl-names = "default";
+               pinctrl-0 = <&ddr_vtt_pins_default>;
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               gpio = <&main_gpio0 12 GPIO_ACTIVE_HIGH>;
+               vin-supply = <&vsys_3v3>;
+               enable-active-high;
+               regulator-always-on;
+               regulator-boot-on;
+       };
+
        leds {
                compatible = "gpio-leds";
 
 };
 
 &main_pmx0 {
-       main_mmc1_pins_default: main-mmc1-pins-default {
+       main_mmc1_pins_default: main-mmc1-default-pins {
                pinctrl-single,pins = <
                        AM64X_IOPAD(0x0294, PIN_INPUT_PULLUP, 0) /* (J19) MMC1_CMD */
                        AM64X_IOPAD(0x028c, PIN_INPUT_PULLDOWN, 0) /* (L20) MMC1_CLK */
                >;
        };
 
-       main_uart0_pins_default: main-uart0-pins-default {
+       main_uart1_pins_default: main-uart1-default-pins {
+               pinctrl-single,pins = <
+                       AM64X_IOPAD(0x0248, PIN_INPUT, 0)               /* (D16) UART1_CTSn */
+                       AM64X_IOPAD(0x024c, PIN_OUTPUT, 0)              /* (E16) UART1_RTSn */
+                       AM64X_IOPAD(0x0240, PIN_INPUT, 0)               /* (E15) UART1_RXD */
+                       AM64X_IOPAD(0x0244, PIN_OUTPUT, 0)              /* (E14) UART1_TXD */
+               >;
+       };
+
+       main_uart0_pins_default: main-uart0-default-pins {
                pinctrl-single,pins = <
                        AM64X_IOPAD(0x0238, PIN_INPUT, 0) /* (B16) UART0_CTSn */
                        AM64X_IOPAD(0x023c, PIN_OUTPUT, 0) /* (A16) UART0_RTSn */
                >;
        };
 
-       main_spi0_pins_default: main-spi0-pins-default {
+       main_spi0_pins_default: main-spi0-default-pins {
                pinctrl-single,pins = <
                        AM64X_IOPAD(0x0210, PIN_INPUT, 0) /* (D13) SPI0_CLK */
                        AM64X_IOPAD(0x0208, PIN_OUTPUT, 0) /* (D12) SPI0_CS0 */
                >;
        };
 
-       main_i2c1_pins_default: main-i2c1-pins-default {
+       main_i2c0_pins_default: main-i2c0-default-pins {
+               pinctrl-single,pins = <
+                       AM64X_IOPAD(0x0260, PIN_INPUT_PULLUP, 0) /* (A18) I2C0_SCL */
+                       AM64X_IOPAD(0x0264, PIN_INPUT_PULLUP, 0) /* (B18) I2C0_SDA */
+               >;
+       };
+
+       main_i2c1_pins_default: main-i2c1-default-pins {
                pinctrl-single,pins = <
                        AM64X_IOPAD(0x0268, PIN_INPUT_PULLUP, 0) /* (C18) I2C1_SCL */
                        AM64X_IOPAD(0x026c, PIN_INPUT_PULLUP, 0) /* (B19) I2C1_SDA */
                >;
        };
 
-       mdio1_pins_default: mdio1-pins-default {
+       mdio1_pins_default: mdio1-default-pins {
                pinctrl-single,pins = <
                        AM64X_IOPAD(0x01fc, PIN_OUTPUT, 4) /* (R2) PRG0_PRU1_GPO19.MDIO0_MDC */
                        AM64X_IOPAD(0x01f8, PIN_INPUT, 4) /* (P5) PRG0_PRU1_GPO18.MDIO0_MDIO */
                >;
        };
 
-       rgmii1_pins_default: rgmii1-pins-default {
+       rgmii1_pins_default: rgmii1-default-pins {
                pinctrl-single,pins = <
                        AM64X_IOPAD(0x01cc, PIN_INPUT, 4) /* (W5) PRG0_PRU1_GPO7.RGMII1_RD0 */
                        AM64X_IOPAD(0x01d4, PIN_INPUT, 4) /* (Y5) PRG0_PRU1_GPO9.RGMII1_RD1 */
                >;
        };
 
-       rgmii2_pins_default: rgmii2-pins-default {
+       rgmii2_pins_default: rgmii2-default-pins {
                pinctrl-single,pins = <
                        AM64X_IOPAD(0x0108, PIN_INPUT, 4) /* (W11) PRG1_PRU1_GPO0.RGMII2_RD0 */
                        AM64X_IOPAD(0x010c, PIN_INPUT, 4) /* (V11) PRG1_PRU1_GPO1.RGMII2_RD1 */
                >;
        };
 
-       main_usb0_pins_default: main-usb0-pins-default {
+       main_usb0_pins_default: main-usb0-default-pins {
                pinctrl-single,pins = <
                        AM64X_IOPAD(0x02a8, PIN_OUTPUT, 0) /* (E19) USB0_DRVVBUS */
                >;
        };
 
-       ospi0_pins_default: ospi0-pins-default {
+       ospi0_pins_default: ospi0-default-pins {
                pinctrl-single,pins = <
                        AM64X_IOPAD(0x0000, PIN_OUTPUT, 0) /* (N20) OSPI0_CLK */
                        AM64X_IOPAD(0x002c, PIN_OUTPUT, 0) /* (L19) OSPI0_CSn0 */
                >;
        };
 
-       main_ecap0_pins_default: main-ecap0-pins-default {
+       main_ecap0_pins_default: main-ecap0-default-pins {
                pinctrl-single,pins = <
                        AM64X_IOPAD(0x0270, PIN_INPUT, 0) /* (D18) ECAP0_IN_APWM_OUT */
                >;
        };
 
-       main_mcan0_pins_default: main-mcan0-pins-default {
+       main_mcan0_pins_default: main-mcan0-default-pins {
                pinctrl-single,pins = <
                        AM64X_IOPAD(0x0254, PIN_INPUT, 0) /* (B17) MCAN0_RX */
                        AM64X_IOPAD(0x0250, PIN_OUTPUT, 0) /* (A17) MCAN0_TX */
                >;
        };
 
-       main_mcan1_pins_default: main-mcan1-pins-default {
+       main_mcan1_pins_default: main-mcan1-default-pins {
                pinctrl-single,pins = <
                        AM64X_IOPAD(0x025c, PIN_INPUT, 0) /* (D17) MCAN1_RX */
                        AM64X_IOPAD(0x0258, PIN_OUTPUT, 0) /* (C17) MCAN1_TX */
                >;
        };
+
+       ddr_vtt_pins_default: ddr-vtt-default-pins {
+               pinctrl-single,pins = <
+                       AM64X_IOPAD(0x0030, PIN_OUTPUT_PULLUP, 7) /* (L18) OSPI0_CSN1.GPIO0_12 */
+               >;
+       };
 };
 
 &main_uart0 {
        status = "okay";
        pinctrl-names = "default";
        pinctrl-0 = <&main_uart0_pins_default>;
+       current-speed = <115200>;
 };
 
 /* main_uart1 is reserved for firmware usage */
 &main_uart1 {
        status = "reserved";
+       pinctrl-names = "default";
+       pinctrl-0 = <&main_uart1_pins_default>;
+};
+
+&main_i2c0 {
+       status = "okay";
+       pinctrl-names = "default";
+       pinctrl-0 = <&main_i2c0_pins_default>;
+       clock-frequency = <400000>;
+
+       eeprom@50 {
+               /* AT24CM01 */
+               compatible = "atmel,24c1024";
+               reg = <0x50>;
+       };
 };
 
 &main_i2c1 {
 
 &cpsw3g {
        pinctrl-names = "default";
-       pinctrl-0 = <&rgmii1_pins_default
-                    &rgmii2_pins_default>;
+       pinctrl-0 = <&rgmii1_pins_default>, <&rgmii2_pins_default>;
 };
 
 &cpsw_port1 {
                cdns,tchsh-ns = <60>;
                cdns,tslch-ns = <60>;
                cdns,read-delay = <4>;
+
+               partitions {
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       partition@0 {
+                               label = "ospi.tiboot3";
+                               reg = <0x0 0x100000>;
+                       };
+
+                       partition@100000 {
+                               label = "ospi.tispl";
+                               reg = <0x100000 0x200000>;
+                       };
+
+                       partition@300000 {
+                               label = "ospi.u-boot";
+                               reg = <0x300000 0x400000>;
+                       };
+
+                       partition@700000 {
+                               label = "ospi.env";
+                               reg = <0x700000 0x40000>;
+                       };
+
+                       partition@740000 {
+                               label = "ospi.env.backup";
+                               reg = <0x740000 0x40000>;
+                       };
+
+                       partition@800000 {
+                               label = "ospi.rootfs";
+                               reg = <0x800000 0x37c0000>;
+                       };
+
+                       partition@3fc0000 {
+                               label = "ospi.phypattern";
+                               reg = <0x3fc0000 0x40000>;
+                       };
+               };
        };
 };
 
 &mailbox0_cluster2 {
+       status = "okay";
+
        mbox_main_r5fss0_core0: mbox-main-r5fss0-core0 {
                ti,mbox-rx = <0 0 2>;
                ti,mbox-tx = <1 0 2>;
        };
 };
 
-&mailbox0_cluster3 {
-       status = "disabled";
-};
-
 &mailbox0_cluster4 {
+       status = "okay";
+
        mbox_main_r5fss1_core0: mbox-main-r5fss1-core0 {
                ti,mbox-rx = <0 0 2>;
                ti,mbox-tx = <1 0 2>;
        };
 };
 
-&mailbox0_cluster5 {
-       status = "disabled";
-};
-
 &mailbox0_cluster6 {
+       status = "okay";
+
        mbox_m4_0: mbox-m4-0 {
                ti,mbox-rx = <0 0 2>;
                ti,mbox-tx = <1 0 2>;
        };
 };
 
-&mailbox0_cluster7 {
-       status = "disabled";
-};
-
 &main_r5fss0_core0 {
-       mboxes = <&mailbox0_cluster2 &mbox_main_r5fss0_core0>;
+       mboxes = <&mailbox0_cluster2>, <&mbox_main_r5fss0_core0>;
        memory-region = <&main_r5fss0_core0_dma_memory_region>,
                        <&main_r5fss0_core0_memory_region>;
 };
 
 &main_r5fss0_core1 {
-       mboxes = <&mailbox0_cluster2 &mbox_main_r5fss0_core1>;
+       mboxes = <&mailbox0_cluster2>, <&mbox_main_r5fss0_core1>;
        memory-region = <&main_r5fss0_core1_dma_memory_region>,
                        <&main_r5fss0_core1_memory_region>;
 };
 
 &main_r5fss1_core0 {
-       mboxes = <&mailbox0_cluster4 &mbox_main_r5fss1_core0>;
+       mboxes = <&mailbox0_cluster4>, <&mbox_main_r5fss1_core0>;
        memory-region = <&main_r5fss1_core0_dma_memory_region>,
                        <&main_r5fss1_core0_memory_region>;
 };
 
 &main_r5fss1_core1 {
-       mboxes = <&mailbox0_cluster4 &mbox_main_r5fss1_core1>;
+       mboxes = <&mailbox0_cluster4>, <&mbox_main_r5fss1_core1>;
        memory-region = <&main_r5fss1_core1_dma_memory_region>,
                        <&main_r5fss1_core1_memory_region>;
 };
index b49064181a08ac64ad3a96e49fb9f18d5ad3b37b..73461f8f6c3eb888a11e8eebd2268d1b9d0aa11b 100644 (file)
@@ -1,34 +1,20 @@
 // SPDX-License-Identifier: GPL-2.0
 /*
- * Copyright (C) 2020-2021 Texas Instruments Incorporated - https://www.ti.com/
+ * Copyright (C) 2020-2023 Texas Instruments Incorporated - https://www.ti.com/
  */
 
-/dts-v1/;
-
-#include "k3-am642.dtsi"
+#include "k3-am642-evm.dts"
 #include "k3-am64-evm-ddr4-1600MTs.dtsi"
 #include "k3-am64-ddr.dtsi"
-#include "k3-am64x-binman.dtsi"
 
-/ {
-       chosen {
-               stdout-path = "serial2:115200n8";
-               tick-timer = &timer1;
-       };
+#include "k3-am642-evm-u-boot.dtsi"
 
+/ {
        aliases {
                remoteproc0 = &sysctrler;
                remoteproc1 = &a53_0;
        };
 
-       memory@80000000 {
-               device_type = "memory";
-               /* 2G RAM */
-               reg = <0x00000000 0x80000000 0x00000000 0x80000000>;
-
-               bootph-pre-ram;
-       };
-
        a53_0: a53@0 {
                compatible = "ti,am654-rproc";
                reg = <0x00 0x00a90000 0x00 0x10>;
                bootph-pre-ram;
        };
 
-       reserved-memory {
-               #address-cells = <2>;
-               #size-cells = <2>;
-               ranges;
-
-               secure_ddr: optee@9e800000 {
-                       reg = <0x00 0x9e800000 0x00 0x01800000>; /* for OP-TEE */
-                       alignment = <0x1000>;
-                       no-map;
-               };
-       };
-
        clk_200mhz: dummy-clock-200mhz {
                compatible = "fixed-clock";
                #clock-cells = <0>;
                clock-frequency = <200000000>;
                bootph-pre-ram;
        };
-
-       vtt_supply: vtt-supply {
-               compatible = "regulator-gpio";
-               regulator-name = "vtt";
-               regulator-min-microvolt = <0>;
-               regulator-max-microvolt = <3300000>;
-               gpios = <&main_gpio0 12 GPIO_ACTIVE_HIGH>;
-               states = <0 0x0 3300000 0x1>;
-               bootph-pre-ram;
-       };
 };
 
 &cbass_main {
        };
 };
 
-&cbass_main {
-       main_esm: esm@420000 {
-               compatible = "ti,j721e-esm";
-               reg = <0x0 0x420000 0x0 0x1000>;
-               ti,esm-pins = <160>, <161>;
-               bootph-pre-ram;
-       };
-};
-
-&cbass_mcu {
+&main_esm {
        bootph-pre-ram;
-       mcu_esm: esm@4100000 {
-               compatible = "ti,j721e-esm";
-               reg = <0x0 0x4100000 0x0 0x1000>;
-               ti,esm-pins = <0>, <1>;
-               bootph-pre-ram;
-       };
 };
 
-&main_pmx0 {
+&mcu_esm {
        bootph-pre-ram;
-       main_uart0_pins_default: main-uart0-pins-default {
-               bootph-pre-ram;
-               pinctrl-single,pins = <
-                       AM64X_IOPAD(0x0238, PIN_INPUT, 0)               /* (B16) UART0_CTSn */
-                       AM64X_IOPAD(0x023c, PIN_OUTPUT, 0)              /* (A16) UART0_RTSn */
-                       AM64X_IOPAD(0x0230, PIN_INPUT, 0)               /* (D15) UART0_RXD */
-                       AM64X_IOPAD(0x0234, PIN_OUTPUT, 0)              /* (C16) UART0_TXD */
-               >;
-       };
-
-       main_uart1_pins_default: main-uart1-pins-default {
-               bootph-pre-ram;
-               pinctrl-single,pins = <
-                       AM64X_IOPAD(0x0248, PIN_INPUT, 0)               /* (D16) UART1_CTSn */
-                       AM64X_IOPAD(0x024c, PIN_OUTPUT, 0)              /* (E16) UART1_RTSn */
-                       AM64X_IOPAD(0x0240, PIN_INPUT, 0)               /* (E15) UART1_RXD */
-                       AM64X_IOPAD(0x0244, PIN_OUTPUT, 0)              /* (E14) UART1_TXD */
-               >;
-       };
-
-       main_mmc0_pins_default: main-mmc0-pins-default {
-               bootph-pre-ram;
-               pinctrl-single,pins = <
-                       AM64X_IOPAD(0x01a8, PIN_INPUT_PULLDOWN, 0)      /* (B25) MMC0_CLK */
-                       AM64X_IOPAD(0x01aC, PIN_INPUT_PULLUP, 0)        /* (B27) MMC0_CMD */
-                       AM64X_IOPAD(0x01a4, PIN_INPUT_PULLUP, 0)        /* (A26) MMC0_DAT0 */
-                       AM64X_IOPAD(0x01a0, PIN_INPUT_PULLUP, 0)        /* (E25) MMC0_DAT1 */
-                       AM64X_IOPAD(0x019c, PIN_INPUT_PULLUP, 0)        /* (C26) MMC0_DAT2 */
-                       AM64X_IOPAD(0x0198, PIN_INPUT_PULLUP, 0)        /* (A25) MMC0_DAT3 */
-                       AM64X_IOPAD(0x0194, PIN_INPUT_PULLUP, 0)        /* (E24) MMC0_DAT4 */
-                       AM64X_IOPAD(0x0190, PIN_INPUT_PULLUP, 0)        /* (A24) MMC0_DAT5 */
-                       AM64X_IOPAD(0x018c, PIN_INPUT_PULLUP, 0)        /* (B26) MMC0_DAT6 */
-                       AM64X_IOPAD(0x0188, PIN_INPUT_PULLUP, 0)        /* (D25) MMC0_DAT7 */
-                       AM64X_IOPAD(0x01b0, PIN_INPUT, 0)               /* (C25) MMC0_DS */
-               >;
-       };
-
-       main_mmc1_pins_default: main-mmc1-pins-default {
-               bootph-pre-ram;
-               pinctrl-single,pins = <
-                       AM64X_IOPAD(0x0294, PIN_INPUT_PULLUP, 0)        /* (J19) MMC1_CMD */
-                       AM64X_IOPAD(0x028c, PIN_INPUT_PULLDOWN, 0)      /* (L20) MMC1_CLK */
-                       AM64X_IOPAD(0x0288, PIN_INPUT_PULLUP, 0)        /* (K21) MMC1_DAT0 */
-                       AM64X_IOPAD(0x0284, PIN_INPUT_PULLUP, 0)        /* (L21) MMC1_DAT1 */
-                       AM64X_IOPAD(0x0280, PIN_INPUT_PULLUP, 0)        /* (K19) MMC1_DAT2 */
-                       AM64X_IOPAD(0x027c, PIN_INPUT_PULLUP, 0)        /* (K18) MMC1_DAT3 */
-                       AM64X_IOPAD(0x0298, PIN_INPUT_PULLUP, 0)        /* (D19) MMC1_SDCD */
-                       AM64X_IOPAD(0x029c, PIN_INPUT_PULLUP, 0)        /* (C20) MMC1_SDWP */
-               >;
-       };
-
-       ddr_vtt_pins_default: ddr-vtt-pins-default {
-               bootph-pre-ram;
-               pinctrl-single,pins = <
-                       AM64X_IOPAD(0x0030, PIN_OUTPUT_PULLUP, 7)       /* (L18) OSPI0_CSN1.GPIO0_12 */
-               >;
-       };
-
-       main_usb0_pins_default: main-usb0-pins-default {
-               pinctrl-single,pins = <
-                       AM64X_IOPAD(0x02a8, PIN_OUTPUT, 0) /* (E19) USB0_DRVVBUS */
-               >;
-       };
-
-       mdio1_pins_default: mdio1-pins-default {
-               pinctrl-single,pins = <
-                       AM64X_IOPAD(0x01fc, PIN_OUTPUT, 4) /* (R2) PRG0_PRU1_GPO19.MDIO0_MDC */
-                       AM64X_IOPAD(0x01f8, PIN_INPUT, 4) /* (P5) PRG0_PRU1_GPO18.MDIO0_MDIO */
-               >;
-       };
-
-       rgmii1_pins_default: rgmii1-pins-default {
-               pinctrl-single,pins = <
-                       AM64X_IOPAD(0x01cc, PIN_INPUT, 4) /* (W5) PRG0_PRU1_GPO7.RGMII1_RD0 */
-                       AM64X_IOPAD(0x01d4, PIN_INPUT, 4) /* (Y5) PRG0_PRU1_GPO9.RGMII1_RD1 */
-                       AM64X_IOPAD(0x01d8, PIN_INPUT, 4) /* (V6) PRG0_PRU1_GPO10.RGMII1_RD2 */
-                       AM64X_IOPAD(0x01f4, PIN_INPUT, 4) /* (V5) PRG0_PRU1_GPO17.RGMII1_RD3 */
-                       AM64X_IOPAD(0x0188, PIN_INPUT, 4) /* (AA5) PRG0_PRU0_GPO10.RGMII1_RXC */
-                       AM64X_IOPAD(0x0184, PIN_INPUT, 4) /* (W6) PRG0_PRU0_GPO9.RGMII1_RX_CTL */
-                       AM64X_IOPAD(0x0124, PIN_OUTPUT, 4) /* (V15) PRG1_PRU1_GPO7.RGMII1_TD0 */
-                       AM64X_IOPAD(0x012c, PIN_OUTPUT, 4) /* (V14) PRG1_PRU1_GPO9.RGMII1_TD1 */
-                       AM64X_IOPAD(0x0130, PIN_OUTPUT, 4) /* (W14) PRG1_PRU1_GPO10.RGMII1_TD2 */
-                       AM64X_IOPAD(0x014c, PIN_OUTPUT, 4) /* (AA14) PRG1_PRU1_GPO17.RGMII1_TD3 */
-                       AM64X_IOPAD(0x00e0, PIN_OUTPUT, 4) /* (U14) PRG1_PRU0_GPO10.RGMII1_TXC */
-                       AM64X_IOPAD(0x00dc, PIN_OUTPUT, 4) /* (U15) PRG1_PRU0_GPO9.RGMII1_TX_CTL */
-               >;
-       };
-
-       rgmii2_pins_default: rgmii2-pins-default {
-               pinctrl-single,pins = <
-                       AM64X_IOPAD(0x0108, PIN_INPUT, 4) /* (W11) PRG1_PRU1_GPO0.RGMII2_RD0 */
-                       AM64X_IOPAD(0x010c, PIN_INPUT, 4) /* (V11) PRG1_PRU1_GPO1.RGMII2_RD1 */
-                       AM64X_IOPAD(0x0110, PIN_INPUT, 4) /* (AA12) PRG1_PRU1_GPO2.RGMII2_RD2 */
-                       AM64X_IOPAD(0x0114, PIN_INPUT, 4) /* (Y12) PRG1_PRU1_GPO3.RGMII2_RD3 */
-                       AM64X_IOPAD(0x0120, PIN_INPUT, 4) /* (U11) PRG1_PRU1_GPO6.RGMII2_RXC */
-                       AM64X_IOPAD(0x0118, PIN_INPUT, 4) /* (W12) PRG1_PRU1_GPO4.RGMII2_RX_CTL */
-                       AM64X_IOPAD(0x0134, PIN_OUTPUT, 4) /* (AA10) PRG1_PRU1_GPO11.RGMII2_TD0 */
-                       AM64X_IOPAD(0x0138, PIN_OUTPUT, 4) /* (V10) PRG1_PRU1_GPO12.RGMII2_TD1 */
-                       AM64X_IOPAD(0x013c, PIN_OUTPUT, 4) /* (U10) PRG1_PRU1_GPO13.RGMII2_TD2 */
-                       AM64X_IOPAD(0x0140, PIN_OUTPUT, 4) /* (AA11) PRG1_PRU1_GPO14.RGMII2_TD3 */
-                       AM64X_IOPAD(0x0148, PIN_OUTPUT, 4) /* (Y10) PRG1_PRU1_GPO16.RGMII2_TXC */
-                       AM64X_IOPAD(0x0144, PIN_OUTPUT, 4) /* (Y11) PRG1_PRU1_GPO15.RGMII2_TX_CTL */
-               >;
-       };
 };
 
 &dmsc {
        ti,secure-host;
 };
 
-&main_uart0 {
-       /delete-property/ power-domains;
-       /delete-property/ clocks;
-       /delete-property/ clock-names;
-       pinctrl-names = "default";
-       pinctrl-0 = <&main_uart0_pins_default>;
-       status = "okay";
-};
-
-&main_uart1 {
-       bootph-pre-ram;
-       pinctrl-names = "default";
-       pinctrl-0 = <&main_uart1_pins_default>;
-};
-
-&memorycontroller {
-       vtt-supply = <&vtt_supply>;
-       pinctrl-names = "default";
-       pinctrl-0 = <&ddr_vtt_pins_default>;
-};
-
 &sdhci0 {
-       /delete-property/ power-domains;
        clocks = <&clk_200mhz>;
        clock-names = "clk_xin";
-       ti,driver-strength-ohm = <50>;
-       disable-wp;
-       pinctrl-0 = <&main_mmc0_pins_default>;
 };
 
 &sdhci1 {
-       /delete-property/ power-domains;
        clocks = <&clk_200mhz>;
        clock-names = "clk_xin";
-       ti,driver-strength-ohm = <50>;
-       disable-wp;
-       pinctrl-0 = <&main_mmc1_pins_default>;
 };
 
 &main_gpio0 {
        bootph-pre-ram;
-       /delete-property/ power-domains;
 };
 
-/* EEPROM might be read before SYSFW is available */
-&main_i2c0 {
+/* UART is initialized before SYSFW is started
+ * so we can't do any power-domain/clock operations.
+ * Delete clock/power-domain properties to avoid
+ * UART init failure
+ */
+&main_uart0 {
        /delete-property/ power-domains;
+       /delete-property/ clocks;
+       /delete-property/ clock-names;
 };
 
-&usbss0 {
-       ti,vbus-divider;
-       ti,usb2-only;
-};
-
-&usb0 {
-       dr_mode = "otg";
-       maximum-speed = "high-speed";
-       pinctrl-names = "default";
-       pinctrl-0 = <&main_usb0_pins_default>;
+/* timer init is called as part of rproc_start() while
+ * starting System Firmware, so any clock/power-domain
+ * operations will fail as SYSFW is not yet up and running.
+ * Delete all clock/power-domain properties to avoid
+ * timer init failure.
+ * This is an always on timer at 20MHz.
+ */
+&main_timer0 {
+       /delete-property/ clocks;
+       /delete-property/ assigned-clocks;
+       /delete-property/ assigned-clock-parents;
+       /delete-property/ power-domains;
 };
-
-#include "k3-am642-evm-u-boot.dtsi"
index 32d4c317284f0f7d64ee638b378700019fd8a190..def4622ff1ee2c1d035ffe8b9bd448e7bb09f099 100644 (file)
@@ -3,33 +3,18 @@
  * Copyright (C) 2021 Texas Instruments Incorporated - https://www.ti.com/
  */
 
-/dts-v1/;
-
-#include <dt-bindings/mux/ti-serdes.h>
-#include <dt-bindings/phy/phy.h>
-#include <dt-bindings/net/ti-dp83867.h>
-#include "k3-am642.dtsi"
+#include "k3-am642-sk.dts"
 #include "k3-am64-sk-lp4-1600MTs.dtsi"
 #include "k3-am64-ddr.dtsi"
 
-/ {
-       chosen {
-               stdout-path = "serial2:115200n8";
-               tick-timer = &timer1;
-       };
+#include "k3-am642-sk-u-boot.dtsi"
 
+/ {
        aliases {
                remoteproc0 = &sysctrler;
                remoteproc1 = &a53_0;
        };
 
-       memory@80000000 {
-               device_type = "memory";
-               /* 2G RAM */
-               reg = <0x00000000 0x80000000 0x00000000 0x80000000>;
-               bootph-pre-ram;
-       };
-
        a53_0: a53@0 {
                compatible = "ti,am654-rproc";
                reg = <0x00 0x00a90000 0x00 0x10>;
                bootph-pre-ram;
        };
 
-       reserved-memory {
-               #address-cells = <2>;
-               #size-cells = <2>;
-               ranges;
-
-               secure_ddr: optee@9e800000 {
-                       reg = <0x00 0x9e800000 0x00 0x01800000>; /* for OP-TEE */
-                       alignment = <0x1000>;
-                       no-map;
-               };
-       };
-
        clk_200mhz: dummy-clock-200mhz {
                compatible = "fixed-clock";
                #clock-cells = <0>;
        };
 };
 
-&cbass_main {
-       main_esm: esm@420000 {
-               compatible = "ti,j721e-esm";
-               reg = <0x0 0x420000 0x0 0x1000>;
-               ti,esm-pins = <160>, <161>;
-               bootph-pre-ram;
-       };
-};
-
-&cbass_mcu {
+&main_esm {
        bootph-pre-ram;
-       mcu_esm: esm@4100000 {
-               compatible = "ti,j721e-esm";
-               reg = <0x0 0x4100000 0x0 0x1000>;
-               ti,esm-pins = <0>, <1>;
-               bootph-pre-ram;
-       };
 };
 
-&main_pmx0 {
+&mcu_esm {
        bootph-pre-ram;
-       main_uart0_pins_default: main-uart0-pins-default {
-               bootph-pre-ram;
-               pinctrl-single,pins = <
-                       AM64X_IOPAD(0x0238, PIN_INPUT, 0)               /* (B16) UART0_CTSn */
-                       AM64X_IOPAD(0x023c, PIN_OUTPUT, 0)              /* (A16) UART0_RTSn */
-                       AM64X_IOPAD(0x0230, PIN_INPUT, 0)               /* (D15) UART0_RXD */
-                       AM64X_IOPAD(0x0234, PIN_OUTPUT, 0)              /* (C16) UART0_TXD */
-               >;
-       };
-
-       main_uart1_pins_default: main-uart1-pins-default {
-               bootph-pre-ram;
-               pinctrl-single,pins = <
-                       AM64X_IOPAD(0x0248, PIN_INPUT, 0)               /* (D16) UART1_CTSn */
-                       AM64X_IOPAD(0x024c, PIN_OUTPUT, 0)              /* (E16) UART1_RTSn */
-                       AM64X_IOPAD(0x0240, PIN_INPUT, 0)               /* (E15) UART1_RXD */
-                       AM64X_IOPAD(0x0244, PIN_OUTPUT, 0)              /* (E14) UART1_TXD */
-               >;
-       };
-
-       main_mmc1_pins_default: main-mmc1-pins-default {
-               bootph-pre-ram;
-               pinctrl-single,pins = <
-                       AM64X_IOPAD(0x0294, PIN_INPUT_PULLUP, 0)        /* (J19) MMC1_CMD */
-                       AM64X_IOPAD(0x028c, PIN_INPUT_PULLDOWN, 0)      /* (L20) MMC1_CLK */
-                       AM64X_IOPAD(0x0288, PIN_INPUT_PULLUP, 0)        /* (K21) MMC1_DAT0 */
-                       AM64X_IOPAD(0x0284, PIN_INPUT_PULLUP, 0)        /* (L21) MMC1_DAT1 */
-                       AM64X_IOPAD(0x0280, PIN_INPUT_PULLUP, 0)        /* (K19) MMC1_DAT2 */
-                       AM64X_IOPAD(0x027c, PIN_INPUT_PULLUP, 0)        /* (K18) MMC1_DAT3 */
-                       AM64X_IOPAD(0x0298, PIN_INPUT_PULLUP, 0)        /* (D19) MMC1_SDCD */
-                       AM64X_IOPAD(0x029c, PIN_INPUT_PULLUP, 0)        /* (C20) MMC1_SDWP */
-               >;
-       };
-
-       main_usb0_pins_default: main-usb0-pins-default {
-               bootph-pre-ram;
-               pinctrl-single,pins = <
-                       AM64X_IOPAD(0x02a8, PIN_OUTPUT, 0) /* (E19) USB0_DRVVBUS */
-               >;
-       };
-
-       mdio1_pins_default: mdio1-pins-default {
-               pinctrl-single,pins = <
-                       AM64X_IOPAD(0x01fc, PIN_OUTPUT, 4) /* (R2) PRG0_PRU1_GPO19.MDIO0_MDC */
-                       AM64X_IOPAD(0x01f8, PIN_INPUT, 4) /* (P5) PRG0_PRU1_GPO18.MDIO0_MDIO */
-               >;
-       };
-
-       rgmii1_pins_default: rgmii1-pins-default {
-               pinctrl-single,pins = <
-                       AM64X_IOPAD(0x011c, PIN_INPUT, 4) /* (AA13) PRG1_PRU1_GPO5.RGMII1_RD0 */
-                       AM64X_IOPAD(0x0128, PIN_INPUT, 4) /* (U12) PRG1_PRU1_GPO8.RGMII1_RD1 */
-                       AM64X_IOPAD(0x0150, PIN_INPUT, 4) /* (Y13) PRG1_PRU1_GPO18.RGMII1_RD2 */
-                       AM64X_IOPAD(0x0154, PIN_INPUT, 4) /* (V12) PRG1_PRU1_GPO19.RGMII1_RD3 */
-                       AM64X_IOPAD(0x00d8, PIN_INPUT, 4) /* (W13) PRG1_PRU0_GPO8.RGMII1_RXC */
-                       AM64X_IOPAD(0x00cc, PIN_INPUT, 4) /* (V13) PRG1_PRU0_GPO5.RGMII1_RX_CTL */
-                       AM64X_IOPAD(0x0124, PIN_OUTPUT, 4) /* (V15) PRG1_PRU1_GPO7.RGMII1_TD0 */
-                       AM64X_IOPAD(0x012c, PIN_OUTPUT, 4) /* (V14) PRG1_PRU1_GPO9.RGMII1_TD1 */
-                       AM64X_IOPAD(0x0130, PIN_OUTPUT, 4) /* (W14) PRG1_PRU1_GPO10.RGMII1_TD2 */
-                       AM64X_IOPAD(0x014c, PIN_OUTPUT, 4) /* (AA14) PRG1_PRU1_GPO17.RGMII1_TD3 */
-                       AM64X_IOPAD(0x00e0, PIN_OUTPUT, 4) /* (U14) PRG1_PRU0_GPO10.RGMII1_TXC */
-                       AM64X_IOPAD(0x00dc, PIN_OUTPUT, 4) /* (U15) PRG1_PRU0_GPO9.RGMII1_TX_CTL */
-               >;
-       };
-
-       rgmii2_pins_default: rgmii2-pins-default {
-               pinctrl-single,pins = <
-                       AM64X_IOPAD(0x0108, PIN_INPUT, 4) /* (W11) PRG1_PRU1_GPO0.RGMII2_RD0 */
-                       AM64X_IOPAD(0x010c, PIN_INPUT, 4) /* (V11) PRG1_PRU1_GPO1.RGMII2_RD1 */
-                       AM64X_IOPAD(0x0110, PIN_INPUT, 4) /* (AA12) PRG1_PRU1_GPO2.RGMII2_RD2 */
-                       AM64X_IOPAD(0x0114, PIN_INPUT, 4) /* (Y12) PRG1_PRU1_GPO3.RGMII2_RD3 */
-                       AM64X_IOPAD(0x0120, PIN_INPUT, 4) /* (U11) PRG1_PRU1_GPO6.RGMII2_RXC */
-                       AM64X_IOPAD(0x0118, PIN_INPUT, 4) /* (W12) PRG1_PRU1_GPO4.RGMII2_RX_CTL */
-                       AM64X_IOPAD(0x0134, PIN_OUTPUT, 4) /* (AA10) PRG1_PRU1_GPO11.RGMII2_TD0 */
-                       AM64X_IOPAD(0x0138, PIN_OUTPUT, 4) /* (V10) PRG1_PRU1_GPO12.RGMII2_TD1 */
-                       AM64X_IOPAD(0x013c, PIN_OUTPUT, 4) /* (U10) PRG1_PRU1_GPO13.RGMII2_TD2 */
-                       AM64X_IOPAD(0x0140, PIN_OUTPUT, 4) /* (AA11) PRG1_PRU1_GPO14.RGMII2_TD3 */
-                       AM64X_IOPAD(0x0148, PIN_OUTPUT, 4) /* (Y10) PRG1_PRU1_GPO16.RGMII2_TXC */
-                       AM64X_IOPAD(0x0144, PIN_OUTPUT, 4) /* (Y11) PRG1_PRU1_GPO15.RGMII2_TX_CTL */
-               >;
-       };
 };
 
 &dmsc {
        ti,secure-host;
 };
 
-&main_uart0 {
-       /delete-property/ power-domains;
-       /delete-property/ clocks;
-       /delete-property/ clock-names;
-       pinctrl-names = "default";
-       pinctrl-0 = <&main_uart0_pins_default>;
-       status = "okay";
-};
-
-&main_uart1 {
-       bootph-pre-ram;
-       pinctrl-names = "default";
-       pinctrl-0 = <&main_uart1_pins_default>;
-};
-
 &sdhci1 {
-       /delete-property/ power-domains;
        clocks = <&clk_200mhz>;
        clock-names = "clk_xin";
-       ti,driver-strength-ohm = <50>;
-       disable-wp;
-       pinctrl-0 = <&main_mmc1_pins_default>;
-};
-
-&serdes_ln_ctrl {
-       idle-states = <AM64_SERDES0_LANE0_USB>;
 };
 
 &serdes_wiz0 {
        status = "okay";
 };
 
-&serdes0 {
-       serdes0_usb_link: link@0 {
-               reg = <0>;
-               cdns,num-lanes = <1>;
-               #phy-cells = <0>;
-               cdns,phy-type = <PHY_TYPE_USB3>;
-               resets = <&serdes_wiz0 1>;
-       };
-};
-
-&usbss0 {
-       ti,vbus-divider;
-};
-
-&usb0 {
-       dr_mode = "host";
-       maximum-speed = "super-speed";
-       pinctrl-names = "default";
-       pinctrl-0 = <&main_usb0_pins_default>;
-       phys = <&serdes0_usb_link>;
-       phy-names = "cdns3,usb3-phy";
-};
-
-&cpsw3g {
-       pinctrl-names = "default";
-       pinctrl-0 = <&mdio1_pins_default
-                    &rgmii1_pins_default
-                    &rgmii2_pins_default>;
-};
-
-&cpsw_port2 {
-       phy-mode = "rgmii-rxid";
-       phy-handle = <&cpsw3g_phy1>;
+/* UART is initialized before SYSFW is started
+ * so we can't do any power-domain/clock operations.
+ * Delete clock/power-domain properties to avoid
+ * UART init failure
+ */
+&main_uart0 {
+       /delete-property/ power-domains;
+       /delete-property/ clocks;
+       /delete-property/ clock-names;
 };
 
-&cpsw3g_mdio {
-       cpsw3g_phy1: ethernet-phy@1 {
-               reg = <1>;
-               ti,rx-internal-delay = <DP83867_RGMIIDCTL_2_00_NS>;
-               ti,fifo-depth = <DP83867_PHYCR_FIFO_DEPTH_4_B_NIB>;
-       };
+/* timer init is called as part of rproc_start() while
+ * starting System Firmware, so any clock/power-domain
+ * operations will fail as SYSFW is not yet up and running.
+ * Delete all clock/power-domain properties to avoid
+ * timer init failure.
+ * This is an always on timer at 20MHz.
+ */
+&main_timer0 {
+       /delete-property/ clocks;
+       /delete-property/ assigned-clocks;
+       /delete-property/ assigned-clock-parents;
+       /delete-property/ power-domains;
 };
-
-#include "k3-am642-sk-u-boot.dtsi"
index 3d6be025bd512c4b43d86597a07b2fbdbeb72fea..c277ef8abab08467b7cbf94174ca62334a4c2a39 100644 (file)
@@ -7,12 +7,7 @@
 
 / {
        chosen {
-               stdout-path = "serial2:115200n8";
-               tick-timer = &timer1;
-       };
-
-       aliases {
-               mmc1 = &sdhci1;
+               tick-timer = &main_timer0;
        };
 
        memory@80000000 {
 
 &cbass_main{
        bootph-pre-ram;
-       timer1: timer@2400000 {
-               compatible = "ti,omap5430-timer";
-               reg = <0x0 0x2400000 0x0 0x80>;
-               ti,timer-alwon;
-               clock-frequency = <200000000>;
-               bootph-pre-ram;
-       };
+};
+
+&cbass_mcu {
+       bootph-pre-ram;
+};
+
+&main_timer0 {
+       bootph-pre-ram;
+       clock-frequency = <200000000>;
 };
 
 &main_conf {
 
 &main_pmx0 {
        bootph-pre-ram;
-       main_i2c0_pins_default: main-i2c0-pins-default {
-               bootph-pre-ram;
-               pinctrl-single,pins = <
-                       AM64X_IOPAD(0x0260, PIN_INPUT_PULLUP, 0) /* (A18) I2C0_SCL */
-                       AM64X_IOPAD(0x0264, PIN_INPUT_PULLUP, 0) /* (B18) I2C0_SDA */
-               >;
-       };
+};
+
+&main_i2c0_pins_default {
+       bootph-pre-ram;
 };
 
 &main_i2c0 {
        bootph-pre-ram;
-       pinctrl-names = "default";
-       pinctrl-0 = <&main_i2c0_pins_default>;
-       clock-frequency = <400000>;
-
-       tps65219: pmic@30 {
-               compatible = "ti,tps65219";
-               reg = <0x30>;
-
-               regulators {
-                       buck1_reg: buck1 {
-                               regulator-name = "VDD_CORE";
-                               regulator-min-microvolt = <750000>;
-                               regulator-max-microvolt = <750000>;
-                               regulator-boot-on;
-                               regulator-always-on;
-                       };
-
-                       buck2_reg: buck2 {
-                               regulator-name = "VCC1V8";
-                               regulator-min-microvolt = <1800000>;
-                               regulator-max-microvolt = <1800000>;
-                               regulator-boot-on;
-                               regulator-always-on;
-                       };
-
-                       buck3_reg: buck3 {
-                               regulator-name = "VDD_LPDDR4";
-                               regulator-min-microvolt = <1100000>;
-                               regulator-max-microvolt = <1100000>;
-                               regulator-boot-on;
-                               regulator-always-on;
-                       };
-
-                       ldo1_reg: ldo1 {
-                               regulator-name = "VDDSHV_SD_IO_PMIC";
-                               regulator-min-microvolt = <33000000>;
-                               regulator-max-microvolt = <33000000>;
-                       };
-
-                       ldo2_reg: ldo2 {
-                               regulator-name = "VDDAR_CORE";
-                               regulator-min-microvolt = <850000>;
-                               regulator-max-microvolt = <850000>;
-                               regulator-boot-on;
-                               regulator-always-on;
-                       };
-
-                       ldo3_reg: ldo3 {
-                               regulator-name = "VDDA_1V8";
-                               regulator-min-microvolt = <18000000>;
-                               regulator-max-microvolt = <18000000>;
-                               regulator-boot-on;
-                               regulator-always-on;
-                       };
-
-                       ldo4_reg: ldo4 {
-                               regulator-name = "VDD_PHY_2V5";
-                               regulator-min-microvolt = <25000000>;
-                               regulator-max-microvolt = <25000000>;
-                               regulator-boot-on;
-                               regulator-always-on;
-                       };
-               };
-       };
+};
+
+&main_uart0_pins_default {
+       bootph-pre-ram;
 };
 
 &main_uart0 {
 };
 
 &cpsw3g {
-       reg = <0x0 0x8000000 0x0 0x200000>,
-             <0x0 0x43000200 0x0 0x8>;
-       reg-names = "cpsw_nuss", "mac_efuse";
-       /delete-property/ ranges;
        bootph-pre-ram;
 
-       cpsw-phy-sel@04044 {
-               compatible = "ti,am64-phy-gmii-sel";
-               reg = <0x0 0x43004044 0x0 0x8>;
-               bootph-pre-ram;
-       };
-
        ethernet-ports {
                bootph-pre-ram;
        };
 };
 
 &usb0 {
-       dr_mode = "host";
        bootph-pre-ram;
 };
 
index 2e2d40da360a274e0b2cc9c8164f45b31434b1a7..cbce43dbe3f9c286055b35dd10f6dbffb8bdc4c0 100644 (file)
        model = "Texas Instruments AM642 SK";
 
        chosen {
-               stdout-path = "serial2:115200n8";
-               bootargs = "console=ttyS2,115200n8 earlycon=ns16550a,mmio32,0x02800000";
+               stdout-path = &main_uart0;
+       };
+
+       aliases {
+               serial0 = &mcu_uart0;
+               serial1 = &main_uart1;
+               serial2 = &main_uart0;
+               i2c0 = &main_i2c0;
+               i2c1 = &main_i2c1;
+               mmc0 = &sdhci0;
+               mmc1 = &sdhci1;
+               ethernet0 = &cpsw_port1;
+               ethernet1 = &cpsw_port2;
        };
 
        memory@80000000 {
                device_type = "memory";
                /* 2G RAM */
                reg = <0x00000000 0x80000000 0x00000000 0x80000000>;
-
        };
 
        reserved-memory {
                };
        };
 
-       vusb_main: fixed-regulator-vusb-main5v0 {
+       vusb_main: regulator-0 {
                /* USB MAIN INPUT 5V DC */
                compatible = "regulator-fixed";
                regulator-name = "vusb_main5v0";
                regulator-boot-on;
        };
 
-       vcc_3v3_sys: fixedregulator-vcc-3v3-sys {
+       vcc_3v3_sys: regulator-1 {
                /* output of LP8733xx */
                compatible = "regulator-fixed";
                regulator-name = "vcc_3v3_sys";
                regulator-boot-on;
        };
 
-       vdd_mmc1: fixed-regulator-sd {
+       vdd_mmc1: regulator-2 {
                /* TPS2051BD */
                compatible = "regulator-fixed";
                regulator-name = "vdd_mmc1";
                gpio = <&exp1 3 GPIO_ACTIVE_HIGH>;
        };
 
-       com8_ls_en: regulator-1 {
+       com8_ls_en: regulator-3 {
                compatible = "regulator-fixed";
                regulator-name = "com8_ls_en";
                regulator-min-microvolt = <3300000>;
                gpio = <&main_gpio0 62 GPIO_ACTIVE_LOW>;
        };
 
-       wlan_en: regulator-2 {
+       wlan_en: regulator-4 {
                /* output of SN74AVC4T245RSVR */
                compatible = "regulator-fixed";
                regulator-name = "wlan_en";
 };
 
 &main_pmx0 {
-       main_mmc1_pins_default: main-mmc1-pins-default {
+       main_mmc1_pins_default: main-mmc1-default-pins {
                pinctrl-single,pins = <
-                       AM64X_IOPAD(0x0294, PIN_INPUT, 0) /* (J19) MMC1_CMD */
+                       AM64X_IOPAD(0x029c, PIN_INPUT_PULLUP, 0) /* (C20) MMC1_SDWP */
+                       AM64X_IOPAD(0x0298, PIN_INPUT_PULLUP, 0) /* (D19) MMC1_SDCD */
+                       AM64X_IOPAD(0x0294, PIN_INPUT_PULLUP, 0) /* (J19) MMC1_CMD */
                        AM64X_IOPAD(0x0290, PIN_INPUT, 0) /* (#N/A) MMC1_CLKLB */
-                       AM64X_IOPAD(0x028c, PIN_INPUT, 0) /* (L20) MMC1_CLK */
-                       AM64X_IOPAD(0x0288, PIN_INPUT, 0) /* (K21) MMC1_DAT0 */
-                       AM64X_IOPAD(0x0284, PIN_INPUT, 0) /* (L21) MMC1_DAT1 */
-                       AM64X_IOPAD(0x0280, PIN_INPUT, 0) /* (K19) MMC1_DAT2 */
-                       AM64X_IOPAD(0x027c, PIN_INPUT, 0) /* (K18) MMC1_DAT3 */
-                       AM64X_IOPAD(0x0298, PIN_INPUT, 0) /* (D19) MMC1_SDCD */
+                       AM64X_IOPAD(0x028c, PIN_INPUT_PULLDOWN, 0) /* (L20) MMC1_CLK */
+                       AM64X_IOPAD(0x0288, PIN_INPUT_PULLUP, 0) /* (K21) MMC1_DAT0 */
+                       AM64X_IOPAD(0x0284, PIN_INPUT_PULLUP, 0) /* (L21) MMC1_DAT1 */
+                       AM64X_IOPAD(0x0280, PIN_INPUT_PULLUP, 0) /* (K19) MMC1_DAT2 */
+                       AM64X_IOPAD(0x027c, PIN_INPUT_PULLUP, 0) /* (K18) MMC1_DAT3 */
                >;
        };
 
-       main_uart0_pins_default: main-uart0-pins-default {
+       main_uart0_pins_default: main-uart0-default-pins {
                pinctrl-single,pins = <
                        AM64X_IOPAD(0x0238, PIN_INPUT, 0) /* (B16) UART0_CTSn */
                        AM64X_IOPAD(0x023c, PIN_OUTPUT, 0) /* (A16) UART0_RTSn */
                >;
        };
 
-       main_usb0_pins_default: main-usb0-pins-default {
+       main_uart1_pins_default: main-uart1-default-pins {
+               pinctrl-single,pins = <
+                       AM64X_IOPAD(0x0248, PIN_INPUT, 0) /* (D16) UART1_CTSn */
+                       AM64X_IOPAD(0x024c, PIN_OUTPUT, 0) /* (E16) UART1_RTSn */
+                       AM64X_IOPAD(0x0240, PIN_INPUT, 0) /* (E15) UART1_RXD */
+                       AM64X_IOPAD(0x0244, PIN_OUTPUT, 0) /* (E14) UART1_TXD */
+               >;
+       };
+
+       main_usb0_pins_default: main-usb0-default-pins {
                pinctrl-single,pins = <
                        AM64X_IOPAD(0x02a8, PIN_OUTPUT, 0) /* (E19) USB0_DRVVBUS */
                >;
        };
 
-       main_i2c1_pins_default: main-i2c1-pins-default {
+       main_i2c0_pins_default: main-i2c0-default-pins {
+               pinctrl-single,pins = <
+                       AM64X_IOPAD(0x0260, PIN_INPUT_PULLUP, 0) /* (A18) I2C0_SCL */
+                       AM64X_IOPAD(0x0264, PIN_INPUT_PULLUP, 0) /* (B18) I2C0_SDA */
+               >;
+       };
+
+       main_i2c1_pins_default: main-i2c1-default-pins {
                pinctrl-single,pins = <
                        AM64X_IOPAD(0x0268, PIN_INPUT_PULLUP, 0) /* (C18) I2C1_SCL */
                        AM64X_IOPAD(0x026c, PIN_INPUT_PULLUP, 0) /* (B19) I2C1_SDA */
                >;
        };
 
-       mdio1_pins_default: mdio1-pins-default {
+       mdio1_pins_default: mdio1-default-pins {
                pinctrl-single,pins = <
                        AM64X_IOPAD(0x01fc, PIN_OUTPUT, 4) /* (R2) PRG0_PRU1_GPO19.MDIO0_MDC */
                        AM64X_IOPAD(0x01f8, PIN_INPUT, 4) /* (P5) PRG0_PRU1_GPO18.MDIO0_MDIO */
                >;
        };
 
-       rgmii1_pins_default: rgmii1-pins-default {
+       rgmii1_pins_default: rgmii1-default-pins {
                pinctrl-single,pins = <
                        AM64X_IOPAD(0x011c, PIN_INPUT, 4) /* (AA13) PRG1_PRU1_GPO5.RGMII1_RD0 */
                        AM64X_IOPAD(0x0128, PIN_INPUT, 4) /* (U12) PRG1_PRU1_GPO8.RGMII1_RD1 */
                >;
        };
 
-       rgmii2_pins_default: rgmii2-pins-default {
+       rgmii2_pins_default: rgmii2-default-pins {
                pinctrl-single,pins = <
                        AM64X_IOPAD(0x0108, PIN_INPUT, 4) /* (W11) PRG1_PRU1_GPO0.RGMII2_RD0 */
                        AM64X_IOPAD(0x010c, PIN_INPUT, 4) /* (V11) PRG1_PRU1_GPO1.RGMII2_RD1 */
                >;
        };
 
-       ospi0_pins_default: ospi0-pins-default {
+       ospi0_pins_default: ospi0-default-pins {
                pinctrl-single,pins = <
                        AM64X_IOPAD(0x0000, PIN_OUTPUT, 0) /* (N20) OSPI0_CLK */
                        AM64X_IOPAD(0x002c, PIN_OUTPUT, 0) /* (L19) OSPI0_CSn0 */
                >;
        };
 
-       main_ecap0_pins_default: main-ecap0-pins-default {
+       main_ecap0_pins_default: main-ecap0-default-pins {
                pinctrl-single,pins = <
                        AM64X_IOPAD(0x0270, PIN_INPUT, 0) /* (D18) ECAP0_IN_APWM_OUT */
                >;
        };
-       main_wlan_en_pins_default: main-wlan-en-pins-default {
+       main_wlan_en_pins_default: main-wlan-en-default-pins {
                pinctrl-single,pins = <
                        AM64X_IOPAD(0x00c4, PIN_OUTPUT_PULLUP, 7) /* (V8) GPIO0_48 */
                >;
        };
 
-       main_com8_ls_en_pins_default: main-com8-ls-en-pins-default {
+       main_com8_ls_en_pins_default: main-com8-ls-en-default-pins {
                pinctrl-single,pins = <
                        AM64X_IOPAD(0x00fc, PIN_OUTPUT, 7) /* (U7) PRG1_PRU0_GPO17.GPIO0_62 */
                >;
        };
 
-       main_wlan_pins_default: main-wlan-pins-default {
+       main_wlan_pins_default: main-wlan-default-pins {
                pinctrl-single,pins = <
                        AM64X_IOPAD(0x00bc, PIN_INPUT, 7) /* (U8) GPIO0_46 */
                >;
        status = "okay";
        pinctrl-names = "default";
        pinctrl-0 = <&main_uart0_pins_default>;
+       current-speed = <115200>;
 };
 
 &main_uart1 {
        /* main_uart1 is reserved for firmware usage */
        status = "reserved";
+       pinctrl-names = "default";
+       pinctrl-0 = <&main_uart1_pins_default>;
+};
+
+&main_i2c0 {
+       status = "okay";
+       pinctrl-names = "default";
+       pinctrl-0 = <&main_i2c0_pins_default>;
+       clock-frequency = <400000>;
+
+       eeprom@51 {
+               compatible = "atmel,24c512";
+               reg = <0x51>;
+       };
 };
 
 &main_i2c1 {
 
 &cpsw3g {
        pinctrl-names = "default";
-       pinctrl-0 = <&rgmii1_pins_default
-                    &rgmii2_pins_default>;
+       pinctrl-0 = <&rgmii1_pins_default>, <&rgmii2_pins_default>;
 };
 
 &cpsw_port1 {
                cdns,tchsh-ns = <60>;
                cdns,tslch-ns = <60>;
                cdns,read-delay = <4>;
+
+               partitions {
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       partition@0 {
+                               label = "ospi.tiboot3";
+                               reg = <0x0 0x100000>;
+                       };
+
+                       partition@100000 {
+                               label = "ospi.tispl";
+                               reg = <0x100000 0x200000>;
+                       };
+
+                       partition@300000 {
+                               label = "ospi.u-boot";
+                               reg = <0x300000 0x400000>;
+                       };
+
+                       partition@700000 {
+                               label = "ospi.env";
+                               reg = <0x700000 0x40000>;
+                       };
+
+                       partition@740000 {
+                               label = "ospi.env.backup";
+                               reg = <0x740000 0x40000>;
+                       };
+
+                       partition@800000 {
+                               label = "ospi.rootfs";
+                               reg = <0x800000 0x37c0000>;
+                       };
+
+                       partition@3fc0000 {
+                               label = "ospi.phypattern";
+                               reg = <0x3fc0000 0x40000>;
+                       };
+               };
        };
 };
 
 &mailbox0_cluster2 {
+       status = "okay";
+
        mbox_main_r5fss0_core0: mbox-main-r5fss0-core0 {
                ti,mbox-rx = <0 0 2>;
                ti,mbox-tx = <1 0 2>;
        };
 };
 
-&mailbox0_cluster3 {
-       status = "disabled";
-};
-
 &mailbox0_cluster4 {
+       status = "okay";
+
        mbox_main_r5fss1_core0: mbox-main-r5fss1-core0 {
                ti,mbox-rx = <0 0 2>;
                ti,mbox-tx = <1 0 2>;
        };
 };
 
-&mailbox0_cluster5 {
-       status = "disabled";
-};
-
 &mailbox0_cluster6 {
+       status = "okay";
+
        mbox_m4_0: mbox-m4-0 {
                ti,mbox-rx = <0 0 2>;
                ti,mbox-tx = <1 0 2>;
        };
 };
 
-&mailbox0_cluster7 {
-       status = "disabled";
-};
-
 &main_r5fss0_core0 {
-       mboxes = <&mailbox0_cluster2 &mbox_main_r5fss0_core0>;
+       mboxes = <&mailbox0_cluster2>, <&mbox_main_r5fss0_core0>;
        memory-region = <&main_r5fss0_core0_dma_memory_region>,
                        <&main_r5fss0_core0_memory_region>;
 };
 
 &main_r5fss0_core1 {
-       mboxes = <&mailbox0_cluster2 &mbox_main_r5fss0_core1>;
+       mboxes = <&mailbox0_cluster2>, <&mbox_main_r5fss0_core1>;
        memory-region = <&main_r5fss0_core1_dma_memory_region>,
                        <&main_r5fss0_core1_memory_region>;
 };
 
 &main_r5fss1_core0 {
-       mboxes = <&mailbox0_cluster4 &mbox_main_r5fss1_core0>;
+       mboxes = <&mailbox0_cluster4>, <&mbox_main_r5fss1_core0>;
        memory-region = <&main_r5fss1_core0_dma_memory_region>,
                        <&main_r5fss1_core0_memory_region>;
 };
 
 &main_r5fss1_core1 {
-       mboxes = <&mailbox0_cluster4 &mbox_main_r5fss1_core1>;
+       mboxes = <&mailbox0_cluster4>, <&mbox_main_r5fss1_core1>;
        memory-region = <&main_r5fss1_core1_dma_memory_region>,
                        <&main_r5fss1_core1_memory_region>;
 };
index 8a76f4821b11b0dcadb84fd3a92034885c24eeae..7a6eedea3aaec96ed65706d72c0047b7ea6abc32 100644 (file)
@@ -58,6 +58,7 @@
        L2_0: l2-cache0 {
                compatible = "cache";
                cache-level = <2>;
+               cache-unified;
                cache-size = <0x40000>;
                cache-line-size = <64>;
                cache-sets = <256>;
index ddd629e8c99d50a25cc748fc5ed6a6e05465f513..ac476d5cdd7f85c23d35596ff884dbdc81884bb7 100644 (file)
@@ -9,6 +9,7 @@
 #include <dt-bindings/clock/mt7988-clk.h>
 #include <dt-bindings/reset/mt7988-reset.h>
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/phy/phy.h>
 
 / {
        compatible = "mediatek,mt7988-rfb";
                #clock-cells = <1>;
        };
 
+       dummy_clk: dummy12m {
+               compatible = "fixed-clock";
+               clock-frequency = <12000000>;
+               #clock-cells = <0>;
+               /* must need this line, or uart uanable to get dummy_clk */
+               bootph-all;
+       };
+
+       xhci1: xhci@11200000 {
+               compatible = "mediatek,mt7988-xhci",
+                            "mediatek,mtk-xhci";
+               reg = <0 0x11200000 0 0x2e00>,
+                     <0 0x11203e00 0 0x0100>;
+               reg-names = "mac", "ippc";
+               interrupts = <GIC_SPI 172 IRQ_TYPE_LEVEL_HIGH>;
+               phys = <&tphyu2port0 PHY_TYPE_USB2>,
+                      <&tphyu3port0 PHY_TYPE_USB3>;
+               clocks = <&dummy_clk>,
+                        <&dummy_clk>,
+                        <&dummy_clk>,
+                        <&dummy_clk>,
+                        <&dummy_clk>;
+               clock-names = "sys_ck",
+                             "xhci_ck",
+                             "ref_ck",
+                             "mcu_ck",
+                             "dma_ck";
+               #address-cells = <2>;
+               #size-cells = <2>;
+               status = "okay";
+       };
+
+       usbtphy: usb-phy@11c50000 {
+               compatible = "mediatek,mt7988",
+                            "mediatek,generic-tphy-v2";
+               #address-cells = <2>;
+               #size-cells = <2>;
+               ranges;
+               status = "okay";
+
+               tphyu2port0: usb-phy@11c50000 {
+                       reg = <0 0x11c50000 0 0x700>;
+                       clocks = <&dummy_clk>;
+                       clock-names = "ref";
+                       #phy-cells = <1>;
+                       status = "okay";
+               };
+
+               tphyu3port0: usb-phy@11c50700 {
+                       reg = <0 0x11c50700 0 0x900>;
+                       clocks = <&dummy_clk>;
+                       clock-names = "ref";
+                       #phy-cells = <1>;
+                       mediatek,usb3-pll-ssc-delta;
+                       mediatek,usb3-pll-ssc-delta1;
+                       status = "okay";
+               };
+       };
+
        xfi_pextp0: syscon@11f20000 {
                compatible = "mediatek,mt7988-xfi_pextp_0", "syscon";
                reg = <0 0x11f20000 0 0x10000>;
index 3cab7807e316349adc672759ae243039e127a523..a93666cb41948d479e30352c58226c075528dbe9 100644 (file)
                &r1en_pins
                &r1oen_pins
        >;
-};
\ No newline at end of file
+};
index 2b93d089384ef8cf139c7af9e835ecc2b2942db9..3b684fc63d53bc8bd47acf0c3709a5efa33dc65f 100644 (file)
                spi0 = &qspi;
        };
 
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               ARM9260_0: cpu@0 {
+                       device_type = "cpu";
+                       compatible = "arm,arm926ej-s";
+                       clocks = <&pmc PMC_TYPE_CORE 19>, <&pmc PMC_TYPE_CORE 11>, <&main_xtal>;
+                       clock-names = "cpu", "master", "xtal";
+               };
+       };
+
        clocks {
                slow_rc_osc: slow_rc_osc {
                        compatible = "fixed-clock";
                };
        };
 
-       cpus {
-               #address-cells = <1>;
-               #size-cells = <0>;
-
-               ARM9260_0: cpu@0 {
-                       device_type = "cpu";
-                       compatible = "arm,arm926ej-s";
-                       clocks = <&pmc PMC_TYPE_CORE 19>, <&pmc PMC_TYPE_CORE 11>, <&main_xtal>;
-                       clock-names = "cpu", "master", "xtal";
-               };
-       };
-
        ahb {
                compatible = "simple-bus";
                #address-cells = <1>;
                                compatible = "microchip,sam9x60-qspi";
                                reg = <0xf0014000 0x100>, <0x70000000 0x10000000>;
                                reg-names = "qspi_base", "qspi_mmap";
-                               clocks =  <&pmc PMC_TYPE_PERIPHERAL 35>, <&pmc PMC_TYPE_SYSTEM 18>; /* ID_QSPI */
+                               clocks = <&pmc PMC_TYPE_PERIPHERAL 35>, <&pmc PMC_TYPE_SYSTEM 18>; /* ID_QSPI */
                                clock-names = "pclk", "qspick";
                                #address-cells = <1>;
                                #size-cells = <0>;
                                status = "disabled";
                        };
 
+                       pit64b0: timer@f0028000 {
+                               compatible = "microchip,sam9x60-pit64b";
+                               reg = <0xf0028000 0xec>;
+                               clocks = <&pmc PMC_TYPE_PERIPHERAL 37>, <&pmc PMC_TYPE_GCK 37>;
+                               clock-names = "pclk", "gclk";
+                       };
+
                        flx0: flexcom@f801c600 {
                                compatible = "atmel,sama5d2-flexcom";
                                reg = <0xf801c000 0x200>;
                                reg = <0xf8050000 0x100>;
                        };
 
+                       pmecc: ecc-engine@ffffe000 {
+                               compatible = "microchip,sam9x60-pmecc", "atmel,at91sam9g45-pmecc";
+                               reg = <0xffffe000 0x300>,
+                                     <0xffffe600 0x100>;
+                       };
+
+                       smc: smc@ffffea00 {
+                               compatible = "microchip,sam9x60-smc", "atmel,at91sam9260-smc", "syscon";
+                               reg = <0xffffea00 0x100>;
+                       };
+
                        dbgu: serial@fffff200 {
                                compatible = "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart";
                                reg = <0xfffff200 0x200>;
                                clock-names = "usart";
                        };
 
-                       pinctrl {
+                       pinctrl: pinctrl@fffff400 {
                                #address-cells = <1>;
                                #size-cells = <1>;
                                compatible = "microchip,sam9x60-pinctrl", "simple-bus";
                                        pinctrl_dbgu: dbgu-0 {
                                                atmel,pins =
                                                        <AT91_PIOA 9 AT91_PERIPH_A AT91_PINCTRL_PULL_UP
-                                                       AT91_PIOA 10 AT91_PERIPH_A AT91_PINCTRL_NONE>;
+                                                        AT91_PIOA 10 AT91_PERIPH_A AT91_PINCTRL_NONE>;
                                        };
                                };
 
                                };
                        };
 
-                       pmecc: ecc-engine@ffffe000 {
-                               compatible = "microchip,sam9x60-pmecc", "atmel,at91sam9g45-pmecc";
-                               reg = <0xffffe000 0x300>,
-                                     <0xffffe600 0x100>;
-                       };
-
-                       smc: smc@ffffea00 {
-                               compatible = "microchip,sam9x60-smc", "atmel,at91sam9260-smc", "syscon";
-                               reg = <0xffffea00 0x100>;
-                       };
-
                        pioA: gpio@fffff400 {
                                compatible = "atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
                                reg = <0xfffff400 0x200>;
                                clocks = <&pmc PMC_TYPE_CORE 11>; /* ID_MCK. */
                        };
 
-                       pit64b0: timer@f0028000 {
-                               compatible = "microchip,sam9x60-pit64b";
-                               reg = <0xf0028000 0xec>;
-                               clocks = <&pmc PMC_TYPE_PERIPHERAL 37>, <&pmc PMC_TYPE_GCK 37>;
-                               clock-names = "pclk", "gclk";
-                       };
-
                        clk32: sckc@fffffe50 {
                                compatible = "microchip,sam9x60-sckc";
                                reg = <0xfffffe50 0x4>;
index 45e2f4cc406268821187c6d78b46fba1b9b72ccb..74016f5e288aeea693804472f96c991fbdadb4c5 100644 (file)
@@ -62,7 +62,7 @@
                                status = "okay";
 
                                i2c@600 {
-                                       compatible = "atmel,sama5d2-i2c";
+                                       compatible = "microchip,sam9x60-i2c";
                                        reg = <0x600 0x200>;
                                        pinctrl-names = "default";
                                        pinctrl-0 = <&pinctrl_flx0>;
index fa8548624a049979f4d8895375cfb1a3d090f488..8e897833bb144b6c4ac12d26c2ecc5852dc6b08b 100644 (file)
 #ifndef __ASM_ARM_BITOPS_H
 #define __ASM_ARM_BITOPS_H
 
+#if __LINUX_ARM_ARCH__ < 5
+
 #include <asm-generic/bitops/__ffs.h>
 #include <asm-generic/bitops/__fls.h>
 #include <asm-generic/bitops/fls.h>
+
+#else
+
+#define PLATFORM_FFS
+#define PLATFORM_FLS
+
+#if !IS_ENABLED(CONFIG_HAS_THUMB2) && CONFIG_IS_ENABLED(SYS_THUMB_BUILD)
+
+unsigned long __fls(unsigned long word);
+unsigned long __ffs(unsigned long word);
+int fls(unsigned int x);
+int ffs(int x);
+
+#else
+
+#include <asm-generic/bitops/builtin-__fls.h>
+#include <asm-generic/bitops/builtin-__ffs.h>
+#include <asm-generic/bitops/builtin-fls.h>
+#include <asm-generic/bitops/builtin-ffs.h>
+
+#endif
+#endif
+
 #include <asm-generic/bitops/fls64.h>
 
 #ifdef __KERNEL__
@@ -113,7 +138,7 @@ static inline int test_bit(int nr, const void * addr)
 
 static inline int __ilog2(unsigned int x)
 {
-       return generic_fls(x) - 1;
+       return fls(x) - 1;
 }
 
 #define ffz(x)  __ffs(~(x))
index 0ece4b09060a3c94d11324df363f0cb38c4bea9e..ee79a19c05c986ad7904e520593e43276a4c105e 100644 (file)
@@ -34,9 +34,6 @@ enum {
 };
 #endif
 
-/* Linker symbols. */
-extern char __bss_start[], __bss_end[];
-
 #ifndef CONFIG_DM
 extern gd_t gdata;
 #endif
index 62cf80f3739c821aad74901466a786d1d758dc83..b1bcd3746625a53b66c41ff98fec3c41e4027244 100644 (file)
@@ -113,6 +113,11 @@ AFLAGS_REMOVE_memset.o := -mthumb -mthumb-interwork
 AFLAGS_REMOVE_memcpy.o := -mthumb -mthumb-interwork
 AFLAGS_memset.o := -DMEMSET_NO_THUMB_BUILD
 AFLAGS_memcpy.o := -DMEMCPY_NO_THUMB_BUILD
+
+# This is only necessary to force ARM mode on THUMB1 targets.
+ifneq ($(CONFIG_SYS_ARM_ARCH),4)
+obj-y   += bitops.o
+endif
 endif
 endif
 
diff --git a/arch/arm/lib/bitops.S b/arch/arm/lib/bitops.S
new file mode 100644 (file)
index 0000000..29d1524
--- /dev/null
@@ -0,0 +1,45 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2023 Sean Anderson <sean.anderson@seco.com>
+ *
+ * ARM bitops to call when using THUMB1, which doesn't have these instructions.
+ */
+#include <linux/linkage.h>
+#include <asm/assembler.h>
+
+.pushsection .text.__fls
+ENTRY(__fls)
+       clz     r0, r0
+       rsb     r0, r0, #31
+       ret     lr
+ENDPROC(__fls)
+.popsection
+
+.pushsection .text.__ffs
+ENTRY(__ffs)
+       rsb     r3, r0, #0
+       and     r0, r0, r3
+       clz     r0, r0
+       rsb     r0, r0, #31
+       ret     lr
+ENDPROC(__ffs)
+.popsection
+
+.pushsection .text.fls
+ENTRY(fls)
+       cmp     r0, #0
+       clzne   r0, r0
+       rsbne   r0, r0, #32
+       ret     lr
+ENDPROC(fls)
+.popsection
+
+.pushsection .text.ffs
+ENTRY(ffs)
+       rsb     r3, r0, #0
+       and     r0, r0, r3
+       clz     r0, r0
+       rsb     r0, r0, #32
+       ret     lr
+ENDPROC(ffs)
+.popsection
index 7c2e4ebbdb0f5f180776186feb5733aea14fcfb1..4c65fc0dbd25cdcfa4b9bc932be283dad2e8bffa 100644 (file)
@@ -215,6 +215,17 @@ config TARGET_SAMA5D2_ICP
          a 64Mbit QSPI flash, 3xMikrobus connectors, 4xUSB ,
          EtherCat and WILC3000 devices on board.
 
+config TARGET_SAMA5D29_CURIOSITY
+       bool "SAMA5D29 CURIOSITY board"
+       select SAMA5D2
+       select BOARD_EARLY_INIT_F
+       select BOARD_LATE_INIT
+       select CPU_V7A
+       help
+         The SAMA5D29 Curiosity embeds SAMA5D29 SoC with 4 Gbit LPDDR2-SDRAM,
+         a 64Mbit QSPI flash with Mac-address, MCP16502 PMIC, RGB LCD connector,
+         2 x Mikrobus connectors, 2 x SD-Card connectors, 2 x USB
+
 config TARGET_SAMA5D3_XPLAINED
        bool "SAMA5D3 Xplained board"
        select BOARD_EARLY_INIT_F
@@ -346,6 +357,7 @@ source "board/atmel/sama5d2_xplained/Kconfig"
 source "board/atmel/sama5d27_som1_ek/Kconfig"
 source "board/atmel/sama5d27_wlsom1_ek/Kconfig"
 source "board/atmel/sama5d2_icp/Kconfig"
+source "board/atmel/sama5d29_curiosity/Kconfig"
 source "board/atmel/sama5d3_xplained/Kconfig"
 source "board/atmel/sama5d3xek/Kconfig"
 source "board/atmel/sama5d4_xplained/Kconfig"
index 183650a90a8b46307da0d9157024174efce0f808..7265faf6cecc614a6507690f70779278b4d32602 100644 (file)
@@ -146,6 +146,14 @@ int mach_cpu_init(void)
        return 0;
 }
 
+#if defined(CONFIG_DISPLAY_CPUINFO)
+int print_cpuinfo(void)
+{
+       printf("CPU: BCM283x\n");
+       return 0;
+}
+#endif
+
 #ifdef CONFIG_ARMV7_LPAE
 #ifdef CONFIG_TARGET_RPI_4_32B
 #define BCM2711_RPI4_PCIE_XHCI_MMIO_VIRT       0xffc00000UL
index d94b5828d0d4f3270e93176fa378e393cc490141..2136ab7e9eb3b24b6047e5edb7ef0b92d4b59314 100644 (file)
@@ -181,7 +181,7 @@ config IMX8_ROMAPI
 config SPL_IMX_ROMAPI_LOADADDR
        hex "Default load address to load image through ROM API"
        depends on IMX8_ROMAPI || SPL_BOOTROM_SUPPORT
-       default 0
+       default 0x0
 
 config IMX_DCD_ADDR
        hex "DCD Blocks location on the image"
index 15f844f5030265fa66fd36b9f6df6d3413e24f01..59d11b3179efdf4b2e8455e3e11671acab3d6b8a 100644 (file)
@@ -34,11 +34,11 @@ config SYS_SOC
 
 config BOOTAUX_RESERVED_MEM_BASE
        hex "i.MX auxiliary core dram memory base"
-       default 0
+       default 0x0
 
 config BOOTAUX_RESERVED_MEM_SIZE
        hex "i.MX auxiliary core dram memory size"
-       default 0
+       default 0x0
 
 choice
        prompt "i.MX8 board select"
index c62357044e0161a38789c97297b3da5ec6dd13ef..39ac0bc4140bc4d97776041ee62352406c58357f 100644 (file)
@@ -69,7 +69,7 @@ int arch_cpu_init(void)
        return 0;
 }
 
-static int imx8_init_mu(void *ctx, struct event *event)
+static int imx8_init_mu(void)
 {
        struct udevice *devp;
        int node, ret;
@@ -91,7 +91,7 @@ static int imx8_init_mu(void *ctx, struct event *event)
 
        return 0;
 }
-EVENT_SPY(EVT_DM_POST_INIT_F, imx8_init_mu);
+EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, imx8_init_mu);
 
 #if defined(CONFIG_ARCH_MISC_INIT)
 int arch_misc_init(void)
index 78b775f449d9902f163d2db5296dadd4d2aeed27..431ad959f53348f42b9df4dfc14ec5e77a188ce7 100644 (file)
@@ -532,7 +532,7 @@ static void imx_set_wdog_powerdown(bool enable)
        writew(enable, &wdog3->wmcr);
 }
 
-static int imx8m_check_clock(void *ctx, struct event *event)
+static int imx8m_check_clock(void)
 {
        struct udevice *dev;
        int ret;
@@ -549,7 +549,7 @@ static int imx8m_check_clock(void *ctx, struct event *event)
 
        return 0;
 }
-EVENT_SPY(EVT_DM_POST_INIT_F, imx8m_check_clock);
+EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, imx8m_check_clock);
 
 static void imx8m_setup_snvs(void)
 {
index e23cf60d126fb9ececf72efe9273c089465c6e08..fd436dd88514652466c268212ec52de479798c47 100644 (file)
@@ -803,12 +803,7 @@ int imx8ulp_dm_post_init(void)
 
        return 0;
 }
-
-static int imx8ulp_evt_dm_post_init(void *ctx, struct event *event)
-{
-       return imx8ulp_dm_post_init();
-}
-EVENT_SPY(EVT_DM_POST_INIT_F, imx8ulp_evt_dm_post_init);
+EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, imx8ulp_dm_post_init);
 
 #if defined(CONFIG_SPL_BUILD)
 __weak void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
index f43b73a6c219e53bd657c76a007081f411c56d92..5d8687b6f43837cca9256066ebd1b9eeb89d5ab1 100644 (file)
@@ -552,7 +552,7 @@ int arch_cpu_init(void)
        return 0;
 }
 
-int imx9_probe_mu(void *ctx, struct event *event)
+int imx9_probe_mu(void)
 {
        struct udevice *devp;
        int node, ret;
@@ -576,7 +576,7 @@ int imx9_probe_mu(void *ctx, struct event *event)
 
        return 0;
 }
-EVENT_SPY(EVT_DM_POST_INIT_F, imx9_probe_mu);
+EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, imx9_probe_mu);
 
 int timer_init(void)
 {
index ecc0a592e9933d7d17e04fc609aa41b20002167f..a6307251c1fc55d357d50bf17fc2b354218238cc 100644 (file)
@@ -527,7 +527,7 @@ void board_init_f(ulong dummy)
 
 #endif
 
-static int am33xx_dm_post_init(void *ctx, struct event *event)
+static int am33xx_dm_post_init(void)
 {
        hw_data_init();
 #if !CONFIG_IS_ENABLED(SKIP_LOWLEVEL_INIT)
@@ -535,4 +535,4 @@ static int am33xx_dm_post_init(void *ctx, struct event *event)
 #endif
        return 0;
 }
-EVENT_SPY(EVT_DM_POST_INIT_F, am33xx_dm_post_init);
+EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, am33xx_dm_post_init);
index 771533394bcd9b040792e731b7e098ec9c9182cb..0e4572ca41a77e490635178c9f6ed2bf481ee09b 100644 (file)
@@ -174,7 +174,7 @@ void __weak init_package_revision(void)
  * done in each of these cases
  * This function is called with SRAM stack.
  */
-void early_system_init(void)
+int early_system_init(void)
 {
 #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_MULTI_DTB_FIT)
        int ret;
@@ -225,6 +225,8 @@ void early_system_init(void)
        debug_uart_init();
 #endif
        prcm_init();
+
+       return 0;
 }
 
 #ifdef CONFIG_SPL_BUILD
@@ -240,13 +242,7 @@ void board_init_f(ulong dummy)
 }
 #endif
 
-static int omap2_system_init(void *ctx, struct event *event)
-{
-       early_system_init();
-
-       return 0;
-}
-EVENT_SPY(EVT_DM_POST_INIT_F, omap2_system_init);
+EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, early_system_init);
 
 /*
  * Routine: wait_for_command_complete
index a279582f4f66cb60fbe7d458ac191695b97f04f3..03c2b3771d2838106116afa1921343295a0c8d9f 100644 (file)
@@ -470,7 +470,7 @@ config ROCKCHIP_STIMER_BASE
 
 config ROCKCHIP_SPL_RESERVE_IRAM
        hex "Size of IRAM reserved in SPL"
-       default 0
+       default 0x0
        help
          SPL may need reserve memory for firmware loaded by SPL, whose load
          address is in IRAM and may overlay with SPL text area if not
index 24d04dcf0f99e73ffe894b5a7f1123fca59c8c22..158bf40cb97e8fb688ab1523413a3b312ab936a0 100644 (file)
@@ -29,7 +29,7 @@ void *board_fdt_blob_setup(int *err)
                        return (void *)nt_fw_dtb;
                log_debug("%s: DTB not found.\n", __func__);
        }
-       log_debug("%s: fall back to builtin DTB, %p\n", __func__, &_end);
+       log_debug("%s: fall back to builtin DTB, %p\n", __func__, _end);
 
-       return (void *)&_end;
+       return (void *)_end;
 }
index e20c3a3ee926a483aa75835c7da0a4a9b804f67f..9d5df2c10273d15c01ec4992040677a166ed4797 100644 (file)
@@ -568,7 +568,7 @@ config DRAM_EMR1
 
 config DRAM_TPR3
        hex "sunxi dram tpr3 value"
-       default 0
+       default 0x0
        ---help---
        Set the dram controller tpr3 parameter. This parameter configures
        the delay on the command lane and also phase shifts, which are
@@ -579,7 +579,7 @@ config DRAM_TPR3
 
 config DRAM_DQS_GATING_DELAY
        hex "sunxi dram dqs_gating_delay value"
-       default 0
+       default 0x0
        ---help---
        Set the dram controller dqs_gating_delay parmeter. Each byte
        encodes the DQS gating delay for each byte lane. The delay
index 958018c1909e010b5505784c32c656dec17f1b2e..c0423eaf93a4fab7a17c6e3a63de293109233c81 100644 (file)
@@ -6,11 +6,6 @@
 #ifndef __ASM_MICROBLAZE_PROCESSOR_H
 #define __ASM_MICROBLAZE_PROCESSOR_H
 
-/* References to section boundaries */
-
-extern char _end[];
-extern char __text_start[];
-
 /* Microblaze board initialization function */
 void board_init(void);
 
index 67c8af2f35a5722a1facc7126f1b2017bb0f92f5..9cf6809f40688aae47ae0c55d9a1693dec32f64a 100644 (file)
@@ -146,7 +146,7 @@ void relocate_code(ulong start_addr_sp, gd_t *new_gd, ulong relocaddr)
 
        /* Clear the .bss section */
        bss_start = (uint8_t *)((unsigned long)__bss_start + off);
-       bss_len = (unsigned long)&__bss_end - (unsigned long)__bss_start;
+       bss_len = (unsigned long)__bss_end - (unsigned long)__bss_start;
        memset(bss_start, 0, bss_len);
 
        /* Jump to the relocated U-Boot */
index 676c305fd3e900b655256de1ed7a0a0ad1b29ae9..56fdf04bca9d4de4f87a36d1298d13ab7150569c 100644 (file)
@@ -42,7 +42,7 @@ void board_init_f(ulong dummy)
        enable_caches();
 
        /* Clear the BSS */
-       memset(__bss_start, 0, (char *)&__bss_end - __bss_start);
+       memset(__bss_start, 0, (size_t)__bss_end - (size_t)__bss_start);
 
        gd->flags |= GD_FLG_SPL_INIT;
 
index f1e90227386337c12b670509dd935950d6fe2e36..e88dab10c76e5b6fb9b0ff54c15374be18a69eae 100644 (file)
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <event.h>
 #include <init.h>
 #include <malloc.h>
 #include <asm/addrspace.h>
@@ -21,7 +22,8 @@ int dram_init(void)
        return 0;
 }
 
-int last_stage_init(void)
+#ifndef CONFIG_SPL_BUILD
+static int last_stage_init(void)
 {
        void *src, *dst;
 
@@ -46,3 +48,5 @@ int last_stage_init(void)
 
        return 0;
 }
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
+#endif
index 37c20a5f564009de9c702a8002d1fb430d456174..95dd65913d4cf9f8bbf77cbd7711204d27254dfa 100644 (file)
@@ -70,7 +70,7 @@ void secondary_cpu_init(void)
                cpumask = 0x0f;
 
                /* Make BootROM/TPL redirect Core1's bootup flow to our entry point */
-               writel((uintptr_t)&_start, sysc + BOOT_SRAM_BASE_REG);
+               writel((uintptr_t)_start, sysc + BOOT_SRAM_BASE_REG);
 
                bootup_secondary_core();
        }
index aa5b267bb96908e2dd001e0f332976aa8cb01be9..25b409e241762c3b23b2f2366dfaa9434cec8487 100644 (file)
@@ -86,7 +86,7 @@ unsigned long spl_nor_get_uboot_base(void)
 
 uint32_t spl_nand_get_uboot_raw_page(void)
 {
-       const struct stage_header *sh = (const struct stage_header *)&_start;
+       const struct stage_header *sh = (const struct stage_header *)_start;
        u32 addr;
 
        addr = image_get_header_size() + be32_to_cpu(sh->stage_size);
index ec3c2505313ce17d043f9de6567231d77eca8197..7ed306e045ea762e44530a6042250930a54730a0 100644 (file)
@@ -57,7 +57,7 @@ static ulong clk_get_cpu_rate(void)
 }
 
 /* initialize prefetch module related to cpu_clk */
-static void prefetch_init(void)
+static int prefetch_init(void)
 {
        struct pic32_reg_atomic *regs;
        const void __iomem *base;
@@ -93,16 +93,12 @@ static void prefetch_init(void)
        /* Enable prefetch for all */
        writel(0x30, &regs->set);
        iounmap(regs);
-}
 
-/* arch specific CPU init after DM */
-static int pic32_flash_prefetch(void *ctx, struct event *event)
-{
-       /* flash prefetch */
-       prefetch_init();
        return 0;
 }
-EVENT_SPY(EVT_DM_POST_INIT_F, pic32_flash_prefetch);
+
+/* arch-specific CPU init after DM: flash prefetch */
+EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, prefetch_init);
 
 /* Un-gate DDR2 modules (gated by default) */
 static void ddr2_pmd_ungate(void)
index da167f4b29e912d4bf049b244bd201dbcde38cb1..79a54d1bc2590b845c0a6938ae07da84d5b786c3 100644 (file)
@@ -64,7 +64,7 @@ static void copy_exception_trampoline(void)
 }
 #endif
 
-static int nios_cpu_setup(void *ctx, struct event *event)
+static int nios_cpu_setup(void)
 {
        struct udevice *dev;
        int ret;
@@ -80,7 +80,7 @@ static int nios_cpu_setup(void *ctx, struct event *event)
 
        return 0;
 }
-EVENT_SPY(EVT_DM_POST_INIT_F, nios_cpu_setup);
+EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, nios_cpu_setup);
 
 static int altera_nios2_get_desc(const struct udevice *dev, char *buf,
                                 int size)
index bd2af8dc10e8d0245d414b716339cbec1b32be64..1731c965ad98dfd94d8f526d0aaa501e273c6a2f 100644 (file)
@@ -94,7 +94,7 @@ config SYS_SIUMCR
 
 config SYS_SYPCR
        hex "SYPCR register" if !WDT_MPC8xxx
-       default 0
+       default 0x0
        help
          System Protection Control (11-9)
 
index 0b4208e721996655acbbddb80eb176cb65b30755..d64aa330f206531f57ce527b76f325752cbb3241 100644 (file)
@@ -92,7 +92,7 @@ static void dummy_pending_ipi_clear(ulong hart, ulong arg0, ulong arg1)
 }
 #endif
 
-int riscv_cpu_setup(void *ctx, struct event *event)
+int riscv_cpu_setup(void)
 {
        int ret;
 
@@ -146,7 +146,7 @@ int riscv_cpu_setup(void *ctx, struct event *event)
 
        return 0;
 }
-EVENT_SPY(EVT_DM_POST_INIT_F, riscv_cpu_setup);
+EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, riscv_cpu_setup);
 
 int arch_early_init_r(void)
 {
index ffa7649f3f9e16125d408b99c0b2afb6eb25454f..87a804bfd5f7391f5e88bc40a74c4cc10102a2aa 100644 (file)
@@ -26,6 +26,6 @@ struct event;
     } while (0)
 
 /* Hook to set up the CPU (called from SPL too) */
-int riscv_cpu_setup(void *ctx, struct event *event);
+int riscv_cpu_setup(void);
 
 #endif /* __ASM_RISCV_SYSTEM_H */
index f4d3b67e5dd08c7e4d6a95edeae7bf5770bc6098..9b242ed821299b9d3a2e4688e46b30e0559972c3 100644 (file)
@@ -28,7 +28,7 @@ __weak void board_init_f(ulong dummy)
        if (ret)
                panic("spl_early_init() failed: %d\n", ret);
 
-       riscv_cpu_setup(NULL, NULL);
+       riscv_cpu_setup();
 
        preloader_console_init();
 
index 9e93a0fa571fb9d098b820226f21149e1e337b83..85d0d6a17035d7038718f9316b4a7f140d1b4f44 100644 (file)
@@ -258,6 +258,30 @@ int os_unmap(void *buf, int size)
        return 0;
 }
 
+int os_persistent_file(char *buf, int maxsize, const char *fname)
+{
+       const char *dirname = getenv("U_BOOT_PERSISTENT_DATA_DIR");
+       char *ptr;
+       int len;
+
+       len = strlen(fname) + (dirname ? strlen(dirname) + 1 : 0) + 1;
+       if (len > maxsize)
+               return -ENOSPC;
+
+       ptr = buf;
+       if (dirname) {
+               strcpy(ptr, dirname);
+               ptr += strlen(dirname);
+               *ptr++ = '/';
+       }
+       strcpy(ptr, fname);
+
+       if (access(buf, F_OK) == -1)
+               return -ENOENT;
+
+       return 0;
+}
+
 /* Restore tty state when we exit */
 static struct termios orig_term;
 static bool term_setup;
index 234652872ecc554a8962a9aff5f8df4bca0e141b..1026898727f5fe32d060e2788a36d197518abd66 100644 (file)
@@ -119,12 +119,7 @@ int sandbox_early_getopt_check(void)
 
        os_exit(0);
 }
-
-static int sandbox_misc_init_f(void *ctx, struct event *event)
-{
-       return sandbox_early_getopt_check();
-}
-EVENT_SPY(EVT_MISC_INIT_F, sandbox_misc_init_f);
+EVENT_SPY_SIMPLE(EVT_MISC_INIT_F, sandbox_early_getopt_check);
 
 static int sandbox_cmdline_cb_help(struct sandbox_state *state, const char *arg)
 {
index 8aaf911a41a77bce5081dc20493c04fd586f9fbc..ff7e5584c5580c861e9e177e3ea59a2e503e3f5e 100644 (file)
                stdout-path = "/serial";
        };
 
-       cedit-theme {
-               font-size = <30>;
-               menu-inset = <3>;
-               menuitem-gap-y = <1>;
-       };
-
        alarm_wdt: alarm-wdt {
                compatible = "sandbox,alarm-wdt";
                timeout-sec = <5>;
        bootstd {
                compatible = "u-boot,boot-std";
                filename-prefixes = "./";
+
+               cedit-theme {
+                       font-size = <30>;
+                       menu-inset = <3>;
+                       menuitem-gap-y = <1>;
+               };
        };
 
        buttons {
index f351d5cb84b0c5431a16204760db4fe67785cad0..b48456aebee33d1d932ab94ee93226f731c03fc0 100644 (file)
@@ -39,6 +39,8 @@
                mmc1 = "/mmc1";
                mmc2 = "/mmc2";
                mmc3 = "/mmc3";
+               mmc4 = "/mmc4";
+               mmc5 = "/mmc5";
                pci0 = &pci0;
                pci1 = &pci1;
                pci2 = &pci2;
                        menuitem-gap-y = <1>;
                };
 
+               cedit-theme {
+                       font-size = <30>;
+                       menu-inset = <3>;
+                       menuitem-gap-y = <1>;
+               };
+
                /*
                 * This is used for the VBE OS-request tests. A FAT filesystem
                 * created in a partition with the VBE information appearing
        cedit: cedit {
        };
 
-       cedit-theme {
-               font-size = <30>;
-               menu-inset = <3>;
-               menuitem-gap-y = <1>;
-       };
-
        fuzzing-engine {
                compatible = "sandbox,fuzzing-engine";
        };
                filename = "mmc4.img";
        };
 
+       /* This is used for ChromiumOS tests */
+       mmc5 {
+               status = "disabled";
+               compatible = "sandbox,mmc";
+               filename = "mmc5.img";
+       };
+
        pch {
                compatible = "sandbox,pch";
        };
index 4a7b4f617f8a18ed163c7eba1045744ecc948938..c270426d820818f9576c32fea0db0e9ced27faab 100644 (file)
@@ -45,7 +45,7 @@ static void hsuart_clock_set(void *base)
  * Configure the internal clock of both SIO HS-UARTs, if they are enabled
  * via FSP
  */
-static int baytrail_uart_init(void *ctx, struct event *event)
+static int baytrail_uart_init(void)
 {
        struct udevice *dev;
        void *base;
@@ -64,7 +64,7 @@ static int baytrail_uart_init(void *ctx, struct event *event)
 
        return 0;
 }
-EVENT_SPY(EVT_DM_POST_INIT_F, baytrail_uart_init);
+EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, baytrail_uart_init);
 
 static void set_max_freq(void)
 {
index f30aebfe4c627ab8574cfe3530ab24e2941e1ede..560b1f7893f695268bacd4857a3724c67339d1e8 100644 (file)
@@ -25,7 +25,7 @@
 #include <asm/arch/pch.h>
 #include <asm/arch/rcb.h>
 
-static int broadwell_init_cpu(void *ctx, struct event *event)
+static int broadwell_init_cpu(void)
 {
        struct udevice *dev;
        int ret;
@@ -40,7 +40,7 @@ static int broadwell_init_cpu(void *ctx, struct event *event)
 
        return 0;
 }
-EVENT_SPY(EVT_DM_POST_INIT_F, broadwell_init_cpu);
+EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, broadwell_init_cpu);
 
 void set_max_freq(void)
 {
index d7eedbd7436ef6a01c486319f19bf13be66199df..835b2c777462786af8ee4df87ca05d5a63e09047 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <event.h>
 #include <fdtdec.h>
 #include <init.h>
 #include <usb.h>
@@ -74,8 +75,11 @@ static void board_final_init(void)
        }
 }
 
-int last_stage_init(void)
+static int last_stage_init(void)
 {
+       if (IS_ENABLED(CONFIG_SPL_BUILD))
+               return 0;
+
        /* start usb so that usb keyboard can be used as input device */
        if (IS_ENABLED(CONFIG_USB_KEYBOARD))
                usb_init();
@@ -84,3 +88,4 @@ int last_stage_init(void)
 
        return 0;
 }
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
index dddd281e966cbea276b183d99ce857a681953864..ce55efc454bfa35b7939e300737b9ddb8bcb26fc 100644 (file)
@@ -26,6 +26,7 @@
 #include <cpu_func.h>
 #include <dm.h>
 #include <errno.h>
+#include <event.h>
 #include <init.h>
 #include <irq.h>
 #include <log.h>
@@ -185,7 +186,8 @@ void show_boot_progress(int val)
 }
 #endif
 
-#if !defined(CONFIG_SYS_COREBOOT) && !defined(CONFIG_EFI_STUB)
+#if !defined(CONFIG_SYS_COREBOOT) && !defined(CONFIG_EFI_STUB) && \
+       !defined(CONFIG_SPL_BUILD)
 /*
  * Implement a weak default function for boards that need to do some final init
  * before the system is ready.
@@ -202,7 +204,7 @@ __weak void board_final_cleanup(void)
 {
 }
 
-int last_stage_init(void)
+static int last_stage_init(void)
 {
        struct acpi_fadt __maybe_unused *fadt;
        int ret;
@@ -245,7 +247,9 @@ int last_stage_init(void)
 
        return 0;
 }
-#endif
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
+
+#endif  /* !SYS_COREBOOT && !EFI_STUB && !SPL_BUILD */
 
 static int x86_init_cpus(void)
 {
index d8920effd3987f92b13ca5f9bced939545f4efeb..708bfbe7ee488d6f6e8a9915a9eb89bcdd8238e8 100644 (file)
@@ -9,6 +9,7 @@
 #include <efi.h>
 #include <efi_api.h>
 #include <errno.h>
+#include <event.h>
 #include <init.h>
 #include <log.h>
 #include <usb.h>
@@ -168,7 +169,7 @@ int reserve_arch(void)
        return 0;
 }
 
-int last_stage_init(void)
+static int last_stage_init(void)
 {
        /* start usb so that usb keyboard can be used as input device */
        if (IS_ENABLED(CONFIG_USB_KEYBOARD))
@@ -176,6 +177,7 @@ int last_stage_init(void)
 
        return 0;
 }
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
 
 unsigned int install_e820_map(unsigned int max_entries,
                              struct e820_entry *entries)
index c988d7ff477ff885d8e4396184ff379bea05e42e..e71a10bfd441014b141c881bb7a9fcce4582c083 100644 (file)
@@ -54,7 +54,7 @@ int arch_cpu_init(void)
        return x86_cpu_init_f();
 }
 
-static int ivybridge_cpu_init(void *ctx, struct event *ev)
+static int ivybridge_cpu_init(void)
 {
        struct pci_controller *hose;
        struct udevice *bus, *dev;
@@ -86,7 +86,7 @@ static int ivybridge_cpu_init(void *ctx, struct event *ev)
 
        return 0;
 }
-EVENT_SPY(EVT_DM_POST_INIT_F, ivybridge_cpu_init);
+EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, ivybridge_cpu_init);
 
 #define PCH_EHCI0_TEMP_BAR0 0xe8000000
 #define PCH_EHCI1_TEMP_BAR0 0xe8000400
index 1be8e38cdf41039add4809fccd17cd7d2c4006c5..62b83c228cfba3ac22f344bce947eb457343dd4a 100644 (file)
@@ -107,7 +107,7 @@ static void quark_setup_bars(void)
                       CONFIG_PCIE_ECAM_BASE | MEM_BAR_EN);
 }
 
-static void quark_pcie_early_init(void)
+static int quark_pcie_early_init(void)
 {
        /*
         * Step1: Assert PCIe signal PERST#
@@ -146,6 +146,8 @@ static void quark_pcie_early_init(void)
        /* Mixer Load Lane 1 */
        msg_port_io_clrbits(MSG_PORT_PCIE_AFE, PCIE_RXPICTRL0_L1,
                            (1 << 6) | (1 << 7));
+
+       return 0;
 }
 
 static void quark_usb_early_init(void)
@@ -248,22 +250,16 @@ int arch_cpu_init(void)
        return 0;
 }
 
-static int quark_init_pcie(void *ctx, struct event *event)
-{
-       /*
-        * Initialize PCIe controller
-        *
-        * Quark SoC holds the PCIe controller in reset following a power on.
-        * U-Boot needs to release the PCIe controller from reset. The PCIe
-        * controller (D23:F0/F1) will not be visible in PCI configuration
-        * space and any access to its PCI configuration registers will cause
-        * system hang while it is held in reset.
-        */
-       quark_pcie_early_init();
-
-       return 0;
-}
-EVENT_SPY(EVT_DM_POST_INIT_F, quark_init_pcie);
+/*
+ * Initialize PCIe controller
+ *
+ * Quark SoC holds the PCIe controller in reset following a power on.
+ * U-Boot needs to release the PCIe controller from reset. The PCIe
+ * controller (D23:F0/F1) will not be visible in PCI configuration
+ * space and any access to its PCI configuration registers will cause
+ * system hang while it is held in reset.
+ */
+EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, quark_pcie_early_init);
 
 int checkcpu(void)
 {
index a6be3604e9b985e45902a2038025ee510176ef1a..874a43d16c767f68e10a88b56f1e7f5aa503dc23 100644 (file)
@@ -8,4 +8,6 @@
 
 #include <asm-generic/sections.h>
 
+extern char __data_end[];
+
 #endif
index 9ad74dc0b946ef31281277b6ed99ad5ab51a79c4..655675b66614bec04e26b75bca0215066d4694ba 100644 (file)
@@ -62,41 +62,4 @@ struct boot_params *load_zimage(char *image, unsigned long kernel_size,
 int setup_zimage(struct boot_params *setup_base, char *cmd_line, int auto_boot,
                 ulong initrd_addr, ulong initrd_size, ulong cmdline_force);
 
-/**
- * zimage_dump() - Dump the metadata of a zimage
- *
- * This shows all available information in a zimage that has been loaded.
- *
- * @base_ptr: Pointer to the boot parameters, typically at address
- *     DEFAULT_SETUP_BASE
- */
-void zimage_dump(struct boot_params *base_ptr);
-
-/**
- * zboot_start() - Boot a zimage
- *
- * Boot a zimage, given the component parts
- *
- * @addr: Address where the bzImage is moved before booting, either
- *     BZIMAGE_LOAD_ADDR or ZIMAGE_LOAD_ADDR
- * @base: Pointer to the boot parameters, typically at address
- *     DEFAULT_SETUP_BASE
- * @initrd: Address of the initial ramdisk, or 0 if none
- * @initrd_size: Size of the initial ramdisk, or 0 if none
- * @cmdline: Command line to use for booting
- * Return: -EFAULT on error (normally it does not return)
- */
-int zboot_start(ulong addr, ulong size, ulong initrd, ulong initrd_size,
-               ulong base, char *cmdline);
-
-/*
- * zimage_get_kernel_version() - Get the version string from a kernel
- *
- * @params: boot_params pointer
- * @kernel_base: base address of kernel
- * Return: Kernel version as a NUL-terminated string
- */
-const char *zimage_get_kernel_version(struct boot_params *params,
-                                     void *kernel_base);
-
 #endif
index 20926171822dd3518666a91920e2c80aa1472ba9..df18f47675628cd2e2138f744aed733a7c4c0c32 100644 (file)
@@ -101,3 +101,4 @@ int arch_fsp_init(void)
 
        return 0;
 }
+EVENT_SPY_SIMPLE(EVT_FSP_INIT_F, arch_fsp_init);
index 20c3f6406adf08386d3a23592d8fc9dedf24fc95..d802a86967d5c83ba0220cf4834287d38727de64 100644 (file)
@@ -8,11 +8,6 @@
 #include <init.h>
 #include <asm/fsp/fsp_support.h>
 
-int arch_fsp_init(void)
-{
-       return 0;
-}
-
 void board_final_cleanup(void)
 {
        u32 status;
index afec7d08d67ff8d49f5c56ebef3c75b8353398ab..aadc08cf3c448ade3ce0816ed1cf9833219ecc3b 100644 (file)
@@ -19,7 +19,7 @@
 #include <dm/uclass-internal.h>
 #include <asm/fsp2/fsp_internal.h>
 
-int fsp_setup_pinctrl(void *ctx, struct event *event)
+int fsp_setup_pinctrl(void)
 {
        struct udevice *dev;
        ofnode node;
@@ -42,7 +42,7 @@ int fsp_setup_pinctrl(void *ctx, struct event *event)
 
        return ret;
 }
-EVENT_SPY(EVT_DM_POST_INIT_F, fsp_setup_pinctrl);
+EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, fsp_setup_pinctrl);
 
 #if !defined(CONFIG_TPL_BUILD)
 binman_sym_declare(ulong, intel_fsp_m, image_pos);
index 5b1b420a643373888b9908a8955de3bd344aa481..da819b9bdd2c1be9e291dee24de2b801886abecd 100644 (file)
@@ -26,11 +26,11 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int copy_uboot_to_ram(void)
 {
-       size_t len = (uintptr_t)&__data_end - (uintptr_t)&__text_start;
+       size_t len = (uintptr_t)__data_end - (uintptr_t)__text_start;
 
        if (gd->flags & GD_FLG_SKIP_RELOC)
                return 0;
-       memcpy((void *)gd->relocaddr, (void *)&__text_start, len);
+       memcpy((void *)gd->relocaddr, (void *)__text_start, len);
 
        return 0;
 }
@@ -38,8 +38,8 @@ int copy_uboot_to_ram(void)
 #ifndef CONFIG_EFI_APP
 int clear_bss(void)
 {
-       ulong dst_addr = (ulong)&__bss_start + gd->reloc_off;
-       size_t len = (uintptr_t)&__bss_end - (uintptr_t)&__bss_start;
+       ulong dst_addr = (ulong)__bss_start + gd->reloc_off;
+       size_t len = (uintptr_t)__bss_end - (uintptr_t)__bss_start;
 
        if (gd->flags & GD_FLG_SKIP_RELOC)
                return 0;
@@ -150,12 +150,12 @@ static void do_elf_reloc_fixups32(unsigned int text_base, uintptr_t size,
  */
 int do_elf_reloc_fixups(void)
 {
-       void *re_src = (void *)(&__rel_dyn_start);
-       void *re_end = (void *)(&__rel_dyn_end);
+       void *re_src = (void *)__rel_dyn_start;
+       void *re_end = (void *)__rel_dyn_end;
        uint text_base;
 
        /* The size of the region of u-boot that runs out of RAM. */
-       uintptr_t size = (uintptr_t)&__bss_end - (uintptr_t)&__text_start;
+       uintptr_t size = (uintptr_t)__bss_end - (uintptr_t)__text_start;
 
        if (gd->flags & GD_FLG_SKIP_RELOC)
                return 0;
index f99df08fbece065e26ebe88c97be70aaf047cf68..58fa572b71aea03062692442284442f6690b2868 100644 (file)
@@ -138,9 +138,9 @@ static int x86_spl_init(void)
        }
 
 #ifndef CONFIG_SYS_COREBOOT
-       debug("BSS clear from %lx to %lx len %lx\n", (ulong)&__bss_start,
-             (ulong)&__bss_end, (ulong)&__bss_end - (ulong)&__bss_start);
-       memset(&__bss_start, 0, (ulong)&__bss_end - (ulong)&__bss_start);
+       debug("BSS clear from %lx to %lx len %lx\n", (ulong)__bss_start,
+             (ulong)__bss_end, (ulong)__bss_end - (ulong)__bss_start);
+       memset(__bss_start, 0, (ulong)__bss_end - (ulong)__bss_start);
 # ifndef CONFIG_TPL
 
        /* TODO(sjg@chromium.org): Consider calling cpu_init_r() here */
index 062e3d3e315108ef649a1c1c09601a92e1ec0ea1..a41e1ccf8a65ad47fdad6802941d0172a2d41390 100644 (file)
@@ -692,7 +692,7 @@ static void show_loader(struct setup_header *hdr)
        printf("\n");
 }
 
-void zimage_dump(struct boot_params *base_ptr)
+void zimage_dump(struct boot_params *base_ptr, bool show_cmdline)
 {
        struct setup_header *hdr;
        const char *version;
@@ -703,7 +703,7 @@ void zimage_dump(struct boot_params *base_ptr)
 
        printf("E820: %d entries\n", base_ptr->e820_entries);
        if (base_ptr->e820_entries) {
-               printf("%18s  %16s  %s\n", "Addr", "Size", "Type");
+               printf("%12s  %10s  %s\n", "Addr", "Size", "Type");
                for (i = 0; i < base_ptr->e820_entries; i++) {
                        struct e820_entry *entry = &base_ptr->e820_map[i];
 
@@ -749,7 +749,7 @@ void zimage_dump(struct boot_params *base_ptr)
        print_num("Ext loader ver", hdr->ext_loader_ver);
        print_num("Ext loader type", hdr->ext_loader_type);
        print_num("Command line ptr", hdr->cmd_line_ptr);
-       if (hdr->cmd_line_ptr) {
+       if (show_cmdline && hdr->cmd_line_ptr) {
                printf("   ");
                /* Use puts() to avoid limits from CONFIG_SYS_PBSIZE */
                puts((char *)(ulong)hdr->cmd_line_ptr);
@@ -787,7 +787,7 @@ static int do_zboot_dump(struct cmd_tbl *cmdtp, int flag, int argc,
                printf("No zboot setup_base\n");
                return CMD_RET_FAILURE;
        }
-       zimage_dump(base_ptr);
+       zimage_dump(base_ptr, true);
 
        return 0;
 }
index 3dc8edc801d7721f946bb4824c0129a41f080b1a..a499590c75bc5f143ef9dd008b36262b63e027de 100644 (file)
@@ -9,8 +9,8 @@
 
 int clear_bss(void)
 {
-       size_t len = (size_t)&__bss_end - (size_t)&__bss_start;
+       size_t len = (size_t)__bss_end - (size_t)__bss_start;
 
-       memset((void *)&__bss_start, 0x00, len);
+       memset((void *)__bss_start, 0x00, len);
        return 0;
 }
index a52a032e4d5d1674427e398ddfb1e181e68e1633..370c2668b081e68f5d94483fce0515846d30b7e1 100644 (file)
@@ -15,6 +15,7 @@
 #include <dm.h>
 #include <dm/of_extra.h>
 #include <env.h>
+#include <event.h>
 #include <fdt_support.h>
 #include <init.h>
 #include <led.h>
@@ -667,7 +668,7 @@ err:
        return NULL;
 }
 
-int last_stage_init(void)
+static int last_stage_init(void)
 {
        struct gpio_desc reset_gpio = {};
 
@@ -712,6 +713,7 @@ handle_reset_btn:
 
        return 0;
 }
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
 
 #if defined(CONFIG_OF_BOARD_SETUP)
 
index 3ab6e8873d8464e53daa31f078b308cf8e9747c3..3fe5319437ea739f096bef6f210fe3c19a6b1b48 100644 (file)
@@ -8,6 +8,7 @@
 #include <dm/device-internal.h>
 #include <env.h>
 #include <env_internal.h>
+#include <event.h>
 #include <i2c.h>
 #include <init.h>
 #include <mmc.h>
@@ -301,7 +302,7 @@ static int mii_multi_chip_mode_write(struct udevice *bus, int dev_smi_addr,
 }
 
 /* Bring-up board-specific network stuff */
-int last_stage_init(void)
+static int last_stage_init(void)
 {
        struct udevice *bus;
        ofnode node;
@@ -356,6 +357,8 @@ int last_stage_init(void)
 
        return 0;
 }
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
+
 #endif
 
 #ifdef CONFIG_OF_BOARD_SETUP
index 08b1aa4b6efe0c8ba5cb72d5841d7080cd38080a..bc9332cb74a394e4ef78880c7251e63b596e6c8b 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <cyclic.h>
 #include <dm.h>
+#include <event.h>
 #include <ram.h>
 #include <time.h>
 #include <asm/gpio.h>
@@ -364,7 +365,7 @@ int board_late_init(void)
        return 0;
 }
 
-int last_stage_init(void)
+static int last_stage_init(void)
 {
        struct gpio_desc gpio = {};
        ofnode node;
@@ -386,3 +387,4 @@ int last_stage_init(void)
 
        return 0;
 }
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
index e7899f49f0c25d31e0edf5e16d9f18046f8119f7..974e9eb82001c24eb1d1ba70c4ac16e3224f8f39 100644 (file)
@@ -12,6 +12,7 @@
 #include <asm/global_data.h>
 #include <dm/uclass-internal.h>
 #include <env.h>
+#include <event.h>
 #include <init.h>
 #include <malloc.h>
 #include <net.h>
@@ -213,11 +214,12 @@ void board_acquire_flash_arb(bool acquire)
        }
 }
 
-int last_stage_init(void)
+static int last_stage_init(void)
 {
        (void)smc_flsf_fw_booted();
        return 0;
 }
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
 
 static int do_go_uboot(struct cmd_tbl *cmdtp, int flag, int argc,
                       char *const argv[])
index f36caece7d7776a45e630e9e1c527d2bef857adf..e8959ede51d9cf0daf0e67493e088937cf35d266 100644 (file)
@@ -14,6 +14,7 @@
 #include <firmware/imx/sci/sci.h>
 #include <asm/arch/imx8-pins.h>
 #include <asm/arch/iomux.h>
+#include <asm/sections.h>
 #include <fsl_esdhc_imx.h>
 
 DECLARE_GLOBAL_DATA_PTR;
index 922bb0b7d434b96b1954b3cbfbca2fe8dd558d75..d32400101fc9311cda312e7a80f283bac9ab61e3 100644 (file)
@@ -17,6 +17,7 @@
 #include <firmware/imx/sci/sci.h>
 #include <asm/arch/imx8-pins.h>
 #include <asm/arch/iomux.h>
+#include <asm/sections.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index fcd60ab1e058e53ceb0cd84e34cfacda3741a934..8bdfb302f7283e3939c57c146d12eafcf92baf01 100644 (file)
@@ -104,8 +104,8 @@ int meson_ft_board_setup(void *blob, struct bd_info *bd)
                }
 
                /* Update PHY names (mandatory to disable USB3.0) */
-               len = strlcpy(data, "usb2-phy0", 32);
-               len += strlcpy(&data[len], "usb2-phy1", 32 - len);
+               len = strlcpy(data, "usb2-phy0", 32) + 1;
+               len += strlcpy(&data[len], "usb2-phy1", 32 - len) + 1;
                ret = fdt_setprop(blob, node, "phy-names", data, len);
                if (ret < 0) {
                        printf("vim3: failed to update usb phy names property (%d)\n", ret);
@@ -132,7 +132,7 @@ int meson_ft_board_setup(void *blob, struct bd_info *bd)
                }
 
                /* Enable PCIe */
-               len = strlcpy(data, "okay", 32);
+               len = strlcpy(data, "okay", 32) + 1;
                ret = fdt_setprop(blob, node, "status", data, len);
                if (ret < 0) {
                        printf("vim3: failed to enable pcie node (%d)\n", ret);
index 4dcf3f396b8ea85e5304799eeaac880bd3187a4b..17f37badd746072786883ae3ccfb4d72f4132848 100644 (file)
@@ -27,6 +27,7 @@
 #include <asm/arch/crm_regs.h>
 #include <asm/io.h>
 #include <asm/arch/sys_proto.h>
+#include <asm/sections.h>
 #include <bmp_logo.h>
 #include <dm/root.h>
 #include <env.h>
@@ -216,7 +217,6 @@ static void set_gpr_register(void)
               &iomuxc_regs->gpr[12]);
 }
 
-extern char __bss_start[], __bss_end[];
 int board_early_init_f(void)
 {
        select_ldb_di_clock_source(MXC_PLL5_CLK);
index 0fe0de9fde93bce02205523f5394d06205bbeff7..f53d359404ef2763d1d51a1a7da8e987a3399268 100644 (file)
@@ -9,6 +9,7 @@
 #include <debug_uart.h>
 #include <fdtdec.h>
 #include <init.h>
+#include <led.h>
 #include <asm/arch/at91_common.h>
 #include <asm/arch/at91_rstc.h>
 #include <asm/arch/at91_sfr.h>
@@ -18,6 +19,7 @@
 #include <asm/global_data.h>
 #include <asm/io.h>
 #include <asm/mach-types.h>
+#include <dm/ofnode.h>
 
 extern void at91_pda_detect(void);
 
@@ -27,9 +29,25 @@ void at91_prepare_cpu_var(void);
 
 static void board_leds_init(void)
 {
+#if CONFIG_IS_ENABLED(LED)
+       const char *led_name;
+       struct udevice *dev;
+       int ret;
+
+       led_name = ofnode_conf_read_str("u-boot,boot-led");
+       if (!led_name)
+               return;
+
+       ret = led_get_by_label(led_name, &dev);
+       if (ret)
+               return;
+
+       led_set_state(dev, LEDST_ON);
+#else
        at91_set_pio_output(AT91_PIO_PORTD, 17, 0);     /* LED RED */
        at91_set_pio_output(AT91_PIO_PORTD, 19, 0);     /* LED GREEN */
        at91_set_pio_output(AT91_PIO_PORTD, 21, 1);     /* LED BLUE */
+#endif
 }
 
 int board_late_init(void)
diff --git a/board/atmel/sama5d29_curiosity/Kconfig b/board/atmel/sama5d29_curiosity/Kconfig
new file mode 100644 (file)
index 0000000..64ca237
--- /dev/null
@@ -0,0 +1,15 @@
+if TARGET_SAMA5D29_CURIOSITY
+
+config SYS_BOARD
+       default "sama5d29_curiosity"
+
+config SYS_VENDOR
+       default "atmel"
+
+config SYS_SOC
+       default "at91"
+
+config SYS_CONFIG_NAME
+       default "sama5d29_curiosity"
+
+endif
diff --git a/board/atmel/sama5d29_curiosity/MAINTAINERS b/board/atmel/sama5d29_curiosity/MAINTAINERS
new file mode 100644 (file)
index 0000000..54894d6
--- /dev/null
@@ -0,0 +1,9 @@
+SAMA5D29 CURIOSITY BOARD
+M:     Mihai Sain <mihai.sain@microchip.com>
+S:     Maintained
+F:     board/atmel/sama5d29_curiosity.c
+F:     include/configs/sama5d29_curiosity.h
+F:     configs/sama5d29_curiosity_mmc_defconfig
+F:     configs/sama5d29_curiosity_mmc1_defconfig
+F:     configs/sama5d29_curiosity_qspiflash_defconfig
+F:     arch/arm/dts/at91-sama5d29_curiosity*
diff --git a/board/atmel/sama5d29_curiosity/Makefile b/board/atmel/sama5d29_curiosity/Makefile
new file mode 100644 (file)
index 0000000..848e1ce
--- /dev/null
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2023 Microchip Technology Inc. and its subsidiaries
+#
+# Author: Mihai Sain <mihai.sain@microchip.com>
+
+obj-y += sama5d29_curiosity.o
diff --git a/board/atmel/sama5d29_curiosity/sama5d29_curiosity.c b/board/atmel/sama5d29_curiosity/sama5d29_curiosity.c
new file mode 100644 (file)
index 0000000..d067931
--- /dev/null
@@ -0,0 +1,86 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2023 Microchip Technology Inc. and its subsidiaries
+ *
+ * Author: Mihai Sain <mihai.sain@microchip.com>
+ *
+ */
+
+#include <common.h>
+#include <debug_uart.h>
+#include <init.h>
+#include <asm/global_data.h>
+#include <asm/io.h>
+#include <asm/arch/at91_common.h>
+#include <asm/arch/atmel_pio4.h>
+#include <asm/arch/atmel_sdhci.h>
+#include <asm/arch/clk.h>
+#include <asm/arch/gpio.h>
+#include <asm/arch/sama5d2.h>
+
+extern void at91_pda_detect(void);
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static void rgb_leds_init(void)
+{
+       atmel_pio4_set_pio_output(AT91_PIO_PORTA, 7, 0);        /* LED RED */
+       atmel_pio4_set_pio_output(AT91_PIO_PORTA, 8, 0);        /* LED GREEN */
+       atmel_pio4_set_pio_output(AT91_PIO_PORTA, 9, 1);        /* LED BLUE */
+}
+
+static void board_usb_hw_init(void)
+{
+       atmel_pio4_set_pio_output(AT91_PIO_PORTA, 6, 1);
+}
+
+int board_late_init(void)
+{
+       at91_video_show_board_info();
+
+       at91_pda_detect();
+
+       return 0;
+}
+
+static void board_uart0_hw_init(void)
+{
+       atmel_pio4_set_c_periph(AT91_PIO_PORTB, 26, ATMEL_PIO_PUEN_MASK);       /* URXD0 */
+       atmel_pio4_set_c_periph(AT91_PIO_PORTB, 27, 0);                         /* UTXD0 */
+
+       at91_periph_clk_enable(ATMEL_ID_UART0);
+}
+
+void board_debug_uart_init(void)
+{
+       board_uart0_hw_init();
+}
+
+int board_early_init_f(void)
+{
+       debug_uart_init();
+
+       return 0;
+}
+
+int board_init(void)
+{
+       /* address of boot parameters */
+       gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100;
+
+       rgb_leds_init();
+
+       board_usb_hw_init();
+
+       return 0;
+}
+
+int dram_init_banksize(void)
+{
+       return fdtdec_setup_memory_banksize();
+}
+
+int dram_init(void)
+{
+       return fdtdec_setup_mem_size_base();
+}
index b2830c5223a10c3556d27e761297bce2d0ab315f..1632238bf5dd5f3e5a21f03226cbfc17bbbc5e8e 100644 (file)
@@ -14,6 +14,7 @@
 #include <asm/arch/sys_proto.h>
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/arch/ddr.h>
+#include <asm/sections.h>
 
 #include <dm/uclass.h>
 #include <dm/device.h>
index 9acd9161800875be5a65e64186dd8df9935af6a4..b4d46f11f98d251665c69f77027aa8b57cf4528d 100644 (file)
@@ -20,6 +20,7 @@
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/mach-imx/gpio.h>
 #include <asm/mach-imx/mxc_i2c.h>
+#include <asm/sections.h>
 #include <fsl_esdhc_imx.h>
 #include <mmc.h>
 #include <linux/delay.h>
index 7c49b206c1526d99d860b2a6252defebc3aa8c6c..34088adee47bd9c4ce41c678c2c29e30b6da9030 100644 (file)
@@ -27,6 +27,7 @@
 #include <asm/arch/mx6-pins.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/mach-imx/iomux-v3.h>
+#include <asm/sections.h>
 #include <usb.h>
 #include <usb/ehci-ci.h>
 #include <fuse.h>
index ce0504a011af68764d52cd8b4f4c1972b032e938..5a77d28cb7e121de431af6d6d9531e6e96b44872 100644 (file)
@@ -13,6 +13,7 @@
 #include <asm/arch/sys_proto.h>
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/mach-imx/gpio.h>
+#include <asm/sections.h>
 #include <dm/device.h>
 #include <dm/uclass.h>
 
index e63904eade88be9625033b78393088cbef33529b..0c3a0135a8600432e8fbd532837cf36748fcee08 100644 (file)
@@ -19,6 +19,7 @@
 #include <asm/arch/sys_proto.h>
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/arch/ddr.h>
+#include <asm/sections.h>
 
 #include <dm/uclass.h>
 #include <dm/device.h>
index 5d4c4d39e724ded70893f00cfe77aeeb02125a92..98c3b831f1e1aca28d3968c8e790737dacef4c7d 100644 (file)
@@ -16,6 +16,7 @@
 #include <asm/arch-mx7/mx7-pins.h>
 #include <asm/arch-mx7/clock.h>
 #include <asm/arch-mx7/mx7-ddr.h>
+#include <asm/sections.h>
 #include "common.h"
 
 #ifdef CONFIG_FSL_ESDHC_IMX
index d2d20269ba07ea1df40071dc9ab010c2482f67d3..19c1acd8a5254da7bcd8348da2e7cec62cca574f 100644 (file)
@@ -21,6 +21,7 @@
 #include <asm/mach-imx/mxc_i2c.h>
 #include <asm/mach-imx/gpio.h>
 #include <asm/arch/ddr.h>
+#include <asm/sections.h>
 
 #include <dm/uclass.h>
 #include <dm/device.h>
index dea34e4dc63cd85048913279a98d5d46c599c353..b432ce27459f60e3773a690880a60a0c136d26a8 100644 (file)
@@ -10,6 +10,7 @@
 #include <init.h>
 #include <log.h>
 #include <spl.h>
+#include <asm/sections.h>
 #include <dm/uclass.h>
 #include <dm/device.h>
 #include <dm/uclass-internal.h>
index aae0a5dac066f159fdbae56cfacdf2e130beee07..fdfa3affc3b134378ab4b33f377ef7191dacfa4a 100644 (file)
@@ -4,6 +4,7 @@
  *
  */
 #include <common.h>
+#include <event.h>
 #include <init.h>
 #include <malloc.h>
 #include <errno.h>
@@ -121,7 +122,7 @@ void reset_cpu(void)
 }
 
 #ifdef CONFIG_LAST_STAGE_INIT
-int last_stage_init(void)
+static int last_stage_init(void)
 {
        u32 val;
 
@@ -134,4 +135,5 @@ int last_stage_init(void)
 
        return 0;
 }
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
 #endif
index 20a330cce62f62030bf33b4422f0d66f80ecc8b5..e6d5657c62d00f52a00cae34b207bab851f61bed 100644 (file)
@@ -21,6 +21,7 @@
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/mach-imx/mxc_i2c.h>
 #include <asm/io.h>
+#include <asm/sections.h>
 #include <asm/system.h>
 #include <errno.h>
 #include <fuse.h>
index e2aa874723a76e1980db081b573943563cd7e5fe..a8fda139aa4d5a3a2a79ddb19a0bf9afb55f44a4 100644 (file)
@@ -15,6 +15,7 @@
 #include <asm/arch/sys_proto.h>
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/arch/ddr.h>
+#include <asm/sections.h>
 
 #include <dm/uclass.h>
 #include <dm/device.h>
index ed9949651c4b51f739194a2be0f4fa5812c7aef6..09c95413a54140b139a235e16eabf023aba13398 100644 (file)
@@ -12,6 +12,10 @@ config BOARD_SPECIFIC_OPTIONS # dummy
        imply VIRTIO_NET
        imply VIRTIO_BLK
 
+config PRE_CON_BUF_ADDR
+       hex
+       default 0x40100000
+
 endif
 
 if TARGET_QEMU_ARM_64BIT && !TFABOOT
index dfea0d92a3c8d434261c8e204f256cc0e8b1d32c..942f1fff571720f15a90647b082a5535c9f513c5 100644 (file)
@@ -11,6 +11,7 @@
 #include <fdtdec.h>
 #include <init.h>
 #include <log.h>
+#include <usb.h>
 #include <virtio_types.h>
 #include <virtio.h>
 
@@ -114,6 +115,10 @@ int board_late_init(void)
         */
        virtio_init();
 
+       /* start usb so that usb keyboard can be used as input device */
+       if (CONFIG_IS_ENABLED(USB_KEYBOARD))
+               usb_init();
+
        return 0;
 }
 
index e658d5ee7d638844de3f5524cf63a6d1b76217c8..fb4adef281ede8837eb90aeec3d84b5bee711c89 100644 (file)
@@ -2,6 +2,9 @@
 
 /* environment for qemu-arm and qemu-arm64 */
 
+stdin=serial,usbkbd
+stdout=serial,vidconsole
+stderr=serial,vidconsole
 fdt_high=0xffffffff
 initrd_high=0xffffffff
 fdt_addr=0x40000000
index a39bcb4fa0c7f7d8323234ca1e9461b82cf77be3..7ca8773b17e5a73ed6839989a2cfc060583b11af 100644 (file)
@@ -9,6 +9,7 @@
 #include <cpu_func.h>
 #include <dm.h>
 #include <env.h>
+#include <event.h>
 #include <init.h>
 #include <log.h>
 #include <net.h>
@@ -184,7 +185,7 @@ int misc_init_r(void)
        return 0;
 }
 
-int last_stage_init(void)
+static int last_stage_init(void)
 {
        void *fdt = get_fdt_virt();
        int len = 0;
@@ -204,6 +205,7 @@ int last_stage_init(void)
 
        return 0;
 }
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
 
 static uint64_t get_linear_ram_size(void)
 {
index 1846134a49255dc5c3fb125ed4980a4dcf6727b8..af9044a3c2b036d5a5e04ae869796f1899b109e6 100644 (file)
@@ -16,6 +16,7 @@
 #include <asm/arch/sys_proto.h>
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/arch/ddr.h>
+#include <asm/sections.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index 6e9513805cdd49a176ee7e673a3ab6d94e8a0e56..35437811d9df7c8e343dbf9057412f04d6d78fe6 100644 (file)
@@ -19,6 +19,7 @@
 #include <asm/arch/sys_proto.h>
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/arch/ddr.h>
+#include <asm/sections.h>
 
 #include <dm/uclass.h>
 #include <dm/device.h>
index ec0378b5b7688ecdc2eb9d74f7abfa8d62a4897e..dd54fa9b6085bb288c2782395f032c9ee754d48d 100644 (file)
@@ -20,6 +20,7 @@
 #include <asm/arch/sys_proto.h>
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/arch/ddr.h>
+#include <asm/sections.h>
 
 #include <dm/uclass.h>
 #include <dm/device.h>
index bea9ddc996048cb208cc454236c0a259943fa2d0..818cdd615eb9a3c28c1a5229e29596a1e4df9667 100644 (file)
@@ -20,6 +20,7 @@
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/mach-imx/gpio.h>
 #include <asm/mach-imx/mxc_i2c.h>
+#include <asm/sections.h>
 #include <fsl_esdhc_imx.h>
 #include <fsl_sec.h>
 #include <mmc.h>
index 332a662dee843353f7d7729ceb0710e42859eb15..17fd437116d35da1544163e13414ab19b76ebad6 100644 (file)
@@ -17,6 +17,7 @@
 #include <dm/device-internal.h>
 #include <dm/lists.h>
 #include <asm/arch/sys_proto.h>
+#include <asm/sections.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index 75aab1651c0acb2558f3d6e37632e33d0a7e2b83..462c43ceebc75b864d2001c10dd01e77846d58d4 100644 (file)
@@ -22,6 +22,7 @@
 #include <asm/arch/imx8-pins.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/sys_proto.h>
+#include <asm/sections.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index 66d0f68cc62de59997015199a80ec2a9849ef1e3..c49b5be4762052ca7754471779e4032632e6161b 100644 (file)
@@ -20,6 +20,7 @@
 #include <asm/arch/rdc.h>
 #include <asm/arch/upower.h>
 #include <asm/mach-imx/ele_api.h>
+#include <asm/sections.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index 63883b30dd794ca2f4820a81c91bcc3f895ff4bb..be9c24fc0d9165efc2ee14043ae7515ad1fa7e72 100644 (file)
@@ -20,6 +20,7 @@
 #include <asm/mach-imx/mxc_i2c.h>
 #include <asm/arch-mx7ulp/gpio.h>
 #include <asm/mach-imx/syscounter.h>
+#include <asm/sections.h>
 #include <dm/uclass.h>
 #include <dm/device.h>
 #include <dm/uclass-internal.h>
index 8605d064138a7e8bd6df6bb929463b8cbab0b4de..d6f22bd6a2a3c0d406174eb0f77a8797bc8cce5a 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <asm/arch/ls102xa_devdis.h>
 #include <asm/arch/ls102xa_soc.h>
+#include <asm/sections.h>
 #include <fsl_csu.h>
 #include <fsl_immap.h>
 #include <netdev.h>
index d5cb7312095ac67375c37b7caec5f57539346bc6..a618ce11a584a432b21fb94be6c24aaf73fd72be 100644 (file)
@@ -16,6 +16,7 @@
 #include <asm/arch/fsl_serdes.h>
 #include <asm/arch/ls102xa_soc.h>
 #include <asm/arch/ls102xa_devdis.h>
+#include <asm/sections.h>
 #include <hwconfig.h>
 #include <mmc.h>
 #include <fsl_csu.h>
index d144f25c623c0c5f2d2391f08af42cec538d61c5..d0e4e796c6062ba65c0f9bf4806638cd0494adcc 100644 (file)
@@ -12,6 +12,7 @@
 #include <asm/arch/ls102xa_soc.h>
 #include <asm/arch/fsl_serdes.h>
 #include <asm/global_data.h>
+#include <asm/sections.h>
 #include <linux/delay.h>
 #include "../common/sleep.h"
 #include <fsl_validate.h>
index 4f5834347db484bbd1f668016f2d8e10b51a22a4..27b9d79e5f0bb874f3df05fa3f8d12b54757fc0f 100644 (file)
@@ -18,6 +18,7 @@
 #include <asm/arch/fsl_serdes.h>
 #include <asm/arch/ls102xa_devdis.h>
 #include <asm/arch/ls102xa_soc.h>
+#include <asm/sections.h>
 #include <hwconfig.h>
 #include <mmc.h>
 #include <fsl_csu.h>
index 7a1047a77f732c8840ae6e71c8796c02390bc58d..f2b8bec03729b24da521078d9a8376a020f5f117 100644 (file)
@@ -181,13 +181,14 @@ unsigned long long get_qixis_addr(void)
 #endif
 
 #if defined(CONFIG_VID)
-int init_func_vid(void)
+static int setup_core_voltage(void)
 {
        if (adjust_vdd(0) < 0)
                printf("core voltage not adjusted\n");
 
        return 0;
 }
+EVENT_SPY_SIMPLE(EVT_MISC_INIT_F, setup_core_voltage);
 
 u16 soc_get_fuse_vid(int vid_index)
 {
index d631a11ff667dbcccd630dd1c34d66c78c60511f..2883848550af17494ac0cc474e6277b8e1e3f382 100644 (file)
@@ -13,6 +13,7 @@
 #include <i2c.h>
 #include <malloc.h>
 #include <errno.h>
+#include <event.h>
 #include <netdev.h>
 #include <fsl_ddr.h>
 #include <asm/io.h>
@@ -242,6 +243,7 @@ int init_func_vid(void)
        return 0;
 }
 #endif
+EVENT_SPY_SIMPLE(EVT_MISC_INIT_F, init_func_vid);
 
 int checkboard(void)
 {
index 039deb5bf94c09041b772e31efe2ba52ea996c22..77e92006131a7e10d2db107767a3dec1020b62af 100644 (file)
@@ -15,6 +15,7 @@
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/mx6-pins.h>
+#include <asm/sections.h>
 #include <env.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
index 96a76b0581c2e4bbc3b3b29ca9a91c8fbb59de67..b558a596dff8a9c225c1eb0d0b67d90a73dc4930 100644 (file)
@@ -14,6 +14,7 @@
 #include <asm/arch/mx6-pins.h>
 #include <asm/global_data.h>
 #include <asm/mach-imx/spi.h>
+#include <asm/sections.h>
 #include <env.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
index 2c90a35e2c9549c9633b042299204e4cd1144714..e9ac57118b0191cf3537bb71499c1e143c3d60e6 100644 (file)
@@ -19,6 +19,7 @@
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/mach-imx/mxc_i2c.h>
 #include <asm/io.h>
+#include <asm/sections.h>
 #include <linux/sizes.h>
 #include <common.h>
 #include <fsl_esdhc_imx.h>
index 570b5014dbb1180852713bdb265ec5574ebf139c..534b16cec7ae87abb916992b551eacc7b2e5ac93 100644 (file)
@@ -18,6 +18,7 @@
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/mach-imx/mxc_i2c.h>
 #include <asm/io.h>
+#include <asm/sections.h>
 #include <common.h>
 #include <env.h>
 #include <fsl_esdhc_imx.h>
index 5aa209578b21db82ee467a42e9a7e1e44afa4d32..774a99041c8a18509cddaaf746bb502a2270df47 100644 (file)
@@ -19,6 +19,7 @@
 #include <asm/mach-imx/mxc_i2c.h>
 #include <asm/arch/ddr.h>
 #include <asm-generic/gpio.h>
+#include <asm/sections.h>
 #include <dm/uclass.h>
 #include <dm/device.h>
 #include <dm/pinctrl.h>
index ccebba72721f292199a8a193e693fd051d2126fe..0f620c2d91728f9fc76d4c77bc255f335b45ba25 100644 (file)
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <command.h>
 #include <dm.h>
+#include <event.h>
 #include <init.h>
 #include <miiphy.h>
 #include <net.h>
@@ -35,19 +36,6 @@ DECLARE_GLOBAL_DATA_PTR;
 #define DB_GP_88F68XX_GPP_POL_LOW      0x0
 #define DB_GP_88F68XX_GPP_POL_MID      0x0
 
-static int get_tpm(struct udevice **devp)
-{
-       int rc;
-
-       rc = uclass_first_device_err(UCLASS_TPM, devp);
-       if (rc) {
-               printf("Could not find TPM (ret=%d)\n", rc);
-               return CMD_RET_FAILURE;
-       }
-
-       return 0;
-}
-
 /*
  * Define the DDR layout / topology here in the board file. This will
  * be used by the DDR3 init code in the SPL U-Boot version to configure
@@ -284,15 +272,22 @@ int board_fix_fdt(void *rw_fdt_blob)
        return 0;
 }
 
-int last_stage_init(void)
+#ifndef CONFIG_SPL_BUILD
+static int last_stage_init(void)
 {
        struct udevice *tpm;
        int ret;
 
-#ifndef CONFIG_SPL_BUILD
+       if (IS_ENABLED(CONFIG_SPL_BUILD))
+               return 0;
        ccdc_eth_init();
-#endif
-       ret = get_tpm(&tpm);
+
+       ret = uclass_first_device_err(UCLASS_TPM, &tpm);
+       if (ret) {
+               printf("Could not find TPM (ret=%d)\n", ret);
+               return ret;
+       }
+
        if (ret || tpm_init(tpm) || tpm1_startup(tpm, TPM_ST_CLEAR) ||
            tpm1_continue_self_test(tpm)) {
                return 1;
@@ -305,3 +300,5 @@ int last_stage_init(void)
 
        return 0;
 }
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
+#endif
index ba88401f13da5841ee91cc335a095387e16ac0ce..cc608c4ac434a95ffed6cbc85fff8a65e3598b00 100644 (file)
@@ -9,6 +9,7 @@
 #include <command.h>
 #include <dm.h>
 #include <env.h>
+#include <event.h>
 #include <fdt_support.h>
 #include <fsl_esdhc.h>
 #include <init.h>
@@ -124,7 +125,7 @@ static void display_osd_info(struct udevice *osd,
               osd_info->width, osd_info->height);
 }
 
-int last_stage_init(void)
+static int last_stage_init(void)
 {
        int fpga_hw_rev = 0;
        int i;
@@ -179,6 +180,7 @@ int last_stage_init(void)
 
        return 0;
 }
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
 
 #if defined(CONFIG_OF_BOARD_SETUP)
 int ft_board_setup(void *blob, struct bd_info *bd)
index 4e9d841fe29169c7e9ad562c95a5860889633749..2d8951964a85c4dd9222fd6d2b330edc54f9f254 100644 (file)
@@ -5,6 +5,7 @@
  * Copyright 2012 Freescale Semiconductor, Inc.
  */
 
+#include <event.h>
 #include <image.h>
 #include <init.h>
 #include <asm/arch/clock.h>
@@ -531,7 +532,7 @@ static void remove_ethaddr_env_var(int index)
        env_set(env_var_name, NULL);
 }
 
-int last_stage_init(void)
+static int last_stage_init(void)
 {
        int i;
 
@@ -544,6 +545,7 @@ int last_stage_init(void)
 
        return 0;
 }
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
 
 int checkboard(void)
 {
index 9e23f5cd31e756dc9bb89e4624a81d490627ba12..9d9168d608a1eec7b8dcd5bf10422d1228d23474 100644 (file)
@@ -33,7 +33,7 @@ struct cros_gpio_info {
        int flags;
 };
 
-static int coral_check_ll_boot(void *ctx, struct event *event)
+static int coral_check_ll_boot(void)
 {
        if (!ll_boot_init()) {
                printf("Running as secondary loader");
@@ -57,7 +57,7 @@ static int coral_check_ll_boot(void *ctx, struct event *event)
 
        return 0;
 }
-EVENT_SPY(EVT_MISC_INIT_F, coral_check_ll_boot);
+EVENT_SPY_SIMPLE(EVT_MISC_INIT_F, coral_check_ll_boot);
 
 int arch_misc_init(void)
 {
index 103c4531a64c850295d5f1aa0c175574a8be22bc..54902437940bb9e46a9c4fdbd2a5574e0a30a1d0 100644 (file)
@@ -14,6 +14,7 @@
 #include <asm/arch/mx6-ddr.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/global_data.h>
+#include <asm/sections.h>
 #include <asm/io.h>
 #include <errno.h>
 #include <spl.h>
index 8f2d873bc68f9ee4d7eeff046942f57fd58ac221..acd13105dd55e729d9977b85ac9c2bf13462d9b0 100644 (file)
@@ -15,6 +15,7 @@
 
 #include <common.h>
 #include <env.h>
+#include <event.h>
 #include <fdt_support.h>
 #include <init.h>
 #include <ioports.h>
@@ -184,7 +185,7 @@ int misc_init_r(void)
        return 0;
 }
 
-int last_stage_init(void)
+static int last_stage_init(void)
 {
 #if defined(CONFIG_TARGET_KMCOGE5NE)
        /*
@@ -202,6 +203,7 @@ int last_stage_init(void)
        set_km_env();
        return 0;
 }
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
 
 static int fixed_sdram(void)
 {
index ed552c57b5faea4f2e196023bc0b8ebdba588d94..572cc7bbdc67f82610d4a8f460f0dc14ca5dd194 100644 (file)
@@ -182,7 +182,7 @@ unsigned long get_serial_clock(unsigned long dummy)
        return (gd->bus_clk / 2);
 }
 
-static int kmcent2_misc_init_f(void *ctx, struct event *event)
+static int kmcent2_misc_init_f(void)
 {
        /* configure QRIO pis for i2c deblocking */
        i2c_deblock_gpio_cfg();
@@ -210,7 +210,7 @@ static int kmcent2_misc_init_f(void *ctx, struct event *event)
 
        return 0;
 }
-EVENT_SPY(EVT_MISC_INIT_F, kmcent2_misc_init_f);
+EVENT_SPY_SIMPLE(EVT_MISC_INIT_F, kmcent2_misc_init_f);
 
 #define USED_SRDS_BANK 0
 #define EXPECTED_SRDS_RFCK SRDS_PLLCR0_RFCK_SEL_100
@@ -261,7 +261,7 @@ int hush_init_var(void)
        return 0;
 }
 
-int last_stage_init(void)
+static int last_stage_init(void)
 {
        const char *kmem;
        /* DIP switch support on BFTIC */
@@ -287,6 +287,7 @@ int last_stage_init(void)
 
        return 0;
 }
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
 
 void fdt_fixup_fman_mac_addresses(void *blob)
 {
index 2f1731eea6a0e6258d73d99f7285f76e9aa3ea19..21c21aac221f907f5fd2821c1f233140f380d465 100644 (file)
@@ -110,14 +110,14 @@ int board_early_init_f(void)
        return 0;
 }
 
-static int pg_wcom_misc_init_f(void *ctx, struct event *event)
+static int pg_wcom_misc_init_f(void)
 {
        if (IS_ENABLED(CONFIG_PG_WCOM_UBOOT_UPDATE_SUPPORTED))
                check_for_uboot_update();
 
        return 0;
 }
-EVENT_SPY(EVT_MISC_INIT_F, pg_wcom_misc_init_f);
+EVENT_SPY_SIMPLE(EVT_MISC_INIT_F, pg_wcom_misc_init_f);
 
 int board_init(void)
 {
@@ -215,8 +215,4 @@ int hush_init_var(void)
        return 0;
 }
 
-int last_stage_init(void)
-{
-       set_km_env();
-       return 0;
-}
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, set_km_env);
index f6fd17048d04de6a9d79db51668ff5e1b3d938d6..a247803a4b469bffcddb6dac3a50eac1247f83d0 100644 (file)
@@ -16,6 +16,7 @@
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/mach-imx/gpio.h>
 #include <asm/mach-imx/mxc_i2c.h>
+#include <asm/sections.h>
 #include <linux/delay.h>
 #include <power/pmic.h>
 #include <power/pfuze100_pmic.h>
index a9d370bc854c4fae924b93e5cdbcacf4f33ec3eb..b175885870557475cc97257e007d8443841dfccb 100644 (file)
@@ -11,6 +11,7 @@
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <asm/mach-imx/iomux-v3.h>
+#include <asm/sections.h>
 #include <fsl_esdhc_imx.h>
 #include <init.h>
 #include <linux/delay.h>
index b49373442a2ce980e69bd8b7a9c089acd3708a9f..54ee1e66a7a4ec265183d7fa29d6203cf2645f39 100644 (file)
@@ -12,6 +12,7 @@
 #include <asm/gpio.h>
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/mach-imx/iomux-v3.h>
+#include <asm/sections.h>
 #include <dm/uclass.h>
 #include <dm/device.h>
 #include <dm/uclass-internal.h>
index 4219d002fec5eba122d492e6347e5011dc634eca..97928e92215c34dfeb1b2e7954fe065fbba87b0f 100644 (file)
@@ -25,6 +25,7 @@
 #include "asm/arch/iomux.h"
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/gpio.h>
+#include <asm/sections.h>
 #include <fsl_esdhc_imx.h>
 #include <netdev.h>
 #include <bootcount.h>
index 21fad4972ab8317e835957323b947c53a6241034..5120c628b91a1a701761852a42416dd10dd37c81 100644 (file)
@@ -21,6 +21,7 @@
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/mach-imx/gpio.h>
 #include <asm/mach-imx/mxc_i2c.h>
+#include <asm/sections.h>
 #include <fsl_esdhc_imx.h>
 #include <mmc.h>
 #include <linux/delay.h>
index 5e5b129ef1ff3090339d9bbf9e07a0272b90e24f..b37c6fe218da48a6ca5b4da478a66f72ca5a9081 100644 (file)
@@ -17,6 +17,7 @@
 #include <asm/global_data.h>
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/arch/sys_proto.h>
+#include <asm/sections.h>
 #include <dm.h>
 
 DECLARE_GLOBAL_DATA_PTR;
index 1bae9b1170ddbc6db8086e95788ae98a4379e377..690a51f7a72e917095cbb7b9ee0e7075a41408e3 100644 (file)
@@ -12,6 +12,7 @@
 #include <asm/global_data.h>
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/mach-imx/iomux-v3.h>
+#include <asm/sections.h>
 #include <hang.h>
 #include <init.h>
 #include <log.h>
index ee484749bcf1b05581e434f7b0e122987c8dea0c..0a4048d4982fea354e6e6d4f1883cddf5ad21800 100644 (file)
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <command.h>
 #include <cpu_func.h>
+#include <event.h>
 #include <init.h>
 #include <log.h>
 #include <asm/armv8/mmu.h>
@@ -99,7 +100,7 @@ int __asm_flush_l3_dcache(void)
        return 0;
 }
 
-int last_stage_init(void)
+static int last_stage_init(void)
 {
        int ret;
 
@@ -113,3 +114,4 @@ int last_stage_init(void)
        }
        return ret;
 }
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
index 75d2636bf4533c71309bfbcdf8aff684dd9ef91c..960e491c7687adacfa0a5aa4699639e92afd0551 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <stdio.h>
 #include <command.h>
+#include <event.h>
 #include <init.h>
 #include <asm/armv8/mmu.h>
 #include <asm/io.h>
@@ -102,7 +103,7 @@ int __asm_flush_l3_dcache(void)
        return 0;
 }
 
-int last_stage_init(void)
+static int last_stage_init(void)
 {
        int ret;
 
@@ -116,3 +117,4 @@ int last_stage_init(void)
        }
        return ret;
 }
+EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, last_stage_init);
index d36f734e49cdda356db76b1affd966721820274f..b94cfd6ffc6761adafab04aa12f836974aa84f91 100644 (file)
@@ -16,6 +16,7 @@
 #include <asm/arch-mx7/mx7-ddr.h>
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/gpio.h>
+#include <asm/sections.h>
 #include <fsl_esdhc_imx.h>
 #include <spl.h>
 
index b9a67451aecca37eb0d75502fcb006985cede2ea..1c675bcab25a5b4860b916fa947b7a917afb6785 100644 (file)
@@ -13,6 +13,7 @@
 #include <asm/arch/clock.h>
 #include <asm/mach-imx/gpio.h>
 #include <asm/mach-imx/mxc_i2c.h>
+#include <asm/sections.h>
 #include <fsl_esdhc_imx.h>
 #include <linux/delay.h>
 #include <spl.h>
diff --git a/board/sandbox/capsule_priv_key_bad.key b/board/sandbox/capsule_priv_key_bad.key
new file mode 100644 (file)
index 0000000..2324f69
--- /dev/null
@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCmPw1pGd2xNW0p
+lesRXkkek3uwUB06Nt61tnZvpMkBKt4IokqGWz1tZls+Z2CqvwOfcsPZ27cPRYSu
+xRnM3YdL4MG6SePV7i/YSNw3rq8CP8zLGtCbNIfsfsNfPQEtPBpw6+7pMJKhjqpV
+2U2UQzZEiX4qlnhLpyv2JNJag27yf0feLdJi7HnJ9xdvcXpA1DSGm4y+DDhgYeI8
+DEteEu6s0TYQfnOZSQOeJi+1/Qz0S594uFJB37MyGh/mB15ILb8gva4nA3ayHOBK
+0dd+HSiUCGYrLYO7aj+nfzQj9N1qTlzCnC1603bMczU5pkwcODg6xP0Sn11J6RYy
+y0c0qzJLAgMBAAECggEABDY2MLoew3IkBltrParAWAUUcFLi95jw92q6BkOHEJg8
+2qia1yCitPUtPodMLmOKF5x4EdgXg5sv2O8MGbWP1VtUKXGh3QJcnRnNmsZ1hXJC
+RBcrei2aVLsqf0V2Mg3+GuG8PW3vLWHyZ/Sd6afeuXEYm2Bzrw9J5rfd3dBVKm7f
+HBvIyy1ATO/2cbUaEaCLOyhxLhssTI2TIK5SjlsjFLxiQXEi6RyGfBxUCriKZykS
+krMdvYh7Tf0uYcv0STmQ5s5Rd+RhRIGCVAdsNBxxJjgBAgqqa/B+kWbcc6o2D41n
+yWjErUaBBx3t0A7oT4K4DSTYwMNDVY3fhdd+szsocQKBgQDjnm8LG4UO6OQDm6iX
+0vTQTItoAz5TU6GEjHTCfVEqiupD4LKfHhSXwp2hRyzxXO5oNTU9MQCzYd7Npes0
+oVk4Tjo3YDacNPgxqKjODu/Q+tkTH15ydzGr674+YXHfCA1uT5GKOiiF0H1FZgMa
+Dk0s+3uWX34vbL4QCu97bUhBewKBgQC6+Z0J9sClgWvvjkglJN3XhRnAacp+WgX7
+bkpgSboXIIsqeqhd1WCLeV7L1pcZgifYBMPojf5LTBqBedL1q3RuqiqQWD/bSIYN
+Oc9KCdTjksS8Zo+w+s5zDObDhW9y13H2mKwDqilYBrT4fiA62wPMf1SjEF+RSC6K
+ZrQzHO1xcQKBgAILsXnLFIYOx8XUh05eAf9BQNt9c/jxvnjffkklMS6Nsw9LHK/b
+aFn40MvbROcia64aFFFpeFUkYwk8HYIKlS+xXEqVHciHnVds6Z94eOVK69qFJKco
+tRSTeNE8tPZJLz23j1pLrYOOXSHbidmZGU53MCQo1Yx9kLO6NW7Ji6WzAoGBALP4
+lEoE80Xbn3NEdvkZ1VcfzLvCmKCqMlvjuz+Xd8HPF2VaDznSq01VFAQMmAB7obJy
+U8hC9OSxakn6Yy8JS9dBgBrUdxKxaibM4FQZxosOuMPHzMPDhniDkJPemnnmGtIL
+/nbAkW8jdYpCjO9Z5PwwC92xYuvKmNGrLgSM8ZhhAoGAfgSZTpASXubM18E3ecfw
+5z333wf9qEQgZj7i9MzByFZudyHUhv/FPW1ocUJf36Wu1dfofZg3noSL6oakrm2v
+dFDo4PoyCStuF0w9SSzpIld01ZG0t7XqphY0DmshCXIXsqr7Vb4WrbBI7KX+b3Um
+BzmROfaSud97NjQ/RA26OZk=
+-----END PRIVATE KEY-----
diff --git a/board/sandbox/capsule_priv_key_good.key b/board/sandbox/capsule_priv_key_good.key
new file mode 100644 (file)
index 0000000..9a37f59
--- /dev/null
@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCwBfaV0P1jRzS6
+13U1T+4VbuMVsxFXhwHJY5z5Fx6v+cWBf3K1ruK+7cEnW55ZHXvNE2JCkjMvISKm
+hI/DLJWIPnAus8tFdU/R2u5oJbKI+b6GbuamO/CG9HsXZ58lOC6r2ckjixxovsA9
+SFshccdIv2YrwiVsWeyFpH+rB3/+cFbrgdWpaUc1367GkU/ZCnSRDBvVvzRRI1a4
+y2NogFqbZHXHENpzWNJ3TTXhf9dwM5HFGkmX7SA43Dtazae6CB4EaUKzLYWj3+ae
+AQbdvBrupKZQz1PUKn7X6+BGaLujHthvibYppNegPvqbJ1xBbv59CQK+lRULwC05
+NYw5+sIxAgMBAAECggEAHn8h/knjpMAw/BAZP//VrYP1Nwy7u/Dpl9U43JUrXWzG
+Uc3dd2nR4id6GBIRCLqJePnbQ9JlqMwyXyxHZhbC34SF1imTVbjh9+dY99VULdQr
+NMphDrsCzLbt3pu24HFv8Jk+dniDFwi5cMSo+U3nq4xxrLIp3rBjwLHD5sNZYyEU
+9xZnj7ziTn5X8da8iRxNpyzz2kQeVemJ0ahr/IkX718bkakSFMesGkln06vH7rAs
+069SeqOPrFEbWYXI5iMktLugl3JZpzasRE48j0M42PuProgvT7jb8B35ZF7kn0jT
+MqTIHglsJRWcSY0fAb2lHSAvd2vLLVunxr9PDWZvGQKBgQDVzVTuvo1CrVrQLy+B
+tpy2k5mjR3qxAOcoWTnKcMErLe8imWWaxukODenP4XqQIX4Sl+X3BXxOqun0Klap
+FEsI7TWSHf0eULFtFj0SCgqfRR+V/nblP05eO2nFXgr5YdNa1bWf/aMHplBo4q9e
+bbAr4InUB7IGWL2cWjhOhWuJbQKBgQDSw81cBM+vGPUYH/wlxlTVgZCo2Dg2NHjt
+LUBqvOZNr21j2F+w8t1vKmqwhkqpc5HIi3pHjEA5gZLTRtmf4GQyo973I6MGn4bS
+eayOd6/+FkAi9DUD+WaF7yctJqeevav6KF2UCiz78OtCAU5Y9jFFJpuOANIztI7m
+t7ZCUpMFVQKBgFnAsP7oj3SGQbFTnaXeeztKCx04TJExx9hwXIpXe0AdMF5d9wFa
+r0tvG9Bg34rSBJLZoXhpnR2JMl2FyIuCMV219t84J6IqTdF1nH2OKZdi9TeKc28Z
+fFSirGxmZkT6hDeFr5FScLYtY2QkhWomseY5hKK1+E4hwrd4SFruN46hAoGBAJgh
+nzTBgEtqH1enlrCJhSiLmihV0dVGcNb559pjuXTvoG0GfKPT2gPowRPkCzZe5ia0
+jrHgSWd44MtCA8nEBW8MG9+VyJH6Si3Yh7ZaLB2iX+8bCL1yow8f/c44bZtGW0F5
+K3q1EZ1VW+rL2IqcQhog8P1CGHgb514f0x3yTo71AoGACGdb+Nb6lg8OSJPUcuuH
+xsWk6RhkJl9bldTleS+QT3R9zO3FvbTwnCCYJboh5Cq/jVmiA7T+fcVAyEJNHSdm
+hxbHdScuiJdNWL9+FczOkylnKH3VEdG3RS5lGdyi6r+miTMs3h8WfzGp4JINysjg
+PUFskK36qGjASfkRUn0hizQ=
+-----END PRIVATE KEY-----
diff --git a/board/sandbox/capsule_pub_esl_good.esl b/board/sandbox/capsule_pub_esl_good.esl
new file mode 100644 (file)
index 0000000..f8cc272
Binary files /dev/null and b/board/sandbox/capsule_pub_esl_good.esl differ
diff --git a/board/sandbox/capsule_pub_key_bad.crt b/board/sandbox/capsule_pub_key_bad.crt
new file mode 100644 (file)
index 0000000..2e8e5d5
--- /dev/null
@@ -0,0 +1,19 @@
+-----BEGIN CERTIFICATE-----
+MIIDDzCCAfegAwIBAgIUWw3vHYnrjoHUXytxSm2eYWzbYVAwDQYJKoZIhvcNAQEL
+BQAwFjEUMBIGA1UEAwwLVEVTVF9TSUdORVIwIBcNMjMwODA0MTgwODEyWhgPMzAw
+MzEwMDYxODA4MTJaMBYxFDASBgNVBAMMC1RFU1RfU0lHTkVSMIIBIjANBgkqhkiG
+9w0BAQEFAAOCAQ8AMIIBCgKCAQEApj8NaRndsTVtKZXrEV5JHpN7sFAdOjbetbZ2
+b6TJASreCKJKhls9bWZbPmdgqr8Dn3LD2du3D0WErsUZzN2HS+DBuknj1e4v2Ejc
+N66vAj/MyxrQmzSH7H7DXz0BLTwacOvu6TCSoY6qVdlNlEM2RIl+KpZ4S6cr9iTS
+WoNu8n9H3i3SYux5yfcXb3F6QNQ0hpuMvgw4YGHiPAxLXhLurNE2EH5zmUkDniYv
+tf0M9EufeLhSQd+zMhof5gdeSC2/IL2uJwN2shzgStHXfh0olAhmKy2Du2o/p380
+I/Tdak5cwpwtetN2zHM1OaZMHDg4OsT9Ep9dSekWMstHNKsySwIDAQABo1MwUTAd
+BgNVHQ4EFgQUm9b8SnF811nweXSfGisfpzUHGwgwHwYDVR0jBBgwFoAUm9b8SnF8
+11nweXSfGisfpzUHGwgwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOC
+AQEAaOZFOcQzF1MRekcBmIZMaHSWYxOUrVLzBNSNhFD8muYiUAAufrkyTUq0Mmat
+w5hAnJ34VGpU1wxQlr/uwH7wpZZnGuj10rAp3tqES0g24AeH1bC9wmRs+rD6dcZR
+YmZq6FxtV7Cv3pQX7lhDYbcBj2za3YT6I1+yczskAHR6KYYuJzKJ7XRVCL7ZlYRX
+pUMZBQq2eAVWlW/c5iDT3KoGZUD9Of71F7qyUAqMMYafeDxguDz7gKstoXVCklQ+
+I4C7JKmRbrRvMgXx6O1clGhAsRZ0nNAtzi7XT5tD27qFwIPgwv48RWgsmPtzE03S
+YGQ5WhYMdHOOjWmcV6MDkCpiSA==
+-----END CERTIFICATE-----
diff --git a/board/sandbox/capsule_pub_key_good.crt b/board/sandbox/capsule_pub_key_good.crt
new file mode 100644 (file)
index 0000000..82d8576
--- /dev/null
@@ -0,0 +1,19 @@
+-----BEGIN CERTIFICATE-----
+MIIDDzCCAfegAwIBAgIUUzrWhMi7oPFshQP6eFlccqf7exswDQYJKoZIhvcNAQEL
+BQAwFjEUMBIGA1UEAwwLVEVTVF9TSUdORVIwIBcNMjMwODA0MTgwNzQyWhgPMzAw
+MzEwMDYxODA3NDJaMBYxFDASBgNVBAMMC1RFU1RfU0lHTkVSMIIBIjANBgkqhkiG
+9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsAX2ldD9Y0c0utd1NU/uFW7jFbMRV4cByWOc
++Rcer/nFgX9yta7ivu3BJ1ueWR17zRNiQpIzLyEipoSPwyyViD5wLrPLRXVP0dru
+aCWyiPm+hm7mpjvwhvR7F2efJTguq9nJI4scaL7APUhbIXHHSL9mK8IlbFnshaR/
+qwd//nBW64HVqWlHNd+uxpFP2Qp0kQwb1b80USNWuMtjaIBam2R1xxDac1jSd001
+4X/XcDORxRpJl+0gONw7Ws2nuggeBGlCsy2Fo9/mngEG3bwa7qSmUM9T1Cp+1+vg
+Rmi7ox7Yb4m2KaTXoD76mydcQW7+fQkCvpUVC8AtOTWMOfrCMQIDAQABo1MwUTAd
+BgNVHQ4EFgQUHvG7Xchqzwdggky+oyzlpNem8UowHwYDVR0jBBgwFoAUHvG7Xchq
+zwdggky+oyzlpNem8UowDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOC
+AQEAUn1ncSqeXbQAHNrVOFldLwu70hNlMxf2z4EfH2M7vJgrpwkRuIFw7PXNITBh
+CImd/ghm5NGFysrK7BwdHkFvUXZV3rE93BhcLC9leWfky33kW9olIzpE14i5FfBn
+ABmaokPhOrzAneGzU35sZHNotlqOrzgpKVkpOWrykhYZ5Qjk8Sz0xvzuG8TJc20s
+2og+W8Rm2u/xI9xPxtFbq9vUjvFS35o1pm+vkzpgNdo4YS1PG37BW/aopsooLSk7
+9Rxv5vzNXtQqeZ5qBdKbAVh3OsgqwigTmXVvOX3xpy9r9qiimhaISxCt83RZ7wQW
+I19t9pXyxAi6u7MRhJZlAeH/3w==
+-----END CERTIFICATE-----
index 8e077d73aef97df2291491d94ebedb8704b986f6..e160c611a962142d0c624feea70fd60bb4fc6203 100644 (file)
@@ -10,6 +10,7 @@
 #include <spl.h>
 #include <dm.h>
 #include <asm/global_data.h>
+#include <asm/sections.h>
 #include <dm/uclass.h>
 #include <dm/device.h>
 #include <dm/uclass-internal.h>
index b6ab06a08fb4a0b3bf45e4993d2037aa0a03b81d..3c5dd50c369b5738f3a21895ddba09e188c31f39 100644 (file)
@@ -122,7 +122,7 @@ void *board_fdt_blob_setup(int *err)
                        return (ulong *)(uintptr_t)gd->arch.firmware_fdt_addr;
        }
 
-       return (ulong *)&_end;
+       return (ulong *)_end;
 }
 
 int board_init(void)
index 6295deeae23404300c75b677896b15c62dd5573a..6675548c2bf81ae648194c6ef7db9443010d795f 100644 (file)
@@ -19,7 +19,7 @@ void *board_fdt_blob_setup(int *err)
                        return (ulong *)(uintptr_t)gd->arch.firmware_fdt_addr;
        }
 
-       return (ulong *)&_end;
+       return (ulong *)_end;
 }
 
 int board_init(void)
index aaeeee361e54b0950a1cfdd85b58323cb02f91cb..4483bd7f7a3829fb05b545c5c8cefd776c6f5069 100644 (file)
@@ -19,6 +19,7 @@
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/io.h>
 #include <asm/mach-imx/mxc_i2c.h>
+#include <asm/sections.h>
 #include <env.h>
 #include <linux/bitops.h>
 #include <linux/delay.h>
index 6fa5cf4d27d773c18fa3b038096d0ee3248cee42..e119330bc0c14a95c53e88f820765da001e5481a 100644 (file)
@@ -32,6 +32,7 @@
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/mach-imx/sata.h>
 #include <asm/mach-imx/video.h>
+#include <asm/sections.h>
 #include <mmc.h>
 #include <fsl_esdhc_imx.h>
 #include <malloc.h>
index 7acd3995aad8789102047eb3a5970fabc22817a0..ad5f71a201803906dc29b39fcc1d9f1ca36adad8 100644 (file)
@@ -218,7 +218,7 @@ void board_init_f(ulong dummy)
        if (ret)
                panic("spl_early_init() failed: %d\n", ret);
 
-       riscv_cpu_setup(NULL, NULL);
+       riscv_cpu_setup();
        preloader_console_init();
 
        /* Set the parent clock of cpu_root clock to pll0,
index 07dcca26b3023b3664f82f306a5b4e51ebdebccf..d609262b67603512f7578cc6de604f458fb357ae 100644 (file)
@@ -49,5 +49,5 @@ void *board_fdt_blob_setup(int *err)
                        return (ulong *)(uintptr_t)gd->arch.firmware_fdt_addr;
        }
 
-       return (ulong *)&_end;
+       return (ulong *)_end;
 }
index f321cd58a6e64bd77f68bdb669fccf5ce9ffeb16..de0f3505e5286ac15447f69420ba674b8ce175fd 100644 (file)
@@ -33,7 +33,6 @@
 #include <asm/arch/sys_proto.h>
 #include <asm/global_data.h>
 #include <linux/delay.h>
-#include <u-boot/crc.h>
 #ifndef CONFIG_ARM64
 #include <asm/armv7.h>
 #endif
index 251f5a1b7d04a1d6423b861533f85d6f425c9d14..ff56fd88d68ed21fea9382488cd5698b7e47da6a 100644 (file)
@@ -14,6 +14,7 @@
 #include <asm/gpio.h>
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/mach-imx/boot_mode.h>
+#include <asm/sections.h>
 #include <fsl_esdhc_imx.h>
 #include <linux/libfdt.h>
 #include <spl.h>
index f86fee9c88ebfb645f54b83ade782eadd1683e1d..c6b21aaa42da655298eba5bea75dbfe2e24a1b22 100644 (file)
@@ -16,6 +16,7 @@
 #include <asm/arch-mx7/mx7-ddr.h>
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/gpio.h>
+#include <asm/sections.h>
 #include <fsl_esdhc_imx.h>
 #include <spl.h>
 
index 2afb4d376088a72aeab1bedae33b350e917534ce..1a9c7996cb2a8a9c7210d2d089a7f11d95353758 100644 (file)
@@ -16,6 +16,7 @@
 #include <asm/mach-imx/gpio.h>
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/mach-imx/mxc_i2c.h>
+#include <asm/sections.h>
 #include <linux/delay.h>
 #include <errno.h>
 #include <fsl_esdhc_imx.h>
index 96f4e3013a3ef85083efaede708603ede183de9d..a080b2b0d2588642ccb24c559145f7437a6700dc 100644 (file)
@@ -18,7 +18,8 @@
 
 #include "../common/board_detect.h"
 
-#define board_is_am64x_gpevm() board_ti_k3_is("AM64-GPEVM")
+#define board_is_am64x_gpevm() (board_ti_k3_is("AM64-GPEVM") || \
+                               board_ti_k3_is("AM64-HSEVM"))
 
 #define board_is_am64x_skevm() (board_ti_k3_is("AM64-SKEVM") || \
                                board_ti_k3_is("AM64B-SKEVM"))
index 3c7cfa309c13e799c89c275347071df8fc7b3498..fa6b7226fedfe3c750b8779bc8e3d949af001964 100644 (file)
@@ -30,6 +30,7 @@
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/mach-imx/sata.h>
 #include <asm/mach-imx/video.h>
+#include <asm/sections.h>
 #include <dm/device-internal.h>
 #include <dm/platform_data/serial_mxc.h>
 #include <dwc_ahsata.h>
index 677caa4a4ebcb3c80085f924e765989d3116493e..e6c9b10570d19959a531b64b15647e3e025a62b5 100644 (file)
@@ -29,6 +29,7 @@
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/mach-imx/sata.h>
 #include <asm/mach-imx/video.h>
+#include <asm/sections.h>
 #include <cpu.h>
 #include <dm/platform_data/serial_mxc.h>
 #include <fsl_esdhc_imx.h>
index 9d54d60bb17d4b0981559a7e448298e41454d9c3..afa3686083a44173fde5b8c0bafef1304fa99d63 100644 (file)
@@ -16,6 +16,7 @@
 #include <asm/io.h>
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/mach-imx/iomux-v3.h>
+#include <asm/sections.h>
 #include <cpu_func.h>
 #include <dm/device.h>
 #include <dm/device-internal.h>
index 1287f719197617b7394a56ae4b3f13c770005ee2..730e266469b22b9b551707231fcb2b603da5793a 100644 (file)
@@ -17,6 +17,7 @@
 #include <asm/global_data.h>
 #include <asm/gpio.h>
 #include <asm/mach-imx/iomux-v3.h>
+#include <asm/sections.h>
 #include <dm.h>
 #include <env.h>
 #include <mmc.h>
index 17b1ae748846b7a34c3a85bb65c06f19ebc2fe83..1dff69c82771f5d0e69cd257a8c6ca2f596c4207 100644 (file)
@@ -12,6 +12,7 @@
 #include <asm/arch/mx6-ddr.h>
 #include <asm/arch/mx6-pins.h>
 #include <asm/arch/crm_regs.h>
+#include <asm/sections.h>
 #include <fsl_esdhc_imx.h>
 
 #define UART_PAD_CTRL  (PAD_CTL_PKE | PAD_CTL_PUE |            \
index 41e70505774d7f2f807ff9cbdeae9f58a191f143..01a63c69641fa1cf275397c2f81701e07cf64197 100644 (file)
@@ -13,6 +13,7 @@
 #include <asm/arch/sys_proto.h>
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/mach-imx/gpio.h>
+#include <asm/sections.h>
 #include <dm/device.h>
 #include <dm/uclass.h>
 
index 906d5e3c2d7cf8f0e2ab4333352c079da19598c2..2caeb32470ff6d970d6136065e838cfb9271d89b 100644 (file)
@@ -374,12 +374,12 @@ void *board_fdt_blob_setup(int *err)
                 * region
                 */
                if (IS_ENABLED(CONFIG_SPL_SEPARATE_BSS))
-                       fdt_blob = (ulong *)&_image_binary_end;
+                       fdt_blob = (ulong *)_image_binary_end;
                else
-                       fdt_blob = (ulong *)&__bss_end;
+                       fdt_blob = (ulong *)__bss_end;
        } else {
                /* FDT is at end of image */
-               fdt_blob = (ulong *)&_end;
+               fdt_blob = (ulong *)_end;
        }
 
        if (fdt_magic(fdt_blob) == FDT_MAGIC)
index 86c2787dc5361b4c6e8e17935ae84e2384bff3e1..0a98f1e22207fb635947e9377ef42a64c9433eef 100644 (file)
@@ -464,8 +464,11 @@ config BOOTMETH_GLOBAL
 
 config BOOTMETH_CROS
        bool "Bootdev support for Chromium OS"
-       depends on X86 || SANDBOX
-       default y
+       depends on X86 || ARM || SANDBOX
+       default y if !ARM
+       select EFI_PARTITION
+       select PARTITION_TYPE_GUID
+       select PARTITION_UUIDS
        help
          Enables support for booting Chromium OS using bootdevs. This uses the
          kernel A slot and obtains the kernel command line from the parameters
@@ -1007,7 +1010,7 @@ config BOOTSTAGE_STASH
 
 config BOOTSTAGE_STASH_ADDR
        hex "Address to stash boot timing information"
-       default 0
+       default 0x0
        help
          Provide an address which will not be overwritten by the OS when it
          starts, so that it can read this information when ready.
index 73b55c196c4ddc16df1f3f6caead75d5692bd57a..0f20a34e5110c15df640bc177a50b06de47076d6 100644 (file)
@@ -12,7 +12,6 @@
 #include <memalign.h>
 #include <linux/err.h>
 #include <u-boot/crc.h>
-#include <u-boot/crc.h>
 
 /**
  * Compute the CRC-32 of the bootloader control struct.
index fa52bc3a9c4e8aebb93c27c83190cb1a835708c0..69506e3865fc04ec4717a1e8c7badb2830c39a4a 100644 (file)
@@ -111,6 +111,8 @@ int bootdev_bind(struct udevice *parent, const char *drv_name, const char *name,
 int bootdev_find_in_blk(struct udevice *dev, struct udevice *blk,
                        struct bootflow_iter *iter, struct bootflow *bflow)
 {
+       struct bootmeth_uc_plat *plat = dev_get_uclass_plat(bflow->method);
+       bool allow_any_part = plat->flags & BOOTMETHF_ANY_PART;
        struct blk_desc *desc = dev_get_uclass_plat(blk);
        struct disk_partition info;
        char partstr[20];
@@ -142,6 +144,7 @@ int bootdev_find_in_blk(struct udevice *dev, struct udevice *blk,
         * us whether there is valid media there
         */
        ret = part_get_info(desc, iter->part, &info);
+       log_debug("part_get_info() returned %d\n", ret);
        if (!iter->part && ret == -ENOENT)
                ret = 0;
 
@@ -154,7 +157,7 @@ int bootdev_find_in_blk(struct udevice *dev, struct udevice *blk,
                ret = -ESHUTDOWN;
        else
                bflow->state = BOOTFLOWST_MEDIA;
-       if (ret) {
+       if (ret && !allow_any_part) {
                /* allow partition 1 to be missing */
                if (iter->part == 1) {
                        iter->max_part = 3;
@@ -174,9 +177,15 @@ int bootdev_find_in_blk(struct udevice *dev, struct udevice *blk,
        if (!iter->part) {
                iter->first_bootable = part_get_bootable(desc);
                log_debug("checking bootable=%d\n", iter->first_bootable);
+       } else if (allow_any_part) {
+               /*
+                * allow any partition to be scanned, by skipping any checks
+                * for filesystems or partition contents on this disk
+                */
 
        /* if there are bootable partitions, scan only those */
-       } else if (iter->first_bootable ? !info.bootable : iter->part != 1) {
+       } else if (iter->first_bootable >= 0 &&
+                  (iter->first_bootable ? !info.bootable : iter->part != 1)) {
                return log_msg_ret("boot", -EINVAL);
        } else {
                ret = fs_set_blk_dev_with_part(desc, bflow->part);
@@ -184,16 +193,16 @@ int bootdev_find_in_blk(struct udevice *dev, struct udevice *blk,
                if (ret)
                        return log_msg_ret("fs", ret);
 
-               /* Use an #ifdef due to info.sys_ind */
-#ifdef CONFIG_DOS_PARTITION
                log_debug("%s: Found partition %x type %x fstype %d\n",
-                         blk->name, bflow->part, info.sys_ind,
+                         blk->name, bflow->part,
+                         IS_ENABLED(CONFIG_DOS_PARTITION) ?
+                         disk_partition_sys_ind(&info) : 0,
                          ret ? -1 : fs_get_type());
-#endif
                bflow->blk = blk;
                bflow->state = BOOTFLOWST_FS;
        }
 
+       log_debug("method %s\n", bflow->method->name);
        ret = bootmeth_read_bootflow(bflow->method, bflow);
        if (ret)
                return log_msg_ret("method", ret);
@@ -560,7 +569,8 @@ int bootdev_get_bootflow(struct udevice *dev, struct bootflow_iter *iter,
 {
        const struct bootdev_ops *ops = bootdev_get_ops(dev);
 
-       log_debug("->get_bootflow %s=%p\n", dev->name, ops->get_bootflow);
+       log_debug("->get_bootflow %s,%x=%p\n", dev->name, iter->part,
+                 ops->get_bootflow);
        bootflow_init(bflow, dev, iter->method);
        if (!ops->get_bootflow)
                return default_get_bootflow(dev, iter, bflow);
index 81b5829d5b3784fcf4492d0a14084101d3076d19..6ef62e1d1896637d1feaf127e0def36c7a341e3d 100644 (file)
@@ -432,6 +432,7 @@ void bootflow_free(struct bootflow *bflow)
        free(bflow->buf);
        free(bflow->os_name);
        free(bflow->fdt_fname);
+       free(bflow->bootmeth_priv);
 }
 
 void bootflow_remove(struct bootflow *bflow)
@@ -444,6 +445,22 @@ void bootflow_remove(struct bootflow *bflow)
        free(bflow);
 }
 
+#if CONFIG_IS_ENABLED(BOOTSTD_FULL)
+int bootflow_read_all(struct bootflow *bflow)
+{
+       int ret;
+
+       if (bflow->state != BOOTFLOWST_READY)
+               return log_msg_ret("rd", -EPROTO);
+
+       ret = bootmeth_read_all(bflow->method, bflow);
+       if (ret)
+               return log_msg_ret("rd2", ret);
+
+       return 0;
+}
+#endif /* BOOTSTD_FULL */
+
 int bootflow_boot(struct bootflow *bflow)
 {
        int ret;
index 75f0b4a9af8a04bf6c2268cc4f6bf32b75478cbd..b1c3afe0a3adafbce9ec99b734befa464633c5f2 100644 (file)
@@ -823,6 +823,43 @@ err:
        return ret;
 }
 
+int bootm_boot_start(ulong addr, const char *cmdline)
+{
+       static struct cmd_tbl cmd = {"bootm"};
+       char addr_str[30];
+       char *argv[] = {addr_str, NULL};
+       int states;
+       int ret;
+
+       /*
+        * TODO(sjg@chromium.org): This uses the command-line interface, but
+        * should not. To clean this up, the various bootm states need to be
+        * passed an info structure instead of cmdline flags. Then this can
+        * set up the required info and move through the states without needing
+        * the command line.
+        */
+       states = BOOTM_STATE_START | BOOTM_STATE_FINDOS | BOOTM_STATE_PRE_LOAD |
+               BOOTM_STATE_FINDOTHER | BOOTM_STATE_LOADOS |
+               BOOTM_STATE_OS_PREP | BOOTM_STATE_OS_FAKE_GO |
+               BOOTM_STATE_OS_GO;
+       if (IS_ENABLED(CONFIG_SYS_BOOT_RAMDISK_HIGH))
+               states |= BOOTM_STATE_RAMDISK;
+       if (IS_ENABLED(CONFIG_PPC) || IS_ENABLED(CONFIG_MIPS))
+               states |= BOOTM_STATE_OS_CMDLINE;
+       images.state |= states;
+
+       snprintf(addr_str, sizeof(addr_str), "%lx", addr);
+
+       ret = env_set("bootargs", cmdline);
+       if (ret) {
+               printf("Failed to set cmdline\n");
+               return ret;
+       }
+       ret = do_bootm_states(&cmd, 0, 1, argv, states, &images, 1);
+
+       return ret;
+}
+
 #if CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT)
 /**
  * image_get_kernel - verify legacy format kernel image
index 175eb1de5e1e1e3b45d96463cb641e63c3a91bec..1d157d54dbdd301cc4b08cf5650cf7379114133c 100644 (file)
@@ -61,6 +61,18 @@ int bootmeth_set_bootflow(struct udevice *dev, struct bootflow *bflow,
        return ops->set_bootflow(dev, bflow, buf, size);
 }
 
+#if CONFIG_IS_ENABLED(BOOTSTD_FULL)
+int bootmeth_read_all(struct udevice *dev, struct bootflow *bflow)
+{
+       const struct bootmeth_ops *ops = bootmeth_get_ops(dev);
+
+       if (!ops->read_all)
+               return -ENOSYS;
+
+       return ops->read_all(dev, bflow);
+}
+#endif /* BOOTSTD_FULL */
+
 int bootmeth_boot(struct udevice *dev, struct bootflow *bflow)
 {
        const struct bootmeth_ops *ops = bootmeth_get_ops(dev);
index aa19ae097f56f73bff1dad4067b6c25a1dbb5522..20e0b1e89c360168fa14eb12ba6b464fbbf61e0d 100644 (file)
 #include <blk.h>
 #include <bootdev.h>
 #include <bootflow.h>
+#include <bootm.h>
 #include <bootmeth.h>
+#include <display_options.h>
 #include <dm.h>
+#include <efi.h>
 #include <malloc.h>
 #include <mapmem.h>
 #include <part.h>
-#ifdef CONFIG_X86
-#include <asm/zimage.h>
-#endif
 #include <linux/sizes.h>
+#include "bootmeth_cros.h"
+
+static const efi_guid_t cros_kern_type = PARTITION_CROS_KERNEL;
+
+/*
+ * Layout of the ChromeOS kernel
+ *
+ * Partitions 2 and 4 contain kernels with type GUID_CROS_KERNEL
+ *
+ * Contents are:
+ *
+ * Offset      Contents
+ *   0         struct vb2_keyblock
+ *   m         struct vb2_kernel_preamble
+ *   m + n     kernel buffer
+ *
+ * m is keyblock->keyblock_size
+ * n is preamble->preamble_size
+ *
+ * The kernel buffer itself consists of various parts:
+ *
+ * Offset      Contents
+ *   m + n     kernel image (Flat vmlinux binary or FIT)
+ *   b - 8KB   Command line text
+ *   b - 4KB   X86 setup block (struct boot_params, extends for about 16KB)
+ *   b          X86 bootloader (continuation of setup block)
+ *   b + 16KB  X86 setup block (copy, used for hold data pointed to)
+ *
+ * b is m + n + preamble->bootloader_address - preamble->body_load_address
+ *
+ * Useful metadata extends from b - 8KB through to b + 32 KB
+ */
 
 enum {
-       /* Offsets in the kernel-partition header */
-       KERN_START      = 0x4f0,
-       KERN_SIZE       = 0x518,
+       PROBE_SIZE      = SZ_4K,        /* initial bytes read from partition */
 
-       SETUP_OFFSET    = 0x1000,       /* bytes before base */
-       CMDLINE_OFFSET  = 0x2000,       /* bytes before base */
-       OFFSET_BASE     = 0x100000,     /* assumed kernel load-address */
+       X86_SETUP_OFFSET = -0x1000,     /* setup offset relative to base */
+       CMDLINE_OFFSET  = -0x2000,      /* cmdline offset relative to base */
+       X86_KERNEL_OFFSET = 0x4000,     /* kernel offset relative to base */
+};
+
+/**
+ * struct cros_priv - Private data
+ *
+ * This is read from the disk and recorded for use when the full kernel must
+ * be loaded and booted
+ *
+ * @body_offset: Offset of kernel body from start of partition (in bytes)
+ * @body_size: Size of kernel body in bytes
+ * @part_start: Block offset of selected partition from the start of the disk
+ * @body_load_address: Nominal load address for kernel body
+ * @bootloader_address: Address of bootloader, after body is loaded at
+ *     body_load_address
+ * @bootloader_size:  Size of bootloader in bytes
+ * @info_buf: Buffer containing ChromiumOS info
+ */
+struct cros_priv {
+       ulong body_offset;
+       ulong body_size;
+       lbaint_t part_start;
+       ulong body_load_address;
+       ulong bootloader_address;
+       ulong bootloader_size;
+       void *info_buf;
 };
 
 static int cros_check(struct udevice *dev, struct bootflow_iter *iter)
@@ -77,61 +132,96 @@ static int copy_cmdline(const char *from, const char *uuid, char **bufp)
        return 0;
 }
 
-static int cros_read_bootflow(struct udevice *dev, struct bootflow *bflow)
+/**
+ * scan_part() - Scan a kernel partition to see if has a ChromeOS header
+ *
+ * This reads the first PROBE_SIZE of a partition, loookng for
+ * VB2_KEYBLOCK_MAGIC
+ *
+ * @blk: Block device to scan
+ * @partnum: Partition number to scan
+ * @info: Please to put partition info
+ * @hdrp: Return allocated keyblock header on success
+ */
+static int scan_part(struct udevice *blk, int partnum,
+                    struct disk_partition *info, struct vb2_keyblock **hdrp)
 {
-       struct blk_desc *desc = dev_get_uclass_plat(bflow->blk);
-       ulong base, start, size, setup, cmdline, num_blks, kern_base;
-       struct disk_partition info;
-       const char *uuid = NULL;
-       void *buf, *hdr;
+       struct blk_desc *desc = dev_get_uclass_plat(blk);
+       struct vb2_keyblock *hdr;
+       struct uuid type;
+       ulong num_blks;
        int ret;
 
-       log_debug("starting, part=%d\n", bflow->part);
+       if (!partnum)
+               return log_msg_ret("efi", -ENOENT);
 
-       /* We consider the whole disk, not any one partition */
-       if (bflow->part)
-               return log_msg_ret("max", -ENOENT);
-
-       /* Check partition 2 */
-       ret = part_get_info(desc, 2, &info);
+       ret = part_get_info(desc, partnum, info);
        if (ret)
                return log_msg_ret("part", ret);
 
+       /* Check for kernel partition type */
+       log_debug("part %x: type=%s\n", partnum, info->type_guid);
+       if (uuid_str_to_bin(info->type_guid, (u8 *)&type, UUID_STR_FORMAT_GUID))
+               return log_msg_ret("typ", -EINVAL);
+
+       if (memcmp(&cros_kern_type, &type, sizeof(type)))
+               return log_msg_ret("typ", -ENOEXEC);
+
        /* Make a buffer for the header information */
-       num_blks = SZ_4K >> desc->log2blksz;
+       num_blks = PROBE_SIZE >> desc->log2blksz;
        log_debug("Reading header, blk=%s, start=%lx, blocks=%lx\n",
-                 bflow->blk->name, (ulong)info.start, num_blks);
-       hdr = memalign(SZ_1K, SZ_4K);
+                 blk->name, (ulong)info->start, num_blks);
+       hdr = memalign(SZ_1K, PROBE_SIZE);
        if (!hdr)
                return log_msg_ret("hdr", -ENOMEM);
-       ret = blk_read(bflow->blk, info.start, num_blks, hdr);
-       if (ret != num_blks)
-               return log_msg_ret("inf", ret);
+       ret = blk_read(blk, info->start, num_blks, hdr);
+       if (ret != num_blks) {
+               free(hdr);
+               return log_msg_ret("inf", -EIO);
+       }
 
-       if (memcmp("CHROMEOS", hdr, 8))
+       if (memcmp(VB2_KEYBLOCK_MAGIC, hdr->magic, VB2_KEYBLOCK_MAGIC_SIZE)) {
+               free(hdr);
+               log_debug("no magic\n");
                return -ENOENT;
+       }
 
-       log_info("Header at %lx\n", (ulong)map_to_sysmem(hdr));
-       start = *(u32 *)(hdr + KERN_START);
-       size = ALIGN(*(u32 *)(hdr + KERN_SIZE), desc->blksz);
-       log_debug("Reading start %lx size %lx\n", start, size);
-       bflow->size = size;
+       *hdrp = hdr;
+
+       return 0;
+}
+
+/**
+ * cros_read_buf() - Read information into a buf and parse it
+ *
+ * @bflow: Bootflow to update
+ * @buf: Buffer to use
+ * @size: Size of buffer and number of bytes to read thereinto
+ * @start: Start offset to read from on disk
+ * @before_base: Number of bytes to read before the bootloader base
+ * @uuid: UUID string if supported, else NULL
+ * Return: 0 if OK, -ENOMEM if out of memory, -EIO on read failure
+ */
+static int cros_read_buf(struct bootflow *bflow, void *buf, ulong size,
+                        loff_t start, ulong before_base, const char *uuid)
+{
+       struct blk_desc *desc = dev_get_uclass_plat(bflow->blk);
+       ulong base, setup, cmdline, kern_base;
+       ulong num_blks;
+       int ret;
 
-       buf = memalign(SZ_1K, size);
-       if (!buf)
-               return log_msg_ret("buf", -ENOMEM);
        num_blks = size >> desc->log2blksz;
-       log_debug("Reading data, blk=%s, start=%lx, blocks=%lx\n",
-                 bflow->blk->name, (ulong)info.start, num_blks);
-       ret = blk_read(bflow->blk, (ulong)info.start + 0x80, num_blks, buf);
+       log_debug("Reading info to %lx, blk=%s, size=%lx, blocks=%lx\n",
+                 (ulong)map_to_sysmem(buf), bflow->blk->name, size, num_blks);
+       ret = blk_read(bflow->blk, start, num_blks, buf);
        if (ret != num_blks)
-               return log_msg_ret("inf", ret);
-       base = map_to_sysmem(buf);
+               return log_msg_ret("inf", -EIO);
+       base = map_to_sysmem(buf) + before_base;
 
-       setup = base + start - OFFSET_BASE - SETUP_OFFSET;
-       cmdline = base + start - OFFSET_BASE - CMDLINE_OFFSET;
-       kern_base = base + start - OFFSET_BASE + SZ_16K;
-       log_debug("base %lx setup %lx, cmdline %lx, kern_base %lx\n", base,
+       setup = base + X86_SETUP_OFFSET;
+       cmdline = base + CMDLINE_OFFSET;
+       kern_base = base + X86_KERNEL_OFFSET;
+       log_debug("base %lx setup %lx cmdline %lx kern_base %lx\n", base,
                  setup, cmdline, kern_base);
 
 #ifdef CONFIG_X86
@@ -151,35 +241,206 @@ static int cros_read_bootflow(struct udevice *dev, struct bootflow *bflow)
        if (!bflow->os_name)
                return log_msg_ret("os", -ENOMEM);
 
-#if CONFIG_IS_ENABLED(PARTITION_UUIDS)
-       uuid = info.uuid;
-#endif
        ret = copy_cmdline(map_sysmem(cmdline, 0), uuid, &bflow->cmdline);
        if (ret)
                return log_msg_ret("cmd", ret);
+       bflow->x86_setup = map_sysmem(setup, 0);
+
+       return 0;
+}
+
+/**
+ * cros_read_info() - Read information and fill out the bootflow
+ *
+ * @bflow: Bootflow to update
+ * @uuid: UUID string if supported, else NULL
+ * @preamble: Kernel preamble information
+ * Return: 0 if OK, -ENOMEM if out of memory, -EIO on read failure
+ */
+static int cros_read_info(struct bootflow *bflow, const char *uuid,
+                         const struct vb2_kernel_preamble *preamble)
+{
+       struct cros_priv *priv = bflow->bootmeth_priv;
+       struct udevice *blk = bflow->blk;
+       struct blk_desc *desc = dev_get_uclass_plat(blk);
+       ulong offset, size, before_base;
+       void *buf;
+       int ret;
+
+       log_debug("Kernel preamble at %lx, version major %x, minor %x\n",
+                 (ulong)map_to_sysmem(preamble),
+                 preamble->header_version_major,
+                 preamble->header_version_minor);
+
+       log_debug("  - load_address %lx, bl_addr %lx, bl_size %lx\n",
+                 (ulong)preamble->body_load_address,
+                 (ulong)preamble->bootloader_address,
+                 (ulong)preamble->bootloader_size);
+
+       priv->body_size = preamble->body_signature.data_size;
+       priv->body_load_address = preamble->body_load_address;
+       priv->bootloader_address = preamble->bootloader_address;
+       priv->bootloader_size = preamble->bootloader_size;
+       log_debug("Kernel body at %lx size %lx\n", priv->body_offset,
+                 priv->body_size);
+
+       /* Work out how many bytes to read before the bootloader base */
+       before_base = -CMDLINE_OFFSET;
+
+       /* Read the cmdline through to the end of the bootloader */
+       size = priv->bootloader_size + before_base;
+       offset = priv->body_offset +
+               (priv->bootloader_address - priv->body_load_address) +
+               CMDLINE_OFFSET;
+       buf = malloc(size);
+       if (!buf)
+               return log_msg_ret("buf", -ENOMEM);
+
+       ret = cros_read_buf(bflow, buf, size,
+                           priv->part_start + (offset >> desc->log2blksz),
+                           before_base, uuid);
+       if (ret) {
+               /* Clear this since the buffer is invalid */
+               bflow->x86_setup = NULL;
+               free(buf);
+               return log_msg_ret("pro", ret);
+       }
+       priv->info_buf = buf;
+
+       return 0;
+}
+
+static int cros_read_kernel(struct bootflow *bflow)
+{
+       struct blk_desc *desc = dev_get_uclass_plat(bflow->blk);
+       struct cros_priv *priv = bflow->bootmeth_priv;
+       ulong base, setup;
+       ulong num_blks;
+       void *buf;
+       int ret;
+
+       bflow->size = priv->body_size;
+
+       buf = memalign(SZ_1K, priv->body_size);
+       if (!buf)
+               return log_msg_ret("buf", -ENOMEM);
+
+       /* Check that the header is not smaller than permitted */
+       if (priv->body_offset < PROBE_SIZE)
+               return log_msg_ret("san", EFAULT);
+
+       /* Read kernel body */
+       num_blks = priv->body_size >> desc->log2blksz;
+       log_debug("Reading body to %lx, blk=%s, size=%lx, blocks=%lx\n",
+                 (ulong)map_to_sysmem(buf), bflow->blk->name, priv->body_size,
+                 num_blks);
+       ret = blk_read(bflow->blk,
+                      priv->part_start + (priv->body_offset >> desc->log2blksz),
+                      num_blks, buf);
+       if (ret != num_blks)
+               return log_msg_ret("inf", -EIO);
+       base = map_to_sysmem(buf) + priv->bootloader_address -
+               priv->body_load_address;
+       setup = base + X86_SETUP_OFFSET;
 
-       bflow->state = BOOTFLOWST_READY;
        bflow->buf = buf;
        bflow->x86_setup = map_sysmem(setup, 0);
 
        return 0;
 }
 
+static int cros_read_bootflow(struct udevice *dev, struct bootflow *bflow)
+{
+       const struct vb2_kernel_preamble *preamble;
+       struct disk_partition info;
+       struct vb2_keyblock *hdr;
+       const char *uuid = NULL;
+       struct cros_priv *priv;
+       int ret;
+
+       log_debug("starting, part=%x\n", bflow->part);
+
+       /* Check for kernel partitions */
+       ret = scan_part(bflow->blk, bflow->part, &info, &hdr);
+       if (ret) {
+               log_debug("- scan failed: err=%d\n", ret);
+               return log_msg_ret("scan", ret);
+       }
+
+       priv = malloc(sizeof(struct cros_priv));
+       if (!priv) {
+               free(hdr);
+               return log_msg_ret("buf", -ENOMEM);
+       }
+       bflow->bootmeth_priv = priv;
+
+       log_debug("Selected partition %d, header at %lx\n", bflow->part,
+                 (ulong)map_to_sysmem(hdr));
+
+       /* Grab a few things from the preamble */
+       preamble = (void *)hdr + hdr->keyblock_size;
+       priv->body_offset = hdr->keyblock_size + preamble->preamble_size;
+       priv->part_start = info.start;
+
+       /* Now read everything we can learn about kernel */
+#if CONFIG_IS_ENABLED(PARTITION_UUIDS)
+       uuid = info.uuid;
+#endif
+       ret = cros_read_info(bflow, uuid, preamble);
+       preamble = NULL;
+       free(hdr);
+       if (ret) {
+               free(priv->info_buf);
+               free(priv);
+               return log_msg_ret("inf", ret);
+       }
+       bflow->size = priv->body_size;
+       bflow->state = BOOTFLOWST_READY;
+
+       return 0;
+}
+
 static int cros_read_file(struct udevice *dev, struct bootflow *bflow,
                         const char *file_path, ulong addr, ulong *sizep)
 {
        return -ENOSYS;
 }
 
+#if CONFIG_IS_ENABLED(BOOSTD_FULL)
+static int cros_read_all(struct udevice *dev, struct bootflow *bflow)
+{
+       int ret;
+
+       if (bflow->buf)
+               return log_msg_ret("ld", -EALREADY);
+       ret = cros_read_kernel(bflow);
+       if (ret)
+               return log_msg_ret("rd", ret);
+
+       return 0;
+}
+#endif /* BOOSTD_FULL */
+
 static int cros_boot(struct udevice *dev, struct bootflow *bflow)
 {
-#ifdef CONFIG_X86
-       zboot_start(map_to_sysmem(bflow->buf), bflow->size, 0, 0,
-                   map_to_sysmem(bflow->x86_setup),
-                   bflow->cmdline);
-#endif
+       int ret;
+
+       if (!bflow->buf) {
+               ret = cros_read_kernel(bflow);
+               if (ret)
+                       return log_msg_ret("rd", ret);
+       }
+
+       if (IS_ENABLED(CONFIG_X86)) {
+               ret = zboot_start(map_to_sysmem(bflow->buf), bflow->size, 0, 0,
+                                 map_to_sysmem(bflow->x86_setup),
+                                 bflow->cmdline);
+       } else {
+               ret = bootm_boot_start(map_to_sysmem(bflow->buf),
+                                      bflow->cmdline);
+       }
 
-       return log_msg_ret("go", -EFAULT);
+       return log_msg_ret("go", ret);
 }
 
 static int cros_bootmeth_bind(struct udevice *dev)
@@ -187,6 +448,7 @@ static int cros_bootmeth_bind(struct udevice *dev)
        struct bootmeth_uc_plat *plat = dev_get_uclass_plat(dev);
 
        plat->desc = "ChromiumOS boot";
+       plat->flags = BOOTMETHF_ANY_PART;
 
        return 0;
 }
@@ -196,6 +458,9 @@ static struct bootmeth_ops cros_bootmeth_ops = {
        .read_bootflow  = cros_read_bootflow,
        .read_file      = cros_read_file,
        .boot           = cros_boot,
+#if CONFIG_IS_ENABLED(BOOSTD_FULL)
+       .read_all       = cros_read_all,
+#endif /* BOOSTD_FULL */
 };
 
 static const struct udevice_id cros_bootmeth_ids[] = {
diff --git a/boot/bootmeth_cros.h b/boot/bootmeth_cros.h
new file mode 100644 (file)
index 0000000..8e30385
--- /dev/null
@@ -0,0 +1,197 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Structures used by the ChromiumOS bootmeth
+ *
+ * See docs at:
+ * https://www.chromium.org/chromium-os/chromiumos-design-docs/verified-boot-data-structures/
+ *
+ * Original code at:
+ * https://chromium.googlesource.com/chromiumos/platform/vboot_reference/+/refs/heads/main/firmware/2lib/include/2struct.h
+ *
+ * Code taken from vboot_reference commit 5b8596ce file 2struct.h
+ *
+ * Copyright 2023 Google LLC
+ * Written by Simon Glass <sjg@chromium.org>
+ */
+
+#ifndef __BOOTMETH_CROS_H
+#define __BOOTMETH_CROS_H
+
+/* Signature data (a secure hash, possibly signed) */
+struct vb2_signature {
+       /* Offset of signature data from start of this struct */
+       uint32_t sig_offset;
+       uint32_t reserved0;
+
+       /* Size of signature data in bytes */
+       uint32_t sig_size;
+       uint32_t reserved1;
+
+       /* Size of the data block which was signed in bytes */
+       uint32_t data_size;
+       uint32_t reserved2;
+} __attribute__((packed));
+
+#define EXPECTED_VB2_SIGNATURE_SIZE 24
+
+/* Packed public key data */
+struct vb2_packed_key {
+       /* Offset of key data from start of this struct */
+       uint32_t key_offset;
+       uint32_t reserved0;
+
+       /* Size of key data in bytes (NOT strength of key in bits) */
+       uint32_t key_size;
+       uint32_t reserved1;
+
+       /* Signature algorithm used by the key (enum vb2_crypto_algorithm) */
+       uint32_t algorithm;
+       uint32_t reserved2;
+
+       /* Key version */
+       uint32_t key_version;
+       uint32_t reserved3;
+
+       /* TODO: when redoing this struct, add a text description of the key */
+} __attribute__((packed));
+
+#define EXPECTED_VB2_PACKED_KEY_SIZE 32
+
+#define VB2_KEYBLOCK_MAGIC "CHROMEOS"
+#define VB2_KEYBLOCK_MAGIC_SIZE 8
+
+/*
+ * Keyblock, containing the public key used to sign some other chunk of data.
+ *
+ * This should be followed by:
+ *   1) The data_key key data, pointed to by data_key.key_offset.
+ *   2) The checksum data for (vb2_keyblock + data_key data), pointed to
+ *      by keyblock_checksum.sig_offset.
+ *   3) The signature data for (vb2_keyblock + data_key data), pointed to
+ *      by keyblock_signature.sig_offset.
+ */
+struct vb2_keyblock {
+       /* Magic number */
+       uint8_t magic[VB2_KEYBLOCK_MAGIC_SIZE];
+
+       /* Version of this header format */
+       uint32_t header_version_major;
+       uint32_t header_version_minor;
+
+       /*
+        * Length of this entire keyblock, including keys, signatures, and
+        * padding, in bytes
+        */
+       uint32_t keyblock_size;
+       uint32_t reserved0;
+
+       /*
+        * Signature for this keyblock (header + data pointed to by data_key)
+        * For use with signed data keys
+        */
+       struct vb2_signature keyblock_signature;
+
+       /*
+        * SHA-512 hash for this keyblock (header + data pointed to by
+        * data_key) For use with unsigned data keys.
+        *
+        * Only supported for kernel keyblocks, not firmware keyblocks.
+        */
+       struct vb2_signature keyblock_hash;
+
+       /* Flags for key (VB2_KEYBLOCK_FLAG_*) */
+       uint32_t keyblock_flags;
+       uint32_t reserved1;
+
+       /* Key to verify the chunk of data */
+       struct vb2_packed_key data_key;
+} __attribute__((packed));
+
+#define EXPECTED_VB2_KEYBLOCK_SIZE 112
+
+/*
+ * Preamble block for kernel, version 2.2
+ *
+ * This should be followed by:
+ *   1) The signature data for the kernel body, pointed to by
+ *      body_signature.sig_offset.
+ *   2) The signature data for (vb2_kernel_preamble + body signature data),
+ *       pointed to by preamble_signature.sig_offset.
+ *   3) The 16-bit vmlinuz header, which is used for reconstruction of
+ *      vmlinuz image.
+ */
+struct vb2_kernel_preamble {
+       /*
+        * Size of this preamble, including keys, signatures, vmlinuz header,
+        * and padding, in bytes
+        */
+       uint32_t preamble_size;
+       uint32_t reserved0;
+
+       /* Signature for this preamble (header + body signature) */
+       struct vb2_signature preamble_signature;
+
+       /* Version of this header format */
+       uint32_t header_version_major;
+       uint32_t header_version_minor;
+
+       /* Kernel version */
+       uint32_t kernel_version;
+       uint32_t reserved1;
+
+       /* Load address for kernel body */
+       uint64_t body_load_address;
+       /* TODO (vboot 2.1): we never used that */
+
+       /* Address of bootloader, after body is loaded at body_load_address */
+       uint64_t bootloader_address;
+       /* TODO (vboot 2.1): should be a 32-bit offset */
+
+       /* Size of bootloader in bytes */
+       uint32_t bootloader_size;
+       uint32_t reserved2;
+
+       /* Signature for the kernel body */
+       struct vb2_signature body_signature;
+
+       /*
+        * TODO (vboot 2.1): fields for kernel offset and size.  Right now the
+        * size is implicitly the same as the size of data signed by the body
+        * signature, and the offset is implicitly at the end of the preamble.
+        * But that forces us to pad the preamble to 64KB rather than just
+        * having a tiny preamble and an offset field.
+        */
+
+       /*
+        * Fields added in header version 2.1.  You must verify the header
+        * version before reading these fields!
+        */
+
+       /*
+        * Address of 16-bit header for vmlinuz reassembly.  Readers should
+        * return 0 for header version < 2.1.
+        */
+       uint64_t vmlinuz_header_address;
+
+       /* Size of 16-bit header for vmlinuz in bytes.  Readers should return 0
+          for header version < 2.1 */
+       uint32_t vmlinuz_header_size;
+       uint32_t reserved3;
+
+       /*
+        * Fields added in header version 2.2.  You must verify the header
+        * version before reading these fields!
+        */
+
+       /*
+        * Flags; see VB2_KERNEL_PREAMBLE_*.  Readers should return 0 for
+        * header version < 2.2.  Flags field is currently defined as:
+        * [31:2] - Reserved (for future use)
+        * [1:0]  - Kernel image type (0b00 - CrOS,
+        *                             0b01 - bootimg,
+        *                             0b10 - multiboot)
+        */
+       uint32_t flags;
+} __attribute__((packed));
+
+#endif /* __BOOTMETH_CROS_H */
index ee24658917bc123c6eec97a89917905c08f42958..73645f70b6cb4d38cd963b9803a2ee1408be27d3 100644 (file)
@@ -6,15 +6,50 @@
  * Written by Simon Glass <sjg@chromium.org>
  */
 
+#define LOG_CATEGORY LOGC_EXPO
+
 #include <common.h>
+#include <abuf.h>
+#include <cedit.h>
 #include <cli.h>
 #include <dm.h>
+#include <env.h>
 #include <expo.h>
+#include <malloc.h>
 #include <menu.h>
+#include <rtc.h>
 #include <video.h>
 #include <linux/delay.h>
 #include "scene_internal.h"
 
+enum {
+       CMOS_MAX_BITS   = 2048,
+       CMOS_MAX_BYTES  = CMOS_MAX_BITS / 8,
+};
+
+#define CMOS_BYTE(bit) ((bit) / 8)
+#define CMOS_BIT(bit)  ((bit) % 8)
+
+/**
+ * struct cedit_iter_priv - private data for cedit operations
+ *
+ * @buf: Buffer to use when writing settings to the devicetree
+ * @node: Node to read from when reading settings from devicetree
+ * @verbose: true to show writing to environment variables
+ * @mask: Mask bits for the CMOS RAM. If a bit is set the byte containing it
+ * will be written
+ * @value: Value bits for CMOS RAM. This is the actual value written
+ * @dev: RTC device to write to
+ */
+struct cedit_iter_priv {
+       struct abuf *buf;
+       ofnode node;
+       bool verbose;
+       u8 *mask;
+       u8 *value;
+       struct udevice *dev;
+};
+
 int cedit_arange(struct expo *exp, struct video_priv *vpriv, uint scene_id)
 {
        struct scene_obj_txt *txt;
@@ -46,18 +81,15 @@ int cedit_arange(struct expo *exp, struct video_priv *vpriv, uint scene_id)
        return 0;
 }
 
-int cedit_run(struct expo *exp)
+int cedit_prepare(struct expo *exp, struct video_priv **vid_privp,
+                 struct scene **scnp)
 {
-       struct cli_ch_state s_cch, *cch = &s_cch;
        struct video_priv *vid_priv;
-       uint scene_id;
        struct udevice *dev;
        struct scene *scn;
-       bool done;
+       uint scene_id;
        int ret;
 
-       cli_ch_init(cch);
-
        /* For now we only support a video console */
        ret = uclass_first_device_err(UCLASS_VIDEO, &dev);
        if (ret)
@@ -92,6 +124,27 @@ int cedit_run(struct expo *exp)
        if (ret)
                return log_msg_ret("dim", ret);
 
+       *vid_privp = vid_priv;
+       *scnp = scn;
+
+       return scene_id;
+}
+
+int cedit_run(struct expo *exp)
+{
+       struct cli_ch_state s_cch, *cch = &s_cch;
+       struct video_priv *vid_priv;
+       uint scene_id;
+       struct scene *scn;
+       bool done;
+       int ret;
+
+       cli_ch_init(cch);
+       ret = cedit_prepare(exp, &vid_priv, &scn);
+       if (ret < 0)
+               return log_msg_ret("prep", ret);
+       scene_id = ret;
+
        done = false;
        do {
                struct expo_action act;
@@ -161,3 +214,507 @@ int cedit_run(struct expo *exp)
 
        return 0;
 }
+
+static int check_space(int ret, struct abuf *buf)
+{
+       if (ret == -FDT_ERR_NOSPACE) {
+               if (!abuf_realloc_inc(buf, CEDIT_SIZE_INC))
+                       return log_msg_ret("spc", -ENOMEM);
+               ret = fdt_resize(abuf_data(buf), abuf_data(buf),
+                                abuf_size(buf));
+               if (ret)
+                       return log_msg_ret("res", -EFAULT);
+       }
+
+       return 0;
+}
+
+static int get_cur_menuitem_text(const struct scene_obj_menu *menu,
+                                const char **strp)
+{
+       struct scene *scn = menu->obj.scene;
+       const struct scene_menitem *mi;
+       const struct scene_obj_txt *txt;
+       const char *str;
+
+       mi = scene_menuitem_find(menu, menu->cur_item_id);
+       if (!mi)
+               return log_msg_ret("mi", -ENOENT);
+
+       txt = scene_obj_find(scn, mi->label_id, SCENEOBJT_TEXT);
+       if (!txt)
+               return log_msg_ret("txt", -ENOENT);
+
+       str = expo_get_str(scn->expo, txt->str_id);
+       if (!str)
+               return log_msg_ret("str", -ENOENT);
+       *strp = str;
+
+       return 0;
+}
+
+static int h_write_settings(struct scene_obj *obj, void *vpriv)
+{
+       struct cedit_iter_priv *priv = vpriv;
+       struct abuf *buf = priv->buf;
+
+       switch (obj->type) {
+       case SCENEOBJT_NONE:
+       case SCENEOBJT_IMAGE:
+       case SCENEOBJT_TEXT:
+               break;
+       case SCENEOBJT_MENU: {
+               const struct scene_obj_menu *menu;
+               const char *str;
+               char name[80];
+               int ret, i;
+
+               menu = (struct scene_obj_menu *)obj;
+               ret = -EAGAIN;
+               for (i = 0; ret && i < 2; i++) {
+                       ret = fdt_property_u32(abuf_data(buf), obj->name,
+                                              menu->cur_item_id);
+                       if (!i) {
+                               ret = check_space(ret, buf);
+                               if (ret)
+                                       return log_msg_ret("res", -ENOMEM);
+                       }
+               }
+               /* this should not happen */
+               if (ret)
+                       return log_msg_ret("wrt", -EFAULT);
+
+               ret = get_cur_menuitem_text(menu, &str);
+               if (ret)
+                       return log_msg_ret("mis", ret);
+
+               snprintf(name, sizeof(name), "%s-str", obj->name);
+               ret = -EAGAIN;
+               for (i = 0; ret && i < 2; i++) {
+                       ret = fdt_property_string(abuf_data(buf), name, str);
+                       if (!i) {
+                               ret = check_space(ret, buf);
+                               if (ret)
+                                       return log_msg_ret("rs2", -ENOMEM);
+                       }
+               }
+
+               /* this should not happen */
+               if (ret)
+                       return log_msg_ret("wr2", -EFAULT);
+
+               break;
+       }
+       }
+
+       return 0;
+}
+
+int cedit_write_settings(struct expo *exp, struct abuf *buf)
+{
+       struct cedit_iter_priv priv;
+       void *fdt;
+       int ret;
+
+       abuf_init(buf);
+       if (!abuf_realloc(buf, CEDIT_SIZE_INC))
+               return log_msg_ret("buf", -ENOMEM);
+
+       fdt = abuf_data(buf);
+       ret = fdt_create(fdt, abuf_size(buf));
+       if (!ret)
+               ret = fdt_finish_reservemap(fdt);
+       if (!ret)
+               ret = fdt_begin_node(fdt, "");
+       if (!ret)
+               ret = fdt_begin_node(fdt, CEDIT_NODE_NAME);
+       if (ret) {
+               log_debug("Failed to start FDT (err=%d)\n", ret);
+               return log_msg_ret("sta", -EINVAL);
+       }
+
+       /* write out the items */
+       priv.buf = buf;
+       ret = expo_iter_scene_objs(exp, h_write_settings, &priv);
+       if (ret) {
+               log_debug("Failed to write settings (err=%d)\n", ret);
+               return log_msg_ret("set", ret);
+       }
+
+       ret = fdt_end_node(fdt);
+       if (!ret)
+               ret = fdt_end_node(fdt);
+       if (!ret)
+               ret = fdt_finish(fdt);
+       if (ret) {
+               log_debug("Failed to finish FDT (err=%d)\n", ret);
+               return log_msg_ret("fin", -EINVAL);
+       }
+
+       return 0;
+}
+
+static int h_read_settings(struct scene_obj *obj, void *vpriv)
+{
+       struct cedit_iter_priv *priv = vpriv;
+       ofnode node = priv->node;
+
+       switch (obj->type) {
+       case SCENEOBJT_NONE:
+       case SCENEOBJT_IMAGE:
+       case SCENEOBJT_TEXT:
+               break;
+       case SCENEOBJT_MENU: {
+               struct scene_obj_menu *menu;
+               uint val;
+
+               if (ofnode_read_u32(node, obj->name, &val))
+                       return log_msg_ret("rd", -ENOENT);
+               menu = (struct scene_obj_menu *)obj;
+               menu->cur_item_id = val;
+
+               break;
+       }
+       }
+
+       return 0;
+}
+
+int cedit_read_settings(struct expo *exp, oftree tree)
+{
+       struct cedit_iter_priv priv;
+       ofnode root, node;
+       int ret;
+
+       root = oftree_root(tree);
+       if (!ofnode_valid(root))
+               return log_msg_ret("roo", -ENOENT);
+       node = ofnode_find_subnode(root, CEDIT_NODE_NAME);
+       if (!ofnode_valid(node))
+               return log_msg_ret("pat", -ENOENT);
+
+       /* read in the items */
+       priv.node = node;
+       ret = expo_iter_scene_objs(exp, h_read_settings, &priv);
+       if (ret) {
+               log_debug("Failed to read settings (err=%d)\n", ret);
+               return log_msg_ret("set", ret);
+       }
+
+       return 0;
+}
+
+static int h_write_settings_env(struct scene_obj *obj, void *vpriv)
+{
+       const struct scene_obj_menu *menu;
+       struct cedit_iter_priv *priv = vpriv;
+       char name[80], var[60];
+       const char *str;
+       int val, ret;
+
+       if (obj->type != SCENEOBJT_MENU)
+               return 0;
+
+       menu = (struct scene_obj_menu *)obj;
+       val = menu->cur_item_id;
+       snprintf(var, sizeof(var), "c.%s", obj->name);
+
+       if (priv->verbose)
+               printf("%s=%d\n", var, val);
+
+       ret = env_set_ulong(var, val);
+       if (ret)
+               return log_msg_ret("set", ret);
+
+       ret = get_cur_menuitem_text(menu, &str);
+       if (ret)
+               return log_msg_ret("mis", ret);
+
+       snprintf(name, sizeof(name), "c.%s-str", obj->name);
+       if (priv->verbose)
+               printf("%s=%s\n", name, str);
+
+       ret = env_set(name, str);
+       if (ret)
+               return log_msg_ret("st2", ret);
+
+       return 0;
+}
+
+int cedit_write_settings_env(struct expo *exp, bool verbose)
+{
+       struct cedit_iter_priv priv;
+       int ret;
+
+       /* write out the items */
+       priv.verbose = verbose;
+       ret = expo_iter_scene_objs(exp, h_write_settings_env, &priv);
+       if (ret) {
+               log_debug("Failed to write settings to env (err=%d)\n", ret);
+               return log_msg_ret("set", ret);
+       }
+
+       return 0;
+}
+
+static int h_read_settings_env(struct scene_obj *obj, void *vpriv)
+{
+       struct cedit_iter_priv *priv = vpriv;
+       struct scene_obj_menu *menu;
+       char var[60];
+       int val;
+
+       if (obj->type != SCENEOBJT_MENU)
+               return 0;
+
+       menu = (struct scene_obj_menu *)obj;
+       val = menu->cur_item_id;
+       snprintf(var, sizeof(var), "c.%s", obj->name);
+
+       val = env_get_ulong(var, 10, 0);
+       if (priv->verbose)
+               printf("%s=%d\n", var, val);
+       if (!val)
+               return log_msg_ret("get", -ENOENT);
+
+       /*
+        * note that no validation is done here, to make sure the ID is valid
+        * and actually points to a menu item
+        */
+       menu->cur_item_id = val;
+
+       return 0;
+}
+
+int cedit_read_settings_env(struct expo *exp, bool verbose)
+{
+       struct cedit_iter_priv priv;
+       int ret;
+
+       /* write out the items */
+       priv.verbose = verbose;
+       ret = expo_iter_scene_objs(exp, h_read_settings_env, &priv);
+       if (ret) {
+               log_debug("Failed to read settings from env (err=%d)\n", ret);
+               return log_msg_ret("set", ret);
+       }
+
+       return 0;
+}
+
+/**
+ * get_cur_menuitem_seq() - Get the sequence number of a menu's current item
+ *
+ * Enumerates the items of a menu (0, 1, 2) and returns the sequence number of
+ * the currently selected item. If the first item is selected, this returns 0;
+ * if the second, 1; etc.
+ *
+ * @menu: Menu to check
+ * Return: Sequence number on success, else -ve error value
+ */
+static int get_cur_menuitem_seq(const struct scene_obj_menu *menu)
+{
+       const struct scene_menitem *mi;
+       int seq, found;
+
+       seq = 0;
+       found = -1;
+       list_for_each_entry(mi, &menu->item_head, sibling) {
+               if (mi->id == menu->cur_item_id) {
+                       found = seq;
+                       break;
+               }
+               seq++;
+       }
+
+       if (found == -1)
+               return log_msg_ret("nf", -ENOENT);
+
+       return found;
+}
+
+static int h_write_settings_cmos(struct scene_obj *obj, void *vpriv)
+{
+       const struct scene_obj_menu *menu;
+       struct cedit_iter_priv *priv = vpriv;
+       int val, ret;
+       uint i, seq;
+
+       if (obj->type != SCENEOBJT_MENU)
+               return 0;
+
+       menu = (struct scene_obj_menu *)obj;
+       val = menu->cur_item_id;
+
+       ret = get_cur_menuitem_seq(menu);
+       if (ret < 0)
+               return log_msg_ret("cur", ret);
+       seq = ret;
+       log_debug("%s: seq=%d\n", menu->obj.name, seq);
+
+       /* figure out where to place this item */
+       if (!obj->bit_length)
+               return log_msg_ret("len", -EINVAL);
+       if (obj->start_bit + obj->bit_length > CMOS_MAX_BITS)
+               return log_msg_ret("bit", -E2BIG);
+
+       for (i = 0; i < obj->bit_length; i++, seq >>= 1) {
+               uint bitnum = obj->start_bit + i;
+
+               priv->mask[CMOS_BYTE(bitnum)] |= 1 << CMOS_BIT(bitnum);
+               if (seq & 1)
+                       priv->value[CMOS_BYTE(bitnum)] |= BIT(CMOS_BIT(bitnum));
+               log_debug("bit %x %x %x\n", bitnum,
+                         priv->mask[CMOS_BYTE(bitnum)],
+                         priv->value[CMOS_BYTE(bitnum)]);
+       }
+
+       return 0;
+}
+
+int cedit_write_settings_cmos(struct expo *exp, struct udevice *dev,
+                             bool verbose)
+{
+       struct cedit_iter_priv priv;
+       int ret, i, count, first, last;
+
+       /* write out the items */
+       priv.mask = calloc(1, CMOS_MAX_BYTES);
+       if (!priv.mask)
+               return log_msg_ret("mas", -ENOMEM);
+       priv.value = calloc(1, CMOS_MAX_BYTES);
+       if (!priv.value) {
+               free(priv.mask);
+               return log_msg_ret("val", -ENOMEM);
+       }
+
+       ret = expo_iter_scene_objs(exp, h_write_settings_cmos, &priv);
+       if (ret) {
+               log_debug("Failed to write CMOS (err=%d)\n", ret);
+               ret = log_msg_ret("set", ret);
+               goto done;
+       }
+
+       /* write the data to the RTC */
+       first = CMOS_MAX_BYTES;
+       last = -1;
+       for (i = 0, count = 0; i < CMOS_MAX_BYTES; i++) {
+               if (priv.mask[i]) {
+                       log_debug("Write byte %x: %x\n", i, priv.value[i]);
+                       ret = rtc_write8(dev, i, priv.value[i]);
+                       if (ret) {
+                               ret = log_msg_ret("wri", ret);
+                               goto done;
+                       }
+                       count++;
+                       first = min(first, i);
+                       last = max(last, i);
+               }
+       }
+       if (verbose) {
+               printf("Write %d bytes from offset %x to %x\n", count, first,
+                      last);
+       }
+
+done:
+       free(priv.mask);
+       free(priv.value);
+       return ret;
+}
+
+static int h_read_settings_cmos(struct scene_obj *obj, void *vpriv)
+{
+       struct cedit_iter_priv *priv = vpriv;
+       const struct scene_menitem *mi;
+       struct scene_obj_menu *menu;
+       int val, ret;
+       uint i;
+
+       if (obj->type != SCENEOBJT_MENU)
+               return 0;
+
+       menu = (struct scene_obj_menu *)obj;
+
+       /* figure out where to place this item */
+       if (!obj->bit_length)
+               return log_msg_ret("len", -EINVAL);
+       if (obj->start_bit + obj->bit_length > CMOS_MAX_BITS)
+               return log_msg_ret("bit", -E2BIG);
+
+       val = 0;
+       for (i = 0; i < obj->bit_length; i++) {
+               uint bitnum = obj->start_bit + i;
+               uint offset = CMOS_BYTE(bitnum);
+
+               /* read the byte if not already read */
+               if (!priv->mask[offset]) {
+                       ret = rtc_read8(priv->dev, offset);
+                       if (ret < 0)
+                               return  log_msg_ret("rea", ret);
+                       priv->value[offset] = ret;
+
+                       /* mark it as read */
+                       priv->mask[offset] = 0xff;
+               }
+
+               if (priv->value[offset] & BIT(CMOS_BIT(bitnum)))
+                       val |= BIT(i);
+               log_debug("bit %x %x\n", bitnum, val);
+       }
+
+       /* update the current item */
+       mi = scene_menuitem_find_seq(menu, val);
+       if (!mi)
+               return log_msg_ret("seq", -ENOENT);
+
+       menu->cur_item_id = mi->id;
+       log_debug("Update menu %d cur_item_id %d\n", menu->obj.id, mi->id);
+
+       return 0;
+}
+
+int cedit_read_settings_cmos(struct expo *exp, struct udevice *dev,
+                            bool verbose)
+{
+       struct cedit_iter_priv priv;
+       int ret, i, count, first, last;
+
+       /* read in the items */
+       priv.mask = calloc(1, CMOS_MAX_BYTES);
+       if (!priv.mask)
+               return log_msg_ret("mas", -ENOMEM);
+       priv.value = calloc(1, CMOS_MAX_BYTES);
+       if (!priv.value) {
+               free(priv.mask);
+               return log_msg_ret("val", -ENOMEM);
+       }
+       priv.dev = dev;
+
+       ret = expo_iter_scene_objs(exp, h_read_settings_cmos, &priv);
+       if (ret) {
+               log_debug("Failed to read CMOS (err=%d)\n", ret);
+               ret = log_msg_ret("set", ret);
+               goto done;
+       }
+
+       /* read the data to the RTC */
+       first = CMOS_MAX_BYTES;
+       last = -1;
+       for (i = 0, count = 0; i < CMOS_MAX_BYTES; i++) {
+               if (priv.mask[i]) {
+                       log_debug("Read byte %x: %x\n", i, priv.value[i]);
+                       count++;
+                       first = min(first, i);
+                       last = max(last, i);
+               }
+       }
+       if (verbose) {
+               printf("Read %d bytes from offset %x to %x\n", count, first,
+                      last);
+       }
+
+done:
+       free(priv.mask);
+       free(priv.value);
+       return ret;
+}
index db837f7b49241c11cbe4ae58689fbd164e167202..139d684f8e6e06a0f4a1d48920213c2def9281af 100644 (file)
@@ -266,3 +266,18 @@ int expo_apply_theme(struct expo *exp, ofnode node)
 
        return 0;
 }
+
+int expo_iter_scene_objs(struct expo *exp, expo_scene_obj_iterator iter,
+                        void *priv)
+{
+       struct scene *scn;
+       int ret;
+
+       list_for_each_entry(scn, &exp->scene_head, sibling) {
+               ret = scene_iter_objs(scn, iter, priv);
+               if (ret)
+                       return log_msg_ret("wr", ret);
+       }
+
+       return 0;
+}
index 22f62eb54bc536edc77d0d8386f8d326509ad584..bb33cc2a33f438cd5212ed641930cf6193913766 100644 (file)
@@ -214,22 +214,21 @@ static void list_strings(struct build_info *info)
  * @info: Build information
  * @node: Node containing the menu description
  * @scn: Scene to add the menu to
+ * @id: ID for the menu
+ * @objp: Returns the object pointer
  * Returns: 0 if OK, -ENOMEM if out of memory, -EINVAL if there is a format
  * error, -ENOENT if there is a references to a non-existent string
  */
-static int menu_build(struct build_info *info, ofnode node, struct scene *scn)
+static int menu_build(struct build_info *info, ofnode node, struct scene *scn,
+                     uint id, struct scene_obj **objp)
 {
        struct scene_obj_menu *menu;
        uint title_id, menu_id;
        const u32 *item_ids;
        int ret, size, i;
        const char *name;
-       u32 id;
 
        name = ofnode_get_name(node);
-       ret = ofnode_read_u32(node, "id", &id);
-       if (ret)
-               return log_msg_ret("id", -EINVAL);
 
        ret = scene_menu(scn, name, id, &menu);
        if (ret < 0)
@@ -275,12 +274,13 @@ static int menu_build(struct build_info *info, ofnode node, struct scene *scn)
                if (ret < 0)
                        return log_msg_ret("mi", ret);
        }
+       *objp = &menu->obj;
 
        return 0;
 }
 
 /**
- * menu_build() - Build an expo object and add it to a scene
+ * obj_build() - Build an expo object and add it to a scene
  *
  * See doc/developer/expo.rst for a description of the format
  *
@@ -292,8 +292,9 @@ static int menu_build(struct build_info *info, ofnode node, struct scene *scn)
  */
 static int obj_build(struct build_info *info, ofnode node, struct scene *scn)
 {
+       struct scene_obj *obj;
        const char *type;
-       u32 id;
+       u32 id, val;
        int ret;
 
        log_debug("- object %s\n", ofnode_get_name(node));
@@ -306,12 +307,17 @@ static int obj_build(struct build_info *info, ofnode node, struct scene *scn)
                return log_msg_ret("typ", -EINVAL);
 
        if (!strcmp("menu", type))
-               ret = menu_build(info, node, scn);
+               ret = menu_build(info, node, scn, id, &obj);
         else
                ret = -EINVAL;
        if (ret)
                return log_msg_ret("bld", ret);
 
+       if (!ofnode_read_u32(node, "start-bit", &val))
+               obj->start_bit = val;
+       if (!ofnode_read_u32(node, "bit-length", &val))
+               obj->bit_length = val;
+
        return 0;
 }
 
index d13c47dd9429d5806583f4403d2fac12a7cd4a59..ac1414a5f26d20f1fa853eed170f2e4c3aae883b 100644 (file)
@@ -702,8 +702,8 @@ static int label_boot(struct pxe_context *ctx, struct pxe_label *label)
                                }
                        }
 
-               if (label->kaslrseed)
-                       label_boot_kaslrseed();
+                       if (label->kaslrseed)
+                               label_boot_kaslrseed();
 
 #ifdef CONFIG_OF_LIBFDT_OVERLAY
                        if (label->fdtoverlays)
index e52333371f9cbc34a714599ccd64eb8e13a660d0..6c52948eb69c1942d4ac7ce2106019f9ff1360d7 100644 (file)
@@ -79,7 +79,7 @@ int scene_obj_count(struct scene *scn)
        return count;
 }
 
-void *scene_obj_find(struct scene *scn, uint id, enum scene_obj_t type)
+void *scene_obj_find(const struct scene *scn, uint id, enum scene_obj_t type)
 {
        struct scene_obj *obj;
 
@@ -681,3 +681,19 @@ int scene_set_open(struct scene *scn, uint id, bool open)
 
        return 0;
 }
+
+int scene_iter_objs(struct scene *scn, expo_scene_obj_iterator iter,
+                   void *priv)
+{
+       struct scene_obj *obj;
+
+       list_for_each_entry(obj, &scn->obj_head, sibling) {
+               int ret;
+
+               ret = iter(obj, priv);
+               if (ret)
+                       return log_msg_ret("itr", ret);
+       }
+
+       return 0;
+}
index fb1ea5533b9ae6b3c4f7a2041633554a0bc7f043..695a907dc6af51075d0740e162811540fffa040b 100644 (file)
@@ -9,6 +9,8 @@
 #ifndef __SCENE_INTERNAL_H
 #define __SCENE_INTERNAL_H
 
+typedef int (*expo_scene_obj_iterator)(struct scene_obj *obj, void *priv);
+
 /**
  * expo_lookup_scene_id() - Look up a scene ID
  *
@@ -38,7 +40,7 @@ uint resolve_id(struct expo *exp, uint id);
  * @type: Type of the object, or SCENEOBJT_NONE to match any type
  * Returns: Object found, or NULL if not found
  */
-void *scene_obj_find(struct scene *scn, uint id, enum scene_obj_t type);
+void *scene_obj_find(const struct scene *scn, uint id, enum scene_obj_t type);
 
 /**
  * scene_obj_find_by_name() - Find an object in a scene by name
@@ -198,4 +200,50 @@ int scene_menu_render_deps(struct scene *scn, struct scene_obj_menu *menu);
  */
 int scene_menu_calc_dims(struct scene_obj_menu *menu);
 
+/**
+ * scene_iter_objs() - Iterate through all scene objects
+ *
+ * @scn: Scene to process
+ * @iter: Iterator to call on each object
+ * @priv: Private data to pass to the iterator, in addition to the object
+ * Return: 0 if OK, -ve on error
+ */
+int scene_iter_objs(struct scene *scn, expo_scene_obj_iterator iter,
+                   void *priv);
+
+/**
+ * expo_iter_scene_objects() - Iterate through all scene objects
+ *
+ * @exp: Expo to process
+ * @iter: Iterator to call on each object
+ * @priv: Private data to pass to the iterator, in addition to the object
+ * Return: 0 if OK, -ve on error
+ */
+int expo_iter_scene_objs(struct expo *exp, expo_scene_obj_iterator iter,
+                        void *priv);
+
+/**
+ * scene_menuitem_find() - Find the menu item for an ID
+ *
+ * Looks up the menu to find the item with the given ID
+ *
+ * @menu: Menu to check
+ * @id: ID to look for
+ * Return: Menu item, or NULL if not found
+ */
+struct scene_menitem *scene_menuitem_find(const struct scene_obj_menu *menu,
+                                         int id);
+
+/**
+ * scene_menuitem_find_seq() - Find the menu item at a sequential position
+ *
+ * This numbers the items from 0 and returns the seq'th one
+ *
+ * @menu: Menu to check
+ * @seq: Sequence number to look for
+ * Return: menu item if found, else NULL
+ */
+struct scene_menitem *scene_menuitem_find_seq(const struct scene_obj_menu *menu,
+                                             uint seq);
+
 #endif /* __SCENE_INTERNAL_H */
index 8a355f838cc8bcfa8b3f5cac78146e141c45cb02..e0dcd0a4e041c0f8a8160b2f75db6eb22445dde9 100644 (file)
@@ -33,8 +33,8 @@ void scene_menu_destroy(struct scene_obj_menu *menu)
                scene_menuitem_destroy(item);
 }
 
-static struct scene_menitem *scene_menuitem_find(struct scene_obj_menu *menu,
-                                                int id)
+struct scene_menitem *scene_menuitem_find(const struct scene_obj_menu *menu,
+                                         int id)
 {
        struct scene_menitem *item;
 
@@ -46,6 +46,22 @@ static struct scene_menitem *scene_menuitem_find(struct scene_obj_menu *menu,
        return NULL;
 }
 
+struct scene_menitem *scene_menuitem_find_seq(const struct scene_obj_menu *menu,
+                                             uint seq)
+{
+       struct scene_menitem *item;
+       uint i;
+
+       i = 0;
+       list_for_each_entry(item, &menu->item_head, sibling) {
+               if (i == seq)
+                       return item;
+               i++;
+       }
+
+       return NULL;
+}
+
 /**
  * update_pointers() - Update the pointer object and handle highlights
  *
@@ -416,7 +432,7 @@ int scene_menuitem(struct scene *scn, uint menu_id, const char *name, uint id,
        if (!scene_obj_find(scn, label_id, SCENEOBJT_TEXT))
                return log_msg_ret("txt", -EINVAL);
 
-       item = calloc(1, sizeof(struct scene_obj_menu));
+       item = calloc(1, sizeof(struct scene_menitem));
        if (!item)
                return log_msg_ret("item", -ENOMEM);
        item->name = strdup(name);
index 312edfa2bdb536c466d675f661e5e57186fe5c22..2f218d4bf97cde87c0b6b126f760ea019236125a 100644 (file)
@@ -230,4 +230,4 @@ static int bootmeth_vbe_ft_fixup(void *ctx, struct event *event)
 
        return 0;
 }
-EVENT_SPY(EVT_FT_FIXUP, bootmeth_vbe_ft_fixup);
+EVENT_SPY_FULL(EVT_FT_FIXUP, bootmeth_vbe_ft_fixup);
index 8c641ec07e2d8ed2b324279540e324860c876e9c..3285e438a56830e1391bd006cf015efeb8554214 100644 (file)
@@ -109,4 +109,4 @@ static int bootmeth_vbe_simple_ft_fixup(void *ctx, struct event *event)
 
        return 0;
 }
-EVENT_SPY(EVT_FT_FIXUP, bootmeth_vbe_simple_ft_fixup);
+EVENT_SPY_FULL(EVT_FT_FIXUP, bootmeth_vbe_simple_ft_fixup);
index 43ca10f69ccf0184ab458dbdb1874e5a088ca90b..3f14923b5ef8e128538b947db2340c18bbc6d92c 100644 (file)
@@ -517,7 +517,7 @@ config CMD_SPL
 config CMD_SPL_NAND_OFS
        hex "Offset of OS args or dtb for Falcon-mode NAND boot"
        depends on CMD_SPL && (TPL_NAND_SUPPORT || SPL_NAND_SUPPORT)
-       default 0
+       default 0x0
        help
          This provides the offset of the command line arguments for Linux
          when booting from NAND in Falcon mode.  See doc/README.falcon
@@ -527,7 +527,7 @@ config CMD_SPL_NAND_OFS
 config CMD_SPL_NOR_OFS
        hex "Offset of OS args or dtb for Falcon-mode NOR boot"
        depends on CMD_SPL && SPL_NOR_SUPPORT
-       default 0
+       default 0x0
        help
          This provides the offset of the command line arguments or dtb for
          Linux when booting from NOR in Falcon mode.
@@ -1524,7 +1524,7 @@ config DEFAULT_SPI_BUS
 config DEFAULT_SPI_MODE
        hex "default spi mode used by sspi command (see include/spi.h)"
        depends on CMD_SPI
-       default 0
+       default 0x0
 
 config CMD_TEMPERATURE
        bool "temperature - display the temperature from thermal sensors"
@@ -1815,7 +1815,7 @@ config BOOTP_PXE_CLIENTARCH
        depends on BOOTP_PXE
        default 0x16 if ARM64
        default 0x15 if ARM
-       default 0 if X86
+       default 0x0 if X86
 
 config BOOTP_VCI_STRING
        string
index c0aa4f84fe8d91ae204af83aaae9c2faa529b716..300ad3aaa760528d9f6dc2caef8a78d42e8c7cc5 100644 (file)
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <bootdev.h>
 #include <bootflow.h>
+#include <bootm.h>
 #include <bootstd.h>
 #include <command.h>
 #include <console.h>
@@ -70,7 +71,7 @@ static void show_bootflow(int index, struct bootflow *bflow, bool errors)
        printf("%3x  %-11s  %-6s  %-9.9s %4x  %-25.25s %s\n", index,
               bflow->method->name, bootflow_state_get_name(bflow->state),
               bflow->dev ? dev_get_uclass_name(dev_get_parent(bflow->dev)) :
-              "(none)", bflow->part, bflow->name, bflow->fname);
+              "(none)", bflow->part, bflow->name, bflow->fname ?: "");
        if (errors)
                report_bootflow_err(bflow, bflow->err);
 }
@@ -303,11 +304,14 @@ static int do_bootflow_info(struct cmd_tbl *cmdtp, int flag, int argc,
 {
        struct bootstd_priv *std;
        struct bootflow *bflow;
+       bool x86_setup = false;
        bool dump = false;
        int ret;
 
-       if (argc > 1 && *argv[1] == '-')
+       if (argc > 1 && *argv[1] == '-') {
                dump = strchr(argv[1], 'd');
+               x86_setup = strchr(argv[1], 's');
+       }
 
        ret = bootstd_get_priv(&std);
        if (ret)
@@ -319,6 +323,12 @@ static int do_bootflow_info(struct cmd_tbl *cmdtp, int flag, int argc,
        }
        bflow = std->cur_bootflow;
 
+       if (IS_ENABLED(CONFIG_X86) && x86_setup) {
+               zimage_dump(bflow->x86_setup, false);
+
+               return 0;
+       }
+
        printf("Name:      %s\n", bflow->name);
        printf("Device:    %s\n", bflow->dev->name);
        printf("Block dev: %s\n", bflow->blk ? bflow->blk->name : "(none)");
@@ -369,6 +379,35 @@ static int do_bootflow_info(struct cmd_tbl *cmdtp, int flag, int argc,
        return 0;
 }
 
+static int do_bootflow_read(struct cmd_tbl *cmdtp, int flag, int argc,
+                           char *const argv[])
+{
+       struct bootstd_priv *std;
+       struct bootflow *bflow;
+       int ret;
+
+       ret = bootstd_get_priv(&std);
+       if (ret)
+               return CMD_RET_FAILURE;
+
+       /*
+        * Require a current bootflow. Users can use 'bootflow scan -b' to
+        * automatically scan and boot, if needed.
+        */
+       if (!std->cur_bootflow) {
+               printf("No bootflow selected\n");
+               return CMD_RET_FAILURE;
+       }
+       bflow = std->cur_bootflow;
+       ret = bootflow_read_all(bflow);
+       if (ret) {
+               printf("Failed: err=%dE\n", ret);
+               return CMD_RET_FAILURE;
+       }
+
+       return 0;
+}
+
 static int do_bootflow_boot(struct cmd_tbl *cmdtp, int flag, int argc,
                            char *const argv[])
 {
@@ -508,8 +547,9 @@ static char bootflow_help_text[] =
        "scan [-abeGl] [bdev]  - scan for valid bootflows (-l list, -a all, -e errors, -b boot, -G no global)\n"
        "bootflow list [-e]             - list scanned bootflows (-e errors)\n"
        "bootflow select [<num>|<name>] - select a bootflow\n"
-       "bootflow info [-d]             - show info on current bootflow (-d dump bootflow)\n"
-       "bootflow boot                  - boot current bootflow (or first available if none selected)\n"
+       "bootflow info [-ds]            - show info on current bootflow (-d dump bootflow)\n"
+       "bootflow read                  - read all current-bootflow files\n"
+       "bootflow boot                  - boot current bootflow\n"
        "bootflow menu [-t]             - show a menu of available bootflows\n"
        "bootflow cmdline [set|get|clear|delete|auto] <param> [<value>] - update cmdline";
 #else
@@ -523,6 +563,7 @@ U_BOOT_CMD_WITH_SUBCMDS(bootflow, "Boot flows", bootflow_help_text,
        U_BOOT_SUBCMD_MKENT(list, 2, 1, do_bootflow_list),
        U_BOOT_SUBCMD_MKENT(select, 2, 1, do_bootflow_select),
        U_BOOT_SUBCMD_MKENT(info, 2, 1, do_bootflow_info),
+       U_BOOT_SUBCMD_MKENT(read, 1, 1, do_bootflow_read),
        U_BOOT_SUBCMD_MKENT(boot, 1, 1, do_bootflow_boot),
        U_BOOT_SUBCMD_MKENT(menu, 2, 1, do_bootflow_menu),
        U_BOOT_SUBCMD_MKENT(cmdline, 4, 1, do_bootflow_cmdline),
index 0cae304c4adced59d3ae40e3004c710b0b1ebf71..2ff284f4cde6d00eb11b32f071be9a337286198e 100644 (file)
@@ -7,14 +7,29 @@
  */
 
 #include <common.h>
+#include <abuf.h>
+#include <cedit.h>
 #include <command.h>
+#include <dm.h>
 #include <expo.h>
 #include <fs.h>
+#include <malloc.h>
+#include <mapmem.h>
 #include <dm/ofnode.h>
 #include <linux/sizes.h>
 
 struct expo *cur_exp;
 
+static int check_cur_expo(void)
+{
+       if (!cur_exp) {
+               printf("No expo loaded\n");
+               return -ENOENT;
+       }
+
+       return 0;
+}
+
 static int do_cedit_load(struct cmd_tbl *cmdtp, int flag, int argc,
                         char *const argv[])
 {
@@ -53,18 +68,192 @@ static int do_cedit_load(struct cmd_tbl *cmdtp, int flag, int argc,
        return 0;
 }
 
+static int do_cedit_write_fdt(struct cmd_tbl *cmdtp, int flag, int argc,
+                             char *const argv[])
+{
+       const char *fname;
+       struct abuf buf;
+       loff_t bytes;
+       int ret;
+
+       if (argc < 4)
+               return CMD_RET_USAGE;
+       fname = argv[3];
+
+       if (check_cur_expo())
+               return CMD_RET_FAILURE;
+
+       ret = cedit_write_settings(cur_exp, &buf);
+       if (ret) {
+               printf("Failed to write settings: %dE\n", ret);
+               return CMD_RET_FAILURE;
+       }
+
+       if (fs_set_blk_dev(argv[1], argv[2], FS_TYPE_ANY))
+               return CMD_RET_FAILURE;
+
+       ret = fs_write(fname, map_to_sysmem(abuf_data(&buf)), 0,
+                      abuf_size(&buf), &bytes);
+       if (ret)
+               return CMD_RET_FAILURE;
+
+       return 0;
+}
+
+static int do_cedit_read_fdt(struct cmd_tbl *cmdtp, int flag, int argc,
+                            char *const argv[])
+{
+       const char *fname;
+       void *buf;
+       oftree tree;
+       ulong size;
+       int ret;
+
+       if (argc < 4)
+               return CMD_RET_USAGE;
+       fname = argv[3];
+
+       ret = fs_load_alloc(argv[1], argv[2], argv[3], SZ_1M, 0, &buf, &size);
+       if (ret) {
+               printf("File not found\n");
+               return CMD_RET_FAILURE;
+       }
+
+       tree = oftree_from_fdt(buf);
+       if (!oftree_valid(tree)) {
+               free(buf);
+               printf("Cannot create oftree\n");
+               return CMD_RET_FAILURE;
+       }
+
+       ret = cedit_read_settings(cur_exp, tree);
+       oftree_dispose(tree);
+       free(buf);
+       if (ret) {
+               printf("Failed to read settings: %dE\n", ret);
+               return CMD_RET_FAILURE;
+       }
+
+       return 0;
+}
+
+static int do_cedit_write_env(struct cmd_tbl *cmdtp, int flag, int argc,
+                             char *const argv[])
+{
+       bool verbose;
+       int ret;
+
+       if (check_cur_expo())
+               return CMD_RET_FAILURE;
+
+       verbose = argc > 1 && !strcmp(argv[1], "-v");
+
+       ret = cedit_write_settings_env(cur_exp, verbose);
+       if (ret) {
+               printf("Failed to write settings to environment: %dE\n", ret);
+               return CMD_RET_FAILURE;
+       }
+
+       return 0;
+}
+
+static int do_cedit_read_env(struct cmd_tbl *cmdtp, int flag, int argc,
+                            char *const argv[])
+{
+       bool verbose;
+       int ret;
+
+       if (check_cur_expo())
+               return CMD_RET_FAILURE;
+
+       verbose = argc > 1 && !strcmp(argv[1], "-v");
+
+       ret = cedit_read_settings_env(cur_exp, verbose);
+       if (ret) {
+               printf("Failed to read settings from environment: %dE\n", ret);
+               return CMD_RET_FAILURE;
+       }
+
+       return 0;
+}
+
+static int do_cedit_write_cmos(struct cmd_tbl *cmdtp, int flag, int argc,
+                              char *const argv[])
+{
+       struct udevice *dev;
+       bool verbose = false;
+       int ret;
+
+       if (check_cur_expo())
+               return CMD_RET_FAILURE;
+
+       if (argc > 1 && !strcmp(argv[1], "-v")) {
+               verbose = true;
+               argc--;
+               argv++;
+       }
+
+       if (argc > 1)
+               ret = uclass_get_device_by_name(UCLASS_RTC, argv[1], &dev);
+       else
+               ret = uclass_first_device_err(UCLASS_RTC, &dev);
+       if (ret) {
+               printf("Failed to get RTC device: %dE\n", ret);
+               return CMD_RET_FAILURE;
+       }
+
+       if (cedit_write_settings_cmos(cur_exp, dev, verbose)) {
+               printf("Failed to write settings to CMOS\n");
+               return CMD_RET_FAILURE;
+       }
+
+       return 0;
+}
+
+static int do_cedit_read_cmos(struct cmd_tbl *cmdtp, int flag, int argc,
+                             char *const argv[])
+{
+       struct udevice *dev;
+       bool verbose = false;
+       int ret;
+
+       if (check_cur_expo())
+               return CMD_RET_FAILURE;
+
+       if (argc > 1 && !strcmp(argv[1], "-v")) {
+               verbose = true;
+               argc--;
+               argv++;
+       }
+
+       if (argc > 1)
+               ret = uclass_get_device_by_name(UCLASS_RTC, argv[1], &dev);
+       else
+               ret = uclass_first_device_err(UCLASS_RTC, &dev);
+       if (ret) {
+               printf("Failed to get RTC device: %dE\n", ret);
+               return CMD_RET_FAILURE;
+       }
+
+       ret = cedit_read_settings_cmos(cur_exp, dev, verbose);
+       if (ret) {
+               printf("Failed to read settings from CMOS: %dE\n", ret);
+               return CMD_RET_FAILURE;
+       }
+
+       return 0;
+}
+
 static int do_cedit_run(struct cmd_tbl *cmdtp, int flag, int argc,
                        char *const argv[])
 {
        ofnode node;
        int ret;
 
-       if (!cur_exp) {
-               printf("No expo loaded\n");
+       if (check_cur_expo())
                return CMD_RET_FAILURE;
-       }
 
-       node = ofnode_path("/cedit-theme");
+       node = ofnode_path("/bootstd/cedit-theme");
        if (ofnode_valid(node)) {
                ret = expo_apply_theme(cur_exp, node);
                if (ret)
@@ -84,10 +273,22 @@ static int do_cedit_run(struct cmd_tbl *cmdtp, int flag, int argc,
 #ifdef CONFIG_SYS_LONGHELP
 static char cedit_help_text[] =
        "load <interface> <dev[:part]> <filename>   - load config editor\n"
+       "cedit read_fdt <i/f> <dev[:part]> <filename>     - read settings\n"
+       "cedit write_fdt <i/f> <dev[:part]> <filename>    - write settings\n"
+       "cedit read_env [-v]                              - read settings from env vars\n"
+       "cedit write_env [-v]                             - write settings to env vars\n"
+       "cedit read_cmos [-v] [dev]                       - read settings from CMOS RAM\n"
+       "cedit write_cmos [-v] [dev]                      - write settings to CMOS RAM\n"
        "cedit run                                        - run config editor";
 #endif /* CONFIG_SYS_LONGHELP */
 
 U_BOOT_CMD_WITH_SUBCMDS(cedit, "Configuration editor", cedit_help_text,
        U_BOOT_SUBCMD_MKENT(load, 5, 1, do_cedit_load),
+       U_BOOT_SUBCMD_MKENT(read_fdt, 5, 1, do_cedit_read_fdt),
+       U_BOOT_SUBCMD_MKENT(write_fdt, 5, 1, do_cedit_write_fdt),
+       U_BOOT_SUBCMD_MKENT(read_env, 2, 1, do_cedit_read_env),
+       U_BOOT_SUBCMD_MKENT(write_env, 2, 1, do_cedit_write_env),
+       U_BOOT_SUBCMD_MKENT(read_cmos, 2, 1, do_cedit_read_cmos),
+       U_BOOT_SUBCMD_MKENT(write_cmos, 2, 1, do_cedit_write_cmos),
        U_BOOT_SUBCMD_MKENT(run, 1, 1, do_cedit_run),
 );
index fe9e06681ce2948de6ee3771437f82b6c4705cfa..3cc6436b28b07aeab2c046d1f97b80c9297dba60 100644 (file)
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -211,12 +211,10 @@ static struct disk_part *allocate_disk_part(struct disk_partition *info,
                PART_TYPE_LEN);
        newpart->gpt_part_info.type[PART_TYPE_LEN - 1] = '\0';
        newpart->gpt_part_info.bootable = info->bootable;
-#ifdef CONFIG_PARTITION_UUIDS
-       strncpy(newpart->gpt_part_info.uuid, (const char *)info->uuid,
-               UUID_STR_LEN);
-       /* UUID_STR_LEN is correct, as uuid[]'s length is UUID_STR_LEN+1 chars */
-       newpart->gpt_part_info.uuid[UUID_STR_LEN] = '\0';
-#endif
+       if (IS_ENABLED(CONFIG_PARTITION_UUIDS)) {
+               strlcpy(newpart->gpt_part_info.uuid, disk_partition_uuid(info),
+                       UUID_STR_LEN + 1);
+       }
        newpart->partnum = partnum;
 
        return newpart;
index 833266f08b1e48a1a5b84e761ca69f833faf0d7f..c75907af7726808a48ff2c8cea5f0641a4d0ff36 100644 (file)
--- a/cmd/mux.c
+++ b/cmd/mux.c
@@ -49,7 +49,7 @@ static struct mux_control *cmd_mux_find(char *const argv[])
 
        chip = dev_get_uclass_priv(dev);
        if (!chip)
-               return ERR_PTR(ret);
+               return ERR_PTR(-EINVAL);
 
        if (id >= chip->controllers)
                return ERR_PTR(-EINVAL);
index 24944ab81e2321c29521f21eb90c177e8c8873b7..7a30b5cc8f87ca4fe614d8cd5227bb11ae9b74ec 100644 (file)
@@ -262,7 +262,7 @@ static int append_value(char **bufp, size_t *sizep, char *data)
        char *tmp_buf = NULL, *new_buf = NULL, *value;
        unsigned long len = 0;
 
-       if (!strncmp(data, "=0x", 2)) { /* hexadecimal number */
+       if (!strncmp(data, "=0x", 3)) { /* hexadecimal number */
                union {
                        u8 u8;
                        u16 u16;
index 677142520bb796066e512c8b4fa2b0c6cd8b0d7c..7bfb1b9b2803ae444fe6d4932580cfc533b28bd7 100644 (file)
--- a/cmd/pxe.c
+++ b/cmd/pxe.c
@@ -333,8 +333,7 @@ static int do_pxe(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 }
 
 U_BOOT_CMD(pxe, 4, 1, do_pxe,
-          "commands to get and boot from pxe files\n"
-          "To use IPv6 add -ipv6 parameter",
+          "get and boot from pxe files",
           "get [" USE_IP6_CMD_PARAM "] - try to retrieve a pxe file using tftp\n"
           "pxe boot [pxefile_addr_r] [-ipv6] - boot from the pxe file at pxefile_addr_r\n"
 );
index 4d671e7ef12b17792dcdf9a892a13593d92fa637..233471f6cb7550203419ca257a75d24544194078 100644 (file)
@@ -215,7 +215,7 @@ int setexpr_regex_sub(char *data, uint data_size, char *nbuf, uint nbuf_size,
 
                if (res == 0) {
                        if (loop == 0) {
-                               printf("%s: No match\n", data);
+                               debug("%s: No match\n", data);
                                return 1;
                        } else {
                                break;
@@ -359,7 +359,7 @@ static int regex_sub_var(const char *name, const char *r, const char *s,
        if (ret)
                return 1;
 
-       printf("%s=%s\n", name, data);
+       debug("%s=%s\n", name, data);
 
        return env_set(name, data);
 }
index c4ed8e5901205b336d2e6ddc0eacc79950a4cd85..9bdc9c660fd0089892114fd1729977cb7cfbd1a1 100644 (file)
@@ -294,8 +294,8 @@ static int test_readonly(struct udevice *dev)
         */
        index_0 += 1;
        if (tpm_nv_write_value(dev, INDEX0, (uint8_t *)&index_0,
-                              sizeof(index_0) !=
-               TPM_SUCCESS)) {
+                              sizeof(index_0)) !=
+               TPM_SUCCESS) {
                pr_err("\tcould not write index 0\n");
        }
        tpm_nv_write_value_lock(dev, INDEX0);
index cdb77a6a7da2401ff3e7b26d61e4e91ce004d70e..d916194b9423fd5972c3ca4311070cdc7b89d4b4 100644 (file)
@@ -720,6 +720,7 @@ config SYS_FSL_CLK
 
 config LAST_STAGE_INIT
        bool "Call board-specific as last setup step"
+       select EVENT
        help
          Some boards need to perform initialisation immediately before control
          is passed to the command-line interpreter (e.g. for initializations
@@ -1031,7 +1032,7 @@ config BLOBLIST_SIZE
 config BLOBLIST_SIZE_RELOC
        hex "Size of bloblist after relocation"
        default BLOBLIST_SIZE if BLOBLIST_FIXED || BLOBLIST_ALLOC
-       default 0 if BLOBLIST_PASSAGE
+       default 0x0 if BLOBLIST_PASSAGE
        help
          Sets the size of the bloblist in bytes after relocation. Since U-Boot
          has a lot more memory available then, it is possible to use a larger
index e9f4edb93db9ae7cf39729ccbac75a98bc7caa4c..aef395b1354eeb8a1f84b9aafc89e62d56b5ee3e 100644 (file)
@@ -124,8 +124,8 @@ static int display_text_info(void)
 #if !defined(CONFIG_SANDBOX) && !defined(CONFIG_EFI_APP)
        ulong bss_start, bss_end, text_base;
 
-       bss_start = (ulong)&__bss_start;
-       bss_end = (ulong)&__bss_end;
+       bss_start = (ulong)__bss_start;
+       bss_end = (ulong)__bss_end;
 
 #ifdef CONFIG_TEXT_BASE
        text_base = CONFIG_TEXT_BASE;
@@ -148,11 +148,12 @@ static int print_resetinfo(void)
        bool status_printed = false;
        int ret;
 
-       /* Not all boards have sysreset drivers available during early
+       /*
+        * Not all boards have sysreset drivers available during early
         * boot, so don't fail if one can't be found.
         */
        for (ret = uclass_first_device_check(UCLASS_SYSRESET, &dev); dev;
-                       ret = uclass_next_device_check(&dev)) {
+            ret = uclass_next_device_check(&dev)) {
                if (ret) {
                        debug("%s: %s sysreset device (error: %d)\n",
                              __func__, dev->name, ret);
@@ -279,31 +280,24 @@ static int init_func_i2c(void)
 }
 #endif
 
-#if defined(CONFIG_VID)
-__weak int init_func_vid(void)
-{
-       return 0;
-}
-#endif
-
 static int setup_mon_len(void)
 {
 #if defined(__ARM__) || defined(__MICROBLAZE__)
-       gd->mon_len = (ulong)&__bss_end - (ulong)_start;
+       gd->mon_len = (ulong)__bss_end - (ulong)_start;
 #elif defined(CONFIG_SANDBOX) && !defined(__riscv)
-       gd->mon_len = (ulong)&_end - (ulong)_init;
+       gd->mon_len = (ulong)_end - (ulong)_init;
 #elif defined(CONFIG_SANDBOX)
        /* gcc does not provide _init in crti.o on RISC-V */
        gd->mon_len = 0;
 #elif defined(CONFIG_EFI_APP)
-       gd->mon_len = (ulong)&_end - (ulong)_init;
+       gd->mon_len = (ulong)_end - (ulong)_init;
 #elif defined(CONFIG_NIOS2) || defined(CONFIG_XTENSA)
        gd->mon_len = CONFIG_SYS_MONITOR_LEN;
 #elif defined(CONFIG_SH) || defined(CONFIG_RISCV)
-       gd->mon_len = (ulong)(&__bss_end) - (ulong)(&_start);
+       gd->mon_len = (ulong)(__bss_end) - (ulong)(_start);
 #elif defined(CONFIG_SYS_MONITOR_BASE)
-       /* TODO: use (ulong)&__bss_end - (ulong)&__text_start; ? */
-       gd->mon_len = (ulong)&__bss_end - CONFIG_SYS_MONITOR_BASE;
+       /* TODO: use (ulong)__bss_end - (ulong)__text_start; ? */
+       gd->mon_len = (ulong)__bss_end - CONFIG_SYS_MONITOR_BASE;
 #endif
        return 0;
 }
@@ -835,11 +829,6 @@ __weak int clear_bss(void)
        return 0;
 }
 
-static int misc_init_f(void)
-{
-       return event_notify_null(EVT_MISC_INIT_F);
-}
-
 static const init_fnc_t init_sequence_f[] = {
        setup_mon_len,
 #ifdef CONFIG_OF_CONTROL
@@ -859,9 +848,7 @@ static const init_fnc_t init_sequence_f[] = {
 #if defined(CONFIG_CONSOLE_RECORD_INIT_F)
        console_record_init,
 #endif
-#if defined(CONFIG_HAVE_FSP)
-       arch_fsp_init,
-#endif
+       INITCALL_EVENT(EVT_FSP_INIT_F),
        arch_cpu_init,          /* basic arch cpu dependent setup */
        mach_cpu_init,          /* SoC/machine dependent CPU setup */
        initf_dm,
@@ -898,13 +885,10 @@ static const init_fnc_t init_sequence_f[] = {
        show_board_info,
 #endif
        INIT_FUNC_WATCHDOG_INIT
-       misc_init_f,
+       INITCALL_EVENT(EVT_MISC_INIT_F),
        INIT_FUNC_WATCHDOG_RESET
 #if CONFIG_IS_ENABLED(SYS_I2C_LEGACY)
        init_func_i2c,
-#endif
-#if defined(CONFIG_VID) && !defined(CONFIG_SPL)
-       init_func_vid,
 #endif
        announce_dram_init,
        dram_init,              /* configure available RAM banks */
index 4aaa89403117e95027ee4b9bd6787bf1ce5a3685..ad9a3cf6336a0fef2ca59a09fd37806fb1775c9f 100644 (file)
@@ -126,9 +126,9 @@ static int initr_reloc_global_data(void)
 #ifdef __ARM__
        monitor_flash_len = _end - __image_copy_start;
 #elif defined(CONFIG_RISCV)
-       monitor_flash_len = (ulong)&_end - (ulong)&_start;
+       monitor_flash_len = (ulong)_end - (ulong)_start;
 #elif !defined(CONFIG_SANDBOX) && !defined(CONFIG_NIOS2)
-       monitor_flash_len = (ulong)&__init_end - gd->relocaddr;
+       monitor_flash_len = (ulong)__init_end - gd->relocaddr;
 #endif
 #if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
        /*
@@ -583,7 +583,10 @@ static int run_main_loop(void)
 }
 
 /*
- * We hope to remove most of the driver-related init and do it if/when
+ * Over time we hope to remove these functions with code fragments and
+ * stub functions, and instead call the relevant function directly.
+ *
+ * We also hope to remove most of the driver-related init and do it if/when
  * the driver is later used.
  *
  * TODO: perhaps reset the watchdog in the initcall function after each call?
@@ -770,15 +773,8 @@ static init_fnc_t init_sequence_r[] = {
 #ifdef CONFIG_POST
        initr_post,
 #endif
-#ifdef CONFIG_LAST_STAGE_INIT
        INIT_FUNC_WATCHDOG_RESET
-       /*
-        * Some parts can be only initialized if all others (like
-        * Interrupts) are up and running (i.e. the PC-style ISA
-        * keyboard).
-        */
-       last_stage_init,
-#endif
+       INITCALL_EVENT(EVT_LAST_STAGE_INIT),
 #if defined(CFG_PRAM)
        initr_mem,
 #endif
@@ -810,10 +806,8 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
 #endif
        gd->flags &= ~GD_FLG_LOG_READY;
 
-       if (IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC)) {
-               for (int i = 0; i < ARRAY_SIZE(init_sequence_r); i++)
-                       MANUAL_RELOC(init_sequence_r[i]);
-       }
+       if (IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC))
+               initcall_manual_reloc(init_sequence_r);
 
        if (initcall_run_list(init_sequence_r))
                hang();
index 93a35668cc29dad6953c447f39d0a67d54f1243f..934b83f7ec3fd2147f2a49386b09e0e642a74aa8 100644 (file)
@@ -79,7 +79,7 @@ int bounce_buffer_stop(struct bounce_buffer *state)
 {
        if (state->flags & GEN_BB_WRITE) {
                /* Invalidate cache so that CPU can see any newly DMA'd data */
-               dma_unmap_single((dma_addr_t)state->bounce_buffer,
+               dma_unmap_single((dma_addr_t)(uintptr_t)state->bounce_buffer,
                                 state->len_aligned,
                                 DMA_BIDIRECTIONAL);
        }
index 6653300e6cf48db043f41064c71bc6539cd5cec9..d11b37a1d802a9d1480d2211a70a07ed7f4b08ea 100644 (file)
@@ -36,6 +36,8 @@ const char *const type_name[] = {
 
        /* init hooks */
        "misc_init_f",
+       "fsp_init_r",
+       "last_stage_init",
 
        /* Fpga load hook */
        "fpga_load",
@@ -50,7 +52,7 @@ const char *const type_name[] = {
 _Static_assert(ARRAY_SIZE(type_name) == EVT_COUNT, "event type_name size");
 #endif
 
-static const char *event_type_name(enum event_t type)
+const char *event_type_name(enum event_t type)
 {
 #if CONFIG_IS_ENABLED(EVENT_DEBUG)
        return type_name[type];
@@ -72,7 +74,14 @@ static int notify_static(struct event *ev)
 
                        log_debug("Sending event %x/%s to spy '%s'\n", ev->type,
                                  event_type_name(ev->type), event_spy_id(spy));
-                       ret = spy->func(NULL, ev);
+                       if (spy->flags & EVSPYF_SIMPLE) {
+                               const struct evspy_info_simple *simple;
+
+                               simple = (struct evspy_info_simple *)spy;
+                               ret = simple->func();
+                       } else {
+                               ret = spy->func(NULL, ev);
+                       }
 
                        /*
                         * TODO: Handle various return codes to
index cbffdfd6db36f2bebe6f3ba9b3f64d3f8efbe895..159179e7f214b6d3c3ab435a006973322cbba311 100644 (file)
@@ -21,7 +21,6 @@
 #include <asm/global_data.h>
 #include <asm/io.h>
 #include <linux/errno.h>
-#include <u-boot/crc.h>
 #else
 #include "mkimage.h"
 #include <linux/compiler_attributes.h>
index c5dd476db58c73399d51b3c31ba14d472baf6427..1c2fe78e3e064ff995c2c8df593011249709acb8 100644 (file)
@@ -67,7 +67,7 @@ config SPL_SIZE_LIMIT_SUBTRACT_MALLOC
 config SPL_SIZE_LIMIT_PROVIDE_STACK
        hex "SPL image size check: provide stack space before relocation"
        depends on SPL_SIZE_LIMIT > 0
-       default 0
+       default 0x0
        help
          If set, this size is reserved in SPL_SIZE_LIMIT check to ensure such
          an image does not overflow SRAM if SPL_SIZE_LIMIT describes the size
index 3d6cf1e59f31a1d670048717fbc30359fbdc7623..cc71578f6466f120c48a19254dbb1ff23616c2ce 100644 (file)
@@ -126,7 +126,7 @@ config TPL_POWER
 
 config TPL_TEXT_BASE
        hex "Base address for the .text section of the TPL stage"
-       default 0
+       default 0x0
        help
          The base address for the .text section of the TPL stage.
 
index a665091b00f525d552ed1dffe7aef4c8f425be29..20f687e138917d8c7db36ac16b3d6779c86b7fda 100644 (file)
@@ -229,7 +229,7 @@ static int mmc_load_image_raw_os(struct spl_image_info *spl_image,
 {
        int ret;
 
-#if CONFIG_VAL(SYS_MMCSD_RAW_MODE_ARGS_SECTOR)
+#if defined(CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR)
        unsigned long count;
 
        count = blk_dread(mmc_get_blk_desc(mmc),
index 5b5e842a11b1eb70169dd3b14d1b316bdbab170d..f7dd289286d442dc258faffbea017e8f11b313d9 100644 (file)
@@ -21,6 +21,23 @@ static int smh_read_full(long fd, void *memp, size_t len)
        return 0;
 }
 
+static ulong smh_fit_read(struct spl_load_info *load, ulong file_offset,
+                         ulong size, void *buf)
+{
+       long fd;
+       ulong ret;
+
+       fd = smh_open(load->filename, MODE_READ | MODE_BINARY);
+       if (fd < 0) {
+               log_debug("could not open %s: %ld\n", load->filename, fd);
+               return 0;
+       }
+       ret = smh_read(fd, buf, size);
+       smh_close(fd);
+
+       return ret;
+}
+
 static int spl_smh_load_image(struct spl_image_info *spl_image,
                              struct spl_boot_device *bootdev)
 {
@@ -49,6 +66,20 @@ static int spl_smh_load_image(struct spl_image_info *spl_image,
                goto out;
        }
 
+       if (IS_ENABLED(CONFIG_SPL_LOAD_FIT) &&
+           image_get_magic(header) == FDT_MAGIC) {
+               struct spl_load_info load;
+
+               debug("Found FIT\n");
+               load.read = smh_fit_read;
+               load.bl_len = 1;
+               load.filename = filename;
+               load.priv = NULL;
+               smh_close(fd);
+
+               return spl_load_simple_fit(spl_image, &load, 0, header);
+       }
+
        ret = spl_parse_image_header(spl_image, bootdev, header);
        if (ret) {
                log_debug("failed to parse image header: %d\n", ret);
index a485cc65eaf5fd5cfcfa97ff79f9896a93057314..7c4085d0849fe707386396350258726d8bfa1a26 100644 (file)
@@ -17,7 +17,6 @@ CONFIG_SPL_SERIAL=y
 CONFIG_SPL_DRIVERS_MISC=y
 CONFIG_BOOTCOUNT_BOOTLIMIT=3
 CONFIG_SPL=y
-CONFIG_BOOTSTAGE_STASH_ADDR=0x0
 CONFIG_ENV_OFFSET_REDUND=0x540000
 CONFIG_SPL_LIBDISK_SUPPORT=y
 CONFIG_SYS_MEMTEST_START=0x80000000
index 755560971e57c4557125de946de1af467799e2fc..d58a9030dbd08e4ac2da89d28f03ce339511df4b 100644 (file)
@@ -16,6 +16,7 @@ CONFIG_NVME_APPLE=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_XHCI_DWC3=y
 CONFIG_USB_XHCI_PCI=y
+CONFIG_USB_DWC3=y
 CONFIG_USB_KEYBOARD=y
 CONFIG_SYS_WHITE_ON_BLACK=y
 CONFIG_NO_FB_CLEAR=y
index a44c9b714be6880a53ca0a9888a1efc1cd2299b9..573f1b48645a95f024939b553b5b8e9de500a5d0 100644 (file)
@@ -25,7 +25,6 @@ CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PBSIZE=532
 CONFIG_CMD_CPU=y
index 00799715e8f91d40acd87c80d8b0f2198694e775..59c3986a2e78ccf7a966807cac97d26776737839 100644 (file)
@@ -18,7 +18,6 @@ CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PBSIZE=532
 CONFIG_CMD_CPU=y
index 152f297c350b5f35f1f677423a37fda02c5c0d87..5394396f8fc676166ed30b513f8bc45d0e81e531 100644 (file)
@@ -40,7 +40,6 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_LOG=y
 CONFIG_LOGF_FUNC=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
 CONFIG_BLOBLIST=y
 # CONFIG_TPL_BLOBLIST is not set
 CONFIG_BLOBLIST_ADDR=0x100000
index 558609e13d667c9b61374a882411db128e1c2dd3..eb8923ceeff7759c6cb9dfad63871d98dd4e8f8c 100644 (file)
@@ -29,7 +29,6 @@ CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
 CONFIG_MISC_INIT_R=y
 CONFIG_SPL_NO_BSS_LIMIT=y
 CONFIG_SPL_SYS_MALLOC_SIMPLE=y
index 96c26f1c37765130bbca2e2493c22577bbff51b1..4347cad33db1cc0a3dd9b620e1a65ae94b0fc2fd 100644 (file)
@@ -25,7 +25,6 @@ CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
 CONFIG_MISC_INIT_R=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PBSIZE=532
index 4019c169a4c7de1ad3da0889843df5804c34add1..3b6a1732c11139a4f44f089a34bb7095778853b6 100644 (file)
@@ -25,7 +25,6 @@ CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
 CONFIG_MISC_INIT_R=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PBSIZE=532
index 4cfaf4bc5c79542e755d659d7e3e4b87e526c890..33ada9fe4f93150995a3d088a0468b956db6c6b8 100644 (file)
@@ -30,7 +30,6 @@ CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
 CONFIG_MISC_INIT_R=y
 CONFIG_BLOBLIST=y
 CONFIG_BLOBLIST_ADDR=0xff7c0000
index f050d066be414c5e2293381bcc9735e1a5127f65..4351a811528bd0111162f720fa876e903551bd3b 100644 (file)
@@ -21,7 +21,6 @@ CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
 CONFIG_MISC_INIT_R=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PBSIZE=532
index 656d575998c722191ee1971042612325affdb4f8..1515246086ea2302a559e47d0f17a5eca0744f99 100644 (file)
@@ -31,7 +31,6 @@ CONFIG_BOOTCOMMAND="load scsi 0:2 03000000 /boot/vmlinuz-${kernel-ver}-generic;l
 CONFIG_USE_PREBOOT=y
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PBSIZE=532
 CONFIG_CMD_CPU=y
index 54dc59e8a13477b5ea6792ffec0780a9cbeaefda..d62fb997c993a9447b13f90546f48361ba380a3f 100644 (file)
@@ -27,7 +27,6 @@ CONFIG_BOOTCOMMAND="load scsi 0:2 03000000 /boot/vmlinuz-${kernel-ver}-generic;l
 CONFIG_USE_PREBOOT=y
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PBSIZE=532
 CONFIG_CMD_CPU=y
index 8aadaa68c279fbd074676913dd69b042c71950af..2793e2c0b9d1b4bbd63aced7ead5ac94c5ed4050 100644 (file)
@@ -19,7 +19,6 @@ CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
 CONFIG_PRE_CONSOLE_BUFFER=y
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
 CONFIG_SPL_NO_BSS_LIMIT=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PBSIZE=532
index 8e11de6638190fa98ce33ae619011f89c19c224f..f196ed776d0b1138163e7a73d2dd9aa99b15860b 100644 (file)
@@ -20,7 +20,6 @@ CONFIG_LOG=y
 CONFIG_LOGF_LINE=y
 CONFIG_LOGF_FUNC=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
 CONFIG_PCI_INIT_R=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_PART=y
index da5ff5573d0563c5851dd7ad29e9276b01d9a21a..71c79f5fb8dad22ce5c916f244e717013ab94c73 100644 (file)
@@ -20,7 +20,6 @@ CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PBSIZE=532
 CONFIG_CMD_CPU=y
index 70e1a50a244eb622380921bd785674dd9e841160..e734c758dac84b02e6e02e4e6b0abc7497e1ca79 100644 (file)
@@ -21,7 +21,6 @@ CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PBSIZE=532
 CONFIG_CMD_CPU=y
index 9313e7fbd1217a80327ee2beff2604bf68ac1335..79f5d74ec5971ec81bf837a86f164570c78e87eb 100644 (file)
@@ -26,7 +26,6 @@ CONFIG_BOOTCOMMAND="load scsi 0:1 03000000 /boot/vmlinuz-${kernel-ver}-generic;l
 CONFIG_USE_PREBOOT=y
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PBSIZE=532
 CONFIG_CMD_CPU=y
index 8692a8a9995aae44dd859bfd8eba21f5a2ada99a..f134680e4122678405dd6d3683ce90fd4e7ce7a7 100644 (file)
@@ -13,7 +13,6 @@ CONFIG_TARGET_EDISON=y
 CONFIG_SMP=y
 CONFIG_SYS_MONITOR_BASE=0x01101000
 CONFIG_BOARD_EARLY_INIT_R=y
-CONFIG_LAST_STAGE_INIT=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_MAXARGS=128
 CONFIG_SYS_CBSIZE=2048
index 50975dbfaafc35cf34616b356624f2d89829e916..dfc315774a50b1529e44f3419bb29bd5de11a883 100644 (file)
@@ -2,7 +2,7 @@ CONFIG_X86=y
 CONFIG_NR_DRAM_BANKS=8
 CONFIG_ENV_SIZE=0x1000
 CONFIG_DEFAULT_DEVICE_TREE="efi-x86_app"
-CONFIG_DEBUG_UART_BASE=0
+CONFIG_DEBUG_UART_BASE=0x0
 CONFIG_DEBUG_UART_CLOCK=0
 CONFIG_VENDOR_EFI=y
 CONFIG_TARGET_EFI_APP32=y
@@ -16,7 +16,6 @@ CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PBSIZE=532
 CONFIG_CMD_BOOTZ=y
index 0fc358ddcdfb96018e14ed8da534b4c41249a734..e0cfe3ee243a672f39c378ea80c85b66e9b1d005 100644 (file)
@@ -2,7 +2,7 @@ CONFIG_X86=y
 CONFIG_NR_DRAM_BANKS=8
 CONFIG_ENV_SIZE=0x1000
 CONFIG_DEFAULT_DEVICE_TREE="efi-x86_app"
-CONFIG_DEBUG_UART_BASE=0
+CONFIG_DEBUG_UART_BASE=0x0
 CONFIG_DEBUG_UART_CLOCK=0
 CONFIG_X86_RUN_64BIT=y
 CONFIG_VENDOR_EFI=y
@@ -17,7 +17,6 @@ CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PBSIZE=532
 CONFIG_CMD_BOOTZ=y
index 4149eea6cf645ba4293b0e31b9e65e53a9c156a9..15323678e31470fa94d163dd5dbf4dd54ca6d034 100644 (file)
@@ -15,7 +15,6 @@ CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
 CONFIG_PRE_CONSOLE_BUFFER=y
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PBSIZE=532
 CONFIG_CMD_IDE=y
index d41f73cccfc9133d201041419fb2925525df4c53..80460d336fb1882035df00aabfd68644d2a2729b 100644 (file)
@@ -15,7 +15,6 @@ CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
 CONFIG_PRE_CONSOLE_BUFFER=y
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PBSIZE=532
 CONFIG_CMD_IDE=y
index c1e7f390ad5ee04c87b5a8d88a5f06e0d8453ea4..7469f3fbe0ac79403ccce9b28613899265e9477c 100644 (file)
@@ -12,7 +12,6 @@ CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rk3229-evb"
 CONFIG_SPL_TEXT_BASE=0x60000000
 CONFIG_ROCKCHIP_RK322X=y
-CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=0x0
 CONFIG_TARGET_EVB_RK3229=y
 CONFIG_SPL_STACK_R_ADDR=0x60600000
 CONFIG_DEBUG_UART_BASE=0x11030000
index a13a809c1ef850c76a4481ccd8e5deefd6cfb892..d1e78582a3aa0fa7c769ab45c7e849a6252fc4b8 100644 (file)
@@ -11,7 +11,6 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_DEFAULT_DEVICE_TREE="rk3308-evb"
 CONFIG_DM_RESET=y
 CONFIG_ROCKCHIP_RK3308=y
-CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=0x0
 CONFIG_SPL_DRIVERS_MISC=y
 CONFIG_TARGET_EVB_RK3308=y
 CONFIG_SPL_STACK_R_ADDR=0xc00000
index c6d989ea6ef33658fa0e930c0b05bd2173624053..c226ae11a81885feed4161d96d8bb092c5b7155e 100644 (file)
@@ -17,7 +17,6 @@ CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PBSIZE=532
 CONFIG_CMD_CPU=y
index 2814e2c8147909d6dca156f3b184237efe1d453b..74733c4de3232e9abfbde4d5682a899847ac3fc2 100644 (file)
@@ -86,7 +86,6 @@ CONFIG_LED=y
 CONFIG_LED_GPIO=y
 CONFIG_MISC=y
 CONFIG_I2C_EEPROM=y
-CONFIG_SYS_I2C_EEPROM_ADDR=0x0
 CONFIG_FSL_USDHC=y
 CONFIG_MTD=y
 CONFIG_DM_MTD=y
index f63eb4fd64cda090b0d65b46aa875b2a7fe6e29c..e2bca406113fff0e25fcca375b82355ead79dfe5 100644 (file)
@@ -233,6 +233,5 @@ CONFIG_USB_GADGET_MANUFACTURER="Data Modul"
 CONFIG_USB_GADGET_VENDOR_NUM=0x0525
 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
 CONFIG_CI_UDC=y
-CONFIG_SDP_LOADADDR=0x0
 CONFIG_USB_FUNCTION_ACM=y
 CONFIG_IMX_WATCHDOG=y
index fab3ab154b57ce1732e8f9f67c6e0a1c5ba423c5..975fcc2481aaea74fc29f556002087504593cd79 100644 (file)
@@ -142,4 +142,3 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL"
 CONFIG_USB_GADGET_VENDOR_NUM=0x0525
 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
 CONFIG_CI_UDC=y
-CONFIG_SDP_LOADADDR=0x0
index f810d4be610920a7f9005ca53a33d19c9379b881..f4ecdc88f39c9c28e6492af37a435d14f2c0875a 100644 (file)
@@ -149,5 +149,4 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL"
 CONFIG_USB_GADGET_VENDOR_NUM=0x0525
 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
 CONFIG_CI_UDC=y
-CONFIG_SDP_LOADADDR=0x0
 CONFIG_IMX_WATCHDOG=y
index 8705d9bccc45c56e5b36af8b897ba0b9433ce967..f5e57fb50bca13927cd3c3ee1bc0e6511a1e7f4f 100644 (file)
@@ -149,7 +149,6 @@ CONFIG_USB_GADGET_MANUFACTURER="FSL"
 CONFIG_USB_GADGET_VENDOR_NUM=0x0525
 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
 CONFIG_CI_UDC=y
-CONFIG_SDP_LOADADDR=0x0
 CONFIG_IMX_WATCHDOG=y
 CONFIG_FSPI_CONF_HEADER=y
 CONFIG_FSPI_CONF_FILE="fspi_header.bin"
index 2570eb6a88503b2a10bb8793f947e6561360869a..c6a3e35e73a37961b675672b59f789e58bcd9953 100644 (file)
@@ -172,7 +172,6 @@ CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_MANUFACTURER="FSL"
 CONFIG_USB_GADGET_VENDOR_NUM=0x1fc9
 CONFIG_USB_GADGET_PRODUCT_NUM=0x0152
-CONFIG_SDP_LOADADDR=0x0
 CONFIG_USB_FUNCTION_ACM=y
 CONFIG_USB_ETHER=y
 CONFIG_USB_ETH_CDC=y
index 2ff577f2d8a3648564e6d7c120562449830d7d06..d3b629caf5c683f0ca876394c9c534090bcf8902 100644 (file)
@@ -257,7 +257,6 @@ CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_MANUFACTURER="Data Modul"
 CONFIG_USB_GADGET_VENDOR_NUM=0x0525
 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
-CONFIG_SDP_LOADADDR=0x0
 CONFIG_USB_FUNCTION_ACM=y
 CONFIG_USB_ETHER=y
 CONFIG_USB_ETH_CDC=y
index 14ac499e587c2b9fb33cb5b53f7cdbafe657c958..24c87aae781f1799b30aa3766a715e106e1d91be 100644 (file)
@@ -255,7 +255,6 @@ CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_MANUFACTURER="DH electronics"
 CONFIG_USB_GADGET_VENDOR_NUM=0x0525
 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
-CONFIG_SDP_LOADADDR=0x0
 CONFIG_USB_FUNCTION_ACM=y
 CONFIG_USB_ETHER=y
 CONFIG_USB_ETH_CDC=y
index 3b26f315bba1914072e284bcaedb4624446179e3..3e89e0f8293ca681d10aa5a73f3233ff0948d1f0 100644 (file)
@@ -258,7 +258,6 @@ CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_MANUFACTURER="DH electronics"
 CONFIG_USB_GADGET_VENDOR_NUM=0x0525
 CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5
-CONFIG_SDP_LOADADDR=0x0
 CONFIG_USB_FUNCTION_ACM=y
 CONFIG_USB_ETHER=y
 CONFIG_USB_ETH_CDC=y
index ad8492a17e1dabd07d24034327a7872742502656..ba5914d3b605598672c60c7ed084755cbc61290c 100644 (file)
@@ -114,6 +114,7 @@ CONFIG_FASTBOOT_FLASH=y
 CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_TI_SCI_PROTOCOL=y
+CONFIG_GPIO_HOG=y
 CONFIG_DA8XX_GPIO=y
 CONFIG_DM_PCA953X=y
 CONFIG_DM_I2C=y
@@ -146,6 +147,7 @@ CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLASH_MTD=y
 CONFIG_MULTIPLEXER=y
 CONFIG_MUX_MMIO=y
+CONFIG_PHY_TI_DP83869=y
 CONFIG_PHY_FIXED=y
 CONFIG_TI_AM65_CPSW_NUSS=y
 CONFIG_PHY=y
index 8fe2798c3ccf43032d01d5991ba65c79edd7a6dd..21a397933e7f4bee9ef86ed25ba9f4c165300bc7 100644 (file)
@@ -20,7 +20,6 @@ CONFIG_SPL_MMC=y
 CONFIG_SPL_SERIAL=y
 CONFIG_SPL_STACK=0x18009ff0
 CONFIG_SPL_SIZE_LIMIT=0x20000
-CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x0
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0x3f0000
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
@@ -130,7 +129,6 @@ CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_WDT=y
 CONFIG_WDT_SL28CPLD=y
 CONFIG_WDT_SP805=y
-CONFIG_OF_LIBFDT_ASSUME_MASK=0x0
 CONFIG_EFI_SET_TIME=y
 CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
 CONFIG_EFI_CAPSULE_FIRMWARE_FIT=y
index 7c55b3be0d2f8c83c083bb9add0f4f85d7ff2b76..9c29eb6fed3729e5091ed32cfd5da75e3ccc3af1 100644 (file)
@@ -10,7 +10,6 @@ CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rk3368-lion-haikou"
 CONFIG_SPL_TEXT_BASE=0x00000000
 CONFIG_ROCKCHIP_RK3368=y
-CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=0x0
 CONFIG_TPL_LIBCOMMON_SUPPORT=y
 CONFIG_TPL_LIBGENERIC_SUPPORT=y
 CONFIG_SPL_DRIVERS_MISC=y
index 8347a9dcecf9edcc2e74b9aaf58274352b385058..80e6a4c12b9e53881353cbc433c3970a7a93f83c 100644 (file)
@@ -30,7 +30,6 @@ CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
 CONFIG_MISC_INIT_R=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PBSIZE=532
index c6f30674a8fcd6ed61467bc63eab920100449135..165f0b512c8bb3117dd287fe0b11257eb98f844d 100644 (file)
@@ -33,7 +33,6 @@ CONFIG_LOG=y
 CONFIG_LOGF_FUNC=y
 CONFIG_SPL_LOG=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
 CONFIG_PCI_INIT_R=y
 CONFIG_BLOBLIST=y
 CONFIG_BLOBLIST_ADDR=0x10000
@@ -84,11 +83,11 @@ CONFIG_SPL_DM_RTC=y
 CONFIG_SYS_NS16550_PORT_MAPPED=y
 CONFIG_SPI=y
 CONFIG_USB_KEYBOARD=y
-CONFIG_SPL_VIDEO=y
 CONFIG_FRAMEBUFFER_SET_VESA_MODE=y
 CONFIG_FRAMEBUFFER_VESA_MODE_USER=y
 CONFIG_FRAMEBUFFER_VESA_MODE=0x144
 CONFIG_CONSOLE_SCROLL_LINES=5
+CONFIG_SPL_VIDEO=y
 # CONFIG_SPL_USE_TINY_PRINTF is not set
 CONFIG_GENERATE_ACPI_TABLE=y
 # CONFIG_GZIP is not set
index 24682a5387dfe514217bbafa692100e983d4f0f5..4b2787d4aaefe30b4a7e44650a373fe8025961ff 100644 (file)
@@ -23,7 +23,6 @@ CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_LOG=y
 CONFIG_LOGF_FUNC=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
 CONFIG_PCI_INIT_R=y
 CONFIG_SYS_PBSIZE=532
 CONFIG_CMD_CPU=y
index 94bd96678443b33f676e0e8b5baba24e27c2afb3..5fdf496a4599e526836f89f978f4bc5fa83e062f 100644 (file)
@@ -35,7 +35,6 @@ CONFIG_CMD_NVEDIT_EFI=y
 CONFIG_CMD_DFU=y
 CONFIG_CMD_MTD=y
 CONFIG_CMD_PCI=y
-CONFIG_CMD_USB=y
 CONFIG_CMD_TPM=y
 CONFIG_CMD_MTDPARTS=y
 CONFIG_ENV_IS_IN_FLASH=y
@@ -68,7 +67,7 @@ CONFIG_SYSRESET=y
 CONFIG_SYSRESET_CMD_POWEROFF=y
 CONFIG_SYSRESET_PSCI=y
 CONFIG_TPM2_MMIO=y
-CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_PCI=y
+CONFIG_SEMIHOSTING=y
 CONFIG_TPM=y
index 7cb1e9f037ff7da939f0ea70ec4042308aac82a1..1347b86f34b1dca8e7ecb0dd9b81c34721371179 100644 (file)
@@ -36,7 +36,6 @@ CONFIG_CMD_NVEDIT_EFI=y
 CONFIG_CMD_DFU=y
 CONFIG_CMD_MTD=y
 CONFIG_CMD_PCI=y
-CONFIG_CMD_USB=y
 CONFIG_CMD_TPM=y
 CONFIG_CMD_MTDPARTS=y
 CONFIG_ENV_IS_IN_FLASH=y
@@ -69,7 +68,6 @@ CONFIG_SYSRESET=y
 CONFIG_SYSRESET_CMD_POWEROFF=y
 CONFIG_SYSRESET_PSCI=y
 CONFIG_TPM2_MMIO=y
-CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_PCI=y
 CONFIG_TPM=y
index 9a789b212f10f3e3d1c446f8476f6f82e4e1c38b..3f3c223fa1d2918fcb8544dac4016ad635d8170b 100644 (file)
@@ -11,7 +11,6 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_DEFAULT_DEVICE_TREE="rk3308-roc-cc"
 CONFIG_DM_RESET=y
 CONFIG_ROCKCHIP_RK3308=y
-CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=0x0
 CONFIG_SPL_DRIVERS_MISC=y
 CONFIG_TARGET_ROC_RK3308_CC=y
 CONFIG_SPL_STACK_R_ADDR=0xc00000
index cc3274a98b3f6068028e2726665944bb3b208d66..8c13f7f9c3be0b0599f29e98232f9d8556dce2a0 100644 (file)
@@ -11,7 +11,6 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x800000
 CONFIG_DEFAULT_DEVICE_TREE="rk3308-rock-pi-s"
 CONFIG_DM_RESET=y
 CONFIG_ROCKCHIP_RK3308=y
-CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=0x0
 CONFIG_SPL_DRIVERS_MISC=y
 CONFIG_TARGET_EVB_RK3308=y
 CONFIG_SPL_STACK_R_ADDR=0xc00000
index 21b2cc2edda1222e7155669bf73727967963edeb..bb5e7d8ed089cd9171811c2289dabd3abdebb2d7 100644 (file)
@@ -14,6 +14,7 @@ CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="at91-sam9x60_curiosity"
 CONFIG_SYS_PROMPT="U-Boot> "
 CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_DM_RESET=y
 CONFIG_DEBUG_UART_BASE=0xfffff200
 CONFIG_DEBUG_UART_CLOCK=200000000
 CONFIG_DEBUG_UART_BOARD_INIT=y
@@ -79,6 +80,7 @@ CONFIG_PHY_MICREL=y
 CONFIG_MACB=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_AT91=y
+CONFIG_RESET_AT91=y
 CONFIG_DM_SERIAL=y
 CONFIG_DEBUG_UART_ANNOUNCE=y
 CONFIG_ATMEL_USART=y
index 10937d67d73e1aaa52d8a7852567c68415c89ac0..a0f819c0028517a5571148c6d540851c4591a79d 100644 (file)
@@ -14,6 +14,7 @@ CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="at91-sam9x60_curiosity"
 CONFIG_SYS_PROMPT="U-Boot> "
 CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_DM_RESET=y
 CONFIG_DEBUG_UART_BASE=0xfffff200
 CONFIG_DEBUG_UART_CLOCK=200000000
 CONFIG_DEBUG_UART_BOARD_INIT=y
@@ -23,7 +24,7 @@ CONFIG_FIT=y
 CONFIG_SD_BOOT=y
 CONFIG_BOOTDELAY=3
 CONFIG_USE_BOOTARGS=y
-CONFIG_BOOTARGS="mem=128M console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait"
+CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait"
 CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="fatload mmc 0:1 0x21000000 at91-sam9x60_curiosity.dtb; fatload mmc 0:1 0x22000000 zImage; bootz 0x22000000 - 0x21000000"
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
@@ -38,6 +39,8 @@ CONFIG_CMD_DM=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
+CONFIG_CMD_NAND=y
+CONFIG_CMD_NAND_TRIMFFS=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_DHCP=y
 CONFIG_BOOTP_BOOTFILESIZE=y
@@ -50,6 +53,8 @@ CONFIG_OF_CONTROL=y
 CONFIG_ENV_IS_IN_FAT=y
 CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
 CONFIG_CLK=y
 CONFIG_CLK_CCF=y
 CONFIG_CLK_AT91=y
@@ -60,17 +65,27 @@ CONFIG_CPU=y
 CONFIG_AT91_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_AT91=y
+CONFIG_ATMEL_EBI=y
+CONFIG_MFD_ATMEL_SMC=y
 CONFIG_I2C_EEPROM=y
 CONFIG_MICROCHIP_FLEXCOM=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_ATMEL=y
+CONFIG_MTD=y
+CONFIG_DM_MTD=y
+CONFIG_MTD_RAW_NAND=y
+CONFIG_DM_NAND_ATMEL=y
+CONFIG_SYS_NAND_ONFI_DETECTION=y
 CONFIG_PHY_MICREL=y
 CONFIG_MACB=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_AT91=y
+CONFIG_RESET_AT91=y
 CONFIG_DM_SERIAL=y
 CONFIG_DEBUG_UART_ANNOUNCE=y
 CONFIG_ATMEL_USART=y
+CONFIG_SYSRESET=y
+CONFIG_SYSRESET_AT91=y
 CONFIG_TIMER=y
 CONFIG_MCHP_PIT64B_TIMER=y
 CONFIG_W1=y
index 2a1399748c855667369cc473b004ab3067c21261..c70c41c278ffab1b24f4ea9a58f521dcb5db3cbf 100644 (file)
@@ -15,6 +15,7 @@ CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="sam9x60ek"
 CONFIG_SYS_PROMPT="U-Boot> "
 CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_DM_RESET=y
 CONFIG_DEBUG_UART_BASE=0xfffff200
 CONFIG_DEBUG_UART_CLOCK=200000000
 CONFIG_DEBUG_UART_BOARD_INIT=y
@@ -87,6 +88,7 @@ CONFIG_PHY_MICREL=y
 CONFIG_MACB=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_AT91=y
+CONFIG_RESET_AT91=y
 CONFIG_DM_SERIAL=y
 CONFIG_DEBUG_UART_ANNOUNCE=y
 CONFIG_ATMEL_USART=y
index c6c468665885815593b6a59fb6fc1c97dce766fc..569b4e747cc7d60e0f5f3fd7532dae34fe38e634 100644 (file)
@@ -14,6 +14,7 @@ CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="sam9x60ek"
 CONFIG_SYS_PROMPT="U-Boot> "
 CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_DM_RESET=y
 CONFIG_DEBUG_UART_BASE=0xfffff200
 CONFIG_DEBUG_UART_CLOCK=200000000
 CONFIG_DEBUG_UART_BOARD_INIT=y
@@ -89,6 +90,7 @@ CONFIG_PHY_MICREL=y
 CONFIG_MACB=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_AT91=y
+CONFIG_RESET_AT91=y
 CONFIG_DM_SERIAL=y
 CONFIG_DEBUG_UART_ANNOUNCE=y
 CONFIG_ATMEL_USART=y
index ef2e2db8b8a44e0012951a72f7e004a8e91473fc..135cd787f9b390b0422fa54fd9694c4677a5b064 100644 (file)
@@ -14,6 +14,7 @@ CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="sam9x60ek"
 CONFIG_SYS_PROMPT="U-Boot> "
 CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_DM_RESET=y
 CONFIG_DEBUG_UART_BASE=0xfffff200
 CONFIG_DEBUG_UART_CLOCK=200000000
 CONFIG_DEBUG_UART_BOARD_INIT=y
@@ -88,6 +89,7 @@ CONFIG_PHY_MICREL=y
 CONFIG_MACB=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_AT91=y
+CONFIG_RESET_AT91=y
 CONFIG_DM_SERIAL=y
 CONFIG_DEBUG_UART_ANNOUNCE=y
 CONFIG_ATMEL_USART=y
diff --git a/configs/sama5d29_curiosity_mmc1_defconfig b/configs/sama5d29_curiosity_mmc1_defconfig
new file mode 100644 (file)
index 0000000..c4ea11e
--- /dev/null
@@ -0,0 +1,120 @@
+CONFIG_ARM=y
+CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_ARCH_CPU_INIT=y
+CONFIG_ARCH_AT91=y
+CONFIG_TEXT_BASE=0x26f00000
+CONFIG_SYS_MALLOC_LEN=0x1000000
+CONFIG_SYS_MALLOC_F_LEN=0x40000
+CONFIG_TARGET_SAMA5D29_CURIOSITY=y
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20044000
+CONFIG_SF_DEFAULT_SPEED=50000000
+CONFIG_ENV_SIZE=0x4000
+CONFIG_DM_GPIO=y
+CONFIG_DEFAULT_DEVICE_TREE="at91-sama5d29_curiosity"
+CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_DM_RESET=y
+CONFIG_DEBUG_UART_BASE=0xf801c000
+CONFIG_DEBUG_UART_CLOCK=82000000
+CONFIG_DEBUG_UART_BOARD_INIT=y
+CONFIG_SYS_LOAD_ADDR=0x22000000
+CONFIG_DEBUG_UART=y
+CONFIG_SYS_MEMTEST_START=0x20000000
+CONFIG_SYS_MEMTEST_END=0x30000000
+CONFIG_ENV_VARS_UBOOT_CONFIG=y
+CONFIG_FIT=y
+# CONFIG_BOOTSTD is not set
+CONFIG_QSPI_BOOT=y
+CONFIG_SD_BOOT=y
+CONFIG_BOOTDELAY=3
+CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/mmcblk1p2 rw rootwait"
+CONFIG_USE_BOOTCOMMAND=y
+CONFIG_BOOTCOMMAND="fatload mmc 1:1 0x21000000 at91-sama5d29_curiosity.dtb; fatload mmc 1:1 0x22000000 zImage; bootz 0x22000000 - 0x21000000"
+CONFIG_BOARD_TYPES=y
+CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_HUSH_PARSER=y
+CONFIG_CMD_BOOTZ=y
+CONFIG_SYS_BOOTM_LEN=0x2000000
+CONFIG_CMD_XXD=y
+CONFIG_CMD_MEMINFO=y
+CONFIG_CMD_MEM_SEARCH=y
+CONFIG_CMD_MX_CYCLIC=y
+CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_STRINGS=y
+CONFIG_CMD_DM=y
+# CONFIG_CMD_FLASH is not set
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_LSBLK=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_MTD=y
+CONFIG_CMD_SF_TEST=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_CAT=y
+CONFIG_CMD_RTC=y
+CONFIG_CMD_TIME=y
+CONFIG_CMD_TIMER=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_CMD_MTDPARTS=y
+CONFIG_CMD_MTDPARTS_SPREAD=y
+CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES=y
+CONFIG_MTDIDS_DEFAULT="nor0=nor0"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=nor0:256k(bootstrap)ro,1M(u-boot)ro,256k(env)ro,512k(dtb)ro,6M(kernel)ro"
+CONFIG_OF_CONTROL=y
+# CONFIG_OF_TAG_MIGRATE is not set
+CONFIG_ENV_IS_IN_FAT=y
+CONFIG_ENV_FAT_DEVICE_AND_PART="1:1"
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_USE_HOSTNAME=y
+CONFIG_HOSTNAME="SAMA5D29"
+CONFIG_VERSION_VARIABLE=y
+# CONFIG_NET is not set
+CONFIG_CLK=y
+CONFIG_CLK_AT91=y
+CONFIG_AT91_UTMI=y
+CONFIG_AT91_H32MX=y
+CONFIG_AT91_GENERIC_CLK=y
+CONFIG_ATMEL_PIO4=y
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_ATMEL=y
+CONFIG_MTD=y
+CONFIG_DM_MTD=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SF_DEFAULT_BUS=2
+CONFIG_SPI_FLASH_SFDP_SUPPORT=y
+CONFIG_SPI_FLASH_SST=y
+# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
+CONFIG_SPI_FLASH_MTD=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_AT91PIO4=y
+CONFIG_RESET_AT91=y
+CONFIG_DM_RTC=y
+CONFIG_RTC_EMULATION=y
+CONFIG_DM_SERIAL=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_ATMEL_USART=y
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_ATMEL_QSPI=y
+CONFIG_SYSRESET=y
+CONFIG_SYSRESET_AT91=y
+CONFIG_TIMER=y
+CONFIG_ATMEL_TCB_TIMER=y
+CONFIG_USB=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_STORAGE=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_ATMEL_USBA=y
+CONFIG_VIDEO=y
+CONFIG_ATMEL_HLCD=y
+CONFIG_W1=y
+CONFIG_W1_GPIO=y
+CONFIG_W1_EEPROM=y
+CONFIG_W1_EEPROM_DS24XXX=y
+CONFIG_FAT_WRITE=y
+CONFIG_CMD_DHRYSTONE=y
+# CONFIG_EFI_LOADER is not set
diff --git a/configs/sama5d29_curiosity_mmc_defconfig b/configs/sama5d29_curiosity_mmc_defconfig
new file mode 100644 (file)
index 0000000..23c9ef7
--- /dev/null
@@ -0,0 +1,119 @@
+CONFIG_ARM=y
+CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_ARCH_CPU_INIT=y
+CONFIG_ARCH_AT91=y
+CONFIG_TEXT_BASE=0x26f00000
+CONFIG_SYS_MALLOC_LEN=0x1000000
+CONFIG_SYS_MALLOC_F_LEN=0x40000
+CONFIG_TARGET_SAMA5D29_CURIOSITY=y
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20044000
+CONFIG_SF_DEFAULT_SPEED=50000000
+CONFIG_ENV_SIZE=0x4000
+CONFIG_DM_GPIO=y
+CONFIG_DEFAULT_DEVICE_TREE="at91-sama5d29_curiosity"
+CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_DM_RESET=y
+CONFIG_DEBUG_UART_BASE=0xf801c000
+CONFIG_DEBUG_UART_CLOCK=82000000
+CONFIG_DEBUG_UART_BOARD_INIT=y
+CONFIG_SYS_LOAD_ADDR=0x22000000
+CONFIG_DEBUG_UART=y
+CONFIG_SYS_MEMTEST_START=0x20000000
+CONFIG_SYS_MEMTEST_END=0x30000000
+CONFIG_ENV_VARS_UBOOT_CONFIG=y
+CONFIG_FIT=y
+# CONFIG_BOOTSTD is not set
+CONFIG_QSPI_BOOT=y
+CONFIG_SD_BOOT=y
+CONFIG_BOOTDELAY=3
+CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait"
+CONFIG_USE_BOOTCOMMAND=y
+CONFIG_BOOTCOMMAND="fatload mmc 0:1 0x21000000 at91-sama5d29_curiosity.dtb; fatload mmc 0:1 0x22000000 zImage; bootz 0x22000000 - 0x21000000"
+CONFIG_BOARD_TYPES=y
+CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_HUSH_PARSER=y
+CONFIG_CMD_BOOTZ=y
+CONFIG_SYS_BOOTM_LEN=0x2000000
+CONFIG_CMD_XXD=y
+CONFIG_CMD_MEMINFO=y
+CONFIG_CMD_MEM_SEARCH=y
+CONFIG_CMD_MX_CYCLIC=y
+CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_STRINGS=y
+CONFIG_CMD_DM=y
+# CONFIG_CMD_FLASH is not set
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_LSBLK=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_MTD=y
+CONFIG_CMD_SF_TEST=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_CAT=y
+CONFIG_CMD_RTC=y
+CONFIG_CMD_TIME=y
+CONFIG_CMD_TIMER=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_CMD_MTDPARTS=y
+CONFIG_CMD_MTDPARTS_SPREAD=y
+CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES=y
+CONFIG_MTDIDS_DEFAULT="nor0=nor0"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=nor0:256k(bootstrap)ro,1M(u-boot)ro,256k(env)ro,512k(dtb)ro,6M(kernel)ro"
+CONFIG_OF_CONTROL=y
+# CONFIG_OF_TAG_MIGRATE is not set
+CONFIG_ENV_IS_IN_FAT=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_USE_HOSTNAME=y
+CONFIG_HOSTNAME="SAMA5D29"
+CONFIG_VERSION_VARIABLE=y
+# CONFIG_NET is not set
+CONFIG_CLK=y
+CONFIG_CLK_AT91=y
+CONFIG_AT91_UTMI=y
+CONFIG_AT91_H32MX=y
+CONFIG_AT91_GENERIC_CLK=y
+CONFIG_ATMEL_PIO4=y
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_ATMEL=y
+CONFIG_MTD=y
+CONFIG_DM_MTD=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SF_DEFAULT_BUS=2
+CONFIG_SPI_FLASH_SFDP_SUPPORT=y
+CONFIG_SPI_FLASH_SST=y
+# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
+CONFIG_SPI_FLASH_MTD=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_AT91PIO4=y
+CONFIG_RESET_AT91=y
+CONFIG_DM_RTC=y
+CONFIG_RTC_EMULATION=y
+CONFIG_DM_SERIAL=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_ATMEL_USART=y
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_ATMEL_QSPI=y
+CONFIG_SYSRESET=y
+CONFIG_SYSRESET_AT91=y
+CONFIG_TIMER=y
+CONFIG_ATMEL_TCB_TIMER=y
+CONFIG_USB=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_STORAGE=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_ATMEL_USBA=y
+CONFIG_VIDEO=y
+CONFIG_ATMEL_HLCD=y
+CONFIG_W1=y
+CONFIG_W1_GPIO=y
+CONFIG_W1_EEPROM=y
+CONFIG_W1_EEPROM_DS24XXX=y
+CONFIG_FAT_WRITE=y
+CONFIG_CMD_DHRYSTONE=y
+# CONFIG_EFI_LOADER is not set
diff --git a/configs/sama5d29_curiosity_qspiflash_defconfig b/configs/sama5d29_curiosity_qspiflash_defconfig
new file mode 100644 (file)
index 0000000..7b8baf1
--- /dev/null
@@ -0,0 +1,119 @@
+CONFIG_ARM=y
+CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_ARCH_CPU_INIT=y
+CONFIG_ARCH_AT91=y
+CONFIG_TEXT_BASE=0x26f00000
+CONFIG_SYS_MALLOC_LEN=0x1000000
+CONFIG_SYS_MALLOC_F_LEN=0x40000
+CONFIG_TARGET_SAMA5D29_CURIOSITY=y
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20044000
+CONFIG_SF_DEFAULT_SPEED=50000000
+CONFIG_ENV_SIZE=0x4000
+CONFIG_DM_GPIO=y
+CONFIG_DEFAULT_DEVICE_TREE="at91-sama5d29_curiosity"
+CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_DM_RESET=y
+CONFIG_DEBUG_UART_BASE=0xf801c000
+CONFIG_DEBUG_UART_CLOCK=82000000
+CONFIG_DEBUG_UART_BOARD_INIT=y
+CONFIG_SYS_LOAD_ADDR=0x22000000
+CONFIG_DEBUG_UART=y
+CONFIG_SYS_MEMTEST_START=0x20000000
+CONFIG_SYS_MEMTEST_END=0x30000000
+CONFIG_ENV_VARS_UBOOT_CONFIG=y
+CONFIG_FIT=y
+# CONFIG_BOOTSTD is not set
+CONFIG_QSPI_BOOT=y
+CONFIG_SD_BOOT=y
+CONFIG_BOOTDELAY=3
+CONFIG_USE_BOOTARGS=y
+CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait"
+CONFIG_USE_BOOTCOMMAND=y
+CONFIG_BOOTCOMMAND="sf probe 0; sf read 0x21000000 0x180000 0x80000; sf read 0x22000000 0x200000 0x600000; bootz 0x22000000 - 0x21000000"
+CONFIG_BOARD_TYPES=y
+CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_HUSH_PARSER=y
+CONFIG_CMD_BOOTZ=y
+CONFIG_SYS_BOOTM_LEN=0x2000000
+CONFIG_CMD_XXD=y
+CONFIG_CMD_MEMINFO=y
+CONFIG_CMD_MEM_SEARCH=y
+CONFIG_CMD_MX_CYCLIC=y
+CONFIG_CMD_MEMTEST=y
+CONFIG_CMD_STRINGS=y
+CONFIG_CMD_DM=y
+# CONFIG_CMD_FLASH is not set
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_LSBLK=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_MTD=y
+CONFIG_CMD_SF_TEST=y
+CONFIG_CMD_USB=y
+CONFIG_CMD_CAT=y
+CONFIG_CMD_RTC=y
+CONFIG_CMD_TIME=y
+CONFIG_CMD_TIMER=y
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_EXT4_WRITE=y
+CONFIG_CMD_FAT=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_CMD_MTDPARTS=y
+CONFIG_CMD_MTDPARTS_SPREAD=y
+CONFIG_CMD_MTDPARTS_SHOW_NET_SIZES=y
+CONFIG_MTDIDS_DEFAULT="nor0=nor0"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=nor0:256k(bootstrap)ro,1M(u-boot)ro,256k(env)ro,512k(dtb)ro,6M(kernel)ro"
+CONFIG_OF_CONTROL=y
+# CONFIG_OF_TAG_MIGRATE is not set
+CONFIG_ENV_IS_IN_SPI_FLASH=y
+CONFIG_SYS_RELOC_GD_ENV_ADDR=y
+CONFIG_USE_HOSTNAME=y
+CONFIG_HOSTNAME="SAMA5D29"
+CONFIG_VERSION_VARIABLE=y
+# CONFIG_NET is not set
+CONFIG_CLK=y
+CONFIG_CLK_AT91=y
+CONFIG_AT91_UTMI=y
+CONFIG_AT91_H32MX=y
+CONFIG_AT91_GENERIC_CLK=y
+CONFIG_ATMEL_PIO4=y
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_ATMEL=y
+CONFIG_MTD=y
+CONFIG_DM_MTD=y
+CONFIG_DM_SPI_FLASH=y
+CONFIG_SF_DEFAULT_BUS=2
+CONFIG_SPI_FLASH_SFDP_SUPPORT=y
+CONFIG_SPI_FLASH_SST=y
+# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
+CONFIG_SPI_FLASH_MTD=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_AT91PIO4=y
+CONFIG_RESET_AT91=y
+CONFIG_DM_RTC=y
+CONFIG_RTC_EMULATION=y
+CONFIG_DM_SERIAL=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_ATMEL_USART=y
+CONFIG_SPI=y
+CONFIG_DM_SPI=y
+CONFIG_ATMEL_QSPI=y
+CONFIG_SYSRESET=y
+CONFIG_SYSRESET_AT91=y
+CONFIG_TIMER=y
+CONFIG_ATMEL_TCB_TIMER=y
+CONFIG_USB=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_STORAGE=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_ATMEL_USBA=y
+CONFIG_VIDEO=y
+CONFIG_ATMEL_HLCD=y
+CONFIG_W1=y
+CONFIG_W1_GPIO=y
+CONFIG_W1_EEPROM=y
+CONFIG_W1_EEPROM_DS24XXX=y
+CONFIG_FAT_WRITE=y
+CONFIG_CMD_DHRYSTONE=y
+# CONFIG_EFI_LOADER is not set
index 14c9d1b04cbb9a0324edf27eb80d75d5b5e20af3..55a01b7eb9dea4ff47b364d556bb06551f88bd4d 100644 (file)
@@ -4,7 +4,6 @@ CONFIG_ENV_SIZE=0x2000
 CONFIG_DEFAULT_DEVICE_TREE="sandbox64"
 CONFIG_DM_RESET=y
 CONFIG_PRE_CON_BUF_ADDR=0x100000
-CONFIG_BOOTSTAGE_STASH_ADDR=0x0
 CONFIG_SYS_LOAD_ADDR=0x0
 CONFIG_PCI=y
 CONFIG_SANDBOX64=y
index 1cd1c2ed7cd55b4ae2d050101d222ef2470d1867..98f0bc13a5f6e66ff3a661f56210b497f8d1b0d6 100644 (file)
@@ -4,7 +4,6 @@ CONFIG_ENV_SIZE=0x2000
 CONFIG_DEFAULT_DEVICE_TREE="sandbox"
 CONFIG_DM_RESET=y
 CONFIG_PRE_CON_BUF_ADDR=0xf0000
-CONFIG_BOOTSTAGE_STASH_ADDR=0x0
 CONFIG_SYS_LOAD_ADDR=0x0
 CONFIG_PCI=y
 CONFIG_DEBUG_UART=y
@@ -227,11 +226,13 @@ CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
 CONFIG_SPI_FLASH_SST=y
 CONFIG_SPI_FLASH_WINBOND=y
+CONFIG_NVMXIP_QSPI=y
 CONFIG_MULTIPLEXER=y
 CONFIG_MUX_MMIO=y
 CONFIG_NVME_PCI=y
 CONFIG_PCI_REGION_MULTI_ENTRY=y
 CONFIG_PCI_SANDBOX=y
+CONFIG_PCI_FTPCI100=y
 CONFIG_PHY=y
 CONFIG_PHY_SANDBOX=y
 CONFIG_PINCTRL=y
@@ -340,6 +341,7 @@ CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
 CONFIG_EFI_CAPSULE_ON_DISK=y
 CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
 CONFIG_EFI_CAPSULE_AUTHENTICATE=y
+CONFIG_EFI_CAPSULE_ESL_FILE="board/sandbox/capsule_pub_esl_good.esl"
 CONFIG_EFI_SECURE_BOOT=y
 CONFIG_TEST_FDTDEC=y
 CONFIG_UNIT_TEST=y
index 8aa295686dcf73ae4aadb12577a9be2ae3f126e0..db916e6c4e9c8236f4f6a62f7d1c2898cdebbb38 100644 (file)
@@ -3,7 +3,6 @@ CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x2000
 CONFIG_DEFAULT_DEVICE_TREE="sandbox"
 CONFIG_DM_RESET=y
-CONFIG_BOOTSTAGE_STASH_ADDR=0x0
 CONFIG_SYS_LOAD_ADDR=0x0
 CONFIG_PCI=y
 CONFIG_DEBUG_UART=y
@@ -227,6 +226,7 @@ CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
 CONFIG_EFI_CAPSULE_ON_DISK=y
 CONFIG_EFI_CAPSULE_FIRMWARE_FIT=y
 CONFIG_EFI_CAPSULE_AUTHENTICATE=y
+CONFIG_EFI_CAPSULE_ESL_FILE="board/sandbox/capsule_pub_esl_good.esl"
 CONFIG_UNIT_TEST=y
 CONFIG_UT_TIME=y
 CONFIG_UT_DM=y
index 2c6aab6c859e230f0a8a34b15fcf992f16d75f31..ee04fbbc2e96297e3ccc326d2f09e90fa383061d 100644 (file)
@@ -10,7 +10,6 @@ CONFIG_SPL_SERIAL=y
 CONFIG_SPL_DRIVERS_MISC=y
 CONFIG_SPL_SYS_MALLOC_F_LEN=0x8000
 CONFIG_SPL=y
-CONFIG_BOOTSTAGE_STASH_ADDR=0x0
 CONFIG_SYS_LOAD_ADDR=0x0
 CONFIG_PCI=y
 CONFIG_SANDBOX_SPL=y
@@ -237,6 +236,8 @@ CONFIG_TPM=y
 CONFIG_LZ4=y
 CONFIG_ZSTD=y
 CONFIG_ERRNO_STR=y
+CONFIG_EFI_CAPSULE_ON_DISK=y
+CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
 CONFIG_UNIT_TEST=y
 CONFIG_SPL_UNIT_TEST=y
 CONFIG_UT_TIME=y
index 8d50162b274ab07f13c3717db0b0d98f4e0857e9..69b413382a18b1a2a533bcab0d76439f392c99e1 100644 (file)
@@ -10,7 +10,6 @@ CONFIG_SPL_SERIAL=y
 CONFIG_SPL_DRIVERS_MISC=y
 CONFIG_SPL_SYS_MALLOC_F_LEN=0x8000
 CONFIG_SPL=y
-CONFIG_BOOTSTAGE_STASH_ADDR=0x0
 CONFIG_SYS_LOAD_ADDR=0x0
 CONFIG_PCI=y
 CONFIG_SANDBOX_SPL=y
@@ -245,6 +244,8 @@ CONFIG_LZ4=y
 CONFIG_ZSTD=y
 CONFIG_ERRNO_STR=y
 CONFIG_SPL_HEXDUMP=y
+CONFIG_EFI_CAPSULE_ON_DISK=y
+CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
 CONFIG_UNIT_TEST=y
 CONFIG_SPL_UNIT_TEST=y
 CONFIG_UT_TIME=y
index f3a0fd19a9668f613417d72d1c30d7a71a38e352..27354b8b5edeb55089b4b9f3369d52e43bd1c02e 100644 (file)
@@ -15,7 +15,6 @@ CONFIG_TPL_SERIAL=y
 CONFIG_SPL_DRIVERS_MISC=y
 CONFIG_SPL_SYS_MALLOC_F_LEN=0x8000
 CONFIG_SPL=y
-CONFIG_BOOTSTAGE_STASH_ADDR=0x0
 CONFIG_SYS_LOAD_ADDR=0x0
 CONFIG_PCI=y
 CONFIG_SANDBOX_SPL=y
@@ -256,6 +255,8 @@ CONFIG_LZ4=y
 CONFIG_ZSTD=y
 # CONFIG_VPL_LZMA is not set
 CONFIG_ERRNO_STR=y
+CONFIG_EFI_CAPSULE_ON_DISK=y
+CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
 CONFIG_UNIT_TEST=y
 CONFIG_SPL_UNIT_TEST=y
 CONFIG_UT_TIME=y
index bb066a645991d3e937180ff8df3a8a74729f195c..22ec8e5141f6f48d63d3b79b2f8ba3301c23f1bd 100644 (file)
@@ -29,6 +29,7 @@ CONFIG_DEBUG_UART=y
 CONFIG_FIT=y
 CONFIG_FIT_BEST_MATCH=y
 CONFIG_BOOTSTD_FULL=y
+CONFIG_BOOTMETH_CROS=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_SILENT_CONSOLE=y
 CONFIG_BLOBLIST=y
index 4a149133db604d3bbbc8ba04f2b2cfd9d9a3c5aa..44db48204bd8a24eea4bb02be2ee9b6083dfbaf6 100644 (file)
@@ -27,7 +27,6 @@ CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="ext2load scsi 0:3 01000000 /boot/vmlinuz; zboot 01000000"
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PBSIZE=532
 CONFIG_CMD_CPU=y
index 69499e17f4c9446c4f0398e2d225447376725f57..c5bd0d9673660459c942247cd0b5169e5ad7f286 100644 (file)
@@ -26,7 +26,6 @@ CONFIG_SHOW_BOOT_PROGRESS=y
 CONFIG_USE_PREBOOT=y
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PBSIZE=532
 CONFIG_CMD_CPU=y
index e2e64b743494d5ba4b9509d499f155fa5109e890..b3afaf34a02f3a2eb06a9c80df4805be466b5ef8 100644 (file)
@@ -25,7 +25,6 @@ CONFIG_SHOW_BOOT_PROGRESS=y
 CONFIG_USE_PREBOOT=y
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PBSIZE=532
 CONFIG_CMD_CPU=y
index 751ae3497ec6ffee19b5dee09677c5307dc9c3cd..8222697f74713c15014b5d37cd1fdcc27ebfcced 100644 (file)
@@ -24,7 +24,6 @@ CONFIG_SHOW_BOOT_PROGRESS=y
 CONFIG_USE_PREBOOT=y
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_LAST_STAGE_INIT=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PBSIZE=532
 CONFIG_CMD_CPU=y
index 97904bdec0ab570f79a5d942f7e802ca5e44eeb8..54ba0b7c4f2585b911d69d2dd187ab5af2541e55 100644 (file)
@@ -77,7 +77,6 @@ CONFIG_DM_MAILBOX=y
 CONFIG_ZYNQMP_IPI=y
 CONFIG_MISC=y
 CONFIG_I2C_EEPROM=y
-CONFIG_SYS_I2C_EEPROM_ADDR=0x0
 CONFIG_SUPPORT_EMMC_BOOT=y
 CONFIG_MMC_IO_VOLTAGE=y
 CONFIG_MMC_UHS_SUPPORT=y
index acab38fefee337cf7a5d250c989bac028c1b8b34..26260841c5901c946cf0dda71094a9316078cbea 100644 (file)
@@ -11,7 +11,6 @@ CONFIG_DM_RESET=y
 CONFIG_SPL_STACK_R_ADDR=0x18000000
 CONFIG_SPL_STACK=0xfffffffc
 CONFIG_SPL_SIZE_LIMIT=0x2a000
-CONFIG_SPL_SIZE_LIMIT_PROVIDE_STACK=0x0
 CONFIG_SPL=y
 CONFIG_ENV_OFFSET_REDUND=0x1E80000
 CONFIG_SPL_SPI_FLASH_SUPPORT=y
index d32747e2242d5e0d38ddce3dac5ac312504f4eaa..efe4bf1f9490ba8e972569a7ac8aa61b25c21de5 100644 (file)
 #include <dm/device-internal.h>
 #include <dm/lists.h>
 
-int part_create_block_devices(struct udevice *blk_dev)
-{
-       int part, count;
-       struct blk_desc *desc = dev_get_uclass_plat(blk_dev);
-       struct disk_partition info;
-       struct disk_part *part_data;
-       char devname[32];
-       struct udevice *dev;
-       int ret;
-
-       if (!CONFIG_IS_ENABLED(PARTITIONS) || !blk_enabled())
-               return 0;
-
-       if (device_get_uclass_id(blk_dev) != UCLASS_BLK)
-               return 0;
-
-       /* Add devices for each partition */
-       for (count = 0, part = 1; part <= MAX_SEARCH_PARTITIONS; part++) {
-               if (part_get_info(desc, part, &info))
-                       continue;
-               snprintf(devname, sizeof(devname), "%s:%d", blk_dev->name,
-                        part);
-
-               ret = device_bind_driver(blk_dev, "blk_partition",
-                                        strdup(devname), &dev);
-               if (ret)
-                       return ret;
-
-               part_data = dev_get_uclass_plat(dev);
-               part_data->partnum = part;
-               part_data->gpt_part_info = info;
-               count++;
-
-               ret = device_probe(dev);
-               if (ret) {
-                       debug("Can't probe\n");
-                       count--;
-                       device_unbind(dev);
-
-                       continue;
-               }
-       }
-       debug("%s: %d partitions found in %s\n", __func__, count,
-             blk_dev->name);
-
-       return 0;
-}
-
-static ulong part_blk_read(struct udevice *dev, lbaint_t start,
-                          lbaint_t blkcnt, void *buffer)
-{
-       struct udevice *parent;
-       struct disk_part *part;
-       const struct blk_ops *ops;
-
-       parent = dev_get_parent(dev);
-       ops = blk_get_ops(parent);
-       if (!ops->read)
-               return -ENOSYS;
-
-       part = dev_get_uclass_plat(dev);
-       if (start >= part->gpt_part_info.size)
-               return 0;
-
-       if ((start + blkcnt) > part->gpt_part_info.size)
-               blkcnt = part->gpt_part_info.size - start;
-       start += part->gpt_part_info.start;
-
-       return ops->read(parent, start, blkcnt, buffer);
-}
-
-static ulong part_blk_write(struct udevice *dev, lbaint_t start,
-                           lbaint_t blkcnt, const void *buffer)
+/**
+ * disk_blk_part_validate() - Check whether access to partition is within limits
+ *
+ * @dev: Device (partition udevice)
+ * @start: Start block for the access(from start of partition)
+ * @blkcnt: Number of blocks to access (within the partition)
+ * @return 0 on valid block range, or -ve on error.
+ */
+static int disk_blk_part_validate(struct udevice *dev, lbaint_t start, lbaint_t blkcnt)
 {
-       struct udevice *parent;
-       struct disk_part *part;
-       const struct blk_ops *ops;
+       struct disk_part *part = dev_get_uclass_plat(dev);
 
-       parent = dev_get_parent(dev);
-       ops = blk_get_ops(parent);
-       if (!ops->write)
+       if (device_get_uclass_id(dev) != UCLASS_PARTITION)
                return -ENOSYS;
 
-       part = dev_get_uclass_plat(dev);
        if (start >= part->gpt_part_info.size)
-               return 0;
+               return -E2BIG;
 
        if ((start + blkcnt) > part->gpt_part_info.size)
-               blkcnt = part->gpt_part_info.size - start;
-       start += part->gpt_part_info.start;
+               return -ERANGE;
 
-       return ops->write(parent, start, blkcnt, buffer);
+       return 0;
 }
 
-static ulong part_blk_erase(struct udevice *dev, lbaint_t start,
-                           lbaint_t blkcnt)
+/**
+ * disk_blk_part_offset() - Compute offset from start of block device
+ *
+ * @dev: Device (partition udevice)
+ * @start: Start block for the access (from start of partition)
+ * @return Start block for the access (from start of block device)
+ */
+static lbaint_t disk_blk_part_offset(struct udevice *dev, lbaint_t start)
 {
-       struct udevice *parent;
-       struct disk_part *part;
-       const struct blk_ops *ops;
-
-       parent = dev_get_parent(dev);
-       ops = blk_get_ops(parent);
-       if (!ops->erase)
-               return -ENOSYS;
-
-       part = dev_get_uclass_plat(dev);
-       if (start >= part->gpt_part_info.size)
-               return 0;
+       struct disk_part *part = dev_get_uclass_plat(dev);
 
-       if ((start + blkcnt) > part->gpt_part_info.size)
-               blkcnt = part->gpt_part_info.size - start;
-       start += part->gpt_part_info.start;
-
-       return ops->erase(parent, start, blkcnt);
+       return start + part->gpt_part_info.start;
 }
 
-static const struct blk_ops blk_part_ops = {
-       .read   = part_blk_read,
-       .write  = part_blk_write,
-       .erase  = part_blk_erase,
-};
-
-U_BOOT_DRIVER(blk_partition) = {
-       .name           = "blk_partition",
-       .id             = UCLASS_PARTITION,
-       .ops            = &blk_part_ops,
-};
-
 /*
  * BLOCK IO APIs
  */
-static struct blk_desc *dev_get_blk(struct udevice *dev)
-{
-       struct blk_desc *desc;
-
-       switch (device_get_uclass_id(dev)) {
-       /*
-        * We won't support UCLASS_BLK with dev_* interfaces.
-        */
-       case UCLASS_PARTITION:
-               desc = dev_get_uclass_plat(dev_get_parent(dev));
-               break;
-       default:
-               desc = NULL;
-               break;
-       }
-
-       return desc;
-}
-
+/**
+ * disk_blk_read() - Read from a block device partition
+ *
+ * @dev: Device to read from (partition udevice)
+ * @start: Start block for the read (from start of partition)
+ * @blkcnt: Number of blocks to read (within the partition)
+ * @buffer: Place to put the data
+ * @return number of blocks read (which may be less than @blkcnt),
+ * or -ve on error. This never returns 0 unless @blkcnt is 0
+ */
 unsigned long disk_blk_read(struct udevice *dev, lbaint_t start,
                            lbaint_t blkcnt, void *buffer)
 {
-       struct blk_desc *desc;
-       const struct blk_ops *ops;
-       struct disk_part *part;
-       lbaint_t start_in_disk;
-       ulong blks_read;
-
-       desc = dev_get_blk(dev);
-       if (!desc)
-               return -ENOSYS;
+       int ret = disk_blk_part_validate(dev, start, blkcnt);
 
-       ops = blk_get_ops(dev);
-       if (!ops->read)
-               return -ENOSYS;
+       if (ret)
+               return ret;
 
-       start_in_disk = start;
-       if (device_get_uclass_id(dev) == UCLASS_PARTITION) {
-               part = dev_get_uclass_plat(dev);
-               start_in_disk += part->gpt_part_info.start;
-       }
-
-       if (blkcache_read(desc->uclass_id, desc->devnum, start_in_disk, blkcnt,
-                         desc->blksz, buffer))
-               return blkcnt;
-       blks_read = ops->read(dev, start, blkcnt, buffer);
-       if (blks_read == blkcnt)
-               blkcache_fill(desc->uclass_id, desc->devnum, start_in_disk,
-                             blkcnt, desc->blksz, buffer);
-
-       return blks_read;
+       return blk_read(dev_get_parent(dev), disk_blk_part_offset(dev, start),
+                       blkcnt, buffer);
 }
 
+/**
+ * disk_blk_write() - Write to a block device
+ *
+ * @dev: Device to write to (partition udevice)
+ * @start: Start block for the write (from start of partition)
+ * @blkcnt: Number of blocks to write (within the partition)
+ * @buffer: Data to write
+ * @return number of blocks written (which may be less than @blkcnt),
+ * or -ve on error. This never returns 0 unless @blkcnt is 0
+ */
 unsigned long disk_blk_write(struct udevice *dev, lbaint_t start,
                             lbaint_t blkcnt, const void *buffer)
 {
-       struct blk_desc *desc;
-       const struct blk_ops *ops;
-
-       desc = dev_get_blk(dev);
-       if (!desc)
-               return -ENOSYS;
-
-       ops = blk_get_ops(dev);
-       if (!ops->write)
-               return -ENOSYS;
+       int ret = disk_blk_part_validate(dev, start, blkcnt);
 
-       blkcache_invalidate(desc->uclass_id, desc->devnum);
+       if (ret)
+               return ret;
 
-       return ops->write(dev, start, blkcnt, buffer);
+       return blk_write(dev_get_parent(dev), disk_blk_part_offset(dev, start),
+                        blkcnt, buffer);
 }
 
+/**
+ * disk_blk_erase() - Erase part of a block device
+ *
+ * @dev: Device to erase (partition udevice)
+ * @start: Start block for the erase (from start of partition)
+ * @blkcnt: Number of blocks to erase (within the partition)
+ * @return number of blocks erased (which may be less than @blkcnt),
+ * or -ve on error. This never returns 0 unless @blkcnt is 0
+ */
 unsigned long disk_blk_erase(struct udevice *dev, lbaint_t start,
                             lbaint_t blkcnt)
 {
-       struct blk_desc *desc;
-       const struct blk_ops *ops;
-
-       desc = dev_get_blk(dev);
-       if (!desc)
-               return -ENOSYS;
+       int ret = disk_blk_part_validate(dev, start, blkcnt);
 
-       ops = blk_get_ops(dev);
-       if (!ops->erase)
-               return -ENOSYS;
-
-       blkcache_invalidate(desc->uclass_id, desc->devnum);
+       if (ret)
+               return ret;
 
-       return ops->erase(dev, start, blkcnt);
+       return blk_erase(dev_get_parent(dev), disk_blk_part_offset(dev, start),
+                        blkcnt);
 }
 
 UCLASS_DRIVER(partition) = {
@@ -245,3 +128,15 @@ UCLASS_DRIVER(partition) = {
        .per_device_plat_auto   = sizeof(struct disk_part),
        .name           = "partition",
 };
+
+static const struct blk_ops blk_part_ops = {
+       .read   = disk_blk_read,
+       .write  = disk_blk_write,
+       .erase  = disk_blk_erase,
+};
+
+U_BOOT_DRIVER(blk_partition) = {
+       .name           = "blk_partition",
+       .id             = UCLASS_PARTITION,
+       .ops            = &blk_part_ops,
+};
index eec02f58988d71efd2110dc47c105a908e596243..72241b7b232c11a4244bb0143ddd8e24261a2077 100644 (file)
 /* Check all partition types */
 #define PART_TYPE_ALL          -1
 
+/**
+ * part_driver_get_type() - Get a driver given its type
+ *
+ * @part_type: Partition type to find the driver for
+ * Return: Driver for that type, or NULL if none
+ */
 static struct part_driver *part_driver_get_type(int part_type)
 {
        struct part_driver *drv =
@@ -42,25 +48,41 @@ static struct part_driver *part_driver_get_type(int part_type)
        return NULL;
 }
 
-static struct part_driver *part_driver_lookup_type(struct blk_desc *dev_desc)
+/**
+ * part_driver_lookup_type() - Look up the partition driver for a blk device
+ *
+ * If @desc->part_type is PART_TYPE_UNKNOWN, this checks each parition driver
+ * against the blk device to see if there is a valid partition table acceptable
+ * to that driver.
+ *
+ * If @desc->part_type is already set, it just returns the driver for that
+ * type, without testing if the driver can find a valid partition on the
+ * descriptor.
+ *
+ * On success it updates @desc->part_type if set to PART_TYPE_UNKNOWN on entry
+ *
+ * @dev_desc: Device descriptor
+ * Return: Driver found, or NULL if none
+ */
+static struct part_driver *part_driver_lookup_type(struct blk_desc *desc)
 {
        struct part_driver *drv =
                ll_entry_start(struct part_driver, part_driver);
        const int n_ents = ll_entry_count(struct part_driver, part_driver);
        struct part_driver *entry;
 
-       if (dev_desc->part_type == PART_TYPE_UNKNOWN) {
+       if (desc->part_type == PART_TYPE_UNKNOWN) {
                for (entry = drv; entry != drv + n_ents; entry++) {
                        int ret;
 
-                       ret = entry->test(dev_desc);
+                       ret = entry->test(desc);
                        if (!ret) {
-                               dev_desc->part_type = entry->part_type;
+                               desc->part_type = entry->part_type;
                                return entry;
                        }
                }
        } else {
-               return part_driver_get_type(dev_desc->part_type);
+               return part_driver_get_type(desc->part_type);
        }
 
        /* Not found */
@@ -83,27 +105,37 @@ int part_get_type_by_name(const char *name)
        return PART_TYPE_UNKNOWN;
 }
 
+/**
+ * get_dev_hwpart() - Get the descriptor for a device with hardware partitions
+ *
+ * @ifname:    Interface name (e.g. "ide", "scsi")
+ * @dev:       Device number (0 for first device on that interface, 1 for
+ *             second, etc.
+ * @hwpart: Hardware partition, or 0 if none (used for MMC)
+ * Return: pointer to the block device, or NULL if not available, or an
+ *        error occurred.
+ */
 static struct blk_desc *get_dev_hwpart(const char *ifname, int dev, int hwpart)
 {
-       struct blk_desc *dev_desc;
+       struct blk_desc *desc;
        int ret;
 
        if (!blk_enabled())
                return NULL;
-       dev_desc = blk_get_devnum_by_uclass_idname(ifname, dev);
-       if (!dev_desc) {
+       desc = blk_get_devnum_by_uclass_idname(ifname, dev);
+       if (!desc) {
                debug("%s: No device for iface '%s', dev %d\n", __func__,
                      ifname, dev);
                return NULL;
        }
-       ret = blk_dselect_hwpart(dev_desc, hwpart);
+       ret = blk_dselect_hwpart(desc, hwpart);
        if (ret) {
                debug("%s: Failed to select h/w partition: err-%d\n", __func__,
                      ret);
                return NULL;
        }
 
-       return dev_desc;
+       return desc;
 }
 
 struct blk_desc *blk_get_dev(const char *ifname, int dev)
@@ -140,29 +172,24 @@ static lba512_t lba512_muldiv(lba512_t block_count, lba512_t mul_by,
        return bc_quot * mul_by + ((bc_rem * mul_by) >> right_shift);
 }
 
-void dev_print(struct blk_desc *dev_desc)
+void dev_print(struct blk_desc *desc)
 {
        lba512_t lba512; /* number of blocks if 512bytes block size */
 
-       if (dev_desc->type == DEV_TYPE_UNKNOWN) {
+       if (desc->type == DEV_TYPE_UNKNOWN) {
                puts ("not available\n");
                return;
        }
 
-       switch (dev_desc->uclass_id) {
+       switch (desc->uclass_id) {
        case UCLASS_SCSI:
-               printf ("(%d:%d) Vendor: %s Prod.: %s Rev: %s\n",
-                       dev_desc->target,dev_desc->lun,
-                       dev_desc->vendor,
-                       dev_desc->product,
-                       dev_desc->revision);
+               printf("(%d:%d) Vendor: %s Prod.: %s Rev: %s\n", desc->target,
+                      desc->lun, desc->vendor, desc->product, desc->revision);
                break;
        case UCLASS_IDE:
        case UCLASS_AHCI:
-               printf ("Model: %s Firm: %s Ser#: %s\n",
-                       dev_desc->vendor,
-                       dev_desc->revision,
-                       dev_desc->product);
+               printf("Model: %s Firm: %s Ser#: %s\n", desc->vendor,
+                      desc->revision, desc->product);
                break;
        case UCLASS_MMC:
        case UCLASS_USB:
@@ -171,27 +198,27 @@ void dev_print(struct blk_desc *dev_desc)
        case UCLASS_HOST:
        case UCLASS_BLKMAP:
                printf ("Vendor: %s Rev: %s Prod: %s\n",
-                       dev_desc->vendor,
-                       dev_desc->revision,
-                       dev_desc->product);
+                       desc->vendor,
+                       desc->revision,
+                       desc->product);
                break;
        case UCLASS_VIRTIO:
-               printf("%s VirtIO Block Device\n", dev_desc->vendor);
+               printf("%s VirtIO Block Device\n", desc->vendor);
                break;
        case UCLASS_EFI_MEDIA:
-               printf("EFI media Block Device %d\n", dev_desc->devnum);
+               printf("EFI media Block Device %d\n", desc->devnum);
                break;
        case UCLASS_INVALID:
                puts("device type unknown\n");
                return;
        default:
-               printf("Unhandled device type: %i\n", dev_desc->uclass_id);
+               printf("Unhandled device type: %i\n", desc->uclass_id);
                return;
        }
        puts ("            Type: ");
-       if (dev_desc->removable)
+       if (desc->removable)
                puts ("Removable ");
-       switch (dev_desc->type & 0x1F) {
+       switch (desc->type & 0x1F) {
        case DEV_TYPE_HARDDISK:
                puts ("Hard Disk");
                break;
@@ -205,17 +232,17 @@ void dev_print(struct blk_desc *dev_desc)
                puts ("Tape");
                break;
        default:
-               printf ("# %02X #", dev_desc->type & 0x1F);
+               printf("# %02X #", desc->type & 0x1F);
                break;
        }
        puts ("\n");
-       if (dev_desc->lba > 0L && dev_desc->blksz > 0L) {
+       if (desc->lba > 0L && desc->blksz > 0L) {
                ulong mb, mb_quot, mb_rem, gb, gb_quot, gb_rem;
                lbaint_t lba;
 
-               lba = dev_desc->lba;
+               lba = desc->lba;
 
-               lba512 = (lba * (dev_desc->blksz/512));
+               lba512 = lba * (desc->blksz / 512);
                /* round to 1 digit */
                /* 2048 = (1024 * 1024) / 512 MB */
                mb = lba512_muldiv(lba512, 10, 11);
@@ -227,7 +254,7 @@ void dev_print(struct blk_desc *dev_desc)
                gb_quot = gb / 10;
                gb_rem  = gb - (10 * gb_quot);
 #ifdef CONFIG_LBA48
-               if (dev_desc->lba48)
+               if (desc->lba48)
                        printf ("            Supports 48-bit addressing\n");
 #endif
 #if defined(CONFIG_SYS_64BIT_LBA)
@@ -235,42 +262,42 @@ void dev_print(struct blk_desc *dev_desc)
                        mb_quot, mb_rem,
                        gb_quot, gb_rem,
                        lba,
-                       dev_desc->blksz);
+                       desc->blksz);
 #else
                printf ("            Capacity: %lu.%lu MB = %lu.%lu GB (%lu x %lu)\n",
                        mb_quot, mb_rem,
                        gb_quot, gb_rem,
                        (ulong)lba,
-                       dev_desc->blksz);
+                       desc->blksz);
 #endif
        } else {
                puts ("            Capacity: not available\n");
        }
 }
 
-void part_init(struct blk_desc *dev_desc)
+void part_init(struct blk_desc *desc)
 {
        struct part_driver *drv =
                ll_entry_start(struct part_driver, part_driver);
        const int n_ents = ll_entry_count(struct part_driver, part_driver);
        struct part_driver *entry;
 
-       blkcache_invalidate(dev_desc->uclass_id, dev_desc->devnum);
+       blkcache_invalidate(desc->uclass_id, desc->devnum);
 
-       dev_desc->part_type = PART_TYPE_UNKNOWN;
+       desc->part_type = PART_TYPE_UNKNOWN;
        for (entry = drv; entry != drv + n_ents; entry++) {
                int ret;
 
-               ret = entry->test(dev_desc);
+               ret = entry->test(desc);
                debug("%s: try '%s': ret=%d\n", __func__, entry->name, ret);
                if (!ret) {
-                       dev_desc->part_type = entry->part_type;
+                       desc->part_type = entry->part_type;
                        break;
                }
        }
 }
 
-static void print_part_header(const char *type, struct blk_desc *dev_desc)
+static void print_part_header(const char *type, struct blk_desc *desc)
 {
 #if CONFIG_IS_ENABLED(MAC_PARTITION) || \
        CONFIG_IS_ENABLED(DOS_PARTITION) || \
@@ -278,7 +305,7 @@ static void print_part_header(const char *type, struct blk_desc *dev_desc)
        CONFIG_IS_ENABLED(AMIGA_PARTITION) || \
        CONFIG_IS_ENABLED(EFI_PARTITION)
        puts ("\nPartition Map for ");
-       switch (dev_desc->uclass_id) {
+       switch (desc->uclass_id) {
        case UCLASS_IDE:
                puts ("IDE");
                break;
@@ -314,50 +341,46 @@ static void print_part_header(const char *type, struct blk_desc *dev_desc)
                break;
        }
        printf (" device %d  --   Partition Type: %s\n\n",
-                       dev_desc->devnum, type);
+                       desc->devnum, type);
 #endif /* any CONFIG_..._PARTITION */
 }
 
-void part_print(struct blk_desc *dev_desc)
+void part_print(struct blk_desc *desc)
 {
        struct part_driver *drv;
 
-       drv = part_driver_lookup_type(dev_desc);
+       drv = part_driver_lookup_type(desc);
        if (!drv) {
                printf("## Unknown partition table type %x\n",
-                      dev_desc->part_type);
+                      desc->part_type);
                return;
        }
 
        PRINTF("## Testing for valid %s partition ##\n", drv->name);
-       print_part_header(drv->name, dev_desc);
+       print_part_header(drv->name, desc);
        if (drv->print)
-               drv->print(dev_desc);
+               drv->print(desc);
 }
 
-int part_get_info_by_type(struct blk_desc *dev_desc, int part, int part_type,
+int part_get_info_by_type(struct blk_desc *desc, int part, int part_type,
                          struct disk_partition *info)
 {
        struct part_driver *drv;
 
        if (blk_enabled()) {
-#if CONFIG_IS_ENABLED(PARTITION_UUIDS)
                /* The common case is no UUID support */
-               info->uuid[0] = 0;
-#endif
-#ifdef CONFIG_PARTITION_TYPE_GUID
-               info->type_guid[0] = 0;
-#endif
+               disk_partition_clr_uuid(info);
+               disk_partition_clr_type_guid(info);
 
                if (part_type == PART_TYPE_UNKNOWN) {
-                       drv = part_driver_lookup_type(dev_desc);
+                       drv = part_driver_lookup_type(desc);
                } else {
                        drv = part_driver_get_type(part_type);
                }
 
                if (!drv) {
                        debug("## Unknown partition table type %x\n",
-                             dev_desc->part_type);
+                             desc->part_type);
                        return -EPROTONOSUPPORT;
                }
                if (!drv->get_info) {
@@ -365,7 +388,7 @@ int part_get_info_by_type(struct blk_desc *dev_desc, int part, int part_type,
                               drv->name);
                        return -ENOSYS;
                }
-               if (drv->get_info(dev_desc, part, info) == 0) {
+               if (drv->get_info(desc, part, info) == 0) {
                        PRINTF("## Valid %s partition found ##\n", drv->name);
                        return 0;
                }
@@ -374,33 +397,29 @@ int part_get_info_by_type(struct blk_desc *dev_desc, int part, int part_type,
        return -ENOENT;
 }
 
-int part_get_info(struct blk_desc *dev_desc, int part,
+int part_get_info(struct blk_desc *desc, int part,
                  struct disk_partition *info)
 {
-       return part_get_info_by_type(dev_desc, part, PART_TYPE_UNKNOWN, info);
+       return part_get_info_by_type(desc, part, PART_TYPE_UNKNOWN, info);
 }
 
-int part_get_info_whole_disk(struct blk_desc *dev_desc,
+int part_get_info_whole_disk(struct blk_desc *desc,
                             struct disk_partition *info)
 {
        info->start = 0;
-       info->size = dev_desc->lba;
-       info->blksz = dev_desc->blksz;
+       info->size = desc->lba;
+       info->blksz = desc->blksz;
        info->bootable = 0;
        strcpy((char *)info->type, BOOT_PART_TYPE);
        strcpy((char *)info->name, "Whole Disk");
-#if CONFIG_IS_ENABLED(PARTITION_UUIDS)
-       info->uuid[0] = 0;
-#endif
-#ifdef CONFIG_PARTITION_TYPE_GUID
-       info->type_guid[0] = 0;
-#endif
+       disk_partition_clr_uuid(info);
+       disk_partition_clr_type_guid(info);
 
        return 0;
 }
 
 int blk_get_device_by_str(const char *ifname, const char *dev_hwpart_str,
-                         struct blk_desc **dev_desc)
+                         struct blk_desc **desc)
 {
        char *ep;
        char *dup_str = NULL;
@@ -436,8 +455,8 @@ int blk_get_device_by_str(const char *ifname, const char *dev_hwpart_str,
                }
        }
 
-       *dev_desc = get_dev_hwpart(ifname, dev, hwpart);
-       if (!(*dev_desc) || ((*dev_desc)->type == DEV_TYPE_UNKNOWN)) {
+       *desc = get_dev_hwpart(ifname, dev, hwpart);
+       if (!(*desc) || ((*desc)->type == DEV_TYPE_UNKNOWN)) {
                debug("** Bad device %s %s **\n", ifname, dev_hwpart_str);
                dev = -ENODEV;
                goto cleanup;
@@ -449,8 +468,8 @@ int blk_get_device_by_str(const char *ifname, const char *dev_hwpart_str,
                 * Always should be done, otherwise hw partition 0 will return
                 * stale data after displaying a non-zero hw partition.
                 */
-               if ((*dev_desc)->uclass_id == UCLASS_MMC)
-                       part_init(*dev_desc);
+               if ((*desc)->uclass_id == UCLASS_MMC)
+                       part_init(*desc);
        }
 
 cleanup:
@@ -461,7 +480,7 @@ cleanup:
 #define PART_UNSPECIFIED -2
 #define PART_AUTO -1
 int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
-                            struct blk_desc **dev_desc,
+                            struct blk_desc **desc,
                             struct disk_partition *info, int allow_whole_dev)
 {
        int ret;
@@ -474,7 +493,7 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
        int part;
        struct disk_partition tmpinfo;
 
-       *dev_desc = NULL;
+       *desc = NULL;
        memset(info, 0, sizeof(*info));
 
 #if IS_ENABLED(CONFIG_SANDBOX) || IS_ENABLED(CONFIG_SEMIHOSTING)
@@ -533,7 +552,7 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
        }
 
        /* Look up the device */
-       dev = blk_get_device_by_str(ifname, dev_str, dev_desc);
+       dev = blk_get_device_by_str(ifname, dev_str, desc);
        if (dev < 0) {
                printf("** Bad device specification %s %s **\n",
                       ifname, dev_str);
@@ -565,9 +584,8 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
         * No partition table on device,
         * or user requested partition 0 (entire device).
         */
-       if (((*dev_desc)->part_type == PART_TYPE_UNKNOWN) ||
-           (part == 0)) {
-               if (!(*dev_desc)->lba) {
+       if (((*desc)->part_type == PART_TYPE_UNKNOWN) || !part) {
+               if (!(*desc)->lba) {
                        printf("** Bad device size - %s %s **\n", ifname,
                               dev_str);
                        ret = -EINVAL;
@@ -586,9 +604,9 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
                        goto cleanup;
                }
 
-               (*dev_desc)->log2blksz = LOG2((*dev_desc)->blksz);
+               (*desc)->log2blksz = LOG2((*desc)->blksz);
 
-               part_get_info_whole_disk(*dev_desc, info);
+               part_get_info_whole_disk(*desc, info);
 
                ret = 0;
                goto cleanup;
@@ -606,7 +624,7 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
         * other than "auto", use that partition number directly.
         */
        if (part != PART_AUTO) {
-               ret = part_get_info(*dev_desc, part, info);
+               ret = part_get_info(*desc, part, info);
                if (ret) {
                        printf("** Invalid partition %d **\n", part);
                        goto cleanup;
@@ -618,7 +636,7 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
                 */
                part = 0;
                for (p = 1; p <= MAX_SEARCH_PARTITIONS; p++) {
-                       ret = part_get_info(*dev_desc, p, info);
+                       ret = part_get_info(*desc, p, info);
                        if (ret)
                                continue;
 
@@ -662,7 +680,7 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
                goto cleanup;
        }
 
-       (*dev_desc)->log2blksz = LOG2((*dev_desc)->blksz);
+       (*desc)->log2blksz = LOG2((*desc)->blksz);
 
        ret = part;
        goto cleanup;
@@ -672,14 +690,14 @@ cleanup:
        return ret;
 }
 
-int part_get_info_by_name(struct blk_desc *dev_desc, const char *name,
+int part_get_info_by_name(struct blk_desc *desc, const char *name,
                          struct disk_partition *info)
 {
        struct part_driver *part_drv;
        int ret;
        int i;
 
-       part_drv = part_driver_lookup_type(dev_desc);
+       part_drv = part_driver_lookup_type(desc);
        if (!part_drv)
                return -1;
 
@@ -690,7 +708,7 @@ int part_get_info_by_name(struct blk_desc *dev_desc, const char *name,
        }
 
        for (i = 1; i < part_drv->max_entries; i++) {
-               ret = part_drv->get_info(dev_desc, i, info);
+               ret = part_drv->get_info(desc, i, info);
                if (ret != 0) {
                        /* no more entries in table */
                        break;
@@ -710,18 +728,18 @@ int part_get_info_by_name(struct blk_desc *dev_desc, const char *name,
  * Parse a device number and partition name string in the form of
  * "devicenum.hwpartnum#partition_name", for example "0.1#misc". devicenum and
  * hwpartnum are both optional, defaulting to 0. If the partition is found,
- * sets dev_desc and part_info accordingly with the information of the
+ * sets desc and part_info accordingly with the information of the
  * partition with the given partition_name.
  *
  * @param[in] dev_iface Device interface
  * @param[in] dev_part_str Input string argument, like "0.1#misc"
- * @param[out] dev_desc Place to store the device description pointer
+ * @param[out] desc Place to store the device description pointer
  * @param[out] part_info Place to store the partition information
  * Return: 0 on success, or a negative on error
  */
 static int part_get_info_by_dev_and_name(const char *dev_iface,
                                         const char *dev_part_str,
-                                        struct blk_desc **dev_desc,
+                                        struct blk_desc **desc,
                                         struct disk_partition *part_info)
 {
        char *dup_str = NULL;
@@ -743,11 +761,11 @@ static int part_get_info_by_dev_and_name(const char *dev_iface,
                return -EINVAL;
        }
 
-       ret = blk_get_device_by_str(dev_iface, dev_str, dev_desc);
+       ret = blk_get_device_by_str(dev_iface, dev_str, desc);
        if (ret < 0)
                goto cleanup;
 
-       ret = part_get_info_by_name(*dev_desc, part_str, part_info);
+       ret = part_get_info_by_name(*desc, part_str, part_info);
        if (ret < 0)
                printf("Could not find \"%s\" partition\n", part_str);
 
@@ -758,35 +776,35 @@ cleanup:
 
 int part_get_info_by_dev_and_name_or_num(const char *dev_iface,
                                         const char *dev_part_str,
-                                        struct blk_desc **dev_desc,
+                                        struct blk_desc **desc,
                                         struct disk_partition *part_info,
                                         int allow_whole_dev)
 {
        int ret;
 
        /* Split the part_name if passed as "$dev_num#part_name". */
-       ret = part_get_info_by_dev_and_name(dev_iface, dev_part_str,
-                                           dev_desc, part_info);
+       ret = part_get_info_by_dev_and_name(dev_iface, dev_part_str, desc,
+                                           part_info);
        if (ret >= 0)
                return ret;
        /*
         * Couldn't lookup by name, try looking up the partition description
         * directly.
         */
-       ret = blk_get_device_part_str(dev_iface, dev_part_str,
-                                     dev_desc, part_info, allow_whole_dev);
+       ret = blk_get_device_part_str(dev_iface, dev_part_str, desc, part_info,
+                                     allow_whole_dev);
        if (ret < 0)
                printf("Couldn't find partition %s %s\n",
                       dev_iface, dev_part_str);
        return ret;
 }
 
-void part_set_generic_name(const struct blk_desc *dev_desc,
-       int part_num, char *name)
+void part_set_generic_name(const struct blk_desc *desc, int part_num,
+                          char *name)
 {
        char *devtype;
 
-       switch (dev_desc->uclass_id) {
+       switch (desc->uclass_id) {
        case UCLASS_IDE:
        case UCLASS_AHCI:
                devtype = "hd";
@@ -805,7 +823,7 @@ void part_set_generic_name(const struct blk_desc *dev_desc,
                break;
        }
 
-       sprintf(name, "%s%c%d", devtype, 'a' + dev_desc->devnum, part_num);
+       sprintf(name, "%s%c%d", devtype, 'a' + desc->devnum, part_num);
 }
 
 int part_get_bootable(struct blk_desc *desc)
index 45d3a7048669cbd1c7797fe62e1361a533060d8a..65e30fea558d5ccbcddc3b167cb62b92f0ade3e1 100644 (file)
@@ -125,7 +125,7 @@ static void print_part_info(struct partition_block *p)
  * the ID AMIGA_ID_RDISK ('RDSK') and needs to have a valid
  * sum-to-zero checksum
  */
-struct rigid_disk_block *get_rdisk(struct blk_desc *dev_desc)
+struct rigid_disk_block *get_rdisk(struct blk_desc *desc)
 {
     int i;
     int limit;
@@ -139,7 +139,7 @@ struct rigid_disk_block *get_rdisk(struct blk_desc *dev_desc)
 
     for (i=0; i<limit; i++)
     {
-       ulong res = blk_dread(dev_desc, i, 1, (ulong *)block_buffer);
+       ulong res = blk_dread(desc, i, 1, (ulong *)block_buffer);
        if (res == 1)
        {
            struct rigid_disk_block *trdb = (struct rigid_disk_block *)block_buffer;
@@ -165,7 +165,7 @@ struct rigid_disk_block *get_rdisk(struct blk_desc *dev_desc)
  * Ridgid disk block
  */
 
-struct bootcode_block *get_bootcode(struct blk_desc *dev_desc)
+struct bootcode_block *get_bootcode(struct blk_desc *desc)
 {
     int i;
     int limit;
@@ -181,7 +181,7 @@ struct bootcode_block *get_bootcode(struct blk_desc *dev_desc)
 
     for (i = 0; i < limit; i++)
     {
-       ulong res = blk_dread(dev_desc, i, 1, (ulong *)block_buffer);
+       ulong res = blk_dread(desc, i, 1, (ulong *)block_buffer);
        if (res == 1)
        {
            struct bootcode_block *boot = (struct bootcode_block *)block_buffer;
@@ -206,17 +206,17 @@ struct bootcode_block *get_bootcode(struct blk_desc *dev_desc)
  * Test if the given partition has an Amiga partition table/Rigid
  * Disk block
  */
-static int part_test_amiga(struct blk_desc *dev_desc)
+static int part_test_amiga(struct blk_desc *desc)
 {
     struct rigid_disk_block *rdb;
     struct bootcode_block *bootcode;
 
     PRINTF("part_test_amiga: Testing for an Amiga RDB partition\n");
 
-    rdb = get_rdisk(dev_desc);
+       rdb = get_rdisk(desc);
     if (rdb)
     {
-       bootcode = get_bootcode(dev_desc);
+       bootcode = get_bootcode(desc);
        if (bootcode)
            PRINTF("part_test_amiga: bootable Amiga disk\n");
        else
@@ -235,7 +235,7 @@ static int part_test_amiga(struct blk_desc *dev_desc)
 /*
  * Find partition number partnum on the given drive.
  */
-static struct partition_block *find_partition(struct blk_desc *dev_desc,
+static struct partition_block *find_partition(struct blk_desc *desc,
                                              int partnum)
 {
     struct rigid_disk_block *rdb;
@@ -243,7 +243,7 @@ static struct partition_block *find_partition(struct blk_desc *dev_desc,
     u32 block;
 
     PRINTF("Trying to find partition block %d\n", partnum);
-    rdb = get_rdisk(dev_desc);
+       rdb = get_rdisk(desc);
     if (!rdb)
     {
        PRINTF("find_partition: no rdb found\n");
@@ -257,7 +257,7 @@ static struct partition_block *find_partition(struct blk_desc *dev_desc,
 
     while (block != 0xFFFFFFFF)
     {
-       ulong res = blk_dread(dev_desc, block, 1, (ulong *)block_buffer);
+       ulong res = blk_dread(desc, block, 1, (ulong *)block_buffer);
        if (res == 1)
        {
            p = (struct partition_block *)block_buffer;
@@ -289,10 +289,10 @@ static struct partition_block *find_partition(struct blk_desc *dev_desc,
 /*
  * Get info about a partition
  */
-static int part_get_info_amiga(struct blk_desc *dev_desc, int part,
-                                   struct disk_partition *info)
+static int part_get_info_amiga(struct blk_desc *desc, int part,
+                              struct disk_partition *info)
 {
-    struct partition_block *p = find_partition(dev_desc, part-1);
+       struct partition_block *p = find_partition(desc, part - 1);
     struct amiga_part_geometry *g;
     u32 disk_type;
 
@@ -317,7 +317,7 @@ static int part_get_info_amiga(struct blk_desc *dev_desc, int part,
     return 0;
 }
 
-static void part_print_amiga(struct blk_desc *dev_desc)
+static void part_print_amiga(struct blk_desc *desc)
 {
     struct rigid_disk_block *rdb;
     struct bootcode_block *boot;
@@ -325,7 +325,7 @@ static void part_print_amiga(struct blk_desc *dev_desc)
     u32 block;
     int i = 1;
 
-    rdb = get_rdisk(dev_desc);
+       rdb = get_rdisk(desc);
     if (!rdb)
     {
        PRINTF("part_print_amiga: no rdb found\n");
@@ -353,7 +353,7 @@ static void part_print_amiga(struct blk_desc *dev_desc)
 
        PRINTF("Trying to load block #0x%X\n", block);
 
-       res = blk_dread(dev_desc, block, 1, (ulong *)block_buffer);
+       res = blk_dread(desc, block, 1, (ulong *)block_buffer);
        if (res == 1)
        {
            p = (struct partition_block *)block_buffer;
@@ -370,7 +370,7 @@ static void part_print_amiga(struct blk_desc *dev_desc)
        } else block = 0xFFFFFFFF;
     }
 
-    boot = get_bootcode(dev_desc);
+       boot = get_bootcode(desc);
     if (boot)
     {
        printf("Disk is bootable\n");
index 56e61884deff6137d2df0feb6f894f3d0cb9c78c..33374384373a67337ce6c359bf3f53e54494d11f 100644 (file)
@@ -98,27 +98,26 @@ static int test_block_type(unsigned char *buffer)
        return -1;
 }
 
-static int part_test_dos(struct blk_desc *dev_desc)
+static int part_test_dos(struct blk_desc *desc)
 {
 #ifndef CONFIG_SPL_BUILD
        ALLOC_CACHE_ALIGN_BUFFER(legacy_mbr, mbr,
-                       DIV_ROUND_UP(dev_desc->blksz, sizeof(legacy_mbr)));
+                       DIV_ROUND_UP(desc->blksz, sizeof(legacy_mbr)));
 
-       if (blk_dread(dev_desc, 0, 1, (ulong *)mbr) != 1)
+       if (blk_dread(desc, 0, 1, (ulong *)mbr) != 1)
                return -1;
 
        if (test_block_type((unsigned char *)mbr) != DOS_MBR)
                return -1;
 
-       if (dev_desc->sig_type == SIG_TYPE_NONE &&
-           mbr->unique_mbr_signature != 0) {
-               dev_desc->sig_type = SIG_TYPE_MBR;
-               dev_desc->mbr_sig = mbr->unique_mbr_signature;
+       if (desc->sig_type == SIG_TYPE_NONE && mbr->unique_mbr_signature) {
+               desc->sig_type = SIG_TYPE_MBR;
+               desc->mbr_sig = mbr->unique_mbr_signature;
        }
 #else
-       ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, dev_desc->blksz);
+       ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, desc->blksz);
 
-       if (blk_dread(dev_desc, 0, 1, (ulong *)buffer) != 1)
+       if (blk_dread(desc, 0, 1, (ulong *)buffer) != 1)
                return -1;
 
        if (test_block_type(buffer) != DOS_MBR)
@@ -130,12 +129,12 @@ static int part_test_dos(struct blk_desc *dev_desc)
 
 /*  Print a partition that is relative to its Extended partition table
  */
-static void print_partition_extended(struct blk_desc *dev_desc,
+static void print_partition_extended(struct blk_desc *desc,
                                     lbaint_t ext_part_sector,
                                     lbaint_t relative,
                                     int part_num, unsigned int disksig)
 {
-       ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, dev_desc->blksz);
+       ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, desc->blksz);
        dos_partition_t *pt;
        int i;
 
@@ -146,9 +145,9 @@ static void print_partition_extended(struct blk_desc *dev_desc,
                return;
     }
 
-       if (blk_dread(dev_desc, ext_part_sector, 1, (ulong *)buffer) != 1) {
+       if (blk_dread(desc, ext_part_sector, 1, (ulong *)buffer) != 1) {
                printf ("** Can't read partition table on %d:" LBAFU " **\n",
-                       dev_desc->devnum, ext_part_sector);
+                       desc->devnum, ext_part_sector);
                return;
        }
        i=test_block_type(buffer);
@@ -189,9 +188,9 @@ static void print_partition_extended(struct blk_desc *dev_desc,
                        lbaint_t lba_start
                                = get_unaligned_le32 (pt->start4) + relative;
 
-                       print_partition_extended(dev_desc, lba_start,
-                               ext_part_sector == 0  ? lba_start : relative,
-                               part_num, disksig);
+                       print_partition_extended(desc, lba_start,
+                                                !ext_part_sector ? lba_start :
+                                                relative, part_num, disksig);
                }
        }
 
@@ -201,14 +200,15 @@ static void print_partition_extended(struct blk_desc *dev_desc,
 
 /*  Print a partition that is relative to its Extended partition table
  */
-static int part_get_info_extended(struct blk_desc *dev_desc,
+static int part_get_info_extended(struct blk_desc *desc,
                                  lbaint_t ext_part_sector, lbaint_t relative,
                                  int part_num, int which_part,
                                  struct disk_partition *info, uint disksig)
 {
-       ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, dev_desc->blksz);
+       ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, desc->blksz);
+       struct disk_partition wdinfo = { 0 };
        dos_partition_t *pt;
-       int i;
+       int i, ret;
        int dos_type;
 
        /* set a maximum recursion level */
@@ -218,9 +218,9 @@ static int part_get_info_extended(struct blk_desc *dev_desc,
                return -1;
     }
 
-       if (blk_dread(dev_desc, ext_part_sector, 1, (ulong *)buffer) != 1) {
+       if (blk_dread(desc, ext_part_sector, 1, (ulong *)buffer) != 1) {
                printf ("** Can't read partition table on %d:" LBAFU " **\n",
-                       dev_desc->devnum, ext_part_sector);
+                       desc->devnum, ext_part_sector);
                return -1;
        }
        if (buffer[DOS_PART_MAGIC_OFFSET] != 0x55 ||
@@ -231,10 +231,12 @@ static int part_get_info_extended(struct blk_desc *dev_desc,
                return -1;
        }
 
-#if CONFIG_IS_ENABLED(PARTITION_UUIDS)
-       if (!ext_part_sector)
+       if (CONFIG_IS_ENABLED(PARTITION_UUIDS) && !ext_part_sector)
                disksig = get_unaligned_le32(&buffer[DOS_PART_DISKSIG_OFFSET]);
-#endif
+
+       ret = part_get_info_whole_disk(desc, &wdinfo);
+       if (ret)
+               return ret;
 
        /* Print all primary/logical partitions */
        pt = (dos_partition_t *) (buffer + DOS_PART_TBL_OFFSET);
@@ -247,18 +249,24 @@ static int part_get_info_extended(struct blk_desc *dev_desc,
                    (pt->sys_ind != 0) &&
                    (part_num == which_part) &&
                    (ext_part_sector == 0 || is_extended(pt->sys_ind) == 0)) {
-                       info->blksz = DOS_PART_DEFAULT_SECTOR;
+                       if (wdinfo.blksz > DOS_PART_DEFAULT_SECTOR)
+                               info->blksz = wdinfo.blksz;
+                       else
+                               info->blksz = DOS_PART_DEFAULT_SECTOR;
                        info->start = (lbaint_t)(ext_part_sector +
                                        get_unaligned_le32(pt->start4));
                        info->size  = (lbaint_t)get_unaligned_le32(pt->size4);
-                       part_set_generic_name(dev_desc, part_num,
+                       part_set_generic_name(desc, part_num,
                                              (char *)info->name);
                        /* sprintf(info->type, "%d, pt->sys_ind); */
                        strcpy((char *)info->type, "U-Boot");
                        info->bootable = get_bootable(pt);
-#if CONFIG_IS_ENABLED(PARTITION_UUIDS)
-                       sprintf(info->uuid, "%08x-%02x", disksig, part_num);
-#endif
+                       if (CONFIG_IS_ENABLED(PARTITION_UUIDS)) {
+                               char str[12];
+
+                               sprintf(str, "%08x-%02x", disksig, part_num);
+                               disk_partition_set_uuid(info, str);
+                       }
                        info->sys_ind = pt->sys_ind;
                        return 0;
                }
@@ -277,7 +285,7 @@ static int part_get_info_extended(struct blk_desc *dev_desc,
                        lbaint_t lba_start
                                = get_unaligned_le32 (pt->start4) + relative;
 
-                       return part_get_info_extended(dev_desc, lba_start,
+                       return part_get_info_extended(desc, lba_start,
                                 ext_part_sector == 0 ? lba_start : relative,
                                 part_num, which_part, info, disksig);
                }
@@ -288,29 +296,30 @@ static int part_get_info_extended(struct blk_desc *dev_desc,
 
        if (dos_type == DOS_PBR) {
                info->start = 0;
-               info->size = dev_desc->lba;
-               info->blksz = DOS_PART_DEFAULT_SECTOR;
+               info->size = desc->lba;
+               if (wdinfo.blksz > DOS_PART_DEFAULT_SECTOR)
+                       info->blksz = wdinfo.blksz;
+               else
+                       info->blksz = DOS_PART_DEFAULT_SECTOR;
                info->bootable = 0;
                strcpy((char *)info->type, "U-Boot");
-#if CONFIG_IS_ENABLED(PARTITION_UUIDS)
-               info->uuid[0] = 0;
-#endif
+               disk_partition_clr_uuid(info);
                return 0;
        }
 
        return -1;
 }
 
-static void __maybe_unused part_print_dos(struct blk_desc *dev_desc)
+static void __maybe_unused part_print_dos(struct blk_desc *desc)
 {
        printf("Part\tStart Sector\tNum Sectors\tUUID\t\tType\n");
-       print_partition_extended(dev_desc, 0, 0, 1, 0);
+       print_partition_extended(desc, 0, 0, 1, 0);
 }
 
-static int __maybe_unused part_get_info_dos(struct blk_desc *dev_desc, int part,
-                     struct disk_partition *info)
+static int __maybe_unused part_get_info_dos(struct blk_desc *desc, int part,
+                                           struct disk_partition *info)
 {
-       return part_get_info_extended(dev_desc, 0, 0, 1, part, info, 0);
+       return part_get_info_extended(desc, 0, 0, 1, part, info, 0);
 }
 
 int is_valid_dos_buf(void *buf)
@@ -490,20 +499,20 @@ int layout_mbr_partitions(struct disk_partition *p, int count,
 }
 #endif
 
-int write_mbr_sector(struct blk_desc *dev_desc, void *buf)
+int write_mbr_sector(struct blk_desc *desc, void *buf)
 {
        if (is_valid_dos_buf(buf))
                return -1;
 
        /* write MBR */
-       if (blk_dwrite(dev_desc, 0, 1, buf) != 1) {
+       if (blk_dwrite(desc, 0, 1, buf) != 1) {
                printf("%s: failed writing '%s' (1 blks at 0x0)\n",
                       __func__, "MBR");
                return 1;
        }
 
        /* Update the partition table entries*/
-       part_init(dev_desc);
+       part_init(desc);
 
        return 0;
 }
index 80a44dc9f072e6703e413cc51e62d4b93d90ed64..39382c5faee0876c97bd59359d00728e143c2e3a 100644 (file)
@@ -9,6 +9,9 @@
  *   when CONFIG_SYS_64BIT_LBA is not defined, lbaint_t is 32 bits; this
  *   limits the maximum size of addressable storage to < 2 tebibytes
  */
+
+#define LOG_CATEGORY LOGC_FS
+
 #include <common.h>
 #include <blk.h>
 #include <log.h>
@@ -51,12 +54,12 @@ static inline u32 efi_crc32(const void *buf, u32 len)
 
 static int pmbr_part_valid(struct partition *part);
 static int is_pmbr_valid(legacy_mbr * mbr);
-static int is_gpt_valid(struct blk_desc *dev_desc, u64 lba,
-                               gpt_header *pgpt_head, gpt_entry **pgpt_pte);
-static gpt_entry *alloc_read_gpt_entries(struct blk_desc *dev_desc,
+static int is_gpt_valid(struct blk_desc *desc, u64 lba, gpt_header *pgpt_head,
+                       gpt_entry **pgpt_pte);
+static gpt_entry *alloc_read_gpt_entries(struct blk_desc *desc,
                                         gpt_header *pgpt_head);
 static int is_pte_valid(gpt_entry * pte);
-static int find_valid_gpt(struct blk_desc *dev_desc, gpt_header *gpt_head,
+static int find_valid_gpt(struct blk_desc *desc, gpt_header *gpt_head,
                          gpt_entry **pgpt_pte);
 
 static char *print_efiname(gpt_entry *pte)
@@ -195,14 +198,14 @@ static void prepare_backup_gpt_header(gpt_header *gpt_h)
  * UUID is displayed as 32 hexadecimal digits, in 5 groups,
  * separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters
  */
-int get_disk_guid(struct blk_desc * dev_desc, char *guid)
+int get_disk_guid(struct blk_desc *desc, char *guid)
 {
-       ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_head, 1, dev_desc->blksz);
+       ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_head, 1, desc->blksz);
        gpt_entry *gpt_pte = NULL;
        unsigned char *guid_bin;
 
        /* This function validates AND fills in the GPT header and PTE */
-       if (find_valid_gpt(dev_desc, gpt_head, &gpt_pte) != 1)
+       if (find_valid_gpt(desc, gpt_head, &gpt_pte) != 1)
                return -EINVAL;
 
        guid_bin = gpt_head->disk_guid.b;
@@ -213,15 +216,15 @@ int get_disk_guid(struct blk_desc * dev_desc, char *guid)
        return 0;
 }
 
-void part_print_efi(struct blk_desc *dev_desc)
+void part_print_efi(struct blk_desc *desc)
 {
-       ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_head, 1, dev_desc->blksz);
+       ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_head, 1, desc->blksz);
        gpt_entry *gpt_pte = NULL;
        int i = 0;
        unsigned char *uuid;
 
        /* This function validates AND fills in the GPT header and PTE */
-       if (find_valid_gpt(dev_desc, gpt_head, &gpt_pte) != 1)
+       if (find_valid_gpt(desc, gpt_head, &gpt_pte) != 1)
                return;
 
        debug("%s: gpt-entry at %p\n", __func__, gpt_pte);
@@ -255,10 +258,10 @@ void part_print_efi(struct blk_desc *dev_desc)
        return;
 }
 
-int part_get_info_efi(struct blk_desc *dev_desc, int part,
+int part_get_info_efi(struct blk_desc *desc, int part,
                      struct disk_partition *info)
 {
-       ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_head, 1, dev_desc->blksz);
+       ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_head, 1, desc->blksz);
        gpt_entry *gpt_pte = NULL;
 
        /* "part" argument must be at least 1 */
@@ -268,7 +271,7 @@ int part_get_info_efi(struct blk_desc *dev_desc, int part,
        }
 
        /* This function validates AND fills in the GPT header and PTE */
-       if (find_valid_gpt(dev_desc, gpt_head, &gpt_pte) != 1)
+       if (find_valid_gpt(desc, gpt_head, &gpt_pte) != 1)
                return -EINVAL;
 
        if (part > le32_to_cpu(gpt_head->num_partition_entries) ||
@@ -283,20 +286,22 @@ int part_get_info_efi(struct blk_desc *dev_desc, int part,
        /* The ending LBA is inclusive, to calculate size, add 1 to it */
        info->size = (lbaint_t)le64_to_cpu(gpt_pte[part - 1].ending_lba) + 1
                     - info->start;
-       info->blksz = dev_desc->blksz;
+       info->blksz = desc->blksz;
 
        snprintf((char *)info->name, sizeof(info->name), "%s",
                 print_efiname(&gpt_pte[part - 1]));
        strcpy((char *)info->type, "U-Boot");
        info->bootable = get_bootable(&gpt_pte[part - 1]);
-#if CONFIG_IS_ENABLED(PARTITION_UUIDS)
-       uuid_bin_to_str(gpt_pte[part - 1].unique_partition_guid.b, info->uuid,
-                       UUID_STR_FORMAT_GUID);
-#endif
-#ifdef CONFIG_PARTITION_TYPE_GUID
-       uuid_bin_to_str(gpt_pte[part - 1].partition_type_guid.b,
-                       info->type_guid, UUID_STR_FORMAT_GUID);
-#endif
+       if (CONFIG_IS_ENABLED(PARTITION_UUIDS)) {
+               uuid_bin_to_str(gpt_pte[part - 1].unique_partition_guid.b,
+                               (char *)disk_partition_uuid(info),
+                               UUID_STR_FORMAT_GUID);
+       }
+       if (IS_ENABLED(CONFIG_PARTITION_TYPE_GUID)) {
+               uuid_bin_to_str(gpt_pte[part - 1].partition_type_guid.b,
+                               (char *)disk_partition_type_uuid(info),
+                               UUID_STR_FORMAT_GUID);
+       }
 
        log_debug("start 0x" LBAF ", size 0x" LBAF ", name %s\n", info->start,
                  info->size, info->name);
@@ -306,12 +311,12 @@ int part_get_info_efi(struct blk_desc *dev_desc, int part,
        return 0;
 }
 
-static int part_test_efi(struct blk_desc *dev_desc)
+static int part_test_efi(struct blk_desc *desc)
 {
-       ALLOC_CACHE_ALIGN_BUFFER_PAD(legacy_mbr, legacymbr, 1, dev_desc->blksz);
+       ALLOC_CACHE_ALIGN_BUFFER_PAD(legacy_mbr, legacymbr, 1, desc->blksz);
 
        /* Read legacy MBR from block 0 and validate it */
-       if ((blk_dread(dev_desc, 0, 1, (ulong *)legacymbr) != 1)
+       if ((blk_dread(desc, 0, 1, (ulong *)legacymbr) != 1)
                || (is_pmbr_valid(legacymbr) != 1)) {
                return -1;
        }
@@ -320,23 +325,23 @@ static int part_test_efi(struct blk_desc *dev_desc)
 
 /**
  * set_protective_mbr(): Set the EFI protective MBR
- * @param dev_desc - block device descriptor
+ * @param desc - block device descriptor
  *
  * Return: - zero on success, otherwise error
  */
-static int set_protective_mbr(struct blk_desc *dev_desc)
+static int set_protective_mbr(struct blk_desc *desc)
 {
        /* Setup the Protective MBR */
-       ALLOC_CACHE_ALIGN_BUFFER_PAD(legacy_mbr, p_mbr, 1, dev_desc->blksz);
+       ALLOC_CACHE_ALIGN_BUFFER_PAD(legacy_mbr, p_mbr, 1, desc->blksz);
        if (p_mbr == NULL) {
                log_debug("calloc failed!\n");
                return -ENOMEM;
        }
 
        /* Read MBR to backup boot code if it exists */
-       if (blk_dread(dev_desc, 0, 1, p_mbr) != 1) {
+       if (blk_dread(desc, 0, 1, p_mbr) != 1) {
                log_debug("** Can't read from device %d **\n",
-                         dev_desc->devnum);
+                         desc->devnum);
                return -EIO;
        }
 
@@ -348,27 +353,26 @@ static int set_protective_mbr(struct blk_desc *dev_desc)
        p_mbr->signature = MSDOS_MBR_SIGNATURE;
        p_mbr->partition_record[0].sys_ind = EFI_PMBR_OSTYPE_EFI_GPT;
        p_mbr->partition_record[0].start_sect = 1;
-       p_mbr->partition_record[0].nr_sects = (u32) dev_desc->lba - 1;
+       p_mbr->partition_record[0].nr_sects = (u32)desc->lba - 1;
 
        /* Write MBR sector to the MMC device */
-       if (blk_dwrite(dev_desc, 0, 1, p_mbr) != 1) {
-               log_debug("** Can't write to device %d **\n", dev_desc->devnum);
+       if (blk_dwrite(desc, 0, 1, p_mbr) != 1) {
+               log_debug("** Can't write to device %d **\n", desc->devnum);
                return -EIO;
        }
 
        return 0;
 }
 
-int write_gpt_table(struct blk_desc *dev_desc,
-               gpt_header *gpt_h, gpt_entry *gpt_e)
+int write_gpt_table(struct blk_desc *desc, gpt_header *gpt_h, gpt_entry *gpt_e)
 {
        const int pte_blk_cnt = BLOCK_CNT((gpt_h->num_partition_entries
-                                          * sizeof(gpt_entry)), dev_desc);
+                                          * sizeof(gpt_entry)), desc);
        u32 calc_crc32;
 
-       debug("max lba: %x\n", (u32) dev_desc->lba);
+       debug("max lba: %x\n", (u32)desc->lba);
        /* Setup the Protective MBR */
-       if (set_protective_mbr(dev_desc) < 0)
+       if (set_protective_mbr(desc) < 0)
                goto err;
 
        /* Generate CRC for the Primary GPT Header */
@@ -382,20 +386,20 @@ int write_gpt_table(struct blk_desc *dev_desc,
        gpt_h->header_crc32 = cpu_to_le32(calc_crc32);
 
        /* Write the First GPT to the block right after the Legacy MBR */
-       if (blk_dwrite(dev_desc, 1, 1, gpt_h) != 1)
+       if (blk_dwrite(desc, 1, 1, gpt_h) != 1)
                goto err;
 
-       if (blk_dwrite(dev_desc, le64_to_cpu(gpt_h->partition_entry_lba),
+       if (blk_dwrite(desc, le64_to_cpu(gpt_h->partition_entry_lba),
                       pte_blk_cnt, gpt_e) != pte_blk_cnt)
                goto err;
 
        prepare_backup_gpt_header(gpt_h);
 
-       if (blk_dwrite(dev_desc, (lbaint_t)le64_to_cpu(gpt_h->last_usable_lba)
+       if (blk_dwrite(desc, (lbaint_t)le64_to_cpu(gpt_h->last_usable_lba)
                       + 1, pte_blk_cnt, gpt_e) != pte_blk_cnt)
                goto err;
 
-       if (blk_dwrite(dev_desc, (lbaint_t)le64_to_cpu(gpt_h->my_lba), 1,
+       if (blk_dwrite(desc, (lbaint_t)le64_to_cpu(gpt_h->my_lba), 1,
                       gpt_h) != 1)
                goto err;
 
@@ -403,11 +407,11 @@ int write_gpt_table(struct blk_desc *dev_desc,
        return 0;
 
  err:
-       log_debug("** Can't write to device %d **\n", dev_desc->devnum);
+       log_debug("** Can't write to device %d **\n", desc->devnum);
        return -EIO;
 }
 
-int gpt_fill_pte(struct blk_desc *dev_desc,
+int gpt_fill_pte(struct blk_desc *desc,
                 gpt_header *gpt_h, gpt_entry *gpt_e,
                 struct disk_partition *partitions, int parts)
 {
@@ -416,10 +420,7 @@ int gpt_fill_pte(struct blk_desc *dev_desc,
                        le64_to_cpu(gpt_h->last_usable_lba);
        int i, k;
        size_t efiname_len, dosname_len;
-#if CONFIG_IS_ENABLED(PARTITION_UUIDS)
-       char *str_uuid;
        unsigned char *bin_uuid;
-#endif
 #ifdef CONFIG_PARTITION_TYPE_GUID
        char *str_type_guid;
        unsigned char *bin_type_guid;
@@ -430,7 +431,7 @@ int gpt_fill_pte(struct blk_desc *dev_desc,
        size_t pte_start = gpt_h->partition_entry_lba;
        size_t pte_end = pte_start +
                gpt_h->num_partition_entries * gpt_h->sizeof_partition_entry /
-               dev_desc->blksz;
+               desc->blksz;
 
        for (i = 0; i < parts; i++) {
                /* partition starting lba */
@@ -488,16 +489,19 @@ int gpt_fill_pte(struct blk_desc *dev_desc,
                        &partition_basic_data_guid, 16);
 #endif
 
-#if CONFIG_IS_ENABLED(PARTITION_UUIDS)
-               str_uuid = partitions[i].uuid;
-               bin_uuid = gpt_e[i].unique_partition_guid.b;
+               if (CONFIG_IS_ENABLED(PARTITION_UUIDS)) {
+                       const char *str_uuid;
 
-               if (uuid_str_to_bin(str_uuid, bin_uuid, UUID_STR_FORMAT_GUID)) {
-                       log_debug("Partition no. %d: invalid guid: %s\n",
-                                 i, str_uuid);
-                       return -EINVAL;
+                       str_uuid = disk_partition_uuid(&partitions[i]);
+                       bin_uuid = gpt_e[i].unique_partition_guid.b;
+
+                       if (uuid_str_to_bin(str_uuid, bin_uuid,
+                                           UUID_STR_FORMAT_GUID)) {
+                               log_debug("Partition no. %d: invalid guid: %s\n",
+                                         i, str_uuid);
+                               return -EINVAL;
+                       }
                }
-#endif
 
                /* partition attributes */
                memset(&gpt_e[i].attributes, 0,
@@ -527,7 +531,7 @@ int gpt_fill_pte(struct blk_desc *dev_desc,
        return 0;
 }
 
-static uint32_t partition_entries_offset(struct blk_desc *dev_desc)
+static uint32_t partition_entries_offset(struct blk_desc *desc)
 {
        uint32_t offset_blks = 2;
        uint32_t __maybe_unused offset_bytes;
@@ -543,8 +547,8 @@ static uint32_t partition_entries_offset(struct blk_desc *dev_desc)
         * CONFIG_EFI_PARTITION_ENTRIES_OFF.
         */
        offset_bytes =
-               PAD_TO_BLOCKSIZE(CONFIG_EFI_PARTITION_ENTRIES_OFF, dev_desc);
-       offset_blks = offset_bytes / dev_desc->blksz;
+               PAD_TO_BLOCKSIZE(CONFIG_EFI_PARTITION_ENTRIES_OFF, desc);
+       offset_blks = offset_bytes / desc->blksz;
 #endif
 
 #if defined(CONFIG_OF_CONTROL)
@@ -556,8 +560,8 @@ static uint32_t partition_entries_offset(struct blk_desc *dev_desc)
        config_offset = ofnode_conf_read_int(
                "u-boot,efi-partition-entries-offset", -EINVAL);
        if (config_offset != -EINVAL) {
-               offset_bytes = PAD_TO_BLOCKSIZE(config_offset, dev_desc);
-               offset_blks = offset_bytes / dev_desc->blksz;
+               offset_bytes = PAD_TO_BLOCKSIZE(config_offset, desc);
+               offset_blks = offset_bytes / desc->blksz;
        }
 #endif
 
@@ -573,17 +577,17 @@ static uint32_t partition_entries_offset(struct blk_desc *dev_desc)
        return offset_blks;
 }
 
-int gpt_fill_header(struct blk_desc *dev_desc, gpt_header *gpt_h,
-               char *str_guid, int parts_count)
+int gpt_fill_header(struct blk_desc *desc, gpt_header *gpt_h, char *str_guid,
+                   int parts_count)
 {
        gpt_h->signature = cpu_to_le64(GPT_HEADER_SIGNATURE_UBOOT);
        gpt_h->revision = cpu_to_le32(GPT_HEADER_REVISION_V1);
        gpt_h->header_size = cpu_to_le32(sizeof(gpt_header));
        gpt_h->my_lba = cpu_to_le64(1);
-       gpt_h->alternate_lba = cpu_to_le64(dev_desc->lba - 1);
-       gpt_h->last_usable_lba = cpu_to_le64(dev_desc->lba - 34);
+       gpt_h->alternate_lba = cpu_to_le64(desc->lba - 1);
+       gpt_h->last_usable_lba = cpu_to_le64(desc->lba - 34);
        gpt_h->partition_entry_lba =
-               cpu_to_le64(partition_entries_offset(dev_desc));
+               cpu_to_le64(partition_entries_offset(desc));
        gpt_h->first_usable_lba =
                cpu_to_le64(le64_to_cpu(gpt_h->partition_entry_lba) + 32);
        gpt_h->num_partition_entries = cpu_to_le32(GPT_ENTRY_NUMBERS);
@@ -597,14 +601,14 @@ int gpt_fill_header(struct blk_desc *dev_desc, gpt_header *gpt_h,
        return 0;
 }
 
-int gpt_restore(struct blk_desc *dev_desc, char *str_disk_guid,
+int gpt_restore(struct blk_desc *desc, char *str_disk_guid,
                struct disk_partition *partitions, int parts_count)
 {
        gpt_header *gpt_h;
        gpt_entry *gpt_e;
        int ret, size;
 
-       size = PAD_TO_BLOCKSIZE(sizeof(gpt_header), dev_desc);
+       size = PAD_TO_BLOCKSIZE(sizeof(gpt_header), desc);
        gpt_h = malloc_cache_aligned(size);
        if (gpt_h == NULL) {
                log_debug("calloc failed!\n");
@@ -613,7 +617,7 @@ int gpt_restore(struct blk_desc *dev_desc, char *str_disk_guid,
        memset(gpt_h, 0, size);
 
        size = PAD_TO_BLOCKSIZE(GPT_ENTRY_NUMBERS * sizeof(gpt_entry),
-                               dev_desc);
+                               desc);
        gpt_e = malloc_cache_aligned(size);
        if (gpt_e == NULL) {
                log_debug("calloc failed!\n");
@@ -623,17 +627,17 @@ int gpt_restore(struct blk_desc *dev_desc, char *str_disk_guid,
        memset(gpt_e, 0, size);
 
        /* Generate Primary GPT header (LBA1) */
-       ret = gpt_fill_header(dev_desc, gpt_h, str_disk_guid, parts_count);
+       ret = gpt_fill_header(desc, gpt_h, str_disk_guid, parts_count);
        if (ret)
                goto err;
 
        /* Generate partition entries */
-       ret = gpt_fill_pte(dev_desc, gpt_h, gpt_e, partitions, parts_count);
+       ret = gpt_fill_pte(desc, gpt_h, gpt_e, partitions, parts_count);
        if (ret)
                goto err;
 
        /* Write GPT partition table */
-       ret = write_gpt_table(dev_desc, gpt_h, gpt_e);
+       ret = write_gpt_table(desc, gpt_h, gpt_e);
 
 err:
        free(gpt_e);
@@ -664,14 +668,14 @@ static void gpt_convert_efi_name_to_char(char *s, void *es, int n)
        }
 }
 
-int gpt_verify_headers(struct blk_desc *dev_desc, gpt_header *gpt_head,
+int gpt_verify_headers(struct blk_desc *desc, gpt_header *gpt_head,
                       gpt_entry **gpt_pte)
 {
        /*
         * This function validates AND
         * fills in the GPT header and PTE
         */
-       if (is_gpt_valid(dev_desc,
+       if (is_gpt_valid(desc,
                         GPT_PRIMARY_PARTITION_TABLE_LBA,
                         gpt_head, gpt_pte) != 1) {
                log_debug("Invalid GPT\n");
@@ -684,12 +688,12 @@ int gpt_verify_headers(struct blk_desc *dev_desc, gpt_header *gpt_head,
        /*
         * Check that the alternate_lba entry points to the last LBA
         */
-       if (le64_to_cpu(gpt_head->alternate_lba) != (dev_desc->lba - 1)) {
+       if (le64_to_cpu(gpt_head->alternate_lba) != (desc->lba - 1)) {
                log_debug("Misplaced Backup GPT\n");
                return -1;
        }
 
-       if (is_gpt_valid(dev_desc, (dev_desc->lba - 1),
+       if (is_gpt_valid(desc, (desc->lba - 1),
                         gpt_head, gpt_pte) != 1) {
                log_debug("Invalid Backup GPT\n");
                return -1;
@@ -698,7 +702,7 @@ int gpt_verify_headers(struct blk_desc *dev_desc, gpt_header *gpt_head,
        return 0;
 }
 
-static void restore_primary_gpt_header(gpt_header *gpt_h, struct blk_desc *dev_desc)
+static void restore_primary_gpt_header(gpt_header *gpt_h, struct blk_desc *desc)
 {
        u32 calc_crc32;
        u64 val;
@@ -707,7 +711,7 @@ static void restore_primary_gpt_header(gpt_header *gpt_h, struct blk_desc *dev_d
        val = le64_to_cpu(gpt_h->my_lba);
        gpt_h->my_lba = gpt_h->alternate_lba;
        gpt_h->alternate_lba = cpu_to_le64(val);
-       gpt_h->partition_entry_lba = cpu_to_le64(partition_entries_offset(dev_desc));
+       gpt_h->partition_entry_lba = cpu_to_le64(partition_entries_offset(desc));
 
        gpt_h->header_crc32 = 0;
 
@@ -716,22 +720,22 @@ static void restore_primary_gpt_header(gpt_header *gpt_h, struct blk_desc *dev_d
        gpt_h->header_crc32 = cpu_to_le32(calc_crc32);
 }
 
-static int write_one_gpt_table(struct blk_desc *dev_desc,
-                              gpt_header *gpt_h, gpt_entry *gpt_e)
+static int write_one_gpt_table(struct blk_desc *desc, gpt_header *gpt_h,
+                              gpt_entry *gpt_e)
 {
        const int pte_blk_cnt = BLOCK_CNT((gpt_h->num_partition_entries
-                                          * sizeof(gpt_entry)), dev_desc);
+                                          * sizeof(gpt_entry)), desc);
        lbaint_t start;
        int ret = 0;
 
        start = le64_to_cpu(gpt_h->my_lba);
-       if (blk_dwrite(dev_desc, start, 1, gpt_h) != 1) {
+       if (blk_dwrite(desc, start, 1, gpt_h) != 1) {
                ret = -1;
                goto out;
        }
 
        start = le64_to_cpu(gpt_h->partition_entry_lba);
-       if (blk_dwrite(dev_desc, start, pte_blk_cnt, gpt_e) != pte_blk_cnt) {
+       if (blk_dwrite(desc, start, pte_blk_cnt, gpt_e) != pte_blk_cnt) {
                ret = -1;
                goto out;
        }
@@ -740,17 +744,17 @@ static int write_one_gpt_table(struct blk_desc *dev_desc,
        return ret;
 }
 
-int gpt_repair_headers(struct blk_desc *dev_desc)
+int gpt_repair_headers(struct blk_desc *desc)
 {
-       ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_h1, 1, dev_desc->blksz);
-       ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_h2, 1, dev_desc->blksz);
+       ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_h1, 1, desc->blksz);
+       ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_h2, 1, desc->blksz);
        gpt_entry *gpt_e1 = NULL, *gpt_e2 = NULL;
        int is_gpt1_valid, is_gpt2_valid;
        int ret = -1;
 
-       is_gpt1_valid = is_gpt_valid(dev_desc, GPT_PRIMARY_PARTITION_TABLE_LBA,
+       is_gpt1_valid = is_gpt_valid(desc, GPT_PRIMARY_PARTITION_TABLE_LBA,
                                     gpt_h1, &gpt_e1);
-       is_gpt2_valid = is_gpt_valid(dev_desc, dev_desc->lba - 1,
+       is_gpt2_valid = is_gpt_valid(desc, desc->lba - 1,
                                     gpt_h2, &gpt_e2);
 
        if (is_gpt1_valid && is_gpt2_valid) {
@@ -760,13 +764,13 @@ int gpt_repair_headers(struct blk_desc *dev_desc)
 
        if (is_gpt1_valid && !is_gpt2_valid) {
                prepare_backup_gpt_header(gpt_h1);
-               ret = write_one_gpt_table(dev_desc, gpt_h1, gpt_e1);
+               ret = write_one_gpt_table(desc, gpt_h1, gpt_e1);
                goto out;
        }
 
        if (!is_gpt1_valid && is_gpt2_valid) {
-               restore_primary_gpt_header(gpt_h2, dev_desc);
-               ret = write_one_gpt_table(dev_desc, gpt_h2, gpt_e2);
+               restore_primary_gpt_header(gpt_h2, desc);
+               ret = write_one_gpt_table(desc, gpt_h2, gpt_e2);
                goto out;
        }
 
@@ -784,7 +788,7 @@ int gpt_repair_headers(struct blk_desc *dev_desc)
        return ret;
 }
 
-int gpt_verify_partitions(struct blk_desc *dev_desc,
+int gpt_verify_partitions(struct blk_desc *desc,
                          struct disk_partition *partitions, int parts,
                          gpt_header *gpt_head, gpt_entry **gpt_pte)
 {
@@ -793,7 +797,7 @@ int gpt_verify_partitions(struct blk_desc *dev_desc,
        gpt_entry *gpt_e;
        int ret, i;
 
-       ret = gpt_verify_headers(dev_desc, gpt_head, gpt_pte);
+       ret = gpt_verify_headers(desc, gpt_head, gpt_pte);
        if (ret)
                return ret;
 
@@ -862,28 +866,27 @@ int gpt_verify_partitions(struct blk_desc *dev_desc,
        return 0;
 }
 
-int is_valid_gpt_buf(struct blk_desc *dev_desc, void *buf)
+int is_valid_gpt_buf(struct blk_desc *desc, void *buf)
 {
        gpt_header *gpt_h;
        gpt_entry *gpt_e;
 
        /* determine start of GPT Header in the buffer */
-       gpt_h = buf + (GPT_PRIMARY_PARTITION_TABLE_LBA *
-                      dev_desc->blksz);
+       gpt_h = buf + (GPT_PRIMARY_PARTITION_TABLE_LBA * desc->blksz);
        if (validate_gpt_header(gpt_h, GPT_PRIMARY_PARTITION_TABLE_LBA,
-                               dev_desc->lba))
+                               desc->lba))
                return -1;
 
        /* determine start of GPT Entries in the buffer */
        gpt_e = buf + (le64_to_cpu(gpt_h->partition_entry_lba) *
-                      dev_desc->blksz);
+                      desc->blksz);
        if (validate_gpt_entries(gpt_h, gpt_e))
                return -1;
 
        return 0;
 }
 
-int write_mbr_and_gpt_partitions(struct blk_desc *dev_desc, void *buf)
+int write_mbr_and_gpt_partitions(struct blk_desc *desc, void *buf)
 {
        gpt_header *gpt_h;
        gpt_entry *gpt_e;
@@ -891,24 +894,22 @@ int write_mbr_and_gpt_partitions(struct blk_desc *dev_desc, void *buf)
        lbaint_t lba;
        int cnt;
 
-       if (is_valid_gpt_buf(dev_desc, buf))
+       if (is_valid_gpt_buf(desc, buf))
                return -1;
 
        /* determine start of GPT Header in the buffer */
-       gpt_h = buf + (GPT_PRIMARY_PARTITION_TABLE_LBA *
-                      dev_desc->blksz);
+       gpt_h = buf + (GPT_PRIMARY_PARTITION_TABLE_LBA * desc->blksz);
 
        /* determine start of GPT Entries in the buffer */
-       gpt_e = buf + (le64_to_cpu(gpt_h->partition_entry_lba) *
-                      dev_desc->blksz);
+       gpt_e = buf + (le64_to_cpu(gpt_h->partition_entry_lba) * desc->blksz);
        gpt_e_blk_cnt = BLOCK_CNT((le32_to_cpu(gpt_h->num_partition_entries) *
                                   le32_to_cpu(gpt_h->sizeof_partition_entry)),
-                                 dev_desc);
+                                 desc);
 
        /* write MBR */
        lba = 0;        /* MBR is always at 0 */
        cnt = 1;        /* MBR (1 block) */
-       if (blk_dwrite(dev_desc, lba, cnt, buf) != cnt) {
+       if (blk_dwrite(desc, lba, cnt, buf) != cnt) {
                log_debug("failed writing '%s' (%d blks at 0x" LBAF ")\n",
                          "MBR", cnt, lba);
                return 1;
@@ -917,7 +918,7 @@ int write_mbr_and_gpt_partitions(struct blk_desc *dev_desc, void *buf)
        /* write Primary GPT */
        lba = GPT_PRIMARY_PARTITION_TABLE_LBA;
        cnt = 1;        /* GPT Header (1 block) */
-       if (blk_dwrite(dev_desc, lba, cnt, gpt_h) != cnt) {
+       if (blk_dwrite(desc, lba, cnt, gpt_h) != cnt) {
                log_debug("failed writing '%s' (%d blks at 0x" LBAF ")\n",
                          "Primary GPT Header", cnt, lba);
                return 1;
@@ -925,7 +926,7 @@ int write_mbr_and_gpt_partitions(struct blk_desc *dev_desc, void *buf)
 
        lba = le64_to_cpu(gpt_h->partition_entry_lba);
        cnt = gpt_e_blk_cnt;
-       if (blk_dwrite(dev_desc, lba, cnt, gpt_e) != cnt) {
+       if (blk_dwrite(desc, lba, cnt, gpt_e) != cnt) {
                log_debug("failed writing '%s' (%d blks at 0x" LBAF ")\n",
                          "Primary GPT Entries", cnt, lba);
                return 1;
@@ -936,7 +937,7 @@ int write_mbr_and_gpt_partitions(struct blk_desc *dev_desc, void *buf)
        /* write Backup GPT */
        lba = le64_to_cpu(gpt_h->partition_entry_lba);
        cnt = gpt_e_blk_cnt;
-       if (blk_dwrite(dev_desc, lba, cnt, gpt_e) != cnt) {
+       if (blk_dwrite(desc, lba, cnt, gpt_e) != cnt) {
                log_debug("failed writing '%s' (%d blks at 0x" LBAF ")\n",
                          "Backup GPT Entries", cnt, lba);
                return 1;
@@ -944,14 +945,14 @@ int write_mbr_and_gpt_partitions(struct blk_desc *dev_desc, void *buf)
 
        lba = le64_to_cpu(gpt_h->my_lba);
        cnt = 1;        /* GPT Header (1 block) */
-       if (blk_dwrite(dev_desc, lba, cnt, gpt_h) != cnt) {
+       if (blk_dwrite(desc, lba, cnt, gpt_h) != cnt) {
                log_debug("failed writing '%s' (%d blks at 0x" LBAF ")\n",
                          "Backup GPT Header", cnt, lba);
                return 1;
        }
 
        /* Update the partition table entries*/
-       part_init(dev_desc);
+       part_init(desc);
 
        return 0;
 }
@@ -978,17 +979,23 @@ static int pmbr_part_valid(struct partition *part)
 /*
  * is_pmbr_valid(): test Protective MBR for validity
  *
+ * @mbr: Pointer to Master Boot-Record data
+ *
  * Returns: 1 if PMBR is valid, 0 otherwise.
  * Validity depends on two things:
  *  1) MSDOS signature is in the last two bytes of the MBR
  *  2) One partition of type 0xEE is found, checked by pmbr_part_valid()
  */
-static int is_pmbr_valid(legacy_mbr * mbr)
+static int is_pmbr_valid(legacy_mbr *mbr)
 {
+       uint sig = le16_to_cpu(mbr->signature);
        int i = 0;
 
-       if (!mbr || le16_to_cpu(mbr->signature) != MSDOS_MBR_SIGNATURE)
+       if (sig != MSDOS_MBR_SIGNATURE) {
+               log_debug("Invalid signature %x\n", sig);
                return 0;
+       }
+       log_debug("Signature %x valid\n", sig);
 
        for (i = 0; i < 4; i++) {
                if (pmbr_part_valid(&mbr->partition_record[i])) {
@@ -1008,25 +1015,25 @@ static int is_pmbr_valid(legacy_mbr * mbr)
  * Description: returns 1 if valid,  0 on error, 2 if ignored header
  * If valid, returns pointers to PTEs.
  */
-static int is_gpt_valid(struct blk_desc *dev_desc, u64 lba,
-                       gpt_header *pgpt_head, gpt_entry **pgpt_pte)
+static int is_gpt_valid(struct blk_desc *desc, u64 lba, gpt_header *pgpt_head,
+                       gpt_entry **pgpt_pte)
 {
        /* Confirm valid arguments prior to allocation. */
-       if (!dev_desc || !pgpt_head) {
+       if (!desc || !pgpt_head) {
                log_debug("Invalid Argument(s)\n");
                return 0;
        }
 
-       ALLOC_CACHE_ALIGN_BUFFER_PAD(legacy_mbr, mbr, 1, dev_desc->blksz);
+       ALLOC_CACHE_ALIGN_BUFFER_PAD(legacy_mbr, mbr, 1, desc->blksz);
 
        /* Read MBR Header from device */
-       if (blk_dread(dev_desc, 0, 1, (ulong *)mbr) != 1) {
+       if (blk_dread(desc, 0, 1, (ulong *)mbr) != 1) {
                log_debug("Can't read MBR header\n");
                return 0;
        }
 
        /* Read GPT Header from device */
-       if (blk_dread(dev_desc, (lbaint_t)lba, 1, pgpt_head) != 1) {
+       if (blk_dread(desc, (lbaint_t)lba, 1, pgpt_head) != 1) {
                log_debug("Can't read GPT header\n");
                return 0;
        }
@@ -1037,23 +1044,23 @@ static int is_gpt_valid(struct blk_desc *dev_desc, u64 lba,
                return 2;
        }
 
-       if (validate_gpt_header(pgpt_head, (lbaint_t)lba, dev_desc->lba))
+       if (validate_gpt_header(pgpt_head, (lbaint_t)lba, desc->lba))
                return 0;
 
-       if (dev_desc->sig_type == SIG_TYPE_NONE) {
+       if (desc->sig_type == SIG_TYPE_NONE) {
                efi_guid_t empty = {};
                if (memcmp(&pgpt_head->disk_guid, &empty, sizeof(empty))) {
-                       dev_desc->sig_type = SIG_TYPE_GUID;
-                       memcpy(&dev_desc->guid_sig, &pgpt_head->disk_guid,
-                             sizeof(empty));
+                       desc->sig_type = SIG_TYPE_GUID;
+                       memcpy(&desc->guid_sig, &pgpt_head->disk_guid,
+                              sizeof(empty));
                } else if (mbr->unique_mbr_signature != 0) {
-                       dev_desc->sig_type = SIG_TYPE_MBR;
-                       dev_desc->mbr_sig = mbr->unique_mbr_signature;
+                       desc->sig_type = SIG_TYPE_MBR;
+                       desc->mbr_sig = mbr->unique_mbr_signature;
                }
        }
 
        /* Read and allocate Partition Table Entries */
-       *pgpt_pte = alloc_read_gpt_entries(dev_desc, pgpt_head);
+       *pgpt_pte = alloc_read_gpt_entries(desc, pgpt_head);
        if (!*pgpt_pte)
                return 0;
 
@@ -1075,20 +1082,20 @@ static int is_gpt_valid(struct blk_desc *dev_desc, u64 lba,
  * Description: returns 1 if found a valid gpt,  0 on error.
  * If valid, returns pointers to PTEs.
  */
-static int find_valid_gpt(struct blk_desc *dev_desc, gpt_header *gpt_head,
+static int find_valid_gpt(struct blk_desc *desc, gpt_header *gpt_head,
                          gpt_entry **pgpt_pte)
 {
        int r;
 
-       r = is_gpt_valid(dev_desc, GPT_PRIMARY_PARTITION_TABLE_LBA, gpt_head,
+       r = is_gpt_valid(desc, GPT_PRIMARY_PARTITION_TABLE_LBA, gpt_head,
                         pgpt_pte);
 
        if (r != 1) {
                if (r != 2)
                        log_debug("Invalid GPT\n");
 
-               if (is_gpt_valid(dev_desc, (dev_desc->lba - 1), gpt_head,
-                                pgpt_pte) != 1) {
+               if (is_gpt_valid(desc, desc->lba - 1, gpt_head, pgpt_pte)
+                   != 1) {
                        log_debug("Invalid Backup GPT\n");
                        return 0;
                }
@@ -1100,21 +1107,21 @@ static int find_valid_gpt(struct blk_desc *dev_desc, gpt_header *gpt_head,
 
 /**
  * alloc_read_gpt_entries(): reads partition entries from disk
- * @dev_desc
+ * @desc
  * @gpt - GPT header
  *
  * Description: Returns ptes on success,  NULL on error.
  * Allocates space for PTEs based on information found in @gpt.
  * Notes: remember to free pte when you're done!
  */
-static gpt_entry *alloc_read_gpt_entries(struct blk_desc *dev_desc,
+static gpt_entry *alloc_read_gpt_entries(struct blk_desc *desc,
                                         gpt_header *pgpt_head)
 {
        size_t count = 0, blk_cnt;
        lbaint_t blk;
        gpt_entry *pte = NULL;
 
-       if (!dev_desc || !pgpt_head) {
+       if (!desc || !pgpt_head) {
                log_debug("Invalid Argument(s)\n");
                return NULL;
        }
@@ -1130,7 +1137,7 @@ static gpt_entry *alloc_read_gpt_entries(struct blk_desc *dev_desc,
        /* Allocate memory for PTE, remember to FREE */
        if (count != 0) {
                pte = memalign(ARCH_DMA_MINALIGN,
-                              PAD_TO_BLOCKSIZE(count, dev_desc));
+                              PAD_TO_BLOCKSIZE(count, desc));
        }
 
        if (count == 0 || pte == NULL) {
@@ -1141,8 +1148,8 @@ static gpt_entry *alloc_read_gpt_entries(struct blk_desc *dev_desc,
 
        /* Read GPT Entries from device */
        blk = le64_to_cpu(pgpt_head->partition_entry_lba);
-       blk_cnt = BLOCK_CNT(count, dev_desc);
-       if (blk_dread(dev_desc, blk, (lbaint_t)blk_cnt, pte) != blk_cnt) {
+       blk_cnt = BLOCK_CNT(count, desc);
+       if (blk_dread(desc, blk, (lbaint_t)blk_cnt, pte) != blk_cnt) {
                log_debug("Can't read GPT Entries\n");
                free(pte);
                return NULL;
index 4cd619bf46d3386f7bc96711e5d096039b89ec50..6ac6d95be92171929069098e6e5997772d7b7577 100644 (file)
@@ -46,7 +46,7 @@ unsigned long iso_dread(struct blk_desc *block_dev, lbaint_t start,
 }
 
 /* only boot records will be listed as valid partitions */
-int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num,
+int part_get_info_iso_verb(struct blk_desc *desc, int part_num,
                           struct disk_partition *info, int verb)
 {
        int i,offset,entry_num;
@@ -58,23 +58,23 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num,
        iso_val_entry_t *pve = (iso_val_entry_t *)tmpbuf;
        iso_init_def_entry_t *pide;
 
-       if ((dev_desc->blksz != CD_SECTSIZE) && (dev_desc->blksz != 512))
+       if (desc->blksz != CD_SECTSIZE && desc->blksz != 512)
                return -1;
 
        /* the first sector (sector 0x10) must be a primary volume desc */
        blkaddr=PVD_OFFSET;
-       if (iso_dread(dev_desc, PVD_OFFSET, 1, (ulong *)tmpbuf) != 1)
+       if (iso_dread(desc, PVD_OFFSET, 1, (ulong *)tmpbuf) != 1)
                return -1;
        if(ppr->desctype!=0x01) {
                if(verb)
                        printf ("** First descriptor is NOT a primary desc on %d:%d **\n",
-                               dev_desc->devnum, part_num);
+                               desc->devnum, part_num);
                return (-1);
        }
        if(strncmp((char *)ppr->stand_ident,"CD001",5)!=0) {
                if(verb)
                        printf ("** Wrong ISO Ident: %s on %d:%d **\n",
-                               ppr->stand_ident, dev_desc->devnum, part_num);
+                               ppr->stand_ident, desc->devnum, part_num);
                return (-1);
        }
        lastsect = le32_to_cpu(ppr->firstsek_LEpathtab1_LE);
@@ -83,14 +83,14 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num,
        PRINTF(" Lastsect:%08lx\n",lastsect);
        for(i=blkaddr;i<lastsect;i++) {
                PRINTF("Reading block %d\n", i);
-               if (iso_dread(dev_desc, i, 1, (ulong *)tmpbuf) != 1)
+               if (iso_dread(desc, i, 1, (ulong *)tmpbuf) != 1)
                        return -1;
                if(ppr->desctype==0x00)
                        break; /* boot entry found */
                if(ppr->desctype==0xff) {
                        if(verb)
                                printf ("** No valid boot catalog found on %d:%d **\n",
-                                       dev_desc->devnum, part_num);
+                                       desc->devnum, part_num);
                        return (-1);
                }
        }
@@ -98,15 +98,15 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num,
        if(strncmp(pbr->ident_str,"EL TORITO SPECIFICATION",23)!=0) {
                if(verb)
                        printf ("** Wrong El Torito ident: %s on %d:%d **\n",
-                               pbr->ident_str, dev_desc->devnum, part_num);
+                               pbr->ident_str, desc->devnum, part_num);
                return (-1);
        }
        bootaddr = get_unaligned_le32(pbr->pointer);
        PRINTF(" Boot Entry at: %08lX\n",bootaddr);
-       if (iso_dread(dev_desc, bootaddr, 1, (ulong *)tmpbuf) != 1) {
+       if (iso_dread(desc, bootaddr, 1, (ulong *)tmpbuf) != 1) {
                if(verb)
                        printf ("** Can't read Boot Entry at %lX on %d:%d **\n",
-                               bootaddr, dev_desc->devnum, part_num);
+                               bootaddr, desc->devnum, part_num);
                return (-1);
        }
        chksum=0;
@@ -116,20 +116,20 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num,
        if(chksum!=0) {
                if(verb)
                        printf("** Checksum Error in booting catalog validation entry on %d:%d **\n",
-                              dev_desc->devnum, part_num);
+                              desc->devnum, part_num);
                return (-1);
        }
        if((pve->key[0]!=0x55)||(pve->key[1]!=0xAA)) {
                if(verb)
                        printf ("** Key 0x55 0xAA error on %d:%d **\n",
-                               dev_desc->devnum, part_num);
+                               desc->devnum, part_num);
                return(-1);
        }
 #ifdef CHECK_FOR_POWERPC_PLATTFORM
        if(pve->platform!=0x01) {
                if(verb)
                        printf ("** No PowerPC platform CD on %d:%d **\n",
-                               dev_desc->devnum, part_num);
+                               desc->devnum, part_num);
                return(-1);
        }
 #endif
@@ -137,7 +137,7 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num,
        entry_num=1;
        offset=0x20;
        strcpy((char *)info->type, "U-Boot");
-       part_set_generic_name(dev_desc, part_num, (char *)info->name);
+       part_set_generic_name(desc, part_num, (char *)info->name);
        /* the bootcatalog (including validation Entry) is limited to 2048Bytes
         * (63 boot entries + validation entry) */
         while(offset<2048) {
@@ -159,7 +159,7 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num,
                else {
                        if(verb)
                                printf ("** Partition %d not found on device %d **\n",
-                                       part_num, dev_desc->devnum);
+                                       part_num, desc->devnum);
                        return(-1);
                }
        }
@@ -167,13 +167,13 @@ int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num,
         * searched w/o succsess */
        if(verb)
                printf ("** Partition %d not found on device %d **\n",
-                       part_num, dev_desc->devnum);
+                       part_num, desc->devnum);
        return(-1);
 found:
        if(pide->boot_ind!=0x88) {
                if(verb)
                        printf("** Partition %d is not bootable on device %d **\n",
-                              part_num, dev_desc->devnum);
+                              part_num, desc->devnum);
                return (-1);
        }
        switch(pide->boot_media) {
@@ -189,7 +189,7 @@ found:
        newblkaddr = get_unaligned_le32(pide->rel_block_addr);
        info->start=newblkaddr;
 
-       if (dev_desc->blksz == 512) {
+       if (desc->blksz == 512) {
                info->size *= 4;
                info->start *= 4;
                info->blksz = 512;
@@ -199,20 +199,20 @@ found:
        return 0;
 }
 
-static int part_get_info_iso(struct blk_desc *dev_desc, int part_num,
+static int part_get_info_iso(struct blk_desc *desc, int part_num,
                             struct disk_partition *info)
 {
-       return part_get_info_iso_verb(dev_desc, part_num, info, 0);
+       return part_get_info_iso_verb(desc, part_num, info, 0);
 }
 
-static void part_print_iso(struct blk_desc *dev_desc)
+static void part_print_iso(struct blk_desc *desc)
 {
        struct disk_partition info;
        int i;
 
-       if (part_get_info_iso_verb(dev_desc, 1, &info, 0) == -1) {
+       if (part_get_info_iso_verb(desc, 1, &info, 0) == -1) {
                printf("** No boot partition found on device %d **\n",
-                      dev_desc->devnum);
+                      desc->devnum);
                return;
        }
        printf("Part   Start     Sect x Size Type\n");
@@ -221,14 +221,14 @@ static void part_print_iso(struct blk_desc *dev_desc)
                printf(" %2d %8" LBAFlength "u %8" LBAFlength "u %6ld %.32s\n",
                       i, info.start, info.size, info.blksz, info.type);
                i++;
-       } while (part_get_info_iso_verb(dev_desc, i, &info, 0) != -1);
+       } while (part_get_info_iso_verb(desc, i, &info, 0) != -1);
 }
 
-static int part_test_iso(struct blk_desc *dev_desc)
+static int part_test_iso(struct blk_desc *desc)
 {
        struct disk_partition info;
 
-       return part_get_info_iso_verb(dev_desc, 1, &info, 0);
+       return part_get_info_iso_verb(desc, 1, &info, 0);
 }
 
 U_BOOT_PART_TYPE(iso) = {
index ae8263f755ae7e761edbdd466611a168acc03abc..db5e203be59257a4bb9d011cbd2fe93efaf45a09 100644 (file)
@@ -31,21 +31,20 @@ extern ldiv_t ldiv (long int __numer, long int __denom);
 #endif
 
 
-static int part_mac_read_ddb(struct blk_desc *dev_desc,
-                            mac_driver_desc_t *ddb_p);
-static int part_mac_read_pdb(struct blk_desc *dev_desc, int part,
+static int part_mac_read_ddb(struct blk_desc *desc, mac_driver_desc_t *ddb_p);
+static int part_mac_read_pdb(struct blk_desc *desc, int part,
                             mac_partition_t *pdb_p);
 
 /*
  * Test for a valid MAC partition
  */
-static int part_test_mac(struct blk_desc *dev_desc)
+static int part_test_mac(struct blk_desc *desc)
 {
        ALLOC_CACHE_ALIGN_BUFFER(mac_driver_desc_t, ddesc, 1);
        ALLOC_CACHE_ALIGN_BUFFER(mac_partition_t, mpart, 1);
        ulong i, n;
 
-       if (part_mac_read_ddb (dev_desc, ddesc)) {
+       if (part_mac_read_ddb(desc, ddesc)) {
                /*
                 * error reading Driver Descriptor Block,
                 * or no valid Signature
@@ -55,8 +54,8 @@ static int part_test_mac(struct blk_desc *dev_desc)
 
        n = 1;  /* assuming at least one partition */
        for (i=1; i<=n; ++i) {
-               if ((blk_dread(dev_desc, i, 1, (ulong *)mpart) != 1) ||
-                   (mpart->signature != MAC_PARTITION_MAGIC) ) {
+               if ((blk_dread(desc, i, 1, (ulong *)mpart) != 1) ||
+                   mpart->signature != MAC_PARTITION_MAGIC) {
                        return (-1);
                }
                /* update partition count */
@@ -65,14 +64,14 @@ static int part_test_mac(struct blk_desc *dev_desc)
        return (0);
 }
 
-static void part_print_mac(struct blk_desc *dev_desc)
+static void part_print_mac(struct blk_desc *desc)
 {
        ulong i, n;
        ALLOC_CACHE_ALIGN_BUFFER(mac_driver_desc_t, ddesc, 1);
        ALLOC_CACHE_ALIGN_BUFFER(mac_partition_t, mpart, 1);
        ldiv_t mb, gb;
 
-       if (part_mac_read_ddb (dev_desc, ddesc)) {
+       if (part_mac_read_ddb(desc, ddesc)) {
                /*
                 * error reading Driver Descriptor Block,
                 * or no valid Signature
@@ -110,15 +109,15 @@ static void part_print_mac(struct blk_desc *dev_desc)
                char c;
 
                printf ("%4ld: ", i);
-               if (blk_dread(dev_desc, i, 1, (ulong *)mpart) != 1) {
+               if (blk_dread(desc, i, 1, (ulong *)mpart) != 1) {
                        printf ("** Can't read Partition Map on %d:%ld **\n",
-                               dev_desc->devnum, i);
+                               desc->devnum, i);
                        return;
                }
 
                if (mpart->signature != MAC_PARTITION_MAGIC) {
                        printf("** Bad Signature on %d:%ld - expected 0x%04x, got 0x%04x\n",
-                              dev_desc->devnum, i, MAC_PARTITION_MAGIC,
+                              desc->devnum, i, MAC_PARTITION_MAGIC,
                               mpart->signature);
                        return;
                }
@@ -154,10 +153,9 @@ static void part_print_mac(struct blk_desc *dev_desc)
 /*
  * Read Device Descriptor Block
  */
-static int part_mac_read_ddb(struct blk_desc *dev_desc,
-                            mac_driver_desc_t *ddb_p)
+static int part_mac_read_ddb(struct blk_desc *desc, mac_driver_desc_t *ddb_p)
 {
-       if (blk_dread(dev_desc, 0, 1, (ulong *)ddb_p) != 1) {
+       if (blk_dread(desc, 0, 1, (ulong *)ddb_p) != 1) {
                debug("** Can't read Driver Descriptor Block **\n");
                return (-1);
        }
@@ -171,7 +169,7 @@ static int part_mac_read_ddb(struct blk_desc *dev_desc,
 /*
  * Read Partition Descriptor Block
  */
-static int part_mac_read_pdb(struct blk_desc *dev_desc, int part,
+static int part_mac_read_pdb(struct blk_desc *desc, int part,
                             mac_partition_t *pdb_p)
 {
        int n = 1;
@@ -182,15 +180,15 @@ static int part_mac_read_pdb(struct blk_desc *dev_desc, int part,
                 * partition 1 first since this is the only way to
                 * know how many partitions we have.
                 */
-               if (blk_dread(dev_desc, n, 1, (ulong *)pdb_p) != 1) {
-                       printf ("** Can't read Partition Map on %d:%d **\n",
-                               dev_desc->devnum, n);
+               if (blk_dread(desc, n, 1, (ulong *)pdb_p) != 1) {
+                       printf("** Can't read Partition Map on %d:%d **\n",
+                              desc->devnum, n);
                        return (-1);
                }
 
                if (pdb_p->signature != MAC_PARTITION_MAGIC) {
                        printf("** Bad Signature on %d:%d: expected 0x%04x, got 0x%04x\n",
-                              dev_desc->devnum, n, MAC_PARTITION_MAGIC,
+                              desc->devnum, n, MAC_PARTITION_MAGIC,
                               pdb_p->signature);
                        return (-1);
                }
@@ -199,10 +197,9 @@ static int part_mac_read_pdb(struct blk_desc *dev_desc, int part,
                        return (0);
 
                if ((part < 1) || (part > pdb_p->map_count)) {
-                       printf ("** Invalid partition %d:%d [%d:1...%d:%d only]\n",
-                               dev_desc->devnum, part,
-                               dev_desc->devnum,
-                               dev_desc->devnum, pdb_p->map_count);
+                       printf("** Invalid partition %d:%d [%d:1...%d:%d only]\n",
+                              desc->devnum, part, desc->devnum, desc->devnum,
+                              pdb_p->map_count);
                        return (-1);
                }
 
@@ -213,21 +210,19 @@ static int part_mac_read_pdb(struct blk_desc *dev_desc, int part,
        /* NOTREACHED */
 }
 
-static int part_get_info_mac(struct blk_desc *dev_desc, int part,
-                                 struct disk_partition *info)
+static int part_get_info_mac(struct blk_desc *desc, int part,
+                            struct disk_partition *info)
 {
        ALLOC_CACHE_ALIGN_BUFFER(mac_driver_desc_t, ddesc, 1);
        ALLOC_CACHE_ALIGN_BUFFER(mac_partition_t, mpart, 1);
 
-       if (part_mac_read_ddb (dev_desc, ddesc)) {
-               return (-1);
-       }
+       if (part_mac_read_ddb(desc, ddesc))
+               return -1;
 
        info->blksz = ddesc->blk_size;
 
-       if (part_mac_read_pdb (dev_desc, part, mpart)) {
-               return (-1);
-       }
+       if (part_mac_read_pdb(desc, part, mpart))
+               return -1;
 
        info->start = mpart->start_block;
        info->size  = mpart->block_count;
index b42d924cc66aab50833aae9e1260d123f879017e..78bcc3ee44c040f0d59aa7f5642c92927e55450d 100644 (file)
@@ -67,6 +67,10 @@ Additional persistent U-Boot environment support can be added as follows:
 Additional peripherals that have been tested to work in both U-Boot and Linux
 can be enabled with the following command line parameters:
 
+- To add a video console, remove "-nographic" and add e.g.::
+
+    -serial stdio -device VGA
+
 - To add a Serial ATA disk via an Intel ICH9 AHCI controller, pass e.g.::
 
     -drive if=none,file=disk.img,format=raw,id=mydisk \
@@ -80,6 +84,10 @@ can be enabled with the following command line parameters:
 
     -device usb-ehci,id=ehci
 
+- To add a USB keyboard attached to an emulated xHCI controller, pass e.g.::
+
+    -device qemu-xhci,id=xhci -device usb-kbd,bus=xhci.0
+
 - To add an NVMe disk, pass e.g.::
 
     -drive if=none,file=disk.img,id=mydisk -device nvme,drive=mydisk,serial=foo
@@ -90,6 +98,74 @@ can be enabled with the following command line parameters:
 
 These have been tested in QEMU 2.9.0 but should work in at least 2.5.0 as well.
 
+Booting distros
+---------------
+
+It is possible to install and boot a standard Linux distribution using
+qemu_arm64 by setting up a root disk::
+
+    qemu-img create root.img 20G
+
+then using the installer to install. For example, with Debian 12::
+
+    qemu-system-aarch64 \
+      -machine virt -cpu cortex-a53 -m 4G -smp 4 \
+      -bios u-boot.bin \
+      -serial stdio -device VGA \
+      -nic user,model=virtio-net-pci \
+      -device virtio-rng-pci \
+      -device qemu-xhci,id=xhci \
+      -device usb-kbd -device usb-tablet \
+      -drive if=virtio,file=debian-12.0.0-arm64-netinst.iso,format=raw,readonly=on,media=cdrom \
+      -drive if=virtio,file=root.img,format=raw,media=disk
+
+The output will be something like this::
+
+    U-Boot 2023.10-rc2-00075-gbe8fbe718e35 (Aug 11 2023 - 08:38:49 +0000)
+
+    DRAM:  4 GiB
+    Core:  51 devices, 14 uclasses, devicetree: board
+    Flash: 64 MiB
+    Loading Environment from Flash... *** Warning - bad CRC, using default environment
+
+    In:    serial,usbkbd
+    Out:   serial,vidconsole
+    Err:   serial,vidconsole
+    Bus xhci_pci: Register 8001040 NbrPorts 8
+    Starting the controller
+    USB XHCI 1.00
+    scanning bus xhci_pci for devices... 3 USB Device(s) found
+    Net:   eth0: virtio-net#32
+    Hit any key to stop autoboot:  0
+    Scanning for bootflows in all bootdevs
+    Seq  Method       State   Uclass    Part  Name                      Filename
+    ---  -----------  ------  --------  ----  ------------------------  ----------------
+    Scanning global bootmeth 'efi_mgr':
+    Scanning bootdev 'fw-cfg@9020000.bootdev':
+    fatal: no kernel available
+    scanning bus for devices...
+    Scanning bootdev 'virtio-blk#34.bootdev':
+      0  efi          ready   virtio       2  virtio-blk#34.bootdev.par efi/boot/bootaa64.efi
+    ** Booting bootflow 'virtio-blk#34.bootdev.part_2' with efi
+    Using prior-stage device tree
+    Failed to load EFI variables
+    Error: writing contents
+    ** Unable to write file ubootefi.var **
+    Failed to persist EFI variables
+    Missing TPMv2 device for EFI_TCG_PROTOCOL
+    Booting /efi\boot\bootaa64.efi
+    Error: writing contents
+    ** Unable to write file ubootefi.var **
+    Failed to persist EFI variables
+    Welcome to GRUB!
+
+Standard boot looks through various available devices and finds the virtio
+disks, then boots from the first one. After a second or so the grub menu appears
+and you can work through the installer flow normally.
+
+After the installation, you can boot into the installed system by running QEMU
+again without the drive argument corresponding to the installer CD image.
+
 Enabling TPMv2 support
 ----------------------
 
diff --git a/doc/board/ti/am64x_evm.rst b/doc/board/ti/am64x_evm.rst
new file mode 100644 (file)
index 0000000..db27461
--- /dev/null
@@ -0,0 +1,200 @@
+.. SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
+.. sectionauthor:: Nishanth Menon <nm@ti.com>
+
+AM64 Platforms
+==============
+
+Introduction:
+-------------
+The AM642 SoC belongs to the K3 Multicore SoC architecture platform,
+providing advanced system integration to enable applications such as
+Motor Drives, PLC, Remote IO and IoT Gateways.
+
+Some highlights of this SoC are:
+
+* Dual Cortex-A53s in a single cluster, two clusters of dual Cortex-R5F
+  MCUs, and a single Cortex-M4F.
+* Two Gigabit Industrial Communication Subsystems (ICSSG).
+* Integrated Ethernet switch supporting up to a total of two external
+  ports.
+* PCIe-GEN2x1L, USB3/USB2, 2xCAN-FD, eMMC and SD, UFS, OSPI memory
+  controller, QSPI, I2C, eCAP/eQEP, ePWM, ADC, among other
+  peripherals.
+* Centralized System Controller for Security, Power, and Resource
+  Management (DMSC).
+
+More details can be found in the Technical Reference Manual:
+ https://www.ti.com/lit/pdf/spruim2
+
+Platform information:
+
+* AM64-EVM: https://www.ti.com/tool/TMDS64EVM
+* AM64-SK: https://www.ti.com/tool/SK-AM64B
+
+Boot Flow:
+----------
+Below is the pictorial representation of boot flow:
+
+.. image:: img/boot_diagram_am64.svg
+  :alt: Boot flow diagram
+
+- Here TIFS acts as master and provides all the critical services. R5/A53
+  requests TIFS to get these services done as shown in the above diagram.
+
+Sources:
+--------
+
+.. include::  k3.rst
+    :start-after: .. k3_rst_include_start_boot_sources
+    :end-before: .. k3_rst_include_end_boot_sources
+
+Build procedure:
+----------------
+0. Setup the environment variables:
+
+.. include::  k3.rst
+    :start-after: .. k3_rst_include_start_common_env_vars_desc
+    :end-before: .. k3_rst_include_end_common_env_vars_desc
+
+.. include::  k3.rst
+    :start-after: .. k3_rst_include_start_board_env_vars_desc
+    :end-before: .. k3_rst_include_end_board_env_vars_desc
+
+Set the variables corresponding to this platform:
+
+.. include::  k3.rst
+    :start-after: .. k3_rst_include_start_common_env_vars_defn
+    :end-before: .. k3_rst_include_end_common_env_vars_defn
+.. code-block:: bash
+
+ $ export UBOOT_CFG_CORTEXR=am64x_evm_r5_defconfig
+ $ export UBOOT_CFG_CORTEXA=am64x_evm_a53_defconfig
+ $ export TFA_BOARD=lite
+ $ # we dont use any extra TFA parameters
+ $ unset TFA_EXTRA_ARGS
+ $ export OPTEE_PLATFORM=k3-am64x
+ $ # we dont use any extra TFA parameters
+ $ unset OPTEE_EXTRA_ARGS
+
+.. am64x_evm_rst_include_start_build_steps
+
+1. Trusted Firmware-A:
+
+.. include::  k3.rst
+    :start-after: .. k3_rst_include_start_build_steps_tfa
+    :end-before: .. k3_rst_include_end_build_steps_tfa
+
+
+2. OP-TEE:
+
+.. include::  k3.rst
+    :start-after: .. k3_rst_include_start_build_steps_optee
+    :end-before: .. k3_rst_include_end_build_steps_optee
+
+3. U-Boot:
+
+* 3.1 R5:
+
+.. include::  k3.rst
+    :start-after: .. k3_rst_include_start_build_steps_spl_r5
+    :end-before: .. k3_rst_include_end_build_steps_spl_r5
+
+* 3.2 A53:
+
+.. include::  k3.rst
+    :start-after: .. k3_rst_include_start_build_steps_uboot
+    :end-before: .. k3_rst_include_end_build_steps_uboot
+.. am64x_evm_rst_include_end_build_steps
+
+Target Images
+--------------
+In order to boot we need tiboot3.bin, tispl.bin and u-boot.img.  Each SoC
+variant (GP, HS-FS, HS-SE) requires a different source for these files.
+
+ - GP
+
+        * tiboot3-am64x-gp-evm.bin from step 3.1
+        * tispl.bin_unsigned, u-boot.img_unsigned from step 3.2
+
+ - HS-FS
+
+        * tiboot3-am64x-hs-fs-evm.bin from step 3.1
+        * tispl.bin, u-boot.img from step 3.2
+
+ - HS-SE
+
+        * tiboot3-am64x-hs-evm.bin from step 3.1
+        * tispl.bin, u-boot.img from step 3.2
+
+Image formats:
+--------------
+
+- tiboot3.bin
+
+.. image:: img/multi_cert_tiboot3.bin.svg
+  :alt: tiboot3.bin image format
+
+- tispl.bin
+
+.. image:: img/nodm_tispl.bin.svg
+  :alt: tispl.bin image format
+
+Switch Setting for Boot Mode
+----------------------------
+
+Boot Mode pins provide means to select the boot mode and options before the
+device is powered up. After every POR, they are the main source to populate
+the Boot Parameter Tables.
+
+The following table shows some common boot modes used on AM64 platform. More
+details can be found in the Technical Reference Manual:
+https://www.ti.com/lit/pdf/spruim2 under the `Boot Mode Pins` section.
+
+.. list-table:: Boot Modes for AM64x-EVM
+   :widths: 16 16 16
+   :header-rows: 1
+
+   * - Switch Label
+     - SW2: 12345678
+     - SW3: 12345678
+
+   * - SD/MMC
+     - 11000010
+     - 01000000
+
+   * - xSPI/SFDP (OSPI)
+     - 11001110
+     - 01000000
+
+   * - UART
+     - 11011100
+     - 00000000
+
+.. note ::
+
+  For SW2 and SW3, the switch state in the "ON" position = 1.
+
+.. list-table:: Boot Modes for AM64x-SK
+   :widths: 16 16 16
+   :header-rows: 1
+
+   * - Switch Label
+     - SW2: 12345678
+     - SW3: 12345678
+
+   * - SD/MMC
+     - 00000010
+     - 01000011
+
+   * - xSPI/SFDP (OSPI)
+     - 00000010
+     - 01110011
+
+   * - UART
+     - 00000000
+     - 00111011
+
+.. note ::
+
+  For SW2 and SW3, the switch state in the "ON" position = 1.
+  Boot bits on SK is reversed bits to the bootmode signals
diff --git a/doc/board/ti/img/boot_diagram_am64.svg b/doc/board/ti/img/boot_diagram_am64.svg
new file mode 100644 (file)
index 0000000..9c922a5
--- /dev/null
@@ -0,0 +1,1702 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--SPDX-License-Identifier: GPL-2.0-or-later OR BSD-3-Clause-->
+
+<!--Copyright (C) 2023 Texas Instruments Incorporated - https://www.ti.com/-->
+
+<svg
+   version="1.1"
+   width="706px"
+   height="951px"
+   viewBox="-0.5 -0.5 706 951"
+   id="svg356"
+   sodipodi:docname="boot_diagram_am64.svg"
+   inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns:xhtml="http://www.w3.org/1999/xhtml">
+  <sodipodi:namedview
+     id="namedview358"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageshadow="2"
+     inkscape:pageopacity="0.0"
+     inkscape:pagecheckerboard="0"
+     showgrid="false"
+     inkscape:zoom="1.0141889"
+     inkscape:cx="23.664231"
+     inkscape:cy="412.15202"
+     inkscape:window-width="3440"
+     inkscape:window-height="1416"
+     inkscape:window-x="0"
+     inkscape:window-y="0"
+     inkscape:window-maximized="1"
+     inkscape:current-layer="g346" />
+  <defs
+     id="defs2" />
+  <g
+     id="g346">
+    <rect
+       x="235.5"
+       y="50"
+       width="137.5"
+       height="40"
+       rx="6"
+       ry="6"
+       fill="rgb(255, 255, 255)"
+       stroke="rgb(0, 0, 0)"
+       pointer-events="all"
+       id="rect4" />
+    <path
+       d="M 304.25 90 L 304.25 940"
+       fill="none"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       stroke-dasharray="3 3"
+       pointer-events="all"
+       id="path6" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g12">
+      <switch
+         id="switch10">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 136px; height: 1px; padding-top: 70px; margin-left: 237px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 12px; font-family: Verdana; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Cortex-R</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="304"
+           y="74"
+           fill="rgb(0, 0, 0)"
+           font-family="Verdana"
+           font-size="12px"
+           text-anchor="middle"
+           id="text8">Cortex-R</text>
+      </switch>
+    </g>
+    <rect
+       x="298.75"
+       y="160"
+       width="10"
+       height="130"
+       fill="rgb(255, 255, 255)"
+       stroke="rgb(0, 0, 0)"
+       pointer-events="all"
+       id="rect14" />
+    <rect
+       x="301"
+       y="161"
+       width="71.5"
+       height="30"
+       fill="#ffe6cc"
+       stroke="#d79b00"
+       pointer-events="all"
+       id="rect16" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g22">
+      <switch
+         id="switch20">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 70px; height: 1px; padding-top: 176px; margin-left: 302px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">ROM</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="337"
+           y="180"
+           fill="rgb(0, 0, 0)"
+           font-family="Helvetica"
+           font-size="12px"
+           text-anchor="middle"
+           id="text18">ROM</text>
+      </switch>
+    </g>
+    <rect
+       x="299.75"
+       y="305"
+       width="10"
+       height="205"
+       fill="rgb(255, 255, 255)"
+       stroke="rgb(0, 0, 0)"
+       pointer-events="all"
+       id="rect24" />
+    <rect
+       x="302"
+       y="306"
+       width="105.5"
+       height="30"
+       fill="#d5e8d4"
+       stroke="#82b366"
+       pointer-events="all"
+       id="rect26" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g32">
+      <switch
+         id="switch30">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 104px; height: 1px; padding-top: 321px; margin-left: 303px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Cortex-R SPL</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="355"
+           y="325"
+           fill="rgb(0, 0, 0)"
+           font-family="Helvetica"
+           font-size="12px"
+           text-anchor="middle"
+           id="text28">Cortex-R SPL</text>
+      </switch>
+    </g>
+    <rect
+       x="308.75"
+       y="190"
+       width="90"
+       height="40"
+       rx="6"
+       ry="6"
+       fill="none"
+       stroke="rgb(0, 0, 0)"
+       pointer-events="all"
+       id="rect34" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g40">
+      <switch
+         id="switch38">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 88px; height: 1px; padding-top: 210px; margin-left: 310px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Load and auth tiboot3.bin</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="354"
+           y="214"
+           fill="rgb(0, 0, 0)"
+           font-family="Helvetica"
+           font-size="12px"
+           text-anchor="middle"
+           id="text36">Load and auth t...</text>
+      </switch>
+    </g>
+    <rect
+       x="309"
+       y="262"
+       width="90"
+       height="32"
+       rx="4.8"
+       ry="4.8"
+       fill="none"
+       stroke="rgb(0, 0, 0)"
+       pointer-events="all"
+       id="rect42" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g48">
+      <switch
+         id="switch46">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 88px; height: 1px; padding-top: 278px; margin-left: 310px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Load system<xhtml:br />
+
+config data</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="354"
+           y="282"
+           fill="rgb(0, 0, 0)"
+           font-family="Helvetica"
+           font-size="12px"
+           text-anchor="middle"
+           id="text44">Load system...</text>
+      </switch>
+    </g>
+    <rect
+       x="310"
+       y="336"
+       width="90"
+       height="32"
+       rx="4.8"
+       ry="4.8"
+       fill="none"
+       stroke="rgb(0, 0, 0)"
+       pointer-events="all"
+       id="rect50" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g56">
+      <switch
+         id="switch54">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 88px; height: 1px; padding-top: 352px; margin-left: 311px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">DDR Config</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="355"
+           y="356"
+           fill="rgb(0, 0, 0)"
+           font-family="Helvetica"
+           font-size="12px"
+           text-anchor="middle"
+           id="text52">DDR Config</text>
+      </switch>
+    </g>
+    <rect
+       x="310"
+       y="368"
+       width="90"
+       height="32"
+       rx="4.8"
+       ry="4.8"
+       fill="none"
+       stroke="rgb(0, 0, 0)"
+       pointer-events="all"
+       id="rect58" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g64">
+      <switch
+         id="switch62">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 88px; height: 1px; padding-top: 384px; margin-left: 311px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Load tispl.bin</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="355"
+           y="388"
+           fill="rgb(0, 0, 0)"
+           font-family="Helvetica"
+           font-size="12px"
+           text-anchor="middle"
+           id="text60">Load tispl.bin</text>
+      </switch>
+    </g>
+    <rect
+       x="310"
+       y="440"
+       width="90"
+       height="32"
+       rx="4.8"
+       ry="4.8"
+       fill="none"
+       stroke="rgb(0, 0, 0)"
+       pointer-events="all"
+       id="rect66" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g72">
+      <switch
+         id="switch70">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 88px; height: 1px; padding-top: 456px; margin-left: 311px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Start Cortex-A</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="355"
+           y="460"
+           fill="rgb(0, 0, 0)"
+           font-family="Helvetica"
+           font-size="12px"
+           text-anchor="middle"
+           id="text68">Start Cortex-A</text>
+      </switch>
+    </g>
+    <path
+       d="M 299 456 L 139.37 456"
+       fill="none"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="stroke"
+       id="path74" />
+    <path
+       d="M 134.12 456 L 141.12 452.5 L 139.37 456 L 141.12 459.5 Z"
+       fill="rgb(0, 0, 0)"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="all"
+       id="path76" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g82">
+      <switch
+         id="switch80">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 440px; margin-left: 257px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">Start Cortex-A</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="257"
+           y="443"
+           fill="rgb(0, 0, 0)"
+           font-family="Helvetica"
+           font-size="11px"
+           text-anchor="middle"
+           id="text78">Start Cort...</text>
+      </switch>
+    </g>
+    <path
+       d="M 481 601 L 139.37 601"
+       fill="none"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="stroke"
+       id="path84" />
+    <path
+       d="M 134.12 601 L 141.12 597.5 L 139.37 601 L 141.12 604.5 Z"
+       fill="rgb(0, 0, 0)"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="all"
+       id="path86" />
+    <path
+       d="M 481 711 L 139.37 711"
+       fill="none"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="stroke"
+       id="path88" />
+    <path
+       d="M 134.12 711 L 141.12 707.5 L 139.37 711 L 141.12 714.5 Z"
+       fill="rgb(0, 0, 0)"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="all"
+       id="path90" />
+    <path
+       d="M 481 791 L 139.37 791"
+       fill="none"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="stroke"
+       id="path92" />
+    <path
+       d="M 134.12 791 L 141.12 787.5 L 139.37 791 L 141.12 794.5 Z"
+       fill="rgb(0, 0, 0)"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="all"
+       id="path94" />
+    <path
+       d="M 481 879 L 139.37 881.95"
+       fill="none"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="stroke"
+       id="path96" />
+    <path
+       d="M 134.12 881.99 L 141.09 878.43 L 139.37 881.95 L 141.15 885.43 Z"
+       fill="rgb(0, 0, 0)"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="all"
+       id="path98" />
+    <rect
+       x="437"
+       y="50"
+       width="100"
+       height="40"
+       rx="6"
+       ry="6"
+       fill="rgb(255, 255, 255)"
+       stroke="rgb(0, 0, 0)"
+       pointer-events="all"
+       id="rect100" />
+    <path
+       d="M 487 90 L 487 820"
+       fill="none"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       stroke-dasharray="3 3"
+       pointer-events="all"
+       id="path102" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g108">
+      <switch
+         id="switch106">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 98px; height: 1px; padding-top: 70px; margin-left: 438px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 12px; font-family: Verdana; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Cortex-A</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="487"
+           y="74"
+           fill="rgb(0, 0, 0)"
+           font-family="Verdana"
+           font-size="12px"
+           text-anchor="middle"
+           id="text104">Cortex-A</text>
+      </switch>
+    </g>
+    <rect
+       x="482"
+       y="510"
+       width="10"
+       height="70"
+       fill="rgb(255, 255, 255)"
+       stroke="rgb(0, 0, 0)"
+       pointer-events="all"
+       id="rect110" />
+    <path
+       d="M 482 565 L 139.37 565"
+       fill="none"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="stroke"
+       id="path112" />
+    <path
+       d="M 134.12 565 L 141.12 561.5 L 139.37 565 L 141.12 568.5 Z"
+       fill="rgb(0, 0, 0)"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="all"
+       id="path114" />
+    <rect
+       x="577"
+       y="50"
+       width="116.5"
+       height="40"
+       rx="6"
+       ry="6"
+       fill="rgb(255, 255, 255)"
+       stroke="rgb(0, 0, 0)"
+       pointer-events="all"
+       id="rect116" />
+    <path
+       d="M 635.25 90 L 635.25 950"
+       fill="none"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       stroke-dasharray="3 3"
+       pointer-events="all"
+       id="path118" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g124">
+      <switch
+         id="switch122">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 115px; height: 1px; padding-top: 70px; margin-left: 578px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 12px; font-family: Verdana; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Cortex-R/M<xhtml:br />
+
+C6x/C7x</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="635"
+           y="74"
+           fill="rgb(0, 0, 0)"
+           font-family="Verdana"
+           font-size="12px"
+           text-anchor="middle"
+           id="text120">Cortex-R/M...</text>
+      </switch>
+    </g>
+    <rect
+       x="631"
+       y="910"
+       width="10"
+       height="38"
+       fill="rgb(255, 255, 255)"
+       stroke="rgb(0, 0, 0)"
+       pointer-events="all"
+       id="rect126" />
+    <rect
+       x="633"
+       y="912"
+       width="71.5"
+       height="30"
+       fill="#e1d5e7"
+       stroke="#9673a6"
+       pointer-events="all"
+       id="rect128" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g134">
+      <switch
+         id="switch132">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 70px; height: 1px; padding-top: 927px; margin-left: 634px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Aux f/w</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="669"
+           y="931"
+           fill="rgb(0, 0, 0)"
+           font-family="Helvetica"
+           font-size="12px"
+           text-anchor="middle"
+           id="text130">Aux f/w</text>
+      </switch>
+    </g>
+    <rect
+       x="77"
+       y="50"
+       width="100"
+       height="40"
+       rx="6"
+       ry="6"
+       fill="rgb(255, 255, 255)"
+       stroke="rgb(0, 0, 0)"
+       pointer-events="all"
+       id="rect136" />
+    <path
+       d="M 127 90 L 127 940"
+       fill="none"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       stroke-dasharray="3 3"
+       pointer-events="all"
+       id="path138" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g144">
+      <switch
+         id="switch142">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 98px; height: 1px; padding-top: 70px; margin-left: 78px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 12px; font-family: Verdana; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">TIFS/DMSC</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="127"
+           y="74"
+           fill="rgb(0, 0, 0)"
+           font-family="Verdana"
+           font-size="12px"
+           text-anchor="middle"
+           id="text140">TIFS/DMSC</text>
+      </switch>
+    </g>
+    <rect
+       x="122"
+       y="130"
+       width="10"
+       height="110"
+       fill="rgb(255, 255, 255)"
+       stroke="rgb(0, 0, 0)"
+       pointer-events="all"
+       id="rect146" />
+    <rect
+       x="79"
+       y="132"
+       width="50"
+       height="30"
+       fill="#ffe6cc"
+       stroke="#d79b00"
+       pointer-events="all"
+       id="rect148" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g154">
+      <switch
+         id="switch152">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 48px; height: 1px; padding-top: 147px; margin-left: 80px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">ROM</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="104"
+           y="151"
+           fill="rgb(0, 0, 0)"
+           font-family="Helvetica"
+           font-size="12px"
+           text-anchor="middle"
+           id="text150">ROM</text>
+      </switch>
+    </g>
+    <rect
+       x="122"
+       y="253"
+       width="10"
+       height="687"
+       fill="rgb(255, 255, 255)"
+       stroke="rgb(0, 0, 0)"
+       pointer-events="all"
+       id="rect156" />
+    <path
+       d="M 297 238 L 138.37 238"
+       fill="none"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="stroke"
+       id="path158" />
+    <path
+       d="M 133.12 238 L 140.12 234.5 L 138.37 238 L 140.12 241.5 Z"
+       fill="rgb(0, 0, 0)"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="all"
+       id="path160" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g166">
+      <switch
+         id="switch164">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 230px; margin-left: 267px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">Start SYSFW</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="267"
+           y="233"
+           fill="rgb(0, 0, 0)"
+           font-family="Helvetica"
+           font-size="11px"
+           text-anchor="middle"
+           id="text162">Start SYSFW</text>
+      </switch>
+    </g>
+    <rect
+       x="80"
+       y="255"
+       width="50"
+       height="30"
+       fill="#f8cecc"
+       stroke="#b85450"
+       pointer-events="all"
+       id="rect168" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g174">
+      <switch
+         id="switch172">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 48px; height: 1px; padding-top: 270px; margin-left: 81px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">SYSFW</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="105"
+           y="274"
+           fill="rgb(0, 0, 0)"
+           font-family="Helvetica"
+           font-size="12px"
+           text-anchor="middle"
+           id="text170">SYSFW</text>
+      </switch>
+    </g>
+    <path
+       d="M 62 0 L 178 0 L 192 14 L 192 35 L 62 35 L 62 0 Z"
+       fill="rgb(255, 255, 255)"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="all"
+       id="path176" />
+    <path
+       d="M 178 0 L 178 14 L 192 14"
+       fill="none"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="all"
+       id="path178" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g184">
+      <switch
+         id="switch182">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe flex-start; justify-content: unsafe center; width: 128px; height: 1px; padding-top: 1px; margin-left: 63px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 12px; font-family: Verdana; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Security Enclave Boot Processor</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="127"
+           y="13"
+           fill="#000000"
+           font-family="Verdana"
+           font-size="12px"
+           text-anchor="middle"
+           id="text180">Security Enclave Boot...</text>
+      </switch>
+    </g>
+    <path
+       d="M 241 0 L 361 0 L 375 14 L 375 35 L 241 35 L 241 0 Z"
+       fill="rgb(255, 255, 255)"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="all"
+       id="path186" />
+    <path
+       d="M 361 0 L 361 14 L 375 14"
+       fill="none"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="all"
+       id="path188" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g194">
+      <switch
+         id="switch192">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe flex-start; justify-content: unsafe center; width: 132px; height: 1px; padding-top: 1px; margin-left: 242px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 12px; font-family: Verdana; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Boot Loader <xhtml:br />
+
+Processor</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="308"
+           y="13"
+           fill="rgb(0, 0, 0)"
+           font-family="Verdana"
+           font-size="12px"
+           text-anchor="middle"
+           id="text190">Boot Loader...</text>
+      </switch>
+    </g>
+    <path
+       d="M 437 0 L 523 0 L 537 14 L 537 35 L 437 35 L 437 0 Z"
+       fill="rgb(255, 255, 255)"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="all"
+       id="path196" />
+    <path
+       d="M 523 0 L 523 14 L 537 14"
+       fill="none"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="all"
+       id="path198" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g204">
+      <switch
+         id="switch202">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe flex-start; justify-content: unsafe center; width: 98px; height: 1px; padding-top: 1px; margin-left: 438px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 12px; font-family: Verdana; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Main CPU</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="487"
+           y="13"
+           fill="rgb(0, 0, 0)"
+           font-family="Verdana"
+           font-size="12px"
+           text-anchor="middle"
+           id="text200">Main CPU</text>
+      </switch>
+    </g>
+    <path
+       d="M 577 0 L 663 0 L 677 14 L 677 35 L 577 35 L 577 0 Z"
+       fill="rgb(255, 255, 255)"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="all"
+       id="path206" />
+    <path
+       d="M 663 0 L 663 14 L 677 14"
+       fill="none"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="all"
+       id="path208" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g214">
+      <switch
+         id="switch212">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe flex-start; justify-content: unsafe center; width: 98px; height: 1px; padding-top: 1px; margin-left: 578px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 12px; font-family: Verdana; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Auxiliary<xhtml:br />
+
+Processor</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="627"
+           y="13"
+           fill="rgb(0, 0, 0)"
+           font-family="Verdana"
+           font-size="12px"
+           text-anchor="middle"
+           id="text210">Auxiliary...</text>
+      </switch>
+    </g>
+    <path
+       d="M 7 120 L 120.63 120"
+       fill="none"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       stroke-dasharray="12 12"
+       pointer-events="stroke"
+       id="path216" />
+    <path
+       d="M 125.88 120 L 118.88 123.5 L 120.63 120 L 118.88 116.5 Z"
+       fill="rgb(0, 0, 0)"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="all"
+       id="path218" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g224">
+      <switch
+         id="switch222">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe flex-end; justify-content: unsafe flex-start; width: 1px; height: 1px; padding-top: 118px; margin-left: 9px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: left;"
+               data-drawio-colors="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">H/w Seq: Reset rls</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="9"
+           y="118"
+           fill="#000000"
+           font-family="Helvetica"
+           font-size="11px"
+           id="text220">H/w Seq: Reset rls</text>
+      </switch>
+    </g>
+    <path
+       d="M 298 200 L 138.37 199.98"
+       fill="none"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="stroke"
+       id="path226" />
+    <path
+       d="M 133.12 199.98 L 140.12 196.48 L 138.37 199.98 L 140.12 203.48 Z"
+       fill="rgb(0, 0, 0)"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="all"
+       id="path228" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g234">
+      <switch
+         id="switch232">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 190px; margin-left: 257px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">Auth tiboot3.bin</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="257"
+           y="193"
+           fill="rgb(0, 0, 0)"
+           font-family="Helvetica"
+           font-size="11px"
+           text-anchor="middle"
+           id="text230">Auth tiboo...</text>
+      </switch>
+    </g>
+    <path
+       d="M 133 159 L 297.38 159"
+       fill="none"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="stroke"
+       id="path236" />
+    <path
+       d="M 302.63 159 L 295.63 162.5 L 297.38 159 L 295.63 155.5 Z"
+       fill="rgb(0, 0, 0)"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="all"
+       id="path238" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g244">
+      <switch
+         id="switch242">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 150px; margin-left: 177px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">Release Reset</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="177"
+           y="153"
+           fill="rgb(0, 0, 0)"
+           font-family="Helvetica"
+           font-size="11px"
+           text-anchor="middle"
+           id="text240">Release Re...</text>
+      </switch>
+    </g>
+    <path
+       d="M 299 281.94 L 139.37 281.04"
+       fill="none"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="stroke"
+       id="path246" />
+    <path
+       d="M 134.12 281.01 L 141.14 277.55 L 139.37 281.04 L 141.1 284.55 Z"
+       fill="rgb(0, 0, 0)"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="all"
+       id="path248" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g254">
+      <switch
+         id="switch252">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 270px; margin-left: 237px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">Load system config data</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="237"
+           y="273"
+           fill="rgb(0, 0, 0)"
+           font-family="Helvetica"
+           font-size="11px"
+           text-anchor="middle"
+           id="text250">Load syste...</text>
+      </switch>
+    </g>
+    <rect
+       x="308.75"
+       y="230"
+       width="90"
+       height="32"
+       rx="4.8"
+       ry="4.8"
+       fill="none"
+       stroke="rgb(0, 0, 0)"
+       pointer-events="all"
+       id="rect256" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g262">
+      <switch
+         id="switch260">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 88px; height: 1px; padding-top: 246px; margin-left: 310px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Start SYSFW</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="354"
+           y="250"
+           fill="rgb(0, 0, 0)"
+           font-family="Helvetica"
+           font-size="12px"
+           text-anchor="middle"
+           id="text258">Start SYSFW</text>
+      </switch>
+    </g>
+    <path
+       d="M 133 511 L 137 511 L 476.63 511"
+       fill="none"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="stroke"
+       id="path264" />
+    <path
+       d="M 481.88 511 L 474.88 514.5 L 476.63 511 L 474.88 507.5 Z"
+       fill="rgb(0, 0, 0)"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="all"
+       id="path266" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g272">
+      <switch
+         id="switch270">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 500px; margin-left: 177px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">Release Reset</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="177"
+           y="503"
+           fill="rgb(0, 0, 0)"
+           font-family="Helvetica"
+           font-size="11px"
+           text-anchor="middle"
+           id="text268">Release Re...</text>
+      </switch>
+    </g>
+    <rect
+       x="484"
+       y="513"
+       width="71.5"
+       height="30"
+       fill="#d5e8d4"
+       stroke="#82b366"
+       pointer-events="all"
+       id="rect274" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g280">
+      <switch
+         id="switch278">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 70px; height: 1px; padding-top: 528px; margin-left: 485px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">TF-A</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="520"
+           y="532"
+           fill="rgb(0, 0, 0)"
+           font-family="Helvetica"
+           font-size="12px"
+           text-anchor="middle"
+           id="text276">TF-A</text>
+      </switch>
+    </g>
+    <rect
+       x="482"
+       y="581"
+       width="10"
+       height="70"
+       fill="rgb(255, 255, 255)"
+       stroke="rgb(0, 0, 0)"
+       pointer-events="all"
+       id="rect282" />
+    <rect
+       x="484"
+       y="584"
+       width="71.5"
+       height="30"
+       fill="#d5e8d4"
+       stroke="#82b366"
+       pointer-events="all"
+       id="rect284" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g290">
+      <switch
+         id="switch288">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 70px; height: 1px; padding-top: 599px; margin-left: 485px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">OP-TEE</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="520"
+           y="603"
+           fill="rgb(0, 0, 0)"
+           font-family="Helvetica"
+           font-size="12px"
+           text-anchor="middle"
+           id="text286">OP-TEE</text>
+      </switch>
+    </g>
+    <rect
+       x="482"
+       y="662"
+       width="10"
+       height="78"
+       fill="rgb(255, 255, 255)"
+       stroke="rgb(0, 0, 0)"
+       pointer-events="all"
+       id="rect292" />
+    <rect
+       x="484"
+       y="665"
+       width="83"
+       height="30"
+       fill="#d5e8d4"
+       stroke="#82b366"
+       pointer-events="all"
+       id="rect294" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g300">
+      <switch
+         id="switch298">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 81px; height: 1px; padding-top: 680px; margin-left: 485px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Cortex A SPL</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="526"
+           y="684"
+           fill="rgb(0, 0, 0)"
+           font-family="Helvetica"
+           font-size="12px"
+           text-anchor="middle"
+           id="text296">Cortex A SPL</text>
+      </switch>
+    </g>
+    <rect
+       x="482"
+       y="748"
+       width="10"
+       height="192"
+       fill="rgb(255, 255, 255)"
+       stroke="rgb(0, 0, 0)"
+       pointer-events="all"
+       id="rect302" />
+    <rect
+       x="484"
+       y="751"
+       width="83"
+       height="30"
+       fill="#d5e8d4"
+       stroke="#82b366"
+       pointer-events="all"
+       id="rect304" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g310">
+      <switch
+         id="switch308">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 81px; height: 1px; padding-top: 766px; margin-left: 485px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">U-Boot</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="526"
+           y="770"
+           fill="rgb(0, 0, 0)"
+           font-family="Helvetica"
+           font-size="12px"
+           text-anchor="middle"
+           id="text306">U-Boot</text>
+      </switch>
+    </g>
+    <rect
+       x="492"
+       y="700"
+       width="103"
+       height="32"
+       rx="4.8"
+       ry="4.8"
+       fill="none"
+       stroke="rgb(0, 0, 0)"
+       pointer-events="all"
+       id="rect312" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g318">
+      <switch
+         id="switch316">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 101px; height: 1px; padding-top: 716px; margin-left: 493px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Load u-boot.img</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="544"
+           y="720"
+           fill="rgb(0, 0, 0)"
+           font-family="Helvetica"
+           font-size="12px"
+           text-anchor="middle"
+           id="text314">Load u-boot.img</text>
+      </switch>
+    </g>
+    <rect
+       x="492"
+       y="820"
+       width="103"
+       height="32"
+       rx="4.8"
+       ry="4.8"
+       fill="none"
+       stroke="rgb(0, 0, 0)"
+       pointer-events="all"
+       id="rect320" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g326">
+      <switch
+         id="switch324">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 101px; height: 1px; padding-top: 836px; margin-left: 493px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Load Aux core f/w<xhtml:br />
+
+(optional)</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="544"
+           y="840"
+           fill="rgb(0, 0, 0)"
+           font-family="Helvetica"
+           font-size="12px"
+           text-anchor="middle"
+           id="text322">Load Aux core f/w...</text>
+      </switch>
+    </g>
+    <rect
+       x="492"
+       y="860"
+       width="103"
+       height="32"
+       rx="4.8"
+       ry="4.8"
+       fill="none"
+       stroke="rgb(0, 0, 0)"
+       pointer-events="all"
+       id="rect328" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g334">
+      <switch
+         id="switch332">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 101px; height: 1px; padding-top: 876px; margin-left: 493px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; white-space: normal; overflow-wrap: normal;">Start Aux core<xhtml:br />
+
+(optional)</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="544"
+           y="880"
+           fill="rgb(0, 0, 0)"
+           font-family="Helvetica"
+           font-size="12px"
+           text-anchor="middle"
+           id="text330">Start Aux core...</text>
+      </switch>
+    </g>
+    <path
+       d="M 132 909 L 628.38 909"
+       fill="none"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="stroke"
+       id="path336" />
+    <path
+       d="M 633.63 909 L 626.63 912.5 L 628.38 909 L 626.63 905.5 Z"
+       fill="rgb(0, 0, 0)"
+       stroke="rgb(0, 0, 0)"
+       stroke-miterlimit="10"
+       pointer-events="all"
+       id="path338" />
+    <g
+       transform="translate(-0.5 -0.5)"
+       id="g344">
+      <switch
+         id="switch342">
+        <foreignObject
+           style="overflow: visible; text-align: left;"
+           pointer-events="none"
+           width="100%"
+           height="100%"
+           requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility">
+          <xhtml:div
+             style="display: flex; align-items: unsafe center; justify-content: unsafe center; width: 1px; height: 1px; padding-top: 900px; margin-left: 203px;">
+            <xhtml:div
+               style="box-sizing: border-box; font-size: 0px; text-align: center;"
+               data-drawio-colors="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); ">
+              <xhtml:div
+                 style="display: inline-block; font-size: 11px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; pointer-events: all; background-color: rgb(255, 255, 255); white-space: nowrap;">Release Reset</xhtml:div>
+            </xhtml:div>
+          </xhtml:div>
+        </foreignObject>
+        <text
+           x="203"
+           y="903"
+           fill="rgb(0, 0, 0)"
+           font-family="Helvetica"
+           font-size="11px"
+           text-anchor="middle"
+           id="text340">Release Re...</text>
+      </switch>
+    </g>
+  </g>
+  <switch
+     id="switch354">
+    <g
+       requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"
+       id="g348" />
+    <a
+       transform="translate(0,-5)"
+       xlink:href="https://www.drawio.com/doc/faq/svg-export-text-problems"
+       target="_blank"
+       id="a352">
+      <text
+         text-anchor="middle"
+         font-size="10px"
+         x="50%"
+         y="100%"
+         id="text350">Text is not SVG - cannot display</text>
+    </a>
+  </switch>
+</svg>
index ec447358ac398fb380c447c8fdaf20726d666eda..95cdb366252ecd2ef5ad618e484708c2d957fa0c 100644 (file)
@@ -32,6 +32,7 @@ K3 Based SoCs
 
    am62x_sk
    ../toradex/verdin-am62
+   am64x_evm
    am65x_evm
    j7200_evm
    j721e_evm
index c47de273ab18543c46d7d9bcc6773541ed5d17ee..e8b90752f0831c2e703cc07868d6dff9f10974ad 100644 (file)
@@ -683,11 +683,12 @@ Assuming the bootmeth is happy, or at least indicates that it is willing to try
 partition. If that works it tries to detect a file system. If that works then it
 calls the bootmeth device once more, this time to read the bootflow.
 
-Note: At present a filesystem is needed for the bootmeth to be called on block
-devices, simply because we don't have any examples where this is not the case.
-This feature can be added as needed. Note that sandbox is a special case, since
-in that case the host filesystem can be accessed even though the block device
-is NULL.
+Note: Normally a filesystem is needed for the bootmeth to be called on block
+devices, but bootmeths which don't need that can set the BOOTMETHF_ANY_PART
+flag to indicate that they can scan any partition. An example is the ChromiumOS
+bootmeth which can store a kernel in a raw partition. Note also that sandbox is
+a special case, since in that case the host filesystem can be accessed even
+though the block device is NULL.
 
 If we take the example of the `bootmeth_extlinux` driver, this call ends up at
 `extlinux_read_bootflow()`. It has the filesystem ready, so tries various
diff --git a/doc/develop/cedit.rst b/doc/develop/cedit.rst
new file mode 100644 (file)
index 0000000..63dff9d
--- /dev/null
@@ -0,0 +1,169 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+Configuration Editor
+====================
+
+Introduction
+------------
+
+U-Boot provides a configuration editor which allows settings to be changed in
+a GUI or text environment.
+
+
+This feature is still in development and has a number of limitations. For
+example, cedit only supports menu items (there is no numeric or text entry),
+provides no support for colour text and does not support scrolling. Still it is
+possible to use it for simple applications.
+
+
+Overview
+--------
+
+The configuration editor makes use of :doc:`expo` to build a description of the
+configuration screens and allow user to interact with it.
+
+To create a single-scene cedit for your application:
+
+#. Design the scene, i.e. the objects that need to be present and what their
+   possible values are
+
+#. Enter this in .dts format
+
+#. Create a header file containing the IDs
+
+#. Run the 'expo.py' tool to generate a .dtb file containing the layout, which
+   can be used by U-Boot
+
+#. Use the :doc:`../usage/cmd/cedit` to create the cedit, read the settings,
+   present the cedit to the user and save the settings afterwards.
+
+Each of these is described in a separate section. See :ref:`expo_example` for
+an example file.
+
+
+Design a scene
+--------------
+
+Using a piece of paper or a drawing tool, lay out the objects you want in your
+scene. Typically you will use the default layout engine, which simply puts items
+one after the other from top to bottom. So use a single column and show the
+prompt and value for each object.
+
+For menu items, show one of the values, but keep in mind what else you need.
+
+
+Create an expo-format file
+--------------------------
+
+The description is in the form of a devicetree file, as documented at
+:ref:`expo_format`. Since everything in an expo has an ID number (an integer
+greater than 1) the description is written terms of these IDs. They each have
+an enum value. which is typically taken care of by the `expo.py` tool.
+
+The expo should have a `scenes` node with a named scene as a subnode. Within the
+scene, add properties for the scene, then a subnode for each object in the
+scene.
+
+All object nodes require an `id` value and a `type` property. Other properties
+depend on the type. For example, a menu has a `title` and an `item-label` list
+proving the text for the menu items, as well as an `item-id` list providing the
+ID of each menu item, so it can be selected.
+
+Text properties may have two variants. For example `title` specifies the title
+of a menu, but you can instead use `title-id` to specify the string ID to use as
+the title. String are defined in a separate area, common to the whole expo,
+which contains a subnode for each string. Within that subnode are the ID and the
+`value` (i.e. the text). For now only English is supported, but in future it may
+be possible to append a language identifier to provide other values (e.g.
+'value-es' for Spanish).
+
+
+Create an ID header-file
+------------------------
+
+Expo needs to know the integer value to use for every ID referenced in your
+expo-format file. For example, if you have defined a `cpu-speed` node with an
+id of `ID_CPU_SPEED`, then Expo needs to know the value of `ID_CPU_SPEED`.
+
+When you write C code to use the expo, you may need to know the IDs. For
+example, to find which value the user selected in `cpu-speed` menu, you must
+use the `ID_CPU_SPEED` ID. The ID is the only way to refer to anything in Expo.
+
+Since we need a shared set of IDs, it is best to have a header file containing
+them. Expo supports doing this with an enum, where every ID is listed in the
+enum::
+
+    enum {
+        ZERO,
+
+        ID_PROMPT,
+
+        ID_SCENE1,
+        ID_SCENE1_TITLE,
+        ...
+    };
+
+The C compiler can parse this directly. The `expo.py` tool parses it for expo.
+
+Create a header file containing every ID mentioned in your expo. Try to group
+related things together.
+
+
+Build the expo layout
+---------------------
+
+Use the `expo.py` tool to build a .dtb for your expo::
+
+    ./tools/expo.py -e expo_ids.h -l expo_layout.dts -o expo.dtb
+
+This uses the enum in the provided header file to get the ID numbers, grabs
+the `.dts` file, inserts the ID numbers and then uses the devicetree compiler to
+build a `.dtb` file.
+
+If you get an error::
+
+    Devicetree compiler error:
+    Error: <stdin>:9.19-20 syntax error
+    FATAL ERROR: Unable to parse input tree
+
+that means that something is wrong with your syntax, or perhaps you have an ID
+in the `.dts` file that is not mentioned in your enum. Check both files and try
+again.
+
+
+Use the command interface
+-------------------------
+
+See the :doc:`../usage/cmd/cedit` command for information on available commands.
+Typically you will use `cedit load` to load the `.dtb` file and `cedit run` to
+let the user interact with it.
+
+
+Multiple scenes
+---------------
+
+Expo supports multiple scenes but has no pre-determined way of moving between
+them. You could use selection of a menu item as a signal to change the scene,
+but this is not currently implemented in the cedit code (see `cedit_run()`).
+
+
+Themes
+------
+
+The configuration editor uses simple expo themes. The theme is read from
+`/bootstd/cedit-theme` in the devicetree.
+
+
+Reading and writing settings
+----------------------------
+
+Cedit provides several options for persistent settings:
+
+- Writing an FDT file to a filesystem
+- Writing to U-Boot's environment variables, which are then typically stored in
+  a persistent manner
+- Writing to CMOS RAM registers (common on x86 machines)
+
+For now, reading and writing settings is not automatic. See the
+:doc:`../usage/cmd/cedit` for how to do this on the command line or in a
+script.
index cb09e9c85a9a3e307a6209d38d089b5635387ef3..d5043ec4f4ca552458093c0b2e112882c8e826ac 100644 (file)
@@ -21,16 +21,31 @@ Declaring a spy
 
 To declare a spy, use something like this::
 
-    static int snow_setup_cpus(void *ctx, struct event *event)
+    static int snow_check_temperature(void)
     {
         /* do something */
         return 0;
     }
-    EVENT_SPY(EVT_DM_POST_INIT_F, snow_setup_cpus);
+    EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, snow_check_temperature);
 
 This function is called when EVT_DM_POST_INIT_F is emitted, i.e. after the
 driver model is initialized (in U-Boot proper before and after relocation).
 
+If you need access to the event data, use `EVENT_SPY_FULL`, like this::
+
+    static int snow_setup_cpus(void *ctx, struct event *event)
+    {
+        /* do something that uses event->data*/
+        return 0;
+    }
+    EVENT_SPY_FULL(EVT_DM_POST_INIT_F, snow_setup_cpus);
+
+Note that the context is always NULL for a static spy. See below for information
+about how to use a dynamic spy.
+
+The return value is handled by the event emitter. If non-zero, then the error
+is returned to the function which emitted the event, i.e. the one that called
+`event_notify()`.
 
 Debugging
 ---------
@@ -80,6 +95,10 @@ to be notified when a particular device is probed or removed.
 This can be handled by enabling `CONFIG_EVENT_DYNAMIC`. It is then possible to
 call `event_register()` to register a new handler for a particular event.
 
+If some context is need for the spy, you can pass a pointer to
+`event_register()` to provide that. Note that the context is only passed to
+a spy registered with `EVENT_SPY_FULL`.
+
 Dynamic event handlers are called after all the static event spy handlers have
 been processed. Of course, since dynamic event handlers are created at runtime
 it is not possible to use the `event_dump.py` to see them.
index 2ac4af232da46dba3b1048af685e6b419cef193a..f13761995d3f4446f8bc1f99ba5a1a5f8b37fa22 100644 (file)
@@ -317,6 +317,18 @@ id
 
     Specifies the ID of the object. This is used when referring to the object.
 
+Where CMOS RAM is used for reading and writing settings, the following
+additional properties are required:
+
+start-bit
+    Specifies the first bit in the CMOS RAM to use for this setting. For a RAM
+    with 0x100 bytes, there are 0x800 bit locations. For example, register 0x80
+    holds bits 0x400 to 0x407.
+
+bit-length
+    Specifies the number of CMOS RAM bits to use for this setting. The bits
+    extend from `start-bit` to `start-bit + bit-length - 1`. Note that the bits
+    must be contiguous.
 
 Menu nodes have the following additional properties:
 
@@ -358,6 +370,9 @@ The `expo_arrange()` function can be called to arrange the expo objects in a
 suitable manner. For each scene it puts the title at the top, the prompt at the
 bottom and the objects in order from top to bottom.
 
+
+.. _expo_example:
+
 Expo format example
 ~~~~~~~~~~~~~~~~~~~
 
@@ -367,22 +382,27 @@ strings are provided inline in the nodes where they are used.
 
 ::
 
-    #define ID_PROMPT           1
-    #define ID_SCENE1           2
-    #define ID_SCENE1_TITLE     3
+    /* this comment is parsed by the expo.py tool to insert the values below
+
+    enum {
+        ZERO,
+        ID_PROMPT,
+        ID_SCENE1,
+        ID_SCENE1_TITLE,
 
-    #define ID_CPU_SPEED        4
-    #define ID_CPU_SPEED_TITLE  5
-    #define ID_CPU_SPEED_1      6
-    #define ID_CPU_SPEED_2      7
-    #define ID_CPU_SPEED_3      8
+        ID_CPU_SPEED,
+        ID_CPU_SPEED_TITLE,
+        ID_CPU_SPEED_1,
+        ID_CPU_SPEED_2,
+        ID_CPU_SPEED_3,
 
-    #define ID_POWER_LOSS       9
-    #define ID_AC_OFF           10
-    #define ID_AC_ON            11
-    #define ID_AC_MEMORY        12
+        ID_POWER_LOSS,
+        ID_AC_OFF,
+        ID_AC_ON,
+        ID_AC_MEMORY,
 
-    #define ID_DYNAMIC_START    13
+        ID_DYNAMIC_START,
+    */
 
     &cedit {
         dynamic-start = <ID_DYNAMIC_START>;
@@ -465,7 +485,7 @@ Some ideas for future work:
 - Support unicode
 - Support curses for proper serial-terminal menus
 - Add support for large menus which need to scroll
-- Add support for reading and writing configuration settings with cedit
+- Update expo.py tool to check for overlapping names and CMOS locations
 
 .. Simon Glass <sjg@chromium.org>
 .. 7-Oct-22
index 5b230d0321f25703a3da752a3e1f1af2391feec3..0d12484ace8ac419bc0133238391ef1e18ee31db 100644 (file)
@@ -38,6 +38,7 @@ Implementation
    driver-model/index
    environment
    expo
+   cedit
    event
    global_data
    logging
index a7a41f2facf2c7f0ee9a1b2058279e1c329eb0d3..68f9b332d153dc409144432a2efd692aa2fa7f48 100644 (file)
@@ -318,6 +318,9 @@ Run the following command
       --guid <image GUID> \
       <capsule_file_name>
 
+Capsule with firmware version
+*****************************
+
 The UEFI specification does not define the firmware versioning mechanism.
 EDK II reference implementation inserts the FMP Payload Header right before
 the payload. It coutains the fw_version and lowest supported version,
@@ -345,6 +348,43 @@ add --fw-version option in mkeficapsule tool.
 If the --fw-version option is not set, FMP Payload Header is not inserted
 and fw_version is set as 0.
 
+Capsule Generation through binman
+*********************************
+
+Support has also been added to generate capsules during U-Boot build
+through binman. This requires the platform's DTB to be populated with
+the capsule entry nodes for binman. The capsules then can be generated
+by specifying the capsule parameters as properties in the capsule
+entry node.
+
+Check the test/py/tests/test_efi_capsule/capsule_gen_binman.dts file
+as reference for how a typical binman node for capsule generation
+looks like. For generating capsules as part of the platform's build, a
+capsule node would then have to be included into the platform's
+devicetree.
+
+A typical binman node for generating a capsule would look like::
+
+       capsule {
+               filename = "u-boot.capsule";
+               efi-capsule {
+                       image-index = <0x1>;
+                       image-guid = "09d7cf52-0720-4710-91d1-08469b7fe9c8";
+
+                       u-boot {
+                       };
+               };
+       };
+
+In the above example, a capsule file named u-boot.capsule will be
+generated with u-boot.bin as it's input payload. The capsule
+generation parameters like image-index and image-guid are being
+specified as properties. Similarly, other properties like the private
+and public key certificate can be specified for generating signed
+capsules. Refer :ref:`etype_efi_capsule` for documentation about the
+efi-capsule binman entry type, which describes all the properties that
+can be specified.
+
 Performing the update
 *********************
 
@@ -522,20 +562,11 @@ and used by the steps highlighted below.
             ...
     }
 
-You can do step-4 manually with
-
-.. code-block:: console
-
-    $ dtc -@ -I dts -O dtb -o signature.dtbo signature.dts
-    $ fdtoverlay -i orig.dtb -o new.dtb -v signature.dtbo
-
-where signature.dts looks like::
-
-    &{/} {
-            signature {
-                    capsule-key = /incbin/("CRT.esl");
-            };
-    };
+You can perform step-4 through the Kconfig symbol
+CONFIG_EFI_CAPSULE_ESL_FILE. This symbol points to the esl file
+generated in step-2. Once the symbol has been populated with the path
+to the esl file, it will automatically get embedded into the
+platform's dtb as part of U-Boot build.
 
 Anti-rollback Protection
 ************************
index a8af1f8f6030b7fc9788d3ec8ffff7eb28b8ec56..ead493d0aaf8b668ea902a908f8c807591404874 100644 (file)
@@ -11,7 +11,8 @@ Synopis
     bootflow scan [-abelGH] [bootdev]
     bootflow list [-e]
     bootflow select [<num|name>]
-    bootflow info [-d]
+    bootflow info [-ds]
+    bootflow read
     bootflow boot
     bootflow cmdline [set|get|clear|delete|auto] <param> [<value>]
 
@@ -191,11 +192,29 @@ Error
 
 Use the `-d` flag to dump out the contents of the bootfile file.
 
+The `-s` flag shows any x86 setup block, instead of the above.
+
+
+bootflow read
+~~~~~~~~~~~~~
+
+This reads any files related to the bootflow. Some bootflows with large files
+avoid doing this when the bootflow is scanned, since it uses a lot of memory
+and takes extra time. The files are then automatically read when `bootflow boot`
+is used.
+
+This command reads these files immediately. Typically this fills in the bootflow
+`buf` property, which can be used to examine the bootflow.
+
+Note that reading the files does not result in any extra parsing, nor loading of
+images in the files. This is purely used to read in the data ready for
+booting, or examination.
+
 
 bootflow boot
 ~~~~~~~~~~~~~
 
-This boots the current bootflow.
+This boots the current bootflow, reading any required files first.
 
 
 bootflow cmdline
@@ -522,6 +541,122 @@ the cmdline is word-wrapped here and some parts of the command line are elided::
     [    0.000000] Command line: loglevel=7 ... usb-storage.quirks=13fe:6500:u earlycon=uart8250,mmio32,0xfe03e000,115200n8
     [    0.000000] x86/split lock detection: warning about user-space split_locks
 
+This shows looking at x86 setup information::
+
+    => bootfl sel 0
+    => bootfl i -s
+    Setup located at 77b56010:
+
+    ACPI RSDP addr      : 0
+    E820: 2 entries
+            Addr        Size  Type
+               0        1000  RAM
+        fffff000        1000  Reserved
+    Setup sectors       : 1e
+    Root flags          : 1
+    Sys size            : 63420
+    RAM size            : 0
+    Video mode          : ffff
+    Root dev            : 0
+    Boot flag           : 0
+    Jump                : 66eb
+    Header              : 53726448
+                          Kernel V2
+    Version             : 20d
+    Real mode switch    : 0
+    Start sys seg       : 1000
+    Kernel version      : 38cc
+       @00003acc:
+    Type of loader      : ff
+                          unknown
+    Load flags          : 1
+                        : loaded-high
+    Setup move size     : 8000
+    Code32 start        : 100000
+    Ramdisk image       : 0
+    Ramdisk size        : 0
+    Bootsect kludge     : 0
+    Heap end ptr        : 5160
+    Ext loader ver      : 0
+    Ext loader type     : 0
+    Command line ptr    : 735000
+    Initrd addr max     : 7fffffff
+    Kernel alignment    : 200000
+    Relocatable kernel  : 1
+    Min alignment       : 15
+                        : 200000
+    Xload flags         : 3
+                        : 64-bit-entry can-load-above-4gb
+    Cmdline size        : 7ff
+    Hardware subarch    : 0
+    HW subarch data     : 0
+    Payload offset      : 26e
+    Payload length      : 612045
+    Setup data          : 0
+    Pref address        : 1000000
+    Init size           : 1383000
+    Handover offset     : 0
+
+This shows reading a bootflow to examine the kernel::
+
+    => bootfl i 0
+    Name:
+    Device:    emmc@1c,0.bootdev
+    Block dev: emmc@1c,0.blk
+    Method:    cros
+    State:     ready
+    Partition: 2
+    Subdir:    (none)
+    Filename:  <NULL>
+    Buffer:    0
+    Size:      63ee00 (6548992 bytes)
+    OS:        ChromeOS
+    Cmdline:   console= loglevel=7 init=/sbin/init cros_secure oops=panic panic=-1 root=PARTUUID=35c775e7-3735-d745-93e5-d9e0238f7ed0/PARTNROFF=1 rootwait rw dm_verity.error_behavior=3 dm_verity.max_bios=-1 dm_verity.dev_wait=0 dm="1 vroot none rw 1,0 3788800 verity payload=ROOT_DEV hashtree=HASH_DEV hashstart=3788800 alg=sha1 root_hexdigest=55052b629d3ac889f25a9583ea12cdcd3ea15ff8 salt=a2d4d9e574069f4fed5e3961b99054b7a4905414b60a25d89974a7334021165c" noinitrd vt.global_cursor_default=0 kern_guid=35c775e7-3735-d745-93e5-d9e0238f7ed0 add_efi_memmap boot=local noresume noswap i915.modeset=1 tpm_tis.force=1 tpm_tis.interrupts=0 nmi_watchdog=panic,lapic disablevmx=off
+    X86 setup: 77b56010
+    Logo:      (none)
+    FDT:       <NULL>
+    Error:     0
+
+Note that `Buffer` is 0 so it has not be read yet. Using `bootflow read`::
+
+    => bootfl read
+    => bootfl info
+    Name:
+    Device:    emmc@1c,0.bootdev
+    Block dev: emmc@1c,0.blk
+    Method:    cros
+    State:     ready
+    Partition: 2
+    Subdir:    (none)
+    Filename:  <NULL>
+    Buffer:    77b7e400
+    Size:      63ee00 (6548992 bytes)
+    OS:        ChromeOS
+    Cmdline:   console= loglevel=7 init=/sbin/init cros_secure oops=panic panic=-1 root=PARTUUID=35c775e7-3735-d745-93e5-d9e0238f7ed0/PARTNROFF=1 rootwait rw dm_verity.error_behavior=3 dm_verity.max_bios=-1 dm_verity.dev_wait=0 dm="1 vroot none rw 1,0 3788800 verity payload=ROOT_DEV hashtree=HASH_DEV hashstart=3788800 alg=sha1 root_hexdigest=55052b629d3ac889f25a9583ea12cdcd3ea15ff8 salt=a2d4d9e574069f4fed5e3961b99054b7a4905414b60a25d89974a7334021165c" noinitrd vt.global_cursor_default=0 kern_guid=35c775e7-3735-d745-93e5-d9e0238f7ed0 add_efi_memmap boot=local noresume noswap i915.modeset=1 tpm_tis.force=1 tpm_tis.interrupts=0 nmi_watchdog=panic,lapic disablevmx=off
+    X86 setup: 781b4400
+    Logo:      (none)
+    FDT:       <NULL>
+    Error:     0
+
+Now the buffer can be accessed::
+
+    => md 77b7e400
+    77b7e400: 1186f6fc 40000002 b8fa0c75 00000018  .......@u.......
+    77b7e410: c08ed88e a68dd08e 000001e8 000000e8  ................
+    77b7e420: ed815d00 00000021 62c280b8 89e80100  .]..!......b....
+    77b7e430: 22f7e8c4 c0850061 22ec850f eb890061  ..."a......"a...
+    77b7e440: 0230868b 01480000 21d0f7c3 00fb81c3  ..0...H....!....
+    77b7e450: 7d010000 0000bb05 c3810100 00d4f000  ...}............
+    77b7e460: 8130858d 85890061 00618132 3095010f  ..0.a...2.a....0
+    77b7e470: 0f006181 c883e020 e0220f20 e000bb8d  .a.. ... .".....
+    77b7e480: c0310062 001800b9 8dabf300 62e000bb  b.1............b
+    77b7e490: 07878d00 89000010 00bb8d07 8d0062f0  .............b..
+    77b7e4a0: 00100787 0004b900 07890000 00100005  ................
+    77b7e4b0: 08c78300 8df37549 630000bb 0183b800  ....Iu.....c....
+    77b7e4c0: 00b90000 89000008 00000507 c7830020  ............ ...
+    77b7e4d0: f3754908 e000838d 220f0062 0080b9d8  .Iu.....b.."....
+    77b7e4e0: 320fc000 08e8ba0f c031300f b8d0000f  ...2.....01.....
+    77b7e4f0: 00000020 6ad8000f 00858d10 50000002   ......j.......P
 
 
 Return value
index 8e1110c7c77e9728ec650e41cc6e60c882d2faf1..f415b48699eacfad065f32adb94d6b5b529a269a 100644 (file)
@@ -10,6 +10,11 @@ Synopis
 
     cedit load <interface> <dev[:part]> <filename>
     cedit run
+    cedit write_fdt <dev[:part]> <filename>
+    cedit read_fdt <dev[:part]> <filename>
+    cedit write_env [-v]
+    cedit read_env [-v]
+    cedit write_cmos [-v] [dev]
 
 Description
 -----------
@@ -22,6 +27,69 @@ It makes use of the expo subsystem.
 The description is in the form of a devicetree file, as documented at
 :ref:`expo_format`.
 
+See :doc:`../../develop/cedit` for information about the configuration editor.
+
+cedit load
+~~~~~~~~~~
+
+Loads a configuration-editor description from a file. It creates a new cedit
+structure ready for use. Initially no settings are read, so default values are
+used for each object.
+
+cedit run
+~~~~~~~~~
+
+Runs the default configuration-editor event loop. This is very simple, just
+accepting character input and moving through the objects under user control.
+The implementation is at `cedit_run()`.
+
+cedit write_fdt
+~~~~~~~~~~~~~~~
+
+Writes the current user settings to a devicetree file. For each menu item the
+selected ID and its text string are written.
+
+cedit read_fdt
+~~~~~~~~~~~~~~
+
+Reads the user settings from a devicetree file and updates the cedit with those
+settings.
+
+cedit read_env
+~~~~~~~~~~~~~~
+
+Reads the settings from the environment variables. For each menu item `<name>`,
+cedit looks for a variable called `c.<name>` with the ID of the selected menu
+item.
+
+The `-v` flag enables verbose mode, where each variable is printed after it is
+read.
+
+cedit write_env
+~~~~~~~~~~~~~~~
+
+Writes the settings to environment variables. For each menu item the selected
+ID and its text string are written, similar to:
+
+   setenv c.<name> <selected_id>
+   setenv c.<name>-str <selected_id's text string>
+
+The `-v` flag enables verbose mode, where each variable is printed before it is
+set.
+
+cedit write_cmos
+~~~~~~~~~~~~~~~~
+
+Writes the settings to locations in the CMOS RAM. The locations used are
+specified by the schema. See `expo_format_`.
+
+The `-v` flag enables verbose mode, which shows which CMOS locations were
+updated.
+
+Normally the first RTC device is used to hold the data. You can specify a
+different device by name using the `dev` parameter.
+
+
 Example
 -------
 
@@ -29,3 +97,52 @@ Example
 
     => cedit load hostfs - fred.dtb
     => cedit run
+    => cedit write_fdt hostfs - settings.dtb
+
+That results in::
+
+    / {
+        cedit-values {
+            cpu-speed = <0x00000006>;
+            cpu-speed-str = "2 GHz";
+            power-loss = <0x0000000a>;
+            power-loss-str = "Always Off";
+        };
+    }
+
+    => cedit read_fdt hostfs - settings.dtb
+
+This shows settings being stored in the environment::
+
+    => cedit write_env -v
+    c.cpu-speed=7
+    c.cpu-speed-str=2.5 GHz
+    c.power-loss=12
+    c.power-loss-str=Memory
+    => print
+    ...
+    c.cpu-speed=6
+    c.cpu-speed-str=2 GHz
+    c.power-loss=10
+    c.power-loss-str=Always Off
+    ...
+
+    => cedit read_env -v
+    c.cpu-speed=7
+    c.power-loss=12
+
+This shows writing to CMOS RAM. Notice that the bytes at 80 and 84 change::
+
+    => rtc read 80 8
+    00000080: 00 00 00 00 00 2f 2a 08                          ...../*.
+    =>  cedit write_cmos -v
+    Write 2 bytes from offset 80 to 84
+    => rtc read 80 8
+    00000080: 01 00 00 00 08 2f 2a 08                          ...../*.
+    => cedit read_cmos -v
+    Read 2 bytes from offset 80 to 84
+
+Here is an example with the device specified::
+
+    => cedit write_cmos rtc@43
+    =>
index 9646e4d7062795609bca8b340dfaa8b18635de97..6074eccbf097b335a00ddddbd6965c08aab668e9 100644 (file)
@@ -51,23 +51,21 @@ static int check_channel(struct udevice *dev, int value, bool number_or_mask,
 static int adc_supply_enable(struct udevice *dev)
 {
        struct adc_uclass_plat *uc_pdata = dev_get_uclass_plat(dev);
-       const char *supply_type;
-       int ret = 0;
+       int ret;
 
-       if (uc_pdata->vdd_supply) {
-               supply_type = "vdd";
-               ret = regulator_set_enable(uc_pdata->vdd_supply, true);
+       ret = regulator_set_enable_if_allowed(uc_pdata->vdd_supply, true);
+       if (ret && ret != -ENOSYS) {
+               pr_err("%s: can't enable vdd-supply!", dev->name);
+               return ret;
        }
 
-       if (!ret && uc_pdata->vss_supply) {
-               supply_type = "vss";
-               ret = regulator_set_enable(uc_pdata->vss_supply, true);
+       ret = regulator_set_enable_if_allowed(uc_pdata->vss_supply, true);
+       if (ret && ret != -ENOSYS) {
+               pr_err("%s: can't enable vss-supply!", dev->name);
+               return ret;
        }
 
-       if (ret)
-               pr_err("%s: can't enable %s-supply!", dev->name, supply_type);
-
-       return ret;
+       return 0;
 }
 
 int adc_data_mask(struct udevice *dev, unsigned int *data_mask)
index 6baaa6f0711ca6206b97814655186d9c4f0c88ce..1abea3f10db42b922853a5286d0a416b1f572ee3 100644 (file)
@@ -167,7 +167,7 @@ config SYS_IDE_MAXDEVICE
 
 config SYS_ATA_BASE_ADDR
        hex "Base address of IDE controller"
-       default 0
+       default 0x0
        help
          This is the address of the IDE controller, from which other addresses
          are calculated. Each bus is at a fixed offset from this address,
index 614b975e25c2b78d9c2198ebfd39f2c4ecf39e76..885513893f6f4003d4c567900ec4273b02a7acac 100644 (file)
@@ -17,6 +17,8 @@
 #include <dm/uclass-internal.h>
 #include <linux/err.h>
 
+#define blk_get_ops(dev)       ((struct blk_ops *)(dev)->driver->ops)
+
 static struct {
        enum uclass_id id;
        const char *name;
@@ -444,6 +446,26 @@ int blk_get_device(int uclass_id, int devnum, struct udevice **devp)
        return device_probe(*devp);
 }
 
+struct blk_bounce_buffer {
+       struct udevice          *dev;
+       struct bounce_buffer    state;
+};
+
+static int blk_buffer_aligned(struct bounce_buffer *state)
+{
+#if IS_ENABLED(CONFIG_BOUNCE_BUFFER)
+       struct blk_bounce_buffer *bbstate =
+               container_of(state, struct blk_bounce_buffer, state);
+       struct udevice *dev = bbstate->dev;
+       const struct blk_ops *ops = blk_get_ops(dev);
+
+       if (ops->buffer_aligned)
+               return ops->buffer_aligned(dev, state);
+#endif /* CONFIG_BOUNCE_BUFFER */
+
+       return 1;       /* Default, any buffer is OK */
+}
+
 long blk_read(struct udevice *dev, lbaint_t start, lbaint_t blkcnt, void *buf)
 {
        struct blk_desc *desc = dev_get_uclass_plat(dev);
@@ -456,7 +478,25 @@ long blk_read(struct udevice *dev, lbaint_t start, lbaint_t blkcnt, void *buf)
        if (blkcache_read(desc->uclass_id, desc->devnum,
                          start, blkcnt, desc->blksz, buf))
                return blkcnt;
-       blks_read = ops->read(dev, start, blkcnt, buf);
+
+       if (IS_ENABLED(CONFIG_BOUNCE_BUFFER)) {
+               struct blk_bounce_buffer bbstate = { .dev = dev };
+               int ret;
+
+               ret = bounce_buffer_start_extalign(&bbstate.state, buf,
+                                                  blkcnt * desc->blksz,
+                                                  GEN_BB_WRITE, desc->blksz,
+                                                  blk_buffer_aligned);
+               if (ret)
+                       return ret;
+
+               blks_read = ops->read(dev, start, blkcnt, bbstate.state.bounce_buffer);
+
+               bounce_buffer_stop(&bbstate.state);
+       } else {
+               blks_read = ops->read(dev, start, blkcnt, buf);
+       }
+
        if (blks_read == blkcnt)
                blkcache_fill(desc->uclass_id, desc->devnum, start, blkcnt,
                              desc->blksz, buf);
@@ -469,13 +509,33 @@ long blk_write(struct udevice *dev, lbaint_t start, lbaint_t blkcnt,
 {
        struct blk_desc *desc = dev_get_uclass_plat(dev);
        const struct blk_ops *ops = blk_get_ops(dev);
+       long blks_written;
 
        if (!ops->write)
                return -ENOSYS;
 
        blkcache_invalidate(desc->uclass_id, desc->devnum);
 
-       return ops->write(dev, start, blkcnt, buf);
+       if (IS_ENABLED(CONFIG_BOUNCE_BUFFER)) {
+               struct blk_bounce_buffer bbstate = { .dev = dev };
+               int ret;
+
+               ret = bounce_buffer_start_extalign(&bbstate.state, (void *)buf,
+                                                  blkcnt * desc->blksz,
+                                                  GEN_BB_READ, desc->blksz,
+                                                  blk_buffer_aligned);
+               if (ret)
+                       return ret;
+
+               blks_written = ops->write(dev, start, blkcnt,
+                                         bbstate.state.bounce_buffer);
+
+               bounce_buffer_stop(&bbstate.state);
+       } else {
+               blks_written = ops->write(dev, start, blkcnt, buf);
+       }
+
+       return blks_written;
 }
 
 long blk_erase(struct udevice *dev, lbaint_t start, lbaint_t blkcnt)
@@ -766,6 +826,54 @@ int blk_unbind_all(int uclass_id)
        return 0;
 }
 
+static int part_create_block_devices(struct udevice *blk_dev)
+{
+       int part, count;
+       struct blk_desc *desc = dev_get_uclass_plat(blk_dev);
+       struct disk_partition info;
+       struct disk_part *part_data;
+       char devname[32];
+       struct udevice *dev;
+       int ret;
+
+       if (!CONFIG_IS_ENABLED(PARTITIONS) || !blk_enabled())
+               return 0;
+
+       if (device_get_uclass_id(blk_dev) != UCLASS_BLK)
+               return 0;
+
+       /* Add devices for each partition */
+       for (count = 0, part = 1; part <= MAX_SEARCH_PARTITIONS; part++) {
+               if (part_get_info(desc, part, &info))
+                       continue;
+               snprintf(devname, sizeof(devname), "%s:%d", blk_dev->name,
+                        part);
+
+               ret = device_bind_driver(blk_dev, "blk_partition",
+                                        strdup(devname), &dev);
+               if (ret)
+                       return ret;
+
+               part_data = dev_get_uclass_plat(dev);
+               part_data->partnum = part;
+               part_data->gpt_part_info = info;
+               count++;
+
+               ret = device_probe(dev);
+               if (ret) {
+                       debug("Can't probe\n");
+                       count--;
+                       device_unbind(dev);
+
+                       continue;
+               }
+       }
+       debug("%s: %d partitions found in %s\n", __func__, count,
+             blk_dev->name);
+
+       return 0;
+}
+
 static int blk_post_probe(struct udevice *dev)
 {
        if (CONFIG_IS_ENABLED(PARTITIONS) && blk_enabled()) {
index 6e26b64fb812ab6ef0251cdf42c62c01ca65ad33..60f8d6700ad417dd03c6d703a826c00c834f5f5d 100644 (file)
@@ -598,9 +598,10 @@ int device_probe(struct udevice *dev)
 
        ret = device_notify(dev, EVT_DM_POST_PROBE);
        if (ret)
-               return ret;
+               goto fail_event;
 
        return 0;
+fail_event:
 fail_uclass:
        if (device_remove(dev, DM_REMOVE_NORMAL)) {
                dm_warn("%s: Device '%s' failed to remove on error path\n",
index 8df16e56af5c1f3ea1611ce26992960fdf3a5d79..a4dc9bde085cce514bc56c0deb791fcc8ea7be3d 100644 (file)
@@ -103,7 +103,7 @@ void *ofnode_lookup_fdt(ofnode node)
        if (gd->flags & GD_FLG_RELOC) {
                uint i = OFTREE_TREE_ID(node.of_offset);
 
-               if (i > oftree_count) {
+               if (i >= oftree_count) {
                        log_debug("Invalid tree ID %x\n", i);
                        return NULL;
                }
index c97a89fbd5c8bd0eddd6df5b6f95d93015119cff..a229f6913b07ee18318b9e6d5cb8bddcf1db5048 100644 (file)
@@ -19,7 +19,7 @@ DECLARE_GLOBAL_DATA_PTR;
        ci = tmp;                                                               \
 }
 
-static int microblaze_cpu_probe_all(void *ctx, struct event *event)
+static int microblaze_cpu_probe_all(void)
 {
        int ret;
 
@@ -29,7 +29,7 @@ static int microblaze_cpu_probe_all(void *ctx, struct event *event)
 
        return 0;
 }
-EVENT_SPY(EVT_DM_POST_INIT_F, microblaze_cpu_probe_all);
+EVENT_SPY_SIMPLE(EVT_DM_POST_INIT_F, microblaze_cpu_probe_all);
 
 static void microblaze_set_cpuinfo_pvr(struct microblaze_cpuinfo *ci)
 {
index 8cd438791e540c20dc0f9decf936c214482340e1..855a874ac1e1bacd8610549cea4eeda5a6be6d78 100644 (file)
@@ -46,13 +46,13 @@ void ddr_load_train_firmware(enum fw_type type)
        u32 error = 0;
        unsigned long pr_to32, pr_from32;
        uint32_t fw_offset = type ? IMEM_2D_OFFSET : 0;
-       unsigned long imem_start = (unsigned long)&_end + fw_offset;
+       unsigned long imem_start = (unsigned long)_end + fw_offset;
        unsigned long dmem_start;
        unsigned long imem_len = IMEM_LEN, dmem_len = DMEM_LEN;
 
 #ifdef CONFIG_SPL_OF_CONTROL
        if (gd->fdt_blob && !fdt_check_header(gd->fdt_blob)) {
-               imem_start = roundup((unsigned long)&_end +
+               imem_start = roundup((unsigned long)_end +
                                     fdt_totalsize(gd->fdt_blob), 4) +
                        fw_offset;
        }
index 105ffd946f4ba286e41405e2034cc829fc44e6a9..8e57e860f25eb7ad74d375a6aac0aff0a54b8ad1 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 /*
- *  Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com
+ *  Copyright (C) 2019-2023 Texas Instruments Incorporated - https://www.ti.com
  *  Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
  */
 
 
 /* PSI-L source thread IDs, used for RX (DMA_DEV_TO_MEM) */
 static struct psil_ep j721e_src_ep_map[] = {
-       /* CPSW0 */
+       /* MCU_CPSW0 */
        PSIL_ETHERNET(0x7000),
+       /* MAIN_CPSW0 */
+       PSIL_ETHERNET(0x4a00),
 };
 
 /* PSI-L destination thread IDs, used for TX (DMA_MEM_TO_DEV) */
 static struct psil_ep j721e_dst_ep_map[] = {
-       /* CPSW0 */
+       /* MCU_CPSW0 */
        PSIL_ETHERNET(0xf000),
        PSIL_ETHERNET(0xf001),
        PSIL_ETHERNET(0xf002),
@@ -36,6 +38,15 @@ static struct psil_ep j721e_dst_ep_map[] = {
        PSIL_ETHERNET(0xf005),
        PSIL_ETHERNET(0xf006),
        PSIL_ETHERNET(0xf007),
+       /* MAIN_CPSW0 */
+       PSIL_ETHERNET(0xca00),
+       PSIL_ETHERNET(0xca01),
+       PSIL_ETHERNET(0xca02),
+       PSIL_ETHERNET(0xca03),
+       PSIL_ETHERNET(0xca04),
+       PSIL_ETHERNET(0xca05),
+       PSIL_ETHERNET(0xca06),
+       PSIL_ETHERNET(0xca07),
 };
 
 struct psil_ep_map j721e_ep_map = {
index a3df9aa3d0f858cf662924e463e7299db2730b3e..837c6f1180da6bb3a64ce0988572194b1f821456 100644 (file)
@@ -56,7 +56,7 @@ config FASTBOOT_BUF_ADDR
                                ROCKCHIP_RK3399
        default 0x280000 if ROCKCHIP_RK3368
        default 0x100000 if ARCH_ZYNQMP
-       default 0 if SANDBOX
+       default 0x0 if SANDBOX
        help
          The fastboot protocol requires a large memory buffer for
          downloads. Define this to the starting RAM address to use for
index dd3475e0a8bd1afefe61a91534b0a8d1fee2bc38..d9f0f07b2bcd2490f7f58982f224ccd2091b571f 100644 (file)
@@ -183,7 +183,7 @@ static void __maybe_unused getvar_has_slot(char *part_name, char *response)
 
        /* part_name_wslot = part_name + "_a" */
        len = strlcpy(part_name_wslot, part_name, PART_NAME_LEN - 3);
-       if (len > PART_NAME_LEN - 3)
+       if (len >= PART_NAME_LEN - 3)
                goto fail;
        strcat(part_name_wslot, "_a");
 
index 31027f3d99029ecb759d3dba27a8755297ab9efb..fc395c97a2892735ad5e3a7f1bf9a7a95dec5d86 100644 (file)
@@ -28,6 +28,8 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+#define GPIO_ALLOC_BITS        32
+
 /**
  * gpio_desc_init() - Initialize the GPIO descriptor
  *
@@ -75,6 +77,46 @@ static int gpio_to_device(unsigned int gpio, struct gpio_desc *desc)
        return -ENOENT;
 }
 
+/**
+ * gpio_is_claimed() - Test whether GPIO is claimed by consumer
+ *
+ * Test whether GPIO is claimed by consumer already.
+ *
+ * @uc_priv:   gpio_dev_priv pointer.
+ * @offset:    gpio offset within the device
+ * @return:    true if claimed, false if not claimed
+ */
+static bool gpio_is_claimed(struct gpio_dev_priv *uc_priv, unsigned int offset)
+{
+       return !!(uc_priv->claimed[offset / GPIO_ALLOC_BITS] & BIT(offset % GPIO_ALLOC_BITS));
+}
+
+/**
+ * gpio_set_claim() - Set GPIO claimed by consumer
+ *
+ * Set a bit which indicate the GPIO is claimed by consumer
+ *
+ * @uc_priv:   gpio_dev_priv pointer.
+ * @offset:    gpio offset within the device
+ */
+static void gpio_set_claim(struct gpio_dev_priv *uc_priv, unsigned int offset)
+{
+       uc_priv->claimed[offset / GPIO_ALLOC_BITS] |= BIT(offset % GPIO_ALLOC_BITS);
+}
+
+/**
+ * gpio_clear_claim() - Clear GPIO claimed by consumer
+ *
+ * Clear a bit which indicate the GPIO is claimed by consumer
+ *
+ * @uc_priv:   gpio_dev_priv pointer.
+ * @offset:    gpio offset within the device
+ */
+static void gpio_clear_claim(struct gpio_dev_priv *uc_priv, unsigned int offset)
+{
+       uc_priv->claimed[offset / GPIO_ALLOC_BITS] &= ~BIT(offset % GPIO_ALLOC_BITS);
+}
+
 #if CONFIG_IS_ENABLED(DM_GPIO_LOOKUP_LABEL)
 /**
  * dm_gpio_lookup_label() - look for name in gpio device
@@ -94,7 +136,7 @@ static int dm_gpio_lookup_label(const char *name,
 
        *offset = -1;
        for (i = 0; i < uc_priv->gpio_count; i++) {
-               if (!uc_priv->name[i])
+               if (!gpio_is_claimed(uc_priv, i))
                        continue;
                if (!strcmp(name, uc_priv->name[i])) {
                        *offset = i;
@@ -350,7 +392,7 @@ int dm_gpio_request(struct gpio_desc *desc, const char *label)
        int ret;
 
        uc_priv = dev_get_uclass_priv(dev);
-       if (uc_priv->name[desc->offset])
+       if (gpio_is_claimed(uc_priv, desc->offset))
                return -EBUSY;
        str = strdup(label);
        if (!str)
@@ -362,6 +404,8 @@ int dm_gpio_request(struct gpio_desc *desc, const char *label)
                        return ret;
                }
        }
+
+       gpio_set_claim(uc_priv, desc->offset);
        uc_priv->name[desc->offset] = str;
 
        return 0;
@@ -438,7 +482,7 @@ int _dm_gpio_free(struct udevice *dev, uint offset)
        int ret;
 
        uc_priv = dev_get_uclass_priv(dev);
-       if (!uc_priv->name[offset])
+       if (!gpio_is_claimed(uc_priv, offset))
                return -ENXIO;
        if (ops->rfree) {
                ret = ops->rfree(dev, offset);
@@ -446,6 +490,7 @@ int _dm_gpio_free(struct udevice *dev, uint offset)
                        return ret;
        }
 
+       gpio_clear_claim(uc_priv, offset);
        free(uc_priv->name[offset]);
        uc_priv->name[offset] = NULL;
 
@@ -480,7 +525,7 @@ static int check_reserved(const struct gpio_desc *desc, const char *func)
                return -ENOENT;
 
        uc_priv = dev_get_uclass_priv(desc->dev);
-       if (!uc_priv->name[desc->offset]) {
+       if (!gpio_is_claimed(uc_priv, desc->offset)) {
                printf("%s: %s: error: gpio %s%d not reserved\n",
                       desc->dev->name, func,
                       uc_priv->bank_name ? uc_priv->bank_name : "",
@@ -826,7 +871,7 @@ static int get_function(struct udevice *dev, int offset, bool skip_unused,
                return -EINVAL;
        if (namep)
                *namep = uc_priv->name[offset];
-       if (skip_unused && !uc_priv->name[offset])
+       if (skip_unused && !gpio_is_claimed(uc_priv, offset))
                return GPIOF_UNUSED;
        if (ops->get_function) {
                int ret;
@@ -1341,6 +1386,14 @@ static int gpio_post_probe(struct udevice *dev)
        if (!uc_priv->name)
                return -ENOMEM;
 
+       uc_priv->claimed = calloc(DIV_ROUND_UP(uc_priv->gpio_count,
+                                              GPIO_ALLOC_BITS),
+                                 GPIO_ALLOC_BITS / 8);
+       if (!uc_priv->claimed) {
+               free(uc_priv->name);
+               return -ENOMEM;
+       }
+
        return gpio_renumber(NULL);
 }
 
@@ -1353,6 +1406,7 @@ static int gpio_pre_remove(struct udevice *dev)
                if (uc_priv->name[i])
                        free(uc_priv->name[i]);
        }
+       free(uc_priv->claimed);
        free(uc_priv->name);
 
        return gpio_renumber(dev);
index 4654f9e0989853b78eee013fbbfa0a9f33c3bd8d..b0c66d18317eefd16911197896671d92158743ac 100644 (file)
@@ -407,6 +407,7 @@ static const struct udevice_id pca953x_ids[] = {
        { .compatible = "ti,tca6416", .data = OF_953X(16, PCA_INT), },
        { .compatible = "ti,tca6424", .data = OF_953X(24, PCA_INT), },
        { .compatible = "ti,tca9539", .data = OF_953X(16, PCA_INT), },
+       { .compatible = "ti,tca9554", .data = OF_953X(8, PCA_INT), },
 
        { .compatible = "onsemi,pca9654", .data = OF_953X(8, PCA_INT), },
 
index 4c76fd7e415bf66a184982b4291b9fcc20e31ae0..4f42200f3923a087da4d2141a78b82ef62a5fe75 100644 (file)
@@ -372,7 +372,7 @@ config SYS_MXC_I2C1_SPEED
 
 config SYS_MXC_I2C1_SLAVE
        hex "I2C1 Slave"
-       default 0
+       default 0x0
        help
         MXC I2C1 Slave
 endif
@@ -387,7 +387,7 @@ config SYS_MXC_I2C2_SPEED
 
 config SYS_MXC_I2C2_SLAVE
        hex "I2C2 Slave"
-       default 0
+       default 0x0
        help
         MXC I2C2 Slave
 endif
@@ -401,7 +401,7 @@ config SYS_MXC_I2C3_SPEED
 
 config SYS_MXC_I2C3_SLAVE
        hex "I2C3 Slave"
-       default 0
+       default 0x0
        help
         MXC I2C3 Slave
 endif
@@ -415,7 +415,7 @@ config SYS_MXC_I2C4_SPEED
 
 config SYS_MXC_I2C4_SLAVE
        hex "I2C4 Slave"
-       default 0
+       default 0x0
        help
         MXC I2C4 Slave
 endif
@@ -429,7 +429,7 @@ config SYS_MXC_I2C5_SPEED
 
 config SYS_MXC_I2C5_SLAVE
        hex "I2C5 Slave"
-       default 0
+       default 0x0
        help
         MXC I2C5 Slave
 endif
@@ -443,7 +443,7 @@ config SYS_MXC_I2C6_SPEED
 
 config SYS_MXC_I2C6_SLAVE
        hex "I2C6 Slave"
-       default 0
+       default 0x0
        help
         MXC I2C6 Slave
 endif
@@ -457,7 +457,7 @@ config SYS_MXC_I2C7_SPEED
 
 config SYS_MXC_I2C7_SLAVE
        hex "I2C7 Slave"
-       default 0
+       default 0x0
        help
         MXC I2C7 Slave
 endif
@@ -471,7 +471,7 @@ config SYS_MXC_I2C8_SPEED
 
 config SYS_MXC_I2C8_SLAVE
        hex "I2C8 Slave"
-       default 0
+       default 0x0
        help
         MXC I2C8 Slave
 endif
index b9f5c7a37aedf3c1d212296b3b541afa8040dc7b..a6e3f62ecb094d17e09c1f51f71e727bbca8cbd5 100644 (file)
@@ -555,7 +555,7 @@ config SPL_I2C_EEPROM
 config SYS_I2C_EEPROM_ADDR
        hex "Chip address of the EEPROM device"
        depends on ID_EEPROM || I2C_EEPROM || SPL_I2C_EEPROM || CMD_EEPROM || ENV_IS_IN_EEPROM
-       default 0
+       default 0x0
 
 if I2C_EEPROM
 
index 621d1752176a9175c75a78ddba18680cbc305965..9c1e6a5e3e70686feacce2d7bafe6f6468ffd7e0 100644 (file)
@@ -1100,8 +1100,11 @@ int cros_ec_get_sku_id(struct udevice *dev)
 
        ret = ec_command_inptr(dev, EC_CMD_GET_SKU_ID, 0, NULL, 0,
                               (uint8_t **)&r, sizeof(*r));
-       if (ret != sizeof(*r))
-               return -ret;
+       if (ret != sizeof(*r)) {
+               if (ret >= 0)
+                       ret = -EIO;
+               return ret;
+       }
 
        return r->sku_id;
 }
index 5085a3b491dac771fc931d171119626a20112a46..400066fa99a29b5cc41cd5818b89a386c27823d9 100644 (file)
@@ -509,6 +509,10 @@ static int dwmci_set_ios(struct mmc *mmc)
        if (mmc->vqmmc_supply) {
                int ret;
 
+               ret = regulator_set_enable_if_allowed(mmc->vqmmc_supply, false);
+               if (ret)
+                       return ret;
+
                if (mmc->signal_voltage == MMC_SIGNAL_VOLTAGE_180)
                        regulator_set_value(mmc->vqmmc_supply, 1800000);
                else
index 31cfda288587119cf65de3e483be69d6437bcedc..089a0442568cf3d698cbe88fd2897c6a8337c66b 100644 (file)
@@ -2775,9 +2775,10 @@ static int mmc_power_on(struct mmc *mmc)
 {
 #if CONFIG_IS_ENABLED(DM_MMC) && CONFIG_IS_ENABLED(DM_REGULATOR)
        if (mmc->vmmc_supply) {
-               int ret = regulator_set_enable(mmc->vmmc_supply, true);
+               int ret = regulator_set_enable_if_allowed(mmc->vmmc_supply,
+                                                         true);
 
-               if (ret && ret != -EACCES) {
+               if (ret && ret != -ENOSYS) {
                        printf("Error enabling VMMC supply : %d\n", ret);
                        return ret;
                }
@@ -2791,9 +2792,10 @@ static int mmc_power_off(struct mmc *mmc)
        mmc_set_clock(mmc, 0, MMC_CLK_DISABLE);
 #if CONFIG_IS_ENABLED(DM_MMC) && CONFIG_IS_ENABLED(DM_REGULATOR)
        if (mmc->vmmc_supply) {
-               int ret = regulator_set_enable(mmc->vmmc_supply, false);
+               int ret = regulator_set_enable_if_allowed(mmc->vmmc_supply,
+                                                         false);
 
-               if (ret && ret != -EACCES) {
+               if (ret && ret != -ENOSYS) {
                        pr_debug("Error disabling VMMC supply : %d\n", ret);
                        return ret;
                }
index 9873d112544d6685883c456ccf5a085ce84052f1..2b29c8def6d4f6a9bb1f08d6d817cfbf6a710b1f 100644 (file)
@@ -1474,7 +1474,6 @@ static void atmel_nand_init(struct atmel_nand_controller *nc,
 
        mtd->dev->parent = nc->dev;
        nand->controller = &nc->base;
-       nand->controller = &nc->base;
 
        chip->cmd_ctrl = atmel_nand_cmd_ctrl;
        chip->read_byte = atmel_nand_read_byte;
index 6d8eb177b500c63a47e12f2b7302443caea5271b..9a316d1de397e6e60e9a89f4ef77e4f18eaabaa6 100644 (file)
 
 #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 nvmxip_probe(struct udevice *udev)
 {
        int ret;
        struct udevice *bdev = NULL;
        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);
 
@@ -67,6 +53,12 @@ static int nvmxip_post_bind(struct udevice *udev)
        return 0;
 }
 
+static int nvmxip_post_bind(struct udevice *udev)
+{
+       dev_or_flags(udev, DM_FLAG_PROBE_AFTER_BIND);
+       return 0;
+}
+
 UCLASS_DRIVER(nvmxip) = {
        .name      = "nvmxip",
        .id        = UCLASS_NVMXIP,
index a359e3b4822e973a199f0fc355506f1ddd747175..0bd98d64275fa1a88f6e8841f0336826d12e84c3 100644 (file)
 #include <linux/errno.h>
 #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
@@ -49,15 +32,14 @@ static ulong nvmxip_blk_read(struct udevice *dev, lbaint_t blknr, lbaint_t blkcn
 {
        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);
+       /* number of bytes to read */
+       u32 size = blkcnt * desc->blksz;
        /* physical address of the first block to read */
        phys_addr_t blkaddr = plat->phys_base + blknr * desc->blksz;
-       u64 *virt_blkaddr;
-       u64 *pdst = buffer;
+       void *virt_blkaddr;
        uint qdata_idx;
 
-       if (!pdst)
+       if (!buffer)
                return -EINVAL;
 
        log_debug("[%s]: reading from blknr: %lu , blkcnt: %lu\n", dev->name, blknr, blkcnt);
@@ -66,12 +48,16 @@ static ulong nvmxip_blk_read(struct udevice *dev, lbaint_t blknr, lbaint_t blkcn
 
        /* 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++);
-
+#if IS_ENABLED(CONFIG_PHYS_64BIT)
+       for (qdata_idx = 0 ; qdata_idx < size; qdata_idx += sizeof(u64))
+               *(u64 *)(buffer + qdata_idx) = readq(virt_blkaddr + qdata_idx);
+#else
+       for (qdata_idx = 0 ; qdata_idx < size; qdata_idx += sizeof(u32))
+               *(u32 *)(buffer + qdata_idx) = readl(virt_blkaddr + qdata_idx);
+#endif
        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 *)virt_blkaddr,
                  *(u64 *)buffer,
                  *(u64 *)((u8 *)virt_blkaddr + desc->blksz * blkcnt - sizeof(u64)),
                  *(u64 *)((u8 *)buffer + desc->blksz * blkcnt - sizeof(u64)));
index 7221fd1cb46dcc819c0cfd0e3e9b33a9fb07a848..4d7471118a4c1394b6b510e6a05345c3ea143e9b 100644 (file)
@@ -50,8 +50,8 @@ static int nvmxip_qspi_of_to_plat(struct udevice *dev)
                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);
+       log_debug("[%s]: XIP device base addr: 0x%p , lba_shift: %d , lbas: %lu\n",
+                 dev->name, (void *)(uintptr_t)plat->phys_base, plat->lba_shift, plat->lba);
 
        return 0;
 }
@@ -66,5 +66,6 @@ U_BOOT_DRIVER(nvmxip_qspi) = {
        .id = UCLASS_NVMXIP,
        .of_match = nvmxip_qspi_ids,
        .of_to_plat = nvmxip_qspi_of_to_plat,
+       .probe = nvmxip_probe,
        .plat_auto = sizeof(struct nvmxip_plat),
 };
index 51a8167d14a97d16aaaf8564935c6bcb4ddf43ec..f4e58093805d2c1652728651ae0067fb4e34f78b 100644 (file)
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <malloc.h>
 #include <asm/cache.h>
+#include <asm/gpio.h>
 #include <asm/io.h>
 #include <asm/processor.h>
 #include <clk.h>
@@ -26,6 +27,7 @@
 #include <soc.h>
 #include <syscon.h>
 #include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/soc/ti/ti-udma.h>
 
 #include "cpsw_mdio.h"
 #define AM65_CPSW_PN_REG_SA_L                  0x308
 #define AM65_CPSW_PN_REG_SA_H                  0x30c
 
+#define AM65_CPSW_SGMII_CONTROL_REG             0x010
+#define AM65_CPSW_SGMII_MR_ADV_ABILITY_REG      0x018
+#define AM65_CPSW_SGMII_CONTROL_MR_AN_ENABLE    BIT(0)
+
+#define ADVERTISE_SGMII                                0x1
+
 #define AM65_CPSW_ALE_CTL_REG                  0x8
 #define AM65_CPSW_ALE_CTL_REG_ENABLE           BIT(31)
 #define AM65_CPSW_ALE_CTL_REG_RESET_TBL                BIT(30)
 
 #define AM65_CPSW_CPPI_PKT_TYPE                        0x7
 
+#define DEFAULT_GPIO_RESET_DELAY               10
+
 struct am65_cpsw_port {
        fdt_addr_t      port_base;
+       fdt_addr_t      port_sgmii_base;
        fdt_addr_t      macsl_base;
        bool            disabled;
        u32             mac_control;
@@ -113,6 +124,10 @@ struct am65_cpsw_common {
        struct mii_dev          *bus;
        u32                     bus_freq;
 
+       struct gpio_desc        mdio_gpio_reset;
+       u32                     reset_delay_us;
+       u32                     reset_post_delay_us;
+
        struct dma              dma_tx;
        struct dma              dma_rx;
        u32                     rx_next;
@@ -204,6 +219,8 @@ static int am65_cpsw_update_link(struct am65_cpsw_priv *priv)
                        mac_control |= AM65_CPSW_MACSL_CTL_REG_FULL_DUPLEX;
                if (phy->speed == 100)
                        mac_control |= AM65_CPSW_MACSL_CTL_REG_IFCTL_A;
+               if (phy->interface == PHY_INTERFACE_MODE_SGMII)
+                       mac_control |= AM65_CPSW_MACSL_CTL_EXT_EN;
        }
 
        if (mac_control == port->mac_control)
@@ -229,6 +246,7 @@ out:
 #define AM65_GMII_SEL_MODE_MII         0
 #define AM65_GMII_SEL_MODE_RMII                1
 #define AM65_GMII_SEL_MODE_RGMII       2
+#define AM65_GMII_SEL_MODE_SGMII       3
 
 #define AM65_GMII_SEL_RGMII_IDMODE     BIT(4)
 
@@ -280,6 +298,10 @@ static int am65_cpsw_gmii_sel_k3(struct am65_cpsw_priv *priv,
                rgmii_id = true;
                break;
 
+       case PHY_INTERFACE_MODE_SGMII:
+               mode = AM65_GMII_SEL_MODE_SGMII;
+               break;
+
        default:
                dev_warn(dev,
                         "Unsupported PHY mode: %u. Defaulting to MII.\n",
@@ -420,6 +442,13 @@ static int am65_cpsw_start(struct udevice *dev)
                goto err_dis_rx;
        }
 
+       if (priv->phydev->interface == PHY_INTERFACE_MODE_SGMII) {
+               writel(ADVERTISE_SGMII,
+                      port->port_sgmii_base + AM65_CPSW_SGMII_MR_ADV_ABILITY_REG);
+               writel(AM65_CPSW_SGMII_CONTROL_MR_AN_ENABLE,
+                      port->port_sgmii_base + AM65_CPSW_SGMII_CONTROL_REG);
+       }
+
        ret = phy_startup(priv->phydev);
        if (ret) {
                dev_err(dev, "phy_startup failed\n");
@@ -658,6 +687,16 @@ static int am65_cpsw_mdio_init(struct udevice *dev)
        if (!priv->has_phy || cpsw_common->bus)
                return 0;
 
+       if (IS_ENABLED(CONFIG_DM_GPIO)) {
+               if (dm_gpio_is_valid(&cpsw_common->mdio_gpio_reset)) {
+                       dm_gpio_set_value(&cpsw_common->mdio_gpio_reset, 1);
+                       udelay(cpsw_common->reset_delay_us);
+                       dm_gpio_set_value(&cpsw_common->mdio_gpio_reset, 0);
+                       if (cpsw_common->reset_post_delay_us > 0)
+                               udelay(cpsw_common->reset_post_delay_us);
+               }
+       }
+
        ret = am65_cpsw_mdio_setup(dev);
        if (ret)
                return ret;
@@ -797,7 +836,7 @@ out:
 static int am65_cpsw_probe_nuss(struct udevice *dev)
 {
        struct am65_cpsw_common *cpsw_common = dev_get_priv(dev);
-       ofnode ports_np, node;
+       ofnode ports_np, node, mdio_np;
        int ret, i;
        struct udevice *port_dev;
 
@@ -824,6 +863,24 @@ static int am65_cpsw_probe_nuss(struct udevice *dev)
                                AM65_CPSW_CPSW_NU_ALE_BASE;
        cpsw_common->mdio_base = cpsw_common->ss_base + AM65_CPSW_MDIO_BASE;
 
+       if (IS_ENABLED(CONFIG_DM_GPIO)) {
+               /* get bus level PHY reset GPIO details */
+               mdio_np = dev_read_subnode(dev, "mdio");
+               if (!ofnode_valid(mdio_np)) {
+                       ret = -ENOENT;
+                       goto out;
+               }
+
+               cpsw_common->reset_delay_us = ofnode_read_u32_default(mdio_np, "reset-delay-us",
+                                                                     DEFAULT_GPIO_RESET_DELAY);
+               cpsw_common->reset_post_delay_us = ofnode_read_u32_default(mdio_np,
+                                                                          "reset-post-delay-us",
+                                                                          0);
+               ret = gpio_request_by_name_nodev(mdio_np, "reset-gpios", 0,
+                                                &cpsw_common->mdio_gpio_reset,
+                                                GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE);
+       }
+
        ports_np = dev_read_subnode(dev, "ethernet-ports");
        if (!ofnode_valid(ports_np)) {
                ret = -ENOENT;
@@ -872,6 +929,8 @@ static int am65_cpsw_probe_nuss(struct udevice *dev)
                port->port_base = cpsw_common->cpsw_base +
                                  AM65_CPSW_CPSW_NU_PORTS_OFFSET +
                                  (i * AM65_CPSW_CPSW_NU_PORTS_OFFSET);
+               port->port_sgmii_base = cpsw_common->ss_base +
+                                       (i * AM65_CPSW_SGMII_BASE);
                port->macsl_base = port->port_base +
                                   AM65_CPSW_CPSW_NU_PORT_MACSL_OFFSET;
        }
index a0bf44d38a9faa335b9af8c3954b4f646b64b65a..463ec47eb92d5cdbda4d84fa9b1edc4663df3520 100644 (file)
@@ -121,11 +121,18 @@ config PCIE_APPLE
        bool "Enable Apple PCIe driver"
        depends on ARCH_APPLE
        imply PCI_INIT_R
+       select SYS_PCI_64BIT
        default y
        help
          Say Y here if you want to enable PCIe controller support on
          Apple SoCs.
 
+config PCI_FTPCI100
+       bool "Enable Faraday FTPCI100 PCI Bridge Controller driver"
+       help
+         Say Y here if you want to enable Faraday FTPCI100 PCI.
+         FTPCI100 IP is used in SoC chip designs.
+
 config PCI_GT64120
        bool "GT64120 PCI support"
        depends on MIPS
index a712a317a398a079555ed68d700ea5d973bfca10..72ef8b4bc77279b52b5e6cfa8cc2e39db2f78c22 100644 (file)
@@ -14,6 +14,7 @@ obj-$(CONFIG_PCI) += pci_auto_common.o pci_common.o
 obj-$(CONFIG_PCIE_ECAM_GENERIC) += pcie_ecam_generic.o
 obj-$(CONFIG_PCIE_ECAM_SYNQUACER) += pcie_ecam_synquacer.o
 obj-$(CONFIG_PCIE_APPLE) += pcie_apple.o
+obj-$(CONFIG_PCI_FTPCI100) += pci_ftpci100.o
 obj-$(CONFIG_PCI_GT64120) += pci_gt64120.o
 obj-$(CONFIG_PCI_MPC85XX) += pci_mpc85xx.o
 obj-$(CONFIG_PCI_MSC01) += pci_msc01.o
index 632c1a63cfce99c9e657268197ea7a8f9cfc894d..0adcdceb1d34fc21cf4aeebe4bcbfdf1d3307bee 100644 (file)
@@ -541,14 +541,13 @@ int pci_auto_config_devices(struct udevice *bus)
        struct pci_child_plat *pplat;
        unsigned int sub_bus;
        struct udevice *dev;
-       int ret;
 
        sub_bus = dev_seq(bus);
        debug("%s: start\n", __func__);
        pciauto_config_init(hose);
-       for (ret = device_find_first_child(bus, &dev);
-            !ret && dev;
-            ret = device_find_next_child(&dev)) {
+       for (device_find_first_child(bus, &dev);
+            dev;
+            device_find_next_child(&dev)) {
                unsigned int max_bus;
                int ret;
 
@@ -1446,7 +1445,7 @@ phys_addr_t dm_pci_bus_to_phys(struct udevice *dev, pci_addr_t bus_addr,
                return res->phys_start + offset;
        }
 
-       puts("pci_hose_bus_to_phys: invalid physical address\n");
+       puts("dm_pci_bus_to_phys: invalid physical address\n");
        return 0;
 }
 
@@ -1486,7 +1485,7 @@ pci_addr_t dm_pci_phys_to_bus(struct udevice *dev, phys_addr_t phys_addr,
                return res->bus_start + offset;
        }
 
-       puts("pci_hose_phys_to_bus: invalid physical address\n");
+       puts("dm_pci_phys_to_bus: invalid physical address\n");
        return 0;
 }
 
diff --git a/drivers/pci/pci_ftpci100.c b/drivers/pci/pci_ftpci100.c
new file mode 100644 (file)
index 0000000..a177544
--- /dev/null
@@ -0,0 +1,95 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include <common.h>
+#include <pci.h>
+#include <dm.h>
+#include <asm/io.h>
+
+struct ftpci100_data {
+       void *reg_base;
+};
+
+/* AHB Control Registers */
+struct ftpci100_ahbc {
+       u32 iosize;     /* 0x00 - I/O Space Size Signal */
+       u32 prot;       /* 0x04 - AHB Protection */
+       u32 rsved[8];   /* 0x08-0x24 - Reserved */
+       u32 conf;       /* 0x28 - PCI Configuration */
+       u32 data;       /* 0x2c - PCI Configuration DATA */
+};
+
+static int ftpci100_read_config(const struct udevice *dev, pci_dev_t bdf,
+                               uint offset, ulong *valuep,
+                               enum pci_size_t size)
+{
+       struct ftpci100_data *priv = dev_get_priv(dev);
+       struct ftpci100_ahbc *regs = priv->reg_base;
+       u32 data;
+
+       out_le32(&regs->conf, PCI_CONF1_ADDRESS(PCI_BUS(bdf), PCI_DEV(bdf), PCI_FUNC(bdf), offset));
+       data = in_le32(&regs->data);
+       *valuep = pci_conv_32_to_size(data, offset, size);
+
+       return 0;
+}
+
+static int ftpci100_write_config(struct udevice *dev, pci_dev_t bdf,
+                                uint offset, ulong value,
+                                enum pci_size_t size)
+{
+       struct ftpci100_data *priv = dev_get_priv(dev);
+       struct ftpci100_ahbc *regs = priv->reg_base;
+       u32 data;
+
+       out_le32(&regs->conf, PCI_CONF1_ADDRESS(PCI_BUS(bdf), PCI_DEV(bdf), PCI_FUNC(bdf), offset));
+
+       if (size == PCI_SIZE_32) {
+               data = value;
+       } else {
+               u32 old = in_le32(&regs->data);
+
+               data = pci_conv_size_to_32(old, value, offset, size);
+       }
+
+       out_le32(&regs->data, data);
+
+       return 0;
+}
+
+static int ftpci100_probe(struct udevice *dev)
+{
+       struct ftpci100_data *priv = dev_get_priv(dev);
+       struct pci_region *io, *mem;
+       int count;
+
+       count = pci_get_regions(dev, &io, &mem, NULL);
+       if (count != 2) {
+               printf("%s: wrong count of regions: %d != 2\n", dev->name, count);
+               return -EINVAL;
+       }
+
+       priv->reg_base = phys_to_virt(io->phys_start);
+       if (!priv->reg_base)
+               return -EINVAL;
+
+       return 0;
+}
+
+static const struct dm_pci_ops ftpci100_ops = {
+       .read_config    = ftpci100_read_config,
+       .write_config   = ftpci100_write_config,
+};
+
+static const struct udevice_id ftpci100_ids[] = {
+       { .compatible = "faraday,ftpci100" },
+       { }
+};
+
+U_BOOT_DRIVER(ftpci100_pci) = {
+       .name           = "ftpci100_pci",
+       .id             = UCLASS_PCI,
+       .of_match       = ftpci100_ids,
+       .ops            = &ftpci100_ops,
+       .probe          = ftpci100_probe,
+       .priv_auto      = sizeof(struct ftpci100_data),
+};
index 1de28021138a7c31587b6336a8dffe843d9b18a3..cd45f0bee9b7996b9305eb80fb282904a87821e4 100644 (file)
@@ -33,6 +33,9 @@
 #define PCIE_RC_CFG_PRIV1_ID_VAL3                      0x043c
 #define  CFG_PRIV1_ID_VAL3_CLASS_CODE_MASK             0xffffff
 
+#define PCIE_RC_CFG_PRIV1_LINK_CAPABILITY                      0x04dc
+#define  PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK   0xc00
+
 #define PCIE_RC_DL_MDIO_ADDR                           0x1100
 #define PCIE_RC_DL_MDIO_WR_DATA                                0x1104
 #define PCIE_RC_DL_MDIO_RD_DATA                                0x1108
@@ -88,7 +91,6 @@
         PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LIMIT_HI + ((win) * 8)
 
 #define PCIE_MISC_HARD_PCIE_HARD_DEBUG                 0x4204
-#define  PCIE_HARD_DEBUG_CLKREQ_DEBUG_ENABLE_MASK      0x2
 #define  PCIE_HARD_DEBUG_SERDES_IDDQ_MASK              0x08000000
 
 #define PCIE_MSI_INTR2_CLR                             0x4508
@@ -223,6 +225,10 @@ static int brcm_pcie_config_address(const struct udevice *dev, pci_dev_t bdf,
                return 0;
        }
 
+       /* An access to our HW w/o link-up will cause a CPU Abort */
+       if (!brcm_pcie_link_up(pcie))
+               return -EINVAL;
+
        /* For devices, write to the config space index register */
        idx = PCIE_ECAM_OFFSET(pci_bus, pci_dev, pci_func, 0);
 
@@ -505,6 +511,12 @@ static int brcm_pcie_probe(struct udevice *dev)
        clrbits_le32(pcie->base + PCIE_RGR1_SW_INIT_1,
                     RGR1_SW_INIT_1_PERST_MASK);
 
+       /*
+        * Wait for 100ms after PERST# deassertion; see PCIe CEM specification
+        * sections 2.2, PCIe r5.0, 6.6.1.
+        */
+       mdelay(100);
+
        /* Give the RC/EP time to wake up, before trying to configure RC.
         * Intermittently check status for link-up, up to a total of 100ms.
         */
@@ -562,12 +574,18 @@ static int brcm_pcie_probe(struct udevice *dev)
        clrsetbits_le32(base + PCIE_RC_CFG_VENDOR_SPECIFIC_REG1,
                        VENDOR_SPECIFIC_REG1_ENDIAN_MODE_BAR2_MASK,
                        VENDOR_SPECIFIC_REG1_LITTLE_ENDIAN);
+
        /*
-        * Refclk from RC should be gated with CLKREQ# input when ASPM L0s,L1
-        * is enabled => setting the CLKREQ_DEBUG_ENABLE field to 1.
+        * We used to enable the CLKREQ# input here, but a few PCIe cards don't
+        * attach anything to the CLKREQ# line, so we shouldn't assume that
+        * it's connected and working. The controller does allow detecting
+        * whether the port on the other side of our link is/was driving this
+        * signal, so we could check before we assume. But because this signal
+        * is for power management, which doesn't make sense in a bootloader,
+        * let's instead just unadvertise ASPM support.
         */
-       setbits_le32(base + PCIE_MISC_HARD_PCIE_HARD_DEBUG,
-                    PCIE_HARD_DEBUG_CLKREQ_DEBUG_ENABLE_MASK);
+       clrbits_le32(base + PCIE_RC_CFG_PRIV1_LINK_CAPABILITY,
+                    PCIE_RC_CFG_PRIV1_LINK_CAPABILITY_ASPM_SUPPORT_MASK);
 
        return 0;
 }
index 7a2d54f71d21bbfd4950af29c2151c89711f0947..8ac5769ed9a04625a0832d3645ea63c23f6312d2 100644 (file)
@@ -70,6 +70,16 @@ config AB8500_USB_PHY
        help
          Support for the USB OTG PHY in ST-Ericsson AB8500.
 
+config APPLE_ATCPHY
+       bool "Apple Type-C PHY Driver"
+       depends on PHY && ARCH_APPLE
+       default y
+       help
+         Support for the Apple Type-C PHY.
+
+        This is a dummy driver since the PHY is initialized
+        sufficiently by previous stage firmware.
+
 config BCM6318_USBH_PHY
        bool "BCM6318 USBH PHY support"
        depends on PHY && ARCH_BMIPS
index aca365d219c4b325eedb4b94659453194cfe0890..5d4de86e71ad3d492240d376a2792777bd2eb230 100644 (file)
@@ -12,6 +12,7 @@ obj-$(CONFIG_$(SPL_)PHY) += phy-uclass.o
 obj-$(CONFIG_$(SPL_)NOP_PHY) += nop-phy.o
 obj-$(CONFIG_MIPI_DPHY_HELPERS) += phy-core-mipi-dphy.o
 obj-$(CONFIG_AB8500_USB_PHY) += phy-ab8500-usb.o
+obj-$(CONFIG_APPLE_ATCPHY) += phy-apple-atc.o
 obj-$(CONFIG_BCM6318_USBH_PHY) += bcm6318-usbh-phy.o
 obj-$(CONFIG_BCM6348_USBH_PHY) += bcm6348-usbh-phy.o
 obj-$(CONFIG_BCM6358_USBH_PHY) += bcm6358-usbh-phy.o
diff --git a/drivers/phy/phy-apple-atc.c b/drivers/phy/phy-apple-atc.c
new file mode 100644 (file)
index 0000000..15c5b8a
--- /dev/null
@@ -0,0 +1,56 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2022 Mark Kettenis <kettenis@openbsd.org>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <dm/device-internal.h>
+#include <generic-phy.h>
+#include <reset-uclass.h>
+
+static const struct phy_ops apple_atcphy_ops = {
+};
+
+static struct driver apple_atcphy_driver = {
+       .name = "apple-atcphy",
+       .id = UCLASS_PHY,
+       .ops = &apple_atcphy_ops,
+};
+
+static int apple_atcphy_reset_of_xlate(struct reset_ctl *reset_ctl,
+                                      struct ofnode_phandle_args *args)
+{
+       if (args->args_count != 0)
+               return -EINVAL;
+
+       return 0;
+}
+
+static const struct reset_ops apple_atcphy_reset_ops = {
+       .of_xlate = apple_atcphy_reset_of_xlate,
+};
+
+static int apple_atcphy_reset_probe(struct udevice *dev)
+{
+       struct udevice *child;
+
+       device_bind(dev, &apple_atcphy_driver, "apple-atcphy", NULL,
+                   dev_ofnode(dev), &child);
+
+       return 0;
+}
+
+static const struct udevice_id apple_atcphy_ids[] = {
+       { .compatible = "apple,t6000-atcphy" },
+       { .compatible = "apple,t8103-atcphy" },
+       { }
+};
+
+U_BOOT_DRIVER(apple_atcphy_reset) = {
+       .name = "apple-atcphy-reset",
+       .id = UCLASS_RESET,
+       .of_match = apple_atcphy_ids,
+       .ops = &apple_atcphy_reset_ops,
+       .probe = apple_atcphy_reset_probe,
+};
index 34314d0bd1eadaf8b958edee5577b7d5a5ebe49c..72613399073eea7464a4c716da169f2f55001f2b 100644 (file)
@@ -585,12 +585,20 @@ static int wiz_reset_assert(struct reset_ctl *reset_ctl)
 
 static int wiz_phy_fullrt_div(struct wiz *wiz, int lane)
 {
-       if (wiz->type != AM64_WIZ_10G)
-               return 0;
-
-       if (wiz->lane_phy_type[lane] == PHY_TYPE_PCIE)
-               return regmap_field_write(wiz->p0_fullrt_div[lane], 0x1);
+       switch (wiz->type) {
+       case AM64_WIZ_10G:
+               if (wiz->lane_phy_type[lane] == PHY_TYPE_PCIE)
+                       return regmap_field_write(wiz->p0_fullrt_div[lane], 0x1);
+               break;
 
+       case J721E_WIZ_16G:
+       case J721E_WIZ_10G:
+               if (wiz->lane_phy_type[lane] == PHY_TYPE_SGMII)
+                       return regmap_field_write(wiz->p0_fullrt_div[lane], 0x2);
+               break;
+       default:
+               return 0;
+       }
        return 0;
 }
 
@@ -706,7 +714,8 @@ static int wiz_p_mac_div_sel(struct wiz *wiz)
        int i;
 
        for (i = 0; i < num_lanes; i++) {
-               if (wiz->lane_phy_type[i] == PHY_TYPE_QSGMII) {
+               if (wiz->lane_phy_type[i] == PHY_TYPE_SGMII ||
+                   wiz->lane_phy_type[i] == PHY_TYPE_QSGMII) {
                        ret = regmap_field_write(wiz->p_mac_div_sel0[i], 1);
                        if (ret)
                                return ret;
index 50bcc9030e98482865b33f1d7a6161ccb363f765..19fe4053be818aa9b6f6f7116e1deb1ac59f78b4 100644 (file)
@@ -689,7 +689,7 @@ static int alloc_vring(struct udevice *dev, struct fw_rsc_vdev *rsc, int i)
        debug("alloc_mem(%#x, %d): %p\n", size, order, pa);
        vring->da = (uintptr_t)pa;
 
-       return !pa;
+       return 0;
 }
 
 static int handle_vdev(struct udevice *dev, struct fw_rsc_vdev *rsc,
index 0a3420b7fbc2b4931344d6d78b085ac1375e1eeb..7411660d465eb188b749a2d2b940bc77b5a995aa 100644 (file)
@@ -14,6 +14,7 @@
 #include <env.h>
 #include <libata.h>
 #include <log.h>
+#include <memalign.h>
 #include <part.h>
 #include <pci.h>
 #include <scsi.h>
@@ -42,7 +43,7 @@ const struct pci_device_id scsi_device_list[] = { SCSI_DEV_LIST };
 #endif
 static struct scsi_cmd tempccb;        /* temporary scsi command buffer */
 
-static unsigned char tempbuff[512]; /* temporary data buffer */
+DEFINE_CACHE_ALIGN_BUFFER(u8, tempbuff, 512);  /* temporary data buffer */
 
 #if !defined(CONFIG_DM_SCSI)
 static int scsi_max_devs; /* number of highest available scsi device */
@@ -273,6 +274,18 @@ static ulong scsi_write(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt,
              __func__, start, smallblks, buf_addr);
        return blkcnt;
 }
+
+#if IS_ENABLED(CONFIG_BOUNCE_BUFFER)
+static int scsi_buffer_aligned(struct udevice *dev, struct bounce_buffer *state)
+{
+       struct scsi_ops *ops = scsi_get_ops(dev->parent);
+
+       if (ops->buffer_aligned)
+               return ops->buffer_aligned(dev->parent, state);
+
+       return 1;
+}
+#endif /* CONFIG_BOUNCE_BUFFER */
 #endif
 
 #if defined(CONFIG_PCI) && !defined(CONFIG_SCSI_AHCI_PLAT) && \
@@ -490,7 +503,7 @@ static int scsi_detect_dev(struct udevice *dev, int target, int lun,
 
        pccb->target = target;
        pccb->lun = lun;
-       pccb->pdata = (unsigned char *)&tempbuff;
+       pccb->pdata = tempbuff;
        pccb->datalen = 512;
        pccb->dma_dir = DMA_FROM_DEVICE;
        scsi_setup_inquiry(pccb);
@@ -719,6 +732,9 @@ int scsi_scan(bool verbose)
 static const struct blk_ops scsi_blk_ops = {
        .read   = scsi_read,
        .write  = scsi_write,
+#if IS_ENABLED(CONFIG_BOUNCE_BUFFER)
+       .buffer_aligned = scsi_buffer_aligned,
+#endif /* CONFIG_BOUNCE_BUFFER */
 };
 
 U_BOOT_DRIVER(scsi_blk) = {
index a1e089962a91b79878c2684fcb2e2906c3a8dc2a..7ca42df6a7e27782fd8424b05959d19ec5c7cc83 100644 (file)
@@ -482,8 +482,8 @@ endchoice
 config DEBUG_UART_BASE
        hex "Base address of UART"
        depends on DEBUG_UART
-       default 0 if DEBUG_SBI_CONSOLE
-       default 0 if DEBUG_UART_SANDBOX
+       default 0x0 if DEBUG_SBI_CONSOLE
+       default 0x0 if DEBUG_UART_SANDBOX
        default 0xff000000 if DEBUG_UART_ZYNQ && ARCH_ZYNQMP
        default 0xe0000000 if DEBUG_UART_ZYNQ && ARCH_ZYNQ
        help
@@ -1139,6 +1139,6 @@ config SYS_SDSR
 config SYS_SDMR
        hex "SDMR Value"
        depends on MPC8XX_CONS
-       default 0
+       default 0x0
 
 endif
index 067fae26145cf0a342f08854c9c79db623f11197..e954f0189bbddff3fd84a2628a7d095ff62e54e2 100644 (file)
@@ -151,6 +151,7 @@ static void serial_find_console_or_panic(void)
 #ifdef CONFIG_REQUIRE_SERIAL_CONSOLE
        panic_str("No serial driver found");
 #endif
+       gd->cur_serial_dev = NULL;
 }
 #endif /* CONFIG_SERIAL_PRESENT */
 
index bad1bf7de5f0b4397547f493fa5f519543dff454..1e62e252e7aed5c38858d3790d56112f4b0a576e 100644 (file)
@@ -119,7 +119,7 @@ static const struct udevice_id cdns_ufs_pltfm_ids[] = {
 
 U_BOOT_DRIVER(cdns_ufs_pltfm) = {
        .name           = "cdns-ufs-pltfm",
-       .id             =  UCLASS_UFS,
+       .id             = UCLASS_UFS,
        .of_match       = cdns_ufs_pltfm_ids,
        .probe          = cdns_ufs_pltfm_probe,
        .bind           = cdns_ufs_pltfm_bind,
index 3bf1a95e7f2210e5c18d96e8cae8072277494262..7c48d57f99d69bc0dfc9216c2b9cbfc9d407e1c7 100644 (file)
@@ -8,6 +8,7 @@
  * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com
  */
 
+#include <bouncebuf.h>
 #include <charset.h>
 #include <common.h>
 #include <dm.h>
@@ -691,14 +692,30 @@ static inline u8 ufshcd_get_upmcrs(struct ufs_hba *hba)
        return (ufshcd_readl(hba, REG_CONTROLLER_STATUS) >> 8) & 0x7;
 }
 
+/**
+ * ufshcd_cache_flush_and_invalidate - Flush and invalidate cache
+ *
+ * Flush and invalidate cache in aligned address..address+size range.
+ * The invalidation is in place to avoid stale data in cache.
+ */
+static void ufshcd_cache_flush_and_invalidate(void *addr, unsigned long size)
+{
+       uintptr_t aaddr = (uintptr_t)addr & ~(ARCH_DMA_MINALIGN - 1);
+       unsigned long asize = ALIGN(size, ARCH_DMA_MINALIGN);
+
+       flush_dcache_range(aaddr, aaddr + asize);
+       invalidate_dcache_range(aaddr, aaddr + asize);
+}
+
 /**
  * ufshcd_prepare_req_desc_hdr() - Fills the requests header
  * descriptor according to request
  */
-static void ufshcd_prepare_req_desc_hdr(struct utp_transfer_req_desc *req_desc,
+static void ufshcd_prepare_req_desc_hdr(struct ufs_hba *hba,
                                        u32 *upiu_flags,
                                        enum dma_data_direction cmd_dir)
 {
+       struct utp_transfer_req_desc *req_desc = hba->utrdl;
        u32 data_direction;
        u32 dword_0;
 
@@ -733,6 +750,8 @@ static void ufshcd_prepare_req_desc_hdr(struct utp_transfer_req_desc *req_desc,
        req_desc->header.dword_3 = 0;
 
        req_desc->prd_table_length = 0;
+
+       ufshcd_cache_flush_and_invalidate(req_desc, sizeof(*req_desc));
 }
 
 static void ufshcd_prepare_utp_query_req_upiu(struct ufs_hba *hba,
@@ -761,10 +780,15 @@ static void ufshcd_prepare_utp_query_req_upiu(struct ufs_hba *hba,
        memcpy(&ucd_req_ptr->qr, &query->request.upiu_req, QUERY_OSF_SIZE);
 
        /* Copy the Descriptor */
-       if (query->request.upiu_req.opcode == UPIU_QUERY_OPCODE_WRITE_DESC)
+       if (query->request.upiu_req.opcode == UPIU_QUERY_OPCODE_WRITE_DESC) {
                memcpy(ucd_req_ptr + 1, query->descriptor, len);
+               ufshcd_cache_flush_and_invalidate(ucd_req_ptr, 2 * sizeof(*ucd_req_ptr));
+       } else {
+               ufshcd_cache_flush_and_invalidate(ucd_req_ptr, sizeof(*ucd_req_ptr));
+       }
 
        memset(hba->ucd_rsp_ptr, 0, sizeof(struct utp_upiu_rsp));
+       ufshcd_cache_flush_and_invalidate(hba->ucd_rsp_ptr, sizeof(*hba->ucd_rsp_ptr));
 }
 
 static inline void ufshcd_prepare_utp_nop_upiu(struct ufs_hba *hba)
@@ -781,6 +805,9 @@ static inline void ufshcd_prepare_utp_nop_upiu(struct ufs_hba *hba)
        ucd_req_ptr->header.dword_2 = 0;
 
        memset(hba->ucd_rsp_ptr, 0, sizeof(struct utp_upiu_rsp));
+
+       ufshcd_cache_flush_and_invalidate(ucd_req_ptr, sizeof(*ucd_req_ptr));
+       ufshcd_cache_flush_and_invalidate(hba->ucd_rsp_ptr, sizeof(*hba->ucd_rsp_ptr));
 }
 
 /**
@@ -792,11 +819,10 @@ static int ufshcd_comp_devman_upiu(struct ufs_hba *hba,
 {
        u32 upiu_flags;
        int ret = 0;
-       struct utp_transfer_req_desc *req_desc = hba->utrdl;
 
        hba->dev_cmd.type = cmd_type;
 
-       ufshcd_prepare_req_desc_hdr(req_desc, &upiu_flags, DMA_NONE);
+       ufshcd_prepare_req_desc_hdr(hba, &upiu_flags, DMA_NONE);
        switch (cmd_type) {
        case DEV_CMD_TYPE_QUERY:
                ufshcd_prepare_utp_query_req_upiu(hba, upiu_flags);
@@ -857,7 +883,9 @@ static inline int ufshcd_get_req_rsp(struct utp_upiu_rsp *ucd_rsp_ptr)
  */
 static inline int ufshcd_get_tr_ocs(struct ufs_hba *hba)
 {
-       return le32_to_cpu(hba->utrdl->header.dword_2) & MASK_OCS;
+       struct utp_transfer_req_desc *req_desc = hba->utrdl;
+
+       return le32_to_cpu(req_desc->header.dword_2) & MASK_OCS;
 }
 
 static inline int ufshcd_get_rsp_upiu_result(struct utp_upiu_rsp *ucd_rsp_ptr)
@@ -1406,6 +1434,8 @@ void ufshcd_prepare_utp_scsi_cmd_upiu(struct ufs_hba *hba,
        memcpy(ucd_req_ptr->sc.cdb, pccb->cmd, cdb_len);
 
        memset(hba->ucd_rsp_ptr, 0, sizeof(struct utp_upiu_rsp));
+       ufshcd_cache_flush_and_invalidate(ucd_req_ptr, sizeof(*ucd_req_ptr));
+       ufshcd_cache_flush_and_invalidate(hba->ucd_rsp_ptr, sizeof(*hba->ucd_rsp_ptr));
 }
 
 static inline void prepare_prdt_desc(struct ufshcd_sg_entry *entry,
@@ -1420,6 +1450,7 @@ static void prepare_prdt_table(struct ufs_hba *hba, struct scsi_cmd *pccb)
 {
        struct utp_transfer_req_desc *req_desc = hba->utrdl;
        struct ufshcd_sg_entry *prd_table = hba->ucd_prdt_ptr;
+       uintptr_t aaddr = (uintptr_t)(pccb->pdata) & ~(ARCH_DMA_MINALIGN - 1);
        ulong datalen = pccb->datalen;
        int table_length;
        u8 *buf;
@@ -1427,9 +1458,19 @@ static void prepare_prdt_table(struct ufs_hba *hba, struct scsi_cmd *pccb)
 
        if (!datalen) {
                req_desc->prd_table_length = 0;
+               ufshcd_cache_flush_and_invalidate(req_desc, sizeof(*req_desc));
                return;
        }
 
+       if (pccb->dma_dir == DMA_TO_DEVICE) {   /* Write to device */
+               flush_dcache_range(aaddr, aaddr +
+                                  ALIGN(datalen, ARCH_DMA_MINALIGN));
+       }
+
+       /* In any case, invalidate cache to avoid stale data in it. */
+       invalidate_dcache_range(aaddr, aaddr +
+                               ALIGN(datalen, ARCH_DMA_MINALIGN));
+
        table_length = DIV_ROUND_UP(pccb->datalen, MAX_PRDT_ENTRY);
        buf = pccb->pdata;
        i = table_length;
@@ -1443,17 +1484,18 @@ static void prepare_prdt_table(struct ufs_hba *hba, struct scsi_cmd *pccb)
        prepare_prdt_desc(&prd_table[table_length - i - 1], buf, datalen - 1);
 
        req_desc->prd_table_length = table_length;
+       ufshcd_cache_flush_and_invalidate(prd_table, sizeof(*prd_table) * table_length);
+       ufshcd_cache_flush_and_invalidate(req_desc, sizeof(*req_desc));
 }
 
 static int ufs_scsi_exec(struct udevice *scsi_dev, struct scsi_cmd *pccb)
 {
        struct ufs_hba *hba = dev_get_uclass_priv(scsi_dev->parent);
-       struct utp_transfer_req_desc *req_desc = hba->utrdl;
        u32 upiu_flags;
        int ocs, result = 0;
        u8 scsi_status;
 
-       ufshcd_prepare_req_desc_hdr(req_desc, &upiu_flags, pccb->dma_dir);
+       ufshcd_prepare_req_desc_hdr(hba, &upiu_flags, pccb->dma_dir);
        ufshcd_prepare_utp_scsi_cmd_upiu(hba, pccb, upiu_flags);
        prepare_prdt_table(hba, pccb);
 
@@ -1630,8 +1672,13 @@ static int ufshcd_get_max_pwr_mode(struct ufs_hba *hba)
        if (hba->max_pwr_info.is_valid)
                return 0;
 
-       pwr_info->pwr_tx = FAST_MODE;
-       pwr_info->pwr_rx = FAST_MODE;
+       if (hba->quirks & UFSHCD_QUIRK_HIBERN_FASTAUTO) {
+               pwr_info->pwr_tx = FASTAUTO_MODE;
+               pwr_info->pwr_rx = FASTAUTO_MODE;
+       } else {
+               pwr_info->pwr_tx = FAST_MODE;
+               pwr_info->pwr_rx = FAST_MODE;
+       }
        pwr_info->hs_rate = PA_HS_MODE_B;
 
        /* Get the connected lane count */
@@ -1889,13 +1936,16 @@ int ufshcd_probe(struct udevice *ufs_dev, struct ufs_hba_ops *hba_ops)
 
        /* Read capabilties registers */
        hba->capabilities = ufshcd_readl(hba, REG_CONTROLLER_CAPABILITIES);
+       if (hba->quirks & UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS)
+               hba->capabilities &= ~MASK_64_ADDRESSING_SUPPORT;
 
        /* Get UFS version supported by the controller */
        hba->version = ufshcd_get_ufs_version(hba);
        if (hba->version != UFSHCI_VERSION_10 &&
            hba->version != UFSHCI_VERSION_11 &&
            hba->version != UFSHCI_VERSION_20 &&
-           hba->version != UFSHCI_VERSION_21)
+           hba->version != UFSHCI_VERSION_21 &&
+           hba->version != UFSHCI_VERSION_30)
                dev_err(hba->dev, "invalid UFS version 0x%x\n",
                        hba->version);
 
@@ -1942,8 +1992,31 @@ int ufs_scsi_bind(struct udevice *ufs_dev, struct udevice **scsi_devp)
        return ret;
 }
 
+#if IS_ENABLED(CONFIG_BOUNCE_BUFFER)
+static int ufs_scsi_buffer_aligned(struct udevice *scsi_dev, struct bounce_buffer *state)
+{
+#ifdef CONFIG_PHYS_64BIT
+       struct ufs_hba *hba = dev_get_uclass_priv(scsi_dev->parent);
+       uintptr_t ubuf = (uintptr_t)state->user_buffer;
+       size_t len = state->len_aligned;
+
+       /* Check if below 32bit boundary */
+       if ((hba->quirks & UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS) &&
+           ((ubuf >> 32) || (ubuf + len) >> 32)) {
+               dev_dbg(scsi_dev, "Buffer above 32bit boundary %lx-%lx\n",
+                       ubuf, ubuf + len);
+               return 0;
+       }
+#endif
+       return 1;
+}
+#endif /* CONFIG_BOUNCE_BUFFER */
+
 static struct scsi_ops ufs_ops = {
        .exec           = ufs_scsi_exec,
+#if IS_ENABLED(CONFIG_BOUNCE_BUFFER)
+       .buffer_aligned = ufs_scsi_buffer_aligned,
+#endif /* CONFIG_BOUNCE_BUFFER */
 };
 
 int ufs_probe_dev(int index)
index 8a38832b05f8f5b44fbd9c08534e247b4adcd10d..9daaf03d222bef46b42d58c87868494203db26f4 100644 (file)
@@ -717,7 +717,19 @@ struct ufs_hba {
  * the LCC transmission on UFS device (by clearing TX_LCC_ENABLE
  * attribute of device to 0).
  */
-#define UFSHCD_QUIRK_BROKEN_LCC                                0x1
+#define UFSHCD_QUIRK_BROKEN_LCC                                BIT(0)
+
+/*
+ * This quirk needs to be enabled if the host controller has
+ * 64-bit addressing supported capability but it doesn't work.
+ */
+#define UFSHCD_QUIRK_BROKEN_64BIT_ADDRESS              BIT(1)
+
+/*
+ * This quirk needs to be enabled if the host controller has
+ * auto-hibernate capability but it's FASTAUTO only.
+ */
+#define UFSHCD_QUIRK_HIBERN_FASTAUTO                   BIT(2)
 
        /* Virtual memory reference */
        struct utp_transfer_cmd_desc *ucdl;
@@ -769,6 +781,7 @@ enum {
        UFSHCI_VERSION_11 = 0x00010100, /* 1.1 */
        UFSHCI_VERSION_20 = 0x00000200, /* 2.0 */
        UFSHCI_VERSION_21 = 0x00000210, /* 2.1 */
+       UFSHCI_VERSION_30 = 0x00000300, /* 3.0 */
 };
 
 /* Interrupt disable masks */
index 1cfe602284242e698e0d9d8785d7a4c3aff76066..4eccc5e3370e12526654372866b1e3a00551ea81 100644 (file)
@@ -160,7 +160,7 @@ config USB_GADGET_VBUS_DRAW
 
 config SDP_LOADADDR
        hex "Default load address at SDP_WRITE and SDP_JUMP"
-       default 0
+       default 0x0
 
 # Selected by UDC drivers that support high-speed operation.
 config USB_GADGET_DUALSPEED
index 9818f9be94e010398e5a3b5986b127e3ebf3972c..637eb2dd06f5394d491a11cf5d6675219ca07339 100644 (file)
@@ -194,8 +194,8 @@ static int dwc_vbus_supply_init(struct udevice *dev)
                return 0;
        }
 
-       ret = regulator_set_enable(priv->vbus_supply, true);
-       if (ret) {
+       ret = regulator_set_enable_if_allowed(priv->vbus_supply, true);
+       if (ret && ret != -ENOSYS) {
                dev_err(dev, "Error enabling vbus supply\n");
                return ret;
        }
@@ -208,12 +208,10 @@ static int dwc_vbus_supply_exit(struct udevice *dev)
        struct dwc2_priv *priv = dev_get_priv(dev);
        int ret;
 
-       if (priv->vbus_supply) {
-               ret = regulator_set_enable(priv->vbus_supply, false);
-               if (ret) {
-                       dev_err(dev, "Error disabling vbus supply\n");
-                       return ret;
-               }
+       ret = regulator_set_enable_if_allowed(priv->vbus_supply, false);
+       if (ret && ret != -ENOSYS) {
+               dev_err(dev, "Error disabling vbus supply\n");
+               return ret;
        }
 
        return 0;
index a765a307a323a8fbe54379135fc6839a65971a48..936e30438d9ff32e1d95fa04fbc861c31ebc94fe 100644 (file)
@@ -39,14 +39,10 @@ static int ehci_enable_vbus_supply(struct udevice *dev)
        if (ret && ret != -ENOENT)
                return ret;
 
-       if (priv->vbus_supply) {
-               ret = regulator_set_enable(priv->vbus_supply, true);
-               if (ret) {
-                       dev_err(dev, "Error enabling VBUS supply (ret=%d)\n", ret);
-                       return ret;
-               }
-       } else {
-               dev_dbg(dev, "No vbus supply\n");
+       ret = regulator_set_enable_if_allowed(priv->vbus_supply, true);
+       if (ret && ret != -ENOSYS) {
+               dev_err(dev, "Error enabling VBUS supply (ret=%d)\n", ret);
+               return ret;
        }
 
        return 0;
@@ -54,10 +50,13 @@ static int ehci_enable_vbus_supply(struct udevice *dev)
 
 static int ehci_disable_vbus_supply(struct generic_ehci *priv)
 {
-       if (priv->vbus_supply)
-               return regulator_set_enable(priv->vbus_supply, false);
-       else
-               return 0;
+       int ret;
+
+       ret = regulator_set_enable_if_allowed(priv->vbus_supply, false);
+       if (ret && ret != -ENOSYS)
+               return ret;
+
+       return 0;
 }
 
 static int ehci_usb_probe(struct udevice *dev)
index 69f4809cf4a6bdc8ce12329817de544003dfefbe..09f2cb1a732135089faf8532c90c49d4452b9b94 100644 (file)
@@ -66,7 +66,7 @@ config VIDEO_PCI_DEFAULT_FB_SIZE
        hex "Default framebuffer size to use if no drivers request it"
        default 0x1000000 if X86
        default 0x800000 if !X86 && VIDEO_BOCHS
-       default 0 if !X86 && !VIDEO_BOCHS
+       default 0x0 if !X86 && !VIDEO_BOCHS
        help
          Generally, video drivers request the amount of memory they need for
          the frame buffer when they are bound, by setting the size field in
@@ -1049,7 +1049,7 @@ config SPL_VIDEO_PCI_DEFAULT_FB_SIZE
        hex "Default framebuffer size to use if no drivers request it at SPL"
        default 0x1000000 if X86
        default 0x800000 if !X86 && VIDEO_BOCHS
-       default 0 if !X86 && !VIDEO_BOCHS
+       default 0x0 if !X86 && !VIDEO_BOCHS
        help
          Generally, video drivers request the amount of memory they need for
          the frame buffer when they are bound, by setting the size field in
index 13e32104b4c11a849bdec688930e7fb495a81a7b..54203faa89ef34c4240d471fafecfa389cc0b91e 100644 (file)
@@ -571,7 +571,7 @@ config ENV_OFFSET
        default 0xE0000 if ARCH_ZYNQ
        default 0x1E00000 if ARCH_ZYNQMP
        default 0x7F40000 if ARCH_VERSAL || ARCH_VERSAL_NET
-       default 0 if ARC
+       default 0x0 if ARC
        default 0x140000 if ARCH_AT91
        default 0x260000 if ARCH_OMAP2PLUS
        default 0x1080000 if MICROBLAZE && ENV_IS_IN_SPI_FLASH
@@ -583,7 +583,7 @@ config ENV_OFFSET_REDUND
        depends on (ENV_IS_IN_EEPROM || ENV_IS_IN_MMC || ENV_IS_IN_NAND || \
                    ENV_IS_IN_SPI_FLASH) && SYS_REDUNDAND_ENVIRONMENT
        default 0x10C0000 if MICROBLAZE
-       default 0
+       default 0x0
        help
          Offset from the start of the device (or partition) of the redundant
          environment location.
index 38e285bf94b02cafce3acdc38336810cbadf058f..4691612eda338589ec803d93a7a017f20bd9838b 100644 (file)
@@ -390,7 +390,7 @@ int btrfs_read_extent_inline(struct btrfs_path *path,
                           csize);
        ret = btrfs_decompress(btrfs_file_extent_compression(leaf, fi),
                               cbuf, csize, dbuf, dsize);
-       if (ret == (u32)-1) {
+       if (ret < 0) {
                ret = -EIO;
                goto out;
        }
@@ -500,7 +500,7 @@ int btrfs_read_extent_reg(struct btrfs_path *path,
 
        ret = btrfs_decompress(btrfs_file_extent_compression(leaf, fi), cbuf,
                               csize, dbuf, dsize);
-       if (ret == (u32)-1) {
+       if (ret < 0) {
                ret = -EIO;
                goto out;
        }
index d446e7a2c418cfc90b5537304709a234fb4a566c..68ca7e48e48e94f587ffa2f547780b460f4c7b2d 100644 (file)
@@ -199,6 +199,7 @@ static int list_subvolums(struct btrfs_fs_info *fs_info)
                        ret = PTR_ERR(root);
                        if (ret == -ENOENT)
                                goto next;
+                       goto out;
                }
                ret = list_one_subvol(root, result);
                if (ret < 0)
index 6c017cebc50ff1338c1acb80264618fbd00872a2..abb2de34eb05d4c2218d34002bbc6394a9aade86 100644 (file)
@@ -166,8 +166,7 @@ static unsigned long cramfs_resolve (unsigned long begin, unsigned long offset,
                                unsigned long ret;
                                char *link;
                                if (p && strlen(p)) {
-                                       printf ("unsupported symlink to \
-                                                non-terminal path\n");
+                                       printf ("unsupported symlink to non-terminal path\n");
                                        return 0;
                                }
                                link = cramfs_uncompress_link (begin,
@@ -177,8 +176,7 @@ static unsigned long cramfs_resolve (unsigned long begin, unsigned long offset,
                                                namelen, namelen, name);
                                        return 0;
                                } else if (link[0] == '/') {
-                                       printf ("unsupported symlink to \
-                                                absolute path\n");
+                                       printf ("unsupported symlink to absolute path\n");
                                        free (link);
                                        return 0;
                                }
index d1476aa433d6fe920ac2a58d842f842cbe3d5311..8ff1fd0ec83506c4891893fbe4b25af6018f8802 100644 (file)
@@ -110,9 +110,7 @@ int fat_register_device(struct blk_desc *dev_desc, int part_no)
                info.name[0] = 0;
                info.type[0] = 0;
                info.bootable = 0;
-#if CONFIG_IS_ENABLED(PARTITION_UUIDS)
-               info.uuid[0] = 0;
-#endif
+               disk_partition_clr_uuid(&info);
        }
 
        return fat_set_blk_dev(dev_desc, &info);
index a6294419b8d66ad914668da57a39b353c85fde9f..8b5d669b00503d0306cf62eba45f23544e4f4d85 100644 (file)
@@ -690,8 +690,8 @@ get_set_cluster(fsdata *mydata, __u32 clustnum, loff_t pos, __u8 *buffer,
        static u8 *tmpbuf_cluster;
        unsigned int bytesperclust = mydata->clust_size * mydata->sect_size;
        __u32 startsect;
-       loff_t wsize;
-       int clustcount, i, ret;
+       loff_t clustcount, wsize;
+       int i, ret;
 
        *gotsize = 0;
        if (!size)
index 9badda64e4faf06da3845cb9eca9b7d3c695f85a..be98ec78c860fb1ff1da43d8969bbce48034e321 100644 (file)
@@ -90,6 +90,15 @@ void abuf_map_sysmem(struct abuf *abuf, ulong addr, size_t size);
  */
 bool abuf_realloc(struct abuf *abuf, size_t new_size);
 
+/**
+ * abuf_realloc_inc() - Increment abuf size by a given amount
+ *
+ * @abuf: abuf to adjust
+ * @inc: Size incrmement to use (the buffer size will be increased by this much)
+ * Return: true if OK, false if out of memory
+ */
+bool abuf_realloc_inc(struct abuf *abuf, size_t inc);
+
 /**
  * abuf_uninit_move() - Return the allocated contents and uninit the abuf
  *
diff --git a/include/asm-generic/bitops/builtin-__ffs.h b/include/asm-generic/bitops/builtin-__ffs.h
new file mode 100644 (file)
index 0000000..87024da
--- /dev/null
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_GENERIC_BITOPS_BUILTIN___FFS_H_
+#define _ASM_GENERIC_BITOPS_BUILTIN___FFS_H_
+
+/**
+ * __ffs - find first bit in word.
+ * @word: The word to search
+ *
+ * Undefined if no bit exists, so code should check against 0 first.
+ */
+static __always_inline unsigned long __ffs(unsigned long word)
+{
+       return __builtin_ctzl(word);
+}
+
+#endif
diff --git a/include/asm-generic/bitops/builtin-__fls.h b/include/asm-generic/bitops/builtin-__fls.h
new file mode 100644 (file)
index 0000000..43a5aa9
--- /dev/null
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_GENERIC_BITOPS_BUILTIN___FLS_H_
+#define _ASM_GENERIC_BITOPS_BUILTIN___FLS_H_
+
+/**
+ * __fls - find last (most-significant) set bit in a long word
+ * @word: the word to search
+ *
+ * Undefined if no set bit exists, so code should check against 0 first.
+ */
+static __always_inline unsigned long __fls(unsigned long word)
+{
+       return (sizeof(word) * 8) - 1 - __builtin_clzl(word);
+}
+
+#endif
diff --git a/include/asm-generic/bitops/builtin-ffs.h b/include/asm-generic/bitops/builtin-ffs.h
new file mode 100644 (file)
index 0000000..7b12932
--- /dev/null
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_GENERIC_BITOPS_BUILTIN_FFS_H_
+#define _ASM_GENERIC_BITOPS_BUILTIN_FFS_H_
+
+/**
+ * ffs - find first bit set
+ * @x: the word to search
+ *
+ * This is defined the same way as
+ * the libc and compiler builtin ffs routines, therefore
+ * differs in spirit from ffz (man ffs).
+ */
+#define ffs(x) __builtin_ffs(x)
+
+#endif
diff --git a/include/asm-generic/bitops/builtin-fls.h b/include/asm-generic/bitops/builtin-fls.h
new file mode 100644 (file)
index 0000000..c8455cc
--- /dev/null
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_GENERIC_BITOPS_BUILTIN_FLS_H_
+#define _ASM_GENERIC_BITOPS_BUILTIN_FLS_H_
+
+/**
+ * fls - find last (most-significant) bit set
+ * @x: the word to search
+ *
+ * This is defined the same way as ffs.
+ * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32.
+ */
+static __always_inline int fls(unsigned int x)
+{
+       return x ? sizeof(x) * 8 - __builtin_clz(x) : 0;
+}
+
+#endif
index c4a7fd28439bca439052e555d72431b0c9d80fca..a21c606f2b8c38a7e3739e771ed3f5cc411ba9bb 100644 (file)
@@ -414,6 +414,7 @@ struct dm_gpio_ops {
  * @gpio_base: Base GPIO number for this device. For the first active device
  * this will be 0; the numbering for others will follow sequentially so that
  * @gpio_base for device 1 will equal the number of GPIOs in device 0.
+ * @claimed: Array of bits indicating which GPIOs in the bank are claimed.
  * @name: Array of pointers to the name for each GPIO in this bank. The
  * value of the pointer will be NULL if the GPIO has not been claimed.
  */
@@ -421,6 +422,7 @@ struct gpio_dev_priv {
        const char *bank_name;
        unsigned gpio_count;
        unsigned gpio_base;
+       u32 *claimed;
        char **name;
 };
 
index 267f1db73f238e18e5acb5a01890733e656a4221..1e1657a01673168bf59b7acbb8f6505e410e8b19 100644 (file)
@@ -61,8 +61,12 @@ static inline int arch_is_kernel_data(unsigned long addr)
 /* Start of U-Boot text region */
 extern char __text_start[];
 
-/* This marks the end of the text region which must be relocated */
-extern char __image_copy_end[];
+/* This marks the text region which must be relocated */
+extern char __image_copy_start[], __image_copy_end[];
+
+extern char __bss_end[];
+extern char __rel_dyn_start[], __rel_dyn_end[];
+extern char _image_binary_end[];
 
 /*
  * This is the U-Boot entry point - prior to relocation it should be same
@@ -70,30 +74,4 @@ extern char __image_copy_end[];
  */
 extern void _start(void);
 
-/*
- * ARM defines its symbols as char[]. Other arches define them as ulongs.
- */
-#ifdef CONFIG_ARM
-
-extern char __bss_start[];
-extern char __bss_end[];
-extern char __image_copy_start[];
-extern char __image_copy_end[];
-extern char _image_binary_end[];
-extern char __rel_dyn_start[];
-extern char __rel_dyn_end[];
-
-#else /* don't use offsets: */
-
-/* Exports from the Linker Script */
-extern ulong __data_end;
-extern ulong __rel_dyn_start;
-extern ulong __rel_dyn_end;
-extern ulong __bss_end;
-extern ulong _image_binary_end;
-
-extern ulong _TEXT_BASE;       /* code start */
-
-#endif
-
 #endif /* _ASM_GENERIC_SECTIONS_H_ */
index 2c9c7985a885d42ddf71594a8041ba56dd419654..b819f97c2f1e06d11a3c9f7f6dac116c99f0da0d 100644 (file)
@@ -7,6 +7,7 @@
 #ifndef BLK_H
 #define BLK_H
 
+#include <bouncebuf.h>
 #include <dm/uclass-id.h>
 #include <efi.h>
 
@@ -260,9 +261,25 @@ struct blk_ops {
         * @return 0 if OK, -ve on error
         */
        int (*select_hwpart)(struct udevice *dev, int hwpart);
-};
 
-#define blk_get_ops(dev)       ((struct blk_ops *)(dev)->driver->ops)
+#if IS_ENABLED(CONFIG_BOUNCE_BUFFER)
+       /**
+        * buffer_aligned() - test memory alignment of block operation buffer
+        *
+        * Some devices have limited DMA capabilities and require that the
+        * buffers passed to them fit specific properties. This optional
+        * callback can be used to indicate whether a buffer alignment is
+        * suitable for the device DMA or not, and trigger use of generic
+        * bounce buffer implementation to help use of unsuitable buffers
+        * at the expense of performance degradation.
+        *
+        * @dev:        Block device associated with the request
+        * @state:      Bounce buffer state
+        * @return 1 if OK, 0 if unaligned
+        */
+       int (*buffer_aligned)(struct udevice *dev, struct bounce_buffer *state);
+#endif /* CONFIG_BOUNCE_BUFFER */
+};
 
 /*
  * These functions should take struct udevice instead of struct blk_desc,
index 4152577afb71836fcc9877567f7804c283406cdc..44d3741eacae0ea12000ff5e6110068d17bde3d6 100644 (file)
@@ -83,6 +83,7 @@ enum bootflow_flags_t {
  * @flags: Flags for the bootflow (see enum bootflow_flags_t)
  * @cmdline: OS command line, or NULL if not known (allocated)
  * @x86_setup: Pointer to x86 setup block inside @buf, NULL if not present
+ * @bootmeth_priv: Private data for the bootmeth
  */
 struct bootflow {
        struct list_head bm_node;
@@ -107,7 +108,8 @@ struct bootflow {
        ulong fdt_addr;
        int flags;
        char *cmdline;
-       char *x86_setup;
+       void *x86_setup;
+       void *bootmeth_priv;
 };
 
 /**
@@ -350,6 +352,17 @@ void bootflow_free(struct bootflow *bflow);
  */
 int bootflow_boot(struct bootflow *bflow);
 
+/**
+ * bootflow_read_all() - Read all bootflow files
+ *
+ * Some bootmeths delay reading of large files until booting is requested. This
+ * causes those files to be read.
+ *
+ * @bflow: Bootflow to read
+ * Return: result of trying to read
+ */
+int bootflow_read_all(struct bootflow *bflow);
+
 /**
  * bootflow_run_boot() - Try to boot a bootflow
  *
index 044a4797ed3609fc35453754b70a6aaf326d9e18..c3c7336207b166a8fea6ea477a707ba3b282d647 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <image.h>
 
+struct boot_params;
 struct cmd_tbl;
 
 #define BOOTM_ERR_RESET                (-1)
@@ -124,4 +125,50 @@ int bootm_process_cmdline(char *buf, int maxlen, int flags);
  */
 int bootm_process_cmdline_env(int flags);
 
+/**
+ * zboot_start() - Boot a zimage
+ *
+ * Boot a zimage, given the component parts
+ *
+ * @addr: Address where the bzImage is moved before booting, either
+ *     BZIMAGE_LOAD_ADDR or ZIMAGE_LOAD_ADDR
+ * @base: Pointer to the boot parameters, typically at address
+ *     DEFAULT_SETUP_BASE
+ * @initrd: Address of the initial ramdisk, or 0 if none
+ * @initrd_size: Size of the initial ramdisk, or 0 if none
+ * @cmdline: Command line to use for booting
+ * Return: -EFAULT on error (normally it does not return)
+ */
+int zboot_start(ulong addr, ulong size, ulong initrd, ulong initrd_size,
+               ulong base, char *cmdline);
+
+/*
+ * zimage_get_kernel_version() - Get the version string from a kernel
+ *
+ * @params: boot_params pointer
+ * @kernel_base: base address of kernel
+ * Return: Kernel version as a NUL-terminated string
+ */
+const char *zimage_get_kernel_version(struct boot_params *params,
+                                     void *kernel_base);
+
+/**
+ * zimage_dump() - Dump the metadata of a zimage
+ *
+ * This shows all available information in a zimage that has been loaded.
+ *
+ * @base_ptr: Pointer to the boot parameters, typically at address
+ *     DEFAULT_SETUP_BASE
+ * @show_cmdline: true to show the full command line
+ */
+void zimage_dump(struct boot_params *base_ptr, bool show_cmdline);
+
+/*
+ * bootm_boot_start() - Boot an image at the given address
+ *
+ * @addr: Image address
+ * @cmdline: Command line to set
+ */
+int bootm_boot_start(ulong addr, const char *cmdline);
+
 #endif
index 7cb7da33deaa8e5202f98fd73c894301ad80e16a..0fc36104ece0ebcbe899a93e8df7ac1f2cd921a7 100644 (file)
@@ -16,9 +16,12 @@ struct udevice;
  * enum bootmeth_flags - Flags for bootmeths
  *
  * @BOOTMETHF_GLOBAL: bootmeth handles bootdev selection automatically
+ * @BOOTMETHF_ANY_PART: bootmeth is willing to check any partition, even if it
+ * has no filesystem
  */
 enum bootmeth_flags {
        BOOTMETHF_GLOBAL        = BIT(0),
+       BOOTMETHF_ANY_PART      = BIT(1),
 };
 
 /**
@@ -119,7 +122,16 @@ struct bootmeth_ops {
         */
        int (*read_file)(struct udevice *dev, struct bootflow *bflow,
                         const char *file_path, ulong addr, ulong *sizep);
-
+#if CONFIG_IS_ENABLED(BOOTSTD_FULL)
+       /**
+        * readall() - read all files for a bootflow
+        *
+        * @dev:        Bootmethod device to boot
+        * @bflow:      Bootflow to read
+        * Return: 0 if OK, -EIO on I/O error, other -ve on other error
+        */
+       int (*read_all)(struct udevice *dev, struct bootflow *bflow);
+#endif /* BOOTSTD_FULL */
        /**
         * boot() - boot a bootflow
         *
@@ -223,6 +235,20 @@ int bootmeth_set_bootflow(struct udevice *dev, struct bootflow *bflow,
 int bootmeth_read_file(struct udevice *dev, struct bootflow *bflow,
                       const char *file_path, ulong addr, ulong *sizep);
 
+/**
+ * bootmeth_read_all() - read all bootflow files
+ *
+ * Some bootmeths delay reading of large files until booting is requested. This
+ * causes those files to be read.
+ *
+ * @dev:       Bootmethod device to use
+ * @bflow:     Bootflow to read
+ * Return: does not return on success, since it should boot the
+ *     Operating Systemn. Returns -EFAULT if that fails, other -ve on
+ *     other error
+ */
+int bootmeth_read_all(struct udevice *dev, struct bootflow *bflow);
+
 /**
  * bootmeth_boot() - boot a bootflow
  *
diff --git a/include/cedit.h b/include/cedit.h
new file mode 100644 (file)
index 0000000..f43cafa
--- /dev/null
@@ -0,0 +1,125 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright 2023 Google LLC
+ * Written by Simon Glass <sjg@chromium.org>
+ */
+
+#ifndef __CEDIT_H
+#define __CEDIT_H
+
+#include <dm/ofnode_decl.h>
+
+struct abuf;
+struct expo;
+struct scene;
+struct video_priv;
+
+enum {
+       /* size increment for writing FDT */
+       CEDIT_SIZE_INC  = 1024,
+};
+
+/* Name of the cedit node in the devicetree */
+#define CEDIT_NODE_NAME                "cedit-values"
+
+extern struct expo *cur_exp;
+
+/**
+ * cedit_arange() - Arrange objects in a configuration-editor scene
+ *
+ * @exp: Expo to update
+ * @vid_priv: Private info of the video device
+ * @scene_id: scene ID to arrange
+ * Returns: 0 if OK, -ve on error
+ */
+int cedit_arange(struct expo *exp, struct video_priv *vid_priv, uint scene_id);
+
+/**
+ * cedit_run() - Run a configuration editor
+ *
+ * This accepts input until the user quits with Escape
+ *
+ * @exp: Expo to use
+ * Returns: 0 if OK, -ve on error
+ */
+int cedit_run(struct expo *exp);
+
+/**
+ * cedit_prepare() - Prepare to run a cedit
+ *
+ * Set up the video device, select the first scene and highlight the first item.
+ * This ensures that all menus have a selected item.
+ *
+ * @exp: Expo to use
+ * @vid_privp: Set to private data for the video device
+ * @scnp: Set to the first scene
+ * Return: scene ID of first scene if OK, -ve on error
+ */
+int cedit_prepare(struct expo *exp, struct video_priv **vid_privp,
+                 struct scene **scnp);
+
+/**
+ * cedit_write_settings() - Write settings in FDT format
+ *
+ * Sets up an FDT with the settings
+ *
+ * @exp: Expo to write settings from
+ * @buf: Returns abuf containing the settings FDT (inited by this function)
+ * Return: 0 if OK, -ve on error
+ */
+int cedit_write_settings(struct expo *exp, struct abuf *buf);
+
+/**
+ * cedit_read_settings() - Read settings in FDT format
+ *
+ * Read an FDT with the settings
+ *
+ * @exp: Expo to read settings into
+ * @tree: Tree to read from
+ * Return: 0 if OK, -ve on error
+ */
+int cedit_read_settings(struct expo *exp, oftree tree);
+
+/**
+ * cedit_write_settings_env() - Write settings to envrionment variables
+ *
+ * @exp: Expo to write settings from
+ * @verbose: true to print each var as it is set
+ * Return: 0 if OK, -ve on error
+ */
+int cedit_write_settings_env(struct expo *exp, bool verbose);
+
+/*
+ * cedit_read_settings_env() - Read settings from the environment
+ *
+ * @exp: Expo to read settings into
+ * @verbose: true to print each var before it is read
+ */
+int cedit_read_settings_env(struct expo *exp, bool verbose);
+
+/**
+ * cedit_write_settings_cmos() - Write settings to CMOS RAM
+ *
+ * Write settings to the defined places in CMOS RAM
+ *
+ * @exp: Expo to write settings from
+ * @dev: UCLASS_RTC device containing space for this information
+ * Returns 0 if OK, -ve on error
+ * @verbose: true to print a summary at the end
+ */
+int cedit_write_settings_cmos(struct expo *exp, struct udevice *dev,
+                             bool verbose);
+
+/**
+ * cedit_read_settings_cmos() - Read settings from CMOS RAM
+ *
+ * Read settings from the defined places in CMO RAM
+ *
+ * @exp: Expo to read settings into
+ * @dev: RTC device to read settings from
+ * @verbose: true to print a summary at the end
+ */
+int cedit_read_settings_cmos(struct expo *exp, struct udevice *dev,
+                            bool verbose);
+
+#endif /* __CEDIT_H */
diff --git a/include/configs/sama5d29_curiosity.h b/include/configs/sama5d29_curiosity.h
new file mode 100644 (file)
index 0000000..ef09b8b
--- /dev/null
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Configuration file for the SAMA5D29 CURIOSITY board.
+ *
+ * Copyright (C) 2023 Microchip Technology Inc. and its subsidiaries
+ *
+ * Author: Mihai Sain <mihai.sain@microchip.com>
+ *
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#define CFG_SYS_AT91_SLOW_CLOCK                32768
+#define CFG_SYS_AT91_MAIN_CLOCK                24000000
+
+#endif
index f5c5d30a64587497c4248b923fb2f3f0177c240c..c37deae94527a6bbd110ebfe9faef7683e0fa43e 100644 (file)
@@ -94,6 +94,27 @@ enum event_t {
         */
        EVT_MISC_INIT_F,
 
+       /*
+        * Emitted before relocation to set up Firmware Support Package
+        *
+        * Where U-Boot relies on binary blobs to handle part of the system
+        * init, this event can be used to set up the blobs. This is used on
+        * some Intel platforms
+        */
+       EVT_FSP_INIT_F,
+
+       /*
+        * Emitted just before jumping to the main loop
+        *
+        * Some boards need to perform initialisation immediately before control
+        * is passed to the command-line interpreter (e.g. for init that depend
+        * on later phases in the init sequence).
+        *
+        * Some parts can be only initialized if all others (like Interrupts)
+        * are up and running (e.g. the PC-style ISA keyboard).
+        */
+       EVT_LAST_STAGE_INIT,
+
        /**
         * @EVT_FPGA_LOAD:
         * The FPGA load hook is called after loading an FPGA with a new binary.
@@ -185,19 +206,48 @@ struct event {
        union event_data data;
 };
 
+/* Flags for event spy */
+enum evspy_flags {
+       EVSPYF_SIMPLE   = 1 << 0,
+};
+
 /** Function type for event handlers */
 typedef int (*event_handler_t)(void *ctx, struct event *event);
 
+/** Function type for simple event handlers */
+typedef int (*event_handler_simple_t)(void);
+
 /**
  * struct evspy_info - information about an event spy
  *
  * @func: Function to call when the event is activated (must be first)
  * @type: Event type
+ * @flag: Flags for this spy
  * @id: Event id string
  */
 struct evspy_info {
        event_handler_t func;
-       enum event_t type;
+       u8 type;
+       u8 flags;
+#if CONFIG_IS_ENABLED(EVENT_DEBUG)
+       const char *id;
+#endif
+};
+
+/**
+ * struct evspy_info_simple - information about an event spy
+ *
+ * THis is the 'simple' record, the only difference being the handler function
+ *
+ * @func: Function to call when the event is activated (must be first)
+ * @type: Event type
+ * @flag: Flags for this spy
+ * @id: Event id string
+ */
+struct evspy_info_simple {
+       event_handler_simple_t func;
+       u8 type;
+       u8 flags;
 #if CONFIG_IS_ENABLED(EVENT_DEBUG)
        const char *id;
 #endif
@@ -205,9 +255,11 @@ struct evspy_info {
 
 /* Declare a new event spy */
 #if CONFIG_IS_ENABLED(EVENT_DEBUG)
-#define _ESPY_REC(_type, _func)   { _func, _type, #_func, }
+#define _ESPY_REC(_type, _func)   { _func, _type, 0, #_func, }
+#define _ESPY_REC_SIMPLE(_type, _func)  { _func, _type, EVSPYF_SIMPLE, #_func, }
 #else
 #define _ESPY_REC(_type, _func)   { _func, _type, }
+#define _ESPY_REC_SIMPLE(_type, _func)  { _func, _type, EVSPYF_SIMPLE }
 #endif
 
 static inline const char *event_spy_id(struct evspy_info *spy)
@@ -250,10 +302,16 @@ static inline const char *event_spy_id(struct evspy_info *spy)
  * away the linker-list entry sometimes, e.g. with the EVT_FT_FIXUP entry in
  * vbe_simple.c - so for now, make it global.
  */
-#define EVENT_SPY(_type, _func) \
+#define EVENT_SPY_FULL(_type, _func) \
        __used ll_entry_declare(struct evspy_info, _type ## _3_ ## _func, \
                evspy_info) = _ESPY_REC(_type, _func)
 
+/* Simple spy with no function arguemnts */
+#define EVENT_SPY_SIMPLE(_type, _func) \
+       __used ll_entry_declare(struct evspy_info_simple, \
+               _type ## _3_ ## _func, \
+               evspy_info) = _ESPY_REC_SIMPLE(_type, _func)
+
 /**
  * event_register - register a new spy
  *
@@ -279,6 +337,14 @@ void event_show_spy_list(void);
  */
 int event_manual_reloc(void);
 
+/**
+ * event_type_name() - Get the name of an event type
+ *
+ * @type: Type to check
+ * Return: Name of event, or "(unknown)" if not known
+ */
+const char *event_type_name(enum event_t type);
+
 /**
  * event_notify() - notify spies about an event
  *
index 0b1d944a169f47980c2df1122a449b730c90830f..a2b3a71c1591c9f2536710e3374034a6834e8934 100644 (file)
@@ -4,14 +4,13 @@
  * Written by Simon Glass <sjg@chromium.org>
  */
 
-#ifndef __SCENE_H
-#define __SCENE_H
+#ifndef __EXPO_H
+#define __EXPO_H
 
 #include <dm/ofnode_decl.h>
 #include <linux/list.h>
 
 struct udevice;
-struct video_priv;
 
 /**
  * enum expoact_type - types of actions reported by the expo
@@ -188,6 +187,8 @@ enum scene_obj_flags_t {
  * @type: Type of this object
  * @dim: Dimensions for this object
  * @flags: Flags for this object
+ * @bit_length: Number of bits used for this object in CMOS RAM
+ * @start_bit: Start bit to use for this object in CMOS RAM
  * @sibling: Node to link this object to its siblings
  */
 struct scene_obj {
@@ -196,7 +197,9 @@ struct scene_obj {
        uint id;
        enum scene_obj_t type;
        struct scene_dim dim;
-       int flags;
+       u8 flags;
+       u8 bit_length;
+       u16 start_bit;
        struct list_head sibling;
 };
 
@@ -676,24 +679,4 @@ int expo_apply_theme(struct expo *exp, ofnode node);
  */
 int expo_build(ofnode root, struct expo **expp);
 
-/**
- * cedit_arange() - Arrange objects in a configuration-editor scene
- *
- * @exp: Expo to update
- * @vid_priv: Private info of the video device
- * @scene_id: scene ID to arrange
- * Returns: 0 if OK, -ve on error
- */
-int cedit_arange(struct expo *exp, struct video_priv *vid_priv, uint scene_id);
-
-/**
- * cedit_run() - Run a configuration editor
- *
- * This accepts input until the user quits with Escape
- *
- * @exp: Expo to use
- * Returns: 0 if OK, -ve on error
- */
-int cedit_run(struct expo *exp);
-
-#endif /*__SCENE_H */
+#endif /*__EXPO_H */
index 3bf30476a2e0d613564494953c15af36f63f9145..4e7fe26c200445fed03926abe09d910721fe2315 100644 (file)
@@ -57,17 +57,6 @@ int arch_cpu_init(void);
  */
 int mach_cpu_init(void);
 
-/**
- * arch_fsp_init() - perform firmware support package init
- *
- * Where U-Boot relies on binary blobs to handle part of the system init, this
- * function can be used to set up the blobs. This is used on some Intel
- * platforms.
- *
- * Return: 0
- */
-int arch_fsp_init(void);
-
 /**
  * arch_fsp_init() - perform post-relocation firmware support package init
  *
@@ -281,15 +270,11 @@ void board_init_r(struct global_data *id, ulong dest_addr)
        __attribute__ ((noreturn));
 
 int cpu_init_r(void);
-int last_stage_init(void);
 int mac_read_from_eeprom(void);
 int set_cpu_clk_info(void);
 int update_flash_size(int flash_size);
 int arch_early_init_r(void);
 int misc_init_r(void);
-#if defined(CONFIG_VID)
-int init_func_vid(void);
-#endif
 
 /* common/board_info.c */
 int checkboard(void);
index 69ce268070510a398a847ed977486dfefd70646f..208effd8d13e44258a5139a544cbc7d1ffead740 100644 (file)
@@ -6,52 +6,40 @@
 #ifndef __INITCALL_H
 #define __INITCALL_H
 
+#include <asm/types.h>
+#include <event.h>
+
+_Static_assert(EVT_COUNT < 256, "Can only support 256 event types with 8 bits");
+
+/**
+ * init_fnc_t - Init function
+ *
+ * Return: 0 if OK -ve on error
+ */
 typedef int (*init_fnc_t)(void);
 
-#include <log.h>
-#ifdef CONFIG_EFI_APP
-#include <efi.h>
-#endif
-#include <asm/global_data.h>
+/* Top bit indicates that the initcall is an event */
+#define INITCALL_IS_EVENT      GENMASK(BITS_PER_LONG - 1, 8)
+#define INITCALL_EVENT_TYPE    GENMASK(7, 0)
 
-/*
- * To enable debugging. add #define DEBUG at the top of the including file.
+#define INITCALL_EVENT(_type)  (void *)((_type) | INITCALL_IS_EVENT)
+
+/**
+ * initcall_run_list() - Run through a list of function calls
+ *
+ * This calls functions one after the other, stopping at the first error, or
+ * when NULL is obtained.
  *
- * To find a symbol, use grep on u-boot.map
+ * @init_sequence: NULL-terminated init sequence to run
+ * Return: 0 if OK, or -ve error code from the first failure
  */
-static inline int initcall_run_list(const init_fnc_t init_sequence[])
-{
-       const init_fnc_t *init_fnc_ptr;
-
-       for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
-               unsigned long reloc_ofs = 0;
-               int ret;
-
-               /*
-                * Sandbox is relocated by the OS, so symbols always appear at
-                * the relocated address.
-                */
-               if (IS_ENABLED(CONFIG_SANDBOX) || (gd->flags & GD_FLG_RELOC))
-                       reloc_ofs = gd->reloc_off;
-#ifdef CONFIG_EFI_APP
-               reloc_ofs = (unsigned long)image_base;
-#endif
-               if (reloc_ofs)
-                       debug("initcall: %p (relocated to %p)\n",
-                                       (char *)*init_fnc_ptr - reloc_ofs,
-                                       (char *)*init_fnc_ptr);
-               else
-                       debug("initcall: %p\n", (char *)*init_fnc_ptr - reloc_ofs);
-
-               ret = (*init_fnc_ptr)();
-               if (ret) {
-                       printf("initcall sequence %p failed at call %p (err=%d)\n",
-                              init_sequence,
-                              (char *)*init_fnc_ptr - reloc_ofs, ret);
-                       return -1;
-               }
-       }
-       return 0;
-}
+int initcall_run_list(const init_fnc_t init_sequence[]);
+
+/**
+ * initcall_manual_reloc() - Do manual relocation on an initcall sequence
+ *
+ * @init_sequence: NULL-terminated init sequence to relocate
+ */
+void initcall_manual_reloc(init_fnc_t init_sequence[]);
 
 #endif
index f4ef37725d2ad60c6a0aeac4961ffdde667396d3..726fffeb3e8e118769cd05d5dc687191077916bc 100644 (file)
@@ -29,4 +29,16 @@ struct nvmxip_plat {
        lbaint_t lba;
 };
 
+/**
+ * nvmxip_bind() - post binding treatments
+ * @dev:       the NVMXIP device
+ *
+ * Create and probe a child block device.
+ *
+ * Return:
+ *
+ * 0 on success. Otherwise, failure
+ */
+int nvmxip_probe(struct udevice *udev);
+
 #endif /* __DRIVER_NVMXIP_H__ */
index 968412b0a822914943751e503aa2e7f502f53ef8..fc8a1b15cbf08828a04d2634692f7da97f318d03 100644 (file)
@@ -98,6 +98,16 @@ int os_close(int fd);
  */
 int os_unlink(const char *pathname);
 
+/** os_persistent_fname() - Find the path to a test file
+ *
+ * @buf: Buffer to hold path
+ * @maxsize: Maximum size of buffer
+ * @fname: Leaf filename to find
+ * Returns: 0 on success, -ENOENT if file is not found, -ENOSPC if the buffer is
+ * too small
+ */
+int os_persistent_file(char *buf, int maxsize, const char *fname);
+
 /**
  * os_exit() - access to the OS exit() system call
  *
index 8e451bbdff9462dfe2d2b7e7c30d0e0ddaff315f..f321479a5e91d63c816729e7bfeab13d6e0297aa 100644 (file)
@@ -80,6 +80,73 @@ struct disk_partition {
 #endif
 };
 
+/* Accessors for struct disk_partition field ->uuid */
+extern char *__invalid_use_of_disk_partition_uuid;
+
+static inline const char *disk_partition_uuid(const struct disk_partition *info)
+{
+#if CONFIG_IS_ENABLED(PARTITION_UUIDS)
+       return info->uuid;
+#else
+       return __invalid_use_of_disk_partition_uuid;
+#endif
+}
+
+static inline void disk_partition_set_uuid(struct disk_partition *info,
+                                          const char *val)
+{
+#if CONFIG_IS_ENABLED(PARTITION_UUIDS)
+       strlcpy(info->uuid, val, UUID_STR_LEN + 1);
+#endif
+}
+
+static inline void disk_partition_clr_uuid(struct disk_partition *info)
+{
+#if CONFIG_IS_ENABLED(PARTITION_UUIDS)
+       *info->uuid = '\0';
+#endif
+}
+
+/* Accessors for struct disk_partition field ->type_guid */
+extern char *__invalid_use_of_disk_partition_type_uuid;
+
+static inline const
+char *disk_partition_type_uuid(const struct disk_partition *info)
+{
+#ifdef CONFIG_PARTITION_TYPE_GUID
+       return info->type_guid;
+#else
+       return __invalid_use_of_disk_partition_type_uuid;
+#endif
+}
+
+static inline void disk_partition_set_type_guid(struct disk_partition *info,
+                                               const char *val)
+{
+#ifdef CONFIG_PARTITION_TYPE_GUID
+       strlcpy(info->type_guid, val, UUID_STR_LEN + 1);
+#endif
+}
+
+static inline void disk_partition_clr_type_guid(struct disk_partition *info)
+{
+#ifdef CONFIG_PARTITION_TYPE_GUID
+       *info->type_guid = '\0';
+#endif
+}
+
+/* Accessors for struct disk_partition field ->sys_ind */
+extern int __invalid_use_of_disk_partition_sys_ind;
+
+static inline uint disk_partition_sys_ind(const struct disk_partition *info)
+{
+#ifdef CONFIG_DOS_PARTITION
+       return info->sys_ind;
+#else
+       return __invalid_use_of_disk_partition_sys_ind;
+#endif
+}
+
 struct disk_part {
        int partnum;
        struct disk_partition gpt_part_info;
@@ -113,7 +180,7 @@ struct blk_desc *mg_disk_get_dev(int dev);
  * contained with the interface's data structure. There is no global
  * numbering for block devices, so the interface name must be provided.
  *
- * @dev_desc:  Block device descriptor
+ * @desc:      Block device descriptor
  * @part:      Partition number to read
  * @part_type: Partition driver to use, or PART_TYPE_UNKNOWN to automatically
  *             choose a driver
@@ -121,24 +188,24 @@ struct blk_desc *mg_disk_get_dev(int dev);
  *
  * Return: 0 on success, negative errno on failure
  */
-int part_get_info_by_type(struct blk_desc *dev_desc, int part, int part_type,
+int part_get_info_by_type(struct blk_desc *desc, int part, int part_type,
                          struct disk_partition *info);
-int part_get_info(struct blk_desc *dev_desc, int part,
+int part_get_info(struct blk_desc *desc, int part,
                  struct disk_partition *info);
 /**
  * part_get_info_whole_disk() - get partition info for the special case of
  * a partition occupying the entire disk.
  *
- * @dev_desc:  block device descriptor
+ * @desc:      block device descriptor
  * @info:      returned partition information
  * Return:     0 on success
  */
-int part_get_info_whole_disk(struct blk_desc *dev_desc,
+int part_get_info_whole_disk(struct blk_desc *desc,
                             struct disk_partition *info);
 
-void part_print(struct blk_desc *dev_desc);
-void part_init(struct blk_desc *dev_desc);
-void dev_print(struct blk_desc *dev_desc);
+void part_print(struct blk_desc *desc);
+void part_init(struct blk_desc *desc);
+void dev_print(struct blk_desc *desc);
 
 /**
  * blk_get_device_by_str() - Get a block device given its interface/hw partition
@@ -162,11 +229,11 @@ void dev_print(struct blk_desc *dev_desc);
  *             containing the device number (e.g. "2") or the device number
  *             and hardware partition number (e.g. "2.4") for devices that
  *             support it (currently only MMC).
- * @dev_desc:  Returns a pointer to the block device on success
+ * @desc:      Returns a pointer to the block device on success
  * Return: block device number (local to the interface), or -1 on error
  */
 int blk_get_device_by_str(const char *ifname, const char *dev_str,
-                         struct blk_desc **dev_desc);
+                         struct blk_desc **desc);
 
 /**
  * blk_get_device_part_str() - Get a block device and partition
@@ -196,7 +263,7 @@ int blk_get_device_by_str(const char *ifname, const char *dev_str,
  *
  * @ifname:            Interface name (e.g. "ide", "scsi")
  * @dev_part_str:      Device and partition string
- * @dev_desc:          Returns a pointer to the block device on success
+ * @desc:              Returns a pointer to the block device on success
  * @info:              Returns partition information
  * @allow_whole_dev:   true to allow the user to select partition 0
  *                     (which means the whole device), false to require a valid
@@ -205,22 +272,22 @@ int blk_get_device_by_str(const char *ifname, const char *dev_str,
  *
  */
 int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
-                           struct blk_desc **dev_desc,
+                           struct blk_desc **desc,
                            struct disk_partition *info, int allow_whole_dev);
 
 /**
  * part_get_info_by_name() - Search for a partition by name
  *                           among all available registered partitions
  *
- * @dev_desc:  block device descriptor
+ * @desc:      block device descriptor
  * @name:      the specified table entry name
  * @info:      returns the disk partition info
  *
  * Return: the partition number on match (starting on 1), -1 on no match,
  * otherwise error
  */
-int part_get_info_by_name(struct blk_desc *dev_desc,
-                             const char *name, struct disk_partition *info);
+int part_get_info_by_name(struct blk_desc *desc, const char *name,
+                         struct disk_partition *info);
 
 /**
  * part_get_info_by_dev_and_name_or_num() - Get partition info from dev number
@@ -232,11 +299,11 @@ int part_get_info_by_name(struct blk_desc *dev_desc,
  * (like "device_num#partition_name") or a device number plus a partition number
  * separated by a ":". For example both "0#misc" and "0:1" can be valid
  * partition descriptions for a given interface. If the partition is found, sets
- * dev_desc and part_info accordingly with the information of the partition.
+ * desc and part_info accordingly with the information of the partition.
  *
  * @dev_iface:         Device interface
  * @dev_part_str:      Input partition description, like "0#misc" or "0:1"
- * @dev_desc:          Place to store the device description pointer
+ * @desc:              Place to store the device description pointer
  * @part_info:         Place to store the partition information
  * @allow_whole_dev:   true to allow the user to select partition 0
  *                     (which means the whole device), false to require a valid
@@ -245,7 +312,7 @@ int part_get_info_by_name(struct blk_desc *dev_desc,
  */
 int part_get_info_by_dev_and_name_or_num(const char *dev_iface,
                                         const char *dev_part_str,
-                                        struct blk_desc **dev_desc,
+                                        struct blk_desc **desc,
                                         struct disk_partition *part_info,
                                         int allow_whole_dev);
 
@@ -256,12 +323,12 @@ int part_get_info_by_dev_and_name_or_num(const char *dev_iface,
  * (DOS, ISO). Generates partition name out of the device type and partition
  * number.
  *
- * @dev_desc:  pointer to the block device
+ * @desc:      pointer to the block device
  * @part_num:  partition number for which the name is generated
  * @name:      buffer where the name is written
  */
-void part_set_generic_name(const struct blk_desc *dev_desc,
-       int part_num, char *name);
+void part_set_generic_name(const struct blk_desc *desc, int part_num,
+                          char *name);
 
 extern const struct block_drvr block_drvr[];
 #else
@@ -269,26 +336,25 @@ static inline struct blk_desc *blk_get_dev(const char *ifname, int dev)
 { return NULL; }
 static inline struct blk_desc *mg_disk_get_dev(int dev) { return NULL; }
 
-static inline int part_get_info(struct blk_desc *dev_desc, int part,
+static inline int part_get_info(struct blk_desc *desc, int part,
                                struct disk_partition *info) { return -1; }
-static inline int part_get_info_whole_disk(struct blk_desc *dev_desc,
+static inline int part_get_info_whole_disk(struct blk_desc *desc,
                                           struct disk_partition *info)
 { return -1; }
-static inline void part_print(struct blk_desc *dev_desc) {}
-static inline void part_init(struct blk_desc *dev_desc) {}
-static inline void dev_print(struct blk_desc *dev_desc) {}
+static inline void part_print(struct blk_desc *desc) {}
+static inline void part_init(struct blk_desc *desc) {}
+static inline void dev_print(struct blk_desc *desc) {}
 static inline int blk_get_device_by_str(const char *ifname, const char *dev_str,
-                                       struct blk_desc **dev_desc)
+                                       struct blk_desc **desc)
 { return -1; }
 static inline int blk_get_device_part_str(const char *ifname,
                                          const char *dev_part_str,
-                                         struct blk_desc **dev_desc,
+                                         struct blk_desc **desc,
                                          struct disk_partition *info,
                                          int allow_whole_dev)
-{ *dev_desc = NULL; return -1; }
+{ *desc = NULL; return -1; }
 
-static inline int part_get_info_by_name(struct blk_desc *dev_desc,
-                                       const char *name,
+static inline int part_get_info_by_name(struct blk_desc *desc, const char *name,
                                        struct disk_partition *info)
 {
        return -ENOENT;
@@ -297,33 +363,16 @@ static inline int part_get_info_by_name(struct blk_desc *dev_desc,
 static inline int
 part_get_info_by_dev_and_name_or_num(const char *dev_iface,
                                     const char *dev_part_str,
-                                    struct blk_desc **dev_desc,
+                                    struct blk_desc **desc,
                                     struct disk_partition *part_info,
                                     int allow_whole_dev)
 {
-       *dev_desc = NULL;
+       *desc = NULL;
        return -ENOSYS;
 }
 #endif
 
-/**
- * part_get_bootable() - Find the first bootable partition
- *
- * @desc: Block-device descriptor
- * @return first bootable partition, or 0 if there is none
- */
-int part_get_bootable(struct blk_desc *desc);
-
 struct udevice;
-/**
- * part_create_block_devices - Create block devices for disk partitions
- *
- * Create UCLASS_PARTITION udevices for each of disk partitions in @parent
- *
- * @blk_dev:   Whole disk device
- */
-int part_create_block_devices(struct udevice *blk_dev);
-
 /**
  * disk_blk_read() - read blocks from a disk partition
  *
@@ -391,29 +440,29 @@ struct part_driver {
        /**
         * @get_info:           Get information about a partition
         *
-        * @get_info.dev_desc:  Block device descriptor
+        * @get_info.desc:      Block device descriptor
         * @get_info.part:      Partition number (1 = first)
         * @get_info.info:      Returns partition information
         */
-       int (*get_info)(struct blk_desc *dev_desc, int part,
+       int (*get_info)(struct blk_desc *desc, int part,
                        struct disk_partition *info);
 
        /**
         * @print:              Print partition information
         *
-        * @print.dev_desc:     Block device descriptor
+        * @print.desc: Block device descriptor
         */
-       void (*print)(struct blk_desc *dev_desc);
+       void (*print)(struct blk_desc *desc);
 
        /**
         * @test:               Test if a device contains this partition type
         *
-        * @test.dev_desc:      Block device descriptor
+        * @test.desc:          Block device descriptor
         * @test.Return:
         * 0 if the block device appears to contain this partition type,
         * -ve if not
         */
-       int (*test)(struct blk_desc *dev_desc);
+       int (*test)(struct blk_desc *desc);
 };
 
 /* Declare a new U-Boot partition 'driver' */
@@ -427,19 +476,18 @@ struct part_driver {
 /**
  * write_gpt_table() - Write the GUID Partition Table to disk
  *
- * @dev_desc:  block device descriptor
+ * @desc:      block device descriptor
  * @gpt_h:     pointer to GPT header representation
  * @gpt_e:     pointer to GPT partition table entries
  *
  * Return:     zero on success, otherwise error
  */
-int write_gpt_table(struct blk_desc *dev_desc,
-                 gpt_header *gpt_h, gpt_entry *gpt_e);
+int write_gpt_table(struct blk_desc *desc, gpt_header *gpt_h, gpt_entry *gpt_e);
 
 /**
  * gpt_fill_pte() - Fill the GPT partition table entry
  *
- * @dev_desc:  block device descriptor
+ * @desc:      block device descriptor
  * @gpt_h:     GPT header representation
  * @gpt_e:     GPT partition table entries
  * @partitions:        list of partitions
@@ -447,55 +495,54 @@ int write_gpt_table(struct blk_desc *dev_desc,
  *
  * Return:     zero on success
  */
-int gpt_fill_pte(struct blk_desc *dev_desc,
-                gpt_header *gpt_h, gpt_entry *gpt_e,
+int gpt_fill_pte(struct blk_desc *desc, gpt_header *gpt_h, gpt_entry *gpt_e,
                 struct disk_partition *partitions, int parts);
 
 /**
  * gpt_fill_header() - Fill the GPT header
  *
- * @dev_desc:          block device descriptor
+ * @desc:              block device descriptor
  * @gpt_h:             GPT header representation
  * @str_guid:          disk guid string representation
  * @parts_count:       number of partitions
  *
  * Return:             error on str_guid conversion error
  */
-int gpt_fill_header(struct blk_desc *dev_desc, gpt_header *gpt_h,
-               char *str_guid, int parts_count);
+int gpt_fill_header(struct blk_desc *desc, gpt_header *gpt_h, char *str_guid,
+                   int parts_count);
 
 /**
  * gpt_restore() - Restore GPT partition table
  *
- * @dev_desc:          block device descriptor
+ * @desc:              block device descriptor
  * @str_disk_guid:     disk GUID
  * @partitions:                list of partitions
  * @parts_count:       number of partitions
  *
  * Return:             0 on success
  */
-int gpt_restore(struct blk_desc *dev_desc, char *str_disk_guid,
+int gpt_restore(struct blk_desc *desc, char *str_disk_guid,
                struct disk_partition *partitions, const int parts_count);
 
 /**
  * is_valid_gpt_buf() - Ensure that the Primary GPT information is valid
  *
- * @dev_desc:  block device descriptor
+ * @desc:      block device descriptor
  * @buf:       buffer which contains the MBR and Primary GPT info
  *
  * Return:     0 on success, otherwise error
  */
-int is_valid_gpt_buf(struct blk_desc *dev_desc, void *buf);
+int is_valid_gpt_buf(struct blk_desc *desc, void *buf);
 
 /**
  * write_mbr_and_gpt_partitions() - write MBR, Primary GPT and Backup GPT
  *
- * @dev_desc:  block device descriptor
+ * @desc:      block device descriptor
  * @buf:       buffer which contains the MBR and Primary GPT info
  *
  * Return:     0 on success, otherwise error
  */
-int write_mbr_and_gpt_partitions(struct blk_desc *dev_desc, void *buf);
+int write_mbr_and_gpt_partitions(struct blk_desc *desc, void *buf);
 
 /**
  * gpt_verify_headers() - Read and check CRC32 of the GPT's header
@@ -503,24 +550,24 @@ int write_mbr_and_gpt_partitions(struct blk_desc *dev_desc, void *buf);
  *
  * As a side effect if sets gpt_head and gpt_pte so they point to GPT data.
  *
- * @dev_desc:  block device descriptor
+ * @desc:      block device descriptor
  * @gpt_head:  pointer to GPT header data read from medium
  * @gpt_pte:   pointer to GPT partition table enties read from medium
  *
  * Return:     0 on success, otherwise error
  */
-int gpt_verify_headers(struct blk_desc *dev_desc, gpt_header *gpt_head,
+int gpt_verify_headers(struct blk_desc *desc, gpt_header *gpt_head,
                       gpt_entry **gpt_pte);
 
 /**
  * gpt_repair_headers() - Function to repair the GPT's header
  *                        and partition table entries (PTE)
  *
- * @dev_desc:  block device descriptor
+ * @desc:      block device descriptor
  *
  * Return:     0 on success, otherwise error
  */
-int gpt_repair_headers(struct blk_desc *dev_desc);
+int gpt_repair_headers(struct blk_desc *desc);
 
 /**
  * gpt_verify_partitions() - Function to check if partitions' name, start and
@@ -530,7 +577,7 @@ int gpt_repair_headers(struct blk_desc *dev_desc);
  * provided in '$partitions' environment variable. Specificially, name, start
  * and size of the partition is checked.
  *
- * @dev_desc:  block device descriptor
+ * @desc:      block device descriptor
  * @partitions:        partition data read from '$partitions' env variable
  * @parts:     number of partitions read from '$partitions' env variable
  * @gpt_head:  pointer to GPT header data read from medium
@@ -538,7 +585,7 @@ int gpt_repair_headers(struct blk_desc *dev_desc);
  *
  * Return:     0 on success, otherwise error
  */
-int gpt_verify_partitions(struct blk_desc *dev_desc,
+int gpt_verify_partitions(struct blk_desc *desc,
                          struct disk_partition *partitions, int parts,
                          gpt_header *gpt_head, gpt_entry **gpt_pte);
 
@@ -549,12 +596,12 @@ int gpt_verify_partitions(struct blk_desc *dev_desc,
  * This function reads the GUID string from a block device whose descriptor
  * is provided.
  *
- * @dev_desc:  block device descriptor
+ * @desc:      block device descriptor
  * @guid:      pre-allocated string in which to return the GUID
  *
  * Return:     0 on success, otherwise error
  */
-int get_disk_guid(struct blk_desc *dev_desc, char *guid);
+int get_disk_guid(struct blk_desc *desc, char *guid);
 
 #endif
 
@@ -571,12 +618,12 @@ int is_valid_dos_buf(void *buf);
 /**
  * write_mbr_sector() - write DOS MBR
  *
- * @dev_desc:  block device descriptor
+ * @desc:      block device descriptor
  * @buf:       buffer which contains the MBR
  *
  * Return:     0 on success, otherwise error
  */
-int write_mbr_sector(struct blk_desc *dev_desc, void *buf);
+int write_mbr_sector(struct blk_desc *desc, void *buf);
 
 int write_mbr_partitions(struct blk_desc *dev,
                struct disk_partition *p, int count, unsigned int disksig);
@@ -615,12 +662,24 @@ static inline struct part_driver *part_driver_get_first(void)
  */
 int part_get_type_by_name(const char *name);
 
+/**
+ * part_get_bootable() - Find the first bootable partition
+ *
+ * @desc: Block-device descriptor
+ * @return first bootable partition, or 0 if there is none
+ */
+int part_get_bootable(struct blk_desc *desc);
+
 #else
 static inline int part_driver_get_count(void)
 { return 0; }
 
 static inline struct part_driver *part_driver_get_first(void)
 { return NULL; }
+
+static inline bool part_get_bootable(struct blk_desc *desc)
+{ return false; }
+
 #endif /* CONFIG_PARTITIONS */
 
 #endif /* _PART_H */
index c68529b4dafe9a83a44100de76392551a5f8c4eb..59b7895b8a2398a822b652ca8f4ac51b8a2a0716 100644 (file)
        EFI_GUID( 0x3de21764, 0x95bd, 0x54bd, \
                0xa5, 0xc3, 0x4a, 0xbe, 0x78, 0x6f, 0x38, 0xa8)
 
+/* Special ChromiumOS things */
+#define PARTITION_CROS_KERNEL \
+       EFI_GUID(0xfe3a2a5d, 0x4f32, 0x41a7, \
+                0xb7, 0x25, 0xac, 0xcc, 0x32, 0x85, 0xa3, 0x09)
+#define PARTITION_CROS_ROOT \
+       EFI_GUID(0x3cb8e202, 0x3b7e, 0x47dd, \
+                0x8a, 0x3c, 0x7f, 0xf2, 0xa1, 0x3c, 0xfc, 0xec)
+#define PARTITION_CROS_FIRMWARE \
+       EFI_GUID(0xcab6e88e, 0xabf3, 0x4102, \
+                0xa0, 0x7a, 0xd4, 0xbb, 0x9b, 0xe3, 0xc1, 0xd3)
+#define PARTITION_CROS_RESERVED \
+       EFI_GUID(0x2e0a753d, 0x9e48, 0x43b0, \
+                0x83, 0x37, 0xb1, 0x51, 0x92, 0xcb, 0x1b, 0x5e)
+
 /* linux/include/efi.h */
 typedef u16 efi_char16_t;
 
diff --git a/include/sandbox_efi_capsule.h b/include/sandbox_efi_capsule.h
new file mode 100644 (file)
index 0000000..3e288e8
--- /dev/null
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2023, Linaro Limited
+ */
+
+#if !defined(_SANDBOX_EFI_CAPSULE_H_)
+#define _SANDBOX_EFI_CAPSULE_H_
+
+#define SANDBOX_UBOOT_IMAGE_GUID       "09d7cf52-0720-4710-91d1-08469b7fe9c8"
+#define SANDBOX_UBOOT_ENV_IMAGE_GUID   "5a7021f5-fef2-48b4-aaba-832e777418c0"
+#define SANDBOX_FIT_IMAGE_GUID         "3673b45d-6a7c-46f3-9e60-adabb03f7937"
+#define SANDBOX_INCORRECT_GUID         "058b7d83-50d5-4c47-a195-60d86ad341c4"
+
+#define UBOOT_FIT_IMAGE                        "u-boot_bin_env.itb"
+
+#define CAPSULE_PRIV_KEY               "capsule_priv_key_good.key"
+#define CAPSULE_PUB_KEY                        "capsule_pub_key_good.crt"
+#define CAPSULE_INVAL_KEY              "capsule_priv_key_bad.key"
+#define CAPSULE_INVAL_PUB_KEY          "capsule_pub_key_bad.crt"
+
+#endif /* _SANDBOX_EFI_CAPSULE_H_ */
index 9efefea99bb90b5fc7e5c24d3fa0a6d45389c494..ee9d622680d60a2541cc8152c5f006eebc86ae17 100644 (file)
@@ -7,6 +7,7 @@
  #define _SCSI_H
 
 #include <asm/cache.h>
+#include <bouncebuf.h>
 #include <linux/dma-direction.h>
 
 /* Fix this to the maximum */
@@ -298,6 +299,24 @@ struct scsi_ops {
         * @return 0 if OK, -ve on error
         */
        int (*bus_reset)(struct udevice *dev);
+
+#if IS_ENABLED(CONFIG_BOUNCE_BUFFER)
+       /**
+        * buffer_aligned() - test memory alignment of block operation buffer
+        *
+        * Some devices have limited DMA capabilities and require that the
+        * buffers passed to them fit specific properties. This optional
+        * callback can be used to indicate whether a buffer alignment is
+        * suitable for the device DMA or not, and trigger use of generic
+        * bounce buffer implementation to help use of unsuitable buffers
+        * at the expense of performance degradation.
+        *
+        * @dev:        Block device associated with the request
+        * @state:      Bounce buffer state
+        * @return 1 if OK, 0 if unaligned
+        */
+       int (*buffer_aligned)(struct udevice *dev, struct bounce_buffer *state);
+#endif /* CONFIG_BOUNCE_BUFFER */
 };
 
 #define scsi_get_ops(dev)        ((struct scsi_ops *)(dev)->driver->ops)
index 89b93e642b730ae9a57dcd33a3bf6a3de57dac50..f5a941250f481bec4f6547206b8c0347c02bef8b 100644 (file)
 
 #include <linux/bitops.h>
 
+/*
+ * UUID - Universally Unique IDentifier - 128 bits unique number.
+ *        There are 5 versions and one variant of UUID defined by RFC4122
+ *        specification. A UUID contains a set of fields. The set varies
+ *        depending on the version of the UUID, as shown below:
+ *        - time, MAC address(v1),
+ *        - user ID(v2),
+ *        - MD5 of name or URL(v3),
+ *        - random data(v4),
+ *        - SHA-1 of name or URL(v5),
+ *
+ * Layout of UUID:
+ * timestamp - 60-bit: time_low, time_mid, time_hi_and_version
+ * version   - 4 bit (bit 4 through 7 of the time_hi_and_version)
+ * clock seq - 14 bit: clock_seq_hi_and_reserved, clock_seq_low
+ * variant:  - bit 6 and 7 of clock_seq_hi_and_reserved
+ * node      - 48 bit
+ *
+ * source: https://www.ietf.org/rfc/rfc4122.txt
+ *
+ * UUID binary format (16 bytes):
+ *
+ * 4B-2B-2B-2B-6B (big endian - network byte order)
+ *
+ * UUID string is 36 length of characters (36 bytes):
+ *
+ * 0        9    14   19   24
+ * xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+ *    be     be   be   be       be
+ *
+ * where x is a hexadecimal character. Fields are separated by '-'s.
+ * When converting to a binary UUID, le means the field should be converted
+ * to little endian and be means it should be converted to big endian.
+ *
+ * UUID is also used as GUID (Globally Unique Identifier) with the same binary
+ * format but it differs in string format like below.
+ *
+ * GUID:
+ * 0        9    14   19   24
+ * xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+ *    le     le   le   be       be
+ *
+ * GUID is used e.g. in GPT (GUID Partition Table) as a partiions unique id.
+ */
+
 /* This is structure is in big-endian */
 struct uuid {
        unsigned int time_low;
@@ -40,20 +85,78 @@ struct uuid {
 #define UUID_VARIANT           0x1
 
 int uuid_str_valid(const char *uuid);
+
+/*
+ * uuid_str_to_bin() - convert string UUID or GUID to big endian binary data.
+ *
+ * @param uuid_str - pointer to UUID or GUID string [37B] or GUID shorcut
+ * @param uuid_bin - pointer to allocated array for big endian output [16B]
+ * @str_format     - UUID string format: 0 - UUID; 1 - GUID
+ * Return: 0 if OK, -EINVAL if the string is not a valid UUID
+ */
 int uuid_str_to_bin(const char *uuid_str, unsigned char *uuid_bin,
                    int str_format);
+
+/*
+ * uuid_bin_to_str() - convert big endian binary data to string UUID or GUID.
+ *
+ * @param uuid_bin:    pointer to binary data of UUID (big endian) [16B]
+ * @param uuid_str:    pointer to allocated array for output string [37B]
+ * @str_format:                bit 0: 0 - UUID; 1 - GUID
+ *                     bit 1: 0 - lower case; 2 - upper case
+ */
 void uuid_bin_to_str(const unsigned char *uuid_bin, char *uuid_str,
                     int str_format);
+
+/*
+ * uuid_guid_get_bin() - this function get GUID bin for string
+ *
+ * @param guid_str - pointer to partition type string
+ * @param guid_bin - pointer to allocated array for big endian output [16B]
+ */
 int uuid_guid_get_bin(const char *guid_str, unsigned char *guid_bin);
+
+/*
+ * uuid_guid_get_str() - this function get string for GUID.
+ *
+ * @param guid_bin - pointer to string with partition type guid [16B]
+ *
+ * Returns NULL if the type GUID is not known.
+ */
 const char *uuid_guid_get_str(const unsigned char *guid_bin);
+
+/*
+ * gen_rand_uuid() - this function generates a random binary UUID version 4.
+ *                   In this version all fields beside 4 bits of version and
+ *                   2 bits of variant are randomly generated.
+ *
+ * @param uuid_bin - pointer to allocated array [16B]. Output is in big endian.
+ */
 void gen_rand_uuid(unsigned char *uuid_bin);
+
+/*
+ * gen_rand_uuid_str() - this function generates UUID v4 (random) in two string
+ *                       formats UUID or GUID.
+ *
+ * @param uuid_str - pointer to allocated array [37B].
+ * @param          - uuid output type: UUID - 0, GUID - 1
+ */
 void gen_rand_uuid_str(char *uuid_str, int str_format);
 
 /**
  * uuid_str_to_le_bin() - Convert string UUID to little endian binary data.
  * @uuid_str:  pointer to UUID string
  * @uuid_bin:  pointer to allocated array for little endian output [16B]
+ *
+ * UUID string is 36 characters (36 bytes):
+ *
+ * xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+ *
+ * where x is a hexadecimal character. Fields are separated by '-'s.
+ * When converting to a little endian binary UUID, the string fields are reversed.
+ *
  * Return:
+ *
  *    uuid_bin filled with little endian UUID data
  *    On success 0 is returned. Otherwise, failure code.
  */
index 16f7a83f8d50381e96458f115679404511ac4ca0..5048116a3d5762de315933678bafd667c3835c2e 100644 (file)
@@ -58,7 +58,7 @@ enum video_log2_bpp {
  * Convert enum video_log2_bpp to bytes and bits. Note we omit the outer
  * brackets to allow multiplication by fractional pixels.
  */
-#define VNBYTES(bpix)  (1 << (bpix)) / 8
+#define VNBYTES(bpix)  ((1 << (bpix)) / 8)
 
 #define VNBITS(bpix)   (1 << (bpix))
 
index 07e61de5b641a089ef580d4ed4b9da4d063e85b3..42e559ad0b5195220cb08ab91309e271ca110b86 100644 (file)
@@ -862,7 +862,7 @@ config OF_LIBFDT
 config OF_LIBFDT_ASSUME_MASK
        hex "Mask of conditions to assume for libfdt"
        depends on OF_LIBFDT || FIT
-       default 0
+       default 0x0
        help
          Use this to change the assumptions made by libfdt about the
          device tree it is working with. A value of 0 means that no assumptions
index 9fa573525b8b36439e3599c23b8fbd050a46d7f0..1c31ad9531e8f97149fc9b76c76828a9db109a01 100644 (file)
@@ -44,6 +44,7 @@ obj-$(CONFIG_GZIP_COMPRESSED) += gzip.o
 obj-$(CONFIG_GENERATE_SMBIOS_TABLE) += smbios.o
 obj-$(CONFIG_SMBIOS_PARSER) += smbios-parser.o
 obj-$(CONFIG_IMAGE_SPARSE) += image-sparse.o
+obj-y += initcall.o
 obj-y += ldiv.o
 obj-$(CONFIG_XXHASH) += xxhash.o
 obj-y += net_utils.o
index bd270467dd452e52d7aee120195fa39902353262..ce2cff53dc933bf18e4c87daf8abfeca441abc15 100644 (file)
@@ -82,6 +82,11 @@ bool abuf_realloc(struct abuf *abuf, size_t new_size)
        }
 }
 
+bool abuf_realloc_inc(struct abuf *abuf, size_t inc)
+{
+       return abuf_realloc(abuf, abuf->size + inc);
+}
+
 void *abuf_uninit_move(struct abuf *abuf, size_t *sizep)
 {
        void *ptr;
index b1842755eb1b64ef6d42123145385fbc6cc5c655..5e4c4f948a4a2570649d4b83cac405539c3fc6b2 100644 (file)
@@ -444,14 +444,14 @@ u16 *u16_strdup(const void *src)
 
 size_t u16_strlcat(u16 *dest, const u16 *src, size_t count)
 {
-       size_t destlen = u16_strlen(dest);
+       size_t destlen = u16_strnlen(dest, count);
        size_t srclen = u16_strlen(src);
-       size_t ret = destlen + srclen + 1;
+       size_t ret = destlen + srclen;
 
        if (destlen >= count)
                return ret;
-       if (ret > count)
-               srclen -= ret - count;
+       if (ret >= count)
+               srclen -= (ret - count + 1);
        memcpy(&dest[destlen], src, 2 * srclen);
        dest[destlen + srclen] = 0x0000;
 
index aa94d70ef3e6b0d08d3456538299eee714a439db..f6fad8c15dfcde18322f5c352bf2e4e169c5c63a 100644 (file)
@@ -10,7 +10,6 @@
 
 #ifdef USE_HOSTCC
 #include <arpa/inet.h>
-#include <u-boot/crc.h>
 #else
 #include <common.h>
 #include <efi_loader.h>
index 9989e3f384e277960f7dbb18e541329d740abff5..d20aaab6dba4bc4bb35e2ea54c3067830f06db07 100644 (file)
@@ -272,6 +272,14 @@ config EFI_CAPSULE_MAX
          Select the max capsule index value used for capsule report
          variables. This value is used to create CapsuleMax variable.
 
+config EFI_CAPSULE_ESL_FILE
+       string "Path to the EFI Signature List File"
+       depends on EFI_CAPSULE_AUTHENTICATE
+       help
+         Provides the path to the EFI Signature List file which will
+         be embedded in the platform's device tree and used for
+         capsule authentication at the time of capsule update.
+
 config EFI_DEVICE_PATH_TO_TEXT
        bool "Device path to text protocol"
        default y
diff --git a/lib/efi_loader/capsule_esl.dtsi.in b/lib/efi_loader/capsule_esl.dtsi.in
new file mode 100644 (file)
index 0000000..61a9f2b
--- /dev/null
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0+
+/**
+ * Devicetree file with the public key EFI Signature List(ESL)
+ * node. This file is used to generate the dtsi file to be
+ * included into the DTB.
+*/
+/ {
+       signature {
+               capsule-key = /incbin/("ESL_BIN_FILE");
+       };
+};
index c60972dfbe868acee761d5569f0012b9f3e4a024..7a69167648354f005e1d6791e8d1955c879912cd 100644 (file)
@@ -1230,12 +1230,12 @@ static void *fdt_find_separate(void)
 #ifdef CONFIG_SPL_BUILD
        /* FDT is at end of BSS unless it is in a different memory region */
        if (IS_ENABLED(CONFIG_SPL_SEPARATE_BSS))
-               fdt_blob = (ulong *)&_image_binary_end;
+               fdt_blob = (ulong *)_image_binary_end;
        else
-               fdt_blob = (ulong *)&__bss_end;
+               fdt_blob = (ulong *)__bss_end;
 #else
        /* FDT is at end of image */
-       fdt_blob = (ulong *)&_end;
+       fdt_blob = (ulong *)_end;
 
        if (_DEBUG && !fdtdec_prepare_fdt(fdt_blob)) {
                int stack_ptr;
index 4d0c8b84b9d0ba0bbd00e461afe6f307919e9ee5..b5805740153973a433e3e9d705382fe74137d9a9 100644 (file)
@@ -618,23 +618,23 @@ int fwu_trial_state_ctr_start(void)
        return ret;
 }
 
-static int fwu_boottime_checks(void *ctx, struct event *event)
+static int fwu_boottime_checks(void)
 {
        int ret;
        u32 boot_idx, active_idx;
 
-       /* Don't have boot time checks on sandbox */
-       if (IS_ENABLED(CONFIG_SANDBOX)) {
-               boottime_check = 1;
-               return 0;
-       }
-
        ret = uclass_first_device_err(UCLASS_FWU_MDATA, &g_dev);
        if (ret) {
                log_debug("Cannot find fwu device\n");
                return ret;
        }
 
+       /* Don't have boot time checks on sandbox */
+       if (IS_ENABLED(CONFIG_SANDBOX)) {
+               boottime_check = 1;
+               return 0;
+       }
+
        ret = fwu_get_mdata(NULL);
        if (ret) {
                log_debug("Unable to read meta-data\n");
@@ -682,4 +682,4 @@ static int fwu_boottime_checks(void *ctx, struct event *event)
 
        return 0;
 }
-EVENT_SPY(EVT_MAIN_LOOP, fwu_boottime_checks);
+EVENT_SPY_SIMPLE(EVT_MAIN_LOOP, fwu_boottime_checks);
diff --git a/lib/initcall.c b/lib/initcall.c
new file mode 100644 (file)
index 0000000..480490e
--- /dev/null
@@ -0,0 +1,109 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2013 The Chromium OS Authors.
+ */
+
+#include <common.h>
+#include <efi.h>
+#include <initcall.h>
+#include <log.h>
+#include <relocate.h>
+#include <asm/global_data.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static ulong calc_reloc_ofs(void)
+{
+#ifdef CONFIG_EFI_APP
+       return (ulong)image_base;
+#endif
+       /*
+        * Sandbox is relocated by the OS, so symbols always appear at
+        * the relocated address.
+        */
+       if (IS_ENABLED(CONFIG_SANDBOX) || (gd->flags & GD_FLG_RELOC))
+               return gd->reloc_off;
+
+       return 0;
+}
+
+/**
+ * initcall_is_event() - Get the event number for an initcall
+ *
+ * func: Function pointer to check
+ * Return: Event number, if this is an event, else 0
+ */
+static int initcall_is_event(init_fnc_t func)
+{
+       ulong val = (ulong)func;
+
+       if ((val & INITCALL_IS_EVENT) == INITCALL_IS_EVENT)
+               return val & INITCALL_EVENT_TYPE;
+
+       return 0;
+}
+
+/*
+ * To enable debugging. add #define DEBUG at the top of the including file.
+ *
+ * To find a symbol, use grep on u-boot.map
+ */
+int initcall_run_list(const init_fnc_t init_sequence[])
+{
+       ulong reloc_ofs = calc_reloc_ofs();
+       const init_fnc_t *ptr;
+       enum event_t type;
+       init_fnc_t func;
+       int ret = 0;
+
+       for (ptr = init_sequence; func = *ptr, !ret && func; ptr++) {
+               type = initcall_is_event(func);
+
+               if (type) {
+                       if (!CONFIG_IS_ENABLED(EVENT))
+                               continue;
+                       debug("initcall: event %d/%s\n", type,
+                             event_type_name(type));
+               } else if (reloc_ofs) {
+                       debug("initcall: %p (relocated to %p)\n",
+                             (char *)func - reloc_ofs, (char *)func);
+               } else {
+                       debug("initcall: %p\n", (char *)func - reloc_ofs);
+               }
+
+               ret = type ? event_notify_null(type) : func();
+       }
+
+       if (ret) {
+               if (CONFIG_IS_ENABLED(EVENT)) {
+                       char buf[60];
+
+                       /* don't worry about buf size as we are dying here */
+                       if (type) {
+                               sprintf(buf, "event %d/%s", type,
+                                       event_type_name(type));
+                       } else {
+                               sprintf(buf, "call %p", func);
+                       }
+
+                       printf("initcall failed at %s (err=%dE)\n", buf, ret);
+               } else {
+                       printf("initcall failed at call %p (err=%d)\n",
+                              (char *)func - reloc_ofs, ret);
+               }
+
+               return ret;
+       }
+
+       return 0;
+}
+
+void initcall_manual_reloc(init_fnc_t init_sequence[])
+{
+       init_fnc_t *ptr;
+
+       for (ptr = init_sequence; *ptr; ptr++) {
+               if (!initcall_is_event(*ptr))
+                       MANUAL_RELOC(*ptr);
+       }
+}
index ecea755f40535277ab407dbfa897ce8b7272a5a0..f2c61471288d179bfdabe4d3729013521521feca 100644 (file)
@@ -116,20 +116,18 @@ char * strncpy(char * dest,const char *src,size_t count)
  * of course, the buffer size is zero). It does not pad
  * out the result like strncpy() does.
  *
- * Return: the number of bytes copied
+ * Return: strlen(src)
  */
 size_t strlcpy(char *dest, const char *src, size_t size)
 {
-       if (size) {
-               size_t srclen = strlen(src);
-               size_t len = (srclen >= size) ? size - 1 : srclen;
+       size_t ret = strlen(src);
 
+       if (size) {
+               size_t len = (ret >= size) ? size - 1 : ret;
                memcpy(dest, src, len);
                dest[len] = '\0';
-               return len + 1;
        }
-
-       return 0;
+       return ret;
 }
 #endif
 
@@ -191,6 +189,8 @@ char * strncat(char *dest, const char *src, size_t count)
  * Compatible with *BSD: the result is always a valid NUL-terminated string that
  * fits in the buffer (unless, of course, the buffer size is zero). It does not
  * write past @size like strncat() does.
+ *
+ * Return: min(strlen(dest), size) + strlen(src)
  */
 size_t strlcat(char *dest, const char *src, size_t size)
 {
index 1091a5793a1cab6523e7082a0009c8e874c1b6e8..4874bef861bf6c56cc459ea20b8d1af5b3793b49 100644 (file)
@@ -51,7 +51,7 @@ static inline uintptr_t __attribute__((no_instrument_function))
        uintptr_t offset = (uintptr_t)func_ptr;
 
 #ifdef CONFIG_SANDBOX
-       offset -= (uintptr_t)&_init;
+       offset -= (uintptr_t)_init;
 #else
        if (gd->flags & GD_FLG_RELOC)
                offset -= gd->relocaddr;
index d0187007d0e89072781187fafa1e5da2eee50dc4..afb40bff507af4bb5adeed6be8934fc38b5e226f 100644 (file)
@@ -7,6 +7,8 @@
  *   Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
  */
 
+#define LOG_CATEGOT LOGC_CORE
+
 #include <common.h>
 #include <command.h>
 #include <efi_api.h>
 #include <dm/uclass.h>
 #include <rng.h>
 
-/*
- * UUID - Universally Unique IDentifier - 128 bits unique number.
- *        There are 5 versions and one variant of UUID defined by RFC4122
- *        specification. A UUID contains a set of fields. The set varies
- *        depending on the version of the UUID, as shown below:
- *        - time, MAC address(v1),
- *        - user ID(v2),
- *        - MD5 of name or URL(v3),
- *        - random data(v4),
- *        - SHA-1 of name or URL(v5),
- *
- * Layout of UUID:
- * timestamp - 60-bit: time_low, time_mid, time_hi_and_version
- * version   - 4 bit (bit 4 through 7 of the time_hi_and_version)
- * clock seq - 14 bit: clock_seq_hi_and_reserved, clock_seq_low
- * variant:  - bit 6 and 7 of clock_seq_hi_and_reserved
- * node      - 48 bit
- *
- * source: https://www.ietf.org/rfc/rfc4122.txt
- *
- * UUID binary format (16 bytes):
- *
- * 4B-2B-2B-2B-6B (big endian - network byte order)
- *
- * UUID string is 36 length of characters (36 bytes):
- *
- * 0        9    14   19   24
- * xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
- *    be     be   be   be       be
- *
- * where x is a hexadecimal character. Fields are separated by '-'s.
- * When converting to a binary UUID, le means the field should be converted
- * to little endian and be means it should be converted to big endian.
- *
- * UUID is also used as GUID (Globally Unique Identifier) with the same binary
- * format but it differs in string format like below.
- *
- * GUID:
- * 0        9    14   19   24
- * xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
- *    le     le   le   be       be
- *
- * GUID is used e.g. in GPT (GUID Partition Table) as a partiions unique id.
- */
 int uuid_str_valid(const char *uuid)
 {
        int i, valid;
@@ -105,6 +63,10 @@ static const struct {
        {"swap",        PARTITION_LINUX_SWAP_GUID},
        {"lvm",         PARTITION_LINUX_LVM_GUID},
        {"u-boot-env",  PARTITION_U_BOOT_ENVIRONMENT},
+       {"cros-kern",   PARTITION_CROS_KERNEL},
+       {"cros-root",   PARTITION_CROS_ROOT},
+       {"cros-fw",     PARTITION_CROS_FIRMWARE},
+       {"cros-rsrv",   PARTITION_CROS_RESERVED},
 #endif
 #if defined(CONFIG_CMD_EFIDEBUG) || defined(CONFIG_EFI)
        {
@@ -269,12 +231,6 @@ static const struct {
 #endif
 };
 
-/*
- * uuid_guid_get_bin() - this function get GUID bin for string
- *
- * @param guid_str - pointer to partition type string
- * @param guid_bin - pointer to allocated array for big endian output [16B]
- */
 int uuid_guid_get_bin(const char *guid_str, unsigned char *guid_bin)
 {
        int i;
@@ -288,13 +244,6 @@ int uuid_guid_get_bin(const char *guid_str, unsigned char *guid_bin)
        return -ENODEV;
 }
 
-/*
- * uuid_guid_get_str() - this function get string for GUID.
- *
- * @param guid_bin - pointer to string with partition type guid [16B]
- *
- * Returns NULL if the type GUID is not known.
- */
 const char *uuid_guid_get_str(const unsigned char *guid_bin)
 {
        int i;
@@ -307,13 +256,6 @@ const char *uuid_guid_get_str(const unsigned char *guid_bin)
        return NULL;
 }
 
-/*
- * uuid_str_to_bin() - convert string UUID or GUID to big endian binary data.
- *
- * @param uuid_str - pointer to UUID or GUID string [37B] or GUID shorcut
- * @param uuid_bin - pointer to allocated array for big endian output [16B]
- * @str_format     - UUID string format: 0 - UUID; 1 - GUID
- */
 int uuid_str_to_bin(const char *uuid_str, unsigned char *uuid_bin,
                    int str_format)
 {
@@ -322,6 +264,7 @@ int uuid_str_to_bin(const char *uuid_str, unsigned char *uuid_bin,
        uint64_t tmp64;
 
        if (!uuid_str_valid(uuid_str)) {
+               log_debug("not valid\n");
 #ifdef CONFIG_PARTITION_TYPE_GUID
                if (!uuid_guid_get_bin(uuid_str, uuid_bin))
                        return 0;
@@ -358,23 +301,6 @@ int uuid_str_to_bin(const char *uuid_str, unsigned char *uuid_bin,
        return 0;
 }
 
-/**
- * uuid_str_to_le_bin() - Convert string UUID to little endian binary data.
- * @uuid_str:  pointer to UUID string
- * @uuid_bin:  pointer to allocated array for little endian output [16B]
- *
- * UUID string is 36 characters (36 bytes):
- *
- * xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
- *
- * where x is a hexadecimal character. Fields are separated by '-'s.
- * When converting to a little endian binary UUID, the string fields are reversed.
- *
- * Return:
- *
- *    uuid_bin filled with little endian UUID data
- *    On success 0 is returned. Otherwise, failure code.
- */
 int uuid_str_to_le_bin(const char *uuid_str, unsigned char *uuid_bin)
 {
        u16 tmp16;
@@ -402,14 +328,6 @@ int uuid_str_to_le_bin(const char *uuid_str, unsigned char *uuid_bin)
        return 0;
 }
 
-/*
- * uuid_bin_to_str() - convert big endian binary data to string UUID or GUID.
- *
- * @param uuid_bin:    pointer to binary data of UUID (big endian) [16B]
- * @param uuid_str:    pointer to allocated array for output string [37B]
- * @str_format:                bit 0: 0 - UUID; 1 - GUID
- *                     bit 1: 0 - lower case; 2 - upper case
- */
 void uuid_bin_to_str(const unsigned char *uuid_bin, char *uuid_str,
                     int str_format)
 {
@@ -449,13 +367,6 @@ void uuid_bin_to_str(const unsigned char *uuid_bin, char *uuid_str,
        }
 }
 
-/*
- * gen_rand_uuid() - this function generates a random binary UUID version 4.
- *                   In this version all fields beside 4 bits of version and
- *                   2 bits of variant are randomly generated.
- *
- * @param uuid_bin - pointer to allocated array [16B]. Output is in big endian.
-*/
 #if defined(CONFIG_RANDOM_UUID) || defined(CONFIG_CMD_UUID)
 void gen_rand_uuid(unsigned char *uuid_bin)
 {
@@ -493,13 +404,6 @@ void gen_rand_uuid(unsigned char *uuid_bin)
        memcpy(uuid_bin, uuid, 16);
 }
 
-/*
- * gen_rand_uuid_str() - this function generates UUID v4 (random) in two string
- *                       formats UUID or GUID.
- *
- * @param uuid_str - pointer to allocated array [37B].
- * @param          - uuid output type: UUID - 0, GUID - 1
- */
 void gen_rand_uuid_str(char *uuid_str, int str_format)
 {
        unsigned char uuid_bin[UUID_BIN_LEN];
index 43abbac7c32e184a9c420019fbe1df8b5393e5e1..e6f61f0f8f6ab7e65ba800f1a7630e013429cd3e 100644 (file)
--- a/net/net.c
+++ b/net/net.c
@@ -716,7 +716,7 @@ restart:
                case NETLOOP_SUCCESS:
                        net_cleanup_loop();
                        if (net_boot_file_size > 0) {
-                               printf("Bytes transferred = %d (%x hex)\n",
+                               printf("Bytes transferred = %u (%x hex)\n",
                                       net_boot_file_size, net_boot_file_size);
                                env_set_hex("filesize", net_boot_file_size);
                                env_set_hex("fileaddr", image_load_addr);
index f5ab7af0f45dd6b55a5e9b4e376e557674ba6c57..8dc6ec82cd56f41bc961e08ffe27f27b690121f3 100644 (file)
@@ -179,10 +179,13 @@ ifdef DEVICE_TREE_DEBUG
 u_boot_dtsi_options_debug = $(warning $(u_boot_dtsi_options_raw))
 endif
 
-# We use the first match
-u_boot_dtsi = $(strip $(u_boot_dtsi_options_debug) \
+# We use the first match to be included
+dtsi_include_list = $(strip $(u_boot_dtsi_options_debug) \
        $(notdir $(firstword $(u_boot_dtsi_options))))
 
+# The CONFIG_DEVICE_TREE_INCLUDES also need to be included
+dtsi_include_list += $(CONFIG_DEVICE_TREE_INCLUDES)
+
 # Modified for U-Boot
 dtc_cpp_flags  = -Wp,-MD,$(depfile).pre.tmp -nostdinc                    \
                 $(UBOOTINCLUDE)                                         \
@@ -320,8 +323,8 @@ quiet_cmd_dtc = DTC     $@
 # Bring in any U-Boot-specific include at the end of the file
 # And finally any custom .dtsi fragments specified with CONFIG_DEVICE_TREE_INCLUDES
 cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
-       (cat $<; $(if $(u_boot_dtsi),echo '$(pound)include "$(u_boot_dtsi)"')) > $(pre-tmp); \
-       $(foreach f,$(subst $(quote),,$(CONFIG_DEVICE_TREE_INCLUDES)), \
+       (cat $< > $(pre-tmp)); \
+       $(foreach f,$(subst $(quote),,$(dtsi_include_list)), \
          echo '$(pound)include "$(f)"' >> $(pre-tmp);) \
        $(HOSTCC) -E $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) $(pre-tmp) ; \
        $(DTC) -O dtb -o $@ -b 0 \
@@ -331,7 +334,24 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \
                ; \
        sed "s:$(pre-tmp):$(<):" $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile)
 
-$(obj)/%.dtb: $(src)/%.dts $(DTC) FORCE
+quiet_cmd_capsule_esl_gen = CAPSULE_ESL_GEN $@
+cmd_capsule_esl_gen = \
+       $(shell sed "s:ESL_BIN_FILE:$(capsule_esl_path):" $(capsule_esl_input_file) > $@)
+
+$(obj)/.capsule_esl.dtsi: FORCE
+       $(call cmd_capsule_esl_gen)
+
+capsule_esl_input_file=$(srctree)/lib/efi_loader/capsule_esl.dtsi.in
+capsule_esl_dtsi = .capsule_esl.dtsi
+capsule_esl_path=$(abspath $(srctree)/$(subst $(quote),,$(CONFIG_EFI_CAPSULE_ESL_FILE)))
+
+ifdef CONFIG_EFI_CAPSULE_AUTHENTICATE
+dtsi_include_list += $(capsule_esl_dtsi)
+endif
+
+dtsi_include_list_deps = $(addprefix $(obj)/,$(subst $(quote),,$(dtsi_include_list)))
+
+$(obj)/%.dtb: $(src)/%.dts $(DTC) $(dtsi_include_list_deps) FORCE
        $(call if_changed_dep,dtc)
 
 pre-tmp = $(subst $(comma),_,$(dot-target).pre.tmp)
index 0117457526ef29a5e2d28d88c3cb0275fb700d85..24dfe2bda91fc17dfbe90a5f9e130687efb74233 100755 (executable)
@@ -19,8 +19,10 @@ from u_boot_pylib import tools
 
 # A typical symbol looks like this:
 #   _u_boot_list_2_evspy_info_2_EVT_MISC_INIT_F_3_sandbox_misc_init_f
-PREFIX = '_u_boot_list_2_evspy_info_2_'
-RE_EVTYPE = re.compile('%s(.*)_3_.*' % PREFIX)
+PREFIX_FULL = '_u_boot_list_2_evspy_info_2_'
+PREFIX_SIMPLE = '_u_boot_list_2_evspy_info_simple_2_'
+RE_EVTYPE_FULL = re.compile('%s(.*)_3_.*' % PREFIX_FULL)
+RE_EVTYPE_SIMPLE = re.compile('%s(.*)_3_.*' % PREFIX_SIMPLE)
 
 def show_sym(fname, data, endian, evtype, sym):
     """Show information about an evspy entry
@@ -88,12 +90,14 @@ def show_event_spy_list(fname, endian):
         fname (str): Filename of ELF file
         endian (str): Endianness to use ('little', 'big', 'auto')
     """
-    syms = elf.GetSymbolFileOffset(fname, [PREFIX])
+    syms = elf.GetSymbolFileOffset(fname, [PREFIX_FULL, PREFIX_SIMPLE])
     data = tools.read_file(fname)
     print('%-20s  %-30s  %s' % ('Event type', 'Id', 'Source location'))
     print('%-20s  %-30s  %s' % ('-' * 20, '-' * 30, '-' * 30))
     for name, sym in syms.items():
-        m_evtype = RE_EVTYPE.search(name)
+        m_evtype = RE_EVTYPE_FULL.search(name)
+        if not m_evtype:
+            m_evtype = RE_EVTYPE_SIMPLE.search(name)
         evtype = m_evtype .group(1)
         show_sym(fname, data, endian, evtype, sym)
 
index 12e525ee31f181a871d1bb356f6595c676f3f9aa..2d97aab8d21e881ff427f77bf9dbdb90e1a3a8cc 100644 (file)
@@ -99,7 +99,9 @@ endif
 %_config: %_defconfig
        @:
 
-configfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/configs/$@)
+configfiles=$(wildcard $(srctree)/kernel/configs/$@ \
+               $(srctree)/arch/$(SRCARCH)/configs/$@ \
+               $(shell find $(srctree)/board -name "$@"))
 
 %.config: $(obj)/conf
        $(if $(call configfiles),, $(error No configuration exists for this target on this architecture))
index 22ed61c8fa02abce4772ff270a9e6cf2a717509a..52947580ae6012b8a2eeb2f34a3a7def42be1dfa 100644 (file)
@@ -6,6 +6,7 @@ obj-$(CONFIG_BOOTSTD) += bootdev.o bootstd_common.o bootflow.o bootmeth.o
 obj-$(CONFIG_FIT) += image.o
 
 obj-$(CONFIG_EXPO) += expo.o
+obj-$(CONFIG_CEDIT) += cedit.o
 
 ifdef CONFIG_OF_LIVE
 obj-$(CONFIG_BOOTMETH_VBE_SIMPLE) += vbe_simple.o
index 1c91a942e989991c74b8dc878eec08ec5b26e4b2..f5b2059140acae8f5a9d463ebf99b9c3462e3106 100644 (file)
@@ -27,6 +27,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+extern U_BOOT_DRIVER(bootmeth_cros);
 extern U_BOOT_DRIVER(bootmeth_2script);
 
 static int inject_response(struct unit_test_state *uts)
@@ -167,21 +168,22 @@ static int bootflow_cmd_scan_e(struct unit_test_state *uts)
        ut_assert_nextline("Seq  Method       State   Uclass    Part  Name                      Filename");
        ut_assert_nextlinen("---");
        ut_assert_nextline("Scanning bootdev 'mmc2.bootdev':");
-       ut_assert_nextline("  0  extlinux     media   mmc          0  mmc2.bootdev.whole        <NULL>");
+       ut_assert_nextline("  0  extlinux     media   mmc          0  mmc2.bootdev.whole        ");
        ut_assert_nextline("     ** No partition found, err=-93: Protocol not supported");
-       ut_assert_nextline("  1  efi          media   mmc          0  mmc2.bootdev.whole        <NULL>");
+       ut_assert_nextline("  1  efi          media   mmc          0  mmc2.bootdev.whole        ");
        ut_assert_nextline("     ** No partition found, err=-93: Protocol not supported");
 
        ut_assert_nextline("Scanning bootdev 'mmc1.bootdev':");
-       ut_assert_nextline("  2  extlinux     media   mmc          0  mmc1.bootdev.whole        <NULL>");
+       ut_assert_nextline("  2  extlinux     media   mmc          0  mmc1.bootdev.whole        ");
        ut_assert_nextline("     ** No partition found, err=-2: No such file or directory");
-       ut_assert_nextline("  3  efi          media   mmc          0  mmc1.bootdev.whole        <NULL>");
+       ut_assert_nextline("  3  efi          media   mmc          0  mmc1.bootdev.whole        ");
        ut_assert_nextline("     ** No partition found, err=-2: No such file or directory");
        ut_assert_nextline("  4  extlinux     ready   mmc          1  mmc1.bootdev.part_1       /extlinux/extlinux.conf");
        ut_assert_nextline("  5  efi          fs      mmc          1  mmc1.bootdev.part_1       efi/boot/bootsbox.efi");
 
        ut_assert_skip_to_line("Scanning bootdev 'mmc0.bootdev':");
-       ut_assert_skip_to_line(" 3f  efi          media   mmc          0  mmc0.bootdev.whole        <NULL>");
+       ut_assert_skip_to_line(
+               " 3f  efi          media   mmc          0  mmc0.bootdev.whole        ");
        ut_assert_nextline("     ** No partition found, err=-93: Protocol not supported");
        ut_assert_nextline("No more bootdevs");
        ut_assert_nextlinen("---");
@@ -192,10 +194,11 @@ static int bootflow_cmd_scan_e(struct unit_test_state *uts)
        ut_assert_nextline("Showing all bootflows");
        ut_assert_nextline("Seq  Method       State   Uclass    Part  Name                      Filename");
        ut_assert_nextlinen("---");
-       ut_assert_nextline("  0  extlinux     media   mmc          0  mmc2.bootdev.whole        <NULL>");
-       ut_assert_nextline("  1  efi          media   mmc          0  mmc2.bootdev.whole        <NULL>");
-       ut_assert_skip_to_line("  4  extlinux     ready   mmc          1  mmc1.bootdev.part_1       /extlinux/extlinux.conf");
-       ut_assert_skip_to_line(" 3f  efi          media   mmc          0  mmc0.bootdev.whole        <NULL>");
+       ut_assert_nextline("  0  extlinux     media   mmc          0  mmc2.bootdev.whole        ");
+       ut_assert_nextline("  1  efi          media   mmc          0  mmc2.bootdev.whole        ");
+       ut_assert_skip_to_line(
+               "  4  extlinux     ready   mmc          1  mmc1.bootdev.part_1       /extlinux/extlinux.conf");
+       ut_assert_skip_to_line(" 3f  efi          media   mmc          0  mmc0.bootdev.whole        ");
        ut_assert_nextlinen("---");
        ut_assert_nextline("(64 bootflows, 1 valid)");
        ut_assert_console_end();
@@ -384,7 +387,7 @@ static int bootflow_system(struct unit_test_state *uts)
        console_record_reset_enable();
        ut_assertok(run_command("bootflow scan -lH", 0));
        ut_assert_skip_to_line(
-               "  0  efi_mgr      ready   (none)       0  <NULL>                    <NULL>");
+               "  0  efi_mgr      ready   (none)       0  <NULL>                    ");
        ut_assert_skip_to_line("No more bootdevs");
        ut_assert_skip_to_line("(2 bootflows, 2 valid)");
        ut_assert_console_end();
@@ -506,21 +509,25 @@ static int bootflow_cmd_boot(struct unit_test_state *uts)
 BOOTSTD_TEST(bootflow_cmd_boot, UT_TESTF_DM | UT_TESTF_SCAN_FDT);
 
 /**
- * prep_mmc4_bootdev() - Set up the mmc4 bootdev so we can access a fake Armbian
+ * prep_mmc_bootdev() - Set up an mmc bootdev so we can access other distros
  *
  * @uts: Unit test state
+ * @mmc_dev: MMC device to use, e.g. "mmc4"
  * Returns 0 on success, -ve on failure
  */
-static int prep_mmc4_bootdev(struct unit_test_state *uts)
+static int prep_mmc_bootdev(struct unit_test_state *uts, const char *mmc_dev,
+                           bool bind_cros)
 {
-       static const char *order[] = {"mmc2", "mmc1", "mmc4", NULL};
+       const char *order[] = {"mmc2", "mmc1", mmc_dev, NULL};
        struct udevice *dev, *bootstd;
        struct bootstd_priv *std;
        const char **old_order;
-       ofnode node;
+       ofnode root, node;
 
        /* Enable the mmc4 node since we need a second bootflow */
-       node = ofnode_path("/mmc4");
+       root = oftree_root(oftree_default());
+       node = ofnode_find_subnode(root, mmc_dev);
+       ut_assert(ofnode_valid(node));
        ut_assertok(lists_bind_fdt(gd->dm_root, node, &dev, NULL, false));
 
        /* Enable the script bootmeth too */
@@ -528,7 +535,14 @@ static int prep_mmc4_bootdev(struct unit_test_state *uts)
        ut_assertok(device_bind(bootstd, DM_DRIVER_REF(bootmeth_2script),
                                "bootmeth_script", 0, ofnode_null(), &dev));
 
-       /* Change the order to include mmc4 */
+       /* Enable the cros bootmeth if needed */
+       if (bind_cros) {
+               ut_assertok(uclass_first_device_err(UCLASS_BOOTSTD, &bootstd));
+               ut_assertok(device_bind(bootstd, DM_DRIVER_REF(bootmeth_cros),
+                                       "cros", 0, ofnode_null(), &dev));
+       }
+
+       /* Change the order to include the device */
        std = dev_get_priv(bootstd);
        old_order = std->bootdev_order;
        std->bootdev_order = order;
@@ -543,6 +557,19 @@ static int prep_mmc4_bootdev(struct unit_test_state *uts)
        return 0;
 }
 
+/**
+ * prep_mmc4_bootdev() - Set up the mmc4 bootdev so we can access a fake Armbian
+ *
+ * @uts: Unit test state
+ * Returns 0 on success, -ve on failure
+ */
+static int prep_mmc4_bootdev(struct unit_test_state *uts)
+{
+       ut_assertok(prep_mmc_bootdev(uts, "mmc4", false));
+
+       return 0;
+}
+
 /* Check 'bootflow menu' to select a bootflow */
 static int bootflow_cmd_menu(struct unit_test_state *uts)
 {
@@ -945,3 +972,24 @@ static int bootflow_cmdline(struct unit_test_state *uts)
        return 0;
 }
 BOOTSTD_TEST(bootflow_cmdline, 0);
+
+/* Test ChromiumOS bootmeth */
+static int bootflow_cros(struct unit_test_state *uts)
+{
+       ut_assertok(prep_mmc_bootdev(uts, "mmc5", true));
+       ut_assertok(run_command("bootflow list", 0));
+
+       ut_assert_nextlinen("Showing all");
+       ut_assert_nextlinen("Seq");
+       ut_assert_nextlinen("---");
+       ut_assert_nextlinen("  0  extlinux");
+       ut_assert_nextlinen("  1  cros         ready   mmc          2  mmc5.bootdev.part_2       ");
+       ut_assert_nextlinen("  2  cros         ready   mmc          4  mmc5.bootdev.part_4       ");
+       ut_assert_nextlinen("---");
+       ut_assert_skip_to_line("(3 bootflows, 3 valid)");
+
+       ut_assert_console_end();
+
+       return 0;
+}
+BOOTSTD_TEST(bootflow_cros, 0);
diff --git a/test/boot/cedit.c b/test/boot/cedit.c
new file mode 100644 (file)
index 0000000..ab2b8a1
--- /dev/null
@@ -0,0 +1,198 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2023 Google LLC
+ * Written by Simon Glass <sjg@chromium.org>
+ */
+
+#include <common.h>
+#include <cedit.h>
+#include <env.h>
+#include <expo.h>
+#include <mapmem.h>
+#include <dm/ofnode.h>
+#include <test/ut.h>
+#include "bootstd_common.h"
+#include <test/cedit-test.h>
+#include "../../boot/scene_internal.h"
+
+/* Check the cedit command */
+static int cedit_base(struct unit_test_state *uts)
+{
+       extern struct expo *cur_exp;
+       struct scene_obj_menu *menu;
+       struct scene_obj_txt *txt;
+       struct expo *exp;
+       struct scene *scn;
+
+       ut_assertok(run_command("cedit load hostfs - cedit.dtb", 0));
+
+       console_record_reset_enable();
+
+       /*
+        * ^N  Move down to second menu
+        * ^M  Open menu
+        * ^N  Move down to second item
+        * ^M  Select item
+        * \e  Quit
+        */
+       console_in_puts("\x0e\x0d\x0e\x0d\e");
+       ut_assertok(run_command("cedit run", 0));
+
+       exp = cur_exp;
+       scn = expo_lookup_scene_id(exp, exp->scene_id);
+       ut_assertnonnull(scn);
+
+       menu = scene_obj_find(scn, scn->highlight_id, SCENEOBJT_NONE);
+       ut_assertnonnull(menu);
+
+       txt = scene_obj_find(scn, menu->title_id, SCENEOBJT_NONE);
+       ut_assertnonnull(txt);
+       ut_asserteq_str("AC Power", expo_get_str(exp, txt->str_id));
+
+       ut_asserteq(ID_AC_ON, menu->cur_item_id);
+
+       return 0;
+}
+BOOTSTD_TEST(cedit_base, 0);
+
+/* Check the cedit write_fdt and read_fdt commands */
+static int cedit_fdt(struct unit_test_state *uts)
+{
+       struct video_priv *vid_priv;
+       extern struct expo *cur_exp;
+       struct scene_obj_menu *menu;
+       ulong addr = 0x1000;
+       struct ofprop prop;
+       struct scene *scn;
+       oftree tree;
+       ofnode node;
+       void *fdt;
+       int i;
+
+       console_record_reset_enable();
+       ut_assertok(run_command("cedit load hostfs - cedit.dtb", 0));
+
+       ut_asserteq(ID_SCENE1, cedit_prepare(cur_exp, &vid_priv, &scn));
+
+       /* get a menu to fiddle with */
+       menu = scene_obj_find(scn, ID_CPU_SPEED, SCENEOBJT_MENU);
+       ut_assertnonnull(menu);
+       menu->cur_item_id = ID_CPU_SPEED_2;
+
+       ut_assertok(run_command("cedit write_fdt hostfs - settings.dtb", 0));
+       ut_assertok(run_commandf("load hostfs - %lx settings.dtb", addr));
+       ut_assert_nextlinen("1024 bytes read");
+
+       fdt = map_sysmem(addr, 1024);
+       tree = oftree_from_fdt(fdt);
+       node = ofnode_find_subnode(oftree_root(tree), CEDIT_NODE_NAME);
+
+       ut_asserteq(ID_CPU_SPEED_2,
+                   ofnode_read_u32_default(node, "cpu-speed", 0));
+       ut_asserteq_str("2.5 GHz", ofnode_read_string(node, "cpu-speed-str"));
+       ut_assert(ofnode_valid(node));
+
+       /* There should only be 4 properties */
+       for (i = 0, ofnode_first_property(node, &prop); ofprop_valid(&prop);
+            i++, ofnode_next_property(&prop))
+               ;
+       ut_asserteq(4, i);
+
+       ut_assert_console_end();
+
+       /* reset the expo */
+       menu->cur_item_id = ID_CPU_SPEED_1;
+
+       /* load in the settings and make sure they update */
+       ut_assertok(run_command("cedit read_fdt hostfs - settings.dtb", 0));
+       ut_asserteq(ID_CPU_SPEED_2, menu->cur_item_id);
+
+       ut_assertnonnull(menu);
+       ut_assert_console_end();
+
+       return 0;
+}
+BOOTSTD_TEST(cedit_fdt, 0);
+
+/* Check the cedit write_env and read_env commands */
+static int cedit_env(struct unit_test_state *uts)
+{
+       struct video_priv *vid_priv;
+       extern struct expo *cur_exp;
+       struct scene_obj_menu *menu;
+       struct scene *scn;
+
+       console_record_reset_enable();
+       ut_assertok(run_command("cedit load hostfs - cedit.dtb", 0));
+
+       ut_asserteq(ID_SCENE1, cedit_prepare(cur_exp, &vid_priv, &scn));
+
+       /* get a menu to fiddle with */
+       menu = scene_obj_find(scn, ID_CPU_SPEED, SCENEOBJT_MENU);
+       ut_assertnonnull(menu);
+       menu->cur_item_id = ID_CPU_SPEED_2;
+
+       ut_assertok(run_command("cedit write_env -v", 0));
+       ut_assert_nextlinen("c.cpu-speed=7");
+       ut_assert_nextlinen("c.cpu-speed-str=2.5 GHz");
+       ut_assert_nextlinen("c.power-loss=10");
+       ut_assert_nextlinen("c.power-loss-str=Always Off");
+       ut_assert_console_end();
+
+       ut_asserteq(7, env_get_ulong("c.cpu-speed", 10, 0));
+       ut_asserteq_str("2.5 GHz", env_get("c.cpu-speed-str"));
+
+       /* reset the expo */
+       menu->cur_item_id = ID_CPU_SPEED_1;
+
+       ut_assertok(run_command("cedit read_env -v", 0));
+       ut_assert_nextlinen("c.cpu-speed=7");
+       ut_assert_nextlinen("c.power-loss=10");
+       ut_assert_console_end();
+
+       ut_asserteq(ID_CPU_SPEED_2, menu->cur_item_id);
+
+       return 0;
+}
+BOOTSTD_TEST(cedit_env, 0);
+
+/* Check the cedit write_cmos and read_cmos commands */
+static int cedit_cmos(struct unit_test_state *uts)
+{
+       struct scene_obj_menu *menu, *menu2;
+       struct video_priv *vid_priv;
+       extern struct expo *cur_exp;
+       struct scene *scn;
+
+       console_record_reset_enable();
+       ut_assertok(run_command("cedit load hostfs - cedit.dtb", 0));
+
+       ut_asserteq(ID_SCENE1, cedit_prepare(cur_exp, &vid_priv, &scn));
+
+       /* get the menus to fiddle with */
+       menu = scene_obj_find(scn, ID_CPU_SPEED, SCENEOBJT_MENU);
+       ut_assertnonnull(menu);
+       menu->cur_item_id = ID_CPU_SPEED_2;
+
+       menu2 = scene_obj_find(scn, ID_POWER_LOSS, SCENEOBJT_MENU);
+       ut_assertnonnull(menu2);
+       menu2->cur_item_id = ID_AC_MEMORY;
+
+       ut_assertok(run_command("cedit write_cmos -v", 0));
+       ut_assert_nextlinen("Write 2 bytes from offset 80 to 84");
+       ut_assert_console_end();
+
+       /* reset the expo */
+       menu->cur_item_id = ID_CPU_SPEED_1;
+       menu2->cur_item_id = ID_AC_OFF;
+
+       ut_assertok(run_command("cedit read_cmos -v", 0));
+       ut_assert_nextlinen("Read 2 bytes from offset 80 to 84");
+       ut_assert_console_end();
+
+       ut_asserteq(ID_CPU_SPEED_2, menu->cur_item_id);
+       ut_asserteq(ID_AC_MEMORY, menu2->cur_item_id);
+
+       return 0;
+}
+BOOTSTD_TEST(cedit_cmos, 0);
index 3898f853a75165ca28eadca6766579dee8a1b02d..90027409c817f55d26ffdbd0b6f99fcadc2e6936 100644 (file)
@@ -289,6 +289,33 @@ static int expo_object_attr(struct unit_test_state *uts)
 }
 BOOTSTD_TEST(expo_object_attr, UT_TESTF_DM | UT_TESTF_SCAN_FDT);
 
+/**
+ * struct test_iter_priv - private data for expo-iterator test
+ *
+ * @count: number of scene objects
+ * @menu_count: number of menus
+ * @fail_at: item ID at which to return an error
+ */
+struct test_iter_priv {
+       int count;
+       int menu_count;
+       int fail_at;
+};
+
+int h_test_iter(struct scene_obj *obj, void *vpriv)
+{
+       struct test_iter_priv *priv = vpriv;
+
+       if (priv->fail_at == obj->id)
+               return -EINVAL;
+
+       priv->count++;
+       if (obj->type == SCENEOBJT_MENU)
+               priv->menu_count++;
+
+       return 0;
+}
+
 /* Check creating a scene with a menu */
 static int expo_object_menu(struct unit_test_state *uts)
 {
@@ -296,6 +323,7 @@ static int expo_object_menu(struct unit_test_state *uts)
        struct scene_menitem *item;
        int id, label_id, desc_id, key_id, pointer_id, preview_id;
        struct scene_obj_txt *ptr, *name1, *desc1, *key1, *tit, *prev1;
+       struct test_iter_priv priv;
        struct scene *scn;
        struct expo *exp;
        ulong start_mem;
@@ -382,6 +410,23 @@ static int expo_object_menu(struct unit_test_state *uts)
        ut_asserteq(menu->obj.dim.y + 32, prev1->obj.dim.y);
        ut_asserteq(true, prev1->obj.flags & SCENEOF_HIDE);
 
+       /* check iterating through scene items */
+       memset(&priv, '\0', sizeof(priv));
+       ut_assertok(expo_iter_scene_objs(exp, h_test_iter, &priv));
+       ut_asserteq(7, priv.count);
+       ut_asserteq(1, priv.menu_count);
+
+       /* check the iterator failing part way through iteration */
+       memset(&priv, '\0', sizeof(priv));
+       priv.fail_at = key_id;
+       ut_asserteq(-EINVAL, expo_iter_scene_objs(exp, h_test_iter, &priv));
+
+       /* 2 items (preview_id and the menuitem) are after key_id, 7 - 2 = 5 */
+       ut_asserteq(5, priv.count);
+
+       /* menu is first, so is still processed */
+       ut_asserteq(1, priv.menu_count);
+
        expo_destroy(exp);
 
        ut_assertok(ut_check_delta(start_mem));
@@ -669,46 +714,3 @@ static int expo_test_build(struct unit_test_state *uts)
        return 0;
 }
 BOOTSTD_TEST(expo_test_build, UT_TESTF_DM);
-
-/* Check the cedit command */
-static int expo_cedit(struct unit_test_state *uts)
-{
-       extern struct expo *cur_exp;
-       struct scene_obj_menu *menu;
-       struct scene_obj_txt *txt;
-       struct expo *exp;
-       struct scene *scn;
-
-       if (!IS_ENABLED(CONFIG_CMD_CEDIT))
-               return -EAGAIN;
-
-       ut_assertok(run_command("cedit load hostfs - cedit.dtb", 0));
-
-       console_record_reset_enable();
-
-       /*
-        * ^N  Move down to second menu
-        * ^M  Open menu
-        * ^N  Move down to second item
-        * ^M  Select item
-        * \e  Quit
-        */
-       console_in_puts("\x0e\x0d\x0e\x0d\e");
-       ut_assertok(run_command("cedit run", 0));
-
-       exp = cur_exp;
-       scn = expo_lookup_scene_id(exp, exp->scene_id);
-       ut_assertnonnull(scn);
-
-       menu = scene_obj_find(scn, scn->highlight_id, SCENEOBJT_NONE);
-       ut_assertnonnull(menu);
-
-       txt = scene_obj_find(scn, menu->title_id, SCENEOBJT_NONE);
-       ut_assertnonnull(txt);
-       ut_asserteq_str("AC Power", expo_get_str(exp, txt->str_id));
-
-       ut_asserteq(ID_AC_ON, menu->cur_item_id);
-
-       return 0;
-}
-BOOTSTD_TEST(expo_cedit, UT_TESTF_DM | UT_TESTF_SCAN_FDT);
diff --git a/test/boot/files/expo_ids.h b/test/boot/files/expo_ids.h
new file mode 100644 (file)
index 0000000..027d44b
--- /dev/null
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Sample expo screen layout (ID numbers)
+ */
+
+enum {
+       ZERO,
+       ID_PROMPT,
+
+       ID_SCENE1,
+       ID_SCENE1_TITLE,
+
+       ID_CPU_SPEED,
+       ID_CPU_SPEED_TITLE,
+       ID_CPU_SPEED_1,
+       ID_CPU_SPEED_2,
+       ID_CPU_SPEED_3,
+
+       ID_POWER_LOSS,
+       ID_AC_OFF,
+       ID_AC_ON,
+       ID_AC_MEMORY,
+
+       ID_DYNAMIC_START,
+};
index 55d5c910dd5e4b983b716c29c09b5a313d4cf51b..cb2a674d9d56a444a40b9c5a74fe133d6fd705cd 100644 (file)
@@ -5,28 +5,7 @@
 
 /dts-v1/;
 
-/*
-enum {
-       ZERO,
-       ID_PROMPT,
-
-       ID_SCENE1,
-       ID_SCENE1_TITLE,
-
-       ID_CPU_SPEED,
-       ID_CPU_SPEED_TITLE,
-       ID_CPU_SPEED_1,
-       ID_CPU_SPEED_2,
-       ID_CPU_SPEED_3,
-
-       ID_POWER_LOSS,
-       ID_AC_OFF,
-       ID_AC_ON,
-       ID_AC_MEMORY,
-
-       ID_DYNAMIC_START,
-};
-*/
+/* see expo_ids.h for the IDs */
 
 / {
        dynamic-start = <ID_DYNAMIC_START>;
@@ -59,6 +38,9 @@ enum {
                                /* IDs for the menu items */
                                item-id = <ID_CPU_SPEED_1 ID_CPU_SPEED_2
                                        ID_CPU_SPEED_3>;
+
+                               start-bit = <0x400>;
+                               bit-length = <2>;
                        };
 
                        power-loss {
@@ -70,6 +52,8 @@ enum {
                                        "Memory";
 
                                item-id = <ID_AC_OFF ID_AC_ON ID_AC_MEMORY>;
+                               start-bit = <0x422>;
+                               bit-length = <2>;
                        };
                };
        };
index 0cb514490b91a7c7d0f3c78e4fb140b6095764c3..0f56409e8031449e49109e29793a24deb0432906 100644 (file)
@@ -201,7 +201,7 @@ static char ut_help_text[] =
        "\nfdt - fdt command"
 #endif
 #ifdef CONFIG_CONSOLE_TRUETYPE
-       "\nut font - font command"
+       "\nfont - font command"
 #endif
 #ifdef CONFIG_CMD_LOADM
        "\nloadm - loadm command parameters and loading memory blob"
index 6037ae2ce3bcebeac108c86ef2b16ad1910be0bb..c0912a3437bb00e4f40a040073161f1df58ba125 100644 (file)
@@ -18,6 +18,8 @@ struct test_state {
        int val;
 };
 
+static bool called;
+
 static int h_adder(void *ctx, struct event *event)
 {
        struct event_data_test *data = &event->data.test;
@@ -28,6 +30,14 @@ static int h_adder(void *ctx, struct event *event)
        return 0;
 }
 
+static int h_adder_simple(void)
+{
+       called = true;
+
+       return 0;
+}
+EVENT_SPY_SIMPLE(EVT_TEST, h_adder_simple);
+
 static int test_event_base(struct unit_test_state *uts)
 {
        struct test_state state;
@@ -46,6 +56,18 @@ static int test_event_base(struct unit_test_state *uts)
 }
 COMMON_TEST(test_event_base, 0);
 
+static int test_event_simple(struct unit_test_state *uts)
+{
+       called = false;
+
+       /* Check that the handler is called */
+       ut_assertok(event_notify_null(EVT_TEST));
+       ut_assert(called);
+
+       return 0;
+}
+COMMON_TEST(test_event_simple, 0);
+
 static int h_probe(void *ctx, struct event *event)
 {
        struct test_state *test_state = ctx;
index 77eb524b59f8280fa5635a411bb9990bb93fa905..5997bda649bda5eec54fe6a802939edc2598b2ec 100644 (file)
@@ -221,7 +221,8 @@ static int dm_test_acpi_create_dmar(struct unit_test_state *uts)
        ut_assertnonnull(cpu);
        ut_assertok(acpi_create_dmar(&dmar, DMAR_INTR_REMAP));
        ut_asserteq(DMAR_INTR_REMAP, dmar.flags);
-       ut_asserteq(32 - 1, dmar.host_address_width);
+       ut_asserteq((IS_ENABLED(CONFIG_PHYS_64BIT) ? 64 : 32) - 1,
+                   dmar.host_address_width);
 
        return 0;
 }
@@ -277,13 +278,16 @@ static int dm_test_acpi_write_tables(struct unit_test_state *uts)
         */
        ut_asserteq_ptr(dmar + 3, ctx.current);
        ut_asserteq(DMAR_INTR_REMAP, dmar->flags);
-       ut_asserteq(32 - 1, dmar->host_address_width);
+       ut_asserteq((IS_ENABLED(CONFIG_PHYS_64BIT) ? 64 : 32) - 1,
+                   dmar->host_address_width);
 
        ut_asserteq(DMAR_INTR_REMAP, dmar[1].flags);
-       ut_asserteq(32 - 1, dmar[1].host_address_width);
+       ut_asserteq((IS_ENABLED(CONFIG_PHYS_64BIT) ? 64 : 32) - 1,
+                   dmar[1].host_address_width);
 
        ut_asserteq(DMAR_INTR_REMAP, dmar[2].flags);
-       ut_asserteq(32 - 1, dmar[2].host_address_width);
+       ut_asserteq((IS_ENABLED(CONFIG_PHYS_64BIT) ? 64 : 32) - 1,
+                   dmar[2].host_address_width);
 
        /* Check that the pointers were added correctly */
        for (i = 0; i < 3; i++) {
index 8b5c83ef4e2d8ff366e4476bc8d2f66dd60e9eae..52018f610fe4764f2655f314069578ebd32489b5 100644 (file)
@@ -93,6 +93,12 @@ static int dm_test_fwu_mdata_read(struct unit_test_state *uts)
        struct udevice *dev;
        struct fwu_mdata mdata = { 0 };
 
+       /*
+        * Trigger lib/fwu_updates/fwu.c fwu_boottime_checks()
+        * to populate g_dev global pointer in that library.
+        */
+       event_notify_null(EVT_MAIN_LOOP);
+
        ut_assertok(uclass_first_device_err(UCLASS_FWU_MDATA, &dev));
        ut_assertok(setup_blk_device(uts));
        ut_assertok(populate_mmc_disk_image(uts));
@@ -112,6 +118,12 @@ static int dm_test_fwu_mdata_write(struct unit_test_state *uts)
        struct udevice *dev;
        struct fwu_mdata mdata = { 0 };
 
+       /*
+        * Trigger lib/fwu_updates/fwu.c fwu_boottime_checks()
+        * to populate g_dev global pointer in that library.
+        */
+       event_notify_null(EVT_MAIN_LOOP);
+
        ut_assertok(setup_blk_device(uts));
        ut_assertok(populate_mmc_disk_image(uts));
        ut_assertok(write_mmc_blk_device(uts));
index 355ba7770afa4c10b1195fbb56ba9ea4452a0b5f..85f21f9839e2afe540e010d7bde5d9a9063157ae 100644 (file)
@@ -8,6 +8,7 @@
 #include <blk.h>
 #include <dm.h>
 #include <fs.h>
+#include <os.h>
 #include <sandbox_host.h>
 #include <asm/test.h>
 #include <dm/device-internal.h>
@@ -15,9 +16,6 @@
 #include <test/test.h>
 #include <test/ut.h>
 
-static const char filename[] = "2MB.ext2.img";
-static const char filename2[] = "1MB.fat32.img";
-
 /* Basic test of host interface */
 static int dm_test_host(struct unit_test_state *uts)
 {
@@ -25,6 +23,7 @@ static int dm_test_host(struct unit_test_state *uts)
        struct udevice *dev, *part, *chk, *blk;
        struct host_sb_plat *plat;
        struct blk_desc *desc;
+       char fname[256];
        ulong mem_start;
        loff_t actwrite;
 
@@ -40,13 +39,15 @@ static int dm_test_host(struct unit_test_state *uts)
        ut_assert(label != plat->label);
        ut_asserteq(0, plat->fd);
 
-       /* Attach a file created in test_host.py */
-       ut_assertok(host_attach_file(dev, filename));
+       /* Attach a file created in test_ut_dm_init */
+       ut_assertok(os_persistent_file(fname, sizeof(fname), "2MB.ext2.img"));
+
+       ut_assertok(host_attach_file(dev, fname));
        ut_assertok(uclass_first_device_err(UCLASS_HOST, &chk));
        ut_asserteq_ptr(chk, dev);
 
-       ut_asserteq_str(filename, plat->filename);
-       ut_assert(filename != plat->filename);
+       ut_asserteq_str(fname, plat->filename);
+       ut_assert(fname != plat->filename);
        ut_assert(plat->fd != 0);
 
        /* Get the block device */
@@ -79,12 +80,14 @@ static int dm_test_host_dup(struct unit_test_state *uts)
 {
        static char label[] = "test";
        struct udevice *dev, *chk;
+       char fname[256];
 
        ut_asserteq(0, uclass_id_count(UCLASS_HOST));
        ut_assertok(host_create_device(label, true, &dev));
 
-       /* Attach a file created in test_host.py */
-       ut_assertok(host_attach_file(dev, filename));
+       /* Attach a file created in test_ut_dm_init */
+       ut_assertok(os_persistent_file(fname, sizeof(fname), "2MB.ext2.img"));
+       ut_assertok(host_attach_file(dev, fname));
        ut_assertok(uclass_first_device_err(UCLASS_HOST, &chk));
        ut_asserteq_ptr(chk, dev);
        ut_asserteq(1, uclass_id_count(UCLASS_HOST));
@@ -92,8 +95,10 @@ static int dm_test_host_dup(struct unit_test_state *uts)
        /* Create another device with the same label (should remove old one) */
        ut_assertok(host_create_device(label, true, &dev));
 
-       /* Attach a different file created in test_host.py */
-       ut_assertok(host_attach_file(dev, filename2));
+       /* Attach a different file created in test_ut_dm_init */
+       ut_assertok(os_persistent_file(fname, sizeof(fname), "1MB.fat32.img"));
+       ut_assertok(host_attach_file(dev, fname));
+
        ut_assertok(uclass_first_device_err(UCLASS_HOST, &chk));
        ut_asserteq_ptr(chk, dev);
 
@@ -109,6 +114,7 @@ static int dm_test_cmd_host(struct unit_test_state *uts)
 {
        struct udevice *dev, *blk;
        struct blk_desc *desc;
+       char fname[256];
 
        console_record_reset();
 
@@ -117,7 +123,8 @@ static int dm_test_cmd_host(struct unit_test_state *uts)
        ut_assert_nextline("dev       blocks label           path");
        ut_assert_console_end();
 
-       ut_assertok(run_commandf("host bind -r test2 %s", filename));
+       ut_assertok(os_persistent_file(fname, sizeof(fname), "2MB.ext2.img"));
+       ut_assertok(run_commandf("host bind -r test2 %s", fname));
 
        /* Check the -r flag worked */
        ut_assertok(uclass_first_device_err(UCLASS_HOST, &dev));
@@ -127,10 +134,11 @@ static int dm_test_cmd_host(struct unit_test_state *uts)
 
        ut_assertok(run_command("host info", 0));
        ut_assert_nextline("dev       blocks label           path");
-       ut_assert_nextline("  0         4096 test2           2MB.ext2.img");
+       ut_assert_nextlinen("  0         4096 test2");
        ut_assert_console_end();
 
-       ut_assertok(run_commandf("host bind fat %s", filename2));
+       ut_assertok(os_persistent_file(fname, sizeof(fname), "1MB.fat32.img"));
+       ut_assertok(run_commandf("host bind fat %s", fname));
 
        /* Check it is not removable (no '-r') */
        ut_assertok(uclass_next_device_err(&dev));
@@ -140,8 +148,8 @@ static int dm_test_cmd_host(struct unit_test_state *uts)
 
        ut_assertok(run_command("host info", 0));
        ut_assert_nextline("dev       blocks label           path");
-       ut_assert_nextline("  0         4096 test2           2MB.ext2.img");
-       ut_assert_nextline("  1         2048 fat             1MB.fat32.img");
+       ut_assert_nextlinen("  0         4096 test2");
+       ut_assert_nextlinen("  1         2048 fat");
        ut_assert_console_end();
 
        ut_asserteq(1, run_command("host info test", 0));
@@ -150,7 +158,7 @@ static int dm_test_cmd_host(struct unit_test_state *uts)
 
        ut_assertok(run_command("host info fat", 0));
        ut_assert_nextline("dev       blocks label           path");
-       ut_assert_nextline("  1         2048 fat             1MB.fat32.img");
+       ut_assert_nextlinen("  1         2048 fat");
        ut_assert_console_end();
 
        /* check 'host dev' */
@@ -187,7 +195,7 @@ static int dm_test_cmd_host(struct unit_test_state *uts)
 
        ut_assertok(run_command("host info", 0));
        ut_assert_nextline("dev       blocks label           path");
-       ut_assert_nextline("  1         2048 fat             1MB.fat32.img");
+       ut_assert_nextlinen("  1         2048 fat");
        ut_assert_console_end();
 
        return 0;
index 89bf481f61617d22a734758a6566fe3cc03c3e49..f0ad47d4efe9313e480154f1da5e34c06db40eb4 100644 (file)
@@ -103,6 +103,8 @@ static int dm_test_nvmxip(struct unit_test_state *uts)
        void *buffer = NULL;
        unsigned long flashsz;
 
+       sandbox_set_enable_memio(true);
+
        /* set the flash content first for both devices */
        dm_nvmxip_flash_sanity(uts, 0, NULL);
        dm_nvmxip_flash_sanity(uts, 1, NULL);
index 42ee4c1755268a7179b8e7e832a55807ee7c17da..42803b20e2a1e4c5293588afd12ec441ce61e72e 100644 (file)
@@ -155,6 +155,31 @@ static int lib_test_abuf_realloc_size(struct unit_test_state *uts)
 }
 LIB_TEST(lib_test_abuf_realloc_size, 0);
 
+/* Test abuf_realloc_inc() */
+static int lib_test_abuf_realloc_inc(struct unit_test_state *uts)
+{
+       struct abuf buf;
+       ulong start;
+
+       start = ut_check_free();
+
+       abuf_init(&buf);
+       ut_asserteq(0, buf.size);
+       ut_asserteq(false, buf.alloced);
+
+       abuf_realloc_inc(&buf, 20);
+       ut_asserteq(20, buf.size);
+       ut_asserteq(true, buf.alloced);
+
+       abuf_uninit(&buf);
+
+       /* Check for memory leaks */
+       ut_assertok(ut_check_delta(start));
+
+       return 0;
+}
+LIB_TEST(lib_test_abuf_realloc_inc, 0);
+
 /* Test handling of buffers that are too large */
 static int lib_test_abuf_large(struct unit_test_state *uts)
 {
index 8661fdd30687e0d4fb226a24f33e338abab5d279..a66cdd77df0ad80f3acf66fec1a76ccc2c138f82 100644 (file)
@@ -120,7 +120,7 @@ static int lib_asn1_x509(struct unit_test_state *uts)
 
        cert = x509_cert_parse(cert_data, cert_data_len);
 
-       ut_assertf(cert != NULL, "decoding failed\n");
+       ut_assertf(!IS_ERR(cert), "decoding failed\n");
        ut_assertf(!strcmp(cert->subject, "Linaro: Tester"),
                   "subject doesn't match\n");
        ut_assertf(!strcmp(cert->issuer, "Linaro: Tester"),
@@ -313,7 +313,7 @@ static int lib_asn1_pkcs7(struct unit_test_state *uts)
 
        pkcs7 = pkcs7_parse_message(image_pk7, image_pk7_len);
 
-       ut_assertf(pkcs7 != NULL, "decoding failed\n");
+       ut_assertf(!IS_ERR(pkcs7), "decoding failed\n");
        ut_assertf(pkcs7->data_len == 104, "signature size doesn't match\n");
        ut_assertf(pkcs7->signed_infos != NULL, "sign-info doesn't exist\n");
        ut_assertf(pkcs7->signed_infos->msgdigest_len == 32,
index a0ec037388bf9acfb976df0e16fc06726d36898a..d8453fe78e2c01c4ce192684f4a1e974a5cae221 100644 (file)
@@ -43,11 +43,11 @@ static int do_test_strlcat(struct unit_test_state *uts, int line, size_t align1,
                s2[i] = 32 + 23 * i % (127 - 32);
        s2[len2 - 1] = '\0';
 
-       expected = len2 < n ? min(len1 + len2 - 1, n) : n;
+       expected = min(strlen(s2), n) + strlen(s1);
        actual = strlcat(s2, s1, n);
        if (expected != actual) {
                ut_failf(uts, __FILE__, line, __func__,
-                        "strlcat(s2, s1, 2) == len2 < n ? min(len1 + len2, n) : n",
+                        "strlcat(s2, s1, n) == min(len2, n) + len1",
                         "Expected %#zx (%zd), got %#zx (%zd)",
                         expected, expected, actual, actual);
                return CMD_RET_FAILURE;
index 17151bcd08ec87fe249be44ccad1cc3241050b69..9882ddb1daa55f122fedc33bd59003ce22cb4a57 100644 (file)
@@ -9,7 +9,7 @@ import re
 import os
 from subprocess import call, check_call, check_output, CalledProcessError
 
-def mk_fs(config, fs_type, size, prefix, use_src_dir=False):
+def mk_fs(config, fs_type, size, prefix):
     """Create a file system volume
 
     Args:
@@ -17,14 +17,12 @@ def mk_fs(config, fs_type, size, prefix, use_src_dir=False):
         fs_type (str): File system type, e.g. 'ext4'
         size (int): Size of file system in bytes
         prefix (str): Prefix string of volume's file name
-        use_src_dir (bool): true to put the file in the source directory
 
     Raises:
         CalledProcessError: if any error occurs when creating the filesystem
     """
     fs_img = f'{prefix}.{fs_type}.img'
-    fs_img = os.path.join(config.source_dir if use_src_dir
-                          else config.persistent_data_dir, fs_img)
+    fs_img = os.path.join(config.persistent_data_dir, fs_img)
 
     if fs_type == 'fat16':
         mkfs_opt = '-F 16'
diff --git a/test/py/tests/test_efi_capsule/capsule_gen_binman.dts b/test/py/tests/test_efi_capsule/capsule_gen_binman.dts
new file mode 100644 (file)
index 0000000..e8a1858
--- /dev/null
@@ -0,0 +1,321 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Devicetree for capsule generation through binman
+ */
+
+/dts-v1/;
+
+#include <sandbox_efi_capsule.h>
+
+/ {
+       binman: binman {
+               multiple-images;
+       };
+};
+
+&binman {
+       itb {
+               filename = UBOOT_FIT_IMAGE;
+
+               fit {
+                       description = "Automatic U-Boot environment update";
+                       #address-cells = <2>;
+
+                       images {
+                               u-boot-bin {
+                                       description = "U-Boot binary on SPI Flash";
+                                       compression = "none";
+                                       type = "firmware";
+                                       arch = "sandbox";
+                                       load = <0>;
+                                       text {
+                                               text = "u-boot:New";
+                                       };
+
+                                       hash-1 {
+                                               algo = "sha1";
+                                       };
+                               };
+                               u-boot-env {
+                                       description = "U-Boot environment on SPI Flash";
+                                       compression = "none";
+                                       type = "firmware";
+                                       arch = "sandbox";
+                                       load = <0>;
+                                       text {
+                                               text = "u-boot-env:New";
+                                       };
+
+                                       hash-1 {
+                                               algo = "sha1";
+                                       };
+                               };
+                       };
+               };
+       };
+
+       capsule1 {
+               filename = "Test01";
+               efi-capsule {
+                       image-index = <0x1>;
+                       image-guid = SANDBOX_UBOOT_IMAGE_GUID;
+
+                       text {
+                               text = "u-boot:New";
+                       };
+               };
+       };
+
+       capsule2 {
+               filename = "Test02";
+               efi-capsule {
+                       image-index = <0x2>;
+                       image-guid = SANDBOX_UBOOT_ENV_IMAGE_GUID;
+
+                       text {
+                               text = "u-boot-env:New";
+                       };
+               };
+       };
+
+       capsule3 {
+               filename = "Test03";
+               efi-capsule {
+                       image-index = <0x1>;
+                       image-guid = SANDBOX_INCORRECT_GUID;
+
+                       text {
+                               text = "u-boot:New";
+                       };
+               };
+       };
+
+       capsule4 {
+               filename = "Test04";
+               efi-capsule {
+                       image-index = <0x1>;
+                       image-guid = SANDBOX_FIT_IMAGE_GUID;
+
+                       blob {
+                               filename = UBOOT_FIT_IMAGE;
+                       };
+               };
+       };
+
+       capsule5 {
+               filename = "Test05";
+               efi-capsule {
+                       image-index = <0x1>;
+                       image-guid = SANDBOX_INCORRECT_GUID;
+
+                       blob {
+                               filename = UBOOT_FIT_IMAGE;
+                       };
+               };
+       };
+
+       capsule6 {
+               filename = "Test101";
+               efi-capsule {
+                       image-index = <0x1>;
+                       fw-version = <0x5>;
+                       image-guid = SANDBOX_UBOOT_IMAGE_GUID;
+
+                       text {
+                               text = "u-boot:New";
+                       };
+               };
+       };
+
+       capsule7 {
+               filename = "Test102";
+               efi-capsule {
+                       image-index = <0x2>;
+                       fw-version = <0xa>;
+                       image-guid = SANDBOX_UBOOT_ENV_IMAGE_GUID;
+
+                       text {
+                               text = "u-boot-env:New";
+                       };
+               };
+       };
+
+       capsule8 {
+               filename = "Test103";
+               efi-capsule {
+                       image-index = <0x1>;
+                       fw-version = <0x2>;
+                       image-guid = SANDBOX_UBOOT_IMAGE_GUID;
+
+                       text {
+                               text = "u-boot:New";
+                       };
+               };
+       };
+
+       capsule9 {
+               filename = "Test104";
+               efi-capsule {
+                       image-index = <0x1>;
+                       fw-version = <0x5>;
+                       image-guid = SANDBOX_FIT_IMAGE_GUID;
+
+                       blob {
+                               filename = UBOOT_FIT_IMAGE;
+                       };
+               };
+       };
+
+       capsule10 {
+               filename = "Test105";
+               efi-capsule {
+                       image-index = <0x1>;
+                       fw-version = <0x2>;
+                       image-guid = SANDBOX_FIT_IMAGE_GUID;
+
+                       blob {
+                               filename = UBOOT_FIT_IMAGE;
+                       };
+               };
+       };
+
+       capsule11 {
+               filename = "Test11";
+               efi-capsule {
+                       image-index = <0x1>;
+                       image-guid = SANDBOX_UBOOT_IMAGE_GUID;
+                       private-key = CAPSULE_PRIV_KEY;
+                       public-key-cert = CAPSULE_PUB_KEY;
+                       monotonic-count = <0x1>;
+
+                       text {
+                               text = "u-boot:New";
+                       };
+               };
+       };
+
+       capsule12 {
+               filename = "Test12";
+               efi-capsule {
+                       image-index = <0x1>;
+                       image-guid = SANDBOX_UBOOT_IMAGE_GUID;
+                       private-key = CAPSULE_INVAL_KEY;
+                       public-key-cert = CAPSULE_INVAL_PUB_KEY;
+                       monotonic-count = <0x1>;
+
+                       text {
+                               text = "u-boot:New";
+                       };
+               };
+       };
+
+       capsule13 {
+               filename = "Test13";
+               efi-capsule {
+                       image-index = <0x1>;
+                       image-guid = SANDBOX_FIT_IMAGE_GUID;
+                       private-key = CAPSULE_PRIV_KEY;
+                       public-key-cert = CAPSULE_PUB_KEY;
+                       monotonic-count = <0x1>;
+
+                       blob {
+                               filename = UBOOT_FIT_IMAGE;
+                       };
+               };
+       };
+
+       capsule14 {
+               filename = "Test14";
+               efi-capsule {
+                       image-index = <0x1>;
+                       image-guid = SANDBOX_FIT_IMAGE_GUID;
+                       private-key = CAPSULE_INVAL_KEY;
+                       public-key-cert = CAPSULE_INVAL_PUB_KEY;
+                       monotonic-count = <0x1>;
+
+                       blob {
+                               filename = UBOOT_FIT_IMAGE;
+                       };
+               };
+       };
+
+       capsule15 {
+               filename = "Test111";
+               efi-capsule {
+                       image-index = <0x1>;
+                       fw-version = <0x5>;
+                       image-guid = SANDBOX_UBOOT_IMAGE_GUID;
+                       private-key = CAPSULE_PRIV_KEY;
+                       public-key-cert = CAPSULE_PUB_KEY;
+                       monotonic-count = <0x1>;
+
+                       text {
+                               text = "u-boot:New";
+                       };
+               };
+       };
+
+       capsule16 {
+               filename = "Test112";
+               efi-capsule {
+                       image-index = <0x2>;
+                       fw-version = <0xa>;
+                       image-guid = SANDBOX_UBOOT_ENV_IMAGE_GUID;
+                       private-key = CAPSULE_PRIV_KEY;
+                       public-key-cert = CAPSULE_PUB_KEY;
+                       monotonic-count = <0x1>;
+
+                       text {
+                               text = "u-boot-env:New";
+                       };
+               };
+       };
+
+       capsule17 {
+               filename = "Test113";
+               efi-capsule {
+                       image-index = <0x1>;
+                       fw-version = <0x2>;
+                       image-guid = SANDBOX_UBOOT_IMAGE_GUID;
+                       private-key = CAPSULE_PRIV_KEY;
+                       public-key-cert = CAPSULE_PUB_KEY;
+                       monotonic-count = <0x1>;
+
+                       text {
+                               text = "u-boot:New";
+                       };
+               };
+       };
+
+       capsule18 {
+               filename = "Test114";
+               efi-capsule {
+                       image-index = <0x1>;
+                       fw-version = <0x5>;
+                       image-guid = SANDBOX_FIT_IMAGE_GUID;
+                       private-key = CAPSULE_PRIV_KEY;
+                       public-key-cert = CAPSULE_PUB_KEY;
+                       monotonic-count = <0x1>;
+
+                       blob {
+                               filename = UBOOT_FIT_IMAGE;
+                       };
+               };
+       };
+
+       capsule19 {
+               filename = "Test115";
+               efi-capsule {
+                       image-index = <0x1>;
+                       fw-version = <0x2>;
+                       image-guid = SANDBOX_FIT_IMAGE_GUID;
+                       private-key = CAPSULE_PRIV_KEY;
+                       public-key-cert = CAPSULE_PUB_KEY;
+                       monotonic-count = <0x1>;
+
+                       blob {
+                               filename = UBOOT_FIT_IMAGE;
+                       };
+               };
+       };
+};
index 054be1ee971be3b39dbda2b1b5d8aac2d72bcec6..dd41da9284e89a67384b0d3963815c102525215a 100644 (file)
@@ -4,6 +4,8 @@
 
 """Fixture for UEFI capsule test."""
 
+import os
+
 from subprocess import call, check_call, CalledProcessError
 import pytest
 from capsule_defs import CAPSULE_DATA_DIR, CAPSULE_INSTALL_DIR, EFITOOLS_PATH
@@ -34,39 +36,30 @@ def efi_capsule_data(request, u_boot_config):
 
         capsule_auth_enabled = u_boot_config.buildconfig.get(
                     'config_efi_capsule_authenticate')
+        key_dir = u_boot_config.source_dir + '/board/sandbox'
         if capsule_auth_enabled:
-            # Create private key (SIGNER.key) and certificate (SIGNER.crt)
-            check_call('cd %s; '
-                       'openssl req -x509 -sha256 -newkey rsa:2048 '
-                            '-subj /CN=TEST_SIGNER/ -keyout SIGNER.key '
-                            '-out SIGNER.crt -nodes -days 365'
-                       % data_dir, shell=True)
-            check_call('cd %s; %scert-to-efi-sig-list SIGNER.crt SIGNER.esl'
-                       % (data_dir, EFITOOLS_PATH), shell=True)
-
-            # Update dtb adding capsule certificate
-            check_call('cd %s; '
-                       'cp %s/test/py/tests/test_efi_capsule/signature.dts .'
-                       % (data_dir, u_boot_config.source_dir), shell=True)
-            check_call('cd %s; '
-                       'dtc -@ -I dts -O dtb -o signature.dtbo signature.dts; '
-                       'fdtoverlay -i %s/arch/sandbox/dts/test.dtb '
-                            '-o test_sig.dtb signature.dtbo'
-                       % (data_dir, u_boot_config.build_dir), shell=True)
+            # Get the keys from the board directory
+            check_call('cp %s/capsule_priv_key_good.key %s/SIGNER.key'
+                       % (key_dir, data_dir), shell=True)
+            check_call('cp %s/capsule_pub_key_good.crt %s/SIGNER.crt'
+                       % (key_dir, data_dir), shell=True)
+            check_call('cp %s/capsule_pub_esl_good.esl %s/SIGNER.esl'
+                       % (key_dir, data_dir), shell=True)
 
-            # Create *malicious* private key (SIGNER2.key) and certificate
-            # (SIGNER2.crt)
-            check_call('cd %s; '
-                       'openssl req -x509 -sha256 -newkey rsa:2048 '
-                            '-subj /CN=TEST_SIGNER/ -keyout SIGNER2.key '
-                            '-out SIGNER2.crt -nodes -days 365'
-                       % data_dir, shell=True)
+            check_call('cp %s/capsule_priv_key_bad.key %s/SIGNER2.key'
+                       % (key_dir, data_dir), shell=True)
+            check_call('cp %s/capsule_pub_key_bad.crt %s/SIGNER2.crt'
+                       % (key_dir, data_dir), shell=True)
 
         # Update dtb to add the version information
         check_call('cd %s; '
                    'cp %s/test/py/tests/test_efi_capsule/version.dts .'
                    % (data_dir, u_boot_config.source_dir), shell=True)
+
         if capsule_auth_enabled:
+            check_call('cd %s; '
+                       'cp %s/arch/sandbox/dts/test.dtb test_sig.dtb'
+                       % (data_dir, u_boot_config.build_dir), shell=True)
             check_call('cd %s; '
                        'dtc -@ -I dts -O dtb -o version.dtbo version.dts; '
                        'fdtoverlay -i test_sig.dtb '
@@ -79,132 +72,20 @@ def efi_capsule_data(request, u_boot_config):
                             '-o test_ver.dtb version.dtbo'
                        % (data_dir, u_boot_config.build_dir), shell=True)
 
-        # Create capsule files
         # two regions: one for u-boot.bin and the other for u-boot.env
         check_call('cd %s; echo -n u-boot:Old > u-boot.bin.old; echo -n u-boot:New > u-boot.bin.new; echo -n u-boot-env:Old > u-boot.env.old; echo -n u-boot-env:New > u-boot.env.new' % data_dir,
                    shell=True)
-        check_call('sed -e \"s?BINFILE1?u-boot.bin.new?\" -e \"s?BINFILE2?u-boot.env.new?\" %s/test/py/tests/test_efi_capsule/uboot_bin_env.its > %s/uboot_bin_env.its' %
-                   (u_boot_config.source_dir, data_dir),
-                   shell=True)
-        check_call('cd %s; %s/tools/mkimage -f uboot_bin_env.its uboot_bin_env.itb' %
-                   (data_dir, u_boot_config.build_dir),
-                   shell=True)
-        check_call('cd %s; %s/tools/mkeficapsule --index 1 --guid 09D7CF52-0720-4710-91D1-08469B7FE9C8 u-boot.bin.new Test01' %
-                   (data_dir, u_boot_config.build_dir),
-                   shell=True)
-        check_call('cd %s; %s/tools/mkeficapsule --index 2 --guid 5A7021F5-FEF2-48B4-AABA-832E777418C0 u-boot.env.new Test02' %
-                   (data_dir, u_boot_config.build_dir),
-                   shell=True)
-        check_call('cd %s; %s/tools/mkeficapsule --index 1 --guid 058B7D83-50D5-4C47-A195-60D86AD341C4 u-boot.bin.new Test03' %
-                   (data_dir, u_boot_config.build_dir),
-                   shell=True)
-        check_call('cd %s; %s/tools/mkeficapsule --index 1 --guid 3673B45D-6A7C-46F3-9E60-ADABB03F7937 uboot_bin_env.itb Test04' %
-                   (data_dir, u_boot_config.build_dir),
-                   shell=True)
-        check_call('cd %s; %s/tools/mkeficapsule --index 1 --guid  058B7D83-50D5-4C47-A195-60D86AD341C4 uboot_bin_env.itb Test05' %
-                   (data_dir, u_boot_config.build_dir),
-                   shell=True)
-        check_call('cd %s; %s/tools/mkeficapsule --index 1 --fw-version 5 '
-                        '--guid 09D7CF52-0720-4710-91D1-08469B7FE9C8 u-boot.bin.new Test101' %
-                   (data_dir, u_boot_config.build_dir),
-                   shell=True)
-        check_call('cd %s; %s/tools/mkeficapsule --index 2 --fw-version 10 '
-                        '--guid 5A7021F5-FEF2-48B4-AABA-832E777418C0 u-boot.env.new Test102' %
-                   (data_dir, u_boot_config.build_dir),
-                   shell=True)
-        check_call('cd %s; %s/tools/mkeficapsule --index 1 --fw-version 2 '
-                        '--guid 09D7CF52-0720-4710-91D1-08469B7FE9C8 u-boot.bin.new Test103' %
-                   (data_dir, u_boot_config.build_dir),
-                   shell=True)
-        check_call('cd %s; %s/tools/mkeficapsule --index 1 --fw-version 5 '
-                        '--guid 3673B45D-6A7C-46F3-9E60-ADABB03F7937 uboot_bin_env.itb Test104' %
-                   (data_dir, u_boot_config.build_dir),
-                   shell=True)
-        check_call('cd %s; %s/tools/mkeficapsule --index 1 --fw-version 2 '
-                        '--guid 3673B45D-6A7C-46F3-9E60-ADABB03F7937 uboot_bin_env.itb Test105' %
-                   (data_dir, u_boot_config.build_dir),
-                   shell=True)
 
-        if capsule_auth_enabled:
-            # raw firmware signed with proper key
-            check_call('cd %s; '
-                       '%s/tools/mkeficapsule --index 1 --monotonic-count 1 '
-                            '--private-key SIGNER.key --certificate SIGNER.crt '
-                            '--guid 09D7CF52-0720-4710-91D1-08469B7FE9C8 '
-                            'u-boot.bin.new Test11'
-                       % (data_dir, u_boot_config.build_dir),
-                       shell=True)
-            # raw firmware signed with *mal* key
-            check_call('cd %s; '
-                       '%s/tools/mkeficapsule --index 1 --monotonic-count 1 '
-                            '--private-key SIGNER2.key '
-                            '--certificate SIGNER2.crt '
-                            '--guid 09D7CF52-0720-4710-91D1-08469B7FE9C8 '
-                            'u-boot.bin.new Test12'
-                       % (data_dir, u_boot_config.build_dir),
-                       shell=True)
-            # FIT firmware signed with proper key
-            check_call('cd %s; '
-                       '%s/tools/mkeficapsule --index 1 --monotonic-count 1 '
-                            '--private-key SIGNER.key --certificate SIGNER.crt '
-                            '--guid 3673B45D-6A7C-46F3-9E60-ADABB03F7937 '
-                            'uboot_bin_env.itb Test13'
-                       % (data_dir, u_boot_config.build_dir),
-                       shell=True)
-            # FIT firmware signed with *mal* key
-            check_call('cd %s; '
-                       '%s/tools/mkeficapsule --index 1 --monotonic-count 1 '
-                            '--private-key SIGNER2.key '
-                            '--certificate SIGNER2.crt '
-                            '--guid 3673B45D-6A7C-46F3-9E60-ADABB03F7937 '
-                            'uboot_bin_env.itb Test14'
-                       % (data_dir, u_boot_config.build_dir),
-                       shell=True)
-            # raw firmware signed with proper key with version information
-            check_call('cd %s; '
-                       '%s/tools/mkeficapsule --index 1 --monotonic-count 1 '
-                            '--fw-version 5 '
-                            '--private-key SIGNER.key --certificate SIGNER.crt '
-                            '--guid 09D7CF52-0720-4710-91D1-08469B7FE9C8 '
-                            'u-boot.bin.new Test111'
-                       % (data_dir, u_boot_config.build_dir),
-                       shell=True)
-            # raw firmware signed with proper key with version information
-            check_call('cd %s; '
-                       '%s/tools/mkeficapsule --index 2 --monotonic-count 1 '
-                            '--fw-version 10 '
-                            '--private-key SIGNER.key --certificate SIGNER.crt '
-                            '--guid 5A7021F5-FEF2-48B4-AABA-832E777418C0 '
-                            'u-boot.env.new Test112'
-                       % (data_dir, u_boot_config.build_dir),
-                       shell=True)
-            # raw firmware signed with proper key with lower version information
-            check_call('cd %s; '
-                       '%s/tools/mkeficapsule --index 1 --monotonic-count 1 '
-                            '--fw-version 2 '
-                            '--private-key SIGNER.key --certificate SIGNER.crt '
-                            '--guid 09D7CF52-0720-4710-91D1-08469B7FE9C8 '
-                            'u-boot.bin.new Test113'
-                       % (data_dir, u_boot_config.build_dir),
-                       shell=True)
-            # FIT firmware signed with proper key with version information
-            check_call('cd %s; '
-                       '%s/tools/mkeficapsule --index 1 --monotonic-count 1 '
-                            '--fw-version 5 '
-                            '--private-key SIGNER.key --certificate SIGNER.crt '
-                            '--guid 3673B45D-6A7C-46F3-9E60-ADABB03F7937 '
-                            'uboot_bin_env.itb Test114'
-                       % (data_dir, u_boot_config.build_dir),
-                       shell=True)
-            # FIT firmware signed with proper key with lower version information
-            check_call('cd %s; '
-                       '%s/tools/mkeficapsule --index 1 --monotonic-count 1 '
-                            '--fw-version 2 '
-                            '--private-key SIGNER.key --certificate SIGNER.crt '
-                            '--guid 3673B45D-6A7C-46F3-9E60-ADABB03F7937 '
-                            'uboot_bin_env.itb Test115'
-                       % (data_dir, u_boot_config.build_dir),
-                       shell=True)
+        pythonpath = os.environ.get('PYTHONPATH', '')
+        os.environ['PYTHONPATH'] = pythonpath + ':' + '%s/scripts/dtc/pylibfdt' % u_boot_config.build_dir
+        check_call('cd %s; '
+                   'cc -E -I %s/include -x assembler-with-cpp -o capsule_gen_tmp.dts %s/test/py/tests/test_efi_capsule/capsule_gen_binman.dts; '
+                   'dtc -I dts -O dtb capsule_gen_tmp.dts -o capsule_binman.dtb;'
+                   % (data_dir, u_boot_config.source_dir, u_boot_config.source_dir), shell=True)
+        check_call('cd %s; '
+                   './tools/binman/binman --toolpath %s/tools build -u -d %s/capsule_binman.dtb -O %s -m --allow-missing -I %s -I ./board/sandbox -I ./arch/sandbox/dts'
+                   % (u_boot_config.source_dir, u_boot_config.build_dir, data_dir, data_dir, data_dir), shell=True)
+        os.environ['PYTHONPATH'] = pythonpath
 
         # Create a disk image with EFI system partition
         check_call('virt-make-fs --partition=gpt --size=+1M --type=vfat %s %s' %
diff --git a/test/py/tests/test_efi_capsule/signature.dts b/test/py/tests/test_efi_capsule/signature.dts
deleted file mode 100644 (file)
index 078cfc7..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-
-/dts-v1/;
-/plugin/;
-
-&{/} {
-       signature {
-               capsule-key = /incbin/("SIGNER.esl");
-       };
-};
diff --git a/test/py/tests/test_efi_capsule/uboot_bin_env.its b/test/py/tests/test_efi_capsule/uboot_bin_env.its
deleted file mode 100644 (file)
index fc65907..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Automatic software update for U-Boot
- * Make sure the flashing addresses ('load' prop) is correct for your board!
- */
-
-/dts-v1/;
-
-/ {
-       description = "Automatic U-Boot environment update";
-       #address-cells = <2>;
-
-       images {
-               u-boot-bin {
-                       description = "U-Boot binary on SPI Flash";
-                       data = /incbin/("BINFILE1");
-                       compression = "none";
-                       type = "firmware";
-                       arch = "sandbox";
-                       load = <0>;
-                       hash-1 {
-                               algo = "sha1";
-                       };
-               };
-               u-boot-env {
-                       description = "U-Boot environment on SPI Flash";
-                       data = /incbin/("BINFILE2");
-                       compression = "none";
-                       type = "firmware";
-                       arch = "sandbox";
-                       load = <0>;
-                       hash-1 {
-                               algo = "sha1";
-                       };
-               };
-       };
-};
index da196df4c3e6606e7b420c3f994ef93a5b5ad795..a6df9e10e54e1aa1001e37c1609f5359b6e67627 100644 (file)
@@ -18,5 +18,6 @@ def test_event_dump(u_boot_console):
 --------------------  ------------------------------  ------------------------------
 EVT_FT_FIXUP          bootmeth_vbe_ft_fixup           .*boot/vbe_request.c:.*
 EVT_FT_FIXUP          bootmeth_vbe_simple_ft_fixup    .*boot/vbe_simple_os.c:.*
-EVT_MISC_INIT_F       sandbox_misc_init_f             .*arch/sandbox/cpu/start.c:'''
+EVT_MISC_INIT_F       sandbox_early_getopt_check      .*arch/sandbox/cpu/start.c:.*
+EVT_TEST              h_adder_simple                  .*test/common/event.c:'''
     assert re.match(expect, out, re.MULTILINE) is not None
diff --git a/test/py/tests/test_semihosting/conftest.py b/test/py/tests/test_semihosting/conftest.py
new file mode 100644 (file)
index 0000000..b00d8f4
--- /dev/null
@@ -0,0 +1,23 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+"""Fixture for semihosting command test
+"""
+
+import os
+import pytest
+
+@pytest.fixture(scope='session')
+def semihosting_data(u_boot_config):
+    """Set up a file system to be used in semihosting tests
+
+    Args:
+        u_boot_config -- U-Boot configuration.
+    """
+    image_path = u_boot_config.persistent_data_dir + '/semihosting.txt'
+
+    with open(image_path, 'w', encoding = 'utf-8') as file:
+        file.write('Das U-Boot\n')
+
+    yield image_path
+
+    os.remove(image_path)
diff --git a/test/py/tests/test_semihosting/test_hostfs.py b/test/py/tests/test_semihosting/test_hostfs.py
new file mode 100644 (file)
index 0000000..51f6fa7
--- /dev/null
@@ -0,0 +1,33 @@
+# SPDX-License-Identifier:      GPL-2.0+
+
+""" Unit test for semihosting
+"""
+
+import pytest
+
+@pytest.mark.buildconfigspec('semihosting')
+def test_semihosting_hostfs(u_boot_console, semihosting_data):
+    """ Unit test for semihosting
+
+    Args:
+        u_boot_console -- U-Boot console
+        semihosting_data -- Path to the disk image used for testing.
+    """
+    response = u_boot_console.run_command(
+        f'load hostfs - $loadaddr {semihosting_data}')
+    assert '11 bytes read' in response
+
+    response = u_boot_console.run_command(
+        'crc32 $loadaddr $filesize')
+    assert '==> 60cfccfc' in response
+
+    u_boot_console.run_command(
+        f'save hostfs - $loadaddr {semihosting_data} 11 11')
+
+    response = u_boot_console.run_command(
+        f'load hostfs - $loadaddr {semihosting_data} 4 13')
+    assert '4 bytes read' in response
+
+    response = u_boot_console.run_command(
+        'crc32 $loadaddr $filesize')
+    assert '==> e29063ea' in response
index ac3e95925e95fc2d4282958c183e2b1d3d6feee4..28a6e72f525f580a8bd775e9a6157fbbd3ffe0a2 100644 (file)
@@ -61,7 +61,7 @@ def collect_trace(cons):
 
     # Read out the trace data
     addr = 0x02000000
-    size = 0x01000000
+    size = 0x02000000
     out = cons.run_command(f'trace calls {addr:x} {size:x}')
     print(out)
     fname = os.path.join(TMPDIR, 'trace')
@@ -175,7 +175,7 @@ def check_funcgraph(cons, fname, proftool, map_fname, trace_dat):
     # Then look for this:
     #  u-boot-1     [000]   282.101375: funcgraph_exit:         0.006 us   |      }
     # Then check for this:
-    #  u-boot-1     [000]   282.101375: funcgraph_entry:        0.000 us   |    event_init();
+    #  u-boot-1     [000]   282.101375: funcgraph_entry:        0.000 us   |    initcall_is_event();
 
     expected_indent = None
     found_start = False
@@ -197,8 +197,9 @@ def check_funcgraph(cons, fname, proftool, map_fname, trace_dat):
             elif found_start and indent == expected_indent and brace == '}':
                 found_end = True
 
-    # The next function after initf_bootstage() exits should be event_init()
-    assert upto == 'event_init()'
+    # The next function after initf_bootstage() exits should be
+    # initcall_is_event()
+    assert upto == 'initcall_is_event()'
 
     # Now look for initf_dm() and dm_timer_init() so we can check the bootstage
     # time
@@ -247,7 +248,7 @@ def check_flamegraph(cons, fname, proftool, map_fname, trace_fg):
     # We expect dm_timer_init() to be called twice: once before relocation and
     # once after
     look1 = 'initf_dm;dm_timer_init 1'
-    look2 = 'board_init_r;initr_dm_devices;dm_timer_init 1'
+    look2 = 'board_init_r;initcall_run_list;initr_dm_devices;dm_timer_init 1'
     found = 0
     with open(trace_fg, 'r') as fd:
         for line in fd:
@@ -272,7 +273,7 @@ def check_flamegraph(cons, fname, proftool, map_fname, trace_fg):
                 total += count
     return total
 
-
+check_flamegraph
 @pytest.mark.slow
 @pytest.mark.boardspec('sandbox')
 @pytest.mark.buildconfigspec('trace')
index aa1d477cd5653e0c5511668b2c35c83f32e1dc3e..82932a662bf8d7cbbe1751bfbbcc4a43cfe6b1d8 100644 (file)
@@ -1,6 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 # Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
 
+import collections
 import getpass
 import gzip
 import os
@@ -282,13 +283,155 @@ label Fedora-Workstation-armhfp-31-1.9 (5.3.7-301.fc31.armv7hl)
         copy_prepared_image(cons, mmc_dev, fname)
 
 
+def setup_cros_image(cons):
+    """Create a 20MB disk image with ChromiumOS partitions"""
+    Partition = collections.namedtuple('part', 'start,size,name')
+    parts = {}
+    disk_data = None
+
+    def pack_kernel(cons, arch, kern, dummy):
+        """Pack a kernel containing some fake data
+
+        Args:
+            cons (ConsoleBase): Console to use
+            arch (str): Architecture to use ('x86' or 'arm')
+            kern (str): Filename containing kernel
+            dummy (str): Dummy filename to use for config and bootloader
+
+        Return:
+            bytes: Packed-kernel data
+        """
+        kern_part = os.path.join(cons.config.result_dir, 'kern-part-{arch}.bin')
+        u_boot_utils.run_and_log(
+            cons,
+            f'futility vbutil_kernel --pack {kern_part} '
+            '--keyblock doc/chromium/files/devkeys/kernel.keyblock '
+            '--signprivate doc/chromium/files/devkeys/kernel_data_key.vbprivk '
+            f'--version 1  --config {dummy} --bootloader {dummy} '
+            f'--vmlinuz {kern}')
+
+        with open(kern_part, 'rb') as inf:
+            kern_part_data = inf.read()
+        return kern_part_data
+
+    def set_part_data(partnum, data):
+        """Set the contents of a disk partition
+
+        This updates disk_data by putting data in the right place
+
+        Args:
+            partnum (int): Partition number to set
+            data (bytes): Data for that partition
+        """
+        nonlocal disk_data
+
+        start = parts[partnum].start * sect_size
+        disk_data = disk_data[:start] + data + disk_data[start + len(data):]
+
+    mmc_dev = 5
+    fname = os.path.join(cons.config.source_dir, f'mmc{mmc_dev}.img')
+    u_boot_utils.run_and_log(cons, 'qemu-img create %s 20M' % fname)
+    #mnt = os.path.join(cons.config.persistent_data_dir, 'mnt')
+    #mkdir_cond(mnt)
+    u_boot_utils.run_and_log(cons, f'cgpt create {fname}')
+
+    uuid_state = 'ebd0a0a2-b9e5-4433-87c0-68b6b72699c7'
+    uuid_kern = 'fe3a2a5d-4f32-41a7-b725-accc3285a309'
+    uuid_root = '3cb8e202-3b7e-47dd-8a3c-7ff2a13cfcec'
+    uuid_rwfw = 'cab6e88e-abf3-4102-a07a-d4bb9be3c1d3'
+    uuid_reserved = '2e0a753d-9e48-43b0-8337-b15192cb1b5e'
+    uuid_efi = 'c12a7328-f81f-11d2-ba4b-00a0c93ec93b'
+
+    ptr = 40
+
+    # Number of sectors in 1MB
+    sect_size = 512
+    sect_1mb = (1 << 20) // sect_size
+
+    required_parts = [
+        {'num': 0xb, 'label':'RWFW', 'type': uuid_rwfw, 'size': '1'},
+        {'num': 6, 'label':'KERN_C', 'type': uuid_kern, 'size': '1'},
+        {'num': 7, 'label':'ROOT_C', 'type': uuid_root, 'size': '1'},
+        {'num': 9, 'label':'reserved', 'type': uuid_reserved, 'size': '1'},
+        {'num': 0xa, 'label':'reserved', 'type': uuid_reserved, 'size': '1'},
+
+        {'num': 2, 'label':'KERN_A', 'type': uuid_kern, 'size': '1M'},
+        {'num': 4, 'label':'KERN_B', 'type': uuid_kern, 'size': '1M'},
+
+        {'num': 8, 'label':'OEM', 'type': uuid_state, 'size': '1M'},
+        {'num': 0xc, 'label':'EFI-SYSTEM', 'type': uuid_efi, 'size': '1M'},
+
+        {'num': 5, 'label':'ROOT_B', 'type': uuid_root, 'size': '1'},
+        {'num': 3, 'label':'ROOT_A', 'type': uuid_root, 'size': '1'},
+        {'num': 1, 'label':'STATE', 'type': uuid_state, 'size': '1M'},
+        ]
+
+    for part in required_parts:
+        size_str = part['size']
+        if 'M' in size_str:
+            size = int(size_str[:-1]) * sect_1mb
+        else:
+            size = int(size_str)
+        u_boot_utils.run_and_log(
+            cons,
+            f"cgpt add -i {part['num']} -b {ptr} -s {size} -t {part['type']} {fname}")
+        ptr += size
+
+    u_boot_utils.run_and_log(cons, f'cgpt boot -p {fname}')
+    out = u_boot_utils.run_and_log(cons, f'cgpt show -q {fname}')
+    '''We expect something like this:
+        8239        2048       1  Basic data
+          45        2048       2  ChromeOS kernel
+        8238           1       3  ChromeOS rootfs
+        2093        2048       4  ChromeOS kernel
+        8237           1       5  ChromeOS rootfs
+          41           1       6  ChromeOS kernel
+          42           1       7  ChromeOS rootfs
+        4141        2048       8  Basic data
+          43           1       9  ChromeOS reserved
+          44           1      10  ChromeOS reserved
+          40           1      11  ChromeOS firmware
+        6189        2048      12  EFI System Partition
+    '''
+
+    # Create a dict (indexed by partition number) containing the above info
+    for line in out.splitlines():
+        start, size, num, name = line.split(maxsplit=3)
+        parts[int(num)] = Partition(int(start), int(size), name)
+
+    dummy = os.path.join(cons.config.result_dir, 'dummy.txt')
+    with open(dummy, 'wb') as outf:
+        outf.write(b'dummy\n')
+
+    # For now we just use dummy kernels. This limits testing to just detecting
+    # a signed kernel. We could add support for the x86 data structures so that
+    # testing could cover getting the cmdline, setup.bin and other pieces.
+    kern = os.path.join(cons.config.result_dir, 'kern.bin')
+    with open(kern, 'wb') as outf:
+        outf.write(b'kernel\n')
+
+    with open(fname, 'rb') as inf:
+        disk_data = inf.read()
+
+    # put x86 kernel in partition 2 and arm one in partition 4
+    set_part_data(2, pack_kernel(cons, 'x86', kern, dummy))
+    set_part_data(4, pack_kernel(cons, 'arm', kern, dummy))
+
+    with open(fname, 'wb') as outf:
+        outf.write(disk_data)
+
+    return fname
+
+
 def setup_cedit_file(cons):
     infname = os.path.join(cons.config.source_dir,
                            'test/boot/files/expo_layout.dts')
+    inhname = os.path.join(cons.config.source_dir,
+                           'test/boot/files/expo_ids.h')
     expo_tool = os.path.join(cons.config.source_dir, 'tools/expo.py')
     outfname = 'cedit.dtb'
     u_boot_utils.run_and_log(
-        cons, f'{expo_tool} -e {infname} -l {infname} -o {outfname}')
+        cons, f'{expo_tool} -e {inhname} -l {infname} -o {outfname}')
 
 
 @pytest.mark.buildconfigspec('ut_dm')
@@ -317,10 +460,8 @@ def test_ut_dm_init(u_boot_console):
         u_boot_utils.run_and_log(
             u_boot_console, f'sfdisk {fn}', stdin=b'type=83')
 
-    fs_helper.mk_fs(u_boot_console.config, 'ext2', 0x200000, '2MB',
-                    use_src_dir=True)
-    fs_helper.mk_fs(u_boot_console.config, 'fat32', 0x100000, '1MB',
-                    use_src_dir=True)
+    fs_helper.mk_fs(u_boot_console.config, 'ext2', 0x200000, '2MB')
+    fs_helper.mk_fs(u_boot_console.config, 'fat32', 0x100000, '1MB')
 
 @pytest.mark.buildconfigspec('cmd_bootflow')
 def test_ut_dm_init_bootstd(u_boot_console):
@@ -329,6 +470,7 @@ def test_ut_dm_init_bootstd(u_boot_console):
     setup_bootflow_image(u_boot_console)
     setup_bootmenu_image(u_boot_console)
     setup_cedit_file(u_boot_console)
+    setup_cros_image(u_boot_console)
 
     # Restart so that the new mmc1.img is picked up
     u_boot_console.restart_uboot()
index b27d7116b9eed5952b1d7457821951455c53c922..1d0d90c2d734ccb4b681d548eaf8e0623627d7a4 100644 (file)
@@ -807,28 +807,28 @@ static int unicode_test_u16_strlcat(struct unit_test_state *uts)
 
        /* dest and src are empty string */
        memset(buf, 0, sizeof(buf));
-       ret = u16_strlcat(buf, &null_src, sizeof(buf));
-       ut_asserteq(1, ret);
+       ret = u16_strlcat(buf, &null_src, ARRAY_SIZE(buf));
+       ut_asserteq(0, ret);
 
        /* dest is empty string */
        memset(buf, 0, sizeof(buf));
-       ret = u16_strlcat(buf, src, sizeof(buf));
-       ut_asserteq(5, ret);
+       ret = u16_strlcat(buf, src, ARRAY_SIZE(buf));
+       ut_asserteq(4, ret);
        ut_assert(!unicode_test_u16_strcmp(buf, src, 40));
 
        /* src is empty string */
        memset(buf, 0xCD, (sizeof(buf) - sizeof(u16)));
        buf[39] = 0;
        memcpy(buf, dest, sizeof(dest));
-       ret = u16_strlcat(buf, &null_src, sizeof(buf));
-       ut_asserteq(6, ret);
+       ret = u16_strlcat(buf, &null_src, ARRAY_SIZE(buf));
+       ut_asserteq(5, ret);
        ut_assert(!unicode_test_u16_strcmp(buf, dest, 40));
 
        for (i = 0; i <= 40; i++) {
                memset(buf, 0xCD, (sizeof(buf) - sizeof(u16)));
                buf[39] = 0;
                memcpy(buf, dest, sizeof(dest));
-               expected = 10;
+               expected = min(5, i) + 4;
                ret = u16_strlcat(buf, src, i);
                ut_asserteq(expected, ret);
                if (i <= 6) {
index 0b0f56dbbba095da507ec66df7fd11c9ddad1682..3c4ad1adbb9e1400f7215e1d07e5a91bb2c379c4 100644 (file)
@@ -328,7 +328,7 @@ class Bintool:
             return result.stdout
 
     @classmethod
-    def build_from_git(cls, git_repo, make_target, bintool_path, flags=None):
+    def build_from_git(cls, git_repo, make_targets, bintool_path, flags=None):
         """Build a bintool from a git repo
 
         This clones the repo in a temporary directory, builds it with 'make',
@@ -336,7 +336,8 @@ class Bintool:
 
         Args:
             git_repo (str): URL of git repo
-            make_target (str): Target to pass to 'make' to build the tool
+            make_targets (list of str): List of targets to pass to 'make' to build
+                the tool
             bintool_path (str): Relative path of the tool in the repo, after
                 build is complete
             flags (list of str): Flags or variables to pass to make, or None
@@ -350,12 +351,14 @@ class Bintool:
         tmpdir = tempfile.mkdtemp(prefix='binmanf.')
         print(f"- clone git repo '{git_repo}' to '{tmpdir}'")
         tools.run('git', 'clone', '--depth', '1', git_repo, tmpdir)
-        print(f"- build target '{make_target}'")
-        cmd = ['make', '-C', tmpdir, '-j', f'{multiprocessing.cpu_count()}',
-               make_target]
-        if flags:
-            cmd += flags
-        tools.run(*cmd)
+        for target in make_targets:
+            print(f"- build target '{target}'")
+            cmd = ['make', '-C', tmpdir, '-j', f'{multiprocessing.cpu_count()}',
+                   target]
+            if flags:
+                cmd += flags
+            tools.run(*cmd)
+
         fname = os.path.join(tmpdir, bintool_path)
         if not os.path.exists(fname):
             print(f"- File '{fname}' was not produced")
diff --git a/tools/binman/btool/mkeficapsule.py b/tools/binman/btool/mkeficapsule.py
new file mode 100644 (file)
index 0000000..6117974
--- /dev/null
@@ -0,0 +1,101 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright 2023 Linaro Limited
+#
+"""Bintool implementation for mkeficapsule tool
+
+mkeficapsule is a tool used for generating EFI capsules.
+
+The following are the commandline options to be provided
+to the tool
+Usage: mkeficapsule [options] <image blob> <output file>
+Options:
+       -g, --guid <guid string>    guid for image blob type
+       -i, --index <index>         update image index
+       -I, --instance <instance>   update hardware instance
+       -v, --fw-version <version>  firmware version
+       -p, --private-key <privkey file>  private key file
+       -c, --certificate <cert file>     signer's certificate file
+       -m, --monotonic-count <count>     monotonic count
+       -d, --dump_sig              dump signature (*.p7)
+       -A, --fw-accept  firmware accept capsule, requires GUID, no image blob
+       -R, --fw-revert  firmware revert capsule, takes no GUID, no image blob
+       -o, --capoemflag Capsule OEM Flag, an integer between 0x0000 and 0xffff
+       -h, --help                  print a help message
+"""
+
+from binman import bintool
+
+class Bintoolmkeficapsule(bintool.Bintool):
+    """Handles the 'mkeficapsule' tool
+
+    This bintool is used for generating the EFI capsules. The
+    capsule generation parameters can either be specified through
+    commandline, or through a config file.
+    """
+    def __init__(self, name):
+        super().__init__(name, 'mkeficapsule tool for generating capsules')
+
+    def generate_capsule(self, image_index, image_guid, hardware_instance,
+                         payload, output_fname, priv_key, pub_key,
+                         monotonic_count=0, version=0, oemflags=0):
+        """Generate a capsule through commandline-provided parameters
+
+        Args:
+            image_index (int): Unique number for identifying payload image
+            image_guid (str): GUID used for identifying the image
+            hardware_instance (int): Optional unique hardware instance of
+            a device in the system. 0 if not being used
+            payload (str): Path to the input payload image
+            output_fname (str): Path to the output capsule file
+            priv_key (str): Path to the private key
+            pub_key(str): Path to the public key
+            monotonic_count (int): Count used when signing an image
+            version (int): Image version (Optional)
+            oemflags (int): Optional 16 bit OEM flags
+
+        Returns:
+            str: Tool output
+        """
+        args = [
+            f'--index={image_index}',
+            f'--guid={image_guid}',
+            f'--instance={hardware_instance}'
+        ]
+
+        if version:
+            args += [f'--fw-version={version}']
+        if oemflags:
+            args += [f'--capoemflag={oemflags}']
+        if priv_key and pub_key:
+            args += [
+                f'--monotonic-count={monotonic_count}',
+                f'--private-key={priv_key}',
+                f'--certificate={pub_key}'
+            ]
+
+        args += [
+            payload,
+            output_fname
+        ]
+
+        return self.run_cmd(*args)
+
+    def fetch(self, method):
+        """Fetch handler for mkeficapsule
+
+        This builds the tool from source
+
+        Returns:
+            tuple:
+                str: Filename of fetched file to copy to a suitable directory
+                str: Name of temp directory to remove, or None
+        """
+        if method != bintool.FETCH_BUILD:
+            return None
+
+        cmd = ['tools-only_defconfig', 'tools']
+        result = self.build_from_git(
+            'https://source.denx.de/u-boot/u-boot.git',
+            cmd,
+            'tools/mkeficapsule')
+        return result
index e7dfe6b2a363840cab30df38a7d537683294c432..801bd946742f2c38631553d77f31591b5822ebef 100644 (file)
@@ -468,6 +468,70 @@ updating the EC on startup via software sync.
 
 
 
+.. _etype_efi_capsule:
+
+Entry: capsule: Entry for generating EFI Capsule files
+------------------------------------------------------
+
+The parameters needed for generation of the capsules can be provided
+as properties in the entry.
+
+Properties / Entry arguments:
+    - image-index: Unique number for identifying corresponding
+      payload image. Number between 1 and descriptor count, i.e.
+      the total number of firmware images that can be updated. Mandatory
+      property.
+    - image-guid: Image GUID which will be used for identifying the
+      updatable image on the board. Mandatory property.
+    - hardware-instance: Optional number for identifying unique
+      hardware instance of a device in the system. Default value of 0
+      for images where value is not to be used.
+    - fw-version: Value of image version that can be put on the capsule
+      through the Firmware Management Protocol(FMP) header.
+    - monotonic-count: Count used when signing an image.
+    - private-key: Path to PEM formatted .key private key file. Mandatory
+      property for generating signed capsules.
+    - public-key-cert: Path to PEM formatted .crt public key certificate
+      file. Mandatory property for generating signed capsules.
+    - oem-flags - OEM flags to be passed through capsule header.
+
+    Since this is a subclass of Entry_section, all properties of the parent
+    class also apply here. Except for the properties stated as mandatory, the
+    rest of the properties are optional.
+
+For more details on the description of the capsule format, and the capsule
+update functionality, refer Section 8.5 and Chapter 23 in the `UEFI
+specification`_.
+
+The capsule parameters like image index and image GUID are passed as
+properties in the entry. The payload to be used in the capsule is to be
+provided as a subnode of the capsule entry.
+
+A typical capsule entry node would then look something like this::
+
+    capsule {
+            type = "efi-capsule";
+            image-index = <0x1>;
+            /* Image GUID for testing capsule update */
+            image-guid = SANDBOX_UBOOT_IMAGE_GUID;
+            hardware-instance = <0x0>;
+            private-key = "path/to/the/private/key";
+            public-key-cert = "path/to/the/public-key-cert";
+            oem-flags = <0x8000>;
+
+            u-boot {
+            };
+    };
+
+In the above example, the capsule payload is the U-Boot image. The
+capsule entry would read the contents of the payload and put them
+into the capsule. Any external file can also be specified as the
+payload using the blob-ext subnode.
+
+.. _`UEFI specification`: https://uefi.org/sites/default/files/resources/UEFI_Spec_2_10_Aug29.pdf
+
+
+
 .. _etype_encrypted:
 
 Entry: encrypted: Externally built encrypted binary blob
diff --git a/tools/binman/etype/efi_capsule.py b/tools/binman/etype/efi_capsule.py
new file mode 100644 (file)
index 0000000..006eb63
--- /dev/null
@@ -0,0 +1,143 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2023 Linaro Limited
+#
+# Entry-type module for producing a EFI capsule
+#
+
+import os
+
+from binman.entry import Entry
+from binman.etype.section import Entry_section
+from dtoc import fdt_util
+from u_boot_pylib import tools
+
+class Entry_efi_capsule(Entry_section):
+    """Generate EFI capsules
+
+    The parameters needed for generation of the capsules can
+    be provided as properties in the entry.
+
+    Properties / Entry arguments:
+    - image-index: Unique number for identifying corresponding
+      payload image. Number between 1 and descriptor count, i.e.
+      the total number of firmware images that can be updated. Mandatory
+      property.
+    - image-guid: Image GUID which will be used for identifying the
+      updatable image on the board. Mandatory property.
+    - hardware-instance: Optional number for identifying unique
+      hardware instance of a device in the system. Default value of 0
+      for images where value is not to be used.
+    - fw-version: Value of image version that can be put on the capsule
+      through the Firmware Management Protocol(FMP) header.
+    - monotonic-count: Count used when signing an image.
+    - private-key: Path to PEM formatted .key private key file. Mandatory
+      property for generating signed capsules.
+    - public-key-cert: Path to PEM formatted .crt public key certificate
+      file. Mandatory property for generating signed capsules.
+    - oem-flags - OEM flags to be passed through capsule header.
+
+    Since this is a subclass of Entry_section, all properties of the parent
+    class also apply here. Except for the properties stated as mandatory, the
+    rest of the properties are optional.
+
+    For more details on the description of the capsule format, and the capsule
+    update functionality, refer Section 8.5 and Chapter 23 in the `UEFI
+    specification`_.
+
+    The capsule parameters like image index and image GUID are passed as
+    properties in the entry. The payload to be used in the capsule is to be
+    provided as a subnode of the capsule entry.
+
+    A typical capsule entry node would then look something like this
+
+    capsule {
+            type = "efi-capsule";
+            image-index = <0x1>;
+            /* Image GUID for testing capsule update */
+            image-guid = SANDBOX_UBOOT_IMAGE_GUID;
+            hardware-instance = <0x0>;
+            private-key = "path/to/the/private/key";
+            public-key-cert = "path/to/the/public-key-cert";
+            oem-flags = <0x8000>;
+
+            u-boot {
+            };
+    };
+
+    In the above example, the capsule payload is the U-Boot image. The
+    capsule entry would read the contents of the payload and put them
+    into the capsule. Any external file can also be specified as the
+    payload using the blob-ext subnode.
+
+    .. _`UEFI specification`: https://uefi.org/sites/default/files/resources/UEFI_Spec_2_10_Aug29.pdf
+    """
+    def __init__(self, section, etype, node):
+        super().__init__(section, etype, node)
+        self.required_props = ['image-index', 'image-guid']
+        self.image_index = 0
+        self.image_guid = ''
+        self.hardware_instance = 0
+        self.monotonic_count = 0
+        self.fw_version = 0
+        self.oem_flags = 0
+        self.private_key = ''
+        self.public_key_cert = ''
+        self.auth = 0
+
+    def ReadNode(self):
+        super().ReadNode()
+
+        self.image_index = fdt_util.GetInt(self._node, 'image-index')
+        self.image_guid = fdt_util.GetString(self._node, 'image-guid')
+        self.fw_version = fdt_util.GetInt(self._node, 'fw-version')
+        self.hardware_instance = fdt_util.GetInt(self._node, 'hardware-instance')
+        self.monotonic_count = fdt_util.GetInt(self._node, 'monotonic-count')
+        self.oem_flags = fdt_util.GetInt(self._node, 'oem-flags')
+
+        self.private_key = fdt_util.GetString(self._node, 'private-key')
+        self.public_key_cert = fdt_util.GetString(self._node, 'public-key-cert')
+        if ((self.private_key and not self.public_key_cert) or (self.public_key_cert and not self.private_key)):
+            self.Raise('Both private key and public key certificate need to be provided')
+        elif not (self.private_key and self.public_key_cert):
+            self.auth = 0
+        else:
+            self.auth = 1
+
+    def BuildSectionData(self, required):
+        def get_binman_test_guid(type_str):
+            TYPE_TO_GUID = {
+                'binman-test' : '09d7cf52-0720-4710-91d1-08469b7fe9c8'
+            }
+            return TYPE_TO_GUID[type_str]
+
+        private_key = ''
+        public_key_cert = ''
+        if self.auth:
+            if not os.path.isabs(self.private_key):
+                private_key =  tools.get_input_filename(self.private_key)
+            if not os.path.isabs(self.public_key_cert):
+                public_key_cert = tools.get_input_filename(self.public_key_cert)
+        data, payload, uniq = self.collect_contents_to_file(
+            self._entries.values(), 'capsule_in')
+        outfile = self._filename if self._filename else 'capsule.%s' % uniq
+        capsule_fname = tools.get_output_filename(outfile)
+        guid = self.image_guid
+        if self.image_guid == "binman-test":
+            guid = get_binman_test_guid('binman-test')
+
+        ret = self.mkeficapsule.generate_capsule(self.image_index,
+                                                 guid,
+                                                 self.hardware_instance,
+                                                 payload,
+                                                 capsule_fname,
+                                                 private_key,
+                                                 public_key_cert,
+                                                 self.monotonic_count,
+                                                 self.fw_version,
+                                                 self.oem_flags)
+        if ret is not None:
+            os.remove(payload)
+            return tools.read_file(capsule_fname)
+
+    def AddBintools(self, btools):
+        self.mkeficapsule = self.AddBintool(btools, 'mkeficapsule')
index 1293e9dbf4234493c7a1fee7d192db74b9240192..8e419645a6d564b13e457fca692916eecedaacf3 100644 (file)
@@ -48,6 +48,7 @@ U_BOOT_VPL_DATA       = b'vpl76543210fedcbazywxyz_'
 BLOB_DATA             = b'89'
 ME_DATA               = b'0abcd'
 VGA_DATA              = b'vga'
+EFI_CAPSULE_DATA      = b'efi'
 U_BOOT_DTB_DATA       = b'udtb'
 U_BOOT_SPL_DTB_DATA   = b'spldtb'
 U_BOOT_TPL_DTB_DATA   = b'tpldtb'
@@ -119,6 +120,11 @@ COMP_BINTOOLS = ['bzip2', 'gzip', 'lz4', 'lzma_alone', 'lzop', 'xz', 'zstd']
 
 TEE_ADDR = 0x5678
 
+# Firmware Management Protocol(FMP) GUID
+FW_MGMT_GUID = 'edd5cb6d2de8444cbda17194199ad92a'
+# Image GUID specified in the DTS
+CAPSULE_IMAGE_GUID = '52cfd7092007104791d108469b7fe9c8'
+
 class TestFunctional(unittest.TestCase):
     """Functional tests for binman
 
@@ -215,6 +221,7 @@ class TestFunctional(unittest.TestCase):
         TestFunctional._MakeInputFile('scp.bin', SCP_DATA)
         TestFunctional._MakeInputFile('rockchip-tpl.bin', ROCKCHIP_TPL_DATA)
         TestFunctional._MakeInputFile('ti_unsecure.bin', TI_UNSECURE_DATA)
+        TestFunctional._MakeInputFile('capsule_input.bin', EFI_CAPSULE_DATA)
 
         # Add a few .dtb files for testing
         TestFunctional._MakeInputFile('%s/test-fdt1.dtb' % TEST_FDT_SUBDIR,
@@ -7216,5 +7223,116 @@ fdt         fdtmap                Extract the devicetree blob from the fdtmap
         self.assertRegex(err,
                          "Image 'image'.*missing bintools.*: bootgen")
 
+    def _CheckCapsule(self, data, signed_capsule=False, version_check=False,
+                      capoemflags=False):
+        fmp_signature = "4d535331" # 'M', 'S', 'S', '1'
+        fmp_size = "10"
+        fmp_fw_version = "02"
+        oemflag = "0080"
+
+        payload_data = EFI_CAPSULE_DATA
+
+        # TODO - Currently, these offsets for capsule fields are hardcoded.
+        # There are plans to add support to the mkeficapsule tool to dump
+        # the capsule contents which can then be used for capsule
+        # verification.
+
+        # Firmware Management Protocol(FMP) GUID - offset(0 - 32)
+        self.assertEqual(FW_MGMT_GUID, data.hex()[:32])
+        # Image GUID - offset(96 - 128)
+        self.assertEqual(CAPSULE_IMAGE_GUID, data.hex()[96:128])
+
+        if capoemflags:
+            # OEM Flags - offset(40 - 44)
+            self.assertEqual(oemflag, data.hex()[40:44])
+        if signed_capsule and version_check:
+            # FMP header signature - offset(4770 - 4778)
+            self.assertEqual(fmp_signature, data.hex()[4770:4778])
+            # FMP header size - offset(4778 - 4780)
+            self.assertEqual(fmp_size, data.hex()[4778:4780])
+            # firmware version - offset(4786 - 4788)
+            self.assertEqual(fmp_fw_version, data.hex()[4786:4788])
+            # payload offset signed capsule(4802 - 4808)
+            self.assertEqual(payload_data.hex(), data.hex()[4802:4808])
+        elif signed_capsule:
+            # payload offset signed capsule(4770 - 4776)
+            self.assertEqual(payload_data.hex(), data.hex()[4770:4776])
+        elif version_check:
+            # FMP header signature - offset(184 - 192)
+            self.assertEqual(fmp_signature, data.hex()[184:192])
+            # FMP header size - offset(192 - 194)
+            self.assertEqual(fmp_size, data.hex()[192:194])
+            # firmware version - offset(200 - 202)
+            self.assertEqual(fmp_fw_version, data.hex()[200:202])
+            # payload offset for non-signed capsule with version header(216 - 222)
+            self.assertEqual(payload_data.hex(), data.hex()[216:222])
+        else:
+            # payload offset for non-signed capsule with no version header(184 - 190)
+            self.assertEqual(payload_data.hex(), data.hex()[184:190])
+
+    def testCapsuleGen(self):
+        """Test generation of EFI capsule"""
+        data = self._DoReadFile('311_capsule.dts')
+
+        self._CheckCapsule(data)
+
+    def testSignedCapsuleGen(self):
+        """Test generation of EFI capsule"""
+        data = tools.read_file(self.TestFile("key.key"))
+        self._MakeInputFile("key.key", data)
+        data = tools.read_file(self.TestFile("key.pem"))
+        self._MakeInputFile("key.crt", data)
+
+        data = self._DoReadFile('312_capsule_signed.dts')
+
+        self._CheckCapsule(data, signed_capsule=True)
+
+    def testCapsuleGenVersionSupport(self):
+        """Test generation of EFI capsule with version support"""
+        data = self._DoReadFile('313_capsule_version.dts')
+
+        self._CheckCapsule(data, version_check=True)
+
+    def testCapsuleGenSignedVer(self):
+        """Test generation of signed EFI capsule with version information"""
+        data = tools.read_file(self.TestFile("key.key"))
+        self._MakeInputFile("key.key", data)
+        data = tools.read_file(self.TestFile("key.pem"))
+        self._MakeInputFile("key.crt", data)
+
+        data = self._DoReadFile('314_capsule_signed_ver.dts')
+
+        self._CheckCapsule(data, signed_capsule=True, version_check=True)
+
+    def testCapsuleGenCapOemFlags(self):
+        """Test generation of EFI capsule with OEM Flags set"""
+        data = self._DoReadFile('315_capsule_oemflags.dts')
+
+        self._CheckCapsule(data, capoemflags=True)
+
+    def testCapsuleGenKeyMissing(self):
+        """Test that binman errors out on missing key"""
+        with self.assertRaises(ValueError) as e:
+            self._DoReadFile('316_capsule_missing_key.dts')
+
+        self.assertIn("Both private key and public key certificate need to be provided",
+                      str(e.exception))
+
+    def testCapsuleGenIndexMissing(self):
+        """Test that binman errors out on missing image index"""
+        with self.assertRaises(ValueError) as e:
+            self._DoReadFile('317_capsule_missing_index.dts')
+
+        self.assertIn("entry is missing properties: image-index",
+                      str(e.exception))
+
+    def testCapsuleGenGuidMissing(self):
+        """Test that binman errors out on missing image GUID"""
+        with self.assertRaises(ValueError) as e:
+            self._DoReadFile('318_capsule_missing_guid.dts')
+
+        self.assertIn("entry is missing properties: image-guid",
+                      str(e.exception))
+
 if __name__ == "__main__":
     unittest.main()
diff --git a/tools/binman/test/311_capsule.dts b/tools/binman/test/311_capsule.dts
new file mode 100644 (file)
index 0000000..8eb4250
--- /dev/null
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       binman {
+               efi-capsule {
+                       image-index = <0x1>;
+                       /* Image GUID for testing capsule update */
+                       image-guid = "binman-test";
+                       hardware-instance = <0x0>;
+
+                       blob {
+                               filename = "capsule_input.bin";
+                       };
+               };
+       };
+};
diff --git a/tools/binman/test/312_capsule_signed.dts b/tools/binman/test/312_capsule_signed.dts
new file mode 100644 (file)
index 0000000..d1c76e2
--- /dev/null
@@ -0,0 +1,23 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       binman {
+               efi-capsule {
+                       image-index = <0x1>;
+                       /* Image GUID for testing capsule update */
+                       image-guid = "binman-test";
+                       hardware-instance = <0x0>;
+                       private-key = "key.key";
+                       public-key-cert = "key.crt";
+
+                       blob {
+                               filename = "capsule_input.bin";
+                       };
+               };
+       };
+};
diff --git a/tools/binman/test/313_capsule_version.dts b/tools/binman/test/313_capsule_version.dts
new file mode 100644 (file)
index 0000000..bafef36
--- /dev/null
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       binman {
+               efi-capsule {
+                       image-index = <0x1>;
+                       fw-version = <0x2>;
+                       /* Image GUID for testing capsule update */
+                       image-guid = "binman-test";
+                       hardware-instance = <0x0>;
+
+                       blob {
+                               filename = "capsule_input.bin";
+                       };
+               };
+       };
+};
diff --git a/tools/binman/test/314_capsule_signed_ver.dts b/tools/binman/test/314_capsule_signed_ver.dts
new file mode 100644 (file)
index 0000000..85c784b
--- /dev/null
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       binman {
+               efi-capsule {
+                       image-index = <0x1>;
+                       fw-version = <0x2>;
+                       /* Image GUID for testing capsule update */
+                       image-guid = "binman-test";
+                       hardware-instance = <0x0>;
+                       private-key = "key.key";
+                       public-key-cert = "key.crt";
+
+                       blob {
+                               filename = "capsule_input.bin";
+                       };
+               };
+       };
+};
diff --git a/tools/binman/test/315_capsule_oemflags.dts b/tools/binman/test/315_capsule_oemflags.dts
new file mode 100644 (file)
index 0000000..f736e87
--- /dev/null
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       binman {
+               efi-capsule {
+                       image-index = <0x1>;
+                       /* Image GUID for testing capsule update */
+                       image-guid = "binman-test";
+                       hardware-instance = <0x0>;
+                       oem-flags = <0x8000>;
+
+                       blob {
+                               filename = "capsule_input.bin";
+                       };
+               };
+       };
+};
diff --git a/tools/binman/test/316_capsule_missing_key.dts b/tools/binman/test/316_capsule_missing_key.dts
new file mode 100644 (file)
index 0000000..2080b50
--- /dev/null
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       binman {
+               efi-capsule {
+                       image-index = <0x1>;
+                       /* Image GUID for testing capsule update */
+                       image-guid = "binman-test";
+                       hardware-instance = <0x0>;
+                       private-key = "tools/binman/test/key.key";
+
+                       blob {
+                               filename = "capsule_input.bin";
+                       };
+               };
+       };
+};
diff --git a/tools/binman/test/317_capsule_missing_index.dts b/tools/binman/test/317_capsule_missing_index.dts
new file mode 100644 (file)
index 0000000..aadb61f
--- /dev/null
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       binman {
+               efi-capsule {
+                       /* Image GUID for testing capsule update */
+                       image-guid = "binman-test";
+                       hardware-instance = <0x0>;
+
+                       blob {
+                               filename = "capsule_input.bin";
+                       };
+               };
+       };
+};
diff --git a/tools/binman/test/318_capsule_missing_guid.dts b/tools/binman/test/318_capsule_missing_guid.dts
new file mode 100644 (file)
index 0000000..d76afba
--- /dev/null
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/dts-v1/;
+
+/ {
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       binman {
+               efi-capsule {
+                       image-index = <0x1>;
+                       hardware-instance = <0x0>;
+
+                       blob {
+                               filename = "capsule_input.bin";
+                       };
+               };
+       };
+};
index b05001194e42b320078606b55806ca7ae36e831e..79c7c11a1105742738c14a87200f8bcc7dde4e8d 100644 (file)
@@ -499,7 +499,7 @@ class Toolchains:
         if arch == 'aarch64':
             arch = 'arm64'
         base = 'https://www.kernel.org/pub/tools/crosstool/files/bin'
-        versions = ['13.1.0', '12.2.0']
+        versions = ['13.2.0', '12.2.0']
         links = []
         for version in versions:
             url = '%s/%s/%s/' % (base, arch, version)
index 0e49ab3301567ec0045deb71721c42254825798f..04bc85bf932cd8969ebfb375e5bf8ba4d8ca7461 100644 (file)
@@ -15,7 +15,6 @@
 
 #include "imagetool.h"
 #include "mkimage.h"
-#include <u-boot/crc.h>
 
 #include <image.h>
 #include <tee/optee.h>
index 3d2b64a355f3f8cbcaf841106ec59edded2977e6..279b3a3504cdb7d64d10fdfce848d1e15b87bf89 100644 (file)
@@ -2,7 +2,7 @@
 # This Dockerfile is used to build an image containing basic stuff to be used
 # to build U-Boot and run our test suites.
 
-FROM ubuntu:jammy-20230624
+FROM ubuntu:jammy-20230804
 MAINTAINER Tom Rini <trini@konsulko.com>
 LABEL Description=" This image is for building U-Boot inside a container"
 
@@ -14,19 +14,19 @@ RUN apt-get update && apt-get install -y gnupg2 wget xz-utils && rm -rf /var/lib
 RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
 RUN echo deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main | tee /etc/apt/sources.list.d/llvm.list
 
-# Manually install the kernel.org "Crosstool" based toolchains for gcc-13.1.0
-RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.1.0/x86_64-gcc-13.1.0-nolibc-aarch64-linux.tar.xz | tar -C /opt -xJ
-RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.1.0/x86_64-gcc-13.1.0-nolibc-arc-linux.tar.xz | tar -C /opt -xJ
-RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.1.0/x86_64-gcc-13.1.0-nolibc-arm-linux-gnueabi.tar.xz | tar -C /opt -xJ
-RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.1.0/x86_64-gcc-13.1.0-nolibc-i386-linux.tar.xz | tar -C /opt -xJ
-RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.1.0/x86_64-gcc-13.1.0-nolibc-m68k-linux.tar.xz | tar -C /opt -xJ
-RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.1.0/x86_64-gcc-13.1.0-nolibc-mips-linux.tar.xz | tar -C /opt -xJ
-RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.1.0/x86_64-gcc-13.1.0-nolibc-microblaze-linux.tar.xz | tar -C /opt -xJ
-RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.1.0/x86_64-gcc-13.1.0-nolibc-nios2-linux.tar.xz | tar -C /opt -xJ
-RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.1.0/x86_64-gcc-13.1.0-nolibc-powerpc-linux.tar.xz | tar -C /opt -xJ
-RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.1.0/x86_64-gcc-13.1.0-nolibc-riscv64-linux.tar.xz | tar -C /opt -xJ
-RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.1.0/x86_64-gcc-13.1.0-nolibc-riscv32-linux.tar.xz | tar -C /opt -xJ
-RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.1.0/x86_64-gcc-13.1.0-nolibc-sh2-linux.tar.xz | tar -C /opt -xJ
+# Manually install the kernel.org "Crosstool" based toolchains for gcc-13.2.0
+RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-aarch64-linux.tar.xz | tar -C /opt -xJ
+RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-arc-linux.tar.xz | tar -C /opt -xJ
+RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-arm-linux-gnueabi.tar.xz | tar -C /opt -xJ
+RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-i386-linux.tar.xz | tar -C /opt -xJ
+RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-m68k-linux.tar.xz | tar -C /opt -xJ
+RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-mips-linux.tar.xz | tar -C /opt -xJ
+RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-microblaze-linux.tar.xz | tar -C /opt -xJ
+RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-nios2-linux.tar.xz | tar -C /opt -xJ
+RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-powerpc-linux.tar.xz | tar -C /opt -xJ
+RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-riscv64-linux.tar.xz | tar -C /opt -xJ
+RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-riscv32-linux.tar.xz | tar -C /opt -xJ
+RUN wget -O - https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/x86_64-gcc-13.2.0-nolibc-sh2-linux.tar.xz | tar -C /opt -xJ
 
 # Manually install other toolchains
 RUN wget -O - https://github.com/foss-xtensa/toolchain/releases/download/2020.07/x86_64-2020.07-xtensa-dc233c-elf.tar.gz | tar -C /opt -xz
@@ -39,6 +39,7 @@ RUN apt-get update && apt-get install -y \
        binutils-dev \
        bison \
        build-essential \
+       cgpt \
        clang-16 \
        coreutils \
        cpio \
@@ -115,6 +116,8 @@ RUN apt-get update && apt-get install -y \
        util-linux \
        uuid-dev \
        virtualenv \
+       vboot-kernel-utils \
+       vboot-utils \
        xxd \
        zip \
        && rm -rf /var/lib/apt/lists/*
@@ -134,11 +137,11 @@ RUN git clone git://git.savannah.gnu.org/grub.git /tmp/grub && \
        mkdir -p /opt/grub && \
        ./configure --target=aarch64 --with-platform=efi \
        CC=gcc \
-       TARGET_CC=/opt/gcc-13.1.0-nolibc/aarch64-linux/bin/aarch64-linux-gcc \
-       TARGET_OBJCOPY=/opt/gcc-13.1.0-nolibc/aarch64-linux/bin/aarch64-linux-objcopy \
-       TARGET_STRIP=/opt/gcc-13.1.0-nolibc/aarch64-linux/bin/aarch64-linux-strip \
-       TARGET_NM=/opt/gcc-13.1.0-nolibc/aarch64-linux/bin/aarch64-linux-nm \
-       TARGET_RANLIB=/opt/gcc-13.1.0-nolibc/aarch64-linux/bin/aarch64-linux-ranlib && \
+       TARGET_CC=/opt/gcc-13.2.0-nolibc/aarch64-linux/bin/aarch64-linux-gcc \
+       TARGET_OBJCOPY=/opt/gcc-13.2.0-nolibc/aarch64-linux/bin/aarch64-linux-objcopy \
+       TARGET_STRIP=/opt/gcc-13.2.0-nolibc/aarch64-linux/bin/aarch64-linux-strip \
+       TARGET_NM=/opt/gcc-13.2.0-nolibc/aarch64-linux/bin/aarch64-linux-nm \
+       TARGET_RANLIB=/opt/gcc-13.2.0-nolibc/aarch64-linux/bin/aarch64-linux-ranlib && \
        make && \
        ./grub-mkimage -O arm64-efi -o /opt/grub/grubaa64.efi --prefix= -d \
        grub-core cat chain configfile echo efinet ext2 fat halt help linux \
@@ -148,11 +151,11 @@ RUN git clone git://git.savannah.gnu.org/grub.git /tmp/grub && \
        make clean && \
        ./configure --target=arm --with-platform=efi \
        CC=gcc \
-       TARGET_CC=/opt/gcc-13.1.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-gcc \
-       TARGET_OBJCOPY=/opt/gcc-13.1.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-objcopy \
-       TARGET_STRIP=/opt/gcc-13.1.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-strip \
-       TARGET_NM=/opt/gcc-13.1.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-nm \
-       TARGET_RANLIB=/opt/gcc-13.1.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ranlib && \
+       TARGET_CC=/opt/gcc-13.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-gcc \
+       TARGET_OBJCOPY=/opt/gcc-13.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-objcopy \
+       TARGET_STRIP=/opt/gcc-13.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-strip \
+       TARGET_NM=/opt/gcc-13.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-nm \
+       TARGET_RANLIB=/opt/gcc-13.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ranlib && \
        make && \
        ./grub-mkimage -O arm-efi -o /opt/grub/grubarm.efi --prefix= -d \
        grub-core cat chain configfile echo efinet ext2 fat halt help linux \
@@ -162,11 +165,11 @@ RUN git clone git://git.savannah.gnu.org/grub.git /tmp/grub && \
        make clean && \
        ./configure --target=riscv64 --with-platform=efi \
        CC=gcc \
-       TARGET_CC=/opt/gcc-13.1.0-nolibc/riscv64-linux/bin/riscv64-linux-gcc \
-       TARGET_OBJCOPY=/opt/gcc-13.1.0-nolibc/riscv64-linux/bin/riscv64-linux-objcopy \
-       TARGET_STRIP=/opt/gcc-13.1.0-nolibc/riscv64-linux/bin/riscv64-linux-strip \
-       TARGET_NM=/opt/gcc-13.1.0-nolibc/riscv64-linux/bin/riscv64-linux-nm \
-       TARGET_RANLIB=/opt/gcc-13.1.0-nolibc/riscv64-linux/bin/riscv64-linux-ranlib && \
+       TARGET_CC=/opt/gcc-13.2.0-nolibc/riscv64-linux/bin/riscv64-linux-gcc \
+       TARGET_OBJCOPY=/opt/gcc-13.2.0-nolibc/riscv64-linux/bin/riscv64-linux-objcopy \
+       TARGET_STRIP=/opt/gcc-13.2.0-nolibc/riscv64-linux/bin/riscv64-linux-strip \
+       TARGET_NM=/opt/gcc-13.2.0-nolibc/riscv64-linux/bin/riscv64-linux-nm \
+       TARGET_RANLIB=/opt/gcc-13.2.0-nolibc/riscv64-linux/bin/riscv64-linux-ranlib && \
        make && \
        ./grub-mkimage -O riscv64-efi -o /opt/grub/grubriscv64.efi --prefix= -d \
        grub-core cat chain configfile echo efinet ext2 fat halt help linux \
@@ -277,7 +280,7 @@ RUN virtualenv -p /usr/bin/python3 /tmp/venv && \
 
 # Create the buildman config file
 RUN /bin/echo -e "[toolchain]\nroot = /usr" > ~/.buildman
-RUN /bin/echo -e "kernelorg = /opt/gcc-13.1.0-nolibc/*" >> ~/.buildman
+RUN /bin/echo -e "kernelorg = /opt/gcc-13.2.0-nolibc/*" >> ~/.buildman
 RUN /bin/echo -e "\n[toolchain-prefix]\nxtensa = /opt/2020.07/xtensa-dc233c-elf/bin/xtensa-dc233c-elf-" >> ~/.buildman;
 RUN /bin/echo -e "\n[toolchain-alias]\nsh = sh2" >> ~/.buildman
 RUN /bin/echo -e "\nsandbox = x86_64" >> ~/.buildman
index c6eb87aec739960b737fa8cb36d6ff5659e36b81..ea80c70f04e3b911605245b1efadaa5ae7d0ecf3 100755 (executable)
@@ -69,7 +69,10 @@ def calc_ids(fname):
 
 def run_expo(args):
     """Run the expo program"""
-    ids = calc_ids(args.enum_fname)
+    fname = args.enum_fname or args.layout
+    ids = calc_ids(fname)
+    if not ids:
+        print(f"Warning: No enum ID values found in file '{fname}'")
 
     indata = tools.read_file(args.layout)
 
@@ -88,10 +91,10 @@ def run_expo(args):
 
     with open('/tmp/asc', 'wb') as outf:
         outf.write(data)
-    proc = subprocess.run('dtc', input=data, capture_output=True, check=True)
+    proc = subprocess.run('dtc', input=data, capture_output=True)
     edtb = proc.stdout
     if proc.stderr:
-        print(proc.stderr)
+        print(f"Devicetree compiler error:\n{proc.stderr.decode('utf-8')}")
         return 1
     tools.write_file(args.outfile, edtb)
     return 0
@@ -109,11 +112,13 @@ def parse_args(argv):
             args is a list of string arguments
     """
     parser = argparse.ArgumentParser()
+    parser.add_argument('-D', '--debug', action='store_true',
+        help='Enable full debug traceback')
     parser.add_argument('-e', '--enum-fname', type=str,
-        help='C file containing enum declaration for expo items')
-    parser.add_argument('-l', '--layout', type=str,
-        help='Devicetree file source .dts for expo layout')
-    parser.add_argument('-o', '--outfile', type=str,
+        help='.dts or C file containing enum declaration for expo items')
+    parser.add_argument('-l', '--layout', type=str, required=True,
+        help='Devicetree file source .dts for expo layout (and perhaps enums)')
+    parser.add_argument('-o', '--outfile', type=str, required=True,
         help='Filename to write expo layout dtb')
 
     return parser.parse_args(argv)
@@ -122,6 +127,9 @@ def start_expo():
     """Start the expo program"""
     args = parse_args(sys.argv[1:])
 
+    if not args.debug:
+        sys.tracebacklimit = 0
+
     ret_code = run_expo(args)
     sys.exit(ret_code)
 
index 4a24dee8153c0514f18dcafad4b15c913c919e8d..ca4950312f9b35daa95f7ec104c01f0c570e7163 100644 (file)
@@ -38,9 +38,9 @@ static int fit_set_hash_value(void *fit, int noffset, uint8_t *value,
 
        ret = fdt_setprop(fit, noffset, FIT_VALUE_PROP, value, value_len);
        if (ret) {
-               printf("Can't set hash '%s' property for '%s' node(%s)\n",
-                      FIT_VALUE_PROP, fit_get_name(fit, noffset, NULL),
-                      fdt_strerror(ret));
+               fprintf(stderr, "Can't set hash '%s' property for '%s' node(%s)\n",
+                       FIT_VALUE_PROP, fit_get_name(fit, noffset, NULL),
+                       fdt_strerror(ret));
                return ret == -FDT_ERR_NOSPACE ? -ENOSPC : -EIO;
        }
 
@@ -72,21 +72,23 @@ static int fit_image_process_hash(void *fit, const char *image_name,
        node_name = fit_get_name(fit, noffset, NULL);
 
        if (fit_image_hash_get_algo(fit, noffset, &algo)) {
-               printf("Can't get hash algo property for '%s' hash node in '%s' image node\n",
-                      node_name, image_name);
+               fprintf(stderr,
+                       "Can't get hash algo property for '%s' hash node in '%s' image node\n",
+                       node_name, image_name);
                return -ENOENT;
        }
 
        if (calculate_hash(data, size, algo, value, &value_len)) {
-               printf("Unsupported hash algorithm (%s) for '%s' hash node in '%s' image node\n",
-                      algo, node_name, image_name);
+               fprintf(stderr,
+                       "Unsupported hash algorithm (%s) for '%s' hash node in '%s' image node\n",
+                       algo, node_name, image_name);
                return -EPROTONOSUPPORT;
        }
 
        ret = fit_set_hash_value(fit, noffset, value, value_len);
        if (ret) {
-               printf("Can't set hash value for '%s' hash node in '%s' image node\n",
-                      node_name, image_name);
+               fprintf(stderr, "Can't set hash value for '%s' hash node in '%s' image node\n",
+                       node_name, image_name);
                return ret;
        }
 
@@ -170,8 +172,9 @@ static int fit_image_setup_sig(struct image_sign_info *info,
        node_name = fit_get_name(fit, noffset, NULL);
        if (!algo_name) {
                if (fit_image_hash_get_algo(fit, noffset, &algo_name)) {
-                       printf("Can't get algo property for '%s' signature node in '%s' image node\n",
-                              node_name, image_name);
+                       fprintf(stderr,
+                               "Can't get algo property for '%s' signature node in '%s' image node\n",
+                               node_name, image_name);
                        return -1;
                }
        }
@@ -191,8 +194,9 @@ static int fit_image_setup_sig(struct image_sign_info *info,
        info->require_keys = require_keys;
        info->engine_id = engine_id;
        if (!info->checksum || !info->crypto) {
-               printf("Unsupported signature algorithm (%s) for '%s' signature node in '%s' image node\n",
-                      algo_name, node_name, image_name);
+               fprintf(stderr,
+                       "Unsupported signature algorithm (%s) for '%s' signature node in '%s' image node\n",
+                       algo_name, node_name, image_name);
                return -1;
        }
 
@@ -241,8 +245,8 @@ static int fit_image_process_sig(const char *keydir, const char *keyfile,
        region.size = size;
        ret = info.crypto->sign(&info, &region, 1, &value, &value_len);
        if (ret) {
-               printf("Failed to sign '%s' signature node in '%s' image node: %d\n",
-                      node_name, image_name, ret);
+               fprintf(stderr, "Failed to sign '%s' signature node in '%s' image node: %d\n",
+                       node_name, image_name, ret);
 
                /* We allow keys to be missing */
                if (ret == -ENOENT)
@@ -255,8 +259,9 @@ static int fit_image_process_sig(const char *keydir, const char *keyfile,
        if (ret) {
                if (ret == -FDT_ERR_NOSPACE)
                        return -ENOSPC;
-               printf("Can't write signature for '%s' signature node in '%s' conf node: %s\n",
-                      node_name, image_name, fdt_strerror(ret));
+               fprintf(stderr,
+                       "Can't write signature for '%s' signature node in '%s' conf node: %s\n",
+                       node_name, image_name, fdt_strerror(ret));
                return -1;
        }
        free(value);
@@ -272,8 +277,9 @@ static int fit_image_process_sig(const char *keydir, const char *keyfile,
        if (keydest) {
                ret = info.crypto->add_verify_data(&info, keydest);
                if (ret < 0) {
-                       printf("Failed to add verification data for '%s' signature node in '%s' image node\n",
-                              node_name, image_name);
+                       fprintf(stderr,
+                               "Failed to add verification data for '%s' signature node in '%s' image node\n",
+                               node_name, image_name);
                        return ret;
                }
                /* Return the node that was written to */
@@ -293,37 +299,37 @@ static int fit_image_read_data(char *filename, unsigned char *data,
        /* Open file */
        fd = open(filename, O_RDONLY | O_BINARY);
        if (fd < 0) {
-               printf("Can't open file %s (err=%d => %s)\n",
-                      filename, errno, strerror(errno));
+               fprintf(stderr, "Can't open file %s (err=%d => %s)\n",
+                       filename, errno, strerror(errno));
                return -1;
        }
 
        /* Compute file size */
        if (fstat(fd, &sbuf) < 0) {
-               printf("Can't fstat file %s (err=%d => %s)\n",
-                      filename, errno, strerror(errno));
+               fprintf(stderr, "Can't fstat file %s (err=%d => %s)\n",
+                       filename, errno, strerror(errno));
                goto err;
        }
 
        /* Check file size */
        if (sbuf.st_size != expected_size) {
-               printf("File %s don't have the expected size (size=%lld, expected=%d)\n",
-                      filename, (long long)sbuf.st_size, expected_size);
+               fprintf(stderr, "File %s don't have the expected size (size=%lld, expected=%d)\n",
+                       filename, (long long)sbuf.st_size, expected_size);
                goto err;
        }
 
        /* Read data */
        n = read(fd, data, sbuf.st_size);
        if (n < 0) {
-               printf("Can't read file %s (err=%d => %s)\n",
-                      filename, errno, strerror(errno));
+               fprintf(stderr, "Can't read file %s (err=%d => %s)\n",
+                       filename, errno, strerror(errno));
                goto err;
        }
 
        /* Check that we have read all the file */
        if (n != sbuf.st_size) {
-               printf("Can't read all file %s (read %zd bytes, expected %lld)\n",
-                      filename, n, (long long)sbuf.st_size);
+               fprintf(stderr, "Can't read all file %s (read %zd bytes, expected %lld)\n",
+                       filename, n, (long long)sbuf.st_size);
                goto err;
        }
 
@@ -341,15 +347,15 @@ static int get_random_data(void *data, int size)
        int i, ret;
 
        if (!tmp) {
-               printf("%s: pointer data is NULL\n", __func__);
+               fprintf(stderr, "%s: pointer data is NULL\n", __func__);
                ret = -1;
                goto out;
        }
 
        ret = clock_gettime(CLOCK_MONOTONIC, &date);
        if (ret) {
-               printf("%s: clock_gettime has failed (%s)\n", __func__,
-                      strerror(errno));
+               fprintf(stderr, "%s: clock_gettime has failed (%s)\n", __func__,
+                       strerror(errno));
                goto out;
        }
 
@@ -374,8 +380,8 @@ static int fit_image_setup_cipher(struct image_cipher_info *info,
        int ret = -1;
 
        if (fit_image_cipher_get_algo(fit, noffset, &algo_name)) {
-               printf("Can't get algo name for cipher in image '%s'\n",
-                      image_name);
+               fprintf(stderr, "Can't get algo name for cipher in image '%s'\n",
+                       image_name);
                goto out;
        }
 
@@ -384,8 +390,8 @@ static int fit_image_setup_cipher(struct image_cipher_info *info,
        /* Read the key name */
        info->keyname = fdt_getprop(fit, noffset, FIT_KEY_HINT, NULL);
        if (!info->keyname) {
-               printf("Can't get key name for cipher in image '%s'\n",
-                      image_name);
+               fprintf(stderr, "Can't get key name for cipher in image '%s'\n",
+                       image_name);
                goto out;
        }
 
@@ -403,7 +409,7 @@ static int fit_image_setup_cipher(struct image_cipher_info *info,
 
        info->cipher = image_get_cipher_algo(algo_name);
        if (!info->cipher) {
-               printf("Can't get algo for cipher '%s'\n", image_name);
+               fprintf(stderr, "Can't get algo for cipher '%s'\n", image_name);
                goto out;
        }
 
@@ -412,7 +418,7 @@ static int fit_image_setup_cipher(struct image_cipher_info *info,
                 info->keydir, info->keyname, ".bin");
        info->key = malloc(info->cipher->key_len);
        if (!info->key) {
-               printf("Can't allocate memory for key\n");
+               fprintf(stderr, "Can't allocate memory for key\n");
                ret = -1;
                goto out;
        }
@@ -423,7 +429,7 @@ static int fit_image_setup_cipher(struct image_cipher_info *info,
 
        info->iv = malloc(info->cipher->iv_len);
        if (!info->iv) {
-               printf("Can't allocate memory for iv\n");
+               fprintf(stderr, "Can't allocate memory for iv\n");
                ret = -1;
                goto out;
        }
@@ -457,7 +463,7 @@ int fit_image_write_cipher(void *fit, int image_noffset, int noffset,
                goto out;
        }
        if (ret) {
-               printf("Can't replace data with ciphered data (err = %d)\n", ret);
+               fprintf(stderr, "Can't replace data with ciphered data (err = %d)\n", ret);
                goto out;
        }
 
@@ -468,7 +474,7 @@ int fit_image_write_cipher(void *fit, int image_noffset, int noffset,
                goto out;
        }
        if (ret) {
-               printf("Can't add unciphered data size (err = %d)\n", ret);
+               fprintf(stderr, "Can't add unciphered data size (err = %d)\n", ret);
                goto out;
        }
 
@@ -508,8 +514,9 @@ fit_image_process_cipher(const char *keydir, void *keydest, void *fit,
        if (keydest) {
                ret = info.cipher->add_cipher_data(&info, keydest, fit, node_noffset);
                if (ret) {
-                       printf("Failed to add verification data for cipher '%s' in image '%s'\n",
-                              info.keyname, image_name);
+                       fprintf(stderr,
+                               "Failed to add verification data for cipher '%s' in image '%s'\n",
+                               info.keyname, image_name);
                        goto out;
                }
        }
@@ -538,13 +545,13 @@ int fit_image_cipher_data(const char *keydir, void *keydest,
        /* Get image name */
        image_name = fit_get_name(fit, image_noffset, NULL);
        if (!image_name) {
-               printf("Can't get image name\n");
+               fprintf(stderr, "Can't get image name\n");
                return -1;
        }
 
        /* Get image data and data length */
        if (fit_image_get_data(fit, image_noffset, &data, &size)) {
-               printf("Can't get image data/size\n");
+               fprintf(stderr, "Can't get image data/size\n");
                return -1;
        }
 
@@ -558,7 +565,7 @@ int fit_image_cipher_data(const char *keydir, void *keydest,
        if (fdt_getprop(fit, image_noffset, "data-size-unciphered", &len))
                return 0;
        if (len != -FDT_ERR_NOTFOUND) {
-               printf("Failure testing for data-size-unciphered\n");
+               fprintf(stderr, "Failure testing for data-size-unciphered\n");
                return -1;
        }
 
@@ -568,7 +575,7 @@ int fit_image_cipher_data(const char *keydir, void *keydest,
        if (cipher_node_offset == -FDT_ERR_NOTFOUND)
                return 0;
        if (cipher_node_offset < 0) {
-               printf("Failure getting cipher node\n");
+               fprintf(stderr, "Failure getting cipher node\n");
                return -1;
        }
        if (!IMAGE_ENABLE_ENCRYPT || !keydir)
@@ -624,7 +631,7 @@ int fit_image_add_verification_data(const char *keydir, const char *keyfile,
 
        /* Get image data and data length */
        if (fit_image_get_data(fit, image_noffset, &data, &size)) {
-               printf("Can't get image data/size\n");
+               fprintf(stderr, "Can't get image data/size\n");
                return -1;
        }
 
@@ -765,8 +772,9 @@ static int fit_config_add_hash(const void *fit, int image_noffset,
        }
 
        if (!hash_count) {
-               printf("Failed to find any hash nodes in configuration '%s/%s' image '%s' - without these it is not possible to verify this image\n",
-                      conf_name, sig_name, iname);
+               fprintf(stderr,
+                       "Failed to find any hash nodes in configuration '%s/%s' image '%s' - without these it is not possible to verify this image\n",
+                       conf_name, sig_name, iname);
                return -ENOMSG;
        }
 
@@ -775,9 +783,10 @@ static int fit_config_add_hash(const void *fit, int image_noffset,
                                     FIT_CIPHER_NODENAME);
        if (noffset != -FDT_ERR_NOTFOUND) {
                if (noffset < 0) {
-                       printf("Failed to get cipher node in configuration '%s/%s' image '%s': %s\n",
-                              conf_name, sig_name, iname,
-                              fdt_strerror(noffset));
+                       fprintf(stderr,
+                               "Failed to get cipher node in configuration '%s/%s' image '%s': %s\n",
+                               conf_name, sig_name, iname,
+                               fdt_strerror(noffset));
                        return -EIO;
                }
                ret = fdt_get_path(fit, noffset, path, sizeof(path));
@@ -790,13 +799,13 @@ static int fit_config_add_hash(const void *fit, int image_noffset,
        return 0;
 
 err_mem:
-       printf("Out of memory processing configuration '%s/%s'\n", conf_name,
-              sig_name);
+       fprintf(stderr, "Out of memory processing configuration '%s/%s'\n", conf_name,
+               sig_name);
        return -ENOMEM;
 
 err_path:
-       printf("Failed to get path for image '%s' in configuration '%s/%s': %s\n",
-              iname, conf_name, sig_name, fdt_strerror(ret));
+       fprintf(stderr, "Failed to get path for image '%s' in configuration '%s/%s': %s\n",
+               iname, conf_name, sig_name, fdt_strerror(ret));
        return -ENOENT;
 }
 
@@ -857,8 +866,9 @@ static int fit_config_get_hash_list(const void *fit, int conf_noffset,
                                                                     iname, index);
 
                        if (image_noffset < 0) {
-                               printf("Failed to find image '%s' in  configuration '%s/%s'\n",
-                                      iname, conf_name, sig_name);
+                               fprintf(stderr,
+                                       "Failed to find image '%s' in  configuration '%s/%s'\n",
+                                       iname, conf_name, sig_name);
                                if (allow_missing)
                                        continue;
 
@@ -875,16 +885,16 @@ static int fit_config_get_hash_list(const void *fit, int conf_noffset,
        }
 
        if (!image_count) {
-               printf("Failed to find any images for configuration '%s/%s'\n",
-                      conf_name, sig_name);
+               fprintf(stderr, "Failed to find any images for configuration '%s/%s'\n",
+                       conf_name, sig_name);
                return -ENOMSG;
        }
 
        return 0;
 
 err_mem:
-       printf("Out of memory processing configuration '%s/%s'\n", conf_name,
-              sig_name);
+       fprintf(stderr, "Out of memory processing configuration '%s/%s'\n", conf_name,
+               sig_name);
        return -ENOMEM;
 }
 
@@ -946,21 +956,21 @@ static int fit_config_get_regions(const void *fit, int conf_noffset,
                        fdt_regions, ARRAY_SIZE(fdt_regions),
                        path, sizeof(path), 1);
        if (count < 0) {
-               printf("Failed to hash configuration '%s/%s': %s\n", conf_name,
-                      sig_name, fdt_strerror(ret));
+               fprintf(stderr, "Failed to hash configuration '%s/%s': %s\n", conf_name,
+                       sig_name, fdt_strerror(ret));
                return -EIO;
        }
        if (count == 0) {
-               printf("No data to hash for configuration '%s/%s': %s\n",
-                      conf_name, sig_name, fdt_strerror(ret));
+               fprintf(stderr, "No data to hash for configuration '%s/%s': %s\n",
+                       conf_name, sig_name, fdt_strerror(ret));
                return -EINVAL;
        }
 
        /* Build our list of data blocks */
        region = fit_region_make_list(fit, fdt_regions, count, NULL);
        if (!region) {
-               printf("Out of memory hashing configuration '%s/%s'\n",
-                      conf_name, sig_name);
+               fprintf(stderr, "Out of memory hashing configuration '%s/%s'\n",
+                       conf_name, sig_name);
                return -ENOMEM;
        }
 
@@ -972,8 +982,8 @@ static int fit_config_get_regions(const void *fit, int conf_noffset,
        }
        region_prop = malloc(len);
        if (!region_prop) {
-               printf("Out of memory setting up regions for configuration '%s/%s'\n",
-                      conf_name, sig_name);
+               fprintf(stderr, "Out of memory setting up regions for configuration '%s/%s'\n",
+                       conf_name, sig_name);
                return -ENOMEM;
        }
        for (i = len = 0; i < node_inc.count;
@@ -1038,8 +1048,8 @@ static int fit_config_process_sig(const char *keydir, const char *keyfile,
                                &value_len);
        free(region);
        if (ret) {
-               printf("Failed to sign '%s' signature node in '%s' conf node\n",
-                      node_name, conf_name);
+               fprintf(stderr, "Failed to sign '%s' signature node in '%s' conf node\n",
+                       node_name, conf_name);
 
                /* We allow keys to be missing */
                if (ret == -ENOENT)
@@ -1053,8 +1063,9 @@ static int fit_config_process_sig(const char *keydir, const char *keyfile,
        if (ret) {
                if (ret == -FDT_ERR_NOSPACE)
                        return -ENOSPC;
-               printf("Can't write signature for '%s' signature node in '%s' conf node: %s\n",
-                      node_name, conf_name, fdt_strerror(ret));
+               fprintf(stderr,
+                       "Can't write signature for '%s' signature node in '%s' conf node: %s\n",
+                       node_name, conf_name, fdt_strerror(ret));
                return -1;
        }
        free(value);
@@ -1067,8 +1078,9 @@ static int fit_config_process_sig(const char *keydir, const char *keyfile,
        if (keydest) {
                ret = info.crypto->add_verify_data(&info, keydest);
                if (ret < 0) {
-                       printf("Failed to add verification data for '%s' signature node in '%s' configuration node\n",
-                              node_name, conf_name);
+                       fprintf(stderr,
+                               "Failed to add verification data for '%s' signature node in '%s' configuration node\n",
+                               node_name, conf_name);
                }
                return ret;
        }
@@ -1148,7 +1160,7 @@ static int read_pub_key(const char *keydir, const void *name,
        /* Read the certificate */
        cert = NULL;
        if (!PEM_read_X509(f, &cert, NULL, NULL)) {
-               printf("Couldn't read certificate");
+               fprintf(stderr, "Couldn't read certificate");
                ret = -EINVAL;
                goto err_cert;
        }
@@ -1156,7 +1168,7 @@ static int read_pub_key(const char *keydir, const void *name,
        /* Get the public key from the certificate. */
        key = X509_get_pubkey(cert);
        if (!key) {
-               printf("Couldn't read public key\n");
+               fprintf(stderr, "Couldn't read public key\n");
                ret = -EINVAL;
                goto err_pubkey;
        }
@@ -1164,7 +1176,7 @@ static int read_pub_key(const char *keydir, const void *name,
        /* Get DER form */
        ret = i2d_PublicKey(key, pubkey);
        if (ret < 0) {
-               printf("Couldn't get DER form\n");
+               fprintf(stderr, "Couldn't get DER form\n");
                ret = -EINVAL;
                goto err_pubkey;
        }
@@ -1203,11 +1215,11 @@ int fit_pre_load_data(const char *keydir, void *keydest, void *fit)
        /* Check that all mandatory properties are present */
        if (!algo_name || !key_name) {
                if (!algo_name)
-                       printf("The property algo-name is missing in the node %s\n",
-                              IMAGE_PRE_LOAD_PATH);
+                       fprintf(stderr, "The property algo-name is missing in the node %s\n",
+                               IMAGE_PRE_LOAD_PATH);
                if (!key_name)
-                       printf("The property key-name is missing in the node %s\n",
-                              IMAGE_PRE_LOAD_PATH);
+                       fprintf(stderr, "The property key-name is missing in the node %s\n",
+                               IMAGE_PRE_LOAD_PATH);
                ret = -EINVAL;
                goto out;
        }
@@ -1221,8 +1233,8 @@ int fit_pre_load_data(const char *keydir, void *keydest, void *fit)
        ret = fdt_setprop(keydest, pre_load_noffset, "public-key",
                          pubkey, pubkey_len);
        if (ret)
-               printf("Can't set public-key in node %s (ret = %d)\n",
-                      IMAGE_PRE_LOAD_PATH, ret);
+               fprintf(stderr, "Can't set public-key in node %s (ret = %d)\n",
+                       IMAGE_PRE_LOAD_PATH, ret);
 
  out:
        return ret;
@@ -1239,8 +1251,8 @@ int fit_cipher_data(const char *keydir, void *keydest, void *fit,
        /* Find images parent node offset */
        images_noffset = fdt_path_offset(fit, FIT_IMAGES_PATH);
        if (images_noffset < 0) {
-               printf("Can't find images parent node '%s' (%s)\n",
-                      FIT_IMAGES_PATH, fdt_strerror(images_noffset));
+               fprintf(stderr, "Can't find images parent node '%s' (%s)\n",
+                       FIT_IMAGES_PATH, fdt_strerror(images_noffset));
                return images_noffset;
        }
 
@@ -1276,8 +1288,8 @@ int fit_add_verification_data(const char *keydir, const char *keyfile,
        /* Find images parent node offset */
        images_noffset = fdt_path_offset(fit, FIT_IMAGES_PATH);
        if (images_noffset < 0) {
-               printf("Can't find images parent node '%s' (%s)\n",
-                      FIT_IMAGES_PATH, fdt_strerror(images_noffset));
+               fprintf(stderr, "Can't find images parent node '%s' (%s)\n",
+                       FIT_IMAGES_PATH, fdt_strerror(images_noffset));
                return images_noffset;
        }
 
@@ -1293,9 +1305,9 @@ int fit_add_verification_data(const char *keydir, const char *keyfile,
                                fit, noffset, comment, require_keys, engine_id,
                                cmdname, algo_name);
                if (ret) {
-                       printf("Can't add verification data for node '%s' (%s)\n",
-                              fdt_get_name(fit, noffset, NULL),
-                              fdt_strerror(ret));
+                       fprintf(stderr, "Can't add verification data for node '%s' (%s)\n",
+                               fdt_get_name(fit, noffset, NULL),
+                               fdt_strerror(ret));
                        return ret;
                }
        }
@@ -1307,8 +1319,8 @@ int fit_add_verification_data(const char *keydir, const char *keyfile,
        /* Find configurations parent node offset */
        confs_noffset = fdt_path_offset(fit, FIT_CONFS_PATH);
        if (confs_noffset < 0) {
-               printf("Can't find images parent node '%s' (%s)\n",
-                      FIT_CONFS_PATH, fdt_strerror(confs_noffset));
+               fprintf(stderr, "Can't find images parent node '%s' (%s)\n",
+                       FIT_CONFS_PATH, fdt_strerror(confs_noffset));
                return -ENOENT;
        }