Source-Changes-HG archive

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

[src/netbsd-7]: src/sys/dev/pci/hdaudio Pull up following revision(s) (reques...



details:   https://anonhg.NetBSD.org/src/rev/e9f40d1be48a
branches:  netbsd-7
changeset: 799585:e9f40d1be48a
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Sep 04 15:07:08 2015 +0000

description:
Pull up following revision(s) (requested by tsutsui in ticket #963):
        sys/dev/pci/hdaudio/hdafg.c: revision 1.26
        sys/dev/pci/hdaudio/hdaudiovar.h: revision 1.10
        sys/dev/pci/hdaudio/hdaudio.c: revision 1.25
Fix locking against myself problem:
        hdaudio_intr() ->
            mutex_enter(&sc->sc_corb_mtx);
            hdaudio_rirb_dequeue() ->
                hdaudio_rirb_unsol() ->
                    hdafg_unsol() ->
                        hdafg_assoc_dump_dd() ->
                            hdaudio_command() ->
                                mutex_enter(&sc->sc_corb_mtx);
Should that be done differently?

diffstat:

 sys/dev/pci/hdaudio/hdafg.c      |  21 ++++++++++++---------
 sys/dev/pci/hdaudio/hdaudio.c    |  18 ++++++++++++++----
 sys/dev/pci/hdaudio/hdaudiovar.h |   4 +++-
 3 files changed, 29 insertions(+), 14 deletions(-)

diffs (144 lines):

diff -r ce811005ab6c -r e9f40d1be48a sys/dev/pci/hdaudio/hdafg.c
--- a/sys/dev/pci/hdaudio/hdafg.c       Fri Sep 04 14:48:57 2015 +0000
+++ b/sys/dev/pci/hdaudio/hdafg.c       Fri Sep 04 15:07:08 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hdafg.c,v 1.21 2014/05/23 13:57:04 msaitoh Exp $ */
+/* $NetBSD: hdafg.c,v 1.21.2.1 2015/09/04 15:07:08 martin Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd <support%precedence.co.uk@localhost>
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.21 2014/05/23 13:57:04 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.21.2.1 2015/09/04 15:07:08 martin Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -834,21 +834,24 @@
 }
 
 static void
-hdafg_assoc_dump_dd(struct hdafg_softc *sc, struct hdaudio_assoc *as, int pin)
+hdafg_assoc_dump_dd(struct hdafg_softc *sc, struct hdaudio_assoc *as, int pin,
+       int lock)
 {
        struct hdafg_dd_info hdi;
        struct hdaudio_widget *w;
        uint8_t elddata[256];
        unsigned int elddatalen = 0, i;
        uint32_t res;
+       uint32_t (*cmd)(struct hdaudio_codec *, int, uint32_t, uint32_t) =
+           lock ? hdaudio_command : hdaudio_command_unlocked;
 
        w = hdafg_widget_lookup(sc, as->as_pins[pin]);
 
        if (w->w_pin.cap & COP_PINCAP_TRIGGER_REQD) {
-               hdaudio_command(sc->sc_codec, as->as_pins[pin],
+               (*cmd)(sc->sc_codec, as->as_pins[pin],
                    CORB_SET_PIN_SENSE, 0);
        }
-       res = hdaudio_command(sc->sc_codec, as->as_pins[pin],
+       res = (*cmd)(sc->sc_codec, as->as_pins[pin],
            CORB_GET_PIN_SENSE, 0);
 
 #ifdef HDAFG_HDMI_DEBUG
@@ -862,13 +865,13 @@
        if ((res &
            (COP_GET_PIN_SENSE_PRESENSE_DETECT|COP_GET_PIN_SENSE_ELD_VALID)) ==
            (COP_GET_PIN_SENSE_PRESENSE_DETECT|COP_GET_PIN_SENSE_ELD_VALID)) {
-               res = hdaudio_command(sc->sc_codec, as->as_pins[pin],
+               res = (*cmd)(sc->sc_codec, as->as_pins[pin],
                    CORB_GET_HDMI_DIP_SIZE, COP_DIP_ELD_SIZE);
                elddatalen = COP_DIP_BUFFER_SIZE(res);
                if (elddatalen == 0)
                        elddatalen = sizeof(elddata); /* paranoid */
                for (i = 0; i < elddatalen; i++) {
-                       res = hdaudio_command(sc->sc_codec, as->as_pins[pin],
+                       res = (*cmd)(sc->sc_codec, as->as_pins[pin],
                            CORB_GET_HDMI_ELD_DATA, i);
                        if (!(res & COP_ELD_VALID)) {
                                hda_error(sc, "bad ELD size (%u/%u)\n",
@@ -1087,7 +1090,7 @@
                        for (j = 0; j < HDAUDIO_MAXPINS; j++) {
                                if (as[i].as_pins[j] == 0)
                                        continue;
-                               hdafg_assoc_dump_dd(sc, &as[i], j);
+                               hdafg_assoc_dump_dd(sc, &as[i], j, 1);
                        }
                }
        }
@@ -4264,7 +4267,7 @@
                        for (j = 0; j < HDAUDIO_MAXPINS; j++) {
                                if (as[i].as_pins[j] == 0)
                                        continue;
-                               hdafg_assoc_dump_dd(sc, &as[i], j);
+                               hdafg_assoc_dump_dd(sc, &as[i], j, 0);
                        }
                }
                break;
diff -r ce811005ab6c -r e9f40d1be48a sys/dev/pci/hdaudio/hdaudio.c
--- a/sys/dev/pci/hdaudio/hdaudio.c     Fri Sep 04 14:48:57 2015 +0000
+++ b/sys/dev/pci/hdaudio/hdaudio.c     Fri Sep 04 15:07:08 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio.c,v 1.22 2014/07/25 08:10:38 dholland Exp $ */
+/* $NetBSD: hdaudio.c,v 1.22.2.1 2015/09/04 15:07:08 martin Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd <support%precedence.co.uk@localhost>
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.22 2014/07/25 08:10:38 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.22.2.1 2015/09/04 15:07:08 martin Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -326,15 +326,25 @@
 hdaudio_command(struct hdaudio_codec *co, int nid, uint32_t control,
     uint32_t param)
 {
+       uint32_t result;
+       struct hdaudio_softc *sc = co->co_host;
+       mutex_enter(&sc->sc_corb_mtx);
+       result = hdaudio_command_unlocked(co, nid, control, param);
+       mutex_exit(&sc->sc_corb_mtx);
+       return result;
+}
+
+uint32_t
+hdaudio_command_unlocked(struct hdaudio_codec *co, int nid, uint32_t control,
+    uint32_t param)
+{
        struct hdaudio_softc *sc = co->co_host;
        uint32_t result;
 
-       mutex_enter(&sc->sc_corb_mtx);
        hda_trace(sc, "cmd  : request %08X %08X (%02X)\n",
            control, param, nid);
        hdaudio_corb_enqueue(sc, co->co_addr, nid, control, param);
        result = hdaudio_rirb_dequeue(sc, false);
-       mutex_exit(&sc->sc_corb_mtx);
 
        return result;
 }
diff -r ce811005ab6c -r e9f40d1be48a sys/dev/pci/hdaudio/hdaudiovar.h
--- a/sys/dev/pci/hdaudio/hdaudiovar.h  Fri Sep 04 14:48:57 2015 +0000
+++ b/sys/dev/pci/hdaudio/hdaudiovar.h  Fri Sep 04 15:07:08 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudiovar.h,v 1.9 2011/02/13 17:49:12 jmcneill Exp $ */
+/* $NetBSD: hdaudiovar.h,v 1.9.30.1 2015/09/04 15:07:08 martin Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd <support%precedence.co.uk@localhost>
@@ -176,6 +176,8 @@
 void   hdaudio_childdet(struct hdaudio_softc *, device_t);
 
 uint32_t hdaudio_command(struct hdaudio_codec *, int, uint32_t, uint32_t);
+uint32_t hdaudio_command_unlocked(struct hdaudio_codec *, int, uint32_t,
+    uint32_t);
 int    hdaudio_intr(struct hdaudio_softc *);
 
 int    hdaudio_dma_alloc(struct hdaudio_softc *, struct hdaudio_dma *, int);



Home | Main Index | Thread Index | Old Index