NetBSD Problem Report #39652
From www@NetBSD.org Mon Sep 29 15:56:23 2008
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by narn.NetBSD.org (Postfix) with ESMTP id F3BDE63BD01
for <gnats-bugs@gnats.netbsd.org>; Mon, 29 Sep 2008 15:56:22 +0000 (UTC)
Message-Id: <20080929155622.B5FF163BCFE@narn.NetBSD.org>
Date: Mon, 29 Sep 2008 15:56:22 +0000 (UTC)
From: lacombar@gmail.com
Reply-To: lacombar@gmail.com
To: gnats-bugs@NetBSD.org
Subject: auich: can't map codec i/o space
X-Send-Pr-Version: www-1.0
>Number: 39652
>Category: kern
>Synopsis: auich: can't map codec i/o space
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Sep 29 16:00:00 +0000 2008
>Closed-Date:
>Last-Modified: Thu Jan 14 17:10:57 +0000 2010
>Originator: Arnaud Lacombe
>Release: 4.99.72
>Organization:
n/a
>Environment:
NetBSD oui 4.99.72 NetBSD 4.99.72 (OUI) #0: Sun Sep 28 17:00:00 EDT 2008 al@oui:/build/current/obj/20080928/sys/arch/i386/compile/OUI i386
>Description:
Audio interface doesn't initialize properly, making the machine unable to enter sleep mode and unable to play any sound.
The call to pci_mapreg_map() in auich_attach() fails. -current kernel 4.99.21 initialize correctly.
pcictl(8) dump for the device, full dmesg available, and kernel config available at: https://82.229.84.165:6900/netbsd/pr/ .
>How-To-Repeat:
boot :/
>Fix:
n/a
>Release-Note:
>Audit-Trail:
From: Matthew Mondor <mm_lists@pulsar-zone.net>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: kern/39652: auich: can't map codec i/o space
Date: Fri, 3 Jul 2009 21:55:42 -0400
I also get both problems with an IBM ThinkPad T23 and netbsd-5 and
5.99.10.
- auich lacks power management hooks preventing suspend
- auich (also an ICH3) cannot map I/O space and when trying to play
audio applications simply lock. This was tested with and without
ACPI with the same results.
The power management part is probably easy to fix, but I'm not yet
aware of a fix for the mapping problem, it might need review of
hardware specs or of drivers for other BSDs or Linux, but I only tried
NetBSD on it so far.
--
Matt
From: "Jonathan A. Kollasch" <jakllsch@kollasch.net>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: PR/39652
Date: Fri, 20 Nov 2009 22:32:48 +0000
--opJtzjQTFsWo+cga
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Attached is a patch that may help,
also available at http://www.netbsd.org/~jakllsch/auich-map.diff
--opJtzjQTFsWo+cga
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="auich-map.diff"
Index: auich.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/auich.c,v
retrieving revision 1.131
diff -u -r1.131 auich.c
--- auich.c 12 Nov 2009 19:39:26 -0000 1.131
+++ auich.c 20 Nov 2009 22:13:23 -0000
@@ -215,8 +215,11 @@
int sc_sts_reg;
/* 440MX workaround */
int sc_dmamap_flags;
- /* Native mode? */
- int sc_native_mode;
+ /* flags */
+ int sc_iose :1,
+ sc_csr_io :1,
+ sc_csr_mem :1,
+ :29;
/* sysctl */
struct sysctllog *sc_log;
@@ -482,46 +485,55 @@
if (d->id == PCIID_ICH4 || d->id == PCIID_ICH5 || d->id == PCIID_ICH6
|| d->id == PCIID_ICH7 || d->id == PCIID_I6300ESB
|| d->id == PCIID_ICH4MODEM) {
- sc->sc_native_mode = 1;
/*
* Use native mode for Intel 6300ESB and ICH4/ICH5/ICH6/ICH7
*/
+
+ sc->sc_csr_mem = 1;
+ v = pci_conf_read(pa->pa_pc, pa->pa_tag,
+ PCI_COMMAND_STATUS_REG);
+ pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG,
+ v | PCI_COMMAND_MEM_ENABLE);
+ pa->pa_flags |= PCI_FLAGS_MEM_ENABLED;
+
if (pci_mapreg_map(pa, ICH_MMBAR, PCI_MAPREG_TYPE_MEM, 0,
- &sc->iot, &sc->mix_ioh, NULL, &sc->mix_size)) {
- v = pci_conf_read(pa->pa_pc, pa->pa_tag, ICH_CFG);
- pci_conf_write(pa->pa_pc, pa->pa_tag, ICH_CFG,
- v | ICH_CFG_IOSE);
- if (pci_mapreg_map(pa, ICH_NAMBAR, PCI_MAPREG_TYPE_IO,
- 0, &sc->iot, &sc->mix_ioh, NULL,
- &sc->mix_size)) {
- aprint_error_dev(self, "can't map codec i/o space\n");
- return;
- }
+ &sc->iot, &sc->mix_ioh, NULL, &sc->mix_size)) {
+ goto retry_map;
}
if (pci_mapreg_map(pa, ICH_MBBAR, PCI_MAPREG_TYPE_MEM, 0,
- &sc->iot, &sc->aud_ioh, NULL, &sc->aud_size)) {
- v = pci_conf_read(pa->pa_pc, pa->pa_tag, ICH_CFG);
- pci_conf_write(pa->pa_pc, pa->pa_tag, ICH_CFG,
- v | ICH_CFG_IOSE);
- if (pci_mapreg_map(pa, ICH_NABMBAR, PCI_MAPREG_TYPE_IO,
- 0, &sc->iot, &sc->aud_ioh, NULL,
- &sc->aud_size)) {
- aprint_error_dev(self, "can't map device i/o space\n");
- return;
- }
- }
- } else {
- if (pci_mapreg_map(pa, ICH_NAMBAR, PCI_MAPREG_TYPE_IO, 0,
- &sc->iot, &sc->mix_ioh, NULL, &sc->mix_size)) {
- aprint_error_dev(self, "can't map codec i/o space\n");
- return;
- }
- if (pci_mapreg_map(pa, ICH_NABMBAR, PCI_MAPREG_TYPE_IO, 0,
- &sc->iot, &sc->aud_ioh, NULL, &sc->aud_size)) {
- aprint_error_dev(self, "can't map device i/o space\n");
- return;
+ &sc->iot, &sc->aud_ioh, NULL, &sc->aud_size)) {
+ goto retry_map;
}
+ goto map_done;
+ } else
+ goto non_native_map;
+
+retry_map:
+ sc->sc_iose = 1;
+ v = pci_conf_read(pa->pa_pc, pa->pa_tag, ICH_CFG);
+ pci_conf_write(pa->pa_pc, pa->pa_tag, ICH_CFG,
+ v | ICH_CFG_IOSE);
+
+non_native_map:
+ sc->sc_csr_io = 1;
+ v = pci_conf_read(pa->pa_pc, pa->pa_tag,
+ PCI_COMMAND_STATUS_REG);
+ pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG,
+ v | PCI_COMMAND_IO_ENABLE);
+ pa->pa_flags |= PCI_FLAGS_IO_ENABLED;
+
+ if (pci_mapreg_map(pa, ICH_NAMBAR, PCI_MAPREG_TYPE_IO, 0,
+ &sc->iot, &sc->mix_ioh, NULL, &sc->mix_size)) {
+ aprint_error_dev(self, "can't map codec i/o space\n");
+ return;
}
+ if (pci_mapreg_map(pa, ICH_NABMBAR, PCI_MAPREG_TYPE_IO, 0,
+ &sc->iot, &sc->aud_ioh, NULL, &sc->aud_size)) {
+ aprint_error_dev(self, "can't map device i/o space\n");
+ return;
+ }
+
+map_done:
sc->dmat = pa->pa_dmat;
/* enable bus mastering */
@@ -1578,12 +1590,19 @@
struct auich_softc *sc = device_private(dv);
pcireg_t v;
- if (sc->sc_native_mode) {
+ if (sc->sc_iose) {
v = pci_conf_read(sc->sc_pc, sc->sc_pt, ICH_CFG);
pci_conf_write(sc->sc_pc, sc->sc_pt, ICH_CFG,
v | ICH_CFG_IOSE);
}
+ v = pci_conf_read(sc->sc_pc, sc->sc_pt, PCI_COMMAND_STATUS_REG);
+ if (sc->sc_csr_io)
+ v |= PCI_COMMAND_IO_ENABLE;
+ if (sc->sc_csr_mem)
+ v |= PCI_COMMAND_MEM_ENABLE;
+ pci_conf_write(sc->sc_pc, sc->sc_pt, PCI_COMMAND_STATUS_REG, v);
+
auich_reset_codec(sc);
DELAY(1000);
(sc->codec_if->vtbl->restore_ports)(sc->codec_if);
--opJtzjQTFsWo+cga--
From: Matthew Mondor <mm_lists@pulsar-zone.net>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: PR/39652
Date: Sun, 20 Dec 2009 17:43:19 -0500
On Fri, 20 Nov 2009 22:35:02 +0000 (UTC)
"Jonathan A. Kollasch" <jakllsch@kollasch.net> wrote:
> Attached is a patch that may help,
> also available at http://www.netbsd.org/~jakllsch/auich-map.diff
Although I tested the patch against netbsd-5, I can confirm it fixes
the mapping and audio-freezing problems on the T23. I didn't test
resume/suspend but since I gave the laptop away and it is no longer
mine, I couldn't borrow it for very long to do the tests on.
Thank you very much,
--
Matt
From: Matthew Mondor <mm_lists@pulsar-zone.net>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: PR/39652
Date: Tue, 29 Dec 2009 15:53:40 -0500
On Sun, 20 Dec 2009 22:45:01 +0000 (UTC)
Matthew Mondor <mm_lists@pulsar-zone.net> wrote:
> The following reply was made to PR kern/39652; it has been noted by GNATS.
>
> From: Matthew Mondor <mm_lists@pulsar-zone.net>
> To: gnats-bugs@NetBSD.org
> Cc:
> Subject: Re: PR/39652
> Date: Sun, 20 Dec 2009 17:43:19 -0500
>
> On Fri, 20 Nov 2009 22:35:02 +0000 (UTC)
> "Jonathan A. Kollasch" <jakllsch@kollasch.net> wrote:
>
> > Attached is a patch that may help,
> > also available at http://www.netbsd.org/~jakllsch/auich-map.diff
>
> Although I tested the patch against netbsd-5, I can confirm it fixes
> the mapping and audio-freezing problems on the T23. I didn't test
> resume/suspend but since I gave the laptop away and it is no longer
> mine, I couldn't borrow it for very long to do the tests on.
Considering this patch also worked well on netbsd-5 as-is, a pullup to
netbsd-5 is probably also worth it once it's commited on -current?
Thanks,
--
Matt
From: "Jonathan A. Kollasch" <jakllsch@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/39652 CVS commit: src/sys/dev/pci
Date: Wed, 30 Dec 2009 00:24:38 +0000
Module Name: src
Committed By: jakllsch
Date: Wed Dec 30 00:24:38 UTC 2009
Modified Files:
src/sys/dev/pci: auich.c
Log Message:
Ensure that the memory or i/o space we need is accessible at attach
and resume.
Rework register mapping code path, using 'goto', so duplicate code
is reduced.
I've tested this on nvidia and sis auich(4)-compatible controllers.
In addition this change is reported to fix PR/39652.
To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/sys/dev/pci/auich.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: Soren Jacobsen <snj@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/39652 CVS commit: [netbsd-5] src/sys/dev/pci
Date: Sat, 9 Jan 2010 01:35:16 +0000
Module Name: src
Committed By: snj
Date: Sat Jan 9 01:35:16 UTC 2010
Modified Files:
src/sys/dev/pci [netbsd-5]: auich.c
Log Message:
Pull up following revision(s) (requested by jakllsch in ticket #1218):
sys/dev/pci/auich.c: revision 1.133
Ensure that the memory or i/o space we need is accessible at attach
and resume.
Rework register mapping code path, using 'goto', so duplicate code
is reduced.
I've tested this on nvidia and sis auich(4)-compatible controllers.
In addition this change is reported to fix PR/39652.
To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.127.10.1 src/sys/dev/pci/auich.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Tue, 12 Jan 2010 04:39:04 +0000
State-Changed-Why:
Patch committed and pulled up; thanks.
From: Matthew Mondor <mm_lists@pulsar-zone.net>
To: gnats-bugs@netbsd.org
Cc: netbsd-bugs@netbsd.org
Subject: Re: kern/39652: auich: can't map codec i/o space
Date: Wed, 13 Jan 2010 18:38:32 -0500
Should this PR be re-opened? The patch had to be reverted.
For reference:
http://mail-index.netbsd.org/current-users/2010/01/13/msg012096.html
Thanks,
--
Matt
State-Changed-From-To: closed->open
State-Changed-By: jakllsch@NetBSD.org
State-Changed-When: Thu, 14 Jan 2010 17:10:57 +0000
State-Changed-Why:
patch had unacceptable side effects on some machines.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.