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