summaryrefslogtreecommitdiffstats
path: root/sys/dev/sym
diff options
context:
space:
mode:
authorse <se@FreeBSD.org>2005-01-01 19:05:46 +0000
committerse <se@FreeBSD.org>2005-01-01 19:05:46 +0000
commit7fcc15c5a877082613e40bedae5388979e1bd0b8 (patch)
treed1d94fa506245829b78bdbe30a7111cf53b4a439 /sys/dev/sym
parent1e74fcad724135c96959befdffe34165f928be00 (diff)
downloadFreeBSD-src-7fcc15c5a877082613e40bedae5388979e1bd0b8.zip
FreeBSD-src-7fcc15c5a877082613e40bedae5388979e1bd0b8.tar.gz
Attempt to fix Symbios driver on amd64. The private memory allocation
function provided by the driver limits allocations to the page size, i.e. 4KB on i385 and 8KB on typical 64 bit processors. Since amd64 has 64 bit pointers, but only 4KB pages, an array of pointers that just fits into one page on all the other processors, does require 2 pages on amd64. In order to make this driver useful on amd64, the allocation unit has been increased to 2 pages on amd64 and contigmalloc() is used instead of malloc(). All other processor types are unaffected by this change. This modification has only been compile-tested on amd64, yet, but should just work (FLW).
Diffstat (limited to 'sys/dev/sym')
-rw-r--r--sys/dev/sym/sym_hipd.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/dev/sym/sym_hipd.c b/sys/dev/sym/sym_hipd.c
index ced33f3..a737671 100644
--- a/sys/dev/sym/sym_hipd.c
+++ b/sys/dev/sym/sym_hipd.c
@@ -431,7 +431,11 @@ static void MDELAY(int ms) { while (ms--) UDELAY(1000); }
*/
#define MEMO_SHIFT 4 /* 16 bytes minimum memory chunk */
+#ifndef __amd64__
#define MEMO_PAGE_ORDER 0 /* 1 PAGE maximum */
+#else
+#define MEMO_PAGE_ORDER 1 /* 2 PAGEs maximum on amd64 */
+#endif
#if 0
#define MEMO_FREE_UNUSED /* Free unused pages immediately */
#endif
@@ -440,8 +444,14 @@ static void MDELAY(int ms) { while (ms--) UDELAY(1000); }
#define MEMO_CLUSTER_SIZE (1UL << MEMO_CLUSTER_SHIFT)
#define MEMO_CLUSTER_MASK (MEMO_CLUSTER_SIZE-1)
+#ifndef __amd64__
#define get_pages() malloc(MEMO_CLUSTER_SIZE, M_DEVBUF, M_NOWAIT)
#define free_pages(p) free((p), M_DEVBUF)
+#else
+#define get_pages() contigmalloc(MEMO_CLUSTER_SIZE, M_DEVBUF, \
+ 0, 0, 1LL << 32, PAGE_SIZE, 1LL << 32)
+#define free_pages(p) contigfree((p), MEMO_CLUSTER_SIZE, M_DEVBUF)
+#endif
typedef u_long m_addr_t; /* Enough bits to bit-hack addresses */
OpenPOWER on IntegriCloud