grf_nubus.c revision 1.72 1 /* $NetBSD: grf_nubus.c,v 1.72 2007/03/04 06:00:09 christos 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.72 2007/03/04 06:00:09 christos 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(void *, 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 static void grfmv_intr_relax_200(void *);
73 static void grfmv_intr_mvc(void *);
74 static void grfmv_intr_viltro_340(void *);
75
76 static int grfmv_mode(struct grf_softc *, int, void *);
77 static int grfmv_match(struct device *, struct cfdata *, void *);
78 static void grfmv_attach(struct device *, struct device *, void *);
79
80 CFATTACH_DECL(macvid, sizeof(struct grfbus_softc),
81 grfmv_match, grfmv_attach, NULL, NULL);
82
83 static void
84 load_image_data(void * data, struct image_data *image)
85 {
86 memcpy(&image->size, data , 4);
87 memcpy(&image->offset, data + 4, 4);
88 memcpy(&image->rowbytes, data + 8, 2);
89 memcpy(&image->top, data + 10, 2);
90 memcpy(&image->left, data + 12, 2);
91 memcpy(&image->bottom, data + 14, 2);
92 memcpy(&image->right, data + 16, 2);
93 memcpy(&image->version, data + 18, 2);
94 memcpy(&image->packType, data + 20, 2);
95 memcpy(&image->packSize, data + 22, 4);
96 memcpy(&image->hRes, data + 26, 4);
97 memcpy(&image->vRes, data + 30, 4);
98 memcpy(&image->pixelType, data + 34, 2);
99 memcpy(&image->pixelSize, data + 36, 2);
100 memcpy(&image->cmpCount, data + 38, 2);
101 memcpy(&image->cmpSize, data + 40, 2);
102 memcpy(&image->planeBytes, data + 42, 4);
103 }
104
105
106 static int
107 grfmv_match(struct device *parent, struct cfdata *cf, 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(struct device *parent, struct device *self, void *aux)
132 {
133 struct grfbus_softc *sc = (struct grfbus_softc *)self;
134 struct nubus_attach_args *na = (struct nubus_attach_args *)aux;
135 struct image_data image_store, image;
136 struct grfmode *gm;
137 char cardname[CARD_NAME_LEN];
138 nubus_dirent dirent;
139 nubus_dir dir, mode_dir;
140 int mode;
141
142 memcpy(&sc->sc_slot, na->fmt, sizeof(nubus_slot));
143
144 sc->sc_tag = na->na_tag;
145 sc->card_id = na->drhw;
146 sc->sc_basepa = (bus_addr_t)NUBUS_SLOT2PA(na->slot);
147 sc->sc_fbofs = 0;
148
149 if (bus_space_map(sc->sc_tag, sc->sc_basepa, NBMEMSIZE,
150 0, &sc->sc_handle)) {
151 printf(": grfmv_attach: failed to map slot %d\n", na->slot);
152 return;
153 }
154
155 nubus_get_main_dir(&sc->sc_slot, &dir);
156
157 if (nubus_find_rsrc(sc->sc_tag, sc->sc_handle,
158 &sc->sc_slot, &dir, na->rsrcid, &dirent) <= 0) {
159 bad:
160 bus_space_unmap(sc->sc_tag, sc->sc_handle, NBMEMSIZE);
161 return;
162 }
163
164 nubus_get_dir_from_rsrc(&sc->sc_slot, &dirent, &sc->board_dir);
165
166 if (nubus_find_rsrc(sc->sc_tag, sc->sc_handle,
167 &sc->sc_slot, &sc->board_dir, NUBUS_RSRC_TYPE, &dirent) <= 0)
168 if ((na->rsrcid != 128) ||
169 (nubus_find_rsrc(sc->sc_tag, sc->sc_handle,
170 &sc->sc_slot, &dir, 129, &dirent) <= 0))
171 goto bad;
172
173 mode = NUBUS_RSRC_FIRSTMODE;
174 if (nubus_find_rsrc(sc->sc_tag, sc->sc_handle,
175 &sc->sc_slot, &sc->board_dir, mode, &dirent) <= 0) {
176 printf(": probe failed to get board rsrc.\n");
177 goto bad;
178 }
179
180 nubus_get_dir_from_rsrc(&sc->sc_slot, &dirent, &mode_dir);
181
182 if (nubus_find_rsrc(sc->sc_tag, sc->sc_handle,
183 &sc->sc_slot, &mode_dir, VID_PARAMS, &dirent) <= 0) {
184 printf(": probe failed to get mode dir.\n");
185 goto bad;
186 }
187
188 if (nubus_get_ind_data(sc->sc_tag, sc->sc_handle, &sc->sc_slot,
189 &dirent, (void *)&image_store, sizeof(struct image_data)) <= 0) {
190 printf(": probe failed to get indirect mode data.\n");
191 goto bad;
192 }
193
194 /* Need to load display info (and driver?), etc... (?) */
195
196 load_image_data((void *)&image_store, &image);
197
198 gm = &sc->curr_mode;
199 gm->mode_id = mode;
200 gm->ptype = image.pixelType;
201 gm->psize = image.pixelSize;
202 gm->width = image.right - image.left;
203 gm->height = image.bottom - image.top;
204 gm->rowbytes = image.rowbytes;
205 gm->hres = image.hRes;
206 gm->vres = image.vRes;
207 gm->fbsize = gm->height * gm->rowbytes;
208 gm->fbbase = (void *)(sc->sc_handle.base); /* XXX evil hack */
209 gm->fboff = image.offset;
210
211 strncpy(cardname, nubus_get_card_name(sc->sc_tag, sc->sc_handle,
212 &sc->sc_slot), CARD_NAME_LEN);
213 cardname[CARD_NAME_LEN-1] = '\0';
214 printf(": %s\n", cardname);
215
216 if (sc->card_id == NUBUS_DRHW_TFB) {
217 /*
218 * This is the Toby card, but apparently some manufacturers
219 * (like Cornerstone) didn't bother to get/use their own
220 * value here, even though the cards are different, so we
221 * so we try to differentiate here.
222 */
223 if (strncmp(cardname, "Samsung 768", 11) == 0)
224 sc->card_id = NUBUS_DRHW_SAM768;
225 else if (strncmp(cardname, "Toby frame", 10) != 0)
226 printf("%s: This display card pretends to be a TFB!\n",
227 sc->sc_dev.dv_xname);
228 }
229
230 switch (sc->card_id) {
231 case NUBUS_DRHW_TFB:
232 case NUBUS_DRHW_M2HRVC:
233 case NUBUS_DRHW_PVC:
234 sc->cli_offset = 0xa0000;
235 sc->cli_value = 0;
236 add_nubus_intr(na->slot, grfmv_intr_generic_write1, sc);
237 break;
238 case NUBUS_DRHW_WVC:
239 sc->cli_offset = 0xa00000;
240 sc->cli_value = 0;
241 add_nubus_intr(na->slot, grfmv_intr_generic_write1, sc);
242 break;
243 case NUBUS_DRHW_COLORMAX:
244 add_nubus_intr(na->slot, grfmv_intr_cmax, sc);
245 break;
246 case NUBUS_DRHW_SE30:
247 /* Do nothing--SE/30 interrupts are disabled */
248 break;
249 case NUBUS_DRHW_MDC:
250 sc->cli_offset = 0x200148;
251 sc->cli_value = 1;
252 add_nubus_intr(na->slot, grfmv_intr_generic_write4, sc);
253
254 /* Enable interrupts; to disable, write 0x7 to this location */
255 bus_space_write_4(sc->sc_tag, sc->sc_handle, 0x20013C, 5);
256 break;
257 case NUBUS_DRHW_CB264:
258 add_nubus_intr(na->slot, grfmv_intr_cb264, sc);
259 break;
260 case NUBUS_DRHW_CB364:
261 add_nubus_intr(na->slot, grfmv_intr_cb364, sc);
262 break;
263 case NUBUS_DRHW_RPC8:
264 sc->cli_offset = 0xfdff8f;
265 sc->cli_value = 0xff;
266 add_nubus_intr(na->slot, grfmv_intr_generic_write1, sc);
267 break;
268 case NUBUS_DRHW_RPC8XJ:
269 sc->cli_value = 0x66;
270 add_nubus_intr(na->slot, grfmv_intr_radius, sc);
271 break;
272 case NUBUS_DRHW_RPC24X:
273 case NUBUS_DRHW_BOOGIE:
274 sc->cli_value = 0x64;
275 add_nubus_intr(na->slot, grfmv_intr_radius, sc);
276 break;
277 case NUBUS_DRHW_RPC24XP:
278 add_nubus_intr(na->slot, grfmv_intr_radius24, sc);
279 break;
280 case NUBUS_DRHW_RADGSC:
281 add_nubus_intr(na->slot, grfmv_intr_radius_gsc, sc);
282 break;
283 case NUBUS_DRHW_RDCGX:
284 add_nubus_intr(na->slot, grfmv_intr_radius_gx, sc);
285 break;
286 case NUBUS_DRHW_FIILX:
287 case NUBUS_DRHW_FIISXDSP:
288 case NUBUS_DRHW_FUTURASX:
289 sc->cli_offset = 0xf05000;
290 sc->cli_value = 0x80;
291 add_nubus_intr(na->slot, grfmv_intr_generic_write1, sc);
292 break;
293 case NUBUS_DRHW_SAM768:
294 add_nubus_intr(na->slot, grfmv_intr_cti, sc);
295 break;
296 case NUBUS_DRHW_SUPRGFX:
297 add_nubus_intr(na->slot, grfmv_intr_supermacgfx, sc);
298 break;
299 case NUBUS_DRHW_SPECTRM8:
300 sc->cli_offset = 0x0de178;
301 sc->cli_value = 0x80;
302 add_nubus_intr(na->slot, grfmv_intr_generic_or4, sc);
303 break;
304 case NUBUS_DRHW_LAPIS:
305 add_nubus_intr(na->slot, grfmv_intr_lapis, sc);
306 break;
307 case NUBUS_DRHW_RELAX200:
308 add_nubus_intr(na->slot, grfmv_intr_relax_200, sc);
309 break;
310 case NUBUS_DRHW_BAER:
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 case NUBUS_DRHW_MVC:
343 add_nubus_intr(na->slot, grfmv_intr_mvc, sc);
344 break;
345 case NUBUS_DRHW_VILTRO340:
346 add_nubus_intr(na->slot, grfmv_intr_viltro_340, sc);
347 break;
348 default:
349 printf("%s: Unknown video card ID 0x%x --",
350 sc->sc_dev.dv_xname, sc->card_id);
351 printf(" Not installing interrupt routine.\n");
352 break;
353 }
354
355 /* Perform common video attachment. */
356 grf_establish(sc, &sc->sc_slot, grfmv_mode);
357 }
358
359 static int
360 grfmv_mode(struct grf_softc *gp, int cmd, void *arg)
361 {
362 switch (cmd) {
363 case GM_GRFON:
364 case GM_GRFOFF:
365 return 0;
366 case GM_CURRMODE:
367 break;
368 case GM_NEWMODE:
369 break;
370 case GM_LISTMODES:
371 break;
372 }
373 return EINVAL;
374 }
375
376 /* Interrupt handlers... */
377 /*
378 * Generic routine to clear interrupts for cards where it simply takes
379 * a MOV.B to clear the interrupt. The offset and value of this byte
380 * varies between cards.
381 */
382 /*ARGSUSED*/
383 static void
384 grfmv_intr_generic_write1(void *vsc)
385 {
386 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
387
388 bus_space_write_1(sc->sc_tag, sc->sc_handle,
389 sc->cli_offset, (u_int8_t)sc->cli_value);
390 }
391
392 /*
393 * Generic routine to clear interrupts for cards where it simply takes
394 * a MOV.L to clear the interrupt. The offset and value of this byte
395 * varies between cards.
396 */
397 /*ARGSUSED*/
398 static void
399 grfmv_intr_generic_write4(void *vsc)
400 {
401 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
402
403 bus_space_write_4(sc->sc_tag, sc->sc_handle,
404 sc->cli_offset, sc->cli_value);
405 }
406
407 /*
408 * Generic routine to clear interrupts for cards where it simply takes
409 * an OR.L to clear the interrupt. The offset and value of this byte
410 * varies between cards.
411 */
412 /*ARGSUSED*/
413 static void
414 grfmv_intr_generic_or4(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(void *vsc)
430 {
431 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
432 u_int8_t c;
433
434 c = sc->cli_value;
435
436 c |= 0x80;
437 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xd00403, c);
438 c &= 0x7f;
439 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xd00403, c);
440 }
441
442 /*
443 * Routine to clear interrupts for the Radius PrecisionColor 24Xp card.
444 * Is this what the 8xj routine is doing, too?
445 */
446 /*ARGSUSED*/
447 static void
448 grfmv_intr_radius24(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(void *vsc)
471 {
472 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
473 u_int8_t c;
474
475 c = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0x80000);
476 c |= 0x02;
477 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x80000, c);
478 c &= 0xfd;
479 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x80000, c);
480 }
481
482 /*ARGSUSED*/
483 static void
484 grfmv_intr_cb264(void *vsc)
485 {
486 struct grfbus_softc *sc;
487 volatile char *slotbase;
488
489 sc = (struct grfbus_softc *)vsc;
490 slotbase = (volatile char *)(sc->sc_handle.base); /* XXX evil hack */
491 __asm volatile(
492 " movl %0,%%a0 \n"
493 " movl %%a0@(0xff6028),%%d0 \n"
494 " andl #0x2,%%d0 \n"
495 " beq _mv_intr0 \n"
496 " movql #0x3,%%d0 \n"
497 "_mv_intr0: \n"
498 " movl %%a0@(0xff600c),%%d1 \n"
499 " andl #0x3,%%d1 \n"
500 " cmpl %%d1,%%d0 \n"
501 " beq _mv_intr_fin \n"
502 " movl %%d0,%%a0@(0xff600c) \n"
503 " nop \n"
504 " tstb %%d0 \n"
505 " beq _mv_intr1 \n"
506 " movl #0x0002,%%a0@(0xff6040) \n"
507 " movl #0x0102,%%a0@(0xff6044) \n"
508 " movl #0x0105,%%a0@(0xff6048) \n"
509 " movl #0x000e,%%a0@(0xff604c) \n"
510 " movl #0x001c,%%a0@(0xff6050) \n"
511 " movl #0x00bc,%%a0@(0xff6054) \n"
512 " movl #0x00c3,%%a0@(0xff6058) \n"
513 " movl #0x0061,%%a0@(0xff605c) \n"
514 " movl #0x0012,%%a0@(0xff6060) \n"
515 " bra _mv_intr_fin \n"
516 "_mv_intr1: \n"
517 " movl #0x0002,%%a0@(0xff6040) \n"
518 " movl #0x0209,%%a0@(0xff6044) \n"
519 " movl #0x020c,%%a0@(0xff6048) \n"
520 " movl #0x000f,%%a0@(0xff604c) \n"
521 " movl #0x0027,%%a0@(0xff6050) \n"
522 " movl #0x00c7,%%a0@(0xff6054) \n"
523 " movl #0x00d7,%%a0@(0xff6058) \n"
524 " movl #0x006b,%%a0@(0xff605c) \n"
525 " movl #0x0029,%%a0@(0xff6060) \n"
526 "_mv_intr_fin: \n"
527 " movl #0x1,%%a0@(0xff6014)"
528 : : "g" (slotbase) : "a0","d0","d1");
529 }
530
531 /*
532 * Support for the Colorboard 364 might be more complex than it needs to
533 * be. If we can find more information about this card, this might be
534 * significantly simplified. Contributions welcome... :-)
535 */
536 /*ARGSUSED*/
537 static void
538 grfmv_intr_cb364(void *vsc)
539 {
540 struct grfbus_softc *sc;
541 volatile char *slotbase;
542
543 sc = (struct grfbus_softc *)vsc;
544 slotbase = (volatile char *)(sc->sc_handle.base); /* XXX evil hack */
545 __asm volatile(
546 " movl %0,%%a0 \n"
547 " movl %%a0@(0xfe6028),%%d0 \n"
548 " andl #0x2,%%d0 \n"
549 " beq _cb364_intr4 \n"
550 " movql #0x3,%%d0 \n"
551 " movl %%a0@(0xfe6018),%%d1 \n"
552 " movl #0x3,%%a0@(0xfe6018) \n"
553 " movw %%a0@(0xfe7010),%%d2 \n"
554 " movl %%d1,%%a0@(0xfe6018) \n"
555 " movl %%a0@(0xfe6020),%%d1 \n"
556 " btst #0x06,%%d2 \n"
557 " beq _cb364_intr0 \n"
558 " btst #0x00,%%d1 \n"
559 " beq _cb364_intr5 \n"
560 " bsr _cb364_intr1 \n"
561 " bra _cb364_intr_out \n"
562 "_cb364_intr0: \n"
563 " btst #0x00,%%d1 \n"
564 " bne _cb364_intr5 \n"
565 " bsr _cb364_intr1 \n"
566 " bra _cb364_intr_out \n"
567 "_cb364_intr1: \n"
568 " movl %%d0,%%a0@(0xfe600c) \n"
569 " nop \n"
570 " tstb %%d0 \n"
571 " beq _cb364_intr3 \n"
572 " movl #0x0002,%%a0@(0xfe6040) \n"
573 " movl #0x0105,%%a0@(0xfe6048) \n"
574 " movl #0x000e,%%a0@(0xfe604c) \n"
575 " movl #0x00c3,%%a0@(0xfe6058) \n"
576 " movl #0x0061,%%a0@(0xfe605c) \n"
577 " btst #0x06,%%d2 \n"
578 " beq _cb364_intr2 \n"
579 " movl #0x001c,%%a0@(0xfe6050) \n"
580 " movl #0x00bc,%%a0@(0xfe6054) \n"
581 " movl #0x0012,%%a0@(0xfe6060) \n"
582 " movl #0x000e,%%a0@(0xfe6044) \n"
583 " movl #0x00c3,%%a0@(0xfe6064) \n"
584 " movl #0x0061,%%a0@(0xfe6020) \n"
585 " rts \n"
586 "_cb364_intr2: \n"
587 " movl #0x0016,%%a0@(0xfe6050) \n"
588 " movl #0x00b6,%%a0@(0xfe6054) \n"
589 " movl #0x0011,%%a0@(0xfe6060) \n"
590 " movl #0x0101,%%a0@(0xfe6044) \n"
591 " movl #0x00bf,%%a0@(0xfe6064) \n"
592 " movl #0x0001,%%a0@(0xfe6020) \n"
593 " rts \n"
594 "_cb364_intr3: \n"
595 " movl #0x0002,%%a0@(0xfe6040) \n"
596 " movl #0x0209,%%a0@(0xfe6044) \n"
597 " movl #0x020c,%%a0@(0xfe6048) \n"
598 " movl #0x000f,%%a0@(0xfe604c) \n"
599 " movl #0x0027,%%a0@(0xfe6050) \n"
600 " movl #0x00c7,%%a0@(0xfe6054) \n"
601 " movl #0x00d7,%%a0@(0xfe6058) \n"
602 " movl #0x006b,%%a0@(0xfe605c) \n"
603 " movl #0x0029,%%a0@(0xfe6060) \n"
604 " oril #0x0040,%%a0@(0xfe6064) \n"
605 " movl #0x0000,%%a0@(0xfe6020) \n"
606 " rts \n"
607 "_cb364_intr4: \n"
608 " movq #0x00,%%d0 \n"
609 "_cb364_intr5: \n"
610 " movl %%a0@(0xfe600c),%%d1 \n"
611 " andl #0x3,%%d1 \n"
612 " cmpl %%d1,%%d0 \n"
613 " beq _cb364_intr_out \n"
614 " bsr _cb364_intr1 \n"
615 "_cb364_intr_out: \n"
616 " movl #0x1,%%a0@(0xfe6014) \n"
617 "_cb364_intr_quit:"
618 : : "g" (slotbase) : "a0","d0","d1","d2");
619 }
620
621 /*
622 * Interrupt clearing routine for SuperMac GFX card.
623 */
624 /*ARGSUSED*/
625 static void
626 grfmv_intr_supermacgfx(void *vsc)
627 {
628 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
629 u_int8_t dummy;
630
631 dummy = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0xE70D3);
632 }
633
634 /*
635 * Routine to clear interrupts for the Sigma Designs ColorMax card.
636 */
637 /*ARGSUSED*/
638 static void
639 grfmv_intr_cmax(void *vsc)
640 {
641 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
642 u_int32_t dummy;
643
644 dummy = bus_space_read_4(sc->sc_tag, sc->sc_handle, 0xf501c);
645 dummy = bus_space_read_4(sc->sc_tag, sc->sc_handle, 0xf5018);
646 }
647
648 /*
649 * Routine to clear interrupts for the Lapis ProColorServer 8 PDS card
650 * (for the SE/30).
651 */
652 /*ARGSUSED*/
653 static void
654 grfmv_intr_lapis(void *vsc)
655 {
656 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
657
658 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xff7000, 0x08);
659 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xff7000, 0x0C);
660 }
661
662 /*
663 * Routine to clear interrupts for the Formac ProNitron 80.IVb
664 * and Color Card II
665 */
666 /*ARGSUSED*/
667 static void
668 grfmv_intr_formac(void *vsc)
669 {
670 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
671 u_int8_t dummy;
672
673 dummy = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0xde80db);
674 dummy = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0xde80d3);
675 }
676
677 /*
678 * Routine to clear interrupts for the Vimage by Interware Co., Ltd.
679 */
680 /*ARGSUSED*/
681 static void
682 grfmv_intr_vimage(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(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(void *vsc)
709 {
710 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
711 u_int8_t dummy;
712
713 dummy = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0xfb802);
714 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xfb802, 0xff);
715 }
716
717 /*
718 * Routine to clear interrupts for the Radius GS/C
719 */
720 /*ARGSUSED*/
721 static void
722 grfmv_intr_radius_gx(void *vsc)
723 {
724 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
725
726 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x600000, 0x00);
727 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x600000, 0x20);
728 }
729
730 /*
731 * Routine to clear interrupts for the Relax 19" model 200.
732 */
733 /*ARGSUSED*/
734 static void
735 grfmv_intr_relax_200(void *vsc)
736 {
737 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
738 unsigned long scratch;
739
740 /* The board ROM driver code has a tst.l here. */
741 scratch = bus_space_read_4(sc->sc_tag, sc->sc_handle, 0x000D0040);
742 }
743
744 /*
745 * Routine to clear interrupts for the Apple Mac II Monochrome Video Card.
746 */
747 /*ARGSUSED*/
748 static void
749 grfmv_intr_mvc(void *vsc)
750 {
751 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
752
753 bus_space_write_4(sc->sc_tag, sc->sc_handle, 0x00040000, 0);
754 bus_space_write_4(sc->sc_tag, sc->sc_handle, 0x00020000, 0);
755 }
756
757 /*
758 * Routine to clear interrupts for the VillageTronic Mac Picasso 340.
759 */
760 /*ARGSUSED*/
761 static void
762 grfmv_intr_viltro_340(void *vsc)
763 {
764 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
765 u_int8_t scratch;
766
767 /* Yes, two read accesses to the same spot. */
768 scratch = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0x0500);
769 scratch = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0x0500);
770 }
771