ich_descriptors: Revise descriptor messages

Correct "firmware descriptor" to "flash descriptor". And also
move the check for peculiar descriptors and the message into an
inline function.

Change-Id: I7f15780e03d2fa17ca6d8328275cae5af13ae424
Signed-off-by: Nico Huber <nico.h@gmx.de>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/55644
Original-Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Original-Reviewed-by: Michał Żygowski <michal.zygowski@3mdeb.com>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/71384
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/ich_descriptors.c b/ich_descriptors.c
index a1fed0f..2446f9f 100644
--- a/ich_descriptors.c
+++ b/ich_descriptors.c
@@ -907,6 +907,13 @@
 	msg_pdbg2("\n");
 }
 
+static inline void warn_peculiar_desc(const bool warn_if, const char *const name)
+{
+	if (!warn_if)
+		return;
+	msg_pwarn("Peculiar flash descriptor, assuming %s compatibility.\n", name);
+}
+
 /*
  * Guesses a minimum chipset version based on the maximum number of
  * soft straps per generation.
@@ -925,11 +932,10 @@
 		else if (content->FLMAP2 == 0) {
 			if (content->ISL == 23)
 				return CHIPSET_GEMINI_LAKE;
-			else if (content->ISL != 19)
-				msg_pwarn("Peculiar firmware descriptor, assuming Apollo Lake compatibility.\n");
+			warn_peculiar_desc(content->ISL != 19, "Apollo Lake");
 			return CHIPSET_APOLLO_LAKE;
 		}
-		msg_pwarn("Peculiar firmware descriptor, assuming Ibex Peak compatibility.\n");
+		warn_peculiar_desc(true, "Ibex Peak");
 		return CHIPSET_5_SERIES_IBEX_PEAK;
 	} else if (content->ICCRIBA < 0x31 && content->FMSBA < 0x30) {
 		if (content->MSL == 0 && content->ISL <= 17)
@@ -938,7 +944,7 @@
 			return CHIPSET_6_SERIES_COUGAR_POINT;
 		else if (content->MSL <= 1 && content->ISL <= 21)
 			return CHIPSET_8_SERIES_LYNX_POINT;
-		msg_pwarn("Peculiar firmware descriptor, assuming Wildcat Point compatibility.\n");
+		warn_peculiar_desc(true, "Wildcat Point");
 		return CHIPSET_9_SERIES_WILDCAT_POINT;
 	} else if (content->ICCRIBA < 0x34) {
 		if (content->NM == 6)
@@ -951,7 +957,7 @@
 		else
 			return CHIPSET_300_SERIES_CANNON_POINT;
 	} else {
-		msg_pwarn("Unknown firmware descriptor, assuming 300 series compatibility.\n");
+		msg_pwarn("Unknown flash descriptor, assuming 300 series compatibility.\n");
 		return CHIPSET_300_SERIES_CANNON_POINT;
 	}
 }
@@ -976,7 +982,7 @@
 	case CHIPSET_C620_SERIES_LEWISBURG:
 	case CHIPSET_APOLLO_LAKE:
 		if (component->modes.freq_read != 6) {
-			msg_pwarn("\nThe firmware descriptor looks like a Skylake/Sunrise Point descriptor.\n"
+			msg_pwarn("\nThe flash descriptor looks like a Skylake/Sunrise Point descriptor.\n"
 				  "However, the read frequency isn't set to 17MHz (the only valid value).\n"
 				  "Please report this message, the output of `ich_descriptors_tool` for\n"
 				  "your descriptor and the output of `lspci -nn` to flashrom@flashrom.org\n\n");
@@ -985,7 +991,7 @@
 		return guess;
 	default:
 		if (component->modes.freq_read == 6) {
-			msg_pwarn("\nThe firmware descriptor has the read frequency set to 17MHz. However,\n"
+			msg_pwarn("\nThe flash descriptor has the read frequency set to 17MHz. However,\n"
 				  "it doesn't look like a Skylake/Sunrise Point compatible descriptor.\n"
 				  "Please report this message, the output of `ich_descriptors_tool` for\n"
 				  "your descriptor and the output of `lspci -nn` to flashrom@flashrom.org\n\n");