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

Function fetch_cbmem_entry

util/cbmem/devmem_drv.c:576–592  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

574}
575
576static void fetch_cbmem_entry(const uint32_t id, const uint64_t addr, const size_t size,
577 uint8_t **buf_out)
578{
579 struct mapping cbmem_mapping;
580 const uint8_t *buf = map_memory(&cbmem_mapping, addr, size);
581 if (!buf)
582 die("Unable to map CBMEM entry id: %#x, size: %zu\n", id, size);
583
584 *buf_out = malloc(size);
585 if (!*buf_out) {
586 unmap_memory(&cbmem_mapping);
587 die("Unable to allocate memory for CBMEM entry id: %#x, size: %zu\n", id, size);
588 }
589
590 aligned_memcpy(*buf_out, buf, size);
591 unmap_memory(&cbmem_mapping);
592}
593
594bool cbmem_devmem_get_cbmem_entry(uint32_t id, uint8_t **buf_out, size_t *size_out,
595 uint64_t *addr_out)

Callers 2

Calls 5

map_memoryFunction · 0.85
unmap_memoryFunction · 0.85
aligned_memcpyFunction · 0.85
dieFunction · 0.50
mallocFunction · 0.50

Tested by

no test coverage detected