From 134b608cb0e515b3469d605fb2f7bc8131af8225 Mon Sep 17 00:00:00 2001
From: Sascha Wildner <saw@online.de>
Date: Sun, 2 Dec 2012 19:47:57 +0100
Subject: [PATCH] u4b uncommittet

---
 Makefile_upgrade.inc |   20 ++++-------
 sys/conf/files       |   23 ++++++++++++
 sys/sys/serial.h     |   94 ++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 124 insertions(+), 13 deletions(-)
 create mode 100644 sys/sys/serial.h

diff --git a/Makefile_upgrade.inc b/Makefile_upgrade.inc
index 5c2b871..2179417 100644
--- a/Makefile_upgrade.inc
+++ b/Makefile_upgrade.inc
@@ -2142,24 +2142,11 @@ TO_REMOVE+=/boot/kernel/if_lgue.ko
 TO_REMOVE+=/boot/kernel/if_rue.ko
 TO_REMOVE+=/boot/kernel/moscom.ko
 TO_REMOVE+=/boot/kernel/snd_uaudio.ko
-TO_REMOVE+=/boot/kernel/uark.ko
-TO_REMOVE+=/boot/kernel/ubsa.ko
 TO_REMOVE+=/boot/kernel/ubt.ko
-TO_REMOVE+=/boot/kernel/uchcom.ko
-TO_REMOVE+=/boot/kernel/ucom.ko
 TO_REMOVE+=/boot/kernel/ufm.ko
-TO_REMOVE+=/boot/kernel/uftdi.ko
 TO_REMOVE+=/boot/kernel/ugen.ko
-TO_REMOVE+=/boot/kernel/ugensa.ko
-TO_REMOVE+=/boot/kernel/ulpt.ko
-TO_REMOVE+=/boot/kernel/umct.ko
-TO_REMOVE+=/boot/kernel/umodem.ko
-TO_REMOVE+=/boot/kernel/uplcom.ko
 TO_REMOVE+=/boot/kernel/uscanner.ko
-TO_REMOVE+=/boot/kernel/uslcom.ko
 TO_REMOVE+=/boot/kernel/uticom.ko
-TO_REMOVE+=/boot/kernel/uvisor.ko
-TO_REMOVE+=/boot/kernel/uvscom.ko
 TO_REMOVE+=/usr/sbin/usbd
 TO_REMOVE+=/usr/share/man/cat5/usbd.conf.5.gz
 TO_REMOVE+=/usr/share/man/man5/usbd.conf.5.gz
@@ -2171,10 +2158,17 @@ TO_REMOVE+=/usr/share/man/man8/usbdevs.8.gz
 .else
 TO_REMOVE+=/boot/kernel/if_udav.ko
 TO_REMOVE+=/boot/kernel/ohci.ko
+TO_REMOVE+=/boot/kernel/u3g.ko
 TO_REMOVE+=/boot/kernel/uaudio.ko
+TO_REMOVE+=/boot/kernel/ubser.ko
+TO_REMOVE+=/boot/kernel/ucycom.ko
 TO_REMOVE+=/boot/kernel/uep.ko
 TO_REMOVE+=/boot/kernel/uether.ko
+TO_REMOVE+=/boot/kernel/ufoma.ko
 TO_REMOVE+=/boot/kernel/uhci.ko
+TO_REMOVE+=/boot/kernel/uipaq.ko
+TO_REMOVE+=/boot/kernel/umcs.ko
+TO_REMOVE+=/boot/kernel/umoscom.ko
 TO_REMOVE+=/boot/kernel/usb_quirk.ko
 TO_REMOVE+=/boot/kernel/usfs.ko
 TO_REMOVE+=/boot/kernel/xhci.ko
diff --git a/sys/conf/files b/sys/conf/files
index 59a4448..0e94408 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -2234,6 +2234,29 @@ bus/u4b/net/usb_ethernet.c		optional uether usb4bsd
 bus/u4b/net/if_axe.c			optional axe uether usb4bsd
 bus/u4b/net/if_udav.c			optional udav uether usb4bsd
 #
+# USB serial and parallel port drivers
+#
+bus/u4b/serial/usb_serial.c 		optional ucom usb4bsd
+bus/u4b/serial/u3g.c			optional u3g ucom usb4bsd
+bus/u4b/serial/uark.c			optional uark ucom usb4bsd
+bus/u4b/serial/ubsa.c			optional ubsa ucom usb4bsd
+bus/u4b/serial/ubser.c			optional ubser ucom usb4bsd
+bus/u4b/serial/uchcom.c			optional uchcom ucom usb4bsd
+bus/u4b/serial/ucycom.c			optional ucycom ucom usb4bsd
+bus/u4b/serial/ufoma.c			optional ufoma ucom usb4bsd
+bus/u4b/serial/uftdi.c			optional uftdi ucom usb4bsd
+bus/u4b/serial/ugensa.c			optional ugensa ucom usb4bsd
+bus/u4b/serial/uipaq.c			optional uipaq ucom usb4bsd
+bus/u4b/serial/ulpt.c			optional ulpt ucom usb4bsd
+bus/u4b/serial/umcs.c			optional umcs ucom usb4bsd
+bus/u4b/serial/umct.c			optional umct ucom usb4bsd
+bus/u4b/serial/umodem.c			optional umodem ucom usb4bsd
+bus/u4b/serial/umoscom.c		optional umoscom ucom usb4bsd
+bus/u4b/serial/uplcom.c			optional uplcom ucom usb4bsd
+bus/u4b/serial/uslcom.c			optional uslcom ucom usb4bsd
+bus/u4b/serial/uvisor.c			optional uvisor ucom usb4bsd
+bus/u4b/serial/uvscom.c			optional uvscom ucom usb4bsd
+#
 # USB input drivers
 #
 bus/u4b/input/ukbd.c			optional ukbd usb4bsd
diff --git a/sys/sys/serial.h b/sys/sys/serial.h
new file mode 100644
index 0000000..69000fa
--- /dev/null
+++ b/sys/sys/serial.h
@@ -0,0 +1,94 @@
+/*-
+ * Copyright (c) 2004 Poul-Henning Kamp
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * This file contains definitions which pertain to serial ports as such,
+ * (both async and sync), but which do not necessarily have anything to
+ * do with tty processing.
+ *
+ * $FreeBSD: src/sys/sys/serial.h,v 1.5 2006/03/30 17:24:42 marcel Exp $
+ */
+
+#ifndef _SYS_SERIAL_H_
+#define	_SYS_SERIAL_H_
+
+
+/*
+ * Indentification of modem control signals.  These definitions match
+ * the TIOCMGET definitions in <sys/ttycom.h> shifted a bit down, and
+ * that identity is enforced with CTASSERT at the bottom of kern/tty.c
+ * Both the modem bits and delta bits must fit in 16 bit.
+ */
+#define	SER_DTR		0x0001		/* data terminal ready */
+#define	SER_RTS		0x0002		/* request to send */
+#define	SER_STX		0x0004		/* secondary transmit */
+#define	SER_SRX		0x0008		/* secondary receive */
+#define	SER_CTS		0x0010		/* clear to send */
+#define	SER_DCD		0x0020		/* data carrier detect */
+#define	SER_RI	 	0x0040		/* ring indicate */
+#define	SER_DSR		0x0080		/* data set ready */
+
+#define	SER_MASK_STATE	0x00ff
+
+/* Delta bits, used to indicate which signals should/was affected */
+#define	SER_DELTA(x)	((x) << 8)
+
+#define	SER_DDTR	SER_DELTA(SER_DTR)
+#define	SER_DRTS	SER_DELTA(SER_RTS)
+#define	SER_DSTX	SER_DELTA(SER_STX)
+#define	SER_DSRX	SER_DELTA(SER_SRX)
+#define	SER_DCTS	SER_DELTA(SER_CTS)
+#define	SER_DDCD	SER_DELTA(SER_DCD)
+#define	SER_DRI		SER_DELTA(SER_RI)
+#define	SER_DDSR	SER_DELTA(SER_DSR)
+
+#define	SER_MASK_DELTA	SER_DELTA(SER_MASK_STATE)
+
+#ifdef _KERNEL
+/*
+ * Specification of interrupt sources typical for serial ports. These are
+ * useful when some umbrella driver like scc(4) has enough knowledge of
+ * the hardware to obtain the set of pending interrupts but does not itself
+ * handle the interrupt. Each interrupt source can be given an interrupt
+ * resource for which inferior drivers can install handlers. The lower 16
+ * bits are kept free for the signals above.
+ */
+#define	SER_INT_OVERRUN	0x010000
+#define	SER_INT_BREAK	0x020000
+#define	SER_INT_RXREADY	0x040000
+#define	SER_INT_SIGCHG	0x080000
+#define	SER_INT_TXIDLE	0x100000
+
+#define	SER_INT_MASK	0xff0000
+#define	SER_INT_SIGMASK	(SER_MASK_DELTA | SER_MASK_STATE)
+
+#ifdef __FreeBSD__
+#ifndef LOCORE
+typedef int serdev_intr_t(void*);
+#endif
+#endif
+
+#endif	/* _KERNEL */
+
+#endif /* !_SYS_SERIAL_H_ */
-- 
1.7.7.2

