/* * mpu_acpi_attach: autoconf(9) attach routine */ static void mpu_acpi_attach(device_t parent, device_t self, void *aux) { struct mpu_acpi_softc *asc = device_private(self); struct mpu_softc *sc = &asc->sc_mpu; struct acpi_attach_args *aa = aux; struct acpi_resources res; struct acpi_io *io; struct acpi_irq *irq; ACPI_STATUS rv; /* parse resources */ rv = acpi_resource_parse(self, aa->aa_node->ad_handle, "_CRS", &res, &acpi_resource_parse_ops_default); if (ACPI_FAILURE(rv)) return; /* find our i/o registers */ io = acpi_res_io(&res, 0); if (io == NULL) { aprint_error_dev(self, "unable to find i/o register resource\n"); goto out; } /* find our IRQ */ irq = acpi_res_irq(&res, 0); if (irq == NULL) { aprint_error_dev(self, "unable to find irq resource\n"); goto out; } sc->iot = aa->aa_iot; if (bus_space_map(sc->iot, io->ar_base, io->ar_length, 0, &sc->ioh)) { aprint_error_dev(self, "can't map i/o space\n"); goto out; } sc->model = "Roland MPU-401 MIDI UART"; sc->sc_dev = self; sc->lock = &asc->sc_lock; mutex_init(&asc->sc_lock, MUTEX_DEFAULT, IPL_AUDIO); mpu_attach(sc); sc->arg = isa_intr_establish(aa->aa_ic, irq->ar_irq, (irq->ar_type == ACPI_EDGE_SENSITIVE) ? IST_EDGE : IST_LEVEL, IPL_AUDIO, mpu_intr, sc); out: acpi_resource_cleanup(&res); }
static void mpu_eso_attach(device_t parent, device_t self, void *aux) { struct eso_softc *esc = device_private(parent); struct mpu_softc *sc = device_private(self); aprint_normal("\n"); sc->ioh = esc->sc_mpu_ioh; sc->iot = esc->sc_mpu_iot; sc->model = "ESO MPU-401 MIDI UART"; sc->sc_dev = self; mpu_attach(sc); }
static void mpu_yds_attach(device_t parent, device_t self, void *aux) { struct yds_softc *ysc = device_private(parent); struct mpu_softc *sc = device_private(self); aprint_normal("\n"); sc->ioh = ysc->sc_mpu_ioh; sc->iot = ysc->sc_mpu_iot; sc->model = "Yamaha DS-1 MIDI UART"; #ifndef AUDIO_NO_POWER_CTL sc->powerctl = 0; #endif sc->lock = &ysc->sc_intr_lock; sc->sc_dev = self; mpu_attach(sc); }