void octohci_attach(struct device *parent, struct device *self, void *aux) { struct octohci_softc *sc = (struct octohci_softc *)self; struct octuctl_attach_args *aa = aux; char *devname; uint64_t port_ctl; int rc; int s; sc->sc_ohci.iot = aa->aa_bust; sc->sc_ohci.sc_bus.pipe_size = sizeof(struct usbd_pipe); sc->sc_ohci.sc_bus.dmatag = aa->aa_dmat; rc = bus_space_map(sc->sc_ohci.iot, UCTL_OHCI_BASE, UCTL_OHCI_SIZE, 0, &sc->sc_ohci.ioh); KASSERT(rc == 0); port_ctl = bus_space_read_8(aa->aa_octuctl_bust, aa->aa_ioh, UCTL_OHCI_CTL); port_ctl &= ~UCTL_OHCI_CTL_L2C_ADDR_MSB_MASK; port_ctl |= (1 << UCTL_OHCI_CTL_L2C_DESC_EMOD_SHIFT); port_ctl |= (1 << UCTL_OHCI_CTL_L2C_BUFF_EMOD_SHIFT); bus_space_write_8(aa->aa_octuctl_bust, aa->aa_ioh, UCTL_OHCI_CTL, port_ctl); s = splusb(); sc->sc_ohci.sc_id_vendor = 0; strlcpy(sc->sc_ohci.sc_vendor, "Octeon", sizeof(sc->sc_ohci.sc_vendor)); sc->sc_ih = octeon_intr_establish(CIU_INT_USB, IPL_USB, ohci_intr, (void *)&sc->sc_ohci, devname); KASSERT(sc->sc_ih != NULL); if ((ohci_checkrev(&sc->sc_ohci) != USBD_NORMAL_COMPLETION) || (ohci_handover(&sc->sc_ohci) != USBD_NORMAL_COMPLETION)) goto failed; /* ignore interrupts for now */ sc->sc_ohci.sc_bus.dying = 1; config_defer(self, octohci_attach_deferred); splx(s); return; failed: octeon_intr_disestablish(sc->sc_ih); bus_space_unmap(sc->sc_ohci.iot, sc->sc_ohci.ioh, UCTL_OHCI_SIZE); splx(s); return; }
void cn30xxuart_attach(struct device *parent, struct device *self, void *aux) { struct com_softc *sc = (void *)self; struct uartbus_attach_args *uba = aux; int console; console = 1; sc->sc_iot = uba->uba_memt; sc->sc_iobase = uba->uba_baseaddr; sc->sc_hwflags = 0; sc->sc_swflags = 0; sc->sc_frequency = curcpu()->ci_hw.clock; sc->sc_uarttype = COM_UART_16550; /* if it's in use as console, it's there. */ if (bus_space_map(sc->sc_iot, sc->sc_iobase, COM_NPORTS, 0, &sc->sc_ioh)) { printf(": can't map uart registers\n"); return; } if (console && !comconsattached) { /* * If we are the console, reuse the existing bus_space * information, so that comcnattach() invokes bus_space_map() * with correct parameters. */ if (comcnattach(sc->sc_iot, sc->sc_iobase, 115200, sc->sc_frequency, (TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8)) panic("can't setup serial console"); } com_attach_subr(sc); octeon_intr_establish(uba->uba_intr, IPL_TTY, comintr, (void *)sc, sc->sc_dev.dv_xname); }
void * octeon_pcibus_pci_intr_establish(void *cookie, pci_intr_handle_t ih, int level, int (*cb)(void *), void *cbarg, char *name) { return octeon_intr_establish(ih, level, cb, cbarg, name); }