lib: edid: Move manufacturer name from private extra to public info

When debugging usually we want to print out a full identifier for panel,
that should be manufacturer and part number. Previously the edid only
contains ascii_string (which is usually the part number) but we should
export manufacturer name as well.

Change-Id: I0020fdd5b9f9331b25825876e0de4dc7e26b0464
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/34852
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
diff --git a/src/include/edid.h b/src/include/edid.h
index e5f7d98..a97b99b 100644
--- a/src/include/edid.h
+++ b/src/include/edid.h
@@ -95,6 +95,7 @@
 
 	int hdmi_monitor_detected;
 	char ascii_string[EDID_ASCII_STRING_LENGTH + 1];
+	char manufacturer_name[3 + 1];
 };
 
 enum edid_status {
diff --git a/src/lib/edid.c b/src/lib/edid.c
index 3b81b5c..964dce2 100644
--- a/src/lib/edid.c
+++ b/src/lib/edid.c
@@ -72,7 +72,6 @@
 /* Stuff that isn't used anywhere but is nice to pretty-print while
    we're decoding everything else. */
 static struct {
-	char manuf_name[4];
 	unsigned int model;
 	unsigned int serial;
 	unsigned int year;
@@ -94,20 +93,20 @@
 
 static struct edid tmp_edid;
 
-static char *manufacturer_name(unsigned char *x)
+static int manufacturer_name(unsigned char *x, char *output)
 {
-	extra_info.manuf_name[0] = ((x[0] & 0x7C) >> 2) + '@';
-	extra_info.manuf_name[1] = ((x[0] & 0x03) << 3) + ((x[1] & 0xE0) >> 5)
-		+ '@';
-	extra_info.manuf_name[2] = (x[1] & 0x1F) + '@';
-	extra_info.manuf_name[3] = 0;
+	output[0] = ((x[0] & 0x7C) >> 2) + '@';
+	output[1] = ((x[0] & 0x03) << 3) + ((x[1] & 0xE0) >> 5) + '@';
+	output[2] = (x[1] & 0x1F) + '@';
+	output[3] = 0;
 
-	if (isupper(extra_info.manuf_name[0]) &&
-	    isupper(extra_info.manuf_name[1]) &&
-	    isupper(extra_info.manuf_name[2]))
-		return extra_info.manuf_name;
+	if (isupper(output[0]) &&
+	    isupper(output[1]) &&
+	    isupper(output[2]))
+		return 1;
 
-	return NULL;
+	memset(output, 0, 4);
+	return 0;
 }
 
 static int
@@ -1154,7 +1153,7 @@
 		return EDID_ABSENT;
 	}
 
-	if (manufacturer_name(edid + 0x08))
+	if (manufacturer_name(edid + 0x08, out->manufacturer_name))
 		c.manufacturer_name_well_formed = 1;
 
 	extra_info.model = (unsigned short)(edid[0x0A] + (edid[0x0B] << 8));
@@ -1162,7 +1161,7 @@
 				     + (edid[0x0E] << 16) + (edid[0x0F] << 24));
 
 	printk(BIOS_SPEW, "Manufacturer: %s Model %x Serial Number %u\n",
-	       extra_info.manuf_name,
+	       out->manufacturer_name,
 	       (unsigned short)(edid[0x0A] + (edid[0x0B] << 8)),
 	       (unsigned int)(edid[0x0C] + (edid[0x0D] << 8)
 			      + (edid[0x0E] << 16) + (edid[0x0F] << 24)));