aboutsummaryrefslogtreecommitdiff
path: root/util/ectool/ectool.c
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2018-01-25 21:44:09 +0800
committerPatrick Georgi <pgeorgi@google.com>2018-04-19 16:30:23 +0000
commit2e8f4ccfe636fcb0ccd62aee503aa2320c83b6ea (patch)
tree69269ce6522780b62393167ac2630f7f8341526b /util/ectool/ectool.c
parent51895d183861234db9500bd1ee33634776e91e93 (diff)
ectool: Add an option to get and use EC ports from /proc/ioports
There are boards that don't use ports 0x62 and 0x66 for EC, e.g. Dell Latitude E6230 uses 0x930 and 0x934. Change-Id: Ie3005f5cd6e37206ef187267b0542efdeb26b3af Signed-off-by: Iru Cai <mytbk920423@gmail.com> Reviewed-on: https://review.coreboot.org/23430 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'util/ectool/ectool.c')
-rw-r--r--util/ectool/ectool.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/util/ectool/ectool.c b/util/ectool/ectool.c
index dcf17288f1..be5a899765 100644
--- a/util/ectool/ectool.c
+++ b/util/ectool/ectool.c
@@ -62,6 +62,7 @@ void print_usage(const char *name)
" -v | --version: print the version\n"
" -h | --help: print this help\n\n"
" -V | --verbose: print debug information\n"
+ " -p | --getports: get EC data & cmd ports from /proc/ioports\n"
" -d | --dump: print RAM\n"
" -i | --idx: print IDX RAM & RAM\n"
" -q | --query: print query byte\n"
@@ -71,7 +72,7 @@ void print_usage(const char *name)
exit(1);
}
-int verbose = 0, dump_idx = 0, dump_ram = 0, dump_query = 0;
+int verbose = 0, dump_idx = 0, dump_ram = 0, dump_query = 0, get_ports = 0;
int main(int argc, char *argv[])
{
@@ -85,10 +86,11 @@ int main(int argc, char *argv[])
{"verbose", 0, 0, 'V'},
{"idx", 0, 0, 'i'},
{"query", 0, 0, 'q'},
+ {"getports", 0, 0, 'p'},
{0, 0, 0, 0}
};
- while ((opt = getopt_long(argc, argv, "vh?Vidqw:z:",
+ while ((opt = getopt_long(argc, argv, "vh?Vidqpw:z:",
long_options, &option_index)) != EOF) {
switch (opt) {
case 'v':
@@ -114,6 +116,9 @@ int main(int argc, char *argv[])
case 'q':
dump_query = 1;
break;
+ case 'p':
+ get_ports = 1;
+ break;
case 'h':
case '?':
default:
@@ -123,6 +128,10 @@ int main(int argc, char *argv[])
}
}
+ if (get_ports && get_ec_ports() != 0)
+ fprintf(stderr, "Cannot get EC ports from /proc/ioports, "
+ "fallback to default.");
+
if (iopl(3)) {
printf("You need to be root.\n");
exit(1);