[coreboot-gerrit] New patch to review for coreboot: util/superiotool: Add initial support for exar XR28V384.

Derek Waldner (derek.waldner.os@gmail.com) gerrit at coreboot.org
Fri Apr 15 00:01:07 CEST 2016


Derek Waldner (derek.waldner.os at gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14367

-gerrit

commit 44d8ce97d4484cd2d04fa28448ccbc99f88b3766
Author: Derek Waldner <derek.waldner.os at gmail.com>
Date:   Thu Apr 14 12:13:48 2016 -0500

    util/superiotool: Add initial support for exar XR28V384.
    
    Datasheet
    https://www.exar.com/content/document.ashx?id=21368
    
    Adding support for exar chip used on a custom board
    that was designed to connect to the Olive Hill Plus
    development platform. The register dump was verified
    on the Olive Hill Plus platform.
    
    Change-Id: Ibd3e13eefb706bd99b6e5b38634f6855b39848ab
    Signed-off-by: Derek Waldner <derek.waldner.os at gmail.com>
---
 util/superiotool/Makefile      |  4 +-
 util/superiotool/exar.c        | 97 ++++++++++++++++++++++++++++++++++++++++++
 util/superiotool/superiotool.h |  6 +++
 3 files changed, 105 insertions(+), 2 deletions(-)

diff --git a/util/superiotool/Makefile b/util/superiotool/Makefile
index 1cd098f..f6d9685 100644
--- a/util/superiotool/Makefile
+++ b/util/superiotool/Makefile
@@ -28,8 +28,8 @@ CFLAGS += -O2 -Wall -Wstrict-prototypes -Wundef -Wstrict-aliasing \
          -Werror-implicit-function-declaration -ansi -pedantic $(VERSION)
 LDFLAGS += -lz
 
-OBJS = superiotool.o serverengines.o ali.o fintek.o ite.o nsc.o nuvoton.o \
-       smsc.o winbond.o infineon.o
+OBJS = superiotool.o serverengines.o ali.o exar.o fintek.o ite.o nsc.o \
+       nuvoton.o smsc.o winbond.o infineon.o
 
 OS_ARCH = $(shell uname)
 ifeq ($(OS_ARCH), Darwin)
diff --git a/util/superiotool/exar.c b/util/superiotool/exar.c
new file mode 100644
index 0000000..8b3c085
--- /dev/null
+++ b/util/superiotool/exar.c
@@ -0,0 +1,97 @@
+/*
+ * This file is part of the superiotool project.
+ *
+ * Copyright (C) 2016 Derek Waldner
+ * Copyright (C) 2016 Sencore Inc <opensource at sencore.com>
+ *
+ * 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.
+ */
+
+#include "superiotool.h"
+
+#define DEVICE_ID_BYTE1_REG	0x20
+#define DEVICE_ID_BYTE2_REG	0x21
+
+#define VENDOR_ID_BYTE1_REG	0x23
+#define VENDOR_ID_BYTE2_REG	0x24
+
+#define EXAR_VENDOR_ID		0xa813
+
+static const struct superio_registers reg_table[] = {
+	{0x8403, "XR28V384", {
+		/* We assume reserved bits are read as 0. */
+		{NOLDN, NULL,
+			{0x02,0x07,0x20,0x21,0x23,0x24,0x25,0x26,0x27,EOT},
+			{0x00,0x00,0x03,0x84,0x13,0xa8,0x00,0x00,0x00,EOT}},
+		{0x0, "COM1",
+			{0x30,0x60,0x61,0x70,0xf0,0xf1,0xf4,0xf5,0xf6,EOT},
+			{0x01,0x03,0xf8,0x03,0x00,0x44,0x00,0x00,0x00,EOT}},
+		{0x1, "COM2",
+			{0x30,0x60,0x61,0x70,0xf0,0xf4,0xf5,0xf6,EOT},
+			{0x01,0x02,0xf8,0x04,0x00,0x00,0x00,0x00,EOT}},
+		{0x2, "COM3",
+			{0x30,0x60,0x61,0x70,0xf0,0xf4,0xf5,0xf6,EOT},
+			{0x01,0x03,0xe8,0x05,0x00,0x00,0x00,0x00,EOT}},
+		{0x3, "COM4",
+			{0x30,0x60,0x61,0x70,0xf0,0xf4,0xf5,0xf6,EOT},
+			{0x01,0x02,0xe8,0x09,0x00,0x00,0x00,0x00,EOT}},
+		{0x8, "WDT",
+			{0x30,0x60,0x61,0x70,0xf0,0xf1,EOT},
+			{0x01,0x04,0x42,0x00,0x02,0x0a,EOT}},
+		{EOT}}},
+	{EOT}
+};
+
+void enter_conf_mode_exar(uint16_t port)
+{
+	OUTB(0x67, port);
+	OUTB(0x67, port);
+}
+
+void exit_conf_mode_exar(uint16_t port)
+{
+	OUTB(0xaa, port);
+}
+
+void probe_idregs_exar(uint16_t port)
+{
+	uint16_t vid, did;
+
+	probing_for("Exar", "", port);
+
+	enter_conf_mode_exar(port);
+
+	did = regval(port, DEVICE_ID_BYTE1_REG);
+	did |= (regval(port, DEVICE_ID_BYTE2_REG) << 8);
+
+	vid = regval(port, VENDOR_ID_BYTE1_REG);
+	vid |= (regval(port, VENDOR_ID_BYTE2_REG) << 8);
+
+	if (vid != EXAR_VENDOR_ID || superio_unknown(reg_table, did)) {
+		if (verbose)
+			printf(NOTFOUND "vid=0x%04x, id=0x%04x\n", vid, did);
+		exit_conf_mode_exar(port);
+		return;
+	}
+
+	printf("Found Exar %s (vid=0x%04x, id=0x%04x) at 0x%x\n",
+		get_superio_name(reg_table, did), vid, did, port);
+	chip_found = 1;
+
+	dump_superio("Exar", reg_table, port, did, LDN_SEL);
+
+	exit_conf_mode_exar(port);
+}
+
+void print_exar_chips(void)
+{
+	print_vendor_chips("Exar", reg_table);
+}
diff --git a/util/superiotool/superiotool.h b/util/superiotool/superiotool.h
index 443cc07..93ff8e2 100644
--- a/util/superiotool/superiotool.h
+++ b/util/superiotool/superiotool.h
@@ -191,6 +191,10 @@ void print_amd_chips(void);
 void probe_idregs_serverengines(uint16_t port);
 void print_serverengines_chips(void);
 
+/* exar.c */
+void probe_idregs_exar(uint16_t port);
+void print_exar_chips(void);
+
 /* fintek.c */
 void probe_idregs_fintek(uint16_t port);
 void probe_idregs_fintek_alternative(uint16_t port);
@@ -232,6 +236,7 @@ static const struct {
 	int ports[MAXNUMPORTS]; /* Signed, as we need EOT. */
 } superio_ports_table[] = {
 	{probe_idregs_ali,	{0x3f0, 0x370, EOT}},
+	{probe_idregs_exar,	{0x2e, 0x4e, EOT}},
 	{probe_idregs_fintek,	{0x2e, 0x4e, EOT}},
 	{probe_idregs_fintek_alternative,	{0x2e, 0x4e, EOT}},
 	/* Only use 0x370 for ITE, but 0x3f0 or 0x3bd would also be valid. */
@@ -256,6 +261,7 @@ static const struct {
 	void (*print_list) (void);
 } vendor_print_functions[] = {
 	{print_ali_chips},
+	{print_exar_chips},
 	{print_fintek_chips},
 	{print_ite_chips},
 	{print_nsc_chips},



More information about the coreboot-gerrit mailing list