Below is a trivial patch to support Moxa CP-168U 8-port serial PCI cards.

Bought one from ebay, but learned that only model C168H is currently 
supported.  Peeked at FreeBSD, found [1] which indicated it would be rather 
trivial to add.  Built, tested, works.

[1] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=53548

Before
------
OpenBSD 5.9-beta (GENERIC.MP) #1556: Tue Jan 12 07:17:50 MST 2016
    [email protected]:/usr/src/sys/arch/i386/compile/GENERIC.MP
vendor "Moxa", unknown product 0x1681 (class communications subclass serial, 
rev 0x00) at pci3 dev 3 function 0 not configured

After
-----
OpenBSD 5.9-beta (GENERIC) #1: Thu Jan 14 19:46:16 CET 2016
    [email protected]:/usr/src/sys/arch/i386/compile/GENERIC
puc0 at pci3 dev 3 function 0 "Moxa CP-168U" rev 0x00: ports: 8 com
com4 at puc0 port 0 apic 2 int 22: st16650, 32 byte fifo
com5 at puc0 port 1 apic 2 int 22: st16650, 32 byte fifo
com6 at puc0 port 2 apic 2 int 22: st16650, 32 byte fifo
com7 at puc0 port 3 apic 2 int 22: st16650, 32 byte fifo
com8 at puc0 port 4 apic 2 int 22: st16650, 32 byte fifo
com9 at puc0 port 5 apic 2 int 22: st16650, 32 byte fifo
com10 at puc0 port 6 apic 2 int 22: st16650, 32 byte fifo
com11 at puc0 port 7 apic 2 int 22: st16650, 32 byte fifo

Sucessfully tested with a few devices without issues:
  Cisco 2950 switch @9600
  Cisco G300-28 switch @9600
  Dell PE860 BIOS console @9600
  OpenBSD/i386 console @9600
  Ubiquiti EdgeRouter Lite @115200


Index: pcidevs
===================================================================
RCS file: /cvs/src/sys/dev/pci/pcidevs,v
retrieving revision 1.1784
diff -u -p -r1.1784 pcidevs
--- pcidevs     14 Jan 2016 04:04:13 -0000      1.1784
+++ pcidevs     14 Jan 2016 18:31:44 -0000
@@ -5103,6 +5103,7 @@ product MOXA C104H                0x1040  C104H
 product MOXA CP104UL           0x1041  CP-104UL
 product MOXA CP104JU           0x1042  CP-104JU
 product MOXA C168H             0x1680  C168H
+product MOXA CP168U            0x1681  CP-168U
 
 /* Mesa Ridge Technologies (MAGMA) */
 product MRTMAGMA DMA4          0x0011  DMA4 serial
Index: pucdata.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/pucdata.c,v
retrieving revision 1.100
diff -u -p -r1.100 pucdata.c
--- pucdata.c   26 Dec 2015 22:16:12 -0000      1.100
+++ pucdata.c   14 Jan 2016 18:31:45 -0000
@@ -1423,6 +1423,22 @@ const struct puc_device_description puc_
            },
        },
 
+       /* Moxa Technologies Co., Ltd. PCI I/O Card 8S RS232 */
+       {   /* "Moxa Technologies, CP-168U" */
+           {   PCI_VENDOR_MOXA, PCI_PRODUCT_MOXA_CP168U,       0, 0    },
+           {   0xffff, 0xffff,                                 0, 0    },
+           {
+               { PUC_COM_POW2(3), 0x18, 0x0000 },
+               { PUC_COM_POW2(3), 0x18, 0x0008 },
+               { PUC_COM_POW2(3), 0x18, 0x0010 },
+               { PUC_COM_POW2(3), 0x18, 0x0018 },
+               { PUC_COM_POW2(3), 0x18, 0x0020 },
+               { PUC_COM_POW2(3), 0x18, 0x0028 },
+               { PUC_COM_POW2(3), 0x18, 0x0030 },
+               { PUC_COM_POW2(3), 0x18, 0x0038 },
+           },
+       },
+
        /* NetMos 1P PCI: 1P */
        {   /* "NetMos NM9805 1284 Printer Port" */
            {   PCI_VENDOR_NETMOS, PCI_PRODUCT_NETMOS_NM9805,   0, 0    },

Index: puc.4
===================================================================
RCS file: /cvs/src/share/man/man4/puc.4,v
retrieving revision 1.51
diff -u -p -r1.51 puc.4
--- puc.4       10 Sep 2015 15:16:43 -0000      1.51
+++ puc.4       14 Jan 2016 18:32:22 -0000
@@ -84,6 +84,7 @@ The driver currently supports the follow
 .It Tn "Moxa Technologies Co., Ltd. C104H/PCI (4 port serial)"
 .It Tn "Moxa Technologies Co., Ltd. CP104/PCI (4 port serial)"
 .It Tn "Moxa Technologies Co., Ltd. C168H/PCI (8 port serial)"
+.It Tn "Moxa Technologies Co., Ltd. CP168U/PCI (8 port serial)"
 .It Tn "NEC PK-UG-X008 (serial)"
 .It Tn "NEC PK-UG-X001 K56flex PCI (modem)"
 .It Tn "NetMos 1P (1 port parallel)"

Reply via email to