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 sn_obio_match(struct device *parent, void *cf, void *aux) { struct obio_attach_args *oa = (struct obio_attach_args *)aux; bus_space_handle_t bsh; int found = 0; if (!mac68k_machine.sonic) return 0; if (bus_space_map(oa->oa_tag, SONIC_REG_BASE, SN_REGSIZE, 0, &bsh)) return 0; if (mac68k_bus_space_probe(oa->oa_tag, bsh, 0, 4)) found = 1; bus_space_unmap(oa->oa_tag, bsh, SN_REGSIZE); return found; }
static int sn_obio_getaddr(struct sn_softc *sc, u_int8_t *lladdr) { bus_space_handle_t bsh; if (bus_space_map(sc->sc_regt, SONIC_PROM_BASE, PAGE_SIZE, 0, &bsh)) { printf(": failed to map space to read SONIC address.\n%s", sc->sc_dev.dv_xname); return (-1); } if (!mac68k_bus_space_probe(sc->sc_regt, bsh, 0, 1)) { bus_space_unmap(sc->sc_regt, bsh, PAGE_SIZE); return (-1); } sn_get_enaddr(sc->sc_regt, bsh, 0, lladdr); bus_space_unmap(sc->sc_regt, bsh, PAGE_SIZE); return (0); }
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; }