Add bus_dmamap_load_bio for non-CAM disk drivers that wish to enable
unmapped I/O. Sponsored by: Intel Reviewed by: kib
This commit is contained in:
parent
86675b5c0d
commit
10a93479b9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=248896
@ -408,6 +408,45 @@ bus_dmamap_load_ccb(bus_dma_tag_t dmat, bus_dmamap_t map, union ccb *ccb,
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
bus_dmamap_load_bio(bus_dma_tag_t dmat, bus_dmamap_t map, struct bio *bio,
|
||||
bus_dmamap_callback_t *callback, void *callback_arg,
|
||||
int flags)
|
||||
{
|
||||
bus_dma_segment_t *segs;
|
||||
struct memdesc mem;
|
||||
int error;
|
||||
int nsegs;
|
||||
|
||||
if ((flags & BUS_DMA_NOWAIT) == 0) {
|
||||
mem = memdesc_bio(bio);
|
||||
_bus_dmamap_waitok(dmat, map, &mem, callback, callback_arg);
|
||||
}
|
||||
nsegs = -1;
|
||||
error = _bus_dmamap_load_bio(dmat, map, bio, &nsegs, flags);
|
||||
nsegs++;
|
||||
|
||||
CTR5(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d nsegs %d",
|
||||
__func__, dmat, flags, error, nsegs);
|
||||
|
||||
if (error == EINPROGRESS)
|
||||
return (error);
|
||||
|
||||
segs = _bus_dmamap_complete(dmat, map, NULL, nsegs, error);
|
||||
if (error)
|
||||
(*callback)(callback_arg, segs, 0, error);
|
||||
else
|
||||
(*callback)(callback_arg, segs, nsegs, error);
|
||||
/*
|
||||
* Return ENOMEM to the caller so that it can pass it up the stack.
|
||||
* This error only happens when NOWAIT is set, so deferral is disabled.
|
||||
*/
|
||||
if (error == ENOMEM)
|
||||
return (error);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
bus_dmamap_load_mem(bus_dma_tag_t dmat, bus_dmamap_t map,
|
||||
struct memdesc *mem, bus_dmamap_callback_t *callback,
|
||||
|
@ -232,6 +232,13 @@ int bus_dmamap_load_ccb(bus_dma_tag_t dmat, bus_dmamap_t map, union ccb *ccb,
|
||||
bus_dmamap_callback_t *callback, void *callback_arg,
|
||||
int flags);
|
||||
|
||||
/*
|
||||
* Like bus_dmamap_load but for bios.
|
||||
*/
|
||||
int bus_dmamap_load_bio(bus_dma_tag_t dmat, bus_dmamap_t map, struct bio *bio,
|
||||
bus_dmamap_callback_t *callback, void *callback_arg,
|
||||
int flags);
|
||||
|
||||
/*
|
||||
* Loads any memory descriptor.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user