diff options
author | scottl <scottl@FreeBSD.org> | 2006-03-28 23:59:07 +0000 |
---|---|---|
committer | scottl <scottl@FreeBSD.org> | 2006-03-28 23:59:07 +0000 |
commit | cb08e1b408cfdbe300674d3648be87273b38614a (patch) | |
tree | a28b38e001b629c826194e7a5dba7a1f81bbdefc /sys/dev/mfi | |
parent | 1a854b0cf791f1081496d7fa2abb3db55adf618d (diff) | |
download | FreeBSD-src-cb08e1b408cfdbe300674d3648be87273b38614a.zip FreeBSD-src-cb08e1b408cfdbe300674d3648be87273b38614a.tar.gz |
Fix 64-bit DMA. The problem was an incorrect flag check. Thanks to Paul
Saab for helping to track this down. Fix a error with 32bit DMA size
calculation that seemed to be harmless. Add a few micro-optimizations while
I'm here.
Diffstat (limited to 'sys/dev/mfi')
-rw-r--r-- | sys/dev/mfi/mfi.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/sys/dev/mfi/mfi.c b/sys/dev/mfi/mfi.c index 064252e..073a0f5 100644 --- a/sys/dev/mfi/mfi.c +++ b/sys/dev/mfi/mfi.c @@ -250,7 +250,7 @@ mfi_attach(struct mfi_softc *sc) sc->mfi_sgsize = sizeof(struct mfi_sg64); sc->mfi_flags |= MFI_FLAGS_SG64; } else { - sc->mfi_sgsize = sizeof(struct mfi_sg64); + sc->mfi_sgsize = sizeof(struct mfi_sg32); } frames = (sc->mfi_sgsize * sc->mfi_total_sgl + MFI_FRAME_SIZE - 1) / MFI_FRAME_SIZE + 1; @@ -1074,6 +1074,7 @@ mfi_data_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) { struct mfi_frame_header *hdr; struct mfi_command *cm; + union mfi_sgl *sgl; struct mfi_softc *sc; int i, dir; @@ -1082,17 +1083,20 @@ mfi_data_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) cm = (struct mfi_command *)arg; sc = cm->cm_sc; - hdr = (struct mfi_frame_header *)cm->cm_frame; + hdr = &cm->cm_frame->header; + sgl = cm->cm_sg; - for (i = 0; i < nsegs; i++) { - if ((cm->cm_flags & MFI_FLAGS_SG64) == 0) { - cm->cm_sg->sg32[i].addr = segs[i].ds_addr; - cm->cm_sg->sg32[i].len = segs[i].ds_len; - } else { - cm->cm_sg->sg64[i].addr = segs[i].ds_addr; - cm->cm_sg->sg64[i].len = segs[i].ds_len; - hdr->flags |= MFI_FRAME_SGL64; + if ((sc->mfi_flags & MFI_FLAGS_SG64) == 0) { + for (i = 0; i < nsegs; i++) { + sgl->sg32[i].addr = segs[i].ds_addr; + sgl->sg32[i].len = segs[i].ds_len; + } + } else { + for (i = 0; i < nsegs; i++) { + sgl->sg64[i].addr = segs[i].ds_addr; + sgl->sg64[i].len = segs[i].ds_len; } + hdr->flags |= MFI_FRAME_SGL64; } hdr->sg_count = nsegs; |