aboutsummaryrefslogtreecommitdiff
path: root/src/superio/intel/i8900/superio.c
diff options
context:
space:
mode:
authorMarc Jones <marc.jones@se-eng.com>2015-09-23 16:19:11 -0600
committerMartin Roth <martinroth@google.com>2015-11-10 00:15:22 +0100
commitcb492da9134c911502905cf9ec705c54992c9df9 (patch)
tree925d98482574617acecfeb7c421620976de8bdaf /src/superio/intel/i8900/superio.c
parent31f4d00c95731be956110f4c76656c330fd4684f (diff)
superio/intel: Add i8900 device
The Intel i8900 Super I/O is similar to the previously supported i3100. Change-Id: I9a5b651cab35991c3c3e09fc4668d35ca2d221ba Signed-off-by: Marc Jones <marc.jones@se-eng.com> Reviewed-on: http://review.coreboot.org/12169 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Reviewed-by: York Yang <york.yang@intel.com>
Diffstat (limited to 'src/superio/intel/i8900/superio.c')
-rw-r--r--src/superio/intel/i8900/superio.c90
1 files changed, 90 insertions, 0 deletions
diff --git a/src/superio/intel/i8900/superio.c b/src/superio/intel/i8900/superio.c
new file mode 100644
index 0000000000..f92f457253
--- /dev/null
+++ b/src/superio/intel/i8900/superio.c
@@ -0,0 +1,90 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2008 Arastra, Inc.
+ *
+ * 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.
+ */
+
+#include <stdlib.h>
+#include <device/device.h>
+#include <device/pnp.h>
+#include <drivers/uart/uart8250reg.h>
+#include "i8900.h"
+#include <arch/io.h>
+
+static void pnp_enter_ext_func_mode(struct device *dev)
+{
+ outb(0x80, dev->path.pnp.port);
+ outb(0x86, dev->path.pnp.port);
+}
+
+static void pnp_exit_ext_func_mode(struct device *dev)
+{
+ outb(0x68, dev->path.pnp.port);
+ outb(0x08, dev->path.pnp.port);
+}
+
+static void i8900_init(struct device *dev)
+{
+ if (!dev->enabled)
+ return;
+}
+
+static void i8900_pnp_set_resources(struct device *dev)
+{
+ pnp_enter_ext_func_mode(dev);
+ pnp_set_resources(dev);
+ pnp_exit_ext_func_mode(dev);
+}
+
+static void i8900_pnp_enable_resources(struct device *dev)
+{
+ pnp_enter_ext_func_mode(dev);
+ pnp_enable_resources(dev);
+ pnp_exit_ext_func_mode(dev);
+}
+
+static void i8900_pnp_enable(struct device *dev)
+{
+ pnp_enter_ext_func_mode(dev);
+ pnp_set_logical_device(dev);
+ pnp_set_enable(dev, !!dev->enabled);
+ pnp_exit_ext_func_mode(dev);
+}
+
+static struct device_operations ops = {
+ .read_resources = pnp_read_resources,
+ .set_resources = i8900_pnp_set_resources,
+ .enable_resources = i8900_pnp_enable_resources,
+ .enable = i8900_pnp_enable,
+ .init = i8900_init,
+};
+
+static struct pnp_info pnp_dev_info[] = {
+ { &ops, I8900_SP1, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, },
+ { &ops, I8900_SP2, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, },
+ { &ops, I8900_WDT, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, },
+};
+
+static void enable_dev(struct device *dev)
+{
+ pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
+}
+
+struct chip_operations superio_intel_i8900_ops = {
+ CHIP_NAME("Intel 8900 Super I/O")
+ .enable_dev = enable_dev,
+};