aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/tools_share/firmware_image_package.h6
-rw-r--r--tools/fiptool/Makefile20
-rw-r--r--tools/fiptool/fiptool.c36
-rw-r--r--tools/fiptool/tbbr_config.h4
-rw-r--r--tools/nxp/plat_fiptool/plat_def_uuid_config.c90
-rw-r--r--tools/nxp/plat_fiptool/plat_fiptool.mk33
6 files changed, 185 insertions, 4 deletions
diff --git a/include/tools_share/firmware_image_package.h b/include/tools_share/firmware_image_package.h
index bcde04fd11..dc65cc6263 100644
--- a/include/tools_share/firmware_image_package.h
+++ b/include/tools_share/firmware_image_package.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2020, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2014-2021, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -82,6 +82,10 @@
#define UUID_FW_CONFIG \
{{0x58, 0x07, 0xe1, 0x6a}, {0x84, 0x59}, {0x47, 0xbe}, 0x8e, 0xd5, {0x64, 0x8e, 0x8d, 0xdd, 0xab, 0x0e} }
+#ifdef PLAT_DEF_FIP_UUID
+#include <plat_def_fip_uuid.h>
+#endif
+
typedef struct fip_toc_header {
uint32_t name;
uint32_t serial_number;
diff --git a/tools/fiptool/Makefile b/tools/fiptool/Makefile
index df8ab5c7be..b75907de06 100644
--- a/tools/fiptool/Makefile
+++ b/tools/fiptool/Makefile
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2014-2020, ARM Limited and Contributors. All rights reserved.
+# Copyright (c) 2014-2021, ARM Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -32,9 +32,23 @@ INCLUDE_PATHS := -I../../include/tools_share
HOSTCC ?= gcc
+ifneq (${PLAT},)
+TF_PLATFORM_ROOT := ../../plat/
+include ${MAKE_HELPERS_DIRECTORY}plat_helpers.mk
+PLAT_FIPTOOL_HELPER_MK := ${PLAT_DIR}/plat_fiptool.mk
+endif
+
+ifneq (,$(wildcard ${PLAT_FIPTOOL_HELPER_MK}))
+include ${PLAT_FIPTOOL_HELPER_MK}
+endif
+
.PHONY: all clean distclean
-all: ${PROJECT}
+# Clean before build as old fiptool might be created with
+# including different PLAT_FIPTOOL_HELPER_MK.
+all:
+ ${MAKE} clean
+ ${MAKE} ${PROJECT}
${PROJECT}: ${OBJECTS} Makefile
@echo " HOSTLD $@"
@@ -43,7 +57,7 @@ ${PROJECT}: ${OBJECTS} Makefile
@echo "Built $@ successfully"
@${ECHO_BLANK_LINE}
-%.o: %.c %.h Makefile
+%.o: %.c Makefile
@echo " HOSTCC $<"
${Q}${HOSTCC} -c ${CPPFLAGS} ${HOSTCCFLAGS} ${INCLUDE_PATHS} $< -o $@
diff --git a/tools/fiptool/fiptool.c b/tools/fiptool/fiptool.c
index 8c5b04a554..d92c31d7f5 100644
--- a/tools/fiptool/fiptool.c
+++ b/tools/fiptool/fiptool.c
@@ -215,6 +215,18 @@ static void fill_image_descs(void)
toc_entry->cmdline_name);
add_image_desc(desc);
}
+#ifdef PLAT_DEF_FIP_UUID
+ for (toc_entry = plat_def_toc_entries;
+ toc_entry->cmdline_name != NULL;
+ toc_entry++) {
+ image_desc_t *desc;
+
+ desc = new_image_desc(&toc_entry->uuid,
+ toc_entry->name,
+ toc_entry->cmdline_name);
+ add_image_desc(desc);
+ }
+#endif
}
static image_desc_t *lookup_image_desc_from_uuid(const uuid_t *uuid)
@@ -753,6 +765,12 @@ static void create_usage(int exit_status)
for (; toc_entry->cmdline_name != NULL; toc_entry++)
printf(" --%-16s FILENAME\t%s\n", toc_entry->cmdline_name,
toc_entry->name);
+#ifdef PLAT_DEF_FIP_UUID
+ toc_entry = plat_def_toc_entries;
+ for (; toc_entry->cmdline_name != NULL; toc_entry++)
+ printf(" --%-16s FILENAME\t%s\n", toc_entry->cmdline_name,
+ toc_entry->name);
+#endif
exit(exit_status);
}
@@ -867,6 +885,12 @@ static void update_usage(int exit_status)
for (; toc_entry->cmdline_name != NULL; toc_entry++)
printf(" --%-16s FILENAME\t%s\n", toc_entry->cmdline_name,
toc_entry->name);
+#ifdef PLAT_DEF_FIP_UUID
+ toc_entry = plat_def_toc_entries;
+ for (; toc_entry->cmdline_name != NULL; toc_entry++)
+ printf(" --%-16s FILENAME\t%s\n", toc_entry->cmdline_name,
+ toc_entry->name);
+#endif
exit(exit_status);
}
@@ -1001,6 +1025,12 @@ static void unpack_usage(int exit_status)
for (; toc_entry->cmdline_name != NULL; toc_entry++)
printf(" --%-16s FILENAME\t%s\n", toc_entry->cmdline_name,
toc_entry->name);
+#ifdef PLAT_DEF_FIP_UUID
+ toc_entry = plat_def_toc_entries;
+ for (; toc_entry->cmdline_name != NULL; toc_entry++)
+ printf(" --%-16s FILENAME\t%s\n", toc_entry->cmdline_name,
+ toc_entry->name);
+#endif
printf("\n");
printf("If no options are provided, all images will be unpacked.\n");
exit(exit_status);
@@ -1126,6 +1156,12 @@ static void remove_usage(int exit_status)
for (; toc_entry->cmdline_name != NULL; toc_entry++)
printf(" --%-16s\t%s\n", toc_entry->cmdline_name,
toc_entry->name);
+#ifdef PLAT_DEF_FIP_UUID
+ toc_entry = plat_def_toc_entries;
+ for (; toc_entry->cmdline_name != NULL; toc_entry++)
+ printf(" --%-16s\t%s\n", toc_entry->cmdline_name,
+ toc_entry->name);
+#endif
exit(exit_status);
}
diff --git a/tools/fiptool/tbbr_config.h b/tools/fiptool/tbbr_config.h
index 1fc6cad49d..b926ff0a3c 100644
--- a/tools/fiptool/tbbr_config.h
+++ b/tools/fiptool/tbbr_config.h
@@ -21,4 +21,8 @@ typedef struct toc_entry {
extern toc_entry_t toc_entries[];
+#ifdef PLAT_DEF_FIP_UUID
+extern toc_entry_t plat_def_toc_entries[];
+#endif
+
#endif /* TBBR_CONFIG_H */
diff --git a/tools/nxp/plat_fiptool/plat_def_uuid_config.c b/tools/nxp/plat_fiptool/plat_def_uuid_config.c
new file mode 100644
index 0000000000..fdb4b938e1
--- /dev/null
+++ b/tools/nxp/plat_fiptool/plat_def_uuid_config.c
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2021 NXP
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <stddef.h>
+
+#include <firmware_image_package.h>
+
+#include "tbbr_config.h"
+
+toc_entry_t plat_def_toc_entries[] = {
+ /* DDR PHY firmwares */
+ {
+ .name = "DDR UDIMM PHY IMEM 1d FW",
+ .uuid = UUID_DDR_IMEM_UDIMM_1D,
+ .cmdline_name = "ddr-immem-udimm-1d"
+ },
+ {
+ .name = "DDR UDIMM PHY IMEM 2d FW",
+ .uuid = UUID_DDR_IMEM_UDIMM_2D,
+ .cmdline_name = "ddr-immem-udimm-2d"
+ },
+ {
+ .name = "DDR UDIMM PHY DMEM 1d FW",
+ .uuid = UUID_DDR_DMEM_UDIMM_1D,
+ .cmdline_name = "ddr-dmmem-udimm-1d"
+ },
+ {
+ .name = "DDR UDIMM PHY DMEM 2d FW",
+ .uuid = UUID_DDR_DMEM_UDIMM_2D,
+ .cmdline_name = "ddr-dmmem-udimm-2d"
+ },
+ {
+ .name = "DDR RDIMM PHY IMEM 1d FW",
+ .uuid = UUID_DDR_IMEM_RDIMM_1D,
+ .cmdline_name = "ddr-immem-rdimm-1d"
+ },
+ {
+ .name = "DDR RDIMM PHY IMEM 2d FW",
+ .uuid = UUID_DDR_IMEM_RDIMM_2D,
+ .cmdline_name = "ddr-immem-rdimm-2d"
+ },
+ {
+ .name = "DDR RDIMM PHY DMEM 1d FW",
+ .uuid = UUID_DDR_DMEM_RDIMM_1D,
+ .cmdline_name = "ddr-dmmem-rdimm-1d"
+ },
+ {
+ .name = "DDR RDIMM PHY DMEM 2d FW",
+ .uuid = UUID_DDR_DMEM_RDIMM_2D,
+ .cmdline_name = "ddr-dmmem-rdimm-2d"
+ },
+ {
+ .name = "FUSE PROV FW",
+ .uuid = UUID_FUSE_PROV,
+ .cmdline_name = "fuse-prov"
+ },
+ {
+ .name = "FUSE UPGRADE FW",
+ .uuid = UUID_FUSE_UP,
+ .cmdline_name = "fuse-upgrade"
+ },
+
+ /* Key Certificates */
+ {
+ .name = "DDR Firmware key certificate",
+ .uuid = UUID_DDR_FW_KEY_CERT,
+ .cmdline_name = "ddr-fw-key-cert"
+ },
+
+ /* Content certificates */
+ {
+ .name = "DDR UDIMM Firmware content certificate",
+ .uuid = UUID_DDR_UDIMM_FW_CONTENT_CERT,
+ .cmdline_name = "ddr-udimm-fw-cert"
+ },
+ {
+ .name = "DDR RDIMM Firmware content certificate",
+ .uuid = UUID_DDR_RDIMM_FW_CONTENT_CERT,
+ .cmdline_name = "ddr-rdimm-fw-cert"
+ },
+
+ {
+ .name = NULL,
+ .uuid = { {0} },
+ .cmdline_name = NULL,
+ }
+};
diff --git a/tools/nxp/plat_fiptool/plat_fiptool.mk b/tools/nxp/plat_fiptool/plat_fiptool.mk
new file mode 100644
index 0000000000..ca2962a045
--- /dev/null
+++ b/tools/nxp/plat_fiptool/plat_fiptool.mk
@@ -0,0 +1,33 @@
+#
+# Copyright (c) 2021, NXP. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+# Name of the platform defined source file name,
+# which contains platform defined UUID entries populated
+# in the plat_def_toc_entries[].
+PLAT_DEF_UUID_CONFIG_FILE_NAME := plat_def_uuid_config
+
+PLAT_DEF_UUID_CONFIG_FILE_PATH := ../nxp/plat_fiptool
+
+PLAT_DEF_OID := yes
+PLAT_DEF_UUID := yes
+PLAT_DEF_UUID_OID_CONFIG_PATH := ../../plat/nxp/common/fip_handler/common
+
+
+INCLUDE_PATHS += -I${PLAT_DEF_UUID_OID_CONFIG_PATH} \
+ -I./
+# Clean the stale object file.
+$(shell rm ${PLAT_DEF_UUID_CONFIG_FILE_PATH}/${PLAT_DEF_UUID_CONFIG_FILE_NAME}.o)
+
+ifeq (${PLAT_DEF_OID},yes)
+HOSTCCFLAGS += -DPLAT_DEF_OID
+endif
+
+ifeq (${PLAT_DEF_UUID},yes)
+HOSTCCFLAGS += -DPLAT_DEF_FIP_UUID
+PLAT_OBJECTS += ${PLAT_DEF_UUID_CONFIG_FILE_PATH}/${PLAT_DEF_UUID_CONFIG_FILE_NAME}.o
+endif
+
+OBJECTS += ${PLAT_OBJECTS}