libpayload: Remove legacy CBFS API
It's been several years already since we announced the deprecation of the legacy CBFS API for payloads. It's time to remove it completely. Change-Id: I0ed157ac2d1376b8dff4537af9a63731064b45f6 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/80650 Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Jakub Czapiga <czapiga@google.com> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Maximilian Brune <maximilian.brune@9elements.com>
This commit is contained in:
@ -78,56 +78,3 @@ enum cb_err fmap_locate_area(const char *name, size_t *offset, size_t *size)
|
||||
|
||||
return fmap_find_area(_fmap_cache, name, offset, size);
|
||||
}
|
||||
|
||||
/***********************************************************************************************
|
||||
* LEGACY CODE *
|
||||
**********************************************************************************************/
|
||||
|
||||
int fmap_region_by_name(const uint32_t fmap_offset, const char * const name,
|
||||
uint32_t * const offset, uint32_t * const size)
|
||||
{
|
||||
int i;
|
||||
|
||||
struct fmap *fmap;
|
||||
struct fmap fmap_head;
|
||||
struct cbfs_media default_media;
|
||||
struct cbfs_media *media = &default_media;
|
||||
|
||||
if (init_default_cbfs_media(media) != 0)
|
||||
return -1;
|
||||
|
||||
media->open(media);
|
||||
|
||||
if (!media->read(media, &fmap_head, fmap_offset, sizeof(fmap_head)))
|
||||
return -1;
|
||||
|
||||
if (memcmp(fmap_head.signature, FMAP_SIGNATURE, sizeof(fmap_head.signature))) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int fmap_size = sizeof(*fmap) +
|
||||
fmap_head.nareas * sizeof(struct fmap_area);
|
||||
|
||||
fmap = malloc(fmap_size);
|
||||
if (!fmap)
|
||||
return -1;
|
||||
|
||||
if (!media->read(media, fmap, fmap_offset, fmap_size))
|
||||
goto err;
|
||||
|
||||
media->close(media);
|
||||
|
||||
for (i = 0; i < fmap->nareas; i++) {
|
||||
if (strcmp((const char *)fmap->areas[i].name, name) != 0)
|
||||
continue;
|
||||
if (offset)
|
||||
*offset = fmap->areas[i].offset;
|
||||
if (size)
|
||||
*size = fmap->areas[i].size;
|
||||
free(fmap);
|
||||
return 0;
|
||||
}
|
||||
err:
|
||||
free(fmap);
|
||||
return -1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user