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

Function map_physical

util/amdtool/amdtool.c:56–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54static int fd_mem;
55
56void *map_physical(uint64_t phys_addr, size_t len)
57{
58 void *virt_addr;
59
60 virt_addr = mmap(0, len, PROT_WRITE | PROT_READ, MAP_SHARED,
61 fd_mem, (off_t) phys_addr);
62
63 if (virt_addr == MAP_FAILED) {
64 printf("Error mapping physical memory 0x%08" PRIx64 "[0x%zx]\n",
65 phys_addr, len);
66 return NULL;
67 }
68
69 return virt_addr;
70}
71
72void unmap_physical(void *virt_addr, size_t len)
73{

Callers 3

print_espiFunction · 0.70
print_spibarFunction · 0.70
init_acpimmioFunction · 0.70

Calls 1

printfFunction · 0.85

Tested by

no test coverage detected