Index: sys/dev/acpi/com_acpi.c =================================================================== RCS file: /cvsroot/src/sys/dev/acpi/com_acpi.c,v retrieving revision 1.27 diff -u -p -r1.27 com_acpi.c --- sys/dev/acpi/com_acpi.c 14 Mar 2008 15:09:11 -0000 1.27 +++ sys/dev/acpi/com_acpi.c 26 Jun 2008 14:54:06 -0000 @@ -53,12 +53,20 @@ static void com_acpi_attach(device_t, de struct com_acpi_softc { struct com_softc sc_com; - void *sc_ih; + + isa_chipset_tag_t sc_ic; + int sc_irq; + int sc_ist; }; +extern struct cfdriver com_cd; + CFATTACH_DECL_NEW(com_acpi, sizeof(struct com_acpi_softc), com_acpi_match, com_acpi_attach, NULL, com_activate); +static void com_acpi_intr_establish(struct com_softc *); +static void com_acpi_finish_attach(device_t); + /* * Supported device IDs */ @@ -108,6 +116,7 @@ com_acpi_attach(device_t parent, device_ aprint_normal("\n"); sc->sc_dev = self; + asc->sc_ic = aa->aa_ic; /* parse resources */ rv = acpi_resource_parse(sc->sc_dev, aa->aa_node->ad_handle, "_CRS", @@ -129,6 +138,8 @@ com_acpi_attach(device_t parent, device_ aprint_error_dev(self, "unable to find irq resource\n"); goto out; } + asc->sc_irq = irq->ar_irq; + asc->sc_ist = (irq->ar_type == ACPI_EDGE_SENSITIVE) ? IST_EDGE : IST_LEVEL; if (!com_is_console(aa->aa_iot, io->ar_base, &ioh)) { if (bus_space_map(sc->sc_regs.cr_iot, io->ar_base, io->ar_length, @@ -139,20 +150,15 @@ com_acpi_attach(device_t parent, device_ } COM_INIT_REGS(sc->sc_regs, aa->aa_iot, ioh, io->ar_base); - aprint_normal("%s", device_xname(self)); - if (com_probe_subr(&sc->sc_regs) == 0) { - aprint_error(": com probe failed\n"); + aprint_error_dev(self, "com probe failed\n"); goto out; } sc->sc_frequency = 115200 * 16; - com_attach_subr(sc); - - asc->sc_ih = isa_intr_establish(aa->aa_ic, irq->ar_irq, - (irq->ar_type == ACPI_EDGE_SENSITIVE) ? IST_EDGE : IST_LEVEL, - IPL_SERIAL, comintr, sc); + sc->intr_establish = com_acpi_intr_establish; + config_defer(sc->sc_dev, com_acpi_finish_attach); if (!pmf_device_register(self, NULL, com_resume)) aprint_error_dev(self, "couldn't establish a power handler\n"); @@ -160,3 +166,38 @@ com_acpi_attach(device_t parent, device_ out: acpi_resource_cleanup(&res); } + +static void +com_acpi_intr_establish(struct com_softc *sc) +{ + struct com_acpi_softc *asc; + isa_chipset_tag_t ic = NULL; + void *rv = NULL; + int irq = 0, ist = 0; /* XXX gcc */ + int i; + + for (i = 0; i < com_cd.cd_ndevs; i++) { + asc = device_lookup_private(&com_cd, i); + if (!asc) + continue; + if (&asc->sc_com != sc) + continue; + + irq = asc->sc_irq; + ist = asc->sc_ist; + ic = asc->sc_ic; + break; + } + + if (i < com_cd.cd_ndevs) + rv = isa_intr_establish(ic, irq, ist, IPL_SERIAL, comintr, sc); + if (rv == NULL) + aprint_error_dev(sc->sc_dev, + "unable to establish interrupt\n"); +} + +static void +com_acpi_finish_attach(device_t dev) +{ + com_attach_subr(device_private(dev)); +} Index: sys/dev/ic/com.c =================================================================== RCS file: /cvsroot/src/sys/dev/ic/com.c,v retrieving revision 1.281 diff -u -p -r1.281 com.c --- sys/dev/ic/com.c 28 Apr 2008 22:00:01 -0000 1.281 +++ sys/dev/ic/com.c 26 Jun 2008 14:54:06 -0000 @@ -473,7 +473,7 @@ fifodelay: * printing it until now. */ delay(10); - aprint_normal(": %s\n", fifo_msg); + aprint_normal_dev(sc->sc_dev, "%s\n", fifo_msg); if (ISSET(sc->sc_hwflags, COM_HW_TXFIFO_DISABLE)) { sc->sc_fifolen = 1; aprint_normal_dev(sc->sc_dev, "txfifo disabled\n"); @@ -546,6 +546,9 @@ fifodone: com_config(sc); + if (sc->intr_establish) + (*sc->intr_establish)(sc); + SET(sc->sc_hwflags, COM_HW_DEV_OK); } Index: sys/dev/ic/comvar.h =================================================================== RCS file: /cvsroot/src/sys/dev/ic/comvar.h,v retrieving revision 1.62 diff -u -p -r1.62 comvar.h --- sys/dev/ic/comvar.h 28 Apr 2008 22:00:01 -0000 1.62 +++ sys/dev/ic/comvar.h 26 Jun 2008 14:54:06 -0000 @@ -219,6 +219,8 @@ struct com_softc { rndsource_element_t rnd_source; #endif kmutex_t sc_lock; + + void (*intr_establish)(struct com_softc *); }; int comprobe1(bus_space_tag_t, bus_space_handle_t);