[Midnightbsd-cvs] src [10080] trunk/sys/dev: sync with freebsd

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun May 27 19:22:58 EDT 2018


Revision: 10080
          http://svnweb.midnightbsd.org/src/?rev=10080
Author:   laffer1
Date:     2018-05-27 19:22:57 -0400 (Sun, 27 May 2018)
Log Message:
-----------
sync with freebsd

Modified Paths:
--------------
    trunk/sys/dev/ppbus/if_plip.c
    trunk/sys/dev/ppbus/immio.c
    trunk/sys/dev/ppbus/lpbb.c
    trunk/sys/dev/ppbus/lpt.c
    trunk/sys/dev/ppbus/lpt.h
    trunk/sys/dev/ppbus/lptio.h
    trunk/sys/dev/ppbus/pcfclock.c
    trunk/sys/dev/ppbus/ppb_1284.c
    trunk/sys/dev/ppbus/ppb_1284.h
    trunk/sys/dev/ppbus/ppb_base.c
    trunk/sys/dev/ppbus/ppb_msq.c
    trunk/sys/dev/ppbus/ppb_msq.h
    trunk/sys/dev/ppbus/ppbconf.c
    trunk/sys/dev/ppbus/ppbconf.h
    trunk/sys/dev/ppbus/ppbio.h
    trunk/sys/dev/ppbus/ppbus_if.m
    trunk/sys/dev/ppbus/ppi.c
    trunk/sys/dev/ppbus/ppi.h
    trunk/sys/dev/ppbus/pps.c
    trunk/sys/dev/ppbus/vpo.c
    trunk/sys/dev/ppbus/vpoio.c
    trunk/sys/dev/ppbus/vpoio.h
    trunk/sys/dev/ppc/ppc.c
    trunk/sys/dev/ppc/ppc_acpi.c
    trunk/sys/dev/ppc/ppc_isa.c
    trunk/sys/dev/ppc/ppc_pci.c
    trunk/sys/dev/ppc/ppc_puc.c
    trunk/sys/dev/ppc/ppcreg.h
    trunk/sys/dev/ppc/ppcvar.h
    trunk/sys/dev/pst/pst-iop.c
    trunk/sys/dev/pst/pst-iop.h
    trunk/sys/dev/pst/pst-pci.c
    trunk/sys/dev/pst/pst-raid.c
    trunk/sys/dev/pty/pty.c
    trunk/sys/dev/puc/puc.c
    trunk/sys/dev/puc/puc_bfe.h
    trunk/sys/dev/puc/puc_bus.h
    trunk/sys/dev/puc/puc_cfg.c
    trunk/sys/dev/puc/puc_cfg.h
    trunk/sys/dev/puc/puc_pccard.c
    trunk/sys/dev/puc/puc_pci.c
    trunk/sys/dev/puc/pucdata.c

Property Changed:
----------------
    trunk/sys/dev/ppbus/ppbus_if.m

Modified: trunk/sys/dev/ppbus/if_plip.c
===================================================================
--- trunk/sys/dev/ppbus/if_plip.c	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/ppbus/if_plip.c	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1997 Poul-Henning Kamp
  * All rights reserved.
@@ -27,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/ppbus/if_plip.c 255471 2013-09-11 09:19:44Z glebius $");
 
 /*
  * Parallel port TCP/IP interfaces added.  I looked at the driver from
@@ -173,7 +174,7 @@
 /* Functions for the lp# interface */
 static int lpinittables(void);
 static int lpioctl(struct ifnet *, u_long, caddr_t);
-static int lpoutput(struct ifnet *, struct mbuf *, struct sockaddr *,
+static int lpoutput(struct ifnet *, struct mbuf *, const struct sockaddr *,
        struct route *);
 static void lpstop(struct lp_data *);
 static void lp_intr(void *);
@@ -410,7 +411,6 @@
 	int error;
 
 	switch (cmd) {
-	case SIOCSIFDSTADDR:
 	case SIOCAIFADDR:
 	case SIOCSIFADDR:
 		if (ifa->ifa_addr->sa_family != AF_INET)
@@ -682,7 +682,7 @@
 }
 
 static int
-lpoutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
+lpoutput(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst,
     struct route *ro)
 {
 	struct lp_data *sc = ifp->if_softc;

Modified: trunk/sys/dev/ppbus/immio.c
===================================================================
--- trunk/sys/dev/ppbus/immio.c	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/ppbus/immio.c	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1998, 1999 Nicolas Souchu
  * Copyright (c) 2001 Alcove - Nicolas Souchu
@@ -28,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/ppbus/immio.c 187576 2009-01-21 23:10:06Z jhb $");
 
 /*
  * Iomega ZIP+ Matchmaker Parallel Port Interface driver

Modified: trunk/sys/dev/ppbus/lpbb.c
===================================================================
--- trunk/sys/dev/ppbus/lpbb.c	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/ppbus/lpbb.c	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1998, 2001 Nicolas Souchu, Marc Bouget
  * All rights reserved.
@@ -27,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/ppbus/lpbb.c 227843 2011-11-22 21:28:20Z marius $");
 
 /*
  * I2C Bit-Banging over parallel port

Modified: trunk/sys/dev/ppbus/lpt.c
===================================================================
--- trunk/sys/dev/ppbus/lpt.c	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/ppbus/lpt.c	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1990 William F. Jolitz, TeleMuse
  * All rights reserved.
@@ -51,7 +52,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/ppbus/lpt.c 227814 2011-11-22 11:35:24Z attilio $");
 
 /*
  * Device Driver for AT parallel printer port

Modified: trunk/sys/dev/ppbus/lpt.h
===================================================================
--- trunk/sys/dev/ppbus/lpt.h	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/ppbus/lpt.h	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
  * All rights reserved.
@@ -34,7 +35,7 @@
  *	Id: lptreg.h,v 1.6 1997/02/22 09:36:52 peter Exp
  *	From Id: nlpt.h,v 1.3 1999/01/10 12:04:54 nsouch Exp
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/ppbus/lpt.h 185003 2008-11-16 17:42:02Z jhb $
  */
 
 /*

Modified: trunk/sys/dev/ppbus/lptio.h
===================================================================
--- trunk/sys/dev/ppbus/lptio.h	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/ppbus/lptio.h	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  *  Copyright (C) 1994 Geoffrey M. Rehmet
  *
@@ -11,7 +12,7 @@
  *
  *	Geoff Rehmet, Rhodes University, South Africa <csgr at cs.ru.ac.za>
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/ppbus/lptio.h 139749 2005-01-06 01:43:34Z imp $
  */
 
 #ifndef	_DEV_PPBUS_LPT_H_

Modified: trunk/sys/dev/ppbus/pcfclock.c
===================================================================
--- trunk/sys/dev/ppbus/pcfclock.c	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/ppbus/pcfclock.c	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2000 Sascha Schumann. All rights reserved.
  *
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/ppbus/pcfclock.c 198358 2009-10-22 06:51:29Z brueffer $");
 
 #include "opt_pcfclock.h"
 

Modified: trunk/sys/dev/ppbus/ppb_1284.c
===================================================================
--- trunk/sys/dev/ppbus/ppb_1284.c	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/ppbus/ppb_1284.c	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1997 Nicolas Souchu
  * All rights reserved.
@@ -27,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/ppbus/ppb_1284.c 305555 2016-09-07 19:02:47Z dim $");
 
 /*
  * General purpose routines for the IEEE1284-1994 Standard
@@ -57,13 +58,13 @@
  * Wait for the peripherial up to 40ms
  */
 static int
-do_1284_wait(device_t bus, char mask, char status)
+do_1284_wait(device_t bus, uint8_t mask, uint8_t status)
 {
 	return (ppb_poll_bus(bus, 4, mask, status, PPB_NOINTR | PPB_POLL));
 }
 
 static int
-do_peripheral_wait(device_t bus, char mask, char status)
+do_peripheral_wait(device_t bus, uint8_t mask, uint8_t status)
 {
 	return (ppb_poll_bus(bus, 100, mask, status, PPB_NOINTR | PPB_POLL));
 }

Modified: trunk/sys/dev/ppbus/ppb_1284.h
===================================================================
--- trunk/sys/dev/ppbus/ppb_1284.h	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/ppbus/ppb_1284.h	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1997 Nicolas Souchu
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/ppbus/ppb_1284.h 55957 2000-01-14 08:03:15Z nsouch $
  *
  */
 #ifndef __1284_H

Modified: trunk/sys/dev/ppbus/ppb_base.c
===================================================================
--- trunk/sys/dev/ppbus/ppb_base.c	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/ppbus/ppb_base.c	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1997, 1998, 1999 Nicolas Souchu
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/ppbus/ppb_base.c 305555 2016-09-07 19:02:47Z dim $");
 
 #include <sys/param.h>
 #include <sys/lock.h>
@@ -54,11 +55,11 @@
  */
 int
 ppb_poll_bus(device_t bus, int max,
-	     char mask, char status, int how)
+	     uint8_t mask, uint8_t status, int how)
 {
 	struct ppb_data *ppb = DEVTOSOFTC(bus);
 	int i, j, error;
-	char r;
+	uint8_t r;
 
 	ppb_assert_locked(bus);
 
@@ -186,7 +187,7 @@
 int
 ppb_get_status(device_t bus, struct ppb_status *status)
 {
-	register char r;
+	uint8_t r;
 
 	ppb_assert_locked(bus);
 

Modified: trunk/sys/dev/ppbus/ppb_msq.c
===================================================================
--- trunk/sys/dev/ppbus/ppb_msq.c	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/ppbus/ppb_msq.c	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1998, 1999 Nicolas Souchu
  * All rights reserved.
@@ -27,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/ppbus/ppb_msq.c 227814 2011-11-22 11:35:24Z attilio $");
 #include <machine/stdarg.h>
 
 #include <sys/param.h>

Modified: trunk/sys/dev/ppbus/ppb_msq.h
===================================================================
--- trunk/sys/dev/ppbus/ppb_msq.h	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/ppbus/ppb_msq.h	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1998 Nicolas Souchu
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/ppbus/ppb_msq.h 106696 2002-11-09 12:55:07Z alfred $
  *
  */
 #ifndef __PPB_MSQ_H

Modified: trunk/sys/dev/ppbus/ppbconf.c
===================================================================
--- trunk/sys/dev/ppbus/ppbconf.c	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/ppbus/ppbconf.c	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1997, 1998, 1999 Nicolas Souchu
  * All rights reserved.
@@ -27,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/ppbus/ppbconf.c 249585 2013-04-17 11:45:15Z gabor $");
 #include "opt_ppb_1284.h"
 
 #include <sys/param.h>
@@ -172,7 +173,7 @@
 /*
  * search_token()
  *
- * Search the first occurence of a token within a string
+ * Search the first occurrence of a token within a string
  */
 static char *
 search_token(char *str, int slen, char *token)
@@ -531,7 +532,7 @@
 
 			/* restore the context of the device
 			 * The first time, ctx.valid is certainly false
-			 * then do not change anything. This is usefull for
+			 * then do not change anything. This is useful for
 			 * drivers that do not set there operating mode
 			 * during attachement
 			 */

Modified: trunk/sys/dev/ppbus/ppbconf.h
===================================================================
--- trunk/sys/dev/ppbus/ppbconf.h	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/ppbus/ppbconf.h	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1997, 1998, 1999 Nicolas Souchu
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/ppbus/ppbconf.h 305555 2016-09-07 19:02:47Z dim $
  *
  */
 #ifndef __PPBCONF_H
@@ -263,7 +264,7 @@
 extern void ppb_init_callout(device_t, struct callout *, int);
 extern int ppb_sleep(device_t, void *, int, const char *, int);
 extern int ppb_get_status(device_t, struct ppb_status *);
-extern int ppb_poll_bus(device_t, int, char, char, int);
+extern int ppb_poll_bus(device_t, int, uint8_t, uint8_t, int);
 extern int ppb_reset_epp_timeout(device_t);
 extern int ppb_ecp_sync(device_t);
 extern int ppb_get_epp_protocol(device_t);

Modified: trunk/sys/dev/ppbus/ppbio.h
===================================================================
--- trunk/sys/dev/ppbus/ppbio.h	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/ppbus/ppbio.h	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1999 Nicolas Souchu
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/ppbus/ppbio.h 55939 2000-01-14 00:18:06Z nsouch $
  *
  */
 

Modified: trunk/sys/dev/ppbus/ppbus_if.m
===================================================================
--- trunk/sys/dev/ppbus/ppbus_if.m	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/ppbus/ppbus_if.m	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 #-
 # Copyright (c) 1999 Nicolas Souchu
 # All rights reserved.
@@ -23,7 +24,7 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 #
-# $MidnightBSD$
+# $FreeBSD: stable/10/sys/dev/ppbus/ppbus_if.m 139749 2005-01-06 01:43:34Z imp $
 #
 
 #include <sys/bus.h>


Property changes on: trunk/sys/dev/ppbus/ppbus_if.m
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/sys/dev/ppbus/ppi.c
===================================================================
--- trunk/sys/dev/ppbus/ppi.c	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/ppbus/ppi.c	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1997, 1998, 1999 Nicolas Souchu, Michael Smith
  * All rights reserved.
@@ -27,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/ppbus/ppi.c 187576 2009-01-21 23:10:06Z jhb $");
 #include "opt_ppb_1284.h"
 
 #include <sys/param.h>

Modified: trunk/sys/dev/ppbus/ppi.h
===================================================================
--- trunk/sys/dev/ppbus/ppi.h	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/ppbus/ppi.h	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1997 Nicolas Souchu
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/ppbus/ppi.h 185003 2008-11-16 17:42:02Z jhb $
  *
  */
 #ifndef __PPI_H

Modified: trunk/sys/dev/ppbus/pps.c
===================================================================
--- trunk/sys/dev/ppbus/pps.c	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/ppbus/pps.c	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * ----------------------------------------------------------------------------
  * "THE BEER-WARE LICENSE" (Revision 42):
@@ -15,7 +16,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/ppbus/pps.c 187576 2009-01-21 23:10:06Z jhb $");
 
 #include <sys/param.h>
 #include <sys/lock.h>

Modified: trunk/sys/dev/ppbus/vpo.c
===================================================================
--- trunk/sys/dev/ppbus/vpo.c	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/ppbus/vpo.c	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1997, 1998, 1999 Nicolas Souchu
  * All rights reserved.
@@ -26,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/ppbus/vpo.c 315813 2017-03-23 06:41:13Z mav $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -187,17 +188,19 @@
 #ifdef VP0_DEBUG
 	int i;
 #endif
+	uint8_t *ptr;
 
+	ptr = scsiio_cdb_ptr(csio);
 	if (vpo->vpo_isplus) {
 		errno = imm_do_scsi(&vpo->vpo_io, VP0_INITIATOR,
 			csio->ccb_h.target_id,
-			(char *)&csio->cdb_io.cdb_bytes, csio->cdb_len,
+			ptr, csio->cdb_len,
 			(char *)csio->data_ptr, csio->dxfer_len,
 			&vpo->vpo_stat, &vpo->vpo_count, &vpo->vpo_error);
 	} else {
 		errno = vpoio_do_scsi(&vpo->vpo_io, VP0_INITIATOR,
 			csio->ccb_h.target_id,
-			(char *)&csio->cdb_io.cdb_bytes, csio->cdb_len,
+			ptr, csio->cdb_len,
 			(char *)csio->data_ptr, csio->dxfer_len,
 			&vpo->vpo_stat, &vpo->vpo_count, &vpo->vpo_error);
 	}
@@ -208,7 +211,7 @@
 
 	/* dump of command */
 	for (i=0; i<csio->cdb_len; i++)
-		printf("%x ", ((char *)&csio->cdb_io.cdb_bytes)[i]);
+		printf("%x ", ((char *)ptr)[i]);
 
 	printf("\n");
 #endif
@@ -307,11 +310,15 @@
 
 		csio = &ccb->csio;
 
+		if (ccb->ccb_h.flags & CAM_CDB_PHYS) {
+			ccb->ccb_h.status = CAM_REQ_INVALID;
+			xpt_done(ccb);
+			break;
+		}
 #ifdef VP0_DEBUG
 		device_printf(vpo->vpo_dev, "XPT_SCSI_IO (0x%x) request\n",
-			csio->cdb_io.cdb_bytes[0]);
+		    *scsiio_cdb_ptr(csio));
 #endif
-
 		vpo_intr(vpo, csio);
 
 		xpt_done(ccb);
@@ -384,9 +391,9 @@
 		cpi->initiator_id = VP0_INITIATOR;
 		cpi->bus_id = sim->bus_id;
 		cpi->base_transfer_speed = 93;
-		strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-		strncpy(cpi->hba_vid, "Iomega", HBA_IDLEN);
-		strncpy(cpi->dev_name, sim->sim_name, DEV_IDLEN);
+		strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+		strlcpy(cpi->hba_vid, "Iomega", HBA_IDLEN);
+		strlcpy(cpi->dev_name, sim->sim_name, DEV_IDLEN);
 		cpi->unit_number = sim->unit_number;
 		cpi->transport = XPORT_PPB;
 		cpi->transport_version = 0;

Modified: trunk/sys/dev/ppbus/vpoio.c
===================================================================
--- trunk/sys/dev/ppbus/vpoio.c	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/ppbus/vpoio.c	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1998, 1999 Nicolas Souchu
  * Copyright (c) 2000 Alcove - Nicolas Souchu
@@ -28,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/ppbus/vpoio.c 187576 2009-01-21 23:10:06Z jhb $");
 
 #ifdef _KERNEL
 #include <sys/param.h>

Modified: trunk/sys/dev/ppbus/vpoio.h
===================================================================
--- trunk/sys/dev/ppbus/vpoio.h	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/ppbus/vpoio.h	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1998 Nicolas Souchu
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/ppbus/vpoio.h 185003 2008-11-16 17:42:02Z jhb $
  *
  */
 #ifndef __VP0IO_H

Modified: trunk/sys/dev/ppc/ppc.c
===================================================================
--- trunk/sys/dev/ppc/ppc.c	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/ppc/ppc.c	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1997-2000 Nicolas Souchu
  * Copyright (c) 2001 Alcove - Nicolas Souchu
@@ -26,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/ppc/ppc.c 247094 2013-02-21 12:40:52Z glebius $");
 
 #include "opt_ppc.h"
 
@@ -74,6 +75,22 @@
 
 #define DEVTOSOFTC(dev) ((struct ppc_data *)device_get_softc(dev))
 
+/*
+ * We use critical enter/exit for the simple config locking needed to
+ * detect the devices. We just want to make sure that both of our writes
+ * happen without someone else also writing to those config registers. Since
+ * we just do this at startup, Giant keeps multiple threads from executing,
+ * and critical_enter() then is all that's needed to keep us from being preempted
+ * during the critical sequences with the hardware.
+ *
+ * Note: this doesn't prevent multiple threads from putting the chips into
+ * config mode, but since we only do that to detect the type at startup the
+ * extra overhead isn't needed since Giant protects us from multiple entry
+ * and no other code changes these registers.
+ */
+#define PPC_CONFIG_LOCK(ppc)		critical_enter()
+#define PPC_CONFIG_UNLOCK(ppc)		critical_exit()
+
 devclass_t ppc_devclass;
 const char ppc_driver_name[] = "ppc";
 
@@ -689,7 +706,7 @@
 static int
 ppc_smc37c66xgt_detect(struct ppc_data *ppc, int chipset_mode)
 {
-	int s, i;
+	int i;
 	u_char r;
 	int type = -1;
 	int csr = SMC66x_CSR;	/* initial value is 0x3F0 */
@@ -702,11 +719,10 @@
 	/*
 	 * Detection: enter configuration mode and read CRD register.
 	 */
-
-	s = splhigh();
+	PPC_CONFIG_LOCK(ppc);
 	outb(csr, SMC665_iCODE);
 	outb(csr, SMC665_iCODE);
-	splx(s);
+	PPC_CONFIG_UNLOCK(ppc);
 
 	outb(csr, 0xd);
 	if (inb(cio) == 0x65) {
@@ -715,10 +731,10 @@
 	}
 
 	for (i = 0; i < 2; i++) {
-		s = splhigh();
+		PPC_CONFIG_LOCK(ppc);
 		outb(csr, SMC666_iCODE);
 		outb(csr, SMC666_iCODE);
-		splx(s);
+		PPC_CONFIG_UNLOCK(ppc);
 
 		outb(csr, 0xd);
 		if (inb(cio) == 0x66) {
@@ -734,8 +750,10 @@
 	/*
 	 * If chipset not found, do not continue.
 	 */
-	if (type == -1)
+	if (type == -1) {
+		outb(csr, 0xaa);	/* end config mode */
 		return (-1);
+	}
 
 	/* select CR1 */
 	outb(csr, 0x1);
@@ -742,8 +760,10 @@
 
 	/* read the port's address: bits 0 and 1 of CR1 */
 	r = inb(cio) & SMC_CR1_ADDR;
-	if (port_address[(int)r] != ppc->ppc_base)
+	if (port_address[(int)r] != ppc->ppc_base) {
+		outb(csr, 0xaa);	/* end config mode */
 		return (-1);
+	}
 
 	ppc->ppc_model = type;
 
@@ -881,8 +901,7 @@
 			outb(cio, (r | SMC_CR4_EPPTYPE));
 	}
 
-	/* end config mode */
-	outb(csr, 0xaa);
+	outb(csr, 0xaa);	/* end config mode */
 
 	ppc->ppc_type = PPC_TYPE_SMCLIKE;
 	ppc_smclike_setmode(ppc, chipset_mode);
@@ -897,13 +916,12 @@
 static int
 ppc_smc37c935_detect(struct ppc_data *ppc, int chipset_mode)
 {
-	int s;
 	int type = -1;
 
-	s = splhigh();
+	PPC_CONFIG_LOCK(ppc);
 	outb(SMC935_CFG, 0x55); /* enter config mode */
 	outb(SMC935_CFG, 0x55);
-	splx(s);
+	PPC_CONFIG_UNLOCK(ppc);
 
 	outb(SMC935_IND, SMC935_ID); /* check device id */
 	if (inb(SMC935_DAT) == 0x2)

Modified: trunk/sys/dev/ppc/ppc_acpi.c
===================================================================
--- trunk/sys/dev/ppc/ppc_acpi.c	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/ppc/ppc_acpi.c	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2006 Marcel Moolenaar
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/ppc/ppc_acpi.c 187576 2009-01-21 23:10:06Z jhb $");
 
 #include "opt_isa.h"
 

Modified: trunk/sys/dev/ppc/ppc_isa.c
===================================================================
--- trunk/sys/dev/ppc/ppc_isa.c	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/ppc/ppc_isa.c	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1997-2000 Nicolas Souchu
  * Copyright (c) 2001 Alcove - Nicolas Souchu
@@ -27,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/ppc/ppc_isa.c 247065 2013-02-21 00:26:31Z imp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -141,7 +142,7 @@
 {
 	struct ppc_data *ppc = device_get_softc(dev);
 	char ecr, ecr_sav, ctr, ctr_sav;
-	int s, error = 0;
+	int error = 0;
 	int spin;
 
 	PPC_ASSERT_LOCKED(ppc);
@@ -190,12 +191,6 @@
 	w_ecr(ppc, ecr);
 	ecr = r_ecr(ppc);
 
-	/* enter splhigh() not to be preempted
-	 * by the dma interrupt, we may miss
-	 * the wakeup otherwise
-	 */
-	s = splhigh();
-
 	ppc->ppc_dmastat = PPC_DMA_INIT;
 
 	/* enable interrupts */
@@ -221,8 +216,6 @@
 		    "ppcdma", 0);
 	} while (error == EWOULDBLOCK);
 
-	splx(s);
-
 	if (error) {
 #ifdef PPC_DEBUG
 		printf("i");

Modified: trunk/sys/dev/ppc/ppc_pci.c
===================================================================
--- trunk/sys/dev/ppc/ppc_pci.c	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/ppc/ppc_pci.c	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2006 Marcel Moolenaar
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/ppc/ppc_pci.c 262230 2014-02-19 19:38:25Z eadler $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -88,6 +89,7 @@
 	{ 0x80001407, "Lava Computers 2SP-PCI parallel port", 0x10 },
 	{ 0x84031415, "Oxford Semiconductor OX12PCI840 Parallel port", 0x10 },
 	{ 0x95131415, "Oxford Semiconductor OX16PCI954 Parallel port", 0x10 },
+	{ 0xc1101415, "Oxford Semiconductor OXPCIe952 Parallel port", 0x10 },
 	{ 0x98059710, "NetMos NM9805 1284 Printer port", 0x10 },
 	{ 0x98659710, "MosChip MCS9865 1284 Printer port", 0x10 },
 	{ 0x99019710, "MosChip MCS9901 PCIe to Peripheral Controller", 0x10 },

Modified: trunk/sys/dev/ppc/ppc_puc.c
===================================================================
--- trunk/sys/dev/ppc/ppc_puc.c	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/ppc/ppc_puc.c	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2006 Marcel Moolenaar
  * Copyright (c) 1997-2000 Nicolas Souchu
@@ -27,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/ppc/ppc_puc.c 187576 2009-01-21 23:10:06Z jhb $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>

Modified: trunk/sys/dev/ppc/ppcreg.h
===================================================================
--- trunk/sys/dev/ppc/ppcreg.h	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/ppc/ppcreg.h	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2001 Alcove - Nicolas Souchu
  * All rights reserved.
@@ -23,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/ppc/ppcreg.h 187576 2009-01-21 23:10:06Z jhb $
  *
  */
 #ifndef __PPCREG_H

Modified: trunk/sys/dev/ppc/ppcvar.h
===================================================================
--- trunk/sys/dev/ppc/ppcvar.h	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/ppc/ppcvar.h	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1997-2000 Nicolas Souchu
  * Copyright (c) 2001 Alcove - Nicolas Souchu
@@ -24,7 +25,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/ppc/ppcvar.h 188173 2009-02-05 19:31:55Z imp $
  *
  */
 

Modified: trunk/sys/dev/pst/pst-iop.c
===================================================================
--- trunk/sys/dev/pst/pst-iop.c	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/pst/pst-iop.c	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,5 +1,6 @@
+/* $MidnightBSD$ */
 /*-
- * Copyright (c) 2001,2002,2003 S\xF8ren Schmidt <sos at FreeBSD.org>
+ * Copyright (c) 2001,2002,2003 Søren Schmidt <sos at FreeBSD.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -27,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/pst/pst-iop.c 230132 2012-01-15 13:23:18Z uqs $");
 
 #include <sys/param.h>
 #include <sys/systm.h>

Modified: trunk/sys/dev/pst/pst-iop.h
===================================================================
--- trunk/sys/dev/pst/pst-iop.h	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/pst/pst-iop.h	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,5 +1,6 @@
+/* $MidnightBSD$ */
 /*-
- * Copyright (c) 2001,2002,2003 S\xF8ren Schmidt <sos at FreeBSD.org>
+ * Copyright (c) 2001,2002,2003 Søren Schmidt <sos at FreeBSD.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -25,7 +26,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/pst/pst-iop.h 230132 2012-01-15 13:23:18Z uqs $
  */
 
 /* misc defines */

Modified: trunk/sys/dev/pst/pst-pci.c
===================================================================
--- trunk/sys/dev/pst/pst-pci.c	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/pst/pst-pci.c	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,5 +1,6 @@
+/* $MidnightBSD$ */
 /*-
- * Copyright (c) 2001,2002,2003 S\xF8ren Schmidt <sos at FreeBSD.org>
+ * Copyright (c) 2001,2002,2003 Søren Schmidt <sos at FreeBSD.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -27,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/pst/pst-pci.c 254263 2013-08-12 23:30:01Z scottl $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -88,9 +89,7 @@
 				       RF_SHAREABLE | RF_ACTIVE);
 
     /* now setup the infrastructure to talk to the device */
-    pci_write_config(dev, PCIR_COMMAND,
-		     pci_read_config(dev, PCIR_COMMAND, 1) |
-		     PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN, 1);
+    pci_enable_busmaster(dev);
 
     sc->ibase = rman_get_virtual(sc->r_mem);
     sc->reg = (struct i2o_registers *)sc->ibase;

Modified: trunk/sys/dev/pst/pst-raid.c
===================================================================
--- trunk/sys/dev/pst/pst-raid.c	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/pst/pst-raid.c	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,5 +1,6 @@
+/* $MidnightBSD$ */
 /*-
- * Copyright (c) 2001,2002,2003 S\xF8ren Schmidt <sos at FreeBSD.org>
+ * Copyright (c) 2001,2002,2003 Søren Schmidt <sos at FreeBSD.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -27,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/pst/pst-raid.c 230132 2012-01-15 13:23:18Z uqs $");
 
 #include <sys/param.h>
 #include <sys/systm.h>

Modified: trunk/sys/dev/pty/pty.c
===================================================================
--- trunk/sys/dev/pty/pty.c	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/pty/pty.c	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2008 Ed Schouten <ed at FreeBSD.org>
  * All rights reserved.
@@ -28,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/pty/pty.c 303433 2016-07-28 11:51:20Z kib $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -52,10 +53,10 @@
  * binary emulation.
  */
 
-static unsigned int pty_warningcnt = 1;
+static unsigned pty_warningcnt = 1;
 SYSCTL_UINT(_kern, OID_AUTO, tty_pty_warningcnt, CTLFLAG_RW,
-	&pty_warningcnt, 0,
-	"Warnings that will be triggered upon legacy PTY allocation");
+    &pty_warningcnt, 0,
+    "Warnings that will be triggered upon legacy PTY allocation");
 
 static int
 ptydev_fdopen(struct cdev *dev, int fflags, struct thread *td, struct file *fp)
@@ -67,7 +68,7 @@
 		return (EBUSY);
 
 	/* Generate device name and create PTY. */
-	strcpy(name, devtoname(dev));
+	strlcpy(name, devtoname(dev), sizeof(name));
 	name[0] = 't';
 
 	error = pts_alloc_external(fflags & (FREAD|FWRITE), td, fp, dev, name);
@@ -77,12 +78,7 @@
 	}
 
 	/* Raise a warning when a legacy PTY has been allocated. */
-	if (pty_warningcnt > 0) {
-		pty_warningcnt--;
-		log(LOG_INFO, "pid %d (%s) is using legacy pty devices%s\n",
-		    td->td_proc->p_pid, td->td_name,
-		    pty_warningcnt ? "" : " - not logging anymore");
-	}
+	counted_warning(&pty_warningcnt, "is using legacy pty devices");
 
 	return (0);
 }
@@ -97,6 +93,8 @@
 pty_clone(void *arg, struct ucred *cr, char *name, int namelen,
     struct cdev **dev)
 {
+	struct make_dev_args mda;
+	int error;
 
 	/* Cloning is already satisfied. */
 	if (*dev != NULL)
@@ -117,8 +115,15 @@
 		return;
 
 	/* Create the controller device node. */
-	*dev = make_dev_credf(MAKEDEV_REF, &ptydev_cdevsw, 0,
-	    NULL, UID_ROOT, GID_WHEEL, 0666, "%s", name);
+	make_dev_args_init(&mda);
+	mda.mda_flags =  MAKEDEV_CHECKNAME | MAKEDEV_REF;
+	mda.mda_devsw = &ptydev_cdevsw;
+	mda.mda_uid = UID_ROOT;
+	mda.mda_gid = GID_WHEEL;
+	mda.mda_mode = 0666;
+	error = make_dev_s(&mda, dev, "%s", name);
+	if (error != 0)
+		*dev = NULL;
 }
 
 static int

Modified: trunk/sys/dev/puc/puc.c
===================================================================
--- trunk/sys/dev/puc/puc.c	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/puc/puc.c	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2006 Marcel Moolenaar
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/puc/puc.c 308402 2016-11-07 09:19:04Z hselasky $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -34,6 +35,7 @@
 #include <sys/conf.h>
 #include <sys/malloc.h>
 #include <sys/mutex.h>
+#include <sys/sysctl.h>
 
 #include <machine/bus.h>
 #include <machine/resource.h>
@@ -70,6 +72,8 @@
 
 static MALLOC_DEFINE(M_PUC, "PUC", "PUC driver");
 
+SYSCTL_NODE(_hw, OID_AUTO, puc, CTLFLAG_RD, 0, "puc(9) driver configuration");
+
 struct puc_bar *
 puc_get_bar(struct puc_softc *sc, int rid)
 {
@@ -324,7 +328,6 @@
 	if (bootverbose && sc->sc_ilr != 0)
 		device_printf(dev, "using interrupt latch register\n");
 
-	sc->sc_irid = 0;
 	sc->sc_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->sc_irid,
 	    RF_ACTIVE|RF_SHAREABLE);
 	if (sc->sc_ires != NULL) {
@@ -412,8 +415,7 @@
 		port = &sc->sc_port[idx];
 		if (port->p_dev == NULL)
 			continue;
-		if (device_detach(port->p_dev) == 0) {
-			device_delete_child(dev, port->p_dev);
+		if (device_delete_child(dev, port->p_dev) == 0) {
 			if (port->p_rres != NULL)
 				rman_release_resource(port->p_rres);
 			if (port->p_ires != NULL)

Modified: trunk/sys/dev/puc/puc_bfe.h
===================================================================
--- trunk/sys/dev/puc/puc_bfe.h	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/puc/puc_bfe.h	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2006 Marcel Moolenaar
  * All rights reserved.
@@ -23,11 +24,11 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/puc/puc_bfe.h 287926 2015-09-17 17:56:23Z rstone $
  */
 
 #ifndef _DEV_PUC_BFE_H_
-#define	_DEV_PUC_BFE_H
+#define	_DEV_PUC_BFE_H_
 
 #define	PUC_PCI_BARS	6
 
@@ -66,6 +67,7 @@
 	int		sc_fastintr:1;
 	int		sc_leaving:1;
 	int		sc_polled:1;
+	int		sc_msi:1;
 
 	int		sc_ilr;
 
@@ -94,4 +96,6 @@
     driver_filter_t *, driver_intr_t *, void *, void **);
 int puc_bus_teardown_intr(device_t, device_t, struct resource *, void *);
 
+SYSCTL_DECL(_hw_puc);
+
 #endif /* _DEV_PUC_BFE_H_ */

Modified: trunk/sys/dev/puc/puc_bus.h
===================================================================
--- trunk/sys/dev/puc/puc_bus.h	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/puc/puc_bus.h	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2006 Marcel Moolenaar
  * All rights reserved.
@@ -23,7 +24,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/puc/puc_bus.h 158124 2006-04-28 21:21:53Z marcel $
  */
 
 #ifndef _DEV_PUC_BUS_H_

Modified: trunk/sys/dev/puc/puc_cfg.c
===================================================================
--- trunk/sys/dev/puc/puc_cfg.c	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/puc/puc_cfg.c	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2006 Marcel Moolenaar
  * All rights reserved.
@@ -25,12 +26,13 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/puc/puc_cfg.c 287926 2015-09-17 17:56:23Z rstone $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/bus.h>
 #include <sys/rman.h>
+#include <sys/sysctl.h>
 
 #include <dev/puc/puc_bus.h>
 #include <dev/puc/puc_cfg.h>

Modified: trunk/sys/dev/puc/puc_cfg.h
===================================================================
--- trunk/sys/dev/puc/puc_cfg.h	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/puc/puc_cfg.h	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2006 Marcel Moolenaar
  * All rights reserved.
@@ -23,11 +24,11 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/puc/puc_cfg.h 251862 2013-06-17 20:11:04Z pluknet $
  */
 
 #ifndef _DEV_PUC_CFG_H_
-#define	_DEV_PUC_CFG_H
+#define	_DEV_PUC_CFG_H_
 
 #define	DEFAULT_RCLK	1843200
 

Modified: trunk/sys/dev/puc/puc_pccard.c
===================================================================
--- trunk/sys/dev/puc/puc_pccard.c	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/puc/puc_pccard.c	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2002 Poul-Henning Kamp.  All rights reserved.
  *
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/puc/puc_pccard.c 287926 2015-09-17 17:56:23Z rstone $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -34,6 +35,7 @@
 #include <sys/bus.h>
 #include <sys/conf.h>
 #include <sys/malloc.h>
+#include <sys/sysctl.h>
 
 #include <machine/bus.h>
 #include <machine/resource.h>

Modified: trunk/sys/dev/puc/puc_pci.c
===================================================================
--- trunk/sys/dev/puc/puc_pci.c	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/puc/puc_pci.c	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*	$NetBSD: puc.c,v 1.7 2000/07/29 17:43:38 jlam Exp $	*/
 
 /*-
@@ -58,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/puc/puc_pci.c 287926 2015-09-17 17:56:23Z rstone $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -67,6 +68,7 @@
 #include <sys/bus.h>
 #include <sys/conf.h>
 #include <sys/malloc.h>
+#include <sys/sysctl.h>
 
 #include <machine/bus.h>
 #include <machine/resource.h>
@@ -78,6 +80,11 @@
 #include <dev/puc/puc_cfg.h>
 #include <dev/puc/puc_bfe.h>
 
+static int puc_msi_disable;
+TUNABLE_INT("hw.puc.msi_disable", &puc_msi_disable);
+SYSCTL_INT(_hw_puc, OID_AUTO, msi_disable, CTLFLAG_RD | CTLFLAG_TUN,
+    &puc_msi_disable, 0, "Disable use of MSI interrupts by puc(9)");
+
 static const struct puc_cfg *
 puc_pci_match(device_t dev, const struct puc_cfg *desc)
 {
@@ -120,11 +127,56 @@
 	return (puc_bfe_probe(dev, desc));
 }
 
+static int
+puc_pci_attach(device_t dev)
+{
+	struct puc_softc *sc;
+	int error, count;
+
+	sc = device_get_softc(dev);
+
+	if (!puc_msi_disable) {
+		count = 1;
+
+		if (pci_alloc_msi(dev, &count) == 0) {
+			sc->sc_msi = 1;
+			sc->sc_irid = 1;
+		}
+	}
+
+	error = puc_bfe_attach(dev);
+
+	if (error != 0 && sc->sc_msi)
+		pci_release_msi(dev);
+
+	return (error);
+}
+
+static int
+puc_pci_detach(device_t dev)
+{
+	struct puc_softc *sc;
+	int error;
+
+	sc = device_get_softc(dev);
+	
+	error = puc_bfe_detach(dev);
+
+	if (error != 0)
+		return (error);
+
+	if (sc->sc_msi)
+		error = pci_release_msi(dev);
+
+	return (error);
+}
+
+
 static device_method_t puc_pci_methods[] = {
     /* Device interface */
     DEVMETHOD(device_probe,		puc_pci_probe),
-    DEVMETHOD(device_attach,		puc_bfe_attach),
-    DEVMETHOD(device_detach,		puc_bfe_detach),
+    DEVMETHOD(device_attach,		puc_pci_attach),
+    DEVMETHOD(device_detach,		puc_pci_detach),
 
     DEVMETHOD(bus_alloc_resource,	puc_bus_alloc_resource),
     DEVMETHOD(bus_release_resource,	puc_bus_release_resource),

Modified: trunk/sys/dev/puc/pucdata.c
===================================================================
--- trunk/sys/dev/puc/pucdata.c	2018-05-27 23:20:26 UTC (rev 10079)
+++ trunk/sys/dev/puc/pucdata.c	2018-05-27 23:22:57 UTC (rev 10080)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2006 Marcel Moolenaar
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/puc/pucdata.c 318151 2017-05-10 20:12:23Z marius $");
 
 /*
  * PCI "universal" communications card driver configuration data (used to
@@ -36,11 +37,15 @@
 #include <sys/systm.h>
 #include <sys/kernel.h>
 #include <sys/bus.h>
+#include <sys/sysctl.h>
 
 #include <machine/resource.h>
 #include <machine/bus.h>
 #include <sys/rman.h>
 
+#include <dev/ic/ns16550.h>
+
+#include <dev/pci/pcireg.h>
 #include <dev/pci/pcivar.h>
 
 #include <dev/puc/puc_bus.h>
@@ -47,20 +52,23 @@
 #include <dev/puc/puc_cfg.h>
 #include <dev/puc/puc_bfe.h>
 
+static puc_config_f puc_config_advantech;
 static puc_config_f puc_config_amc;
 static puc_config_f puc_config_diva;
 static puc_config_f puc_config_exar;
+static puc_config_f puc_config_exar_pcie;
 static puc_config_f puc_config_icbook;
 static puc_config_f puc_config_moxa;
+static puc_config_f puc_config_oxford_pci954;
 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;
 
 const struct puc_cfg puc_pci_devices[] = {
-
 	{   0x0009, 0x7168, 0xffff, 0,
 	    "Sunix SUN1889",
 	    DEFAULT_RCLK * 8,
@@ -175,6 +183,55 @@
 	    .config_function = puc_config_amc
 	},
 
+	/*
+	 * The following members of the Digi International Neo series are
+	 * based on Exar PCI chips, f. e. the 8 port variants on XR17V258IV.
+	 * Accordingly, the PCIe versions of these cards incorporate a PLX
+	 * PCIe-PCI-bridge.
+	 */
+
+	{   0x114f, 0x00b0, 0xffff, 0,
+	    "Digi Neo PCI 4 Port",
+	    DEFAULT_RCLK * 8,
+	    PUC_PORT_4S, 0x10, 0, -1,
+	    .config_function = puc_config_exar
+	},
+
+	{   0x114f, 0x00b1, 0xffff, 0,
+	    "Digi Neo PCI 8 Port",
+	    DEFAULT_RCLK * 8,
+	    PUC_PORT_8S, 0x10, 0, -1,
+	    .config_function = puc_config_exar
+	},
+
+	{   0x114f, 0x00f0, 0xffff, 0,
+	    "Digi Neo PCIe 8 Port",
+	    DEFAULT_RCLK * 8,
+	    PUC_PORT_8S, 0x10, 0, -1,
+	    .config_function = puc_config_exar
+	},
+
+	{   0x114f, 0x00f1, 0xffff, 0,
+	    "Digi Neo PCIe 4 Port",
+	    DEFAULT_RCLK * 8,
+	    PUC_PORT_4S, 0x10, 0, -1,
+	    .config_function = puc_config_exar
+	},
+
+	{   0x114f, 0x00f2, 0xffff, 0,
+	    "Digi Neo PCIe 4 Port RJ45",
+	    DEFAULT_RCLK * 8,
+	    PUC_PORT_4S, 0x10, 0, -1,
+	    .config_function = puc_config_exar
+	},
+
+	{   0x114f, 0x00f3, 0xffff, 0,
+	    "Digi Neo PCIe 8 Port RJ45",
+	    DEFAULT_RCLK * 8,
+	    PUC_PORT_8S, 0x10, 0, -1,
+	    .config_function = puc_config_exar
+	},
+
 	{   0x11fe, 0x8010, 0xffff, 0,
 	    "Comtrol RocketPort 550/8 RJ11 part A",
 	    DEFAULT_RCLK * 4,
@@ -511,7 +568,7 @@
 	    "Moxa Technologies, Smartio CP-102E/PCIe",
 	    DEFAULT_RCLK * 8,
 	    PUC_PORT_2S, 0x14, 0, -1,
-	        .config_function = puc_config_moxa
+	    .config_function = puc_config_moxa
 	},
 
 	{   0x1393, 0x1025, 0xffff, 0,
@@ -518,7 +575,7 @@
 	    "Moxa Technologies, Smartio CP-102EL/PCIe",
 	    DEFAULT_RCLK * 8,
 	    PUC_PORT_2S, 0x14, 0, -1,
-	        .config_function = puc_config_moxa
+	    .config_function = puc_config_moxa
 	},
 
 	{   0x1393, 0x1040, 0xffff, 0,
@@ -549,7 +606,7 @@
 	    "Moxa Technologies, Smartio CP-104EL-A/PCIe",
 	    DEFAULT_RCLK * 8,
 	    PUC_PORT_4S, 0x14, 0, -1,
-		.config_function = puc_config_moxa
+	    .config_function = puc_config_moxa
 	},
 
 	{   0x1393, 0x1120, 0xffff, 0,
@@ -568,7 +625,7 @@
 	    "Moxa Technologies, Smartio CP-114EL/PCIe",
 	    DEFAULT_RCLK * 8,
 	    PUC_PORT_4S, 0x14, 0, -1,
-		.config_function = puc_config_moxa
+	    .config_function = puc_config_moxa
 	},
 
 	{   0x1393, 0x1182, 0xffff, 0,
@@ -575,7 +632,7 @@
 	    "Moxa Technologies, Smartio CP-118EL-A/PCIe",
 	    DEFAULT_RCLK * 8,
 	    PUC_PORT_8S, 0x14, 0, -1,
-		.config_function = puc_config_moxa
+	    .config_function = puc_config_moxa
 	},
 
 	{   0x1393, 0x1680, 0xffff, 0,
@@ -600,7 +657,7 @@
 	    "Moxa Technologies, Smartio CP-168EL-A/PCIe",
 	    DEFAULT_RCLK * 8,
 	    PUC_PORT_8S, 0x14, 0, -1,
-		.config_function = puc_config_moxa
+	    .config_function = puc_config_moxa
 	},
 
 	{   0x13a8, 0x0152, 0xffff, 0,
@@ -628,14 +685,38 @@
 	    "Exar XR17V258IV",
 	    DEFAULT_RCLK * 8,
 	    PUC_PORT_8S, 0x10, 0, -1,
+	    .config_function = puc_config_exar
 	},
 
+	/* The XR17V358 uses the 125MHz PCIe clock as its reference clock. */
+	{   0x13a8, 0x0358, 0xffff, 0,
+	    "Exar XR17V358",
+	    125000000,
+	    PUC_PORT_8S, 0x10, 0, -1,
+	    .config_function = puc_config_exar_pcie
+	},
+
+	/*
+	 * The Advantech PCI-1602 Rev. A use the first two ports of an Oxford
+	 * Semiconductor OXuPCI954.  Note these boards have a hardware bug in
+	 * that they drive the RS-422/485 transmitters after power-on until a
+	 * driver initalizes the UARTs.
+	 */
 	{   0x13fe, 0x1600, 0x1602, 0x0002,
-	    "Advantech PCI-1602",
+	    "Advantech PCI-1602 Rev. A",
 	    DEFAULT_RCLK * 8,
 	    PUC_PORT_2S, 0x10, 0, 8,
+	    .config_function = puc_config_advantech
 	},
 
+	/* Advantech PCI-1602 Rev. B1/PCI-1603 are also based on OXuPCI952. */
+	{   0x13fe, 0xa102, 0x13fe, 0xa102,
+	    "Advantech 2-port PCI (PCI-1602 Rev. B1/PCI-1603)",
+	    DEFAULT_RCLK * 8,
+	    PUC_PORT_2S, 0x10, 4, 0,
+	    .config_function = puc_config_advantech
+	},
+
 	{   0x1407, 0x0100, 0xffff, 0,
 	    "Lava Computers Dual Serial",
 	    DEFAULT_RCLK,
@@ -701,10 +782,10 @@
 	 * I/O Flex PCI I/O Card Model-223 with 4 serial and 1 parallel ports.
 	 */
 	{
-		0x1415, 0x9501, 0x10fc ,0xc070,
-		"I-O DATA RSA-PCI2/R",
-		DEFAULT_RCLK * 8,
-		PUC_PORT_2S, 0x10, 0, 8,
+	    0x1415, 0x9501, 0x10fc, 0xc070,
+	    "I-O DATA RSA-PCI2/R",
+	    DEFAULT_RCLK * 8,
+	    PUC_PORT_2S, 0x10, 0, 8,
 	},
 
 	{   0x1415, 0x9501, 0x131f, 0x2050,
@@ -733,8 +814,9 @@
 
 	{   0x1415, 0x9501, 0xffff, 0,
 	    "Oxford Semiconductor OX16PCI954 UARTs",
-	    DEFAULT_RCLK,
+	    0,
 	    PUC_PORT_4S, 0x10, 0, 8,
+	    .config_function = puc_config_oxford_pci954
 	},
 
 	{   0x1415, 0x950a, 0x131f, 0x2030,
@@ -749,6 +831,12 @@
 	    PUC_PORT_4S, 0x10, 0, 8,
 	},
 
+	{   0x1415, 0x950a, 0x131f, 0x2061,
+	    "SIIG Cyber 2SP1 PCIe",
+	    DEFAULT_RCLK * 10,
+	    PUC_PORT_2S, 0x10, 0, 8,
+	},
+
 	{   0x1415, 0x950a, 0xffff, 0,
 	    "Oxford Semiconductor OX16PCI954 UARTs",
 	    DEFAULT_RCLK,
@@ -820,11 +908,18 @@
 	 *
 	 * Lindy 51189 (4 port)
 	 * <URL:http://www.lindy.com> <URL:http://tinyurl.com/lindy-51189>
-	 * 
+	 *
 	 * StarTech.com PEX4S952 (4 port) and PEX8S952 (8 port)
 	 * <URL:http://www.startech.com>
 	 */
 
+	{   0x1415, 0xc11b, 0xffff, 0,
+	    "Oxford Semiconductor OXPCIe952 1S1P",
+	    DEFAULT_RCLK * 0x22,
+	    PUC_PORT_NONSTANDARD, 0x10, 0, -1,
+	    .config_function = puc_config_oxford_pcie
+	},
+
 	{   0x1415, 0xc138, 0xffff, 0,
 	    "Oxford Semiconductor OXPCIe952 UARTs",
 	    DEFAULT_RCLK * 0x22,
@@ -974,18 +1069,58 @@
 	    .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,
 	},
 
-	{    0x5372, 0x6873, 0xffff, 0,
-	     "Sun 1040 PCI Quad Serial",
-	     DEFAULT_RCLK,
-	     PUC_PORT_4S, 0x10, 4, 0,
+	{   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, 0x6872, 0xffff, 0,
+	    "Feasso PCI FPP-02 2S1P",
+	    DEFAULT_RCLK,
+	    PUC_PORT_2S1P, 0x10, 4, 0,
+	},
+
+	{   0x5372, 0x6873, 0xffff, 0,
+	    "Sun 1040 PCI Quad Serial",
+	    DEFAULT_RCLK,
+	    PUC_PORT_4S, 0x10, 4, 0,
+	},
+
 	{   0x6666, 0x0001, 0xffff, 0,
 	    "Decision Computer Inc, PCCOM 4-port serial",
 	    DEFAULT_RCLK,
@@ -1005,14 +1140,14 @@
 	},
 
 	{   0x9710, 0x9815, 0xffff, 0,
-	    "NetMos NM9815 Dual 1284 Printer port", 
+	    "NetMos NM9815 Dual 1284 Printer port",
 	    0,
 	    PUC_PORT_2P, 0x10, 8, 0,
-	}, 
+	},
 
 	/*
-	 * 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.
 	 */
@@ -1141,9 +1276,96 @@
 };
 
 static int
-puc_config_amc(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port,
+puc_config_advantech(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port,
+    intptr_t *res __unused)
+{
+	const struct puc_cfg *cfg;
+	struct resource *cres;
+	struct puc_bar *bar;
+	device_t cdev, dev;
+	bus_size_t off;
+	int base, crtype, fixed, high, i, oxpcie;
+	uint8_t acr, func, mask;
+
+	if (cmd != PUC_CFG_SETUP)
+		return (ENXIO);
+
+	base = fixed = oxpcie = 0;
+	crtype = SYS_RES_IOPORT;
+	acr = mask = 0x0;
+	func = high = 1;
+	off = 0x60;
+
+	cfg = sc->sc_cfg;
+	switch (cfg->subvendor) {
+	case 0x13fe:
+		switch (cfg->device) {
+		case 0xa102:
+			high = 0;
+			break;
+		default:
+			break;
+		}
+	default:
+		break;
+	}
+	if (fixed == 1)
+		goto setup;
+
+	dev = sc->sc_dev;
+	cdev = pci_find_dbsf(pci_get_domain(dev), pci_get_bus(dev),
+	    pci_get_slot(dev), func);
+	if (cdev == NULL) {
+		device_printf(dev, "could not find config function\n");
+		return (ENXIO);
+	}
+
+	i = PCIR_BAR(0);
+	cres = bus_alloc_resource_any(cdev, crtype, &i, RF_ACTIVE);
+	if (cres == NULL) {
+		device_printf(dev, "could not allocate config resource\n");
+		return (ENXIO);
+	}
+
+	if (oxpcie == 0) {
+		mask = bus_read_1(cres, off);
+		if (pci_get_function(dev) == 1)
+			base = 4;
+	}
+
+ setup:
+	for (i = 0; i < sc->sc_nports; ++i) {
+		device_printf(dev, "port %d: ", i);
+		bar = puc_get_bar(sc, cfg->rid + i * cfg->d_rid);
+		if (bar == NULL) {
+			printf("could not get BAR\n");
+			continue;
+		}
+
+		if (fixed == 0) {
+			if ((mask & (1 << (base + i))) == 0) {
+				acr = 0;
+				printf("RS-232\n");
+			} else {
+				acr = (high == 1 ? 0x18 : 0x10);
+				printf("RS-422/RS-485, active-%s auto-DTR\n",
+				    high == 1 ? "high" : "low");
+			}
+		}
+
+		bus_write_1(bar->b_res, REG_SPR, REG_ACR);
+		bus_write_1(bar->b_res, REG_ICR, acr);
+	}
+
+	bus_release_resource(cdev, crtype, rman_get_rid(cres), cres);
+	return (0);
+}
+
+static int
+puc_config_amc(struct puc_softc *sc __unused, enum puc_cfg_cmd cmd, int port,
     intptr_t *res)
 {
+
 	switch (cmd) {
 	case PUC_CFG_GET_OFS:
 		*res = 8 * (port & 1);
@@ -1175,9 +1397,10 @@
 }
 
 static int
-puc_config_exar(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port,
-    intptr_t *res)
+puc_config_exar(struct puc_softc *sc __unused, enum puc_cfg_cmd cmd,
+    int port, intptr_t *res)
 {
+
 	if (cmd == PUC_CFG_GET_OFS) {
 		*res = port * 0x200;
 		return (0);
@@ -1186,9 +1409,22 @@
 }
 
 static int
-puc_config_icbook(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port,
-    intptr_t *res)
+puc_config_exar_pcie(struct puc_softc *sc __unused, enum puc_cfg_cmd cmd,
+    int port, intptr_t *res)
 {
+
+	if (cmd == PUC_CFG_GET_OFS) {
+		*res = port * 0x400;
+		return (0);
+	}
+	return (ENXIO);
+}
+
+static int
+puc_config_icbook(struct puc_softc *sc __unused, enum puc_cfg_cmd cmd,
+    int port __unused, intptr_t *res)
+{
+
 	if (cmd == PUC_CFG_GET_ILR) {
 		*res = PUC_ILR_DIGI;
 		return (0);
@@ -1200,10 +1436,11 @@
 puc_config_moxa(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port,
     intptr_t *res)
 {
+	const struct puc_cfg *cfg = sc->sc_cfg;
+
 	if (cmd == PUC_CFG_GET_OFS) {
-		const struct puc_cfg *cfg = sc->sc_cfg;
-
-		if (port == 3 && (cfg->device == 0x1045 || cfg->device == 0x1144))
+		if (port == 3 && (cfg->device == 0x1045 ||
+		    cfg->device == 0x1144))
 			port = 7;
 		*res = port * 0x200;
 
@@ -1213,8 +1450,8 @@
 }
 
 static int
-puc_config_quatech(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port,
-    intptr_t *res)
+puc_config_quatech(struct puc_softc *sc, enum puc_cfg_cmd cmd,
+    int port __unused, intptr_t *res)
 {
 	const struct puc_cfg *cfg = sc->sc_cfg;
 	struct puc_bar *bar;
@@ -1229,24 +1466,17 @@
 		bar = puc_get_bar(sc, cfg->rid);
 		if (bar == NULL)
 			return (ENXIO);
-		/* Set DLAB in the LCR register of UART 0. */
-		bus_write_1(bar->b_res, 3, 0x80);
-		/* Write 0 to the SPR register of UART 0. */
-		bus_write_1(bar->b_res, 7, 0);
-		/* Read back the contents of the SPR register of UART 0. */
-		v0 = bus_read_1(bar->b_res, 7);
-		/* Write a specific value to the SPR register of UART 0. */
-		bus_write_1(bar->b_res, 7, 0x80 + -cfg->clock);
-		/* Read back the contents of the SPR register of UART 0. */
-		v1 = bus_read_1(bar->b_res, 7);
-		/* Clear DLAB in the LCR register of UART 0. */
-		bus_write_1(bar->b_res, 3, 0);
-		/* Save the two values read-back from the SPR register. */
+		bus_write_1(bar->b_res, REG_LCR, LCR_DLAB);
+		bus_write_1(bar->b_res, REG_SPR, 0);
+		v0 = bus_read_1(bar->b_res, REG_SPR);
+		bus_write_1(bar->b_res, REG_SPR, 0x80 + -cfg->clock);
+		v1 = bus_read_1(bar->b_res, REG_SPR);
+		bus_write_1(bar->b_res, REG_LCR, 0);
 		sc->sc_cfg_data = (v0 << 8) | v1;
 		if (v0 == 0 && v1 == 0x80 + -cfg->clock) {
 			/*
 			 * The SPR register echoed the two values written
-			 * by us. This means that the SPAD jumper is set.
+			 * by us.  This means that the SPAD jumper is set.
 			 */
 			device_printf(sc->sc_dev, "warning: extra features "
 			    "not usable -- SPAD compatibility enabled\n");
@@ -1254,7 +1484,7 @@
 		}
 		if (v0 != 0) {
 			/*
-			 * The first value doesn't match. This can only mean
+			 * The first value doesn't match.  This can only mean
 			 * that the SPAD jumper is not set and that a non-
 			 * standard fixed clock multiplier jumper is set.
 			 */
@@ -1268,8 +1498,8 @@
 			return (0);
 		}
 		/*
-		 * The first value matched, but the second didn't. We know
-		 * that the SPAD jumper is not set. We also know that the
+		 * The first value matched, but the second didn't.  We know
+		 * that the SPAD jumper is not set.  We also know that the
 		 * clock rate multiplier is software controlled *and* that
 		 * we just programmed it to the maximum allowed.
 		 */
@@ -1284,8 +1514,8 @@
 			/*
 			 * XXX With the SPAD jumper applied, there's no
 			 * easy way of knowing if there's also a clock
-			 * rate multiplier jumper installed. Let's hope
-			 * not...
+			 * rate multiplier jumper installed.  Let's hope
+			 * not ...
 			 */
 			*res = DEFAULT_RCLK;
 		} else if (v0 == 0) {
@@ -1302,8 +1532,8 @@
 	case PUC_CFG_GET_ILR:
 		v0 = (sc->sc_cfg_data >> 8) & 0xff;
 		v1 = sc->sc_cfg_data & 0xff;
-		*res = (v0 == 0 && v1 == 0x80 + -cfg->clock)
-		    ? PUC_ILR_NONE : PUC_ILR_QUATECH;
+		*res = (v0 == 0 && v1 == 0x80 + -cfg->clock) ?
+		    PUC_ILR_NONE : PUC_ILR_QUATECH;
 		return (0);
 	default:
 		break;
@@ -1423,19 +1653,19 @@
 {
 	static const uint16_t dual[] = {
 	    0x0002, 0x4036, 0x4037, 0x4038, 0x4078, 0x4079, 0x4085,
-	    0x4088, 0x4089, 0x5037, 0x5078, 0x5079, 0x5085, 0x6079, 
-	    0x7079, 0x8079, 0x8137, 0x8138, 0x8237, 0x8238, 0x9079, 
+	    0x4088, 0x4089, 0x5037, 0x5078, 0x5079, 0x5085, 0x6079,
+	    0x7079, 0x8079, 0x8137, 0x8138, 0x8237, 0x8238, 0x9079,
 	    0x9137, 0x9138, 0x9237, 0x9238, 0xA079, 0xB079, 0xC079,
 	    0xD079, 0
 	};
 	static const uint16_t quad[] = {
-	    0x4055, 0x4056, 0x4095, 0x4096, 0x5056, 0x8156, 0x8157, 
-	    0x8256, 0x8257, 0x9056, 0x9156, 0x9157, 0x9158, 0x9159, 
+	    0x4055, 0x4056, 0x4095, 0x4096, 0x5056, 0x8156, 0x8157,
+	    0x8256, 0x8257, 0x9056, 0x9156, 0x9157, 0x9158, 0x9159,
 	    0x9256, 0x9257, 0xA056, 0xA157, 0xA158, 0xA159, 0xB056,
 	    0xB157, 0
 	};
 	static const uint16_t octa[] = {
-	    0x4065, 0x4066, 0x5065, 0x5066, 0x8166, 0x9066, 0x9166, 
+	    0x4065, 0x4066, 0x5065, 0x5066, 0x8166, 0x9066, 0x9166,
 	    0x9167, 0x9168, 0xA066, 0xA167, 0xA168, 0
 	};
 	static const struct {
@@ -1495,6 +1725,28 @@
 }
 
 static int
+puc_config_oxford_pci954(struct puc_softc *sc, enum puc_cfg_cmd cmd,
+    int port __unused, intptr_t *res)
+{
+
+	switch (cmd) {
+	case PUC_CFG_GET_CLOCK:
+		/*
+		 * OXu16PCI954 use a 14.7456 MHz clock by default while
+		 * OX16PCI954 and OXm16PCI954 employ a 1.8432 MHz one.
+		 */
+		if (pci_get_revid(sc->sc_dev) == 1)
+			*res = DEFAULT_RCLK * 8;
+		else
+			*res = DEFAULT_RCLK;
+		return (0);
+	default:
+		break;
+	}
+	return (ENXIO);
+}
+
+static int
 puc_config_oxford_pcie(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port,
     intptr_t *res)
 {
@@ -1525,15 +1777,15 @@
 	case PUC_CFG_GET_NPORTS:
 		/*
 		 * Check if we are being called from puc_bfe_attach()
-		 * or puc_bfe_probe(). If puc_bfe_probe(), we cannot
-		 * puc_get_bar(), so we return a value of 16. This has cosmetic
-		 * side-effects at worst; in PUC_CFG_GET_DESC,
-		 * (int)sc->sc_cfg_data will not contain the true number of
-		 * ports in PUC_CFG_GET_DESC, but we are not implementing that
-		 * call for this device family anyway.
+		 * or puc_bfe_probe().  If puc_bfe_probe(), we cannot
+		 * puc_get_bar(), so we return a value of 16.  This has
+		 * cosmetic side-effects at worst; in PUC_CFG_GET_DESC,
+		 * sc->sc_cfg_data will not contain the true number of
+		 * ports in PUC_CFG_GET_DESC, but we are not implementing
+		 * that call for this device family anyway.
 		 *
-		 * The check is for initialisation of sc->sc_bar[idx], which is
-		 * only done in puc_bfe_attach().
+		 * The check is for initialization of sc->sc_bar[idx],
+		 * which is only done in puc_bfe_attach().
 		 */
 		idx = 0;
 		do {
@@ -1568,11 +1820,37 @@
 }
 
 static int
-puc_config_titan(struct puc_softc *sc, enum puc_cfg_cmd cmd, int port,
+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 __unused, enum puc_cfg_cmd cmd,
+    int port, intptr_t *res)
+{
+
+	switch (cmd) {
+	case PUC_CFG_GET_OFS:
 		*res = (port < 3) ? 0 : (port - 2) << 3;
 		return (0);
 	case PUC_CFG_GET_RID:



More information about the Midnightbsd-cvs mailing list