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