From: Jonathan A. Kollasch Date: Mon, 7 Nov 2011 16:56:42 +0000 (-0600) Subject: superiotool: add detection and dump of Infineon SLB9635 TPM X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=coreboot.git;a=commitdiff_plain;h=3d1d6bb4ecb15a12f48f871c623882bee9c0c576 superiotool: add detection and dump of Infineon SLB9635 TPM Change-Id: If94ea5f45135a4b65bdd37532851fa0ba864bb73 Signed-off-by: Jonathan A. Kollasch Reviewed-on: http://review.coreboot.org/421 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- diff --git a/util/superiotool/Makefile b/util/superiotool/Makefile index 5cc7650ad..e7d2f6329 100644 --- a/util/superiotool/Makefile +++ b/util/superiotool/Makefile @@ -34,7 +34,7 @@ CFLAGS += -O2 -Wall -Wstrict-prototypes -Wundef -Wstrict-aliasing \ LDFLAGS += -lz OBJS = superiotool.o serverengines.o ali.o fintek.o ite.o nsc.o nuvoton.o \ - smsc.o winbond.o + smsc.o winbond.o infineon.o OS_ARCH = $(shell uname) ifeq ($(OS_ARCH), Darwin) diff --git a/util/superiotool/infineon.c b/util/superiotool/infineon.c new file mode 100644 index 000000000..56bc06206 --- /dev/null +++ b/util/superiotool/infineon.c @@ -0,0 +1,87 @@ +/* + * This file is part of the superiotool project. + * + * Copyright (C) 2011 Jonathan A. Kollasch + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "superiotool.h" + +#define DEVICE_ID_REG 0x20 +#define DEVICE_REV_REG 0x21 + +static const struct superio_registers reg_table[] = { + {0x0b, "SLB9635TT12", { + {NOLDN, NULL, + {0x20,0x21,0x26,0x27,EOT}, + {0x0b,0x00,NANA,NANA,EOT}}, + {0, NULL, + {0x30,0x38,0x60,0x61,0x70,0x71,0xf1,0xf2,0xf3,0xf4,0xf5,EOT}, + {0x00,0x00,NANA,NANA,0x00,0x02,0xd1,0x15,0x0b,0x00,NANA,EOT}}, + {EOT}}}, + {EOT} +}; + +/* same as some SMSC */ +static void enter_conf_mode_infineon(uint16_t port) +{ + OUTB(0x55, port); +} + +static void exit_conf_mode_infineon(uint16_t port) +{ + OUTB(0xaa, port); +} + +void probe_idregs_infineon(uint16_t port) +{ + uint8_t rev, devid; + + probing_for("Infineon", "", port); + + enter_conf_mode_infineon(port); + + devid = regval(port, DEVICE_ID_REG); + rev = regval(port, DEVICE_REV_REG); + + if (superio_unknown(reg_table, devid)) { + if (verbose) + printf(NOTFOUND "id=0x%02x, rev=0x%02x\n", devid, rev); + exit_conf_mode_infineon(port); + return; + } + + /* Attempt to prevent false matches on SMSC FDC37N972, see smsc.c */ + if (((regval(port, 0x27)<<8)|regval(port, 0x26)) != port) { + if (verbose) + printf(NOTFOUND "id=0x%02x, rev=0x%02x\n", devid, rev); + exit_conf_mode_infineon(port); + return; + } + + printf("Found Infineon %s (id=0x%02x, rev=0x%02x) at 0x%x\n", + get_superio_name(reg_table, devid), devid, rev, port); + chip_found = 1; + + dump_superio("Infineon", reg_table, port, devid, LDN_SEL); + + exit_conf_mode_infineon(port); +} + +void print_infineon_chips(void) +{ + print_vendor_chips("Infineon", reg_table); +} diff --git a/util/superiotool/superiotool.h b/util/superiotool/superiotool.h index f705a58d8..5583ec566 100644 --- a/util/superiotool/superiotool.h +++ b/util/superiotool/superiotool.h @@ -195,6 +195,10 @@ void probe_idregs_fintek(uint16_t port); void probe_idregs_fintek_alternative(uint16_t port); void print_fintek_chips(void); +/* infineon.c */ +void probe_idregs_infineon(uint16_t port); +void print_infineon_chips(void); + /* ite.c */ void probe_idregs_ite(uint16_t port); void print_ite_chips(void); @@ -243,6 +247,7 @@ static const struct { {probe_idregs_amd, {0xaa, EOT}}, #endif {probe_idregs_serverengines, {0x2e, EOT}}, + {probe_idregs_infineon, {0x2e, 0x4e}}, }; /** Table of functions to print out supported Super I/O chips. */ @@ -261,6 +266,7 @@ static const struct { {print_amd_chips}, #endif {print_serverengines_chips}, + {print_infineon_chips}, }; #endif