Take care when accessing DAFB--some quadra-class machines use other video
authorbriggs <briggs@openbsd.org>
Mon, 21 Apr 1997 00:58:14 +0000 (00:58 +0000)
committerbriggs <briggs@openbsd.org>
Mon, 21 Apr 1997 00:58:14 +0000 (00:58 +0000)
controllers.

sys/arch/mac68k/dev/grf_iv.c

index 07a3d29..8082cf0 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: grf_iv.c,v 1.14 1997/03/30 22:44:03 briggs Exp $      */
+/*     $OpenBSD: grf_iv.c,v 1.15 1997/04/21 00:58:14 briggs Exp $      */
 /*     $NetBSD: grf_iv.c,v 1.17 1997/02/20 00:23:27 scottr Exp $       */
 
 /*
@@ -89,16 +89,25 @@ grfiv_match(parent, vcf, aux)
        found = 1;
 
         switch (current_mac_model->class) {
-        case MACH_CLASSQ:
-        case MACH_CLASSQ2:
+       case MACH_CLASSQ:
+       case MACH_CLASSQ2:
 
-               /* Assume DAFB for all of these */
+               /*
+                * Assume DAFB for all of these, unless we can't
+                * access the memory.
+                */
 
                if (bus_space_map(oa->oa_tag, QUADRA_DAFB_BASE, 0x1000,
                                        0, &bsh)) {
                        panic("failed to map space for DAFB regs.\n");
                }
 
+               if (bus_probe(oa->oa_tag, bsh, 0x1C, 4) == 0) {
+                       bus_space_unmap(oa->oa_tag, bsh, 0x1000);
+                       found = 0;
+                       goto nodafb;
+               }
+
                sense = (bus_space_read_4(oa->oa_tag, bsh, 0x1C) & 7);
 
                if (sense == 0)
@@ -121,6 +130,7 @@ grfiv_match(parent, vcf, aux)
                break;
 
        default:
+nodafb:
                if (mac68k_vidlog == 0) {
                        found = 0;
                }