static void joy_isapnp_attach(device_t parent, device_t self, void *aux) { struct joy_softc *sc = device_private(self); struct isapnp_attach_args *ipa = aux; bus_space_handle_t ioh; aprint_normal("\n"); if (isapnp_config(ipa->ipa_iot, ipa->ipa_memt, ipa)) { aprint_error_dev(self, "error in region allocation\n"); return; } if (ipa->ipa_io[0].length == 8) { if (bus_space_subregion(ipa->ipa_iot, ipa->ipa_io[0].h, 1, 1, &ioh) < 0) { aprint_error_dev(self, "error in region allocation\n"); return; } } else ioh = ipa->ipa_io[0].h; sc->sc_iot = ipa->ipa_iot; sc->sc_ioh = ioh; sc->sc_dev = self; aprint_normal_dev(self, "%s %s\n", ipa->ipa_devident, ipa->ipa_devclass); joyattach(sc); }
static void joy_eso_attach(device_t parent, device_t self, void *aux) { struct eso_softc *esc = device_private(parent); struct joy_softc *sc = device_private(self); aprint_normal("\n"); sc->sc_ioh = esc->sc_game_ioh; sc->sc_iot = esc->sc_game_iot; sc->sc_dev = self; sc->sc_lock = &esc->sc_lock; joyattach(sc); }
static void joy_isa_attach(device_t parent, device_t self, void *aux) { struct joy_softc *sc = device_private(self); struct isa_attach_args *ia = aux; aprint_normal("\n"); sc->sc_iot = ia->ia_iot; sc->sc_dev = self; if (bus_space_map(sc->sc_iot, ia->ia_io[0].ir_addr, JOY_NPORTS, 0, &sc->sc_ioh)) { aprint_error_dev(self, "can't map i/o space\n"); return; } joyattach(sc); }
static void joy_pci_attach(device_t parent, device_t self, void *aux) { struct joy_softc *sc = device_private(self); struct pci_attach_args *pa = aux; char devinfo[256]; bus_size_t mapsize; int reg; pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo, sizeof(devinfo)); aprint_normal(": %s (rev 0x%02x)\n", devinfo, PCI_REVISION(pa->pa_class)); for (reg = PCI_MAPREG_START; reg < PCI_MAPREG_END; reg += sizeof(pcireg_t)) if (bar_is_io(pa->pa_pc, pa->pa_tag, reg)) break; if (reg >= PCI_MAPREG_END) { aprint_error_dev(self, "violates PCI spec, no IO region found\n"); return; } if (pci_mapreg_map(pa, reg, PCI_MAPREG_TYPE_IO, 0, &sc->sc_iot, &sc->sc_ioh, NULL, &mapsize)) { aprint_error_dev(self, "could not map IO space\n"); return; } if (mapsize != 2) { if (!bus_space_subregion(sc->sc_iot, sc->sc_ioh, 1, 1, &sc->sc_ioh) < 0) { aprint_error_dev(self, "error mapping subregion\n"); return; } } sc->sc_dev = self; joyattach(sc); }