From fdf0cc2e9573c19b550fa2b5e4e06337b114f864 Mon Sep 17 00:00:00 2001 From: Hung-Te Lin Date: Thu, 3 Apr 2014 18:35:58 +0800 Subject: [PATCH] edid: Fix extension parsing when EDID blob does not have any extensions. When parsing "extensions", we should skip the first EDID (main) block and start from offset 128 (EDID may have only main block, so an EDID without any extension is fine) because the header format for main block and extensions are different. Without this we will see "Unknown extension block" on all EDIDs, and seeing a error (1) return value for EDIDs without extension. Also, after the first "unknown" error is fixed, we can now collect all return values from parse_extension, and give error when any of the extensions are wrong (not just last one). BRANCH=none BUG=chrome-os-partner:25933 TEST=emerge-nyan coreboot chromeos-bootimage Manually boot on Nyan and no "Unknown extension block" anymore. Also tried EDID from following devices: Link, Peppy. Display panel initialization is still functional. Change-Id: I0ee029ac8ec6800687cd7749e23989399e721109 Signed-off-by: Hung-Te Lin Reviewed-on: https://chromium-review.googlesource.com/193011 --- src/lib/edid.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lib/edid.c b/src/lib/edid.c index c1df71a471..b56900b7f3 100644 --- a/src/lib/edid.c +++ b/src/lib/edid.c @@ -1261,8 +1261,14 @@ int decode_edid(unsigned char *edid, int size, struct edid *out) printk(BIOS_SPEW, "Checksum\n"); vbe_valid = do_checksum(edid); - for(i = 0; i < size; i += 128) - nonconformant_extension = parse_extension(out, &edid[i]); + + /* EDID v2.0 has a larger blob (256 bytes) and may have some problem in + * the extension parsing loop below. Since v2.0 was quickly deprecated + * by v1.3 and we are unlikely to use any EDID 2.0 panels, we ignore + * that case now and can fix it when we need to use a real 2.0 panel. + */ + for(i = 128; i < size; i += 128) + nonconformant_extension += parse_extension(out, &edid[i]); /* * x = edid; * for (edid_lines /= 8; edid_lines > 1; edid_lines--) {