Пример #1
0
void
nextdma_attach(struct device *parent, struct device *self, void *aux)
{
	struct nextdma_softc *nsc = (struct nextdma_softc *)self;
	struct intio_attach_args *ia = (struct intio_attach_args *)aux;

	if (attached >= nnextdma_channels)
		return;

	nsc->sc_chan = &nextdma_channel[attached];

	nsc->sc_dmat = ia->ia_dmat;
	nsc->sc_bst = ia->ia_bst;

	if (bus_space_map(nsc->sc_bst, nsc->sc_chan->nd_base,
			  nsc->sc_chan->nd_size, 0, &nsc->sc_bsh)) {
		panic("%s: can't map DMA registers for channel %s",
		      nsc->sc_dev.dv_xname, nsc->sc_chan->nd_name);
	}

	nextdma_init (nsc);

	isrlink_autovec(nsc->sc_chan->nd_intrfunc, nsc,
			NEXT_I_IPL(nsc->sc_chan->nd_intr), 10, NULL);
	INTR_ENABLE(nsc->sc_chan->nd_intr);

	printf (": channel %d (%s)\n", attached, 
		nsc->sc_chan->nd_name);
	attached++;

	return;
}
Пример #2
0
void
cbus_attach(struct device *parent, struct device *self, void *args)
{
	struct cbus_softc *sc = (struct cbus_softc *)self;
	struct mainbus_attach_args *ma = args;
	int i;

	for (i = 0; i < NCBUSISR; i++) {
		struct cbus_isr_t *ci = &sc->cbus_isr[i];
		ci->isr_func = NULL;
		ci->isr_arg = NULL;
		ci->isr_intlevel = ci->isr_ipl = -1;
		/* clearing interrupt flags (INT0-INT6) */
		*cbus_isreg = (u_int8_t)(6 - i);
	}
	sc->registered = 0x00;

	/* register C-bus interrupt service routine on mainbus */
	isrlink_autovec(cbus_intr, (void *)self, ma->ma_ilvl,
	    ISRPRI_TTY, self->dv_xname);

	printf("\n");

	for (i = 0; i < sizeof(cbus_devs)/sizeof(cbus_devs[0]); i++)
		config_found(self, &cbus_devs[i], cbus_print);

	return;
}
void
nextdisplay_attach(device_t parent, device_t self, void *aux)
{
	struct nextdisplay_softc *sc = device_private(self);
	struct wsemuldisplaydev_attach_args waa;
	int isconsole;
	int iscolor;
	paddr_t addr;

	if (rom_machine_type == NeXT_WARP9C ||
	    rom_machine_type == NeXT_TURBO_COLOR) {
		iscolor = 1;
		addr = colorbase;
	} else {
		iscolor = 0;
		addr = monobase;
	}

	isconsole = nextdisplay_is_console(addr);
				
	if (isconsole) {
		sc->sc_dc = &nextdisplay_console_dc;
		sc->nscreens = 1;
	} else {
		sc->sc_dc = (struct nextdisplay_config *)
				malloc(sizeof(struct nextdisplay_config), M_DEVBUF, M_WAITOK);
		nextdisplay_init(sc->sc_dc, iscolor);
	}

	printf(": %d x %d, %dbpp\n", sc->sc_dc->dc_wid, sc->sc_dc->dc_ht,
	       sc->sc_dc->dc_depth);

	if (iscolor) {
#if 0
		uint8_t x;

		x = *(volatile uint8_t *)IIOV(NEXT_P_C16_CMD_REG);
		aprint_debug_dev(sc->sc_dev, "cmd=%02x\n", x);
#endif
		*(volatile uint8_t *)IIOV(NEXT_P_C16_CMD_REG) = 0x05;
		isrlink_autovec(nextdisplay_intr, sc, NEXT_I_IPL(NEXT_I_C16_VIDEO), 1, NULL);
		INTR_ENABLE(NEXT_I_C16_VIDEO);
	}

	/* initialize the raster */
	waa.console = isconsole;
	waa.scrdata = iscolor ? &nextdisplay_screenlist_color : &nextdisplay_screenlist_mono;
	waa.accessops = &nextdisplay_accessops;
	waa.accesscookie = sc;
#if 0
	printf("nextdisplay: access cookie is %p\n", sc);
#endif
	config_found(self, &waa, wsemuldisplaydevprint);
}
Пример #4
0
void
spc_mainbus_attach(struct device *parent, struct device *self, void *aux)
{
	struct spc_softc *sc = (void *)self;
	struct mainbus_attach_args *ma = aux;

	printf ("\n");

	sc->sc_iot = &spc_bst;
	sc->sc_ioh = ma->ma_addr;
	sc->sc_initiator = 7;
	sc->sc_dma_start = NULL;
	sc->sc_dma_done = NULL;

	isrlink_autovec(spc_intr, (void *)sc, ma->ma_ilvl, ISRPRI_BIO,
	    self->dv_xname);

	spc_attach(sc, &spc_switch);
}
Пример #5
0
/*
 * Set up the real-time and statistics clocks.  Leave stathz 0 only
 * if no alternative timer is available.
 *
 * The frequencies of these clocks must be an even number of microseconds.
 */
void
cpu_initclocks(void)
{
	int s, cnt;
	volatile struct timer_reg *timer;

	rtc_init();
	hz = 100;
	s = splclock();
	timer = (volatile struct timer_reg *)IIOV(NEXT_P_TIMER);
	cnt = 1000000/hz;          /* usec timer */
	timer->csr = 0;
	timer->msb = (cnt >> 8);
	timer->lsb = cnt;
	timer->csr = TIMER_REG_ENABLE|TIMER_REG_UPDATE;
	isrlink_autovec(clock_intr, NULL, NEXT_I_IPL(NEXT_I_TIMER), 0, NULL);
	INTR_ENABLE(NEXT_I_TIMER);
	splx(s);
}
Пример #6
0
static void
kb_hb_attach(device_t parent, device_t self, void *aux)
{
	struct kb_softc *sc = device_private(self);
	struct hb_attach_args *ha = aux;
	bus_space_tag_t bt = ha->ha_bust;
	bus_space_handle_t bh;
	struct wskbddev_attach_args wsa;
	int ipl;

	sc->sc_dev = self;

	if (bus_space_map(bt, ha->ha_address, KB_SIZE, 0, &bh) != 0) {
		aprint_error(": can't map device space\n");
		return;
	}

	aprint_normal("\n");

	sc->sc_bt = bt;
	sc->sc_bh = bh;
	sc->sc_offset = KB_REG_DATA;
	sc->sc_conssc = &kb_hb_conssc;

	ipl = ha->ha_ipl;
	if (ipl == -1)
		ipl = KB_PRI;

	kb_hb_init(sc);

	isrlink_autovec(kb_hb_intr, (void *)sc, ipl, IPL_TTY);

	wsa.console = kb_hb_conssc.cs_isconsole;
	wsa.keymap = &kb_keymapdata;
	wsa.accessops = &kb_accessops;
	wsa.accesscookie = sc;

	sc->sc_wskbddev = config_found(self, &wsa, wskbddevprint);
}
Пример #7
0
void
sio_attach(struct device *parent, struct device *self, void *aux)
{
	struct sio_softc *sc = (void *)self;
	struct mainbus_attach_args *ma = aux;
	struct sio_attach_args sio_args;
	int channel;
	extern int sysconsole; /* console: 0 for ttya, 1 for desktop */

	printf(": 7201a\n");

	sc->scp_ctl = (caddr_t)ma->ma_addr;
	sc->scp_intr[0] = sc->scp_intr[1] = nullintr;
	for (channel = 0; channel < 2; channel++) {
		sio_args.channel = channel;
		sio_args.hwflags = (channel == sysconsole);
		config_found(self, (void *)&sio_args, sio_print);
	}

	isrlink_autovec(xsiointr, sc, ma->ma_ilvl, ISRPRI_TTYNOBUF,
	    self->dv_xname);
}