aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/bhnd
diff options
context:
space:
mode:
authorLandon J. Fuller <landonf@FreeBSD.org>2017-12-16 04:35:37 +0000
committerLandon J. Fuller <landonf@FreeBSD.org>2017-12-16 04:35:37 +0000
commit80a7c0f53bac4410ef9fc8ca8614be0ec1057c06 (patch)
tree6134e08822c193a6102a0e00a9b023c5256cb6a5 /sys/dev/bhnd
parent6e050ee62a820af76719b5c8cd23c0d41c6550cb (diff)
Notes
Diffstat (limited to 'sys/dev/bhnd')
-rw-r--r--sys/dev/bhnd/bhndb/bhndb_pci_hwdata.c6
-rw-r--r--sys/dev/bhnd/bhndb/bhndb_subr.c18
2 files changed, 11 insertions, 13 deletions
diff --git a/sys/dev/bhnd/bhndb/bhndb_pci_hwdata.c b/sys/dev/bhnd/bhndb/bhndb_pci_hwdata.c
index bf8c3ed7e204..67d0e804cd7c 100644
--- a/sys/dev/bhnd/bhndb/bhndb_pci_hwdata.c
+++ b/sys/dev/bhnd/bhndb/bhndb_pci_hwdata.c
@@ -511,7 +511,7 @@ static const struct bhndb_hwcfg bhndb_pci_hwcfg_v1_pcie = {
{
.base_addr = BHND_PCIE_DMA64_TRANSLATION,
.addr_mask = ~BHND_PCIE_DMA64_MASK,
- .addrext_mask = 0
+ .addrext_mask = BHND_PCIE_DMA64_MASK
},
BHND_DMA_TRANSLATION_TABLE_END
}
@@ -594,7 +594,7 @@ static const struct bhndb_hwcfg bhndb_pci_hwcfg_v2 = {
{
.base_addr = BHND_PCIE_DMA64_TRANSLATION,
.addr_mask = ~BHND_PCIE_DMA64_MASK,
- .addrext_mask = 0
+ .addrext_mask = BHND_PCIE_DMA64_MASK
},
BHND_DMA_TRANSLATION_TABLE_END
}
@@ -672,7 +672,7 @@ static const struct bhndb_hwcfg bhndb_pci_hwcfg_v3 = {
{
.base_addr = BHND_PCIE2_DMA64_TRANSLATION,
.addr_mask = ~BHND_PCIE2_DMA64_MASK,
- .addrext_mask = 0
+ .addrext_mask = BHND_PCIE_DMA64_MASK
},
BHND_DMA_TRANSLATION_TABLE_END
}
diff --git a/sys/dev/bhnd/bhndb/bhndb_subr.c b/sys/dev/bhnd/bhndb/bhndb_subr.c
index c2392ecc00d7..7ebabc5c6226 100644
--- a/sys/dev/bhnd/bhndb/bhndb_subr.c
+++ b/sys/dev/bhnd/bhndb/bhndb_subr.c
@@ -521,12 +521,12 @@ bhndb_dma_tag_create(device_t dev, bus_dma_tag_t parent_dmat,
{
bus_dma_tag_t translation_tag;
bhnd_addr_t dt_mask;
- bus_addr_t boundary;
bus_addr_t lowaddr, highaddr;
+ bus_size_t maxsegsz;
int error;
highaddr = BUS_SPACE_MAXADDR;
- boundary = 0;
+ maxsegsz = BUS_SPACE_MAXSIZE;
/* Determine full addressable mask */
dt_mask = (translation->addr_mask | translation->addrext_mask);
@@ -536,19 +536,17 @@ bhndb_dma_tag_create(device_t dev, bus_dma_tag_t parent_dmat,
/* (addr_mask|addrext_mask) is our maximum supported address */
lowaddr = MIN(dt_mask, BUS_SPACE_MAXADDR);
- /* Do we need to to avoid crossing a DMA translation window boundary? */
- if (translation->addr_mask < BUS_SPACE_MAXADDR) {
- /* round down to nearest power of two */
- boundary = translation->addr_mask & (~1ULL);
- }
+ /* Constrain to translation window size */
+ if (translation->addr_mask < maxsegsz)
+ maxsegsz = translation->addr_mask;
/* Create our DMA tag */
error = bus_dma_tag_create(parent_dmat,
- 1, /* alignment */
- boundary, lowaddr, highaddr,
+ 1, 0, /* alignment, boundary */
+ lowaddr, highaddr,
NULL, NULL, /* filter, filterarg */
BUS_SPACE_MAXSIZE, 0, /* maxsize, nsegments */
- BUS_SPACE_MAXSIZE, 0, /* maxsegsize, flags */
+ maxsegsz, 0, /* maxsegsize, flags */
NULL, NULL, /* lockfunc, lockarg */
&translation_tag);
if (error) {