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" ?
> 
> -- 
> k...@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 <g...@unixarea.de> - 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
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);
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Reply via email to