[coreboot-gerrit] Patch set updated for coreboot: e8f80fe ectool: add --dump / -d for RAM dump
Alexander Couzens (lynxis@fe80.eu)
gerrit at coreboot.org
Mon Mar 2 18:33:08 CET 2015
Alexander Couzens (lynxis at fe80.eu) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8381
-gerrit
commit e8f80fe124b24f7a09c80c616969005b84aefb2c
Author: Alexander Couzens <lynxis at fe80.eu>
Date: Sat Feb 7 04:10:12 2015 +0100
ectool: add --dump / -d for RAM dump
This moves the ram dump behind an argument, but
it still be called by default when no over arguments given.
Change-Id: I82648e8cf1eac455e9937bd3669a0e91a3ee87cf
Signed-off-by: Alexander Couzens <lynxis at fe80.eu>
---
util/ectool/ectool.c | 28 +++++++++++++++++++---------
1 file changed, 19 insertions(+), 9 deletions(-)
diff --git a/util/ectool/ectool.c b/util/ectool/ectool.c
index fddf340..2ed7ddf 100644
--- a/util/ectool/ectool.c
+++ b/util/ectool/ectool.c
@@ -46,11 +46,12 @@ void print_version(void)
void print_usage(const char *name)
{
- printf("usage: %s [-vh?Vi] [-w 0x<addr> -z 0x<data>]\n", name);
+ printf("usage: %s [-vh?Vid] [-w 0x<addr> -z 0x<data>]\n", name);
printf("\n"
" -v | --version: print the version\n"
" -h | --help: print this help\n\n"
" -V | --verbose: print debug information\n"
+ " -d | --dump: print RAM\n"
" -i | --idx: print IDX RAM\n"
" -w <addr in hex> write to addr\n"
" -z <data in hex> write to data\n"
@@ -58,7 +59,7 @@ void print_usage(const char *name)
exit(1);
}
-int verbose = 0, dump_idx = 0;
+int verbose = 0, dump_idx = 0, dump_ram = 0;
int main(int argc, char *argv[])
{
@@ -74,7 +75,7 @@ int main(int argc, char *argv[])
{0, 0, 0, 0}
};
- while ((opt = getopt_long(argc, argv, "vh?Viw:z:",
+ while ((opt = getopt_long(argc, argv, "vh?Vidw:z:",
long_options, &option_index)) != EOF) {
switch (opt) {
case 'v':
@@ -93,6 +94,9 @@ int main(int argc, char *argv[])
case 'z':
write_data = strtol(optarg , NULL, 16);
break;
+ case 'd':
+ dump_ram = 1;
+ break;
case 'h':
case '?':
default:
@@ -113,13 +117,19 @@ int main(int argc, char *argv[])
ec_write(write_addr & 0xff, write_data & 0xff);
}
- printf("EC RAM:\n");
- for (i = 0; i < 0x100; i++) {
- if ((i % 0x10) == 0)
- printf("\n%02x: ", i);
- printf("%02x ", ec_read(i));
+ /* preserve default - dump_ram if nothing selected */
+ if (!dump_ram && !dump_idx)
+ dump_ram = 1;
+
+ if (dump_ram) {
+ printf("EC RAM:\n");
+ for (i = 0; i < 0x100; i++) {
+ if ((i % 0x10) == 0)
+ printf("\n%02x: ", i);
+ printf("%02x ", ec_read(i));
+ }
+ printf("\n\n");
}
- printf("\n\n");
if (dump_idx) {
printf("EC IDX RAM:\n");
More information about the coreboot-gerrit
mailing list