Subject: Moxa serial card
To: None <tech-kern@NetBSD.org>
From: Olivier Cherrier <oc@symacx.com>
List: tech-kern
Date: 03/06/2006 07:52:17
--OgqxwSJOaUobr8KG
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

	Hello,

This patch adds the Moxa CP104 serial card to the puc(4) driver.
Tested on i386 3.0.


Thanks.


This is the dmesg:.

NetBSD 3.0.0_STABLE (GENERIC) #0: Fri Mar  3 20:22:05 UTC 2006
	oc@thalo001:/usr/obj/sys/arch/i386/compile/GENERIC
total memory = 511 MB
avail memory = 492 MB
BIOS32 rev. 0 found at 0xfd5b6
mainbus0 (root)
cpu0 at mainbus0: (uniprocessor)
cpu0: Intel (686-class), 3400.70 MHz, id 0xf41
cpu0: features bfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR>
cpu0: features bfebfbff<PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX>
cpu0: features bfebfbff<FXSR,SSE,SSE2,SS,HTT,TM,SBF>
cpu0: features2 641d<SSE3,MONITOR,DS-CPL,CID,xTPR>
cpu0: features3 20000000<EM64T>
cpu0: "Intel(R) Pentium(R) 4 CPU 3.40GHz"
cpu0: I-cache 12K uOp cache 8-way
cpu0: L2 cache 1 MB 64B/line 8-way
cpu0: ITLB 4K/4M: 64 entries
cpu0: DTLB 4K/4M: 64 entries
cpu0: running without thermal monitor!
cpu0: 32 page colors
pci0 at mainbus0 bus 0: configuration mode 1
pci0: i/o space, memory space enabled, rd/line, rd/mult, wr/inv ok
pchb0 at pci0 dev 0 function 0
pchb0: Intel 82875P Host (rev. 0x02)
ppb0 at pci0 dev 3 function 0: Intel 82875P PCI-CSA Bridge (rev. 0x02)
pci1 at ppb0 bus 2
pci1: i/o space, memory space enabled
wm0 at pci1 dev 1 function 0: Intel i82547GI 1000BASE-T Ethernet, rev. 0
wm0: interrupting at irq 5
wm0: Communication Streaming Architecture
wm0: 65536 word (16 address bits) SPI EEPROM
wm0: Ethernet address 00:11:25:ab:a7:06
igphy0 at wm0 phy 1: Intel IGP01E1000 Gigabit PHY, rev. 0
igphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto
ppb1 at pci0 dev 28 function 0: Intel 6300ESB PCI-X Bridge (rev. 0x02)
pci2 at ppb1 bus 3
pci2: i/o space, memory space enabled, rd/line, wr/inv ok
puc0 at pci2 dev 1 function 0: Moxa Technologies, SmartIO CP104/PCI (com, com, com, com)
com3 at puc0 port 0: interrupting at irq 11
com3: ns16550a, working fifo
com4 at puc0 port 1: interrupting at irq 11
com4: ns16550a, working fifo
com5 at puc0 port 2: interrupting at irq 11
com5: ns16550a, working fifo
com6 at puc0 port 3: interrupting at irq 11
com6: ns16550a, working fifo
uhci0 at pci0 dev 29 function 0: Intel 6300ESB USB UHCI Controller (rev. 0x02)
uhci0: interrupting at irq 3
usb0 at uhci0: USB revision 1.0
uhub0 at usb0
uhub0: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered
uhci1 at pci0 dev 29 function 1: Intel 6300ESB USB UHCI Controller (rev. 0x02)
uhci1: interrupting at irq 11
usb1 at uhci1: USB revision 1.0
uhub1 at usb1
uhub1: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub1: 2 ports with 2 removable, self powered
Intel 6300ESB Watchdog Timer (miscellaneous system, revision 0x02) at pci0 dev 29 function 4 not configured
Intel 6300ESB Advanced Interrupt Controller (interrupt system, interface 0x20, revision 0x02) at pci0 dev 29 function 5 not configured
ehci0 at pci0 dev 29 function 7: Intel 6300ESB USB EHCI Controller (rev. 0x02)
ehci0: interrupting at irq 7
ehci0: BIOS has given up ownership
ehci0: EHCI version 1.0
ehci0: companion controllers, 2 ports each: uhci0 uhci1
usb2 at ehci0: USB revision 2.0
uhub2 at usb2
uhub2: Intel EHCI root hub, class 9/0, rev 2.00/1.00, addr 1
uhub2: single transaction translator
uhub2: 4 ports with 4 removable, self powered
ppb2 at pci0 dev 30 function 0: Intel 82801BA Hub-PCI Bridge (rev. 0x0a)
pci3 at ppb2 bus 4
pci3: i/o space, memory space enabled
vga1 at pci3 dev 2 function 0: ATI Technologies Radeon 7000/VE (rev. 0x00)
wsdisplay0 at vga1 kbdmux 1: console (80x25, vt100 emulation)
wsmux1: connecting to wsdisplay0
wm1 at pci3 dev 3 function 0: Intel i82541GI 1000BASE-T Ethernet, rev. 0
wm1: interrupting at irq 11
wm1: 32-bit 33MHz PCI bus
wm1: 256 word (8 address bits) MicroWire EEPROM
wm1: Ethernet address 00:11:25:ab:a7:07
igphy1 at wm1 phy 1: Intel IGP01E1000 Gigabit PHY, rev. 0
igphy1: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto
ukphy0 at wm1 phy 2: Generic IEEE 802.3u media interface
ukphy0: OUI 0x000000, model 0x0000, rev. 0
ukphy0: no media present
pcib0 at pci0 dev 31 function 0
pcib0: Intel 6300ESB LPC Interface Bridge (rev. 0x02)
piixide0 at pci0 dev 31 function 2
piixide0: Intel 6300ESB Serial ATA Controller (rev. 0x02)
piixide0: bus-master DMA support present
piixide0: primary channel configured to compatibility mode
piixide0: primary channel interrupting at irq 14
atabus0 at piixide0 channel 0
piixide0: secondary channel configured to compatibility mode
piixide0: secondary channel interrupting at irq 15
atabus1 at piixide0 channel 1
Intel 6300ESB SMBus Controller (SMBus serial bus, revision 0x02) at pci0 dev 31 function 3 not configured
isa0 at pcib0
com0 at isa0 port 0x3f8-0x3ff irq 4: ns16550a, working fifo
pckbc0 at isa0 port 0x60-0x64
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pms0 at pckbc0 (aux slot)
pckbc0: using irq 12 for aux slot
wsmouse0 at pms0 mux 0
pcppi0 at isa0 port 0x61
midi0 at pcppi0: PC speaker
sysbeep0 at pcppi0
isapnp0 at isa0 port 0x279: ISA Plug 'n Play device support
npx0 at isa0 port 0xf0-0xff: using exception 16
fdc0 at isa0 port 0x3f0-0x3f7 irq 6 drq 2
isapnp0: no ISA Plug 'n Play devices found
fd0 at fdc0 drive 0: 1.44MB, 80 cyl, 2 head, 18 sec
Kernelized RAIDframe activated
atapibus0 at atabus0: 2 targets
cd0 at atapibus0 drive 0: <LG CD-ROM CRN-8245B, , 1.16> cdrom removable
cd0: 32-bit data port
cd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 2 (Ultra/33)
cd0(piixide0:0:0): using PIO mode 4, Ultra-DMA mode 2 (Ultra/33) (using DMA)
wd0 at atabus1 drive 0: <ST380013AS>
wd0: drive supports 16-sector PIO transfers, LBA48 addressing
wd0: 76324 MB, 155072 cyl, 16 head, 63 sec, 512 bytes/sect x 156312576 sectors
wd0: 32-bit data port
wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 6 (Ultra/133)
wd1 at atabus1 drive 1: <ST380013AS>
wd1: drive supports 16-sector PIO transfers, LBA48 addressing
wd1: 76324 MB, 155072 cyl, 16 head, 63 sec, 512 bytes/sect x 156312576 sectors
wd1: 32-bit data port
wd1: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 6 (Ultra/133)
wd0(piixide0:1:0): using PIO mode 4, Ultra-DMA mode 6 (Ultra/133) (using DMA)
wd1(piixide0:1:1): using PIO mode 4, Ultra-DMA mode 6 (Ultra/133) (using DMA)
raid0: RAID Level 1
raid0: Components: /dev/wd0a /dev/wd1a
raid0: Total Sectors: 156312448 (76324 MB)
boot device: raid0
root on raid0a dumps on raid0b
root file system type: ffs
wsdisplay0: screen 1 added (80x25, vt100 emulation)
wsdisplay0: screen 2 added (80x25, vt100 emulation)
wsdisplay0: screen 3 added (80x25, vt100 emulation)
wsdisplay0: screen 4 added (80x25, vt100 emulation)


-- 
Olivier Cherrier - Symacx.com

--OgqxwSJOaUobr8KG
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff

Index: sys/dev/pci/pcidevs
===================================================================
RCS file: /pub/NetBSD-CVS/src/sys/dev/pci/pcidevs,v
retrieving revision 1.769
diff -u -r1.769 pcidevs
--- sys/dev/pci/pcidevs	1 Mar 2006 22:22:36 -0000	1.769
+++ sys/dev/pci/pcidevs	6 Mar 2006 07:12:40 -0000
@@ -538,6 +538,7 @@
 vendor DOMEX		0x134a	Domex
 vendor LMC		0x1376	LAN Media
 vendor NETGEAR		0x1385	Netgear
+vendor MOXA		0x1393	Moxa
 vendor LEVELONE		0x1394	Level One
 vendor COLOGNECHIP	0x1397	Cologne Chip Designs
 vendor HIFN		0x13a3	Hifn
@@ -2151,6 +2152,12 @@
 product MOT FALCON	0x4802	Falcon ECC Memory Controller Chip Set
 product MOT HAWK	0x4803	Hawk System Memory Controller & PCI Host Bridge
 
+/* Moxa products */
+product	MOXA CP114		0x1141	CP-114
+product	MOXA C104H		0x1040	C104H
+product	MOXA CP104		0x1041	CP-104UL
+product	MOXA C168H		0x1680	C168H
+
 /* Mutech products */
 product MUTECH MV1000	0x0001	MV1000
 
Index: sys/dev/pci/pucdata.c
===================================================================
RCS file: /pub/NetBSD-CVS/src/sys/dev/pci/pucdata.c,v
retrieving revision 1.42
diff -u -r1.42 pucdata.c
--- sys/dev/pci/pucdata.c	24 Jan 2006 20:10:55 -0000	1.42
+++ sys/dev/pci/pucdata.c	6 Mar 2006 07:12:42 -0000
@@ -906,6 +906,18 @@
 	    },
 	},
 
+	/* Moxa Technologies Co., Ltd. PCI I/O Card 4S RS232 */
+	{   "Moxa Technologies, SmartIO CP104/PCI",
+	    {   0x1393, 0x1041, 0,      0    },
+	    {   0xffff, 0xffff, 0,      0    },
+	    {
+		{ PUC_PORT_TYPE_COM, 0x18, 0x00, COM_FREQ * 8 },
+		{ PUC_PORT_TYPE_COM, 0x18, 0x08, COM_FREQ * 8 },
+		{ PUC_PORT_TYPE_COM, 0x18, 0x10, COM_FREQ * 8 },
+		{ PUC_PORT_TYPE_COM, 0x18, 0x18, COM_FREQ * 8 },
+	    },
+	},
+
 	/* NetMos 1P PCI : 1P */
 	{   "NetMos NM9805 1284 Printer port",
 	    {	0x9710,	0x9805,	0,	0	},

Index: share/man/man4/puc.4
===================================================================
RCS file: /pub/NetBSD-CVS/src/share/man/man4/puc.4,v
retrieving revision 1.18
diff -u -r1.18 puc.4
--- share/man/man4/puc.4	16 Oct 2004 18:10:31 -0000	1.18
+++ share/man/man4/puc.4	6 Mar 2006 07:13:05 -0000
@@ -96,6 +96,7 @@
 .It Tn "Boca Research Turbo Serial 658 (8-port serial)"
 .It Tn "Chase Research / Perle PCI-FAST8 (8-port serial)"
 .It Tn "ADDI-DATA APCI-7800 (8-port serial)"
+.It Tn "Moxa Technologies SmartIO CP104/PCI (4-port serial)"
 .El
 .Pp
 The driver does not support the cards:

--OgqxwSJOaUobr8KG--