mirror of
https://review.coreboot.org/flashrom.git
synced 2025-07-01 22:21:16 +02:00
tree: Port programmers to pass programmer_cfg to extractors
Ran; ``` $ find -name '*.c' -exec sed -i 's/extract_programmer_param_str(NULL/extract_programmer_param_str(cfg/g' '{}' \; ``` Manually fix i2c_helper_linux.c and other cases after. Treat cases of; - pcidev.c , and - usb_device.c as exceptional to be dealt with in later patches. Change-Id: If7b7987e803d35582dda219652a6fc3ed5729b47 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/66656 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Felix Singer <felixsinger@posteo.net>
This commit is contained in:

committed by
Anastasia Klimchuk

parent
c3df94cb96
commit
5c710ea54a
@ -958,7 +958,7 @@ static int init_data(const struct programmer_cfg *cfg,
|
||||
char *status = NULL;
|
||||
int size = -1; /* size for VARIABLE_SIZE chip device */
|
||||
|
||||
bustext = extract_programmer_param_str(NULL, "bus");
|
||||
bustext = extract_programmer_param_str(cfg, "bus");
|
||||
msg_pdbg("Requested buses are: %s\n", bustext ? bustext : "default");
|
||||
if (!bustext)
|
||||
bustext = strdup("parallel+lpc+fwh+spi+prog");
|
||||
@ -990,7 +990,7 @@ static int init_data(const struct programmer_cfg *cfg,
|
||||
msg_pdbg("Support for all flash bus types disabled.\n");
|
||||
free(bustext);
|
||||
|
||||
tmp = extract_programmer_param_str(NULL, "spi_write_256_chunksize");
|
||||
tmp = extract_programmer_param_str(cfg, "spi_write_256_chunksize");
|
||||
if (tmp) {
|
||||
data->spi_write_256_chunksize = strtoul(tmp, &endptr, 0);
|
||||
if (*endptr != '\0' || data->spi_write_256_chunksize < 1) {
|
||||
@ -1001,7 +1001,7 @@ static int init_data(const struct programmer_cfg *cfg,
|
||||
}
|
||||
free(tmp);
|
||||
|
||||
tmp = extract_programmer_param_str(NULL, "spi_blacklist");
|
||||
tmp = extract_programmer_param_str(cfg, "spi_blacklist");
|
||||
if (tmp) {
|
||||
i = strlen(tmp);
|
||||
if (!strncmp(tmp, "0x", 2)) {
|
||||
@ -1037,7 +1037,7 @@ static int init_data(const struct programmer_cfg *cfg,
|
||||
}
|
||||
free(tmp);
|
||||
|
||||
tmp = extract_programmer_param_str(NULL, "spi_ignorelist");
|
||||
tmp = extract_programmer_param_str(cfg, "spi_ignorelist");
|
||||
if (tmp) {
|
||||
i = strlen(tmp);
|
||||
if (!strncmp(tmp, "0x", 2)) {
|
||||
@ -1074,7 +1074,7 @@ static int init_data(const struct programmer_cfg *cfg,
|
||||
free(tmp);
|
||||
|
||||
/* frequency to emulate in Hz (default), KHz, or MHz */
|
||||
tmp = extract_programmer_param_str(NULL, "freq");
|
||||
tmp = extract_programmer_param_str(cfg, "freq");
|
||||
if (tmp) {
|
||||
unsigned long int freq;
|
||||
char *units = tmp;
|
||||
@ -1124,7 +1124,7 @@ static int init_data(const struct programmer_cfg *cfg,
|
||||
}
|
||||
free(tmp);
|
||||
|
||||
tmp = extract_programmer_param_str(NULL, "size");
|
||||
tmp = extract_programmer_param_str(cfg, "size");
|
||||
if (tmp) {
|
||||
size = strtol(tmp, NULL, 10);
|
||||
if (size <= 0 || (size % 1024 != 0)) {
|
||||
@ -1136,7 +1136,7 @@ static int init_data(const struct programmer_cfg *cfg,
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
tmp = extract_programmer_param_str(NULL, "hwwp");
|
||||
tmp = extract_programmer_param_str(cfg, "hwwp");
|
||||
if (tmp) {
|
||||
if (!strcmp(tmp, "yes")) {
|
||||
msg_pdbg("Emulated chip will have hardware WP enabled\n");
|
||||
@ -1151,7 +1151,7 @@ static int init_data(const struct programmer_cfg *cfg,
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
tmp = extract_programmer_param_str(NULL, "emulate");
|
||||
tmp = extract_programmer_param_str(cfg, "emulate");
|
||||
if (!tmp) {
|
||||
if (size != -1) {
|
||||
msg_perr("%s: size parameter is only valid for VARIABLE_SIZE chip.\n", __func__);
|
||||
@ -1275,7 +1275,7 @@ static int init_data(const struct programmer_cfg *cfg,
|
||||
free(tmp);
|
||||
|
||||
/* Should emulated flash erase to zero (yes/no)? */
|
||||
tmp = extract_programmer_param_str(NULL, "erase_to_zero");
|
||||
tmp = extract_programmer_param_str(cfg, "erase_to_zero");
|
||||
if (tmp) {
|
||||
if (data->emu_chip != EMULATE_VARIABLE_SIZE) {
|
||||
msg_perr("%s: erase_to_zero parameter is not valid for real chip.\n", __func__);
|
||||
@ -1295,7 +1295,7 @@ static int init_data(const struct programmer_cfg *cfg,
|
||||
}
|
||||
free(tmp);
|
||||
|
||||
status = extract_programmer_param_str(NULL, "spi_status");
|
||||
status = extract_programmer_param_str(cfg, "spi_status");
|
||||
if (status) {
|
||||
unsigned int emu_status;
|
||||
|
||||
@ -1371,7 +1371,7 @@ static int dummy_init(const struct programmer_cfg *cfg)
|
||||
memset(data->flashchip_contents, data->erase_to_zero ? 0x00 : 0xff, data->emu_chip_size);
|
||||
|
||||
/* Will be freed by shutdown function if necessary. */
|
||||
data->emu_persistent_image = extract_programmer_param_str(NULL, "image");
|
||||
data->emu_persistent_image = extract_programmer_param_str(cfg, "image");
|
||||
if (!data->emu_persistent_image) {
|
||||
/* Nothing else to do. */
|
||||
goto dummy_init_out;
|
||||
|
Reference in New Issue
Block a user