/* * if we are a Commodore Amiga A4091 or possibly an A4000T */ int afscmatch(struct device *pdp, struct cfdata *cfp, void *auxp) { struct zbus_args *zap; siop_regmap_p rp; u_long temp, scratch; zap = auxp; if (zap->manid == 514 && zap->prodid == 84) return(1); /* It's an A4091 SCSI card */ if (!is_a4000() || !matchname("afsc", auxp)) return(0); /* Not on an A4000 or not A4000T SCSI */ rp = ztwomap(0xdd0040); if (badaddr((void *)__UNVOLATILE(&rp->siop_scratch)) || badaddr((void *)__UNVOLATILE(&rp->siop_temp))) { return(0); } scratch = rp->siop_scratch; temp = rp->siop_temp; rp->siop_scratch = 0xdeadbeef; rp->siop_temp = 0xaaaa5555; if (rp->siop_scratch != 0xdeadbeef || rp->siop_temp != 0xaaaa5555) return(0); rp->siop_scratch = scratch; rp->siop_temp = temp; if (rp->siop_scratch != scratch || rp->siop_temp != temp) return(0); return(1); }
int wdc_amiga_probe(device_t parent, cfdata_t cfp, void *aux) { if ((!is_a4000() && !is_a1200() && !is_a600()) || !matchname(aux, "wdc")) return(0); return 1; }
int wdc_amiga_intr(void *arg) { struct wdc_amiga_softc *sc; uint8_t intreq; int ret; sc = (struct wdc_amiga_softc *)arg; ret = 0; intreq = gayle_intr_status(); if (intreq & GAYLE_INT_IDE) { if (!is_a4000()) gayle_intr_ack(0x7C | (intreq & GAYLE_INT_IDEACK)); ret = wdcintr(&sc->sc_channel); } return ret; }
void wdc_amiga_attach(device_t parent, device_t self, void *aux) { struct wdc_amiga_softc *sc = device_private(self); struct wdc_regs *wdr; int i; aprint_normal("\n"); sc->sc_wdcdev.sc_atac.atac_dev = self; sc->sc_wdcdev.regs = wdr = &sc->sc_wdc_regs; gayle_init(); if (is_a4000()) { sc->cmd_iot.base = (bus_addr_t) ztwomap(GAYLE_IDE_BASE_A4000 + 2); } else { sc->cmd_iot.base = (bus_addr_t) ztwomap(GAYLE_IDE_BASE + 2); } sc->cmd_iot.absm = sc->ctl_iot.absm = &amiga_bus_stride_4swap; wdr->cmd_iot = &sc->cmd_iot; wdr->ctl_iot = &sc->ctl_iot; if (bus_space_map(wdr->cmd_iot, 0, 0x40, 0, &wdr->cmd_baseioh)) { aprint_error_dev(self, "couldn't map registers\n"); return; } for (i = 0; i < WDC_NREG; i++) { if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh, i, i == 0 ? 4 : 1, &wdr->cmd_iohs[i]) != 0) { bus_space_unmap(wdr->cmd_iot, wdr->cmd_baseioh, 0x40); aprint_error_dev(self, "couldn't map registers\n"); return; } } if (bus_space_subregion(wdr->cmd_iot, wdr->cmd_baseioh, 0x406, 1, &wdr->ctl_ioh)) return; sc->sc_wdcdev.sc_atac.atac_cap = ATAC_CAP_DATA16; sc->sc_wdcdev.sc_atac.atac_pio_cap = 0; sc->sc_chanlist[0] = &sc->sc_channel; sc->sc_wdcdev.sc_atac.atac_channels = sc->sc_chanlist; sc->sc_wdcdev.sc_atac.atac_nchannels = 1; sc->sc_wdcdev.wdc_maxdrives = 2; sc->sc_channel.ch_channel = 0; sc->sc_channel.ch_atac = &sc->sc_wdcdev.sc_atac; sc->sc_channel.ch_queue = &sc->sc_chqueue; wdc_init_shadow_regs(&sc->sc_channel); sc->sc_isr.isr_intr = wdc_amiga_intr; sc->sc_isr.isr_arg = sc; sc->sc_isr.isr_ipl = 2; add_isr (&sc->sc_isr); if (!is_a4000()) gayle_intr_enable_set(GAYLE_INT_IDE); wdcattach(&sc->sc_channel); }