util/ifdtool: Add Panther Lake platform support under IFDv2

BUG=b:347669091
TEST=Able to build ifdtool.

Change-Id: Id261898932f11f4c9066453bce18fd889996e171
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/83141
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Reviewed-by: Eric Lai <ericllai@google.com>
diff --git a/util/ifdtool/ifdtool.c b/util/ifdtool/ifdtool.c
index c04d504..1c3e810 100644
--- a/util/ifdtool/ifdtool.c
+++ b/util/ifdtool/ifdtool.c
@@ -271,6 +271,8 @@
 		return CHIPSET_500_600_SERIES_TIGER_ALDER_POINT;
 	case PLATFORM_MTL:
 		return CHIPSET_800_SERIES_METEOR_LAKE;
+	case PLATFORM_PTL:
+		return CHIPSET_900_SERIES_PANTHER_LAKE;
 	case PLATFORM_ICL:
 		return CHIPSET_400_SERIES_ICE_POINT;
 	case PLATFORM_LBG:
@@ -306,6 +308,7 @@
 		PLATFORM_SKLKBL,
 		PLATFORM_IFD2,
 		PLATFORM_MTL,
+		PLATFORM_PTL,
 		PLATFORM_WBG,
 	};
 	unsigned int i;
@@ -562,6 +565,7 @@
 	switch (chipset) {
 	case CHIPSET_500_600_SERIES_TIGER_ALDER_POINT:
 	case CHIPSET_800_SERIES_METEOR_LAKE:
+	case CHIPSET_900_SERIES_PANTHER_LAKE:
 		_decode_spi_frequency_500_series(freq);
 		break;
 	default:
@@ -640,12 +644,17 @@
 
 static void decode_espi_frequency(unsigned int freq)
 {
-	if (chipset == CHIPSET_500_600_SERIES_TIGER_ALDER_POINT)
+	switch (chipset) {
+	case CHIPSET_500_600_SERIES_TIGER_ALDER_POINT:
 		_decode_espi_frequency_500_series(freq);
-	else if (chipset == CHIPSET_800_SERIES_METEOR_LAKE)
+		break;
+	case CHIPSET_800_SERIES_METEOR_LAKE:
+	case CHIPSET_900_SERIES_PANTHER_LAKE:
 		_decode_espi_frequency_800_series(freq);
-	else
+		break;
+	default:
 		_decode_espi_frequency(freq);
+	}
 }
 
 static void decode_component_density(unsigned int density)
@@ -695,7 +704,7 @@
 static int is_platform_with_100x_series_pch(void)
 {
 	if (chipset >= CHIPSET_100_200_SERIES_SUNRISE_POINT &&
-			chipset <= CHIPSET_800_SERIES_METEOR_LAKE)
+			chipset <= CHIPSET_900_SERIES_PANTHER_LAKE)
 		return 1;
 
 	return 0;
@@ -724,6 +733,8 @@
 			freq = (fpsba->pchstrp[22] & 0x38) >> 3;
 		else if (chipset == CHIPSET_800_SERIES_METEOR_LAKE)
 			freq = (fpsba->pchstrp[65] & 0x38) >> 3;
+		else if (chipset == CHIPSET_900_SERIES_PANTHER_LAKE)
+			freq = (fpsba->pchstrp[119] & 0x38) >> 3;
 		else
 			freq = (fcba->flcomp >> 17) & 7;
 		decode_espi_frequency(freq);
@@ -1021,7 +1032,8 @@
 	}
 
 	if (chipset == CHIPSET_500_600_SERIES_TIGER_ALDER_POINT ||
-		 chipset == CHIPSET_800_SERIES_METEOR_LAKE) {
+		 chipset == CHIPSET_800_SERIES_METEOR_LAKE ||
+		 chipset == CHIPSET_900_SERIES_PANTHER_LAKE) {
 		printf("FLMAP3:    0x%08x\n", fdb->flmap3);
 		printf("  Minor Revision ID:     0x%04x\n", (fdb->flmap3 >> 14) & 0x7f);
 		printf("  Major Revision ID:     0x%04x\n", (fdb->flmap3 >> 21) & 0x7ff);
@@ -1379,6 +1391,7 @@
 	case PLATFORM_TGL:
 	case PLATFORM_ADL:
 	case PLATFORM_MTL:
+	case PLATFORM_PTL:
 		return true;
 	default:
 		return false;
@@ -1443,6 +1456,7 @@
 	case PLATFORM_ADL:
 	case PLATFORM_IFD2:
 	case PLATFORM_MTL:
+	case PLATFORM_PTL:
 		/* CPU/BIOS can read descriptor and BIOS. */
 		fmba->flmstr1 |= (1 << REGION_DESC) << rd_shift;
 		fmba->flmstr1 |= (1 << REGION_BIOS) << rd_shift;
@@ -1596,6 +1610,7 @@
 	case PLATFORM_TGL:
 	case PLATFORM_ADL:
 	case PLATFORM_MTL:
+	case PLATFORM_PTL:
 		data_offset = 0x18;
 		break;
 	default:
@@ -1624,6 +1639,9 @@
 	case PLATFORM_MTL:
 		gpr0_offset = 0x40;
 		break;
+	case PLATFORM_PTL:
+		gpr0_offset = 0x76;
+		break;
 	default:
 		break;
 	}
@@ -2470,6 +2488,8 @@
 				platform = PLATFORM_IFD2;
 			} else if (!strcmp(optarg, "mtl")) {
 				platform = PLATFORM_MTL;
+			} else if (!strcmp(optarg, "ptl")) {
+				platform = PLATFORM_PTL;
 			} else if (!strcmp(optarg, "wbg")) {
 				platform = PLATFORM_WBG;
 			} else {
diff --git a/util/ifdtool/ifdtool.h b/util/ifdtool/ifdtool.h
index 79fe0ab..ef37ca7 100644
--- a/util/ifdtool/ifdtool.h
+++ b/util/ifdtool/ifdtool.h
@@ -39,6 +39,7 @@
 	CHIPSET_500_600_SERIES_TIGER_ALDER_POINT, /* 11th-12th gen Core i/o (LP)
 						   * variants onwards */
 	CHIPSET_800_SERIES_METEOR_LAKE, /* 14th gen Core i/o (LP) variants onwards */
+	CHIPSET_900_SERIES_PANTHER_LAKE, /* 16th gen Core i/o (LP) variants onwards */
 	CHIPSET_C620_SERIES_LEWISBURG,
 	CHIPSET_DENVERTON,
 };
@@ -57,6 +58,7 @@
 	PLATFORM_IFD2,
 	PLATFORM_DNV,
 	PLATFORM_MTL,
+	PLATFORM_PTL,
 	PLATFORM_WBG
 };