static void attimer_isa_attach(device_t parent, device_t self, void *aux) { struct attimer_softc *sc = device_private(self); struct isa_attach_args *ia = aux; sc->sc_dev = self; sc->sc_iot = ia->ia_iot; aprint_naive("\n"); aprint_normal("\n"); sc->sc_size = 4; if (bus_space_map(sc->sc_iot, IO_TIMER1, sc->sc_size, 0, &sc->sc_ioh) != 0) aprint_error_dev(self, "could not map registers\n"); else attimer_attach(sc); }
/* * attimer_acpi_attach: autoconf(9) attach routine */ static void attimer_acpi_attach(device_t parent, device_t self, void *aux) { struct attimer_softc *sc = device_private(self); struct acpi_attach_args *aa = aux; struct acpi_resources res; struct acpi_io *io; ACPI_STATUS rv; sc->sc_dev = self; aprint_naive(": AT Timer\n"); aprint_normal(": AT Timer\n"); /* parse resources */ rv = acpi_resource_parse(sc->sc_dev, 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; } sc->sc_iot = aa->aa_iot; sc->sc_size = io->ar_length; if (bus_space_map(sc->sc_iot, io->ar_base, sc->sc_size, 0, &sc->sc_ioh) != 0) { aprint_error_dev(self, "can't map i/o space\n"); goto out; } attimer_attach(sc); out: acpi_resource_cleanup(&res); }