grf_nubus.c revision 1.61 1 /* $NetBSD: grf_nubus.c,v 1.61 2001/01/22 18:23:14 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. 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/param.h>
33
34 #include <sys/device.h>
35 #include <sys/ioctl.h>
36 #include <sys/file.h>
37 #include <sys/malloc.h>
38 #include <sys/mman.h>
39 #include <sys/proc.h>
40 #include <sys/systm.h>
41
42 #include <machine/bus.h>
43 #include <machine/cpu.h>
44 #include <machine/grfioctl.h>
45 #include <machine/viareg.h>
46
47 #include <mac68k/nubus/nubus.h>
48 #include <mac68k/dev/grfvar.h>
49
50 static void load_image_data __P((caddr_t data, struct image_data *image));
51
52 static void grfmv_intr_generic_write1 __P((void *vsc));
53 static void grfmv_intr_generic_write4 __P((void *vsc));
54 static void grfmv_intr_generic_or4 __P((void *vsc));
55
56 static void grfmv_intr_cb264 __P((void *vsc));
57 static void grfmv_intr_cb364 __P((void *vsc));
58 static void grfmv_intr_cmax __P((void *vsc));
59 static void grfmv_intr_cti __P((void *vsc));
60 static void grfmv_intr_radius __P((void *vsc));
61 static void grfmv_intr_radius24 __P((void *vsc));
62 static void grfmv_intr_supermacgfx __P((void *vsc));
63 static void grfmv_intr_lapis __P((void *vsc));
64 static void grfmv_intr_formac __P((void *vsc));
65 static void grfmv_intr_vimage __P((void *vsc));
66 static void grfmv_intr_gvimage __P((void *vsc));
67 static void grfmv_intr_radius_gsc __P((void *vsc));
68 static void grfmv_intr_radius_gx __P((void *vsc));
69
70 static int grfmv_mode __P((struct grf_softc *gp, int cmd, void *arg));
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 bcopy(na->fmt, &sc->sc_slot, sizeof(nubus_slot));
145
146 sc->sc_tag = na->na_tag;
147 sc->card_id = na->drhw;
148 sc->sc_basepa = (bus_addr_t)NUBUS_SLOT2PA(na->slot);
149 sc->sc_fbofs = 0;
150
151 if (bus_space_map(sc->sc_tag, sc->sc_basepa, NBMEMSIZE,
152 0, &sc->sc_handle)) {
153 printf(": grfmv_attach: failed to map slot %d\n", na->slot);
154 return;
155 }
156
157 nubus_get_main_dir(&sc->sc_slot, &dir);
158
159 if (nubus_find_rsrc(sc->sc_tag, sc->sc_handle,
160 &sc->sc_slot, &dir, na->rsrcid, &dirent) <= 0) {
161 bad:
162 bus_space_unmap(sc->sc_tag, sc->sc_handle, NBMEMSIZE);
163 return;
164 }
165
166 nubus_get_dir_from_rsrc(&sc->sc_slot, &dirent, &sc->board_dir);
167
168 if (nubus_find_rsrc(sc->sc_tag, sc->sc_handle,
169 &sc->sc_slot, &sc->board_dir, NUBUS_RSRC_TYPE, &dirent) <= 0)
170 if ((na->rsrcid != 128) ||
171 (nubus_find_rsrc(sc->sc_tag, sc->sc_handle,
172 &sc->sc_slot, &dir, 129, &dirent) <= 0))
173 goto bad;
174
175 mode = NUBUS_RSRC_FIRSTMODE;
176 if (nubus_find_rsrc(sc->sc_tag, sc->sc_handle,
177 &sc->sc_slot, &sc->board_dir, mode, &dirent) <= 0) {
178 printf(": probe failed to get board rsrc.\n");
179 goto bad;
180 }
181
182 nubus_get_dir_from_rsrc(&sc->sc_slot, &dirent, &mode_dir);
183
184 if (nubus_find_rsrc(sc->sc_tag, sc->sc_handle,
185 &sc->sc_slot, &mode_dir, VID_PARAMS, &dirent) <= 0) {
186 printf(": probe failed to get mode dir.\n");
187 goto bad;
188 }
189
190 if (nubus_get_ind_data(sc->sc_tag, sc->sc_handle, &sc->sc_slot,
191 &dirent, (caddr_t)&image_store, sizeof(struct image_data)) <= 0) {
192 printf(": probe failed to get indirect mode data.\n");
193 goto bad;
194 }
195
196 /* Need to load display info (and driver?), etc... (?) */
197
198 load_image_data((caddr_t)&image_store, &image);
199
200 gm = &sc->curr_mode;
201 gm->mode_id = mode;
202 gm->ptype = image.pixelType;
203 gm->psize = image.pixelSize;
204 gm->width = image.right - image.left;
205 gm->height = image.bottom - image.top;
206 gm->rowbytes = image.rowbytes;
207 gm->hres = image.hRes;
208 gm->vres = image.vRes;
209 gm->fbsize = gm->height * gm->rowbytes;
210 gm->fbbase = (caddr_t)(sc->sc_handle.base); /* XXX evil hack */
211 gm->fboff = image.offset;
212
213 strncpy(cardname, nubus_get_card_name(sc->sc_tag, sc->sc_handle,
214 &sc->sc_slot), CARD_NAME_LEN);
215 cardname[CARD_NAME_LEN-1] = '\0';
216 printf(": %s\n", cardname);
217
218 if (sc->card_id == NUBUS_DRHW_TFB) {
219 /*
220 * This is the Toby card, but apparently some manufacturers
221 * (like Cornerstone) didn't bother to get/use their own
222 * value here, even though the cards are different, so we
223 * so we try to differentiate here.
224 */
225 if (strncmp(cardname, "Samsung 768", 11) == 0)
226 sc->card_id = NUBUS_DRHW_SAM768;
227 else if (strncmp(cardname, "Toby frame", 10) != 0)
228 printf("%s: This display card pretends to be a TFB!\n",
229 sc->sc_dev.dv_xname);
230 }
231
232 switch (sc->card_id) {
233 case NUBUS_DRHW_TFB:
234 case NUBUS_DRHW_M2HRVC:
235 case NUBUS_DRHW_PVC:
236 sc->cli_offset = 0xa0000;
237 sc->cli_value = 0;
238 add_nubus_intr(na->slot, grfmv_intr_generic_write1, sc);
239 break;
240 case NUBUS_DRHW_WVC:
241 sc->cli_offset = 0xa00000;
242 sc->cli_value = 0;
243 add_nubus_intr(na->slot, grfmv_intr_generic_write1, sc);
244 break;
245 case NUBUS_DRHW_COLORMAX:
246 add_nubus_intr(na->slot, grfmv_intr_cmax, sc);
247 break;
248 case NUBUS_DRHW_SE30:
249 /* Do nothing--SE/30 interrupts are disabled */
250 break;
251 case NUBUS_DRHW_MDC:
252 sc->cli_offset = 0x200148;
253 sc->cli_value = 1;
254 add_nubus_intr(na->slot, grfmv_intr_generic_write4, sc);
255
256 /* Enable interrupts; to disable, write 0x7 to this location */
257 bus_space_write_4(sc->sc_tag, sc->sc_handle, 0x20013C, 5);
258 break;
259 case NUBUS_DRHW_CB264:
260 add_nubus_intr(na->slot, grfmv_intr_cb264, sc);
261 break;
262 case NUBUS_DRHW_CB364:
263 add_nubus_intr(na->slot, grfmv_intr_cb364, sc);
264 break;
265 case NUBUS_DRHW_RPC8:
266 sc->cli_offset = 0xfdff8f;
267 sc->cli_value = 0xff;
268 add_nubus_intr(na->slot, grfmv_intr_generic_write1, sc);
269 break;
270 case NUBUS_DRHW_RPC8XJ:
271 sc->cli_value = 0x66;
272 add_nubus_intr(na->slot, grfmv_intr_radius, sc);
273 break;
274 case NUBUS_DRHW_RPC24X:
275 case NUBUS_DRHW_BOOGIE:
276 sc->cli_value = 0x64;
277 add_nubus_intr(na->slot, grfmv_intr_radius, sc);
278 break;
279 case NUBUS_DRHW_RPC24XP:
280 add_nubus_intr(na->slot, grfmv_intr_radius24, sc);
281 break;
282 case NUBUS_DRHW_RADGSC:
283 add_nubus_intr(na->slot, grfmv_intr_radius_gsc, sc);
284 break;
285 case NUBUS_DRHW_RDCGX:
286 add_nubus_intr(na->slot, grfmv_intr_radius_gx, sc);
287 break;
288 case NUBUS_DRHW_FIILX:
289 case NUBUS_DRHW_FIISXDSP:
290 case NUBUS_DRHW_FUTURASX:
291 sc->cli_offset = 0xf05000;
292 sc->cli_value = 0x80;
293 add_nubus_intr(na->slot, grfmv_intr_generic_write1, sc);
294 break;
295 case NUBUS_DRHW_SAM768:
296 add_nubus_intr(na->slot, grfmv_intr_cti, sc);
297 break;
298 case NUBUS_DRHW_SUPRGFX:
299 add_nubus_intr(na->slot, grfmv_intr_supermacgfx, sc);
300 break;
301 case NUBUS_DRHW_SPECTRM8:
302 sc->cli_offset = 0x0de178;
303 sc->cli_value = 0x80;
304 add_nubus_intr(na->slot, grfmv_intr_generic_or4, sc);
305 break;
306 case NUBUS_DRHW_LAPIS:
307 add_nubus_intr(na->slot, grfmv_intr_lapis, sc);
308 break;
309 case NUBUS_DRHW_FORMAC:
310 add_nubus_intr(na->slot, grfmv_intr_formac, sc);
311 break;
312 case NUBUS_DRHW_ROPS24LXI:
313 case NUBUS_DRHW_ROPS24XLTV:
314 case NUBUS_DRHW_ROPS24MXTV:
315 sc->cli_offset = 0xfb0010;
316 sc->cli_value = 0x00;
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(gp, cmd, arg)
348 struct grf_softc *gp;
349 int cmd;
350 void *arg;
351 {
352 switch (cmd) {
353 case GM_GRFON:
354 case GM_GRFOFF:
355 return 0;
356 case GM_CURRMODE:
357 break;
358 case GM_NEWMODE:
359 break;
360 case GM_LISTMODES:
361 break;
362 }
363 return EINVAL;
364 }
365
366 /* Interrupt handlers... */
367 /*
368 * Generic routine to clear interrupts for cards where it simply takes
369 * a MOV.B to clear the interrupt. The offset and value of this byte
370 * varies between cards.
371 */
372 /*ARGSUSED*/
373 static void
374 grfmv_intr_generic_write1(vsc)
375 void *vsc;
376 {
377 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
378
379 bus_space_write_1(sc->sc_tag, sc->sc_handle,
380 sc->cli_offset, (u_int8_t)sc->cli_value);
381 }
382
383 /*
384 * Generic routine to clear interrupts for cards where it simply takes
385 * a MOV.L to clear the interrupt. The offset and value of this byte
386 * varies between cards.
387 */
388 /*ARGSUSED*/
389 static void
390 grfmv_intr_generic_write4(vsc)
391 void *vsc;
392 {
393 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
394
395 bus_space_write_4(sc->sc_tag, sc->sc_handle,
396 sc->cli_offset, sc->cli_value);
397 }
398
399 /*
400 * Generic routine to clear interrupts for cards where it simply takes
401 * an OR.L to clear the interrupt. The offset and value of this byte
402 * varies between cards.
403 */
404 /*ARGSUSED*/
405 static void
406 grfmv_intr_generic_or4(vsc)
407 void *vsc;
408 {
409 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
410 unsigned long scratch;
411
412 scratch = bus_space_read_4(sc->sc_tag, sc->sc_handle, sc->cli_offset);
413 scratch |= 0x80;
414 bus_space_write_4(sc->sc_tag, sc->sc_handle, sc->cli_offset, scratch);
415 }
416
417 /*
418 * Routine to clear interrupts for the Radius PrecisionColor 8xj card.
419 */
420 /*ARGSUSED*/
421 static void
422 grfmv_intr_radius(vsc)
423 void *vsc;
424 {
425 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
426 u_int8_t c;
427
428 c = sc->cli_value;
429
430 c |= 0x80;
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 for the Radius PrecisionColor 24Xp card.
438 * Is this what the 8xj routine is doing, too?
439 */
440 /*ARGSUSED*/
441 static void
442 grfmv_intr_radius24(vsc)
443 void *vsc;
444 {
445 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
446 u_int8_t c;
447
448 c = 0x80 | bus_space_read_1(sc->sc_tag, sc->sc_handle, 0xfffd8);
449 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xd00403, c);
450 c &= 0x7f;
451 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xd00403, c);
452 }
453
454 /*
455 * Routine to clear interrupts on Samsung 768x1006 video controller.
456 * This controller was manufactured by Cornerstone Technology, Inc.,
457 * now known as Cornerstone Imaging.
458 *
459 * To clear this interrupt, we apparently have to set, then clear,
460 * bit 2 at byte offset 0x80000 from the card's base.
461 * Information for this provided by Brad Salai <bsalai (at) servtech.com>
462 */
463 /*ARGSUSED*/
464 static void
465 grfmv_intr_cti(vsc)
466 void *vsc;
467 {
468 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
469 u_int8_t c;
470
471 c = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0x80000);
472 c |= 0x02;
473 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x80000, c);
474 c &= 0xfd;
475 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x80000, c);
476 }
477
478 /*ARGSUSED*/
479 static void
480 grfmv_intr_cb264(vsc)
481 void *vsc;
482 {
483 struct grfbus_softc *sc;
484 volatile char *slotbase;
485
486 sc = (struct grfbus_softc *)vsc;
487 slotbase = (volatile char *)(sc->sc_handle.base); /* XXX evil hack */
488 asm volatile(" movl %0,a0
489 movl a0@(0xff6028),d0
490 andl #0x2,d0
491 beq _mv_intr0
492 movql #0x3,d0
493 _mv_intr0:
494 movl a0@(0xff600c),d1
495 andl #0x3,d1
496 cmpl d1,d0
497 beq _mv_intr_fin
498 movl d0,a0@(0xff600c)
499 nop
500 tstb d0
501 beq _mv_intr1
502 movl #0x0002,a0@(0xff6040)
503 movl #0x0102,a0@(0xff6044)
504 movl #0x0105,a0@(0xff6048)
505 movl #0x000e,a0@(0xff604c)
506 movl #0x001c,a0@(0xff6050)
507 movl #0x00bc,a0@(0xff6054)
508 movl #0x00c3,a0@(0xff6058)
509 movl #0x0061,a0@(0xff605c)
510 movl #0x0012,a0@(0xff6060)
511 bra _mv_intr_fin
512 _mv_intr1:
513 movl #0x0002,a0@(0xff6040)
514 movl #0x0209,a0@(0xff6044)
515 movl #0x020c,a0@(0xff6048)
516 movl #0x000f,a0@(0xff604c)
517 movl #0x0027,a0@(0xff6050)
518 movl #0x00c7,a0@(0xff6054)
519 movl #0x00d7,a0@(0xff6058)
520 movl #0x006b,a0@(0xff605c)
521 movl #0x0029,a0@(0xff6060)
522 _mv_intr_fin:
523 movl #0x1,a0@(0xff6014)"
524 : : "g" (slotbase) : "a0","d0","d1");
525 }
526
527 /*
528 * Support for the Colorboard 364 might be more complex than it needs to
529 * be. If we can find more information about this card, this might be
530 * significantly simplified. Contributions welcome... :-)
531 */
532 /*ARGSUSED*/
533 static void
534 grfmv_intr_cb364(vsc)
535 void *vsc;
536 {
537 struct grfbus_softc *sc;
538 volatile char *slotbase;
539
540 sc = (struct grfbus_softc *)vsc;
541 slotbase = (volatile char *)(sc->sc_handle.base); /* XXX evil hack */
542 asm volatile(" movl %0,a0
543 movl a0@(0xfe6028),d0
544 andl #0x2,d0
545 beq _cb364_intr4
546 movql #0x3,d0
547 movl a0@(0xfe6018),d1
548 movl #0x3,a0@(0xfe6018)
549 movw a0@(0xfe7010),d2
550 movl d1,a0@(0xfe6018)
551 movl a0@(0xfe6020),d1
552 btst #0x06,d2
553 beq _cb364_intr0
554 btst #0x00,d1
555 beq _cb364_intr5
556 bsr _cb364_intr1
557 bra _cb364_intr_out
558 _cb364_intr0:
559 btst #0x00,d1
560 bne _cb364_intr5
561 bsr _cb364_intr1
562 bra _cb364_intr_out
563 _cb364_intr1:
564 movl d0,a0@(0xfe600c)
565 nop
566 tstb d0
567 beq _cb364_intr3
568 movl #0x0002,a0@(0xfe6040)
569 movl #0x0105,a0@(0xfe6048)
570 movl #0x000e,a0@(0xfe604c)
571 movl #0x00c3,a0@(0xfe6058)
572 movl #0x0061,a0@(0xfe605c)
573 btst #0x06,d2
574 beq _cb364_intr2
575 movl #0x001c,a0@(0xfe6050)
576 movl #0x00bc,a0@(0xfe6054)
577 movl #0x0012,a0@(0xfe6060)
578 movl #0x000e,a0@(0xfe6044)
579 movl #0x00c3,a0@(0xfe6064)
580 movl #0x0061,a0@(0xfe6020)
581 rts
582 _cb364_intr2:
583 movl #0x0016,a0@(0xfe6050)
584 movl #0x00b6,a0@(0xfe6054)
585 movl #0x0011,a0@(0xfe6060)
586 movl #0x0101,a0@(0xfe6044)
587 movl #0x00bf,a0@(0xfe6064)
588 movl #0x0001,a0@(0xfe6020)
589 rts
590 _cb364_intr3:
591 movl #0x0002,a0@(0xfe6040)
592 movl #0x0209,a0@(0xfe6044)
593 movl #0x020c,a0@(0xfe6048)
594 movl #0x000f,a0@(0xfe604c)
595 movl #0x0027,a0@(0xfe6050)
596 movl #0x00c7,a0@(0xfe6054)
597 movl #0x00d7,a0@(0xfe6058)
598 movl #0x006b,a0@(0xfe605c)
599 movl #0x0029,a0@(0xfe6060)
600 oril #0x0040,a0@(0xfe6064)
601 movl #0x0000,a0@(0xfe6020)
602 rts
603 _cb364_intr4:
604 movq #0x00,d0
605 _cb364_intr5:
606 movl a0@(0xfe600c),d1
607 andl #0x3,d1
608 cmpl d1,d0
609 beq _cb364_intr_out
610 bsr _cb364_intr1
611 _cb364_intr_out:
612 movl #0x1,a0@(0xfe6014)
613 _cb364_intr_quit:
614 " : : "g" (slotbase) : "a0","d0","d1","d2");
615 }
616
617 /*
618 * Interrupt clearing routine for SuperMac GFX card.
619 */
620 /*ARGSUSED*/
621 static void
622 grfmv_intr_supermacgfx(vsc)
623 void *vsc;
624 {
625 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
626 u_int8_t dummy;
627
628 dummy = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0xE70D3);
629 }
630
631 /*
632 * Routine to clear interrupts for the Sigma Designs ColorMax card.
633 */
634 /*ARGSUSED*/
635 static void
636 grfmv_intr_cmax(vsc)
637 void *vsc;
638 {
639 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
640 u_int32_t dummy;
641
642 dummy = bus_space_read_4(sc->sc_tag, sc->sc_handle, 0xf501c);
643 dummy = bus_space_read_4(sc->sc_tag, sc->sc_handle, 0xf5018);
644 }
645
646 /*
647 * Routine to clear interrupts for the Lapis ProColorServer 8 PDS card
648 * (for the SE/30).
649 */
650 /*ARGSUSED*/
651 static void
652 grfmv_intr_lapis(vsc)
653 void *vsc;
654 {
655 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
656
657 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xff7000, 0x08);
658 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xff7000, 0x0C);
659 }
660
661 /*
662 * Routine to clear interrupts for the Formac Color Card II
663 */
664 /*ARGSUSED*/
665 static void
666 grfmv_intr_formac(vsc)
667 void *vsc;
668 {
669 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
670 u_int8_t dummy;
671
672 dummy = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0xde80db);
673 dummy = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0xde80d3);
674 }
675
676 /*
677 * Routine to clear interrupts for the Vimage by Interware Co., Ltd.
678 */
679 /*ARGSUSED*/
680 static void
681 grfmv_intr_vimage(vsc)
682 void *vsc;
683 {
684 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
685
686 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x800000, 0x67);
687 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x800000, 0xE7);
688 }
689
690 /*
691 * Routine to clear interrupts for the Grand Vimage by Interware Co., Ltd.
692 */
693 /*ARGSUSED*/
694 static void
695 grfmv_intr_gvimage(vsc)
696 void *vsc;
697 {
698 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
699 u_int8_t dummy;
700
701 dummy = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0xf00000);
702 }
703
704 /*
705 * Routine to clear interrupts for the Radius GS/C
706 */
707 /*ARGSUSED*/
708 static void
709 grfmv_intr_radius_gsc(vsc)
710 void *vsc;
711 {
712 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
713 u_int8_t dummy;
714
715 dummy = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0xfb802);
716 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xfb802, 0xff);
717 }
718
719 /*
720 * Routine to clear interrupts for the Radius GS/C
721 */
722 /*ARGSUSED*/
723 static void
724 grfmv_intr_radius_gx(vsc)
725 void *vsc;
726 {
727 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
728
729 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x600000, 0x00);
730 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x600000, 0x20);
731 }
732