[U-Boot] [PATCH 36/41] common: Move board_get_usable_ram_top() out of common.h

Simon Glass sjg at chromium.org
Mon Sep 30 14:41:07 UTC 2019


Move this function into init.h which seems to be designed for this sort
of thing. Also update the header to declare struct global_data so that it
can be included without global_data.h being needed.

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

 arch/arm/mach-mvebu/arm64-common.c    |  1 +
 arch/arm/mach-rockchip/sdram_common.c |  1 +
 arch/arm/mach-tegra/board2.c          |  1 +
 arch/mips/mach-jz47xx/jz4780/jz4780.c |  1 +
 arch/riscv/cpu/generic/dram.c         |  1 +
 arch/x86/cpu/broadwell/sdram.c        |  1 +
 arch/x86/cpu/coreboot/sdram.c         |  1 +
 arch/x86/cpu/efi/payload.c            |  1 +
 arch/x86/cpu/efi/sdram.c              |  1 +
 arch/x86/cpu/intel_common/mrc.c       |  1 +
 arch/x86/cpu/ivybridge/sdram.c        |  1 +
 arch/x86/cpu/qemu/dram.c              |  1 +
 arch/x86/cpu/quark/dram.c             |  1 +
 arch/x86/cpu/slimbootloader/sdram.c   |  1 +
 arch/x86/lib/fsp/fsp_dram.c           |  1 +
 arch/x86/lib/init_helpers.c           |  1 +
 board/armadeus/apf27/apf27.c          |  1 +
 board/imgtec/boston/ddr.c             |  1 +
 board/menlo/m53menlo/m53menlo.c       |  1 +
 board/raspberrypi/rpi/rpi.c           |  1 +
 board/ti/am65x/evm.c                  |  1 +
 board/ti/j721e/evm.c                  |  1 +
 common/board_f.c                      |  1 +
 drivers/video/fsl_dcu_fb.c            |  1 +
 drivers/video/sunxi/sunxi_display.c   |  1 +
 include/common.h                      | 11 -----------
 include/init.h                        | 20 ++++++++++++++++++--
 lib/efi_loader/efi_memory.c           |  1 +
 28 files changed, 44 insertions(+), 13 deletions(-)

diff --git a/arch/arm/mach-mvebu/arm64-common.c b/arch/arm/mach-mvebu/arm64-common.c
index aaf7b7c4472..40b98dbf08b 100644
--- a/arch/arm/mach-mvebu/arm64-common.c
+++ b/arch/arm/mach-mvebu/arm64-common.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <init.h>
 #include <linux/libfdt.h>
 #include <linux/sizes.h>
 #include <pci.h>
diff --git a/arch/arm/mach-rockchip/sdram_common.c b/arch/arm/mach-rockchip/sdram_common.c
index 22a4aca9402..74a1223532e 100644
--- a/arch/arm/mach-rockchip/sdram_common.c
+++ b/arch/arm/mach-rockchip/sdram_common.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <init.h>
 #include <ram.h>
 #include <asm/io.h>
 #include <asm/arch-rockchip/sdram_common.h>
diff --git a/arch/arm/mach-tegra/board2.c b/arch/arm/mach-tegra/board2.c
index f13bd256cc2..46491a1d43f 100644
--- a/arch/arm/mach-tegra/board2.c
+++ b/arch/arm/mach-tegra/board2.c
@@ -9,6 +9,7 @@
 #include <efi_loader.h>
 #include <env.h>
 #include <errno.h>
+#include <init.h>
 #include <ns16550.h>
 #include <usb.h>
 #include <asm/io.h>
diff --git a/arch/mips/mach-jz47xx/jz4780/jz4780.c b/arch/mips/mach-jz47xx/jz4780/jz4780.c
index 0949cbc3d09..967fc41be49 100644
--- a/arch/mips/mach-jz47xx/jz4780/jz4780.c
+++ b/arch/mips/mach-jz47xx/jz4780/jz4780.c
@@ -9,6 +9,7 @@
 #include <config.h>
 #include <common.h>
 #include <cpu_legacy.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/sections.h>
 #include <mach/jz4780.h>
diff --git a/arch/riscv/cpu/generic/dram.c b/arch/riscv/cpu/generic/dram.c
index b7b12072351..1dc77efeca5 100644
--- a/arch/riscv/cpu/generic/dram.c
+++ b/arch/riscv/cpu/generic/dram.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <fdtdec.h>
+#include <init.h>
 #include <linux/sizes.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/arch/x86/cpu/broadwell/sdram.c b/arch/x86/cpu/broadwell/sdram.c
index b31d78c092a..dfd8afc35f5 100644
--- a/arch/x86/cpu/broadwell/sdram.c
+++ b/arch/x86/cpu/broadwell/sdram.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <init.h>
 #include <pci.h>
 #include <syscon.h>
 #include <asm/cpu.h>
diff --git a/arch/x86/cpu/coreboot/sdram.c b/arch/x86/cpu/coreboot/sdram.c
index 664817feffd..27e859885e8 100644
--- a/arch/x86/cpu/coreboot/sdram.c
+++ b/arch/x86/cpu/coreboot/sdram.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/e820.h>
 #include <asm/arch/sysinfo.h>
 
diff --git a/arch/x86/cpu/efi/payload.c b/arch/x86/cpu/efi/payload.c
index 019e312527e..8f8a9331944 100644
--- a/arch/x86/cpu/efi/payload.c
+++ b/arch/x86/cpu/efi/payload.c
@@ -8,6 +8,7 @@
 #include <cpu.h>
 #include <efi.h>
 #include <errno.h>
+#include <init.h>
 #include <usb.h>
 #include <asm/bootparam.h>
 #include <asm/e820.h>
diff --git a/arch/x86/cpu/efi/sdram.c b/arch/x86/cpu/efi/sdram.c
index a45525f842e..3143c079adb 100644
--- a/arch/x86/cpu/efi/sdram.c
+++ b/arch/x86/cpu/efi/sdram.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <efi.h>
+#include <init.h>
 #include <asm/u-boot-x86.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/arch/x86/cpu/intel_common/mrc.c b/arch/x86/cpu/intel_common/mrc.c
index b35102a3f08..755670a847e 100644
--- a/arch/x86/cpu/intel_common/mrc.c
+++ b/arch/x86/cpu/intel_common/mrc.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <init.h>
 #include <syscon.h>
 #include <asm/cpu.h>
 #include <asm/gpio.h>
diff --git a/arch/x86/cpu/ivybridge/sdram.c b/arch/x86/cpu/ivybridge/sdram.c
index 8a58d0383d5..51ca4ad3017 100644
--- a/arch/x86/cpu/ivybridge/sdram.c
+++ b/arch/x86/cpu/ivybridge/sdram.c
@@ -12,6 +12,7 @@
 #include <common.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <init.h>
 #include <malloc.h>
 #include <net.h>
 #include <rtc.h>
diff --git a/arch/x86/cpu/qemu/dram.c b/arch/x86/cpu/qemu/dram.c
index 6707b7b3634..19d92f27d80 100644
--- a/arch/x86/cpu/qemu/dram.c
+++ b/arch/x86/cpu/qemu/dram.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/post.h>
 #include <asm/arch/qemu.h>
 
diff --git a/arch/x86/cpu/quark/dram.c b/arch/x86/cpu/quark/dram.c
index 1c5d6a963c9..3e502c010dc 100644
--- a/arch/x86/cpu/quark/dram.c
+++ b/arch/x86/cpu/quark/dram.c
@@ -7,6 +7,7 @@
 #include <cpu_legacy.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <init.h>
 #include <malloc.h>
 #include <asm/mrccache.h>
 #include <asm/mtrr.h>
diff --git a/arch/x86/cpu/slimbootloader/sdram.c b/arch/x86/cpu/slimbootloader/sdram.c
index 05d40d196ce..33e91fb6366 100644
--- a/arch/x86/cpu/slimbootloader/sdram.c
+++ b/arch/x86/cpu/slimbootloader/sdram.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <linux/sizes.h>
 #include <asm/e820.h>
 #include <asm/arch/slimbootloader.h>
diff --git a/arch/x86/lib/fsp/fsp_dram.c b/arch/x86/lib/fsp/fsp_dram.c
index 3a23b70410b..6dbaffa4f6d 100644
--- a/arch/x86/lib/fsp/fsp_dram.c
+++ b/arch/x86/lib/fsp/fsp_dram.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/fsp/fsp_support.h>
 #include <asm/e820.h>
 #include <asm/mrccache.h>
diff --git a/arch/x86/lib/init_helpers.c b/arch/x86/lib/init_helpers.c
index 4774a9bdb78..b28988e75a0 100644
--- a/arch/x86/lib/init_helpers.c
+++ b/arch/x86/lib/init_helpers.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <linux/errno.h>
 #include <asm/mtrr.h>
 
diff --git a/board/armadeus/apf27/apf27.c b/board/armadeus/apf27/apf27.c
index 20be0c3bd4e..75395d92cd1 100644
--- a/board/armadeus/apf27/apf27.c
+++ b/board/armadeus/apf27/apf27.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <jffs2/jffs2.h>
 #include <nand.h>
 #include <netdev.h>
diff --git a/board/imgtec/boston/ddr.c b/board/imgtec/boston/ddr.c
index 3f8a5c0d8e6..241b3846687 100644
--- a/board/imgtec/boston/ddr.c
+++ b/board/imgtec/boston/ddr.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 
 #include <asm/io.h>
 
diff --git a/board/menlo/m53menlo/m53menlo.c b/board/menlo/m53menlo/m53menlo.c
index bda5f0df5bc..065e6a2ccc4 100644
--- a/board/menlo/m53menlo/m53menlo.c
+++ b/board/menlo/m53menlo/m53menlo.c
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/sys_proto.h>
diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
index fa57d50c95e..a3243ce8193 100644
--- a/board/raspberrypi/rpi/rpi.c
+++ b/board/raspberrypi/rpi/rpi.c
@@ -10,6 +10,7 @@
 #include <efi_loader.h>
 #include <fdt_support.h>
 #include <fdt_simplefb.h>
+#include <init.h>
 #include <lcd.h>
 #include <memalign.h>
 #include <mmc.h>
diff --git a/board/ti/am65x/evm.c b/board/ti/am65x/evm.c
index e01adcd642f..1b60222e7d6 100644
--- a/board/ti/am65x/evm.c
+++ b/board/ti/am65x/evm.c
@@ -9,6 +9,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <init.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/hardware.h>
 #include <asm/gpio.h>
diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c
index db5d7b8834f..51b121ce05f 100644
--- a/board/ti/j721e/evm.c
+++ b/board/ti/j721e/evm.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 #include <spl.h>
 #include <asm/arch/sys_proto.h>
diff --git a/common/board_f.c b/common/board_f.c
index ca26375cdb2..364028adea4 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -20,6 +20,7 @@
 #include <fdtdec.h>
 #include <fs.h>
 #include <i2c.h>
+#include <init.h>
 #include <initcall.h>
 #include <lcd.h>
 #include <malloc.h>
diff --git a/drivers/video/fsl_dcu_fb.c b/drivers/video/fsl_dcu_fb.c
index add64b85b59..076e9ea0193 100644
--- a/drivers/video/fsl_dcu_fb.c
+++ b/drivers/video/fsl_dcu_fb.c
@@ -6,6 +6,7 @@
  * FSL DCU Framebuffer driver
  */
 
+#include <init.h>
 #include <asm/io.h>
 #include <common.h>
 #include <dm.h>
diff --git a/drivers/video/sunxi/sunxi_display.c b/drivers/video/sunxi/sunxi_display.c
index 9172a3b0113..9fd864bde22 100644
--- a/drivers/video/sunxi/sunxi_display.c
+++ b/drivers/video/sunxi/sunxi_display.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <cpu_legacy.h>
 #include <efi_loader.h>
+#include <init.h>
 #include <time.h>
 
 #include <asm/arch/clock.h>
diff --git a/include/common.h b/include/common.h
index 16d4b0612f8..9bdd1cf85c4 100644
--- a/include/common.h
+++ b/include/common.h
@@ -73,17 +73,6 @@ extern u8 __dtb_dt_begin[];	/* embedded device tree blob */
 extern u8 __dtb_dt_spl_begin[];	/* embedded device tree blob for SPL/TPL */
 int mdm_init(void);
 
-/**
- * Get the uppermost pointer that is valid to access
- *
- * Some systems may not map all of their address space. This function allows
- * boards to indicate what their highest support pointer value is for DRAM
- * access.
- *
- * @param total_size	Size of U-Boot (unused?)
- */
-ulong board_get_usable_ram_top(ulong total_size);
-
 /**
  * arch_fixup_fdt() - Write arch-specific information to fdt
  *
diff --git a/include/init.h b/include/init.h
index afc953d51e2..6076283d2c8 100644
--- a/include/init.h
+++ b/include/init.h
@@ -10,6 +10,8 @@
 #ifndef __INIT_H_
 #define __INIT_H_	1
 
+#include <linux/types.h>
+
 #ifndef __ASSEMBLY__		/* put C only stuff in this section */
 
 /*
@@ -149,6 +151,8 @@ ulong board_init_f_alloc_reserve(ulong top);
  */
 void board_init_f_init_reserve(ulong base);
 
+struct global_data;
+
 /**
  * arch_setup_gd() - Set up the global_data pointer
  * @gd_ptr: Pointer to global data
@@ -160,10 +164,11 @@ void board_init_f_init_reserve(ulong base);
  *
  *    gd = gd_ptr;
  */
-void arch_setup_gd(gd_t *gd_ptr);
+void arch_setup_gd(struct global_data *gd_ptr);
 
 /* common/board_r.c */
-void board_init_r(gd_t *id, ulong dest_addr) __attribute__ ((noreturn));
+void board_init_r(struct global_data *id, ulong dest_addr)
+	__attribute__ ((noreturn));
 
 int cpu_init_r(void);
 int last_stage_init(void);
@@ -181,6 +186,17 @@ int init_func_vid(void);
 int checkboard(void);
 int show_board_info(void);
 
+/**
+ * Get the uppermost pointer that is valid to access
+ *
+ * Some systems may not map all of their address space. This function allows
+ * boards to indicate what their highest support pointer value is for DRAM
+ * access.
+ *
+ * @param total_size	Size of U-Boot (unused?)
+ */
+ulong board_get_usable_ram_top(ulong total_size);
+
 #endif	/* __ASSEMBLY__ */
 /* Put only stuff here that the assembler can digest */
 
diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index 83cbc9154f3..e2d6ea4fb89 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <efi_loader.h>
+#include <init.h>
 #include <malloc.h>
 #include <mapmem.h>
 #include <watchdog.h>
-- 
2.23.0.444.g18eeb5a265-goog



More information about the U-Boot mailing list