From 2e8f4ccfe636fcb0ccd62aee503aa2320c83b6ea Mon Sep 17 00:00:00 2001 From: Iru Cai Date: Thu, 25 Jan 2018 21:44:09 +0800 Subject: 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 Reviewed-on: https://review.coreboot.org/23430 Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber --- util/ectool/ectool.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'util/ectool/ectool.c') 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); -- cgit v1.2.3