libflashrom
 All Data Structures Functions Typedefs Enumerations Modules
Functions
Layout handling

Functions

int flashrom_layout_include_region (struct flashrom_layout *const layout, const char *name)
 Mark given region as included. More...
 
int flashrom_layout_read_from_ifd (struct flashrom_layout **const layout, struct flashctx *const flashctx, const void *const dump, const size_t len)
 Read a layout from the Intel ICH descriptor in the flash. More...
 
int flashrom_layout_read_fmap_from_rom (struct flashrom_layout **const layout, struct flashctx *const flashctx, off_t offset, size_t len)
 Read a layout by searching the flash chip for fmap. More...
 
int flashrom_layout_read_fmap_from_buffer (struct flashrom_layout **const layout, struct flashctx *const flashctx, const uint8_t *const buf, size_t size)
 Read a layout by searching buffer for fmap. More...
 
void flashrom_layout_release (struct flashrom_layout *const layout)
 Free a layout. More...
 
void flashrom_layout_set (struct flashrom_flashctx *const flashctx, const struct flashrom_layout *const layout)
 Set the active layout for a flash context. More...
 

Detailed Description

Function Documentation

int flashrom_layout_include_region ( struct flashrom_layout *const  layout,
const char *  name 
)

Mark given region as included.

Parameters
layoutThe layout to alter.
nameThe name of the region to include.
Returns
0 on success, 1 if the given name can't be found.
int flashrom_layout_read_fmap_from_buffer ( struct flashrom_layout **const  layout,
struct flashctx *const  flashctx,
const uint8_t *const  buf,
size_t  size 
)

Read a layout by searching buffer for fmap.

Parameters
[out]layoutPoints to a struct flashrom_layout pointer that gets set if the fmap is read and parsed successfully.
[in]flashctxFlash context
[in]bufferBuffer to search in
[in]sizeSize of buffer to search
Returns
0 on success, 3 if fmap parsing isn't implemented for the host, 2 if the fmap couldn't be read, 1 on any other error.
int flashrom_layout_read_fmap_from_rom ( struct flashrom_layout **const  layout,
struct flashctx *const  flashctx,
off_t  offset,
size_t  len 
)

Read a layout by searching the flash chip for fmap.

Parameters
[out]layoutPoints to a struct flashrom_layout pointer that gets set if the fmap is read and parsed successfully.
[in]flashctxFlash context
[in]offsetOffset to begin searching for fmap.
[in]offsetLength of address space to search.
Returns
0 on success, 3 if fmap parsing isn't implemented for the host, 2 if the fmap couldn't be read, 1 on any other error.
int flashrom_layout_read_from_ifd ( struct flashrom_layout **const  layout,
struct flashctx *const  flashctx,
const void *const  dump,
const size_t  len 
)

Read a layout from the Intel ICH descriptor in the flash.

Optionally verify that the layout matches the one in the given descriptor dump.

Parameters
[out]layoutPoints to a struct flashrom_layout pointer that gets set if the descriptor is read and parsed successfully.
[in]flashctxFlash context to read the descriptor from flash.
[in]dumpThe descriptor dump to compare to or NULL.
[in]lenThe length of the descriptor dump.
Returns
0 on success, 6 if descriptor parsing isn't implemented for the host, 5 if the descriptors don't match, 4 if the descriptor dump couldn't be parsed, 3 if the descriptor on flash couldn't be parsed, 2 if the descriptor on flash couldn't be read, 1 on any other error.
void flashrom_layout_release ( struct flashrom_layout *const  layout)

Free a layout.

Parameters
layoutLayout to free.
void flashrom_layout_set ( struct flashrom_flashctx *const  flashctx,
const struct flashrom_layout *const  layout 
)

Set the active layout for a flash context.

Note: This just sets a pointer. The caller must not release the layout as long as he uses it through the given flash context.

Parameters
flashctxFlash context whose layout will be set.
layoutLayout to bet set.