Do the first and mostly mechanical step of adding mutex support to the
bus_dma async callback scheme. Note that sparc64 does not seem to do async callbacks. Note that ia64 callbacks might not be MPSAFE at the moment. Note that powerpc doesn't seem to do async callbacks due to the implementation being incomplete. Reviewed by: mostly silence on arch@
This commit is contained in:
parent
57df706ad1
commit
870f77fed0
@ -94,6 +94,7 @@ struct bus_dmamap {
|
||||
vm_offset_t busaddress; /* address in bus space */
|
||||
bus_dmamap_callback_t *callback;
|
||||
void *callback_arg;
|
||||
struct mtx *callback_mtx;
|
||||
void *sgmaphandle; /* handle into sgmap */
|
||||
STAILQ_ENTRY(bus_dmamap) links;
|
||||
};
|
||||
@ -931,8 +932,12 @@ busdma_swi(void)
|
||||
while ((map = STAILQ_FIRST(&bounce_map_callbacklist)) != NULL) {
|
||||
STAILQ_REMOVE_HEAD(&bounce_map_callbacklist, links);
|
||||
mtx_unlock(&bounce_lock);
|
||||
if (map->callback_mtx != NULL)
|
||||
mtx_lock(map->callback_mtx);
|
||||
bus_dmamap_load(map->dmat, map, map->buf, map->buflen,
|
||||
map->callback, map->callback_arg, /*flags*/0);
|
||||
if (map->callback_mtx != NULL)
|
||||
mtx_unlock(map->callback_mtx);
|
||||
mtx_lock(&bounce_lock);
|
||||
}
|
||||
mtx_unlock(&bounce_lock);
|
||||
|
@ -92,6 +92,7 @@ struct bus_dmamap {
|
||||
bus_size_t buflen; /* unmapped buffer length */
|
||||
bus_dmamap_callback_t *callback;
|
||||
void *callback_arg;
|
||||
struct mtx *callback_mtx;
|
||||
STAILQ_ENTRY(bus_dmamap) links;
|
||||
};
|
||||
|
||||
@ -869,8 +870,12 @@ busdma_swi(void)
|
||||
while ((map = STAILQ_FIRST(&bounce_map_callbacklist)) != NULL) {
|
||||
STAILQ_REMOVE_HEAD(&bounce_map_callbacklist, links);
|
||||
mtx_unlock(&bounce_lock);
|
||||
if (map->callback_mtx != NULL)
|
||||
mtx_lock(map->callback_mtx);
|
||||
bus_dmamap_load(map->dmat, map, map->buf, map->buflen,
|
||||
map->callback, map->callback_arg, /*flags*/0);
|
||||
if (map->callback_mtx != NULL)
|
||||
mtx_unlock(map->callback_mtx);
|
||||
mtx_lock(&bounce_lock);
|
||||
}
|
||||
mtx_unlock(&bounce_lock);
|
||||
|
@ -90,6 +90,7 @@ struct bus_dmamap {
|
||||
vm_offset_t busaddress; /* address in bus space */
|
||||
bus_dmamap_callback_t *callback;
|
||||
void *callback_arg;
|
||||
struct mtx *callback_mtx;
|
||||
void *sgmaphandle; /* handle into sgmap */
|
||||
STAILQ_ENTRY(bus_dmamap) links;
|
||||
};
|
||||
@ -920,8 +921,12 @@ busdma_swi(void)
|
||||
while ((map = STAILQ_FIRST(&bounce_map_callbacklist)) != NULL) {
|
||||
STAILQ_REMOVE_HEAD(&bounce_map_callbacklist, links);
|
||||
splx(s);
|
||||
if (map->callback_mtx != NULL)
|
||||
mtx_lock(map->callback_mtx);
|
||||
bus_dmamap_load(map->dmat, map, map->buf, map->buflen,
|
||||
map->callback, map->callback_arg, /*flags*/0);
|
||||
if (map->callback_mtx != NULL)
|
||||
mtx_unlock(map->callback_mtx);
|
||||
s = splhigh();
|
||||
}
|
||||
splx(s);
|
||||
|
@ -75,6 +75,7 @@ struct bus_dmamap {
|
||||
bus_size_t buflen; /* unmapped buffer length */
|
||||
bus_dmamap_callback_t *callback;
|
||||
void *callback_arg;
|
||||
struct mtx *callback_mtx;
|
||||
};
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user