Changeset View
Changeset View
Standalone View
Standalone View
head/sys/compat/linuxkpi/common/src/linux_pci.c
Show First 20 Lines • Show All 494 Lines • ▼ Show 20 Lines | linux_dma_uninit(void *arg) | ||||
uma_zdestroy(linux_dma_trie_zone); | uma_zdestroy(linux_dma_trie_zone); | ||||
} | } | ||||
SYSUNINIT(linux_dma, SI_SUB_DRIVERS, SI_ORDER_THIRD, linux_dma_uninit, NULL); | SYSUNINIT(linux_dma, SI_SUB_DRIVERS, SI_ORDER_THIRD, linux_dma_uninit, NULL); | ||||
static void * | static void * | ||||
linux_dma_trie_alloc(struct pctrie *ptree) | linux_dma_trie_alloc(struct pctrie *ptree) | ||||
{ | { | ||||
return (uma_zalloc(linux_dma_trie_zone, 0)); | return (uma_zalloc(linux_dma_trie_zone, M_NOWAIT)); | ||||
} | } | ||||
static void | static void | ||||
linux_dma_trie_free(struct pctrie *ptree, void *node) | linux_dma_trie_free(struct pctrie *ptree, void *node) | ||||
{ | { | ||||
uma_zfree(linux_dma_trie_zone, node); | uma_zfree(linux_dma_trie_zone, node); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | linux_dma_map_phys(struct device *dev, vm_paddr_t phys, size_t len) | ||||
* If the resultant mapping will be entirely 1:1 with the | * If the resultant mapping will be entirely 1:1 with the | ||||
* physical address, short-circuit the remainder of the | * physical address, short-circuit the remainder of the | ||||
* bus_dma API. This avoids tracking collisions in the pctrie | * bus_dma API. This avoids tracking collisions in the pctrie | ||||
* with the additional benefit of reducing overhead. | * with the additional benefit of reducing overhead. | ||||
*/ | */ | ||||
if (bus_dma_id_mapped(priv->dmat, phys, len)) | if (bus_dma_id_mapped(priv->dmat, phys, len)) | ||||
return (phys); | return (phys); | ||||
obj = uma_zalloc(linux_dma_obj_zone, 0); | obj = uma_zalloc(linux_dma_obj_zone, M_NOWAIT); | ||||
if (obj == NULL) { | |||||
return (0); | |||||
} | |||||
DMA_PRIV_LOCK(priv); | DMA_PRIV_LOCK(priv); | ||||
if (bus_dmamap_create(priv->dmat, 0, &obj->dmamap) != 0) { | if (bus_dmamap_create(priv->dmat, 0, &obj->dmamap) != 0) { | ||||
DMA_PRIV_UNLOCK(priv); | DMA_PRIV_UNLOCK(priv); | ||||
uma_zfree(linux_dma_obj_zone, obj); | uma_zfree(linux_dma_obj_zone, obj); | ||||
return (0); | return (0); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 293 Lines • Show Last 20 Lines |