From owner-freebsd-current@FreeBSD.ORG Tue Jul 3 10:40:17 2012 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 23AF01065674 for ; Tue, 3 Jul 2012 10:40:17 +0000 (UTC) (envelope-from guru@unixarea.de) Received: from ms16-1.1blu.de (ms16-1.1blu.de [89.202.0.34]) by mx1.freebsd.org (Postfix) with ESMTP id 9F2C98FC15 for ; Tue, 3 Jul 2012 10:40:16 +0000 (UTC) Received: from [88.217.83.27] (helo=localhost.my.domain) by ms16-1.1blu.de with esmtpsa (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1Sm0Wi-0007ga-90; Tue, 03 Jul 2012 12:40:12 +0200 Received: from localhost.my.domain (localhost [127.0.0.1]) by localhost.my.domain (8.14.4/8.14.3) with ESMTP id q63AeAjH003287; Tue, 3 Jul 2012 12:40:10 +0200 (CEST) (envelope-from guru@unixarea.de) Received: (from guru@localhost) by localhost.my.domain (8.14.4/8.14.3/Submit) id q63Ae843003286; Tue, 3 Jul 2012 12:40:08 +0200 (CEST) (envelope-from guru@unixarea.de) X-Authentication-Warning: localhost.my.domain: guru set sender to guru@unixarea.de using -f Date: Tue, 3 Jul 2012 12:40:07 +0200 From: Matthias Apitz To: Kaho Toshikazu Message-ID: <20120703104007.GA2780@tinyCurrent> References: <20120629133422.GA2233@tiny.Sisis.de> <201206301349.58930.erich@alogreentechnologies.com> <20120630151130.GA1106@tiny.Sisis.de> <201207010629.29148.erich@alogreentechnologies.com> <20120701065849.GA2681@tinyCurrent> <6039.1341276697@pf2.ed.niigata-u.ac.jp> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="9amGYk9869ThD9tj" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <6039.1341276697@pf2.ed.niigata-u.ac.jp> X-Operating-System: FreeBSD 9.0-CURRENT r214444 (i386) User-Agent: Mutt/1.5.21 (2010-09-15) X-Con-Id: 51246 X-Con-U: 0-guru X-Originating-IP: 88.217.83.27 Cc: freebsd-current@freebsd.org, Hans Petter Selasky Subject: Re: no keyboard after booting r235646 in laptop FS Amilo D 7830 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Matthias Apitz List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jul 2012 10:40:17 -0000 --9amGYk9869ThD9tj Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit El día Tuesday, July 03, 2012 a las 09:51:37AM +0900, Kaho Toshikazu escribió: > Hello Matthias Apitz and -current member, > > "sys/dev/atkbdc/atkbdc_isa.c" may not have your keyboard controller's ID. > Run `acpidump -dt` and search your keyboard description. > Is your keyboard controller "PNP0303" ? > > -- > kaho@ed.niigata-u.ac.jp Hello Kaho Toshikazu and all, The command `acpidump -dt` in both releases (r214444 and r235646) gives an error: # acpidump -dt > /tmp/acpidump-r214444.txt acpidump: RSDT entry 2 (sig OEMB) is corrupt the output in r235646 is only some 70 lines and in r214444 I do not see any keyboard related; so I can't answer your question if the keyboard controller is "PNP0303"; Based on r235646 sources, I have checked the SVN-diff between r214444 (where the keyboard is working) and r235646, see attachment /tmp/atkbdc_isa.c-r214444:r235646; and the logic of the kb detection has changed; I will just give it a try and will revert this SVN change, i.e. 'svn up -r r214444 atkbdc_isa.c to see if this works... it does not help; Thanks matthias -- Matthias Apitz t +49-89-61308 351 - f +49-89-61308 399 - m +49-170-4527211 e - w http://www.unixarea.de/ UNIX since V7 on PDP-11 | UNIX on mainframe since ESER 1055 (IBM /370) UNIX on x86 since SVR4.2 UnixWare 2.1.2 | FreeBSD since 2.2.5 --9amGYk9869ThD9tj Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="atkbdc_isa.c-r214444:r235646" Index: atkbdc_isa.c =================================================================== --- atkbdc_isa.c (revision 214444) +++ atkbdc_isa.c (revision 235646) @@ -49,6 +49,11 @@ static int atkbdc_isa_attach(device_t dev); static device_t atkbdc_isa_add_child(device_t bus, u_int order, const char *name, int unit); +static struct resource *atkbdc_isa_alloc_resource(device_t dev, device_t child, + int type, int *rid, u_long start, u_long end, + u_long count, u_int flags); +static int atkbdc_isa_release_resource(device_t dev, device_t child, + int type, int rid, struct resource *r); static device_method_t atkbdc_isa_methods[] = { DEVMETHOD(device_probe, atkbdc_isa_probe), @@ -61,8 +66,8 @@ DEVMETHOD(bus_read_ivar, atkbdc_read_ivar), DEVMETHOD(bus_write_ivar, atkbdc_write_ivar), DEVMETHOD(bus_get_resource_list,atkbdc_get_resource_list), - DEVMETHOD(bus_alloc_resource, bus_generic_rl_alloc_resource), - DEVMETHOD(bus_release_resource, bus_generic_rl_release_resource), + DEVMETHOD(bus_alloc_resource, atkbdc_isa_alloc_resource), + DEVMETHOD(bus_release_resource, atkbdc_isa_release_resource), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), @@ -82,6 +87,7 @@ static struct isa_pnp_id atkbdc_ids[] = { { 0x0303d041, "Keyboard controller (i8042)" }, /* PNP0303 */ + { 0x2003d041, "Keyboard controller (i8042)" }, /* PNP0320 */ { 0 } }; @@ -170,8 +176,6 @@ device_verbose(dev); error = atkbdc_probe_unit(device_get_unit(dev), port0, port1); - if (error == 0) - bus_generic_probe(dev); bus_release_resource(dev, SYS_RES_IOPORT, 0, port0); bus_release_resource(dev, SYS_RES_IOPORT, 1, port1); @@ -216,14 +220,25 @@ return ENXIO; } + /* + * If the device is not created by the PnP BIOS or ACPI, then + * the hint for the IRQ is on the child atkbd device, not the + * keyboard controller, so this can fail. + */ + rid = 0; + sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE); + error = atkbdc_attach_unit(unit, sc, sc->port0, sc->port1); if (error) { bus_release_resource(dev, SYS_RES_IOPORT, 0, sc->port0); bus_release_resource(dev, SYS_RES_IOPORT, 1, sc->port1); + if (sc->irq != NULL) + bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq); return error; } *(atkbdc_softc_t **)device_get_softc(dev) = sc; + bus_generic_probe(dev); bus_generic_attach(dev); return 0; @@ -233,9 +248,11 @@ atkbdc_isa_add_child(device_t bus, u_int order, const char *name, int unit) { atkbdc_device_t *ivar; + atkbdc_softc_t *sc; device_t child; int t; + sc = *(atkbdc_softc_t **)device_get_softc(bus); ivar = malloc(sizeof(struct atkbdc_device), M_ATKBDDEV, M_NOWAIT | M_ZERO); if (!ivar) @@ -251,18 +268,21 @@ ivar->rid = order; /* - * If the device is not created by the PnP BIOS or ACPI, - * refer to device hints for IRQ. + * If the device is not created by the PnP BIOS or ACPI, refer + * to device hints for IRQ. We always populate the resource + * list entry so we can use a standard bus_get_resource() + * method. */ - if (ISA_PNP_PROBE(device_get_parent(bus), bus, atkbdc_ids) != 0) { - if (resource_int_value(name, unit, "irq", &t) != 0) - t = -1; - } else { - t = bus_get_resource_start(bus, SYS_RES_IRQ, ivar->rid); + if (order == KBDC_RID_KBD) { + if (sc->irq == NULL) { + if (resource_int_value(name, unit, "irq", &t) != 0) + t = -1; + } else + t = rman_get_start(sc->irq); + if (t > 0) + resource_list_add(&ivar->resources, SYS_RES_IRQ, + ivar->rid, t, t, 1); } - if (t > 0) - resource_list_add(&ivar->resources, SYS_RES_IRQ, ivar->rid, - t, t, 1); if (resource_disabled(name, unit)) device_disable(child); @@ -272,5 +292,30 @@ return child; } +struct resource * +atkbdc_isa_alloc_resource(device_t dev, device_t child, int type, int *rid, + u_long start, u_long end, u_long count, u_int flags) +{ + atkbdc_softc_t *sc; + + sc = *(atkbdc_softc_t **)device_get_softc(dev); + if (type == SYS_RES_IRQ && *rid == KBDC_RID_KBD && sc->irq != NULL) + return (sc->irq); + return (bus_generic_rl_alloc_resource(dev, child, type, rid, start, + end, count, flags)); +} + +static int +atkbdc_isa_release_resource(device_t dev, device_t child, int type, int rid, + struct resource *r) +{ + atkbdc_softc_t *sc; + + sc = *(atkbdc_softc_t **)device_get_softc(dev); + if (type == SYS_RES_IRQ && rid == KBDC_RID_KBD && r == sc->irq) + return (0); + return (bus_generic_rl_release_resource(dev, child, type, rid, r)); +} + DRIVER_MODULE(atkbdc, isa, atkbdc_isa_driver, atkbdc_devclass, 0, 0); DRIVER_MODULE(atkbdc, acpi, atkbdc_isa_driver, atkbdc_devclass, 0, 0); --9amGYk9869ThD9tj--