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 <hungte@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/193011
This commit is contained in:
Hung-Te Lin 2014-04-03 18:35:58 +08:00 committed by chrome-internal-fetch
commit fdf0cc2e95

View file

@ -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--) {