Lines Matching refs:asc
59 bus_space_handle_t sc_scsi_bsh; /* ASC register handle */
71 #define ASC_READ_REG(asc, reg) \
72 ((uint8_t)bus_space_read_4((asc)->sc_bst, (asc)->sc_scsi_bsh, \
74 #define ASC_WRITE_REG(asc, reg, val) \
75 bus_space_write_4((asc)->sc_bst, (asc)->sc_scsi_bsh, \
113 if (strncmp("asc", d->iada_modname, TC_ROM_LLEN))
122 struct asc_softc *asc = device_private(self);
123 struct ncr53c9x_softc *sc = &asc->sc_ncr53c9x;
132 asc->sc_bst = isc->sc_bst;
133 asc->sc_bsh = isc->sc_bsh;
134 if (bus_space_subregion(asc->sc_bst, asc->sc_bsh,
135 IOASIC_SLOT_12_START, 0x100, &asc->sc_scsi_bsh)) {
139 asc->sc_dmat = isc->sc_dmat;
140 if (bus_dmamap_create(asc->sc_dmat, PAGE_SIZE * 2,
142 &asc->sc_dmamap)) {
197 struct asc_softc *asc = (struct asc_softc *)sc;
200 ssr = bus_space_read_4(asc->sc_bst, asc->sc_bsh, IOASIC_CSR);
202 bus_space_write_4(asc->sc_bst, asc->sc_bsh, IOASIC_CSR, ssr);
203 bus_space_write_4(asc->sc_bst, asc->sc_bsh, IOASIC_SCSI_SCR, 0);
205 if (asc->sc_flags & ASC_MAPLOADED)
206 bus_dmamap_unload(asc->sc_dmat, asc->sc_dmamap);
207 asc->sc_flags &= ~(ASC_DMAACTIVE|ASC_MAPLOADED);
216 struct asc_softc *asc = (struct asc_softc *)sc;
222 *asc->sc_dmalen, *asc->sc_dmaaddr, ispullup ? "IN" : "OUT"));
226 asc->sc_dmaaddr = addr;
227 asc->sc_dmalen = len;
228 asc->sc_dmasize = size;
229 asc->sc_flags = (ispullup) ? ASC_ISPULLUP : 0;
233 ssr = bus_space_read_4(asc->sc_bst, asc->sc_bsh, IOASIC_CSR);
235 bus_space_write_4(asc->sc_bst, asc->sc_bsh, IOASIC_CSR, ssr);
238 if (bus_dmamap_load(asc->sc_dmat, asc->sc_dmamap,
255 asc->sc_dmamap->dm_segs[0].ds_addr &= ~7;
256 asc->sc_dmamap->dm_segs[0].ds_len += (cp & 6);
257 if ((asc->sc_flags & ASC_ISPULLUP) == 0) {
261 asc->sc_dmamap->dm_segs[0].ds_addr += 8;
265 bus_space_write_4(asc->sc_bst, asc->sc_bsh,
267 bus_space_write_4(asc->sc_bst, asc->sc_bsh,
270 bus_space_write_4(asc->sc_bst, asc->sc_bsh,
272 IOASIC_DMA_ADDR(asc->sc_dmamap->dm_segs[0].ds_addr));
273 bus_space_write_4(asc->sc_bst, asc->sc_bsh,
275 (asc->sc_dmamap->dm_nsegs == 1) ?
276 ~0 : IOASIC_DMA_ADDR(asc->sc_dmamap->dm_segs[1].ds_addr));
277 bus_space_write_4(asc->sc_bst, asc->sc_bsh, IOASIC_SCSI_SCR, scr);
280 bus_dmamap_sync(asc->sc_dmat, asc->sc_dmamap,
284 asc->sc_flags |= ASC_MAPLOADED;
291 struct asc_softc *asc = (struct asc_softc *)sc;
294 ssr = bus_space_read_4(asc->sc_bst, asc->sc_bsh, IOASIC_CSR);
295 if (asc->sc_flags & ASC_ISPULLUP)
300 bus_space_write_4(asc->sc_bst, asc->sc_bsh, IOASIC_CSR, ssr);
301 ssr = bus_space_read_4(asc->sc_bst, asc->sc_bsh, IOASIC_CSR);
304 bus_space_write_4(asc->sc_bst, asc->sc_bsh, IOASIC_CSR, ssr);
305 asc->sc_flags |= ASC_DMAACTIVE;
311 struct asc_softc *asc = (struct asc_softc *)sc;
315 if ((asc->sc_flags & ASC_DMAACTIVE) == 0)
326 intr = bus_space_read_4(asc->sc_bst, asc->sc_bsh, IOASIC_INTR);
329 bus_space_write_4(asc->sc_bst, asc->sc_bsh, IOASIC_INTR, intr);
333 ssr = bus_space_read_4(asc->sc_bst, asc->sc_bsh, IOASIC_CSR);
335 bus_space_write_4(asc->sc_bst, asc->sc_bsh, IOASIC_CSR, ssr);
337 asc->sc_flags &= ~ASC_DMAACTIVE;
339 if (asc->sc_dmasize == 0) {
341 tcl = ASC_READ_REG(asc, NCR_TCL);
342 tcm = ASC_READ_REG(asc, NCR_TCM);
349 if ((asc->sc_flags & ASC_ISPULLUP) == 0 &&
350 (resid = (ASC_READ_REG(asc, NCR_FFLAG) & NCRFIFO_FF)) != 0) {
355 resid += (tcl = ASC_READ_REG(asc, NCR_TCL));
356 resid += (tcm = ASC_READ_REG(asc, NCR_TCM)) << 8;
358 trans = asc->sc_dmasize - resid;
361 trans, asc->sc_dmasize);
362 trans = asc->sc_dmasize;
367 bus_dmamap_sync(asc->sc_dmat, asc->sc_dmamap,
368 0, asc->sc_dmasize,
369 (asc->sc_flags & ASC_ISPULLUP) ?
372 scr = bus_space_read_4(asc->sc_bst, asc->sc_bsh, IOASIC_SCSI_SCR);
373 if ((asc->sc_flags & ASC_ISPULLUP) && scr != 0) {
376 sdr[0] = bus_space_read_4(asc->sc_bst, asc->sc_bsh,
378 sdr[1] = bus_space_read_4(asc->sc_bst, asc->sc_bsh,
380 ptr = bus_space_read_4(asc->sc_bst, asc->sc_bsh,
392 bus_dmamap_unload(asc->sc_dmat, asc->sc_dmamap);
393 asc->sc_flags &= ~ASC_MAPLOADED;
395 *asc->sc_dmalen -= trans;
396 *asc->sc_dmaaddr += trans;
405 struct asc_softc *asc = (struct asc_softc *)sc;
407 if (asc->sc_flags & ASC_MAPLOADED) {
408 bus_dmamap_sync(asc->sc_dmat, asc->sc_dmamap,
409 0, asc->sc_dmasize,
410 (asc->sc_flags & ASC_ISPULLUP) ?
412 bus_dmamap_unload(asc->sc_dmat, asc->sc_dmamap);
415 asc->sc_flags &= ~(ASC_DMAACTIVE|ASC_MAPLOADED);
421 struct asc_softc *asc = (struct asc_softc *)sc;
423 return ASC_READ_REG(asc, reg);
429 struct asc_softc *asc = (struct asc_softc *)sc;
431 ASC_WRITE_REG(asc, reg, val);
437 struct asc_softc *asc = (struct asc_softc *)sc;
439 return (ASC_READ_REG(asc, NCR_STAT) & NCRSTAT_INT) != 0;
445 struct asc_softc *asc = (struct asc_softc *)sc;
447 return (asc->sc_flags & ASC_DMAACTIVE) != 0;