Source-Changes-HG archive

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

[src/trunk]: src/sys ac97_host_if::reset() returns non-zero value if codec re...



details:   https://anonhg.NetBSD.org/src/rev/8bef81fb006b
branches:  trunk
changeset: 570076:8bef81fb006b
user:      kent <kent%NetBSD.org@localhost>
date:      Wed Sep 22 12:20:24 2004 +0000

description:
ac97_host_if::reset() returns non-zero value if codec reset fails, and
ac97 is not attached in that case.

PR: kern/26973

diffstat:

 sys/arch/amiga/dev/repulse.c |   9 +++++----
 sys/dev/ic/ac97.c            |   9 ++++++---
 sys/dev/ic/ac97var.h         |   4 ++--
 sys/dev/pci/auich.c          |  26 +++++++++++++-------------
 sys/dev/pci/autri.c          |  15 +++++++++------
 sys/dev/pci/auvia.c          |  13 ++++++++-----
 sys/dev/pci/cs4280.c         |  11 ++++++-----
 sys/dev/pci/cs4281.c         |  19 ++++++++++---------
 sys/dev/pci/eap.c            |  10 +++++-----
 sys/dev/pci/emuxki.c         |   9 +++++----
 sys/dev/pci/esa.c            |  10 +++++-----
 sys/dev/pci/esm.c            |   7 ++++---
 sys/dev/pci/esmvar.h         |   4 ++--
 sys/dev/pci/fms.c            |   9 +++++----
 sys/dev/pci/neo.c            |   9 +++++----
 sys/dev/pci/yds.c            |   9 +++++----
 16 files changed, 95 insertions(+), 78 deletions(-)

diffs (truncated from 704 to 300 lines):

diff -r cfae0f5e2645 -r 8bef81fb006b sys/arch/amiga/dev/repulse.c
--- a/sys/arch/amiga/dev/repulse.c      Wed Sep 22 11:47:23 2004 +0000
+++ b/sys/arch/amiga/dev/repulse.c      Wed Sep 22 12:20:24 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: repulse.c,v 1.8 2003/04/06 18:20:10 wiz Exp $ */
+/*     $NetBSD: repulse.c,v 1.9 2004/09/22 12:20:24 kent Exp $ */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: repulse.c,v 1.8 2003/04/06 18:20:10 wiz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: repulse.c,v 1.9 2004/09/22 12:20:24 kent Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -75,7 +75,7 @@
 int repac_attach(void *, struct ac97_codec_if *);
 int repac_read(void *, u_int8_t, u_int16_t *);
 int repac_write(void *, u_int8_t, u_int16_t);
-void repac_reset(void *);
+int repac_reset(void *);
 enum ac97_host_flag repac_flags(void *);
 
 /* audio attachment functions */
@@ -381,7 +381,7 @@
 
 }
 
-void repac_reset(void *arg) {
+int repac_reset(void *arg) {
        struct repulse_softc *sc = arg;
        struct repulse_hw *bp = sc->sc_boardp;
 
@@ -403,6 +403,7 @@
        a = bp->rhw_status;
        a &= ~REPSTATUS_CODECRESET;
        bp->rhw_status = a;
+       return 0;
 }
 
 int repac_read(void *arg, u_int8_t reg, u_int16_t *valuep) {
diff -r cfae0f5e2645 -r 8bef81fb006b sys/dev/ic/ac97.c
--- a/sys/dev/ic/ac97.c Wed Sep 22 11:47:23 2004 +0000
+++ b/sys/dev/ic/ac97.c Wed Sep 22 12:20:24 2004 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: ac97.c,v 1.61 2004/08/28 07:02:11 kent Exp $ */
+/*      $NetBSD: ac97.c,v 1.62 2004/09/22 12:20:24 kent Exp $ */
 /*     $OpenBSD: ac97.c,v 1.8 2000/07/19 09:01:35 csapuntz Exp $       */
 
 /*
@@ -63,7 +63,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ac97.c,v 1.61 2004/08/28 07:02:11 kent Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ac97.c,v 1.62 2004/09/22 12:20:24 kent Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -956,7 +956,10 @@
                return error;
        }
 
-       host_if->reset(host_if->arg);
+       if ((error = host_if->reset(host_if->arg))) {
+               free(as, M_DEVBUF);
+               return error;
+       }
 
        host_if->write(host_if->arg, AC97_REG_POWER, 0);
        host_if->write(host_if->arg, AC97_REG_RESET, 0);
diff -r cfae0f5e2645 -r 8bef81fb006b sys/dev/ic/ac97var.h
--- a/sys/dev/ic/ac97var.h      Wed Sep 22 11:47:23 2004 +0000
+++ b/sys/dev/ic/ac97var.h      Wed Sep 22 12:20:24 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ac97var.h,v 1.9 2004/08/23 23:17:54 thorpej Exp $      */
+/*     $NetBSD: ac97var.h,v 1.10 2004/09/22 12:20:24 kent Exp $        */
 /*     $OpenBSD: ac97.h,v 1.4 2000/07/19 09:01:35 csapuntz Exp $       */
 
 /*
@@ -47,7 +47,7 @@
        int (*attach)(void *, struct ac97_codec_if *);
        int (*read)(void *, u_int8_t, u_int16_t *);
        int (*write)(void *, u_int8_t, u_int16_t);
-       void (*reset)(void *);
+       int (*reset)(void *);
 
        enum ac97_host_flags (*flags)(void *);
 };
diff -r cfae0f5e2645 -r 8bef81fb006b sys/dev/pci/auich.c
--- a/sys/dev/pci/auich.c       Wed Sep 22 11:47:23 2004 +0000
+++ b/sys/dev/pci/auich.c       Wed Sep 22 12:20:24 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: auich.c,v 1.61 2004/08/07 16:12:57 soren Exp $ */
+/*     $NetBSD: auich.c,v 1.62 2004/09/22 12:20:24 kent Exp $  */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -118,7 +118,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.61 2004/08/07 16:12:57 soren Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.62 2004/09/22 12:20:24 kent Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -322,7 +322,7 @@
 int    auich_attach_codec(void *, struct ac97_codec_if *);
 int    auich_read_codec(void *, u_int8_t, u_int16_t *);
 int    auich_write_codec(void *, u_int8_t, u_int16_t);
-void   auich_reset_codec(void *);
+int    auich_reset_codec(void *);
 
 static const struct auich_devtype {
        int     vendor;
@@ -600,7 +600,7 @@
        return 0;
 }
 
-void
+int
 auich_reset_codec(void *v)
 {
        struct auich_softc *sc = v;
@@ -620,17 +620,17 @@
        }
        if (i <= 0) {
                printf("%s: auich_reset_codec: time out\n", sc->sc_dev.dv_xname);
-               /* XXX: should not attach the audio device */
-       } else {
+               return ETIMEDOUT;
+       }
 #ifdef DEBUG
-               if (status & ICH_SCR)
-                       printf("%s: The 2nd codec is ready.\n",
-                              sc->sc_dev.dv_xname);
-               if (status & ICH_S2CR)
-                       printf("%s: The 3rd codec is ready.\n",
-                              sc->sc_dev.dv_xname);
+       if (status & ICH_SCR)
+               printf("%s: The 2nd codec is ready.\n",
+                      sc->sc_dev.dv_xname);
+       if (status & ICH_S2CR)
+               printf("%s: The 3rd codec is ready.\n",
+                      sc->sc_dev.dv_xname);
 #endif
-       }
+       return 0;
 }
 
 int
diff -r cfae0f5e2645 -r 8bef81fb006b sys/dev/pci/autri.c
--- a/sys/dev/pci/autri.c       Wed Sep 22 11:47:23 2004 +0000
+++ b/sys/dev/pci/autri.c       Wed Sep 22 12:20:24 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autri.c,v 1.19 2004/04/23 21:13:06 itojun Exp $        */
+/*     $NetBSD: autri.c,v 1.20 2004/09/22 12:20:25 kent Exp $  */
 
 /*
  * Copyright (c) 2001 SOMEYA Yoshihiko and KUROSAWA Takahiro.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autri.c,v 1.19 2004/04/23 21:13:06 itojun Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autri.c,v 1.20 2004/09/22 12:20:25 kent Exp $");
 
 #include "midi.h"
 
@@ -101,7 +101,7 @@
 int    autri_attach_codec(void *sc, struct ac97_codec_if *);
 int    autri_read_codec(void *sc, u_int8_t a, u_int16_t *d);
 int    autri_write_codec(void *sc, u_int8_t a, u_int16_t d);
-void   autri_reset_codec(void *sc);
+int    autri_reset_codec(void *sc);
 enum ac97_host_flags   autri_flags_codec(void *sc);
 
 static void autri_powerhook(int why,void *addr);
@@ -366,7 +366,7 @@
        return 0;
 }
 
-void
+int
 autri_reset_codec(void *sc_)
 {
        struct autri_codec_softc *codec = sc_;
@@ -425,7 +425,7 @@
        default:
                printf("%s: autri_reset_codec : unknown device\n",
                       sc->sc_dev.dv_xname);
-               return;
+               return EOPNOTSUPP;
        }
 
        /* wait for 'Codec Ready' */
@@ -436,9 +436,12 @@
                delay(1000);
        }
 
-       if (count == 0)
+       if (count == 0) {
                printf("%s: Codec timeout. AC'97 is not ready for operation.\n",
                       sc->sc_dev.dv_xname);
+               return ETIMEDOUT;
+       }
+       return 0;
 }
 
 enum ac97_host_flags
diff -r cfae0f5e2645 -r 8bef81fb006b sys/dev/pci/auvia.c
--- a/sys/dev/pci/auvia.c       Wed Sep 22 11:47:23 2004 +0000
+++ b/sys/dev/pci/auvia.c       Wed Sep 22 12:20:24 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: auvia.c,v 1.41 2004/07/09 02:42:45 mycroft Exp $       */
+/*     $NetBSD: auvia.c,v 1.42 2004/09/22 12:20:25 kent Exp $  */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -47,7 +47,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auvia.c,v 1.41 2004/07/09 02:42:45 mycroft Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auvia.c,v 1.42 2004/09/22 12:20:25 kent Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -226,7 +226,7 @@
 int    auvia_attach_codec(void *, struct ac97_codec_if *);
 int    auvia_write_codec(void *, u_int8_t, u_int16_t);
 int    auvia_read_codec(void *, u_int8_t, u_int16_t *);
-void   auvia_reset_codec(void *);
+int    auvia_reset_codec(void *);
 int    auvia_waitready_codec(struct auvia_softc *sc);
 int    auvia_waitvalid_codec(struct auvia_softc *sc);
 
@@ -383,7 +383,7 @@
 }
 
 
-void
+int
 auvia_reset_codec(void *addr)
 {
        int i;
@@ -405,8 +405,11 @@
        for (i = 500000; i != 0 && !(pci_conf_read(sc->sc_pc, sc->sc_pt,
                AUVIA_PCICONF_JUNK) & AUVIA_PCICONF_PRIVALID); i--)
                DELAY(1);
-       if (i == 0)
+       if (i == 0) {
                printf("%s: codec reset timed out\n", sc->sc_dev.dv_xname);
+               return ETIMEDOUT;
+       }
+       return 0;
 }
 
 
diff -r cfae0f5e2645 -r 8bef81fb006b sys/dev/pci/cs4280.c
--- a/sys/dev/pci/cs4280.c      Wed Sep 22 11:47:23 2004 +0000
+++ b/sys/dev/pci/cs4280.c      Wed Sep 22 12:20:24 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cs4280.c,v 1.29 2004/08/05 16:43:59 drochner Exp $     */
+/*     $NetBSD: cs4280.c,v 1.30 2004/09/22 12:20:25 kent Exp $ */
 
 /*
  * Copyright (c) 1999, 2000 Tatoku Ogaito.  All rights reserved.
@@ -52,7 +52,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cs4280.c,v 1.29 2004/08/05 16:43:59 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cs4280.c,v 1.30 2004/09/22 12:20:25 kent Exp $");
 
 #include "midi.h"
 
@@ -102,7 +102,7 @@
 int  cs4280_trigger_input(void *, void *, void *, int, void (*)(void *),
                           void *, struct audio_params *);
 
-void cs4280_reset_codec(void *);
+int cs4280_reset_codec(void *);
 
 /* For PowerHook */
 void cs4280_power(int, void *);
@@ -948,7 +948,7 @@
 }
 
 /* control AC97 codec */
-void
+int
 cs4280_reset_codec(void *addr)
 {
        struct cs428x_softc *sc;
@@ -979,9 +979,10 @@



Home | Main Index | Thread Index | Old Index