| 86 | void print_malloc_map(void); |
| 87 | |
| 88 | void 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 | |
| 115 | int dma_initialized(void) |
| 116 | { |
no test coverage detected