static void bcm2835_plcom_attach(device_t parent, device_t self, void *aux) { struct plcom_softc *sc = device_private(self); struct amba_attach_args *aaa = aux; void *ih; sc->sc_dev = self; sc->sc_frequency = BCM2835_UART0_CLK; sc->sc_hwflags = PLCOM_HW_TXFIFO_DISABLE; sc->sc_swflags = 0; sc->sc_set_mcr = NULL; sc->sc_set_mcr_arg = NULL; sc->sc_pi.pi_type = PLCOM_TYPE_PL011; sc->sc_pi.pi_flags = PLC_FLAG_32BIT_ACCESS; sc->sc_pi.pi_iot = aaa->aaa_iot; sc->sc_pi.pi_iobase = aaa->aaa_addr; if (bus_space_map(aaa->aaa_iot, aaa->aaa_addr, PL011COM_UART_SIZE, 0, &sc->sc_pi.pi_ioh)) { aprint_error_dev(sc->sc_dev, "unable to map device\n"); return; } plcom_attach_subr(sc); ih = bcm2835_intr_establish(aaa->aaa_intr, IPL_SERIAL, plcomintr, sc); if (ih == NULL) panic("%s: cannot install interrupt handler", device_xname(sc->sc_dev)); }
struct bcm_dmac_channel * bcm_dmac_alloc(enum bcm_dmac_type type, int ipl, void (*cb)(void *), void *cbarg) { struct bcm_dmac_softc *sc; struct bcm_dmac_channel *ch = NULL; device_t dev; int index; dev = device_find_by_driver_unit("bcmdmac", 0); if (dev == NULL) return NULL; sc = device_private(dev); mutex_enter(&sc->sc_lock); for (index = 0; index < sc->sc_nchannels; index++) { if ((sc->sc_channelmask & __BIT(index)) == 0) continue; if (DMAC_CHANNEL_TYPE(&sc->sc_channels[index]) != type) continue; if (DMAC_CHANNEL_USED(&sc->sc_channels[index])) continue; ch = &sc->sc_channels[index]; ch->ch_callback = cb; ch->ch_callbackarg = cbarg; break; } mutex_exit(&sc->sc_lock); if (ch == NULL) return NULL; KASSERT(ch->ch_ih == NULL); ch->ch_ih = bcm2835_intr_establish(BCM2835_INT_DMA0 + ch->ch_index, ipl, bcm_dmac_intr, ch); if (ch->ch_ih == NULL) { aprint_error_dev(sc->sc_dev, "failed to establish interrupt for DMA%d\n", ch->ch_index); ch->ch_callback = NULL; ch->ch_callbackarg = NULL; ch = NULL; } return ch; }
static void vchiq_defer(device_t self) { struct vchiq_attach_args vaa; struct vchiq_softc *sc = device_private(self); vchiq_core_initialize(); sc->sc_ih = bcm2835_intr_establish(sc->sc_intr, IPL_VM, vchiq_intr, sc); if (sc->sc_ih == NULL) { aprint_error_dev(self, "failed to establish interrupt %d\n", sc->sc_intr); return; } vchiq_init(); vaa.vaa_name = "AUDS"; config_found_ia(self, "vchiqbus", &vaa, vchiq_print); }