shithub: riscv

Download patch

ref: 95dbc72801b507b9c2c42444347b98872576244a
parent: ee05bbccbce695f51f67ac2f376d93779ce69224
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Nov 9 19:35:07 EST 2014

io: add -E flag to access embedded controller space

--- a/sys/man/1/io
+++ b/sys/man/1/io
@@ -4,7 +4,7 @@
 .SH SYNOPSIS
 .B io
 [
-.B -WLMrw
+.B -WLMErw
 ]
 .I address
 [
@@ -38,7 +38,11 @@
 .TP
 .B  -M
 Access a 64 bit wide machine specific register (MSR).
+.TP
+.B  -E
+Access embedded controller space.
 .SH SOURCE
 .B /sys/src/cmd/io.c
 .SH SEE ALSO
-.IR seg (1)
+.IR seg (1),
+.IR arch (3)
--- a/sys/src/cmd/io.c
+++ b/sys/src/cmd/io.c
@@ -1,7 +1,7 @@
 #include <u.h>
 #include <libc.h>
 
-const char const * datac[] = {0,"#P/iob","#P/iow",0,"#P/iol",0,0,0,"#P/msr"};
+char *datac[] = {0,"#P/iob","#P/iow",0,"#P/iol",0,0,0,"#P/msr"};
 
 void
 main(int argc, char** argv) {
@@ -17,6 +17,7 @@
 		case 'W': size = 2; break;
 		case 'L': size = 4; break;
 		case 'M': size = 8; break;
+		case 'E': datac[1] = datac[2] = datac[4] = datac[8] = "#P/ec"; break;
 		case 'r': op = OREAD; break;
 		case 'w': op = OWRITE; break;
 		default: sysfatal("bad flag %c", ARGC());