static void pckbc_ebus_attach(device_t parent, device_t self, void *aux) { struct pckbc_js_softc *jsc = device_private(self); struct ebus_attach_args *ea = aux; bus_space_tag_t iot; bus_addr_t ioaddr; int intr; int stdin_node, node; int isconsole; jsc->jsc_pckbc.sc_dv = self; iot = ea->ea_bustag; ioaddr = EBUS_ADDR_FROM_REG(&ea->ea_reg[0]); intr = ea->ea_nintr ? ea->ea_intr[0] : /* line */ 0; /* search children of "8042" node for stdin (keyboard) */ stdin_node = prom_instance_to_package(prom_stdin()); isconsole = 0; for (node = prom_firstchild(ea->ea_node); node != 0; node = prom_nextsibling(node)) if (node == stdin_node) { isconsole = 1; break; } pckbc_js_attach_common(jsc, iot, ioaddr, intr, isconsole); }
void pldwdog_attach(device_t parent, device_t self, void *aux) { struct pldwdog_softc *sc = device_private(self); struct ebus_attach_args *ea = aux; printf("\n"); sc->sc_dev = self; sc->sc_btag = ea->ea_bustag; if (ea->ea_nreg < 1) { printf(": no registers??\n"); return; } if (ea->ea_nvaddr) sparc_promaddr_to_handle(sc->sc_btag, ea->ea_vaddr[0], &sc->sc_bh); else if (bus_space_map(sc->sc_btag, EBUS_ADDR_FROM_REG(&ea->ea_reg[0]), ea->ea_reg[0].size, 0, &sc->sc_bh) != 0) { printf(": can't map register space\n"); return; } sc->sc_wdog_period = PLD_WDOG_PERIOD_DEFAULT; sc->sc_smw.smw_name = device_xname(sc->sc_dev); sc->sc_smw.smw_cookie = sc; sc->sc_smw.smw_setmode = pldwdog_setmode; sc->sc_smw.smw_tickle = pldwdog_tickle; sc->sc_smw.smw_period = sc->sc_wdog_period; if (sysmon_wdog_register(&sc->sc_smw) != 0) aprint_error_dev(sc->sc_dev, "unable to register with sysmon\n"); /* pldwdog_regs(sc); */ #if 0 bus_intr_establish(ea->ea_bustag, ea->ea_intr[0], IPL_TTY, pldwdog_intr, sc); #endif }
static int com_ebus_match(device_t parent, cfdata_t cf, void *aux) { struct ebus_attach_args *ea = aux; bus_space_handle_t ioh; int match; if (strcmp(ea->ea_name, "su") != 0) return (0); match = 0; if (bus_space_map(ea->ea_bustag, EBUS_ADDR_FROM_REG(&ea->ea_reg[0]), ea->ea_reg[0].size, 0, &ioh) == 0) { match = comprobe1(ea->ea_bustag, ioh); bus_space_unmap(ea->ea_bustag, ioh, ea->ea_reg[0].size); } return (match); }
static void com_ebus_attach(device_t parent, device_t self, void *aux) { struct com_ebus_softc *ebsc = device_private(self); struct com_softc *sc = &ebsc->ebsc_com; struct ebus_attach_args *ea = aux; bus_space_tag_t iot; bus_space_handle_t ioh; bus_addr_t iobase; sc->sc_dev = self; iot = ea->ea_bustag; iobase = EBUS_ADDR_FROM_REG(&ea->ea_reg[0]); sc->sc_frequency = COM_FREQ; sc->sc_hwflags = COM_HW_NO_TXPRELOAD; /* * XXX: It would be nice to be able to split console input and * output to different devices. For now switch to serial * console if PROM stdin is on serial (so that we can use DDB). */ if (prom_instance_to_package(prom_stdin()) == ea->ea_node) comcnattach(iot, iobase, B9600, sc->sc_frequency, COM_TYPE_NORMAL, (CLOCAL | CREAD | CS8)); if (!com_is_console(iot, iobase, &ioh) && bus_space_map(iot, iobase, ea->ea_reg[0].size, 0, &ioh) != 0) { aprint_error(": unable to map device registers\n"); return; } COM_INIT_REGS(sc->sc_regs, iot, ioh, iobase); com_attach_subr(sc); if (ea->ea_nintr != 0) (void)bus_intr_establish(iot, ea->ea_intr[0], IPL_SERIAL, comintr, sc); }
void lpt_ebus_attach(device_t parent, device_t self, void *aux) { struct lpt_softc *sc = device_private(self); struct ebus_attach_args *ea = aux; int i; sc->sc_dev = self; sc->sc_iot = ea->ea_bustag; /* * Addresses that should be supplied by the prom: * - normal lpt registers * - ns873xx configuration registers * - DMA space * The `lpt' driver does not use DMA accesses, so we can * ignore that for now. We should enable the lpt port in * the ns873xx registers here. XXX * * Use the prom address if there. */ if (ea->ea_nvaddr) sparc_promaddr_to_handle(sc->sc_iot, ea->ea_vaddr[0], &sc->sc_ioh); else if (bus_space_map(sc->sc_iot, EBUS_ADDR_FROM_REG(&ea->ea_reg[0]), ea->ea_reg[0].size, 0, &sc->sc_ioh) != 0) { aprint_error(": can't map register space\n"); return; } for (i = 0; i < ea->ea_nintr; i++) bus_intr_establish(ea->ea_bustag, ea->ea_intr[i], IPL_SERIAL, lptintr, sc); aprint_normal("\n"); lpt_attach_subr(sc); }
void sab_attach(struct device *parent, struct device *self, void *aux) { struct sab_softc *sc = (struct sab_softc *)self; struct ebus_attach_args *ea = aux; uint8_t r; u_int i; int locs[SABCF_NLOCS]; sc->sc_bt = ea->ea_bustag; sc->sc_node = ea->ea_node; /* Use prom mapping, if available. */ if (ea->ea_nvaddr) sparc_promaddr_to_handle(sc->sc_bt, ea->ea_vaddr[0], &sc->sc_bh); else if (bus_space_map(sc->sc_bt, EBUS_ADDR_FROM_REG(&ea->ea_reg[0]), ea->ea_reg[0].size, 0, &sc->sc_bh) != 0) { printf(": can't map register space\n"); return; } sc->sc_ih = bus_intr_establish(ea->ea_bustag, ea->ea_intr[0], IPL_TTY, sab_intr, sc); if (sc->sc_ih == NULL) { printf(": can't map interrupt\n"); return; } sc->sc_softintr = softint_establish(SOFTINT_SERIAL, sab_softintr, sc); if (sc->sc_softintr == NULL) { printf(": can't get soft intr\n"); return; } aprint_normal(": rev "); r = SAB_READ(sc, SAB_VSTR) & SAB_VSTR_VMASK; switch (r) { case SAB_VSTR_V_1: aprint_normal("1"); break; case SAB_VSTR_V_2: aprint_normal("2"); break; case SAB_VSTR_V_32: aprint_normal("3.2"); break; default: aprint_normal("unknown(0x%x)", r); break; } aprint_normal("\n"); /* Let current output drain */ DELAY(100000); /* Set all pins, except DTR pins to be inputs */ SAB_WRITE(sc, SAB_PCR, ~(SAB_PVR_DTR_A | SAB_PVR_DTR_B)); /* Disable port interrupts */ SAB_WRITE(sc, SAB_PIM, 0xff); SAB_WRITE(sc, SAB_PVR, SAB_PVR_DTR_A | SAB_PVR_DTR_B | SAB_PVR_MAGIC); SAB_WRITE(sc, SAB_IPC, SAB_IPC_ICPL); for (i = 0; i < SAB_NCHAN; i++) { struct sabtty_attach_args stax; stax.sbt_portno = i; locs[SABCF_CHANNEL] = i; sc->sc_child[i] = (struct sabtty_softc *)config_found_sm_loc(self, "sab", locs, &stax, sab_print, config_stdsubmatch); if (sc->sc_child[i] != NULL) sc->sc_nchild++; } }