summaryrefslogtreecommitdiff
path: root/util/amdfwtool/amdfwtool.c
diff options
context:
space:
mode:
authorZheng Bao <fishbaozi@gmail.com>2022-08-18 15:54:47 +0800
committerFred Reitberger <reitbergerfred@gmail.com>2023-03-08 12:59:50 +0000
commit84fb9eac96dc15016820eec6fc6de91f4a243205 (patch)
tree1fbbeec663d50f5239bd9b91199791415f471c55 /util/amdfwtool/amdfwtool.c
parent35cdffd6eaefbe60234ee22d7b97f5c1d5945606 (diff)
amdfwtool: combo: Add combo feature for BIOS table
It is similar to PSP combo. Change-Id: If0523a4a0e1f31969e4bbaa6062dcc0f2d6da420 Signed-off-by: Zheng Bao <fishbaozi@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/66856 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com>
Diffstat (limited to 'util/amdfwtool/amdfwtool.c')
-rw-r--r--util/amdfwtool/amdfwtool.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c
index c62ad2b9d4..9b913865cb 100644
--- a/util/amdfwtool/amdfwtool.c
+++ b/util/amdfwtool/amdfwtool.c
@@ -633,6 +633,7 @@ static void fill_dir_header(void *directory, uint32_t count, uint32_t cookie, co
switch (cookie) {
case PSP2_COOKIE:
+ case BHD2_COOKIE:
cdir->header.cookie = cookie;
/* lookup mode is hardcoded for now. */
cdir->header.lookup = 1;
@@ -2159,7 +2160,7 @@ int main(int argc, char **argv)
psp_directory_table *pspdir = NULL;
psp_directory_table *pspdir2 = NULL;
psp_directory_table *pspdir2_b = NULL;
- psp_combo_directory *psp_combo_dir = NULL;
+ psp_combo_directory *psp_combo_dir = NULL, *bhd_combo_dir = NULL;
int fuse_defined = 0;
int targetfd;
char *output = NULL, *config = NULL;
@@ -2590,6 +2591,10 @@ int main(int argc, char **argv)
if (cb_config.use_combo) {
psp_combo_dir = new_combo_dir(&ctx);
+
+ adjust_current_pointer(&ctx, 0, 0x1000U);
+
+ bhd_combo_dir = new_combo_dir(&ctx);
}
if (cb_config.multi_level) {
@@ -2667,7 +2672,17 @@ int main(int argc, char **argv)
integrate_bios_firmwares(&ctx, biosdir, NULL,
amd_bios_table, BHD_COOKIE, &cb_config);
}
- fill_bios_directory_to_efs(amd_romsig, biosdir, &ctx, &cb_config);
+ if (!cb_config.use_combo) {
+ fill_bios_directory_to_efs(amd_romsig, biosdir, &ctx, &cb_config);
+ } else {
+ fill_bios_directory_to_efs(amd_romsig, bhd_combo_dir, &ctx, &cb_config);
+ bhd_combo_dir->entries[0].id_sel = 0;
+ bhd_combo_dir->entries[0].id = get_psp_id(cb_config.soc_id);
+ bhd_combo_dir->entries[0].lvl2_addr =
+ BUFF_TO_RUN_MODE(ctx, biosdir, AMD_ADDR_REL_BIOS);
+
+ fill_dir_header(bhd_combo_dir, 1, BHD2_COOKIE, &ctx);
+ }
}
targetfd = open(output, O_RDWR | O_CREAT | O_TRUNC, 0666);