amdfwtool: Add PSP ID for combo and ISH header for A/B recovery

Nobody calls the function until combo or A/B is added, so suppress the
warning for now.

Test=Majolica (Cezanne)

Change-Id: I3082b850fb3fd2d7ae83a1c4dfd89eb7e1bd0f97
Signed-off-by: Zheng Bao <fishbaozi@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55551
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
diff --git a/util/amdfwtool/Makefile b/util/amdfwtool/Makefile
index 7b77935..1805459 100644
--- a/util/amdfwtool/Makefile
+++ b/util/amdfwtool/Makefile
@@ -5,7 +5,7 @@
 SRC = amdfwtool.c data_parse.c
 OBJ = $(SRC:%.c=%.o)
 TARGET = amdfwtool
-WERROR=-Werror
+WERROR=-Werror -Wno-unused-function
 CFLAGS=-O2 -Wall -Wextra -Wshadow ${WERROR}
 
 all: $(TARGET)
diff --git a/util/amdfwtool/Makefile.inc b/util/amdfwtool/Makefile.inc
index 4b7db76..f772299 100644
--- a/util/amdfwtool/Makefile.inc
+++ b/util/amdfwtool/Makefile.inc
@@ -2,7 +2,7 @@
 
 amdfwtoolobj = amdfwtool.o data_parse.o
 
-AMDFWTOOLCFLAGS=-O2 -Wall -Wextra -Wshadow -Werror
+AMDFWTOOLCFLAGS=-O2 -Wall -Wextra -Wshadow -Werror -Wno-unused-function
 
 $(objutil)/amdfwtool/%.o: $(top)/util/amdfwtool/%.c # $(HEADER)
 	$(HOSTCC) $(AMDFWTOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $<
diff --git a/util/amdfwtool/amdfwtool.c b/util/amdfwtool/amdfwtool.c
index 9ad913e..d088179 100644
--- a/util/amdfwtool/amdfwtool.c
+++ b/util/amdfwtool/amdfwtool.c
@@ -490,6 +490,45 @@
 	return bytes;
 }
 
+enum platform {
+	PLATFORM_UNKNOWN,
+	PLATFORM_STONEYRIDGE,
+	PLATFORM_RAVEN,
+	PLATFORM_PICASSO,
+	PLATFORM_RENOIR,
+	PLATFORM_CEZANNE,
+	PLATFORM_MENDOCINO,
+	PLATFORM_LUCIENNE,
+};
+
+static uint32_t get_psp_id(enum platform soc_id)
+{
+	uint32_t psp_id;
+	switch (soc_id) {
+	case PLATFORM_RAVEN:
+	case PLATFORM_PICASSO:
+		psp_id = 0xBC0A0000;
+		break;
+	case PLATFORM_RENOIR:
+	case PLATFORM_LUCIENNE:
+		psp_id = 0xBC0C0000;
+		break;
+	case PLATFORM_CEZANNE:
+		psp_id = 0xBC0C0140;
+		break;
+	case PLATFORM_MENDOCINO:
+		psp_id = 0xBC0D0900;
+		break;
+	case PLATFORM_STONEYRIDGE:
+		psp_id = 0x10220B00;
+		break;
+	default:
+		psp_id = 0;
+		break;
+	}
+	return psp_id;
+}
+
 static void integrate_firmwares(context *ctx,
 				embedded_firmware *romsig,
 				amd_fw_entry *fw_table)
@@ -1143,17 +1182,6 @@
 	}
 }
 
-enum platform {
-	PLATFORM_UNKNOWN,
-	PLATFORM_STONEYRIDGE,
-	PLATFORM_RAVEN,
-	PLATFORM_PICASSO,
-	PLATFORM_RENOIR,
-	PLATFORM_CEZANNE,
-	PLATFORM_MENDOCINO,
-	PLATFORM_LUCIENNE,
-};
-
 static int set_efs_table(uint8_t soc_id, embedded_firmware *amd_romsig,
 			 uint8_t efs_spi_readmode, uint8_t efs_spi_speed,
 			 uint8_t efs_spi_micron_flag)
@@ -1596,8 +1624,7 @@
 	amd_romsig->combo_psp_directory = BUFF_TO_RUN(ctx, combo_dir);
 	/* 0 -Compare PSP ID, 1 -Compare chip family ID */
 	combo_dir->entries[0].id_sel = 0;
-	/* TODO: PSP ID. Documentation is needed. */
-	combo_dir->entries[0].id = 0x10220B00;
+	combo_dir->entries[0].id = get_psp_id(soc_id);
 	combo_dir->entries[0].lvl2_addr = BUFF_TO_RUN(ctx, pspdir);
 
 	combo_dir->header.lookup = 1;