[coreboot] [PATCH]ich_gpio_dump util

joe at smittys.pointclark.net joe at smittys.pointclark.net
Tue Feb 26 21:52:37 CET 2008


Quoting Uwe Hermann <uwe at hermann-uwe.de>:

> 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.
>
I agree it would be cool to have something like this in superiotool. I  
know for smsc it would be very helpful for a dump of "Runtime  
Registers".
>
> Having extra tools for such small stuff feels a bit strange.
>
reguarless of it's size it is still a tool:-)
>
>
> On Sun, Feb 24, 2008 at 12:04:16PM -0500, joe at 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 at coresystems.de>
>> + * modded for all ICH's by Joseph Smith <joe at smittys.pointclark.net>
>
> If it's modded enough to be non-trivial, add
>
> Copyright (C) 2008 Joseph Smith <joe at smittys.pointclark.net>
>
> otherwise please drop this line. The license header should only contain
> copyright holders IMO.
>
ok
>
>
>> +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.
>
ok
>
>
>> +
>> +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?
>
Not sure how you could do this with lspci??? It can be don with dd but  
the output is not as pretty:-)
>
>
> Uwe.
Thanks for the feedback Uwe, You seem sort quiet these days.....

Thanks - Joe




More information about the coreboot mailing list