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
This commit is contained in:
Carl-Daniel Hailfinger 2010-01-24 01:40:46 +00:00 committed by Uwe Hermann
parent 5142dcd530
commit bb38f3213b
3 changed files with 40 additions and 2 deletions

View File

@ -1,7 +1,7 @@
## ##
## This file is part of the superiotool project. ## 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 ## 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 ## 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 LDFLAGS = -framework IOKit -framework DirectIO -lpci -lz
endif 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) all: $(PROGRAM)
superiotool.o: *.c superiotool.h superiotool.o: *.c superiotool.h

View File

@ -282,6 +282,13 @@ int main(int argc, char *argv[])
print_version(); 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 (i = 0; i < ARRAY_SIZE(superio_ports_table); i++) {
for (j = 0; superio_ports_table[i].ports[j] != EOT; j++) for (j = 0; superio_ports_table[i].ports[j] != EOT; j++)
superio_ports_table[i].probe_idregs( superio_ports_table[i].probe_idregs(

View File

@ -2,7 +2,7 @@
* This file is part of the superiotool project. * This file is part of the superiotool project.
* *
* Copyright (C) 2007 Carl-Daniel Hailfinger * 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 Robinson P. Tryon <bishop.robinson@gmail.com>
* Copyright (C) 2008-2009 coresystems GmbH * Copyright (C) 2008-2009 coresystems GmbH
* *
@ -37,6 +37,10 @@
#include <DirectIO/darwinio.h> #include <DirectIO/darwinio.h>
#endif #endif
#ifdef PCI_SUPPORT
#include <pci/pci.h>
#endif
#if defined(__FreeBSD__) #if defined(__FreeBSD__)
#include <sys/types.h> #include <sys/types.h>
#include <machine/cpufunc.h> #include <machine/cpufunc.h>
@ -102,6 +106,12 @@ struct superio_registers {
} ldn[LDNSIZE]; } 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 */ /* superiotool.c */
uint8_t regval(uint16_t port, uint8_t reg); uint8_t regval(uint16_t port, uint8_t reg);
void regwrite(uint16_t port, uint8_t reg, uint8_t val); 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 probe_idregs_winbond(uint16_t port);
void print_winbond_chips(void); 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. */ /** Table of which config ports to probe for each Super I/O family. */
static const struct { static const struct {
void (*probe_idregs) (uint16_t port); void (*probe_idregs) (uint16_t port);
@ -153,6 +169,9 @@ static const struct {
{probe_idregs_nsc, {0x2e, 0x4e, 0x15c, EOT}}, {probe_idregs_nsc, {0x2e, 0x4e, 0x15c, EOT}},
{probe_idregs_smsc, {0x2e, 0x4e, 0x162e, 0x164e, 0x3f0, 0x370, EOT}}, {probe_idregs_smsc, {0x2e, 0x4e, 0x162e, 0x164e, 0x3f0, 0x370, EOT}},
{probe_idregs_winbond, {0x2e, 0x4e, 0x3f0, 0x370, 0x250, 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. */ /** Table of functions to print out supported Super I/O chips. */
@ -165,6 +184,9 @@ static const struct {
{print_nsc_chips}, {print_nsc_chips},
{print_smsc_chips}, {print_smsc_chips},
{print_winbond_chips}, {print_winbond_chips},
#ifdef PCI_SUPPORT
{print_via_chips},
#endif
}; };
#endif #endif