static void epe_attach(device_t parent, device_t self, void *aux) { struct epe_softc *sc = device_private(self); struct epsoc_attach_args *sa; prop_data_t enaddr; aprint_normal("\n"); sa = aux; sc->sc_dev = self; sc->sc_iot = sa->sa_iot; sc->sc_intr = sa->sa_intr; sc->sc_dmat = sa->sa_dmat; if (bus_space_map(sa->sa_iot, sa->sa_addr, sa->sa_size, 0, &sc->sc_ioh)) panic("%s: Cannot map registers", device_xname(self)); /* Fetch the Ethernet address from property if set. */ enaddr = prop_dictionary_get(device_properties(self), "mac-address"); if (enaddr != NULL) { KASSERT(prop_object_type(enaddr) == PROP_TYPE_DATA); KASSERT(prop_data_size(enaddr) == ETHER_ADDR_LEN); memcpy(sc->sc_enaddr, prop_data_data_nocopy(enaddr), ETHER_ADDR_LEN); bus_space_write_4(sc->sc_iot, sc->sc_ioh, EPE_AFP, 0); bus_space_write_region_1(sc->sc_iot, sc->sc_ioh, EPE_IndAd, sc->sc_enaddr, ETHER_ADDR_LEN); } ep93xx_intr_establish(sc->sc_intr, IPL_NET, epe_intr, sc); epe_init(sc); }
static void epcom_ts_attach(device_t parent, device_t self, void *aux) { struct epcom_ts_softc *esc = device_private(self); struct epcom_softc *sc = &esc->sc_epcom; struct epsoc_attach_args *sa = aux; uint32_t pwrcnt; bus_space_handle_t ioh; sc->sc_dev = self; esc->sc_iot = sa->sa_iot; sc->sc_iot = sa->sa_iot; sc->sc_hwbase = sa->sa_addr; aprint_normal("\n"); bus_space_map(sa->sa_iot, sa->sa_addr, sa->sa_size, 0, &sc->sc_ioh); bus_space_map(sa->sa_iot, EP93XX_APB_HWBASE + EP93XX_APB_SYSCON, EP93XX_APB_SYSCON_SIZE, 0, &ioh); pwrcnt = bus_space_read_4(sa->sa_iot, ioh, EP93XX_SYSCON_PwrCnt); pwrcnt &= ~(PwrCnt_UARTBAUD); bus_space_write_4(sa->sa_iot, ioh, EP93XX_SYSCON_PwrCnt, pwrcnt); bus_space_unmap(sa->sa_iot, ioh, EP93XX_APB_SYSCON_SIZE); epcom_attach_subr(sc); ep93xx_intr_establish(sa->sa_intr, IPL_SERIAL, epcomintr, sc); }