void sbc_obio_clrintr(struct ncr5380_softc *ncr_sc) { struct sbc_softc *sc = (struct sbc_softc *)ncr_sc; int flags; flags = V2IF_SCSIIRQ; if (sc->sc_options & SBC_INTR) flags |= V2IF_SCSIDRQ; if (VIA2 == VIA2OFF) via2_reg(vIFR) = 0x80 | flags; else via2_reg(rIFR) = 0x80 | flags; }
void sbc_intr_disable(struct ncr5380_softc *ncr_sc) { struct sbc_softc *sc = (struct sbc_softc *)ncr_sc; int s, flags; flags = V2IF_SCSIIRQ; if (sc->sc_options & SBC_INTR) flags |= V2IF_SCSIDRQ; s = splhigh(); if (VIA2 == VIA2OFF) via2_reg(vIER) = flags; else via2_reg(rIER) = flags; splx(s); }
int macfb_obio_match(struct device *parent, void *vcf, void *aux) { struct obio_attach_args *oa = (struct obio_attach_args *)aux; bus_space_handle_t bsh; static int found; if (found != 0) return (0); found = 1; switch (current_mac_model->class) { case MACH_CLASSQ2: if (current_mac_model->machineid != MACH_MACLC575) break; /* * Note: the only system in this class that does not have * the Valkyrie chip -- at least, that we know of -- is * the Performa/LC 57x series. This system has a version * of the DAFB controller, instead. * * If this assumption proves false, we'll have to be more * intelligent here. */ /*FALLTHROUGH*/ case MACH_CLASSQ: /* * Assume DAFB for all of these, unless we can't * access the memory. */ if (bus_space_map(oa->oa_tag, DAFB_CONTROL_BASE, 0x120, 0, &bsh) != 0) return (0); if (mac68k_bus_space_probe(oa->oa_tag, bsh, 0x1c, 4) == 0 || mac68k_bus_space_probe(oa->oa_tag, bsh, 0x104, 4) == 0) found = 0; bus_space_unmap(oa->oa_tag, bsh, 0x120); break; case MACH_CLASSAV: break; case MACH_CLASSIIci: case MACH_CLASSIIsi: if (mac68k_vidlen == 0 || (via2_reg(rMonitor) & RBVMonitorMask) == RBVMonIDNone) found = 0; break; default: if (mac68k_vidlen == 0) found = 0; break; } return (found); }
static int grfiv_match(struct device *parent, struct cfdata *cf, void *aux) { struct obio_attach_args *oa = (struct obio_attach_args *)aux; bus_space_handle_t bsh; int found; u_int base; found = 1; switch (current_mac_model->class) { case MACH_CLASSQ2: if (current_mac_model->machineid != MACH_MACLC575) { base = VALKYRIE_CONTROL_BASE; if (bus_space_map(oa->oa_tag, base, 0x40, 0, &bsh)) return 0; /* Disable interrupts */ bus_space_write_1(oa->oa_tag, bsh, 0x18, 0x1); bus_space_unmap(oa->oa_tag, bsh, 0x40); break; } /* * Note: the only system in this class that does not have * the Valkyrie chip -- at least, that we know of -- is * the Performa/LC 57x series. This system has a version * of the DAFB controller, instead. * * If this assumption proves false, we'll have to be more * intelligent here. */ /*FALLTHROUGH*/ case MACH_CLASSQ: /* * Assume DAFB for all of these, unless we can't * access the memory. */ base = DAFB_CONTROL_BASE; if (bus_space_map(oa->oa_tag, base, 0x20, 0, &bsh)) return 0; if (mac68k_bus_space_probe(oa->oa_tag, bsh, 0x1c, 4) == 0) { bus_space_unmap(oa->oa_tag, bsh, 0x20); return 0; } bus_space_unmap(oa->oa_tag, bsh, 0x20); if (bus_space_map(oa->oa_tag, base + 0x100, 0x20, 0, &bsh)) return 0; if (mac68k_bus_space_probe(oa->oa_tag, bsh, 0x04, 4) == 0) { bus_space_unmap(oa->oa_tag, bsh, 0x20); return 0; } /* Disable interrupts */ bus_space_write_4(oa->oa_tag, bsh, 0x04, 0); /* Clear any interrupts */ bus_space_write_4(oa->oa_tag, bsh, 0x0C, 0); bus_space_write_4(oa->oa_tag, bsh, 0x10, 0); bus_space_write_4(oa->oa_tag, bsh, 0x14, 0); bus_space_unmap(oa->oa_tag, bsh, 0x20); break; case MACH_CLASSAV: base = CIVIC_CONTROL_BASE; if (bus_space_map(oa->oa_tag, base, 0x1000, 0, &bsh)) return 0; /* Disable interrupts */ bus_space_write_1(oa->oa_tag, bsh, 0x120, 0); bus_space_unmap(oa->oa_tag, bsh, 0x1000); break; case MACH_CLASSIIci: case MACH_CLASSIIsi: if (mac68k_video.mv_len == 0 || (via2_reg(rMonitor) & RBVMonitorMask) == RBVMonIDNone) found = 0; break; default: if (mac68k_video.mv_len == 0) found = 0; break; } return found; }
static void grfiv_attach(struct device *parent, struct device *self, void *aux) { struct obio_attach_args *oa = (struct obio_attach_args *)aux; struct grfbus_softc *sc; struct grfmode *gm; u_long base, length; u_int32_t vbase1, vbase2; sc = (struct grfbus_softc *)self; sc->card_id = 0; switch (current_mac_model->class) { case MACH_CLASSQ2: if (current_mac_model->machineid != MACH_MACLC575) { sc->sc_basepa = VALKYRIE_BASE; length = 0x00100000; /* 1MB */ if (sc->sc_basepa <= mac68k_video.mv_phys && mac68k_video.mv_phys < (sc->sc_basepa + length)) { sc->sc_fbofs = mac68k_video.mv_phys - sc->sc_basepa; } else { sc->sc_basepa = m68k_trunc_page(mac68k_video.mv_phys); sc->sc_fbofs = m68k_page_offset(mac68k_video.mv_phys); length = mac68k_video.mv_len + sc->sc_fbofs; } printf(" @ %lx: Valkyrie video subsystem\n", sc->sc_basepa + sc->sc_fbofs); break; } /* See note in grfiv_match() */ /*FALLTHROUGH*/ case MACH_CLASSQ: base = DAFB_CONTROL_BASE; sc->sc_tag = oa->oa_tag; if (bus_space_map(sc->sc_tag, base, 0x20, 0, &sc->sc_regh)) { printf(": failed to map DAFB register space\n"); return; } sc->sc_basepa = DAFB_BASE; length = 0x00100000; /* 1MB */ /* Compute the current frame buffer offset */ vbase1 = bus_space_read_4(sc->sc_tag, sc->sc_regh, 0x0) & 0xfff; #if 1 /* * XXX The following exists because the DAFB v7 in these * systems doesn't return reasonable values to use for fbofs. * Ken'ichi Ishizaka gets credit for this hack. (sar 19990426) * (Does this get us the correct result for _all_ DAFB- * equipped systems and monitor combinations? It seems * possible, if not likely...) */ switch (current_mac_model->machineid) { case MACH_MACLC475: case MACH_MACLC475_33: case MACH_MACLC575: case MACH_MACQ605: case MACH_MACQ605_33: vbase1 &= 0x3f; break; } #endif vbase2 = bus_space_read_4(sc->sc_tag, sc->sc_regh, 0x4) & 0xf; sc->sc_fbofs = (vbase1 << 9) | (vbase2 << 5); printf(" @ %lx: DAFB video subsystem, monitor sense %x\n", sc->sc_basepa + sc->sc_fbofs, (bus_space_read_4(sc->sc_tag, sc->sc_regh, 0x1c) & 0x7)); bus_space_unmap(sc->sc_tag, sc->sc_regh, 0x20); break; case MACH_CLASSAV: sc->sc_basepa = CIVIC_BASE; length = 0x00200000; /* 2MB */ if (mac68k_video.mv_phys >= sc->sc_basepa && mac68k_video.mv_phys < (sc->sc_basepa + length)) { sc->sc_fbofs = mac68k_video.mv_phys - sc->sc_basepa; } else { sc->sc_basepa = m68k_trunc_page(mac68k_video.mv_phys); sc->sc_fbofs = m68k_page_offset(mac68k_video.mv_phys); length = mac68k_video.mv_len + sc->sc_fbofs; } printf(" @ %lx: CIVIC video subsystem\n", sc->sc_basepa + sc->sc_fbofs); break; case MACH_CLASSIIci: case MACH_CLASSIIsi: sc->sc_basepa = m68k_trunc_page(mac68k_video.mv_phys); sc->sc_fbofs = m68k_page_offset(mac68k_video.mv_phys); length = mac68k_video.mv_len + sc->sc_fbofs; printf(" @ %lx: RBV video subsystem, ", sc->sc_basepa + sc->sc_fbofs); switch (via2_reg(rMonitor) & RBVMonitorMask) { case RBVMonIDBWP: printf("15\" monochrome portrait"); break; case RBVMonIDRGB12: printf("12\" color"); break; case RBVMonIDRGB15: printf("15\" color"); break; case RBVMonIDStd: printf("Macintosh II"); break; default: printf("unrecognized"); break; } printf(" display\n"); break; default: sc->sc_basepa = m68k_trunc_page(mac68k_video.mv_phys); sc->sc_fbofs = m68k_page_offset(mac68k_video.mv_phys); length = mac68k_video.mv_len + sc->sc_fbofs; printf(" @ %lx: On-board video\n", sc->sc_basepa + sc->sc_fbofs); break; } if (bus_space_map(sc->sc_tag, sc->sc_basepa, length, 0, &sc->sc_handle)) { printf("%s: failed to map video RAM\n", sc->sc_dev.dv_xname); return; } if (sc->sc_basepa <= mac68k_video.mv_phys && mac68k_video.mv_phys < (sc->sc_basepa + length)) { /* XXX Hack */ mac68k_video.mv_kvaddr = sc->sc_handle.base + sc->sc_fbofs; } gm = &(sc->curr_mode); gm->mode_id = 0; gm->psize = mac68k_video.mv_depth; gm->ptype = 0; gm->width = mac68k_video.mv_width; gm->height = mac68k_video.mv_height; gm->rowbytes = mac68k_video.mv_stride; gm->hres = 80; /* XXX hack */ gm->vres = 80; /* XXX hack */ gm->fbsize = gm->height * gm->rowbytes; gm->fbbase = (void *)sc->sc_handle.base; /* XXX yet another hack */ gm->fboff = sc->sc_fbofs; /* Perform common video attachment. */ grf_establish(sc, NULL, grfiv_mode); }
void macfb_obio_attach(struct device *parent, struct device *self, void *aux) { struct obio_attach_args *oa = (struct obio_attach_args *) aux; struct macfb_softc *sc = (struct macfb_softc *)self; u_long length; u_int32_t vbase1, vbase2; struct macfb_devconfig *dc; sc->card_id = 0; sc->sc_tag = oa->oa_tag; dc = malloc(sizeof(*dc), M_DEVBUF, M_WAITOK); bzero(dc, sizeof(*dc)); switch (current_mac_model->class) { case MACH_CLASSQ2: if (current_mac_model->machineid != MACH_MACLC575) { sc->sc_basepa = VALKYRIE_BASE; length = 0x00100000; /* 1MB */ if (sc->sc_basepa <= mac68k_vidphys && mac68k_vidphys < (sc->sc_basepa + length)) sc->sc_fbofs = mac68k_vidphys - sc->sc_basepa; else sc->sc_fbofs = 0; #ifdef DEBUG printf(" @ %lx", sc->sc_basepa + sc->sc_fbofs); #endif if (bus_space_map(sc->sc_tag, VALKYRIE_CONTROL_BASE, 0x40, 0, &sc->sc_regh) != 0) { printf(": can't map Valkyrie registers\n"); free(dc, M_DEVBUF); return; } /* Disable interrupts */ bus_space_write_1(sc->sc_tag, sc->sc_regh, 0x18, 0x1); bus_space_unmap(sc->sc_tag, sc->sc_regh, 0x40); printf(": Valkyrie\n"); break; } /* * Note: the only system in this class that does not have * the Valkyrie chip -- at least, that we know of -- is * the Performa/LC 57x series. This system has a version * of the DAFB controller, instead. * * If this assumption proves false, we'll have to be more * intelligent here. */ /*FALLTHROUGH*/ case MACH_CLASSQ: if (bus_space_map(sc->sc_tag, DAFB_CONTROL_BASE, 0x120, 0, &sc->sc_regh)) { printf(": can't map DAFB registers\n"); free(dc, M_DEVBUF); return; } sc->sc_basepa = DAFB_BASE; length = 0x00100000; /* 1MB */ /* Compute the current frame buffer offset */ vbase1 = bus_space_read_4(sc->sc_tag, sc->sc_regh, 0x0) & 0xfff; /* * XXX The following exists because the DAFB v7 in these * systems doesn't return reasonable values to use for fbofs. * Ken'ichi Ishizaka gets credit for this hack. (sar 19990426) * (Does this get us the correct result for _all_ DAFB- * equipped systems and monitor combinations? It seems * possible, if not likely...) */ switch (current_mac_model->machineid) { case MACH_MACLC475: case MACH_MACLC475_33: case MACH_MACLC575: case MACH_MACQ605: case MACH_MACQ605_33: vbase1 &= 0x3f; break; } vbase2 = bus_space_read_4(sc->sc_tag, sc->sc_regh, 0x4) & 0xf; sc->sc_fbofs = (vbase1 << 9) | (vbase2 << 5); #ifdef DEBUG printf(" @ %lx", sc->sc_basepa + sc->sc_fbofs); #endif /* Disable interrupts */ bus_space_write_4(sc->sc_tag, sc->sc_regh, 0x104, 0); /* Clear any pending interrupts */ bus_space_write_4(sc->sc_tag, sc->sc_regh, 0x10C, 0); bus_space_write_4(sc->sc_tag, sc->sc_regh, 0x110, 0); bus_space_write_4(sc->sc_tag, sc->sc_regh, 0x114, 0); printf(": DAFB, monitor sense %x\n", (bus_space_read_4(sc->sc_tag, sc->sc_regh, 0x1c) & 0x7)); bus_space_unmap(sc->sc_tag, sc->sc_regh, 0x120); if (bus_space_map(sc->sc_tag, DAFB_CMAP_BASE, 0x20, 0, &sc->sc_regh) == 0) { dc->dc_cmapregs = (vaddr_t)bus_space_vaddr(sc->sc_tag, sc->sc_regh); dc->dc_setcolor = dafb_setcolor; } break; case MACH_CLASSAV: sc->sc_basepa = CIVIC_BASE; length = 0x00200000; /* 2MB */ if (sc->sc_basepa <= mac68k_vidphys && mac68k_vidphys < (sc->sc_basepa + length)) sc->sc_fbofs = mac68k_vidphys - sc->sc_basepa; else sc->sc_fbofs = 0; #ifdef DEBUG printf(" @ %lx", sc->sc_basepa + sc->sc_fbofs); #endif if (bus_space_map(sc->sc_tag, CIVIC_CONTROL_BASE, PAGE_SIZE, 0, &sc->sc_regh) != 0) { printf(": can't map Civic registers\n"); free(dc, M_DEVBUF); return; } /* Disable interrupts */ bus_space_write_1(sc->sc_tag, sc->sc_regh, 0x120, 0); bus_space_unmap(sc->sc_tag, sc->sc_regh, PAGE_SIZE); printf(": Civic\n"); break; case MACH_CLASSIIci: case MACH_CLASSIIsi: sc->sc_basepa = trunc_page(mac68k_vidphys); sc->sc_fbofs = m68k_page_offset(mac68k_vidphys); length = mac68k_vidlen + sc->sc_fbofs; #ifdef DEBUG printf(" @ %lx: RBV", sc->sc_basepa + sc->sc_fbofs); switch (via2_reg(rMonitor) & RBVMonitorMask) { case RBVMonIDBWP: printf(", 15\" monochrome portrait"); break; case RBVMonIDRGB12: printf(", 12\" color"); break; case RBVMonIDRGB15: printf(", 15\" color"); break; case RBVMonIDStd: printf(", Macintosh II"); break; default: printf(", unrecognized"); break; } printf(" display\n"); #else printf(": RBV\n"); #endif break; default: sc->sc_basepa = trunc_page(mac68k_vidphys); sc->sc_fbofs = m68k_page_offset(mac68k_vidphys); length = mac68k_vidlen + sc->sc_fbofs; #ifdef DEBUG printf(" @ %lx:", sc->sc_basepa + sc->sc_fbofs); #endif printf(": On-board video\n"); break; } if (bus_space_map(sc->sc_tag, sc->sc_basepa, length, 0, &sc->sc_handle)) { printf("%s: failed to map video RAM\n", sc->sc_dev.dv_xname); free(dc, M_DEVBUF); return; } if (sc->sc_basepa <= mac68k_vidphys && mac68k_vidphys < (sc->sc_basepa + length)) videoaddr = (vaddr_t)bus_space_vaddr(sc->sc_tag, sc->sc_handle) + sc->sc_fbofs; dc->dc_vaddr = (vaddr_t)bus_space_vaddr(sc->sc_tag, sc->sc_handle); dc->dc_paddr = sc->sc_basepa; dc->dc_offset = sc->sc_fbofs; dc->dc_wid = videosize & 0xffff; dc->dc_ht = (videosize >> 16) & 0xffff; dc->dc_depth = videobitdepth; dc->dc_rowbytes = videorowbytes; dc->dc_size = dc->dc_ht * dc->dc_rowbytes; /* Perform common video attachment. */ macfb_attach_common(sc, dc); }