Lines Matching defs:esc

210 	struct esp_pci_softc *esc;
214 esc = device_get_softc(dev);
215 sc = &esc->sc_ncr53c9x;
219 esc->sc_dev = dev;
224 error = bus_alloc_resources(dev, esp_pci_res_spec, esc->sc_res);
227 bus_release_resources(dev, esp_pci_res_spec, esc->sc_res);
234 BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, &esc->sc_pdmat);
287 error = bus_dma_tag_create(esc->sc_pdmat, PAGE_SIZE, 0,
290 busdma_lock_mutex, &sc->sc_lock, &esc->sc_xferdmat);
295 error = bus_dmamap_create(esc->sc_xferdmat, 0, &esc->sc_xferdmam);
301 error = bus_setup_intr(dev, esc->sc_res[ESP_PCI_RES_INTR],
303 &esc->sc_ih);
310 sc->sc_dev = esc->sc_dev;
313 device_printf(esc->sc_dev, "ncr53c9x_attach failed\n");
320 bus_teardown_intr(esc->sc_dev, esc->sc_res[ESP_PCI_RES_INTR],
321 esc->sc_ih);
323 bus_dmamap_destroy(esc->sc_xferdmat, esc->sc_xferdmam);
325 bus_dma_tag_destroy(esc->sc_xferdmat);
327 bus_dma_tag_destroy(esc->sc_pdmat);
329 bus_release_resources(dev, esp_pci_res_spec, esc->sc_res);
339 struct esp_pci_softc *esc;
342 esc = device_get_softc(dev);
343 sc = &esc->sc_ncr53c9x;
345 bus_teardown_intr(esc->sc_dev, esc->sc_res[ESP_PCI_RES_INTR],
346 esc->sc_ih);
350 bus_dmamap_destroy(esc->sc_xferdmat, esc->sc_xferdmam);
351 bus_dma_tag_destroy(esc->sc_xferdmat);
352 bus_dma_tag_destroy(esc->sc_pdmat);
353 bus_release_resources(dev, esp_pci_res_spec, esc->sc_res);
376 struct esp_pci_softc *esc = (struct esp_pci_softc *)arg;
388 WRITE_DMAREG(esc, DMA_SPA, segs[0].ds_addr);
398 struct esp_pci_softc *esc = (struct esp_pci_softc *)sc;
400 return (READ_ESPREG(esc, reg));
406 struct esp_pci_softc *esc = (struct esp_pci_softc *)sc;
408 WRITE_ESPREG(esc, reg, v);
414 struct esp_pci_softc *esc = (struct esp_pci_softc *)sc;
416 return (READ_ESPREG(esc, NCR_STAT) & NCRSTAT_INT) != 0;
422 struct esp_pci_softc *esc = (struct esp_pci_softc *)sc;
424 WRITE_DMAREG(esc, DMA_CMD, DMACMD_IDLE);
426 esc->sc_active = 0;
432 struct esp_pci_softc *esc = (struct esp_pci_softc *)sc;
440 xferdmat = esc->sc_xferdmat;
441 xferdmam = esc->sc_xferdmam;
442 datain = esc->sc_datain;
444 dmastat = READ_DMAREG(esc, DMA_STAT);
448 WRITE_DMAREG(esc, DMA_CMD, DMACMD_ABORT | (datain != 0 ?
451 device_printf(esc->sc_dev, "DMA error detected; Aborting.\n");
460 device_printf(esc->sc_dev, "DMA aborted.\n");
461 WRITE_DMAREG(esc, DMA_CMD, DMACMD_IDLE | (datain != 0 ?
463 esc->sc_active = 0;
467 KASSERT(esc->sc_active != 0, ("%s: DMA wasn't active", __func__));
471 esc->sc_active = 0;
473 dmasize = esc->sc_dmasize;
477 __func__, READ_ESPREG(esc, NCR_TCL) |
478 (READ_ESPREG(esc, NCR_TCM) << 8),
479 READ_ESPREG(esc, NCR_TCL), READ_ESPREG(esc, NCR_TCM)));
491 (resid = (READ_ESPREG(esc, NCR_FFLAG) & NCRFIFO_FF)) != 0)
500 resid = READ_ESPREG(esc, NCR_FFLAG) & NCRFIFO_FF;
503 READ_ESPREG(esc, NCR_FFLAG) & NCRFIFO_FF;
504 WRITE_DMAREG(esc, DMA_CMD, DMACMD_BLAST | DMACMD_DIR);
507 if ((READ_DMAREG(esc, DMA_STAT) &
513 p = *esc->sc_dmaaddr;
516 resid += READ_ESPREG(esc, NCR_TCL) |
517 (READ_ESPREG(esc, NCR_TCM) << 8) |
518 (READ_ESPREG(esc, NCR_TCH) << 16);
521 dmastat = READ_DMAREG(esc, DMA_STAT);
523 WRITE_DMAREG(esc, DMA_CMD, DMACMD_IDLE | (datain != 0 ?
543 *p = READ_ESPREG(esc, NCR_FIFO);
560 READ_ESPREG(esc, NCR_TCL), READ_ESPREG(esc, NCR_TCM),
561 READ_ESPREG(esc, NCR_TCH), trans, resid));
563 *esc->sc_dmalen -= trans;
564 *esc->sc_dmaaddr = (char *)*esc->sc_dmaaddr + trans;
573 struct esp_pci_softc *esc = (struct esp_pci_softc *)sc;
576 WRITE_DMAREG(esc, DMA_CMD, DMACMD_IDLE | (datain != 0 ? DMACMD_DIR :
579 *dmasize = esc->sc_dmasize = ulmin(*dmasize, MDL_SEG_SIZE);
580 esc->sc_dmaaddr = addr;
581 esc->sc_dmalen = len;
582 esc->sc_datain = datain;
591 WRITE_DMAREG(esc, DMA_STC, *dmasize);
598 error = bus_dmamap_load(esc->sc_xferdmat, esc->sc_xferdmam,
599 *esc->sc_dmaaddr, *dmasize, esp_pci_xfermap, sc, BUS_DMA_NOWAIT);
607 struct esp_pci_softc *esc = (struct esp_pci_softc *)sc;
610 datain = esc->sc_datain;
613 if (esc->sc_dmasize == 0)
617 bus_dmamap_sync(esc->sc_xferdmat, esc->sc_xferdmam, datain != 0 ?
622 WRITE_DMAREG(esc, DMA_CMD, DMACMD_IDLE | /* DMACMD_INTE | */
626 WRITE_DMAREG(esc, DMA_CMD, DMACMD_START | /* DMACMD_INTE | */
629 esc->sc_active = 1;
635 struct esp_pci_softc *esc = (struct esp_pci_softc *)sc;
639 WRITE_DMAREG(esc, DMA_CMD,
640 DMACMD_ABORT | (esc->sc_datain != 0 ? DMACMD_DIR : 0));
641 bus_dmamap_unload(esc->sc_xferdmat, esc->sc_xferdmam);
643 esc->sc_active = 0;
649 struct esp_pci_softc *esc = (struct esp_pci_softc *)sc;
651 /* XXX should we check esc->sc_active? */
652 if ((READ_DMAREG(esc, DMA_CMD) & DMACMD_CMD) != DMACMD_IDLE)