Implement programmer aliases
This introduces the notion of a programmer alias which allows us to
simplify the "-p" option. Now a user can use "-p <alias>" where
currently supported aliases are "host" and "ec".
For example:
flashrom -p ec -r ec.bin
flashrom -p host -r host.bin
This patch also modifies various programmers to cope with both old
and new syntax:
- ENE, ChromeEC (GEC), ICH, linux_spi, and mec1308 only required
additional checking for a user-specified alias.
- Programmers which use require chipset configuration such as
forwarding LPC/FWH bus cycles in a shared memory region (it85xxx
and wpce775x/npce781x) will set the chipset's target bus. This is
sort of ugly dependency, but is necessary so they don't interfere
with operation of other chips. They are probed fully using
non-interfering SuperIO techniques first.
BUG=chrome-os-partner:19077, chrome-os-partner:16211
BRANCH=none
TEST=See notes below
Tested on (mario, zgb, alex, lumpy, stumpy, parrot, butterfly, stout,
snow, spring, pit, link). Note: stumpy doesn't have an EC so LPC/EC
reads were omitted from the testing below.
Test methodology:
1. Use old syntax with ToT flashrom to obtain host and EC ROMs
2. Use old syntax with this patch to obtain host and EC ROMs
3. Use new syntax with this patch to obtain host and EC ROMs
4. compare size and content to ensure the binaries for each host/EC
set came out the same
Change-Id: Ib904e1a0088b086789d1b084cb38e55a4fff28fd
Reviewed-on: https://gerrit.chromium.org/gerrit/58013
Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
diff --git a/programmer.c b/programmer.c
index 5eabdaf..eb92e1b 100644
--- a/programmer.c
+++ b/programmer.c
@@ -116,3 +116,10 @@
par_programmer = pgm;
buses_supported |= buses;
}
+
+struct programmer_alias aliases[] = {
+ { "ec", ALIAS_EC },
+ { "host", ALIAS_HOST },
+ { NULL },
+};
+struct programmer_alias *alias;