MCPcopy Create free account
hub / github.com/F-Stack/f-stack / bus_dmamap_create

Function bus_dmamap_create

freebsd/arm/arm/busdma_machdep.c:715–746  ·  view source on GitHub ↗

* Allocate a handle for mapping from kva/uva/physical * address space into bus device space. */

Source from the content-addressed store, hash-verified

713 * address space into bus device space.
714 */
715int
716bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp)
717{
718 bus_dmamap_t map;
719 int error = 0;
720
721 *mapp = map = allocate_map(dmat, M_NOWAIT);
722 if (map == NULL) {
723 CTR3(KTR_BUSDMA, "%s: tag %p error %d", __func__, dmat, ENOMEM);
724 return (ENOMEM);
725 }
726
727 /*
728 * Bouncing might be required if the driver asks for an exclusion
729 * region, a data alignment that is stricter than 1, or DMA that begins
730 * or ends with a partial cacheline. Whether bouncing will actually
731 * happen can't be known until mapping time, but we need to pre-allocate
732 * resources now because we might not be allowed to at mapping time.
733 */
734 error = allocate_bz_and_pages(dmat, map);
735 if (error != 0) {
736 free(map, M_BUSDMA);
737 *mapp = NULL;
738 return (error);
739 }
740 if (map->flags & DMAMAP_COHERENT)
741 atomic_add_32(&maps_coherent, 1);
742 atomic_add_32(&maps_total, 1);
743 dmat->map_count++;
744
745 return (0);
746}
747
748/*
749 * Destroy a handle for mapping from kva/uva/physical

Callers 4

cpsw_add_slotsFunction · 0.50
aw_mmc_setup_dmaFunction · 0.50
awg_setup_dmaFunction · 0.50
bcm_sdhci_attachFunction · 0.50

Calls 4

allocate_mapFunction · 0.85
allocate_bz_and_pagesFunction · 0.85
freeFunction · 0.50
atomic_add_32Function · 0.50

Tested by

no test coverage detected