diff options
author | aiju <devnull@localhost> | 2011-04-15 20:29:46 +0200 |
---|---|---|
committer | aiju <devnull@localhost> | 2011-04-15 20:29:46 +0200 |
commit | 68d6b0808bbd57a91abf2a5ac4571e4372a8d3fc (patch) | |
tree | 4b0b6214de9c0e70fc26d09264c41557f1f23510 /sys/src/cmd/aux/vga/io.c | |
parent | a95f7282410ebfa4e2a4ff816e8486e7e0f8284a (diff) |
added geode driver
Diffstat (limited to 'sys/src/cmd/aux/vga/io.c')
-rw-r--r-- | sys/src/cmd/aux/vga/io.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sys/src/cmd/aux/vga/io.c b/sys/src/cmd/aux/vga/io.c index c602c0837..ed73f6a27 100644 --- a/sys/src/cmd/aux/vga/io.c +++ b/sys/src/cmd/aux/vga/io.c @@ -11,6 +11,7 @@ static int iobfd = -1; static int iowfd = -1; static int iolfd = -1; static int biosfd = -1; +static int msrfd = -1; static ulong biosoffset = 0; enum { @@ -106,6 +107,29 @@ outportl(long port, ulong data) error("outportl(0x%4.4lx, 0x%2.2luX): %r\n", port, data); } +uvlong +rdmsr(long port) +{ + uvlong data; + + if(msrfd == -1) + msrfd = devopen("#P/msr", ORDWR); + + if(pread(msrfd, &data, sizeof(data), port) != sizeof(data)) + error("rdmsr(0x%4.4lx): %r\n", port); + return data; +} + +void +wrmsr(long port, uvlong data) +{ + if(msrfd == -1) + msrfd = devopen("#P/msr", ORDWR); + + if(pwrite(msrfd, &data, sizeof(data), port) != sizeof(data)) + error("wrmsr(0x%4.4lx, 0x%2.2lluX): %r\n", port, data); +} + static void vgactlinit(void) { |