grf_nubus.c revision 1.64 1 /* $NetBSD: grf_nubus.c,v 1.64 2002/05/30 21:36:38 thorpej 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_ROPSPPGT:
320 sc->cli_offset = 0xf50010;
321 sc->cli_value = 0x02;
322 add_nubus_intr(na->slot, grfmv_intr_generic_write4, sc);
323 break;
324 case NUBUS_DRHW_VIMAGE:
325 add_nubus_intr(na->slot, grfmv_intr_vimage, sc);
326 break;
327 case NUBUS_DRHW_GVIMAGE:
328 add_nubus_intr(na->slot, grfmv_intr_gvimage, sc);
329 break;
330 case NUBUS_DRHW_MC2124NB:
331 sc->cli_offset = 0xfd1000;
332 sc->cli_value = 0x00;
333 add_nubus_intr(na->slot, grfmv_intr_generic_write4, sc);
334 break;
335 case NUBUS_DRHW_MICRON:
336 sc->cli_offset = 0xa00014;
337 sc->cli_value = 0;
338 add_nubus_intr(na->slot, grfmv_intr_generic_write4, sc);
339 break;
340 default:
341 printf("%s: Unknown video card ID 0x%x --",
342 sc->sc_dev.dv_xname, sc->card_id);
343 printf(" Not installing interrupt routine.\n");
344 break;
345 }
346
347 /* Perform common video attachment. */
348 grf_establish(sc, &sc->sc_slot, grfmv_mode);
349 }
350
351 static int
352 grfmv_mode(gp, cmd, arg)
353 struct grf_softc *gp;
354 int cmd;
355 void *arg;
356 {
357 switch (cmd) {
358 case GM_GRFON:
359 case GM_GRFOFF:
360 return 0;
361 case GM_CURRMODE:
362 break;
363 case GM_NEWMODE:
364 break;
365 case GM_LISTMODES:
366 break;
367 }
368 return EINVAL;
369 }
370
371 /* Interrupt handlers... */
372 /*
373 * Generic routine to clear interrupts for cards where it simply takes
374 * a MOV.B to clear the interrupt. The offset and value of this byte
375 * varies between cards.
376 */
377 /*ARGSUSED*/
378 static void
379 grfmv_intr_generic_write1(vsc)
380 void *vsc;
381 {
382 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
383
384 bus_space_write_1(sc->sc_tag, sc->sc_handle,
385 sc->cli_offset, (u_int8_t)sc->cli_value);
386 }
387
388 /*
389 * Generic routine to clear interrupts for cards where it simply takes
390 * a MOV.L to clear the interrupt. The offset and value of this byte
391 * varies between cards.
392 */
393 /*ARGSUSED*/
394 static void
395 grfmv_intr_generic_write4(vsc)
396 void *vsc;
397 {
398 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
399
400 bus_space_write_4(sc->sc_tag, sc->sc_handle,
401 sc->cli_offset, sc->cli_value);
402 }
403
404 /*
405 * Generic routine to clear interrupts for cards where it simply takes
406 * an OR.L to clear the interrupt. The offset and value of this byte
407 * varies between cards.
408 */
409 /*ARGSUSED*/
410 static void
411 grfmv_intr_generic_or4(vsc)
412 void *vsc;
413 {
414 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
415 unsigned long scratch;
416
417 scratch = bus_space_read_4(sc->sc_tag, sc->sc_handle, sc->cli_offset);
418 scratch |= 0x80;
419 bus_space_write_4(sc->sc_tag, sc->sc_handle, sc->cli_offset, scratch);
420 }
421
422 /*
423 * Routine to clear interrupts for the Radius PrecisionColor 8xj card.
424 */
425 /*ARGSUSED*/
426 static void
427 grfmv_intr_radius(vsc)
428 void *vsc;
429 {
430 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
431 u_int8_t c;
432
433 c = sc->cli_value;
434
435 c |= 0x80;
436 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xd00403, c);
437 c &= 0x7f;
438 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xd00403, c);
439 }
440
441 /*
442 * Routine to clear interrupts for the Radius PrecisionColor 24Xp card.
443 * Is this what the 8xj routine is doing, too?
444 */
445 /*ARGSUSED*/
446 static void
447 grfmv_intr_radius24(vsc)
448 void *vsc;
449 {
450 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
451 u_int8_t c;
452
453 c = 0x80 | bus_space_read_1(sc->sc_tag, sc->sc_handle, 0xfffd8);
454 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xd00403, c);
455 c &= 0x7f;
456 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xd00403, c);
457 }
458
459 /*
460 * Routine to clear interrupts on Samsung 768x1006 video controller.
461 * This controller was manufactured by Cornerstone Technology, Inc.,
462 * now known as Cornerstone Imaging.
463 *
464 * To clear this interrupt, we apparently have to set, then clear,
465 * bit 2 at byte offset 0x80000 from the card's base.
466 * Information for this provided by Brad Salai <bsalai (at) servtech.com>
467 */
468 /*ARGSUSED*/
469 static void
470 grfmv_intr_cti(vsc)
471 void *vsc;
472 {
473 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
474 u_int8_t c;
475
476 c = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0x80000);
477 c |= 0x02;
478 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x80000, c);
479 c &= 0xfd;
480 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x80000, c);
481 }
482
483 /*ARGSUSED*/
484 static void
485 grfmv_intr_cb264(vsc)
486 void *vsc;
487 {
488 struct grfbus_softc *sc;
489 volatile char *slotbase;
490
491 sc = (struct grfbus_softc *)vsc;
492 slotbase = (volatile char *)(sc->sc_handle.base); /* XXX evil hack */
493 __asm __volatile(
494 " movl %0,%%a0 \n"
495 " movl %%a0@(0xff6028),%%d0 \n"
496 " andl #0x2,%%d0 \n"
497 " beq _mv_intr0 \n"
498 " movql #0x3,%%d0 \n"
499 "_mv_intr0: \n"
500 " movl %%a0@(0xff600c),%%d1 \n"
501 " andl #0x3,%%d1 \n"
502 " cmpl %%d1,%%d0 \n"
503 " beq _mv_intr_fin \n"
504 " movl %%d0,%%a0@(0xff600c) \n"
505 " nop \n"
506 " tstb %%d0 \n"
507 " beq _mv_intr1 \n"
508 " movl #0x0002,%%a0@(0xff6040) \n"
509 " movl #0x0102,%%a0@(0xff6044) \n"
510 " movl #0x0105,%%a0@(0xff6048) \n"
511 " movl #0x000e,%%a0@(0xff604c) \n"
512 " movl #0x001c,%%a0@(0xff6050) \n"
513 " movl #0x00bc,%%a0@(0xff6054) \n"
514 " movl #0x00c3,%%a0@(0xff6058) \n"
515 " movl #0x0061,%%a0@(0xff605c) \n"
516 " movl #0x0012,%%a0@(0xff6060) \n"
517 " bra _mv_intr_fin \n"
518 "_mv_intr1: \n"
519 " movl #0x0002,%%a0@(0xff6040) \n"
520 " movl #0x0209,%%a0@(0xff6044) \n"
521 " movl #0x020c,%%a0@(0xff6048) \n"
522 " movl #0x000f,%%a0@(0xff604c) \n"
523 " movl #0x0027,%%a0@(0xff6050) \n"
524 " movl #0x00c7,%%a0@(0xff6054) \n"
525 " movl #0x00d7,%%a0@(0xff6058) \n"
526 " movl #0x006b,%%a0@(0xff605c) \n"
527 " movl #0x0029,%%a0@(0xff6060) \n"
528 "_mv_intr_fin: \n"
529 " movl #0x1,%%a0@(0xff6014)"
530 : : "g" (slotbase) : "a0","d0","d1");
531 }
532
533 /*
534 * Support for the Colorboard 364 might be more complex than it needs to
535 * be. If we can find more information about this card, this might be
536 * significantly simplified. Contributions welcome... :-)
537 */
538 /*ARGSUSED*/
539 static void
540 grfmv_intr_cb364(vsc)
541 void *vsc;
542 {
543 struct grfbus_softc *sc;
544 volatile char *slotbase;
545
546 sc = (struct grfbus_softc *)vsc;
547 slotbase = (volatile char *)(sc->sc_handle.base); /* XXX evil hack */
548 __asm __volatile(
549 " movl %0,%%a0 \n"
550 " movl %%a0@(0xfe6028),%%d0 \n"
551 " andl #0x2,%%d0 \n"
552 " beq _cb364_intr4 \n"
553 " movql #0x3,%%d0 \n"
554 " movl %%a0@(0xfe6018),%%d1 \n"
555 " movl #0x3,%%a0@(0xfe6018) \n"
556 " movw %%a0@(0xfe7010),%%d2 \n"
557 " movl %%d1,%%a0@(0xfe6018) \n"
558 " movl %%a0@(0xfe6020),%%d1 \n"
559 " btst #0x06,%%d2 \n"
560 " beq _cb364_intr0 \n"
561 " btst #0x00,%%d1 \n"
562 " beq _cb364_intr5 \n"
563 " bsr _cb364_intr1 \n"
564 " bra _cb364_intr_out \n"
565 "_cb364_intr0: \n"
566 " btst #0x00,%%d1 \n"
567 " bne _cb364_intr5 \n"
568 " bsr _cb364_intr1 \n"
569 " bra _cb364_intr_out \n"
570 "_cb364_intr1: \n"
571 " movl %%d0,%%a0@(0xfe600c) \n"
572 " nop \n"
573 " tstb %%d0 \n"
574 " beq _cb364_intr3 \n"
575 " movl #0x0002,%%a0@(0xfe6040) \n"
576 " movl #0x0105,%%a0@(0xfe6048) \n"
577 " movl #0x000e,%%a0@(0xfe604c) \n"
578 " movl #0x00c3,%%a0@(0xfe6058) \n"
579 " movl #0x0061,%%a0@(0xfe605c) \n"
580 " btst #0x06,%%d2 \n"
581 " beq _cb364_intr2 \n"
582 " movl #0x001c,%%a0@(0xfe6050) \n"
583 " movl #0x00bc,%%a0@(0xfe6054) \n"
584 " movl #0x0012,%%a0@(0xfe6060) \n"
585 " movl #0x000e,%%a0@(0xfe6044) \n"
586 " movl #0x00c3,%%a0@(0xfe6064) \n"
587 " movl #0x0061,%%a0@(0xfe6020) \n"
588 " rts \n"
589 "_cb364_intr2: \n"
590 " movl #0x0016,%%a0@(0xfe6050) \n"
591 " movl #0x00b6,%%a0@(0xfe6054) \n"
592 " movl #0x0011,%%a0@(0xfe6060) \n"
593 " movl #0x0101,%%a0@(0xfe6044) \n"
594 " movl #0x00bf,%%a0@(0xfe6064) \n"
595 " movl #0x0001,%%a0@(0xfe6020) \n"
596 " rts \n"
597 "_cb364_intr3: \n"
598 " movl #0x0002,%%a0@(0xfe6040) \n"
599 " movl #0x0209,%%a0@(0xfe6044) \n"
600 " movl #0x020c,%%a0@(0xfe6048) \n"
601 " movl #0x000f,%%a0@(0xfe604c) \n"
602 " movl #0x0027,%%a0@(0xfe6050) \n"
603 " movl #0x00c7,%%a0@(0xfe6054) \n"
604 " movl #0x00d7,%%a0@(0xfe6058) \n"
605 " movl #0x006b,%%a0@(0xfe605c) \n"
606 " movl #0x0029,%%a0@(0xfe6060) \n"
607 " oril #0x0040,%%a0@(0xfe6064) \n"
608 " movl #0x0000,%%a0@(0xfe6020) \n"
609 " rts \n"
610 "_cb364_intr4: \n"
611 " movq #0x00,%%d0 \n"
612 "_cb364_intr5: \n"
613 " movl %%a0@(0xfe600c),%%d1 \n"
614 " andl #0x3,%%d1 \n"
615 " cmpl %%d1,%%d0 \n"
616 " beq _cb364_intr_out \n"
617 " bsr _cb364_intr1 \n"
618 "_cb364_intr_out: \n"
619 " movl #0x1,%%a0@(0xfe6014) \n"
620 "_cb364_intr_quit:"
621 : : "g" (slotbase) : "a0","d0","d1","d2");
622 }
623
624 /*
625 * Interrupt clearing routine for SuperMac GFX card.
626 */
627 /*ARGSUSED*/
628 static void
629 grfmv_intr_supermacgfx(vsc)
630 void *vsc;
631 {
632 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
633 u_int8_t dummy;
634
635 dummy = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0xE70D3);
636 }
637
638 /*
639 * Routine to clear interrupts for the Sigma Designs ColorMax card.
640 */
641 /*ARGSUSED*/
642 static void
643 grfmv_intr_cmax(vsc)
644 void *vsc;
645 {
646 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
647 u_int32_t dummy;
648
649 dummy = bus_space_read_4(sc->sc_tag, sc->sc_handle, 0xf501c);
650 dummy = bus_space_read_4(sc->sc_tag, sc->sc_handle, 0xf5018);
651 }
652
653 /*
654 * Routine to clear interrupts for the Lapis ProColorServer 8 PDS card
655 * (for the SE/30).
656 */
657 /*ARGSUSED*/
658 static void
659 grfmv_intr_lapis(vsc)
660 void *vsc;
661 {
662 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
663
664 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xff7000, 0x08);
665 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xff7000, 0x0C);
666 }
667
668 /*
669 * Routine to clear interrupts for the Formac Color Card II
670 */
671 /*ARGSUSED*/
672 static void
673 grfmv_intr_formac(vsc)
674 void *vsc;
675 {
676 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
677 u_int8_t dummy;
678
679 dummy = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0xde80db);
680 dummy = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0xde80d3);
681 }
682
683 /*
684 * Routine to clear interrupts for the Vimage by Interware Co., Ltd.
685 */
686 /*ARGSUSED*/
687 static void
688 grfmv_intr_vimage(vsc)
689 void *vsc;
690 {
691 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
692
693 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x800000, 0x67);
694 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x800000, 0xE7);
695 }
696
697 /*
698 * Routine to clear interrupts for the Grand Vimage by Interware Co., Ltd.
699 */
700 /*ARGSUSED*/
701 static void
702 grfmv_intr_gvimage(vsc)
703 void *vsc;
704 {
705 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
706 u_int8_t dummy;
707
708 dummy = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0xf00000);
709 }
710
711 /*
712 * Routine to clear interrupts for the Radius GS/C
713 */
714 /*ARGSUSED*/
715 static void
716 grfmv_intr_radius_gsc(vsc)
717 void *vsc;
718 {
719 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
720 u_int8_t dummy;
721
722 dummy = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0xfb802);
723 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xfb802, 0xff);
724 }
725
726 /*
727 * Routine to clear interrupts for the Radius GS/C
728 */
729 /*ARGSUSED*/
730 static void
731 grfmv_intr_radius_gx(vsc)
732 void *vsc;
733 {
734 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
735
736 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x600000, 0x00);
737 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x600000, 0x20);
738 }
739