diff options
author | Marius Strobl <marius@FreeBSD.org> | 2012-06-14 20:49:22 +0000 |
---|---|---|
committer | Marius Strobl <marius@FreeBSD.org> | 2012-06-14 20:49:22 +0000 |
commit | 4bc42357a91961def51ab92571e0c1052a49e3e9 (patch) | |
tree | f821458ca88977bc32ea74e58b83a2ea49ca9b75 /sys/dev/sym | |
parent | d2a3fae7ecbe5c9153bea84d244029302f5897e1 (diff) | |
download | src-4bc42357a91961def51ab92571e0c1052a49e3e9.tar.gz src-4bc42357a91961def51ab92571e0c1052a49e3e9.zip |
Fix a braino in r236469; the number of DMA tags required for handling
MAXPHYS should be based on PAGE_SIZE rather than SYM_CONF_DMA_BOUNDARY.
While at it, reuse the SYM_CONF_MAX_SG macro for specifying the maximum
number of DMA tags so sym(4) itself doesn't size memory beyond what's
required for handling MAXPHYS.
PR: 168928
MFC after: 3 days
Notes
Notes:
svn path=/head/; revision=237101
Diffstat (limited to 'sys/dev/sym')
-rw-r--r-- | sys/dev/sym/sym_conf.h | 7 | ||||
-rw-r--r-- | sys/dev/sym/sym_hipd.c | 7 |
2 files changed, 6 insertions, 8 deletions
diff --git a/sys/dev/sym/sym_conf.h b/sys/dev/sym/sym_conf.h index aa486d44a72c..b1b2102a9a31 100644 --- a/sys/dev/sym/sym_conf.h +++ b/sys/dev/sym/sym_conf.h @@ -90,11 +90,12 @@ #define SYM_CONF_DMA_BOUNDARY (1UL << 24) /* - * Max number of scatter/gather entries for en IO. + * Max number of scatter/gather entries for an I/O. * Each entry costs 8 bytes in the internal CCB data structure. - * For now 65 should suffice given the BSD O/Ses capabilities. + * We use at most 33 segments but also no more than required for handling + * MAXPHYS. */ -#define SYM_CONF_MAX_SG (33) +#define SYM_CONF_MAX_SG (MIN(33, (MAXPHYS / PAGE_SIZE) + 1)) /* * Max number of targets. diff --git a/sys/dev/sym/sym_hipd.c b/sys/dev/sym/sym_hipd.c index 9f2fb2ae3fc5..8ac59b9a2691 100644 --- a/sys/dev/sym/sym_hipd.c +++ b/sys/dev/sym/sym_hipd.c @@ -1609,7 +1609,6 @@ struct sym_hcb { u_int features; /* Chip features map */ u_char myaddr; /* SCSI id of the adapter */ u_char maxburst; /* log base 2 of dwords burst */ - u_char maxsegcnt; /* Max DMA S/G segments */ u_char maxwide; /* Maximum transfer width */ u_char minsync; /* Min sync period factor (ST) */ u_char maxsync; /* Max sync period factor (ST) */ @@ -8135,7 +8134,7 @@ static void sym_action2(struct cam_sim *sim, union ccb *ccb) cpi->xport_specific.spi.ppr_options = SID_SPI_CLOCK_DT_ST; } - cpi->maxio = np->maxsegcnt * SYM_CONF_DMA_BOUNDARY; + cpi->maxio = SYM_CONF_MAX_SG * PAGE_SIZE; sym_xpt_done2(np, ccb, CAM_REQ_CMP); break; case XPT_ABORT: @@ -8536,11 +8535,9 @@ sym_pci_attach(device_t dev) /* * Allocate a tag for the DMA of user data. */ - np->maxsegcnt = MIN(SYM_CONF_MAX_SG, - (MAXPHYS / SYM_CONF_DMA_BOUNDARY) + 1); if (bus_dma_tag_create(np->bus_dmat, 1, SYM_CONF_DMA_BOUNDARY, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, - BUS_SPACE_MAXSIZE, np->maxsegcnt, SYM_CONF_DMA_BOUNDARY, + BUS_SPACE_MAXSIZE, SYM_CONF_MAX_SG, SYM_CONF_DMA_BOUNDARY, BUS_DMA_ALLOCNOW, busdma_lock_mutex, &np->mtx, &np->data_dmat)) { device_printf(dev, "failed to create DMA tag.\n"); goto attach_failed; |