bus_dma_segment_t *
bus_dma_tag_lock(bus_dma_tag_t tag, bus_dma_segment_t *cache)
{
+ if (tag->flags & BUS_DMA_PROTECTED)
+ return(tag->segments);
+
if (tag->nsegments <= BUS_DMA_CACHE_SEGMENTS)
return(cache);
#ifdef SMP
bus_dma_tag_unlock(bus_dma_tag_t tag)
{
#ifdef SMP
+ if (tag->flags & BUS_DMA_PROTECTED)
+ return;
+
if (tag->nsegments > BUS_DMA_CACHE_SEGMENTS)
spin_unlock(&tag->spin);
#endif
KKASSERT((dmat->flags &
(BUS_DMA_PRIVBZONE | BUS_DMA_ALLOCALL)) !=
(BUS_DMA_PRIVBZONE | BUS_DMA_ALLOCALL));
+
+ if (dmat->flags & BUS_DMA_PROTECTED)
+ panic("protected dmamap callback will be defered\n");
+
bus_dma_tag_unlock(dmat);
return error;
}
bus_dma_segment_t *
bus_dma_tag_lock(bus_dma_tag_t tag, bus_dma_segment_t *cache)
{
+ if (tag->flags & BUS_DMA_PROTECTED)
+ return(tag->segments);
+
if (tag->nsegments <= BUS_DMA_CACHE_SEGMENTS)
return(cache);
#ifdef SMP
bus_dma_tag_unlock(bus_dma_tag_t tag)
{
#ifdef SMP
+ if (tag->flags & BUS_DMA_PROTECTED)
+ return;
+
if (tag->nsegments > BUS_DMA_CACHE_SEGMENTS)
spin_unlock(&tag->spin);
#endif
KKASSERT((dmat->flags &
(BUS_DMA_PRIVBZONE | BUS_DMA_ALLOCALL)) !=
(BUS_DMA_PRIVBZONE | BUS_DMA_ALLOCALL));
+
+ if (dmat->flags & BUS_DMA_PROTECTED)
+ panic("protected dmamap callback will be defered\n");
+
bus_dma_tag_unlock(dmat);
return error;
}
* loaded memory is properly aligned */
#define BUS_DMA_PRIVBZONE 0x0400 /* need private bounce zone */
#define BUS_DMA_ALLOCALL 0x0800 /* allocate all needed resources */
+#define BUS_DMA_PROTECTED 0x1000 /* all busdma functions are already
+ * protected */
/* Forwards needed by prototypes below. */
struct mbuf;