summaryrefslogtreecommitdiff
path: root/util/superiotool
diff options
context:
space:
mode:
authorCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2010-01-24 01:40:46 +0000
committerUwe Hermann <uwe@hermann-uwe.de>2010-01-24 01:40:46 +0000
commitbb38f3213b6889db9fcdab79086bb860f3a32547 (patch)
tree64a5d355f078462b98c3db16ecb48818ef0621c0 /util/superiotool
parent5142dcd530e27c5a94612a532b2deaf229670223 (diff)
downloadcoreboot-bb38f3213b6889db9fcdab79086bb860f3a32547.tar.xz
Add VIA VT82C686A/VT82C686B detection support to superiotool.
This adds an additional requirement to superiotool: libpci. The PCI code is conditional on PCI_SUPPORT. You can set the CONFIG_PCI variable in the Makefile to 'no' to disable it. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de> Acked-by: Stefan Reinauer <stepan@coresystems.de> Acked-by: Uwe Hermann <uwe@hermann-uwe.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5047 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'util/superiotool')
-rw-r--r--util/superiotool/Makefile11
-rw-r--r--util/superiotool/superiotool.c7
-rw-r--r--util/superiotool/superiotool.h24
3 files changed, 40 insertions, 2 deletions
diff --git a/util/superiotool/Makefile b/util/superiotool/Makefile
index 6cb3042739..6a6b69762f 100644
--- a/util/superiotool/Makefile
+++ b/util/superiotool/Makefile
@@ -1,7 +1,7 @@
##
## This file is part of the superiotool project.
##
-## Copyright (C) 2007 Uwe Hermann <uwe@hermann-uwe.de>
+## Copyright (C) 2007-2010 Uwe Hermann <uwe@hermann-uwe.de>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -39,6 +39,15 @@ ifeq ($(OS_ARCH), Darwin)
LDFLAGS = -framework IOKit -framework DirectIO -lpci -lz
endif
+# Support for PCI-attached "Super I/Os" (e.g. in VIA VT82686A/B).
+CONFIG_PCI = yes
+
+ifeq ($(CONFIG_PCI), yes)
+CFLAGS += -DPCI_SUPPORT
+LDFLAGS += -lpci
+OBJS += pci.o via.o
+endif
+
all: $(PROGRAM)
superiotool.o: *.c superiotool.h
diff --git a/util/superiotool/superiotool.c b/util/superiotool/superiotool.c
index 6786b0a47f..2afc2bfa62 100644
--- a/util/superiotool/superiotool.c
+++ b/util/superiotool/superiotool.c
@@ -282,6 +282,13 @@ int main(int argc, char *argv[])
print_version();
+#ifdef PCI_SUPPORT
+ /* Do some basic libpci init. */
+ pacc = pci_alloc();
+ pci_init(pacc);
+ pci_scan_bus(pacc);
+#endif
+
for (i = 0; i < ARRAY_SIZE(superio_ports_table); i++) {
for (j = 0; superio_ports_table[i].ports[j] != EOT; j++)
superio_ports_table[i].probe_idregs(
diff --git a/util/superiotool/superiotool.h b/util/superiotool/superiotool.h
index f9a38a1d5a..c953038528 100644
--- a/util/superiotool/superiotool.h
+++ b/util/superiotool/superiotool.h
@@ -2,7 +2,7 @@
* This file is part of the superiotool project.
*
* Copyright (C) 2007 Carl-Daniel Hailfinger
- * Copyright (C) 2007 Uwe Hermann <uwe@hermann-uwe.de>
+ * Copyright (C) 2007-2010 Uwe Hermann <uwe@hermann-uwe.de>
* Copyright (C) 2008 Robinson P. Tryon <bishop.robinson@gmail.com>
* Copyright (C) 2008-2009 coresystems GmbH
*
@@ -37,6 +37,10 @@
#include <DirectIO/darwinio.h>
#endif
+#ifdef PCI_SUPPORT
+#include <pci/pci.h>
+#endif
+
#if defined(__FreeBSD__)
#include <sys/types.h>
#include <machine/cpufunc.h>
@@ -102,6 +106,12 @@ struct superio_registers {
} ldn[LDNSIZE];
};
+/* pci.c */
+#ifdef PCI_SUPPORT
+extern struct pci_access *pacc;
+struct pci_dev *pci_dev_find(uint16_t vendor, uint16_t device);
+#endif
+
/* superiotool.c */
uint8_t regval(uint16_t port, uint8_t reg);
void regwrite(uint16_t port, uint8_t reg, uint8_t val);
@@ -141,6 +151,12 @@ void print_smsc_chips(void);
void probe_idregs_winbond(uint16_t port);
void print_winbond_chips(void);
+/* via.c */
+#ifdef PCI_SUPPORT
+void probe_idregs_via(uint16_t port);
+void print_via_chips(void);
+#endif
+
/** Table of which config ports to probe for each Super I/O family. */
static const struct {
void (*probe_idregs) (uint16_t port);
@@ -153,6 +169,9 @@ static const struct {
{probe_idregs_nsc, {0x2e, 0x4e, 0x15c, EOT}},
{probe_idregs_smsc, {0x2e, 0x4e, 0x162e, 0x164e, 0x3f0, 0x370, EOT}},
{probe_idregs_winbond, {0x2e, 0x4e, 0x3f0, 0x370, 0x250, EOT}},
+#ifdef PCI_SUPPORT
+ {probe_idregs_via, {0x3f0, EOT}},
+#endif
};
/** Table of functions to print out supported Super I/O chips. */
@@ -165,6 +184,9 @@ static const struct {
{print_nsc_chips},
{print_smsc_chips},
{print_winbond_chips},
+#ifdef PCI_SUPPORT
+ {print_via_chips},
+#endif
};
#endif