mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-16 10:20:30 +00:00
Update on the last commit, the dma* funciton needs to be called with
a channel device, not an ata device, or we'll be out of luck in reset/timeout where we dont have a device.
This commit is contained in:
parent
6bd1d1a192
commit
9ec5e87f63
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=145769
@ -2004,7 +2004,7 @@ ata_promise_sx4_intr(void *data)
|
||||
static int
|
||||
ata_promise_mio_dmastart(device_t dev)
|
||||
{
|
||||
struct ata_channel *ch = device_get_softc(device_get_parent(dev));
|
||||
struct ata_channel *ch = device_get_softc(dev);
|
||||
|
||||
ch->flags |= ATA_DMA_ACTIVE;
|
||||
return 0;
|
||||
@ -2013,7 +2013,7 @@ ata_promise_mio_dmastart(device_t dev)
|
||||
static int
|
||||
ata_promise_mio_dmastop(device_t dev)
|
||||
{
|
||||
struct ata_channel *ch = device_get_softc(device_get_parent(dev));
|
||||
struct ata_channel *ch = device_get_softc(dev);
|
||||
|
||||
ch->flags &= ~ATA_DMA_ACTIVE;
|
||||
/* get status XXX SOS */
|
||||
@ -2428,8 +2428,8 @@ ata_promise_old_intr(void *data)
|
||||
static int
|
||||
ata_promise_new_dmastart(device_t dev)
|
||||
{
|
||||
struct ata_pci_controller *ctlr = device_get_softc(GRANDPARENT(dev));
|
||||
struct ata_channel *ch = device_get_softc(device_get_parent(dev));
|
||||
struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
|
||||
struct ata_channel *ch = device_get_softc(dev);
|
||||
|
||||
if (ch->flags & ATA_48BIT_ACTIVE) {
|
||||
ATA_OUTB(ctlr->r_res1, 0x11,
|
||||
@ -2451,8 +2451,8 @@ ata_promise_new_dmastart(device_t dev)
|
||||
static int
|
||||
ata_promise_new_dmastop(device_t dev)
|
||||
{
|
||||
struct ata_pci_controller *ctlr = device_get_softc(GRANDPARENT(dev));
|
||||
struct ata_channel *ch = device_get_softc(device_get_parent(dev));
|
||||
struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
|
||||
struct ata_channel *ch = device_get_softc(dev);
|
||||
int error;
|
||||
|
||||
if (ch->flags & ATA_48BIT_ACTIVE) {
|
||||
|
@ -218,7 +218,7 @@ ata_dmasetprd(void *xsc, bus_dma_segment_t *segs, int nsegs, int error)
|
||||
static int
|
||||
ata_dmaload(device_t dev, caddr_t data, int32_t count, int dir)
|
||||
{
|
||||
struct ata_channel *ch = device_get_softc(device_get_parent(dev));
|
||||
struct ata_channel *ch = device_get_softc(dev);
|
||||
struct ata_dmasetprd_args cba;
|
||||
|
||||
if (ch->dma->flags & ATA_DMA_LOADED) {
|
||||
@ -259,7 +259,7 @@ ata_dmaload(device_t dev, caddr_t data, int32_t count, int dir)
|
||||
int
|
||||
ata_dmaunload(device_t dev)
|
||||
{
|
||||
struct ata_channel *ch = device_get_softc(device_get_parent(dev));
|
||||
struct ata_channel *ch = device_get_softc(dev);
|
||||
bus_dmamap_sync(ch->dma->sg_tag, ch->dma->sg_map, BUS_DMASYNC_POSTWRITE);
|
||||
|
||||
bus_dmamap_sync(ch->dma->data_tag, ch->dma->data_map,
|
||||
|
@ -129,7 +129,7 @@ ata_begin_transaction(struct ata_request *request)
|
||||
/* ATA DMA data transfer commands */
|
||||
case ATA_R_DMA:
|
||||
/* check sanity, setup SG list and DMA engine */
|
||||
if (ch->dma->load(request->dev, request->data, request->bytecount,
|
||||
if (ch->dma->load(ch->dev, request->data, request->bytecount,
|
||||
request->flags & ATA_R_READ)) {
|
||||
device_printf(request->dev, "setting up DMA failed\n");
|
||||
request->result = EIO;
|
||||
@ -147,7 +147,7 @@ ata_begin_transaction(struct ata_request *request)
|
||||
}
|
||||
|
||||
/* start DMA engine */
|
||||
if (ch->dma->start(request->dev)) {
|
||||
if (ch->dma->start(ch->dev)) {
|
||||
device_printf(request->dev, "error starting DMA\n");
|
||||
request->result = EIO;
|
||||
goto begin_finished;
|
||||
@ -218,7 +218,7 @@ ata_begin_transaction(struct ata_request *request)
|
||||
}
|
||||
|
||||
/* check sanity, setup SG list and DMA engine */
|
||||
if (ch->dma->load(request->dev, request->data, request->bytecount,
|
||||
if (ch->dma->load(ch->dev, request->data, request->bytecount,
|
||||
request->flags & ATA_R_READ)) {
|
||||
device_printf(request->dev, "setting up DMA failed\n");
|
||||
request->result = EIO;
|
||||
@ -261,7 +261,7 @@ ata_begin_transaction(struct ata_request *request)
|
||||
ATA_PROTO_ATAPI_12 ? 6 : 8);
|
||||
|
||||
/* start DMA engine */
|
||||
if (ch->dma->start(request->dev)) {
|
||||
if (ch->dma->start(ch->dev)) {
|
||||
request->result = EIO;
|
||||
goto begin_finished;
|
||||
}
|
||||
@ -272,7 +272,7 @@ ata_begin_transaction(struct ata_request *request)
|
||||
|
||||
begin_finished:
|
||||
if (ch->dma && ch->dma->flags & ATA_DMA_LOADED)
|
||||
ch->dma->unload(request->dev);
|
||||
ch->dma->unload(ch->dev);
|
||||
return ATA_OP_FINISHED;
|
||||
|
||||
begin_continue:
|
||||
@ -390,7 +390,7 @@ ata_end_transaction(struct ata_request *request)
|
||||
|
||||
/* stop DMA engine and get status */
|
||||
if (ch->dma->stop)
|
||||
request->dmastat = ch->dma->stop(request->dev);
|
||||
request->dmastat = ch->dma->stop(ch->dev);
|
||||
|
||||
/* did we get error or data */
|
||||
if (request->status & ATA_S_ERROR)
|
||||
@ -401,7 +401,7 @@ ata_end_transaction(struct ata_request *request)
|
||||
request->donecount = request->bytecount;
|
||||
|
||||
/* release SG list etc */
|
||||
ch->dma->unload(request->dev);
|
||||
ch->dma->unload(ch->dev);
|
||||
|
||||
/* done with HW */
|
||||
goto end_finished;
|
||||
@ -502,7 +502,7 @@ ata_end_transaction(struct ata_request *request)
|
||||
|
||||
/* stop the engine and get engine status */
|
||||
if (ch->dma->stop)
|
||||
request->dmastat = ch->dma->stop(request->dev);
|
||||
request->dmastat = ch->dma->stop(ch->dev);
|
||||
|
||||
/* did we get error or data */
|
||||
if (request->status & (ATA_S_ERROR | ATA_S_DWF))
|
||||
@ -513,7 +513,7 @@ ata_end_transaction(struct ata_request *request)
|
||||
request->donecount = request->bytecount;
|
||||
|
||||
/* release SG list etc */
|
||||
ch->dma->unload(request->dev);
|
||||
ch->dma->unload(ch->dev);
|
||||
|
||||
/* done with HW */
|
||||
goto end_finished;
|
||||
|
@ -419,7 +419,7 @@ ata_pci_allocate(device_t dev)
|
||||
static int
|
||||
ata_pci_dmastart(device_t dev)
|
||||
{
|
||||
struct ata_channel *ch = device_get_softc(device_get_parent(dev));
|
||||
struct ata_channel *ch = device_get_softc(dev);
|
||||
|
||||
ATA_IDX_OUTB(ch, ATA_BMSTAT_PORT, (ATA_IDX_INB(ch, ATA_BMSTAT_PORT) |
|
||||
(ATA_BMSTAT_INTERRUPT | ATA_BMSTAT_ERROR)));
|
||||
@ -435,7 +435,7 @@ ata_pci_dmastart(device_t dev)
|
||||
static int
|
||||
ata_pci_dmastop(device_t dev)
|
||||
{
|
||||
struct ata_channel *ch = device_get_softc(device_get_parent(dev));
|
||||
struct ata_channel *ch = device_get_softc(dev);
|
||||
int error;
|
||||
|
||||
ATA_IDX_OUTB(ch, ATA_BMCMD_PORT,
|
||||
|
Loading…
Reference in New Issue
Block a user