void ti_sbus_attach(struct device *parent, struct device *self, void *aux) { struct confargs *ca = aux; struct ti_sbus_softc *tsc = (void *)self; struct ti_softc *sc = &tsc->tsc_sc; bus_space_handle_t ioh; /* Pass on the bus tags */ tsc->tsc_rr = ca->ca_ra.ra_reg[1]; sc->ti_btag = &tsc->tsc_rr; sc->sc_dmatag = iommu_dmatag; if (ca->ca_ra.ra_nintr < 1) { printf(": no interrupt\n"); return; } if (ca->ca_ra.ra_nreg < 2) { printf(": only %d register sets\n", ca->ca_ra.ra_nreg); return; } if (bus_space_map(&ca->ca_ra.ra_reg[1], 0, ca->ca_ra.ra_reg[1].rr_len, 0, &sc->ti_bhandle)) { printf(": can't map registers\n"); return; } if (bus_space_map(&ca->ca_ra.ra_reg[0], 0, ca->ca_ra.ra_reg[0].rr_len, 0, &ioh)) { printf(": can't map registers\n"); goto fail; } tsc->tsc_ih.ih_fun = ti_intr; tsc->tsc_ih.ih_arg = sc; intr_establish(ca->ca_ra.ra_intr[0].int_pri, &tsc->tsc_ih, IPL_NET, self->dv_xname); bus_space_write_4(sc->ti_btag, ioh, TI_PCI_CMDSTAT, 0x02000006); bus_space_write_4(sc->ti_btag, ioh, TI_PCI_BIST, 0xffffffff); bus_space_write_4(sc->ti_btag, ioh, TI_PCI_LOMEM, 0x00000400); bus_space_unmap(&ca->ca_ra.ra_reg[0], ioh, ca->ca_ra.ra_reg[0].rr_len); sc->ti_sbus = 1; if (ti_attach(sc) == 0) return; fail: bus_space_unmap(&ca->ca_ra.ra_reg[1], sc->ti_bhandle, ca->ca_ra.ra_reg[1].rr_len); }
void ti_sbus_attach(struct device *parent, struct device *self, void *aux) { struct sbus_attach_args *sa = aux; struct ti_sbus_softc *tsc = (void *)self; struct ti_softc *sc = &tsc->tsc_sc; bus_space_handle_t ioh; /* Pass on the bus tags */ sc->ti_btag = sa->sa_bustag; sc->sc_dmatag = sa->sa_dmatag; if (sa->sa_nintr < 1) { printf(": no interrupt\n"); return; } if (sa->sa_nreg < 2) { printf(": only %d register sets\n", sa->sa_nreg); return; } if (sbus_bus_map(sa->sa_bustag, sa->sa_reg[1].sbr_slot, sa->sa_reg[1].sbr_offset, sa->sa_reg[1].sbr_size, 0, 0, &sc->ti_bhandle)) { printf(": can't map registers\n"); return; } if (sbus_bus_map(sa->sa_bustag, sa->sa_reg[0].sbr_slot, sa->sa_reg[0].sbr_offset, sa->sa_reg[0].sbr_size, 0, 0, &ioh)) { printf(": can't map registers\n"); goto unmap; } bus_intr_establish(sa->sa_bustag, sa->sa_pri, IPL_NET, 0, ti_intr, sc, self->dv_xname); bus_space_write_4(sa->sa_bustag, ioh, TI_PCI_CMDSTAT, 0x02000006); bus_space_write_4(sa->sa_bustag, ioh, TI_PCI_BIST, 0xffffffff); bus_space_write_4(sa->sa_bustag, ioh, TI_PCI_LOMEM, 0x00000400); bus_space_unmap(sa->sa_bustag, ioh, sa->sa_reg[0].sbr_size); sc->ti_sbus = 1; if (ti_attach(sc) == 0) return; unmap: bus_space_unmap(sa->sa_bustag, sc->ti_bhandle, sa->sa_reg[1].sbr_size); }
void ti_pci_attach(struct device *parent, struct device *self, void *aux) { struct ti_softc *sc = (struct ti_softc *)self; struct pci_attach_args *pa = aux; pci_chipset_tag_t pc = pa->pa_pc; pci_intr_handle_t ih; const char *intrstr = NULL; bus_size_t size; /* * Map control/status registers. */ if (pci_mapreg_map(pa, TI_PCI_LOMEM, PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT, 0, &sc->ti_btag, &sc->ti_bhandle, NULL, &size, 0)) { printf(": can't map registers\n"); return; } sc->sc_dmatag = pa->pa_dmat; if (pci_intr_map(pa, &ih)) { printf(": can't map interrupt\n"); goto unmap; } intrstr = pci_intr_string(pc, ih); sc->ti_intrhand = pci_intr_establish(pc, ih, IPL_NET, ti_intr, sc, self->dv_xname); if (sc->ti_intrhand == NULL) { printf(": can't establish interrupt"); if (intrstr != NULL) printf(" at %s", intrstr); printf("\n"); goto unmap; } printf(": %s", intrstr); /* * We really need a better way to tell a 1000baseTX card * from a 1000baseSX one, since in theory there could be * OEMed 1000baseTX cards from lame vendors who aren't * clever enough to change the PCI ID. For the moment * though, the AceNIC is the only copper card available. */ if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_ALTEON && PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ALTEON_ACENICT) sc->ti_copper = 1; /* Ok, it's not the only copper card available */ if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_NETGEAR && PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_NETGEAR_GA620T) sc->ti_copper = 1; if (ti_attach(sc) == 0) return; pci_intr_disestablish(pc, sc->ti_intrhand); unmap: bus_space_unmap(sc->ti_btag, sc->ti_bhandle, size); }