summaryrefslogtreecommitdiffstats
path: root/sys/dev/puc
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2014-04-22 13:02:03 +0000
committermarius <marius@FreeBSD.org>2014-04-22 13:02:03 +0000
commitf2fa870ceb0ea27f9b9805a304fbe4af9cd08ece (patch)
tree10506c03a6865f904718b2264db09b2d3678a54d /sys/dev/puc
parent353e3008f577212b1df0845ea24bd93c3eca1e3f (diff)
downloadFreeBSD-src-f2fa870ceb0ea27f9b9805a304fbe4af9cd08ece.zip
FreeBSD-src-f2fa870ceb0ea27f9b9805a304fbe4af9cd08ece.tar.gz
MFC: r264257, r264327, r264514
Distinguish between the different variants and configurations of Sunix {MIO,SER}5xxxx chips instead of treating all of them as PUC_PORT_2S. Among others, this fixes the hang seen when trying to probe the none- existent second UART on an actually 1-port chip. Obtained from: NetBSD (BAR layouts) Sponsored by: Bally Wulff Games & Entertainment GmbH
Diffstat (limited to 'sys/dev/puc')
-rw-r--r--sys/dev/puc/pucdata.c68
1 files changed, 64 insertions, 4 deletions
diff --git a/sys/dev/puc/pucdata.c b/sys/dev/puc/pucdata.c
index 76be542..6b07aeb 100644
--- a/sys/dev/puc/pucdata.c
+++ b/sys/dev/puc/pucdata.c
@@ -58,6 +58,7 @@ static puc_config_f puc_config_oxford_pcie;
static puc_config_f puc_config_quatech;
static puc_config_f puc_config_syba;
static puc_config_f puc_config_siig;
+static puc_config_f puc_config_sunix;
static puc_config_f puc_config_timedia;
static puc_config_f puc_config_titan;
@@ -986,12 +987,46 @@ const struct puc_cfg puc_pci_devices[] = {
.config_function = puc_config_syba
},
- { 0x1fd4, 0x1999, 0xffff, 0,
- "Sunix SER5437A",
+ { 0x1fd4, 0x1999, 0x1fd4, 0x0002,
+ "Sunix SER5xxxx 2-port serial",
DEFAULT_RCLK * 8,
PUC_PORT_2S, 0x10, 0, 8,
},
+ { 0x1fd4, 0x1999, 0x1fd4, 0x0004,
+ "Sunix SER5xxxx 4-port serial",
+ DEFAULT_RCLK * 8,
+ PUC_PORT_4S, 0x10, 0, 8,
+ },
+
+ { 0x1fd4, 0x1999, 0x1fd4, 0x0008,
+ "Sunix SER5xxxx 8-port serial",
+ DEFAULT_RCLK * 8,
+ PUC_PORT_8S, -1, -1, -1,
+ .config_function = puc_config_sunix
+ },
+
+ { 0x1fd4, 0x1999, 0x1fd4, 0x0101,
+ "Sunix MIO5xxxx 1-port serial and 1284 Printer port",
+ DEFAULT_RCLK * 8,
+ PUC_PORT_1S1P, -1, -1, -1,
+ .config_function = puc_config_sunix
+ },
+
+ { 0x1fd4, 0x1999, 0x1fd4, 0x0102,
+ "Sunix MIO5xxxx 2-port serial and 1284 Printer port",
+ DEFAULT_RCLK * 8,
+ PUC_PORT_2S1P, -1, -1, -1,
+ .config_function = puc_config_sunix
+ },
+
+ { 0x1fd4, 0x1999, 0x1fd4, 0x0104,
+ "Sunix MIO5xxxx 4-port serial and 1284 Printer port",
+ DEFAULT_RCLK * 8,
+ PUC_PORT_4S1P, -1, -1, -1,
+ .config_function = puc_config_sunix
+ },
+
{ 0x5372, 0x6873, 0xffff, 0,
"Sun 1040 PCI Quad Serial",
DEFAULT_RCLK,
@@ -1023,8 +1058,8 @@ const struct puc_cfg puc_pci_devices[] = {
},
/*
- * This is more specific than the generic NM9835 entry that follows, and
- * is placed here to _prevent_ puc from claiming this single port card.
+ * This is more specific than the generic NM9835 entry, and is placed
+ * here to _prevent_ puc(4) from claiming this single port card.
*
* uart(4) will claim this device.
*/
@@ -1613,6 +1648,31 @@ puc_config_oxford_pcie(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port,
}
static int
+puc_config_sunix(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port,
+ intptr_t *res)
+{
+ int error;
+
+ switch (cmd) {
+ case PUC_CFG_GET_OFS:
+ error = puc_config(sc, PUC_CFG_GET_TYPE, port, res);
+ if (error != 0)
+ return (error);
+ *res = (*res == PUC_TYPE_SERIAL) ? (port & 3) * 8 : 0;
+ return (0);
+ case PUC_CFG_GET_RID:
+ error = puc_config(sc, PUC_CFG_GET_TYPE, port, res);
+ if (error != 0)
+ return (error);
+ *res = (*res == PUC_TYPE_SERIAL && port <= 3) ? 0x10 : 0x14;
+ return (0);
+ default:
+ break;
+ }
+ return (ENXIO);
+}
+
+static int
puc_config_titan(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port,
intptr_t *res)
{
OpenPOWER on IntegriCloud