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

Function cbfs_preload

src/lib/cbfs.c:358–406  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

356}
357
358void cbfs_preload(const char *name)
359{
360 struct region_device rdev;
361 union cbfs_mdata mdata;
362 struct cbfs_preload_context *context;
363 bool force_ro = false;
364 size_t size;
365
366 if (!CONFIG(CBFS_PRELOAD))
367 dead_code();
368
369 /* We don't want to cross the vboot boundary */
370 if (ENV_SEPARATE_ROMSTAGE && CONFIG(VBOOT_STARTS_IN_ROMSTAGE))
371 return;
372
373 DEBUG("%s(name='%s')\n", __func__, name);
374
375 if (_cbfs_boot_lookup(name, force_ro, &mdata, &rdev))
376 return;
377
378 size = region_device_sz(&rdev);
379
380 context = alloc_cbfs_preload_context(strlen(name) + 1);
381 if (!context) {
382 ERROR("%s(name='%s') failed to allocate preload context\n", __func__, name);
383 return;
384 }
385
386 context->buffer = mem_pool_alloc(&cbfs_cache, size);
387 if (context->buffer == NULL) {
388 ERROR("%s(name='%s') failed to allocate %zu bytes for preload buffer\n",
389 __func__, name, size);
390 goto out;
391 }
392
393 context->rdev = rdev;
394 strcpy(context->name, name);
395
396 append_cbfs_preload_context(context);
397
398 if (thread_run(&context->handle, cbfs_preload_thread_entry, context) == 0)
399 return;
400
401 ERROR("%s(name='%s') failed to start preload thread\n", __func__, name);
402 mem_pool_free(&cbfs_cache, context->buffer);
403
404out:
405 free_cbfs_preload_context(context);
406}
407
408void cbfs_preload_wait_for_all(void)
409{

Callers 10

preload_ramstageFunction · 0.85
payload_preloadFunction · 0.85
preload_fspsFunction · 0.85
preload_fspmFunction · 0.85
vga_oprom_preloadFunction · 0.85
preload_bl31Function · 0.85
preload_bl32Function · 0.85
preload_bl31Function · 0.85
preload_bl32Function · 0.85
preload_post_fspsFunction · 0.85

Calls 10

region_device_szFunction · 0.85
strlenFunction · 0.85
thread_runFunction · 0.85
_cbfs_boot_lookupFunction · 0.70
strcpyFunction · 0.70
mem_pool_allocFunction · 0.50
mem_pool_freeFunction · 0.50

Tested by

no test coverage detected