Skip to contentSkip to conversation

spl: add support to booting with ATF

PATCH New Kever Yang 4 participants 5 messages May 5, 2017 – May 15, 2017

lore
Share & tools
lore

Kever Yang

author
#0 lore raw

PATCH v4 1/1 spl: add support to booting with ATF

ATF(ARM Trusted Firmware) is used by ARM arch64 SoCs, find more infomation about ATF at: https://github.com/ARM-software/arm-trusted-firmware

SPL is considered as BL2 in ATF terminology, it needs to load other parts of ATF binary like BL31, BL32, SCP-BL30, and BL33(U-Boot). And needs to prepare the parameter for BL31 which including entry and image information for all other images. Then the SPL handle PC to BL31 with the parameter, the BL31 will do the rest of work and at last get into U-Boot(BL33).

This patch needs work with patches from Andre for SPL support multi binary in FIT.

The entry point of bl31 and bl33 are still using hard code because we still can not get them from the FIT image information.

---

Changes in v4:
- fix description in Kconfig
- add debug log before get into ATF BL31
- remove '_t' postfix for structure define

Changes in v3:
- remove no neccessary Macro definition in header file.
- rename some Macro with 'ATF_' prefix.

Changes in v2:
- Kconfig comment update with Simon's suggestion
- including file ordering,
- update function comment format,
- use 'if' instead of '#ifdef' for bl31_entry
- add ATF Kconfig option depend on ARM64

Changes in v1:
- license update
- split out as separate patch

 common/spl/Kconfig   |  14 ++++
 common/spl/Makefile  |   1 +
 common/spl/spl.c     |   5 ++
 common/spl/spl_atf.c |  97 +++++++++++++++++++++++++++
 include/atf_common.h | 183 +++++++++++++++++++++++++++++++++++++++++++++++++++
 include/spl.h        |   1 +
 6 files changed, 301 insertions(+)
 create mode 100644 common/spl/spl_atf.c
 create mode 100644 include/atf_common.h
common/spl/Kconfig +14 -0
index ea6fbb6..90c3c38 100644
@@ -688,6 +688,20 @@ config SPL_YMODEM_SUPPORT
 	  means of transmitting U-Boot over a serial line for using in SPL,
 	  with a checksum to ensure correctness.
 
+config SPL_ATF_SUPPORT
+	bool "Support ARM Trusted Firmware"
+	depends on SPL && ARM64
+	help
+	  ATF(ARM Trusted Firmware) is a component for ARM arch64 which which
+	  is loaded by SPL(which is considered as BL2 in ATF terminology).
+	  More detail at: https://github.com/ARM-software/arm-trusted-firmware
+
+config SPL_ATF_TEXT_BASE
+	depends on SPL_ATF_SUPPORT
+	hex "ATF BL31 base address"
+	help
+	  This is the base address in memory for ATF BL31 text and entry point.
+
 config TPL_ENV_SUPPORT
 	bool "Support an environment"
 	depends on TPL
common/spl/Makefile +1 -0
index 1933cbd..b3b34d6 100644
@@ -20,6 +20,7 @@ endif
 obj-$(CONFIG_SPL_UBI) += spl_ubi.o
 obj-$(CONFIG_SPL_NET_SUPPORT) += spl_net.o
 obj-$(CONFIG_SPL_MMC_SUPPORT) += spl_mmc.o
+obj-$(CONFIG_SPL_ATF_SUPPORT) += spl_atf.o
 obj-$(CONFIG_SPL_USB_SUPPORT) += spl_usb.o
 obj-$(CONFIG_SPL_FAT_SUPPORT) += spl_fat.o
 obj-$(CONFIG_SPL_EXT_SUPPORT) += spl_ext.o
common/spl/spl.c +5 -0
index a3e73b8..97f1163 100644
@@ -372,6 +372,11 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 	      gd->malloc_ptr / 1024);
 #endif
 
+	if (IS_ENABLED(CONFIG_SPL_ATF_SUPPORT)) {
+		debug("loaded - jumping to U-Boot via ATF BL31.\n");
+		bl31_entry();
+	}
+
 	debug("loaded - jumping to U-Boot...\n");
 	spl_board_prepare_for_boot();
 	jump_to_image_no_args(&spl_image);
common/spl/spl_atf.c new file +97 -0

97 lines not on this page · raw message

include/atf_common.h new file +183 -0

183 lines not on this page · raw message

include/spl.h +1 -0
index 2e5b885..387054d 100644
@@ -268,4 +268,5 @@ int spl_dfu_cmd(int usbctrl, char *dfu_alt_info, char *interface, char *devstr);
 int spl_mmc_load_image(struct spl_image_info *spl_image,
 		       struct spl_boot_device *bootdev);
 
+void bl31_entry(void);
 #endif
Signature · 1 line
1.9.1
#1 lore raw

PATCH v4 1/1 spl: add support to booting with ATF

Am Freitag, 5. Mai 2017, 11:47:45 CEST schrieb Kever Yang:

Quoted 9 lines

ATF(ARM Trusted Firmware) is used by ARM arch64 SoCs, find more infomation about ATF at: https://github.com/ARM-software/arm-trusted-firmware

SPL is considered as BL2 in ATF terminology, it needs to load other parts of ATF binary like BL31, BL32, SCP-BL30, and BL33(U-Boot). And needs to prepare the parameter for BL31 which including entry and image information for all other images. Then the SPL handle PC to BL31 with the parameter, the BL31 will do the rest of work and at last get into U-Boot(BL33).

Quoted 7 lines

This patch needs work with patches from Andre for SPL support multi binary in FIT.

The entry point of bl31 and bl33 are still using hard code because we still can not get them from the FIT image information.

On a rk3399-firefly

#2 lore raw

PATCH v4 1/1 spl: add support to booting with ATF

In reply to Kever Yang
Quoted 38 lines · Kever Yang

ATF(ARM Trusted Firmware) is used by ARM arch64 SoCs, find more infomation about ATF at: https://github.com/ARM-software/arm-trusted-firmware

SPL is considered as BL2 in ATF terminology, it needs to load other parts of ATF binary like BL31, BL32, SCP-BL30, and BL33(U-Boot). And needs to prepare the parameter for BL31 which including entry and image information for all other images. Then the SPL handle PC to BL31 with the parameter, the BL31 will do the rest of work and at last get into U-Boot(BL33).

This patch needs work with patches from Andre for SPL support multi binary in FIT.

The entry point of bl31 and bl33 are still using hard code because we still can not get them from the FIT image information.

---

Changes in v4:
- fix description in Kconfig
- add debug log before get into ATF BL31
- remove '_t' postfix for structure define

Changes in v3:
- remove no neccessary Macro definition in header file.
- rename some Macro with 'ATF_' prefix.

Changes in v2:
- Kconfig comment update with Simon's suggestion
- including file ordering,
- update function comment format,
- use 'if' instead of '#ifdef' for bl31_entry
- add ATF Kconfig option depend on ARM64

Changes in v1:
- license update
- split out as separate patch

Quoted 9 lines
 common/spl/Kconfig   |  14 ++++
 common/spl/Makefile  |   1 +
 common/spl/spl.c     |   5 ++
 common/spl/spl_atf.c |  97 +++++++++++++++++++++++++++
 include/atf_common.h | 183 +++++++++++++++++++++++++++++++++++++++++++++++++++
 include/spl.h        |   1 +
 6 files changed, 301 insertions(+)
 create mode 100644 common/spl/spl_atf.c
 create mode 100644 include/atf_common.h
#3 lore raw

PATCH v4 1/1 spl: add support to booting with ATF

In reply to Kever Yang
Quoted 9 lines · Kever Yang

ATF(ARM Trusted Firmware) is used by ARM arch64 SoCs, find more infomation about ATF at: https://github.com/ARM-software/arm-trusted-firmware

SPL is considered as BL2 in ATF terminology, it needs to load other parts of ATF binary like BL31, BL32, SCP-BL30, and BL33(U-Boot). And needs to prepare the parameter for BL31 which including entry and image information for all other images. Then the SPL handle PC to BL31 with the parameter, the BL31 will do the rest of work and at last get into U-Boot(BL33).

Quoted 7 lines

This patch needs work with patches from Andre for SPL support multi binary in FIT.

The entry point of bl31 and bl33 are still using hard code because we still can not get them from the FIT image information.

Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170514/4ae833b2/attachment.sig>
#4 lore raw

PATCH v4 1/1 spl: add support to booting with ATF

In reply to Kever Yang
Quoted 12 lines · Kever Yang

ATF(ARM Trusted Firmware) is used by ARM arch64 SoCs, find more infomation about ATF at: https://github.com/ARM-software/arm-trusted-firmware

SPL is considered as BL2 in ATF terminology, it needs to load other parts of ATF binary like BL31, BL32, SCP-BL30, and BL33(U-Boot). And needs to prepare the parameter for BL31 which including entry and image information for all other images. Then the SPL handle PC to BL31 with the parameter, the BL31 will do the rest of work and at last get into U-Boot(BL33).

This patch needs work with patches from Andre for SPL support multi binary in FIT.

Quoted 7 lines

The entry point of bl31 and bl33 are still using hard code because we still can not get them from the FIT image information.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170515/9a863b7f/attachment.sig>