From f1991bdf9743cbdf90b98331232f90d4c12bbce3 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 16 Aug 2021 07:54:10 +0200 Subject: doc: move i.MX7D/i.MX8MM A/B booting to board specific Having "i.MX7D/i.MX8MM SRC_GPR10 PERSIST_SECONDARY_BOOT for bootloader A/B switching" at the top level of the documentation tree does not make sense. Move it to board specific information. Fixes: 59e3d1bd4992 ("doc: imx: psb: Document usage of SRC_GPR10 PERSIST_SECONDARY_BOOT for A/B switching") Signed-off-by: Heinrich Schuchardt --- doc/board/freescale/index.rst | 1 + doc/board/freescale/psb.rst | 174 ++++++++++++++++++++++++++++++++++++++++++ doc/imx/index.rst | 9 --- doc/imx/misc/index.rst | 9 --- doc/imx/misc/psb.rst | 174 ------------------------------------------ doc/index.rst | 11 --- 6 files changed, 175 insertions(+), 203 deletions(-) create mode 100644 doc/board/freescale/psb.rst delete mode 100644 doc/imx/index.rst delete mode 100644 doc/imx/misc/index.rst delete mode 100644 doc/imx/misc/psb.rst diff --git a/doc/board/freescale/index.rst b/doc/board/freescale/index.rst index bddc6c6c2c7..aa192effabb 100644 --- a/doc/board/freescale/index.rst +++ b/doc/board/freescale/index.rst @@ -17,3 +17,4 @@ Freescale mx6sabresd mx6ul_14x14_evk mx6ullevk + psb diff --git a/doc/board/freescale/psb.rst b/doc/board/freescale/psb.rst new file mode 100644 index 00000000000..71ac09fac8d --- /dev/null +++ b/doc/board/freescale/psb.rst @@ -0,0 +1,174 @@ +i.MX7D/i.MX8MM SRC_GPR10 PERSIST_SECONDARY_BOOT for bootloader A/B switching +============================================================================ + +Introduction +------------ +Since at least iMX53 until iMX8MM, it is possible to have two copies of +bootloader in SD/eMMC and switch between them. The switch is triggered +either by the BootROM in case the bootloader image is faulty OR can be +enforced by the user. + +Operation +--------- + #. Upon Power-On Reset (POR) + + - SRC_GPR10 bit PERSIST_SECONDARY_BOOT is set to 0 + - BootROM attempts to start bootloader A-copy + + - if A-copy valid + + - BootROM starts A-copy + - END + + - if A-copy NOT valid + + - BootROM sets SRC_GPR10 bit PERSIST_SECONDARY_BOOT to 1 + - BootROM triggers WARM reset, GOTO 1) + - END + + #. Upon COLD Reset + + - GOTO 1) + - END + + #. Upon WARM Reset + + - SRC_GPR10 bit PERSIST_SECONDARY_BOOT is retained + + - if SRC_GPR10 bit PERSIST_SECONDARY_BOOT is 0 + + - BootROM attempts to start bootloader A-copy + + - if A-copy valid + + - BootROM starts A-copy + - END + + - if A-copy NOT valid + + - BootROM sets SRC_GPR10 bit PERSIST_SECONDARY_BOOT to 1 + - BootROM triggers WARM reset. GOTO 1.3) + - END + + - if SRC_GPR10 bit PERSIST_SECONDARY_BOOT is 1 + + - BootROM attempts to start bootloader B-copy + + - if B-copy valid + + - BootROM starts B-copy + - END + + - if B-copy NOT valid + - System hangs + - END + +Setup +----- +The bootloader A-copy must be placed at predetermined offset in SD/eMMC. The +bootloader B-copy area offset is determined by an offset stored in Secondary +Image Table (SIT). The SIT must be placed at predetermined offset in SD/eMMC. + +The following table contains offset of SIT, bootloader A-copy and recommended +bootloader B-copy offset. The offsets are in 512 Byte sector units (that is +offset 0x1 means 512 Bytes from the start of SD/eMMC card data partition). +For details on the addition of two numbers in recommended B-copy offset, see +SIT format below. + ++----------+--------------------+-----------------------+-----------------------------+ +| SoC | SIT offset (fixed) | A-copy offset (fixed) | B-copy offset (recommended) | ++----------+--------------------+-----------------------+-----------------------------+ +| iMX7D | 0x1 | 0x2 | 0x800+0x2 | ++----------+--------------------+-----------------------+-----------------------------+ +| iMX8MM | 0x41 | 0x42 | 0x1000+0x42 | ++----------+--------------------+-----------------------+-----------------------------+ + +SIT format +~~~~~~~~~~ +SIT is a 20 byte long structure containing of 5 32-bit words. Those encode +bootloader B-copy area offset (called "firstSectorNumber"), magic value +(called "tag") that is always 0x00112233, and three unused words set to 0. +SIT is documented in [1]_ and [2]_. Example SIT are below:: + + $ hexdump -vC sit-mx7d.bin + 00000000 00 00 00 00 + 00000004 00 00 00 00 + 00000008 33 22 11 00 <--- This is the "tag" + 0000000c 00 08 00 00 <--- This is the "firstSectorNumber" + 00000010 00 00 00 00 + + $ hexdump -vC sit-mx8mm.bin + 00000000 00 00 00 00 + 00000004 00 00 00 00 + 00000008 33 22 11 00 <--- This is the "tag" + 0000000c 00 10 00 00 <--- This is the "firstSectorNumber" + 00000010 00 00 00 00 + +B-copy area offset ("firstSectorNumber") is offset, in units of 512 Byte +sectors, that is added to the start of boot media when switching between +A-copy and B-copy. For A-copy, this offset is 0x0. For B-copy, this offset +is determined by SIT (e.g. if firstSectorNumber is 0x1000 as it is above +in sit-mx8mm.bin, then the B-copy offset is 0x1000 sectors = 2 MiB). + +Bootloader A-copy (e.g. u-boot.imx or flash.bin) is placed at fixed offset +from A-copy area offset (e.g. 0x2 sectors from sector 0x0 for iMX7D, which +means u-boot.imx A-copy must be written to sector 0x2). + +The same applies to bootloader B-copy, which is placed at fixed offset from +B-copy area offset determined by SIT (e.g. 0x2 sectors from sector 0x800 [see +sit-mx7d.bin example above, this can be changed in SIT firstSectorNumber] for +iMX7D, which means u-boot.imx B-copy must be written to sector 0x802) + +**WARNING:** +B-copy area offset ("firstSectorNumber") is NOT equal to bootloader +(image, which is u-boot.imx or flash.bin) B-copy offset. + +To generate SIT, use for example the following bourne shell printf command:: + +$ printf '\x0\x0\x0\x0\x0\x0\x0\x0\x33\x22\x11\x00\x00\x08\x00\x00\x0\x0\x0\x0' > sit-mx7d.bin +$ printf '\x0\x0\x0\x0\x0\x0\x0\x0\x33\x22\x11\x00\x00\x10\x00\x00\x0\x0\x0\x0' > sit-mx8mm.bin + +Write bootloader A/B copy and SIT to SD/eMMC +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Examples of writing SIT and two copies of bootloader to SD or eMMC: + +- iMX8MM, SD card at /dev/sdX, Linux command line + :: + + $ dd if=sit-mx8mm.bin of=/dev/sdX bs=512 seek=65 + $ dd if=flash.bin of=/dev/sdX bs=512 seek=66 + $ dd if=flash.bin of=/dev/sdX bs=512 seek=4162 + +- iMX8MM, eMMC 1 data partition, U-Boot command line + :: + + => mmc partconf 1 0 0 0 + + => dhcp ${loadaddr} sit-mx8mm.bin + => mmc dev 1 + => mmc write ${loadaddr} 0x41 0x1 + + => dhcp ${loadaddr} flash.bin + => setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200 + => mmc dev 1 + => mmc write ${loadaddr} 0x42 ${blkcnt} + => mmc write ${loadaddr} 0x1042 ${blkcnt} + +WARM reset into B-copy using WDT +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +To perform a reboot into B-copy, the PERSIST_SECONDARY_BOOT must be set +in SRC_GPR0 register. Example on iMX8MM:: + + => mw 0x30390098 0x40000000 + +A WARM reset can be triggered using WDT as follows:: + + => mw.w 0x30280000 0x25 + +References +---------- + +.. [1] i.MX 7Dual Applications Processor Reference Manual, Rev. 1, 01/2018 ; section 6.6.5.3.5 Redundant boot support for expansion device +.. [2] i.MX 8M Mini Applications Processor Reference Manual, Rev. 3, 11/2020 ; section 6.1.5.4.5 Redundant boot support for expansion device diff --git a/doc/imx/index.rst b/doc/imx/index.rst deleted file mode 100644 index b225b1d1837..00000000000 --- a/doc/imx/index.rst +++ /dev/null @@ -1,9 +0,0 @@ -.. SPDX-License-Identifier: GPL-2.0+ - -NXP i.MX Machine-specific doc -============================= - -.. toctree:: - :maxdepth: 2 - - misc/index diff --git a/doc/imx/misc/index.rst b/doc/imx/misc/index.rst deleted file mode 100644 index 85fbdb6588f..00000000000 --- a/doc/imx/misc/index.rst +++ /dev/null @@ -1,9 +0,0 @@ -.. SPDX-License-Identifier: GPL-2.0+ - -Miscellaneous -============= - -.. toctree:: - :maxdepth: 2 - - psb diff --git a/doc/imx/misc/psb.rst b/doc/imx/misc/psb.rst deleted file mode 100644 index 71ac09fac8d..00000000000 --- a/doc/imx/misc/psb.rst +++ /dev/null @@ -1,174 +0,0 @@ -i.MX7D/i.MX8MM SRC_GPR10 PERSIST_SECONDARY_BOOT for bootloader A/B switching -============================================================================ - -Introduction ------------- -Since at least iMX53 until iMX8MM, it is possible to have two copies of -bootloader in SD/eMMC and switch between them. The switch is triggered -either by the BootROM in case the bootloader image is faulty OR can be -enforced by the user. - -Operation ---------- - #. Upon Power-On Reset (POR) - - - SRC_GPR10 bit PERSIST_SECONDARY_BOOT is set to 0 - - BootROM attempts to start bootloader A-copy - - - if A-copy valid - - - BootROM starts A-copy - - END - - - if A-copy NOT valid - - - BootROM sets SRC_GPR10 bit PERSIST_SECONDARY_BOOT to 1 - - BootROM triggers WARM reset, GOTO 1) - - END - - #. Upon COLD Reset - - - GOTO 1) - - END - - #. Upon WARM Reset - - - SRC_GPR10 bit PERSIST_SECONDARY_BOOT is retained - - - if SRC_GPR10 bit PERSIST_SECONDARY_BOOT is 0 - - - BootROM attempts to start bootloader A-copy - - - if A-copy valid - - - BootROM starts A-copy - - END - - - if A-copy NOT valid - - - BootROM sets SRC_GPR10 bit PERSIST_SECONDARY_BOOT to 1 - - BootROM triggers WARM reset. GOTO 1.3) - - END - - - if SRC_GPR10 bit PERSIST_SECONDARY_BOOT is 1 - - - BootROM attempts to start bootloader B-copy - - - if B-copy valid - - - BootROM starts B-copy - - END - - - if B-copy NOT valid - - System hangs - - END - -Setup ------ -The bootloader A-copy must be placed at predetermined offset in SD/eMMC. The -bootloader B-copy area offset is determined by an offset stored in Secondary -Image Table (SIT). The SIT must be placed at predetermined offset in SD/eMMC. - -The following table contains offset of SIT, bootloader A-copy and recommended -bootloader B-copy offset. The offsets are in 512 Byte sector units (that is -offset 0x1 means 512 Bytes from the start of SD/eMMC card data partition). -For details on the addition of two numbers in recommended B-copy offset, see -SIT format below. - -+----------+--------------------+-----------------------+-----------------------------+ -| SoC | SIT offset (fixed) | A-copy offset (fixed) | B-copy offset (recommended) | -+----------+--------------------+-----------------------+-----------------------------+ -| iMX7D | 0x1 | 0x2 | 0x800+0x2 | -+----------+--------------------+-----------------------+-----------------------------+ -| iMX8MM | 0x41 | 0x42 | 0x1000+0x42 | -+----------+--------------------+-----------------------+-----------------------------+ - -SIT format -~~~~~~~~~~ -SIT is a 20 byte long structure containing of 5 32-bit words. Those encode -bootloader B-copy area offset (called "firstSectorNumber"), magic value -(called "tag") that is always 0x00112233, and three unused words set to 0. -SIT is documented in [1]_ and [2]_. Example SIT are below:: - - $ hexdump -vC sit-mx7d.bin - 00000000 00 00 00 00 - 00000004 00 00 00 00 - 00000008 33 22 11 00 <--- This is the "tag" - 0000000c 00 08 00 00 <--- This is the "firstSectorNumber" - 00000010 00 00 00 00 - - $ hexdump -vC sit-mx8mm.bin - 00000000 00 00 00 00 - 00000004 00 00 00 00 - 00000008 33 22 11 00 <--- This is the "tag" - 0000000c 00 10 00 00 <--- This is the "firstSectorNumber" - 00000010 00 00 00 00 - -B-copy area offset ("firstSectorNumber") is offset, in units of 512 Byte -sectors, that is added to the start of boot media when switching between -A-copy and B-copy. For A-copy, this offset is 0x0. For B-copy, this offset -is determined by SIT (e.g. if firstSectorNumber is 0x1000 as it is above -in sit-mx8mm.bin, then the B-copy offset is 0x1000 sectors = 2 MiB). - -Bootloader A-copy (e.g. u-boot.imx or flash.bin) is placed at fixed offset -from A-copy area offset (e.g. 0x2 sectors from sector 0x0 for iMX7D, which -means u-boot.imx A-copy must be written to sector 0x2). - -The same applies to bootloader B-copy, which is placed at fixed offset from -B-copy area offset determined by SIT (e.g. 0x2 sectors from sector 0x800 [see -sit-mx7d.bin example above, this can be changed in SIT firstSectorNumber] for -iMX7D, which means u-boot.imx B-copy must be written to sector 0x802) - -**WARNING:** -B-copy area offset ("firstSectorNumber") is NOT equal to bootloader -(image, which is u-boot.imx or flash.bin) B-copy offset. - -To generate SIT, use for example the following bourne shell printf command:: - -$ printf '\x0\x0\x0\x0\x0\x0\x0\x0\x33\x22\x11\x00\x00\x08\x00\x00\x0\x0\x0\x0' > sit-mx7d.bin -$ printf '\x0\x0\x0\x0\x0\x0\x0\x0\x33\x22\x11\x00\x00\x10\x00\x00\x0\x0\x0\x0' > sit-mx8mm.bin - -Write bootloader A/B copy and SIT to SD/eMMC -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Examples of writing SIT and two copies of bootloader to SD or eMMC: - -- iMX8MM, SD card at /dev/sdX, Linux command line - :: - - $ dd if=sit-mx8mm.bin of=/dev/sdX bs=512 seek=65 - $ dd if=flash.bin of=/dev/sdX bs=512 seek=66 - $ dd if=flash.bin of=/dev/sdX bs=512 seek=4162 - -- iMX8MM, eMMC 1 data partition, U-Boot command line - :: - - => mmc partconf 1 0 0 0 - - => dhcp ${loadaddr} sit-mx8mm.bin - => mmc dev 1 - => mmc write ${loadaddr} 0x41 0x1 - - => dhcp ${loadaddr} flash.bin - => setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200 - => mmc dev 1 - => mmc write ${loadaddr} 0x42 ${blkcnt} - => mmc write ${loadaddr} 0x1042 ${blkcnt} - -WARM reset into B-copy using WDT -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -To perform a reboot into B-copy, the PERSIST_SECONDARY_BOOT must be set -in SRC_GPR0 register. Example on iMX8MM:: - - => mw 0x30390098 0x40000000 - -A WARM reset can be triggered using WDT as follows:: - - => mw.w 0x30280000 0x25 - -References ----------- - -.. [1] i.MX 7Dual Applications Processor Reference Manual, Rev. 1, 01/2018 ; section 6.6.5.3.5 Redundant boot support for expansion device -.. [2] i.MX 8M Mini Applications Processor Reference Manual, Rev. 3, 11/2020 ; section 6.1.5.4.5 Redundant boot support for expansion device diff --git a/doc/index.rst b/doc/index.rst index 8066fcbfc0b..02de1d46842 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -64,17 +64,6 @@ implementation. arch/index -Machine-specific doc --------------------- - -These books provide programming details about machine-specific -implementation. - -.. toctree:: - :maxdepth: 2 - - imx/index - Board-specific doc ------------------ -- cgit v1.2.3 From 49dae655896cbe13802282959d2fef785f33c608 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 16 Aug 2021 08:18:37 +0200 Subject: doc: rename Freescale to NXP Freescale Semiconductor, Inc. was merged into NXP Semiconductors in 2015. Signed-off-by: Heinrich Schuchardt --- doc/board/freescale/imx8mm_evk.rst | 57 ----------- doc/board/freescale/imx8mn_evk.rst | 58 ----------- doc/board/freescale/imx8mp_evk.rst | 61 ----------- doc/board/freescale/imx8mq_evk.rst | 56 ---------- doc/board/freescale/imx8qxp_mek.rst | 66 ------------ doc/board/freescale/imxrt1020-evk.rst | 41 -------- doc/board/freescale/imxrt1050-evk.rst | 41 -------- doc/board/freescale/index.rst | 20 ---- doc/board/freescale/mx6sabreauto.rst | 100 ------------------ doc/board/freescale/mx6sabresd.rst | 132 ------------------------ doc/board/freescale/mx6ul_14x14_evk.rst | 98 ------------------ doc/board/freescale/mx6ullevk.rst | 47 --------- doc/board/freescale/psb.rst | 174 -------------------------------- doc/board/index.rst | 2 +- doc/board/nxp/imx8mm_evk.rst | 57 +++++++++++ doc/board/nxp/imx8mn_evk.rst | 58 +++++++++++ doc/board/nxp/imx8mp_evk.rst | 61 +++++++++++ doc/board/nxp/imx8mq_evk.rst | 56 ++++++++++ doc/board/nxp/imx8qxp_mek.rst | 66 ++++++++++++ doc/board/nxp/imxrt1020-evk.rst | 41 ++++++++ doc/board/nxp/imxrt1050-evk.rst | 41 ++++++++ doc/board/nxp/index.rst | 20 ++++ doc/board/nxp/mx6sabreauto.rst | 100 ++++++++++++++++++ doc/board/nxp/mx6sabresd.rst | 132 ++++++++++++++++++++++++ doc/board/nxp/mx6ul_14x14_evk.rst | 98 ++++++++++++++++++ doc/board/nxp/mx6ullevk.rst | 47 +++++++++ doc/board/nxp/psb.rst | 174 ++++++++++++++++++++++++++++++++ 27 files changed, 952 insertions(+), 952 deletions(-) delete mode 100644 doc/board/freescale/imx8mm_evk.rst delete mode 100644 doc/board/freescale/imx8mn_evk.rst delete mode 100644 doc/board/freescale/imx8mp_evk.rst delete mode 100644 doc/board/freescale/imx8mq_evk.rst delete mode 100644 doc/board/freescale/imx8qxp_mek.rst delete mode 100644 doc/board/freescale/imxrt1020-evk.rst delete mode 100644 doc/board/freescale/imxrt1050-evk.rst delete mode 100644 doc/board/freescale/index.rst delete mode 100644 doc/board/freescale/mx6sabreauto.rst delete mode 100644 doc/board/freescale/mx6sabresd.rst delete mode 100644 doc/board/freescale/mx6ul_14x14_evk.rst delete mode 100644 doc/board/freescale/mx6ullevk.rst delete mode 100644 doc/board/freescale/psb.rst create mode 100644 doc/board/nxp/imx8mm_evk.rst create mode 100644 doc/board/nxp/imx8mn_evk.rst create mode 100644 doc/board/nxp/imx8mp_evk.rst create mode 100644 doc/board/nxp/imx8mq_evk.rst create mode 100644 doc/board/nxp/imx8qxp_mek.rst create mode 100644 doc/board/nxp/imxrt1020-evk.rst create mode 100644 doc/board/nxp/imxrt1050-evk.rst create mode 100644 doc/board/nxp/index.rst create mode 100644 doc/board/nxp/mx6sabreauto.rst create mode 100644 doc/board/nxp/mx6sabresd.rst create mode 100644 doc/board/nxp/mx6ul_14x14_evk.rst create mode 100644 doc/board/nxp/mx6ullevk.rst create mode 100644 doc/board/nxp/psb.rst diff --git a/doc/board/freescale/imx8mm_evk.rst b/doc/board/freescale/imx8mm_evk.rst deleted file mode 100644 index 7fd3d725649..00000000000 --- a/doc/board/freescale/imx8mm_evk.rst +++ /dev/null @@ -1,57 +0,0 @@ -.. SPDX-License-Identifier: GPL-2.0+ - -imx8mm_evk -========== - -U-Boot for the NXP i.MX8MM EVK board - -Quick Start ------------ - -- Build the ARM Trusted firmware binary -- Get ddr firmware -- Build U-Boot -- Boot - -Get and Build the ARM Trusted firmware --------------------------------------- - -Note: builddir is U-Boot build directory (source directory for in-tree builds) -Get ATF from: https://source.codeaurora.org/external/imx/imx-atf -branch: imx_5.4.47_2.2.0 - -.. code-block:: bash - - $ make PLAT=imx8mm bl31 - $ cp build/imx8mm/release/bl31.bin $(builddir) - -Get the ddr firmware --------------------- - -.. code-block:: bash - - $ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.9.bin - $ chmod +x firmware-imx-8.9.bin - $ ./firmware-imx-8.9 - $ cp firmware-imx-8.9/firmware/ddr/synopsys/lpddr4*.bin $(builddir) - -Build U-Boot ------------- - -.. code-block:: bash - - $ export CROSS_COMPILE=aarch64-poky-linux- - $ make imx8mm_evk_defconfig - $ export ATF_LOAD_ADDR=0x920000 - $ make - -Burn the flash.bin to MicroSD card offset 33KB: - -.. code-block:: bash - - $sudo dd if=flash.bin of=/dev/sd[x] bs=1024 seek=33 conv=notrunc - $sudo dd if=u-boot.itb of=/dev/sdc bs=1024 seek=384 conv=sync - -Boot ----- -Set Boot switch to SD boot diff --git a/doc/board/freescale/imx8mn_evk.rst b/doc/board/freescale/imx8mn_evk.rst deleted file mode 100644 index 9fbb947032b..00000000000 --- a/doc/board/freescale/imx8mn_evk.rst +++ /dev/null @@ -1,58 +0,0 @@ -.. SPDX-License-Identifier: GPL-2.0+ - -imx8mn_evk -========== - -U-Boot for the NXP i.MX8MN EVK board - -Quick Start ------------ - -- Build the ARM Trusted firmware binary -- Get firmware-imx package -- Build U-Boot -- Boot - -Get and Build the ARM Trusted firmware --------------------------------------- - -Note: srctree is U-Boot source directory -Get ATF from: https://source.codeaurora.org/external/imx/imx-atf -branch: imx_5.4.47_2.2.0 - -.. code-block:: bash - - $ make PLAT=imx8mn bl31 - $ cp build/imx8mn/release/bl31.bin $(srctree) - -Get the ddr firmware --------------------- - -.. code-block:: bash - - $ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.9.bin - $ chmod +x firmware-imx-8.9.bin - $ ./firmware-imx-8.9 - $ cp firmware-imx-8.9/firmware/ddr/synopsys/ddr4*.bin $(srctree) - -Build U-Boot ------------- - -.. code-block:: bash - - $ export CROSS_COMPILE=aarch64-poky-linux- - $ make imx8mn_ddr4_evk_defconfig - $ export ATF_LOAD_ADDR=0x960000 - $ make - -Burn the flash.bin to MicroSD card offset 32KB: - -.. code-block:: bash - - $sudo dd if=flash.bin of=/dev/sd[x] bs=1024 seek=32 conv=notrunc - $sudo dd if=u-boot.itb of=/dev/sd[x] bs=1024 seek=384 conv=notrunc - -Boot ----- - -Set Boot switch to SD boot diff --git a/doc/board/freescale/imx8mp_evk.rst b/doc/board/freescale/imx8mp_evk.rst deleted file mode 100644 index 609a29f3ebc..00000000000 --- a/doc/board/freescale/imx8mp_evk.rst +++ /dev/null @@ -1,61 +0,0 @@ -.. SPDX-License-Identifier: GPL-2.0+ - -imx8mp_evk -========== - -U-Boot for the NXP i.MX8MP EVK board - -Quick Start ------------ - -- Build the ARM Trusted firmware binary -- Get the firmware-imx package -- Build U-Boot -- Boot - -Get and Build the ARM Trusted firmware --------------------------------------- - -Get ATF from: https://source.codeaurora.org/external/imx/imx-atf -branch: imx_5.4.70_2.3.0 - -.. code-block:: bash - - $ make PLAT=imx8mp bl31 - -Get the ddr firmware --------------------- - -.. code-block:: bash - - $ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.10.bin - $ chmod +x firmware-imx-8.10.bin - $ ./firmware-imx-8.10.bin - -Build U-Boot ------------- - -.. code-block:: bash - - $ export CROSS_COMPILE=aarch64-poky-linux- - $ make O=build imx8mp_evk_defconfig - $ cp ../imx-atf/build/imx8mp/release/bl31.bin ./build/bl31.bin - $ cp ../firmware-imx-8.10/firmware/ddr/synopsys/lpddr4_pmu_train_1d_dmem_202006.bin ./build/ - $ cp ../firmware-imx-8.10/firmware/ddr/synopsys/lpddr4_pmu_train_1d_imem_202006.bin ./build/ - $ cp ../firmware-imx-8.10/firmware/ddr/synopsys/lpddr4_pmu_train_2d_dmem_202006.bin ./build/ - $ cp ../firmware-imx-8.10/firmware/ddr/synopsys/lpddr4_pmu_train_2d_imem_202006.bin ./build/ - $ export ATF_LOAD_ADDR=0x970000 - $ make O=build - -Burn the flash.bin to the MicroSD card at offset 32KB: - -.. code-block:: bash - - $sudo dd if=build/flash.bin of=/dev/sd[x] bs=1K seek=32 conv=notrunc; sync - $sudo dd if=build/u-boot.itb of=/dev/sd[x] bs=1K seek=384 conv=notrunc; sync - -Boot ----- - -Set Boot switch to SD boot -Use /dev/ttyUSB2 for U-Boot console diff --git a/doc/board/freescale/imx8mq_evk.rst b/doc/board/freescale/imx8mq_evk.rst deleted file mode 100644 index c269fdebe30..00000000000 --- a/doc/board/freescale/imx8mq_evk.rst +++ /dev/null @@ -1,56 +0,0 @@ -.. SPDX-License-Identifier: GPL-2.0+ - -imx8mq_evk -========== - -U-Boot for the NXP i.MX8MQ EVK board - -Quick Start ------------ - -- Build the ARM Trusted firmware binary -- Get ddr and hdmi fimware -- Build U-Boot -- Boot - -Get and Build the ARM Trusted firmware --------------------------------------- - -Note: srctree is U-Boot source directory -Get ATF from: https://source.codeaurora.org/external/imx/imx-atf -branch: imx_5.4.47_2.2.0 - -.. code-block:: bash - - $ make PLAT=imx8mq bl31 - $ cp build/imx8mq/release/bl31.bin $(builddir) - -Get the ddr and hdmi firmware ------------------------------ - -.. code-block:: bash - - $ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.9.bin - $ chmod +x firmware-imx-8.9.bin - $ ./firmware-imx-8.9.bin - $ cp firmware-imx-8.9/firmware/hdmi/cadence/signed_hdmi_imx8m.bin $(builddir) - $ cp firmware-imx-8.9/firmware/ddr/synopsys/lpddr4*.bin $(builddir) - -Build U-Boot ------------- - -.. code-block:: bash - - $ export CROSS_COMPILE=aarch64-poky-linux- - $ make imx8mq_evk_defconfig - $ make flash.bin - -Burn the flash.bin to MicroSD card offset 33KB: - -.. code-block:: bash - - $sudo dd if=flash.bin of=/dev/sd[x] bs=1024 seek=33 conv=notrunc - -Boot ----- -Set Boot switch SW801: 1100 and Bmode: 10 to boot from Micro SD. diff --git a/doc/board/freescale/imx8qxp_mek.rst b/doc/board/freescale/imx8qxp_mek.rst deleted file mode 100644 index 215627cfa6d..00000000000 --- a/doc/board/freescale/imx8qxp_mek.rst +++ /dev/null @@ -1,66 +0,0 @@ -.. SPDX-License-Identifier: GPL-2.0+ - -imx8qxp_mek -=========== - -U-Boot for the NXP i.MX8QXP EVK board - -Quick Start ------------ - -- Build the ARM Trusted firmware binary -- Get scfw_tcm.bin and ahab-container.img -- Build U-Boot -- Flash the binary into the SD card -- Boot - -Get and Build the ARM Trusted firmware --------------------------------------- - -.. code-block:: bash - - $ git clone https://source.codeaurora.org/external/imx/imx-atf - $ cd imx-atf/ - $ git checkout origin/imx_4.19.35_1.1.0 -b imx_4.19.35_1.1.0 - $ make PLAT=imx8qx bl31 - -Get scfw_tcm.bin and ahab-container.img ---------------------------------------- - -.. code-block:: bash - - $ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/imx-sc-firmware-1.2.7.1.bin - $ chmod +x imx-sc-firmware-1.2.7.1.bin - $ ./imx-sc-firmware-1.2.7.1.bin - $ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/imx-seco-2.3.1.bin - $ chmod +x imx-seco-2.3.1.bin - $ ./imx-seco-2.3.1.bin - -Copy the following binaries to U-Boot folder: - -.. code-block:: bash - - $ cp imx-atf/build/imx8qx/release/bl31.bin . - $ cp imx-seco-2.3.1/firmware/seco/mx8qx-ahab-container.img ./ahab-container.img - $ cp imx-sc-firmware-1.2.7.1/mx8qx-mek-scfw-tcm.bin . - -Build U-Boot ------------- - -.. code-block:: bash - - $ make imx8qxp_mek_defconfig - $ make flash.bin - -Flash the binary into the SD card ---------------------------------- - -Burn the flash.bin binary to SD card offset 32KB: - -.. code-block:: bash - - $ sudo dd if=flash.bin of=/dev/sd[x] bs=1024 seek=32 conv=notrunc - -Boot ----- -Set Boot switch SW2: 1100. diff --git a/doc/board/freescale/imxrt1020-evk.rst b/doc/board/freescale/imxrt1020-evk.rst deleted file mode 100644 index 267f80c5170..00000000000 --- a/doc/board/freescale/imxrt1020-evk.rst +++ /dev/null @@ -1,41 +0,0 @@ -.. SPDX-License-Identifier: GPL-2.0+ - -imxrt1020-evk -============= - -How to use U-Boot on NXP i.MXRT1020 EVK ---------------------------------------- - -- Build U-Boot for i.MXRT1020 EVK: - -.. code-block:: bash - - $ make mrproper - $ make imxrt1020-evk_defconfig - $ make - -This will generate the SPL image called SPL and the u-boot.img. - -- Flash the SPL image into the micro SD card: - -.. code-block:: bash - - $sudo dd if=SPL of=/dev/sdX bs=1k seek=1 conv=notrunc; sync - -- Flash the u-boot.img image into the micro SD card: - -.. code-block:: bash - - $sudo dd if=u-boot.img of=/dev/sdX bs=1k seek=128 conv=notrunc; sync - -- Jumper settings:: - - SW8: 0 1 1 0 - -where 0 means bottom position and 1 means top position (from the -switch label numbers reference). - -- Connect the USB cable between the EVK and the PC for the console. - The USB console connector is the one close the ethernet connector - -- Insert the micro SD card in the board, power it up and U-Boot messages should come up. diff --git a/doc/board/freescale/imxrt1050-evk.rst b/doc/board/freescale/imxrt1050-evk.rst deleted file mode 100644 index c1fb48f0cdd..00000000000 --- a/doc/board/freescale/imxrt1050-evk.rst +++ /dev/null @@ -1,41 +0,0 @@ -.. SPDX-License-Identifier: GPL-2.0+ - -imxrt1050-evk -============= - -How to use U-Boot on NXP i.MXRT1050 EVK ---------------------------------------- - -- Build U-Boot for i.MXRT1050 EVK: - -.. code-block:: bash - - $ make mrproper - $ make imxrt1050-evk_defconfig - $ make - -This will generate the SPL image called SPL and the u-boot.img. - -- Flash the SPL image into the micro SD card: - -.. code-block:: bash - - $sudo dd if=SPL of=/dev/sdX bs=1k seek=1 conv=notrunc; sync - -- Flash the u-boot.img image into the micro SD card: - -.. code-block:: bash - - $sudo dd if=u-boot.img of=/dev/sdX bs=1k seek=128 conv=notrunc; sync - -- Jumper settings:: - - SW7: 1 0 1 0 - -where 0 means bottom position and 1 means top position (from the -switch label numbers reference). - -- Connect the USB cable between the EVK and the PC for the console. - The USB console connector is the one close the ethernet connector - -- Insert the micro SD card in the board, power it up and U-Boot messages should come up. diff --git a/doc/board/freescale/index.rst b/doc/board/freescale/index.rst deleted file mode 100644 index aa192effabb..00000000000 --- a/doc/board/freescale/index.rst +++ /dev/null @@ -1,20 +0,0 @@ -.. SPDX-License-Identifier: GPL-2.0+ - -Freescale -========= - -.. toctree:: - :maxdepth: 2 - - imx8mm_evk - imx8mn_evk - imx8mp_evk - imx8mq_evk - imx8qxp_mek - imxrt1020-evk - imxrt1050-evk - mx6sabreauto - mx6sabresd - mx6ul_14x14_evk - mx6ullevk - psb diff --git a/doc/board/freescale/mx6sabreauto.rst b/doc/board/freescale/mx6sabreauto.rst deleted file mode 100644 index fe4cd9d2141..00000000000 --- a/doc/board/freescale/mx6sabreauto.rst +++ /dev/null @@ -1,100 +0,0 @@ -.. SPDX-License-Identifier: GPL-2.0+ - -mx6sabreauto -============ - -How to use and build U-Boot on mx6sabreauto -------------------------------------------- - -mx6sabreauto_defconfig target supports mx6q/mx6dl/mx6qp sabreauto variants. - -In order to build it: - -.. code-block:: bash - - $ make mx6sabreauto_defconfig - $ make - -This will generate the SPL and u-boot-dtb.img binaries. - -- Flash the SPL binary into the SD card: - -.. code-block:: bash - - $ sudo dd if=SPL of=/dev/sdX bs=1K seek=1 conv=notrunc && sync - -- Flash the u-boot-dtb.img binary into the SD card: - -.. code-block:: bash - - $ sudo dd if=u-boot-dtb.img of=/dev/sdX bs=1K seek=69 conv=notrunc && sync - -Booting via Falcon mode ------------------------ - -Write in mx6sabreauto_defconfig the following define below: - -CONFIG_SPL_OS_BOOT=y - -In order to build it: - -.. code-block:: bash - - $ make mx6sabreauto_defconfig - $ make - -This will generate the SPL image called SPL and the u-boot-dtb.img. - -- Flash the SPL image into the SD card: - -.. code-block:: bash - - $ sudo dd if=SPL of=/dev/sdb bs=1K seek=1 conv=notrunc && sync - -- Flash the u-boot-dtb.img image into the SD card: - -.. code-block:: bash - - $ sudo dd if=u-boot-dtb.img of=/dev/sdb bs=1K seek=69 conv=notrunc && sync - -Create a FAT16 boot partition to store uImage and the dtb file, then copy the files there: - -.. code-block:: bash - - $ sudo cp uImage /media/boot - $ sudo cp imx6dl-sabreauto.dtb /media/boot - -Create a partition for root file system and extract it there: - -.. code-block:: bash - - $ sudo tar xvf rootfs.tar.gz -C /media/root - -The SD card must have enough space for raw "args" and "kernel". -To configure Falcon mode for the first time, on U-Boot do the following commands: - -- Load dtb file from boot partition:: - - # load mmc 0:1 ${fdt_addr} imx6dl-sabreauto.dtb - -- Load kernel image from boot partition:: - - # load mmc 0:1 ${loadaddr} uImage - -- Write kernel at 2MB offset:: - - # mmc write ${loadaddr} 0x1000 0x4000 - -- Setup kernel bootargs:: - - # setenv bootargs "console=ttymxc3,115200 root=/dev/mmcblk0p1 rootfstype=ext4 rootwait quiet rw" - -- Prepare args:: - - # spl export fdt ${loadaddr} - ${fdt_addr} - -- Write args 1MB data (0x800 sectors) to 1MB offset (0x800 sectors):: - - # mmc write 18000000 0x800 0x800 - -- Restart the board and then SPL binary will launch the kernel directly. diff --git a/doc/board/freescale/mx6sabresd.rst b/doc/board/freescale/mx6sabresd.rst deleted file mode 100644 index fe15ba7b798..00000000000 --- a/doc/board/freescale/mx6sabresd.rst +++ /dev/null @@ -1,132 +0,0 @@ -.. SPDX-License-Identifier: GPL-2.0+ - -mx6sabresd -========== - -How to use and build U-Boot on mx6sabresd ------------------------------------------ - -The following methods can be used for booting mx6sabresd boards: - -1. Booting from SD card - -2. Booting from eMMC - -3. Booting via Falcon mode (SPL launches the kernel directly) - - -1. Booting from SD card via SPL -------------------------------- - -mx6sabresd_defconfig target supports mx6q/mx6dl/mx6qp sabresd variants. - -In order to build it: - -.. code-block:: bash - - $ make mx6sabresd_defconfig - $ make - -This will generate the SPL and u-boot-dtb.img binaries. - -- Flash the SPL binary into the SD card: - -.. code-block:: bash - - $ sudo dd if=SPL of=/dev/sdX bs=1K seek=1 conv=notrunc && sync - -- Flash the u-boot-dtb.img binary into the SD card: - -.. code-block:: bash - - $ sudo dd if=u-boot-dtb.img of=/dev/sdX bs=1K seek=69 conv=notrunc && sync - -2. Booting from eMMC --------------------- - -.. code-block:: bash - - $ make mx6sabresd_defconfig - $ make - -This will generate the SPL and u-boot-dtb.img binaries. - -- Boot first from SD card as shown in the previous section - -In U-boot change the eMMC partition config:: - - => mmc partconf 2 1 0 0 - -Mount the eMMC in the host PC:: - - => ums 0 mmc 2 - -- Flash SPL and u-boot-dtb.img binaries into the eMMC: - -.. code-block:: bash - - $ sudo dd if=SPL of=/dev/sdX bs=1K seek=1 conv=notrunc && sync - $ sudo dd if=u-boot-dtb.img of=/dev/sdX bs=1K seek=69 conv=notrunc && sync - -Set SW6 to eMMC 8-bit boot: 11010110 - -3. Booting via Falcon mode --------------------------- - -.. code-block:: bash - - $ make mx6sabresd_defconfig - $ make - -This will generate the SPL image called SPL and the u-boot-dtb.img. - -- Flash the SPL image into the SD card - -.. code-block:: bash - - $ sudo dd if=SPL of=/dev/sdX bs=1K seek=1 oflag=sync status=none conv=notrunc && sync - -- Flash the u-boot-dtb.img image into the SD card - -.. code-block:: bash - - $ sudo dd if=u-boot-dtb.img of=/dev/sdX bs=1K seek=69 oflag=sync status=none conv=notrunc && sync - -Create a partition for root file system and extract it there - -.. code-block:: bash - - $ sudo tar xvf rootfs.tar.gz -C /media/root - -The SD card must have enough space for raw "args" and "kernel". -To configure Falcon mode for the first time, on U-Boot do the following commands: - -- Setup the IP server:: - - # setenv serverip - -- Download dtb file:: - - # dhcp ${fdt_addr} imx6q-sabresd.dtb - -- Download kernel image:: - - # dhcp ${loadaddr} uImage - -- Write kernel at 2MB offset:: - - # mmc write ${loadaddr} 0x1000 0x4000 - -- Setup kernel bootargs:: - - # setenv bootargs "console=ttymxc0,115200 root=/dev/mmcblk1p1 rootfstype=ext4 rootwait quiet rw" - -- Prepare args:: - - # spl export fdt ${loadaddr} - ${fdt_addr} - -- Write args 1MB data (0x800 sectors) to 1MB offset (0x800 sectors):: - - # mmc write 18000000 0x800 0x800 - -- Press KEY_VOL_UP key, power up the board and then SPL binary will launch the kernel directly. diff --git a/doc/board/freescale/mx6ul_14x14_evk.rst b/doc/board/freescale/mx6ul_14x14_evk.rst deleted file mode 100644 index 8298bf8e1e7..00000000000 --- a/doc/board/freescale/mx6ul_14x14_evk.rst +++ /dev/null @@ -1,98 +0,0 @@ -.. SPDX-License-Identifier: GPL-2.0+ - -mx6ul_14x14_evk -=============== - -How to use U-Boot on Freescale MX6UL 14x14 EVK ------------------------------------------------ - -- Build U-Boot for MX6UL 14x14 EVK: - -.. code-block:: bash - - $ make mrproper - $ make mx6ul_14x14_evk_defconfig - $ make - -This will generate the SPL image called SPL and the u-boot.img. - -1. Booting via SDCard ---------------------- - -- Flash the SPL image into the micro SD card: - -.. code-block:: bash - - sudo dd if=SPL of=/dev/mmcblk0 bs=1k seek=1 conv=notrunc; sync - -- Flash the u-boot.img image into the micro SD card: - -.. code-block:: bash - - sudo dd if=u-boot.img of=/dev/mmcblk0 bs=1k seek=69 conv=notrunc; sync - -- Jumper settings:: - - SW601: 0 0 1 0 - Sw602: 1 0 - -where 0 means bottom position and 1 means top position (from the -switch label numbers reference). - -- Connect the USB cable between the EVK and the PC for the console. - The USB console connector is the one close the push buttons - -- Insert the micro SD card in the board, power it up and U-Boot messages should come up. - -2. Booting via Serial Download Protocol (SDP) ---------------------------------------------- - -The mx6ulevk board can boot from USB OTG port using the SDP, target will -enter in SDP mode in case an SD Card is not connect or boot switches are -set as below:: - - Sw602: 0 1 - SW601: x x x x - -The following tools can be used to boot via SDP, for both tools you must -connect an USB cable in USB OTG port. - -- Method 1: Universal Update Utility (uuu) - -The UUU binary can be downloaded in release tab from link below: -https://github.com/NXPmicro/mfgtools - -The following script should be created to boot SPL + u-boot-dtb.img binaries: - -.. code-block:: bash - - $ cat uuu_script - uuu_version 1.1.4 - - SDP: boot -f SPL - SDPU: write -f u-boot-dtb.img -addr 0x877fffc0 - SDPU: jump -addr 0x877fffc0 - SDPU: done - -Please note that the address above is calculated based on SYS_TEXT_BASE address: - -0x877fffc0 = 0x87800000 (SYS_TEXT_BASE) - 0x40 (U-Boot proper Header size) - -Power on the target and run the following command from U-Boot root directory: - -.. code-block:: bash - - $ sudo ./uuu uuu_script - -- Method 2: imx usb loader tool (imx_usb): - -The imx_usb_loader tool can be downloaded in link below: -https://github.com/boundarydevices/imx_usb_loader - -Build the source code and run the following commands from U-Boot root -directory: - -.. code-block:: bash - - $ sudo ./imx_usb SPL - $ sudo ./imx_usb u-boot-dtb.img diff --git a/doc/board/freescale/mx6ullevk.rst b/doc/board/freescale/mx6ullevk.rst deleted file mode 100644 index a26248a1e3b..00000000000 --- a/doc/board/freescale/mx6ullevk.rst +++ /dev/null @@ -1,47 +0,0 @@ -.. SPDX-License-Identifier: GPL-2.0+ - -mx6ullevk -========= - -How to use U-Boot on Freescale MX6ULL 14x14 EVK ------------------------------------------------ - -- First make sure you have installed the dtc package (device tree compiler): - -.. code-block:: bash - - $ sudo apt-get install device-tree-compiler - -- Build U-Boot for MX6ULL 14x14 EVK: - -.. code-block:: bash - - $ make mrproper - $ make mx6ull_14x14_evk_defconfig - $ make - -This generates the u-boot-dtb.imx image in the current directory. - -- Flash the u-boot-dtb.imx image into the micro SD card: - -.. code-block:: bash - - $ sudo dd if=u-boot-dtb.imx of=/dev/sdb bs=1K seek=1 conv=notrunc && sync - -- Jumper settings:: - - SW601: 0 0 1 0 - Sw602: 1 0 - -Where 0 means bottom position and 1 means top position (from the switch label -numbers reference). - -Connect the USB cable between the EVK and the PC for the console. -(The USB console connector is the one close the push buttons) - -Insert the micro SD card in the board, power it up and U-Boot messages should -come up. - -The link for the board: http://www.nxp.com/products/microcontrollers-and- \ -processors/arm-processors/i.mx-applications-processors/i.mx-6-processors/ \ -i.mx6qp/evaluation-kit-for-the-i.mx-6ull-applications-processor:MCIMX6ULL-EVK diff --git a/doc/board/freescale/psb.rst b/doc/board/freescale/psb.rst deleted file mode 100644 index 71ac09fac8d..00000000000 --- a/doc/board/freescale/psb.rst +++ /dev/null @@ -1,174 +0,0 @@ -i.MX7D/i.MX8MM SRC_GPR10 PERSIST_SECONDARY_BOOT for bootloader A/B switching -============================================================================ - -Introduction ------------- -Since at least iMX53 until iMX8MM, it is possible to have two copies of -bootloader in SD/eMMC and switch between them. The switch is triggered -either by the BootROM in case the bootloader image is faulty OR can be -enforced by the user. - -Operation ---------- - #. Upon Power-On Reset (POR) - - - SRC_GPR10 bit PERSIST_SECONDARY_BOOT is set to 0 - - BootROM attempts to start bootloader A-copy - - - if A-copy valid - - - BootROM starts A-copy - - END - - - if A-copy NOT valid - - - BootROM sets SRC_GPR10 bit PERSIST_SECONDARY_BOOT to 1 - - BootROM triggers WARM reset, GOTO 1) - - END - - #. Upon COLD Reset - - - GOTO 1) - - END - - #. Upon WARM Reset - - - SRC_GPR10 bit PERSIST_SECONDARY_BOOT is retained - - - if SRC_GPR10 bit PERSIST_SECONDARY_BOOT is 0 - - - BootROM attempts to start bootloader A-copy - - - if A-copy valid - - - BootROM starts A-copy - - END - - - if A-copy NOT valid - - - BootROM sets SRC_GPR10 bit PERSIST_SECONDARY_BOOT to 1 - - BootROM triggers WARM reset. GOTO 1.3) - - END - - - if SRC_GPR10 bit PERSIST_SECONDARY_BOOT is 1 - - - BootROM attempts to start bootloader B-copy - - - if B-copy valid - - - BootROM starts B-copy - - END - - - if B-copy NOT valid - - System hangs - - END - -Setup ------ -The bootloader A-copy must be placed at predetermined offset in SD/eMMC. The -bootloader B-copy area offset is determined by an offset stored in Secondary -Image Table (SIT). The SIT must be placed at predetermined offset in SD/eMMC. - -The following table contains offset of SIT, bootloader A-copy and recommended -bootloader B-copy offset. The offsets are in 512 Byte sector units (that is -offset 0x1 means 512 Bytes from the start of SD/eMMC card data partition). -For details on the addition of two numbers in recommended B-copy offset, see -SIT format below. - -+----------+--------------------+-----------------------+-----------------------------+ -| SoC | SIT offset (fixed) | A-copy offset (fixed) | B-copy offset (recommended) | -+----------+--------------------+-----------------------+-----------------------------+ -| iMX7D | 0x1 | 0x2 | 0x800+0x2 | -+----------+--------------------+-----------------------+-----------------------------+ -| iMX8MM | 0x41 | 0x42 | 0x1000+0x42 | -+----------+--------------------+-----------------------+-----------------------------+ - -SIT format -~~~~~~~~~~ -SIT is a 20 byte long structure containing of 5 32-bit words. Those encode -bootloader B-copy area offset (called "firstSectorNumber"), magic value -(called "tag") that is always 0x00112233, and three unused words set to 0. -SIT is documented in [1]_ and [2]_. Example SIT are below:: - - $ hexdump -vC sit-mx7d.bin - 00000000 00 00 00 00 - 00000004 00 00 00 00 - 00000008 33 22 11 00 <--- This is the "tag" - 0000000c 00 08 00 00 <--- This is the "firstSectorNumber" - 00000010 00 00 00 00 - - $ hexdump -vC sit-mx8mm.bin - 00000000 00 00 00 00 - 00000004 00 00 00 00 - 00000008 33 22 11 00 <--- This is the "tag" - 0000000c 00 10 00 00 <--- This is the "firstSectorNumber" - 00000010 00 00 00 00 - -B-copy area offset ("firstSectorNumber") is offset, in units of 512 Byte -sectors, that is added to the start of boot media when switching between -A-copy and B-copy. For A-copy, this offset is 0x0. For B-copy, this offset -is determined by SIT (e.g. if firstSectorNumber is 0x1000 as it is above -in sit-mx8mm.bin, then the B-copy offset is 0x1000 sectors = 2 MiB). - -Bootloader A-copy (e.g. u-boot.imx or flash.bin) is placed at fixed offset -from A-copy area offset (e.g. 0x2 sectors from sector 0x0 for iMX7D, which -means u-boot.imx A-copy must be written to sector 0x2). - -The same applies to bootloader B-copy, which is placed at fixed offset from -B-copy area offset determined by SIT (e.g. 0x2 sectors from sector 0x800 [see -sit-mx7d.bin example above, this can be changed in SIT firstSectorNumber] for -iMX7D, which means u-boot.imx B-copy must be written to sector 0x802) - -**WARNING:** -B-copy area offset ("firstSectorNumber") is NOT equal to bootloader -(image, which is u-boot.imx or flash.bin) B-copy offset. - -To generate SIT, use for example the following bourne shell printf command:: - -$ printf '\x0\x0\x0\x0\x0\x0\x0\x0\x33\x22\x11\x00\x00\x08\x00\x00\x0\x0\x0\x0' > sit-mx7d.bin -$ printf '\x0\x0\x0\x0\x0\x0\x0\x0\x33\x22\x11\x00\x00\x10\x00\x00\x0\x0\x0\x0' > sit-mx8mm.bin - -Write bootloader A/B copy and SIT to SD/eMMC -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Examples of writing SIT and two copies of bootloader to SD or eMMC: - -- iMX8MM, SD card at /dev/sdX, Linux command line - :: - - $ dd if=sit-mx8mm.bin of=/dev/sdX bs=512 seek=65 - $ dd if=flash.bin of=/dev/sdX bs=512 seek=66 - $ dd if=flash.bin of=/dev/sdX bs=512 seek=4162 - -- iMX8MM, eMMC 1 data partition, U-Boot command line - :: - - => mmc partconf 1 0 0 0 - - => dhcp ${loadaddr} sit-mx8mm.bin - => mmc dev 1 - => mmc write ${loadaddr} 0x41 0x1 - - => dhcp ${loadaddr} flash.bin - => setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200 - => mmc dev 1 - => mmc write ${loadaddr} 0x42 ${blkcnt} - => mmc write ${loadaddr} 0x1042 ${blkcnt} - -WARM reset into B-copy using WDT -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -To perform a reboot into B-copy, the PERSIST_SECONDARY_BOOT must be set -in SRC_GPR0 register. Example on iMX8MM:: - - => mw 0x30390098 0x40000000 - -A WARM reset can be triggered using WDT as follows:: - - => mw.w 0x30280000 0x25 - -References ----------- - -.. [1] i.MX 7Dual Applications Processor Reference Manual, Rev. 1, 01/2018 ; section 6.6.5.3.5 Redundant boot support for expansion device -.. [2] i.MX 8M Mini Applications Processor Reference Manual, Rev. 3, 11/2020 ; section 6.1.5.4.5 Redundant boot support for expansion device diff --git a/doc/board/index.rst b/doc/board/index.rst index 9e909788916..33087074fa8 100644 --- a/doc/board/index.rst +++ b/doc/board/index.rst @@ -14,11 +14,11 @@ Board-specific doc congatec/index coreboot/index emulation/index - freescale/index google/index intel/index kontron/index microchip/index + nxp/index openpiton/index qualcomm/index rockchip/index diff --git a/doc/board/nxp/imx8mm_evk.rst b/doc/board/nxp/imx8mm_evk.rst new file mode 100644 index 00000000000..7fd3d725649 --- /dev/null +++ b/doc/board/nxp/imx8mm_evk.rst @@ -0,0 +1,57 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +imx8mm_evk +========== + +U-Boot for the NXP i.MX8MM EVK board + +Quick Start +----------- + +- Build the ARM Trusted firmware binary +- Get ddr firmware +- Build U-Boot +- Boot + +Get and Build the ARM Trusted firmware +-------------------------------------- + +Note: builddir is U-Boot build directory (source directory for in-tree builds) +Get ATF from: https://source.codeaurora.org/external/imx/imx-atf +branch: imx_5.4.47_2.2.0 + +.. code-block:: bash + + $ make PLAT=imx8mm bl31 + $ cp build/imx8mm/release/bl31.bin $(builddir) + +Get the ddr firmware +-------------------- + +.. code-block:: bash + + $ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.9.bin + $ chmod +x firmware-imx-8.9.bin + $ ./firmware-imx-8.9 + $ cp firmware-imx-8.9/firmware/ddr/synopsys/lpddr4*.bin $(builddir) + +Build U-Boot +------------ + +.. code-block:: bash + + $ export CROSS_COMPILE=aarch64-poky-linux- + $ make imx8mm_evk_defconfig + $ export ATF_LOAD_ADDR=0x920000 + $ make + +Burn the flash.bin to MicroSD card offset 33KB: + +.. code-block:: bash + + $sudo dd if=flash.bin of=/dev/sd[x] bs=1024 seek=33 conv=notrunc + $sudo dd if=u-boot.itb of=/dev/sdc bs=1024 seek=384 conv=sync + +Boot +---- +Set Boot switch to SD boot diff --git a/doc/board/nxp/imx8mn_evk.rst b/doc/board/nxp/imx8mn_evk.rst new file mode 100644 index 00000000000..9fbb947032b --- /dev/null +++ b/doc/board/nxp/imx8mn_evk.rst @@ -0,0 +1,58 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +imx8mn_evk +========== + +U-Boot for the NXP i.MX8MN EVK board + +Quick Start +----------- + +- Build the ARM Trusted firmware binary +- Get firmware-imx package +- Build U-Boot +- Boot + +Get and Build the ARM Trusted firmware +-------------------------------------- + +Note: srctree is U-Boot source directory +Get ATF from: https://source.codeaurora.org/external/imx/imx-atf +branch: imx_5.4.47_2.2.0 + +.. code-block:: bash + + $ make PLAT=imx8mn bl31 + $ cp build/imx8mn/release/bl31.bin $(srctree) + +Get the ddr firmware +-------------------- + +.. code-block:: bash + + $ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.9.bin + $ chmod +x firmware-imx-8.9.bin + $ ./firmware-imx-8.9 + $ cp firmware-imx-8.9/firmware/ddr/synopsys/ddr4*.bin $(srctree) + +Build U-Boot +------------ + +.. code-block:: bash + + $ export CROSS_COMPILE=aarch64-poky-linux- + $ make imx8mn_ddr4_evk_defconfig + $ export ATF_LOAD_ADDR=0x960000 + $ make + +Burn the flash.bin to MicroSD card offset 32KB: + +.. code-block:: bash + + $sudo dd if=flash.bin of=/dev/sd[x] bs=1024 seek=32 conv=notrunc + $sudo dd if=u-boot.itb of=/dev/sd[x] bs=1024 seek=384 conv=notrunc + +Boot +---- + +Set Boot switch to SD boot diff --git a/doc/board/nxp/imx8mp_evk.rst b/doc/board/nxp/imx8mp_evk.rst new file mode 100644 index 00000000000..609a29f3ebc --- /dev/null +++ b/doc/board/nxp/imx8mp_evk.rst @@ -0,0 +1,61 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +imx8mp_evk +========== + +U-Boot for the NXP i.MX8MP EVK board + +Quick Start +----------- + +- Build the ARM Trusted firmware binary +- Get the firmware-imx package +- Build U-Boot +- Boot + +Get and Build the ARM Trusted firmware +-------------------------------------- + +Get ATF from: https://source.codeaurora.org/external/imx/imx-atf +branch: imx_5.4.70_2.3.0 + +.. code-block:: bash + + $ make PLAT=imx8mp bl31 + +Get the ddr firmware +-------------------- + +.. code-block:: bash + + $ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.10.bin + $ chmod +x firmware-imx-8.10.bin + $ ./firmware-imx-8.10.bin + +Build U-Boot +------------ + +.. code-block:: bash + + $ export CROSS_COMPILE=aarch64-poky-linux- + $ make O=build imx8mp_evk_defconfig + $ cp ../imx-atf/build/imx8mp/release/bl31.bin ./build/bl31.bin + $ cp ../firmware-imx-8.10/firmware/ddr/synopsys/lpddr4_pmu_train_1d_dmem_202006.bin ./build/ + $ cp ../firmware-imx-8.10/firmware/ddr/synopsys/lpddr4_pmu_train_1d_imem_202006.bin ./build/ + $ cp ../firmware-imx-8.10/firmware/ddr/synopsys/lpddr4_pmu_train_2d_dmem_202006.bin ./build/ + $ cp ../firmware-imx-8.10/firmware/ddr/synopsys/lpddr4_pmu_train_2d_imem_202006.bin ./build/ + $ export ATF_LOAD_ADDR=0x970000 + $ make O=build + +Burn the flash.bin to the MicroSD card at offset 32KB: + +.. code-block:: bash + + $sudo dd if=build/flash.bin of=/dev/sd[x] bs=1K seek=32 conv=notrunc; sync + $sudo dd if=build/u-boot.itb of=/dev/sd[x] bs=1K seek=384 conv=notrunc; sync + +Boot +---- + +Set Boot switch to SD boot +Use /dev/ttyUSB2 for U-Boot console diff --git a/doc/board/nxp/imx8mq_evk.rst b/doc/board/nxp/imx8mq_evk.rst new file mode 100644 index 00000000000..c269fdebe30 --- /dev/null +++ b/doc/board/nxp/imx8mq_evk.rst @@ -0,0 +1,56 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +imx8mq_evk +========== + +U-Boot for the NXP i.MX8MQ EVK board + +Quick Start +----------- + +- Build the ARM Trusted firmware binary +- Get ddr and hdmi fimware +- Build U-Boot +- Boot + +Get and Build the ARM Trusted firmware +-------------------------------------- + +Note: srctree is U-Boot source directory +Get ATF from: https://source.codeaurora.org/external/imx/imx-atf +branch: imx_5.4.47_2.2.0 + +.. code-block:: bash + + $ make PLAT=imx8mq bl31 + $ cp build/imx8mq/release/bl31.bin $(builddir) + +Get the ddr and hdmi firmware +----------------------------- + +.. code-block:: bash + + $ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.9.bin + $ chmod +x firmware-imx-8.9.bin + $ ./firmware-imx-8.9.bin + $ cp firmware-imx-8.9/firmware/hdmi/cadence/signed_hdmi_imx8m.bin $(builddir) + $ cp firmware-imx-8.9/firmware/ddr/synopsys/lpddr4*.bin $(builddir) + +Build U-Boot +------------ + +.. code-block:: bash + + $ export CROSS_COMPILE=aarch64-poky-linux- + $ make imx8mq_evk_defconfig + $ make flash.bin + +Burn the flash.bin to MicroSD card offset 33KB: + +.. code-block:: bash + + $sudo dd if=flash.bin of=/dev/sd[x] bs=1024 seek=33 conv=notrunc + +Boot +---- +Set Boot switch SW801: 1100 and Bmode: 10 to boot from Micro SD. diff --git a/doc/board/nxp/imx8qxp_mek.rst b/doc/board/nxp/imx8qxp_mek.rst new file mode 100644 index 00000000000..215627cfa6d --- /dev/null +++ b/doc/board/nxp/imx8qxp_mek.rst @@ -0,0 +1,66 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +imx8qxp_mek +=========== + +U-Boot for the NXP i.MX8QXP EVK board + +Quick Start +----------- + +- Build the ARM Trusted firmware binary +- Get scfw_tcm.bin and ahab-container.img +- Build U-Boot +- Flash the binary into the SD card +- Boot + +Get and Build the ARM Trusted firmware +-------------------------------------- + +.. code-block:: bash + + $ git clone https://source.codeaurora.org/external/imx/imx-atf + $ cd imx-atf/ + $ git checkout origin/imx_4.19.35_1.1.0 -b imx_4.19.35_1.1.0 + $ make PLAT=imx8qx bl31 + +Get scfw_tcm.bin and ahab-container.img +--------------------------------------- + +.. code-block:: bash + + $ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/imx-sc-firmware-1.2.7.1.bin + $ chmod +x imx-sc-firmware-1.2.7.1.bin + $ ./imx-sc-firmware-1.2.7.1.bin + $ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/imx-seco-2.3.1.bin + $ chmod +x imx-seco-2.3.1.bin + $ ./imx-seco-2.3.1.bin + +Copy the following binaries to U-Boot folder: + +.. code-block:: bash + + $ cp imx-atf/build/imx8qx/release/bl31.bin . + $ cp imx-seco-2.3.1/firmware/seco/mx8qx-ahab-container.img ./ahab-container.img + $ cp imx-sc-firmware-1.2.7.1/mx8qx-mek-scfw-tcm.bin . + +Build U-Boot +------------ + +.. code-block:: bash + + $ make imx8qxp_mek_defconfig + $ make flash.bin + +Flash the binary into the SD card +--------------------------------- + +Burn the flash.bin binary to SD card offset 32KB: + +.. code-block:: bash + + $ sudo dd if=flash.bin of=/dev/sd[x] bs=1024 seek=32 conv=notrunc + +Boot +---- +Set Boot switch SW2: 1100. diff --git a/doc/board/nxp/imxrt1020-evk.rst b/doc/board/nxp/imxrt1020-evk.rst new file mode 100644 index 00000000000..267f80c5170 --- /dev/null +++ b/doc/board/nxp/imxrt1020-evk.rst @@ -0,0 +1,41 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +imxrt1020-evk +============= + +How to use U-Boot on NXP i.MXRT1020 EVK +--------------------------------------- + +- Build U-Boot for i.MXRT1020 EVK: + +.. code-block:: bash + + $ make mrproper + $ make imxrt1020-evk_defconfig + $ make + +This will generate the SPL image called SPL and the u-boot.img. + +- Flash the SPL image into the micro SD card: + +.. code-block:: bash + + $sudo dd if=SPL of=/dev/sdX bs=1k seek=1 conv=notrunc; sync + +- Flash the u-boot.img image into the micro SD card: + +.. code-block:: bash + + $sudo dd if=u-boot.img of=/dev/sdX bs=1k seek=128 conv=notrunc; sync + +- Jumper settings:: + + SW8: 0 1 1 0 + +where 0 means bottom position and 1 means top position (from the +switch label numbers reference). + +- Connect the USB cable between the EVK and the PC for the console. + The USB console connector is the one close the ethernet connector + +- Insert the micro SD card in the board, power it up and U-Boot messages should come up. diff --git a/doc/board/nxp/imxrt1050-evk.rst b/doc/board/nxp/imxrt1050-evk.rst new file mode 100644 index 00000000000..c1fb48f0cdd --- /dev/null +++ b/doc/board/nxp/imxrt1050-evk.rst @@ -0,0 +1,41 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +imxrt1050-evk +============= + +How to use U-Boot on NXP i.MXRT1050 EVK +--------------------------------------- + +- Build U-Boot for i.MXRT1050 EVK: + +.. code-block:: bash + + $ make mrproper + $ make imxrt1050-evk_defconfig + $ make + +This will generate the SPL image called SPL and the u-boot.img. + +- Flash the SPL image into the micro SD card: + +.. code-block:: bash + + $sudo dd if=SPL of=/dev/sdX bs=1k seek=1 conv=notrunc; sync + +- Flash the u-boot.img image into the micro SD card: + +.. code-block:: bash + + $sudo dd if=u-boot.img of=/dev/sdX bs=1k seek=128 conv=notrunc; sync + +- Jumper settings:: + + SW7: 1 0 1 0 + +where 0 means bottom position and 1 means top position (from the +switch label numbers reference). + +- Connect the USB cable between the EVK and the PC for the console. + The USB console connector is the one close the ethernet connector + +- Insert the micro SD card in the board, power it up and U-Boot messages should come up. diff --git a/doc/board/nxp/index.rst b/doc/board/nxp/index.rst new file mode 100644 index 00000000000..63956287c5b --- /dev/null +++ b/doc/board/nxp/index.rst @@ -0,0 +1,20 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +NXP Semiconductors +================== + +.. toctree:: + :maxdepth: 2 + + imx8mm_evk + imx8mn_evk + imx8mp_evk + imx8mq_evk + imx8qxp_mek + imxrt1020-evk + imxrt1050-evk + mx6sabreauto + mx6sabresd + mx6ul_14x14_evk + mx6ullevk + psb diff --git a/doc/board/nxp/mx6sabreauto.rst b/doc/board/nxp/mx6sabreauto.rst new file mode 100644 index 00000000000..fe4cd9d2141 --- /dev/null +++ b/doc/board/nxp/mx6sabreauto.rst @@ -0,0 +1,100 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +mx6sabreauto +============ + +How to use and build U-Boot on mx6sabreauto +------------------------------------------- + +mx6sabreauto_defconfig target supports mx6q/mx6dl/mx6qp sabreauto variants. + +In order to build it: + +.. code-block:: bash + + $ make mx6sabreauto_defconfig + $ make + +This will generate the SPL and u-boot-dtb.img binaries. + +- Flash the SPL binary into the SD card: + +.. code-block:: bash + + $ sudo dd if=SPL of=/dev/sdX bs=1K seek=1 conv=notrunc && sync + +- Flash the u-boot-dtb.img binary into the SD card: + +.. code-block:: bash + + $ sudo dd if=u-boot-dtb.img of=/dev/sdX bs=1K seek=69 conv=notrunc && sync + +Booting via Falcon mode +----------------------- + +Write in mx6sabreauto_defconfig the following define below: + +CONFIG_SPL_OS_BOOT=y + +In order to build it: + +.. code-block:: bash + + $ make mx6sabreauto_defconfig + $ make + +This will generate the SPL image called SPL and the u-boot-dtb.img. + +- Flash the SPL image into the SD card: + +.. code-block:: bash + + $ sudo dd if=SPL of=/dev/sdb bs=1K seek=1 conv=notrunc && sync + +- Flash the u-boot-dtb.img image into the SD card: + +.. code-block:: bash + + $ sudo dd if=u-boot-dtb.img of=/dev/sdb bs=1K seek=69 conv=notrunc && sync + +Create a FAT16 boot partition to store uImage and the dtb file, then copy the files there: + +.. code-block:: bash + + $ sudo cp uImage /media/boot + $ sudo cp imx6dl-sabreauto.dtb /media/boot + +Create a partition for root file system and extract it there: + +.. code-block:: bash + + $ sudo tar xvf rootfs.tar.gz -C /media/root + +The SD card must have enough space for raw "args" and "kernel". +To configure Falcon mode for the first time, on U-Boot do the following commands: + +- Load dtb file from boot partition:: + + # load mmc 0:1 ${fdt_addr} imx6dl-sabreauto.dtb + +- Load kernel image from boot partition:: + + # load mmc 0:1 ${loadaddr} uImage + +- Write kernel at 2MB offset:: + + # mmc write ${loadaddr} 0x1000 0x4000 + +- Setup kernel bootargs:: + + # setenv bootargs "console=ttymxc3,115200 root=/dev/mmcblk0p1 rootfstype=ext4 rootwait quiet rw" + +- Prepare args:: + + # spl export fdt ${loadaddr} - ${fdt_addr} + +- Write args 1MB data (0x800 sectors) to 1MB offset (0x800 sectors):: + + # mmc write 18000000 0x800 0x800 + +- Restart the board and then SPL binary will launch the kernel directly. diff --git a/doc/board/nxp/mx6sabresd.rst b/doc/board/nxp/mx6sabresd.rst new file mode 100644 index 00000000000..fe15ba7b798 --- /dev/null +++ b/doc/board/nxp/mx6sabresd.rst @@ -0,0 +1,132 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +mx6sabresd +========== + +How to use and build U-Boot on mx6sabresd +----------------------------------------- + +The following methods can be used for booting mx6sabresd boards: + +1. Booting from SD card + +2. Booting from eMMC + +3. Booting via Falcon mode (SPL launches the kernel directly) + + +1. Booting from SD card via SPL +------------------------------- + +mx6sabresd_defconfig target supports mx6q/mx6dl/mx6qp sabresd variants. + +In order to build it: + +.. code-block:: bash + + $ make mx6sabresd_defconfig + $ make + +This will generate the SPL and u-boot-dtb.img binaries. + +- Flash the SPL binary into the SD card: + +.. code-block:: bash + + $ sudo dd if=SPL of=/dev/sdX bs=1K seek=1 conv=notrunc && sync + +- Flash the u-boot-dtb.img binary into the SD card: + +.. code-block:: bash + + $ sudo dd if=u-boot-dtb.img of=/dev/sdX bs=1K seek=69 conv=notrunc && sync + +2. Booting from eMMC +-------------------- + +.. code-block:: bash + + $ make mx6sabresd_defconfig + $ make + +This will generate the SPL and u-boot-dtb.img binaries. + +- Boot first from SD card as shown in the previous section + +In U-boot change the eMMC partition config:: + + => mmc partconf 2 1 0 0 + +Mount the eMMC in the host PC:: + + => ums 0 mmc 2 + +- Flash SPL and u-boot-dtb.img binaries into the eMMC: + +.. code-block:: bash + + $ sudo dd if=SPL of=/dev/sdX bs=1K seek=1 conv=notrunc && sync + $ sudo dd if=u-boot-dtb.img of=/dev/sdX bs=1K seek=69 conv=notrunc && sync + +Set SW6 to eMMC 8-bit boot: 11010110 + +3. Booting via Falcon mode +-------------------------- + +.. code-block:: bash + + $ make mx6sabresd_defconfig + $ make + +This will generate the SPL image called SPL and the u-boot-dtb.img. + +- Flash the SPL image into the SD card + +.. code-block:: bash + + $ sudo dd if=SPL of=/dev/sdX bs=1K seek=1 oflag=sync status=none conv=notrunc && sync + +- Flash the u-boot-dtb.img image into the SD card + +.. code-block:: bash + + $ sudo dd if=u-boot-dtb.img of=/dev/sdX bs=1K seek=69 oflag=sync status=none conv=notrunc && sync + +Create a partition for root file system and extract it there + +.. code-block:: bash + + $ sudo tar xvf rootfs.tar.gz -C /media/root + +The SD card must have enough space for raw "args" and "kernel". +To configure Falcon mode for the first time, on U-Boot do the following commands: + +- Setup the IP server:: + + # setenv serverip + +- Download dtb file:: + + # dhcp ${fdt_addr} imx6q-sabresd.dtb + +- Download kernel image:: + + # dhcp ${loadaddr} uImage + +- Write kernel at 2MB offset:: + + # mmc write ${loadaddr} 0x1000 0x4000 + +- Setup kernel bootargs:: + + # setenv bootargs "console=ttymxc0,115200 root=/dev/mmcblk1p1 rootfstype=ext4 rootwait quiet rw" + +- Prepare args:: + + # spl export fdt ${loadaddr} - ${fdt_addr} + +- Write args 1MB data (0x800 sectors) to 1MB offset (0x800 sectors):: + + # mmc write 18000000 0x800 0x800 + +- Press KEY_VOL_UP key, power up the board and then SPL binary will launch the kernel directly. diff --git a/doc/board/nxp/mx6ul_14x14_evk.rst b/doc/board/nxp/mx6ul_14x14_evk.rst new file mode 100644 index 00000000000..8298bf8e1e7 --- /dev/null +++ b/doc/board/nxp/mx6ul_14x14_evk.rst @@ -0,0 +1,98 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +mx6ul_14x14_evk +=============== + +How to use U-Boot on Freescale MX6UL 14x14 EVK +----------------------------------------------- + +- Build U-Boot for MX6UL 14x14 EVK: + +.. code-block:: bash + + $ make mrproper + $ make mx6ul_14x14_evk_defconfig + $ make + +This will generate the SPL image called SPL and the u-boot.img. + +1. Booting via SDCard +--------------------- + +- Flash the SPL image into the micro SD card: + +.. code-block:: bash + + sudo dd if=SPL of=/dev/mmcblk0 bs=1k seek=1 conv=notrunc; sync + +- Flash the u-boot.img image into the micro SD card: + +.. code-block:: bash + + sudo dd if=u-boot.img of=/dev/mmcblk0 bs=1k seek=69 conv=notrunc; sync + +- Jumper settings:: + + SW601: 0 0 1 0 + Sw602: 1 0 + +where 0 means bottom position and 1 means top position (from the +switch label numbers reference). + +- Connect the USB cable between the EVK and the PC for the console. + The USB console connector is the one close the push buttons + +- Insert the micro SD card in the board, power it up and U-Boot messages should come up. + +2. Booting via Serial Download Protocol (SDP) +--------------------------------------------- + +The mx6ulevk board can boot from USB OTG port using the SDP, target will +enter in SDP mode in case an SD Card is not connect or boot switches are +set as below:: + + Sw602: 0 1 + SW601: x x x x + +The following tools can be used to boot via SDP, for both tools you must +connect an USB cable in USB OTG port. + +- Method 1: Universal Update Utility (uuu) + +The UUU binary can be downloaded in release tab from link below: +https://github.com/NXPmicro/mfgtools + +The following script should be created to boot SPL + u-boot-dtb.img binaries: + +.. code-block:: bash + + $ cat uuu_script + uuu_version 1.1.4 + + SDP: boot -f SPL + SDPU: write -f u-boot-dtb.img -addr 0x877fffc0 + SDPU: jump -addr 0x877fffc0 + SDPU: done + +Please note that the address above is calculated based on SYS_TEXT_BASE address: + +0x877fffc0 = 0x87800000 (SYS_TEXT_BASE) - 0x40 (U-Boot proper Header size) + +Power on the target and run the following command from U-Boot root directory: + +.. code-block:: bash + + $ sudo ./uuu uuu_script + +- Method 2: imx usb loader tool (imx_usb): + +The imx_usb_loader tool can be downloaded in link below: +https://github.com/boundarydevices/imx_usb_loader + +Build the source code and run the following commands from U-Boot root +directory: + +.. code-block:: bash + + $ sudo ./imx_usb SPL + $ sudo ./imx_usb u-boot-dtb.img diff --git a/doc/board/nxp/mx6ullevk.rst b/doc/board/nxp/mx6ullevk.rst new file mode 100644 index 00000000000..a26248a1e3b --- /dev/null +++ b/doc/board/nxp/mx6ullevk.rst @@ -0,0 +1,47 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +mx6ullevk +========= + +How to use U-Boot on Freescale MX6ULL 14x14 EVK +----------------------------------------------- + +- First make sure you have installed the dtc package (device tree compiler): + +.. code-block:: bash + + $ sudo apt-get install device-tree-compiler + +- Build U-Boot for MX6ULL 14x14 EVK: + +.. code-block:: bash + + $ make mrproper + $ make mx6ull_14x14_evk_defconfig + $ make + +This generates the u-boot-dtb.imx image in the current directory. + +- Flash the u-boot-dtb.imx image into the micro SD card: + +.. code-block:: bash + + $ sudo dd if=u-boot-dtb.imx of=/dev/sdb bs=1K seek=1 conv=notrunc && sync + +- Jumper settings:: + + SW601: 0 0 1 0 + Sw602: 1 0 + +Where 0 means bottom position and 1 means top position (from the switch label +numbers reference). + +Connect the USB cable between the EVK and the PC for the console. +(The USB console connector is the one close the push buttons) + +Insert the micro SD card in the board, power it up and U-Boot messages should +come up. + +The link for the board: http://www.nxp.com/products/microcontrollers-and- \ +processors/arm-processors/i.mx-applications-processors/i.mx-6-processors/ \ +i.mx6qp/evaluation-kit-for-the-i.mx-6ull-applications-processor:MCIMX6ULL-EVK diff --git a/doc/board/nxp/psb.rst b/doc/board/nxp/psb.rst new file mode 100644 index 00000000000..71ac09fac8d --- /dev/null +++ b/doc/board/nxp/psb.rst @@ -0,0 +1,174 @@ +i.MX7D/i.MX8MM SRC_GPR10 PERSIST_SECONDARY_BOOT for bootloader A/B switching +============================================================================ + +Introduction +------------ +Since at least iMX53 until iMX8MM, it is possible to have two copies of +bootloader in SD/eMMC and switch between them. The switch is triggered +either by the BootROM in case the bootloader image is faulty OR can be +enforced by the user. + +Operation +--------- + #. Upon Power-On Reset (POR) + + - SRC_GPR10 bit PERSIST_SECONDARY_BOOT is set to 0 + - BootROM attempts to start bootloader A-copy + + - if A-copy valid + + - BootROM starts A-copy + - END + + - if A-copy NOT valid + + - BootROM sets SRC_GPR10 bit PERSIST_SECONDARY_BOOT to 1 + - BootROM triggers WARM reset, GOTO 1) + - END + + #. Upon COLD Reset + + - GOTO 1) + - END + + #. Upon WARM Reset + + - SRC_GPR10 bit PERSIST_SECONDARY_BOOT is retained + + - if SRC_GPR10 bit PERSIST_SECONDARY_BOOT is 0 + + - BootROM attempts to start bootloader A-copy + + - if A-copy valid + + - BootROM starts A-copy + - END + + - if A-copy NOT valid + + - BootROM sets SRC_GPR10 bit PERSIST_SECONDARY_BOOT to 1 + - BootROM triggers WARM reset. GOTO 1.3) + - END + + - if SRC_GPR10 bit PERSIST_SECONDARY_BOOT is 1 + + - BootROM attempts to start bootloader B-copy + + - if B-copy valid + + - BootROM starts B-copy + - END + + - if B-copy NOT valid + - System hangs + - END + +Setup +----- +The bootloader A-copy must be placed at predetermined offset in SD/eMMC. The +bootloader B-copy area offset is determined by an offset stored in Secondary +Image Table (SIT). The SIT must be placed at predetermined offset in SD/eMMC. + +The following table contains offset of SIT, bootloader A-copy and recommended +bootloader B-copy offset. The offsets are in 512 Byte sector units (that is +offset 0x1 means 512 Bytes from the start of SD/eMMC card data partition). +For details on the addition of two numbers in recommended B-copy offset, see +SIT format below. + ++----------+--------------------+-----------------------+-----------------------------+ +| SoC | SIT offset (fixed) | A-copy offset (fixed) | B-copy offset (recommended) | ++----------+--------------------+-----------------------+-----------------------------+ +| iMX7D | 0x1 | 0x2 | 0x800+0x2 | ++----------+--------------------+-----------------------+-----------------------------+ +| iMX8MM | 0x41 | 0x42 | 0x1000+0x42 | ++----------+--------------------+-----------------------+-----------------------------+ + +SIT format +~~~~~~~~~~ +SIT is a 20 byte long structure containing of 5 32-bit words. Those encode +bootloader B-copy area offset (called "firstSectorNumber"), magic value +(called "tag") that is always 0x00112233, and three unused words set to 0. +SIT is documented in [1]_ and [2]_. Example SIT are below:: + + $ hexdump -vC sit-mx7d.bin + 00000000 00 00 00 00 + 00000004 00 00 00 00 + 00000008 33 22 11 00 <--- This is the "tag" + 0000000c 00 08 00 00 <--- This is the "firstSectorNumber" + 00000010 00 00 00 00 + + $ hexdump -vC sit-mx8mm.bin + 00000000 00 00 00 00 + 00000004 00 00 00 00 + 00000008 33 22 11 00 <--- This is the "tag" + 0000000c 00 10 00 00 <--- This is the "firstSectorNumber" + 00000010 00 00 00 00 + +B-copy area offset ("firstSectorNumber") is offset, in units of 512 Byte +sectors, that is added to the start of boot media when switching between +A-copy and B-copy. For A-copy, this offset is 0x0. For B-copy, this offset +is determined by SIT (e.g. if firstSectorNumber is 0x1000 as it is above +in sit-mx8mm.bin, then the B-copy offset is 0x1000 sectors = 2 MiB). + +Bootloader A-copy (e.g. u-boot.imx or flash.bin) is placed at fixed offset +from A-copy area offset (e.g. 0x2 sectors from sector 0x0 for iMX7D, which +means u-boot.imx A-copy must be written to sector 0x2). + +The same applies to bootloader B-copy, which is placed at fixed offset from +B-copy area offset determined by SIT (e.g. 0x2 sectors from sector 0x800 [see +sit-mx7d.bin example above, this can be changed in SIT firstSectorNumber] for +iMX7D, which means u-boot.imx B-copy must be written to sector 0x802) + +**WARNING:** +B-copy area offset ("firstSectorNumber") is NOT equal to bootloader +(image, which is u-boot.imx or flash.bin) B-copy offset. + +To generate SIT, use for example the following bourne shell printf command:: + +$ printf '\x0\x0\x0\x0\x0\x0\x0\x0\x33\x22\x11\x00\x00\x08\x00\x00\x0\x0\x0\x0' > sit-mx7d.bin +$ printf '\x0\x0\x0\x0\x0\x0\x0\x0\x33\x22\x11\x00\x00\x10\x00\x00\x0\x0\x0\x0' > sit-mx8mm.bin + +Write bootloader A/B copy and SIT to SD/eMMC +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Examples of writing SIT and two copies of bootloader to SD or eMMC: + +- iMX8MM, SD card at /dev/sdX, Linux command line + :: + + $ dd if=sit-mx8mm.bin of=/dev/sdX bs=512 seek=65 + $ dd if=flash.bin of=/dev/sdX bs=512 seek=66 + $ dd if=flash.bin of=/dev/sdX bs=512 seek=4162 + +- iMX8MM, eMMC 1 data partition, U-Boot command line + :: + + => mmc partconf 1 0 0 0 + + => dhcp ${loadaddr} sit-mx8mm.bin + => mmc dev 1 + => mmc write ${loadaddr} 0x41 0x1 + + => dhcp ${loadaddr} flash.bin + => setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200 + => mmc dev 1 + => mmc write ${loadaddr} 0x42 ${blkcnt} + => mmc write ${loadaddr} 0x1042 ${blkcnt} + +WARM reset into B-copy using WDT +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +To perform a reboot into B-copy, the PERSIST_SECONDARY_BOOT must be set +in SRC_GPR0 register. Example on iMX8MM:: + + => mw 0x30390098 0x40000000 + +A WARM reset can be triggered using WDT as follows:: + + => mw.w 0x30280000 0x25 + +References +---------- + +.. [1] i.MX 7Dual Applications Processor Reference Manual, Rev. 1, 01/2018 ; section 6.6.5.3.5 Redundant boot support for expansion device +.. [2] i.MX 8M Mini Applications Processor Reference Manual, Rev. 3, 11/2020 ; section 6.1.5.4.5 Redundant boot support for expansion device -- cgit v1.2.3 From 7075ef463eec1f4856c13b9873f8a5ae5f040ddf Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 16 Aug 2021 19:46:38 +0200 Subject: doc: move doc/board/st/st.rst 'make htmldocs' does not use file doc/board/st/st.rst because the name matches the directory name. Let's rename it to st-dt.rst. Signed-off-by: Heinrich Schuchardt --- doc/board/st/index.rst | 2 +- doc/board/st/st-dt.rst | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++ doc/board/st/st.rst | 68 -------------------------------------------------- 3 files changed, 69 insertions(+), 69 deletions(-) create mode 100644 doc/board/st/st-dt.rst delete mode 100644 doc/board/st/st.rst diff --git a/doc/board/st/index.rst b/doc/board/st/index.rst index 8a06a954a26..9bba42f1dae 100644 --- a/doc/board/st/index.rst +++ b/doc/board/st/index.rst @@ -6,5 +6,5 @@ STMicroelectronics .. toctree:: :maxdepth: 2 - st + st-dt stm32mp1 diff --git a/doc/board/st/st-dt.rst b/doc/board/st/st-dt.rst new file mode 100644 index 00000000000..3dade1681f0 --- /dev/null +++ b/doc/board/st/st-dt.rst @@ -0,0 +1,68 @@ +.. SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause +.. sectionauthor:: Patrick Delaunay + +U-Boot device tree bindings +---------------------------- + +The U-Boot specific bindings are defined in the U-Boot directory: +doc/device-tree-bindings + +* clock + - :download:`clock/st,stm32mp1.txt <../../device-tree-bindings/clock/st,stm32mp1.txt>` +* ram + - :download:`memory-controllers/st,stm32mp1-ddr.txt <../../device-tree-bindings/memory-controllers/st,stm32mp1-ddr.txt>` + +All the other device tree bindings used in U-Boot are specified in Linux +kernel. Please refer dt bindings from below specified paths in the Linux +kernel binding directory = Documentation/devicetree/bindings/ + +* acd + - iio/adc/st,stm32-adc.yaml +* clock + - clock/st,stm32-rcc.txt + - clock/st,stm32h7-rcc.txt + - clock/st,stm32mp1-rcc.yaml +* display + - display/st,stm32-dsi.yaml + - display/st,stm32-ltdc.yaml +* gpio + - pinctrl/st,stm32-pinctrl.yaml +* hwlock + - hwlock/st,stm32-hwspinlock.yaml +* i2c + - i2c/st,stm32-i2c.yaml +* mailbox + - mailbox/st,stm32-ipcc.yaml +* mmc + - mmc/arm,pl18x.yaml +* nand + - mtd/st,stm32-fmc2-nand.yaml + - memory-controllers/st,stm32-fmc2-ebi.yaml +* net + - net/stm32-dwmac.yaml +* nvmem + - nvmem/st,stm32-romem.yaml +* remoteproc + - remoteproc/st,stm32-rproc.yaml +* regulator + - regulator/st,stm32mp1-pwr-reg.yaml + - regulator/st,stm32-vrefbuf.yaml +* reset + - reset/st,stm32-rcc.txt + - reset/st,stm32mp1-rcc.txt +* rng + - rng/st,stm32-rng.yaml +* rtc + - rtc/st,stm32-rtc.yaml +* serial + - serial/st,stm32-uart.yaml +* spi + - spi/st,stm32-spi.yaml + - spi/st,stm32-qspi.yaml +* syscon + - arm/stm32/st,stm32-syscon.yaml +* usb + - phy/phy-stm32-usbphyc.yaml + - usb/dwc2.yaml +* watchdog + - watchdog/st,stm32-iwdg.yaml diff --git a/doc/board/st/st.rst b/doc/board/st/st.rst deleted file mode 100644 index 3dade1681f0..00000000000 --- a/doc/board/st/st.rst +++ /dev/null @@ -1,68 +0,0 @@ -.. SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause -.. sectionauthor:: Patrick Delaunay - -U-Boot device tree bindings ----------------------------- - -The U-Boot specific bindings are defined in the U-Boot directory: -doc/device-tree-bindings - -* clock - - :download:`clock/st,stm32mp1.txt <../../device-tree-bindings/clock/st,stm32mp1.txt>` -* ram - - :download:`memory-controllers/st,stm32mp1-ddr.txt <../../device-tree-bindings/memory-controllers/st,stm32mp1-ddr.txt>` - -All the other device tree bindings used in U-Boot are specified in Linux -kernel. Please refer dt bindings from below specified paths in the Linux -kernel binding directory = Documentation/devicetree/bindings/ - -* acd - - iio/adc/st,stm32-adc.yaml -* clock - - clock/st,stm32-rcc.txt - - clock/st,stm32h7-rcc.txt - - clock/st,stm32mp1-rcc.yaml -* display - - display/st,stm32-dsi.yaml - - display/st,stm32-ltdc.yaml -* gpio - - pinctrl/st,stm32-pinctrl.yaml -* hwlock - - hwlock/st,stm32-hwspinlock.yaml -* i2c - - i2c/st,stm32-i2c.yaml -* mailbox - - mailbox/st,stm32-ipcc.yaml -* mmc - - mmc/arm,pl18x.yaml -* nand - - mtd/st,stm32-fmc2-nand.yaml - - memory-controllers/st,stm32-fmc2-ebi.yaml -* net - - net/stm32-dwmac.yaml -* nvmem - - nvmem/st,stm32-romem.yaml -* remoteproc - - remoteproc/st,stm32-rproc.yaml -* regulator - - regulator/st,stm32mp1-pwr-reg.yaml - - regulator/st,stm32-vrefbuf.yaml -* reset - - reset/st,stm32-rcc.txt - - reset/st,stm32mp1-rcc.txt -* rng - - rng/st,stm32-rng.yaml -* rtc - - rtc/st,stm32-rtc.yaml -* serial - - serial/st,stm32-uart.yaml -* spi - - spi/st,stm32-spi.yaml - - spi/st,stm32-qspi.yaml -* syscon - - arm/stm32/st,stm32-syscon.yaml -* usb - - phy/phy-stm32-usbphyc.yaml - - usb/dwc2.yaml -* watchdog - - watchdog/st,stm32-iwdg.yaml -- cgit v1.2.3 From 7685d17b72bc4fee08ba669634f3dc3084af190d Mon Sep 17 00:00:00 2001 From: Masahisa Kojima Date: Fri, 13 Aug 2021 16:12:43 +0900 Subject: efi_loader: add comment for efi_tcg2.h This commit adds the comment of the TCG Specification efi_tcg2.h file refers, and comment for the structure. Signed-off-by: Masahisa Kojima Signed-off-by: Heinrich Schuchardt --- include/efi_tcg2.h | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/include/efi_tcg2.h b/include/efi_tcg2.h index 497ba3ce940..b6b958da514 100644 --- a/include/efi_tcg2.h +++ b/include/efi_tcg2.h @@ -3,6 +3,13 @@ * Defines data structures and APIs that allow an OS to interact with UEFI * firmware to query information about the device * + * This file refers the following TCG specification. + * - TCG PC Client Platform Firmware Profile Specification + * https://trustedcomputinggroup.org/resource/pc-client-specific-platform-firmware-profile-specification/ + * + * - TCG EFI Protocol Specification + * https://trustedcomputinggroup.org/resource/tcg-efi-protocol-specification/ + * * Copyright (c) 2020, Linaro Limited */ @@ -36,11 +43,23 @@ typedef u32 efi_tcg_event_log_bitmap; typedef u32 efi_tcg_event_log_format; typedef u32 efi_tcg_event_algorithm_bitmap; +/** + * struct tdEFI_TCG2_VERSION - structure of EFI TCG2 version + * @major: major version + * @minor: minor version + */ struct efi_tcg2_version { u8 major; u8 minor; }; +/** + * struct tdEFI_TCG2_EVENT_HEADER - structure of EFI TCG2 event header + * @header_size: size of the event header + * @header_version: header version + * @pcr_index: index of the PCR that is extended + * @event_type: type of the event that is extended + */ struct efi_tcg2_event_header { u32 header_size; u16 header_version; @@ -48,12 +67,27 @@ struct efi_tcg2_event_header { u32 event_type; } __packed; +/** + * struct tdEFI_TCG2_EVENT - structure of EFI TCG2 event + * @size: total size of the event including the size component, the header + * and the event data + * @header: event header + * @event: event to add + */ struct efi_tcg2_event { u32 size; struct efi_tcg2_event_header header; u8 event[]; } __packed; +/** + * struct tdUEFI_IMAGE_LOAD_EVENT - structure of PE/COFF image measurement + * @image_location_in_memory: image address + * @image_length_in_memory: image size + * @image_link_time_address: image link time address + * @length_of_device_path: devive path size + * @device_path: device path + */ struct uefi_image_load_event { efi_physical_addr_t image_location_in_memory; u64 image_length_in_memory; @@ -62,6 +96,23 @@ struct uefi_image_load_event { struct efi_device_path device_path[]; }; +/** + * struct tdEFI_TCG2_BOOT_SERVICE_CAPABILITY - protocol capability information + * @size: allocated size of the structure + * @structure_version: version of this structure + * @protocol_version: version of the EFI TCG2 protocol. + * @hash_algorithm_bitmap: supported hash algorithms + * @supported_event_logs: bitmap of supported event log formats + * @tpm_present_flag: false = TPM not present + * @max_command_size: max size (in bytes) of a command + * that can be sent to the TPM + * @max_response_size: max size (in bytes) of a response that + * can be provided by the TPM + * @manufacturer_id: 4-byte Vendor ID + * @number_of_pcr_banks: maximum number of PCR banks + * @active_pcr_banks: bitmap of currently active + * PCR banks (hashing algorithms). + */ struct efi_tcg2_boot_service_capability { u8 size; struct efi_tcg2_version structure_version; @@ -86,7 +137,7 @@ struct efi_tcg2_boot_service_capability { #define TCG_EFI_SPEC_ID_EVENT_SPEC_VERSION_ERRATA_TPM2 2 /** - * struct TCG_EfiSpecIdEventAlgorithmSize + * struct TCG_EfiSpecIdEventAlgorithmSize - hashing algorithm information * * @algorithm_id: algorithm defined in enum tpm2_algorithms * @digest_size: size of the algorithm @@ -97,7 +148,7 @@ struct tcg_efi_spec_id_event_algorithm_size { } __packed; /** - * struct TCG_EfiSpecIDEventStruct + * struct TCG_EfiSpecIDEventStruct - content of the event log header * * @signature: signature, set to Spec ID Event03 * @platform_class: class defined in TCG ACPI Specification @@ -130,7 +181,7 @@ struct tcg_efi_spec_id_event { } __packed; /** - * struct tdEFI_TCG2_FINAL_EVENTS_TABLE + * struct tdEFI_TCG2_FINAL_EVENTS_TABLE - log entries after Get Event Log * @version: version number for this structure * @number_of_events: number of events recorded after invocation of * GetEventLog() -- cgit v1.2.3 From 3ced574530e13b12cec3dc9ef87f1a175fb76c83 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 17 Aug 2021 14:52:16 +0200 Subject: efi_loader: use an enum for the memory allocation types For type checking we need an enum. Signed-off-by: Heinrich Schuchardt --- include/efi.h | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/include/efi.h b/include/efi.h index 6417a9b8c53..4eb573a2806 100644 --- a/include/efi.h +++ b/include/efi.h @@ -125,6 +125,34 @@ struct efi_table_hdr { u32 reserved; }; +/* Allocation types for calls to boottime->allocate_pages*/ +/** + * enum efi_allocate_type - address restriction for memory allocation + */ +enum efi_allocate_type { + /** + * @EFI_ALLOCATE_ANY_PAGES: + * Allocate any block of sufficient size. Ignore memory address. + */ + EFI_ALLOCATE_ANY_PAGES, + /** + * @EFI_ALLOCATE_MAX_ADDRESS: + * Allocate a memory block with an uppermost address less or equal + * to the indicated address. + */ + EFI_ALLOCATE_MAX_ADDRESS, + /** + * @EFI_ALLOCATE_ADDRESS: + * Allocate a memory block starting at the indicatged adress. + */ + EFI_ALLOCATE_ADDRESS, + /** + * @EFI_MAX_ALLOCATE_TYPE: + * Value use for range checking. + */ + EFI_MAX_ALLOCATE_TYPE, +}; + /* Enumeration of memory types introduced in UEFI */ enum efi_mem_type { EFI_RESERVED_MEMORY_TYPE, @@ -224,12 +252,6 @@ struct efi_mem_desc { #define EFI_MEMORY_DESCRIPTOR_VERSION 1 -/* Allocation types for calls to boottime->allocate_pages*/ -#define EFI_ALLOCATE_ANY_PAGES 0 -#define EFI_ALLOCATE_MAX_ADDRESS 1 -#define EFI_ALLOCATE_ADDRESS 2 -#define EFI_MAX_ALLOCATE_TYPE 3 - /* Types and defines for Time Services */ #define EFI_TIME_ADJUST_DAYLIGHT 0x1 #define EFI_TIME_IN_DAYLIGHT 0x2 -- cgit v1.2.3 From c91737b7f1a5180b8944eea2121347ef6429b17c Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 17 Aug 2021 15:02:23 +0200 Subject: efi_loader rename enum efi_mem_type to efi_memory_type Use the same name as in the UEFI specification to avoid confusion. Signed-off-by: Heinrich Schuchardt --- arch/x86/include/asm/hob.h | 2 +- include/efi.h | 2 +- include/efi_api.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/hob.h b/arch/x86/include/asm/hob.h index 56e11dbb28f..2f5b6e24c29 100644 --- a/arch/x86/include/asm/hob.h +++ b/arch/x86/include/asm/hob.h @@ -91,7 +91,7 @@ struct hob_mem_alloc { * Type EFI_MEMORY_TYPE is defined in AllocatePages() in the UEFI 2.0 * specification. */ - enum efi_mem_type mem_type; + enum efi_memory_type mem_type; /* padding */ u8 reserved[4]; }; diff --git a/include/efi.h b/include/efi.h index 4eb573a2806..18c13e0370a 100644 --- a/include/efi.h +++ b/include/efi.h @@ -154,7 +154,7 @@ enum efi_allocate_type { }; /* Enumeration of memory types introduced in UEFI */ -enum efi_mem_type { +enum efi_memory_type { EFI_RESERVED_MEMORY_TYPE, /* * The code portions of a loaded application. diff --git a/include/efi_api.h b/include/efi_api.h index 38ac47f1646..c8f959bb720 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -249,7 +249,7 @@ struct efi_memory_range { struct efi_memory_range_capsule { struct efi_capsule_header *header; /* EFI_MEMORY_TYPE: 0x80000000-0xFFFFFFFF */ - enum efi_mem_type os_requested_memory_type; + enum efi_memory_type os_requested_memory_type; u64 number_of_memory_ranges; struct efi_memory_range memory_ranges[]; } __packed; -- cgit v1.2.3 From 49d225e7bf3a26adfe6093978c04e454c82bd955 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 17 Aug 2021 15:05:31 +0200 Subject: efi_loader: use correct type for AllocatePages, AllocatePool Use enum efi_memory_type and enum_allocate_type in the definitions of the efi_allocate_pages(), efi_allocate_pool(). In the external UEFI API leave the type as int as the UEFI specification explicitely requires that enums use a 32bit type. Signed-off-by: Heinrich Schuchardt --- include/efi_loader.h | 9 +++++---- lib/efi_loader/efi_memory.c | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/efi_loader.h b/include/efi_loader.h index 32cb8d0f1ef..c440962fe52 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -676,13 +676,14 @@ struct efi_device_path *efi_get_dp_from_boot(const efi_guid_t guid); /* Generic EFI memory allocator, call this to get memory */ void *efi_alloc(uint64_t len, int memory_type); /* More specific EFI memory allocator, called by EFI payloads */ -efi_status_t efi_allocate_pages(int type, int memory_type, efi_uintn_t pages, - uint64_t *memory); +efi_status_t efi_allocate_pages(enum efi_allocate_type type, + enum efi_memory_type memory_type, + efi_uintn_t pages, uint64_t *memory); /* EFI memory free function. */ efi_status_t efi_free_pages(uint64_t memory, efi_uintn_t pages); /* EFI memory allocator for small allocations */ -efi_status_t efi_allocate_pool(int pool_type, efi_uintn_t size, - void **buffer); +efi_status_t efi_allocate_pool(enum efi_memory_type pool_type, + efi_uintn_t size, void **buffer); /* EFI pool memory free function. */ efi_status_t efi_free_pool(void *buffer); /* Returns the EFI memory map */ diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index be2f655dffd..f4acbee4f9b 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -454,7 +454,8 @@ static uint64_t efi_find_free_memory(uint64_t len, uint64_t max_addr) * @memory allocated memory * @return status code */ -efi_status_t efi_allocate_pages(int type, int memory_type, +efi_status_t efi_allocate_pages(enum efi_allocate_type type, + enum efi_memory_type memory_type, efi_uintn_t pages, uint64_t *memory) { u64 len = pages << EFI_PAGE_SHIFT; @@ -556,7 +557,7 @@ efi_status_t efi_free_pages(uint64_t memory, efi_uintn_t pages) * @buffer: allocated memory * Return: status code */ -efi_status_t efi_allocate_pool(int pool_type, efi_uintn_t size, void **buffer) +efi_status_t efi_allocate_pool(enum efi_memory_type pool_type, efi_uintn_t size, void **buffer) { efi_status_t r; u64 addr; -- cgit v1.2.3 From 426a15893f16c5f640bf8380b6a9086906e2f659 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 17 Aug 2021 15:15:23 +0200 Subject: efi_loader: use EfiBootServicesData for device path dp_alloc() was using a constant from the wrong enum resulting in creating device paths in EfiReservedMemory. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_device_path.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c index 9c3ac712fef..cbdb466da41 100644 --- a/lib/efi_loader/efi_device_path.c +++ b/lib/efi_loader/efi_device_path.c @@ -68,7 +68,7 @@ static void *dp_alloc(size_t sz) { void *buf; - if (efi_allocate_pool(EFI_ALLOCATE_ANY_PAGES, sz, &buf) != + if (efi_allocate_pool(EFI_BOOT_SERVICES_DATA, sz, &buf) != EFI_SUCCESS) { debug("EFI: ERROR: out of memory in %s\n", __func__); return NULL; -- cgit v1.2.3 From 9a4b3c8e914dbb9d06640d8e04db8a06dedca051 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 17 Aug 2021 16:15:34 +0200 Subject: efi_loader: use EfiBootServicesData for DP to text Memory allocated in the implementation of the EFI_DEVICE_PATH_TO_TEXT_PROTOCOL must be of type EfiBootServicesData. Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_device_path_to_text.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_device_path_to_text.c b/lib/efi_loader/efi_device_path_to_text.c index d46327a1c94..57fa9d97f71 100644 --- a/lib/efi_loader/efi_device_path_to_text.c +++ b/lib/efi_loader/efi_device_path_to_text.c @@ -34,7 +34,7 @@ static u16 *efi_str_to_u16(char *str) efi_status_t ret; len = sizeof(u16) * (utf8_utf16_strlen(str) + 1); - ret = efi_allocate_pool(EFI_ALLOCATE_ANY_PAGES, len, (void **)&out); + ret = efi_allocate_pool(EFI_BOOT_SERVICES_DATA, len, (void **)&out); if (ret != EFI_SUCCESS) return NULL; dst = out; -- cgit v1.2.3