mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-02 06:23:18 +02:00
tree/: Convert flashchip read func ptr to enumerate
This forges the way for flashchips.c to be pure declarative data and lookup functions for dispatch to be pure. This means that the flashchips data could be extracted out to be agnostic data of the flashrom code and algorithms. TEST='R|W|E && --flash-name' on ARM, AMD & Intel DUT's. Change-Id: I612d46fefedf2b69e7e2064aa857fa0756efb4e7 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/66788 Reviewed-by: Nikolai Artemiev <nartemiev@google.com> Reviewed-by: Felix Singer <felixsinger@posteo.net> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:

committed by
Felix Singer

parent
985ad5623f
commit
594d3357b6
@ -255,6 +255,19 @@ enum write_func {
|
||||
};
|
||||
typedef int (write_func_t)(struct flashctx *flash, const uint8_t *buf, unsigned int start, unsigned int len);
|
||||
|
||||
enum read_func {
|
||||
NO_READ_FUNC = 0, /* 0 indicates no read function set. */
|
||||
SPI_CHIP_READ = 1,
|
||||
READ_OPAQUE,
|
||||
READ_MEMMAPPED,
|
||||
EDI_CHIP_READ,
|
||||
SPI_READ_AT45DB,
|
||||
SPI_READ_AT45DB_E8,
|
||||
TEST_READ_INJECTOR, /* special case must come last. */
|
||||
};
|
||||
typedef int (read_func_t)(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
|
||||
int read_flash(struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
|
||||
|
||||
struct flashchip {
|
||||
const char *vendor;
|
||||
const char *name;
|
||||
@ -323,7 +336,7 @@ struct flashchip {
|
||||
int (*printlock) (struct flashctx *flash);
|
||||
int (*unlock) (struct flashctx *flash);
|
||||
enum write_func write;
|
||||
int (*read) (struct flashctx *flash, uint8_t *buf, unsigned int start, unsigned int len);
|
||||
enum read_func read;
|
||||
struct voltage {
|
||||
uint16_t min;
|
||||
uint16_t max;
|
||||
|
Reference in New Issue
Block a user