Hi everyone,

Testing of a Sunix 4066u 8 port serial card with OpenBSD 5.7 shows port speeds on ports 3-8 to be out (slower than expected) by a factor of eight. Checking the source code it looks like the problem still exists in 5.8 though I haven't actually tested to confirm.

My card:
# pcidump -v
<snip...>
 5:12:0: Sunix 40XX
        0x0000: Vendor ID: 1409 Product ID: 7168
        0x0004: Command: 0081 Status: 0280
        0x0008: Class: 07 Subclass: 00 Interface: 02 Revision: 01
0x000c: BIST: 00 Header Type: 00 Latency Timer: 00 Cache Line Size: 00
        0x0010: BAR io addr: 0x0000ce00/0x0020
        0x0014: BAR io addr: 0x0000cd00/0x0010
        0x0018: BAR io addr: 0x0000cc00/0x0008
        0x001c: BAR io addr: 0x0000cb00/0x0008
        0x0020: BAR io addr: 0x0000ca00/0x0008
        0x0024: BAR io addr: 0x0000c900/0x0008
        0x0028: Cardbus CIS: 00000000
        0x002c: Subsystem Vendor ID: 1409 Product ID: 4066
        0x0030: Expansion ROM Base Address: 00000000
        0x0038: 00000000
        0x003c: Interrupt Pin: 01 Line: 09 Min Gnt: 00 Max Lat: 00


The relevant file I changed in order to fix is /usr/src/sys/dev/pci/pucdata.c

In particular, with changes applied:

        {   /* SUNIX 406X 8S */
            {   PCI_VENDOR_SUNIX, PCI_PRODUCT_SUNIX_40XX, 0x1409, 0x4060 },
            {   0xffff, 0xffff, 0xffff, 0xe0f0 },
            {
                { PUC_COM_POW2(3), 0x10, 0x0000 },
                { PUC_COM_POW2(3), 0x10, 0x0008 },
                { PUC_COM_POW2(0), 0x14, 0x0000 }, // Changed MJV 29-Oct-15
                { PUC_COM_POW2(0), 0x14, 0x0008 }, // From 3->0
{ PUC_COM_POW2(0), 0x18, 0x0000 }, // Port speeds now correct
                { PUC_COM_POW2(0), 0x1c, 0x0000 }, //
                { PUC_COM_POW2(0), 0x20, 0x0000 }, //
                { PUC_COM_POW2(0), 0x24, 0x0000 }, //
            },
        },

Here is the diff on my hierarchy - may or may not not work on 'release', but you get the idea of what I have changed:

--- pucdata.c.orig      Thu Oct 29 16:44:52 2015
+++ pucdata.c   Fri Oct 30 09:36:45 2015
@@ -1631,12 +1631,12 @@
            {
                { PUC_COM_POW2(3), 0x10, 0x0000 },
                { PUC_COM_POW2(3), 0x10, 0x0008 },
-               { PUC_COM_POW2(3), 0x14, 0x0000 },
-               { PUC_COM_POW2(3), 0x14, 0x0008 },
-               { PUC_COM_POW2(3), 0x18, 0x0000 },
-               { PUC_COM_POW2(3), 0x1c, 0x0000 },
-               { PUC_COM_POW2(3), 0x20, 0x0000 },
-               { PUC_COM_POW2(3), 0x24, 0x0000 },
+               { PUC_COM_POW2(0), 0x14, 0x0000 }, // Changed MJV 29-Oct-15
+               { PUC_COM_POW2(0), 0x14, 0x0008 }, // From 3->0
+ { PUC_COM_POW2(0), 0x18, 0x0000 }, // Port speeds now correct
+               { PUC_COM_POW2(0), 0x1c, 0x0000 }, //
+               { PUC_COM_POW2(0), 0x20, 0x0000 }, //
+               { PUC_COM_POW2(0), 0x24, 0x0000 }, //
            },
        },


...

Perhaps also of interest, when originally searching for other people experiencing this problem I found a posting from 2009:

http://openbsd-archive.7691.n7.nabble.com/system-6206-SUNIX-8-ports-serial-card-SER4066RM-some-ports-have-a-clock-generator-which-is-8x-higherl-td194444.html

in which there is a patch for the Sunix 406X to fix the incorrect port speeds (ports too fast!)?! I'm guessing the change became mainstream by 5.7, but this doesn't work with my card. Curiously, in that web posting the card in question has a Product ID

        0x002c: Subsystem Vendor ID: 1409 Product ID: 5066

Which doesn't match up with the patch in that posting or the product ID of my card, which is:

        0x002c: Subsystem Vendor ID: 1409 Product ID: 4066

Interestingly, there is an entry for the 5066 card in present day pucdata.c, but it also has PUC_COM_POW2(0) for ports 3-8. I'll let someone else figure how that all came about...

        {   /* SUNIX 406X 8S */
            {   PCI_VENDOR_SUNIX, PCI_PRODUCT_SUNIX_40XX, 0x1409, 0x5066 },
            {   0xffff, 0xffff, 0xffff, 0xffff },
            {
                { PUC_COM_POW2(3), 0x10, 0x0000 },
                { PUC_COM_POW2(3), 0x10, 0x0008 },
                { PUC_COM_POW2(0), 0x14, 0x0000 },
                { PUC_COM_POW2(0), 0x14, 0x0008 },
                { PUC_COM_POW2(0), 0x18, 0x0000 },
                { PUC_COM_POW2(0), 0x1c, 0x0000 },
                { PUC_COM_POW2(0), 0x20, 0x0000 },
                { PUC_COM_POW2(0), 0x24, 0x0000 },
            },
        },

In any case, the change I made make my card work correctly. It may help other people too but YMMV.

-Martin

--
R A Ward Ltd. | We take the privacy of our customers seriously.
Christchurch  | All sensitive E-Mail attachments MUST be encrypted.
New Zealand

Reply via email to