mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 23:22:37 +02:00
layout: Move generic layout functions into layout.c
Change-Id: If1edde70fc51e88e6e1c560d79a0d51941b9627c Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/33514 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
This commit is contained in:
parent
2b94cdb5cb
commit
4f213285d7
3
Doxyfile
3
Doxyfile
@ -782,7 +782,8 @@ WARN_LOGFILE =
|
|||||||
|
|
||||||
INPUT = libflashrom.c \
|
INPUT = libflashrom.c \
|
||||||
libflashrom.h \
|
libflashrom.h \
|
||||||
flashrom.c
|
flashrom.c \
|
||||||
|
layout.c \
|
||||||
|
|
||||||
# This tag can be used to specify the character encoding of the source files
|
# This tag can be used to specify the character encoding of the source files
|
||||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
|
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
|
||||||
|
41
layout.c
41
layout.c
@ -244,3 +244,44 @@ const struct romentry *layout_next_included_region(
|
|||||||
|
|
||||||
return lowest;
|
return lowest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @addtogroup flashrom-layout
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Mark given region as included.
|
||||||
|
*
|
||||||
|
* @param layout The layout to alter.
|
||||||
|
* @param name The name of the region to include.
|
||||||
|
*
|
||||||
|
* @return 0 on success,
|
||||||
|
* 1 if the given name can't be found.
|
||||||
|
*/
|
||||||
|
int flashrom_layout_include_region(struct flashrom_layout *const layout, const char *name)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
for (i = 0; i < layout->num_entries; ++i) {
|
||||||
|
if (!strcmp(layout->entries[i].name, name)) {
|
||||||
|
layout->entries[i].included = true;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Free a layout.
|
||||||
|
*
|
||||||
|
* @param layout Layout to free.
|
||||||
|
*/
|
||||||
|
void flashrom_layout_release(struct flashrom_layout *const layout)
|
||||||
|
{
|
||||||
|
if (layout == get_global_layout())
|
||||||
|
return;
|
||||||
|
|
||||||
|
free(layout);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @} */ /* end flashrom-layout */
|
||||||
|
@ -282,27 +282,6 @@ bool flashrom_flag_get(const struct flashrom_flashctx *const flashctx, const enu
|
|||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Mark given region as included.
|
|
||||||
*
|
|
||||||
* @param layout The layout to alter.
|
|
||||||
* @param name The name of the region to include.
|
|
||||||
*
|
|
||||||
* @return 0 on success,
|
|
||||||
* 1 if the given name can't be found.
|
|
||||||
*/
|
|
||||||
int flashrom_layout_include_region(struct flashrom_layout *const layout, const char *name)
|
|
||||||
{
|
|
||||||
size_t i;
|
|
||||||
for (i = 0; i < layout->num_entries; ++i) {
|
|
||||||
if (!strcmp(layout->entries[i].name, name)) {
|
|
||||||
layout->entries[i].included = true;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Read a layout from the Intel ICH descriptor in the flash.
|
* @brief Read a layout from the Intel ICH descriptor in the flash.
|
||||||
*
|
*
|
||||||
@ -506,19 +485,6 @@ _ret:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Free a layout.
|
|
||||||
*
|
|
||||||
* @param layout Layout to free.
|
|
||||||
*/
|
|
||||||
void flashrom_layout_release(struct flashrom_layout *const layout)
|
|
||||||
{
|
|
||||||
if (layout == get_global_layout())
|
|
||||||
return;
|
|
||||||
|
|
||||||
free(layout);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the active layout for a flash context.
|
* @brief Set the active layout for a flash context.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user