1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-08-16 03:44:41 +02:00

Various places in the flashrom source feature custom parameter extraction from programmer_param

This led to wildly differing syntax for programmer parameters, and
it also voids pretty much every assumption you could make about
programmer_param. The latter is a problem for libflashrom.

Use extract_param everywhere, clean up related code and make it more
foolproof. Add two instances of exit(1) where we have no option to
return an error. Remove six instances of exit(1) where returning an
error was possible.

WARNING: This changes programmer parameter syntax for a few programmers!

Corresponding to flashrom svn r1070.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Michael Karcher <flashrom@mkarcher.dialup.fu-berlin.de>
This commit is contained in:
Carl-Daniel Hailfinger
2010-07-06 09:55:48 +00:00
parent d1be52d545
commit 744132af4b
18 changed files with 243 additions and 184 deletions

View File

@@ -300,11 +300,8 @@ static int enable_flash_ich_dc(struct pci_dev *dev, const char *name)
int max_decode_fwh_decode = 0;
int contiguous = 1;
if (programmer_param)
idsel = strstr(programmer_param, "fwh_idsel=");
if (idsel) {
idsel += strlen("fwh_idsel=");
idsel = extract_param(&programmer_param, "fwh_idsel", ",:");
if (idsel && strlen(idsel)) {
fwh_conf = (uint32_t)strtoul(idsel, NULL, 0);
/* FIXME: Need to undo this on shutdown. */
@@ -312,7 +309,15 @@ static int enable_flash_ich_dc(struct pci_dev *dev, const char *name)
pci_write_long(dev, 0xd0, fwh_conf);
pci_write_word(dev, 0xd4, fwh_conf);
/* FIXME: Decode settings are not changed. */
} else if (idsel) {
msg_perr("Error: idsel= specified, but no number given.\n");
free(idsel);
/* FIXME: Return failure here once internal_init() starts
* to care about the return value of the chipset enable.
*/
exit(1);
}
free(idsel);
/* Ignore all legacy ranges below 1 MB.
* We currently only support flashing the chip which responds to