summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorAlexander Yurchenko <grange@cvs.openbsd.org>2003-05-17 18:35:05 +0000
committerAlexander Yurchenko <grange@cvs.openbsd.org>2003-05-17 18:35:05 +0000
commit4b8ab9aa0889d4c4353a47a23f73ef70cad7e558 (patch)
tree77430951fc2327f0cb4420e741a3e2ec2bcaabd5 /sys/dev/pci
parent21959db67a6aea697e8e2d58032624da63b8a695 (diff)
Allow chip-specific setup routines to change dma engine parameters
(size and align of dma segment) since some chips may have quirks; from NetBSD. ok millert@
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/pciide.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/sys/dev/pci/pciide.c b/sys/dev/pci/pciide.c
index 56fb8628b4a..49f02f6e95f 100644
--- a/sys/dev/pci/pciide.c
+++ b/sys/dev/pci/pciide.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pciide.c,v 1.124 2003/05/17 18:31:54 grange Exp $ */
+/* $OpenBSD: pciide.c,v 1.125 2003/05/17 18:35:04 grange Exp $ */
/* $NetBSD: pciide.c,v 1.127 2001/08/03 01:31:08 tsutsui Exp $ */
/*
@@ -163,6 +163,13 @@ struct pciide_softc {
bus_space_handle_t sc_dma_ioh;
bus_dma_tag_t sc_dmat;
+ /*
+ * Some controllers might have DMA restrictions other than
+ * the norm.
+ */
+ bus_size_t sc_dma_maxsegsz;
+ bus_size_t sc_dma_boundary;
+
/* For Cypress */
const struct cy82c693_handle *sc_cy_handle;
int sc_cy_compatchan;
@@ -724,6 +731,10 @@ pciide_attach(parent, self, aux)
sc->sc_pc = pa->pa_pc;
sc->sc_tag = pa->pa_tag;
+ /* Set up DMA defaults; these might be adjusted by chip_map. */
+ sc->sc_dma_maxsegsz = IDEDMA_BYTE_COUNT_MAX;
+ sc->sc_dma_boundary = IDEDMA_BYTE_COUNT_ALIGN;
+
WDCDEBUG_PRINT((" sc_pc=%p, sc_tag=%p, pa_class=0x%x\n", sc->sc_pc,
sc->sc_tag, pa->pa_class), DEBUG_PROBE);
@@ -1120,7 +1131,7 @@ pciide_dma_table_setup(sc, channel, drive)
dma_maps->dmamap_table->dm_segs[0].ds_addr), DEBUG_PROBE);
/* Create a xfer DMA map for this drive */
if ((error = bus_dmamap_create(sc->sc_dmat, IDEDMA_BYTE_COUNT_MAX,
- NIDEDMA_TABLES, IDEDMA_BYTE_COUNT_MAX, IDEDMA_BYTE_COUNT_ALIGN,
+ NIDEDMA_TABLES, sc->sc_dma_maxsegsz, sc->sc_dma_boundary,
BUS_DMA_NOWAIT | BUS_DMA_ALLOCNOW,
&dma_maps->dmamap_xfer)) != 0) {
printf("%s:%d: unable to create xfer DMA map for "