diff --git a/sys/dev/ata/ata-all.h b/sys/dev/ata/ata-all.h index bce3497dce8f..5bc3b16cbe52 100644 --- a/sys/dev/ata/ata-all.h +++ b/sys/dev/ata/ata-all.h @@ -448,10 +448,11 @@ struct ata_dma { u_int8_t *work; /* workspace */ bus_addr_t work_bus; /* bus address of dmatab */ - u_int32_t alignment; /* DMA engine alignment */ - u_int32_t boundary; /* DMA engine boundary */ - u_int32_t max_iosize; /* DMA engine max IO size */ - u_int32_t cur_iosize; /* DMA engine current IO size */ + u_int32_t alignment; /* DMA SG list alignment */ + u_int32_t boundary; /* DMA SG list boundary */ + u_int32_t segsize; /* DMA SG list segment size */ + u_int32_t max_iosize; /* DMA data max IO size */ + u_int32_t cur_iosize; /* DMA data current IO size */ int flags; #define ATA_DMA_READ 0x01 /* transaction is a read */ #define ATA_DMA_LOADED 0x02 /* DMA tables etc loaded */ diff --git a/sys/dev/ata/ata-chipset.c b/sys/dev/ata/ata-chipset.c index 0bba2a6f70e3..62817f30a685 100644 --- a/sys/dev/ata/ata-chipset.c +++ b/sys/dev/ata/ata-chipset.c @@ -66,7 +66,6 @@ static int ata_ahci_begin_transaction(struct ata_request *request); static int ata_ahci_end_transaction(struct ata_request *request); static void ata_ahci_intr(void *data); static void ata_ahci_reset(device_t dev); -static void ata_ahci_dmasetprd(void *xsc, bus_dma_segment_t *segs, int nsegs, int error); static void ata_ahci_dmainit(device_t dev); static int ata_acard_chipinit(device_t dev); static void ata_acard_intr(void *data); @@ -3426,7 +3425,7 @@ ata_sii_allocate(device_t dev) if ((ctlr->chip->cfg2 & SIIBUG) && ch->dma) { /* work around errata in early chips */ ch->dma->boundary = 16 * DEV_BSIZE; - ch->dma->max_iosize = 15 * DEV_BSIZE; + ch->dma->segsize = 15 * DEV_BSIZE; } ata_generic_hw(dev); @@ -3553,6 +3552,13 @@ ata_sii_reset(device_t dev) /* disable PHY state change interrupt */ ATA_OUTL(ctlr->r_res2, 0x148 + offset, ~(1 << 16)); + /* reset controller part for this channel */ + ATA_OUTL(ctlr->r_res2, 0x48, + ATA_INL(ctlr->r_res2, 0x48) | (0xc0 >> ch->unit)); + DELAY(1000); + ATA_OUTL(ctlr->r_res2, 0x48, + ATA_INL(ctlr->r_res2, 0x48) & ~(0xc0 >> ch->unit)); + ata_sata_phy_enable(ch); /* enable PHY state change interrupt */ diff --git a/sys/dev/ata/ata-dma.c b/sys/dev/ata/ata-dma.c index f8c4411d73c4..4032a48f6fc2 100644 --- a/sys/dev/ata/ata-dma.c +++ b/sys/dev/ata/ata-dma.c @@ -77,8 +77,9 @@ ata_dmainit(device_t dev) ch->dma->load = ata_dmaload; ch->dma->unload = ata_dmaunload; ch->dma->alignment = 2; - ch->dma->max_iosize = 128 * DEV_BSIZE; ch->dma->boundary = 128 * DEV_BSIZE; + ch->dma->segsize = 128 * DEV_BSIZE; + ch->dma->max_iosize = 128 * DEV_BSIZE; } } @@ -99,8 +100,8 @@ ata_dmaalloc(device_t dev) if (bus_dma_tag_create(NULL, ch->dma->alignment, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, - NULL, NULL, 256 * DEV_BSIZE, - ATA_DMA_ENTRIES, ch->dma->max_iosize, + NULL, NULL, ch->dma->max_iosize, + ATA_DMA_ENTRIES, ch->dma->segsize, 0, NULL, NULL, &ch->dma->dmatag)) goto error; @@ -112,8 +113,8 @@ ata_dmaalloc(device_t dev) if (bus_dma_tag_create(ch->dma->dmatag,ch->dma->alignment,ch->dma->boundary, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, - NULL, NULL, 256 * DEV_BSIZE, - ATA_DMA_ENTRIES, ch->dma->max_iosize, + NULL, NULL, ch->dma->max_iosize, + ATA_DMA_ENTRIES, ch->dma->segsize, BUS_DMA_ALLOCNOW, NULL, NULL, &ch->dma->data_tag)) goto error;