aboutsummaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorSughosh Ganu2022-04-15 11:29:34 +0530
committerHeinrich Schuchardt2022-04-15 10:43:18 +0200
commit741ef867288bb294039e34ab2287ffe981b05b86 (patch)
tree283cab5cd74fea8b86672de3dc3fdb674117dd17 /board
parent42a2d90cf51acea56bf19006ed5688c93c099ff0 (diff)
capsule: board: Add information needed for capsule updates
Add a structure which defines the information that is needed for executing capsule updates on a platform. Some information in the structure like the dfu string is used for making the update process more robust while some information like the per platform image GUIDs is used for fixing issues. Initialise this structure in the board file, and use the information for the capsule updates. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Diffstat (limited to 'board')
-rw-r--r--board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c29
-rw-r--r--board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c28
-rw-r--r--board/emulation/common/qemu_dfu.c3
-rw-r--r--board/emulation/qemu-arm/qemu-arm.c28
-rw-r--r--board/kontron/pitx_imx8m/pitx_imx8m.c21
-rw-r--r--board/kontron/sl-mx8mm/sl-mx8mm.c20
-rw-r--r--board/kontron/sl28/sl28.c21
-rw-r--r--board/sandbox/sandbox.c34
-rw-r--r--board/socionext/developerbox/developerbox.c33
-rw-r--r--board/xilinx/common/board.c28
-rw-r--r--board/xilinx/zynq/board.c3
-rw-r--r--board/xilinx/zynqmp/zynqmp.c3
12 files changed, 247 insertions, 4 deletions
diff --git a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c
index 16566092bd8..782025dc785 100644
--- a/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c
+++ b/board/advantech/imx8mp_rsb3720a1/imx8mp_rsb3720a1.c
@@ -6,6 +6,8 @@
#include <common.h>
#include <dwc3-uboot.h>
+#include <efi.h>
+#include <efi_loader.h>
#include <errno.h>
#include <miiphy.h>
#include <netdev.h>
@@ -21,6 +23,7 @@
#include <asm/arch/clock.h>
#include <asm/mach-imx/dma.h>
#include <linux/delay.h>
+#include <linux/kernel.h>
#include <power/pmic.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -44,6 +47,32 @@ static void setup_gpmi_nand(void)
}
#endif
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_image fw_images[] = {
+#if defined(CONFIG_TARGET_IMX8MP_RSB3720A1_4G)
+ {
+ .image_type_id = IMX8MP_RSB3720A1_4G_FIT_IMAGE_GUID,
+ .fw_name = u"IMX8MP-RSB3720-FIT",
+ .image_index = 1,
+ },
+#elif defined(CONFIG_TARGET_IMX8MP_RSB3720A1_6G)
+ {
+ .image_type_id = IMX8MP_RSB3720A1_6G_FIT_IMAGE_GUID,
+ .fw_name = u"IMX8MP-RSB3720-FIT",
+ .image_index = 1,
+ },
+#endif
+};
+
+struct efi_capsule_update_info update_info = {
+ .dfu_string = "mmc 2=flash-bin raw 0 0x1B00 mmcpart 1",
+ .images = fw_images,
+};
+
+u8 num_image_type_guids = ARRAY_SIZE(fw_images);
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
+
int board_early_init_f(void)
{
struct wdog_regs *wdog = (struct wdog_regs *)WDOG1_BASE_ADDR;
diff --git a/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c b/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c
index 27200f728ef..e6021a45662 100644
--- a/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c
+++ b/board/compulab/imx8mm-cl-iot-gate/imx8mm-cl-iot-gate.c
@@ -5,6 +5,8 @@
*/
#include <common.h>
+#include <efi.h>
+#include <efi_loader.h>
#include <env.h>
#include <extension_board.h>
#include <hang.h>
@@ -23,11 +25,37 @@
#include <asm/mach-imx/gpio.h>
#include <asm/mach-imx/mxc_i2c.h>
#include <asm/sections.h>
+#include <linux/kernel.h>
#include "ddr/ddr.h"
DECLARE_GLOBAL_DATA_PTR;
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_image fw_images[] = {
+#if defined(CONFIG_TARGET_IMX8MM_CL_IOT_GATE)
+ {
+ .image_type_id = IMX8MM_CL_IOT_GATE_FIT_IMAGE_GUID,
+ .fw_name = u"IMX8MM-CL-IOT-GATE-FIT",
+ .image_index = 1,
+ },
+#elif defined(CONFIG_TARGET_IMX8MM_CL_IOT_GATE_OPTEE)
+ {
+ .image_type_id = IMX8MM_CL_IOT_GATE_OPTEE_FIT_IMAGE_GUID,
+ .fw_name = u"IMX8MM-CL-IOT-GATE-FIT",
+ .image_index = 1,
+ },
+#endif
+};
+
+struct efi_capsule_update_info update_info = {
+ .dfu_string = "mmc 2=flash-bin raw 0x42 0x1D00 mmcpart 1",
+ .images = fw_images,
+};
+
+u8 num_image_type_guids = ARRAY_SIZE(fw_images);
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
int board_phys_sdram_size(phys_size_t *size)
{
struct lpddr4_tcm_desc *lpddr4_tcm_desc =
diff --git a/board/emulation/common/qemu_dfu.c b/board/emulation/common/qemu_dfu.c
index 62234a7647d..c1aeaf10d93 100644
--- a/board/emulation/common/qemu_dfu.c
+++ b/board/emulation/common/qemu_dfu.c
@@ -44,7 +44,8 @@ void set_dfu_alt_info(char *interface, char *devstr)
ALLOC_CACHE_ALIGN_BUFFER(char, buf, DFU_ALT_BUF_LEN);
- if (env_get("dfu_alt_info"))
+ if (!CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT) &&
+ env_get("dfu_alt_info"))
return;
memset(buf, 0, sizeof(buf));
diff --git a/board/emulation/qemu-arm/qemu-arm.c b/board/emulation/qemu-arm/qemu-arm.c
index c9e886e44a5..16237e29e46 100644
--- a/board/emulation/qemu-arm/qemu-arm.c
+++ b/board/emulation/qemu-arm/qemu-arm.c
@@ -6,15 +6,43 @@
#include <common.h>
#include <cpu_func.h>
#include <dm.h>
+#include <efi.h>
+#include <efi_loader.h>
#include <fdtdec.h>
#include <init.h>
#include <log.h>
#include <virtio_types.h>
#include <virtio.h>
+#include <linux/kernel.h>
+
#ifdef CONFIG_ARM64
#include <asm/armv8/mmu.h>
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_image fw_images[] = {
+#if defined(CONFIG_TARGET_QEMU_ARM_32BIT)
+ {
+ .image_type_id = QEMU_ARM_UBOOT_IMAGE_GUID,
+ .fw_name = u"Qemu-Arm-UBOOT",
+ .image_index = 1,
+ },
+#elif defined(CONFIG_TARGET_QEMU_ARM_64BIT)
+ {
+ .image_type_id = QEMU_ARM64_UBOOT_IMAGE_GUID,
+ .fw_name = u"Qemu-Arm-UBOOT",
+ .image_index = 1,
+ },
+#endif
+};
+
+struct efi_capsule_update_info update_info = {
+ .images = fw_images,
+};
+
+u8 num_image_type_guids = ARRAY_SIZE(fw_images);
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
static struct mm_region qemu_arm64_mem_map[] = {
{
/* Flash */
diff --git a/board/kontron/pitx_imx8m/pitx_imx8m.c b/board/kontron/pitx_imx8m/pitx_imx8m.c
index d655fe099b5..d974af8da1a 100644
--- a/board/kontron/pitx_imx8m/pitx_imx8m.c
+++ b/board/kontron/pitx_imx8m/pitx_imx8m.c
@@ -2,6 +2,8 @@
#include "pitx_misc.h"
#include <common.h>
+#include <efi.h>
+#include <efi_loader.h>
#include <init.h>
#include <mmc.h>
#include <miiphy.h>
@@ -12,7 +14,7 @@
#include <asm/mach-imx/gpio.h>
#include <asm/mach-imx/iomux-v3.h>
#include <linux/delay.h>
-
+#include <linux/kernel.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -30,6 +32,23 @@ static iomux_v3_cfg_t const uart_pads[] = {
IMX8MQ_PAD_ECSPI1_MISO__UART3_CTS_B | MUX_PAD_CTRL(UART_PAD_CTRL),
};
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_image fw_images[] = {
+ {
+ .image_type_id = KONTRON_PITX_IMX8M_FIT_IMAGE_GUID,
+ .fw_name = u"KONTRON-PITX-IMX8M-UBOOT",
+ .image_index = 1,
+ },
+};
+
+struct efi_capsule_update_info update_info = {
+ .dfu_string = "mmc 0=flash-bin raw 0x42 0x1000 mmcpart 1",
+ .images = fw_images,
+};
+
+u8 num_image_type_guids = ARRAY_SIZE(fw_images);
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
int board_early_init_f(void)
{
struct wdog_regs *wdog = (struct wdog_regs *)WDOG1_BASE_ADDR;
diff --git a/board/kontron/sl-mx8mm/sl-mx8mm.c b/board/kontron/sl-mx8mm/sl-mx8mm.c
index 48376cb8267..fea93278374 100644
--- a/board/kontron/sl-mx8mm/sl-mx8mm.c
+++ b/board/kontron/sl-mx8mm/sl-mx8mm.c
@@ -6,12 +6,32 @@
#include <asm/arch/imx-regs.h>
#include <asm/global_data.h>
#include <asm/io.h>
+#include <efi.h>
+#include <efi_loader.h>
#include <fdt_support.h>
#include <linux/errno.h>
+#include <linux/kernel.h>
#include <net.h>
DECLARE_GLOBAL_DATA_PTR;
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_image fw_images[] = {
+ {
+ .image_type_id = KONTRON_SL_MX8MM_FIT_IMAGE_GUID,
+ .fw_name = u"KONTROL-SL-MX8MM-UBOOT",
+ .image_index = 1,
+ },
+};
+
+struct efi_capsule_update_info update_info = {
+ .dfu_string = "sf 0:0=flash-bin raw 0x400 0x1f0000",
+ .images = fw_images,
+};
+
+u8 num_image_type_guids = ARRAY_SIZE(fw_images);
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
int board_phys_sdram_size(phys_size_t *size)
{
u32 ddr_size = readl(M4_BOOTROM_BASE_ADDR);
diff --git a/board/kontron/sl28/sl28.c b/board/kontron/sl28/sl28.c
index 17bb4577363..32e9694b77c 100644
--- a/board/kontron/sl28/sl28.c
+++ b/board/kontron/sl28/sl28.c
@@ -3,11 +3,14 @@
#include <common.h>
#include <dm.h>
#include <malloc.h>
+#include <efi.h>
+#include <efi_loader.h>
#include <errno.h>
#include <fsl_ddr.h>
#include <fdt_support.h>
#include <asm/global_data.h>
#include <linux/libfdt.h>
+#include <linux/kernel.h>
#include <env_internal.h>
#include <asm/arch-fsl-layerscape/soc.h>
#include <asm/arch-fsl-layerscape/fsl_icid.h>
@@ -23,6 +26,24 @@
DECLARE_GLOBAL_DATA_PTR;
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_image fw_images[] = {
+ {
+ .image_type_id = KONTRON_SL28_FIT_IMAGE_GUID,
+ .fw_name = u"KONTRON-SL28-FIT",
+ .image_index = 1,
+ },
+};
+
+struct efi_capsule_update_info update_info = {
+ .dfu_string = "sf 0:0=u-boot-bin raw 0x210000 0x1d0000;"
+ "u-boot-env raw 0x3e0000 0x20000",
+ .images = fw_images,
+};
+
+u8 num_image_type_guids = ARRAY_SIZE(fw_images);
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
int board_early_init_f(void)
{
fsl_lsch3_early_init_f();
diff --git a/board/sandbox/sandbox.c b/board/sandbox/sandbox.c
index 5d9a945d64c..28ad6efd136 100644
--- a/board/sandbox/sandbox.c
+++ b/board/sandbox/sandbox.c
@@ -7,6 +7,8 @@
#include <cpu_func.h>
#include <cros_ec.h>
#include <dm.h>
+#include <efi.h>
+#include <efi_loader.h>
#include <env_internal.h>
#include <init.h>
#include <led.h>
@@ -14,6 +16,7 @@
#include <asm/global_data.h>
#include <asm/test.h>
#include <asm/u-boot-sandbox.h>
+#include <linux/kernel.h>
#include <malloc.h>
#include <extension_board.h>
@@ -25,6 +28,37 @@
*/
gd_t *gd;
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_image fw_images[] = {
+#if defined(CONFIG_EFI_CAPSULE_FIRMWARE_RAW)
+ {
+ .image_type_id = SANDBOX_UBOOT_IMAGE_GUID,
+ .fw_name = u"SANDBOX-UBOOT",
+ .image_index = 1,
+ },
+ {
+ .image_type_id = SANDBOX_UBOOT_ENV_IMAGE_GUID,
+ .fw_name = u"SANDBOX-UBOOT-ENV",
+ .image_index = 2,
+ },
+#elif defined(CONFIG_EFI_CAPSULE_FIRMWARE_FIT)
+ {
+ .image_type_id = SANDBOX_FIT_IMAGE_GUID,
+ .fw_name = u"SANDBOX-FIT",
+ .image_index = 1,
+ },
+#endif
+};
+
+struct efi_capsule_update_info update_info = {
+ .dfu_string = "sf 0:0=u-boot-bin raw 0x100000 0x50000;"
+ "u-boot-env raw 0x150000 0x200000",
+ .images = fw_images,
+};
+
+u8 num_image_type_guids = ARRAY_SIZE(fw_images);
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
/*
* Add a simple GPIO device (don't use with of-platdata as it interferes with
diff --git a/board/socionext/developerbox/developerbox.c b/board/socionext/developerbox/developerbox.c
index 9552bfcdc3b..f5a5fe01210 100644
--- a/board/socionext/developerbox/developerbox.c
+++ b/board/socionext/developerbox/developerbox.c
@@ -10,10 +10,43 @@
#include <asm/global_data.h>
#include <asm/io.h>
#include <common.h>
+#include <efi.h>
+#include <efi_loader.h>
#include <env_internal.h>
#include <fdt_support.h>
#include <log.h>
+#include <linux/kernel.h>
+
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_image fw_images[] = {
+ {
+ .image_type_id = DEVELOPERBOX_UBOOT_IMAGE_GUID,
+ .fw_name = u"DEVELOPERBOX-UBOOT",
+ .image_index = 1,
+ },
+ {
+ .image_type_id = DEVELOPERBOX_FIP_IMAGE_GUID,
+ .fw_name = u"DEVELOPERBOX-FIP",
+ .image_index = 2,
+ },
+ {
+ .image_type_id = DEVELOPERBOX_OPTEE_IMAGE_GUID,
+ .fw_name = u"DEVELOPERBOX-OPTEE",
+ .image_index = 3,
+ },
+};
+
+struct efi_capsule_update_info update_info = {
+ .dfu_string = "mtd nor1=u-boot.bin raw 200000 100000;"
+ "fip.bin raw 180000 78000;"
+ "optee.bin raw 500000 100000",
+ .images = fw_images,
+};
+
+u8 num_image_type_guids = ARRAY_SIZE(fw_images);
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
static struct mm_region sc2a11_mem_map[] = {
{
.virt = 0x0UL,
diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
index 0769189dcf2..5be3090c318 100644
--- a/board/xilinx/common/board.c
+++ b/board/xilinx/common/board.c
@@ -5,6 +5,8 @@
*/
#include <common.h>
+#include <efi.h>
+#include <efi_loader.h>
#include <env.h>
#include <log.h>
#include <asm/global_data.h>
@@ -20,9 +22,35 @@
#include <generated/dt.h>
#include <soc.h>
#include <linux/ctype.h>
+#include <linux/kernel.h>
#include "fru.h"
+#if CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT)
+struct efi_fw_image fw_images[] = {
+#if defined(XILINX_BOOT_IMAGE_GUID)
+ {
+ .image_type_id = XILINX_BOOT_IMAGE_GUID,
+ .fw_name = u"XILINX-BOOT",
+ .image_index = 1,
+ },
+#endif
+#if defined(XILINX_UBOOT_IMAGE_GUID)
+ {
+ .image_type_id = XILINX_UBOOT_IMAGE_GUID,
+ .fw_name = u"XILINX-UBOOT",
+ .image_index = 2,
+ },
+#endif
+};
+
+struct efi_capsule_update_info update_info = {
+ .images = fw_images,
+};
+
+u8 num_image_type_guids = ARRAY_SIZE(fw_images);
+#endif /* EFI_HAVE_CAPSULE_SUPPORT */
+
#if defined(CONFIG_ZYNQ_GEM_I2C_MAC_OFFSET)
int zynq_board_read_rom_ethaddr(unsigned char *ethaddr)
{
diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c
index 26ef0488358..63aff0474be 100644
--- a/board/xilinx/zynq/board.c
+++ b/board/xilinx/zynq/board.c
@@ -168,7 +168,8 @@ void set_dfu_alt_info(char *interface, char *devstr)
{
ALLOC_CACHE_ALIGN_BUFFER(char, buf, DFU_ALT_BUF_LEN);
- if (env_get("dfu_alt_info"))
+ if (!CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT) &&
+ env_get("dfu_alt_info"))
return;
memset(buf, 0, sizeof(buf));
diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index e7e8e91d2cf..41ecc9559c4 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -889,7 +889,8 @@ void set_dfu_alt_info(char *interface, char *devstr)
ALLOC_CACHE_ALIGN_BUFFER(char, buf, DFU_ALT_BUF_LEN);
- if (env_get("dfu_alt_info"))
+ if (!CONFIG_IS_ENABLED(EFI_HAVE_CAPSULE_SUPPORT) &&
+ env_get("dfu_alt_info"))
return;
memset(buf, 0, sizeof(buf));