superiotool: add detection and dump of Infineon SLB9635 TPM
authorJonathan A. Kollasch <jakllsch@kollasch.net>
Mon, 7 Nov 2011 16:56:42 +0000 (10:56 -0600)
committerStefan Reinauer <stefan.reinauer@coreboot.org>
Mon, 7 Nov 2011 21:05:21 +0000 (22:05 +0100)
Change-Id: If94ea5f45135a4b65bdd37532851fa0ba864bb73
Signed-off-by: Jonathan A. Kollasch <jakllsch@kollasch.net>
Reviewed-on: http://review.coreboot.org/421
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
util/superiotool/Makefile
util/superiotool/infineon.c [new file with mode: 0644]
util/superiotool/superiotool.h

index 5cc7650ad81d03977eba2104462de09456deb3e7..e7d2f6329ee0e626b52cb548731e30328e302864 100644 (file)
@@ -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 \
 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)
 
 OS_ARCH = $(shell uname)
 ifeq ($(OS_ARCH), Darwin)
diff --git a/util/superiotool/infineon.c b/util/superiotool/infineon.c
new file mode 100644 (file)
index 0000000..56bc062
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ * This file is part of the superiotool project.
+ *
+ * Copyright (C) 2011 Jonathan A. Kollasch <jakllsch@kollasch.net>
+ *
+ * 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);
+}
index f705a58d822bacc9e9421d344a66c42c2820f2dc..5583ec56697540a6d8f00c86f9bbbee40800f380 100644 (file)
@@ -195,6 +195,10 @@ void probe_idregs_fintek(uint16_t port);
 void probe_idregs_fintek_alternative(uint16_t port);
 void print_fintek_chips(void);
 
 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);
 /* 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_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. */
 };
 
 /** 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_amd_chips},
 #endif
        {print_serverengines_chips},
+       {print_infineon_chips},
 };
 
 #endif
 };
 
 #endif