All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/3] imx: Don't define __ASSEMBLY__ in C files
@ 2022-01-14 20:23 Simon Glass
  2022-01-14 20:23 ` [PATCH v3 2/3] kconfig: Add support for conditional values Simon Glass
  2022-01-14 20:23 ` [PATCH v3 3/3] bloblist: Update to use conditional value Simon Glass
  0 siblings, 2 replies; 4+ messages in thread
From: Simon Glass @ 2022-01-14 20:23 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Rasmus Villemoes, Simon Glass, Adam Ford,
	Adrian Alonso, Anatolij Gustschin, Arkadiusz Karas,
	Fabio Estevam, Frieder Schrempf, Giulio Benetti, Heiko Schocher,
	Ian Ray, Ilko Iliev, Marcel Ziswiler, Marek Vasut, Markus Niebel,
	Martyn Welch, NXP i.MX U-Boot Team, Oleh Kravchenko,
	Oliver Graute, Otavio Salvador, Patrick Wildt, Peng Fan,
	Richard Hu, Shawn Guo, Silvio Fricke, Soeren Moch, Stefano Babic,
	Teresa Remmet, Tim Harvey, Troy Kisky, Ying-Chun Liu (PaulLiu)

This is supposed to be a build-system flag. Move it there so we can
define it before linux/kconfig.h is included.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

(no changes since v1)

 arch/arm/mach-imx/Makefile                                | 2 +-
 arch/arm/mach-imx/imx8m/imximage-8mm-lpddr4.cfg           | 1 -
 arch/arm/mach-imx/imx8m/imximage-8mn-ddr4.cfg             | 1 -
 arch/arm/mach-imx/imx8m/imximage-8mn-lpddr4.cfg           | 1 -
 arch/arm/mach-imx/imx8m/imximage-8mp-lpddr4.cfg           | 1 -
 arch/arm/mach-imx/imx8m/imximage.cfg                      | 1 -
 arch/arm/mach-imx/spl_qspi.cfg                            | 1 -
 arch/arm/mach-imx/spl_sd.cfg                              | 1 -
 board/advantech/imx8qm_rom7720_a1/imximage.cfg            | 1 -
 board/aristainetos/aristainetos2.cfg                      | 1 -
 board/beacon/imx8mm/imximage-8mm-lpddr4.cfg               | 1 -
 board/beacon/imx8mn/imximage-8mn-lpddr4.cfg               | 1 -
 board/boundary/nitrogen6x/nitrogen6dl.cfg                 | 1 -
 board/boundary/nitrogen6x/nitrogen6dl2g.cfg               | 1 -
 board/boundary/nitrogen6x/nitrogen6q.cfg                  | 1 -
 board/boundary/nitrogen6x/nitrogen6q2g.cfg                | 1 -
 board/boundary/nitrogen6x/nitrogen6s.cfg                  | 1 -
 board/boundary/nitrogen6x/nitrogen6s1g.cfg                | 1 -
 board/compulab/imx8mm-cl-iot-gate/imximage-8mm-lpddr4.cfg | 1 -
 board/congatec/cgtqmx8/imximage.cfg                       | 1 -
 board/ea/mx7ulp_com/imximage.cfg                          | 1 -
 board/freescale/imx8mm_evk/imximage-8mm-lpddr4.cfg        | 1 -
 board/freescale/imx8mn_evk/imximage-8mn-ddr4.cfg          | 1 -
 board/freescale/imx8mp_evk/imximage-8mp-lpddr4.cfg        | 1 -
 board/freescale/imx8qm_mek/imximage.cfg                   | 1 -
 board/freescale/imx8qm_mek/uboot-container.cfg            | 1 -
 board/freescale/imx8qxp_mek/imximage.cfg                  | 1 -
 board/freescale/imx8qxp_mek/uboot-container.cfg           | 1 -
 board/freescale/imxrt1020-evk/imximage.cfg                | 1 -
 board/freescale/imxrt1050-evk/imximage.cfg                | 1 -
 board/freescale/mx6slevk/imximage.cfg                     | 1 -
 board/freescale/mx6sllevk/imximage.cfg                    | 1 -
 board/freescale/mx6sxsabreauto/imximage.cfg               | 1 -
 board/freescale/mx6sxsabresd/imximage.cfg                 | 1 -
 board/freescale/mx6ullevk/imximage.cfg                    | 1 -
 board/freescale/mx7dsabresd/imximage.cfg                  | 1 -
 board/freescale/mx7ulp_evk/imximage.cfg                   | 1 -
 board/gateworks/venice/imximage-8mm-lpddr4.cfg            | 1 -
 board/ge/bx50v3/bx50v3.cfg                                | 1 -
 board/kontron/sl-mx8mm/imximage.cfg                       | 1 -
 board/novtech/meerkat96/imximage.cfg                      | 1 -
 board/out4/o4-imx6ull-nano/K4B4G1646D-BCMA.cfg            | 1 -
 board/out4/o4-imx6ull-nano/MT41K256M16HA-125E.cfg         | 1 -
 board/phytec/phycore_imx8mm/imximage-8mm-sd.cfg           | 1 -
 board/phytec/phycore_imx8mp/imximage-8mp-sd.cfg           | 1 -
 board/ronetix/imx8mq-cm/imximage-8mq-lpddr4.cfg           | 1 -
 board/siemens/capricorn/imximage.cfg                      | 1 -
 board/siemens/capricorn/uboot-container.cfg               | 1 -
 board/softing/vining_2000/imximage.cfg                    | 1 -
 board/somlabs/visionsom-6ull/imximage.cfg                 | 1 -
 board/storopack/smegw01/imximage.cfg                      | 1 -
 board/tbs/tbs2910/tbs2910.cfg                             | 1 -
 board/technexion/pico-imx6ul/imximage.cfg                 | 1 -
 board/toradex/apalis-imx8/apalis-imx8-imximage.cfg        | 1 -
 board/toradex/apalis-imx8x/apalis-imx8x-imximage.cfg      | 1 -
 board/toradex/colibri-imx6ull/imximage.cfg                | 1 -
 board/toradex/colibri-imx8x/colibri-imx8x-imximage.cfg    | 1 -
 board/toradex/colibri_imx7/imximage.cfg                   | 1 -
 board/toradex/verdin-imx8mm/imximage.cfg                  | 1 -
 board/tq/tqma6/tqma6dl.cfg                                | 1 -
 board/tq/tqma6/tqma6q.cfg                                 | 1 -
 board/tq/tqma6/tqma6s.cfg                                 | 1 -
 board/warp/imximage.cfg                                   | 1 -
 board/warp7/imximage.cfg                                  | 1 -
 64 files changed, 1 insertion(+), 64 deletions(-)

diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 07954bc2014..77e72702bba 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -91,7 +91,7 @@ $(PLUGIN).bin:
 endif
 
 quiet_cmd_cpp_cfg = CFGS    $@
-      cmd_cpp_cfg = $(CPP) $(cpp_flags) -x c -o $@ $<
+      cmd_cpp_cfg = $(CPP) $(cpp_flags) -D__ASSEMBLY__ -x c -o $@ $<
 
 # mkimage source config file
 IMX_CONFIG = $(CONFIG_IMX_CONFIG:"%"=%)
diff --git a/arch/arm/mach-imx/imx8m/imximage-8mm-lpddr4.cfg b/arch/arm/mach-imx/imx8m/imximage-8mm-lpddr4.cfg
index 1a2e43e6718..e06d53ef417 100644
--- a/arch/arm/mach-imx/imx8m/imximage-8mm-lpddr4.cfg
+++ b/arch/arm/mach-imx/imx8m/imximage-8mm-lpddr4.cfg
@@ -3,7 +3,6 @@
  * Copyright 2019 NXP
  */
 
-#define __ASSEMBLY__
 
 FIT
 BOOT_FROM	sd
diff --git a/arch/arm/mach-imx/imx8m/imximage-8mn-ddr4.cfg b/arch/arm/mach-imx/imx8m/imximage-8mn-ddr4.cfg
index 1405c6560c7..120631a423a 100644
--- a/arch/arm/mach-imx/imx8m/imximage-8mn-ddr4.cfg
+++ b/arch/arm/mach-imx/imx8m/imximage-8mn-ddr4.cfg
@@ -3,7 +3,6 @@
  * Copyright 2019 NXP
  */
 
-#define __ASSEMBLY__
 
 FIT
 ROM_VERSION	v2
diff --git a/arch/arm/mach-imx/imx8m/imximage-8mn-lpddr4.cfg b/arch/arm/mach-imx/imx8m/imximage-8mn-lpddr4.cfg
index 4c63b31db6d..7dae3fa93aa 100644
--- a/arch/arm/mach-imx/imx8m/imximage-8mn-lpddr4.cfg
+++ b/arch/arm/mach-imx/imx8m/imximage-8mn-lpddr4.cfg
@@ -3,7 +3,6 @@
  * Copyright 2019 NXP
  */
 
-#define __ASSEMBLY__
 
 FIT
 ROM_VERSION	v2
diff --git a/arch/arm/mach-imx/imx8m/imximage-8mp-lpddr4.cfg b/arch/arm/mach-imx/imx8m/imximage-8mp-lpddr4.cfg
index 586a5ff306d..0fba9f50f3e 100644
--- a/arch/arm/mach-imx/imx8m/imximage-8mp-lpddr4.cfg
+++ b/arch/arm/mach-imx/imx8m/imximage-8mp-lpddr4.cfg
@@ -3,7 +3,6 @@
  * Copyright 2019 NXP
  */
 
-#define __ASSEMBLY__
 
 FIT
 ROM_VERSION	v2
diff --git a/arch/arm/mach-imx/imx8m/imximage.cfg b/arch/arm/mach-imx/imx8m/imximage.cfg
index 2a3f9591835..30490e04182 100644
--- a/arch/arm/mach-imx/imx8m/imximage.cfg
+++ b/arch/arm/mach-imx/imx8m/imximage.cfg
@@ -3,7 +3,6 @@
  * Copyright 2018-2021 NXP
  */
 
-#define __ASSEMBLY__
 
 FIT
 BOOT_FROM	sd
diff --git a/arch/arm/mach-imx/spl_qspi.cfg b/arch/arm/mach-imx/spl_qspi.cfg
index 1e39ae2f01f..6df779b7715 100644
--- a/arch/arm/mach-imx/spl_qspi.cfg
+++ b/arch/arm/mach-imx/spl_qspi.cfg
@@ -3,7 +3,6 @@
  * Copyright (C) 2014, Compulab Ltd - http://compulab.co.il/
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 IMAGE_VERSION	2
diff --git a/arch/arm/mach-imx/spl_sd.cfg b/arch/arm/mach-imx/spl_sd.cfg
index dbaee815357..e739b547005 100644
--- a/arch/arm/mach-imx/spl_sd.cfg
+++ b/arch/arm/mach-imx/spl_sd.cfg
@@ -3,7 +3,6 @@
  * Copyright (C) 2014, Compulab Ltd - http://compulab.co.il/
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 IMAGE_VERSION	2
diff --git a/board/advantech/imx8qm_rom7720_a1/imximage.cfg b/board/advantech/imx8qm_rom7720_a1/imximage.cfg
index e324c7ca37c..5ecde0c5309 100644
--- a/board/advantech/imx8qm_rom7720_a1/imximage.cfg
+++ b/board/advantech/imx8qm_rom7720_a1/imximage.cfg
@@ -3,7 +3,6 @@
  * Copyright 2018 NXP
  */
 
-#define __ASSEMBLY__
 
 /* Boot from SD, sector size 0x400 */
 BOOT_FROM SD 0x400
diff --git a/board/aristainetos/aristainetos2.cfg b/board/aristainetos/aristainetos2.cfg
index d088cc83ad4..2454ac5515a 100644
--- a/board/aristainetos/aristainetos2.cfg
+++ b/board/aristainetos/aristainetos2.cfg
@@ -21,7 +21,6 @@ IMAGE_VERSION 2
  */
 BOOT_FROM      spi
 
-#define __ASSEMBLY__
 #include <config.h>
 #ifdef CONFIG_IMX_HAB
 CSF CONFIG_CSF_SIZE
diff --git a/board/beacon/imx8mm/imximage-8mm-lpddr4.cfg b/board/beacon/imx8mm/imximage-8mm-lpddr4.cfg
index 90573be5fd9..20061521f22 100644
--- a/board/beacon/imx8mm/imximage-8mm-lpddr4.cfg
+++ b/board/beacon/imx8mm/imximage-8mm-lpddr4.cfg
@@ -3,7 +3,6 @@
  * Copyright 2021 NXP
  */
 
-#define __ASSEMBLY__
 
 BOOT_FROM	sd
 LOADER		u-boot-spl-ddr.bin	0x7E1000
diff --git a/board/beacon/imx8mn/imximage-8mn-lpddr4.cfg b/board/beacon/imx8mn/imximage-8mn-lpddr4.cfg
index 7286b264944..0edda9c5e06 100644
--- a/board/beacon/imx8mn/imximage-8mn-lpddr4.cfg
+++ b/board/beacon/imx8mn/imximage-8mn-lpddr4.cfg
@@ -3,7 +3,6 @@
  * Copyright 2021 NXP
  */
 
-#define __ASSEMBLY__
 
 ROM_VERSION	v2
 BOOT_FROM	sd
diff --git a/board/boundary/nitrogen6x/nitrogen6dl.cfg b/board/boundary/nitrogen6x/nitrogen6dl.cfg
index 9558e26a2f1..a57b16a7670 100644
--- a/board/boundary/nitrogen6x/nitrogen6dl.cfg
+++ b/board/boundary/nitrogen6x/nitrogen6dl.cfg
@@ -17,7 +17,6 @@ IMAGE_VERSION 2
  */
 BOOT_FROM      spi
 
-#define __ASSEMBLY__
 #include <config.h>
 #ifdef CONFIG_IMX_HAB
 CSF CONFIG_CSF_SIZE
diff --git a/board/boundary/nitrogen6x/nitrogen6dl2g.cfg b/board/boundary/nitrogen6x/nitrogen6dl2g.cfg
index f5a107c2254..7379b891a65 100644
--- a/board/boundary/nitrogen6x/nitrogen6dl2g.cfg
+++ b/board/boundary/nitrogen6x/nitrogen6dl2g.cfg
@@ -17,7 +17,6 @@ IMAGE_VERSION 2
  */
 BOOT_FROM      spi
 
-#define __ASSEMBLY__
 #include <config.h>
 #ifdef CONFIG_IMX_HAB
 CSF CONFIG_CSF_SIZE
diff --git a/board/boundary/nitrogen6x/nitrogen6q.cfg b/board/boundary/nitrogen6x/nitrogen6q.cfg
index b0bbf0d7975..c7029ab0343 100644
--- a/board/boundary/nitrogen6x/nitrogen6q.cfg
+++ b/board/boundary/nitrogen6x/nitrogen6q.cfg
@@ -17,7 +17,6 @@ IMAGE_VERSION 2
  */
 BOOT_FROM      spi
 
-#define __ASSEMBLY__
 #include <config.h>
 #ifdef CONFIG_IMX_HAB
 CSF CONFIG_CSF_SIZE
diff --git a/board/boundary/nitrogen6x/nitrogen6q2g.cfg b/board/boundary/nitrogen6x/nitrogen6q2g.cfg
index 4999254329f..1d58cd4d13d 100644
--- a/board/boundary/nitrogen6x/nitrogen6q2g.cfg
+++ b/board/boundary/nitrogen6x/nitrogen6q2g.cfg
@@ -17,7 +17,6 @@ IMAGE_VERSION 2
  */
 BOOT_FROM      spi
 
-#define __ASSEMBLY__
 #include <config.h>
 #ifdef CONFIG_IMX_HAB
 CSF CONFIG_CSF_SIZE
diff --git a/board/boundary/nitrogen6x/nitrogen6s.cfg b/board/boundary/nitrogen6x/nitrogen6s.cfg
index 16d778491a4..b16d9447fa9 100644
--- a/board/boundary/nitrogen6x/nitrogen6s.cfg
+++ b/board/boundary/nitrogen6x/nitrogen6s.cfg
@@ -17,7 +17,6 @@ IMAGE_VERSION 2
  */
 BOOT_FROM      spi
 
-#define __ASSEMBLY__
 #include <config.h>
 #ifdef CONFIG_IMX_HAB
 CSF CONFIG_CSF_SIZE
diff --git a/board/boundary/nitrogen6x/nitrogen6s1g.cfg b/board/boundary/nitrogen6x/nitrogen6s1g.cfg
index 0320078a911..debec755d6b 100644
--- a/board/boundary/nitrogen6x/nitrogen6s1g.cfg
+++ b/board/boundary/nitrogen6x/nitrogen6s1g.cfg
@@ -17,7 +17,6 @@ IMAGE_VERSION 2
  */
 BOOT_FROM      spi
 
-#define __ASSEMBLY__
 #include <config.h>
 #ifdef CONFIG_IMX_HAB
 CSF CONFIG_CSF_SIZE
diff --git a/board/compulab/imx8mm-cl-iot-gate/imximage-8mm-lpddr4.cfg b/board/compulab/imx8mm-cl-iot-gate/imximage-8mm-lpddr4.cfg
index 4071219fbf4..f9ce7f89d7c 100644
--- a/board/compulab/imx8mm-cl-iot-gate/imximage-8mm-lpddr4.cfg
+++ b/board/compulab/imx8mm-cl-iot-gate/imximage-8mm-lpddr4.cfg
@@ -3,7 +3,6 @@
  * Copyright 2021 NXP
  */
 
-#define __ASSEMBLY__
 
 BOOT_FROM	sd
 LOADER		u-boot-spl-ddr.bin	0x7e1000
diff --git a/board/congatec/cgtqmx8/imximage.cfg b/board/congatec/cgtqmx8/imximage.cfg
index e324c7ca37c..5ecde0c5309 100644
--- a/board/congatec/cgtqmx8/imximage.cfg
+++ b/board/congatec/cgtqmx8/imximage.cfg
@@ -3,7 +3,6 @@
  * Copyright 2018 NXP
  */
 
-#define __ASSEMBLY__
 
 /* Boot from SD, sector size 0x400 */
 BOOT_FROM SD 0x400
diff --git a/board/ea/mx7ulp_com/imximage.cfg b/board/ea/mx7ulp_com/imximage.cfg
index 1b218996aea..1731da814d0 100644
--- a/board/ea/mx7ulp_com/imximage.cfg
+++ b/board/ea/mx7ulp_com/imximage.cfg
@@ -9,7 +9,6 @@
  * The syntax is taken as close as possible with the kwbimage
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/freescale/imx8mm_evk/imximage-8mm-lpddr4.cfg b/board/freescale/imx8mm_evk/imximage-8mm-lpddr4.cfg
index 90573be5fd9..20061521f22 100644
--- a/board/freescale/imx8mm_evk/imximage-8mm-lpddr4.cfg
+++ b/board/freescale/imx8mm_evk/imximage-8mm-lpddr4.cfg
@@ -3,7 +3,6 @@
  * Copyright 2021 NXP
  */
 
-#define __ASSEMBLY__
 
 BOOT_FROM	sd
 LOADER		u-boot-spl-ddr.bin	0x7E1000
diff --git a/board/freescale/imx8mn_evk/imximage-8mn-ddr4.cfg b/board/freescale/imx8mn_evk/imximage-8mn-ddr4.cfg
index 22aec26da7d..d0f5b6ccd7b 100644
--- a/board/freescale/imx8mn_evk/imximage-8mn-ddr4.cfg
+++ b/board/freescale/imx8mn_evk/imximage-8mn-ddr4.cfg
@@ -3,7 +3,6 @@
  * Copyright 2021 NXP
  */
 
-#define __ASSEMBLY__
 
 ROM_VERSION	v2
 BOOT_FROM	sd
diff --git a/board/freescale/imx8mp_evk/imximage-8mp-lpddr4.cfg b/board/freescale/imx8mp_evk/imximage-8mp-lpddr4.cfg
index 4c3ecf5a71a..6dedf1724ab 100644
--- a/board/freescale/imx8mp_evk/imximage-8mp-lpddr4.cfg
+++ b/board/freescale/imx8mp_evk/imximage-8mp-lpddr4.cfg
@@ -3,7 +3,6 @@
  * Copyright 2021 NXP
  */
 
-#define __ASSEMBLY__
 
 ROM_VERSION	v2
 BOOT_FROM	sd
diff --git a/board/freescale/imx8qm_mek/imximage.cfg b/board/freescale/imx8qm_mek/imximage.cfg
index 7dc6b93eb58..71612678c99 100644
--- a/board/freescale/imx8qm_mek/imximage.cfg
+++ b/board/freescale/imx8qm_mek/imximage.cfg
@@ -3,7 +3,6 @@
  * Copyright 2018 NXP
  */
 
-#define __ASSEMBLY__
 
 /* Boot from SD, sector size 0x400 */
 BOOT_FROM SD 0x400
diff --git a/board/freescale/imx8qm_mek/uboot-container.cfg b/board/freescale/imx8qm_mek/uboot-container.cfg
index 6cc47cd1027..93c5d39ae9b 100644
--- a/board/freescale/imx8qm_mek/uboot-container.cfg
+++ b/board/freescale/imx8qm_mek/uboot-container.cfg
@@ -3,7 +3,6 @@
  * Copyright 2019 NXP
  */
 
-#define __ASSEMBLY__
 
 /* This file is to create a container image could be loaded by SPL */
 BOOT_FROM SD 0x400
diff --git a/board/freescale/imx8qxp_mek/imximage.cfg b/board/freescale/imx8qxp_mek/imximage.cfg
index cd747d2eee7..89a4736ab7a 100644
--- a/board/freescale/imx8qxp_mek/imximage.cfg
+++ b/board/freescale/imx8qxp_mek/imximage.cfg
@@ -6,7 +6,6 @@
  * and create imx8image boot image
  */
 
-#define __ASSEMBLY__
 
 /* Boot from SD, sector size 0x400 */
 BOOT_FROM SD 0x400
diff --git a/board/freescale/imx8qxp_mek/uboot-container.cfg b/board/freescale/imx8qxp_mek/uboot-container.cfg
index 81658118185..b53896f2354 100644
--- a/board/freescale/imx8qxp_mek/uboot-container.cfg
+++ b/board/freescale/imx8qxp_mek/uboot-container.cfg
@@ -3,7 +3,6 @@
  * Copyright 2019 NXP
  */
 
-#define __ASSEMBLY__
 
 /* This file is to create a container image could be loaded by SPL */
 BOOT_FROM SD 0x400
diff --git a/board/freescale/imxrt1020-evk/imximage.cfg b/board/freescale/imxrt1020-evk/imximage.cfg
index 9bcc2c15907..0ed71479a60 100644
--- a/board/freescale/imxrt1020-evk/imximage.cfg
+++ b/board/freescale/imxrt1020-evk/imximage.cfg
@@ -4,7 +4,6 @@
  * Author(s): Giulio Benetti <giulio.benetti@benettiengineering.com>
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/freescale/imxrt1050-evk/imximage.cfg b/board/freescale/imxrt1050-evk/imximage.cfg
index cf1665be610..f1f09fd7ebb 100644
--- a/board/freescale/imxrt1050-evk/imximage.cfg
+++ b/board/freescale/imxrt1050-evk/imximage.cfg
@@ -4,7 +4,6 @@
  * Author(s): Giulio Benetti <giulio.benetti@benettiengineering.com>
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/freescale/mx6slevk/imximage.cfg b/board/freescale/mx6slevk/imximage.cfg
index b97761a5162..64be101d6ec 100644
--- a/board/freescale/mx6slevk/imximage.cfg
+++ b/board/freescale/mx6slevk/imximage.cfg
@@ -7,7 +7,6 @@
  *
  * The syntax is taken as close as possible with the kwbimage
  */
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/freescale/mx6sllevk/imximage.cfg b/board/freescale/mx6sllevk/imximage.cfg
index 74b3a907bf2..550be3f6c12 100644
--- a/board/freescale/mx6sllevk/imximage.cfg
+++ b/board/freescale/mx6sllevk/imximage.cfg
@@ -8,7 +8,6 @@
  * The syntax is taken as close as possible with the kwbimage
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/freescale/mx6sxsabreauto/imximage.cfg b/board/freescale/mx6sxsabreauto/imximage.cfg
index 4a0bcc5f7d6..da703093aa6 100644
--- a/board/freescale/mx6sxsabreauto/imximage.cfg
+++ b/board/freescale/mx6sxsabreauto/imximage.cfg
@@ -3,7 +3,6 @@
  * Copyright (C) 2014 Freescale Semiconductor, Inc.
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/freescale/mx6sxsabresd/imximage.cfg b/board/freescale/mx6sxsabresd/imximage.cfg
index 28ffb2f8bc9..313ab589505 100644
--- a/board/freescale/mx6sxsabresd/imximage.cfg
+++ b/board/freescale/mx6sxsabresd/imximage.cfg
@@ -3,7 +3,6 @@
  * Copyright (C) 2014 Freescale Semiconductor, Inc.
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/freescale/mx6ullevk/imximage.cfg b/board/freescale/mx6ullevk/imximage.cfg
index 155503997d2..0c6f444a7a3 100644
--- a/board/freescale/mx6ullevk/imximage.cfg
+++ b/board/freescale/mx6ullevk/imximage.cfg
@@ -8,7 +8,6 @@
  * The syntax is taken as close as possible with the kwbimage
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/freescale/mx7dsabresd/imximage.cfg b/board/freescale/mx7dsabresd/imximage.cfg
index 05446ac833d..59e66fbda16 100644
--- a/board/freescale/mx7dsabresd/imximage.cfg
+++ b/board/freescale/mx7dsabresd/imximage.cfg
@@ -8,7 +8,6 @@
  * The syntax is taken as close as possible with the kwbimage
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/freescale/mx7ulp_evk/imximage.cfg b/board/freescale/mx7ulp_evk/imximage.cfg
index ec3673040ba..62fd79afd6c 100644
--- a/board/freescale/mx7ulp_evk/imximage.cfg
+++ b/board/freescale/mx7ulp_evk/imximage.cfg
@@ -8,7 +8,6 @@
  * The syntax is taken as close as possible with the kwbimage
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/gateworks/venice/imximage-8mm-lpddr4.cfg b/board/gateworks/venice/imximage-8mm-lpddr4.cfg
index ccaa765cb7d..6bc457c6a20 100644
--- a/board/gateworks/venice/imximage-8mm-lpddr4.cfg
+++ b/board/gateworks/venice/imximage-8mm-lpddr4.cfg
@@ -3,7 +3,6 @@
  * Copyright 2021 Gateworks Corporation
  */
 
-#define __ASSEMBLY__
 
 BOOT_FROM	sd
 LOADER		u-boot-spl-ddr.bin	0x7E1000
diff --git a/board/ge/bx50v3/bx50v3.cfg b/board/ge/bx50v3/bx50v3.cfg
index de3955a94d2..1386516a16f 100644
--- a/board/ge/bx50v3/bx50v3.cfg
+++ b/board/ge/bx50v3/bx50v3.cfg
@@ -13,7 +13,6 @@
 IMAGE_VERSION 2
 BOOT_FROM sd
 
-#define __ASSEMBLY__
 #include <config.h>
 #include "asm/arch/mx6-ddr.h"
 #include "asm/arch/iomux.h"
diff --git a/board/kontron/sl-mx8mm/imximage.cfg b/board/kontron/sl-mx8mm/imximage.cfg
index f101f3d228f..b5380267114 100644
--- a/board/kontron/sl-mx8mm/imximage.cfg
+++ b/board/kontron/sl-mx8mm/imximage.cfg
@@ -3,7 +3,6 @@
  * Copyright (C) 2019 Kontron Electronics GmbH
  */
 
-#define __ASSEMBLY__
 
 BOOT_FROM	sd
 LOADER		u-boot-spl-ddr.bin	0x7E1000
diff --git a/board/novtech/meerkat96/imximage.cfg b/board/novtech/meerkat96/imximage.cfg
index 86275b84d9c..a67ce533141 100644
--- a/board/novtech/meerkat96/imximage.cfg
+++ b/board/novtech/meerkat96/imximage.cfg
@@ -9,7 +9,6 @@
  * The syntax is taken as close as possible with the kwbimage
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/out4/o4-imx6ull-nano/K4B4G1646D-BCMA.cfg b/board/out4/o4-imx6ull-nano/K4B4G1646D-BCMA.cfg
index c0dcfe9a0c5..38c4572152b 100644
--- a/board/out4/o4-imx6ull-nano/K4B4G1646D-BCMA.cfg
+++ b/board/out4/o4-imx6ull-nano/K4B4G1646D-BCMA.cfg
@@ -2,7 +2,6 @@
 // Copyright (C) 2016 Freescale Semiconductor, Inc.
 // Copyright (C) 2021 Oleh Kravchenko <oleg@kaa.org.ua>
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/out4/o4-imx6ull-nano/MT41K256M16HA-125E.cfg b/board/out4/o4-imx6ull-nano/MT41K256M16HA-125E.cfg
index 6f823a7272a..497e7f8fc4a 100644
--- a/board/out4/o4-imx6ull-nano/MT41K256M16HA-125E.cfg
+++ b/board/out4/o4-imx6ull-nano/MT41K256M16HA-125E.cfg
@@ -2,7 +2,6 @@
 // Copyright (C) 2016 Freescale Semiconductor, Inc.
 // Copyright (C) 2021 Oleh Kravchenko <oleg@kaa.org.ua>
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/phytec/phycore_imx8mm/imximage-8mm-sd.cfg b/board/phytec/phycore_imx8mm/imximage-8mm-sd.cfg
index ea74fb7e590..722e62c92d6 100644
--- a/board/phytec/phycore_imx8mm/imximage-8mm-sd.cfg
+++ b/board/phytec/phycore_imx8mm/imximage-8mm-sd.cfg
@@ -3,7 +3,6 @@
  * Copyright 2021 Phytec Messtechnik GmbH
  */
 
-#define __ASSEMBLY__
 
 BOOT_FROM       sd
 LOADER          u-boot-spl-ddr.bin      0x7E1000
diff --git a/board/phytec/phycore_imx8mp/imximage-8mp-sd.cfg b/board/phytec/phycore_imx8mp/imximage-8mp-sd.cfg
index 4c3ecf5a71a..6dedf1724ab 100644
--- a/board/phytec/phycore_imx8mp/imximage-8mp-sd.cfg
+++ b/board/phytec/phycore_imx8mp/imximage-8mp-sd.cfg
@@ -3,7 +3,6 @@
  * Copyright 2021 NXP
  */
 
-#define __ASSEMBLY__
 
 ROM_VERSION	v2
 BOOT_FROM	sd
diff --git a/board/ronetix/imx8mq-cm/imximage-8mq-lpddr4.cfg b/board/ronetix/imx8mq-cm/imximage-8mq-lpddr4.cfg
index 268b5ae7163..fae7ad83693 100644
--- a/board/ronetix/imx8mq-cm/imximage-8mq-lpddr4.cfg
+++ b/board/ronetix/imx8mq-cm/imximage-8mq-lpddr4.cfg
@@ -3,7 +3,6 @@
  * Copyright 2021 NXP
  */
 
-#define __ASSEMBLY__
 
 BOOT_FROM	sd
 LOADER		mkimage.flash.mkimage	0x7E1000
\ No newline at end of file
diff --git a/board/siemens/capricorn/imximage.cfg b/board/siemens/capricorn/imximage.cfg
index 9f9df68e64c..fa871bac212 100644
--- a/board/siemens/capricorn/imximage.cfg
+++ b/board/siemens/capricorn/imximage.cfg
@@ -6,7 +6,6 @@
  * and create imx8image boot image
  */
 
-#define __ASSEMBLY__
 
 /* Boot from SD, sector size 0x400 */
 BOOT_FROM SD 0x400
diff --git a/board/siemens/capricorn/uboot-container.cfg b/board/siemens/capricorn/uboot-container.cfg
index 81658118185..b53896f2354 100644
--- a/board/siemens/capricorn/uboot-container.cfg
+++ b/board/siemens/capricorn/uboot-container.cfg
@@ -3,7 +3,6 @@
  * Copyright 2019 NXP
  */
 
-#define __ASSEMBLY__
 
 /* This file is to create a container image could be loaded by SPL */
 BOOT_FROM SD 0x400
diff --git a/board/softing/vining_2000/imximage.cfg b/board/softing/vining_2000/imximage.cfg
index f6f59ddf55c..300aafcae24 100644
--- a/board/softing/vining_2000/imximage.cfg
+++ b/board/softing/vining_2000/imximage.cfg
@@ -4,7 +4,6 @@
  * Copyright (C) 2017-2019 softing automotive electronics gmbH
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/somlabs/visionsom-6ull/imximage.cfg b/board/somlabs/visionsom-6ull/imximage.cfg
index b49a2df6dd8..370b303cfa6 100644
--- a/board/somlabs/visionsom-6ull/imximage.cfg
+++ b/board/somlabs/visionsom-6ull/imximage.cfg
@@ -9,7 +9,6 @@
  * The syntax is taken as close as possible with the kwbimage
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/storopack/smegw01/imximage.cfg b/board/storopack/smegw01/imximage.cfg
index c7fa06996cc..fd457b27f5e 100644
--- a/board/storopack/smegw01/imximage.cfg
+++ b/board/storopack/smegw01/imximage.cfg
@@ -8,7 +8,6 @@
  * The syntax is taken as close as possible with the kwbimage
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 IMAGE_VERSION	2
diff --git a/board/tbs/tbs2910/tbs2910.cfg b/board/tbs/tbs2910/tbs2910.cfg
index 3ca807b3157..2fa70947cec 100644
--- a/board/tbs/tbs2910/tbs2910.cfg
+++ b/board/tbs/tbs2910/tbs2910.cfg
@@ -3,7 +3,6 @@
  * Copyright (C) 2017 Soeren Moch <smoch@web.de>
  */
 
-#define __ASSEMBLY__
 #include "asm/arch/crm_regs.h"
 #include "asm/arch/iomux.h"
 #include "asm/arch/mx6-ddr.h"
diff --git a/board/technexion/pico-imx6ul/imximage.cfg b/board/technexion/pico-imx6ul/imximage.cfg
index 993c1da6700..98de1782037 100644
--- a/board/technexion/pico-imx6ul/imximage.cfg
+++ b/board/technexion/pico-imx6ul/imximage.cfg
@@ -8,7 +8,6 @@
  * The syntax is taken as close as possible with the kwbimage
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/toradex/apalis-imx8/apalis-imx8-imximage.cfg b/board/toradex/apalis-imx8/apalis-imx8-imximage.cfg
index b8f0f3dc10f..16183f96679 100644
--- a/board/toradex/apalis-imx8/apalis-imx8-imximage.cfg
+++ b/board/toradex/apalis-imx8/apalis-imx8-imximage.cfg
@@ -6,7 +6,6 @@
  * and create imx8image boot image
  */
 
-#define __ASSEMBLY__
 
 /* Boot from SD, sector size 0x400 */
 BOOT_FROM EMMC_FASTBOOT 0x400
diff --git a/board/toradex/apalis-imx8x/apalis-imx8x-imximage.cfg b/board/toradex/apalis-imx8x/apalis-imx8x-imximage.cfg
index 58c62d0a659..c229706f80a 100644
--- a/board/toradex/apalis-imx8x/apalis-imx8x-imximage.cfg
+++ b/board/toradex/apalis-imx8x/apalis-imx8x-imximage.cfg
@@ -6,7 +6,6 @@
  * and create imx8image boot image
  */
 
-#define __ASSEMBLY__
 
 /* Boot from SD, sector size 0x400 */
 BOOT_FROM EMMC_FASTBOOT 0x400
diff --git a/board/toradex/colibri-imx6ull/imximage.cfg b/board/toradex/colibri-imx6ull/imximage.cfg
index e162cff90f0..0d81f9b2f4c 100644
--- a/board/toradex/colibri-imx6ull/imximage.cfg
+++ b/board/toradex/colibri-imx6ull/imximage.cfg
@@ -9,7 +9,6 @@
  * The syntax is taken as close as possible with the kwbimage
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/toradex/colibri-imx8x/colibri-imx8x-imximage.cfg b/board/toradex/colibri-imx8x/colibri-imx8x-imximage.cfg
index 44f6c0c4554..fa176b04084 100644
--- a/board/toradex/colibri-imx8x/colibri-imx8x-imximage.cfg
+++ b/board/toradex/colibri-imx8x/colibri-imx8x-imximage.cfg
@@ -6,7 +6,6 @@
  * and create imx8image boot image
  */
 
-#define __ASSEMBLY__
 
 /* Boot from SD, sector size 0x400 */
 BOOT_FROM EMMC_FASTBOOT 0x400
diff --git a/board/toradex/colibri_imx7/imximage.cfg b/board/toradex/colibri_imx7/imximage.cfg
index bdce48b7ffa..41b3577b10d 100644
--- a/board/toradex/colibri_imx7/imximage.cfg
+++ b/board/toradex/colibri_imx7/imximage.cfg
@@ -9,7 +9,6 @@
  * The syntax is taken as close as possible with the kwbimage
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/toradex/verdin-imx8mm/imximage.cfg b/board/toradex/verdin-imx8mm/imximage.cfg
index fcc92009f3b..0e02e447992 100644
--- a/board/toradex/verdin-imx8mm/imximage.cfg
+++ b/board/toradex/verdin-imx8mm/imximage.cfg
@@ -3,7 +3,6 @@
  * Copyright 2020-2021 Toradex
  */
 
-#define __ASSEMBLY__
 
 BOOT_FROM	emmc_fastboot
 LOADER		u-boot-spl-ddr.bin	0x7e1000
diff --git a/board/tq/tqma6/tqma6dl.cfg b/board/tq/tqma6/tqma6dl.cfg
index 80c71503161..8cd1885b43f 100644
--- a/board/tq/tqma6/tqma6dl.cfg
+++ b/board/tq/tqma6/tqma6dl.cfg
@@ -11,7 +11,6 @@
 /* image version */
 IMAGE_VERSION 2
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /*
diff --git a/board/tq/tqma6/tqma6q.cfg b/board/tq/tqma6/tqma6q.cfg
index 82a0a271d4f..a49489aed3f 100644
--- a/board/tq/tqma6/tqma6q.cfg
+++ b/board/tq/tqma6/tqma6q.cfg
@@ -11,7 +11,6 @@
 /* image version */
 IMAGE_VERSION 2
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /*
diff --git a/board/tq/tqma6/tqma6s.cfg b/board/tq/tqma6/tqma6s.cfg
index 9cdbb3c7676..02f7e109100 100644
--- a/board/tq/tqma6/tqma6s.cfg
+++ b/board/tq/tqma6/tqma6s.cfg
@@ -11,7 +11,6 @@
 /* image version */
 IMAGE_VERSION 2
 
-#define __ASSEMBLY__
 #include <config.h>
 
 /*
diff --git a/board/warp/imximage.cfg b/board/warp/imximage.cfg
index d952c6f2e9e..f6bc604c8b2 100644
--- a/board/warp/imximage.cfg
+++ b/board/warp/imximage.cfg
@@ -7,7 +7,6 @@
  *
  * The syntax is taken as close as possible with the kwbimage
  */
-#define __ASSEMBLY__
 #include <config.h>
 
 /* image version */
diff --git a/board/warp7/imximage.cfg b/board/warp7/imximage.cfg
index 9e7d4725e4a..ca22ee159b7 100644
--- a/board/warp7/imximage.cfg
+++ b/board/warp7/imximage.cfg
@@ -8,7 +8,6 @@
  * The syntax is taken as close as possible with the kwbimage
  */
 
-#define __ASSEMBLY__
 #include <config.h>
 
 IMAGE_VERSION	2
-- 
2.34.1.703.g22d0c6ccf7-goog


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

* [PATCH v3 2/3] kconfig: Add support for conditional values
  2022-01-14 20:23 [PATCH v3 1/3] imx: Don't define __ASSEMBLY__ in C files Simon Glass
@ 2022-01-14 20:23 ` Simon Glass
       [not found]   ` <DU0PR10MB52663E1F129CD6A185F5968893559@DU0PR10MB5266.EURPRD10.PROD.OUTLOOK.COM>
  2022-01-14 20:23 ` [PATCH v3 3/3] bloblist: Update to use conditional value Simon Glass
  1 sibling, 1 reply; 4+ messages in thread
From: Simon Glass @ 2022-01-14 20:23 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Rini, Rasmus Villemoes, Simon Glass, Alexandru Gagniuc,
	Angelo Dureghello, Masahiro Yamada, Patrick Delaunay

At present if an optional Kconfig value needs to be used it must be
bracketed by #ifdef. For example, with this Kconfig setup:

config WIBBLE
	bool "Support wibbles, the world needs more wibbles"

config WIBBLE_ADDR
	hex "Address of the wibble"
	depends on WIBBLE

then the following code must be used:

 #ifdef CONFIG_WIBBLE
 static void handle_wibble(void)
 {
 	int val = CONFIG_WIBBLE_ADDR;

	...
 }
 #endif

 static void init_machine()
 {
 ...
 #ifdef CONFIG_WIBBLE
	handle_wibble();
 #endif
 }

Add a new IF_ENABLED_INT() to help with this. So now it is possible to
write, without #ifdefs:

 static void handle_wibble(void)
 {
        int val = IF_ENABLED_INT(CONFIG_WIBBLE, CONFIG_WIBBLE_ADDR);

	...
 }

 static void init_machine()
 {
 ...
 if (IS_ENABLED(CONFIG_WIBBLE))
	handle_wibble();
 }

The value will be 0 if CONFIG_WIBBLE is not defined, and
CONFIG_WIBBLE_ADDR if it is. This allows us to reduce the use of #ifdef in
the code, ensuring that the compiler still checks the code even if it is
not ultimately used for a particular build.

Add a CONFIG_IF_ENABLED_INT() version as well.

If an attempt is made to use a value that does not exist (i.e. when the
conditional is not enabled), an error about a non-existing function is
generated, e.g.:

common/bloblist.c:447: undefined reference to `invalid_use_of_IF_ENABLED_INT'

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v3:
- Add a way to detect use of a non-existent value

 include/linux/kconfig.h   | 32 ++++++++++++++++++++++++++++++++
 scripts/Makefile.autoconf |  2 +-
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h
index a1d1a298426..e59e920c108 100644
--- a/include/linux/kconfig.h
+++ b/include/linux/kconfig.h
@@ -59,6 +59,26 @@
  */
 #define CONFIG_VAL(option)  config_val(option)
 
+/*
+ * This uses a similar mechanism to config_enabled() above. If cfg is enabled,
+ * it resolves to the value of opt_cfg, otherwise it resolves to def_val
+ */
+#define config_opt_enabled(cfg, opt_cfg, def_val) _config_opt_enabled(cfg, opt_cfg, def_val)
+#define _config_opt_enabled(cfg_val, opt_value, def_val) \
+	__config_opt_enabled(__ARG_PLACEHOLDER_##cfg_val, opt_value, def_val)
+#define __config_opt_enabled(arg1_or_junk, arg2, def_val) \
+	___config_opt_enabled(arg1_or_junk arg2, def_val)
+#define ___config_opt_enabled(__ignored, val, ...) val
+
+#ifndef __ASSEMBLY__
+/* detect usage of a the value when the conditional is not enabled */
+long invalid_use_of_IF_ENABLED_INT(void);
+
+/* Evaluates to 0 if option is not defined, int_option if it is defined */
+#define IF_ENABLED_INT(option, int_option) \
+	config_opt_enabled(option, int_option, invalid_use_of_IF_ENABLED_INT())
+#endif
+
 /*
  * Count number of arguments to a variadic macro. Currently only need
  * it for 1, 2 or 3 arguments.
@@ -113,5 +133,17 @@
 #define CONFIG_IS_ENABLED(option, ...)					\
 	__concat(__CONFIG_IS_ENABLED_, __count_args(option, ##__VA_ARGS__)) (option, ##__VA_ARGS__)
 
+#ifndef __ASSEMBLY__
+/* detect usage of a the value when the conditional is not enabled */
+long invalid_use_of_CONFIG_IF_ENABLED_INT(void);
+
+/*
+ * Evaluates to 0 if SPL_/TPL_/option is not defined, SPL_/TPL_int_option if it
+ * is defined
+ */
+#define CONFIG_IF_ENABLED_INT(option, int_option) \
+	CONFIG_IS_ENABLED(option, (CONFIG_VAL(int_option)), \
+		(invalid_use_of_CONFIG_IF_ENABLED_INT()))
+#endif
 
 #endif /* __LINUX_KCONFIG_H */
diff --git a/scripts/Makefile.autoconf b/scripts/Makefile.autoconf
index 5ed9abc8e14..0b3ffa08bfa 100644
--- a/scripts/Makefile.autoconf
+++ b/scripts/Makefile.autoconf
@@ -68,7 +68,7 @@ quiet_cmd_u_boot_cfg = CFG     $@
       cmd_u_boot_cfg = \
 	$(CPP) $(c_flags) $2 -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && { \
 		grep 'define CONFIG_' $@.tmp | \
-			sed '/define CONFIG_IS_ENABLED(/d;/define CONFIG_VAL(/d;' > $@; \
+			sed '/define CONFIG_IS_ENABLED(/d;/define CONFIG_IF_ENABLED_INT(/d;/define CONFIG_VAL(/d;' > $@; \
 		rm $@.tmp;						\
 	} || {								\
 		rm $@.tmp; false;					\
-- 
2.34.1.703.g22d0c6ccf7-goog


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

* [PATCH v3 3/3] bloblist: Update to use conditional value
  2022-01-14 20:23 [PATCH v3 1/3] imx: Don't define __ASSEMBLY__ in C files Simon Glass
  2022-01-14 20:23 ` [PATCH v3 2/3] kconfig: Add support for conditional values Simon Glass
@ 2022-01-14 20:23 ` Simon Glass
  1 sibling, 0 replies; 4+ messages in thread
From: Simon Glass @ 2022-01-14 20:23 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Tom Rini, Rasmus Villemoes, Simon Glass

Use the new IF_ENABLED_INT() feature to avoid needing our own inline
function to handle this case. Tidy up the logic to ensure that the value
is only used when present. Update the 'expected' comment also.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v3:
- Add new patch to update bloblist to use conditional value

 common/bloblist.c  | 15 +++++++++++----
 include/bloblist.h | 10 ----------
 2 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/common/bloblist.c b/common/bloblist.c
index 056b50c2cb6..406073c8105 100644
--- a/common/bloblist.c
+++ b/common/bloblist.c
@@ -430,18 +430,23 @@ void bloblist_reloc(void *to, uint to_size, void *from, uint from_size)
 
 int bloblist_init(void)
 {
+	bool fixed = IS_ENABLED(CONFIG_BLOBLIST_FIXED);
 	int ret = -ENOENT;
 	ulong addr, size;
 	bool expected;
 
 	/**
-	 * Wed expect to find an existing bloblist in the first phase of U-Boot
-	 * that runs
+	 * We don't expect to find an existing bloblist in the first phase of
+	 * U-Boot that runs. Also we have no way to receive the address of an
+	 * allocated bloblist from a previous stage, so it must be at a fixed
+	 * address.
 	 */
-	expected = !u_boot_first_phase();
+	expected = fixed && !u_boot_first_phase();
 	if (spl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST))
 		expected = false;
-	addr = bloblist_addr();
+	if (fixed)
+		addr = IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED,
+				      CONFIG_BLOBLIST_ADDR);
 	size = CONFIG_BLOBLIST_SIZE;
 	if (expected) {
 		ret = bloblist_check(addr, size);
@@ -460,6 +465,8 @@ int bloblist_init(void)
 			if (!ptr)
 				return log_msg_ret("alloc", -ENOMEM);
 			addr = map_to_sysmem(ptr);
+		} else if (!fixed) {
+			return log_msg_ret("!fixed", ret);
 		}
 		log_debug("Creating new bloblist size %lx at %lx\n", size,
 			  addr);
diff --git a/include/bloblist.h b/include/bloblist.h
index 173129b0273..d0e128acf10 100644
--- a/include/bloblist.h
+++ b/include/bloblist.h
@@ -147,16 +147,6 @@ struct bloblist_rec {
 	u32 spare;
 };
 
-/* access CONFIG_BLOBLIST_ADDR, dealing with it possibly not being defined */
-static inline ulong bloblist_addr(void)
-{
-#ifdef CONFIG_BLOBLIST_FIXED
-	return CONFIG_BLOBLIST_ADDR;
-#else
-	return 0;
-#endif
-}
-
 /**
  * bloblist_check_magic() - return a bloblist if the magic matches
  *
-- 
2.34.1.703.g22d0c6ccf7-goog


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

* Re: [PATCH v3 2/3] kconfig: Add support for conditional values
       [not found]   ` <DU0PR10MB52663E1F129CD6A185F5968893559@DU0PR10MB5266.EURPRD10.PROD.OUTLOOK.COM>
@ 2022-01-15 15:55     ` Simon Glass
  0 siblings, 0 replies; 4+ messages in thread
From: Simon Glass @ 2022-01-15 15:55 UTC (permalink / raw)
  To: Rasmus Villemoes; +Cc: U-Boot Mailing List

+U-Boot Mailing List to update patchwork so 'patman status' works

On Fri, 14 Jan 2022 at 21:52, Rasmus Villemoes
<rasmus.villemoes@prevas.dk> wrote:
>
> (Sorry for formatting, on phone)
>
> At present if an optional Kconfig value needs to be used it must be
> bracketed by #ifdef. For example, with this Kconfig setup:
>
> config WIBBLE
>         bool "Support wibbles, the world needs more wibbles"
>
> config WIBBLE_ADDR
>         hex "Address of the wibble"
>         depends on WIBBLE
>
> then the following code must be used:
>
>  #ifdef CONFIG_WIBBLE
>  static void handle_wibble(void)
>  {
>          int val = CONFIG_WIBBLE_ADDR;
>
>         ...
>  }
>  #endif
>
>  static void init_machine()
>  {
>  ...
>  #ifdef CONFIG_WIBBLE
>         handle_wibble();
>  #endif
>  }
>
> Add a new IF_ENABLED_INT() to help with this. So now it is possible to
> write, without #ifdefs:
>
>  static void handle_wibble(void)
>  {
>         int val = IF_ENABLED_INT(CONFIG_WIBBLE, CONFIG_WIBBLE_ADDR);
>
>         ...
>  }
>
>  static void init_machine()
>  {
>  ...
>  if (IS_ENABLED(CONFIG_WIBBLE))
>         handle_wibble();
>  }
>
> The value will be 0 if CONFIG_WIBBLE is not defined, and
> CONFIG_WIBBLE_ADDR if it is.
>
This is stale, please update.
>
>
> This allows us
> +/* Evaluates to 0 if option is not defined, int_option if it is defined */
>

Stale.
>
> +#define IF_ENABLED_INT(option, int_option) \
> +       config_opt_enabled(option, int_option, invalid_use_of_IF_ENABLED_INT())
> +#endif
> +
>

Should we add a three-arg form of IS_ENABLED so this can also be a
trivial wrapper?
>
>
>  /*
>   * Count number of arguments to a variadic macro. Currently only need
>   * it for 1, 2 or 3 arguments.
> @@ -113,5 +133,17 @@
>  #define CONFIG_IS_ENABLED(option, ...)                                  \
>          __concat(__CONFIG_IS_ENABLED_, __count_args(option, ##__VA_ARGS__)) (option, ##__VA_ARGS__)
>
> +#ifndef __ASSEMBLY__
>

Why prevent use from asm? Sure, if it expands to the function call
that gives a syntax error and not a link error, but it will still
serve its purpose. Of course the declaration of the function must be
guarded, but not the macro definition.
>
>
> Rasmus
>

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

end of thread, other threads:[~2022-01-15 15:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-14 20:23 [PATCH v3 1/3] imx: Don't define __ASSEMBLY__ in C files Simon Glass
2022-01-14 20:23 ` [PATCH v3 2/3] kconfig: Add support for conditional values Simon Glass
     [not found]   ` <DU0PR10MB52663E1F129CD6A185F5968893559@DU0PR10MB5266.EURPRD10.PROD.OUTLOOK.COM>
2022-01-15 15:55     ` Simon Glass
2022-01-14 20:23 ` [PATCH v3 3/3] bloblist: Update to use conditional value Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.