mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/6] ARM: Merge single PBL code into multi PBL code
@ 2019-09-16  7:27 Sascha Hauer
  2019-09-16  7:27 ` [PATCH 1/6] ARM: remove PBL_FORCE_PIGGYDATA_COPY Sascha Hauer
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Sascha Hauer @ 2019-09-16  7:27 UTC (permalink / raw)
  To: Barebox List

Hi All,

This series merges the single PBL code into the multi PBL code. Some
preparations are needed, but in the end the single PBL code just
vanishes leaving a simpler startup path. The last patch is a rebased
version of Andreys patch he recently sent.

Sascha

Andrey Smirnov (1):
  ARM: aarch64: Re-implement most of barebox_arm_entry() in assembly

Sascha Hauer (5):
  ARM: remove PBL_FORCE_PIGGYDATA_COPY
  ARM: Compile dtbs for lowlevel code
  ARM: drop bultin DTB
  ARM: Merge single pbl with multi pbl
  ARM: remove now unused PBL code

 Makefile                                      |   2 +-
 arch/arm/Kconfig                              |  14 --
 arch/arm/Makefile                             |   8 -
 arch/arm/boards/canon-a1100/lowlevel.c        |   9 +-
 arch/arm/boards/module-mb7707/lowlevel.c      |   8 +-
 arch/arm/boards/versatile/lowlevel.c          |   9 +-
 arch/arm/boards/virt2real/lowlevel.c          |   8 +-
 arch/arm/configs/canon-a1100_defconfig        |   1 -
 arch/arm/configs/module-mb7707_defconfig      |   1 -
 .../arm/configs/versatilepb_arm1176_defconfig |   2 -
 arch/arm/configs/versatilepb_defconfig        |   2 -
 arch/arm/configs/virt2real_defconfig          |   1 -
 arch/arm/cpu/Makefile                         |   7 +-
 arch/arm/cpu/dtb.c                            |   6 -
 arch/arm/cpu/entry.c                          |  23 ++-
 arch/arm/cpu/entry.h                          |  10 +-
 arch/arm/cpu/entry_ll.S                       |  25 +++
 arch/arm/cpu/entry_ll_64.S                    |  23 +++
 arch/arm/cpu/start-pbl.c                      | 109 ----------
 arch/arm/cpu/uncompress.c                     |  17 +-
 arch/arm/dts/Makefile                         | 195 +++++++++---------
 arch/arm/include/asm/common.h                 |   3 +-
 arch/arm/pbl/.gitignore                       |   9 -
 arch/arm/pbl/Makefile                         |  61 ------
 arch/arm/pbl/piggy.comp_copy.S                |   6 -
 arch/arm/pbl/piggy.gzip.S                     |   6 -
 arch/arm/pbl/piggy.lz4.S                      |   6 -
 arch/arm/pbl/piggy.lzo.S                      |   6 -
 arch/arm/pbl/piggy.xzkern.S                   |   6 -
 images/Makefile                               |   7 +
 pbl/Kconfig                                   |   8 -
 scripts/Makefile.lib                          |   4 +-
 32 files changed, 218 insertions(+), 384 deletions(-)
 create mode 100644 arch/arm/cpu/entry_ll.S
 create mode 100644 arch/arm/cpu/entry_ll_64.S
 delete mode 100644 arch/arm/cpu/start-pbl.c
 delete mode 100644 arch/arm/pbl/.gitignore
 delete mode 100644 arch/arm/pbl/Makefile
 delete mode 100644 arch/arm/pbl/piggy.comp_copy.S
 delete mode 100644 arch/arm/pbl/piggy.gzip.S
 delete mode 100644 arch/arm/pbl/piggy.lz4.S
 delete mode 100644 arch/arm/pbl/piggy.lzo.S
 delete mode 100644 arch/arm/pbl/piggy.xzkern.S

-- 
2.23.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/6] ARM: remove PBL_FORCE_PIGGYDATA_COPY
  2019-09-16  7:27 [PATCH 0/6] ARM: Merge single PBL code into multi PBL code Sascha Hauer
@ 2019-09-16  7:27 ` Sascha Hauer
  2019-09-16  7:27 ` [PATCH 2/6] ARM: Compile dtbs for lowlevel code Sascha Hauer
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2019-09-16  7:27 UTC (permalink / raw)
  To: Barebox List

This option is unused in the tree, remove it for now. If you need this
option, let me know, we'll find another solution.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/cpu/start-pbl.c | 13 -------------
 pbl/Kconfig              |  8 --------
 2 files changed, 21 deletions(-)

diff --git a/arch/arm/cpu/start-pbl.c b/arch/arm/cpu/start-pbl.c
index 796239d902..0006f40d55 100644
--- a/arch/arm/cpu/start-pbl.c
+++ b/arch/arm/cpu/start-pbl.c
@@ -52,7 +52,6 @@ extern void *input_data_end;
 __noreturn void barebox_single_pbl_start(unsigned long membase,
 		unsigned long memsize, void *boarddata)
 {
-	unsigned long offset;
 	unsigned long pg_start, pg_end, pg_len, uncompressed_len;
 	void __noreturn (*barebox)(unsigned long, unsigned long, void *);
 	unsigned long endmem = membase + memsize;
@@ -61,9 +60,6 @@ __noreturn void barebox_single_pbl_start(unsigned long membase,
 	if (IS_ENABLED(CONFIG_PBL_RELOCATABLE))
 		relocate_to_current_adr();
 
-	/* Get offset between linked address and runtime address */
-	offset = get_runtime_offset();
-
 	pg_start = (unsigned long)&input_data + global_variable_offset();
 	pg_end = (unsigned long)&input_data_end + global_variable_offset();
 	pg_len = pg_end - pg_start;
@@ -74,15 +70,6 @@ __noreturn void barebox_single_pbl_start(unsigned long membase,
 	else
 		barebox_base = TEXT_BASE;
 
-	if (offset && (IS_ENABLED(CONFIG_PBL_FORCE_PIGGYDATA_COPY) ||
-				region_overlap(pg_start, pg_len, barebox_base, pg_len * 4))) {
-		/*
-		 * copy piggydata binary to its link address
-		 */
-		memcpy(&input_data, (void *)pg_start, pg_len);
-		pg_start = (uint32_t)&input_data;
-	}
-
 	setup_c();
 
 	if (IS_ENABLED(CONFIG_MMU_EARLY)) {
diff --git a/pbl/Kconfig b/pbl/Kconfig
index 7e6077f96d..6e8cc3ac04 100644
--- a/pbl/Kconfig
+++ b/pbl/Kconfig
@@ -24,14 +24,6 @@ config PBL_SINGLE_IMAGE
 	depends on !HAVE_PBL_MULTI_IMAGES
 	default y
 
-config PBL_FORCE_PIGGYDATA_COPY
-	bool
-	help
-	  In some case we need to copy the PIGGYDATA as the link address
-	  as example we run from SRAM and shutdown the SDRAM/DDR for
-	  reconfiguration but most of the time we just need to copy the
-	  executable code.
-
 if PBL_IMAGE
 
 config PBL_RELOCATABLE
-- 
2.23.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/6] ARM: Compile dtbs for lowlevel code
  2019-09-16  7:27 [PATCH 0/6] ARM: Merge single PBL code into multi PBL code Sascha Hauer
  2019-09-16  7:27 ` [PATCH 1/6] ARM: remove PBL_FORCE_PIGGYDATA_COPY Sascha Hauer
@ 2019-09-16  7:27 ` Sascha Hauer
  2019-09-16  7:27 ` [PATCH 3/6] ARM: drop bultin DTB Sascha Hauer
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2019-09-16  7:27 UTC (permalink / raw)
  To: Barebox List

When no PBL is used then the DTB is used in the real barebox binary. We
already have lwl-y for code which needs to be in PBL when existing and
in the real barebox binary otherwise. Do the same for the DTBs and
compile them with lwl-dtb-y.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/dts/Makefile | 190 +++++++++++++++++++++---------------------
 scripts/Makefile.lib  |   4 +-
 2 files changed, 97 insertions(+), 97 deletions(-)

diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index f33e6a4989..7a212174de 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -7,45 +7,45 @@ endif
 # created.
 obj- += dummy.o
 
-pbl-dtb-$(CONFIG_MACH_ADVANTECH_ROM_742X) += imx6dl-advantech-rom-7421.dtb.o
-pbl-dtb-$(CONFIG_MACH_AFI_GF) += am335x-afi-gf.dtb.o
-pbl-dtb-$(CONFIG_MACH_BEAGLEBONE) += am335x-bone.dtb.o am335x-boneblack.dtb.o am335x-bone-common.dtb.o
-pbl-dtb-$(CONFIG_MACH_CM_FX6) += imx6dl-cm-fx6.dtb.o imx6q-cm-fx6.dtb.o imx6q-utilite.dtb.o
-pbl-dtb-$(CONFIG_MACH_DFI_FS700_M60) += imx6q-dfi-fs700-m60-6q.dtb.o imx6dl-dfi-fs700-m60-6s.dtb.o
-pbl-dtb-$(CONFIG_MACH_DUCKBILL) += imx28-duckbill.dtb.o
-pbl-dtb-$(CONFIG_MACH_KINDLE_MX50) += imx50-kindle-d01100.dtb.o imx50-kindle-d01200.dtb.o imx50-kindle-ey21.dtb.o
-pbl-dtb-$(CONFIG_MACH_EFIKA_MX_SMARTBOOK) += imx51-genesi-efika-sb.dtb.o
-pbl-dtb-$(CONFIG_MACH_ELTEC_HIPERCAM) += imx6dl-eltec-hipercam.dtb.o
-pbl-dtb-$(CONFIG_MACH_EMBEST_RIOTBOARD) += imx6s-riotboard.dtb.o
-pbl-dtb-$(CONFIG_MACH_EMBEDSKY_E9) += imx6q-embedsky-e9.dtb.o
-pbl-dtb-$(CONFIG_MACH_FREESCALE_MX51_PDK) += imx51-babbage.dtb.o
-pbl-dtb-$(CONFIG_MACH_FREESCALE_MX53_LOCO) += imx53-qsb.dtb.o imx53-qsrb.dtb.o
-pbl-dtb-$(CONFIG_MACH_TX53) += imx53-tx53-xx30.dtb.o imx53-tx53-1011.dtb.o
-pbl-dtb-$(CONFIG_MACH_CCMX51) += imx51-ccxmx51.dtb.o
-pbl-dtb-$(CONFIG_MACH_CCMX53) += imx53-ccxmx53.dtb.o
-pbl-dtb-$(CONFIG_MACH_DIGI_CCIMX6ULSBCPRO) += imx6ul-ccimx6ulsbcpro.dtb.o
-pbl-dtb-$(CONFIG_MACH_FREESCALE_MX53_VMX53) += imx53-voipac-bsb.dtb.o
-pbl-dtb-$(CONFIG_MACH_FREESCALE_MX7_SABRESD) += imx7d-sdb.dtb.o
-pbl-dtb-$(CONFIG_MACH_GK802) += imx6q-gk802.dtb.o
-pbl-dtb-$(CONFIG_MACH_GLOBALSCALE_GURUPLUG) += kirkwood-guruplug-server-plus-bb.dtb.o
-pbl-dtb-$(CONFIG_MACH_GLOBALSCALE_MIRABOX) += armada-370-mirabox-bb.dtb.o
-pbl-dtb-$(CONFIG_MACH_GRINN_LITEBOARD) += imx6ul-liteboard.dtb.o
-pbl-dtb-$(CONFIG_MACH_GUF_SANTARO) += imx6q-guf-santaro.dtb.o
-pbl-dtb-$(CONFIG_MACH_GUF_VINCELL) += imx53-guf-vincell.dtb.o imx53-guf-vincell-lt.dtb.o
-pbl-dtb-$(CONFIG_MACH_GW_VENTANA) += imx6q-gw54xx.dtb.o
-pbl-dtb-$(CONFIG_MACH_KONTRON_SAMX6I) += imx6q-samx6i.dtb.o \
+lwl-dtb-$(CONFIG_MACH_ADVANTECH_ROM_742X) += imx6dl-advantech-rom-7421.dtb.o
+lwl-dtb-$(CONFIG_MACH_AFI_GF) += am335x-afi-gf.dtb.o
+lwl-dtb-$(CONFIG_MACH_BEAGLEBONE) += am335x-bone.dtb.o am335x-boneblack.dtb.o am335x-bone-common.dtb.o
+lwl-dtb-$(CONFIG_MACH_CM_FX6) += imx6dl-cm-fx6.dtb.o imx6q-cm-fx6.dtb.o imx6q-utilite.dtb.o
+lwl-dtb-$(CONFIG_MACH_DFI_FS700_M60) += imx6q-dfi-fs700-m60-6q.dtb.o imx6dl-dfi-fs700-m60-6s.dtb.o
+lwl-dtb-$(CONFIG_MACH_DUCKBILL) += imx28-duckbill.dtb.o
+lwl-dtb-$(CONFIG_MACH_KINDLE_MX50) += imx50-kindle-d01100.dtb.o imx50-kindle-d01200.dtb.o imx50-kindle-ey21.dtb.o
+lwl-dtb-$(CONFIG_MACH_EFIKA_MX_SMARTBOOK) += imx51-genesi-efika-sb.dtb.o
+lwl-dtb-$(CONFIG_MACH_ELTEC_HIPERCAM) += imx6dl-eltec-hipercam.dtb.o
+lwl-dtb-$(CONFIG_MACH_EMBEST_RIOTBOARD) += imx6s-riotboard.dtb.o
+lwl-dtb-$(CONFIG_MACH_EMBEDSKY_E9) += imx6q-embedsky-e9.dtb.o
+lwl-dtb-$(CONFIG_MACH_FREESCALE_MX51_PDK) += imx51-babbage.dtb.o
+lwl-dtb-$(CONFIG_MACH_FREESCALE_MX53_LOCO) += imx53-qsb.dtb.o imx53-qsrb.dtb.o
+lwl-dtb-$(CONFIG_MACH_TX53) += imx53-tx53-xx30.dtb.o imx53-tx53-1011.dtb.o
+lwl-dtb-$(CONFIG_MACH_CCMX51) += imx51-ccxmx51.dtb.o
+lwl-dtb-$(CONFIG_MACH_CCMX53) += imx53-ccxmx53.dtb.o
+lwl-dtb-$(CONFIG_MACH_DIGI_CCIMX6ULSBCPRO) += imx6ul-ccimx6ulsbcpro.dtb.o
+lwl-dtb-$(CONFIG_MACH_FREESCALE_MX53_VMX53) += imx53-voipac-bsb.dtb.o
+lwl-dtb-$(CONFIG_MACH_FREESCALE_MX7_SABRESD) += imx7d-sdb.dtb.o
+lwl-dtb-$(CONFIG_MACH_GK802) += imx6q-gk802.dtb.o
+lwl-dtb-$(CONFIG_MACH_GLOBALSCALE_GURUPLUG) += kirkwood-guruplug-server-plus-bb.dtb.o
+lwl-dtb-$(CONFIG_MACH_GLOBALSCALE_MIRABOX) += armada-370-mirabox-bb.dtb.o
+lwl-dtb-$(CONFIG_MACH_GRINN_LITEBOARD) += imx6ul-liteboard.dtb.o
+lwl-dtb-$(CONFIG_MACH_GUF_SANTARO) += imx6q-guf-santaro.dtb.o
+lwl-dtb-$(CONFIG_MACH_GUF_VINCELL) += imx53-guf-vincell.dtb.o imx53-guf-vincell-lt.dtb.o
+lwl-dtb-$(CONFIG_MACH_GW_VENTANA) += imx6q-gw54xx.dtb.o
+lwl-dtb-$(CONFIG_MACH_KONTRON_SAMX6I) += imx6q-samx6i.dtb.o \
 					imx6dl-samx6i.dtb.o
-pbl-dtb-$(CONFIG_MACH_LENOVO_IX4_300D) += armada-xp-lenovo-ix4-300d-bb.dtb.o
-pbl-dtb-$(CONFIG_MACH_MARVELL_ARMADA_XP_GP) += armada-xp-gp-bb.dtb.o armada-xp-db-bb.dtb.o
-pbl-dtb-$(CONFIG_MACH_MX28EVK) += imx28-evk.dtb.o
-pbl-dtb-$(CONFIG_MACH_NETGEAR_RN104) += armada-370-rn104-bb.dtb.o
-pbl-dtb-$(CONFIG_MACH_NETGEAR_RN2120) += armada-xp-rn2120-bb.dtb.o
-pbl-dtb-$(CONFIG_MACH_NITROGEN6) += imx6q-nitrogen6x.dtb.o imx6dl-nitrogen6x.dtb.o imx6qp-nitrogen6_max.dtb.o
-pbl-dtb-$(CONFIG_MACH_NVIDIA_BEAVER) += tegra30-beaver.dtb.o
-pbl-dtb-$(CONFIG_MACH_NVIDIA_JETSON) += tegra124-jetson-tk1.dtb.o
-pbl-dtb-$(CONFIG_MACH_PCA100) += imx27-phytec-phycard-s-rdk-bb.dtb.o
-pbl-dtb-$(CONFIG_MACH_PCM038) += imx27-phytec-phycore-rdk.dtb.o
-pbl-dtb-$(CONFIG_MACH_PHYTEC_SOM_AM335X) += am335x-phytec-phyflex-som.dtb.o am335x-phytec-phyflex-som-mlo.dtb.o \
+lwl-dtb-$(CONFIG_MACH_LENOVO_IX4_300D) += armada-xp-lenovo-ix4-300d-bb.dtb.o
+lwl-dtb-$(CONFIG_MACH_MARVELL_ARMADA_XP_GP) += armada-xp-gp-bb.dtb.o armada-xp-db-bb.dtb.o
+lwl-dtb-$(CONFIG_MACH_MX28EVK) += imx28-evk.dtb.o
+lwl-dtb-$(CONFIG_MACH_NETGEAR_RN104) += armada-370-rn104-bb.dtb.o
+lwl-dtb-$(CONFIG_MACH_NETGEAR_RN2120) += armada-xp-rn2120-bb.dtb.o
+lwl-dtb-$(CONFIG_MACH_NITROGEN6) += imx6q-nitrogen6x.dtb.o imx6dl-nitrogen6x.dtb.o imx6qp-nitrogen6_max.dtb.o
+lwl-dtb-$(CONFIG_MACH_NVIDIA_BEAVER) += tegra30-beaver.dtb.o
+lwl-dtb-$(CONFIG_MACH_NVIDIA_JETSON) += tegra124-jetson-tk1.dtb.o
+lwl-dtb-$(CONFIG_MACH_PCA100) += imx27-phytec-phycard-s-rdk-bb.dtb.o
+lwl-dtb-$(CONFIG_MACH_PCM038) += imx27-phytec-phycore-rdk.dtb.o
+lwl-dtb-$(CONFIG_MACH_PHYTEC_SOM_AM335X) += am335x-phytec-phyflex-som.dtb.o am335x-phytec-phyflex-som-mlo.dtb.o \
 	am335x-phytec-phyflex-som-no-spi.dtb.o am335x-phytec-phyflex-som-no-eeprom.dtb.o \
 	am335x-phytec-phyflex-som-no-spi-no-eeprom.dtb.o \
 	am335x-phytec-phycore-som-mlo.dtb.o \
@@ -53,7 +53,7 @@ pbl-dtb-$(CONFIG_MACH_PHYTEC_SOM_AM335X) += am335x-phytec-phyflex-som.dtb.o am33
 	am335x-phytec-phycore-som-nand-no-eeprom.dtb.o am335x-phytec-phycore-som-nand-no-spi-no-eeprom.dtb.o \
 	am335x-phytec-phycore-som-emmc.dtb.o \
 	am335x-phytec-phycard-som.dtb.o am335x-phytec-phycard-som-mlo.dtb.o
-pbl-dtb-$(CONFIG_MACH_PHYTEC_SOM_IMX6) += imx6q-phytec-pbaa03.dtb.o \
+lwl-dtb-$(CONFIG_MACH_PHYTEC_SOM_IMX6) += imx6q-phytec-pbaa03.dtb.o \
 				imx6s-phytec-pbab01.dtb.o \
 				imx6dl-phytec-pbab01.dtb.o \
 				imx6q-phytec-pbab01.dtb.o \
@@ -71,61 +71,61 @@ pbl-dtb-$(CONFIG_MACH_PHYTEC_SOM_IMX6) += imx6q-phytec-pbaa03.dtb.o \
 				imx6ull-phytec-phycore-som-lc-nand.dtb.o \
 				imx6ull-phytec-phycore-som-nand.dtb.o \
 				imx6ull-phytec-phycore-som-emmc.dtb.o
-pbl-dtb-$(CONFIG_MACH_PHYTEC_PHYCORE_IMX7) += imx7d-phyboard-zeta.dtb.o
-pbl-dtb-$(CONFIG_MACH_PHYTEC_SOM_IMX8MQ) += imx8mq-phytec-phycore-som.dtb.o
-pbl-dtb-$(CONFIG_MACH_PLATHOME_OPENBLOCKS_AX3) += armada-xp-openblocks-ax3-4-bb.dtb.o
-pbl-dtb-$(CONFIG_MACH_PLATHOME_OPENBLOCKS_A6) += kirkwood-openblocks_a6-bb.dtb.o
-pbl-dtb-$(CONFIG_MACH_RADXA_ROCK) += rk3188-radxarock.dtb.o
-pbl-dtb-$(CONFIG_MACH_PHYTEC_SOM_RK3288) += rk3288-phycore-som.dtb.o
-pbl-dtb-$(CONFIG_MACH_REALQ7) += imx6q-dmo-edmqmx6.dtb.o
-pbl-dtb-$(CONFIG_MACH_RPI) += bcm2835-rpi.dtb.o
-pbl-dtb-$(CONFIG_MACH_RPI2) += bcm2836-rpi-2.dtb.o
-pbl-dtb-$(CONFIG_MACH_RPI3) += bcm2837-rpi-3.dtb.o
-pbl-dtb-$(CONFIG_MACH_RPI_CM3) += bcm2837-rpi-cm3.dtb.o
-pbl-dtb-$(CONFIG_MACH_SABRELITE) += imx6q-sabrelite.dtb.o imx6dl-sabrelite.dtb.o
-pbl-dtb-$(CONFIG_MACH_SABRESD) += imx6q-sabresd.dtb.o
-pbl-dtb-$(CONFIG_MACH_FREESCALE_IMX6SX_SABRESDB) += imx6sx-sdb.dtb.o
-pbl-dtb-$(CONFIG_MACH_SOCFPGA_ALTERA_SOCDK) += socfpga_cyclone5_socdk.dtb.o
-pbl-dtb-$(CONFIG_MACH_SOCFPGA_EBV_SOCRATES) += socfpga_cyclone5_socrates.dtb.o
-pbl-dtb-$(CONFIG_MACH_SOCFPGA_REFLEX_ACHILLES) += socfpga_arria10_achilles.dtb.o
-pbl-dtb-$(CONFIG_MACH_SOCFPGA_TERASIC_DE0_NANO_SOC) += socfpga_cyclone5_de0_nano_soc.dtb.o
-pbl-dtb-$(CONFIG_MACH_SOCFPGA_TERASIC_SOCKIT) += socfpga_cyclone5_sockit.dtb.o
-pbl-dtb-$(CONFIG_MACH_SOLIDRUN_CUBOX) += dove-cubox-bb.dtb.o
-pbl-dtb-$(CONFIG_MACH_SOLIDRUN_MICROSOM) += imx6dl-hummingboard.dtb.o imx6q-hummingboard.dtb.o \
+lwl-dtb-$(CONFIG_MACH_PHYTEC_PHYCORE_IMX7) += imx7d-phyboard-zeta.dtb.o
+lwl-dtb-$(CONFIG_MACH_PHYTEC_SOM_IMX8MQ) += imx8mq-phytec-phycore-som.dtb.o
+lwl-dtb-$(CONFIG_MACH_PLATHOME_OPENBLOCKS_AX3) += armada-xp-openblocks-ax3-4-bb.dtb.o
+lwl-dtb-$(CONFIG_MACH_PLATHOME_OPENBLOCKS_A6) += kirkwood-openblocks_a6-bb.dtb.o
+lwl-dtb-$(CONFIG_MACH_RADXA_ROCK) += rk3188-radxarock.dtb.o
+lwl-dtb-$(CONFIG_MACH_PHYTEC_SOM_RK3288) += rk3288-phycore-som.dtb.o
+lwl-dtb-$(CONFIG_MACH_REALQ7) += imx6q-dmo-edmqmx6.dtb.o
+lwl-dtb-$(CONFIG_MACH_RPI) += bcm2835-rpi.dtb.o
+lwl-dtb-$(CONFIG_MACH_RPI2) += bcm2836-rpi-2.dtb.o
+lwl-dtb-$(CONFIG_MACH_RPI3) += bcm2837-rpi-3.dtb.o
+lwl-dtb-$(CONFIG_MACH_RPI_CM3) += bcm2837-rpi-cm3.dtb.o
+lwl-dtb-$(CONFIG_MACH_SABRELITE) += imx6q-sabrelite.dtb.o imx6dl-sabrelite.dtb.o
+lwl-dtb-$(CONFIG_MACH_SABRESD) += imx6q-sabresd.dtb.o
+lwl-dtb-$(CONFIG_MACH_FREESCALE_IMX6SX_SABRESDB) += imx6sx-sdb.dtb.o
+lwl-dtb-$(CONFIG_MACH_SOCFPGA_ALTERA_SOCDK) += socfpga_cyclone5_socdk.dtb.o
+lwl-dtb-$(CONFIG_MACH_SOCFPGA_EBV_SOCRATES) += socfpga_cyclone5_socrates.dtb.o
+lwl-dtb-$(CONFIG_MACH_SOCFPGA_REFLEX_ACHILLES) += socfpga_arria10_achilles.dtb.o
+lwl-dtb-$(CONFIG_MACH_SOCFPGA_TERASIC_DE0_NANO_SOC) += socfpga_cyclone5_de0_nano_soc.dtb.o
+lwl-dtb-$(CONFIG_MACH_SOCFPGA_TERASIC_SOCKIT) += socfpga_cyclone5_sockit.dtb.o
+lwl-dtb-$(CONFIG_MACH_SOLIDRUN_CUBOX) += dove-cubox-bb.dtb.o
+lwl-dtb-$(CONFIG_MACH_SOLIDRUN_MICROSOM) += imx6dl-hummingboard.dtb.o imx6q-hummingboard.dtb.o \
 				imx6dl-hummingboard2.dtb.o imx6q-hummingboard2.dtb.o \
 				imx6q-h100.dtb.o
-pbl-dtb-$(CONFIG_MACH_STM32MP157C_DK2) += stm32mp157c-dk2.dtb.o
-pbl-dtb-$(CONFIG_MACH_SCB9328) += imx1-scb9328.dtb.o
-pbl-dtb-$(CONFIG_MACH_TECHNEXION_WANDBOARD) += imx6q-wandboard.dtb.o imx6dl-wandboard.dtb.o
-pbl-dtb-$(CONFIG_MACH_TECHNEXION_PICO_HOBBIT) += imx6ul-pico-hobbit.dtb.o
-pbl-dtb-$(CONFIG_MACH_NXP_IMX6ULL_EVK) += imx6ull-14x14-evk.dtb.o
-pbl-dtb-$(CONFIG_MACH_NXP_IMX8MQ_EVK) += imx8mq-evk.dtb.o
-pbl-dtb-$(CONFIG_MACH_TORADEX_COLIBRI_T20) += tegra20-colibri-iris.dtb.o
-pbl-dtb-$(CONFIG_MACH_TOSHIBA_AC100) += tegra20-paz00.dtb.o
-pbl-dtb-$(CONFIG_MACH_TQMA53) += imx53-mba53.dtb.o
-pbl-dtb-$(CONFIG_MACH_TQMA6X) += imx6dl-mba6x.dtb.o imx6q-mba6x.dtb.o
-pbl-dtb-$(CONFIG_MACH_TX25) += imx25-karo-tx25.dtb.o
-pbl-dtb-$(CONFIG_MACH_TX6X) += imx6dl-tx6u.dtb.o
-pbl-dtb-$(CONFIG_MACH_TX6X) += imx6q-tx6q.dtb.o
-pbl-dtb-$(CONFIG_MACH_TURRIS_OMNIA) += armada-385-turris-omnia-bb.dtb.o
-pbl-dtb-$(CONFIG_MACH_UDOO) += imx6q-udoo.dtb.o
-pbl-dtb-$(CONFIG_MACH_UDOO_NEO) += imx6sx-udoo-neo-full.dtb.o
-pbl-dtb-$(CONFIG_MACH_USI_TOPKICK) += kirkwood-topkick-bb.dtb.o
-pbl-dtb-$(CONFIG_MACH_VARISCITE_MX6) += imx6q-var-custom.dtb.o
-pbl-dtb-$(CONFIG_MACH_VEXPRESS) += vexpress-v2p-ca9.dtb.o
-pbl-dtb-$(CONFIG_MACH_VEXPRESS) += vexpress-v2p-ca15.dtb.o
-pbl-dtb-$(CONFIG_MACH_VSCOM_BALTOS) += am335x-baltos-minimal.dtb.o
-pbl-dtb-$(CONFIG_MACH_WARP7) += imx7s-warp.dtb.o
-pbl-dtb-$(CONFIG_MACH_VF610_TWR) += vf610-twr.dtb.o
-pbl-dtb-$(CONFIG_MACH_ZII_RDU1) +=	\
+lwl-dtb-$(CONFIG_MACH_STM32MP157C_DK2) += stm32mp157c-dk2.dtb.o
+lwl-dtb-$(CONFIG_MACH_SCB9328) += imx1-scb9328.dtb.o
+lwl-dtb-$(CONFIG_MACH_TECHNEXION_WANDBOARD) += imx6q-wandboard.dtb.o imx6dl-wandboard.dtb.o
+lwl-dtb-$(CONFIG_MACH_TECHNEXION_PICO_HOBBIT) += imx6ul-pico-hobbit.dtb.o
+lwl-dtb-$(CONFIG_MACH_NXP_IMX6ULL_EVK) += imx6ull-14x14-evk.dtb.o
+lwl-dtb-$(CONFIG_MACH_NXP_IMX8MQ_EVK) += imx8mq-evk.dtb.o
+lwl-dtb-$(CONFIG_MACH_TORADEX_COLIBRI_T20) += tegra20-colibri-iris.dtb.o
+lwl-dtb-$(CONFIG_MACH_TOSHIBA_AC100) += tegra20-paz00.dtb.o
+lwl-dtb-$(CONFIG_MACH_TQMA53) += imx53-mba53.dtb.o
+lwl-dtb-$(CONFIG_MACH_TQMA6X) += imx6dl-mba6x.dtb.o imx6q-mba6x.dtb.o
+lwl-dtb-$(CONFIG_MACH_TX25) += imx25-karo-tx25.dtb.o
+lwl-dtb-$(CONFIG_MACH_TX6X) += imx6dl-tx6u.dtb.o
+lwl-dtb-$(CONFIG_MACH_TX6X) += imx6q-tx6q.dtb.o
+lwl-dtb-$(CONFIG_MACH_TURRIS_OMNIA) += armada-385-turris-omnia-bb.dtb.o
+lwl-dtb-$(CONFIG_MACH_UDOO) += imx6q-udoo.dtb.o
+lwl-dtb-$(CONFIG_MACH_UDOO_NEO) += imx6sx-udoo-neo-full.dtb.o
+lwl-dtb-$(CONFIG_MACH_USI_TOPKICK) += kirkwood-topkick-bb.dtb.o
+lwl-dtb-$(CONFIG_MACH_VARISCITE_MX6) += imx6q-var-custom.dtb.o
+lwl-dtb-$(CONFIG_MACH_VEXPRESS) += vexpress-v2p-ca9.dtb.o
+lwl-dtb-$(CONFIG_MACH_VEXPRESS) += vexpress-v2p-ca15.dtb.o
+lwl-dtb-$(CONFIG_MACH_VSCOM_BALTOS) += am335x-baltos-minimal.dtb.o
+lwl-dtb-$(CONFIG_MACH_WARP7) += imx7s-warp.dtb.o
+lwl-dtb-$(CONFIG_MACH_VF610_TWR) += vf610-twr.dtb.o
+lwl-dtb-$(CONFIG_MACH_ZII_RDU1) +=	\
 	imx51-zii-rdu1.dtb.o		\
 	imx51-zii-scu2-mezz.dtb.o	\
 	imx51-zii-scu3-esb.dtb.o
-pbl-dtb-$(CONFIG_MACH_ZII_RDU2) += imx6q-zii-rdu2.dtb.o imx6qp-zii-rdu2.dtb.o
-pbl-dtb-$(CONFIG_MACH_ZII_IMX8MQ_DEV) +=	\
+lwl-dtb-$(CONFIG_MACH_ZII_RDU2) += imx6q-zii-rdu2.dtb.o imx6qp-zii-rdu2.dtb.o
+lwl-dtb-$(CONFIG_MACH_ZII_IMX8MQ_DEV) +=	\
 	imx8mq-zii-ultra-rmb3.dtb.o		\
 	imx8mq-zii-ultra-zest.dtb.o
-pbl-dtb-$(CONFIG_MACH_ZII_VF610_DEV) += \
+lwl-dtb-$(CONFIG_MACH_ZII_VF610_DEV) += \
 	vf610-zii-dev-rev-b.dtb.o 	\
 	vf610-zii-dev-rev-c.dtb.o 	\
 	vf610-zii-cfu1.dtb.o		\
@@ -133,14 +133,14 @@ pbl-dtb-$(CONFIG_MACH_ZII_VF610_DEV) += \
 	vf610-zii-scu4-aib.dtb.o	\
 	vf610-zii-spb4.dtb.o		\
 	vf610-zii-ssmb-dtu.dtb.o
-pbl-dtb-$(CONFIG_MACH_AT91SAM9263EK_DT) += at91sam9263ek.dtb.o
-pbl-dtb-$(CONFIG_MACH_MICROCHIP_KSZ9477_EVB) += at91-microchip-ksz9477-evb.dtb.o
-pbl-dtb-$(CONFIG_MACH_AT91SAM9X5EK) += at91sam9x5ek.dtb.o
-pbl-dtb-$(CONFIG_MACH_XILINX_ZCU104) += zynqmp-zcu104-revA.dtb.o
+lwl-dtb-$(CONFIG_MACH_AT91SAM9263EK_DT) += at91sam9263ek.dtb.o
+lwl-dtb-$(CONFIG_MACH_MICROCHIP_KSZ9477_EVB) += at91-microchip-ksz9477-evb.dtb.o
+lwl-dtb-$(CONFIG_MACH_AT91SAM9X5EK) += at91sam9x5ek.dtb.o
+lwl-dtb-$(CONFIG_MACH_XILINX_ZCU104) += zynqmp-zcu104-revA.dtb.o
 
-pbl-dtb-$(CONFIG_MACH_ZII_IMX7D_DEV) += imx7d-zii-rpu2.dtb.o imx7d-zii-rmu2.dtb.o
-pbl-dtb-$(CONFIG_MACH_WAGO_PFC_AM35XX) += am35xx-pfc-750_820x.dtb.o
-pbl-dtb-$(CONFIG_MACH_LS1046ARDB) += fsl-ls1046a-rdb.dtb.o
-pbl-dtb-$(CONFIG_MACH_TQMLS1046A) += fsl-tqmls1046a-mbls10xxa.dtb.o
+lwl-dtb-$(CONFIG_MACH_ZII_IMX7D_DEV) += imx7d-zii-rpu2.dtb.o imx7d-zii-rmu2.dtb.o
+lwl-dtb-$(CONFIG_MACH_WAGO_PFC_AM35XX) += am35xx-pfc-750_820x.dtb.o
+lwl-dtb-$(CONFIG_MACH_LS1046ARDB) += fsl-ls1046a-rdb.dtb.o
+lwl-dtb-$(CONFIG_MACH_TQMLS1046A) += fsl-tqmls1046a-mbls10xxa.dtb.o
 
 clean-files := *.dtb *.dtb.S .*.dtc .*.pre .*.dts *.dtb.lzo
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index c4d307ae30..2da14ba29b 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -29,9 +29,9 @@ extra-y		+= $(patsubst %.dtb.o,%.dtb,$(pbl-dtb-y))
 # lowlevel is present in the PBL if enabled
 # otherwise in barebox
 ifeq ($(CONFIG_PBL_IMAGE), y)
-pbl-y		+= $(lwl-y)
+pbl-y		+= $(lwl-y) $(lwl-dtb-y)
 else
-obj-y		+= $(lwl-y)
+obj-y		+= $(lwl-y) $(lwl-dtb-y)
 endif
 
 obj-y		+= $(obj-pbl-y)
-- 
2.23.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 3/6] ARM: drop bultin DTB
  2019-09-16  7:27 [PATCH 0/6] ARM: Merge single PBL code into multi PBL code Sascha Hauer
  2019-09-16  7:27 ` [PATCH 1/6] ARM: remove PBL_FORCE_PIGGYDATA_COPY Sascha Hauer
  2019-09-16  7:27 ` [PATCH 2/6] ARM: Compile dtbs for lowlevel code Sascha Hauer
@ 2019-09-16  7:27 ` Sascha Hauer
  2019-09-16  7:27 ` [PATCH 4/6] ARM: Merge single pbl with multi pbl Sascha Hauer
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2019-09-16  7:27 UTC (permalink / raw)
  To: Barebox List

We can build multiple DTBs into the binary and board code can select
which one to use. Drop the single builtin DTB and let the boards using
it pass the correct one.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/Kconfig                               | 14 --------------
 arch/arm/boards/canon-a1100/lowlevel.c         |  9 ++++++++-
 arch/arm/boards/module-mb7707/lowlevel.c       |  8 +++++++-
 arch/arm/boards/versatile/lowlevel.c           |  9 ++++++++-
 arch/arm/boards/virt2real/lowlevel.c           |  8 +++++++-
 arch/arm/configs/canon-a1100_defconfig         |  1 -
 arch/arm/configs/module-mb7707_defconfig       |  1 -
 arch/arm/configs/versatilepb_arm1176_defconfig |  2 --
 arch/arm/configs/versatilepb_defconfig         |  2 --
 arch/arm/configs/virt2real_defconfig           |  1 -
 arch/arm/cpu/dtb.c                             |  6 ------
 arch/arm/dts/Makefile                          |  5 -----
 12 files changed, 30 insertions(+), 36 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index a6821bf4d0..349ad33909 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -25,20 +25,6 @@ config TEXT_BASE
 
 menu "System Type"
 
-config BUILTIN_DTB
-	bool "link a DTB into the barebox image"
-	depends on OFTREE
-	depends on !HAVE_PBL_MULTI_IMAGES
-
-config BUILTIN_DTB_NAME
-	string "DTB to build into the barebox image"
-	depends on BUILTIN_DTB
-	default "canon-a1100" if MACH_CANON_A1100
-	default "imx51-genesi-efika-sb" if MACH_EFIKA_MX_SMARTBOOK
-	default "versatile-pb" if ARCH_VERSATILE_PB
-	default "virt2real" if MACH_VIRT2REAL
-	default "module-mb7707" if MACH_MB7707
-
 choice
 	prompt "ARM system type"
 
diff --git a/arch/arm/boards/canon-a1100/lowlevel.c b/arch/arm/boards/canon-a1100/lowlevel.c
index 744ce59eaa..b75a1bfa60 100644
--- a/arch/arm/boards/canon-a1100/lowlevel.c
+++ b/arch/arm/boards/canon-a1100/lowlevel.c
@@ -3,10 +3,16 @@
 #include <asm/barebox-arm-head.h>
 #include <asm/barebox-arm.h>
 
+extern char __dtb_canon_a1100_start[];
+
 void __naked barebox_arm_reset_vector(uint32_t r0, uint32_t r1, uint32_t r2)
 {
+	void *fdt;
+
 	arm_cpu_lowlevel_init();
 
+	fdt = __dtb_canon_a1100_start + get_runtime_offset();
+
 	/* FIXME: can we determine RAM size using CP15 register?
 	 *
 	 * see http://chdk.setepontos.com/index.php?topic=5980.90
@@ -19,5 +25,6 @@ void __naked barebox_arm_reset_vector(uint32_t r0, uint32_t r1, uint32_t r2)
 	 * The Control Register value (mrc    p15, 0, %0, c0, c1, 4)
 	 * is 0x00051078.
 	 */
-	barebox_arm_entry(0x0, SZ_64M, 0);
+
+	barebox_arm_entry(0x0, SZ_64M, fdt);
 }
diff --git a/arch/arm/boards/module-mb7707/lowlevel.c b/arch/arm/boards/module-mb7707/lowlevel.c
index 055e432c1c..fc102e26e1 100644
--- a/arch/arm/boards/module-mb7707/lowlevel.c
+++ b/arch/arm/boards/module-mb7707/lowlevel.c
@@ -26,9 +26,15 @@
 #define MB7707_SRAM_BASE 0x40000000
 #define MB7707_SRAM_SIZE SZ_128M
 
+extern char __dtb_module_mb7707_start[];
+
 void __naked __bare_init barebox_arm_reset_vector(uint32_t r0, uint32_t r1, uint32_t r2)
 {
+	void *fdt;
+
 	arm_cpu_lowlevel_init();
 
-	barebox_arm_entry(MB7707_SRAM_BASE, MB7707_SRAM_SIZE, 0);
+	fdt = __dtb_module_mb7707_start + get_runtime_offset();
+
+	barebox_arm_entry(MB7707_SRAM_BASE, MB7707_SRAM_SIZE, fdt);
 }
diff --git a/arch/arm/boards/versatile/lowlevel.c b/arch/arm/boards/versatile/lowlevel.c
index a9ccf1fff5..beab04d234 100644
--- a/arch/arm/boards/versatile/lowlevel.c
+++ b/arch/arm/boards/versatile/lowlevel.c
@@ -3,8 +3,15 @@
 #include <asm/barebox-arm-head.h>
 #include <asm/barebox-arm.h>
 
+extern char __dtb_versatile_pb_start[];
+
 void __naked barebox_arm_reset_vector(uint32_t r0, uint32_t r1, uint32_t r2)
 {
+	void *fdt;
+
 	arm_cpu_lowlevel_init();
-	barebox_arm_entry(0x0, SZ_64M, NULL);
+
+	fdt = __dtb_versatile_pb_start + get_runtime_offset();
+
+	barebox_arm_entry(0x0, SZ_64M, fdt);
 }
diff --git a/arch/arm/boards/virt2real/lowlevel.c b/arch/arm/boards/virt2real/lowlevel.c
index 264ebee893..a72334bb0e 100644
--- a/arch/arm/boards/virt2real/lowlevel.c
+++ b/arch/arm/boards/virt2real/lowlevel.c
@@ -26,9 +26,15 @@
 #define VIRT2REAL_SRAM_BASE 0x82000000
 #define VIRT2REAL_SRAM_SIZE SZ_16M
 
+extern char __dtb_virt2real_start[];
+
 void __naked __bare_init barebox_arm_reset_vector(uint32_t r0, uint32_t r1, uint32_t r2)
 {
+	void *fdt;
+
 	arm_cpu_lowlevel_init();
 
-	barebox_arm_entry(VIRT2REAL_SRAM_BASE, VIRT2REAL_SRAM_SIZE, NULL);
+	fdt = __dtb_virt2real_start + get_runtime_offset();
+
+	barebox_arm_entry(VIRT2REAL_SRAM_BASE, VIRT2REAL_SRAM_SIZE, fdt);
 }
diff --git a/arch/arm/configs/canon-a1100_defconfig b/arch/arm/configs/canon-a1100_defconfig
index 9887c4c292..12a3f0af95 100644
--- a/arch/arm/configs/canon-a1100_defconfig
+++ b/arch/arm/configs/canon-a1100_defconfig
@@ -1,5 +1,4 @@
 CONFIG_TEXT_BASE=0x00300000
-CONFIG_BUILTIN_DTB=y
 CONFIG_ARCH_DIGIC=y
 CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
 CONFIG_PBL_IMAGE=y
diff --git a/arch/arm/configs/module-mb7707_defconfig b/arch/arm/configs/module-mb7707_defconfig
index 189f295c67..9484c39fb8 100644
--- a/arch/arm/configs/module-mb7707_defconfig
+++ b/arch/arm/configs/module-mb7707_defconfig
@@ -1,4 +1,3 @@
-CONFIG_BUILTIN_DTB=y
 CONFIG_ARCH_UEMD=y
 CONFIG_AEABI=y
 CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
diff --git a/arch/arm/configs/versatilepb_arm1176_defconfig b/arch/arm/configs/versatilepb_arm1176_defconfig
index 284fbd1150..e8c662183a 100644
--- a/arch/arm/configs/versatilepb_arm1176_defconfig
+++ b/arch/arm/configs/versatilepb_arm1176_defconfig
@@ -1,5 +1,3 @@
-CONFIG_BUILTIN_DTB=y
-CONFIG_BUILTIN_DTB_NAME="versatile-pb"
 CONFIG_ARCH_VERSATILE=y
 CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x80000
 CONFIG_MACH_VERSATILEPB_ARM1176=y
diff --git a/arch/arm/configs/versatilepb_defconfig b/arch/arm/configs/versatilepb_defconfig
index 61b9ff1c38..14481ea58e 100644
--- a/arch/arm/configs/versatilepb_defconfig
+++ b/arch/arm/configs/versatilepb_defconfig
@@ -1,5 +1,3 @@
-CONFIG_BUILTIN_DTB=y
-CONFIG_BUILTIN_DTB_NAME="versatile-pb"
 CONFIG_ARCH_VERSATILE=y
 CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x80000
 CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
diff --git a/arch/arm/configs/virt2real_defconfig b/arch/arm/configs/virt2real_defconfig
index 4fb61cbd0c..814fe69e42 100644
--- a/arch/arm/configs/virt2real_defconfig
+++ b/arch/arm/configs/virt2real_defconfig
@@ -1,5 +1,4 @@
 CONFIG_TEXT_BASE=0x82300000
-CONFIG_BUILTIN_DTB=y
 CONFIG_ARCH_DAVINCI=y
 CONFIG_AEABI=y
 CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
diff --git a/arch/arm/cpu/dtb.c b/arch/arm/cpu/dtb.c
index b9390b46e6..1ba5aa415e 100644
--- a/arch/arm/cpu/dtb.c
+++ b/arch/arm/cpu/dtb.c
@@ -36,12 +36,6 @@ static int of_arm_init(void)
 	if (fdt)
 		pr_debug("using boarddata provided DTB\n");
 
-	/* Next see if we have a builtin dtb */
-	if (!fdt && IS_ENABLED(CONFIG_BUILTIN_DTB)) {
-		fdt = __dtb_start;
-		pr_debug("using internal DTB\n");
-	}
-
 	if (!fdt) {
 		pr_debug("No DTB found\n");
 		return 0;
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 7a212174de..550d8680d7 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -1,8 +1,3 @@
-BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_NAME))
-ifneq ($(BUILTIN_DTB),)
-obj-dtb-$(CONFIG_BUILTIN_DTB) += $(BUILTIN_DTB).dtb.o
-endif
-
 # just to build a built-in.o. Otherwise compilation fails when no devicetree is
 # created.
 obj- += dummy.o
-- 
2.23.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 4/6] ARM: Merge single pbl with multi pbl
  2019-09-16  7:27 [PATCH 0/6] ARM: Merge single PBL code into multi PBL code Sascha Hauer
                   ` (2 preceding siblings ...)
  2019-09-16  7:27 ` [PATCH 3/6] ARM: drop bultin DTB Sascha Hauer
@ 2019-09-16  7:27 ` Sascha Hauer
  2019-09-16  7:27 ` [PATCH 5/6] ARM: remove now unused PBL code Sascha Hauer
  2019-09-16  7:27 ` [PATCH 6/6] ARM: aarch64: Re-implement most of barebox_arm_entry() in assembly Sascha Hauer
  5 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2019-09-16  7:27 UTC (permalink / raw)
  To: Barebox List

So far we have two different implementations for PBL: One for a single
PBL and one for multiple images. This patch implements the single PBL
case as a special case of the multi PBL case. With this the single PBL
becomes a multi PBL image with the entry point start_pbl.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 Makefile                  |  2 +-
 arch/arm/cpu/Makefile     |  3 +-
 arch/arm/cpu/entry.c      |  6 +--
 arch/arm/cpu/entry.h      | 10 ++--
 arch/arm/cpu/start-pbl.c  | 96 ---------------------------------------
 arch/arm/cpu/uncompress.c | 17 ++++++-
 images/Makefile           |  7 +++
 7 files changed, 29 insertions(+), 112 deletions(-)
 delete mode 100644 arch/arm/cpu/start-pbl.c

diff --git a/Makefile b/Makefile
index aa50aa73ed..71f3ce5775 100644
--- a/Makefile
+++ b/Makefile
@@ -519,7 +519,7 @@ images: barebox.bin FORCE
 images/%.s: barebox.bin FORCE
 	$(Q)$(MAKE) $(build)=images $@
 
-ifdef CONFIG_PBL_MULTI_IMAGES
+ifdef CONFIG_PBL_IMAGE
 all: barebox.bin images
 else
 all: barebox-flash-image barebox-flash-images
diff --git a/arch/arm/cpu/Makefile b/arch/arm/cpu/Makefile
index 97e4eb52e3..e6a1a321dc 100644
--- a/arch/arm/cpu/Makefile
+++ b/arch/arm/cpu/Makefile
@@ -48,7 +48,6 @@ obj-pbl-$(CONFIG_CPU_64v8) += cache-armv8.o
 AFLAGS_pbl-cache-armv8.o       :=-Wa,-march=armv8-a
 
 pbl-y += entry.o
-pbl-$(CONFIG_PBL_SINGLE_IMAGE) += start-pbl.o
-pbl-$(CONFIG_PBL_MULTI_IMAGES) += uncompress.o
+pbl-y += uncompress.o
 
 obj-pbl-y += common.o sections.o
diff --git a/arch/arm/cpu/entry.c b/arch/arm/cpu/entry.c
index 30df95f078..8b17179437 100644
--- a/arch/arm/cpu/entry.c
+++ b/arch/arm/cpu/entry.c
@@ -30,10 +30,8 @@ void NAKED __noreturn barebox_arm_entry(unsigned long membase,
 	arm_setup_stack(arm_mem_stack_top(membase, membase + memsize));
 	arm_early_mmu_cache_invalidate();
 
-	if (IS_ENABLED(CONFIG_PBL_MULTI_IMAGES))
-		barebox_multi_pbl_start(membase, memsize, boarddata);
-	else if (IS_ENABLED(CONFIG_PBL_SINGLE_IMAGE))
-		barebox_single_pbl_start(membase, memsize, boarddata);
+	if (IS_ENABLED(CONFIG_PBL_IMAGE))
+		barebox_pbl_start(membase, memsize, boarddata);
 	else
 		barebox_non_pbl_start(membase, memsize, boarddata);
 }
diff --git a/arch/arm/cpu/entry.h b/arch/arm/cpu/entry.h
index f0163a34f7..18110eadf3 100644
--- a/arch/arm/cpu/entry.h
+++ b/arch/arm/cpu/entry.h
@@ -7,12 +7,8 @@ void __noreturn barebox_non_pbl_start(unsigned long membase,
 				      unsigned long memsize,
 				      void *boarddata);
 
-void __noreturn barebox_multi_pbl_start(unsigned long membase,
-					unsigned long memsize,
-					void *boarddata);
-
-void __noreturn barebox_single_pbl_start(unsigned long membase,
-					 unsigned long memsize,
-					 void *boarddata);
+void __noreturn barebox_pbl_start(unsigned long membase,
+				  unsigned long memsize,
+				  void *boarddata);
 
 #endif
diff --git a/arch/arm/cpu/start-pbl.c b/arch/arm/cpu/start-pbl.c
deleted file mode 100644
index 0006f40d55..0000000000
--- a/arch/arm/cpu/start-pbl.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * start-pbl.c
- *
- * Copyright (c) 2010-2012 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
- * Copyright (c) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#include <common.h>
-#include <init.h>
-#include <linux/sizes.h>
-#include <pbl.h>
-#include <asm/barebox-arm.h>
-#include <asm/barebox-arm-head.h>
-#include <asm-generic/memory_layout.h>
-#include <asm/sections.h>
-#include <asm/secure.h>
-#include <asm/cache.h>
-#include <asm/mmu.h>
-#include <asm/unaligned.h>
-
-#include "entry.h"
-
-unsigned long free_mem_ptr;
-unsigned long free_mem_end_ptr;
-
-void pbl_start(void);
-
-/*
- * First instructions in the pbl image
- */
-void __naked __section(.text_head_entry) pbl_start(void)
-{
-	barebox_arm_head();
-}
-
-extern void *input_data;
-extern void *input_data_end;
-
-__noreturn void barebox_single_pbl_start(unsigned long membase,
-		unsigned long memsize, void *boarddata)
-{
-	unsigned long pg_start, pg_end, pg_len, uncompressed_len;
-	void __noreturn (*barebox)(unsigned long, unsigned long, void *);
-	unsigned long endmem = membase + memsize;
-	unsigned long barebox_base;
-
-	if (IS_ENABLED(CONFIG_PBL_RELOCATABLE))
-		relocate_to_current_adr();
-
-	pg_start = (unsigned long)&input_data + global_variable_offset();
-	pg_end = (unsigned long)&input_data_end + global_variable_offset();
-	pg_len = pg_end - pg_start;
-	uncompressed_len = get_unaligned((const u32 *)(pg_start + pg_len - 4));
-
-	if (IS_ENABLED(CONFIG_RELOCATABLE))
-		barebox_base = arm_mem_barebox_image(membase, endmem, uncompressed_len + MAX_BSS_SIZE);
-	else
-		barebox_base = TEXT_BASE;
-
-	setup_c();
-
-	if (IS_ENABLED(CONFIG_MMU_EARLY)) {
-		unsigned long ttb = arm_mem_ttb(membase, endmem);
-		mmu_early_enable(membase, memsize, ttb);
-	}
-
-	free_mem_ptr = arm_mem_early_malloc(membase, endmem);
-	free_mem_end_ptr = arm_mem_early_malloc_end(membase, endmem);
-
-	pbl_barebox_uncompress((void*)barebox_base, (void *)pg_start, pg_len);
-
-	sync_caches_for_execution();
-
-	if (IS_ENABLED(CONFIG_THUMB2_BAREBOX))
-		barebox = (void *)(barebox_base + 1);
-	else
-		barebox = (void *)barebox_base;
-
-	if (IS_ENABLED(CONFIG_CPU_V7) && boot_cpu_mode() == HYP_MODE)
-		armv7_switch_to_hyp();
-
-	barebox(membase, memsize, boarddata);
-}
diff --git a/arch/arm/cpu/uncompress.c b/arch/arm/cpu/uncompress.c
index 4f16af22f8..88d073ebdd 100644
--- a/arch/arm/cpu/uncompress.c
+++ b/arch/arm/cpu/uncompress.c
@@ -36,14 +36,27 @@
 
 #include "entry.h"
 
+#ifndef CONFIG_HAVE_PBL_MULTI_IMAGES
+
+void start_pbl(void);
+
+/*
+ * First instructions in the pbl image
+ */
+void __naked __section(.text_head_entry_start_single_pbl) start_pbl(void)
+{
+	barebox_arm_head();
+}
+#endif
+
 unsigned long free_mem_ptr;
 unsigned long free_mem_end_ptr;
 
 extern unsigned char input_data[];
 extern unsigned char input_data_end[];
 
-void __noreturn barebox_multi_pbl_start(unsigned long membase,
-		unsigned long memsize, void *boarddata)
+void __noreturn barebox_pbl_start(unsigned long membase, unsigned long memsize,
+				  void *boarddata)
 {
 	uint32_t pg_len, uncompressed_len;
 	void __noreturn (*barebox)(unsigned long, unsigned long, void *);
diff --git a/images/Makefile b/images/Makefile
index dd39f44afb..ceb00618d2 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -164,10 +164,17 @@ include $(srctree)/images/Makefile.at91
 include $(srctree)/images/Makefile.zynqmp
 include $(srctree)/images/Makefile.layerscape
 
+
 pblb-$(CONFIG_BOARD_ARM_GENERIC_DT) += start_dt_2nd
 FILE_barebox-dt-2nd.img = start_dt_2nd.pblb
 image-$(CONFIG_BOARD_ARM_GENERIC_DT) += barebox-dt-2nd.img
 
+ifdef CONFIG_ARM
+pblb-$(CONFIG_PBL_SINGLE_IMAGE) += start_pbl
+FILE_barebox.img = start_pbl.pblb
+image-$(CONFIG_PBL_SINGLE_IMAGE) += barebox.img
+endif
+
 ifneq ($(pblx-y)$(pblx-),)
   $(error pblx- has been removed. Please use pblb- instead.)
 endif
-- 
2.23.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 5/6] ARM: remove now unused PBL code
  2019-09-16  7:27 [PATCH 0/6] ARM: Merge single PBL code into multi PBL code Sascha Hauer
                   ` (3 preceding siblings ...)
  2019-09-16  7:27 ` [PATCH 4/6] ARM: Merge single pbl with multi pbl Sascha Hauer
@ 2019-09-16  7:27 ` Sascha Hauer
  2019-09-16  7:27 ` [PATCH 6/6] ARM: aarch64: Re-implement most of barebox_arm_entry() in assembly Sascha Hauer
  5 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2019-09-16  7:27 UTC (permalink / raw)
  To: Barebox List

Single PBL is now built as part of the multi PBL images, so drop the now
unused single PBL code.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/Makefile              |  8 -----
 arch/arm/pbl/.gitignore        |  9 -----
 arch/arm/pbl/Makefile          | 61 ----------------------------------
 arch/arm/pbl/piggy.comp_copy.S |  6 ----
 arch/arm/pbl/piggy.gzip.S      |  6 ----
 arch/arm/pbl/piggy.lz4.S       |  6 ----
 arch/arm/pbl/piggy.lzo.S       |  6 ----
 arch/arm/pbl/piggy.xzkern.S    |  6 ----
 8 files changed, 108 deletions(-)
 delete mode 100644 arch/arm/pbl/.gitignore
 delete mode 100644 arch/arm/pbl/Makefile
 delete mode 100644 arch/arm/pbl/piggy.comp_copy.S
 delete mode 100644 arch/arm/pbl/piggy.gzip.S
 delete mode 100644 arch/arm/pbl/piggy.lz4.S
 delete mode 100644 arch/arm/pbl/piggy.lzo.S
 delete mode 100644 arch/arm/pbl/piggy.xzkern.S

diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index cbf3d310db..13e8cee286 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -147,11 +147,7 @@ else
 LDFLAGS_barebox += -static
 endif
 
-ifdef CONFIG_IMAGE_COMPRESSION
-KBUILD_BINARY := arch/arm/pbl/zbarebox.bin
-else
 KBUILD_BINARY := barebox.bin
-endif
 
 barebox.s5p: $(KBUILD_BINARY)
 	$(Q)scripts/s5p_cksum $< barebox.s5p
@@ -254,10 +250,6 @@ CFG_barebox.imximg := $(imxcfg-y)
 KBUILD_IMAGE  := barebox.imximg
 endif
 
-pbl := arch/arm/pbl
-$(pbl)/zbarebox.S $(pbl)/zbarebox.bin $(pbl)/zbarebox: barebox.bin FORCE
-	$(Q)$(MAKE) $(build)=$(pbl) $@
-
 archclean:
 	$(MAKE) $(clean)=$(pbl)
 
diff --git a/arch/arm/pbl/.gitignore b/arch/arm/pbl/.gitignore
deleted file mode 100644
index be604a81bf..0000000000
--- a/arch/arm/pbl/.gitignore
+++ /dev/null
@@ -1,9 +0,0 @@
-piggy.gzip
-piggy.lzo
-piggy.lz4
-piggy.xzkern
-piggy.shipped
-zbarebox
-zbarebox.bin
-zbarebox.lds
-zbarebox.map
diff --git a/arch/arm/pbl/Makefile b/arch/arm/pbl/Makefile
deleted file mode 100644
index 5d7e85b373..0000000000
--- a/arch/arm/pbl/Makefile
+++ /dev/null
@@ -1,61 +0,0 @@
-
-suffix_$(CONFIG_IMAGE_COMPRESSION_GZIP) = gzip
-suffix_$(CONFIG_IMAGE_COMPRESSION_LZO)	= lzo
-suffix_$(CONFIG_IMAGE_COMPRESSION_LZ4)	= lz4
-suffix_$(CONFIG_IMAGE_COMPRESSION_XZKERN)	= xzkern
-suffix_$(CONFIG_IMAGE_COMPRESSION_NONE)	= comp_copy
-
-OBJCOPYFLAGS_zbarebox.bin = -O binary
-piggy_o := piggy.$(suffix_y).o
-
-targets := zbarebox.lds zbarebox zbarebox.bin zbarebox.S \
-	   $(piggy_o) piggy.$(suffix_y)
-
-# Make sure files are removed during clean
-extra-y       += piggy.gzip piggy.lz4 piggy.lzo piggy.lzma piggy.xzkern piggy.shipped zbarebox.map
-
-ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
-FIX_SIZE=-b
-else
-FIX_SIZE=
-endif
-
-$(obj)/zbarebox.bin:	$(obj)/zbarebox FORCE
-	$(call if_changed,objcopy)
-	$(call cmd,check_file_size,$@,$(CONFIG_BAREBOX_MAX_IMAGE_SIZE))
-	$(Q)$(kecho) '  Barebox: fix size'
-	$(Q)$(objtree)/scripts/fix_size -i -f $(objtree)/$@ $(FIX_SIZE)
-	$(Q)$(kecho) '  Barebox: $@ is ready'
-
-$(obj)/zbarebox.S: $(obj)/zbarebox FORCE
-	$(call if_changed,disasm)
-
-PBL_CPPFLAGS		+= -fdata-sections -ffunction-sections
-LDFLAGS_zbarebox	:= -Map $(obj)/zbarebox.map --gc-sections
-ifdef CONFIG_PBL_RELOCATABLE
-LDFLAGS_zbarebox += -pie
-else
-LDFLAGS_zbarebox += -static
-endif
-
-LDFLAGS_zbarebox += $(call ld-option, --no-dynamic-linker)
-
-zbarebox-common := $(barebox-pbl-common) $(obj)/$(piggy_o)
-zbarebox-lds := $(obj)/zbarebox.lds
-
-$(zbarebox-lds): $(obj)/../lib/pbl.lds.S FORCE
-	$(call if_changed_dep,cpp_lds_S)
-
-quiet_cmd_zbarebox__ ?= LD      $@
-      cmd_zbarebox__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_zbarebox) -o $@ \
-      -e pbl_start -T $(zbarebox-lds)                              \
-      --start-group $(zbarebox-common) --end-group                 \
-      $(filter-out $(zbarebox-lds) $(zbarebox-common) FORCE ,$^)
-
-$(obj)/zbarebox: $(zbarebox-lds) $(zbarebox-common) FORCE
-	$(call if_changed,zbarebox__)
-
-$(obj)/piggy.$(suffix_y): $(obj)/../../../barebox.bin FORCE
-	$(call if_changed,$(suffix_y))
-
-$(obj)/$(piggy_o): $(obj)/piggy.$(suffix_y) FORCE
diff --git a/arch/arm/pbl/piggy.comp_copy.S b/arch/arm/pbl/piggy.comp_copy.S
deleted file mode 100644
index 2b5a812ded..0000000000
--- a/arch/arm/pbl/piggy.comp_copy.S
+++ /dev/null
@@ -1,6 +0,0 @@
-	.section .piggydata,#alloc
-	.globl	input_data
-input_data:
-	.incbin	"arch/arm/pbl/piggy.comp_copy"
-	.globl	input_data_end
-input_data_end:
diff --git a/arch/arm/pbl/piggy.gzip.S b/arch/arm/pbl/piggy.gzip.S
deleted file mode 100644
index 4a623c0c57..0000000000
--- a/arch/arm/pbl/piggy.gzip.S
+++ /dev/null
@@ -1,6 +0,0 @@
-	.section .piggydata,#alloc
-	.globl  input_data
-input_data:
-	.incbin "arch/arm/pbl/piggy.gzip"
-	.globl  input_data_end
-input_data_end:
diff --git a/arch/arm/pbl/piggy.lz4.S b/arch/arm/pbl/piggy.lz4.S
deleted file mode 100644
index fa9b2469e1..0000000000
--- a/arch/arm/pbl/piggy.lz4.S
+++ /dev/null
@@ -1,6 +0,0 @@
-	.section .piggydata,#alloc
-	.globl	input_data
-input_data:
-	.incbin	"arch/arm/pbl/piggy.lz4"
-	.globl	input_data_end
-input_data_end:
diff --git a/arch/arm/pbl/piggy.lzo.S b/arch/arm/pbl/piggy.lzo.S
deleted file mode 100644
index e0484c7d5c..0000000000
--- a/arch/arm/pbl/piggy.lzo.S
+++ /dev/null
@@ -1,6 +0,0 @@
-	.section .piggydata,#alloc
-	.globl	input_data
-input_data:
-	.incbin	"arch/arm/pbl/piggy.lzo"
-	.globl	input_data_end
-input_data_end:
diff --git a/arch/arm/pbl/piggy.xzkern.S b/arch/arm/pbl/piggy.xzkern.S
deleted file mode 100644
index a7c0259590..0000000000
--- a/arch/arm/pbl/piggy.xzkern.S
+++ /dev/null
@@ -1,6 +0,0 @@
-	.section .piggydata,#alloc
-	.globl	input_data
-input_data:
-	.incbin	"arch/arm/pbl/piggy.xzkern"
-	.globl	input_data_end
-input_data_end:
-- 
2.23.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 6/6] ARM: aarch64: Re-implement most of barebox_arm_entry() in assembly
  2019-09-16  7:27 [PATCH 0/6] ARM: Merge single PBL code into multi PBL code Sascha Hauer
                   ` (4 preceding siblings ...)
  2019-09-16  7:27 ` [PATCH 5/6] ARM: remove now unused PBL code Sascha Hauer
@ 2019-09-16  7:27 ` Sascha Hauer
  5 siblings, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2019-09-16  7:27 UTC (permalink / raw)
  To: Barebox List; +Cc: Andrey Smirnov

From: Andrey Smirnov <andrew.smirnov@gmail.com>

GCC9 now produces the following warning:

common.h:51:2: warning: listing the stack pointer register ‘sp’ in a clobber list is deprecated [-Wdeprecated]
   51 |  __asm__ __volatile__("mov sp, %0"
      |  ^~~~~~~
common.h:51:2: note: the value of the stack pointer after  an ‘asm’ statement must be the same as it was before the statement

Stack pointer was added to clobber list in commit f9fc8254b2 ("ARM:
Mark SP as being clobbered in arm_setup_stack()") to prevent GCC from
generating code that would corrupt 'boarddata' pointer by trying to
restore it from invalid stack frame.

Interestingly enough, seemingly unrelated change in commit
64d95896cf ("ARM: aarch64: compile with general-regs-only") changed
generated code such that adding SP to clobber list became no longer
necessary.

While the above can probably be a fix by itself, it seems a better and
more future proof approach would be to address the problem at its root
and re-implement offending startup sequence in assembly.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/cpu/Makefile         |  4 ++--
 arch/arm/cpu/entry.c          | 21 +++++++++++++--------
 arch/arm/cpu/entry_ll.S       | 25 +++++++++++++++++++++++++
 arch/arm/cpu/entry_ll_64.S    | 23 +++++++++++++++++++++++
 arch/arm/include/asm/common.h |  3 +--
 5 files changed, 64 insertions(+), 12 deletions(-)
 create mode 100644 arch/arm/cpu/entry_ll.S
 create mode 100644 arch/arm/cpu/entry_ll_64.S

diff --git a/arch/arm/cpu/Makefile b/arch/arm/cpu/Makefile
index e6a1a321dc..e0b16747ad 100644
--- a/arch/arm/cpu/Makefile
+++ b/arch/arm/cpu/Makefile
@@ -8,7 +8,7 @@ obj-pbl-$(CONFIG_CPU_32v7) += hyp.o
 AFLAGS_hyp.o :=-Wa,-march=armv7-a -Wa,-mcpu=all
 AFLAGS_pbl-hyp.o :=-Wa,-march=armv7-a -Wa,-mcpu=all
 
-obj-y += start.o entry.o
+obj-y += start.o entry.o entry_ll$(S64).o
 
 pbl-$(CONFIG_BOARD_ARM_GENERIC_DT) += board-dt-2nd.o
 pbl-$(CONFIG_BOARD_ARM_GENERIC_DT_AARCH64) += board-dt-2nd-aarch64.o
@@ -47,7 +47,7 @@ AFLAGS_cache-armv8.o       :=-Wa,-march=armv8-a
 obj-pbl-$(CONFIG_CPU_64v8) += cache-armv8.o
 AFLAGS_pbl-cache-armv8.o       :=-Wa,-march=armv8-a
 
-pbl-y += entry.o
+pbl-y += entry.o entry_ll$(S64).o
 pbl-y += uncompress.o
 
 obj-pbl-y += common.o sections.o
diff --git a/arch/arm/cpu/entry.c b/arch/arm/cpu/entry.c
index 8b17179437..0b447de801 100644
--- a/arch/arm/cpu/entry.c
+++ b/arch/arm/cpu/entry.c
@@ -24,14 +24,19 @@
  * be fine.
  */
 
+/*
+ * It can be hard to convince GCC to not use old stack pointer after
+ * we modify it with arm_setup_stack() on ARM64, so we implement the
+ * low level details in assembly
+ */
+void __noreturn __barebox_arm_entry(unsigned long membase,
+				    unsigned long memsize,
+				    void *boarddata,
+				    unsigned long sp);
+
 void NAKED __noreturn barebox_arm_entry(unsigned long membase,
-					  unsigned long memsize, void *boarddata)
+					unsigned long memsize, void *boarddata)
 {
-	arm_setup_stack(arm_mem_stack_top(membase, membase + memsize));
-	arm_early_mmu_cache_invalidate();
-
-	if (IS_ENABLED(CONFIG_PBL_IMAGE))
-		barebox_pbl_start(membase, memsize, boarddata);
-	else
-		barebox_non_pbl_start(membase, memsize, boarddata);
+	__barebox_arm_entry(membase, memsize, boarddata,
+			    arm_mem_stack_top(membase, membase + memsize));
 }
diff --git a/arch/arm/cpu/entry_ll.S b/arch/arm/cpu/entry_ll.S
new file mode 100644
index 0000000000..8cc7a84f10
--- /dev/null
+++ b/arch/arm/cpu/entry_ll.S
@@ -0,0 +1,25 @@
+#include <linux/linkage.h>
+#include <asm/sections.h>
+
+/*
+ * r0: memory base
+ * r1: memory size
+ * r2: board data
+ * r3: new value for SP
+ */
+.section .text.__barebox_arm_entry
+ENTRY(__barebox_arm_entry)
+	mov	sp, r3
+	mov	r4, r0
+	mov	r5, r1
+	mov	r6, r2
+	bl	arm_early_mmu_cache_invalidate
+	mov	r0, r4
+	mov	r1, r5
+	mov	r2, r6
+#if IS_ENABLED(CONFIG_PBL_IMAGE)
+	b	barebox_pbl_start
+#else
+	b	barebox_non_pbl_start
+#endif
+ENDPROC(__barebox_arm_entry)
diff --git a/arch/arm/cpu/entry_ll_64.S b/arch/arm/cpu/entry_ll_64.S
new file mode 100644
index 0000000000..37e0cb66b5
--- /dev/null
+++ b/arch/arm/cpu/entry_ll_64.S
@@ -0,0 +1,23 @@
+#include <linux/linkage.h>
+#include <asm/sections.h>
+
+/*
+ * x0: memory base
+ * x1: memory size
+ * x2: board data
+ * x3: new value for SP
+ */
+.section .text.__barebox_arm_entry
+ENTRY(__barebox_arm_entry)
+	mov	sp, x3
+	/*
+	 * arm_early_mmu_cache_invalidate is jsut a call to
+	 * v8_invalidate_icache_all() which doesn't clobber x0, x1 or x2
+ 	 */
+	bl	arm_early_mmu_cache_invalidate
+#if IS_ENABLED(CONFIG_PBL_IMAGE)
+	b	barebox_pbl_start
+#else
+	b	barebox_non_pbl_start
+#endif
+ENDPROC(__barebox_arm_entry)
\ No newline at end of file
diff --git a/arch/arm/include/asm/common.h b/arch/arm/include/asm/common.h
index c32cdfe5ec..d03ee6273f 100644
--- a/arch/arm/include/asm/common.h
+++ b/arch/arm/include/asm/common.h
@@ -50,8 +50,7 @@ static inline void arm_setup_stack(unsigned long top)
 {
 	__asm__ __volatile__("mov sp, %0"
 			     :
-			     : "r"(top)
-			     : "sp");
+			     : "r"(top));
 }
 
 #endif /* __ASM_ARM_COMMON_H */
-- 
2.23.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-09-16  7:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-16  7:27 [PATCH 0/6] ARM: Merge single PBL code into multi PBL code Sascha Hauer
2019-09-16  7:27 ` [PATCH 1/6] ARM: remove PBL_FORCE_PIGGYDATA_COPY Sascha Hauer
2019-09-16  7:27 ` [PATCH 2/6] ARM: Compile dtbs for lowlevel code Sascha Hauer
2019-09-16  7:27 ` [PATCH 3/6] ARM: drop bultin DTB Sascha Hauer
2019-09-16  7:27 ` [PATCH 4/6] ARM: Merge single pbl with multi pbl Sascha Hauer
2019-09-16  7:27 ` [PATCH 5/6] ARM: remove now unused PBL code Sascha Hauer
2019-09-16  7:27 ` [PATCH 6/6] ARM: aarch64: Re-implement most of barebox_arm_entry() in assembly Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox