MCPcopy Create free account
hub / github.com/coreboot/coreboot / init_dma_memory

Function init_dma_memory

payloads/libpayload/libc/malloc.c:88–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86void print_malloc_map(void);
87
88void init_dma_memory(void *start, u32 size)
89{
90 if (dma_initialized()) {
91 printf("ERROR: %s called twice!\n", __func__);
92 return;
93 }
94
95 /*
96 * DMA memory might not be zeroed by coreboot on stage loading, so make
97 * sure we clear the magic cookie from last boot.
98 */
99 *(hdrtype_t *)start = 0;
100
101 dma = malloc(sizeof(*dma));
102 dma->start = start;
103 dma->end = start + size;
104 dma->align_regions = NULL;
105
106#if CONFIG(LP_DEBUG_MALLOC)
107 dma->minimal_free = 0;
108 dma->magic_initialized = 0;
109 dma->name = "DMA";
110
111 printf("Initialized cache-coherent DMA memory at [%p:%p]\n", start, start + size);
112#endif
113}
114
115int dma_initialized(void)
116{

Callers 2

cb_parse_dmaFunction · 0.85

Calls 3

dma_initializedFunction · 0.85
printfFunction · 0.85
mallocFunction · 0.70

Tested by

no test coverage detected