Пример #1
0
void
panel_attach(struct device *parent, struct device *self, void *aux)
{
	struct panel_softc *sc = (struct panel_softc *)self;
	struct hpc_attach_args *haa = aux;

	sc->sc_iot = haa->ha_st;
	if (bus_space_subregion(haa->ha_st, haa->ha_sh, haa->ha_devoff + 3, 1,
	    &sc->sc_ioh)) {
		printf(": can't map registers\n");
		return;
	}

	sc->sc_irq = haa->ha_irq;
	sc->sc_ih = hpc_intr_establish(sc->sc_irq, IPL_BIO, panel_intr, sc,
	    sc->sc_dev.dv_xname);
	if (sc->sc_ih == NULL) {
		printf(": can't establish interrupt\n");
		return;
	}

	if (sys_config.system_subtype == IP22_INDY)
		printf(": power and volume buttons\n");
	else
		printf(": power button\n");

	timeout_set(&sc->sc_repeat_tmo, panel_repeat, sc);
}
Пример #2
0
/*
 * Attach the wdsc driver
 */
void
wdsc_attach(struct device *parent, struct device *self, void *aux)
{
	struct wdsc_softc *wsc = (struct wdsc_softc *)self;
	struct wd33c93_softc *sc = &wsc->sc_wd33c93;
	struct hpc_attach_args *haa = aux;
	int err;

	sc->sc_regt = haa->ha_st;
	wsc->sc_dmat = haa->ha_dmat;

	wsc->sc_hpcdma.hpc = haa->hpc_regs;

	if ((err = bus_space_subregion(haa->ha_st, haa->ha_sh,
	    haa->ha_devoff + 3, 1, &sc->sc_asr_regh)) != 0) {
		printf(": unable to map asr reg, err=%d\n", err);
		return;
	}

	if ((err = bus_space_subregion(haa->ha_st, haa->ha_sh,
	    haa->ha_devoff + 3 + 4,  1, &sc->sc_data_regh)) != 0) {
		printf(": unable to map data reg, err=%d\n", err);
		return;
	}

	if (bus_dmamap_create(wsc->sc_dmat, MAXPHYS,
	    wsc->sc_hpcdma.hpc->scsi_dma_segs,
	    wsc->sc_hpcdma.hpc->scsi_dma_segs_size,
	    wsc->sc_hpcdma.hpc->scsi_dma_segs_size,
	    BUS_DMA_WAITOK, &wsc->sc_dmamap) != 0) {
		printf(": failed to create dmamap\n");
		return;
	}

	sc->sc_dmasetup = wdsc_dmasetup;
	sc->sc_dmago    = wdsc_dmago;
	sc->sc_dmastop  = wdsc_dmastop;
	sc->sc_reset	= wdsc_reset;

	sc->sc_id = 0;					/* Host ID = 0 */
	sc->sc_clkfreq = 200;				/* 20MHz */
	sc->sc_dmamode = SBIC_CTL_BURST_DMA;

	if (hpc_intr_establish(haa->ha_irq, IPL_BIO,
	     wd33c93_intr, wsc, self->dv_xname) == NULL) {
		printf(": unable to establish interrupt!\n");
		return;
	}

	hpcdma_init(haa, &wsc->sc_hpcdma, wsc->sc_hpcdma.hpc->scsi_dma_segs);
	wd33c93_attach(sc, &wdsc_switch);
}
Пример #3
0
void
pckbc_hpc_intr_establish(struct pckbc_softc *sc, pckbc_slot_t slot)
{
	struct pckbc_hpc_softc *msc = (struct pckbc_hpc_softc *)sc;

	if (msc->sc_hasintr)
		return;

	if (hpc_intr_establish(msc->sc_irq, IPL_TTY, pckbcintr, sc,
	    sc->sc_dv.dv_xname) == NULL) {
		printf("%s: unable to establish interrupt for %s slot\n",
		    sc->sc_dv.dv_xname, pckbc_slot_names[slot]);
	} else {
		msc->sc_hasintr = 1;
	}
}
Пример #4
0
void
pckbc_hpc_attach(struct device *parent, struct device * self, void *aux)
{
	struct pckbc_softc *sc = (struct pckbc_softc *)self;
	struct hpc_attach_args *haa = aux;
	struct pckbc_internal *t = NULL;
	bus_space_handle_t ioh_d, ioh_c;
	int console;

	if (hpc_intr_establish(haa->ha_irq, IPL_TTY, pckbcintr, sc,
	    sc->sc_dv.dv_xname) == NULL) {
		printf(": unable to establish interrupt\n");
		return;
	}

	console = pckbc_is_console(haa->ha_st,
	    XKPHYS_TO_PHYS(haa->ha_sh + haa->ha_devoff + 3));

	if (console) {
		/* pckbc_cnattach() has already been called */
		t = &pckbc_consdata;
		pckbc_console_attached = 1;
	} else {
		if (bus_space_subregion(haa->ha_st, haa->ha_sh,
		    haa->ha_devoff + 3 + KBDATAP, 1, &ioh_d) ||
		    bus_space_subregion(haa->ha_st, haa->ha_sh,
		    haa->ha_devoff + 3 + KBCMDP, 1, &ioh_c)) {
			printf(": couldn't map registers\n");
			return;
		}

		t = malloc(sizeof(*t), M_DEVBUF, M_NOWAIT | M_ZERO);
		t->t_iot = haa->ha_st;
		t->t_ioh_c = ioh_c;
		t->t_ioh_d = ioh_d;
	}

	t->t_cmdbyte = KC8_CPU;
	t->t_sc = sc;
	sc->id = t;

	printf("\n");
	pckbc_attach(sc, 0);
}