amd64/89550: [amd64] sym0: VTOBUS failed (6.0 Release)
Jan Mikkelsen
janm at transactionware.com
Mon Sep 25 20:10:21 PDT 2006
The following reply was made to PR amd64/89550; it has been noted by GNATS.
From: "Jan Mikkelsen" <janm at transactionware.com>
To: <bug-followup at FreeBSD.org>,
<awallac3 at uiuc.edu>
Cc:
Subject: Re: amd64/89550: [amd64] sym0: VTOBUS failed (6.0 Release)
Date: Tue, 26 Sep 2006 13:06:36 +1000
Alternative, smaller, cleaner, patch.
Removes amd64 specific case by splitting the sym_hcb struct so that we =
don't
have to cross page boundaries.
--- =
/home/janm/p4/image-freebsd-std-main/FreeBSD/src/sys/dev/sym/sym_hipd.c
Sun Sep 24 08:06:41 2006
+++ sym_hipd.c Mon Sep 25 17:25:02 2006
@@ -421,11 +421,7 @@
*/
=20
#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
@@ -434,14 +430,8 @@
#define MEMO_CLUSTER_SIZE (1UL << MEMO_CLUSTER_SHIFT)
#define MEMO_CLUSTER_MASK (MEMO_CLUSTER_SIZE-1)
=20
-#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
=20
typedef u_long m_addr_t; /* Enough bits to bit-hack addresses */
=20
@@ -675,7 +665,7 @@
BUS_DMA_NOWAIT, &vbp->dmamap))
goto out_err;
bus_dmamap_load(mp->dmat, vbp->dmamap, vaddr,
- MEMO_CLUSTER_SIZE, getbaddrcb, &baddr, 0);
+ MEMO_CLUSTER_SIZE, getbaddrcb, &baddr,
BUS_DMA_NOWAIT);
if (baddr) {
int hc =3D VTOB_HASH_CODE(vaddr);
vbp->vaddr =3D (m_addr_t) vaddr;
@@ -735,7 +725,7 @@
mp->dev_dmat =3D dev_dmat;
if (!bus_dma_tag_create(dev_dmat, 1, MEMO_CLUSTER_SIZE,
BUS_SPACE_MAXADDR_32BIT,
- BUS_SPACE_MAXADDR_32BIT,
+ BUS_SPACE_MAXADDR,
NULL, NULL, MEMO_CLUSTER_SIZE, 1,
MEMO_CLUSTER_SIZE, 0,
busdma_lock_mutex, &Giant, &mp->dmat)) {
@@ -1592,7 +1582,7 @@
/*
* Target data.
*/
- struct sym_tcb target[SYM_CONF_MAX_TARGET];
+ struct sym_tcb *target;
=20
/*
* Target control block bus address array used by the SCRIPT=20
@@ -8698,6 +8688,11 @@
np->fw_patch =3D fw->patch;
np->fw_name =3D fw->name;
=20
+ np->target =3D sym_calloc_dma(SYM_CONF_MAX_TARGET *
sizeof(*(np->target)),
+ "TARGET");
+ if (!np->target)
+ goto attach_failed;
+
/*
* Edit its name.
*/
@@ -9096,6 +9091,9 @@
"LUNMP");
#endif=20
}
+ if (np->target)
+ sym_mfree_dma(np->target,
+ SYM_CONF_MAX_TARGET * sizeof(*(np->target)),
"TARGET");
if (np->targtbl)
sym_mfree_dma(np->targtbl, 256, "TARGTBL");
if (np->data_dmat)
More information about the freebsd-amd64
mailing list