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