From owner-freebsd-stable@FreeBSD.ORG Fri Jun 23 06:09:32 2006 Return-Path: X-Original-To: freebsd-stable@freebsd.org Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id AE02116A54E for ; Fri, 23 Jun 2006 06:09:32 +0000 (UTC) (envelope-from doconnor@gsoft.com.au) Received: from cain.gsoft.com.au (cain.gsoft.com.au [203.31.81.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id BD04443D46 for ; Fri, 23 Jun 2006 06:09:31 +0000 (GMT) (envelope-from doconnor@gsoft.com.au) Received: from inchoate.gsoft.com.au (inchoate.gsoft.com.au [203.31.81.25]) (authenticated bits=0) by cain.gsoft.com.au (8.13.5/8.13.4) with ESMTP id k5N69CAZ040033 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 23 Jun 2006 15:39:12 +0930 (CST) (envelope-from doconnor@gsoft.com.au) From: "Daniel O'Connor" To: "M. Warner Losh" Date: Fri, 23 Jun 2006 15:39:08 +0930 User-Agent: KMail/1.9.3 References: <200606221424.14380.doconnor@gsoft.com.au> <200606231104.31514.doconnor@gsoft.com.au> <20060622.231428.790460912.imp@bsdimp.com> In-Reply-To: <20060622.231428.790460912.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart5209481.GZX5Gb0luM"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <200606231539.09594.doconnor@gsoft.com.au> X-Spam-Score: -1.36 () ALL_TRUSTED X-Scanned-By: MIMEDefang 2.56 on 203.31.81.10 Cc: pieter@degoeje.nl, freebsd-stable@freebsd.org Subject: Re: Asus A8V IRQ/serial problems X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Jun 2006 06:09:32 -0000 --nextPart5209481.GZX5Gb0luM Content-Type: multipart/mixed; boundary="Boundary-01=_FW4mEsOyYbTAyuJ" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_FW4mEsOyYbTAyuJ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Friday 23 June 2006 14:44, M. Warner Losh wrote: > : I think a better option would be to remove the test in sio.c for the > : AMD64 case since isa_irq_pending() won't do anything. > > I hate #ifdef __amd64__ code. It is evil and should be avoided. > Maybe the right answer is to have a separate ACPI probe routine that > does something similar to the pccard case where we pass 'noprobe =3D 1' > to the sioprobe routine. If ACPI says there's a sio there, we don't > need to probe for it... That sounds like a good solution! Better than an ifdef for sure :) How's this diff? Note that I just mangled the uart ACPI attachment and the sio PCCARD one.. =2D-=20 Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C --Boundary-01=_FW4mEsOyYbTAyuJ Content-Type: text/x-diff; charset="iso-8859-1"; name="sio-acpi.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="sio-acpi.diff" Index: sys/conf/files =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /usr/CVS-Repository/src/sys/conf/files,v retrieving revision 1.1104 diff -u -r1.1104 files =2D-- sys/conf/files 23 Mar 2006 23:06:14 -0000 1.1104 +++ sys/conf/files 23 Jun 2006 05:46:57 -0000 @@ -828,6 +828,7 @@ dev/si/si_eisa.c optional si eisa dev/si/si_isa.c optional si isa dev/si/si_pci.c optional si pci +dev/sio/sio_acpi.c optional sio acpi dev/sio/sio_pccard.c optional sio pccard dev/sio/sio_pci.c optional sio pci dev/sio/sio_puc.c optional sio puc pci Index: sys/modules/sio/Makefile =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /usr/CVS-Repository/src/sys/modules/sio/Makefile,v retrieving revision 1.9 diff -u -r1.9 Makefile =2D-- sys/modules/sio/Makefile 14 Oct 2005 23:30:15 -0000 1.9 +++ sys/modules/sio/Makefile 23 Jun 2006 05:46:32 -0000 @@ -8,7 +8,7 @@ KMOD=3D sio SRCS=3D bus_if.h card_if.h device_if.h isa_if.h pci_if.h \ opt_comconsole.h opt_compat.h opt_gdb.h opt_kdb.h opt_sio.h \ =2D sio.c sio_pccard.c sio_pci.c sio_puc.c pccarddevs.h + sio.c sio_acpi.c sio_pccard.c sio_pci.c sio_puc.c pccarddevs.h .if ${MACHINE} =3D=3D "pc98" SRCS+=3D sio_cbus.c .else Index: sys/dev/sio/sio_acpi.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: sys/dev/sio/sio_acpi.c diff -N sys/dev/sio/sio_acpi.c =2D-- /dev/null 1 Jan 1970 00:00:00 -0000 +++ sys/dev/sio/sio_acpi.c 23 Jun 2006 05:57:03 -0000 @@ -0,0 +1,98 @@ +/*- + * Copyright (c) 2006 Daniel O'Connor. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTI= ES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF US= E, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +static int sio_acpi_attach(device_t dev); +static int sio_acpi_probe(device_t dev); + +static device_method_t sio_acpi_methods[] =3D { + /* Device interface */ + DEVMETHOD(device_probe, sio_acpi_probe), + DEVMETHOD(device_attach, sio_acpi_attach), + DEVMETHOD(device_detach, siodetach), + + { 0, 0 } +}; + +static driver_t sio_acpi_driver =3D { + sio_driver_name, + sio_acpi_methods, + 0, +}; + +static struct isa_pnp_id sio_acpi_ids[] =3D { + {0x0005d041, "Standard PC COM port"}, /* PNP0500 */ + {0x0105d041, "16550A-compatible COM port"}, /* PNP0501 */ + {0} +}; + +static int +sio_acpi_probe(dev) + device_t dev; +{ + device_t parent; +=09 + parent =3D device_get_parent(dev); + + if (!ISA_PNP_PROBE(parent, dev, sio_acpi_ids)) + return (sioprobe(dev, 0, 0UL, 2)); + + /* Add checks for non-ns8250 IDs here. */ + return (ENXIO); + +} + +static int +sio_acpi_attach(dev) + device_t dev; +{ + int err; +=09 + /* Do not probe IRQ - if ACPI says it's there, it is */ + if ((err =3D sioprobe(dev, 0, 0UL, 1)) !=3D 0) + return (err); + return (sioattach(dev, 0, 0UL)); +} + +DRIVER_MODULE(sio, acpi, sio_acpi_driver, sio_devclass, 0, 0); Index: sys/dev/sio/sio_isa.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /usr/CVS-Repository/src/sys/dev/sio/sio_isa.c,v retrieving revision 1.16 diff -u -r1.16 sio_isa.c =2D-- sys/dev/sio/sio_isa.c 29 May 2005 04:42:25 -0000 1.16 +++ sys/dev/sio/sio_isa.c 23 Jun 2006 05:46:11 -0000 @@ -167,4 +167,3 @@ } =20 DRIVER_MODULE(sio, isa, sio_isa_driver, sio_devclass, 0, 0); =2DDRIVER_MODULE(sio, acpi, sio_isa_driver, sio_devclass, 0, 0); Index: sys/dev/sio/sio.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /usr/CVS-Repository/src/sys/dev/sio/sio.c,v retrieving revision 1.464 diff -u -r1.464 sio.c =2D-- sys/dev/sio/sio.c 22 Feb 2006 18:16:25 -0000 1.464 +++ sys/dev/sio/sio.c 23 Jun 2006 06:03:59 -0000 @@ -716,10 +716,12 @@ failures[1] =3D sio_getreg(com, com_ier) - IER_ETXRDY; failures[2] =3D sio_getreg(com, com_mcr) - mcr_image; DELAY(10000); /* Some internal modems need this time */ =2D irqmap[1] =3D isa_irq_pending(); + if (noprobe < 2) + irqmap[1] =3D isa_irq_pending(); failures[4] =3D (sio_getreg(com, com_iir) & IIR_IMASK) - IIR_TXRDY; DELAY(1000); /* XXX */ =2D irqmap[2] =3D isa_irq_pending(); + if (noprobe < 2) + irqmap[2] =3D isa_irq_pending(); failures[6] =3D (sio_getreg(com, com_iir) & IIR_IMASK) - IIR_NOPEND; =20 /* @@ -735,26 +737,30 @@ sio_setreg(com, com_cfcr, CFCR_8BITS); /* dummy to avoid bus echo */ failures[7] =3D sio_getreg(com, com_ier); DELAY(1000); /* XXX */ =2D irqmap[3] =3D isa_irq_pending(); + if (noprobe < 2) + irqmap[3] =3D isa_irq_pending(); failures[9] =3D (sio_getreg(com, com_iir) & IIR_IMASK) - IIR_NOPEND; =20 mtx_unlock_spin(&sio_lock); =20 =2D irqs =3D irqmap[1] & ~irqmap[0]; =2D if (bus_get_resource(idev, SYS_RES_IRQ, 0, &xirq, NULL) =3D=3D 0 && =2D ((1 << xirq) & irqs) =3D=3D 0) { + if (noprobe < 2) { + irqs =3D irqmap[1] & ~irqmap[0]; + if (bus_get_resource(idev, SYS_RES_IRQ, 0, &xirq, NULL) =3D=3D 0 && + ((1 << xirq) & irqs) =3D=3D 0) { printf( =2D "sio%d: configured irq %ld not in bitmap of probed irqs %#x\n", + "sio%d: configured irq %ld not in bitmap of probed irqs %#x\n", device_get_unit(dev), xirq, irqs); printf( =2D "sio%d: port may not be enabled\n", + "sio%d: port may not be enabled\n", device_get_unit(dev)); =2D } =2D if (bootverbose) + } + + if (bootverbose) printf("sio%d: irq maps: %#x %#x %#x %#x\n", =2D device_get_unit(dev), =2D irqmap[0], irqmap[1], irqmap[2], irqmap[3]); + device_get_unit(dev), + irqmap[0], irqmap[1], irqmap[2], irqmap[3]); =20 + } result =3D 0; for (fn =3D 0; fn < sizeof failures; ++fn) if (failures[fn]) { --Boundary-01=_FW4mEsOyYbTAyuJ-- --nextPart5209481.GZX5Gb0luM Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (FreeBSD) iD8DBQBEm4WF5ZPcIHs/zowRArSBAJoDdtbVJwMmPwlAH6SKfMJU82lcYgCgpi6X TUAZixZBbRW3zSBNdGyhym0= =pTy/ -----END PGP SIGNATURE----- --nextPart5209481.GZX5Gb0luM--