Sync usage with man page.
[netbsd-mini2440.git] / sys / arch / mac68k / nubus / grf_nubus.c
blobd65c3d6b1fce00c9696c3dd5cc8855648672b3e8
1 /* $NetBSD: grf_nubus.c,v 1.73.10.1 2007/10/03 19:24:09 garbled Exp $ */
3 /*
4 * Copyright (c) 1995 Allen Briggs. All rights reserved.
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.
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.
29 * Device-specific routines for handling Nubus-based video cards.
32 #include <sys/cdefs.h>
33 __KERNEL_RCSID(0, "$NetBSD: grf_nubus.c,v 1.73.10.1 2007/10/03 19:24:09 garbled Exp $");
35 #include <sys/param.h>
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>
45 #include <machine/bus.h>
46 #include <machine/cpu.h>
47 #include <machine/grfioctl.h>
48 #include <machine/viareg.h>
50 #include <mac68k/nubus/nubus.h>
51 #include <mac68k/dev/grfvar.h>
53 static void load_image_data(void *, struct image_data *);
55 static void grfmv_intr_generic_write1(void *);
56 static void grfmv_intr_generic_write4(void *);
57 static void grfmv_intr_generic_or4(void *);
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 *);
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 *);
80 CFATTACH_DECL(macvid, sizeof(struct grfbus_softc),
81 grfmv_match, grfmv_attach, NULL, NULL);
83 static void
84 load_image_data(void * data, struct image_data *image)
86 char *d = (char*)data;
88 memcpy(&image->size, d , 4);
89 memcpy(&image->offset, d + 4, 4);
90 memcpy(&image->rowbytes, d + 8, 2);
91 memcpy(&image->top, d + 10, 2);
92 memcpy(&image->left, d + 12, 2);
93 memcpy(&image->bottom, d + 14, 2);
94 memcpy(&image->right, d + 16, 2);
95 memcpy(&image->version, d + 18, 2);
96 memcpy(&image->packType, d + 20, 2);
97 memcpy(&image->packSize, d + 22, 4);
98 memcpy(&image->hRes, d + 26, 4);
99 memcpy(&image->vRes, d + 30, 4);
100 memcpy(&image->pixelType, d + 34, 2);
101 memcpy(&image->pixelSize, d + 36, 2);
102 memcpy(&image->cmpCount, d + 38, 2);
103 memcpy(&image->cmpSize, d + 40, 2);
104 memcpy(&image->planeBytes, d + 42, 4);
108 static int
109 grfmv_match(struct device *parent, struct cfdata *cf, void *aux)
111 struct nubus_attach_args *na = (struct nubus_attach_args *)aux;
113 if (na->category != NUBUS_CATEGORY_DISPLAY)
114 return 0;
116 if (na->type != NUBUS_TYPE_VIDEO)
117 return 0;
119 if (na->drsw != NUBUS_DRSW_APPLE)
120 return 0;
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.
129 return 1;
132 static void
133 grfmv_attach(struct device *parent, struct device *self, void *aux)
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;
144 memcpy(&sc->sc_slot, na->fmt, sizeof(nubus_slot));
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;
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;
157 nubus_get_main_dir(&sc->sc_slot, &dir);
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;
166 nubus_get_dir_from_rsrc(&sc->sc_slot, &dirent, &sc->board_dir);
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;
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;
182 nubus_get_dir_from_rsrc(&sc->sc_slot, &dirent, &mode_dir);
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;
190 if (nubus_get_ind_data(sc->sc_tag, sc->sc_handle, &sc->sc_slot,
191 &dirent, (void *)&image_store, sizeof(struct image_data)) <= 0) {
192 printf(": probe failed to get indirect mode data.\n");
193 goto bad;
196 /* Need to load display info (and driver?), etc... (?) */
198 load_image_data((void *)&image_store, &image);
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 = (void *)(sc->sc_handle.base); /* XXX evil hack */
211 gm->fboff = image.offset;
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);
218 if (sc->card_id == NUBUS_DRHW_TFB) {
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 * try to differentiate here.
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);
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);
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_RELAX200:
310 add_nubus_intr(na->slot, grfmv_intr_relax_200, sc);
311 break;
312 case NUBUS_DRHW_BAER:
313 case NUBUS_DRHW_FORMAC:
314 add_nubus_intr(na->slot, grfmv_intr_formac, sc);
315 break;
316 case NUBUS_DRHW_ROPS24LXI:
317 case NUBUS_DRHW_ROPS24XLTV:
318 case NUBUS_DRHW_ROPS24MXTV:
319 sc->cli_offset = 0xfb0010;
320 sc->cli_value = 0x00;
321 add_nubus_intr(na->slot, grfmv_intr_generic_write4, sc);
322 break;
323 case NUBUS_DRHW_ROPSPPGT:
324 sc->cli_offset = 0xf50010;
325 sc->cli_value = 0x02;
326 add_nubus_intr(na->slot, grfmv_intr_generic_write4, sc);
327 break;
328 case NUBUS_DRHW_VIMAGE:
329 add_nubus_intr(na->slot, grfmv_intr_vimage, sc);
330 break;
331 case NUBUS_DRHW_GVIMAGE:
332 add_nubus_intr(na->slot, grfmv_intr_gvimage, sc);
333 break;
334 case NUBUS_DRHW_MC2124NB:
335 sc->cli_offset = 0xfd1000;
336 sc->cli_value = 0x00;
337 add_nubus_intr(na->slot, grfmv_intr_generic_write4, sc);
338 break;
339 case NUBUS_DRHW_MICRON:
340 sc->cli_offset = 0xa00014;
341 sc->cli_value = 0;
342 add_nubus_intr(na->slot, grfmv_intr_generic_write4, sc);
343 break;
344 case NUBUS_DRHW_MVC:
345 add_nubus_intr(na->slot, grfmv_intr_mvc, sc);
346 break;
347 case NUBUS_DRHW_VILTRO340:
348 add_nubus_intr(na->slot, grfmv_intr_viltro_340, sc);
349 break;
350 default:
351 printf("%s: Unknown video card ID 0x%x --",
352 sc->sc_dev.dv_xname, sc->card_id);
353 printf(" Not installing interrupt routine.\n");
354 break;
357 /* Perform common video attachment. */
358 grf_establish(sc, &sc->sc_slot, grfmv_mode);
361 static int
362 grfmv_mode(struct grf_softc *gp, int cmd, void *arg)
364 switch (cmd) {
365 case GM_GRFON:
366 case GM_GRFOFF:
367 return 0;
368 case GM_CURRMODE:
369 break;
370 case GM_NEWMODE:
371 break;
372 case GM_LISTMODES:
373 break;
375 return EINVAL;
378 /* Interrupt handlers... */
380 * Generic routine to clear interrupts for cards where it simply takes
381 * a MOV.B to clear the interrupt. The offset and value of this byte
382 * varies between cards.
384 /*ARGSUSED*/
385 static void
386 grfmv_intr_generic_write1(void *vsc)
388 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
390 bus_space_write_1(sc->sc_tag, sc->sc_handle,
391 sc->cli_offset, (u_int8_t)sc->cli_value);
395 * Generic routine to clear interrupts for cards where it simply takes
396 * a MOV.L to clear the interrupt. The offset and value of this byte
397 * varies between cards.
399 /*ARGSUSED*/
400 static void
401 grfmv_intr_generic_write4(void *vsc)
403 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
405 bus_space_write_4(sc->sc_tag, sc->sc_handle,
406 sc->cli_offset, sc->cli_value);
410 * Generic routine to clear interrupts for cards where it simply takes
411 * an OR.L to clear the interrupt. The offset and value of this byte
412 * varies between cards.
414 /*ARGSUSED*/
415 static void
416 grfmv_intr_generic_or4(void *vsc)
418 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
419 unsigned long scratch;
421 scratch = bus_space_read_4(sc->sc_tag, sc->sc_handle, sc->cli_offset);
422 scratch |= 0x80;
423 bus_space_write_4(sc->sc_tag, sc->sc_handle, sc->cli_offset, scratch);
427 * Routine to clear interrupts for the Radius PrecisionColor 8xj card.
429 /*ARGSUSED*/
430 static void
431 grfmv_intr_radius(void *vsc)
433 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
434 u_int8_t c;
436 c = sc->cli_value;
438 c |= 0x80;
439 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xd00403, c);
440 c &= 0x7f;
441 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xd00403, c);
445 * Routine to clear interrupts for the Radius PrecisionColor 24Xp card.
446 * Is this what the 8xj routine is doing, too?
448 /*ARGSUSED*/
449 static void
450 grfmv_intr_radius24(void *vsc)
452 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
453 u_int8_t c;
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);
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.
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@servtech.com>
470 /*ARGSUSED*/
471 static void
472 grfmv_intr_cti(void *vsc)
474 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
475 u_int8_t c;
477 c = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0x80000);
478 c |= 0x02;
479 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x80000, c);
480 c &= 0xfd;
481 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x80000, c);
484 /*ARGSUSED*/
485 static void
486 grfmv_intr_cb264(void *vsc)
488 struct grfbus_softc *sc;
489 volatile char *slotbase;
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");
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... :-)
538 /*ARGSUSED*/
539 static void
540 grfmv_intr_cb364(void *vsc)
542 struct grfbus_softc *sc;
543 volatile char *slotbase;
545 sc = (struct grfbus_softc *)vsc;
546 slotbase = (volatile char *)(sc->sc_handle.base); /* XXX evil hack */
547 __asm volatile(
548 " movl %0,%%a0 \n"
549 " movl %%a0@(0xfe6028),%%d0 \n"
550 " andl #0x2,%%d0 \n"
551 " beq _cb364_intr4 \n"
552 " movql #0x3,%%d0 \n"
553 " movl %%a0@(0xfe6018),%%d1 \n"
554 " movl #0x3,%%a0@(0xfe6018) \n"
555 " movw %%a0@(0xfe7010),%%d2 \n"
556 " movl %%d1,%%a0@(0xfe6018) \n"
557 " movl %%a0@(0xfe6020),%%d1 \n"
558 " btst #0x06,%%d2 \n"
559 " beq _cb364_intr0 \n"
560 " btst #0x00,%%d1 \n"
561 " beq _cb364_intr5 \n"
562 " bsr _cb364_intr1 \n"
563 " bra _cb364_intr_out \n"
564 "_cb364_intr0: \n"
565 " btst #0x00,%%d1 \n"
566 " bne _cb364_intr5 \n"
567 " bsr _cb364_intr1 \n"
568 " bra _cb364_intr_out \n"
569 "_cb364_intr1: \n"
570 " movl %%d0,%%a0@(0xfe600c) \n"
571 " nop \n"
572 " tstb %%d0 \n"
573 " beq _cb364_intr3 \n"
574 " movl #0x0002,%%a0@(0xfe6040) \n"
575 " movl #0x0105,%%a0@(0xfe6048) \n"
576 " movl #0x000e,%%a0@(0xfe604c) \n"
577 " movl #0x00c3,%%a0@(0xfe6058) \n"
578 " movl #0x0061,%%a0@(0xfe605c) \n"
579 " btst #0x06,%%d2 \n"
580 " beq _cb364_intr2 \n"
581 " movl #0x001c,%%a0@(0xfe6050) \n"
582 " movl #0x00bc,%%a0@(0xfe6054) \n"
583 " movl #0x0012,%%a0@(0xfe6060) \n"
584 " movl #0x000e,%%a0@(0xfe6044) \n"
585 " movl #0x00c3,%%a0@(0xfe6064) \n"
586 " movl #0x0061,%%a0@(0xfe6020) \n"
587 " rts \n"
588 "_cb364_intr2: \n"
589 " movl #0x0016,%%a0@(0xfe6050) \n"
590 " movl #0x00b6,%%a0@(0xfe6054) \n"
591 " movl #0x0011,%%a0@(0xfe6060) \n"
592 " movl #0x0101,%%a0@(0xfe6044) \n"
593 " movl #0x00bf,%%a0@(0xfe6064) \n"
594 " movl #0x0001,%%a0@(0xfe6020) \n"
595 " rts \n"
596 "_cb364_intr3: \n"
597 " movl #0x0002,%%a0@(0xfe6040) \n"
598 " movl #0x0209,%%a0@(0xfe6044) \n"
599 " movl #0x020c,%%a0@(0xfe6048) \n"
600 " movl #0x000f,%%a0@(0xfe604c) \n"
601 " movl #0x0027,%%a0@(0xfe6050) \n"
602 " movl #0x00c7,%%a0@(0xfe6054) \n"
603 " movl #0x00d7,%%a0@(0xfe6058) \n"
604 " movl #0x006b,%%a0@(0xfe605c) \n"
605 " movl #0x0029,%%a0@(0xfe6060) \n"
606 " oril #0x0040,%%a0@(0xfe6064) \n"
607 " movl #0x0000,%%a0@(0xfe6020) \n"
608 " rts \n"
609 "_cb364_intr4: \n"
610 " movq #0x00,%%d0 \n"
611 "_cb364_intr5: \n"
612 " movl %%a0@(0xfe600c),%%d1 \n"
613 " andl #0x3,%%d1 \n"
614 " cmpl %%d1,%%d0 \n"
615 " beq _cb364_intr_out \n"
616 " bsr _cb364_intr1 \n"
617 "_cb364_intr_out: \n"
618 " movl #0x1,%%a0@(0xfe6014) \n"
619 "_cb364_intr_quit:"
620 : : "g" (slotbase) : "a0","d0","d1","d2");
624 * Interrupt clearing routine for SuperMac GFX card.
626 /*ARGSUSED*/
627 static void
628 grfmv_intr_supermacgfx(void *vsc)
630 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
631 u_int8_t dummy;
633 dummy = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0xE70D3);
637 * Routine to clear interrupts for the Sigma Designs ColorMax card.
639 /*ARGSUSED*/
640 static void
641 grfmv_intr_cmax(void *vsc)
643 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
644 u_int32_t dummy;
646 dummy = bus_space_read_4(sc->sc_tag, sc->sc_handle, 0xf501c);
647 dummy = bus_space_read_4(sc->sc_tag, sc->sc_handle, 0xf5018);
651 * Routine to clear interrupts for the Lapis ProColorServer 8 PDS card
652 * (for the SE/30).
654 /*ARGSUSED*/
655 static void
656 grfmv_intr_lapis(void *vsc)
658 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
660 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xff7000, 0x08);
661 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0xff7000, 0x0C);
665 * Routine to clear interrupts for the Formac ProNitron 80.IVb
666 * and Color Card II
668 /*ARGSUSED*/
669 static void
670 grfmv_intr_formac(void *vsc)
672 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
673 u_int8_t dummy;
675 dummy = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0xde80db);
676 dummy = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0xde80d3);
680 * Routine to clear interrupts for the Vimage by Interware Co., Ltd.
682 /*ARGSUSED*/
683 static void
684 grfmv_intr_vimage(void *vsc)
686 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
688 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x800000, 0x67);
689 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x800000, 0xE7);
693 * Routine to clear interrupts for the Grand Vimage by Interware Co., Ltd.
695 /*ARGSUSED*/
696 static void
697 grfmv_intr_gvimage(void *vsc)
699 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
700 u_int8_t dummy;
702 dummy = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0xf00000);
706 * Routine to clear interrupts for the Radius GS/C
708 /*ARGSUSED*/
709 static void
710 grfmv_intr_radius_gsc(void *vsc)
712 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
713 u_int8_t dummy;
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);
720 * Routine to clear interrupts for the Radius GS/C
722 /*ARGSUSED*/
723 static void
724 grfmv_intr_radius_gx(void *vsc)
726 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
728 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x600000, 0x00);
729 bus_space_write_1(sc->sc_tag, sc->sc_handle, 0x600000, 0x20);
733 * Routine to clear interrupts for the Relax 19" model 200.
735 /*ARGSUSED*/
736 static void
737 grfmv_intr_relax_200(void *vsc)
739 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
740 unsigned long scratch;
742 /* The board ROM driver code has a tst.l here. */
743 scratch = bus_space_read_4(sc->sc_tag, sc->sc_handle, 0x000D0040);
747 * Routine to clear interrupts for the Apple Mac II Monochrome Video Card.
749 /*ARGSUSED*/
750 static void
751 grfmv_intr_mvc(void *vsc)
753 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
755 bus_space_write_4(sc->sc_tag, sc->sc_handle, 0x00040000, 0);
756 bus_space_write_4(sc->sc_tag, sc->sc_handle, 0x00020000, 0);
760 * Routine to clear interrupts for the VillageTronic Mac Picasso 340.
762 /*ARGSUSED*/
763 static void
764 grfmv_intr_viltro_340(void *vsc)
766 struct grfbus_softc *sc = (struct grfbus_softc *)vsc;
767 u_int8_t scratch;
769 /* Yes, two read accesses to the same spot. */
770 scratch = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0x0500);
771 scratch = bus_space_read_1(sc->sc_tag, sc->sc_handle, 0x0500);