Home | History | Annotate | Line # | Download | only in nubus
grf_nubus.c revision 1.40
      1 /*	$NetBSD: grf_nubus.c,v 1.40 1998/04/24 01:58:44 briggs Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1995 Allen Briggs.  All rights reserved.
      5  *
      6  * Redistribution and use in source and binary forms, with or without
      7  * modification, are permitted provided that the following conditions
      8  * are met:
      9  * 1. Redistributions of source code must retain the above copyright
     10  *    notice, this list of conditions and the following disclaimer.
     11  * 2. Redistributions in binary form must reproduce the above copyright
     12  *    notice, this list of conditions and the following disclaimer in the
     13  *    documentation and/or other materials provided with the distribution.
     14  * 3. All advertising materials mentioning features or use of this software
     15  *    must display the following acknowledgement:
     16  *	This product includes software developed by Allen Briggs.
     17  * 4. The name of the author may not be used to endorse or promote products
     18  *    derived from this software without specific prior written permission.
     19  *
     20  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     21  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     22  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     23  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     25  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     26  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     27  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     28  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     29  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     30  */
     31 /*
     32  * Device-specific routines for handling Nubus-based video cards.
     33  */
     34 
     35 #include <sys/param.h>
     36 
     37 #include <sys/device.h>
     38 #include <sys/ioctl.h>
     39 #include <sys/file.h>
     40 #include <sys/malloc.h>
     41 #include <sys/mman.h>
     42 #include <sys/proc.h>
     43 #include <sys/systm.h>
     44 
     45 #include <machine/bus.h>
     46 #include <machine/cpu.h>
     47 #include <machine/grfioctl.h>
     48 #include <machine/viareg.h>
     49 
     50 #include <mac68k/dev/nubus.h>
     51 #include <mac68k/dev/grfvar.h>
     52 
     53 static void	load_image_data __P((caddr_t data, struct image_data *image));
     54 
     55 static void	grfmv_intr_generic_write1 __P((void *vsc, int slot));
     56 static void	grfmv_intr_generic_write4 __P((void *vsc, int slot));
     57 static void	grfmv_intr_generic_or4 __P((void *vsc, int slot));
     58 
     59 static void	grfmv_intr_cb264 __P((void *vsc, int slot));
     60 static void	grfmv_intr_cb364 __P((void *vsc, int slot));
     61 static void	grfmv_intr_cmax __P((void *vsc, int slot));
     62 static void	grfmv_intr_cti __P((void *vsc, int slot));
     63 static void	grfmv_intr_radius __P((void *vsc, int slot));
     64 static void	grfmv_intr_radius24 __P((void *vsc, int slot));
     65 static void	grfmv_intr_supermacgfx __P((void *vsc, int slot));
     66 static void	grfmv_intr_lapis __P((void *vsc, int slot));
     67 static void	grfmv_intr_formac __P((void *vsc, int slot));
     68 
     69 static int	grfmv_mode __P((struct grf_softc *gp, int cmd, void *arg));
     70 static caddr_t	grfmv_phys __P((struct grf_softc *gp));
     71 static int	grfmv_match __P((struct device *, struct cfdata *, void *));
     72 static void	grfmv_attach __P((struct device *, struct device *, void *));
     73 
     74 struct cfattach macvid_ca = {
     75 	sizeof(struct grfbus_softc), grfmv_match, grfmv_attach
     76 };
     77 
     78 static void
     79 load_image_data(data, image)
     80 	caddr_t	data;
     81 	struct	image_data *image;
     82 {
     83 	bcopy(data     , &image->size,       4);
     84 	bcopy(data +  4, &image->offset,     4);
     85 	bcopy(data +  8, &image->rowbytes,   2);
     86 	bcopy(data + 10, &image->top,        2);
     87 	bcopy(data + 12, &image->left,       2);
     88 	bcopy(data + 14, &image->bottom,     2);
     89 	bcopy(data + 16, &image->right,      2);
     90 	bcopy(data + 18, &image->version,    2);
     91 	bcopy(data + 20, &image->packType,   2);
     92 	bcopy(data + 22, &image->packSize,   4);
     93 	bcopy(data + 26, &image->hRes,       4);
     94 	bcopy(data + 30, &image->vRes,       4);
     95 	bcopy(data + 34, &image->pixelType,  2);
     96 	bcopy(data + 36, &image->pixelSize,  2);
     97 	bcopy(data + 38, &image->cmpCount,   2);
     98 	bcopy(data + 40, &image->cmpSize,    2);
     99 	bcopy(data + 42, &image->planeBytes, 4);
    100 }
    101 
    102 
    103 static int
    104 grfmv_match(parent, cf, aux)
    105 	struct device *parent;
    106 	struct cfdata *cf;
    107 	void *aux;
    108 {
    109 	struct nubus_attach_args *na = (struct nubus_attach_args *)aux;
    110 
    111 	if (na->category != NUBUS_CATEGORY_DISPLAY)
    112 		return 0;
    113 
    114 	if (na->type != NUBUS_TYPE_VIDEO)
    115 		return 0;
    116 
    117 	if (na->drsw != NUBUS_DRSW_APPLE)
    118 		return 0;
    119 
    120 	/*
    121 	 * If we've gotten this far, then we're dealing with a real-live
    122 	 * Apple QuickDraw-compatible display card resource.  Now, how to
    123 	 * determine that this is an active resource???  Dunno.  But we'll
    124 	 * proceed like it is.
    125 	 */
    126 
    127 	return 1;
    128 }
    129 
    130 static void
    131 grfmv_attach(parent, self, aux)
    132 	struct device *parent, *self;
    133 	void *aux;
    134 {
    135 	struct grfbus_softc *sc = (struct grfbus_softc *)self;
    136 	struct nubus_attach_args *na = (struct nubus_attach_args *)aux;
    137 	struct image_data image_store, image;
    138 	struct grfmode *gm;
    139 	char cardname[CARD_NAME_LEN];
    140 	nubus_dirent dirent;
    141 	nubus_dir dir, mode_dir;
    142 	int mode;
    143 
    144 	sc->sc_tag = na->na_tag;
    145 	sc->card_id = na->drhw;
    146 
    147 	bcopy(na->fmt, &sc->sc_slot, sizeof(nubus_slot));
    148 
    149 	if (bus_space_map(sc->sc_tag,
    150 	    NUBUS_SLOT2PA(na->slot), NBMEMSIZE, 0, &sc->sc_handle)) {
    151 		printf(": grfmv_attach: failed to map slot %d\n", na->slot);
    152 		return;
    153 	}
    154 
    155 	nubus_get_main_dir(&sc->sc_slot, &dir);
    156 
    157 	if (nubus_find_rsrc(sc->sc_tag, sc->sc_handle,
    158 	    &sc->sc_slot, &dir, na->rsrcid, &dirent) <= 0) {
    159 bad:
    160 		bus_space_unmap(sc->sc_tag, sc->sc_handle, NBMEMSIZE);
    161 		return;
    162 	}
    163 
    164 	nubus_get_dir_from_rsrc(&sc->sc_slot, &dirent, &sc->board_dir);
    165 
    166 	if (nubus_find_rsrc(sc->sc_tag, sc->sc_handle,
    167 	    &sc->sc_slot, &sc->board_dir, NUBUS_RSRC_TYPE, &dirent) <= 0)
    168 		if ((na->rsrcid != 128) ||
    169 		    (nubus_find_rsrc(sc->sc_tag, sc->sc_handle,
    170 		    &sc->sc_slot, &dir, 129, &dirent) <= 0))
    171 			goto bad;
    172 
    173 	mode = NUBUS_RSRC_FIRSTMODE;
    174 	if (nubus_find_rsrc(sc->sc_tag, sc->sc_handle,
    175 	    &sc->sc_slot, &sc->board_dir, mode, &dirent) <= 0) {
    176 		printf(": probe failed to get board rsrc.\n");
    177 		goto bad;
    178 	}
    179 
    180 	nubus_get_dir_from_rsrc(&sc->sc_slot, &dirent, &mode_dir);
    181 
    182 	if (nubus_find_rsrc(sc->sc_tag, sc->sc_handle,
    183 	    &sc->sc_slot, &mode_dir, VID_PARAMS, &dirent) <= 0) {
    184 		printf(": probe failed to get mode dir.\n");
    185 		goto bad;
    186 	}
    187 
    188 	if (nubus_get_ind_data(sc->sc_tag, sc->sc_handle, &sc->sc_slot,
    189 	    &dirent, (caddr_t)&image_store, sizeof(struct image_data)) <= 0) {
    190 		printf(": probe failed to get indirect mode data.\n");
    191 		goto bad;
    192 	}
    193 
    194 	/* Need to load display info (and driver?), etc... (?) */
    195 
    196 	load_image_data((caddr_t)&image_store, &image);
    197 
    198 	gm = &sc->curr_mode;
    199 	gm->mode_id = mode;
    200 	gm->fbbase = (caddr_t)sc->sc_handle; /* XXX evil! */
    201 	gm->fboff = image.offset;
    202 	gm->rowbytes = image.rowbytes;
    203 	gm->width = image.right - image.left;
    204 	gm->height = image.bottom - image.top;
    205 	gm->fbsize = gm->height * gm->rowbytes;
    206 	gm->hres = image.hRes;
    207 	gm->vres = image.vRes;
    208 	gm->ptype = image.pixelType;
    209 	gm->psize = image.pixelSize;
    210 
    211 	strncpy(cardname, nubus_get_card_name(sc->sc_tag, sc->sc_handle,
    212 	    &sc->sc_slot), CARD_NAME_LEN);
    213 	cardname[CARD_NAME_LEN-1] = '\0';
    214 	printf(": %s\n", cardname);
    215 
    216 	if (sc->card_id == NUBUS_DRHW_TFB) {
    217 		/*
    218 		 * This is the Toby card, but apparently some manufacturers
    219 		 * (like Cornerstone) didn't bother to get/use their own
    220 		 * value here, even though the cards are different, so we
    221 		 * so we try to differentiate here.
    222 		 */
    223 		if (strncmp(cardname, "Samsung 768", 11) == 0)
    224 			sc->card_id = NUBUS_DRHW_SAM768;
    225 		else if (strncmp(cardname, "Toby frame", 10) != 0)
    226 			printf("%s: This display card pretends to be a TFB!\n",
    227 			    sc->sc_dev.dv_xname);
    228 	}
    229 
    230 	switch (sc->card_id) {
    231 	case NUBUS_DRHW_TFB:
    232 	case NUBUS_DRHW_M2HRVC:
    233 	case NUBUS_DRHW_PVC:
    234 		sc->cli_offset = 0xa0000;
    235 		sc->cli_value = 0;
    236 		add_nubus_intr(na->slot, grfmv_intr_generic_write1, sc);
    237 		break;
    238 	case NUBUS_DRHW_WVC:
    239 		sc->cli_offset = 0xa00000;
    240 		sc->cli_value = 0;
    241 		add_nubus_intr(na->slot, grfmv_intr_generic_write1, sc);
    242 		break;
    243 	case NUBUS_DRHW_COLORMAX:
    244 		add_nubus_intr(na->slot, grfmv_intr_cmax, sc);
    245 		break;
    246 	case NUBUS_DRHW_SE30:
    247 		/* Do nothing--SE/30 interrupts are disabled */
    248 		break;
    249 	case NUBUS_DRHW_MDC:
    250 		sc->cli_offset = 0x200148;
    251 		sc->cli_value = 1;
    252 		add_nubus_intr(na->slot, grfmv_intr_generic_write4, sc);
    253 
    254 		/* Enable interrupts; to disable, write 0x7 to this location */
    255 		bus_space_write_4(sc->sc_tag, sc->sc_handle, 0x20013C, 5);
    256 		break;
    257 	case NUBUS_DRHW_CB264:
    258 		add_nubus_intr(na->slot, grfmv_intr_cb264, sc);
    259 		break;
    260 	case NUBUS_DRHW_CB364:
    261 		add_nubus_intr(na->slot, grfmv_intr_cb364, sc);
    262 		break;
    263 	case NUBUS_DRHW_RPC8:
    264 		sc->cli_offset = 0xfdff8f;
    265 		sc->cli_value = 0xff;
    266 		add_nubus_intr(na->slot, grfmv_intr_generic_write1, sc);
    267 		break;
    268 	case NUBUS_DRHW_RPC8XJ:
    269 		add_nubus_intr(na->slot, grfmv_intr_radius, sc);
    270 		break;
    271 	case NUBUS_DRHW_RPC24XP:
    272 		add_nubus_intr(na->slot, grfmv_intr_radius24, sc);
    273 		break;
    274 	case NUBUS_DRHW_FIILX:
    275 	case NUBUS_DRHW_FIISXDSP:
    276 	case NUBUS_DRHW_FUTURASX:
    277 		sc->cli_offset = 0xf05000;
    278 		sc->cli_value = 0x80;
    279 		add_nubus_intr(na->slot, grfmv_intr_generic_write1, sc);
    280 		break;
    281 	case NUBUS_DRHW_SAM768:
    282 		add_nubus_intr(na->slot, grfmv_intr_cti, sc);
    283 		break;
    284 	case NUBUS_DRHW_SUPRGFX:
    285 		add_nubus_intr(na->slot, grfmv_intr_supermacgfx, sc);
    286 		break;
    287 	case NUBUS_DRHW_SPECTRM8:
    288 		sc->cli_offset = 0x0de178;
    289 		sc->cli_value = 0x80;
    290 		add_nubus_intr(na->slot, grfmv_intr_generic_or4, sc);
    291 		break;
    292 	case NUBUS_DRHW_LAPIS:
    293 		add_nubus_intr(na->slot, grfmv_intr_lapis, sc);
    294 		break;
    295 	case NUBUS_DRHW_FORMAC:
    296 		add_nubus_intr(na->slot, grfmv_intr_formac, sc);
    297 		break;
    298 	case NUBUS_DRHW_MICRON:
    299 		/* What do we know about this one? */
    300 	default:
    301 		printf("%s: Unknown video card ID 0x%x --",
    302 		    sc->sc_dev.dv_xname, sc->card_id);
    303 		printf(" Not installing interrupt routine.\n");
    304 		break;
    305 	}
    306 
    307 	/* Perform common video attachment. */
    308 	grf_establish(sc, &sc->sc_slot, grfmv_mode, grfmv_phys);
    309 }
    310 
    311 static int
    312 grfmv_mode(gp, cmd, arg)
    313 	struct grf_softc *gp;
    314 	int cmd;
    315 	void *arg;
    316 {
    317 	switch (cmd) {
    318 	case GM_GRFON:
    319 	case GM_GRFOFF:
    320 		return 0;
    321 	case GM_CURRMODE:
    322 		break;
    323 	case GM_NEWMODE:
    324 		break;
    325 	case GM_LISTMODES:
    326 		break;
    327 	}
    328 	return EINVAL;
    329 }
    330 
    331 static caddr_t
    332 grfmv_phys(gp)
    333 	struct grf_softc *gp;
    334 {
    335 	return (caddr_t)NUBUS_SLOT2PA(gp->sc_slot->slot);
    336 }
    337 
    338 /* Interrupt handlers... */
    339 /*
    340  * Generic routine to clear interrupts for cards where it simply takes
    341  * a MOV.B to clear the interrupt.  The offset and value of this byte
    342  * varies between cards.
    343  */
    344 /*ARGSUSED*/
    345 static void
    346 grfmv_intr_generic_write1(vsc, slot)
    347 	void	*vsc;
    348 	int	slot;
    349 {
    350 	struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
    351 
    352 	bus_space_write_1(sc->sc_tag, sc->sc_handle,
    353 	    sc->cli_offset, (u_int8_t)sc->cli_value);
    354 }
    355 
    356 /*
    357  * Generic routine to clear interrupts for cards where it simply takes
    358  * a MOV.L to clear the interrupt.  The offset and value of this byte
    359  * varies between cards.
    360  */
    361 /*ARGSUSED*/
    362 static void
    363 grfmv_intr_generic_write4(vsc, slot)
    364 	void	*vsc;
    365 	int	slot;
    366 {
    367 	struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
    368 
    369 	bus_space_write_4(sc->sc_tag, sc->sc_handle,
    370 	    sc->cli_offset, sc->cli_value);
    371 }
    372 
    373 /*
    374  * Generic routine to clear interrupts for cards where it simply takes
    375  * an OR.L to clear the interrupt.  The offset and value of this byte
    376  * varies between cards.
    377  */
    378 /*ARGSUSED*/
    379 static void
    380 grfmv_intr_generic_or4(vsc, slot)
    381 	void	*vsc;
    382 	int	slot;
    383 {
    384 	struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
    385 	unsigned long	scratch;
    386 
    387 	scratch = bus_space_read_4(sc->sc_tag, sc->sc_handle, sc->cli_offset);
    388 	scratch |= 0x80;
    389 	bus_space_write_4(sc->sc_tag, sc->sc_handle, sc->cli_offset, scratch);
    390 }
    391 
    392 /*
    393  * Routine to clear interrupts for the Radius PrecisionColor 8xj card.
    394  */
    395 /*ARGSUSED*/
    396 static void
    397 grfmv_intr_radius(vsc, slot)
    398 	void	*vsc;
    399 	int	slot;
    400 {
    401 	struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
    402 	u_int8_t c;
    403 
    404 	/*
    405 	 * The value 0x66 was the observed value on one	card.  It is read
    406 	 * from the driver's information block, so this may not be sufficient.
    407 	 * Then again, we're not setting up any other interrupts...
    408 	 */
    409 	c = 0x66;
    410 
    411 	c |= 0x80;
    412 	bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xd00403, c);
    413 	c &= 0x7f;
    414 	bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xd00403, c);
    415 }
    416 
    417 /*
    418  * Routine to clear interrupts for the Radius PrecisionColor 24Xp card.
    419  * Is this what the 8xj routine is doing, too?
    420  */
    421 /*ARGSUSED*/
    422 static void
    423 grfmv_intr_radius24(vsc, slot)
    424 	void	*vsc;
    425 	int	slot;
    426 {
    427 	struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
    428 	u_int8_t c;
    429 
    430 	c = 0x80 | bus_space_read_1(sc->sc_tag, sc->sc_handle, 0xfffd8);
    431 	bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xd00403, c);
    432 	c &= 0x7f;
    433 	bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xd00403, c);
    434 }
    435 
    436 /*
    437  * Routine to clear interrupts on Samsung 768x1006 video controller.
    438  * This controller was manufactured by Cornerstone Technology, Inc.,
    439  * now known as Cornerstone Imaging.
    440  *
    441  * To clear this interrupt, we apparently have to set, then clear,
    442  * bit 2 at byte offset 0x80000 from the card's base.
    443  *	Information for this provided by Brad Salai <bsalai (at) servtech.com>
    444  */
    445 /*ARGSUSED*/
    446 static void
    447 grfmv_intr_cti(vsc, slot)
    448 	void	*vsc;
    449 	int	slot;
    450 {
    451 	struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
    452 	u_int8_t c;
    453 
    454 	c = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0x80000);
    455 	c |= 0x02;
    456 	bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x80000, c);
    457 	c &= 0xfd;
    458 	bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x80000, c);
    459 }
    460 
    461 /*ARGSUSED*/
    462 static void
    463 grfmv_intr_cb264(vsc, slot)
    464 	void	*vsc;
    465 	int	slot;
    466 {
    467 	struct grfbus_softc *sc;
    468 	volatile char *slotbase;
    469 
    470 	sc = (struct grfbus_softc *)vsc;
    471 	slotbase = (volatile char *)sc->sc_handle;	/* XXX evil hack */
    472 	asm volatile("	movl	%0,a0
    473 			movl	a0@(0xff6028),d0
    474 			andl	#0x2,d0
    475 			beq	_mv_intr0
    476 			movql	#0x3,d0
    477 		_mv_intr0:
    478 			movl	a0@(0xff600c),d1
    479 			andl	#0x3,d1
    480 			cmpl	d1,d0
    481 			beq	_mv_intr_fin
    482 			movl	d0,a0@(0xff600c)
    483 			nop
    484 			tstb	d0
    485 			beq	_mv_intr1
    486 			movl	#0x0002,a0@(0xff6040)
    487 			movl	#0x0102,a0@(0xff6044)
    488 			movl	#0x0105,a0@(0xff6048)
    489 			movl	#0x000e,a0@(0xff604c)
    490 			movl	#0x001c,a0@(0xff6050)
    491 			movl	#0x00bc,a0@(0xff6054)
    492 			movl	#0x00c3,a0@(0xff6058)
    493 			movl	#0x0061,a0@(0xff605c)
    494 			movl	#0x0012,a0@(0xff6060)
    495 			bra	_mv_intr_fin
    496 		_mv_intr1:
    497 			movl	#0x0002,a0@(0xff6040)
    498 			movl	#0x0209,a0@(0xff6044)
    499 			movl	#0x020c,a0@(0xff6048)
    500 			movl	#0x000f,a0@(0xff604c)
    501 			movl	#0x0027,a0@(0xff6050)
    502 			movl	#0x00c7,a0@(0xff6054)
    503 			movl	#0x00d7,a0@(0xff6058)
    504 			movl	#0x006b,a0@(0xff605c)
    505 			movl	#0x0029,a0@(0xff6060)
    506 		_mv_intr_fin:
    507 			movl	#0x1,a0@(0xff6014)"
    508 		: : "g" (slotbase) : "a0","d0","d1");
    509 }
    510 
    511 /*
    512  * Support for the Colorboard 364 might be more complex than it needs to
    513  * be.  If we can find more information about this card, this might be
    514  * significantly simplified.  Contributions welcome...  :-)
    515  */
    516 /*ARGSUSED*/
    517 static void
    518 grfmv_intr_cb364(vsc, slot)
    519 	void	*vsc;
    520 	int	slot;
    521 {
    522 	struct grfbus_softc *sc;
    523 	volatile char *slotbase;
    524 
    525 	sc = (struct grfbus_softc *)vsc;
    526 	slotbase = (volatile char *)sc->sc_handle;	/* XXX evil hack */
    527 	asm volatile("	movl	%0,a0
    528 			movl	a0@(0xfe6028),d0
    529 			andl	#0x2,d0
    530 			beq	_cb364_intr4
    531 			movql	#0x3,d0
    532 			movl	a0@(0xfe6018),d1
    533 			movl	#0x3,a0@(0xfe6018)
    534 			movw	a0@(0xfe7010),d2
    535 			movl	d1,a0@(0xfe6018)
    536 			movl	a0@(0xfe6020),d1
    537 			btst	#0x06,d2
    538 			beq	_cb364_intr0
    539 			btst	#0x00,d1
    540 			beq	_cb364_intr5
    541 			bsr	_cb364_intr1
    542 			bra	_cb364_intr_out
    543 		_cb364_intr0:
    544 			btst	#0x00,d1
    545 			bne	_cb364_intr5
    546 			bsr	_cb364_intr1
    547 			bra	_cb364_intr_out
    548 		_cb364_intr1:
    549 			movl	d0,a0@(0xfe600c)
    550 			nop
    551 			tstb	d0
    552 			beq	_cb364_intr3
    553 			movl	#0x0002,a0@(0xfe6040)
    554 			movl	#0x0105,a0@(0xfe6048)
    555 			movl	#0x000e,a0@(0xfe604c)
    556 			movl	#0x00c3,a0@(0xfe6058)
    557 			movl	#0x0061,a0@(0xfe605c)
    558 			btst	#0x06,d2
    559 			beq	_cb364_intr2
    560 			movl	#0x001c,a0@(0xfe6050)
    561 			movl	#0x00bc,a0@(0xfe6054)
    562 			movl	#0x0012,a0@(0xfe6060)
    563 			movl	#0x000e,a0@(0xfe6044)
    564 			movl	#0x00c3,a0@(0xfe6064)
    565 			movl	#0x0061,a0@(0xfe6020)
    566 			rts
    567 		_cb364_intr2:
    568 			movl	#0x0016,a0@(0xfe6050)
    569 			movl	#0x00b6,a0@(0xfe6054)
    570 			movl	#0x0011,a0@(0xfe6060)
    571 			movl	#0x0101,a0@(0xfe6044)
    572 			movl	#0x00bf,a0@(0xfe6064)
    573 			movl	#0x0001,a0@(0xfe6020)
    574 			rts
    575 		_cb364_intr3:
    576 			movl	#0x0002,a0@(0xfe6040)
    577 			movl	#0x0209,a0@(0xfe6044)
    578 			movl	#0x020c,a0@(0xfe6048)
    579 			movl	#0x000f,a0@(0xfe604c)
    580 			movl	#0x0027,a0@(0xfe6050)
    581 			movl	#0x00c7,a0@(0xfe6054)
    582 			movl	#0x00d7,a0@(0xfe6058)
    583 			movl	#0x006b,a0@(0xfe605c)
    584 			movl	#0x0029,a0@(0xfe6060)
    585 			oril	#0x0040,a0@(0xfe6064)
    586 			movl	#0x0000,a0@(0xfe6020)
    587 			rts
    588 		_cb364_intr4:
    589 			movq	#0x00,d0
    590 		_cb364_intr5:
    591 			movl	a0@(0xfe600c),d1
    592 			andl	#0x3,d1
    593 			cmpl	d1,d0
    594 			beq	_cb364_intr_out
    595 			bsr	_cb364_intr1
    596 		_cb364_intr_out:
    597 			movl	#0x1,a0@(0xfe6014)
    598 		_cb364_intr_quit:
    599 		" : : "g" (slotbase) : "a0","d0","d1","d2");
    600 }
    601 
    602 /*
    603  * Interrupt clearing routine for SuperMac GFX card.
    604  */
    605 /*ARGSUSED*/
    606 static void
    607 grfmv_intr_supermacgfx(vsc, slot)
    608 	void	*vsc;
    609 	int	slot;
    610 {
    611 	struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
    612 	u_int8_t dummy;
    613 
    614 	dummy = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0xE70D3);
    615 }
    616 
    617 /*
    618  * Routine to clear interrupts for the Sigma Designs ColorMax card.
    619  */
    620 /*ARGSUSED*/
    621 static void
    622 grfmv_intr_cmax(vsc, slot)
    623 	void	*vsc;
    624 	int	slot;
    625 {
    626 	struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
    627 	u_int32_t dummy;
    628 
    629 	dummy = bus_space_read_4(sc->sc_tag, sc->sc_handle, 0xf501c);
    630 	dummy = bus_space_read_4(sc->sc_tag, sc->sc_handle, 0xf5018);
    631 }
    632 
    633 /*
    634  * Routine to clear interrupts for the Lapis ProColorServer 8 PDS card
    635  * (for the SE/30).
    636  */
    637 /*ARGSUSED*/
    638 static void
    639 grfmv_intr_lapis(vsc, slot)
    640 	void	*vsc;
    641 	int	slot;
    642 {
    643 	struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
    644 
    645 	bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xff7000, 0x08);
    646 	bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xff7000, 0x0C);
    647 }
    648 
    649 /*
    650  * Routine to clear interrupts for the Formac Color Card II
    651  */
    652 /*ARGSUSED*/
    653 static void
    654 grfmv_intr_formac(vsc, slot)
    655 	void	*vsc;
    656 	int	slot;
    657 {
    658 	struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
    659 	u_int8_t dummy;
    660 
    661 	dummy = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0xde80db);
    662 	dummy = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0xde80d3);
    663 }
    664