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,94 @@ +/* + * dump gpio on intel ICH series southbridges + * + * Copyright (C) 2008 by coresystems GmbH + * written by Stefan Reinauer + * Copyright (C) 2008 Joseph Smith + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +int map_gpio(uint16_t gpio) +{ + int i; + unsigned long size=0x40; + + for (i=0; i= 0x2640) { + gpiobadd = pci_read_word(sb, 0x48) & 0xfffc; + } + printf("GPIOBASE = 0x%04x\n\n", gpiobadd); + + pci_free_dev(sb); + pci_cleanup(pacc); + + map_gpio(gpiobadd); + + + return 0; +} Index: intel-debugtools/ich_gpio_dump/ich_gpio.8 =================================================================== --- intel-debugtools/ich_gpio_dump/ich_gpio.8 (revision 0) +++ intel-debugtools/ich_gpio_dump/ich_gpio.8 (revision 0) @@ -0,0 +1,59 @@ +.TH ICH_GPIO 8 "March 8, 2008" +.SH NAME +ich_gpio \- Intel southbridge GPIO Dump Utility +.SH SYNOPSIS +.B ich_gpio +.SH DESCRIPTION +.B ich_gpio +is a user-space utility which can dump all +register contents of the Intel ICH series Southbridges. +.PP +It is mainly used for coreboot development purposes (see coreboot.org +for details on coreboot), but it may also be useful for other things. +.PP +Here is an example output: +.br +[root@localhost dumpgpio]# ich_gpio +.br +Intel Southbridge: 8086:24c0 +.br +GPIOBASE = 0x0500 +.br +gpiobase+0x0000: 0x1a003180 +.br +gpiobase+0x0004: 0x0900ffff +.br +gpiobase+0x0008: 0x00000000 +.br +gpiobase+0x000c: 0x1bbf0000 +.br +gpiobase+0x0010: 0x00000000 +.br +gpiobase+0x0014: 0x00000000 +.br +gpiobase+0x0018: 0x00040000 +.br +gpiobase+0x001c: 0x00000000 +.br +gpiobase+0x0020: 0x00000000 +.br +gpiobase+0x0024: 0x00000000 +.br +gpiobase+0x0028: 0x00000000 +.br +gpiobase+0x002c: 0x00003000 +.br +gpiobase+0x0030: 0x00000fff +.br +gpiobase+0x0034: 0x00000e00 +.br +gpiobase+0x0038: 0x00000fff +.br +gpiobase+0x003c: 0x00000000 +.PP +Please consult your datasheet for the register meanings. +.SH OPTIONS +No command line options needed just run ich_gpio. +.SH AUTHORS +Please see the individual source code files. + Index: intel-debugtools/ich_gpio_dump/Makefile =================================================================== --- intel-debugtools/ich_gpio_dump/Makefile (revision 0) +++ intel-debugtools/ich_gpio_dump/Makefile (revision 0) @@ -0,0 +1,62 @@ +# +# Makefile for ich_gpio utility +# +# (C) 2008 by coresystems GmbH +# written by Stefan Reinauer +# Copyright (C) 2008 Joseph Smith +# + +PROGRAM = ich_gpio + +CC = gcc +STRIP = strip +INSTALL = /usr/bin/install +PREFIX = /usr/local +CFLAGS = -O2 -g -Wall +OS_ARCH = $(shell uname) +ifeq ($(OS_ARCH), SunOS) +LDFLAGS = -lpci -lz +else +LDFLAGS = -lpci -lz -static +STRIP_ARGS = -s +endif + +OBJS = ich_gpio.o + +all: pciutils dep $(PROGRAM) + +$(PROGRAM): $(OBJS) + $(CC) -o $(PROGRAM) $(OBJS) $(LDFLAGS) + $(STRIP) $(STRIP_ARGS) $(PROGRAM) + +clean: + rm -f *.o *~ + +distclean: clean + rm -f $(PROGRAM) .dependencies + +dep: + @$(CC) -MM *.c > .dependencies + +pciutils: + @echo; echo -n "Checking for pciutils and zlib... " + @$(shell ( echo "#include "; \ + echo "struct pci_access *pacc;"; \ + echo "int main(int argc, char **argv)"; \ + echo "{ pacc = pci_alloc(); return 0; }"; ) > .test.c ) + @$(CC) $(CFLAGS) .test.c -o .test $(LDFLAGS) &>/dev/null && \ + echo "found." || ( echo "not found."; echo; \ + echo "Please install pciutils-devel and zlib-devel."; \ + echo "See README for more information."; echo; \ + rm -f .test.c .test; exit 1) + @rm -f .test.c .test + +install: $(PROGRAM) + $(INSTALL) $(PROGRAM) $(PREFIX)/sbin + mkdir -p $(PREFIX)/share/man/man8 + $(INSTALL) $(PROGRAM).8 $(PREFIX)/share/man/man8 + +.PHONY: all clean distclean dep pciutils + +-include .dependencies +