summaryrefslogtreecommitdiffstats
path: root/sys/sparc64/include/bus_private.h
diff options
context:
space:
mode:
authortmm <tmm@FreeBSD.org>2003-01-21 18:22:26 +0000
committertmm <tmm@FreeBSD.org>2003-01-21 18:22:26 +0000
commitc5298f4e6cc794e4370a71027577dc4ebfc4ac5e (patch)
tree7329e75f2c4a6881852d249a411ecd62deb32a00 /sys/sparc64/include/bus_private.h
parentcb27222f4795837aa939e012105958acc32c3d82 (diff)
downloadFreeBSD-src-c5298f4e6cc794e4370a71027577dc4ebfc4ac5e.zip
FreeBSD-src-c5298f4e6cc794e4370a71027577dc4ebfc4ac5e.tar.gz
Fixes for a number of problems in the IOMMU code:
1.) Fix an off-by-one in the DVMA space handling, which would make it possible to allocate one page beyond the end of the DVMA area. This page was aliased to the first page. Apparently, this bug was responsible for the trashed nvram/eeprom some people were reporting, in conjunction with a number of unfortunate coincidences. 2.) Fix broken boundary and and lowaddr calculations. 3.) Fix a memory leak on an error path. 4.) Update a outdated comment to reflect the introduction of IOMMU_MAX_PRE, make the usage of IOMMU_MAX_PRE more consistent and KASSERT that the preallocation size is not 0. 5.) Fix a case where an error return was lost. 6.) When signalling an error to the caller by invoking the callback, do not use a segment pointer of NULL for compatability with existing drivers. Also, increase the maximum segment number to 64; it is rather arbitrary, with the exception of the of the stack space consumed by the segment array. Special thanks go to Harti Brandt <brandt@fokus.fraunhofer.de> for spotting 4 and 5, and testing many iterations of patches. Pointy hats to: tmm
Diffstat (limited to 'sys/sparc64/include/bus_private.h')
-rw-r--r--sys/sparc64/include/bus_private.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/sparc64/include/bus_private.h b/sys/sparc64/include/bus_private.h
index 4b68ffd..6c3a86e 100644
--- a/sys/sparc64/include/bus_private.h
+++ b/sys/sparc64/include/bus_private.h
@@ -33,7 +33,12 @@
#include <sys/queue.h>
-#define BUS_DMAMAP_NSEGS ((BUS_SPACE_MAXSIZE / PAGE_SIZE) + 1)
+/*
+ * This is more or less arbitrary, except for the stack space consumed by
+ * the segments array. Choose more than ((BUS_SPACE_MAXSIZE / PAGE_SIZE) + 1),
+ * since in practice we could be map pages more than once.
+ */
+#define BUS_DMAMAP_NSEGS 64
struct bus_dmamap_res {
struct resource *dr_res;
OpenPOWER on IntegriCloud