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

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun May 27 20:21:17 EDT 2018


Revision: 10124
          http://svnweb.midnightbsd.org/src/?rev=10124
Author:   laffer1
Date:     2018-05-27 20:21:16 -0400 (Sun, 27 May 2018)
Log Message:
-----------
sync with freebsd

Modified Paths:
--------------
    trunk/sys/dev/cardbus/cardbus.c
    trunk/sys/dev/cardbus/cardbus_cis.c
    trunk/sys/dev/cardbus/cardbus_cis.h
    trunk/sys/dev/cardbus/cardbus_device.c
    trunk/sys/dev/cardbus/cardbusreg.h
    trunk/sys/dev/cardbus/cardbusvar.h
    trunk/sys/dev/cas/if_cas.c
    trunk/sys/dev/cas/if_casreg.h
    trunk/sys/dev/cas/if_casvar.h
    trunk/sys/dev/ce/ceddk.c
    trunk/sys/dev/ce/ceddk.h
    trunk/sys/dev/ce/if_ce.c
    trunk/sys/dev/ce/ng_ce.h
    trunk/sys/dev/ce/tau32-ddk.c
    trunk/sys/dev/ce/tau32-ddk.h
    trunk/sys/dev/cesa/cesa.c
    trunk/sys/dev/cesa/cesa.h
    trunk/sys/dev/cfe/cfe_api.c
    trunk/sys/dev/cfe/cfe_api.h
    trunk/sys/dev/cfe/cfe_api_int.h
    trunk/sys/dev/cfe/cfe_console.c
    trunk/sys/dev/cfe/cfe_env.c
    trunk/sys/dev/cfe/cfe_error.h
    trunk/sys/dev/cfe/cfe_ioctl.h
    trunk/sys/dev/cfe/cfe_resource.c
    trunk/sys/dev/cfi/cfi_bus_fdt.c
    trunk/sys/dev/cfi/cfi_bus_ixp4xx.c
    trunk/sys/dev/cfi/cfi_core.c
    trunk/sys/dev/cfi/cfi_dev.c
    trunk/sys/dev/cfi/cfi_disk.c
    trunk/sys/dev/cfi/cfi_reg.h
    trunk/sys/dev/cfi/cfi_var.h
    trunk/sys/dev/ciss/ciss.c
    trunk/sys/dev/ciss/cissio.h
    trunk/sys/dev/ciss/cissreg.h
    trunk/sys/dev/ciss/cissvar.h
    trunk/sys/dev/cm/if_cm_isa.c
    trunk/sys/dev/cm/smc90cx6.c
    trunk/sys/dev/cm/smc90cx6reg.h
    trunk/sys/dev/cm/smc90cx6var.h
    trunk/sys/dev/cmx/cmx.c
    trunk/sys/dev/cmx/cmx_pccard.c
    trunk/sys/dev/cmx/cmxreg.h
    trunk/sys/dev/cmx/cmxvar.h

Added Paths:
-----------
    trunk/sys/dev/cfi/cfi_bus_nexus.c

Modified: trunk/sys/dev/cardbus/cardbus.c
===================================================================
--- trunk/sys/dev/cardbus/cardbus.c	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cardbus/cardbus.c	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2003-2008 M. Warner Losh.  All Rights Reserved.
  * Copyright (c) 2000,2001 Jonathan Chen.  All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/cardbus/cardbus.c 330938 2018-03-14 19:04:40Z jhb $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -96,9 +97,21 @@
 cardbus_attach(device_t cbdev)
 {
 	struct cardbus_softc *sc;
+#ifdef PCI_RES_BUS
+	int rid;
+#endif
 
 	sc = device_get_softc(cbdev);
 	sc->sc_dev = cbdev;
+#ifdef PCI_RES_BUS
+	rid = 0;
+	sc->sc_bus = bus_alloc_resource(cbdev, PCI_RES_BUS, &rid,
+	    pcib_get_bus(cbdev), pcib_get_bus(cbdev), 1, 0);
+	if (sc->sc_bus == NULL) {
+		device_printf(cbdev, "failed to allocate bus number\n");
+		return (ENXIO);
+	}
+#endif
 	return (0);
 }
 
@@ -105,8 +118,15 @@
 static int
 cardbus_detach(device_t cbdev)
 {
+#ifdef PCI_RES_BUS
+	struct cardbus_softc *sc;
+#endif
 
 	cardbus_detach_card(cbdev);
+#ifdef PCI_RES_BUS
+	sc = device_get_softc(cbdev);
+	(void)bus_release_resource(cbdev, PCI_RES_BUS, 0, sc->sc_bus);
+#endif
 	return (0);
 }
 
@@ -207,31 +227,30 @@
 	return (ENOENT);
 }
 
+static void
+cardbus_child_deleted(device_t cbdev, device_t child)
+{
+	struct cardbus_devinfo *dinfo = device_get_ivars(child);
+
+	if (dinfo->pci.cfg.dev != child)
+		device_printf(cbdev, "devinfo dev mismatch\n");
+	cardbus_device_destroy(dinfo);
+	pci_child_deleted(cbdev, child);
+}
+
 static int
 cardbus_detach_card(device_t cbdev)
 {
-	int numdevs;
-	device_t *devlist;
-	int tmp;
 	int err = 0;
 
-	if (device_get_children(cbdev, &devlist, &numdevs) != 0)
-		return (ENOENT);
-	if (numdevs == 0) {
-		free(devlist, M_TEMP);
-		return (ENOENT);
-	}
+	err = bus_generic_detach(cbdev);
+	if (err)
+		return (err);
+	err = device_delete_children(cbdev);
+	if (err)
+		return (err);
 
-	for (tmp = 0; tmp < numdevs; tmp++) {
-		struct cardbus_devinfo *dinfo = device_get_ivars(devlist[tmp]);
-
-		if (dinfo->pci.cfg.dev != devlist[tmp])
-			device_printf(cbdev, "devinfo dev mismatch\n");
-		cardbus_device_destroy(dinfo);
-		pci_delete_child(cbdev, devlist[tmp]);
-	}
 	POWER_DISABLE_SOCKET(device_get_parent(cbdev), cbdev);
-	free(devlist, M_TEMP);
 	return (err);
 }
 
@@ -316,6 +335,7 @@
 	DEVMETHOD(device_resume,	cardbus_resume),
 
 	/* Bus interface */
+	DEVMETHOD(bus_child_deleted,	cardbus_child_deleted),
 	DEVMETHOD(bus_get_dma_tag,	bus_generic_get_dma_tag),
 	DEVMETHOD(bus_read_ivar,	cardbus_read_ivar),
 	DEVMETHOD(bus_driver_added,	cardbus_driver_added),

Modified: trunk/sys/dev/cardbus/cardbus_cis.c
===================================================================
--- trunk/sys/dev/cardbus/cardbus_cis.c	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cardbus/cardbus_cis.c	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2005-2008, M. Warner Losh
  * Copyright (c) 2000,2001 Jonathan Chen.
@@ -26,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/cardbus/cardbus_cis.c 225515 2011-09-12 15:21:52Z jhb $");
 
 /*
  * CIS Handling for the Cardbus Bus

Modified: trunk/sys/dev/cardbus/cardbus_cis.h
===================================================================
--- trunk/sys/dev/cardbus/cardbus_cis.h	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cardbus/cardbus_cis.h	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2000,2001 Jonathan Chen.
  * 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/cardbus/cardbus_cis.h 141412 2005-02-06 21:03:13Z imp $
  */
 
 /*

Modified: trunk/sys/dev/cardbus/cardbus_device.c
===================================================================
--- trunk/sys/dev/cardbus/cardbus_device.c	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cardbus/cardbus_device.c	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2005-2008, M. Warner Losh
  * All rights reserved.
@@ -26,7 +27,7 @@
  *
  */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/cardbus/cardbus_device.c 188216 2009-02-06 00:55:19Z wkoszek $");
 
 #include <sys/param.h>
 #include <sys/conf.h>

Modified: trunk/sys/dev/cardbus/cardbusreg.h
===================================================================
--- trunk/sys/dev/cardbus/cardbusreg.h	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cardbus/cardbusreg.h	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2000,2001 Jonathan Chen.
  * 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/cardbus/cardbusreg.h 184584 2008-11-03 06:37:59Z imp $
  */
 
 /*

Modified: trunk/sys/dev/cardbus/cardbusvar.h
===================================================================
--- trunk/sys/dev/cardbus/cardbusvar.h	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cardbus/cardbusvar.h	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2008, M. Warner Losh
  * Copyright (c) 2000,2001 Jonathan Chen.
@@ -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/cardbus/cardbusvar.h 280970 2015-04-01 21:48:54Z jhb $
  */
 
 /*
@@ -69,6 +70,9 @@
 struct cardbus_softc 
 {
 	device_t	sc_dev;
+#ifdef PCI_RES_BUS
+	struct resource *sc_bus;
+#endif
 };
 
 /*

Modified: trunk/sys/dev/cas/if_cas.c
===================================================================
--- trunk/sys/dev/cas/if_cas.c	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cas/if_cas.c	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (C) 2001 Eduardo Horvath.
  * Copyright (c) 2001-2003 Thomas Moestl
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/cas/if_cas.c 254842 2013-08-25 10:57:09Z andre $");
 
 /*
  * driver for Sun Cassini/Cassini+ and National Semiconductor DP83065
@@ -132,7 +133,7 @@
 static int	cas_disable_rx(struct cas_softc *sc);
 static int	cas_disable_tx(struct cas_softc *sc);
 static void	cas_eint(struct cas_softc *sc, u_int status);
-static void	cas_free(void *arg1, void* arg2);
+static int	cas_free(struct mbuf *m, void *arg1, void* arg2);
 static void	cas_init(void *xsc);
 static void	cas_init_locked(struct cas_softc *sc);
 static void	cas_init_regs(struct cas_softc *sc);
@@ -1887,8 +1888,8 @@
 #endif
 }
 
-static void
-cas_free(void *arg1, void *arg2)
+static int
+cas_free(struct mbuf *m, void *arg1, void *arg2)
 {
 	struct cas_rxdsoft *rxds;
 	struct cas_softc *sc;
@@ -1904,7 +1905,7 @@
 	rxds = &sc->sc_rxdsoft[idx];
 #endif
 	if (refcount_release(&rxds->rxds_refcount) == 0)
-		return;
+		return (EXT_FREE_OK);
 
 	/*
 	 * NB: this function can be called via m_freem(9) within
@@ -1915,6 +1916,7 @@
 	cas_add_rxdesc(sc, idx);
 	if (locked == 0)
 		CAS_UNLOCK(sc);
+	return (EXT_FREE_OK);
 }
 
 static inline void

Modified: trunk/sys/dev/cas/if_casreg.h
===================================================================
--- trunk/sys/dev/cas/if_casreg.h	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cas/if_casreg.h	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (C) 2001 Eduardo Horvath.
  * Copyright (c) 2008 Marius Strobl <marius at FreeBSD.org>
@@ -27,7 +28,7 @@
  *	from: NetBSD: gemreg.h,v 1.8 2005/12/11 12:21:26 christos Exp
  *	from: FreeBSD: if_gemreg.h 174987 2007-12-30 01:32:03Z marius
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/cas/if_casreg.h 207585 2010-05-03 20:57:16Z marius $
  */
 
 #ifndef	_IF_CASREG_H

Modified: trunk/sys/dev/cas/if_casvar.h
===================================================================
--- trunk/sys/dev/cas/if_casvar.h	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cas/if_casvar.h	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (C) 2001 Eduardo Horvath.
  * Copyright (c) 2008 Marius Strobl <marius at FreeBSD.org>
@@ -27,7 +28,7 @@
  *	from: NetBSD: gemvar.h,v 1.8 2002/05/15 02:36:12 matt Exp
  *	from: FreeBSD: if_gemvar.h 177560 2008-03-24 17:23:53Z marius
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/cas/if_casvar.h 249583 2013-04-17 11:42:40Z gabor $
  */
 
 #ifndef	_IF_CASVAR_H
@@ -56,7 +57,7 @@
 
 /*
  * Receive completion ring size - we have one completion per
- * incoming packet (though the opposite isn't necesarrily true),
+ * incoming packet (though the opposite isn't necessarily true),
  * so this logic is a little simpler.
  */
 #define	CAS_NRXCOMP		4096

Modified: trunk/sys/dev/ce/ceddk.c
===================================================================
--- trunk/sys/dev/ce/ceddk.c	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/ce/ceddk.c	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Middle-level code for Cronyx Tau32-PCI adapters.
  *
@@ -16,7 +17,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/ce/ceddk.c 154899 2006-01-27 09:02:09Z rik $");
 
 #include <dev/cx/machdep.h>
 #include <dev/ce/ceddk.h>

Modified: trunk/sys/dev/ce/ceddk.h
===================================================================
--- trunk/sys/dev/ce/ceddk.h	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/ce/ceddk.h	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Middle-level code for Cronyx Tau32-PCI adapters.
  *
@@ -13,7 +14,7 @@
  * works or modified versions.
  *
  * $Cronyx: ceddk.h,v 1.2.6.1 2005/11/09 13:01:39 rik Exp $
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/ce/ceddk.h 180132 2008-06-30 21:18:27Z rik $
  */
 
 #define TAU32_UserContext_Add	void	*sys;

Modified: trunk/sys/dev/ce/if_ce.c
===================================================================
--- trunk/sys/dev/ce/if_ce.c	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/ce/if_ce.c	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Cronyx-Tau32-PCI adapter driver for FreeBSD.
  *
@@ -16,7 +17,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/ce/if_ce.c 314667 2017-03-04 13:03:31Z avg $");
 
 #include <sys/param.h>
 
@@ -103,10 +104,6 @@
 #define CE_DEBUG2(d,s)	({if (d->chan->debug>1) {\
 				printf ("%s: ", d->name); printf s;}})
 
-#ifndef CALLOUT_MPSAFE
-#define CALLOUT_MPSAFE		0
-#endif
-
 #ifndef IF_DRAIN
 #define IF_DRAIN(ifq) do {		\
 	struct mbuf *m;			\
@@ -145,7 +142,7 @@
 	DEVMETHOD(device_attach,	ce_attach),
 	DEVMETHOD(device_detach,	ce_detach),
 
-	{0, 0}
+	DEVMETHOD_END
 };
 
 typedef struct _ce_dma_mem_t {
@@ -625,7 +622,7 @@
 		return (ENXIO);
 	}
 #if __FreeBSD_version >= 500000
-	callout_init (&led_timo[unit], CALLOUT_MPSAFE);
+	callout_init (&led_timo[unit], 1);
 #else
 	callout_init (&led_timo[unit]);
 #endif
@@ -677,7 +674,7 @@
 			continue;
 		d = c->sys;
 
-		callout_init (&d->timeout_handle, CALLOUT_MPSAFE);
+		callout_init (&d->timeout_handle, 1);
 #ifdef NETGRAPH
 		if (ng_make_node_common (&typestruct, &d->node) != 0) {
 			printf ("%s: cannot make common node\n", d->name);
@@ -2580,7 +2577,7 @@
 		cdevsw_add (&ce_cdevsw);
 #endif
 #if __FreeBSD_version >= 500000
-		callout_init (&timeout_handle, CALLOUT_MPSAFE);
+		callout_init (&timeout_handle, 1);
 #else
 		callout_init (&timeout_handle);
 #endif

Modified: trunk/sys/dev/ce/ng_ce.h
===================================================================
--- trunk/sys/dev/ce/ng_ce.h	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/ce/ng_ce.h	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Defines for Cronyx Tau32-PCI adapter driver.
  *
@@ -13,7 +14,7 @@
  * works or modified versions.
  *
  * $Cronyx: ng_ce.h,v 1.2 2005/04/23 20:11:57 rik Exp $
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/ce/ng_ce.h 154899 2006-01-27 09:02:09Z rik $
  */
 
 #ifdef NETGRAPH

Modified: trunk/sys/dev/ce/tau32-ddk.c
===================================================================
--- trunk/sys/dev/ce/tau32-ddk.c	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/ce/tau32-ddk.c	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * DDK (Driver Development Kit) for Cronyx Tau32-PCI adapter.
  *
@@ -22,7 +23,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/ce/tau32-ddk.c 156143 2006-03-01 09:50:20Z rik $");
 
 #ifndef __noinline
 #	ifdef __GNUC__

Modified: trunk/sys/dev/ce/tau32-ddk.h
===================================================================
--- trunk/sys/dev/ce/tau32-ddk.h	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/ce/tau32-ddk.h	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * DDK (Driver Development Kit) for Cronyx Tau32-PCI adapter.
  *
@@ -8,7 +9,7 @@
  *
  * $Cronyx: tau32-ddk.h,v 1.2 2006/02/01 09:14:40 ly Exp $
  * $Rik: tau32-ddk.h,v 1.7 2006/02/28 22:33:29 rik Exp $
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/ce/tau32-ddk.h 156143 2006-03-01 09:50:20Z rik $
  */
 
 #if defined(__GNUC__) || defined(__TURBOC__)

Modified: trunk/sys/dev/cesa/cesa.c
===================================================================
--- trunk/sys/dev/cesa/cesa.c	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cesa/cesa.c	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (C) 2009-2011 Semihalf.
  * All rights reserved.
@@ -39,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/cesa/cesa.c 266152 2014-05-15 16:11:06Z ian $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -71,8 +72,6 @@
 #include <arm/mv/mvvar.h>
 #include "cesa.h"
 
-#undef DEBUG
-
 static int	cesa_probe(device_t);
 static int	cesa_attach(device_t);
 static int	cesa_detach(device_t);
@@ -80,6 +79,7 @@
 static int	cesa_newsession(device_t, u_int32_t *, struct cryptoini *);
 static int	cesa_freesession(device_t, u_int64_t);
 static int	cesa_process(device_t, struct cryptop *, int);
+static int	decode_win_cesa_setup(struct cesa_softc *sc);
 
 static struct resource_spec cesa_res_spec[] = {
 	{ SYS_RES_MEMORY, 0, RF_ACTIVE },
@@ -93,16 +93,12 @@
 	DEVMETHOD(device_attach,	cesa_attach),
 	DEVMETHOD(device_detach,	cesa_detach),
 
-	/* Bus interface */
-	DEVMETHOD(bus_print_child,	bus_generic_print_child),
-	DEVMETHOD(bus_driver_added,	bus_generic_driver_added),
-
 	/* Crypto device methods */
 	DEVMETHOD(cryptodev_newsession,	cesa_newsession),
 	DEVMETHOD(cryptodev_freesession,cesa_freesession),
 	DEVMETHOD(cryptodev_process,	cesa_process),
 
-	{ 0, 0 }
+	DEVMETHOD_END
 };
 
 static driver_t cesa_driver = {
@@ -161,7 +157,7 @@
 	KASSERT(cdm->cdm_vaddr == NULL,
 	    ("%s(): DMA memory descriptor in use.", __func__));
 
-	error = bus_dma_tag_create(NULL,	/* parent */
+	error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev),	/* parent */
 	    PAGE_SIZE, 0,			/* alignment, boundary */
 	    BUS_SPACE_MAXADDR_32BIT,		/* lowaddr */
 	    BUS_SPACE_MAXADDR,			/* highaddr */
@@ -977,6 +973,10 @@
 static int
 cesa_probe(device_t dev)
 {
+
+	if (!ofw_bus_status_okay(dev))
+		return (ENXIO);
+
 	if (!ofw_bus_is_compatible(dev, "mrvl,cesa"))
 		return (ENXIO);
 
@@ -999,10 +999,10 @@
 	sc->sc_error = 0;
 	sc->sc_dev = dev;
 
-	error = cesa_setup_sram(sc);
-	if (error) {
-		device_printf(dev, "could not setup SRAM\n");
-		return (error);
+	/* Check if CESA peripheral device has power turned on */
+	if (soc_power_ctrl_get(CPU_PM_CTRL_CRYPTO) != CPU_PM_CTRL_CRYPTO) {
+		device_printf(dev, "not powered on\n");
+		return (ENXIO);
 	}
 
 	soc_id(&d, &r);
@@ -1009,6 +1009,7 @@
 
 	switch (d) {
 	case MV_DEV_88F6281:
+	case MV_DEV_88F6282:
 		sc->sc_tperr = 0;
 		break;
 	case MV_DEV_MV78100:
@@ -1041,6 +1042,20 @@
 	sc->sc_bsh = rman_get_bushandle(*(sc->sc_res));
 	sc->sc_bst = rman_get_bustag(*(sc->sc_res));
 
+	/* Setup CESA decoding windows */
+	error = decode_win_cesa_setup(sc);
+	if (error) {
+		device_printf(dev, "could not setup decoding windows\n");
+		goto err1;
+	}
+
+	/* Acquire SRAM base address */
+	error = cesa_setup_sram(sc);
+	if (error) {
+		device_printf(dev, "could not setup SRAM\n");
+		goto err1;
+	}
+
 	/* Setup interrupt handler */
 	error = bus_setup_intr(dev, sc->sc_res[1], INTR_TYPE_NET | INTR_MPSAFE,
 	    NULL, cesa_intr, sc, &(sc->sc_icookie));
@@ -1050,7 +1065,7 @@
 	}
 
 	/* Create DMA tag for processed data */
-	error = bus_dma_tag_create(NULL,	/* parent */
+	error = bus_dma_tag_create(bus_get_dma_tag(dev),	/* parent */
 	    1, 0,				/* alignment, boundary */
 	    BUS_SPACE_MAXADDR_32BIT,		/* lowaddr */
 	    BUS_SPACE_MAXADDR,			/* highaddr */
@@ -1612,3 +1627,50 @@
 
 	return (0);
 }
+
+/*
+ * Set CESA TDMA decode windows.
+ */
+static int
+decode_win_cesa_setup(struct cesa_softc *sc)
+{
+	struct mem_region availmem_regions[FDT_MEM_REGIONS];
+	int availmem_regions_sz;
+	uint32_t memsize, br, cr, i;
+
+	/* Grab physical memory regions information from DTS */
+	if (fdt_get_mem_regions(availmem_regions, &availmem_regions_sz,
+	    &memsize) != 0)
+		return (ENXIO);
+
+	if (availmem_regions_sz > MV_WIN_CESA_MAX) {
+		device_printf(sc->sc_dev, "Too much memory regions, cannot "
+		    " set CESA windows to cover whole DRAM \n");
+		return (ENXIO);
+	}
+
+	/* Disable and clear all CESA windows */
+	for (i = 0; i < MV_WIN_CESA_MAX; i++) {
+		CESA_WRITE(sc, MV_WIN_CESA_BASE(i), 0);
+		CESA_WRITE(sc, MV_WIN_CESA_CTRL(i), 0);
+	}
+
+	/* Fill CESA TDMA decoding windows with information acquired from DTS */
+	for (i = 0; i < availmem_regions_sz; i++) {
+		br = availmem_regions[i].mr_start;
+		cr = availmem_regions[i].mr_size;
+
+		/* Don't add entries with size lower than 64KB */
+		if (cr & 0xffff0000) {
+			cr = (((cr - 1) & 0xffff0000) |
+			(MV_WIN_DDR_ATTR(i) << MV_WIN_CPU_ATTR_SHIFT) |
+			    (MV_WIN_DDR_TARGET << MV_WIN_CPU_TARGET_SHIFT) |
+			    MV_WIN_CPU_ENABLE_BIT);
+			CESA_WRITE(sc, MV_WIN_CESA_BASE(i), br);
+			CESA_WRITE(sc, MV_WIN_CESA_CTRL(i), cr);
+		}
+	}
+
+	return (0);
+}
+

Modified: trunk/sys/dev/cesa/cesa.h
===================================================================
--- trunk/sys/dev/cesa/cesa.h	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cesa/cesa.h	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (C) 2009-2011 Semihalf.
  * 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/cesa/cesa.h 261455 2014-02-04 03:36:42Z eadler $
  */
 
 #ifndef _DEV_CESA_H_
@@ -297,8 +298,8 @@
 #define CESA_CSH_AES_KLEN_MASK		(3 << 24)
 
 #define CESA_CSHD_FRAG_FIRST		(1 << 30)
-#define CESA_CSHD_FRAG_LAST		(2 << 30)
-#define CESA_CSHD_FRAG_MIDDLE		(3 << 30)
+#define CESA_CSHD_FRAG_LAST		(2U << 30)
+#define CESA_CSHD_FRAG_MIDDLE		(3U << 30)
 
 /* CESA registers definitions */
 #define CESA_ICR			0xDE20
@@ -333,6 +334,11 @@
 #define CESA_TDMA_EMR_BOTH_HIT		CESA_TDMA_ECR_BOTH_HIT
 #define CESA_TDMA_EMR_DATA_ERROR	CESA_TDMA_ECR_DATA_ERROR
 
+/*  CESA TDMA address decoding registers */
+#define MV_WIN_CESA_CTRL(n)		(0x8 * (n) + 0xA04)
+#define MV_WIN_CESA_BASE(n)		(0x8 * (n) + 0xA00)
+#define MV_WIN_CESA_MAX			4
+
 /* CESA SA registers definitions */
 #define CESA_SA_CMD			0xDE00
 #define CESA_SA_CMD_ACTVATE		(1 << 0)

Modified: trunk/sys/dev/cfe/cfe_api.c
===================================================================
--- trunk/sys/dev/cfe/cfe_api.c	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cfe/cfe_api.c	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /* $NetBSD: cfe_api.c,v 1.5 2005/12/11 12:18:07 christos Exp $ */
 /* from: SiByte Id: cfe_api.c,v 1.16 2002/07/09 23:29:11 cgd Exp $ */
 
@@ -48,7 +49,7 @@
     ********************************************************************* */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/cfe/cfe_api.c 202091 2010-01-11 17:16:06Z imp $");
 
 #include <dev/cfe/cfe_api.h>
 #include <dev/cfe/cfe_api_int.h>

Modified: trunk/sys/dev/cfe/cfe_api.h
===================================================================
--- trunk/sys/dev/cfe/cfe_api.h	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cfe/cfe_api.h	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /* $NetBSD: cfe_api.h,v 1.3 2003/02/07 17:38:48 cgd Exp $ */
 /* from: SiByte Id: cfe_api.h,v 1.29 2002/07/09 23:29:11 cgd Exp $ */
 
@@ -32,7 +33,7 @@
  *    WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  *    OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/cfe/cfe_api.h 183370 2008-09-26 03:53:10Z imp $
  */
 
 /*  *********************************************************************

Modified: trunk/sys/dev/cfe/cfe_api_int.h
===================================================================
--- trunk/sys/dev/cfe/cfe_api_int.h	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cfe/cfe_api_int.h	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /* $NetBSD: cfe_api_int.h,v 1.2 2003/02/07 17:38:48 cgd Exp $ */
 /* from: SiByte Id: cfe_api_int.h,v 1.21 2002/07/09 23:29:11 cgd Exp $ */
 
@@ -32,7 +33,7 @@
  *    WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  *    OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/cfe/cfe_api_int.h 183370 2008-09-26 03:53:10Z imp $
  */
 
 /*  *********************************************************************

Modified: trunk/sys/dev/cfe/cfe_console.c
===================================================================
--- trunk/sys/dev/cfe/cfe_console.c	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cfe/cfe_console.c	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Bruce M. Simpson.
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/cfe/cfe_console.c 228631 2011-12-17 15:08:43Z avg $");
 
 #include <sys/param.h>
 #include <sys/kdb.h>

Modified: trunk/sys/dev/cfe/cfe_env.c
===================================================================
--- trunk/sys/dev/cfe/cfe_env.c	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cfe/cfe_env.c	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2009 Neelkanth Natu
  * All rights reserved.
@@ -29,7 +30,7 @@
 
 #include <dev/cfe/cfe_api.h>
 
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/cfe/cfe_env.c 211158 2010-08-11 02:13:50Z neel $");
 
 #ifndef	CFE_ENV_SIZE
 #define	CFE_ENV_SIZE	PAGE_SIZE	/* default is one page */

Modified: trunk/sys/dev/cfe/cfe_error.h
===================================================================
--- trunk/sys/dev/cfe/cfe_error.h	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cfe/cfe_error.h	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /* $NetBSD: cfe_error.h,v 1.2 2003/02/07 17:38:48 cgd Exp $ */
 /* from: SiByte Id: cfe_error.h,v 1.2 2002/07/09 19:37:52 cgd Exp $ */
 
@@ -32,7 +33,7 @@
  *    WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  *    OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/cfe/cfe_error.h 183370 2008-09-26 03:53:10Z imp $
  */
 
 /*  *********************************************************************

Modified: trunk/sys/dev/cfe/cfe_ioctl.h
===================================================================
--- trunk/sys/dev/cfe/cfe_ioctl.h	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cfe/cfe_ioctl.h	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /* $NetBSD: cfe_ioctl.h,v 1.2 2003/02/07 17:52:08 cgd Exp $ */
 
 /*-
@@ -31,7 +32,7 @@
  *    WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  *    OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/cfe/cfe_ioctl.h 183370 2008-09-26 03:53:10Z imp $
  */
 
 /*  *********************************************************************

Modified: trunk/sys/dev/cfe/cfe_resource.c
===================================================================
--- trunk/sys/dev/cfe/cfe_resource.c	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cfe/cfe_resource.c	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007 Bruce M. Simpson.
  * All rights reserved.
@@ -32,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/cfe/cfe_resource.c 265999 2014-05-14 01:35:43Z ian $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -61,7 +62,7 @@
 cferes_probe(device_t dev)
 {
 
-	return (0);
+	return (BUS_PROBE_NOWILDCARD);
 }
 
 static int

Modified: trunk/sys/dev/cfi/cfi_bus_fdt.c
===================================================================
--- trunk/sys/dev/cfi/cfi_bus_fdt.c	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cfi/cfi_bus_fdt.c	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007, Juniper Networks, Inc.
  * All rights reserved.
@@ -28,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/cfi/cfi_bus_fdt.c 266152 2014-05-15 16:11:06Z ian $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -51,7 +52,7 @@
 	DEVMETHOD(device_attach,	cfi_attach),
 	DEVMETHOD(device_detach,	cfi_detach),
 
-	{0, 0}
+	DEVMETHOD_END
 };
 
 static driver_t cfi_fdt_driver = {
@@ -61,11 +62,15 @@
 };
 
 DRIVER_MODULE (cfi, lbc, cfi_fdt_driver, cfi_devclass, 0, 0);
+DRIVER_MODULE (cfi, simplebus, cfi_fdt_driver, cfi_devclass, 0, 0);
 
 static int
 cfi_fdt_probe(device_t dev)
 {
 
+	if (!ofw_bus_status_okay(dev))
+		return (ENXIO);
+
 	if (!ofw_bus_is_compatible(dev, "cfi-flash"))
 		return (ENXIO);
 

Modified: trunk/sys/dev/cfi/cfi_bus_ixp4xx.c
===================================================================
--- trunk/sys/dev/cfi/cfi_bus_ixp4xx.c	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cfi/cfi_bus_ixp4xx.c	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2009 Roelof Jonkman, Carlson Wireless Inc.
  * Copyright (c) 2009 Sam Leffler, Errno Consulting
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/cfi/cfi_bus_ixp4xx.c 246128 2013-01-30 18:01:20Z sbz $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -69,7 +70,7 @@
 	DEVMETHOD(device_attach,	cfi_attach),
 	DEVMETHOD(device_detach,	cfi_detach),
 
-	{0, 0}
+	DEVMETHOD_END
 };
 
 static driver_t cfi_ixp4xx_driver = {

Added: trunk/sys/dev/cfi/cfi_bus_nexus.c
===================================================================
--- trunk/sys/dev/cfi/cfi_bus_nexus.c	                        (rev 0)
+++ trunk/sys/dev/cfi/cfi_bus_nexus.c	2018-05-28 00:21:16 UTC (rev 10124)
@@ -0,0 +1,83 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2012 SRI International
+ * Copyright (c) 2009 Roelof Jonkman, Carlson Wireless Inc.
+ * Copyright (c) 2009 Sam Leffler, Errno Consulting
+ * All rights reserved.
+ *
+ * Portions of this software were developed by SRI International and the
+ * University of Cambridge Computer Laboratory under DARPA/AFRL contract
+ * (FA8750-10-C-0237) ("CTSRD"), as part of the DARPA CRASH research
+ * programme.
+ *
+ * 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 ``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 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/sys/dev/cfi/cfi_bus_nexus.c 265959 2014-05-13 17:12:07Z ian $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/conf.h>
+#include <sys/kernel.h>
+#include <sys/malloc.h>   
+#include <sys/module.h>
+#include <sys/rman.h>
+#include <sys/sysctl.h>
+
+#include <machine/bus.h>
+
+#include <dev/cfi/cfi_var.h>
+
+static int
+cfi_nexus_probe(device_t dev)
+{
+	return (BUS_PROBE_NOWILDCARD);
+}
+
+static int
+cfi_nexus_attach(device_t dev)
+{
+	int error;
+
+	error = cfi_probe(dev);
+	if (error != 0)
+		return (error);
+
+	return cfi_attach(dev);
+}
+
+static device_method_t cfi_nexus_methods[] = {
+	/* device interface */
+	DEVMETHOD(device_probe,		cfi_nexus_probe),
+	DEVMETHOD(device_attach,	cfi_nexus_attach),
+	DEVMETHOD(device_detach,	cfi_detach),
+
+	{0, 0}
+};
+
+static driver_t cfi_nexus_driver = {
+	cfi_driver_name,
+	cfi_nexus_methods,
+	sizeof(struct cfi_softc),
+};
+DRIVER_MODULE(cfi, nexus, cfi_nexus_driver, cfi_devclass, 0, 0);


Property changes on: trunk/sys/dev/cfi/cfi_bus_nexus.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/sys/dev/cfi/cfi_core.c
===================================================================
--- trunk/sys/dev/cfi/cfi_core.c	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cfi/cfi_core.c	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,7 +1,14 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007, Juniper Networks, Inc.
+ * Copyright (c) 2012-2013, SRI International
  * All rights reserved.
  *
+ * Portions of this software were developed by SRI International and the
+ * University of Cambridge Computer Laboratory under DARPA/AFRL contract
+ * (FA8750-10-C-0237) ("CTSRD"), as part of the DARPA CRASH research
+ * programme.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -28,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/cfi/cfi_core.c 257524 2013-11-01 20:33:30Z brooks $");
 
 #include "opt_cfi.h"
 
@@ -36,6 +43,8 @@
 #include <sys/systm.h>
 #include <sys/bus.h>
 #include <sys/conf.h>
+#include <sys/endian.h>
+#include <sys/kenv.h>
 #include <sys/kernel.h>
 #include <sys/malloc.h>   
 #include <sys/module.h>
@@ -47,6 +56,8 @@
 #include <dev/cfi/cfi_reg.h>
 #include <dev/cfi/cfi_var.h>
 
+static void cfi_add_sysctls(struct cfi_softc *);
+
 extern struct cdevsw cfi_cdevsw;
 
 char cfi_driver_name[] = "cfi";
@@ -54,7 +65,7 @@
 devclass_t cfi_diskclass;
 
 uint32_t
-cfi_read(struct cfi_softc *sc, u_int ofs)
+cfi_read_raw(struct cfi_softc *sc, u_int ofs)
 {
 	uint32_t val;
 
@@ -76,6 +87,32 @@
 	return (val);
 }
 
+uint32_t
+cfi_read(struct cfi_softc *sc, u_int ofs)
+{
+	uint32_t val;
+	uint16_t sval;
+
+	ofs &= ~(sc->sc_width - 1);
+	switch (sc->sc_width) {
+	case 1:
+		val = bus_space_read_1(sc->sc_tag, sc->sc_handle, ofs);
+		break;
+	case 2:
+		sval = bus_space_read_2(sc->sc_tag, sc->sc_handle, ofs);
+		val = le16toh(sval);
+		break;
+	case 4:
+		val = bus_space_read_4(sc->sc_tag, sc->sc_handle, ofs);
+		val = le32toh(val);
+		break;
+	default:
+		val = ~0;
+		break;
+	}
+	return (val);
+}
+
 static void
 cfi_write(struct cfi_softc *sc, u_int ofs, u_int val)
 {
@@ -86,10 +123,10 @@
 		bus_space_write_1(sc->sc_tag, sc->sc_handle, ofs, val);
 		break;
 	case 2:
-		bus_space_write_2(sc->sc_tag, sc->sc_handle, ofs, val);
+		bus_space_write_2(sc->sc_tag, sc->sc_handle, ofs, htole16(val));
 		break;
 	case 4:
-		bus_space_write_4(sc->sc_tag, sc->sc_handle, ofs, val);
+		bus_space_write_4(sc->sc_tag, sc->sc_handle, ofs, htole32(val));
 		break;
 	}
 }
@@ -234,6 +271,11 @@
 	struct cfi_softc *sc;
 	u_int blksz, blocks;
 	u_int r, u;
+	uint64_t mtoexp, ttoexp;
+#ifdef CFI_SUPPORT_STRATAFLASH
+	uint64_t ppr;
+	char name[KENV_MNAMELEN], value[32];
+#endif
 
 	sc = device_get_softc(dev);
 	sc->sc_dev = dev;
@@ -240,7 +282,11 @@
 
 	sc->sc_rid = 0;
 	sc->sc_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->sc_rid,
+#ifndef ATSE_CFI_HACK
 	    RF_ACTIVE);
+#else
+	    RF_ACTIVE | RF_SHAREABLE);
+#endif
 	if (sc->sc_res == NULL)
 		return (ENXIO);
 
@@ -247,12 +293,80 @@
 	sc->sc_tag = rman_get_bustag(sc->sc_res);
 	sc->sc_handle = rman_get_bushandle(sc->sc_res);
 
-	/* Get time-out values for erase and write. */
-	sc->sc_write_timeout = 1 << cfi_read_qry(sc, CFI_QRY_TTO_WRITE);
-	sc->sc_erase_timeout = 1 << cfi_read_qry(sc, CFI_QRY_TTO_ERASE);
-	sc->sc_write_timeout *= 1 << cfi_read_qry(sc, CFI_QRY_MTO_WRITE);
-	sc->sc_erase_timeout *= 1 << cfi_read_qry(sc, CFI_QRY_MTO_ERASE);
+	/* Get time-out values for erase, write, and buffer write. */
+	ttoexp = cfi_read_qry(sc, CFI_QRY_TTO_ERASE);
+	mtoexp = cfi_read_qry(sc, CFI_QRY_MTO_ERASE);
+	if (ttoexp == 0) {
+		device_printf(dev, "erase timeout == 0, using 2^16ms\n");
+		ttoexp = 16;
+	}
+	if (ttoexp > 41) {
+		device_printf(dev, "insane timeout: 2^%jdms\n", ttoexp);
+		return (EINVAL);
+	}
+	if (mtoexp == 0) {
+		device_printf(dev, "max erase timeout == 0, using 2^%jdms\n",
+		    ttoexp + 4);
+		mtoexp = 4;
+	}
+	if (ttoexp + mtoexp > 41) {
+		device_printf(dev, "insane max erase timeout: 2^%jd\n",
+		    ttoexp + mtoexp);
+		return (EINVAL);
+	}
+	sc->sc_typical_timeouts[CFI_TIMEOUT_ERASE] = SBT_1MS * (1ULL << ttoexp);
+	sc->sc_max_timeouts[CFI_TIMEOUT_ERASE] =
+	    sc->sc_typical_timeouts[CFI_TIMEOUT_ERASE] * (1ULL << mtoexp);
 
+	ttoexp = cfi_read_qry(sc, CFI_QRY_TTO_WRITE);
+	mtoexp = cfi_read_qry(sc, CFI_QRY_MTO_WRITE);
+	if (ttoexp == 0) {
+		device_printf(dev, "write timeout == 0, using 2^18ns\n");
+		ttoexp = 18;
+	}
+	if (ttoexp > 51) {
+		device_printf(dev, "insane write timeout: 2^%jdus\n", ttoexp);
+		return (EINVAL);
+	}
+	if (mtoexp == 0) {
+		device_printf(dev, "max write timeout == 0, using 2^%jdms\n",
+		    ttoexp + 4);
+		mtoexp = 4;
+	}
+	if (ttoexp + mtoexp > 51) {
+		device_printf(dev, "insane max write timeout: 2^%jdus\n",
+		    ttoexp + mtoexp);
+		return (EINVAL);
+	}
+	sc->sc_typical_timeouts[CFI_TIMEOUT_WRITE] = SBT_1US * (1ULL << ttoexp);
+	sc->sc_max_timeouts[CFI_TIMEOUT_WRITE] =
+	    sc->sc_typical_timeouts[CFI_TIMEOUT_WRITE] * (1ULL << mtoexp);
+
+	ttoexp = cfi_read_qry(sc, CFI_QRY_TTO_BUFWRITE);
+	mtoexp = cfi_read_qry(sc, CFI_QRY_MTO_BUFWRITE);
+	/* Don't check for 0, it means not-supported. */
+	if (ttoexp > 51) {
+		device_printf(dev, "insane write timeout: 2^%jdus\n", ttoexp);
+		return (EINVAL);
+	}
+	if (ttoexp + mtoexp > 51) {
+		device_printf(dev, "insane max write timeout: 2^%jdus\n",
+		    ttoexp + mtoexp);
+		return (EINVAL);
+	}
+	sc->sc_typical_timeouts[CFI_TIMEOUT_BUFWRITE] =
+	    SBT_1US * (1ULL << cfi_read_qry(sc, CFI_QRY_TTO_BUFWRITE));
+	sc->sc_max_timeouts[CFI_TIMEOUT_BUFWRITE] =
+	    sc->sc_typical_timeouts[CFI_TIMEOUT_BUFWRITE] *
+	    (1ULL << cfi_read_qry(sc, CFI_QRY_MTO_BUFWRITE));
+
+	/* Get the maximum size of a multibyte program */
+	if (sc->sc_typical_timeouts[CFI_TIMEOUT_BUFWRITE] != 0)
+		sc->sc_maxbuf = 1 << (cfi_read_qry(sc, CFI_QRY_MAXBUF) |
+		    cfi_read_qry(sc, CFI_QRY_MAXBUF) << 8);
+	else
+		sc->sc_maxbuf = 0;
+
 	/* Get erase regions. */
 	sc->sc_regions = cfi_read_qry(sc, CFI_QRY_NREGIONS);
 	sc->sc_region = malloc(sc->sc_regions * sizeof(struct cfi_region),
@@ -285,6 +399,22 @@
 	    "%s%u", cfi_driver_name, u);
 	sc->sc_nod->si_drv1 = sc;
 
+	cfi_add_sysctls(sc);
+
+#ifdef CFI_SUPPORT_STRATAFLASH
+	/*
+	 * Store the Intel factory PPR in the environment.  In some
+	 * cases it is the most unique ID on a board.
+	 */
+	if (cfi_intel_get_factory_pr(sc, &ppr) == 0) {
+		if (snprintf(name, sizeof(name), "%s.factory_ppr",
+		    device_get_nameunit(dev)) < (sizeof(name) - 1) &&
+		    snprintf(value, sizeof(value), "0x%016jx", ppr) <
+		    (sizeof(value) - 1))
+			(void) setenv(name, value);
+	}
+#endif
+
 	device_add_child(dev, "cfid", -1);
 	bus_generic_attach(dev);
 
@@ -291,6 +421,45 @@
 	return (0);
 }
 
+static void
+cfi_add_sysctls(struct cfi_softc *sc)
+{
+	struct sysctl_ctx_list *ctx;
+	struct sysctl_oid_list *children;
+
+	ctx = device_get_sysctl_ctx(sc->sc_dev);
+	children = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->sc_dev));
+
+	SYSCTL_ADD_UINT(ctx, children, OID_AUTO,
+	    "typical_erase_timout_count",
+	    CTLFLAG_RD, &sc->sc_tto_counts[CFI_TIMEOUT_ERASE],
+	    0, "Number of times the typical erase timeout was exceeded");
+	SYSCTL_ADD_UINT(ctx, children, OID_AUTO,
+	    "max_erase_timout_count",
+	    CTLFLAG_RD, &sc->sc_mto_counts[CFI_TIMEOUT_ERASE], 0,
+	    "Number of times the maximum erase timeout was exceeded");
+	SYSCTL_ADD_UINT(ctx, children, OID_AUTO,
+	    "typical_write_timout_count",
+	    CTLFLAG_RD, &sc->sc_tto_counts[CFI_TIMEOUT_WRITE], 0,
+	    "Number of times the typical write timeout was exceeded");
+	SYSCTL_ADD_UINT(ctx, children, OID_AUTO,
+	    "max_write_timout_count",
+	    CTLFLAG_RD, &sc->sc_mto_counts[CFI_TIMEOUT_WRITE], 0,
+	    "Number of times the maximum write timeout was exceeded");
+	if (sc->sc_maxbuf > 0) {
+		SYSCTL_ADD_UINT(ctx, children, OID_AUTO,
+		    "typical_bufwrite_timout_count",
+		    CTLFLAG_RD, &sc->sc_tto_counts[CFI_TIMEOUT_BUFWRITE], 0,
+		    "Number of times the typical buffered write timeout was "
+		    "exceeded");
+		SYSCTL_ADD_UINT(ctx, children, OID_AUTO,
+		    "max_bufwrite_timout_count",
+		    CTLFLAG_RD, &sc->sc_mto_counts[CFI_TIMEOUT_BUFWRITE], 0,
+		    "Number of times the maximum buffered write timeout was "
+		    "exceeded");
+	}
+}
+
 int
 cfi_detach(device_t dev)
 {
@@ -305,17 +474,22 @@
 }
 
 static int
-cfi_wait_ready(struct cfi_softc *sc, u_int ofs, u_int timeout)
+cfi_wait_ready(struct cfi_softc *sc, u_int ofs, sbintime_t start,
+    enum cfi_wait_cmd cmd)
 {
-	int done, error;
+	int done, error, tto_exceeded;
 	uint32_t st0 = 0, st = 0;
+	sbintime_t now;
 
 	done = 0;
 	error = 0;
-	timeout *= 10;
-	while (!done && !error && timeout) {
-		DELAY(100);
-		timeout--;
+	tto_exceeded = 0;
+	while (!done && !error) {
+		/*
+		 * Save time before we start so we always do one check
+		 * after the timeout has expired.
+		 */
+		now = sbinuptime();
 
 		switch (sc->sc_cmdset) {
 		case CFI_VEND_INTEL_ECS:
@@ -344,6 +518,25 @@
 			done = ((st & 0x40) == (st0 & 0x40)) ? 1 : 0;
 			break;
 		}
+
+		if (tto_exceeded ||
+		    now > start + sc->sc_typical_timeouts[cmd]) {
+			if (!tto_exceeded) {
+				tto_exceeded = 1;
+				sc->sc_tto_counts[cmd]++;
+#ifdef CFI_DEBUG_TIMEOUT
+				device_printf(sc->sc_dev,
+				    "typical timeout exceeded (cmd %d)", cmd);
+#endif
+			}
+			if (now > start + sc->sc_max_timeouts[cmd]) {
+				sc->sc_mto_counts[cmd]++;
+#ifdef CFI_DEBUG_TIMEOUT
+				device_printf(sc->sc_dev,
+				    "max timeout exceeded (cmd %d)", cmd);
+#endif
+			}
+		}
 	}
 	if (!done && !error)
 		error = ETIMEDOUT;
@@ -359,35 +552,141 @@
 		uint8_t		*x8;
 		uint16_t	*x16;
 		uint32_t	*x32;
-	} ptr;
+	} ptr, cpyprt;
 	register_t intr;
-	int error, i;
+	int error, i, neederase = 0;
+	uint32_t st;
+	u_int wlen;
+	sbintime_t start;
 
-	/* Erase the block. */
+	/* Intel flash must be unlocked before modification */
 	switch (sc->sc_cmdset) {
 	case CFI_VEND_INTEL_ECS:
 	case CFI_VEND_INTEL_SCS:
-		cfi_write(sc, sc->sc_wrofs, CFI_BCS_BLOCK_ERASE);
-		cfi_write(sc, sc->sc_wrofs, CFI_BCS_CONFIRM);
+		cfi_write(sc, sc->sc_wrofs, CFI_INTEL_LBS);
+		cfi_write(sc, sc->sc_wrofs, CFI_INTEL_UB);
+		cfi_write(sc, sc->sc_wrofs, CFI_BCS_READ_ARRAY);
 		break;
-	case CFI_VEND_AMD_SCS:
-	case CFI_VEND_AMD_ECS:
-		cfi_amd_write(sc, sc->sc_wrofs, AMD_ADDR_START,
-		    CFI_AMD_ERASE_SECTOR);
-		cfi_amd_write(sc, sc->sc_wrofs, 0, CFI_AMD_BLOCK_ERASE);
-		break;
-	default:
-		/* Better safe than sorry... */
-		return (ENODEV);
 	}
-	error = cfi_wait_ready(sc, sc->sc_wrofs, sc->sc_erase_timeout);
-	if (error)
-		goto out;
 
-	/* Write the block. */
+	/* Check if an erase is required. */
+	for (i = 0; i < sc->sc_wrbufsz; i++)
+		if ((sc->sc_wrbuf[i] & sc->sc_wrbufcpy[i]) != sc->sc_wrbuf[i]) {
+			neederase = 1;
+			break;
+		}
+
+	if (neederase) {
+		intr = intr_disable();
+		start = sbinuptime();
+		/* Erase the block. */
+		switch (sc->sc_cmdset) {
+		case CFI_VEND_INTEL_ECS:
+		case CFI_VEND_INTEL_SCS:
+			cfi_write(sc, sc->sc_wrofs, CFI_BCS_BLOCK_ERASE);
+			cfi_write(sc, sc->sc_wrofs, CFI_BCS_CONFIRM);
+			break;
+		case CFI_VEND_AMD_SCS:
+		case CFI_VEND_AMD_ECS:
+			cfi_amd_write(sc, sc->sc_wrofs, AMD_ADDR_START,
+			    CFI_AMD_ERASE_SECTOR);
+			cfi_amd_write(sc, sc->sc_wrofs, 0, CFI_AMD_BLOCK_ERASE);
+			break;
+		default:
+			/* Better safe than sorry... */
+			intr_restore(intr);
+			return (ENODEV);
+		}
+		intr_restore(intr);
+		error = cfi_wait_ready(sc, sc->sc_wrofs, start, 
+		    CFI_TIMEOUT_ERASE);
+		if (error)
+			goto out;
+	} else
+		error = 0;
+
+	/* Write the block using a multibyte write if supported. */
 	ptr.x8 = sc->sc_wrbuf;
+	cpyprt.x8 = sc->sc_wrbufcpy;
+	if (sc->sc_maxbuf > sc->sc_width) {
+		switch (sc->sc_cmdset) {
+		case CFI_VEND_INTEL_ECS:
+		case CFI_VEND_INTEL_SCS:
+			for (i = 0; i < sc->sc_wrbufsz; i += wlen) {
+				wlen = MIN(sc->sc_maxbuf, sc->sc_wrbufsz - i);
+
+				intr = intr_disable();
+
+				start = sbinuptime();
+				do {
+					cfi_write(sc, sc->sc_wrofs + i,
+					    CFI_BCS_BUF_PROG_SETUP);
+					if (sbinuptime() > start + sc->sc_max_timeouts[CFI_TIMEOUT_BUFWRITE]) {
+						error = ETIMEDOUT;
+						goto out;
+					}
+					st = cfi_read(sc, sc->sc_wrofs + i);
+				} while (! (st & CFI_INTEL_STATUS_WSMS));
+
+				cfi_write(sc, sc->sc_wrofs + i,
+				    (wlen / sc->sc_width) - 1);
+				switch (sc->sc_width) {
+				case 1:
+					bus_space_write_region_1(sc->sc_tag,
+					    sc->sc_handle, sc->sc_wrofs + i,
+					    ptr.x8 + i, wlen);
+					break;
+				case 2:
+					bus_space_write_region_2(sc->sc_tag,
+					    sc->sc_handle, sc->sc_wrofs + i,
+					    ptr.x16 + i / 2, wlen / 2);
+					break;
+				case 4:
+					bus_space_write_region_4(sc->sc_tag,
+					    sc->sc_handle, sc->sc_wrofs + i,
+					    ptr.x32 + i / 4, wlen / 4);
+					break;
+				}
+
+				cfi_write(sc, sc->sc_wrofs + i,
+				    CFI_BCS_CONFIRM);
+
+				intr_restore(intr);
+
+				error = cfi_wait_ready(sc, sc->sc_wrofs + i,
+				    start, CFI_TIMEOUT_BUFWRITE);
+				if (error != 0)
+					goto out;
+			}
+			goto out;
+		default:
+			/* Fall through to single word case */
+			break;
+		}
+
+	}
+
+	/* Write the block one byte/word at a time. */
 	for (i = 0; i < sc->sc_wrbufsz; i += sc->sc_width) {
 
+		/* Avoid writing unless we are actually changing bits */
+		if (!neederase) {
+			switch (sc->sc_width) {
+			case 1:
+				if(*(ptr.x8 + i) == *(cpyprt.x8 + i))
+					continue;
+				break;
+			case 2:
+				if(*(ptr.x16 + i / 2) == *(cpyprt.x16 + i / 2))
+					continue;
+				break;
+			case 4:
+				if(*(ptr.x32 + i / 4) == *(cpyprt.x32 + i / 4))
+					continue;
+				break;
+			}
+		}
+
 		/*
 		 * Make sure the command to start a write and the
 		 * actual write happens back-to-back without any
@@ -395,6 +694,7 @@
 		 */
 		intr = intr_disable();
 
+		start = sbinuptime();
 		switch (sc->sc_cmdset) {
 		case CFI_VEND_INTEL_ECS:
 		case CFI_VEND_INTEL_SCS:
@@ -408,21 +708,22 @@
 		switch (sc->sc_width) {
 		case 1:
 			bus_space_write_1(sc->sc_tag, sc->sc_handle,
-			    sc->sc_wrofs + i, *(ptr.x8)++);
+			    sc->sc_wrofs + i, *(ptr.x8 + i));
 			break;
 		case 2:
 			bus_space_write_2(sc->sc_tag, sc->sc_handle,
-			    sc->sc_wrofs + i, *(ptr.x16)++);
+			    sc->sc_wrofs + i, *(ptr.x16 + i / 2));
 			break;
 		case 4:
 			bus_space_write_4(sc->sc_tag, sc->sc_handle,
-			    sc->sc_wrofs + i, *(ptr.x32)++);
+			    sc->sc_wrofs + i, *(ptr.x32 + i / 4));
 			break;
 		}
-
+		
 		intr_restore(intr);
 
-		error = cfi_wait_ready(sc, sc->sc_wrofs, sc->sc_write_timeout);
+		error = cfi_wait_ready(sc, sc->sc_wrofs, start,
+		   CFI_TIMEOUT_WRITE);
 		if (error)
 			goto out;
 	}
@@ -431,6 +732,16 @@
 
  out:
 	cfi_write(sc, 0, CFI_BCS_READ_ARRAY);
+
+	/* Relock Intel flash */
+	switch (sc->sc_cmdset) {
+	case CFI_VEND_INTEL_ECS:
+	case CFI_VEND_INTEL_SCS:
+		cfi_write(sc, sc->sc_wrofs, CFI_INTEL_LBS);
+		cfi_write(sc, sc->sc_wrofs, CFI_INTEL_LB);
+		cfi_write(sc, sc->sc_wrofs, CFI_BCS_READ_ARRAY);
+		break;
+	}
 	return (error);
 }
 
@@ -510,6 +821,7 @@
 #ifdef CFI_ARMEDANDDANGEROUS
 	register_t intr;
 	int i, error;
+	sbintime_t start;
 #endif
 
 	if (sc->sc_cmdset != CFI_VEND_INTEL_ECS)
@@ -519,11 +831,12 @@
 #ifdef CFI_ARMEDANDDANGEROUS
 	for (i = 7; i >= 4; i--, id >>= 16) {
 		intr = intr_disable();
+		start = sbinuptime();
 		cfi_write(sc, 0, CFI_INTEL_PP_SETUP);
 		cfi_put16(sc, CFI_INTEL_PR(i), id&0xffff);
 		intr_restore(intr);
-		error = cfi_wait_ready(sc, CFI_BCS_READ_STATUS,
-		    sc->sc_write_timeout);
+		error = cfi_wait_ready(sc, CFI_BCS_READ_STATUS, start,
+		    CFI_TIMEOUT_WRITE);
 		if (error)
 			break;
 	}
@@ -563,6 +876,7 @@
 #ifdef CFI_ARMEDANDDANGEROUS
 	register_t intr;
 	int error;
+	sbintime_t start;
 #endif
 	if (sc->sc_cmdset != CFI_VEND_INTEL_ECS)
 		return EOPNOTSUPP;
@@ -572,10 +886,12 @@
 	/* worthy of console msg */
 	device_printf(sc->sc_dev, "set PLR\n");
 	intr = intr_disable();
+	binuptime(&start);
 	cfi_write(sc, 0, CFI_INTEL_PP_SETUP);
 	cfi_put16(sc, CFI_INTEL_PLR, 0xFFFD);
 	intr_restore(intr);
-	error = cfi_wait_ready(sc, CFI_BCS_READ_STATUS, sc->sc_write_timeout);
+	error = cfi_wait_ready(sc, CFI_BCS_READ_STATUS, start,
+	    CFI_TIMEOUT_WRITE);
 	cfi_write(sc, 0, CFI_BCS_READ_ARRAY);
 	return error;
 #else

Modified: trunk/sys/dev/cfi/cfi_dev.c
===================================================================
--- trunk/sys/dev/cfi/cfi_dev.c	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cfi/cfi_dev.c	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,7 +1,14 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007, Juniper Networks, Inc.
+ * Copyright (c) 2012-2013, SRI International
  * All rights reserved.
  *
+ * Portions of this software were developed by SRI International and the
+ * University of Cambridge Computer Laboratory under DARPA/AFRL contract
+ * (FA8750-10-C-0237) ("CTSRD"), as part of the DARPA CRASH research
+ * programme.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -28,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/cfi/cfi_dev.c 255207 2013-09-04 17:19:21Z brooks $");
 
 #include "opt_cfi.h"
 
@@ -72,7 +79,8 @@
  * Begin writing into a new block/sector.  We read the sector into
  * memory and keep updating that, until we move into another sector
  * or the process stops writing. At that time we write the whole
- * sector to flash (see cfi_block_finish).
+ * sector to flash (see cfi_block_finish).  To avoid unneeded erase
+ * cycles, keep a pristine copy of the sector on hand.
  */
 int
 cfi_block_start(struct cfi_softc *sc, u_int ofs)
@@ -103,7 +111,7 @@
 	/* Read the block from flash for byte-serving. */
 	ptr.x8 = sc->sc_wrbuf;
 	for (r = 0; r < sc->sc_wrbufsz; r += sc->sc_width) {
-		val = cfi_read(sc, sc->sc_wrofs + r);
+		val = cfi_read_raw(sc, sc->sc_wrofs + r);
 		switch (sc->sc_width) {
 		case 1:
 			*(ptr.x8)++ = val;
@@ -116,6 +124,8 @@
 			break;
 		}
 	}
+	sc->sc_wrbufcpy = malloc(sc->sc_wrbufsz, M_TEMP, M_WAITOK);
+	memcpy(sc->sc_wrbufcpy, sc->sc_wrbuf, sc->sc_wrbufsz);
 	sc->sc_writing = 1;
 	return (0);
 }
@@ -131,6 +141,7 @@
 
 	error = cfi_write_block(sc);
 	free(sc->sc_wrbuf, M_TEMP);
+	free(sc->sc_wrbufcpy, M_TEMP);
 	sc->sc_wrbuf = NULL;
 	sc->sc_wrbufsz = 0;
 	sc->sc_wrofs = 0;
@@ -189,7 +200,7 @@
 	while (error == 0 && uio->uio_resid > 0 &&
 	    uio->uio_offset < sc->sc_size) {
 		ofs = uio->uio_offset;
-		val = cfi_read(sc, ofs);
+		val = cfi_read_raw(sc, ofs);
 		switch (sc->sc_width) {
 		case 1:
 			buf.x8[0] = val;

Modified: trunk/sys/dev/cfi/cfi_disk.c
===================================================================
--- trunk/sys/dev/cfi/cfi_disk.c	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cfi/cfi_disk.c	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,7 +1,14 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2009 Sam Leffler, Errno Consulting
+ * Copyright (c) 2012-2013, SRI International
  * All rights reserved.
  *
+ * Portions of this software were developed by SRI International and the
+ * University of Cambridge Computer Laboratory under DARPA/AFRL contract
+ * (FA8750-10-C-0237) ("CTSRD"), as part of the DARPA CRASH research
+ * programme.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -24,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/cfi/cfi_disk.c 255207 2013-09-04 17:19:21Z brooks $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -44,6 +51,7 @@
 
 #include <dev/cfi/cfi_var.h>
 
+#include <geom/geom.h>
 #include <geom/geom_disk.h>
 
 struct cfi_disk_softc {
@@ -64,6 +72,7 @@
 static int cfi_disk_open(struct disk *);
 static int cfi_disk_close(struct disk *);
 static void cfi_io_proc(void *, int);
+static int cfi_disk_getattr(struct bio *);
 static void cfi_disk_strategy(struct bio *);
 static int cfi_disk_ioctl(struct disk *, u_long, void *, int, struct thread *);
 
@@ -95,6 +104,7 @@
 	sc->disk->d_strategy = cfi_disk_strategy;
 	sc->disk->d_ioctl = cfi_disk_ioctl;
 	sc->disk->d_dump = NULL;		/* NB: no dumps */
+	sc->disk->d_getattr = cfi_disk_getattr;
 	sc->disk->d_sectorsize = CFI_DISK_SECSIZE;
 	sc->disk->d_mediasize = sc->parent->sc_size;
 	sc->disk->d_maxsize = CFI_DISK_MAXIOSIZE;
@@ -182,19 +192,19 @@
 	if (sc->sc_width == 1) {
 		uint8_t *dp = (uint8_t *)bp->bio_data;
 		while (resid > 0 && bp->bio_offset < sc->sc_size) {
-			*dp++ = cfi_read(sc, bp->bio_offset);
+			*dp++ = cfi_read_raw(sc, bp->bio_offset);
 			bp->bio_offset += 1, resid -= 1;
 		}
 	} else if (sc->sc_width == 2) {
 		uint16_t *dp = (uint16_t *)bp->bio_data;
 		while (resid > 0 && bp->bio_offset < sc->sc_size) {
-			*dp++ = cfi_read(sc, bp->bio_offset);
+			*dp++ = cfi_read_raw(sc, bp->bio_offset);
 			bp->bio_offset += 2, resid -= 2;
 		}
 	} else {
 		uint32_t *dp = (uint32_t *)bp->bio_data;
 		while (resid > 0 && bp->bio_offset < sc->sc_size) {
-			*dp++ = cfi_read(sc, bp->bio_offset);
+			*dp++ = cfi_read_raw(sc, bp->bio_offset);
 			bp->bio_offset += 4, resid -= 4;
 		}
 	}
@@ -275,6 +285,30 @@
 	}
 }
 
+static int
+cfi_disk_getattr(struct bio *bp)
+{
+	struct cfi_disk_softc *dsc;
+	struct cfi_softc *sc;
+	device_t dev;
+
+	if (bp->bio_disk == NULL || bp->bio_disk->d_drv1 == NULL)
+		return (ENXIO);
+
+	dsc = bp->bio_disk->d_drv1;
+	sc = dsc->parent;
+	dev = sc->sc_dev;
+
+	if (strcmp(bp->bio_attribute, "CFI::device") == 0) {
+		if (bp->bio_length != sizeof(dev))
+			return (EFAULT);
+		bcopy(&dev, bp->bio_data, sizeof(dev));
+	} else
+		return (-1);
+	return (0);
+}
+
+
 static void
 cfi_disk_strategy(struct bio *bp)
 {

Modified: trunk/sys/dev/cfi/cfi_reg.h
===================================================================
--- trunk/sys/dev/cfi/cfi_reg.h	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cfi/cfi_reg.h	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,7 +1,14 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007, Juniper Networks, Inc.
+ * Copyright (c) 2012-2013, SRI International
  * All rights reserved.
  *
+ * Portions of this software were developed by SRI International and the
+ * University of Cambridge Computer Laboratory under DARPA/AFRL contract
+ * (FA8750-10-C-0237) ("CTSRD"), as part of the DARPA CRASH research
+ * programme.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -26,7 +33,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/cfi/cfi_reg.h 255207 2013-09-04 17:19:21Z brooks $
  */
 
 #ifndef _DEV_CFI_REG_H_
@@ -44,8 +51,8 @@
 	u_char		max_vcc;
 	u_char		min_vpp;
 	u_char		max_vpp;
-	u_char		tto_byte_write;		/* 2**n milliseconds. */
-	u_char		tto_buf_write;		/* 2**n milliseconds. */
+	u_char		tto_byte_write;		/* 2**n microseconds. */
+	u_char		tto_buf_write;		/* 2**n microseconds. */
 	u_char		tto_block_erase;	/* 2**n milliseconds. */
 	u_char		tto_chip_erase;		/* 2**n milliseconds. */
 	u_char		mto_byte_write;		/* 2**n times typical t/o. */
@@ -70,12 +77,15 @@
 #define	CFI_QRY_VEND		offsetof(struct cfi_qry, pri_vend)
 
 #define	CFI_QRY_TTO_WRITE	offsetof(struct cfi_qry, tto_byte_write)
+#define	CFI_QRY_TTO_BUFWRITE	offsetof(struct cfi_qry, tto_buf_write)
 #define	CFI_QRY_TTO_ERASE	offsetof(struct cfi_qry, tto_block_erase)
 #define	CFI_QRY_MTO_WRITE	offsetof(struct cfi_qry, mto_byte_write)
+#define	CFI_QRY_MTO_BUFWRITE	offsetof(struct cfi_qry, mto_buf_write)
 #define	CFI_QRY_MTO_ERASE	offsetof(struct cfi_qry, mto_block_erase)
 
 #define	CFI_QRY_SIZE		offsetof(struct cfi_qry, size)
 #define	CFI_QRY_IFACE		offsetof(struct cfi_qry, iface)
+#define	CFI_QRY_MAXBUF		offsetof(struct cfi_qry, max_buf_write_size)
 #define	CFI_QRY_NREGIONS	offsetof(struct cfi_qry, nregions)
 #define	CFI_QRY_REGION0		offsetof(struct cfi_qry, region)
 #define	CFI_QRY_REGION(x)	(CFI_QRY_REGION0 + (x) * 4)
@@ -102,11 +112,15 @@
 #define	CFI_BCS_ERASE_SUSPEND	0xb0
 #define	CFI_BCS_ERASE_RESUME	0xd0	/* Equals CONFIRM */
 #define	CFI_BCS_CONFIRM		0xd0
+#define	CFI_BCS_BUF_PROG_SETUP	0xe8
 #define	CFI_BCS_READ_ARRAY	0xff
 
 /* Intel commands. */
+#define	CFI_INTEL_LB		0x01	/* Lock Block */
+#define	CFI_INTEL_LBS		0x60	/* Lock Block Setup */
 #define	CFI_INTEL_READ_ID	0x90	/* Read Identifier */
 #define	CFI_INTEL_PP_SETUP	0xc0	/* Protection Program Setup */
+#define	CFI_INTEL_UB		0xd0	/* Unlock Block */
 
 /* NB: these are addresses for 16-bit accesses */
 #define	CFI_INTEL_PLR		0x80	/* Protection Lock Register */

Modified: trunk/sys/dev/cfi/cfi_var.h
===================================================================
--- trunk/sys/dev/cfi/cfi_var.h	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cfi/cfi_var.h	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,7 +1,14 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2007, Juniper Networks, Inc.
+ * Copyright (c) 2012-2013, SRI International
  * All rights reserved.
  *
+ * Portions of this software were developed by SRI International and the
+ * University of Cambridge Computer Laboratory under DARPA/AFRL contract
+ * (FA8750-10-C-0237) ("CTSRD"), as part of the DARPA CRASH research
+ * programme.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -26,12 +33,18 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/sys/dev/cfi/cfi_var.h 255207 2013-09-04 17:19:21Z brooks $
  */
 
 #ifndef _DEV_CFI_VAR_H_
 #define	_DEV_CFI_VAR_H_
 
+enum cfi_wait_cmd {
+	CFI_TIMEOUT_ERASE,
+	CFI_TIMEOUT_WRITE,
+	CFI_TIMEOUT_BUFWRITE
+};
+
 struct cfi_region {
 	u_int		r_blocks;
 	u_int		r_blksz;
@@ -51,13 +64,18 @@
 	struct cfi_region *sc_region;	/* Array of region info. */
 
 	u_int		sc_cmdset;
-	u_int		sc_erase_timeout;
-	u_int		sc_write_timeout;
+	sbintime_t	sc_typical_timeouts[3];
+	sbintime_t	sc_max_timeouts[3];
+	u_int		sc_tto_counts[3];
+	u_int		sc_mto_counts[3];
 
+	u_int		sc_maxbuf;
+
 	struct cdev	*sc_nod;
 	struct proc	*sc_opened;	/* Process that has us opened. */
 
 	u_char		*sc_wrbuf;
+	u_char		*sc_wrbufcpy;
 	u_int		sc_wrbufsz;
 	u_int		sc_wrofs;
 	u_int		sc_writing;
@@ -71,6 +89,7 @@
 int cfi_attach(device_t);
 int cfi_detach(device_t);
 
+uint32_t cfi_read_raw(struct cfi_softc *, u_int);
 uint32_t cfi_read(struct cfi_softc *, u_int);
 uint8_t cfi_read_qry(struct cfi_softc *, u_int);
 int cfi_write_block(struct cfi_softc *);

Modified: trunk/sys/dev/ciss/ciss.c
===================================================================
--- trunk/sys/dev/ciss/ciss.c	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/ciss/ciss.c	2018-05-28 00:21:16 UTC (rev 10124)
@@ -25,7 +25,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$FreeBSD$
+ *	$FreeBSD: stable/10/sys/dev/ciss/ciss.c 315813 2017-03-23 06:41:13Z mav $
  */
 
 /*
@@ -181,8 +181,6 @@
 static void	ciss_cam_poll(struct cam_sim *sim);
 static void	ciss_cam_complete(struct ciss_request *cr);
 static void	ciss_cam_complete_fixup(struct ciss_softc *sc, struct ccb_scsiio *csio);
-static struct cam_periph *ciss_find_periph(struct ciss_softc *sc,
-					   int bus, int target);
 static int	ciss_name_device(struct ciss_softc *sc, int bus, int target);
 
 /* periodic status monitoring */
@@ -339,6 +337,31 @@
     { 0x103C, 0x3354, CISS_BOARD_SA5,   "HP Smart Array P420i" },
     { 0x103C, 0x3355, CISS_BOARD_SA5,   "HP Smart Array P220i" },
     { 0x103C, 0x3356, CISS_BOARD_SA5,   "HP Smart Array P721m" },
+    { 0x103C, 0x1920, CISS_BOARD_SA5,   "HP Smart Array P430i" },
+    { 0x103C, 0x1921, CISS_BOARD_SA5,   "HP Smart Array P830i" },
+    { 0x103C, 0x1922, CISS_BOARD_SA5,   "HP Smart Array P430" },
+    { 0x103C, 0x1923, CISS_BOARD_SA5,   "HP Smart Array P431" },
+    { 0x103C, 0x1924, CISS_BOARD_SA5,   "HP Smart Array P830" },
+    { 0x103C, 0x1926, CISS_BOARD_SA5,   "HP Smart Array P731m" },
+    { 0x103C, 0x1928, CISS_BOARD_SA5,   "HP Smart Array P230i" },
+    { 0x103C, 0x1929, CISS_BOARD_SA5,   "HP Smart Array P530" },
+    { 0x103C, 0x192A, CISS_BOARD_SA5,   "HP Smart Array P531" },
+    { 0x103C, 0x21BD, CISS_BOARD_SA5,   "HP Smart Array P244br" },
+    { 0x103C, 0x21BE, CISS_BOARD_SA5,   "HP Smart Array P741m" },
+    { 0x103C, 0x21BF, CISS_BOARD_SA5,   "HP Smart Array H240ar" },
+    { 0x103C, 0x21C0, CISS_BOARD_SA5,   "HP Smart Array P440ar" },
+    { 0x103C, 0x21C1, CISS_BOARD_SA5,   "HP Smart Array P840ar" },
+    { 0x103C, 0x21C2, CISS_BOARD_SA5,   "HP Smart Array P440" },
+    { 0x103C, 0x21C3, CISS_BOARD_SA5,   "HP Smart Array P441" },
+    { 0x103C, 0x21C5, CISS_BOARD_SA5,   "HP Smart Array P841" },
+    { 0x103C, 0x21C6, CISS_BOARD_SA5,   "HP Smart Array H244br" },
+    { 0x103C, 0x21C7, CISS_BOARD_SA5,   "HP Smart Array H240" },
+    { 0x103C, 0x21C8, CISS_BOARD_SA5,   "HP Smart Array H241" },
+    { 0x103C, 0x21CA, CISS_BOARD_SA5,   "HP Smart Array P246br" },
+    { 0x103C, 0x21CB, CISS_BOARD_SA5,   "HP Smart Array P840" },
+    { 0x103C, 0x21CC, CISS_BOARD_SA5,   "HP Smart Array TBD" },
+    { 0x103C, 0x21CD, CISS_BOARD_SA5,   "HP Smart Array P240nr" },
+    { 0x103C, 0x21CE, CISS_BOARD_SA5,   "HP Smart Array H240nr" },
     { 0, 0, 0, NULL }
 };
 
@@ -443,7 +466,7 @@
     ciss_initq_notify(sc);
 
     /*
-     * Initalize device sysctls.
+     * Initialize device sysctls.
      */
     ciss_init_sysctl(sc);
 
@@ -598,7 +621,7 @@
 	/*
 	 * XXX Big hammer, masks/unmasks all possible interrupts.  This should
 	 * work on all hardware variants.  Need to add code to handle the
-	 * "controller crashed" interupt bit that this unmasks.
+	 * "controller crashed" interrupt bit that this unmasks.
 	 */
 	sqmask = ~0;
     }
@@ -812,7 +835,7 @@
 			   BUS_SPACE_MAXADDR, 		/* highaddr */
 			   NULL, NULL, 			/* filter, filterarg */
 			   BUS_SPACE_MAXSIZE_32BIT,	/* maxsize */
-			   CISS_MAX_SG_ELEMENTS,	/* nsegments */
+			   BUS_SPACE_UNRESTRICTED,	/* nsegments */
 			   BUS_SPACE_MAXSIZE_32BIT,	/* maxsegsize */
 			   0,				/* flags */
 			   NULL, NULL,			/* lockfunc, lockarg */
@@ -830,7 +853,8 @@
 			   BUS_SPACE_MAXADDR,		/* lowaddr */
 			   BUS_SPACE_MAXADDR, 		/* highaddr */
 			   NULL, NULL, 			/* filter, filterarg */
-			   MAXBSIZE, CISS_MAX_SG_ELEMENTS,	/* maxsize, nsegments */
+			   (CISS_MAX_SG_ELEMENTS - 1) * PAGE_SIZE, /* maxsize */
+			   CISS_MAX_SG_ELEMENTS,	/* nsegments */
 			   BUS_SPACE_MAXSIZE_32BIT,	/* maxsegsize */
 			   BUS_DMA_ALLOCNOW,		/* flags */
 			   busdma_lock_mutex, &sc->ciss_mtx,	/* lockfunc, lockarg */
@@ -1199,7 +1223,7 @@
     }
 
     /* sanity-check reply */
-    if (!sc->ciss_id->big_map_supported) {
+    if (!(sc->ciss_id->controller_flags & CONTROLLER_FLAGS_BIG_MAP_SUPPORT)) {
 	ciss_printf(sc, "adapter does not support BIG_MAP\n");
 	error = ENXIO;
 	goto out;
@@ -1229,7 +1253,7 @@
 		    sc->ciss_id->configured_logical_drives,
 		    (sc->ciss_id->configured_logical_drives == 1) ? "" : "s");
 	ciss_printf(sc, "  firmware %4.4s\n", sc->ciss_id->running_firmware_revision);
-	ciss_printf(sc, "  %d SCSI channels\n", sc->ciss_id->scsi_bus_count);
+	ciss_printf(sc, "  %d SCSI channels\n", sc->ciss_id->scsi_chip_count);
 
 	ciss_printf(sc, "  signature '%.4s'\n", sc->ciss_cfg->signature);
 	ciss_printf(sc, "  valence %d\n", sc->ciss_cfg->valence);
@@ -1253,6 +1277,10 @@
     	ciss_printf(sc, "  max logical logical volumes: %d\n", sc->ciss_cfg->max_logical_supported);
     	ciss_printf(sc, "  max physical disks supported: %d\n", sc->ciss_cfg->max_physical_supported);
     	ciss_printf(sc, "  max physical disks per logical volume: %d\n", sc->ciss_cfg->max_physical_per_logical);
+	ciss_printf(sc, "  JBOD Support is %s\n", (sc->ciss_id->uiYetMoreControllerFlags & YMORE_CONTROLLER_FLAGS_JBOD_SUPPORTED) ?
+			"Available" : "Unavailable");
+	ciss_printf(sc, "  JBOD Mode is %s\n", (sc->ciss_id->PowerUPNvramFlags & PWR_UP_FLAG_JBOD_ENABLED) ?
+			"Enabled" : "Disabled");
     }
 
 out:
@@ -1405,7 +1433,7 @@
 	goto out;
     }
 
-    for (i = 0; i <= sc->ciss_max_logical_bus; i++) {
+    for (i = 0; i < sc->ciss_max_logical_bus; i++) {
 	sc->ciss_logical[i] =
 	    malloc(sc->ciss_cfg->max_logical_supported *
 		   sizeof(struct ciss_ldrive),
@@ -2004,7 +2032,7 @@
     if (sc->ciss_parent_dmat)
 	bus_dma_tag_destroy(sc->ciss_parent_dmat);
     if (sc->ciss_logical) {
-	for (i = 0; i <= sc->ciss_max_logical_bus; i++) {
+	for (i = 0; i < sc->ciss_max_logical_bus; i++) {
 	    for (j = 0; j < sc->ciss_cfg->max_logical_supported; j++) {
 		if (sc->ciss_logical[i][j].cl_ldrive)
 		    free(sc->ciss_logical[i][j].cl_ldrive, CISS_MALLOC_CLASS);
@@ -2389,7 +2417,8 @@
 	return(error);
 
     while ((cr->cr_flags & CISS_REQ_SLEEP) && (error != EWOULDBLOCK)) {
-	error = msleep(cr, &cr->cr_sc->ciss_mtx, PRIBIO, "cissREQ", (timeout * hz) / 1000);
+	error = msleep_sbt(cr, &cr->cr_sc->ciss_mtx, PRIBIO, "cissREQ",
+	    SBT_1MS * timeout, 0, 0);
     }
     return(error);
 }
@@ -2488,6 +2517,7 @@
     cc->header.sg_total = 0;
     cc->header.host_tag = cr->cr_tag << 2;
     cc->header.host_tag_zeroes = 0;
+    bzero(&(cc->sg[0]), CISS_COMMAND_ALLOC_SIZE - sizeof(struct ciss_command));
     cmdphys = cr->cr_ccphys;
     cc->error_info.error_info_address = cmdphys + sizeof(struct ciss_command);
     cc->error_info.error_info_length = CISS_COMMAND_ALLOC_SIZE - sizeof(struct ciss_command);
@@ -2698,9 +2728,14 @@
 		    BUS_DMASYNC_PREWRITE);
 
     if (cr->cr_data != NULL) {
-	error = bus_dmamap_load(sc->ciss_buffer_dmat, cr->cr_datamap,
-				cr->cr_data, cr->cr_length,
-				ciss_request_map_helper, cr, 0);
+	if (cr->cr_flags & CISS_REQ_CCB)
+		error = bus_dmamap_load_ccb(sc->ciss_buffer_dmat,
+					cr->cr_datamap, cr->cr_data,
+					ciss_request_map_helper, cr, 0);
+	else
+		error = bus_dmamap_load(sc->ciss_buffer_dmat, cr->cr_datamap,
+					cr->cr_data, cr->cr_length,
+					ciss_request_map_helper, cr, 0);
 	if (error != 0)
 	    return (error);
     } else {
@@ -2909,7 +2944,7 @@
 	return;
     }
 
-    if (xpt_create_path(&ccb->ccb_h.path, xpt_periph,
+    if (xpt_create_path(&ccb->ccb_h.path, NULL,
 	    cam_sim_path(sc->ciss_cam_sim[bus]),
 	    target, CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
 	ciss_printf(sc, "rescan failed (can't create path)\n");
@@ -2981,6 +3016,7 @@
     case XPT_PATH_INQ:
     {
 	struct ccb_pathinq	*cpi = &ccb->cpi;
+	int			sg_length;
 
 	debug(1, "XPT_PATH_INQ %d:%d:%d", cam_sim_bus(sim), ccb->ccb_h.target_id, ccb->ccb_h.target_lun);
 
@@ -2991,9 +3027,9 @@
 	cpi->max_target = sc->ciss_cfg->max_logical_supported;
 	cpi->max_lun = 0;		/* 'logical drive' channel only */
 	cpi->initiator_id = sc->ciss_cfg->max_logical_supported;
-	strncpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
-        strncpy(cpi->hba_vid, "msmith at freebsd.org", HBA_IDLEN);
-        strncpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
+	strlcpy(cpi->sim_vid, "FreeBSD", SIM_IDLEN);
+        strlcpy(cpi->hba_vid, "CISS", HBA_IDLEN);
+        strlcpy(cpi->dev_name, cam_sim_name(sim), DEV_IDLEN);
         cpi->unit_number = cam_sim_unit(sim);
         cpi->bus_id = cam_sim_bus(sim);
 	cpi->base_transfer_speed = 132 * 1024;	/* XXX what to set this to? */
@@ -3001,7 +3037,22 @@
 	cpi->transport_version = 2;
 	cpi->protocol = PROTO_SCSI;
 	cpi->protocol_version = SCSI_REV_2;
-	cpi->maxio = (CISS_MAX_SG_ELEMENTS - 1) * PAGE_SIZE;
+	if (sc->ciss_cfg->max_sg_length == 0) {
+		sg_length = 17;
+	} else {
+	/* XXX Fix for ZMR cards that advertise max_sg_length == 32
+	 * Confusing bit here. max_sg_length is usually a power of 2. We always
+	 * need to subtract 1 to account for partial pages. Then we need to 
+	 * align on a valid PAGE_SIZE so we round down to the nearest power of 2. 
+	 * Add 1 so we can then subtract it out in the assignment to maxio.
+	 * The reason for all these shenanigans is to create a maxio value that
+	 * creates IO operations to volumes that yield consistent operations
+	 * with good performance.
+	 */
+		sg_length = sc->ciss_cfg->max_sg_length - 1;
+		sg_length = (1 << (fls(sg_length) - 1)) + 1;
+	}
+	cpi->maxio = (min(CISS_MAX_SG_ELEMENTS, sg_length) - 1) * PAGE_SIZE;
 	ccb->ccb_h.status = CAM_REQ_CMP;
 	break;
     }
@@ -3066,18 +3117,6 @@
 	csio->ccb_h.status = CAM_REQ_CMP_ERR;
     }
 
-    /* if there is data transfer, it must be to/from a virtual address */
-    if ((csio->ccb_h.flags & CAM_DIR_MASK) != CAM_DIR_NONE) {
-	if (csio->ccb_h.flags & CAM_DATA_PHYS) {		/* we can't map it */
-	    debug(3, "  data pointer is to physical address");
-	    csio->ccb_h.status = CAM_REQ_CMP_ERR;
-	}
-	if (csio->ccb_h.flags & CAM_SCATTER_VALID) {	/* we want to do the s/g setup */
-	    debug(3, "  data has premature s/g setup");
-	    csio->ccb_h.status = CAM_REQ_CMP_ERR;
-	}
-    }
-
     /* abandon aborted ccbs or those that have failed validation */
     if ((csio->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_INPROG) {
 	debug(3, "abandoning CCB due to abort/validation failure");
@@ -3104,7 +3143,7 @@
      * Build the command.
      */
     cc = cr->cr_cc;
-    cr->cr_data = csio->data_ptr;
+    cr->cr_data = csio;
     cr->cr_length = csio->dxfer_len;
     cr->cr_complete = ciss_cam_complete;
     cr->cr_private = csio;
@@ -3122,12 +3161,13 @@
     cc->cdb.type = CISS_CDB_TYPE_COMMAND;
     cc->cdb.attribute = CISS_CDB_ATTRIBUTE_SIMPLE;	/* XXX ordered tags? */
     if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT) {
-	cr->cr_flags = CISS_REQ_DATAOUT;
+	cr->cr_flags = CISS_REQ_DATAOUT | CISS_REQ_CCB;
 	cc->cdb.direction = CISS_CDB_DIRECTION_WRITE;
     } else if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
-	cr->cr_flags = CISS_REQ_DATAIN;
+	cr->cr_flags = CISS_REQ_DATAIN | CISS_REQ_CCB;
 	cc->cdb.direction = CISS_CDB_DIRECTION_READ;
     } else {
+	cr->cr_data = NULL;
 	cr->cr_flags = 0;
 	cc->cdb.direction = CISS_CDB_DIRECTION_NONE;
     }
@@ -3355,67 +3395,63 @@
 	bus = cam_sim_bus(xpt_path_sim(csio->ccb_h.path));
 
 	/*
-	 * Don't let hard drives be seen by the DA driver.  They will still be
-	 * attached by the PASS driver.
+	 * If the controller is in JBOD mode, there are no logical volumes.
+	 * Let the disks be probed and dealt with via CAM.  Else, mask off 
+	 * the physical disks and setup the parts of the inq structure for
+	 * the logical volume.  swb
 	 */
-	if (CISS_IS_PHYSICAL(bus)) {
-	    if (SID_TYPE(inq) == T_DIRECT)
-		inq->device = (inq->device & 0xe0) | T_NODEVICE;
-	    return;
+	if( !(sc->ciss_id->PowerUPNvramFlags & PWR_UP_FLAG_JBOD_ENABLED)){
+		if (CISS_IS_PHYSICAL(bus)) {
+	    		if (SID_TYPE(inq) == T_DIRECT)
+				inq->device = (inq->device & 0xe0) | T_NODEVICE;
+	    		return;
+		}
+		cl = &sc->ciss_logical[bus][target];
+
+		padstr(inq->vendor, "HP",
+	       		SID_VENDOR_SIZE);
+		padstr(inq->product,
+	       		ciss_name_ldrive_org(cl->cl_ldrive->fault_tolerance),
+	       		SID_PRODUCT_SIZE);
+		padstr(inq->revision,
+	       		ciss_name_ldrive_status(cl->cl_lstatus->status),
+	       		SID_REVISION_SIZE);
 	}
-
-	cl = &sc->ciss_logical[bus][target];
-
-	padstr(inq->vendor, "COMPAQ",
-	       SID_VENDOR_SIZE);
-	padstr(inq->product,
-	       ciss_name_ldrive_org(cl->cl_ldrive->fault_tolerance),
-	       SID_PRODUCT_SIZE);
-	padstr(inq->revision,
-	       ciss_name_ldrive_status(cl->cl_lstatus->status),
-	       SID_REVISION_SIZE);
     }
 }
 
 
 /********************************************************************************
- * Find a peripheral attached at (target)
+ * Name the device at (target)
+ *
+ * XXX is this strictly correct?
  */
-static struct cam_periph *
-ciss_find_periph(struct ciss_softc *sc, int bus, int target)
+static int
+ciss_name_device(struct ciss_softc *sc, int bus, int target)
 {
     struct cam_periph	*periph;
     struct cam_path	*path;
     int			status;
 
+    if (CISS_IS_PHYSICAL(bus))
+	return (0);
+
     status = xpt_create_path(&path, NULL, cam_sim_path(sc->ciss_cam_sim[bus]),
 			     target, 0);
+
     if (status == CAM_REQ_CMP) {
+	mtx_lock(&sc->ciss_mtx);
+	xpt_path_lock(path);
 	periph = cam_periph_find(path, NULL);
+	xpt_path_unlock(path);
+	mtx_unlock(&sc->ciss_mtx);
 	xpt_free_path(path);
-    } else {
-	periph = NULL;
+	if (periph != NULL) {
+		sprintf(sc->ciss_logical[bus][target].cl_name, "%s%d",
+			periph->periph_name, periph->unit_number);
+		return(0);
+	}
     }
-    return(periph);
-}
-
-/********************************************************************************
- * Name the device at (target)
- *
- * XXX is this strictly correct?
- */
-static int
-ciss_name_device(struct ciss_softc *sc, int bus, int target)
-{
-    struct cam_periph	*periph;
-
-    if (CISS_IS_PHYSICAL(bus))
-	return (0);
-    if ((periph = ciss_find_periph(sc, bus, target)) != NULL) {
-	sprintf(sc->ciss_logical[bus][target].cl_name, "%s%d",
-		periph->periph_name, periph->unit_number);
-	return(0);
-    }
     sc->ciss_logical[bus][target].cl_name[0] = 0;
     return(ENOENT);
 }
@@ -3984,8 +4020,7 @@
 ciss_notify_logical(struct ciss_softc *sc, struct ciss_notify *cn)
 {
     struct ciss_ldrive	*ld;
-    int			bus, target;
-    int			rescan_ld;
+    int			ostatus, bus, target;
 
     debug_called(2);
 
@@ -4008,6 +4043,7 @@
 	    /*
 	     * Update our idea of the drive's status.
 	     */
+	    ostatus = ciss_decode_ldrive_status(cn->data.logical_status.previous_state);
 	    ld->cl_status = ciss_decode_ldrive_status(cn->data.logical_status.new_state);
 	    if (ld->cl_lstatus != NULL)
 		ld->cl_lstatus->status = cn->data.logical_status.new_state;
@@ -4015,9 +4051,7 @@
 	    /*
 	     * Have CAM rescan the drive if its status has changed.
 	     */
-            rescan_ld = (cn->data.logical_status.previous_state !=
-                         cn->data.logical_status.new_state) ? 1 : 0;
-	    if (rescan_ld) {
+	    if (ostatus != ld->cl_status) {
 		ld->cl_update = 1;
 		ciss_notify_rescan_logical(sc);
 	    }
@@ -4368,11 +4402,17 @@
 DB_COMMAND(ciss_prt, db_ciss_prt)
 {
     struct ciss_softc	*sc;
+    devclass_t dc;
+    int maxciss, i;
 
-    sc = devclass_get_softc(devclass_find("ciss"), 0);
-    if (sc == NULL) {
-	printf("no ciss controllers\n");
-    } else {
+    dc = devclass_find("ciss");
+    if ( dc == NULL ) {
+        printf("%s: can't find devclass!\n", __func__);
+        return;
+    }
+    maxciss = devclass_get_maxunit(dc);
+    for (i = 0; i < maxciss; i++) {
+        sc = devclass_get_softc(dc, i);
 	ciss_print_adapter(sc);
     }
 }
@@ -4461,7 +4501,7 @@
     case CISS_LDRIVE_RAIDADG:
 	return("RAID ADG");
     }
-    return("unkown");
+    return("unknown");
 }
 
 /************************************************************************

Modified: trunk/sys/dev/ciss/cissio.h
===================================================================
--- trunk/sys/dev/ciss/cissio.h	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/ciss/cissio.h	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,4 +1,4 @@
-/* $MidnightBSD: src/sys/dev/ciss/cissio.h,v 1.2 2008/12/02 02:24:38 laffer1 Exp $ */
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2001 Michael Smith
  * All rights reserved.
@@ -24,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$FreeBSD$
+ *	$FreeBSD: stable/10/sys/dev/ciss/cissio.h 180454 2008-07-11 21:20:51Z scottl $
  */
 
 /*

Modified: trunk/sys/dev/ciss/cissreg.h
===================================================================
--- trunk/sys/dev/ciss/cissreg.h	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/ciss/cissreg.h	2018-05-28 00:21:16 UTC (rev 10124)
@@ -24,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$FreeBSD$
+ *	$FreeBSD: stable/10/sys/dev/ciss/cissreg.h 268955 2014-07-21 20:08:53Z sbruno $
  */
 
 /*
@@ -616,26 +616,124 @@
     char	running_firmware_revision[4];
     char	stored_firmware_revision[4];
     u_int8_t	hardware_revision;
-    u_int8_t	res1[4];
+    u_int8_t	boot_block_revision[4];
     u_int32_t	deprecated_drive_present_map;
     u_int32_t	deprecated_external_drive_present_map;
     u_int32_t	board_id;
-    u_int8_t	res2;
+    u_int8_t	swapped_error_cable;
     u_int32_t	deprecated_non_disk_map;
-    u_int8_t	res3[5];
+    u_int8_t	bad_host_ram_addr;
+    u_int8_t	cpu_revision;
+    u_int8_t	res3[3];
     char	marketting_revision;
-    u_int8_t	res4:3;
-    u_int8_t	more_than_seven_supported:1;
-    u_int8_t	res5:3;
-    u_int8_t	big_map_supported:1;		/* must be set! */
-    u_int8_t	res6[2];
-    u_int8_t	scsi_bus_count;
-    u_int32_t	res7;
+    u_int8_t	controller_flags;
+#define	CONTROLLER_FLAGS_FLASH_ROM_INSTALLED	0x01
+#define	CONTROLLER_FLAGS_DIAGS_MODE_BIT		0x02
+#define	CONTROLLER_FLAGS_EXPAND_32MB_FX 	0x04
+#define	CONTROLLER_FLAGS_MORE_THAN_7_SUPPORT 	0x08
+#define	CONTROLLER_FLAGS_DAISY_SUPPORT_BIT 	0x10
+#define	CONTROLLER_FLAGS_RES6 			0x20
+#define	CONTROLLER_FLAGS_RES7 			0x40
+#define	CONTROLLER_FLAGS_BIG_MAP_SUPPORT 	0x80
+    u_int8_t	host_flags;
+#define HOST_FLAGS_SDB_ASIC_WORK_AROUND 	0x01
+#define HOST_FLAGS_PCI_DATA_BUS_PARITY_SUPPORT	0x02
+#define HOST_FLAGS_RES3				0x04
+#define HOST_FLAGS_RES4				0x08
+#define HOST_FLAGS_RES5				0x10
+#define HOST_FLAGS_RES6				0x20
+#define HOST_FLAGS_RES7				0x30
+#define HOST_FLAGS_RES8				0x40
+    u_int8_t	expand_disable_code;
+#define EXPAND_DISABLE_NOT_NEEDED		0x01
+#define EXPAND_DISABLE_MISSING_CACHE_BOARD	0x02
+#define EXPAND_DISABLE_WCXC_FATAL_CACHE_BITS	0x04
+#define EXPAND_DISABLE_CACHE_PERM_DISABLED	0x08
+#define EXPAND_DISABLE_RAM_ALLOCATION_FAILED	0x10
+#define EXPAND_DISABLE_BATTEREIS_DISCHARGED	0x20
+#define EXPAND_DISABLE_RES7			0x40
+#define EXPAND_DISABLE_REBUILD_RUNNING		0x80
+    u_int8_t	scsi_chip_count;
+    u_int32_t	maximum_blocks;
     u_int32_t	controller_clock;
     u_int8_t	drives_per_scsi_bus;
     u_int8_t	big_drive_present_map[CISS_BIG_MAP_ENTRIES / 8];
     u_int8_t	big_external_drive_present_map[CISS_BIG_MAP_ENTRIES / 8];
     u_int8_t	big_non_disk_map[CISS_BIG_MAP_ENTRIES / 8];
+
+    u_int16_t	task_flags;		/* used for FW debugging */
+    u_int8_t	ICL_bus_map;		/* Bitmap used for ICL between controllers */
+    u_int8_t	redund_ctlr_modes_support;	/* See REDUNDANT MODE VALUES */
+    u_int8_t	curr_redund_ctlr_mode;
+    u_int8_t	redund_ctlr_status;
+    u_int8_t	redund_op_failure_code;
+
+    u_int8_t	unsupported_nile_bus;
+    u_int8_t	host_i2c_autorev;
+    u_int8_t	cpld_revision;
+    u_int8_t	fibre_chip_count;
+    u_int8_t	daughterboard_type;
+    u_int8_t	more_swapped_config_cable_error;
+
+    u_int8_t	license_key_status;
+    u_int8_t	access_module_status;
+    u_int8_t	features_supported[12];
+    u_int8_t	rec_rom_inact_rev[4];    /* Recovery ROM inactive f/w revision  */
+    u_int8_t	rec_rom_act_status;      /* Recovery ROM flags                  */
+    u_int8_t	pci_to_pci_status;       /* PCI to PCI bridge status            */
+    u_int32_t	redundant_server_info;   /* Reserved for future use             */
+    u_int8_t	percent_write_cache;     /* Percent of memory allocated to write cache */
+    u_int16_t	daughterboard_size_mb;   /* Total size (MB) of cache board      */
+    u_int8_t	cache_batter_count;      /* Number of cache batteries           */
+    u_int16_t	total_controller_mem_mb; /* Total size (MB) of atttached memory */
+    u_int8_t	more_controller_flags;   /* Additional controller flags byte    */
+    u_int8_t	x_board_host_i2c_rev;    /* 2nd byte of 3 byte autorev field    */
+    u_int8_t	battery_pic_rev;         /* BBWC PIC revision                   */
+/*
+ * Below here I have no documentation on the rest of this data structure.  It is
+ * inferred from the opensource cciss_vol_status application.  I assume that this 
+ * data strucutre is 512 bytes in total size, do not exceed it.
+ */
+    u_int8_t	bDdffVersion[4];         /* DDFF update engine version          */
+    u_int16_t	usMaxLogicalUnits;       /* Maximum logical units supported */
+    u_int16_t	usExtLogicalUnitCount;   /* Big num configured logical units */
+    u_int16_t	usMaxPhysicalDevices;    /* Maximum physical devices supported */
+    u_int16_t	usMaxPhyDrvPerLogicalUnit; /* Max physical drive per logical unit */
+    u_int8_t	bEnclosureCount;         /* Number of attached enclosures */
+    u_int8_t	bExpanderCount;          /* Number of expanders detected */
+    u_int16_t	usOffsetToEDPbitmap;     /* Offset to extended drive present map*/
+    u_int16_t	usOffsetToEEDPbitmap;    /* Offset to extended external drive present map */
+    u_int16_t	usOffsetToENDbitmap;     /* Offset to extended non-disk map */
+    u_int8_t	bInternalPortStatus[8];  /* Internal port status bytes */
+    u_int8_t	bExternalPortStatus[8];  /* External port status bytes */
+    u_int32_t	uiYetMoreControllerFlags;/* Yet More Controller flags  */
+#define YMORE_CONTROLLER_FLAGS_JBOD_SUPPORTED \
+	( 1 << 25 )			 /* Controller has JBOD support */
+
+    u_int8_t	bLastLockup;              /* Last lockup code */
+    u_int8_t	bSlot;                    /* PCI slot according to option ROM*/
+    u_int16_t	usBuildNum;               /* Build number */
+    u_int32_t	uiMaxSafeFullStripeSize;  /* Maximum safe full stripe size */
+    u_int32_t	uiTotalLength;            /* Total structure length */
+    u_int8_t	bVendorID[8];             /* Vendor ID */
+    u_int8_t	bProductID[16];           /* Product ID */
+/*
+ * These are even more obscure as they seem to only be available in cciss_vol_status
+ */
+    u_int32_t	ExtendedLastLockupCode;
+    u_int16_t	MaxRaid;
+    u_int16_t	MaxParity;
+    u_int16_t	MaxADGStripSize;
+    u_int16_t	YetMoreSwappedCables;
+    u_int8_t	MaxDevicePaths;
+    u_int8_t	PowerUPNvramFlags;
+#define PWR_UP_FLAG_JBOD_ENABLED	0x08	/*JBOD mode is enabled, all RAID features off */
+
+    u_int16_t	ZonedOffset;
+    u_int32_t   FixedFieldsLength;
+    u_int8_t	FWCompileTimeStamp[24];
+    u_int32_t	EvenMoreControllerFlags;
+    u_int8_t	padding[240];
 } __packed;
 
 /* CISS_BMIC_ID_PDRIVE */

Modified: trunk/sys/dev/ciss/cissvar.h
===================================================================
--- trunk/sys/dev/ciss/cissvar.h	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/ciss/cissvar.h	2018-05-28 00:21:16 UTC (rev 10124)
@@ -24,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$FreeBSD$
+ *	$FreeBSD: stable/10/sys/dev/ciss/cissvar.h 246713 2013-02-12 16:57:20Z kib $
  */
 
 /*
@@ -117,6 +117,7 @@
 #define CISS_REQ_DATAOUT	(1<<3)		/* data host->adapter */
 #define CISS_REQ_DATAIN		(1<<4)		/* data adapter->host */
 #define CISS_REQ_BUSY		(1<<5)		/* controller has req */
+#define CISS_REQ_CCB		(1<<6)		/* data is ccb */
 
     void			(* cr_complete)(struct ciss_request *);
     void			*cr_private;

Modified: trunk/sys/dev/cm/if_cm_isa.c
===================================================================
--- trunk/sys/dev/cm/if_cm_isa.c	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cm/if_cm_isa.c	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,8 +1,8 @@
-/* $MidnightBSD: src/sys/dev/cm/if_cm_isa.c,v 1.2 2008/12/02 02:24:38 laffer1 Exp $ */
+/* $MidnightBSD$ */
 /*	$NetBSD: if_bah_zbus.c,v 1.6 2000/01/23 21:06:12 aymeric Exp $ */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/cm/if_cm_isa.c 204520 2010-03-01 16:52:11Z joel $");
 
 /*-
  * Copyright (c) 1994, 1995, 1998 The NetBSD Foundation, Inc.

Modified: trunk/sys/dev/cm/smc90cx6.c
===================================================================
--- trunk/sys/dev/cm/smc90cx6.c	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cm/smc90cx6.c	2018-05-28 00:21:16 UTC (rev 10124)
@@ -2,7 +2,7 @@
 /*	$NetBSD: smc90cx6.c,v 1.38 2001/07/07 15:57:53 thorpej Exp $ */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/cm/smc90cx6.c 243857 2012-12-04 09:32:43Z glebius $");
 
 /*-
  * Copyright (c) 1994, 1995, 1998 The NetBSD Foundation, Inc.
@@ -597,7 +597,7 @@
 	}
 }
 
-__inline static void
+static inline void
 cm_tint_locked(sc, isr)
 	struct cm_softc *sc;
 	int isr;

Modified: trunk/sys/dev/cm/smc90cx6reg.h
===================================================================
--- trunk/sys/dev/cm/smc90cx6reg.h	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cm/smc90cx6reg.h	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,6 +1,6 @@
-/* $MidnightBSD: src/sys/dev/cm/smc90cx6reg.h,v 1.2 2008/12/02 02:24:38 laffer1 Exp $ */
+/* $MidnightBSD$ */
 /*	$NetBSD: smc90cx6reg.h,v 1.7 1999/02/16 23:34:13 is Exp $ */
-/*	$FreeBSD$ */
+/*	$FreeBSD: stable/10/sys/dev/cm/smc90cx6reg.h 204520 2010-03-01 16:52:11Z joel $ */
 
 /*-
  * Copyright (c) 1994, 1995, 1998 The NetBSD Foundation, Inc.

Modified: trunk/sys/dev/cm/smc90cx6var.h
===================================================================
--- trunk/sys/dev/cm/smc90cx6var.h	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cm/smc90cx6var.h	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,6 +1,6 @@
-/* $MidnightBSD: src/sys/dev/cm/smc90cx6var.h,v 1.2 2008/12/02 02:24:38 laffer1 Exp $ */
+/* $MidnightBSD$ */
 /*	$NetBSD: smc90cx6var.h,v 1.5 2000/03/23 07:01:32 thorpej Exp $	*/
-/*	$FreeBSD$ */
+/*	$FreeBSD: stable/10/sys/dev/cm/smc90cx6var.h 204520 2010-03-01 16:52:11Z joel $ */
 
 /*-
  * Copyright (c) 1994, 1995, 1998 The NetBSD Foundation, Inc.

Modified: trunk/sys/dev/cmx/cmx.c
===================================================================
--- trunk/sys/dev/cmx/cmx.c	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cmx/cmx.c	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2006-2007 Daniel Roethlisberger <daniel at roe.ch>
  * Copyright (c) 2000-2004 OMNIKEY GmbH (www.omnikey.com)
@@ -27,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/cmx/cmx.c 176868 2008-03-06 08:09:45Z rink $");
 
 /*
  * OMNIKEY CardMan 4040 a.k.a. CardMan eXtended (cmx) driver.

Modified: trunk/sys/dev/cmx/cmx_pccard.c
===================================================================
--- trunk/sys/dev/cmx/cmx_pccard.c	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cmx/cmx_pccard.c	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2006-2007 Daniel Roethlisberger <daniel at roe.ch>
  * All rights reserved.
@@ -26,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/sys/dev/cmx/cmx_pccard.c 176868 2008-03-06 08:09:45Z rink $");
 
 #include <sys/param.h>
 #include <sys/systm.h>

Modified: trunk/sys/dev/cmx/cmxreg.h
===================================================================
--- trunk/sys/dev/cmx/cmxreg.h	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cmx/cmxreg.h	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2006-2007 Daniel Roethlisberger <daniel at roe.ch>
  * Copyright (c) 2000-2004 OMNIKEY GmbH (www.omnikey.com)
@@ -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/cmx/cmxreg.h 176868 2008-03-06 08:09:45Z rink $
  */
 
 /* I/O port registers */

Modified: trunk/sys/dev/cmx/cmxvar.h
===================================================================
--- trunk/sys/dev/cmx/cmxvar.h	2018-05-28 00:20:56 UTC (rev 10123)
+++ trunk/sys/dev/cmx/cmxvar.h	2018-05-28 00:21:16 UTC (rev 10124)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2006-2007 Daniel Roethlisberger <daniel at roe.ch>
  * 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/cmx/cmxvar.h 176868 2008-03-06 08:09:45Z rink $
  */
 
 /*#define	CMX_DEBUG*/



More information about the Midnightbsd-cvs mailing list