Arthur Heymans has uploaded a new change for review. ( https://review.coreboot.org/19502 )
Change subject: lib/edid.c: Return value differentiates absent and non-conformant ......................................................................
lib/edid.c: Return value differentiates absent and non-conformant
Change-Id: Id90aa210ff72092c4ab638a7bafb82bd11889bdc Signed-off-by: Arthur Heymans arthur@aheymans.xyz --- M src/include/edid.h M src/lib/edid.c 2 files changed, 17 insertions(+), 8 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/02/19502/1
diff --git a/src/include/edid.h b/src/include/edid.h index cf81258..100dbe9 100644 --- a/src/include/edid.h +++ b/src/include/edid.h @@ -91,6 +91,12 @@ int hdmi_monitor_detected; };
+enum edid_status { + EDID_CONFORMANT, + EDID_NOT_CONFORMANT, + EDID_ABSENT, +}; + /* Defined in src/lib/edid.c */ int decode_edid(unsigned char *edid, int size, struct edid *out); void edid_set_framebuffer_bits_per_pixel(struct edid *edid, int fb_bpp, diff --git a/src/lib/edid.c b/src/lib/edid.c index 58dd813..9de3a24 100644 --- a/src/lib/edid.c +++ b/src/lib/edid.c @@ -1134,7 +1134,7 @@ .has_valid_range_descriptor = 1, .has_valid_max_dotclock = 1, .has_valid_string_termination = 1, - .conformant = 1, + .conformant = EDID_CONFORMANT, };
dump_breakdown(edid); @@ -1143,7 +1143,7 @@
if (!edid || memcmp(edid, "\x00\xFF\xFF\xFF\xFF\xFF\xFF\x00", 8)) { printk(BIOS_SPEW, "No header found\n"); - return 1; + return EDID_ABSENT; }
if (manufacturer_name(edid + 0x08)) @@ -1486,7 +1486,7 @@ !c.has_valid_string_termination || !c.has_valid_descriptor_pad || !c.has_preferred_timing) - c.conformant = 0; + c.conformant = EDID_NOT_CONFORMANT; if (!c.conformant) printk(BIOS_ERR, "EDID block does NOT conform to EDID 1.4!\n"); @@ -1507,7 +1507,7 @@ !c.has_valid_string_termination || !c.has_valid_descriptor_pad || !c.has_preferred_timing) { - c.conformant = 0; + c.conformant = EDID_NOT_CONFORMANT; } /** * According to E-EDID (EDIDv1.3), has_name_descriptor and @@ -1543,7 +1543,7 @@ } else if (c.claims_one_point_two) { if (c.nonconformant_digital_display || !c.has_valid_string_termination) - c.conformant = 0; + c.conformant = EDID_NOT_CONFORMANT; if (!c.conformant) printk(BIOS_ERR, "EDID block does NOT conform to EDID 1.2!\n"); @@ -1556,7 +1556,7 @@ "\tDetailed block string not properly terminated\n"); } else if (c.claims_one_point_oh) { if (c.seen_non_detailed_descriptor) - c.conformant = 0; + c.conformant = EDID_NOT_CONFORMANT; if (!c.conformant) printk(BIOS_ERR, "EDID block does NOT conform to EDID 1.0!\n"); @@ -1576,7 +1576,7 @@ !c.has_valid_descriptor_ordering || !c.has_valid_range_descriptor || !c.manufacturer_name_well_formed) { - c.conformant = 0; + c.conformant = EDID_CONFORMANT; printk(BIOS_ERR, "EDID block does not conform at all!\n"); if (c.nonconformant_extension) printk(BIOS_ERR, @@ -1618,7 +1618,10 @@ if (c.warning_zero_preferred_refresh) printk(BIOS_ERR, "Warning: CVT block does not set preferred refresh rate\n"); - return !c.conformant; + if (!c.conformant) + return EDID_NOT_CONFORMANT; + else + return EDID_CONFORMANT; }
/*