Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/hdaudio In rev 1.0a of the Intel High Definition Aud...



details:   https://anonhg.NetBSD.org/src/rev/7921af409f15
branches:  trunk
changeset: 826738:7921af409f15
user:      kre <kre%NetBSD.org@localhost>
date:      Tue Sep 26 09:24:22 2017 +0000

description:
In rev 1.0a of the Intel High Definition Audio Spec:

        https://www.intel.com/content/www/us/en/standards/
                high-definition-audio-specification.html

page 186 shows the layout of the baseline block of the ELD (EDID Like Data)
struct - and allows a reserved (effectively padding) area at the end of the
struct.  This is required to keep the struct an even number of words long
(size measured in units of 32 bits) while allowing for a variable length
monitor name, followed by a variable number of 3 byte structs - the
combination of which is not likely to be a multiple of 4.

Code here assumed that there was no padding, and objected to the ELD
format if any padding bytes existed (hdafg_dd_parse_info() would return
EINVAL) causing a "failed to parse ELD data" message (if HDAFG_HDMI_DEBUG
is defined) from hdafg_assoc_dump_dd() making it difficult (or at least
confusing) to debug HDMI related audio issues (hdafg_assoc_dump_dd would
not print most of the data it is expected to print) although this would
most likely have no effect on actual operations.

Change a test from a != to < (there must be enough data, not exactly the
amount needed) for the EINVAL.   As a consequence, the length after the
SAD data is parsed (the 3 byte structs) is no longer required to be 0,
so remove the KASSERT() (previously it was just useless, the code guaranteed
a 0 value, now it is incorrect.)   While here also change a related
diagnostic message to be slightly more informative as to what is being shown.

OK jmcneill@

diffstat:

 sys/dev/hdaudio/hdafg_dd.c |  10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diffs (39 lines):

diff -r 7c7571fb7b64 -r 7921af409f15 sys/dev/hdaudio/hdafg_dd.c
--- a/sys/dev/hdaudio/hdafg_dd.c        Tue Sep 26 08:25:56 2017 +0000
+++ b/sys/dev/hdaudio/hdafg_dd.c        Tue Sep 26 09:24:22 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hdafg_dd.c,v 1.2 2017/08/04 00:25:23 mrg Exp $ */
+/* $NetBSD: hdafg_dd.c,v 1.3 2017/09/26 09:24:22 kre Exp $ */
 
 /*
  * Copyright (c) 2011 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdafg_dd.c,v 1.2 2017/08/04 00:25:23 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdafg_dd.c,v 1.3 2017/09/26 09:24:22 kre Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -92,7 +92,7 @@
        data += ELD_MNL(block);
        datalen -= ELD_MNL(block);
 
-       if (datalen != ELD_SAD_COUNT(block) * sizeof(hdi->sad[0])) {
+       if (datalen < ELD_SAD_COUNT(block) * sizeof(hdi->sad[0])) {
 #ifdef HDAFG_HDMI_DEBUG
                printf(" datalen %u sadcount %u sizeof sad %u\n",
                    (unsigned int)datalen,
@@ -109,10 +109,8 @@
        }
 
 #ifdef HDAFG_HDMI_DEBUG
-       printf("datalen = %u\n", (unsigned int)datalen);
+       printf("hdafg eld padding ignored = %u\n", (unsigned int)datalen);
 #endif
-       KASSERT(datalen == 0);
-
        return 0;
 }
 



Home | Main Index | Thread Index | Old Index