From f3998fdc4d0871727d7be6838bac750c6323c0a8 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 2 Aug 2019 09:44:25 -0600 Subject: env: Rename environment.h to env_internal.h This file contains lots of internal details about the environment. Most code can include env.h instead, calling the functions there as needed. Rename this file and add a comment at the top to indicate its internal nature. Signed-off-by: Simon Glass Acked-by: Joe Hershberger Reviewed-by: Simon Goldschmidt [trini: Fixup apalis-tk1.c] Signed-off-by: Tom Rini --- api/api.c | 2 +- arch/arm/cpu/armv8/fsl-layerscape/cpu.c | 2 +- arch/arm/cpu/armv8/fsl-layerscape/soc.c | 2 +- arch/x86/cpu/qemu/e820.c | 2 +- board/Arcturus/ucp1020/spl.c | 2 +- board/amlogic/w400/w400.c | 2 +- board/birdland/bav335x/board.c | 2 +- board/bosch/guardian/board.c | 2 +- board/bosch/shc/board.c | 2 +- board/buffalo/lsxl/lsxl.c | 2 +- board/freescale/b4860qds/spl.c | 2 +- board/freescale/c29xpcie/spl.c | 2 +- board/freescale/ls1012afrdm/ls1012afrdm.c | 2 +- board/freescale/ls1012aqds/ls1012aqds.c | 2 +- board/freescale/ls1012ardb/ls1012ardb.c | 2 +- board/freescale/ls1028a/ls1028a.c | 2 +- board/freescale/ls1088a/ls1088a.c | 2 +- board/freescale/ls2080a/ls2080a.c | 2 +- board/freescale/ls2080aqds/ls2080aqds.c | 2 +- board/freescale/ls2080ardb/ls2080ardb.c | 2 +- board/freescale/lx2160a/lx2160a.c | 2 +- board/freescale/p1010rdb/spl.c | 2 +- board/freescale/p1022ds/spl.c | 2 +- board/freescale/p1_p2_rdb_pc/spl.c | 2 +- board/freescale/t102xqds/spl.c | 2 +- board/freescale/t102xrdb/spl.c | 2 +- board/freescale/t104xrdb/spl.c | 2 +- board/freescale/t208xqds/spl.c | 2 +- board/freescale/t208xrdb/spl.c | 2 +- board/freescale/t4qds/spl.c | 2 +- board/freescale/t4rdb/spl.c | 2 +- board/gardena/smart-gateway-mt7688/board.c | 2 +- board/phytec/phycore_rk3288/phycore-rk3288.c | 2 +- board/renesas/alt/alt.c | 2 +- board/renesas/gose/gose.c | 2 +- board/renesas/koelsch/koelsch.c | 2 +- board/renesas/lager/lager.c | 2 +- board/renesas/porter/porter.c | 2 +- board/renesas/silk/silk.c | 2 +- board/renesas/stout/stout.c | 2 +- board/st/stm32mp1/stm32mp1.c | 2 +- board/sunxi/board.c | 2 +- board/tcl/sl50/board.c | 2 +- board/ti/am335x/board.c | 2 +- board/toradex/apalis-tk1/apalis-tk1.c | 2 +- cmd/nvedit.c | 2 +- common/board_f.c | 2 +- common/board_r.c | 2 +- common/console.c | 2 +- drivers/mtd/cfi_flash.c | 2 +- drivers/serial/serial-uclass.c | 2 +- drivers/serial/serial.c | 2 +- env/callback.c | 2 +- env/common.c | 2 +- env/eeprom.c | 2 +- env/embedded.c | 2 +- env/env.c | 2 +- env/ext4.c | 2 +- env/fat.c | 2 +- env/flags.c | 2 +- env/flash.c | 2 +- env/mmc.c | 2 +- env/nand.c | 2 +- env/nowhere.c | 2 +- env/nvram.c | 2 +- env/onenand.c | 2 +- env/remote.c | 2 +- env/sata.c | 2 +- env/sf.c | 2 +- env/ubi.c | 2 +- include/common.h | 2 +- include/env_internal.h | 278 +++++++++++++++++++++++++++ include/environment.h | 270 -------------------------- lib/efi_loader/efi_variable.c | 2 +- net/net.c | 2 +- tools/envcrc.c | 2 +- 76 files changed, 352 insertions(+), 344 deletions(-) create mode 100644 include/env_internal.h delete mode 100644 include/environment.h diff --git a/api/api.c b/api/api.c index cd7487fde2..bc9454eb4b 100644 --- a/api/api.c +++ b/api/api.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c index 9577ada113..26f4fdacdb 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c +++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c @@ -33,7 +33,7 @@ #include #ifdef CONFIG_TFABOOT -#include +#include #ifdef CONFIG_CHAIN_OF_TRUST #include #endif diff --git a/arch/arm/cpu/armv8/fsl-layerscape/soc.c b/arch/arm/cpu/armv8/fsl-layerscape/soc.c index 00c705f74e..ca8005992a 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/soc.c +++ b/arch/arm/cpu/armv8/fsl-layerscape/soc.c @@ -27,7 +27,7 @@ #endif #include #ifdef CONFIG_TFABOOT -#include +#include DECLARE_GLOBAL_DATA_PTR; #endif diff --git a/arch/x86/cpu/qemu/e820.c b/arch/x86/cpu/qemu/e820.c index 7b3bc7db5e..e682486547 100644 --- a/arch/x86/cpu/qemu/e820.c +++ b/arch/x86/cpu/qemu/e820.c @@ -4,7 +4,7 @@ */ #include -#include +#include #include DECLARE_GLOBAL_DATA_PTR; diff --git a/board/Arcturus/ucp1020/spl.c b/board/Arcturus/ucp1020/spl.c index f3b7d99878..9314fabdf2 100644 --- a/board/Arcturus/ucp1020/spl.c +++ b/board/Arcturus/ucp1020/spl.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/board/amlogic/w400/w400.c b/board/amlogic/w400/w400.c index 4737865367..e60dc3a622 100644 --- a/board/amlogic/w400/w400.c +++ b/board/amlogic/w400/w400.c @@ -6,7 +6,7 @@ #include #include -#include +#include #include #include diff --git a/board/birdland/bav335x/board.c b/board/birdland/bav335x/board.c index 9e64cbbc82..8811583ac6 100644 --- a/board/birdland/bav335x/board.c +++ b/board/birdland/bav335x/board.c @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include "board.h" diff --git a/board/bosch/guardian/board.c b/board/bosch/guardian/board.c index bc3c6d229c..ec0c4a17f6 100644 --- a/board/bosch/guardian/board.c +++ b/board/bosch/guardian/board.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/board/bosch/shc/board.c b/board/bosch/shc/board.c index 358118f757..a96fdef992 100644 --- a/board/bosch/shc/board.c +++ b/board/bosch/shc/board.c @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include "mmc.h" #include "board.h" diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c index b2ccb83c8a..95d3a5e1f5 100644 --- a/board/buffalo/lsxl/lsxl.c +++ b/board/buffalo/lsxl/lsxl.c @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include #include diff --git a/board/freescale/b4860qds/spl.c b/board/freescale/b4860qds/spl.c index d9aa57f41c..6dfc0c73ec 100644 --- a/board/freescale/b4860qds/spl.c +++ b/board/freescale/b4860qds/spl.c @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/board/freescale/c29xpcie/spl.c b/board/freescale/c29xpcie/spl.c index 5db60d8ed9..29040962cf 100644 --- a/board/freescale/c29xpcie/spl.c +++ b/board/freescale/c29xpcie/spl.c @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include #include diff --git a/board/freescale/ls1012afrdm/ls1012afrdm.c b/board/freescale/ls1012afrdm/ls1012afrdm.c index b4c611e19f..31e41ce169 100644 --- a/board/freescale/ls1012afrdm/ls1012afrdm.c +++ b/board/freescale/ls1012afrdm/ls1012afrdm.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/board/freescale/ls1012aqds/ls1012aqds.c b/board/freescale/ls1012aqds/ls1012aqds.c index a862fe6a93..86c72ee357 100644 --- a/board/freescale/ls1012aqds/ls1012aqds.c +++ b/board/freescale/ls1012aqds/ls1012aqds.c @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/board/freescale/ls1012ardb/ls1012ardb.c b/board/freescale/ls1012ardb/ls1012ardb.c index f648a9040b..e4527c19b8 100644 --- a/board/freescale/ls1012ardb/ls1012ardb.c +++ b/board/freescale/ls1012ardb/ls1012ardb.c @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/board/freescale/ls1028a/ls1028a.c b/board/freescale/ls1028a/ls1028a.c index e5de4eb70c..4aa7cec9ce 100644 --- a/board/freescale/ls1028a/ls1028a.c +++ b/board/freescale/ls1028a/ls1028a.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/board/freescale/ls1088a/ls1088a.c b/board/freescale/ls1088a/ls1088a.c index a1c9eb3f46..f0bea7327d 100644 --- a/board/freescale/ls1088a/ls1088a.c +++ b/board/freescale/ls1088a/ls1088a.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/board/freescale/ls2080a/ls2080a.c b/board/freescale/ls2080a/ls2080a.c index cc1822d0f5..413a698511 100644 --- a/board/freescale/ls2080a/ls2080a.c +++ b/board/freescale/ls2080a/ls2080a.c @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include DECLARE_GLOBAL_DATA_PTR; diff --git a/board/freescale/ls2080aqds/ls2080aqds.c b/board/freescale/ls2080aqds/ls2080aqds.c index e9e0999a18..e9c055745f 100644 --- a/board/freescale/ls2080aqds/ls2080aqds.c +++ b/board/freescale/ls2080aqds/ls2080aqds.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/board/freescale/ls2080ardb/ls2080ardb.c b/board/freescale/ls2080ardb/ls2080ardb.c index a278e2fc11..2b2dbbb0ce 100644 --- a/board/freescale/ls2080ardb/ls2080ardb.c +++ b/board/freescale/ls2080ardb/ls2080ardb.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/board/freescale/lx2160a/lx2160a.c b/board/freescale/lx2160a/lx2160a.c index 3b4cb86692..f3885fa8b7 100644 --- a/board/freescale/lx2160a/lx2160a.c +++ b/board/freescale/lx2160a/lx2160a.c @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/board/freescale/p1010rdb/spl.c b/board/freescale/p1010rdb/spl.c index 95f8b5837d..8f050b3947 100644 --- a/board/freescale/p1010rdb/spl.c +++ b/board/freescale/p1010rdb/spl.c @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/board/freescale/p1022ds/spl.c b/board/freescale/p1022ds/spl.c index 92fd199876..06273f1d20 100644 --- a/board/freescale/p1022ds/spl.c +++ b/board/freescale/p1022ds/spl.c @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/board/freescale/p1_p2_rdb_pc/spl.c b/board/freescale/p1_p2_rdb_pc/spl.c index 9d7b5eff6f..dbf9f739b2 100644 --- a/board/freescale/p1_p2_rdb_pc/spl.c +++ b/board/freescale/p1_p2_rdb_pc/spl.c @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/board/freescale/t102xqds/spl.c b/board/freescale/t102xqds/spl.c index 1b58174ed1..3008f0919f 100644 --- a/board/freescale/t102xqds/spl.c +++ b/board/freescale/t102xqds/spl.c @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include #include diff --git a/board/freescale/t102xrdb/spl.c b/board/freescale/t102xrdb/spl.c index a226d4b5b5..029e3d212c 100644 --- a/board/freescale/t102xrdb/spl.c +++ b/board/freescale/t102xrdb/spl.c @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include #include diff --git a/board/freescale/t104xrdb/spl.c b/board/freescale/t104xrdb/spl.c index 58a7376e7f..7b0eb8edf5 100644 --- a/board/freescale/t104xrdb/spl.c +++ b/board/freescale/t104xrdb/spl.c @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include #include diff --git a/board/freescale/t208xqds/spl.c b/board/freescale/t208xqds/spl.c index 27f3c4c84f..9695dfc2e2 100644 --- a/board/freescale/t208xqds/spl.c +++ b/board/freescale/t208xqds/spl.c @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include #include diff --git a/board/freescale/t208xrdb/spl.c b/board/freescale/t208xrdb/spl.c index ecb1e0d73c..ca7d6a28e0 100644 --- a/board/freescale/t208xrdb/spl.c +++ b/board/freescale/t208xrdb/spl.c @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include #include diff --git a/board/freescale/t4qds/spl.c b/board/freescale/t4qds/spl.c index 16cc29eaa6..7666fe7556 100644 --- a/board/freescale/t4qds/spl.c +++ b/board/freescale/t4qds/spl.c @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include #include diff --git a/board/freescale/t4rdb/spl.c b/board/freescale/t4rdb/spl.c index cc2b2f9ffb..a19558bd6b 100644 --- a/board/freescale/t4rdb/spl.c +++ b/board/freescale/t4rdb/spl.c @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include #include diff --git a/board/gardena/smart-gateway-mt7688/board.c b/board/gardena/smart-gateway-mt7688/board.c index baa3e5726c..bd494c84fc 100644 --- a/board/gardena/smart-gateway-mt7688/board.c +++ b/board/gardena/smart-gateway-mt7688/board.c @@ -5,7 +5,7 @@ #include #include -#include +#include #include #include #include diff --git a/board/phytec/phycore_rk3288/phycore-rk3288.c b/board/phytec/phycore_rk3288/phycore-rk3288.c index 7b9178e3a6..5fcbf65b7c 100644 --- a/board/phytec/phycore_rk3288/phycore-rk3288.c +++ b/board/phytec/phycore_rk3288/phycore-rk3288.c @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/board/renesas/alt/alt.c b/board/renesas/alt/alt.c index 77979704be..10ef7f931b 100644 --- a/board/renesas/alt/alt.c +++ b/board/renesas/alt/alt.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/board/renesas/gose/gose.c b/board/renesas/gose/gose.c index bffa85c232..f86c9f1a63 100644 --- a/board/renesas/gose/gose.c +++ b/board/renesas/gose/gose.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/board/renesas/koelsch/koelsch.c b/board/renesas/koelsch/koelsch.c index 1bb3b492e2..841d337f4d 100644 --- a/board/renesas/koelsch/koelsch.c +++ b/board/renesas/koelsch/koelsch.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/board/renesas/lager/lager.c b/board/renesas/lager/lager.c index bda3295bad..3cb1a56142 100644 --- a/board/renesas/lager/lager.c +++ b/board/renesas/lager/lager.c @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include #include diff --git a/board/renesas/porter/porter.c b/board/renesas/porter/porter.c index d3afc2a400..86f79da7fd 100644 --- a/board/renesas/porter/porter.c +++ b/board/renesas/porter/porter.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/board/renesas/silk/silk.c b/board/renesas/silk/silk.c index bda6a414e6..25221e3c55 100644 --- a/board/renesas/silk/silk.c +++ b/board/renesas/silk/silk.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/board/renesas/stout/stout.c b/board/renesas/stout/stout.c index 95b5711fdb..0a0ff5ff76 100644 --- a/board/renesas/stout/stout.c +++ b/board/renesas/stout/stout.c @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c index 1f9251d7a0..279c7b7797 100644 --- a/board/st/stm32mp1/stm32mp1.c +++ b/board/st/stm32mp1/stm32mp1.c @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/board/sunxi/board.c b/board/sunxi/board.c index bb425cbf66..e3b2d13892 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/board/tcl/sl50/board.c b/board/tcl/sl50/board.c index a9c9d377b4..c7eed31946 100644 --- a/board/tcl/sl50/board.c +++ b/board/tcl/sl50/board.c @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include "board.h" diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c index 54adcd510d..7eaa6cd96d 100644 --- a/board/ti/am335x/board.c +++ b/board/ti/am335x/board.c @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include "../common/board_detect.h" #include "board.h" diff --git a/board/toradex/apalis-tk1/apalis-tk1.c b/board/toradex/apalis-tk1/apalis-tk1.c index beb7e10dfe..bc98858ae0 100644 --- a/board/toradex/apalis-tk1/apalis-tk1.c +++ b/board/toradex/apalis-tk1/apalis-tk1.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/cmd/nvedit.c b/cmd/nvedit.c index 8e8572235c..1cb0bc1460 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/common/board_f.c b/common/board_f.c index 18937bf6f5..31181a9dc4 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/common/board_r.c b/common/board_r.c index f4193cdbec..1dabf5a11c 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/common/console.c b/common/console.c index 0f7e0916cd..89b1e9590c 100644 --- a/common/console.c +++ b/common/console.c @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 6c22f074b0..c59254c76e 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c index d4488a2cc2..dcdaedefe7 100644 --- a/drivers/serial/serial-uclass.c +++ b/drivers/serial/serial-uclass.c @@ -5,7 +5,7 @@ #include #include -#include +#include #include #include #include diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c index 09365ba6a1..b907508dbe 100644 --- a/drivers/serial/serial.c +++ b/drivers/serial/serial.c @@ -5,7 +5,7 @@ */ #include -#include +#include #include #include #include diff --git a/env/callback.c b/env/callback.c index d5469ce3c2..f0904cfdc5 100644 --- a/env/callback.c +++ b/env/callback.c @@ -6,7 +6,7 @@ #include #include -#include +#include #if defined(CONFIG_NEEDS_MANUAL_RELOC) DECLARE_GLOBAL_DATA_PTR; diff --git a/env/common.c b/env/common.c index 474ea2280b..3fb60509dd 100644 --- a/env/common.c +++ b/env/common.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/env/eeprom.c b/env/eeprom.c index 91ee3f35eb..cb04d2ac88 100644 --- a/env/eeprom.c +++ b/env/eeprom.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #if defined(CONFIG_I2C_ENV_EEPROM_BUS) #include diff --git a/env/embedded.c b/env/embedded.c index b1090e90e5..a38e169fe0 100644 --- a/env/embedded.c +++ b/env/embedded.c @@ -12,7 +12,7 @@ #define __ASM_STUB_PROCESSOR_H__ /* don't include asm/processor. */ #include #undef __ASSEMBLY__ -#include +#include #include /* Handle HOSTS that have prepended crap on symbol names, not TARGETS. */ diff --git a/env/env.c b/env/env.c index 9d421e8125..9237bb9c74 100644 --- a/env/env.c +++ b/env/env.c @@ -6,7 +6,7 @@ #include #include -#include +#include DECLARE_GLOBAL_DATA_PTR; diff --git a/env/ext4.c b/env/ext4.c index 6aa36867b6..1f6b1b5bd8 100644 --- a/env/ext4.c +++ b/env/ext4.c @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include #include diff --git a/env/fat.c b/env/fat.c index d23753c6ff..1836556f36 100644 --- a/env/fat.c +++ b/env/fat.c @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include #include diff --git a/env/flags.c b/env/flags.c index 93d337a1aa..418d6cc742 100644 --- a/env/flags.c +++ b/env/flags.c @@ -19,7 +19,7 @@ #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) #else #include -#include +#include #endif #ifdef CONFIG_CMD_NET diff --git a/env/flash.c b/env/flash.c index bdba09e306..231a5fdf24 100644 --- a/env/flash.c +++ b/env/flash.c @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/env/mmc.c b/env/mmc.c index 4ca7c2b9ff..9f1878def1 100644 --- a/env/mmc.c +++ b/env/mmc.c @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include #include diff --git a/env/nand.c b/env/nand.c index 3e2235f5f3..9f3dc635cf 100644 --- a/env/nand.c +++ b/env/nand.c @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/env/nowhere.c b/env/nowhere.c index 7db4eec845..f5b0a17652 100644 --- a/env/nowhere.c +++ b/env/nowhere.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include DECLARE_GLOBAL_DATA_PTR; diff --git a/env/nvram.c b/env/nvram.c index a5b1873aaf..79201bd788 100644 --- a/env/nvram.c +++ b/env/nvram.c @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/env/onenand.c b/env/onenand.c index d371bd757c..dfd4e939f8 100644 --- a/env/onenand.c +++ b/env/onenand.c @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include #include diff --git a/env/remote.c b/env/remote.c index b1a7d1a4c1..02531f427b 100644 --- a/env/remote.c +++ b/env/remote.c @@ -7,7 +7,7 @@ #include #include -#include +#include #include #ifdef ENV_IS_EMBEDDED diff --git a/env/sata.c b/env/sata.c index a5364dda5d..9369710081 100644 --- a/env/sata.c +++ b/env/sata.c @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include #include diff --git a/env/sf.c b/env/sf.c index 09646e1eed..590d0cedd8 100644 --- a/env/sf.c +++ b/env/sf.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/env/ubi.c b/env/ubi.c index a69db14afd..08aac47df2 100644 --- a/env/ubi.c +++ b/env/ubi.c @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include #include diff --git a/include/common.h b/include/common.h index 34ae514805..f8afbc0d70 100644 --- a/include/common.h +++ b/include/common.h @@ -394,7 +394,7 @@ int cpu_release(u32 nr, int argc, char * const argv[]); /* Pull in stuff for the build system */ #ifdef DO_DEPS_ONLY -# include +# include #endif #endif /* __COMMON_H_ */ diff --git a/include/env_internal.h b/include/env_internal.h new file mode 100644 index 0000000000..b1ddcb5adf --- /dev/null +++ b/include/env_internal.h @@ -0,0 +1,278 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Internal environment header file. This includes direct access to environment + * information such as its size and offset, direct access to the default + * environment and embedded environment (if used). It also provides environment + * drivers with various declarations. + * + * It should not be included by board files, drivers and code other than that + * related to the environment implementation. + * + * (C) Copyright 2002 + * Wolfgang Denk, DENX Software Engineering, wd@denx.de. + */ + +#ifndef _ENV_INTERNAL_H_ +#define _ENV_INTERNAL_H_ + +#include + +/************************************************************************** + * + * The "environment" is stored as a list of '\0' terminated + * "name=value" strings. The end of the list is marked by a double + * '\0'. New entries are always added at the end. Deleting an entry + * shifts the remaining entries to the front. Replacing an entry is a + * combination of deleting the old value and adding the new one. + * + * The environment is preceded by a 32 bit CRC over the data part. + * + *************************************************************************/ + +#if defined(CONFIG_ENV_IS_IN_FLASH) +# ifndef CONFIG_ENV_ADDR +# define CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE + CONFIG_ENV_OFFSET) +# endif +# ifndef CONFIG_ENV_OFFSET +# define CONFIG_ENV_OFFSET (CONFIG_ENV_ADDR - CONFIG_SYS_FLASH_BASE) +# endif +# if !defined(CONFIG_ENV_ADDR_REDUND) && defined(CONFIG_ENV_OFFSET_REDUND) +# define CONFIG_ENV_ADDR_REDUND \ + (CONFIG_SYS_FLASH_BASE + CONFIG_ENV_OFFSET_REDUND) +# endif +# if defined(CONFIG_ENV_SECT_SIZE) || defined(CONFIG_ENV_SIZE) +# ifndef CONFIG_ENV_SECT_SIZE +# define CONFIG_ENV_SECT_SIZE CONFIG_ENV_SIZE +# endif +# ifndef CONFIG_ENV_SIZE +# define CONFIG_ENV_SIZE CONFIG_ENV_SECT_SIZE +# endif +# else +# error "Both CONFIG_ENV_SECT_SIZE and CONFIG_ENV_SIZE undefined" +# endif +# if defined(CONFIG_ENV_ADDR_REDUND) && !defined(CONFIG_ENV_SIZE_REDUND) +# define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE +# endif +# if (CONFIG_ENV_ADDR >= CONFIG_SYS_MONITOR_BASE) && \ + (CONFIG_ENV_ADDR + CONFIG_ENV_SIZE) <= \ + (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN) +# define ENV_IS_EMBEDDED +# endif +# if defined(CONFIG_ENV_ADDR_REDUND) || defined(CONFIG_ENV_OFFSET_REDUND) +# define CONFIG_SYS_REDUNDAND_ENVIRONMENT +# endif +# ifdef CONFIG_ENV_IS_EMBEDDED +# error "do not define CONFIG_ENV_IS_EMBEDDED in your board config" +# error "it is calculated automatically for you" +# endif +#endif /* CONFIG_ENV_IS_IN_FLASH */ + +#if defined(CONFIG_ENV_IS_IN_MMC) +# ifdef CONFIG_ENV_OFFSET_REDUND +# define CONFIG_SYS_REDUNDAND_ENVIRONMENT +# endif +#endif + +#if defined(CONFIG_ENV_IS_IN_NAND) +# if defined(CONFIG_ENV_OFFSET_OOB) +# ifdef CONFIG_ENV_OFFSET_REDUND +# error "CONFIG_ENV_OFFSET_REDUND is not supported when CONFIG_ENV_OFFSET_OOB" +# error "is set" +# endif +extern unsigned long nand_env_oob_offset; +# define CONFIG_ENV_OFFSET nand_env_oob_offset +# else +# ifndef CONFIG_ENV_OFFSET +# error "Need to define CONFIG_ENV_OFFSET when using CONFIG_ENV_IS_IN_NAND" +# endif +# ifdef CONFIG_ENV_OFFSET_REDUND +# define CONFIG_SYS_REDUNDAND_ENVIRONMENT +# endif +# endif /* CONFIG_ENV_OFFSET_OOB */ +# ifndef CONFIG_ENV_SIZE +# error "Need to define CONFIG_ENV_SIZE when using CONFIG_ENV_IS_IN_NAND" +# endif +#endif /* CONFIG_ENV_IS_IN_NAND */ + +#if defined(CONFIG_ENV_IS_IN_UBI) +# ifndef CONFIG_ENV_UBI_PART +# error "Need to define CONFIG_ENV_UBI_PART when using CONFIG_ENV_IS_IN_UBI" +# endif +# ifndef CONFIG_ENV_UBI_VOLUME +# error "Need to define CONFIG_ENV_UBI_VOLUME when using CONFIG_ENV_IS_IN_UBI" +# endif +# if defined(CONFIG_ENV_UBI_VOLUME_REDUND) +# define CONFIG_SYS_REDUNDAND_ENVIRONMENT +# endif +# ifndef CONFIG_ENV_SIZE +# error "Need to define CONFIG_ENV_SIZE when using CONFIG_ENV_IS_IN_UBI" +# endif +# ifndef CONFIG_CMD_UBI +# error "Need to define CONFIG_CMD_UBI when using CONFIG_ENV_IS_IN_UBI" +# endif +#endif /* CONFIG_ENV_IS_IN_UBI */ + +/* Embedded env is only supported for some flash types */ +#ifdef CONFIG_ENV_IS_EMBEDDED +# if !defined(CONFIG_ENV_IS_IN_FLASH) && \ + !defined(CONFIG_ENV_IS_IN_NAND) && \ + !defined(CONFIG_ENV_IS_IN_ONENAND) && \ + !defined(CONFIG_ENV_IS_IN_SPI_FLASH) +# error "CONFIG_ENV_IS_EMBEDDED not supported for your flash type" +# endif +#endif + +/* + * For the flash types where embedded env is supported, but it cannot be + * calculated automatically (i.e. NAND), take the board opt-in. + */ +#if defined(CONFIG_ENV_IS_EMBEDDED) && !defined(ENV_IS_EMBEDDED) +# define ENV_IS_EMBEDDED +#endif + +/* The build system likes to know if the env is embedded */ +#ifdef DO_DEPS_ONLY +# ifdef ENV_IS_EMBEDDED +# ifndef CONFIG_ENV_IS_EMBEDDED +# define CONFIG_ENV_IS_EMBEDDED +# endif +# endif +#endif + +#include "compiler.h" + +#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT +# define ENV_HEADER_SIZE (sizeof(uint32_t) + 1) +#else +# define ENV_HEADER_SIZE (sizeof(uint32_t)) +#endif + +#define ENV_SIZE (CONFIG_ENV_SIZE - ENV_HEADER_SIZE) + +/* + * If the environment is in RAM, allocate extra space for it in the malloc + * region. + */ +#if defined(CONFIG_ENV_IS_EMBEDDED) +#define TOTAL_MALLOC_LEN CONFIG_SYS_MALLOC_LEN +#elif (CONFIG_ENV_ADDR + CONFIG_ENV_SIZE < CONFIG_SYS_MONITOR_BASE) || \ + (CONFIG_ENV_ADDR >= CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN) || \ + defined(CONFIG_ENV_IS_IN_NVRAM) +#define TOTAL_MALLOC_LEN (CONFIG_SYS_MALLOC_LEN + CONFIG_ENV_SIZE) +#else +#define TOTAL_MALLOC_LEN CONFIG_SYS_MALLOC_LEN +#endif + +typedef struct environment_s { + uint32_t crc; /* CRC32 over data bytes */ +#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT + unsigned char flags; /* active/obsolete flags ENVF_REDUND_ */ +#endif + unsigned char data[ENV_SIZE]; /* Environment data */ +} env_t; + +#ifdef ENV_IS_EMBEDDED +extern env_t embedded_environment; +#endif /* ENV_IS_EMBEDDED */ + +extern const unsigned char default_environment[]; + +#ifndef DO_DEPS_ONLY + +#include +#include +#include +#include + +enum env_location { + ENVL_UNKNOWN, + ENVL_EEPROM, + ENVL_EXT4, + ENVL_FAT, + ENVL_FLASH, + ENVL_MMC, + ENVL_NAND, + ENVL_NVRAM, + ENVL_ONENAND, + ENVL_REMOTE, + ENVL_SPI_FLASH, + ENVL_UBI, + ENVL_NOWHERE, + + ENVL_COUNT, +}; + +/* value for the various operations we want to perform on the env */ +enum env_operation { + ENVOP_GET_CHAR, /* we want to call the get_char function */ + ENVOP_INIT, /* we want to call the init function */ + ENVOP_LOAD, /* we want to call the load function */ + ENVOP_SAVE, /* we want to call the save function */ + ENVOP_ERASE, /* we want to call the erase function */ +}; + +struct env_driver { + const char *name; + enum env_location location; + + /** + * load() - Load the environment from storage + * + * This method is optional. If not provided, no environment will be + * loaded. + * + * @return 0 if OK, -ve on error + */ + int (*load)(void); + + /** + * save() - Save the environment to storage + * + * This method is required for 'saveenv' to work. + * + * @return 0 if OK, -ve on error + */ + int (*save)(void); + + /** + * erase() - Erase the environment on storage + * + * This method is optional and required for 'eraseenv' to work. + * + * @return 0 if OK, -ve on error + */ + int (*erase)(void); + + /** + * init() - Set up the initial pre-relocation environment + * + * This method is optional. + * + * @return 0 if OK, -ENOENT if no initial environment could be found, + * other -ve on error + */ + int (*init)(void); +}; + +/* Declare a new environment location driver */ +#define U_BOOT_ENV_LOCATION(__name) \ + ll_entry_declare(struct env_driver, __name, env_driver) + +/* Declare the name of a location */ +#ifdef CONFIG_CMD_SAVEENV +#define ENV_NAME(_name) .name = _name, +#else +#define ENV_NAME(_name) +#endif + +#ifdef CONFIG_CMD_SAVEENV +#define env_save_ptr(x) x +#else +#define env_save_ptr(x) NULL +#endif + +extern struct hsearch_data env_htab; + +#endif /* DO_DEPS_ONLY */ + +#endif /* _ENV_INTERNAL_H_ */ diff --git a/include/environment.h b/include/environment.h deleted file mode 100644 index cc8c0546c2..0000000000 --- a/include/environment.h +++ /dev/null @@ -1,270 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ */ -/* - * (C) Copyright 2002 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - */ - -#ifndef _ENVIRONMENT_H_ -#define _ENVIRONMENT_H_ - -#include - -/************************************************************************** - * - * The "environment" is stored as a list of '\0' terminated - * "name=value" strings. The end of the list is marked by a double - * '\0'. New entries are always added at the end. Deleting an entry - * shifts the remaining entries to the front. Replacing an entry is a - * combination of deleting the old value and adding the new one. - * - * The environment is preceded by a 32 bit CRC over the data part. - * - *************************************************************************/ - -#if defined(CONFIG_ENV_IS_IN_FLASH) -# ifndef CONFIG_ENV_ADDR -# define CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE + CONFIG_ENV_OFFSET) -# endif -# ifndef CONFIG_ENV_OFFSET -# define CONFIG_ENV_OFFSET (CONFIG_ENV_ADDR - CONFIG_SYS_FLASH_BASE) -# endif -# if !defined(CONFIG_ENV_ADDR_REDUND) && defined(CONFIG_ENV_OFFSET_REDUND) -# define CONFIG_ENV_ADDR_REDUND \ - (CONFIG_SYS_FLASH_BASE + CONFIG_ENV_OFFSET_REDUND) -# endif -# if defined(CONFIG_ENV_SECT_SIZE) || defined(CONFIG_ENV_SIZE) -# ifndef CONFIG_ENV_SECT_SIZE -# define CONFIG_ENV_SECT_SIZE CONFIG_ENV_SIZE -# endif -# ifndef CONFIG_ENV_SIZE -# define CONFIG_ENV_SIZE CONFIG_ENV_SECT_SIZE -# endif -# else -# error "Both CONFIG_ENV_SECT_SIZE and CONFIG_ENV_SIZE undefined" -# endif -# if defined(CONFIG_ENV_ADDR_REDUND) && !defined(CONFIG_ENV_SIZE_REDUND) -# define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE -# endif -# if (CONFIG_ENV_ADDR >= CONFIG_SYS_MONITOR_BASE) && \ - (CONFIG_ENV_ADDR + CONFIG_ENV_SIZE) <= \ - (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN) -# define ENV_IS_EMBEDDED -# endif -# if defined(CONFIG_ENV_ADDR_REDUND) || defined(CONFIG_ENV_OFFSET_REDUND) -# define CONFIG_SYS_REDUNDAND_ENVIRONMENT -# endif -# ifdef CONFIG_ENV_IS_EMBEDDED -# error "do not define CONFIG_ENV_IS_EMBEDDED in your board config" -# error "it is calculated automatically for you" -# endif -#endif /* CONFIG_ENV_IS_IN_FLASH */ - -#if defined(CONFIG_ENV_IS_IN_MMC) -# ifdef CONFIG_ENV_OFFSET_REDUND -# define CONFIG_SYS_REDUNDAND_ENVIRONMENT -# endif -#endif - -#if defined(CONFIG_ENV_IS_IN_NAND) -# if defined(CONFIG_ENV_OFFSET_OOB) -# ifdef CONFIG_ENV_OFFSET_REDUND -# error "CONFIG_ENV_OFFSET_REDUND is not supported when CONFIG_ENV_OFFSET_OOB" -# error "is set" -# endif -extern unsigned long nand_env_oob_offset; -# define CONFIG_ENV_OFFSET nand_env_oob_offset -# else -# ifndef CONFIG_ENV_OFFSET -# error "Need to define CONFIG_ENV_OFFSET when using CONFIG_ENV_IS_IN_NAND" -# endif -# ifdef CONFIG_ENV_OFFSET_REDUND -# define CONFIG_SYS_REDUNDAND_ENVIRONMENT -# endif -# endif /* CONFIG_ENV_OFFSET_OOB */ -# ifndef CONFIG_ENV_SIZE -# error "Need to define CONFIG_ENV_SIZE when using CONFIG_ENV_IS_IN_NAND" -# endif -#endif /* CONFIG_ENV_IS_IN_NAND */ - -#if defined(CONFIG_ENV_IS_IN_UBI) -# ifndef CONFIG_ENV_UBI_PART -# error "Need to define CONFIG_ENV_UBI_PART when using CONFIG_ENV_IS_IN_UBI" -# endif -# ifndef CONFIG_ENV_UBI_VOLUME -# error "Need to define CONFIG_ENV_UBI_VOLUME when using CONFIG_ENV_IS_IN_UBI" -# endif -# if defined(CONFIG_ENV_UBI_VOLUME_REDUND) -# define CONFIG_SYS_REDUNDAND_ENVIRONMENT -# endif -# ifndef CONFIG_ENV_SIZE -# error "Need to define CONFIG_ENV_SIZE when using CONFIG_ENV_IS_IN_UBI" -# endif -# ifndef CONFIG_CMD_UBI -# error "Need to define CONFIG_CMD_UBI when using CONFIG_ENV_IS_IN_UBI" -# endif -#endif /* CONFIG_ENV_IS_IN_UBI */ - -/* Embedded env is only supported for some flash types */ -#ifdef CONFIG_ENV_IS_EMBEDDED -# if !defined(CONFIG_ENV_IS_IN_FLASH) && \ - !defined(CONFIG_ENV_IS_IN_NAND) && \ - !defined(CONFIG_ENV_IS_IN_ONENAND) && \ - !defined(CONFIG_ENV_IS_IN_SPI_FLASH) -# error "CONFIG_ENV_IS_EMBEDDED not supported for your flash type" -# endif -#endif - -/* - * For the flash types where embedded env is supported, but it cannot be - * calculated automatically (i.e. NAND), take the board opt-in. - */ -#if defined(CONFIG_ENV_IS_EMBEDDED) && !defined(ENV_IS_EMBEDDED) -# define ENV_IS_EMBEDDED -#endif - -/* The build system likes to know if the env is embedded */ -#ifdef DO_DEPS_ONLY -# ifdef ENV_IS_EMBEDDED -# ifndef CONFIG_ENV_IS_EMBEDDED -# define CONFIG_ENV_IS_EMBEDDED -# endif -# endif -#endif - -#include "compiler.h" - -#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT -# define ENV_HEADER_SIZE (sizeof(uint32_t) + 1) -#else -# define ENV_HEADER_SIZE (sizeof(uint32_t)) -#endif - -#define ENV_SIZE (CONFIG_ENV_SIZE - ENV_HEADER_SIZE) - -/* - * If the environment is in RAM, allocate extra space for it in the malloc - * region. - */ -#if defined(CONFIG_ENV_IS_EMBEDDED) -#define TOTAL_MALLOC_LEN CONFIG_SYS_MALLOC_LEN -#elif (CONFIG_ENV_ADDR + CONFIG_ENV_SIZE < CONFIG_SYS_MONITOR_BASE) || \ - (CONFIG_ENV_ADDR >= CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN) || \ - defined(CONFIG_ENV_IS_IN_NVRAM) -#define TOTAL_MALLOC_LEN (CONFIG_SYS_MALLOC_LEN + CONFIG_ENV_SIZE) -#else -#define TOTAL_MALLOC_LEN CONFIG_SYS_MALLOC_LEN -#endif - -typedef struct environment_s { - uint32_t crc; /* CRC32 over data bytes */ -#ifdef CONFIG_SYS_REDUNDAND_ENVIRONMENT - unsigned char flags; /* active/obsolete flags ENVF_REDUND_ */ -#endif - unsigned char data[ENV_SIZE]; /* Environment data */ -} env_t; - -#ifdef ENV_IS_EMBEDDED -extern env_t embedded_environment; -#endif /* ENV_IS_EMBEDDED */ - -extern const unsigned char default_environment[]; - -#ifndef DO_DEPS_ONLY - -#include -#include -#include -#include - -enum env_location { - ENVL_UNKNOWN, - ENVL_EEPROM, - ENVL_EXT4, - ENVL_FAT, - ENVL_FLASH, - ENVL_MMC, - ENVL_NAND, - ENVL_NVRAM, - ENVL_ONENAND, - ENVL_REMOTE, - ENVL_SPI_FLASH, - ENVL_UBI, - ENVL_NOWHERE, - - ENVL_COUNT, -}; - -/* value for the various operations we want to perform on the env */ -enum env_operation { - ENVOP_GET_CHAR, /* we want to call the get_char function */ - ENVOP_INIT, /* we want to call the init function */ - ENVOP_LOAD, /* we want to call the load function */ - ENVOP_SAVE, /* we want to call the save function */ - ENVOP_ERASE, /* we want to call the erase function */ -}; - -struct env_driver { - const char *name; - enum env_location location; - - /** - * load() - Load the environment from storage - * - * This method is optional. If not provided, no environment will be - * loaded. - * - * @return 0 if OK, -ve on error - */ - int (*load)(void); - - /** - * save() - Save the environment to storage - * - * This method is required for 'saveenv' to work. - * - * @return 0 if OK, -ve on error - */ - int (*save)(void); - - /** - * erase() - Erase the environment on storage - * - * This method is optional and required for 'eraseenv' to work. - * - * @return 0 if OK, -ve on error - */ - int (*erase)(void); - - /** - * init() - Set up the initial pre-relocation environment - * - * This method is optional. - * - * @return 0 if OK, -ENOENT if no initial environment could be found, - * other -ve on error - */ - int (*init)(void); -}; - -/* Declare a new environment location driver */ -#define U_BOOT_ENV_LOCATION(__name) \ - ll_entry_declare(struct env_driver, __name, env_driver) - -/* Declare the name of a location */ -#ifdef CONFIG_CMD_SAVEENV -#define ENV_NAME(_name) .name = _name, -#else -#define ENV_NAME(_name) -#endif - -#ifdef CONFIG_CMD_SAVEENV -#define env_save_ptr(x) x -#else -#define env_save_ptr(x) NULL -#endif - -extern struct hsearch_data env_htab; - -#endif /* DO_DEPS_ONLY */ - -#endif /* _ENVIRONMENT_H_ */ diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c index 8a0e0db13e..6687b69a40 100644 --- a/lib/efi_loader/efi_variable.c +++ b/lib/efi_loader/efi_variable.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include diff --git a/net/net.c b/net/net.c index f0a3996cd6..40511db645 100644 --- a/net/net.c +++ b/net/net.c @@ -91,7 +91,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tools/envcrc.c b/tools/envcrc.c index 7eb7246d45..672ef4d675 100644 --- a/tools/envcrc.c +++ b/tools/envcrc.c @@ -59,7 +59,7 @@ #ifdef CONFIG_BUILD_ENVCRC -# include +# include extern unsigned int env_size; extern env_t embedded_environment; #endif /* CONFIG_BUILD_ENVCRC */ -- cgit