summaryrefslogtreecommitdiff
path: root/util/probe_superio
diff options
context:
space:
mode:
authorRonald G. Minnich <rminnich@gmail.com>2006-02-22 22:12:21 +0000
committerRonald G. Minnich <rminnich@gmail.com>2006-02-22 22:12:21 +0000
commit394e7c416bb1e431005fe1cbfd62b4366896c27b (patch)
tree0ac66a073c61f19dd5e41a871a375bcac7856368 /util/probe_superio
parent7db27ee6483f6b31023030a77fe37bc4c1842ac8 (diff)
added new superio. added new simple util.
modified dell 1850 git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2178 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/probe_superio')
-rw-r--r--util/probe_superio/Makefile2
-rwxr-xr-xutil/probe_superio/probe_superiobin0 -> 7134 bytes
-rw-r--r--util/probe_superio/probe_superio.c79
3 files changed, 81 insertions, 0 deletions
diff --git a/util/probe_superio/Makefile b/util/probe_superio/Makefile
new file mode 100644
index 0000000000..37b13b1ba9
--- /dev/null
+++ b/util/probe_superio/Makefile
@@ -0,0 +1,2 @@
+probe_superio: probe_superio.c
+ cc -O2 -o probe_superio probe_superio.c
diff --git a/util/probe_superio/probe_superio b/util/probe_superio/probe_superio
new file mode 100755
index 0000000000..79601d15ec
--- /dev/null
+++ b/util/probe_superio/probe_superio
Binary files differ
diff --git a/util/probe_superio/probe_superio.c b/util/probe_superio/probe_superio.c
new file mode 100644
index 0000000000..6bb1347e15
--- /dev/null
+++ b/util/probe_superio/probe_superio.c
@@ -0,0 +1,79 @@
+#include <stdio.h>
+#include <sys/io.h>
+
+/* well, they really thought this throught, eh? Family is 8 bits!!!! */
+char *familyid[] = {
+ [0xf1] = "pc8374 (winbond, was NS)"
+};
+
+/* eventually, if you care, break this out into a file. For now, I don't know
+ * if we need this.
+ */
+
+unsigned char regval(unsigned short port, unsigned short reg) {
+ outb(reg, port);
+ return inb(port+1);
+}
+
+void
+dump_ns8374(unsigned short port) {
+ printf("Enables: 21=%02x, 22=%02x, 23=%02x, 24=%02x, 26=%02x\n",
+ regval(port,0x21), regval(port,0x22),
+ regval(port,0x23), regval(port,0x24), regval(port,0x26));
+ /* check COM1. This is all we care about at present. */
+ printf("COM 1 is Globally %s\n", regval(port,0x26)&8 ? "disabled" : "enabled");
+ /* select com1 */
+ outb(0x7, port);
+ outb(3, port+1);
+ printf("COM 1 is locally %s\n", regval(port, 0x30) & 1 ? "enabled" : "disabled");
+ printf("COM1 60=%02x, 61=%02x, 70=%02x, 71=%02x, 74=%02x, 75=%02x, f0=%02x\n",
+ regval(port, 0x60), regval(port, 0x61), regval(port, 0x70), regval(port, 0x71),
+ regval(port, 0x74), regval(port, 0x75), regval(port, 0xf0));
+
+}
+
+void
+probe_idregs(unsigned short port){
+ unsigned char id;
+ int i;
+ outb(0x20, port);
+ if (inb(port) != 0x20) {
+ printf("probing 0x%04x, failed (0x%02x), data returns 0x%02x\n",
+ port, inb(port), inb(port+1));
+ return;
+ }
+ id = inb(port+1);
+ printf("Probe of id returns %02x\n", id);
+ if (id == 0xff)
+ return;
+
+ printf("%s\n", familyid[id]);
+ switch(id) {
+ case 0xf1:
+ dump_ns8374(port);
+ break;
+ default:
+ printf("no dump for 0x%02x\n", id);
+ break;
+ }
+}
+
+void
+probe_superio(unsigned short port) {
+ probe_idregs(port);
+}
+
+int
+main(int argc, char *argv[]){
+ unsigned short port;
+
+ if (iopl(3) < 0) {
+ perror("iopl");
+ exit(1);
+ }
+
+ /* try the 2e */
+ probe_superio(0x2e);
+ /* now try the 4e */
+ probe_superio(0x4e);
+}