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

Function prepare_flash_buffer

tests/lib/fmap-test.c:19–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17static size_t flash_buffer_size = 0;
18
19static void prepare_flash_buffer(void)
20{
21 /* Prepare flash buffer with dummy data and FMAP */
22 flash_buffer = malloc(FMAP_SECTION_FLASH_SIZE);
23 flash_buffer_size = FMAP_SECTION_FLASH_SIZE;
24
25 /* Fill first part of buffer with dummy data */
26 for (int i = 0; i < FMAP_SECTION_FMAP_START; ++i)
27 flash_buffer[i] = 'a' + i % ('z' - 'a');
28
29 /* Copy FMAP section into buffer */
30 memcpy(flash_buffer + FMAP_SECTION_FMAP_START, tests_fmap_bin, FMAP_SIZE);
31
32 /* Fill rest of buffer with dummy data */
33 for (int i = FMAP_SECTION_FMAP_START + FMAP_SECTION_FMAP_SIZE;
34 i < FMAP_SECTION_FLASH_SIZE; ++i)
35 flash_buffer[i] = 'a' + i % ('z' - 'a');
36}
37
38static int setup_fmap(void **state)
39{

Callers 1

setup_fmapFunction · 0.85

Calls 2

mallocFunction · 0.50
memcpyFunction · 0.50

Tested by

no test coverage detected