diff options
author | scottl <scottl@FreeBSD.org> | 2006-05-03 04:14:17 +0000 |
---|---|---|
committer | scottl <scottl@FreeBSD.org> | 2006-05-03 04:14:17 +0000 |
commit | 7ef1f80fdd3ab40ec0c9ba6a13e39b0552eea059 (patch) | |
tree | 1056f9c32d16deef6cf66c9fbf7618d1bedf5215 /sys/amd64 | |
parent | 581c3c81537dc544744b18bab247968aa7b6d5f6 (diff) | |
download | FreeBSD-src-7ef1f80fdd3ab40ec0c9ba6a13e39b0552eea059.zip FreeBSD-src-7ef1f80fdd3ab40ec0c9ba6a13e39b0552eea059.tar.gz |
Allow bus_dmamap_load() to pass ENOMEM back to the caller. This puts it into
conformance with the mbuf and uio load routines. ENOMEM can only happen
with BUS_DMA_NOWAIT is passed in, thus the deferals are disabled. I don't
like doing this, but fixing this fixes assumptions in other important drivers,
which is a net benefit for now.
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/amd64/busdma_machdep.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sys/amd64/amd64/busdma_machdep.c b/sys/amd64/amd64/busdma_machdep.c index 1d70417..348ab78 100644 --- a/sys/amd64/amd64/busdma_machdep.c +++ b/sys/amd64/amd64/busdma_machdep.c @@ -703,9 +703,10 @@ bus_dmamap_load(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf, error = _bus_dmamap_load_buffer(dmat, map, buf, buflen, NULL, flags, &lastaddr, dmat->segments, &nsegs, 1); + CTR5(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d nsegs %d", + __func__, dmat, dmat->flags, error, nsegs + 1); + if (error == EINPROGRESS) { - CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d", - __func__, dmat, dmat->flags, error); return (error); } @@ -714,8 +715,13 @@ bus_dmamap_load(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf, else (*callback)(callback_arg, dmat->segments, nsegs + 1, 0); - CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error 0 nsegs %d", - __func__, dmat, dmat->flags, nsegs + 1); + /* + * Return ENOMEM to the caller so that it can pass it up the stack. + * This error only happens when NOWAIT is set, so deferal is disabled. + */ + if (error == ENOMEM) + return (error); + return (0); } |