Maybe we want something like this in superiotool? It's not _really_ superio-related, but as we now start dumping EC information and other stuff in superiotool we might also do this.
Having extra tools for such small stuff feels a bit strange.
On Sun, Feb 24, 2008 at 12:04:16PM -0500, joe@smittys.pointclark.net wrote:
Index: intel-debugtools/ich_gpio_dump/ich_gpio.c
--- intel-debugtools/ich_gpio_dump/ich_gpio.c (revision 0) +++ intel-debugtools/ich_gpio_dump/ich_gpio.c (revision 0) @@ -0,0 +1,95 @@ +/*
- dump gpio on intel ICH series southbridges
- Copyright (C) 2008 by coresystems GmbH
- written by Stefan Reinauer stepan@coresystems.de
- modded for all ICH's by Joseph Smith joe@smittys.pointclark.net
If it's modded enough to be non-trivial, add
Copyright (C) 2008 Joseph Smith joe@smittys.pointclark.net
otherwise please drop this line. The license header should only contain copyright holders IMO.
+int map_gpio(uint16_t gpio) +{
- int i;
- unsigned long size=0x40;
- for (i=0; i<size; i+=4) {
printf("gpiobase+0x%04x: 0x%08x\n", i, inl(gpio+i));
- }
- return 0;
+}
Please run indent over the code so it complies with the coding standards.
+int main(int argc, char *argv[]) +{
- struct pci_access *pacc;
- struct pci_dev *sb;
- uint16_t gpiobadd;
- uint16_t device;
- if (iopl(3)) { printf("You need to be root.\n"); exit(1); }
- pacc = pci_alloc();
- pci_init(pacc);
- pci_scan_bus(pacc);
- sb = pci_get_dev(pacc, 0, 0, 0x1f, 0);
- if (!sb) {
printf("No southbridge found.\n");
pci_cleanup(pacc);
exit(1);
- }
- if (pci_read_word(sb, 0) != 0x8086) {
printf("Not an Intel southbridge.\n");
pci_free_dev(sb);
pci_cleanup(pacc);
exit(1);
- }
- printf("Intel Southbridge: %04x:%04x\n",
pci_read_word(sb, 0), pci_read_word(sb, 2));
- device = pci_read_word(sb, 2);
- if (device < 0x2640) {
gpiobadd = pci_read_word(sb, 0x58) & 0xfffc;
- } else if (device >= 0x2640) {
gpiobadd = pci_read_word(sb, 0x48) & 0xfffc;
- }
- printf("GPIOBASE = 0x%04x\n\n", gpiobadd);
Hm, maybe this can even be done with some small shell script magic and lspci and similar standard tools? If so, I'd prefer such a script and / or just a small code snippet in the wiki?
Uwe.