diff options
author | sos <sos@FreeBSD.org> | 2005-10-06 15:44:07 +0000 |
---|---|---|
committer | sos <sos@FreeBSD.org> | 2005-10-06 15:44:07 +0000 |
commit | 84b311757f08e75b3d4c4210fbb357e1fcf3d748 (patch) | |
tree | 0865eae36111178e7797a9a91aaff2e630347ed4 /sys | |
parent | a6cc05cfd1542bb7b2c631e44e266ef52c0f083a (diff) | |
download | FreeBSD-src-84b311757f08e75b3d4c4210fbb357e1fcf3d748.zip FreeBSD-src-84b311757f08e75b3d4c4210fbb357e1fcf3d748.tar.gz |
Add support for setting the SG list segment size.
Use this for the SiI3112 workaround to get rid of the "oversized DMA" errors.
MFC to 6.0 candidate.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ata/ata-all.h | 9 | ||||
-rw-r--r-- | sys/dev/ata/ata-chipset.c | 10 | ||||
-rw-r--r-- | sys/dev/ata/ata-dma.c | 11 |
3 files changed, 19 insertions, 11 deletions
diff --git a/sys/dev/ata/ata-all.h b/sys/dev/ata/ata-all.h index bce3497..5bc3b16 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 0bba2a6..62817f3 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 f8c4411..4032a48 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; |