ich_descriptors: Pretty print an assumed chipset

Change-Id: Id28cb3abc45c6e7f4c4accfc019579c7448c45d7
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.coreboot.org/20247
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-by: David Hendricks <david.hendricks@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/ich_descriptors.c b/ich_descriptors.c
index a2aa940..a2f8edf 100644
--- a/ich_descriptors.c
+++ b/ich_descriptors.c
@@ -90,6 +90,21 @@
 #define getFISBA(cont)	(((cont)->FLMAP1 >> 12) & 0x00000ff0)
 #define getFMSBA(cont)	(((cont)->FLMAP2 <<  4) & 0x00000ff0)
 
+void prettyprint_ich_chipset(enum ich_chipset cs)
+{
+	static const char *const chipset_names[] = {
+		"Unknown ICH", "ICH8", "ICH9", "ICH10",
+		"5 series Ibex Peak", "6 series Cougar Point", "7 series Panther Point",
+		"8 series Lynx Point", "Baytrail", "8 series Lynx Point LP", "8 series Wellsburg",
+		"9 series Wildcat Point", "9 series Wildcat Point LP", "100 series Sunrise Point",
+	};
+	if (cs < CHIPSET_ICH8 || cs - CHIPSET_ICH8 + 1 >= ARRAY_SIZE(chipset_names))
+		cs = 0;
+	else
+		cs = cs - CHIPSET_ICH8 + 1;
+	msg_pdbg2("Assuming chipset '%s'.\n", chipset_names[cs]);
+}
+
 void prettyprint_ich_descriptors(enum ich_chipset cs, const struct ich_descriptors *desc)
 {
 	prettyprint_ich_descriptor_content(cs, &desc->content);
@@ -881,8 +896,10 @@
 	desc->component.FLILL	= dump[(getFCBA(&desc->content) >> 2) + 1];
 	desc->component.FLPB	= dump[(getFCBA(&desc->content) >> 2) + 2];
 
-	if (*cs == CHIPSET_ICH_UNKNOWN)
+	if (*cs == CHIPSET_ICH_UNKNOWN) {
 		*cs = guess_ich_chipset(&desc->content, &desc->component);
+		prettyprint_ich_chipset(*cs);
+	}
 
 	/* region */
 	const ssize_t nr = ich_number_of_regions(*cs, &desc->content);
diff --git a/ich_descriptors.h b/ich_descriptors.h
index bccea27..8c313d1 100644
--- a/ich_descriptors.h
+++ b/ich_descriptors.h
@@ -567,6 +567,7 @@
 ssize_t ich_number_of_regions(enum ich_chipset cs, const struct ich_desc_content *content);
 ssize_t ich_number_of_masters(enum ich_chipset cs, const struct ich_desc_content *content);
 
+void prettyprint_ich_chipset(enum ich_chipset cs);
 void prettyprint_ich_descriptors(enum ich_chipset cs, const struct ich_descriptors *desc);
 
 void prettyprint_ich_descriptor_content(enum ich_chipset cs, const struct ich_desc_content *content);