libflashrom
Enumerations | Functions
Flash chips

Enumerations

enum  flashrom_flag {
  FLASHROM_FLAG_FORCE, FLASHROM_FLAG_FORCE_BOARDMISMATCH, FLASHROM_FLAG_VERIFY_AFTER_WRITE, FLASHROM_FLAG_VERIFY_WHOLE_CHIP,
  FLASHROM_FLAG_SKIP_UNREADABLE_REGIONS, FLASHROM_FLAG_SKIP_UNWRITABLE_REGIONS
}
 

Functions

int flashrom_flash_probe (struct flashrom_flashctx **flashctx, const struct flashrom_programmer *flashprog, const char *chip_name) __attribute__((deprecated("Use flashrom_flash_probe_v2 instead")))
 Probe for a flash chip. More...
 
int flashrom_flash_probe_v2 (struct flashrom_flashctx *flashctx, const char ***const all_matched_names, const struct flashrom_programmer *flashprog, const char *chip_name)
 Probe for a flash chip, v2. More...
 
size_t flashrom_flash_getsize (const struct flashrom_flashctx *flashctx)
 Returns the size of the specified flash chip in bytes. More...
 
int flashrom_flash_erase (struct flashrom_flashctx *flashctx)
 Erase the specified ROM chip. More...
 
void flashrom_flash_release (struct flashrom_flashctx *flashctx)
 Free a flash context. More...
 
void flashrom_flag_set (struct flashrom_flashctx *flashctx, enum flashrom_flag flag, bool value)
 Set a flag in the given flash context. More...
 
bool flashrom_flag_get (const struct flashrom_flashctx *flashctx, enum flashrom_flag flag)
 Return the current value of a flag in the given flash context. More...
 

Detailed Description

Function Documentation

bool flashrom_flag_get ( const struct flashrom_flashctx *  flashctx,
enum flashrom_flag  flag 
)

Return the current value of a flag in the given flash context.

Parameters
flashctxFlash context to read from.
flagFlag to be read.
Returns
Current value of the flag.
void flashrom_flag_set ( struct flashrom_flashctx *  flashctx,
enum flashrom_flag  flag,
bool  value 
)

Set a flag in the given flash context.

Parameters
flashctxFlash context to alter.
flagFlag that is to be set / cleared.
valueValue to set.
int flashrom_flash_erase ( struct flashrom_flashctx *  flashctx)

Erase the specified ROM chip.

If a layout is set in the given flash context, only included regions will be erased.

Parameters
flashctxThe context of the flash chip to erase.
Returns
0 on success.
size_t flashrom_flash_getsize ( const struct flashrom_flashctx *  flashctx)

Returns the size of the specified flash chip in bytes.

Parameters
flashctxThe queried flash context.
Returns
Size of flash chip in bytes.
int flashrom_flash_probe ( struct flashrom_flashctx **  flashctx,
const struct flashrom_programmer *  flashprog,
const char *  chip_name 
)

Probe for a flash chip.

Deprecated:
Use flashrom_flash_probe_v2 instead

Probes for a flash chip and returns a flash context, that can be used later with flash chip and image operations, if exactly one matching chip is found.

Parameters
[out]flashctxPoints to a pointer of type struct flashrom_flashctx that will be set if exactly one chip is found. *flashctx has to be freed by the caller with flashrom_flash_release.
[in]flashprogThe flash programmer used to access the chip.
[in]chip_nameName of a chip to probe for, or NULL to probe for all known chips.
Returns
0 on success, 3 if multiple chips were found, 2 if no chip was found, or 1 on any other error.
int flashrom_flash_probe_v2 ( struct flashrom_flashctx *  flashctx,
const char ***const  all_matched_names,
const struct flashrom_programmer *  flashprog,
const char *  chip_name 
)

Probe for a flash chip, v2.

Probes for a flash chip and returns a flash context, that can be used later with flash chip and image operations, if exactly one matching chip is found.

Returns the list of names for all chips that matched, and the count of how many chips matched.

Memory for the list of chips is dynamically allocated according to the number of chips found, and always needs to be freed with flashrom_data_free afterwards (including when no matches found or error happened).

Note that if chip_name param is set, then probing happens only once, only for this one requested chip name. So the number of matches that can be returned in this case will be either 1 or 0 (and -1 for error).

Parameters
[out]flashctxPoints to a struct flashrom_flashctx that will be set if exactly one chip is found. *flashctx has to be freed by the caller with flashrom_flash_release.
[out]all_matched_namespointer to an array containing the names of all chips that were successfully probed, terminated with a NULL pointer. If no chips are found, the returned array contains a single NULL element. Callers must free the array once unused by calling flashrom_data_free.
[in]flashprogThe flash programmer used to access the chip, currently unused.
[in]chip_nameName of a chip to probe for, or NULL to probe for all known chips.
Returns
the number of matched chips (which can be 0) on success, -1 if error happened during probing.
void flashrom_flash_release ( struct flashrom_flashctx *  flashctx)

Free a flash context.

Parameters
flashctxFlash context to free.