svn commit: r310320 - stable/10/lib/libc/gen

2016-12-19 Thread Ed Schouten
Author: ed
Date: Tue Dec 20 07:50:49 2016
New Revision: 310320
URL: https://svnweb.freebsd.org/changeset/base/310320

Log:
  MFC r309650:
  
Properly sign extend the result of jrand48() and mrand48().
  
These functions are supposed to return a value between [-2^31, 2^31).
This doesn't seem to work on 64-bit systems, where we return a value
between [0, 3^32). Patch up the function to use proper casts to int32_t.
While there, fix some other style bugs.

Modified:
  stable/10/lib/libc/gen/jrand48.c
  stable/10/lib/libc/gen/mrand48.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/gen/jrand48.c
==
--- stable/10/lib/libc/gen/jrand48.cTue Dec 20 07:42:15 2016
(r310319)
+++ stable/10/lib/libc/gen/jrand48.cTue Dec 20 07:50:49 2016
(r310320)
@@ -14,11 +14,14 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include 
+
 #include "rand48.h"
 
 long
 jrand48(unsigned short xseed[3])
 {
+
_dorand48(xseed);
-   return ((long) xseed[2] << 16) + (long) xseed[1];
+   return ((int32_t)(((uint32_t)xseed[2] << 16) | (uint32_t)xseed[1]));
 }

Modified: stable/10/lib/libc/gen/mrand48.c
==
--- stable/10/lib/libc/gen/mrand48.cTue Dec 20 07:42:15 2016
(r310319)
+++ stable/10/lib/libc/gen/mrand48.cTue Dec 20 07:50:49 2016
(r310320)
@@ -14,6 +14,8 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include 
+
 #include "rand48.h"
 
 extern unsigned short _rand48_seed[3];
@@ -21,6 +23,8 @@ extern unsigned short _rand48_seed[3];
 long
 mrand48(void)
 {
+
_dorand48(_rand48_seed);
-   return ((long) _rand48_seed[2] << 16) + (long) _rand48_seed[1];
+   return ((int32_t)(((uint32_t)_rand48_seed[2] << 16) |
+   (uint32_t)_rand48_seed[1]));
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310319 - stable/11/lib/libc/gen

2016-12-19 Thread Ed Schouten
Author: ed
Date: Tue Dec 20 07:42:15 2016
New Revision: 310319
URL: https://svnweb.freebsd.org/changeset/base/310319

Log:
  MFC r309650:
  
Properly sign extend the result of jrand48() and mrand48().
  
These functions are supposed to return a value between [-2^31, 2^31).
This doesn't seem to work on 64-bit systems, where we return a value
between [0, 3^32). Patch up the function to use proper casts to int32_t.
While there, fix some other style bugs.

Modified:
  stable/11/lib/libc/gen/jrand48.c
  stable/11/lib/libc/gen/mrand48.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/gen/jrand48.c
==
--- stable/11/lib/libc/gen/jrand48.cTue Dec 20 07:34:44 2016
(r310318)
+++ stable/11/lib/libc/gen/jrand48.cTue Dec 20 07:42:15 2016
(r310319)
@@ -14,11 +14,14 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include 
+
 #include "rand48.h"
 
 long
 jrand48(unsigned short xseed[3])
 {
+
_dorand48(xseed);
-   return ((long) xseed[2] << 16) + (long) xseed[1];
+   return ((int32_t)(((uint32_t)xseed[2] << 16) | (uint32_t)xseed[1]));
 }

Modified: stable/11/lib/libc/gen/mrand48.c
==
--- stable/11/lib/libc/gen/mrand48.cTue Dec 20 07:34:44 2016
(r310318)
+++ stable/11/lib/libc/gen/mrand48.cTue Dec 20 07:42:15 2016
(r310319)
@@ -14,6 +14,8 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include 
+
 #include "rand48.h"
 
 extern unsigned short _rand48_seed[3];
@@ -21,6 +23,8 @@ extern unsigned short _rand48_seed[3];
 long
 mrand48(void)
 {
+
_dorand48(_rand48_seed);
-   return ((long) _rand48_seed[2] << 16) + (long) _rand48_seed[1];
+   return ((int32_t)(((uint32_t)_rand48_seed[2] << 16) |
+   (uint32_t)_rand48_seed[1]));
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310318 - head/sys/dev/hyperv/utilities

2016-12-19 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Dec 20 07:34:44 2016
New Revision: 310318
URL: https://svnweb.freebsd.org/changeset/base/310318

Log:
  hyperv/ic: Cleanup driver glue.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8849

Modified:
  head/sys/dev/hyperv/utilities/hv_heartbeat.c
  head/sys/dev/hyperv/utilities/hv_shutdown.c
  head/sys/dev/hyperv/utilities/hv_timesync.c

Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c
==
--- head/sys/dev/hyperv/utilities/hv_heartbeat.cTue Dec 20 07:14:24 
2016(r310317)
+++ head/sys/dev/hyperv/utilities/hv_heartbeat.cTue Dec 20 07:34:44 
2016(r310318)
@@ -46,6 +46,9 @@ __FBSDID("$FreeBSD$");
 #define VMBUS_HEARTBEAT_MSGVER \
VMBUS_IC_VERSION(VMBUS_HEARTBEAT_MSGVER_MAJOR, 0)
 
+static int vmbus_heartbeat_probe(device_t);
+static int vmbus_heartbeat_attach(device_t);
+
 static const struct vmbus_ic_desc vmbus_heartbeat_descs[] = {
{
.ic_guid = { .hv_guid = {
@@ -56,6 +59,27 @@ static const struct vmbus_ic_desc vmbus_
VMBUS_IC_DESC_END
 };
 
+static device_method_t vmbus_heartbeat_methods[] = {
+   /* Device interface */
+   DEVMETHOD(device_probe, vmbus_heartbeat_probe),
+   DEVMETHOD(device_attach,vmbus_heartbeat_attach),
+   DEVMETHOD(device_detach,vmbus_ic_detach),
+   DEVMETHOD_END
+};
+
+static driver_t vmbus_heartbeat_driver = {
+   "hvheartbeat",
+   vmbus_heartbeat_methods,
+   sizeof(struct vmbus_ic_softc)
+};
+
+static devclass_t vmbus_heartbeat_devclass;
+
+DRIVER_MODULE(hv_heartbeat, vmbus, vmbus_heartbeat_driver,
+vmbus_heartbeat_devclass, NULL, NULL);
+MODULE_VERSION(hv_heartbeat, 1);
+MODULE_DEPEND(hv_heartbeat, vmbus, 1, 1, 1);
+
 static void
 vmbus_heartbeat_cb(struct vmbus_channel *chan, void *xsc)
 {
@@ -114,35 +138,15 @@ vmbus_heartbeat_cb(struct vmbus_channel 
 }
 
 static int
-hv_heartbeat_probe(device_t dev)
+vmbus_heartbeat_probe(device_t dev)
 {
 
return (vmbus_ic_probe(dev, vmbus_heartbeat_descs));
 }
 
 static int
-hv_heartbeat_attach(device_t dev)
+vmbus_heartbeat_attach(device_t dev)
 {
 
return (vmbus_ic_attach(dev, vmbus_heartbeat_cb));
 }
-
-static device_method_t heartbeat_methods[] = {
-   /* Device interface */
-   DEVMETHOD(device_probe, hv_heartbeat_probe),
-   DEVMETHOD(device_attach, hv_heartbeat_attach),
-   DEVMETHOD(device_detach, vmbus_ic_detach),
-   { 0, 0 }
-};
-
-static driver_t heartbeat_driver = {
-   "hvheartbeat",
-   heartbeat_methods,
-   sizeof(struct vmbus_ic_softc)
-};
-
-static devclass_t heartbeat_devclass;
-
-DRIVER_MODULE(hv_heartbeat, vmbus, heartbeat_driver, heartbeat_devclass, NULL, 
NULL);
-MODULE_VERSION(hv_heartbeat, 1);
-MODULE_DEPEND(hv_heartbeat, vmbus, 1, 1, 1);

Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c
==
--- head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 07:14:24 2016
(r310317)
+++ head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 07:34:44 2016
(r310318)
@@ -47,6 +47,9 @@ __FBSDID("$FreeBSD$");
 #define VMBUS_SHUTDOWN_MSGVER  \
VMBUS_IC_VERSION(VMBUS_SHUTDOWN_MSGVER_MAJOR, 0)
 
+static int vmbus_shutdown_probe(device_t);
+static int vmbus_shutdown_attach(device_t);
+
 static const struct vmbus_ic_desc vmbus_shutdown_descs[] = {
{
.ic_guid = { .hv_guid = {
@@ -57,6 +60,27 @@ static const struct vmbus_ic_desc vmbus_
VMBUS_IC_DESC_END
 };
 
+static device_method_t vmbus_shutdown_methods[] = {
+   /* Device interface */
+   DEVMETHOD(device_probe, vmbus_shutdown_probe),
+   DEVMETHOD(device_attach,vmbus_shutdown_attach),
+   DEVMETHOD(device_detach,vmbus_ic_detach),
+   DEVMETHOD_END
+};
+
+static driver_t vmbus_shutdown_driver = {
+   "hvshutdown",
+   vmbus_shutdown_methods,
+   sizeof(struct vmbus_ic_softc)
+};
+
+static devclass_t vmbus_shutdown_devclass;
+
+DRIVER_MODULE(hv_shutdown, vmbus, vmbus_shutdown_driver,
+vmbus_shutdown_devclass, NULL, NULL);
+MODULE_VERSION(hv_shutdown, 1);
+MODULE_DEPEND(hv_shutdown, vmbus, 1, 1, 1);
+
 static void
 vmbus_shutdown_cb(struct vmbus_channel *chan, void *xsc)
 {
@@ -129,35 +153,15 @@ vmbus_shutdown_cb(struct vmbus_channel *
 }
 
 static int
-hv_shutdown_probe(device_t dev)
+vmbus_shutdown_probe(device_t dev)
 {
 
return (vmbus_ic_probe(dev, vmbus_shutdown_descs));
 }
 
 static int
-hv_shutdown_attach(device_t dev)
+vmbus_shutdown_attach(device_t dev)
 {
 
return (vmbus_ic_attach(dev, vmbus_shutdown_cb));
 }
-
-static device_method_t shutdown_methods[] = {
-   /* Device interface */
-   DEVMETHOD(device_probe, 

svn commit: r310317 - in head/sys: conf dev/hyperv/utilities modules/hyperv/utilities

2016-12-19 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Dec 20 07:14:24 2016
New Revision: 310317
URL: https://svnweb.freebsd.org/changeset/base/310317

Log:
  hyperv/ic: Rname cleaned up file.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8848

Added:
  head/sys/dev/hyperv/utilities/vmbus_ic.c
 - copied unchanged from r310316, head/sys/dev/hyperv/utilities/hv_util.c
Deleted:
  head/sys/dev/hyperv/utilities/hv_util.c
Modified:
  head/sys/conf/files.amd64
  head/sys/conf/files.i386
  head/sys/modules/hyperv/utilities/Makefile

Modified: head/sys/conf/files.amd64
==
--- head/sys/conf/files.amd64   Tue Dec 20 05:45:52 2016(r310316)
+++ head/sys/conf/files.amd64   Tue Dec 20 07:14:24 2016(r310317)
@@ -303,7 +303,7 @@ dev/hyperv/utilities/hv_kvp.c   
optiona
 dev/hyperv/utilities/hv_snapshot.c optionalhyperv
 dev/hyperv/utilities/hv_shutdown.c optionalhyperv
 dev/hyperv/utilities/hv_timesync.c optionalhyperv
-dev/hyperv/utilities/hv_util.c optionalhyperv
+dev/hyperv/utilities/vmbus_ic.coptional
hyperv
 dev/hyperv/vmbus/hyperv.c  optionalhyperv
 dev/hyperv/vmbus/hyperv_busdma.c   optionalhyperv
 dev/hyperv/vmbus/vmbus.c   optionalhyperv 
pci

Modified: head/sys/conf/files.i386
==
--- head/sys/conf/files.i386Tue Dec 20 05:45:52 2016(r310316)
+++ head/sys/conf/files.i386Tue Dec 20 07:14:24 2016(r310317)
@@ -259,7 +259,7 @@ dev/hyperv/utilities/hv_kvp.c   
optiona
 dev/hyperv/utilities/hv_snapshot.c optionalhyperv
 dev/hyperv/utilities/hv_shutdown.c optionalhyperv
 dev/hyperv/utilities/hv_timesync.c optionalhyperv
-dev/hyperv/utilities/hv_util.c optionalhyperv
+dev/hyperv/utilities/vmbus_ic.coptional
hyperv
 dev/hyperv/vmbus/hyperv.c  optionalhyperv
 dev/hyperv/vmbus/hyperv_busdma.c   optionalhyperv
 dev/hyperv/vmbus/vmbus.c   optionalhyperv 
pci

Copied: head/sys/dev/hyperv/utilities/vmbus_ic.c (from r310316, 
head/sys/dev/hyperv/utilities/hv_util.c)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/hyperv/utilities/vmbus_ic.cTue Dec 20 07:14:24 2016
(r310317, copy of r310316, head/sys/dev/hyperv/utilities/hv_util.c)
@@ -0,0 +1,299 @@
+/*-
+ * Copyright (c) 2014,2016 Microsoft Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice unmodified, 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 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include "vmbus_if.h"
+
+#define VMBUS_IC_BRSIZE(4 * PAGE_SIZE)
+
+#define VMBUS_IC_VERCNT2
+#define VMBUS_IC_NEGOSZ\
+   __offsetof(struct vmbus_icmsg_negotiate, ic_ver[VMBUS_IC_VERCNT])
+CTASSERT(VMBUS_IC_NEGOSZ < VMBUS_IC_BRSIZE);
+
+static int vmbus_ic_fwver_sysctl(SYSCTL_HANDLER_ARGS);
+static int vmbus_ic_msgver_sysctl(SYSCTL_HANDLER_ARGS);
+
+int
+vmbus_ic_negomsg(struct vmbus_ic_softc *sc, void *data, int *dlen0,
+uint32_t 

svn commit: r310316 - head/cddl/contrib/opensolaris/lib/libdtrace/common

2016-12-19 Thread Mark Johnston
Author: markj
Date: Tue Dec 20 05:45:52 2016
New Revision: 310316
URL: https://svnweb.freebsd.org/changeset/base/310316

Log:
  Consistently print D variable indices in decimal when disassembling.
  
  MFC after:1 week

Modified:
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dis.c

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dis.c
==
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dis.c Tue Dec 20 
05:39:00 2016(r310315)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dis.c Tue Dec 20 
05:45:52 2016(r310316)
@@ -499,7 +499,7 @@ dt_dis(const dtrace_difo_t *dp, FILE *fp
if (v->dtdv_flags & DIFV_F_MOD)
(void) strcat(flags, "/w");
 
-   (void) fprintf(fp, "%-16s %-4x %-3s %-3s %-4s %s\n",
+   (void) fprintf(fp, "%-16s %-4u %-3s %-3s %-4s %s\n",
>dtdo_strtab[v->dtdv_name],
v->dtdv_id, kind, scope, flags + 1,
dt_dis_typestr(>dtdv_type, type, sizeof (type)));
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310315 - head/sys/dev/hyperv/utilities

2016-12-19 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Dec 20 05:39:00 2016
New Revision: 310315
URL: https://svnweb.freebsd.org/changeset/base/310315

Log:
  hyperv/ic: Inclusion cleanup
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8847

Modified:
  head/sys/dev/hyperv/utilities/hv_heartbeat.c
  head/sys/dev/hyperv/utilities/hv_shutdown.c
  head/sys/dev/hyperv/utilities/hv_timesync.c
  head/sys/dev/hyperv/utilities/hv_util.c

Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c
==
--- head/sys/dev/hyperv/utilities/hv_heartbeat.cTue Dec 20 05:26:38 
2016(r310314)
+++ head/sys/dev/hyperv/utilities/hv_heartbeat.cTue Dec 20 05:39:00 
2016(r310315)
@@ -38,8 +38,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include "vmbus_if.h"
-
 #define VMBUS_HEARTBEAT_FWVER_MAJOR3
 #define VMBUS_HEARTBEAT_FWVER  \
VMBUS_IC_VERSION(VMBUS_HEARTBEAT_FWVER_MAJOR, 0)

Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c
==
--- head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 05:26:38 2016
(r310314)
+++ head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 05:39:00 2016
(r310315)
@@ -39,8 +39,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include "vmbus_if.h"
-
 #define VMBUS_SHUTDOWN_FWVER_MAJOR 3
 #define VMBUS_SHUTDOWN_FWVER   \
VMBUS_IC_VERSION(VMBUS_SHUTDOWN_FWVER_MAJOR, 0)

Modified: head/sys/dev/hyperv/utilities/hv_timesync.c
==
--- head/sys/dev/hyperv/utilities/hv_timesync.c Tue Dec 20 05:26:38 2016
(r310314)
+++ head/sys/dev/hyperv/utilities/hv_timesync.c Tue Dec 20 05:39:00 2016
(r310315)
@@ -40,8 +40,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include "vmbus_if.h"
-
 #define VMBUS_TIMESYNC_FWVER_MAJOR 3
 #define VMBUS_TIMESYNC_FWVER   \
VMBUS_IC_VERSION(VMBUS_TIMESYNC_FWVER_MAJOR, 0)

Modified: head/sys/dev/hyperv/utilities/hv_util.c
==
--- head/sys/dev/hyperv/utilities/hv_util.c Tue Dec 20 05:26:38 2016
(r310314)
+++ head/sys/dev/hyperv/utilities/hv_util.c Tue Dec 20 05:39:00 2016
(r310315)
@@ -22,23 +22,16 @@
  * 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.
- *
- * $FreeBSD$
  */
 
-/*
- * A common driver for all hyper-V util services.
- */
+#include 
+__FBSDID("$FreeBSD$");
 
 #include 
-#include 
 #include 
 #include 
-#include 
-#include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310314 - head/sys/dev/hyperv/utilities

2016-12-19 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Dec 20 05:26:38 2016
New Revision: 310314
URL: https://svnweb.freebsd.org/changeset/base/310314

Log:
  hyperv/ic: Rename cleaned up header file.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8846

Added:
  head/sys/dev/hyperv/utilities/vmbus_icvar.h
 - copied unchanged from r310313, head/sys/dev/hyperv/utilities/hv_util.h
Deleted:
  head/sys/dev/hyperv/utilities/hv_util.h
Modified:
  head/sys/dev/hyperv/utilities/hv_heartbeat.c
  head/sys/dev/hyperv/utilities/hv_kvp.c
  head/sys/dev/hyperv/utilities/hv_shutdown.c
  head/sys/dev/hyperv/utilities/hv_snapshot.c
  head/sys/dev/hyperv/utilities/hv_timesync.c
  head/sys/dev/hyperv/utilities/hv_util.c

Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c
==
--- head/sys/dev/hyperv/utilities/hv_heartbeat.cTue Dec 20 05:07:12 
2016(r310313)
+++ head/sys/dev/hyperv/utilities/hv_heartbeat.cTue Dec 20 05:26:38 
2016(r310314)
@@ -35,8 +35,8 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#include 
 #include 
+#include 
 
 #include "vmbus_if.h"
 

Modified: head/sys/dev/hyperv/utilities/hv_kvp.c
==
--- head/sys/dev/hyperv/utilities/hv_kvp.c  Tue Dec 20 05:07:12 2016
(r310313)
+++ head/sys/dev/hyperv/utilities/hv_kvp.c  Tue Dec 20 05:26:38 2016
(r310314)
@@ -64,8 +64,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
-#include "hv_util.h"
 #include "unicode.h"
 #include "hv_kvp.h"
 #include "vmbus_if.h"

Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c
==
--- head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 05:07:12 2016
(r310313)
+++ head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 05:26:38 2016
(r310314)
@@ -36,8 +36,8 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#include 
 #include 
+#include 
 
 #include "vmbus_if.h"
 

Modified: head/sys/dev/hyperv/utilities/hv_snapshot.c
==
--- head/sys/dev/hyperv/utilities/hv_snapshot.c Tue Dec 20 05:07:12 2016
(r310313)
+++ head/sys/dev/hyperv/utilities/hv_snapshot.c Tue Dec 20 05:26:38 2016
(r310314)
@@ -57,8 +57,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 
-#include "hv_util.h"
 #include "hv_snapshot.h"
 #include "vmbus_if.h"
 

Modified: head/sys/dev/hyperv/utilities/hv_timesync.c
==
--- head/sys/dev/hyperv/utilities/hv_timesync.c Tue Dec 20 05:07:12 2016
(r310313)
+++ head/sys/dev/hyperv/utilities/hv_timesync.c Tue Dec 20 05:26:38 2016
(r310314)
@@ -37,8 +37,8 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
-#include 
 #include 
+#include 
 
 #include "vmbus_if.h"
 

Modified: head/sys/dev/hyperv/utilities/hv_util.c
==
--- head/sys/dev/hyperv/utilities/hv_util.c Tue Dec 20 05:07:12 2016
(r310313)
+++ head/sys/dev/hyperv/utilities/hv_util.c Tue Dec 20 05:26:38 2016
(r310314)
@@ -42,8 +42,8 @@
 
 #include 
 #include 
-#include 
 #include 
+#include 
 
 #include "vmbus_if.h"
 

Copied: head/sys/dev/hyperv/utilities/vmbus_icvar.h (from r310313, 
head/sys/dev/hyperv/utilities/hv_util.h)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/hyperv/utilities/vmbus_icvar.h Tue Dec 20 05:26:38 2016
(r310314, copy of r310313, head/sys/dev/hyperv/utilities/hv_util.h)
@@ -0,0 +1,61 @@
+/*-
+ * Copyright (c) 2009-2012,2016 Microsoft Corp.
+ * Copyright (c) 2012 NetApp Inc.
+ * Copyright (c) 2012 Citrix Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice unmodified, 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 

svn commit: r310313 - head/sys/dev/hyperv/utilities

2016-12-19 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Dec 20 05:07:12 2016
New Revision: 310313
URL: https://svnweb.freebsd.org/changeset/base/310313

Log:
  hyperv/ic: Cleanup common struct and functions.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8845

Modified:
  head/sys/dev/hyperv/utilities/hv_heartbeat.c
  head/sys/dev/hyperv/utilities/hv_kvp.c
  head/sys/dev/hyperv/utilities/hv_shutdown.c
  head/sys/dev/hyperv/utilities/hv_snapshot.c
  head/sys/dev/hyperv/utilities/hv_timesync.c
  head/sys/dev/hyperv/utilities/hv_util.c
  head/sys/dev/hyperv/utilities/hv_util.h

Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c
==
--- head/sys/dev/hyperv/utilities/hv_heartbeat.cTue Dec 20 04:51:14 
2016(r310312)
+++ head/sys/dev/hyperv/utilities/hv_heartbeat.cTue Dec 20 05:07:12 
2016(r310313)
@@ -61,7 +61,7 @@ static const struct vmbus_ic_desc vmbus_
 static void
 vmbus_heartbeat_cb(struct vmbus_channel *chan, void *xsc)
 {
-   struct hv_util_sc *sc = xsc;
+   struct vmbus_ic_softc *sc = xsc;
struct vmbus_icmsg_hdr *hdr;
int dlen, error;
uint64_t xactid;
@@ -70,7 +70,7 @@ vmbus_heartbeat_cb(struct vmbus_channel 
/*
 * Receive request.
 */
-   data = sc->receive_buffer;
+   data = sc->ic_buf;
dlen = sc->ic_buflen;
error = vmbus_chan_recv(chan, data, , );
KASSERT(error != ENOBUFS, ("icbuf is not large enough"));
@@ -126,18 +126,22 @@ static int
 hv_heartbeat_attach(device_t dev)
 {
 
-   return (hv_util_attach(dev, vmbus_heartbeat_cb));
+   return (vmbus_ic_attach(dev, vmbus_heartbeat_cb));
 }
 
 static device_method_t heartbeat_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, hv_heartbeat_probe),
DEVMETHOD(device_attach, hv_heartbeat_attach),
-   DEVMETHOD(device_detach, hv_util_detach),
+   DEVMETHOD(device_detach, vmbus_ic_detach),
{ 0, 0 }
 };
 
-static driver_t heartbeat_driver = { "hvheartbeat", heartbeat_methods, 
sizeof(hv_util_sc)};
+static driver_t heartbeat_driver = {
+   "hvheartbeat",
+   heartbeat_methods,
+   sizeof(struct vmbus_ic_softc)
+};
 
 static devclass_t heartbeat_devclass;
 

Modified: head/sys/dev/hyperv/utilities/hv_kvp.c
==
--- head/sys/dev/hyperv/utilities/hv_kvp.c  Tue Dec 20 04:51:14 2016
(r310312)
+++ head/sys/dev/hyperv/utilities/hv_kvp.c  Tue Dec 20 05:07:12 2016
(r310313)
@@ -128,7 +128,7 @@ static struct cdevsw hv_kvp_cdevsw =
  * KVP transaction requests from the host.
  */
 typedef struct hv_kvp_sc {
-   struct hv_util_sc   util_sc;
+   struct vmbus_ic_softc   util_sc;
device_tdev;
 
/* Unless specified the pending mutex should be
@@ -590,7 +590,7 @@ hv_kvp_process_request(void *context, in
hv_kvp_log_info("%s: entering hv_kvp_process_request\n", __func__);
 
sc = (hv_kvp_sc*)context;
-   kvp_buf = sc->util_sc.receive_buffer;
+   kvp_buf = sc->util_sc.ic_buf;
channel = vmbus_get_channel(sc->dev);
 
recvlen = sc->util_sc.ic_buflen;
@@ -885,7 +885,7 @@ hv_kvp_attach(device_t dev)
return (error);
sc->hv_kvp_dev->si_drv1 = sc;
 
-   return hv_util_attach(dev, hv_kvp_callback);
+   return (vmbus_ic_attach(dev, hv_kvp_callback));
 }
 
 static int
@@ -900,7 +900,7 @@ hv_kvp_detach(device_t dev)
}
 
destroy_dev(sc->hv_kvp_dev);
-   return hv_util_detach(dev);
+   return (vmbus_ic_detach(dev));
 }
 
 static device_method_t kvp_methods[] = {

Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c
==
--- head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 04:51:14 2016
(r310312)
+++ head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 05:07:12 2016
(r310313)
@@ -62,7 +62,7 @@ static const struct vmbus_ic_desc vmbus_
 static void
 vmbus_shutdown_cb(struct vmbus_channel *chan, void *xsc)
 {
-   struct hv_util_sc *sc = xsc;
+   struct vmbus_ic_softc *sc = xsc;
struct vmbus_icmsg_hdr *hdr;
struct vmbus_icmsg_shutdown *msg;
int dlen, error, do_shutdown = 0;
@@ -72,7 +72,7 @@ vmbus_shutdown_cb(struct vmbus_channel *
/*
 * Receive request.
 */
-   data = sc->receive_buffer;
+   data = sc->ic_buf;
dlen = sc->ic_buflen;
error = vmbus_chan_recv(chan, data, , );
KASSERT(error != ENOBUFS, ("icbuf is not large enough"));
@@ -141,18 +141,22 @@ static int
 hv_shutdown_attach(device_t dev)
 {
 
-   return (hv_util_attach(dev, vmbus_shutdown_cb));
+   return (vmbus_ic_attach(dev, vmbus_shutdown_cb));
 }
 
 static device_method_t shutdown_methods[] = {
/* Device 

svn commit: r310312 - head/sys/dev/hyperv/utilities

2016-12-19 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Dec 20 04:51:14 2016
New Revision: 310312
URL: https://svnweb.freebsd.org/changeset/base/310312

Log:
  hyperv/ic: Factor out function to send IC response
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D8844

Modified:
  head/sys/dev/hyperv/utilities/hv_heartbeat.c
  head/sys/dev/hyperv/utilities/hv_shutdown.c
  head/sys/dev/hyperv/utilities/hv_timesync.c
  head/sys/dev/hyperv/utilities/hv_util.c
  head/sys/dev/hyperv/utilities/hv_util.h

Modified: head/sys/dev/hyperv/utilities/hv_heartbeat.c
==
--- head/sys/dev/hyperv/utilities/hv_heartbeat.cTue Dec 20 04:05:21 
2016(r310311)
+++ head/sys/dev/hyperv/utilities/hv_heartbeat.cTue Dec 20 04:51:14 
2016(r310312)
@@ -110,13 +110,9 @@ vmbus_heartbeat_cb(struct vmbus_channel 
}
 
/*
-* Send response by echoing the updated request back.
+* Send response by echoing the request back.
 */
-   hdr->ic_flags = VMBUS_ICMSG_FLAG_XACT | VMBUS_ICMSG_FLAG_RESP;
-   error = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, 0,
-   data, dlen, xactid);
-   if (error)
-   device_printf(sc->ic_dev, "resp send failed: %d\n", error);
+   vmbus_ic_sendresp(sc, chan, data, dlen, xactid);
 }
 
 static int

Modified: head/sys/dev/hyperv/utilities/hv_shutdown.c
==
--- head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 04:05:21 2016
(r310311)
+++ head/sys/dev/hyperv/utilities/hv_shutdown.c Tue Dec 20 04:51:14 2016
(r310312)
@@ -122,13 +122,9 @@ vmbus_shutdown_cb(struct vmbus_channel *
}
 
/*
-* Send response by echoing the updated request back.
+* Send response by echoing the request back.
 */
-   hdr->ic_flags = VMBUS_ICMSG_FLAG_XACT | VMBUS_ICMSG_FLAG_RESP;
-   error = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, 0,
-   data, dlen, xactid);
-   if (error)
-   device_printf(sc->ic_dev, "resp send failed: %d\n", error);
+   vmbus_ic_sendresp(sc, chan, data, dlen, xactid);
 
if (do_shutdown)
shutdown_nice(RB_POWEROFF);

Modified: head/sys/dev/hyperv/utilities/hv_timesync.c
==
--- head/sys/dev/hyperv/utilities/hv_timesync.c Tue Dec 20 04:05:21 2016
(r310311)
+++ head/sys/dev/hyperv/utilities/hv_timesync.c Tue Dec 20 04:51:14 2016
(r310312)
@@ -203,13 +203,9 @@ vmbus_timesync_cb(struct vmbus_channel *
}
 
/*
-* Send response by echoing the updated request back.
+* Send response by echoing the request back.
 */
-   hdr->ic_flags = VMBUS_ICMSG_FLAG_XACT | VMBUS_ICMSG_FLAG_RESP;
-   error = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, 0,
-   data, dlen, xactid);
-   if (error)
-   device_printf(sc->ic_dev, "resp send failed: %d\n", error);
+   vmbus_ic_sendresp(sc, chan, data, dlen, xactid);
 }
 
 static int

Modified: head/sys/dev/hyperv/utilities/hv_util.c
==
--- head/sys/dev/hyperv/utilities/hv_util.c Tue Dec 20 04:05:21 2016
(r310311)
+++ head/sys/dev/hyperv/utilities/hv_util.c Tue Dec 20 04:51:14 2016
(r310312)
@@ -287,3 +287,21 @@ hv_util_detach(device_t dev)
 
return (0);
 }
+
+int
+vmbus_ic_sendresp(struct hv_util_sc *sc, struct vmbus_channel *chan,
+void *data, int dlen, uint64_t xactid)
+{
+   struct vmbus_icmsg_hdr *hdr;
+   int error;
+
+   KASSERT(dlen >= sizeof(*hdr), ("invalid data length %d", dlen));
+   hdr = data;
+
+   hdr->ic_flags = VMBUS_ICMSG_FLAG_XACT | VMBUS_ICMSG_FLAG_RESP;
+   error = vmbus_chan_send(chan, VMBUS_CHANPKT_TYPE_INBAND, 0,
+   data, dlen, xactid);
+   if (error)
+   device_printf(sc->ic_dev, "resp send failed: %d\n", error);
+   return (error);
+}

Modified: head/sys/dev/hyperv/utilities/hv_util.h
==
--- head/sys/dev/hyperv/utilities/hv_util.h Tue Dec 20 04:05:21 2016
(r310311)
+++ head/sys/dev/hyperv/utilities/hv_util.h Tue Dec 20 04:51:14 2016
(r310312)
@@ -58,5 +58,8 @@ int   hv_util_detach(device_t dev);
 intvmbus_ic_probe(device_t dev, const struct vmbus_ic_desc 
descs[]);
 intvmbus_ic_negomsg(struct hv_util_sc *sc, void *data, int *dlen,
uint32_t fw_ver, uint32_t msg_ver);
+intvmbus_ic_sendresp(struct hv_util_sc *sc,
+   struct vmbus_channel *chan, void *data, int dlen,
+   uint64_t xactid);
 
 #endif
___

Re: svn commit: r310138 - head/lib/libc/stdio

2016-12-19 Thread John Baldwin
On Monday, December 19, 2016 02:23:08 PM Adrian Chadd wrote:
> [snip]
> 
> tl;dr - can we revert it from stdio for now so we don't end up having
> people use this?

I agree with that.  I think in userland something like snprintb() is ok.
In the kernel I'd rather keep '%b'.

-- 
John Baldwin
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310311 - head/usr.sbin/syslogd

2016-12-19 Thread Hiroki Sato
Author: hrs
Date: Tue Dec 20 04:05:21 2016
New Revision: 310311
URL: https://svnweb.freebsd.org/changeset/base/310311

Log:
  Add a NULL check.

Modified:
  head/usr.sbin/syslogd/syslogd.c

Modified: head/usr.sbin/syslogd/syslogd.c
==
--- head/usr.sbin/syslogd/syslogd.c Tue Dec 20 03:41:40 2016
(r310310)
+++ head/usr.sbin/syslogd/syslogd.c Tue Dec 20 04:05:21 2016
(r310311)
@@ -532,6 +532,8 @@ main(int argc, char *argv[])
 
if (bflag == 0) {
pe = calloc(1, sizeof(*pe));
+   if (pe == NULL)
+   err(1, "malloc failed");
*pe = (struct peer) {
.pe_serv = "syslog"
};
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310310 - head/usr.sbin/syslogd

2016-12-19 Thread Hiroki Sato
Author: hrs
Date: Tue Dec 20 03:41:40 2016
New Revision: 310310
URL: https://svnweb.freebsd.org/changeset/base/310310

Log:
  Add a default socket bound to *:514 when no -b option is specified.
  This was accidentally removed at r309933.
  
  Spotted by:   Michael Butler

Modified:
  head/usr.sbin/syslogd/syslogd.c

Modified: head/usr.sbin/syslogd/syslogd.c
==
--- head/usr.sbin/syslogd/syslogd.c Tue Dec 20 03:38:14 2016
(r310309)
+++ head/usr.sbin/syslogd/syslogd.c Tue Dec 20 03:41:40 2016
(r310310)
@@ -383,7 +383,7 @@ close_filed(struct filed *f)
 int
 main(int argc, char *argv[])
 {
-   int ch, i, fdsrmax = 0;
+   int ch, i, fdsrmax = 0, bflag = 0;
struct sockaddr_storage ss;
fd_set *fdsr = NULL;
char line[MAXLINE + 1];
@@ -437,6 +437,7 @@ main(int argc, char *argv[])
pe->pe_name = (strlen(optarg) == 0) ?
NULL : optarg;
}
+   bflag = 1;
STAILQ_INSERT_TAIL(, pe, next);
break;
case 'c':
@@ -528,6 +529,14 @@ main(int argc, char *argv[])
}
if ((argc -= optind) != 0)
usage();
+
+   if (bflag == 0) {
+   pe = calloc(1, sizeof(*pe));
+   *pe = (struct peer) {
+   .pe_serv = "syslog"
+   };
+   STAILQ_INSERT_TAIL(, pe, next);
+   }
STAILQ_FOREACH(pe, , next)
socksetup(pe);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310309 - in head/sys/dev: mmc sdhci

2016-12-19 Thread Conrad E. Meyer
Author: cem
Date: Tue Dec 20 03:38:14 2016
New Revision: 310309
URL: https://svnweb.freebsd.org/changeset/base/310309

Log:
  sdhci/mmc: Minor whitespace cleanups
  
  No functional change.
  
  Submitted by: Johannes Lundberg 

Modified:
  head/sys/dev/mmc/mmc.c
  head/sys/dev/sdhci/sdhci_pci.c

Modified: head/sys/dev/mmc/mmc.c
==
--- head/sys/dev/mmc/mmc.c  Tue Dec 20 01:51:09 2016(r310308)
+++ head/sys/dev/mmc/mmc.c  Tue Dec 20 03:38:14 2016(r310309)
@@ -401,7 +401,7 @@ mmc_wait_for_req(struct mmc_softc *sc, s
msleep(req, >sc_mtx, 0, "mmcreq", 0);
MMC_UNLOCK(sc);
if (mmc_debug > 2 || (mmc_debug > 0 && req->cmd->error != MMC_ERR_NONE))
-   device_printf(sc->dev, "CMD%d RESULT: %d\n", 
+   device_printf(sc->dev, "CMD%d RESULT: %d\n",
req->cmd->opcode, req->cmd->error);
return (0);
 }
@@ -511,7 +511,7 @@ mmc_idle_cards(struct mmc_softc *sc)
 {
device_t dev;
struct mmc_command cmd;
-   
+
dev = sc->dev;
mmcbr_set_chip_select(dev, cs_high);
mmcbr_update_ios(dev);
@@ -795,7 +795,7 @@ mmc_test_bus_width(struct mmc_softc *sc)
data.len = 8;
data.flags = MMC_DATA_WRITE;
mmc_wait_for_cmd(sc, , 0);
-   
+
memset(, 0, sizeof(cmd));
memset(, 0, sizeof(data));
cmd.opcode = MMC_BUSTEST_R;
@@ -808,7 +808,7 @@ mmc_test_bus_width(struct mmc_softc *sc)
data.flags = MMC_DATA_READ;
err = mmc_wait_for_cmd(sc, , 0);
sc->squelched--;
-   
+
mmcbr_set_bus_width(sc->dev, bus_width_1);
mmcbr_update_ios(sc->dev);
 
@@ -832,7 +832,7 @@ mmc_test_bus_width(struct mmc_softc *sc)
data.len = 4;
data.flags = MMC_DATA_WRITE;
mmc_wait_for_cmd(sc, , 0);
-   
+
memset(, 0, sizeof(cmd));
memset(, 0, sizeof(data));
cmd.opcode = MMC_BUSTEST_R;
@@ -1017,7 +1017,7 @@ mmc_decode_csd_sd(uint32_t *raw_csd, str
csd->r2w_factor = 1 << mmc_get_bits(raw_csd, 128, 26, 3);
csd->write_bl_len = 1 << mmc_get_bits(raw_csd, 128, 22, 4);
csd->write_bl_partial = mmc_get_bits(raw_csd, 128, 21, 1);
-   } else 
+   } else
panic("unknown SD CSD version");
 }
 
@@ -1349,9 +1349,9 @@ mmc_discover_cards(struct mmc_softc *sc)
if (ivar->csd.csd_structure > 0)
ivar->high_cap = 1;
ivar->tran_speed = ivar->csd.tran_speed;
-   ivar->erase_sector = ivar->csd.erase_sector * 
+   ivar->erase_sector = ivar->csd.erase_sector *
ivar->csd.write_bl_len / MMC_SECTOR_SIZE;
-   
+
err = mmc_send_status(sc, ivar->rca, );
if (err != MMC_ERR_NONE) {
device_printf(sc->dev,
@@ -1446,7 +1446,7 @@ mmc_discover_cards(struct mmc_softc *sc)
mmc_decode_csd_mmc(ivar->raw_csd, >csd);
ivar->sec_count = ivar->csd.capacity / MMC_SECTOR_SIZE;
ivar->tran_speed = ivar->csd.tran_speed;
-   ivar->erase_sector = ivar->csd.erase_sector * 
+   ivar->erase_sector = ivar->csd.erase_sector *
ivar->csd.write_bl_len / MMC_SECTOR_SIZE;
 
err = mmc_send_status(sc, ivar->rca, );
@@ -1655,7 +1655,7 @@ mmc_calculate_clock(struct mmc_softc *sc
int nkid, i, f_max;
device_t *kids;
struct mmc_ivars *ivar;
-   
+
f_max = mmcbr_get_f_max(sc->dev);
max_dtr = max_hs_dtr = f_max;
if ((mmcbr_get_caps(sc->dev) & MMC_CAP_HSPEED))
@@ -1770,7 +1770,7 @@ static void
 mmc_delayed_attach(void *xsc)
 {
struct mmc_softc *sc = xsc;
-   
+
mmc_scan(sc);
config_intrhook_disestablish(>config_intrhook);
 }

Modified: head/sys/dev/sdhci/sdhci_pci.c
==
--- head/sys/dev/sdhci/sdhci_pci.c  Tue Dec 20 01:51:09 2016
(r310308)
+++ head/sys/dev/sdhci/sdhci_pci.c  Tue Dec 20 03:38:14 2016
(r310309)
@@ -63,15 +63,15 @@ __FBSDID("$FreeBSD$");
 #define PCI_SDHCI_IFVENDOR 0x02
 
 #define PCI_SLOT_INFO  0x40/* 8 bits */
-#define  PCI_SLOT_INFO_SLOTS(x)(((x >> 4) & 7) + 1)
-#define  PCI_SLOT_INFO_FIRST_BAR(x)((x) & 7)
+#define PCI_SLOT_INFO_SLOTS(x) (((x >> 4) & 7) + 1)
+#define PCI_SLOT_INFO_FIRST_BAR(x) ((x) & 7)
 
 /*
  * RICOH specific PCI registers
  */
 #defineSDHC_PCI_MODE_KEY   0xf9
 #defineSDHC_PCI_MODE   0x150
-#define  

Re: svn commit: r310171 - head/sys/sys

2016-12-19 Thread Bruce Evans

On Mon, 19 Dec 2016, Ravi Pokala wrote:


-Original Message-

From:  on behalf of Ian Lepore 

Date: 2016-12-19, Monday at 11:20
To: Warner Losh , Ravi Pokala 
Cc: Sepherosa Ziehau , Dimitry Andric , src-committers 
, "svn-src-all@freebsd.org" , 
"svn-src-h...@freebsd.org" 
Subject: Re: svn commit: r310171 - head/sys/sys

On Mon, 2016-12-19 at 11:58 -0700, Warner Losh wrote:


...

Are there other precedence for avoiding the SCN macros in the tree as
well, or is this new art?


There was another commit recently the fixed the same kind of scanf
error by making the variable fit the scanf type (changing uint64_t to
an explicit long long unsigned, iirc).  I don't know if that alone
counts as a precedent, but IMO it's a more palatible fix than the
SCN/PRI ugliness.


That was apparently a bug, not a fix.  Someone said that the variable
needs to have type precisely uint64_t.
  (Extensive use of fixed-width types in FreeBSD is another bug.  It
  asks for fixed width at all cost.  Using the "fast" or "least" types
  would as for time or space efficiency instead.  Or just use basic
  types whenever possible for simplicity.  Fixed-width types should
  only be used on ABI boundaries.)
I think there is an ABI boundary near the other commit.  Some hardware
wants uint64_t, and we should use uint_fast64_t or uint_least64_t, but
we used uint64_t.  These uses require translation at the ABI boundary,
since the fast and least types may be larger than the fixed-width types.
  (In more complicated cases, the relevant fixed-width type does't exist.
  IIRC, POSIX requires only fixed width types of width 8, 16 and 32 to
  exist, since old badly designed ABIs like inet_addr() require a fixed
  width, but newer ABIs don't repeat the mistake for width 64.  The C
  standard requires the "fast" and "least" types for widths 8, 16, 32 and
  64 to exist.  This is possible since they can all be [unsigned] long
  long or [u]intmax_t although these might be very far from being either
  fast or least.  All fixed-width types are optional in C.  So to support
  bad software ABIs and some hardware ABIs using portable code, you have
  to read write the data using some basic type (perhaps unsigned char)
  and convert it to a "fast" or "least" type (or maybe [u]intmax_t).
We changed to using the unsigned long long abomination.  This is basically
a bad spelling of uintmax_t.  All uint_fast64_t, uint_least64_t, unsigned
long long and uintmax_t are at least as large asthe ABI type uint64_t, so
they can be used to represent the ABI values, but all need translation at
ABI booundaries since they may be strictly larger.  The translation may
be as simple as assignment, depending on how the code is written.  Since
the code wasn't written with this in mind, it might have type puns instead.
Or the compiler might just warn about all implicit conversions that might
lose bits.


With all apologies to Churchill, SCN/PRI are the worst way to address this in a 
machine-independent way, except for all the other ways that have been tried 
from time to time. :-P


No, there are much better ways.  For PRI*, just cast to [u]intmax_t.  The
only thing wrong with this is that it lots wastes space and time when
[u]intmax_t is very wide.  We don't have this problem yet since [u]intmax_t
is only 64 bits.  That would be very wide on 8-bit systems but is merely
wide on 32-bit systems and not wide on 63-bit systems.  PRI* is not even
available for an average typedef like uid_t.  It is available for all
"fast" and "least" typedefs.

For SCN*, first don't use *scanf().  Use APIs that can actually handle errors,
like strtol().  If you have to maintain bad code that uses *scanf(), then
convert to uintmax_t.  The conversions are not as short as casting for
*printf().  They are much like what is needed at ABI boundaries:

uintmax_t tmp;
uint64_t val;

/*
 * Good code does tmp = strtoumax() here.  Then handle errors
 * reported by strtoumax().  Then check that the result is
 * representable in uint64_t.  Then handle errors from that.
 *
 * Bad code did *sscanf(str, "%llx", ) with no error checking
 * or handling of course.  The type didn't't match the format in
 * general, and the behaviour was undefined on overflow.
 */
sscanf(str, "%jx", ); /* keep null error handling */
val = tmp;  /* preserve undefined on overflow */
/*
 * Overflow in sscanf() is less likely than before (uintmax_t
 * might be larger).  Then overflow occurs much like before on
 * assignment (if the result is too large for the final type).
 */

Since the conversion is more elaborate for *scanf() than for *printf(),
SCN* is slightly less bad than 

Re: svn commit: r310171 - head/sys/sys

2016-12-19 Thread Sepherosa Ziehau
On Tue, Dec 20, 2016 at 4:37 AM, Ravi Pokala  wrote:
> -Original Message-
>> From:  on behalf of Ian Lepore 
>> 
>> Date: 2016-12-19, Monday at 11:20
>> To: Warner Losh , Ravi Pokala 
>> Cc: Sepherosa Ziehau , Dimitry Andric 
>> , src-committers , 
>> "svn-src-all@freebsd.org" , 
>> "svn-src-h...@freebsd.org" 
>> Subject: Re: svn commit: r310171 - head/sys/sys
>>
>> On Mon, 2016-12-19 at 11:58 -0700, Warner Losh wrote:
>>>
>>> ...
>>>
>>> Are there other precedence for avoiding the SCN macros in the tree as
>>> well, or is this new art?
>>>
>>> Warner
>>
>> There was another commit recently the fixed the same kind of scanf
>> error by making the variable fit the scanf type (changing uint64_t to
>> an explicit long long unsigned, iirc).  I don't know if that alone
>> counts as a precedent, but IMO it's a more palatible fix than the
>> SCN/PRI ugliness.
>
> With all apologies to Churchill, SCN/PRI are the worst way to address this in 
> a machine-independent way, except for all the other ways that have been tried 
> from time to time. :-P
>

If no objection comes, I'd commit the posted patch as it is tomorrow in my time.

Thanks,
sephe

-- 
Tomorrow Will Never Die
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310308 - in head/sys/mips: conf ingenic

2016-12-19 Thread Jared McNeill
Author: jmcneill
Date: Tue Dec 20 01:51:09 2016
New Revision: 310308
URL: https://svnweb.freebsd.org/changeset/base/310308

Log:
  Add support for Ingenic JZ4780 LCD controller and enable framebuffer
  console support.
  
  Reviewed by:  kan
  Differential Revision:https://reviews.freebsd.org/D8827

Added:
  head/sys/mips/ingenic/jz4780_lcd.c   (contents, props changed)
  head/sys/mips/ingenic/jz4780_lcd.h   (contents, props changed)
Modified:
  head/sys/mips/conf/JZ4780
  head/sys/mips/ingenic/files.jz4780

Modified: head/sys/mips/conf/JZ4780
==
--- head/sys/mips/conf/JZ4780   Tue Dec 20 01:37:00 2016(r310307)
+++ head/sys/mips/conf/JZ4780   Tue Dec 20 01:51:09 2016(r310308)
@@ -86,6 +86,16 @@ device   mmcsd
 
 device dme
 
+device iic
+device iicbus
+
+# Framebuffer console support
+device vt
+device kbdmux
+device hdmi
+device videomode
+device pty
+
 # USB support
 optionsUSB_DEBUG   # enable debug msgs
 optionsUSB_HOST_ALIGN=128 # L2 cache line size
@@ -95,6 +105,7 @@ device   dwcotg  # DesignWare HS OTG cont
 device usb # USB Bus (required)
 #deviceudbp# USB Double Bulk Pipe devices
 device uhid# "Human Interface Devices"
+device ukbd# Allow keyboard like HIDs to control console
 #deviceulpt# Printer
 device umass   # Disks/Mass storage - Requires scbus and da
 device ums # Mouse

Modified: head/sys/mips/ingenic/files.jz4780
==
--- head/sys/mips/ingenic/files.jz4780  Tue Dec 20 01:37:00 2016
(r310307)
+++ head/sys/mips/ingenic/files.jz4780  Tue Dec 20 01:51:09 2016
(r310308)
@@ -6,6 +6,9 @@ mips/ingenic/jz4780_mmc.c   optional mmc
 mips/ingenic/jz4780_ohci.c optional ohci
 mips/ingenic/jz4780_smb.c  optional iicbus
 mips/ingenic/jz4780_uart.c optional uart
+mips/ingenic/jz4780_lcd.c  optional vt
+dev/hdmi/dwc_hdmi.coptional hdmi iicbus
+dev/hdmi/dwc_hdmi_fdt.coptional hdmi iicbus
 
 mips/ingenic/jz4780_clock.cstandard
 mips/ingenic/jz4780_clk_gen.c  standard
@@ -25,3 +28,6 @@ mips/ingenic/jz4780_mpboot.S  optional sm
 
 # Custom interface between pinctrl and gpio
 mips/ingenic/jz4780_gpio_if.m  standard
+
+# HDMI interface
+dev/hdmi/hdmi_if.m standard

Added: head/sys/mips/ingenic/jz4780_lcd.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/mips/ingenic/jz4780_lcd.c  Tue Dec 20 01:51:09 2016
(r310308)
@@ -0,0 +1,572 @@
+/*-
+ * Copyright (c) 2016 Jared McNeill 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * Ingenic JZ4780 LCD Controller
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+#include 
+
+#include "fb_if.h"
+#include "hdmi_if.h"
+
+#defineFB_DEFAULT_W800
+#defineFB_DEFAULT_H600
+#defineFB_DEFAULT_REF  60
+#defineFB_BPP  32
+#defineFB_ALIGN(16 * 4)
+#defineFB_MAX_BW   (1920 * 1080 * 60)
+#defineFB_MAX_W2048
+#defineFB_MAX_H2048
+#define FB_DIVIDE(x, y)

svn commit: r310307 - head/sys/mips/ingenic

2016-12-19 Thread Jared McNeill
Author: jmcneill
Date: Tue Dec 20 01:37:00 2016
New Revision: 310307
URL: https://svnweb.freebsd.org/changeset/base/310307

Log:
  Choose the closes matching divider instead of one that results in a
  frequency >= target. Fix inverted rounding logic for CLK_SET_ROUND_UP/DOWN.
  
  Reviewed by:  kan
  Differential Revision:https://reviews.freebsd.org/D8784

Modified:
  head/sys/mips/ingenic/jz4780_clk_gen.c

Modified: head/sys/mips/ingenic/jz4780_clk_gen.c
==
--- head/sys/mips/ingenic/jz4780_clk_gen.c  Tue Dec 20 01:34:29 2016
(r310306)
+++ head/sys/mips/ingenic/jz4780_clk_gen.c  Tue Dec 20 01:37:00 2016
(r310307)
@@ -153,23 +153,29 @@ jz4780_clk_gen_set_freq(struct clknode *
 {
struct jz4780_clk_gen_sc *sc;
uint64_t _fout;
-   uint32_t divider, div_reg, div_msk, reg;
+   uint32_t divider, div_reg, div_msk, reg, div_l, div_h;
int rv;
 
sc = clknode_get_softc(clk);
 
-   divider = fin / *fout;
+   /* Find closest divider */
+   div_l = howmany(fin, *fout);
+   div_h = fin / *fout;
+   divider = abs((int64_t)*fout - (fin / div_l)) <
+   abs((int64_t)*fout - (fin / div_h)) ? div_l : div_h;
 
/* Adjust for divider multiplier */
div_reg = divider >> sc->clk_descr->clk_div.div_lg;
divider = div_reg << sc->clk_descr->clk_div.div_lg;
+   if (divider == 0)
+   divider = 1;
 
_fout = fin / divider;
 
/* Rounding */
-   if ((flags & CLK_SET_ROUND_UP) && (*fout < _fout))
+   if ((flags & CLK_SET_ROUND_UP) && (*fout > _fout))
div_reg--;
-   else if ((flags & CLK_SET_ROUND_DOWN) && (*fout > _fout))
+   else if ((flags & CLK_SET_ROUND_DOWN) && (*fout < _fout))
div_reg++;
if (div_reg == 0)
div_reg = 1;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310306 - in head/sys: arm/allwinner arm/arm arm/freescale/imx conf dev/hdmi

2016-12-19 Thread Jared McNeill
Author: jmcneill
Date: Tue Dec 20 01:34:29 2016
New Revision: 310306
URL: https://svnweb.freebsd.org/changeset/base/310306

Log:
  Split the DesignWare HDMI-specific code from imx6_hdmi.c into a separate
  file and add a generic DT binding that takes advantage of the extres
  framework for setting up clocks.
  
  Reviewed by:  gonzo
  Differential Revision:https://reviews.freebsd.org/D8826

Added:
  head/sys/dev/hdmi/
  head/sys/dev/hdmi/dwc_hdmi.c   (contents, props changed)
  head/sys/dev/hdmi/dwc_hdmi.h   (contents, props changed)
  head/sys/dev/hdmi/dwc_hdmi_fdt.c   (contents, props changed)
  head/sys/dev/hdmi/dwc_hdmireg.h   (contents, props changed)
  head/sys/dev/hdmi/hdmi_if.m
 - copied unchanged from r310305, head/sys/arm/arm/hdmi_if.m
Deleted:
  head/sys/arm/arm/hdmi_if.m
  head/sys/arm/freescale/imx/imx6_hdmireg.h
Modified:
  head/sys/arm/allwinner/files.allwinner
  head/sys/arm/freescale/imx/files.imx6
  head/sys/arm/freescale/imx/imx6_hdmi.c
  head/sys/conf/files.arm

Modified: head/sys/arm/allwinner/files.allwinner
==
--- head/sys/arm/allwinner/files.allwinner  Tue Dec 20 01:13:11 2016
(r310305)
+++ head/sys/arm/allwinner/files.allwinner  Tue Dec 20 01:34:29 2016
(r310306)
@@ -35,7 +35,7 @@ arm/allwinner/aw_cir.coptional
aw_cir
 arm/allwinner/a10_fb.c optionalvt
 arm/allwinner/a10_hdmi.c   optionalhdmi
 arm/allwinner/a10_hdmiaudio.c  optionalhdmi sound
-arm/arm/hdmi_if.m  optionalhdmi
+dev/hdmi/hdmi_if.m optionalhdmi
 
 arm/allwinner/aw_reset.c   standard
 arm/allwinner/aw_ccu.c standard

Modified: head/sys/arm/freescale/imx/files.imx6
==
--- head/sys/arm/freescale/imx/files.imx6   Tue Dec 20 01:13:11 2016
(r310305)
+++ head/sys/arm/freescale/imx/files.imx6   Tue Dec 20 01:34:29 2016
(r310306)
@@ -24,7 +24,8 @@ arm/freescale/imx/imx6_sdma.c optional 
 arm/freescale/imx/imx6_audmux.coptional sound
 arm/freescale/imx/imx6_ssi.c   optional sound
 
-arm/arm/hdmi_if.m  optional hdmi
+dev/hdmi/hdmi_if.m optional hdmi
+dev/hdmi/dwc_hdmi.coptional hdmi
 arm/freescale/imx/imx6_hdmi.c  optional hdmi
 
 arm/freescale/imx/imx6_ipu.c   optionalvt

Modified: head/sys/arm/freescale/imx/imx6_hdmi.c
==
--- head/sys/arm/freescale/imx/imx6_hdmi.c  Tue Dec 20 01:13:11 2016
(r310305)
+++ head/sys/arm/freescale/imx/imx6_hdmi.c  Tue Dec 20 01:34:29 2016
(r310306)
@@ -44,30 +44,18 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
-#include 
-
-#include 
-#include 
 
 #include 
 #include 
 #include 
-#include 
 
-#include "hdmi_if.h"
+#include 
 
-#defineI2C_DDC_ADDR(0x50 << 1)
-#defineEDID_LENGTH 0x80
+#include "hdmi_if.h"
 
 struct imx_hdmi_softc {
-   device_tsc_dev;
-   struct resource *sc_mem_res;
-   int sc_mem_rid;
-   struct intr_config_hook sc_mode_hook;
-   struct videomodesc_mode;
-   uint8_t *sc_edid;
-   uint8_t sc_edid_len;
-   phandle_t   sc_i2c_xref;
+   struct dwc_hdmi_softc   base;
+   phandle_t   i2c_xref;
 };
 
 static struct ofw_compat_data compat_data[] = {
@@ -76,565 +64,17 @@ static struct ofw_compat_data compat_dat
{NULL,  0}
 };
 
-static inline uint8_t
-RD1(struct imx_hdmi_softc *sc, bus_size_t off)
-{
-
-   return (bus_read_1(sc->sc_mem_res, off));
-}
-
-static inline void
-WR1(struct imx_hdmi_softc *sc, bus_size_t off, uint8_t val)
-{
-
-   bus_write_1(sc->sc_mem_res, off, val);
-}
-
-static void
-imx_hdmi_phy_wait_i2c_done(struct imx_hdmi_softc *sc, int msec)
-{
-   uint8_t val;
-
-   val = RD1(sc, HDMI_IH_I2CMPHY_STAT0) &
-   (HDMI_IH_I2CMPHY_STAT0_DONE | HDMI_IH_I2CMPHY_STAT0_ERROR);
-   while (val == 0) {
-   pause("HDMI_PHY", hz/100);
-   msec -= 10;
-   if (msec <= 0)
-   return;
-   val = RD1(sc, HDMI_IH_I2CMPHY_STAT0) &
-   (HDMI_IH_I2CMPHY_STAT0_DONE | HDMI_IH_I2CMPHY_STAT0_ERROR);
-   }
-}
-
-static void
-imx_hdmi_phy_i2c_write(struct imx_hdmi_softc *sc, unsigned short data,
-unsigned char addr)
-{
-
-   /* clear DONE and ERROR flags */
-   WR1(sc, HDMI_IH_I2CMPHY_STAT0,
-   HDMI_IH_I2CMPHY_STAT0_DONE | HDMI_IH_I2CMPHY_STAT0_ERROR);
-   WR1(sc, HDMI_PHY_I2CM_ADDRESS_ADDR, addr);
-   WR1(sc, HDMI_PHY_I2CM_DATAO_1_ADDR, ((data >> 8) & 0xff));
-  

svn commit: r310305 - in head/sys/dev/rtwn: rtl8188e/usb rtl8192c rtl8812a

2016-12-19 Thread Kevin Lo
Author: kevlo
Date: Tue Dec 20 01:13:11 2016
New Revision: 310305
URL: https://svnweb.freebsd.org/changeset/base/310305

Log:
  Merge r92c_init_rf_common() into r92c_init_rf().  In r88eu_attach.c, we could
  use r92c_init_rf() rather than r92c_init_rf_common() when sc_init_rf()
  callback is invoked.
  
  While here, constantly use RF chain instead of RF path in comment.
  
  Reviewed by:  avos

Modified:
  head/sys/dev/rtwn/rtl8188e/usb/r88eu_attach.c
  head/sys/dev/rtwn/rtl8188e/usb/r88eu_init.c
  head/sys/dev/rtwn/rtl8192c/r92c.h
  head/sys/dev/rtwn/rtl8192c/r92c_init.c
  head/sys/dev/rtwn/rtl8812a/r12a_priv.h

Modified: head/sys/dev/rtwn/rtl8188e/usb/r88eu_attach.c
==
--- head/sys/dev/rtwn/rtl8188e/usb/r88eu_attach.c   Mon Dec 19 23:38:07 
2016(r310304)
+++ head/sys/dev/rtwn/rtl8188e/usb/r88eu_attach.c   Tue Dec 20 01:13:11 
2016(r310305)
@@ -171,7 +171,7 @@ r88eu_attach(struct rtwn_usb_softc *uc)
sc->sc_init_intr= r88eu_init_intr;
sc->sc_init_edca= r92c_init_edca;
sc->sc_init_bb  = r88e_init_bb;
-   sc->sc_init_rf  = r92c_init_rf_common;
+   sc->sc_init_rf  = r92c_init_rf;
sc->sc_init_antsel  = rtwn_nop_softc;
sc->sc_post_init= r88eu_post_init;
sc->sc_init_bcnq1_boundary  = rtwn_nop_int_softc;

Modified: head/sys/dev/rtwn/rtl8188e/usb/r88eu_init.c
==
--- head/sys/dev/rtwn/rtl8188e/usb/r88eu_init.c Mon Dec 19 23:38:07 2016
(r310304)
+++ head/sys/dev/rtwn/rtl8188e/usb/r88eu_init.c Tue Dec 20 01:13:11 2016
(r310305)
@@ -200,9 +200,6 @@ r88eu_init_rx_agg(struct rtwn_softc *sc)
 void
 r88eu_post_init(struct rtwn_softc *sc)
 {
-   /* Turn CCK and OFDM blocks on. */
-   rtwn_bb_setbits(sc, R92C_FPGA0_RFMOD, 0, R92C_RFMOD_CCK_EN);
-   rtwn_bb_setbits(sc, R92C_FPGA0_RFMOD, 0, R92C_RFMOD_OFDM_EN);
 
/* Enable per-packet TX report. */
rtwn_setbits_1(sc, R88E_TX_RPT_CTRL, 0, R88E_TX_RPT1_ENA);

Modified: head/sys/dev/rtwn/rtl8192c/r92c.h
==
--- head/sys/dev/rtwn/rtl8192c/r92c.h   Mon Dec 19 23:38:07 2016
(r310304)
+++ head/sys/dev/rtwn/rtl8192c/r92c.h   Tue Dec 20 01:13:11 2016
(r310305)
@@ -81,7 +81,6 @@ int   r92c_set_page_size(struct rtwn_softc
 void   r92c_init_bb_common(struct rtwn_softc *);
 intr92c_init_rf_chain(struct rtwn_softc *,
const struct rtwn_rf_prog *, int);
-void   r92c_init_rf_common(struct rtwn_softc *);
 void   r92c_init_rf(struct rtwn_softc *);
 void   r92c_init_edca(struct rtwn_softc *);
 void   r92c_init_ampdu(struct rtwn_softc *);

Modified: head/sys/dev/rtwn/rtl8192c/r92c_init.c
==
--- head/sys/dev/rtwn/rtl8192c/r92c_init.c  Mon Dec 19 23:38:07 2016
(r310304)
+++ head/sys/dev/rtwn/rtl8192c/r92c_init.c  Tue Dec 20 01:13:11 2016
(r310305)
@@ -204,7 +204,7 @@ r92c_init_rf_chain(struct rtwn_softc *sc
 }
 
 void
-r92c_init_rf_common(struct rtwn_softc *sc)
+r92c_init_rf(struct rtwn_softc *sc)
 {
struct r92c_softc *rs = sc->sc_priv;
uint32_t reg, type;
@@ -244,14 +244,6 @@ r92c_init_rf_common(struct rtwn_softc *s
rs->rf_chnlbw[chain] = rtwn_rf_read(sc, chain,
R92C_RF_CHNLBW);
}
-}
-
-void
-r92c_init_rf(struct rtwn_softc *sc)
-{
-   struct r92c_softc *rs = sc->sc_priv;
-
-   r92c_init_rf_common(sc);
 
if ((rs->chip & (R92C_CHIP_UMC_A_CUT | R92C_CHIP_92C)) ==
R92C_CHIP_UMC_A_CUT) {

Modified: head/sys/dev/rtwn/rtl8812a/r12a_priv.h
==
--- head/sys/dev/rtwn/rtl8812a/r12a_priv.h  Mon Dec 19 23:38:07 2016
(r310304)
+++ head/sys/dev/rtwn/rtl8812a/r12a_priv.h  Tue Dec 20 01:13:11 2016
(r310305)
@@ -657,7 +657,7 @@ static const struct rtwn_rf_prog rtl8812
NULL
},
{ 0, NULL, NULL, { 0 }, NULL },
-   /* RF path 2. */
+   /* RF chain 1. */
{
nitems(rtl8812au_rf1_regs0),
rtl8812au_rf1_regs0,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310304 - in head: contrib/bmake contrib/bmake/mk usr.bin/bmake

2016-12-19 Thread Simon J. Gerraty
Author: sjg
Date: Mon Dec 19 23:38:07 2016
New Revision: 310304
URL: https://svnweb.freebsd.org/changeset/base/310304

Log:
  Merge bmake-20161212

Added:
  head/contrib/bmake/mk/sys.debug.mk
 - copied unchanged from r310300, vendor/NetBSD/bmake/dist/mk/sys.debug.mk
  head/contrib/bmake/mk/sys.vars.mk
 - copied unchanged from r310300, vendor/NetBSD/bmake/dist/mk/sys.vars.mk
Modified:
  head/contrib/bmake/ChangeLog
  head/contrib/bmake/Makefile
  head/contrib/bmake/bmake.1
  head/contrib/bmake/bmake.cat1
  head/contrib/bmake/compat.c
  head/contrib/bmake/job.c
  head/contrib/bmake/main.c
  head/contrib/bmake/make.1
  head/contrib/bmake/make.c
  head/contrib/bmake/make.h
  head/contrib/bmake/mk/ChangeLog
  head/contrib/bmake/mk/FILES
  head/contrib/bmake/mk/dirdeps.mk
  head/contrib/bmake/mk/gendirdeps.mk
  head/contrib/bmake/mk/install-mk
  head/contrib/bmake/mk/lib.mk
  head/contrib/bmake/mk/meta.stage.mk
  head/contrib/bmake/mk/meta.sys.mk
  head/contrib/bmake/mk/meta2deps.py
  head/contrib/bmake/mk/meta2deps.sh
  head/contrib/bmake/mk/sys.mk
  head/contrib/bmake/nonints.h
  head/contrib/bmake/parse.c
  head/usr.bin/bmake/Makefile
Directory Properties:
  head/contrib/bmake/   (props changed)

Modified: head/contrib/bmake/ChangeLog
==
--- head/contrib/bmake/ChangeLogMon Dec 19 22:28:28 2016
(r310303)
+++ head/contrib/bmake/ChangeLogMon Dec 19 23:38:07 2016
(r310304)
@@ -1,3 +1,32 @@
+2016-12-12  Simon J. Gerraty  
+
+   * Makefile (_MAKE_VERSION): 20161212
+ Merge with NetBSD make, pick up
+  o main.c: look for obj.${MACHINE}-${MACHINE_ARCH} too.
+
+2016-12-09  Simon J. Gerraty  
+
+   * Makefile (_MAKE_VERSION): 20161209
+ Merge with NetBSD make, pick up
+ o main.c: cleanup setting of .OBJDIR
+ o parse.c: avoid coredump from (var)=val
+
+2016-11-26  Simon J. Gerraty  
+
+   * Makefile (_MAKE_VERSION): 20161126
+ Merge with NetBSD make, pick up
+ o make.c: Make_OODate: report src node name if path not set
+
+2016-09-26  Simon J. Gerraty  
+
+   * Makefile (_MAKE_VERSION): 20160926
+ Merge with NetBSD make, pick up
+ o support for .DELETE_ON_ERROR: (remove targets that fail)
+   
+2016-09-26  Simon J. Gerraty  
+
+   * Makefile MAN: tweak .Dt to match ${PROG}
+
 2016-08-18  Simon J. Gerraty  
 
* Makefile (_MAKE_VERSION): 20160818

Modified: head/contrib/bmake/Makefile
==
--- head/contrib/bmake/Makefile Mon Dec 19 22:28:28 2016(r310303)
+++ head/contrib/bmake/Makefile Mon Dec 19 23:38:07 2016(r310304)
@@ -1,7 +1,7 @@
-#  $Id: Makefile,v 1.72 2016/08/18 23:02:26 sjg Exp $
+#  $Id: Makefile,v 1.77 2016/12/12 07:34:19 sjg Exp $
 
 # Base version on src date
-_MAKE_VERSION= 20160818
+_MAKE_VERSION= 20161212
 
 PROG=  bmake
 
@@ -156,7 +156,10 @@ my.history: ${MAKEFILE}
 .NOPATH: ${MAN}
 ${MAN}:make.1 my.history
@echo making $@
-   @sed -e 's/^.Nx/NetBSD/' -e '/^.Nm/s/make/${PROG}/' \
+   @sed \
+   -e '/^.Dt/s/MAKE/${PROG:tu}/' \
+   -e 's/^.Nx/NetBSD/' \
+   -e '/^.Nm/s/make/${PROG}/' \
-e '/^.Sh HISTORY/rmy.history' \
-e '/^.Sh HISTORY/,$$s,^.Nm,make,' ${srcdir}/make.1 > $@
 

Modified: head/contrib/bmake/bmake.1
==
--- head/contrib/bmake/bmake.1  Mon Dec 19 22:28:28 2016(r310303)
+++ head/contrib/bmake/bmake.1  Mon Dec 19 23:38:07 2016(r310304)
@@ -1,4 +1,4 @@
-.\"$NetBSD: make.1,v 1.262 2016/08/18 19:23:20 wiz Exp $
+.\"$NetBSD: make.1,v 1.263 2016/08/26 23:37:54 dholland Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"The Regents of the University of California.  All rights reserved.
@@ -29,8 +29,8 @@
 .\"
 .\"from: @(#)make.18.4 (Berkeley) 3/19/94
 .\"
-.Dd August 15, 2016
-.Dt MAKE 1
+.Dd August 26, 2016
+.Dt BMAKE 1
 .Os
 .Sh NAME
 .Nm bmake
@@ -2011,6 +2011,14 @@ variable of a target that inherits
 .Ic .DEFAULT Ns 's
 commands is set
 to the target's own name.
+.It Ic .DELETE_ON_ERROR
+If this target is present in the makefile, it globally causes make to
+delete targets whose commands fail.
+(By default, only targets whose commands are interrupted during
+execution are deleted.
+This is the historical behavior.)
+This setting can be used to help prevent half-finished or malformed
+targets from being left around and corrupting future rebuilds.
 .It Ic .END
 Any command lines attached to this target are executed after everything
 else is done.

Modified: head/contrib/bmake/bmake.cat1
==
--- head/contrib/bmake/bmake.cat1   Mon 

svn commit: r310303 - stable/10/sys/fs/nfsserver

2016-12-19 Thread Rick Macklem
Author: rmacklem
Date: Mon Dec 19 22:28:28 2016
New Revision: 310303
URL: https://svnweb.freebsd.org/changeset/base/310303

Log:
  MFC: r309566
  Fix the NFSv4.1 server for Open reclaim after a reboot.
  
  The NFSv4.1 server failed to update the nfs-stablerestart file for
  a client when the client was issued its first Open. As such, recovery
  of Opens after a server reboot failed with NFSERR_NOGRACE.
  This patch fixes this.
  It also changes the code so that it malloc()'s the 1024 byte array
  instead of allocating it on the kernel stack for both NFSv4.0 and NFSv4.1.
  Note that this bug only affected NFSv4.1 and only when clients attempted
  to reclaim Opens after a server reboot.

Modified:
  stable/10/sys/fs/nfsserver/nfs_nfsdstate.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/nfsserver/nfs_nfsdstate.c
==
--- stable/10/sys/fs/nfsserver/nfs_nfsdstate.c  Mon Dec 19 22:18:36 2016
(r310302)
+++ stable/10/sys/fs/nfsserver/nfs_nfsdstate.c  Mon Dec 19 22:28:28 2016
(r310303)
@@ -2498,6 +2498,8 @@ nfsrv_openctrl(struct nfsrv_descript *nd
struct nfsclient *clp;
int error = 0, haslock = 0, ret, delegate = 1, writedeleg = 1;
int readonly = 0, cbret = 1, getfhret = 0;
+   int gotstate = 0, len = 0;
+   u_char *clidp = NULL;
 
if ((new_stp->ls_flags & NFSLCK_SHAREBITS) == NFSLCK_READACCESS)
readonly = 1;
@@ -2516,6 +2518,7 @@ nfsrv_openctrl(struct nfsrv_descript *nd
goto out;
}
 
+   clidp = malloc(NFSV4_OPAQUELIMIT, M_TEMP, M_WAITOK);
 tryagain:
MALLOC(new_lfp, struct nfslockfile *, sizeof (struct nfslockfile),
M_NFSDLOCKFILE, M_WAITOK);
@@ -3178,6 +3181,16 @@ tryagain:
nfsrv_openpluslock++;
nfsrv_delegatecnt++;
}
+   /*
+* Since NFSv4.1 never does an OpenConfirm, the first
+* open state will be acquired here.
+*/
+   if (!(clp->lc_flags & LCL_STAMPEDSTABLE)) {
+   clp->lc_flags |= LCL_STAMPEDSTABLE;
+   len = clp->lc_idlen;
+   NFSBCOPY(clp->lc_id, clidp, len);
+   gotstate = 1;
+   }
} else {
*rflagsp |= NFSV4OPEN_RESULTCONFIRM;
new_stp->ls_flags = NFSLCK_NEEDSCONFIRM;
@@ -3214,7 +3227,17 @@ tryagain:
if (new_deleg)
FREE((caddr_t)new_deleg, M_NFSDSTATE);
 
+   /*
+* If the NFSv4.1 client just acquired its first open, write a timestamp
+* to the stable storage file.
+*/
+   if (gotstate != 0) {
+   nfsrv_writestable(clidp, len, NFSNST_NEWSTATE, p);
+   nfsrv_backupstable();
+   }
+
 out:
+   free(clidp, M_TEMP);
NFSEXITCODE2(error, nd);
return (error);
 }
@@ -3231,7 +3254,7 @@ nfsrv_openupdate(vnode_t vp, struct nfss
struct nfslockfile *lfp;
u_int32_t bits;
int error = 0, gotstate = 0, len = 0;
-   u_char client[NFSV4_OPAQUELIMIT];
+   u_char *clidp = NULL;
 
/*
 * Check for restart conditions (client and server).
@@ -3241,6 +3264,7 @@ nfsrv_openupdate(vnode_t vp, struct nfss
if (error)
goto out;
 
+   clidp = malloc(NFSV4_OPAQUELIMIT, M_TEMP, M_WAITOK);
NFSLOCKSTATE();
/*
 * Get the open structure via clientid and stateid.
@@ -3319,7 +3343,7 @@ nfsrv_openupdate(vnode_t vp, struct nfss
if (!(clp->lc_flags & LCL_STAMPEDSTABLE)) {
clp->lc_flags |= LCL_STAMPEDSTABLE;
len = clp->lc_idlen;
-   NFSBCOPY(clp->lc_id, client, len);
+   NFSBCOPY(clp->lc_id, clidp, len);
gotstate = 1;
}
NFSUNLOCKSTATE();
@@ -3366,11 +3390,12 @@ nfsrv_openupdate(vnode_t vp, struct nfss
 * to the stable storage file.
 */
if (gotstate != 0) {
-   nfsrv_writestable(client, len, NFSNST_NEWSTATE, p);
+   nfsrv_writestable(clidp, len, NFSNST_NEWSTATE, p);
nfsrv_backupstable();
}
 
 out:
+   free(clidp, M_TEMP);
NFSEXITCODE2(error, nd);
return (error);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r310138 - head/lib/libc/stdio

2016-12-19 Thread Adrian Chadd
[snip]

tl;dr - can we revert it from stdio for now so we don't end up having
people use this?



-adrian
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310302 - head/sys/kern

2016-12-19 Thread Konstantin Belousov
Author: kib
Date: Mon Dec 19 22:18:36 2016
New Revision: 310302
URL: https://svnweb.freebsd.org/changeset/base/310302

Log:
  Do not clear KN_INFLUX when not owning influx state.
  
  For notes in KN_INFLUX|KN_SCAN state, the influx bit is set by a
  parallel scan.  When knote() reports event for the vnode filters,
  which require kqueue unlocked, it unconditionally sets and then clears
  influx to keep note around kqueue unlock.  There, do not clear influx
  flag if a scan set it, since we do not own it, instead we prevent scan
  from executing by holding knlist lock.
  
  The knote_fork() function has somewhat similar problem, it might set
  KN_INFLUX for scanned note, drop kqueue and list locks, and then clear
  the flag after relock.  A solution there would be different enough, as
  well as the test program, so close the reported issue first.
  
  Reported and test case provided by:   yjh0...@gmail.com
  PR:   214923
  Tested by:pho
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/kern/kern_event.c

Modified: head/sys/kern/kern_event.c
==
--- head/sys/kern/kern_event.c  Mon Dec 19 22:15:29 2016(r310301)
+++ head/sys/kern/kern_event.c  Mon Dec 19 22:18:36 2016(r310302)
@@ -2006,6 +2006,7 @@ knote(struct knlist *list, long hint, in
struct kqueue *kq;
struct knote *kn, *tkn;
int error;
+   bool own_influx;
 
if (list == NULL)
return;
@@ -2036,11 +2037,14 @@ knote(struct knlist *list, long hint, in
 */
KQ_UNLOCK(kq);
} else if ((lockflags & KNF_NOKQLOCK) != 0) {
-   kn->kn_status |= KN_INFLUX;
+   own_influx = (kn->kn_status & KN_INFLUX) == 0;
+   if (own_influx)
+   kn->kn_status |= KN_INFLUX;
KQ_UNLOCK(kq);
error = kn->kn_fop->f_event(kn, hint);
KQ_LOCK(kq);
-   kn->kn_status &= ~KN_INFLUX;
+   if (own_influx)
+   kn->kn_status &= ~KN_INFLUX;
if (error)
KNOTE_ACTIVATE(kn, 1);
KQ_UNLOCK_FLUX(kq);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310301 - stable/11/sys/fs/nfsserver

2016-12-19 Thread Rick Macklem
Author: rmacklem
Date: Mon Dec 19 22:15:29 2016
New Revision: 310301
URL: https://svnweb.freebsd.org/changeset/base/310301

Log:
  MFC: r309566
  Fix the NFSv4.1 server for Open reclaim after a reboot.
  
  The NFSv4.1 server failed to update the nfs-stablerestart file for
  a client when the client was issued its first Open. As such, recovery
  of Opens after a server reboot failed with NFSERR_NOGRACE.
  This patch fixes this.
  It also changes the code so that it malloc()'s the 1024 byte array
  instead of allocating it on the kernel stack for both NFSv4.0 and NFSv4.1.
  Note that this bug only affected NFSv4.1 and only when clients attempted
  to reclaim Opens after a server reboot.

Modified:
  stable/11/sys/fs/nfsserver/nfs_nfsdstate.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/nfsserver/nfs_nfsdstate.c
==
--- stable/11/sys/fs/nfsserver/nfs_nfsdstate.c  Mon Dec 19 21:51:13 2016
(r310300)
+++ stable/11/sys/fs/nfsserver/nfs_nfsdstate.c  Mon Dec 19 22:15:29 2016
(r310301)
@@ -2501,6 +2501,8 @@ nfsrv_openctrl(struct nfsrv_descript *nd
struct nfsclient *clp;
int error = 0, haslock = 0, ret, delegate = 1, writedeleg = 1;
int readonly = 0, cbret = 1, getfhret = 0;
+   int gotstate = 0, len = 0;
+   u_char *clidp = NULL;
 
if ((new_stp->ls_flags & NFSLCK_SHAREBITS) == NFSLCK_READACCESS)
readonly = 1;
@@ -2519,6 +2521,7 @@ nfsrv_openctrl(struct nfsrv_descript *nd
goto out;
}
 
+   clidp = malloc(NFSV4_OPAQUELIMIT, M_TEMP, M_WAITOK);
 tryagain:
MALLOC(new_lfp, struct nfslockfile *, sizeof (struct nfslockfile),
M_NFSDLOCKFILE, M_WAITOK);
@@ -3181,6 +3184,16 @@ tryagain:
nfsrv_openpluslock++;
nfsrv_delegatecnt++;
}
+   /*
+* Since NFSv4.1 never does an OpenConfirm, the first
+* open state will be acquired here.
+*/
+   if (!(clp->lc_flags & LCL_STAMPEDSTABLE)) {
+   clp->lc_flags |= LCL_STAMPEDSTABLE;
+   len = clp->lc_idlen;
+   NFSBCOPY(clp->lc_id, clidp, len);
+   gotstate = 1;
+   }
} else {
*rflagsp |= NFSV4OPEN_RESULTCONFIRM;
new_stp->ls_flags = NFSLCK_NEEDSCONFIRM;
@@ -3217,7 +3230,17 @@ tryagain:
if (new_deleg)
FREE((caddr_t)new_deleg, M_NFSDSTATE);
 
+   /*
+* If the NFSv4.1 client just acquired its first open, write a timestamp
+* to the stable storage file.
+*/
+   if (gotstate != 0) {
+   nfsrv_writestable(clidp, len, NFSNST_NEWSTATE, p);
+   nfsrv_backupstable();
+   }
+
 out:
+   free(clidp, M_TEMP);
NFSEXITCODE2(error, nd);
return (error);
 }
@@ -3234,7 +3257,7 @@ nfsrv_openupdate(vnode_t vp, struct nfss
struct nfslockfile *lfp;
u_int32_t bits;
int error = 0, gotstate = 0, len = 0;
-   u_char client[NFSV4_OPAQUELIMIT];
+   u_char *clidp = NULL;
 
/*
 * Check for restart conditions (client and server).
@@ -3244,6 +3267,7 @@ nfsrv_openupdate(vnode_t vp, struct nfss
if (error)
goto out;
 
+   clidp = malloc(NFSV4_OPAQUELIMIT, M_TEMP, M_WAITOK);
NFSLOCKSTATE();
/*
 * Get the open structure via clientid and stateid.
@@ -3322,7 +3346,7 @@ nfsrv_openupdate(vnode_t vp, struct nfss
if (!(clp->lc_flags & LCL_STAMPEDSTABLE)) {
clp->lc_flags |= LCL_STAMPEDSTABLE;
len = clp->lc_idlen;
-   NFSBCOPY(clp->lc_id, client, len);
+   NFSBCOPY(clp->lc_id, clidp, len);
gotstate = 1;
}
NFSUNLOCKSTATE();
@@ -3369,11 +3393,12 @@ nfsrv_openupdate(vnode_t vp, struct nfss
 * to the stable storage file.
 */
if (gotstate != 0) {
-   nfsrv_writestable(client, len, NFSNST_NEWSTATE, p);
+   nfsrv_writestable(clidp, len, NFSNST_NEWSTATE, p);
nfsrv_backupstable();
}
 
 out:
+   free(clidp, M_TEMP);
NFSEXITCODE2(error, nd);
return (error);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310300 - vendor/NetBSD/bmake/20161212

2016-12-19 Thread Simon J. Gerraty
Author: sjg
Date: Mon Dec 19 21:51:13 2016
New Revision: 310300
URL: https://svnweb.freebsd.org/changeset/base/310300

Log:
  tag bmake-20161212

Added:
  vendor/NetBSD/bmake/20161212/
 - copied from r310299, vendor/NetBSD/bmake/dist/
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310299 - in vendor/NetBSD/bmake/dist: . mk

2016-12-19 Thread Simon J. Gerraty
Author: sjg
Date: Mon Dec 19 21:50:59 2016
New Revision: 310299
URL: https://svnweb.freebsd.org/changeset/base/310299

Log:
  Import bmake-20161212
  
  From ChangeLog
  2016-12-12  Simon J. Gerraty  
  
* Makefile (_MAKE_VERSION): 20161212
  Merge with NetBSD make, pick up
o main.c: look for obj.${MACHINE}-${MACHINE_ARCH} too.
  
  2016-12-09  Simon J. Gerraty  
  
* Makefile (_MAKE_VERSION): 20161209
  Merge with NetBSD make, pick up
  o main.c: cleanup setting of .OBJDIR
  o parse.c: avoid coredump from (var)=val
  
  2016-11-26  Simon J. Gerraty  
  
* Makefile (_MAKE_VERSION): 20161126
  Merge with NetBSD make, pick up
  o make.c: Make_OODate: report src node name if path not set
  
  2016-09-26  Simon J. Gerraty  
  
* Makefile (_MAKE_VERSION): 20160926
  Merge with NetBSD make, pick up
  o support for .DELETE_ON_ERROR: (remove targets that fail)
  
  2016-09-26  Simon J. Gerraty  
  
* Makefile MAN: tweak .Dt to match ${PROG}
  
  mk/ChangeLog
  
  2016-12-12  Simon J. Gerraty  
  
* install-mk (MK_VERSION): 20161212
  
* meta2deps.py: set pid_cwd[pid] when we process 'C'hdir,
rather than when we detect pid change.
  
  2016-12-07  Simon J. Gerraty  
  
* install-mk (MK_VERSION): 20161207
  
* meta.stage.mk: add stage_as_and_symlink for staging packages.
  We build foo.tgz stage_as foo-${VERSION}.tgz but want to be able
  to use foo.tgz to reference the latest staged version - so we
  make foo.tgz a symlink to it.
  Using a target to do both operations ensures we stay in sync.
  
  2016-11-26  Simon J. Gerraty  
  
* install-mk (MK_VERSION): 20161126
  
* dirdeps.mk: set DIRDEPS_CACHE before we include local.dirdeps.mk
  so it can add dependencies.
  
  2016-10-10  Simon J. Gerraty  
  
* dirdeps.mk: set DEP_* before we expand .MAKE.DEPENDFILE_PREFERENCE
  do that they can influence the result correctly.
  
* dirdeps.mk (${DIRDEPS_CACHE}): make sure we pass on TARGET_SPEC
  
* dirdeps.mk: Add ONLY_TARGET_SPEC_LIST and NOT_TARGET_SPEC_LIST
  similar to ONLY_MACHINE_LIST and NOT_MACHINE_LIST
  
  2016-10-05  Simon J. Gerraty  
  
* dirdeps.mk: remove dependence on jot (normal situations anyway).
  Before we read another Makefile.depend* set DEP_* vars from
  _DEP_TARGET_SPEC in case it uses any of them with :=
  When bootstrapping, trim any ,* from extention of chosen _src
  Makefile.depend* to get the machine value we subst for.
  
  2016-09-30  Simon J. Gerraty  
  
* dirdeps.mk: use TARGET_SPEC_VARS to qualify components added to
  DEP_SKIP_DIR and DEP_DIRDEPS_FILTER
  
* sys.mk: extract some bits to sys.{debug,vars}.mk
  for easier re-use by others.
  
  2016-09-23  Simon Gerraty  
  
* lib.mk: Use ${PICO} for extension for PIC objects.
  default to .pico (like NetBSD) safe on case insensitive filesystem.
  
  2016-08-19  Simon J. Gerraty  
  
* meta.sys.mk (META_COOKIE_TOUCH): use ${.OBJDIR}/${.TARGET:T} as 
default

Added:
  vendor/NetBSD/bmake/dist/mk/sys.debug.mk   (contents, props changed)
  vendor/NetBSD/bmake/dist/mk/sys.vars.mk   (contents, props changed)
Modified:
  vendor/NetBSD/bmake/dist/ChangeLog
  vendor/NetBSD/bmake/dist/Makefile
  vendor/NetBSD/bmake/dist/bmake.1
  vendor/NetBSD/bmake/dist/bmake.cat1
  vendor/NetBSD/bmake/dist/compat.c
  vendor/NetBSD/bmake/dist/job.c
  vendor/NetBSD/bmake/dist/main.c
  vendor/NetBSD/bmake/dist/make.1
  vendor/NetBSD/bmake/dist/make.c
  vendor/NetBSD/bmake/dist/make.h
  vendor/NetBSD/bmake/dist/mk/ChangeLog
  vendor/NetBSD/bmake/dist/mk/FILES
  vendor/NetBSD/bmake/dist/mk/dirdeps.mk
  vendor/NetBSD/bmake/dist/mk/gendirdeps.mk
  vendor/NetBSD/bmake/dist/mk/install-mk
  vendor/NetBSD/bmake/dist/mk/lib.mk
  vendor/NetBSD/bmake/dist/mk/meta.stage.mk
  vendor/NetBSD/bmake/dist/mk/meta.sys.mk
  vendor/NetBSD/bmake/dist/mk/meta2deps.py
  vendor/NetBSD/bmake/dist/mk/meta2deps.sh
  vendor/NetBSD/bmake/dist/mk/sys.mk
  vendor/NetBSD/bmake/dist/nonints.h
  vendor/NetBSD/bmake/dist/parse.c

Modified: vendor/NetBSD/bmake/dist/ChangeLog
==
--- vendor/NetBSD/bmake/dist/ChangeLog  Mon Dec 19 21:27:18 2016
(r310298)
+++ vendor/NetBSD/bmake/dist/ChangeLog  Mon Dec 19 21:50:59 2016
(r310299)
@@ -1,3 +1,32 @@
+2016-12-12  Simon J. Gerraty  
+
+   * Makefile (_MAKE_VERSION): 20161212
+ Merge with NetBSD make, pick up
+  o main.c: look 

svn commit: r310298 - head/sys/cam/ctl

2016-12-19 Thread Alexander Motin
Author: mav
Date: Mon Dec 19 21:27:18 2016
New Revision: 310298
URL: https://svnweb.freebsd.org/changeset/base/310298

Log:
  Improve error handling when I/O split between several BIOs.
  
  If we get several error codes, handle one with lowest offset.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/ctl/ctl_backend_block.c

Modified: head/sys/cam/ctl/ctl_backend_block.c
==
--- head/sys/cam/ctl/ctl_backend_block.cMon Dec 19 20:34:05 2016
(r310297)
+++ head/sys/cam/ctl/ctl_backend_block.cMon Dec 19 21:27:18 2016
(r310298)
@@ -201,7 +201,8 @@ struct ctl_be_block_io {
int num_bios_sent;
int num_bios_done;
int send_complete;
-   int num_errors;
+   int first_error;
+   uint64_tfirst_error_offset;
struct bintime  ds_t0;
devstat_tag_typeds_tag_type;
devstat_trans_flags ds_trans_type;
@@ -486,8 +487,12 @@ ctl_be_block_biodone(struct bio *bio)
 
error = bio->bio_error;
mtx_lock(_lun->io_lock);
-   if (error != 0)
-   beio->num_errors++;
+   if (error != 0 &&
+   (beio->first_error == 0 ||
+bio->bio_offset < beio->first_error_offset)) {
+   beio->first_error = error;
+   beio->first_error_offset = bio->bio_offset;
+   }
 
beio->num_bios_done++;
 
@@ -520,7 +525,8 @@ ctl_be_block_biodone(struct bio *bio)
 * If there are any errors from the backing device, we fail the
 * entire I/O with a medium error.
 */
-   if (beio->num_errors > 0) {
+   error = beio->first_error;
+   if (error != 0) {
if (error == EOPNOTSUPP) {
ctl_set_invalid_opcode(>scsiio);
} else if (error == ENOSPC || error == EDQUOT) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r310171 - head/sys/sys

2016-12-19 Thread Joerg Sonnenberger
On Mon, Dec 19, 2016 at 12:37:27PM -0800, Ravi Pokala wrote:
> With all apologies to Churchill, SCN/PRI are the worst way to address
> this in a machine-independent way, except for all the other ways that
> have been tried from time to time. :-P

They can't be the worst as they at least don't involve additional
variables or using larger than necessary types.

Joerg
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r310171 - head/sys/sys

2016-12-19 Thread Ravi Pokala
-Original Message-
> From:  on behalf of Ian Lepore 
> 
> Date: 2016-12-19, Monday at 11:20
> To: Warner Losh , Ravi Pokala 
> Cc: Sepherosa Ziehau , Dimitry Andric 
> , src-committers , 
> "svn-src-all@freebsd.org" , 
> "svn-src-h...@freebsd.org" 
> Subject: Re: svn commit: r310171 - head/sys/sys
> 
> On Mon, 2016-12-19 at 11:58 -0700, Warner Losh wrote:
>>
>> ...
>> 
>> Are there other precedence for avoiding the SCN macros in the tree as
>> well, or is this new art?
>> 
>> Warner
> 
> There was another commit recently the fixed the same kind of scanf
> error by making the variable fit the scanf type (changing uint64_t to
> an explicit long long unsigned, iirc).  I don't know if that alone
> counts as a precedent, but IMO it's a more palatible fix than the
> SCN/PRI ugliness.

With all apologies to Churchill, SCN/PRI are the worst way to address this in a 
machine-independent way, except for all the other ways that have been tried 
from time to time. :-P

-Ravi (rpokala@)

> -- Ian



___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310297 - in head/sys: conf dev/bhnd/nvram dev/bhnd/tools modules/bhnd

2016-12-19 Thread Landon J. Fuller
Author: landonf
Date: Mon Dec 19 20:34:05 2016
New Revision: 310297
URL: https://svnweb.freebsd.org/changeset/base/310297

Log:
  bhnd(4): NVRAM serialization support.
  
  This adds support for:
  
  - Serializing an bhnd_nvram_plist (as exported from bhnd_nvram_store, etc) to
an arbitrary NVRAM data format.
  - Generating a serialized representation of the current NVRAM store's state
suitable for writing back to flash, or re-encoding for upload to a
FullMAC device.
  
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D8762

Added:
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom_subr.c   (contents, props 
changed)
Modified:
  head/sys/conf/files
  head/sys/dev/bhnd/nvram/bhnd_nvram_data.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmraw.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmreg.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_btxt.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_spromvar.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_tlv.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_datavar.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_private.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_store.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_store.h
  head/sys/dev/bhnd/tools/nvram_map_gen.awk
  head/sys/modules/bhnd/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Mon Dec 19 20:31:27 2016(r310296)
+++ head/sys/conf/files Mon Dec 19 20:34:05 2016(r310297)
@@ -1236,6 +1236,7 @@ dev/bhnd/nvram/bhnd_nvram_data_bcm.c  opt
 dev/bhnd/nvram/bhnd_nvram_data_bcmraw.coptional bhnd
 dev/bhnd/nvram/bhnd_nvram_data_btxt.c  optional bhnd
 dev/bhnd/nvram/bhnd_nvram_data_sprom.c optional bhnd
+dev/bhnd/nvram/bhnd_nvram_data_sprom_subr.coptional bhnd
 dev/bhnd/nvram/bhnd_nvram_data_tlv.c   optional bhnd
 dev/bhnd/nvram/bhnd_nvram_if.m optional bhnd
 dev/bhnd/nvram/bhnd_nvram_io.c optional bhnd

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data.c
==
--- head/sys/dev/bhnd/nvram/bhnd_nvram_data.c   Mon Dec 19 20:31:27 2016
(r310296)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_data.c   Mon Dec 19 20:34:05 2016
(r310297)
@@ -65,6 +65,54 @@ bhnd_nvram_data_class_desc(bhnd_nvram_da
 }
 
 /**
+ * Return the class-level capability flags (@see BHND_NVRAM_DATA_CAP_*) for
+ * of @p cls.
+ *
+ * @param cls The NVRAM class.
+ */
+uint32_t
+bhnd_nvram_data_class_caps(bhnd_nvram_data_class *cls)
+{
+   return (cls->caps);
+}
+
+/**
+ * Serialize all NVRAM properties in @p plist using @p cls's NVRAM data
+ * format, writing the result to @p outp.
+ * 
+ * @param  cls The NVRAM data class to be used to perform
+ * serialization.
+ * @param  props   The raw property values to be serialized to
+ * @p outp, in serialization order.
+ * @param  options Serialization options for @p cls, or NULL.
+ * @param[out] outpOn success, the serialed NVRAM data will be
+ * written to this buffer. This argment may be
+ * NULL if the value is not desired.
+ * @param[in,out]  olenThe capacity of @p buf. On success, will be set
+ * to the actual length of the serialized data.
+ *
+ * @retval 0   success
+ * 
+ * @retval ENOMEM  If @p outp is non-NULL and a buffer of @p olen is too
+ * small to hold the serialized data.
+ * @retval EINVAL  If a property value required by @p cls is not found in
+ * @p plist.
+ * @retval EFTYPE  If a property value in @p plist cannot be represented
+ * as the data type required by @p cls.
+ * @retval ERANGE  If a property value in @p plist would would overflow
+ * (or underflow) the data type required by @p cls.
+ * @retval non-zeroIf serialization otherwise fails, a regular unix error
+ * code will be returned.
+ */
+int
+bhnd_nvram_data_serialize(bhnd_nvram_data_class *cls,
+bhnd_nvram_plist *props, bhnd_nvram_plist *options, void *outp,
+size_t *olen)
+{
+   return (cls->op_serialize(cls, props, options, outp, olen));
+}
+
+/**
  * Probe to see if this NVRAM data class class supports the data mapped by the
  * given I/O context, returning a BHND_NVRAM_DATA_PROBE probe result.
  *
@@ -293,51 +341,6 @@ bhnd_nvram_data_options(struct bhnd_nvra
 }
 
 /**
- * Compute the size of the serialized form of @p nv.
- *
- * Serialization may be performed via bhnd_nvram_data_serialize().
- *
- * @param  nv  The NVRAM data to be queried.
- * @param[out] len On success, will be set to the computed size.
- * 
- 

svn commit: r310296 - head/sys/dev/bhnd/nvram

2016-12-19 Thread Landon J. Fuller
Author: landonf
Date: Mon Dec 19 20:31:27 2016
New Revision: 310296
URL: https://svnweb.freebsd.org/changeset/base/310296

Log:
  bhnd(4): Add support for exporting all (or a subtree) of NVRAM
  properties backed by an NVRAM store.
  
  This will be used to support:
  
  - Serializing the current NVRAM state for writing back to flash.
  - Exporting subsidiary device paths for serialization and upload to fullmac
chipsets.
  
  Additionally, this includes an improvement to BCM-RAW format detection
  to avoid matching on BCM-TEXT NVRAM data.
  
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D8761

Modified:
  head/sys/dev/bhnd/nvram/bhnd_nvram_data.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmraw.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmvar.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_btxt.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_tlv.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_datavar.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_store.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_store.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_store_subr.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_storevar.h

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data.c
==
--- head/sys/dev/bhnd/nvram/bhnd_nvram_data.c   Mon Dec 19 20:28:27 2016
(r310295)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_data.c   Mon Dec 19 20:31:27 2016
(r310296)
@@ -281,6 +281,18 @@ bhnd_nvram_data_count(struct bhnd_nvram_
 }
 
 /**
+ * Return a borrowed reference to the serialization options for @p nv,
+ * suitable for use with bhnd_nvram_data_serialize(), or NULL if none.
+ * 
+ * @param nv The NVRAM data to be queried.
+ */
+bhnd_nvram_plist *
+bhnd_nvram_data_options(struct bhnd_nvram_data *nv)
+{
+   return (nv->cls->op_options(nv));
+}
+
+/**
  * Compute the size of the serialized form of @p nv.
  *
  * Serialization may be performed via bhnd_nvram_data_serialize().

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data.h
==
--- head/sys/dev/bhnd/nvram/bhnd_nvram_data.h   Mon Dec 19 20:28:27 2016
(r310295)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_data.h   Mon Dec 19 20:31:27 2016
(r310296)
@@ -44,6 +44,7 @@
 
 #include "bhnd_nvram.h"
 #include "bhnd_nvram_io.h"
+#include "bhnd_nvram_plist.h"
 #include "bhnd_nvram_value.h"
 
 /* NVRAM data class */
@@ -115,6 +116,7 @@ int  bhnd_nvram_data_size(struct bhnd_
 int bhnd_nvram_data_serialize(struct bhnd_nvram_data *nv,
 void *buf, size_t *len);
 
+bhnd_nvram_plist   *bhnd_nvram_data_options(struct bhnd_nvram_data *nv);
 uint32_tbhnd_nvram_data_caps(struct bhnd_nvram_data *nv);
 
 const char *bhnd_nvram_data_next(struct bhnd_nvram_data *nv,

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c
==
--- head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c   Mon Dec 19 20:28:27 
2016(r310295)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c   Mon Dec 19 20:31:27 
2016(r310296)
@@ -121,6 +121,7 @@ static const struct bhnd_nvram_bcm_hvar 
 struct bhnd_nvram_bcm {
struct bhnd_nvram_data   nv;/**< common instance state */
struct bhnd_nvram_io*data;  /**< backing buffer */
+   bhnd_nvram_plist*opts;  /**< serialization options */
 
/** BCM header values */
struct bhnd_nvram_bcm_hvar   hvars[nitems(bhnd_nvram_bcm_hvars)];
@@ -157,7 +158,7 @@ bhnd_nvram_bcm_init(struct bhnd_nvram_bc
uint8_t *p;
void*ptr;
size_t   io_offset, io_size;
-   uint8_t  crc, valid;
+   uint8_t  crc, valid, bcm_ver;
int  error;
 
if ((error = bhnd_nvram_io_read(src, 0x0, , sizeof(hdr
@@ -344,6 +345,14 @@ bhnd_nvram_bcm_init(struct bhnd_nvram_bc
bcm->count++;
}
 
+   /* Populate serialization options from our header */
+   bcm_ver = BCM_NVRAM_GET_BITS(hdr.cfg0, BCM_NVRAM_CFG0_VER);
+   error = bhnd_nvram_plist_append_bytes(bcm->opts,
+   BCM_NVRAM_ENCODE_OPT_VERSION, _ver, sizeof(bcm_ver),
+   BHND_NVRAM_TYPE_UINT8);
+   if (error)
+   return (error);
+
return (0);
 }
 
@@ -360,6 +369,12 @@ bhnd_nvram_bcm_new(struct bhnd_nvram_dat
"hvar declarations must match bhnd_nvram_bcm_hvars template");
memcpy(bcm->hvars, bhnd_nvram_bcm_hvars, sizeof(bcm->hvars));
 
+   /* Allocate (empty) option list, to be populated by
+* 

svn commit: r310295 - in head/sys: conf dev/bhnd/nvram modules/bhnd

2016-12-19 Thread Landon J. Fuller
Author: landonf
Date: Mon Dec 19 20:28:27 2016
New Revision: 310295
URL: https://svnweb.freebsd.org/changeset/base/310295

Log:
  bhnd(4): NVRAM device path support.
  
  Implements bhnd_nvram_store support for parsing and operating over NVRAM
  device paths, and device path aliases, as well as tracking per-path NVRAM
  variable writes.
  
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D8760

Added:
  head/sys/dev/bhnd/nvram/bhnd_nvram_store_subr.c   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/dev/bhnd/nvram/bhnd_nvram_data.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcmraw.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_btxt.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_tlv.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_datavar.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_private.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_store.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_store.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_storevar.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_subr.c
  head/sys/modules/bhnd/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Mon Dec 19 20:26:10 2016(r310294)
+++ head/sys/conf/files Mon Dec 19 20:28:27 2016(r310295)
@@ -1244,6 +1244,7 @@ dev/bhnd/nvram/bhnd_nvram_ioptr.c option
 dev/bhnd/nvram/bhnd_nvram_iores.c  optional bhnd
 dev/bhnd/nvram/bhnd_nvram_plist.c  optional bhnd
 dev/bhnd/nvram/bhnd_nvram_store.c  optional bhnd
+dev/bhnd/nvram/bhnd_nvram_store_subr.c optional bhnd
 dev/bhnd/nvram/bhnd_nvram_subr.c   optional bhnd
 dev/bhnd/nvram/bhnd_nvram_value.c  optional bhnd
 dev/bhnd/nvram/bhnd_nvram_value_fmts.c optional bhnd

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data.c
==
--- head/sys/dev/bhnd/nvram/bhnd_nvram_data.c   Mon Dec 19 20:26:10 2016
(r310294)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_data.c   Mon Dec 19 20:28:27 2016
(r310295)
@@ -350,7 +350,26 @@ bhnd_nvram_data_caps(struct bhnd_nvram_d
 const char *
 bhnd_nvram_data_next(struct bhnd_nvram_data *nv, void **cookiep)
 {
-   return (nv->cls->op_next(nv, cookiep));
+   const char  *name;
+#ifdef BHND_NV_INVARIANTS
+   void*prev = *cookiep;
+#endif
+
+   /* Fetch next */
+   if ((name = nv->cls->op_next(nv, cookiep)) == NULL)
+   return (NULL);
+
+   /* Enforce precedence ordering invariant between bhnd_nvram_data_next()
+* and bhnd_nvram_data_getvar_order() */
+#ifdef BHND_NV_INVARIANTS
+   if (prev != NULL &&
+   bhnd_nvram_data_getvar_order(nv, prev, *cookiep) > 0)
+   {
+   BHND_NV_PANIC("%s: returned out-of-order entry", __FUNCTION__);
+   }
+#endif
+
+   return (name);
 }
 
 /**
@@ -388,7 +407,7 @@ bhnd_nvram_data_generic_find(struct bhnd
 
cookiep = NULL;
while ((next = bhnd_nvram_data_next(nv, ))) {
-   if (strcasecmp(name, next) == 0)
+   if (strcmp(name, next) == 0)
return (cookiep);
}
 
@@ -397,6 +416,37 @@ bhnd_nvram_data_generic_find(struct bhnd
 }
 
 /**
+ * Compare the declaration order of two NVRAM variables.
+ * 
+ * Variable declaration order is used to determine the current order of
+ * the variables in the source data, as well as to determine the precedence
+ * of variable declarations in data sources that define duplicate names.
+ * 
+ * The comparison order will match the order of variables returned via
+ * bhnd_nvstore_path_data_next().
+ *
+ * @param  nv  The NVRAM data.
+ * @param  cookiep1An NVRAM variable cookie previously
+ * returned via bhnd_nvram_data_next() or
+ * bhnd_nvram_data_find().
+ * @param  cookiep2An NVRAM variable cookie previously
+ * returned via bhnd_nvram_data_next() or
+ * bhnd_nvram_data_find().
+ *
+ * @retval <= -1   If @p cookiep1 has an earlier declaration order than
+ * @p cookiep2.
+ * @retval 0   If @p cookiep1 and @p cookiep2 are identical.
+ * @retval >= 1If @p cookiep has a later declaration order than
+ * @p cookiep2.
+ */
+int
+bhnd_nvram_data_getvar_order(struct bhnd_nvram_data *nv, void *cookiep1,
+void *cookiep2)
+{
+   return (nv->cls->op_getvar_order(nv, cookiep1, cookiep2));
+}
+
+/**
  * Read a variable and decode as @p type.
  *
  * @param  nv  The NVRAM data.
@@ -423,6 +473,58 @@ bhnd_nvram_data_getvar(struct bhnd_nvram
return (nv->cls->op_getvar(nv, cookiep, buf, len, type));
 }
 
+/*
+ * 

svn commit: r310294 - in head/sys: conf dev/bhnd/nvram modules/bhnd

2016-12-19 Thread Landon J. Fuller
Author: landonf
Date: Mon Dec 19 20:26:10 2016
New Revision: 310294
URL: https://svnweb.freebsd.org/changeset/base/310294

Log:
  bhnd(4): add support for wrapping arbitrary pointers in an NVRAM I/O
  context.
  
  Approved by:  adrian (mentor)
  Differential Revision: https://reviews.freebsd.org/D8759

Added:
  head/sys/dev/bhnd/nvram/bhnd_nvram_ioptr.c   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/dev/bhnd/nvram/bhnd_nvram_io.h
  head/sys/modules/bhnd/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Mon Dec 19 20:23:19 2016(r310293)
+++ head/sys/conf/files Mon Dec 19 20:26:10 2016(r310294)
@@ -1240,6 +1240,7 @@ dev/bhnd/nvram/bhnd_nvram_data_tlv.c  opt
 dev/bhnd/nvram/bhnd_nvram_if.m optional bhnd
 dev/bhnd/nvram/bhnd_nvram_io.c optional bhnd
 dev/bhnd/nvram/bhnd_nvram_iobuf.c  optional bhnd
+dev/bhnd/nvram/bhnd_nvram_ioptr.c  optional bhnd
 dev/bhnd/nvram/bhnd_nvram_iores.c  optional bhnd
 dev/bhnd/nvram/bhnd_nvram_plist.c  optional bhnd
 dev/bhnd/nvram/bhnd_nvram_store.c  optional bhnd

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_io.h
==
--- head/sys/dev/bhnd/nvram/bhnd_nvram_io.h Mon Dec 19 20:23:19 2016
(r310293)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_io.h Mon Dec 19 20:26:10 2016
(r310294)
@@ -52,6 +52,9 @@ struct bhnd_nvram_io  *bhnd_nvram_iobuf_c
 struct bhnd_nvram_io   *bhnd_nvram_iobuf_copy_range(struct bhnd_nvram_io *src,
 size_t offset, size_t size);
 
+struct bhnd_nvram_io   *bhnd_nvram_ioptr_new(const void *ptr, size_t size,
+size_t capacity, uint32_t flags);
+
 #ifdef _KERNEL
 struct bhnd_nvram_io   *bhnd_nvram_iores_new(struct bhnd_resource *r,
 bus_size_t offset, bus_size_t size,
@@ -76,4 +79,12 @@ int   bhnd_nvram_io_write_ptr(struct bh
 
 voidbhnd_nvram_io_free(struct bhnd_nvram_io *io);
 
+/**
+ * bhnd_nvram_ioptr flags
+ */
+enum {
+   BHND_NVRAM_IOPTR_RDONLY = (1<<0),   /**< read-only */
+   BHND_NVRAM_IOPTR_RDWR   = (1<<1),   /**< read/write */
+};
+
 #endif /* _BHND_NVRAM_BHND_NVRAM_IO_H_ */

Added: head/sys/dev/bhnd/nvram/bhnd_nvram_ioptr.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_ioptr.c  Mon Dec 19 20:26:10 2016
(r310294)
@@ -0,0 +1,228 @@
+/*-
+ * Copyright (c) 2016 Landon Fuller 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer,
+ *without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ *redistribution must be conditioned upon including a substantially
+ *similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#ifdef _KERNEL
+#include 
+#include 
+#include 
+#else /* !_KERNEL */
+#include 
+#include 
+#include 
+#include 
+#endif /* _KERNEL */
+
+#include "bhnd_nvram_private.h"
+
+#include "bhnd_nvram_io.h"
+#include "bhnd_nvram_iovar.h"
+
+/**
+ * Memory-backed NVRAM I/O context.
+ *
+ * ioptr instances are gauranteed to provide persistent references to its
+ * backing contigious memory via bhnd_nvram_io_read_ptr() and
+ * bhnd_nvram_io_write_ptr().
+ */
+struct bhnd_nvram_ioptr {
+   struct bhnd_nvram_io io;/**< common I/O instance state 
*/
+   void*ptr;   /**< backing memory */
+   size_t   size;  /**< size at @p ptr */
+   size_t   capacity;  

svn commit: r310293 - head/sys/dev/bhnd/nvram

2016-12-19 Thread Landon J. Fuller
Author: landonf
Date: Mon Dec 19 20:23:19 2016
New Revision: 310293
URL: https://svnweb.freebsd.org/changeset/base/310293

Log:
  bhnd(4): Add support for three new NVRAM value types; booleans,
  NULL (which we'll use to denote deleted values in bhnd_nvram_store), and
  opaque data (aka octet-strings).
  
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D8758

Modified:
  head/sys/dev/bhnd/nvram/bhnd_nvram.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_plist.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_plist.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_store.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_subr.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_value.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_value.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_value_fmts.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_value_subr.c

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram.h
==
--- head/sys/dev/bhnd/nvram/bhnd_nvram.hMon Dec 19 20:20:33 2016
(r310292)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram.hMon Dec 19 20:23:19 2016
(r310293)
@@ -40,6 +40,14 @@
 #endif /* _KERNEL */
 
 /**
+ * BHND NVRAM boolean type; guaranteed to be exactly 8-bits, representing
+ * true as integer constant 1, and false as integer constant 0.
+ * 
+ * Compatible with stdbool constants (true, false).
+ */
+typedef uint8_tbhnd_nvram_bool_t;
+
+/**
  * NVRAM data sources supported by bhnd(4) devices.
  */
 typedef enum {
@@ -94,6 +102,10 @@ typedef enum {
BHND_NVRAM_TYPE_CHAR= 8,/**< ASCII/UTF-8 character */
BHND_NVRAM_TYPE_STRING  = 9,/**< ASCII/UTF-8 NUL-terminated
 string */
+   BHND_NVRAM_TYPE_BOOL= 10,   /**< uint8 boolean value. see
+bhnd_nvram_bool_t. */
+   BHND_NVRAM_TYPE_NULL= 11,   /**< NULL (empty) value */
+   BHND_NVRAM_TYPE_DATA= 12,   /**< opaque octet string */
 
/* 10-15 reserved for primitive (non-array) types */
 
@@ -109,13 +121,17 @@ typedef enum {
 characters */
BHND_NVRAM_TYPE_STRING_ARRAY= 25,   /**< array of ASCII/UTF-8
 NUL-terminated strings */
+   BHND_NVRAM_TYPE_BOOL_ARRAY  = 26,   /**< array of uint8 boolean
+values */
 } bhnd_nvram_type;
 
+
 boolbhnd_nvram_is_signed_type(bhnd_nvram_type type);
 boolbhnd_nvram_is_unsigned_type(bhnd_nvram_type type);
 boolbhnd_nvram_is_int_type(bhnd_nvram_type type);
 boolbhnd_nvram_is_array_type(bhnd_nvram_type type);
 bhnd_nvram_type bhnd_nvram_base_type(bhnd_nvram_type type);
+bhnd_nvram_type bhnd_nvram_raw_type(bhnd_nvram_type type);
 const char *bhnd_nvram_type_name(bhnd_nvram_type type);
 size_t  bhnd_nvram_type_width(bhnd_nvram_type type);
 size_t  bhnd_nvram_type_host_align(bhnd_nvram_type type);

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_plist.c
==
--- head/sys/dev/bhnd/nvram/bhnd_nvram_plist.c  Mon Dec 19 20:20:33 2016
(r310292)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_plist.c  Mon Dec 19 20:23:19 2016
(r310293)
@@ -743,6 +743,27 @@ bhnd_nvram_plist_get_uint64(bhnd_nvram_p
 }
 
 /**
+ * Return the boolean representation of a named property's value.
+ * 
+ * @param  plist   The property list to be queried.
+ * @param  nameThe name of the property value to be returned.
+ * @param[out] val On success, the boolean value of @p name.
+ *
+ * @retval 0   success
+ * @retval ENOENT  If @p name is not found in @p plist.
+ * @retval EFTYPE  If coercion of the property's value to @p val.
+ * @retval ERANGE  If coercion of the property's value would overflow
+ * (or underflow) @p val.
+ */
+int
+bhnd_nvram_plist_get_bool(bhnd_nvram_plist *plist, const char *name,
+bool *val)
+{
+   return (bhnd_nvram_plist_get_encoded(plist, name, val, sizeof(*val),
+   BHND_NVRAM_TYPE_BOOL));
+}
+
+/**
  * Allocate and initialize a new property value.
  * 
  * The caller is responsible for releasing the returned property value
@@ -901,6 +922,18 @@ bhnd_nvram_prop_type(bhnd_nvram_prop *pr
 }
 
 /**
+ * Return true if @p prop has a NULL value type (BHND_NVRAM_TYPE_NULL), false
+ * otherwise.
+ * 
+ * @param  propThe property to query.
+ */
+bool
+bhnd_nvram_prop_is_null(bhnd_nvram_prop *prop)
+{
+   return (bhnd_nvram_prop_type(prop) == BHND_NVRAM_TYPE_NULL);
+}
+
+/**
  * Return a borrowed reference to the property's internal value representation.
  *
  * @param  propThe property to query.

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_plist.h

svn commit: r310292 - in head/sys: conf dev/bhnd/nvram modules/bhnd

2016-12-19 Thread Landon J. Fuller
Author: landonf
Date: Mon Dec 19 20:20:33 2016
New Revision: 310292
URL: https://svnweb.freebsd.org/changeset/base/310292

Log:
  bhnd(4): support direct conversion of bhnd_nvram_val
  
  This adds support for bhnd_nvram_val_convert_init() and
  bhnd_nvram_val_convert_new(), which may be used to perform value
  format-aware encoding of an NVRAM value to a new target format/type.
  
  This will be used to simplify converting to/from serialized
  format-specific NVRAM value representations to common external
  representations.
  
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D8757

Added:
  head/sys/dev/bhnd/nvram/bhnd_nvram_value_subr.c   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/dev/bhnd/nvram/bhnd_nvram.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_private.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_store.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_subr.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_value.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_value.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_value_fmts.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_value_prf.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_valuevar.h
  head/sys/modules/bhnd/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Mon Dec 19 20:11:48 2016(r310291)
+++ head/sys/conf/files Mon Dec 19 20:20:33 2016(r310292)
@@ -1247,6 +1247,7 @@ dev/bhnd/nvram/bhnd_nvram_subr.c  optiona
 dev/bhnd/nvram/bhnd_nvram_value.c  optional bhnd
 dev/bhnd/nvram/bhnd_nvram_value_fmts.c optional bhnd
 dev/bhnd/nvram/bhnd_nvram_value_prf.c  optional bhnd
+dev/bhnd/nvram/bhnd_nvram_value_subr.c optional bhnd
 dev/bhnd/nvram/bhnd_sprom.coptional bhnd
 dev/bhnd/siba/siba.c   optional siba bhnd
 dev/bhnd/siba/siba_bhndb.c optional siba bhnd bhndb

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram.h
==
--- head/sys/dev/bhnd/nvram/bhnd_nvram.hMon Dec 19 20:11:48 2016
(r310291)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram.hMon Dec 19 20:20:33 2016
(r310292)
@@ -111,14 +111,16 @@ typedef enum {
 NUL-terminated strings */
 } bhnd_nvram_type;
 
-const char *bhnd_nvram_string_array_next(const char *inp, size_t ilen,
-const char *prev); 
-
 boolbhnd_nvram_is_signed_type(bhnd_nvram_type type);
 boolbhnd_nvram_is_unsigned_type(bhnd_nvram_type type);
 boolbhnd_nvram_is_int_type(bhnd_nvram_type type);
 boolbhnd_nvram_is_array_type(bhnd_nvram_type type);
 bhnd_nvram_type bhnd_nvram_base_type(bhnd_nvram_type type);
 const char *bhnd_nvram_type_name(bhnd_nvram_type type);
+size_t  bhnd_nvram_type_width(bhnd_nvram_type type);
+size_t  bhnd_nvram_type_host_align(bhnd_nvram_type type);
+
+const char *bhnd_nvram_string_array_next(const char *inp, size_t ilen,
+const char *prev, size_t *olen); 
 
 #endif /* _BHND_NVRAM_BHND_NVRAM_H_ */

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c
==
--- head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c   Mon Dec 19 20:11:48 
2016(r310291)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_data_bcm.c   Mon Dec 19 20:20:33 
2016(r310292)
@@ -647,10 +647,8 @@ bhnd_nvram_bcm_getvar_ptr(struct bhnd_nv
 
/* Handle header variables */
if ((hvar = bhnd_nvram_bcm_to_hdrvar(bcm, cookiep)) != NULL) {
-   BHND_NV_ASSERT(
-   hvar->len % bhnd_nvram_value_size(hvar->type, NULL, 0,
-   hvar->nelem) == 0,
-   ("length is not aligned to type width"));
+   BHND_NV_ASSERT(bhnd_nvram_value_check_aligned(>value,
+   hvar->len, hvar->type) == 0, ("value misaligned"));
 
*type = hvar->type;
*len = hvar->len;

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c
==
--- head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c Mon Dec 19 20:11:48 
2016(r310291)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c Mon Dec 19 20:20:33 
2016(r310292)
@@ -597,7 +597,7 @@ bhnd_nvram_sprom_read_offset(struct bhnd
} sp_value;
 
/* Determine type width */
-   sp_width = bhnd_nvram_value_size(type, NULL, 0, 1);
+   sp_width = bhnd_nvram_type_width(type);
if (sp_width == 0) {
/* Variable-width types are unsupported */
BHND_NV_LOG("invalid %s SPROM offset type %d\n", var->name,
@@ -716,7 +716,7 @@ bhnd_nvram_sprom_getvar(struct bhnd_nvra
var_btype = 

svn commit: r310291 - in head/sys: conf dev/bhnd/nvram modules/bhnd

2016-12-19 Thread Landon J. Fuller
Author: landonf
Date: Mon Dec 19 20:11:48 2016
New Revision: 310291
URL: https://svnweb.freebsd.org/changeset/base/310291

Log:
  bhnd(4): Implement a new bhnd_nvram_plist and bhnd_nvram_prop API for
  representing arbitrary Broadcom NVRAM key/value pairs.
  
  This will be used to track pending changes in bhnd_nvram_store, and
  provide support for exporting all or a device subpath for NVRAM (as
  required by some fullmac wifi chipsets).
  
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D8756

Added:
  head/sys/dev/bhnd/nvram/bhnd_nvram_plist.c   (contents, props changed)
  head/sys/dev/bhnd/nvram/bhnd_nvram_plist.h   (contents, props changed)
  head/sys/dev/bhnd/nvram/bhnd_nvram_plistvar.h   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/dev/bhnd/nvram/bhnd_nvram_private.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_value.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_value.h
  head/sys/modules/bhnd/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Mon Dec 19 20:07:58 2016(r310290)
+++ head/sys/conf/files Mon Dec 19 20:11:48 2016(r310291)
@@ -1241,6 +1241,7 @@ dev/bhnd/nvram/bhnd_nvram_if.moptional
 dev/bhnd/nvram/bhnd_nvram_io.c optional bhnd
 dev/bhnd/nvram/bhnd_nvram_iobuf.c  optional bhnd
 dev/bhnd/nvram/bhnd_nvram_iores.c  optional bhnd
+dev/bhnd/nvram/bhnd_nvram_plist.c  optional bhnd
 dev/bhnd/nvram/bhnd_nvram_store.c  optional bhnd
 dev/bhnd/nvram/bhnd_nvram_subr.c   optional bhnd
 dev/bhnd/nvram/bhnd_nvram_value.c  optional bhnd

Added: head/sys/dev/bhnd/nvram/bhnd_nvram_plist.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_plist.c  Mon Dec 19 20:11:48 2016
(r310291)
@@ -0,0 +1,947 @@
+/*-
+ * Copyright (c) 2015-2016 Landon Fuller 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer,
+ *without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ *redistribution must be conditioned upon including a substantially
+ *similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+
+#ifdef _KERNEL
+
+#include 
+
+#else /* !_KERNEL */
+
+#include 
+#include 
+#include 
+#include 
+
+#endif /* _KERNEL */
+
+#include "bhnd_nvram_plistvar.h"
+#include "bhnd_nvram_private.h"
+
+static bhnd_nvram_plist_entry  *bhnd_nvram_plist_get_entry(
+bhnd_nvram_plist *plist, const char *name);
+
+/**
+ * Allocate and initialize a new, empty property list.
+ * 
+ * The caller is responsible for releasing the returned property value
+ * via bhnd_nvram_plist_release().
+ * 
+ * @retval non-NULLsuccess
+ * @retval NULLif allocation fails.
+ */
+bhnd_nvram_plist *
+bhnd_nvram_plist_new(void)
+{
+   bhnd_nvram_plist *plist;
+
+   plist = bhnd_nv_calloc(1, sizeof(*plist));
+   if (plist == NULL)
+   return NULL;
+
+   /* Implicit caller-owned reference */
+   plist->refs = 1;
+
+   /* Initialize entry list */
+   plist->num_entries = 0;
+   TAILQ_INIT(>entries);
+
+   /* Initialize entry hash table */
+   for (size_t i = 0; i < nitems(plist->names); i++)
+   LIST_INIT(>names[i]);
+
+   return (plist);
+}
+
+/**
+ * Retain a reference and return @p plist to the caller.
+ * 
+ * The caller is responsible for releasing their reference ownership via
+ * bhnd_nvram_plist_release().
+ * 
+ * @param  plist   The property list to be retained.
+ */
+bhnd_nvram_plist *

svn commit: r310290 - in head/sys: dev/bhnd/nvram mips/broadcom

2016-12-19 Thread Landon J. Fuller
Author: landonf
Date: Mon Dec 19 20:07:58 2016
New Revision: 310290
URL: https://svnweb.freebsd.org/changeset/base/310290

Log:
  bhnd(4): minor style(9) fixes
  
  Approved by:  adrian (mentor)
  Differential Revision:https://reviews.freebsd.org/D8755

Modified:
  head/sys/dev/bhnd/nvram/bhnd_nvram_data.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_data.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_data_sprom.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_datavar.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_private.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_store.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_store.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_subr.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_value.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_value.h
  head/sys/dev/bhnd/nvram/bhnd_nvram_value_fmts.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_value_prf.c
  head/sys/dev/bhnd/nvram/bhnd_nvram_valuevar.h
  head/sys/mips/broadcom/bcm_nvram_cfe.c

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data.c
==
--- head/sys/dev/bhnd/nvram/bhnd_nvram_data.c   Mon Dec 19 19:40:11 2016
(r310289)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_data.c   Mon Dec 19 20:07:58 2016
(r310290)
@@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$");
  * @param cls The NVRAM class.
  */
 const char *
-bhnd_nvram_data_class_desc(bhnd_nvram_data_class_t *cls)
+bhnd_nvram_data_class_desc(bhnd_nvram_data_class *cls)
 {
return (cls->desc);
 }
@@ -80,7 +80,7 @@ bhnd_nvram_data_class_desc(bhnd_nvram_da
  * code should be returned.
  */
 int
-bhnd_nvram_data_probe(bhnd_nvram_data_class_t *cls, struct bhnd_nvram_io *io)
+bhnd_nvram_data_probe(bhnd_nvram_data_class *cls, struct bhnd_nvram_io *io)
 {
return (cls->op_probe(io));
 }
@@ -106,10 +106,10 @@ bhnd_nvram_data_probe(bhnd_nvram_data_cl
  */
 int
 bhnd_nvram_data_probe_classes(struct bhnd_nvram_data **data,
-struct bhnd_nvram_io *io, bhnd_nvram_data_class_t *classes[],
+struct bhnd_nvram_io *io, bhnd_nvram_data_class *classes[],
 size_t num_classes)
 {
-   bhnd_nvram_data_class_t *cls;
+   bhnd_nvram_data_class   *cls;
int  error, prio, result;
 
cls = NULL;
@@ -124,7 +124,7 @@ bhnd_nvram_data_probe_classes(struct bhn
 
/* Try to find the best data class capable of parsing io */
for (size_t i = 0; i < num_classes; i++) {
-   bhnd_nvram_data_class_t *next_cls;
+   bhnd_nvram_data_class *next_cls;
 
next_cls = classes[i];
 
@@ -196,8 +196,8 @@ bhnd_nvram_data_probe_classes(struct bhn
  * regular unix error code will be returned.
  */
 int
-bhnd_nvram_data_new(bhnd_nvram_data_class_t *cls,
-struct bhnd_nvram_data **nv, struct bhnd_nvram_io *io)
+bhnd_nvram_data_new(bhnd_nvram_data_class *cls, struct bhnd_nvram_data **nv,
+struct bhnd_nvram_io *io)
 {
struct bhnd_nvram_data  *data;
int  error;
@@ -263,8 +263,8 @@ bhnd_nvram_data_release(struct bhnd_nvra
  * 
  * @param nv The NVRAM data instance to be queried.
  */
-bhnd_nvram_data_class_t *
-bhnd_nvram_data_class(struct bhnd_nvram_data *nv)
+bhnd_nvram_data_class *
+bhnd_nvram_data_get_class(struct bhnd_nvram_data *nv)
 {
return (nv->cls);
 }
@@ -423,6 +423,7 @@ bhnd_nvram_data_getvar(struct bhnd_nvram
return (nv->cls->op_getvar(nv, cookiep, buf, len, type));
 }
 
+
 /**
  * A generic implementation of bhnd_nvram_data_getvar().
  * 
@@ -438,9 +439,9 @@ int
 bhnd_nvram_data_generic_rp_getvar(struct bhnd_nvram_data *nv, void *cookiep,
 void *outp, size_t *olen, bhnd_nvram_type otype)
 {
-   bhnd_nvram_val_t val;
+   bhnd_nvram_val   val;
const struct bhnd_nvram_vardefn *vdefn;
-   const bhnd_nvram_val_fmt_t  *fmt;
+   const bhnd_nvram_val_fmt*fmt;
const char  *name;
const void  *vptr;
bhnd_nvram_type  vtype;

Modified: head/sys/dev/bhnd/nvram/bhnd_nvram_data.h
==
--- head/sys/dev/bhnd/nvram/bhnd_nvram_data.h   Mon Dec 19 19:40:11 2016
(r310289)
+++ head/sys/dev/bhnd/nvram/bhnd_nvram_data.h   Mon Dec 19 20:07:58 2016
(r310290)
@@ -46,7 +46,7 @@
 #include "bhnd_nvram_io.h"
 
 /* NVRAM data class */
-typedef struct bhnd_nvram_data_class bhnd_nvram_data_class_t;
+typedef struct bhnd_nvram_data_class bhnd_nvram_data_class;
 
 /* NVRAM data instance */
 struct bhnd_nvram_data;
@@ -88,25 +88,24 @@ enum {
 parsing */
 };
 
-const char *bhnd_nvram_data_class_desc(
-bhnd_nvram_data_class_t *cls);
+const char *bhnd_nvram_data_class_desc(bhnd_nvram_data_class *cls);
 
-int bhnd_nvram_data_probe(bhnd_nvram_data_class_t *cls,
+int 

svn commit: r310289 - head/sys/dev/uart

2016-12-19 Thread Jayachandran C.
Author: jchandra
Date: Mon Dec 19 19:40:11 2016
New Revision: 310289
URL: https://svnweb.freebsd.org/changeset/base/310289

Log:
  Fix whitespace issues in pl011 uart driver
  
  Fix up trailing whitespace introduced by r310190. While there,
  fix a couple of earlier whitespace errors as well.

Modified:
  head/sys/dev/uart/uart_dev_pl011.c

Modified: head/sys/dev/uart/uart_dev_pl011.c
==
--- head/sys/dev/uart/uart_dev_pl011.c  Mon Dec 19 19:39:02 2016
(r310288)
+++ head/sys/dev/uart/uart_dev_pl011.c  Mon Dec 19 19:40:11 2016
(r310289)
@@ -173,7 +173,7 @@ uart_pl011_param(struct uart_bas *bas, i
line &= ~LCR_H_PEN;
 
/* Configure the rest */
-   line &=  ~LCR_H_FEN;
+   line &= ~LCR_H_FEN;
ctrl |= (CR_RXE | CR_TXE | CR_UARTEN);
 
if (bas->rclk != 0 && baudrate != 0) {
@@ -196,7 +196,7 @@ uart_pl011_init(struct uart_bas *bas, in
/* Mask all interrupts */
__uart_setreg(bas, UART_IMSC, __uart_getreg(bas, UART_IMSC) &
~IMSC_MASK_ALL);
-   
+
uart_pl011_param(bas, baudrate, databits, stopbits, parity);
 }
 
@@ -307,7 +307,7 @@ uart_pl011_bus_attach(struct uart_softc 
struct uart_pl011_softc *psc;
struct uart_bas *bas;
 
-   psc = (struct uart_pl011_softc *)sc; 
+   psc = (struct uart_pl011_softc *)sc;
bas = >sc_bas;
 
/* Enable interrupts */
@@ -373,7 +373,7 @@ uart_pl011_bus_ipend(struct uart_softc *
uint32_t ints;
int ipend;
 
-   psc = (struct uart_pl011_softc *)sc; 
+   psc = (struct uart_pl011_softc *)sc;
bas = >sc_bas;
 
uart_lock(sc->sc_hwmtx);
@@ -472,7 +472,7 @@ uart_pl011_bus_transmit(struct uart_soft
struct uart_bas *bas;
int i;
 
-   psc = (struct uart_pl011_softc *)sc; 
+   psc = (struct uart_pl011_softc *)sc;
bas = >sc_bas;
uart_lock(sc->sc_hwmtx);
 
@@ -504,7 +504,7 @@ uart_pl011_bus_grab(struct uart_softc *s
struct uart_pl011_softc *psc;
struct uart_bas *bas;
 
-   psc = (struct uart_pl011_softc *)sc; 
+   psc = (struct uart_pl011_softc *)sc;
bas = >sc_bas;
 
/* Disable interrupts on switch to polling */
@@ -519,7 +519,7 @@ uart_pl011_bus_ungrab(struct uart_softc 
struct uart_pl011_softc *psc;
struct uart_bas *bas;
 
-   psc = (struct uart_pl011_softc *) sc; 
+   psc = (struct uart_pl011_softc *)sc;
bas = >sc_bas;
 
/* Switch to using interrupts while not grabbed */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310288 - stable/10

2016-12-19 Thread Nikolai Lifanov
Author: lifanov (ports committer)
Date: Mon Dec 19 19:39:02 2016
New Revision: 310288
URL: https://svnweb.freebsd.org/changeset/base/310288

Log:
  MFC r310160
  
  retain cc.4.gz man page for Chelsio T6 NICs
  
  This man page was removed in r225583 when cc.4 was renamed to mod_cc.4
  With reintroduction of cc.4 "make installworld; make delete-old" was
  no longer convergent.
  
  Reviewed by:  matthew
  Approved by:  jhb (implicit), matthew (mentor)
  Differential Revision:https://reviews.freebsd.org/D8829

Modified:
  stable/10/ObsoleteFiles.inc
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/ObsoleteFiles.inc
==
--- stable/10/ObsoleteFiles.inc Mon Dec 19 19:37:55 2016(r310287)
+++ stable/10/ObsoleteFiles.inc Mon Dec 19 19:39:02 2016(r310288)
@@ -937,7 +937,6 @@ OLD_FILES+=usr/lib32/libftpio_p.a
 OLD_FILES+=usr/include/ftpio.h
 OLD_FILES+=usr/share/man/man3/ftpio.3.gz
 # 20110915: rename congestion control manpages
-OLD_FILES+=usr/share/man/man4/cc.4.gz
 OLD_FILES+=usr/share/man/man9/cc.9.gz
 # 20110831: atomic page flags operations
 OLD_FILES+=usr/share/man/man9/vm_page_flag.9.gz
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310287 - stable/11

2016-12-19 Thread Nikolai Lifanov
Author: lifanov (ports committer)
Date: Mon Dec 19 19:37:55 2016
New Revision: 310287
URL: https://svnweb.freebsd.org/changeset/base/310287

Log:
  MFC r310160
  
  retain cc.4.gz man page for Chelsio T6 NICs
  
  This man page was removed in r225583 when cc.4 was renamed to mod_cc.4
  With reintroduction of cc.4 "make installworld; make delete-old" was
  no longer convergent.
  
  Reviewed by:  matthew
  Approved by:  jhb (implicit), matthew (mentor)
  Differential Revision:https://reviews.freebsd.org/D8828

Modified:
  stable/11/ObsoleteFiles.inc
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/ObsoleteFiles.inc
==
--- stable/11/ObsoleteFiles.inc Mon Dec 19 19:21:28 2016(r310286)
+++ stable/11/ObsoleteFiles.inc Mon Dec 19 19:37:55 2016(r310287)
@@ -2777,7 +2777,6 @@ OLD_FILES+=usr/lib32/libftpio_p.a
 OLD_FILES+=usr/include/ftpio.h
 OLD_FILES+=usr/share/man/man3/ftpio.3.gz
 # 20110915: rename congestion control manpages
-OLD_FILES+=usr/share/man/man4/cc.4.gz
 OLD_FILES+=usr/share/man/man9/cc.9.gz
 # 20110831: atomic page flags operations
 OLD_FILES+=usr/share/man/man9/vm_page_flag.9.gz
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310286 - head/sys/netinet6

2016-12-19 Thread Mark Johnston
Author: markj
Date: Mon Dec 19 19:21:28 2016
New Revision: 310286
URL: https://svnweb.freebsd.org/changeset/base/310286

Log:
  Remove a bogus KASSERT from nd6_prefix_unlink().
  
  The caller may unlink a prefix before purging referencing addresses. An
  identical assertion in nd6_prefix_del() verifies that the addresses are
  purged before the prefix is freed.
  
  PR:   215372
  X-MFC With:   r306829

Modified:
  head/sys/netinet6/nd6_rtr.c

Modified: head/sys/netinet6/nd6_rtr.c
==
--- head/sys/netinet6/nd6_rtr.c Mon Dec 19 19:00:03 2016(r310285)
+++ head/sys/netinet6/nd6_rtr.c Mon Dec 19 19:21:28 2016(r310286)
@@ -1122,8 +1122,6 @@ void
 nd6_prefix_unlink(struct nd_prefix *pr, struct nd_prhead *list)
 {
 
-   KASSERT(pr->ndpr_addrcnt == 0,
-   ("prefix %p has referencing addresses", pr));
ND6_WLOCK_ASSERT();
 
LIST_REMOVE(pr, ndpr_entry);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r310171 - head/sys/sys

2016-12-19 Thread Ian Lepore
On Mon, 2016-12-19 at 11:58 -0700, Warner Losh wrote:
> On Mon, Dec 19, 2016 at 1:39 AM, Ravi Pokala  wrote:
> > 
> > -Original Message-
> > > 
> > > From:  on behalf of Sepherosa
> > > Ziehau 
> > > Date: 2016-12-18, Sunday at 23:02
> > > To: Dimitry Andric 
> > > Cc: , ,  > > -src-h...@freebsd.org>
> > > Subject: Re: svn commit: r310171 - head/sys/sys
> > > 
> > > The following patch unbreaks the LINT builds on amd64 for me
> > > after this commit:
> > > https://people.freebsd.org/~sephe/geom_sscanf.diff
> > Wouldn't it be better to use the SCN macros?
> Are there other precedence for avoiding the SCN macros in the tree as
> well, or is this new art?
> 
> Warner

There was another commit recently the fixed the same kind of scanf
error by making the variable fit the scanf type (changing uint64_t to
an explicit long long unsigned, iirc).  I don't know if that alone
counts as a precedent, but IMO it's a more palatible fix than the
SCN/PRI ugliness.

-- Ian

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r310171 - head/sys/sys

2016-12-19 Thread Dimitry Andric
On 19 Dec 2016, at 19:58, Warner Losh  wrote:
> 
> On Mon, Dec 19, 2016 at 1:39 AM, Ravi Pokala  wrote:
>> -Original Message-
>>> From:  on behalf of Sepherosa Ziehau 
>>> 
>>> Date: 2016-12-18, Sunday at 23:02
>>> To: Dimitry Andric 
>>> Cc: , , 
>>> 
>>> Subject: Re: svn commit: r310171 - head/sys/sys
>>> 
>>> The following patch unbreaks the LINT builds on amd64 for me after this 
>>> commit:
>>> https://people.freebsd.org/~sephe/geom_sscanf.diff
>> 
>> Wouldn't it be better to use the SCN macros?
> 
> Are there other precedence for avoiding the SCN macros in the tree as
> well, or is this new art?

I personally don't have anything against using the PRI or SCN macros,
but traditionally there has been some backlash against it, if I recall
correctly.  It also requires including either  or
, depending on circumstance or preference.

-Dimitry



signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r310285 - head/sys/cam/ctl

2016-12-19 Thread Alexander Motin
Author: mav
Date: Mon Dec 19 19:00:03 2016
New Revision: 310285
URL: https://svnweb.freebsd.org/changeset/base/310285

Log:
  When reporting "Logical block address out of range" error, report the LBA
  in sense data INFORMATION field.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/ctl/ctl_error.c
  head/sys/cam/ctl/ctl_error.h
  head/sys/cam/ctl/ctl_tpc.c

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Mon Dec 19 18:55:10 2016(r310284)
+++ head/sys/cam/ctl/ctl.c  Mon Dec 19 19:00:03 2016(r310285)
@@ -5362,7 +5362,8 @@ ctl_sync_cache(struct ctl_scsiio *ctsio)
 * to see an error for an out of range LBA.
 */
if ((starting_lba + block_count) > (lun->be_lun->maxlba + 1)) {
-   ctl_set_lba_out_of_range(ctsio);
+   ctl_set_lba_out_of_range(ctsio,
+   MAX(starting_lba, lun->be_lun->maxlba + 1));
ctl_done((union ctl_io *)ctsio);
goto bailout;
}
@@ -5678,7 +5679,8 @@ ctl_write_same(struct ctl_scsiio *ctsio)
 */
if (((lba + num_blocks) > (lun->be_lun->maxlba + 1))
 || ((lba + num_blocks) < lba)) {
-   ctl_set_lba_out_of_range(ctsio);
+   ctl_set_lba_out_of_range(ctsio,
+   MAX(lba, lun->be_lun->maxlba + 1));
ctl_done((union ctl_io *)ctsio);
return (CTL_RETVAL_COMPLETE);
}
@@ -5791,7 +5793,8 @@ ctl_unmap(struct ctl_scsiio *ctsio)
num_blocks = scsi_4btoul(range->length);
if (((lba + num_blocks) > (lun->be_lun->maxlba + 1))
 || ((lba + num_blocks) < lba)) {
-   ctl_set_lba_out_of_range(ctsio);
+   ctl_set_lba_out_of_range(ctsio,
+   MAX(lba, lun->be_lun->maxlba + 1));
ctl_done((union ctl_io *)ctsio);
return (CTL_RETVAL_COMPLETE);
}
@@ -6995,7 +6998,7 @@ ctl_get_lba_status(struct ctl_scsiio *ct
alloc_len = scsi_4btoul(cdb->alloc_len);
 
if (lba > lun->be_lun->maxlba) {
-   ctl_set_lba_out_of_range(ctsio);
+   ctl_set_lba_out_of_range(ctsio, lba);
ctl_done((union ctl_io *)ctsio);
return (CTL_RETVAL_COMPLETE);
}
@@ -8785,7 +8788,8 @@ ctl_read_write(struct ctl_scsiio *ctsio)
 */
if (((lba + num_blocks) > (lun->be_lun->maxlba + 1))
 || ((lba + num_blocks) < lba)) {
-   ctl_set_lba_out_of_range(ctsio);
+   ctl_set_lba_out_of_range(ctsio,
+   MAX(lba, lun->be_lun->maxlba + 1));
ctl_done((union ctl_io *)ctsio);
return (CTL_RETVAL_COMPLETE);
}
@@ -8894,7 +8898,8 @@ ctl_cnw(struct ctl_scsiio *ctsio)
 */
if (((lba + num_blocks) > (lun->be_lun->maxlba + 1))
 || ((lba + num_blocks) < lba)) {
-   ctl_set_lba_out_of_range(ctsio);
+   ctl_set_lba_out_of_range(ctsio,
+   MAX(lba, lun->be_lun->maxlba + 1));
ctl_done((union ctl_io *)ctsio);
return (CTL_RETVAL_COMPLETE);
}
@@ -9005,7 +9010,8 @@ ctl_verify(struct ctl_scsiio *ctsio)
 */
if (((lba + num_blocks) > (lun->be_lun->maxlba + 1))
 || ((lba + num_blocks) < lba)) {
-   ctl_set_lba_out_of_range(ctsio);
+   ctl_set_lba_out_of_range(ctsio,
+   MAX(lba, lun->be_lun->maxlba + 1));
ctl_done((union ctl_io *)ctsio);
return (CTL_RETVAL_COMPLETE);
}

Modified: head/sys/cam/ctl/ctl_error.c
==
--- head/sys/cam/ctl/ctl_error.cMon Dec 19 18:55:10 2016
(r310284)
+++ head/sys/cam/ctl/ctl_error.cMon Dec 19 19:00:03 2016
(r310285)
@@ -181,8 +181,8 @@ ctl_sense_to_desc(struct scsi_sense_data
   /*asc*/ sense_src->add_sense_code,
   /*ascq*/ sense_src->add_sense_code_qual,
 
-  /* Information Bytes */ 
-  (scsi_4btoul(sense_src->info) != 0) ?
+  /* Information Bytes */
+  (sense_src->error_code & SSD_ERRCODE_VALID) ?
   SSD_ELEM_INFO : SSD_ELEM_SKIP,
   sizeof(sense_src->info),
   sense_src->info,
@@ -727,14 +727,20 @@ ctl_set_aborted(struct ctl_scsiio *ctsio
 }
 
 void
-ctl_set_lba_out_of_range(struct ctl_scsiio *ctsio)
+ctl_set_lba_out_of_range(struct ctl_scsiio *ctsio, uint64_t lba)
 {
+   uint8_t info[8];
+
+   scsi_u64to8b(lba, info);
+
/* "Logical block address out of range" */
ctl_set_sense(ctsio,
  /*current_error*/ 1,
  

Re: svn commit: r310171 - head/sys/sys

2016-12-19 Thread Warner Losh
On Mon, Dec 19, 2016 at 1:39 AM, Ravi Pokala  wrote:
> -Original Message-
>> From:  on behalf of Sepherosa Ziehau 
>> 
>> Date: 2016-12-18, Sunday at 23:02
>> To: Dimitry Andric 
>> Cc: , , 
>> 
>> Subject: Re: svn commit: r310171 - head/sys/sys
>>
>> The following patch unbreaks the LINT builds on amd64 for me after this 
>> commit:
>> https://people.freebsd.org/~sephe/geom_sscanf.diff
>
> Wouldn't it be better to use the SCN macros?

Are there other precedence for avoiding the SCN macros in the tree as
well, or is this new art?

Warner

>> Thanks,
>> sephe
>>
>>
>> On Sat, Dec 17, 2016 at 3:49 AM, Dimitry Andric  wrote:
>>> Author: dim
>>> Date: Fri Dec 16 19:49:22 2016
>>> New Revision: 310171
>>> URL: https://svnweb.freebsd.org/changeset/base/310171
>>>
>>> Log:
>>>   Add __scanflike attributes to the kernel's sscanf() and vsscanf()
>>>   declarations.  This should help to catch future mismatches between
>>>   format strings and arguments.
>>>
>>>   MFC after:1 week
>>>
>>> Modified:
>>>   head/sys/sys/systm.h
>>>
>>> Modified: head/sys/sys/systm.h
>>> ==
>>> --- head/sys/sys/systm.hFri Dec 16 19:09:57 2016(r310170)
>>> +++ head/sys/sys/systm.hFri Dec 16 19:49:22 2016(r310171)
>>> @@ -227,8 +227,8 @@ int vsnprintf(char *, size_t, const char
>>>  intvsnrprintf(char *, size_t, int, const char *, __va_list) 
>>> __printflike(4, 0);
>>>  intvsprintf(char *buf, const char *, __va_list) __printflike(2, 0);
>>>  intttyprintf(struct tty *, const char *, ...) __printflike(2, 3);
>>> -intsscanf(const char *, char const *, ...) __nonnull(1) __nonnull(2);
>>> -intvsscanf(const char *, char const *, __va_list) __nonnull(1) 
>>> __nonnull(2);
>>> +intsscanf(const char *, char const *, ...) __nonnull(1) __nonnull(2) 
>>> __scanflike(2, 3);
>>> +intvsscanf(const char *, char const *, __va_list) __nonnull(1) 
>>> __nonnull(2) __scanflike(2, 0);
>>>  long   strtol(const char *, char **, int) __nonnull(1);
>>>  u_long strtoul(const char *, char **, int) __nonnull(1);
>>>  quad_t strtoq(const char *, char **, int) __nonnull(1);
>>> ___
>>> svn-src-all@freebsd.org mailing list
>>> https://lists.freebsd.org/mailman/listinfo/svn-src-all
>>> To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
>>
>> --
>> Tomorrow Will Never Die
>
>
>
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310284 - head/sys/cam/scsi

2016-12-19 Thread Alexander Motin
Author: mav
Date: Mon Dec 19 18:55:10 2016
New Revision: 310284
URL: https://svnweb.freebsd.org/changeset/base/310284

Log:
  When writing fixed format sense data, set VALID bit only if provided value
  for INFORMATION field fit into available 4 bytes (has no non-zero bytes
  except last 4), as explicitly required by SPC-5 specification.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/scsi/scsi_all.c

Modified: head/sys/cam/scsi/scsi_all.c
==
--- head/sys/cam/scsi/scsi_all.cMon Dec 19 18:32:26 2016
(r310283)
+++ head/sys/cam/scsi/scsi_all.cMon Dec 19 18:55:10 2016
(r310284)
@@ -4020,11 +4020,17 @@ scsi_set_sense_data_va(struct scsi_sense
data_dest = >info[0];
len_to_copy = MIN(sense_len,
sizeof(sense->info));
-   /*
-* We're setting the info field, so
-* set the valid bit.
-*/
-   sense->error_code |= SSD_ERRCODE_VALID;
+
+   /* Set VALID bit only if no overflow. */
+   for (i = 0; i < sense_len - len_to_copy;
+   i++) {
+   if (data[i] != 0)
+   break;
+   }
+   if (i >= sense_len - len_to_copy) {
+   sense->error_code |=
+   SSD_ERRCODE_VALID;
+   }
}
 
/*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310283 - stable/9/sys/dev/usb

2016-12-19 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Dec 19 18:32:26 2016
New Revision: 310283
URL: https://svnweb.freebsd.org/changeset/base/310283

Log:
  MFC r307902:
  
  Make the USB attach strings in dmesg include product name.

Modified:
  stable/9/sys/dev/usb/usb_device.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/dev/usb/usb_device.c
==
--- stable/9/sys/dev/usb/usb_device.c   Mon Dec 19 18:31:22 2016
(r310282)
+++ stable/9/sys/dev/usb/usb_device.c   Mon Dec 19 18:32:26 2016
(r310283)
@@ -1904,8 +1904,8 @@ config_done:
udev->ugen_symlink = usb_alloc_symlink(udev->ugen_name);
 
/* Announce device */
-   printf("%s: <%s> at %s\n", udev->ugen_name,
-   usb_get_manufacturer(udev),
+   printf("%s: <%s %s> at %s\n", udev->ugen_name,
+   usb_get_manufacturer(udev), usb_get_product(udev),
device_get_nameunit(udev->bus->bdev));
 #endif
 
@@ -2111,8 +2111,9 @@ usb_free_device(struct usb_device *udev,
 
 #if USB_HAVE_UGEN
if (!rebooting) {
-   printf("%s: <%s> at %s (disconnected)\n", udev->ugen_name,
-   usb_get_manufacturer(udev), device_get_nameunit(bus->bdev));
+   printf("%s: <%s %s> at %s (disconnected)\n", udev->ugen_name,
+   usb_get_manufacturer(udev), usb_get_product(udev),
+   device_get_nameunit(bus->bdev));
}
 
/* Destroy UGEN symlink, if any */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310282 - stable/9/lib/libusb

2016-12-19 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Dec 19 18:31:22 2016
New Revision: 310282
URL: https://svnweb.freebsd.org/changeset/base/310282

Log:
  MFC r307774:
  
  Fix libusb20_dev_get_desc(3) to use the "vendor product" order, not
  "product vendor". This is consistent with how it's generally done.
  The ordering is visible eg in usbconfig(8) output.

Modified:
  stable/9/lib/libusb/libusb20_ugen20.c
Directory Properties:
  stable/9/lib/libusb/   (props changed)

Modified: stable/9/lib/libusb/libusb20_ugen20.c
==
--- stable/9/lib/libusb/libusb20_ugen20.c   Mon Dec 19 18:27:22 2016
(r310281)
+++ stable/9/lib/libusb/libusb20_ugen20.c   Mon Dec 19 18:31:22 2016
(r310282)
@@ -206,8 +206,8 @@ ugen20_enumerate(struct libusb20_device 
 
snprintf(pdev->usb_desc, sizeof(pdev->usb_desc),
USB_GENERIC_NAME "%u.%u: <%s %s> at usbus%u", pdev->bus_number,
-   pdev->device_address, devinfo.udi_product,
-   devinfo.udi_vendor, pdev->bus_number);
+   pdev->device_address, devinfo.udi_vendor,
+   devinfo.udi_product, pdev->bus_number);
 
error = 0;
 done:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310281 - stable/10/sys/dev/usb

2016-12-19 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Dec 19 18:27:22 2016
New Revision: 310281
URL: https://svnweb.freebsd.org/changeset/base/310281

Log:
  MFC r307902:
  
  Make the USB attach strings in dmesg include product name.
  
  MFC after:1 month

Modified:
  stable/10/sys/dev/usb/usb_device.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/usb/usb_device.c
==
--- stable/10/sys/dev/usb/usb_device.c  Mon Dec 19 18:26:26 2016
(r310280)
+++ stable/10/sys/dev/usb/usb_device.c  Mon Dec 19 18:27:22 2016
(r310281)
@@ -1941,8 +1941,8 @@ config_done:
udev->ugen_symlink = usb_alloc_symlink(udev->ugen_name);
 
/* Announce device */
-   printf("%s: <%s> at %s\n", udev->ugen_name,
-   usb_get_manufacturer(udev),
+   printf("%s: <%s %s> at %s\n", udev->ugen_name,
+   usb_get_manufacturer(udev), usb_get_product(udev),
device_get_nameunit(udev->bus->bdev));
 #endif
 
@@ -2148,8 +2148,9 @@ usb_free_device(struct usb_device *udev,
 
 #if USB_HAVE_UGEN
if (!rebooting) {
-   printf("%s: <%s> at %s (disconnected)\n", udev->ugen_name,
-   usb_get_manufacturer(udev), device_get_nameunit(bus->bdev));
+   printf("%s: <%s %s> at %s (disconnected)\n", udev->ugen_name,
+   usb_get_manufacturer(udev), usb_get_product(udev),
+   device_get_nameunit(bus->bdev));
}
 
/* Destroy UGEN symlink, if any */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310280 - stable/10/lib/libusb

2016-12-19 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Dec 19 18:26:26 2016
New Revision: 310280
URL: https://svnweb.freebsd.org/changeset/base/310280

Log:
  MFC r307774:
  
  Fix libusb20_dev_get_desc(3) to use the "vendor product" order, not
  "product vendor". This is consistent with how it's generally done.
  The ordering is visible eg in usbconfig(8) output.

Modified:
  stable/10/lib/libusb/libusb20_ugen20.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libusb/libusb20_ugen20.c
==
--- stable/10/lib/libusb/libusb20_ugen20.c  Mon Dec 19 17:31:34 2016
(r310279)
+++ stable/10/lib/libusb/libusb20_ugen20.c  Mon Dec 19 18:26:26 2016
(r310280)
@@ -214,8 +214,8 @@ ugen20_enumerate(struct libusb20_device 
 
snprintf(pdev->usb_desc, sizeof(pdev->usb_desc),
USB_GENERIC_NAME "%u.%u: <%s %s> at usbus%u", pdev->bus_number,
-   pdev->device_address, devinfo.udi_product,
-   devinfo.udi_vendor, pdev->bus_number);
+   pdev->device_address, devinfo.udi_vendor,
+   devinfo.udi_product, pdev->bus_number);
 
error = 0;
 done:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r310242 - head/sys/dev/usb

2016-12-19 Thread Hans Petter Selasky

On 12/19/16 17:13, John Baldwin wrote:

On Monday, December 19, 2016 09:28:13 AM Hans Petter Selasky wrote:

Author: hselasky
Date: Mon Dec 19 09:28:12 2016
New Revision: 310242
URL: https://svnweb.freebsd.org/changeset/base/310242

Log:
  Defer USB enumeration until the SI_SUB_KICK_SCHEDULER is executed to avoid
  boot panics in conjunction with the recently added EARLY_AP_STARTUP feature.
  The panics happen due to using kernel facilities like callouts too early.

  Tested by:jhb @
  MFC after:1 week


As mentioned in the thread, the patches to usb_hub.c weren't needed and the 
block
in usb_process.c can just be removed unconditionally since it should never 
execute
in the non-EARLY_AP_STARTUP case.



Hi John,

The checks in usb_process.c are needed in case attaching a USB 
controller fails for some unknown reason. Then there is a problem that 
thread0 cannot wait/sleep for the process to exit, so that it doesn't 
access freed memory. Did I miss anything?


--HPS
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r307774 - head/lib/libusb

2016-12-19 Thread Edward Tomasz Napierala
On 1211T0110, Oliver Pinter wrote:
> On 10/22/16, Edward Tomasz Napierala  wrote:
> > Author: trasz
> > Date: Sat Oct 22 14:37:13 2016
> > New Revision: 307774
> > URL: https://svnweb.freebsd.org/changeset/base/307774
> >
> > Log:
> >   Fix libusb20_dev_get_desc(3) to use the "vendor product" order, not
> >   "product vendor". This is consistent with how it's generally done.
> >   The ordering is visible eg in usbconfig(8) output.
> >
> >   Note to self: MFC this to 9 and 8.
> >
> >   Reviewed by:  hselasky@
> >   MFC after:1 month
> 
> Is this MFC still valid? I can't see them in 10-STABLE nor in 11-STABLE.

Working on it, thanks for the reminder :-)

___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310279 - head/sys/conf

2016-12-19 Thread Ed Maste
Author: emaste
Date: Mon Dec 19 17:31:34 2016
New Revision: 310279
URL: https://svnweb.freebsd.org/changeset/base/310279

Log:
  newvers.sh: consider as modified SVN mixed revision and other cases
  
  The newvers -R option is intended to include build metadata (e.g. user,
  host, time) if the build is from an unmodified VCS tree. For subversion
  it considered a trailing 'M' as an indication of a modified tree, and
  any other version string as modified.
  
  Also include mixed revision checkouts (e.g. 123:126), switched (123S)
  and partial (123P) working copies as modified: the revision number is
  insufficient to uniquely determine which source was used for the build.
  
  Reported by:  gjb
  Reviewed by:  gjb
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D8853

Modified:
  head/sys/conf/newvers.sh

Modified: head/sys/conf/newvers.sh
==
--- head/sys/conf/newvers.shMon Dec 19 17:10:30 2016(r310278)
+++ head/sys/conf/newvers.shMon Dec 19 17:31:34 2016(r310279)
@@ -197,12 +197,17 @@ fi
 
 if [ -n "$svnversion" ] ; then
svn=`cd ${SYSDIR} && $svnversion 2>/dev/null`
-   if expr "$svn" : ".*M" >/dev/null; then
-   modified=true
-   fi
case "$svn" in
-   [0-9]*) svn=" r${svn}" ;;
-   *)  unset svn ;;
+   [0-9]*[MSP]|*:*)
+   svn=" r${svn}"
+   modified=true
+   ;;
+   [0-9]*)
+   svn=" r${svn}"
+   ;;
+   *)
+   unset svn
+   ;;
esac
 fi
 
@@ -270,7 +275,7 @@ if [ -n "$hg_cmd" ] ; then
 fi
 
 include_metadata=true
-while getopts r opt; do
+while getopts rR opt; do
case "$opt" in
r)
include_metadata=
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310278 - head/usr.sbin/syslogd

2016-12-19 Thread Hiroki Sato
Author: hrs
Date: Mon Dec 19 17:10:30 2016
New Revision: 310278
URL: https://svnweb.freebsd.org/changeset/base/310278

Log:
  Add a missing STAILQ_INSERT_TAIL() for allowaddr rule.

Modified:
  head/usr.sbin/syslogd/syslogd.c

Modified: head/usr.sbin/syslogd/syslogd.c
==
--- head/usr.sbin/syslogd/syslogd.c Mon Dec 19 17:05:24 2016
(r310277)
+++ head/usr.sbin/syslogd/syslogd.c Mon Dec 19 17:10:30 2016
(r310278)
@@ -2303,7 +2303,7 @@ static int
 allowaddr(char *s)
 {
char *cp1, *cp2;
-   struct allowedpeer ap;
+   struct allowedpeer *ap;
struct servent *se;
int masklen = -1;
struct addrinfo hints, *res;
@@ -2314,6 +2314,10 @@ allowaddr(char *s)
 #endif
char ip[NI_MAXHOST];
 
+   ap = calloc(1, sizeof(*ap));
+   if (ap == NULL)
+   err(1, "malloc failed");
+
 #ifdef INET6
if (*s != '[' || (cp1 = strchr(s + 1, ']')) == NULL)
 #endif
@@ -2323,20 +2327,20 @@ allowaddr(char *s)
*cp1++ = '\0';
if (strlen(cp1) == 1 && *cp1 == '*')
/* any port allowed */
-   ap.port = 0;
+   ap->port = 0;
else if ((se = getservbyname(cp1, "udp"))) {
-   ap.port = ntohs(se->s_port);
+   ap->port = ntohs(se->s_port);
} else {
-   ap.port = strtol(cp1, , 0);
+   ap->port = strtol(cp1, , 0);
if (*cp2 != '\0')
return (-1); /* port not numeric */
}
} else {
if ((se = getservbyname("syslog", "udp")))
-   ap.port = ntohs(se->s_port);
+   ap->port = ntohs(se->s_port);
else
/* sanity, should not happen */
-   ap.port = 514;
+   ap->port = 514;
}
 
if ((cp1 = strchr(s, '/')) != NULL &&
@@ -2363,14 +2367,14 @@ allowaddr(char *s)
hints.ai_socktype = SOCK_DGRAM;
hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST;
if (getaddrinfo(s, NULL, , ) == 0) {
-   ap.isnumeric = 1;
-   memcpy(_addr, res->ai_addr, res->ai_addrlen);
-   memset(_mask, 0, sizeof(ap.a_mask));
-   ap.a_mask.ss_family = res->ai_family;
+   ap->isnumeric = 1;
+   memcpy(>a_addr, res->ai_addr, res->ai_addrlen);
+   memset(>a_mask, 0, sizeof(ap->a_mask));
+   ap->a_mask.ss_family = res->ai_family;
if (res->ai_family == AF_INET) {
-   ap.a_mask.ss_len = sizeof(struct sockaddr_in);
-   maskp = &((struct sockaddr_in *)_mask)->sin_addr;
-   addrp = &((struct sockaddr_in *)_addr)->sin_addr;
+   ap->a_mask.ss_len = sizeof(struct sockaddr_in);
+   maskp = &((struct sockaddr_in *)>a_mask)->sin_addr;
+   addrp = &((struct sockaddr_in *)>a_addr)->sin_addr;
if (masklen < 0) {
/* use default netmask */
if (IN_CLASSA(ntohl(addrp->s_addr)))
@@ -2394,10 +2398,10 @@ allowaddr(char *s)
}
 #ifdef INET6
else if (res->ai_family == AF_INET6 && masklen <= 128) {
-   ap.a_mask.ss_len = sizeof(struct sockaddr_in6);
+   ap->a_mask.ss_len = sizeof(struct sockaddr_in6);
if (masklen < 0)
masklen = 128;
-   mask6p = (u_int32_t *)&((struct sockaddr_in6 
*)_mask)->sin6_addr;
+   mask6p = (u_int32_t *)&((struct sockaddr_in6 
*)>a_mask)->sin6_addr;
/* convert masklen to netmask */
while (masklen > 0) {
if (masklen < 32) {
@@ -2408,8 +2412,8 @@ allowaddr(char *s)
masklen -= 32;
}
/* Lose any host bits in the network number. */
-   mask6p = (u_int32_t *)&((struct sockaddr_in6 
*)_mask)->sin6_addr;
-   addr6p = (u_int32_t *)&((struct sockaddr_in6 
*)_addr)->sin6_addr;
+   mask6p = (u_int32_t *)&((struct sockaddr_in6 
*)>a_mask)->sin6_addr;
+   addr6p = (u_int32_t *)&((struct sockaddr_in6 
*)>a_addr)->sin6_addr;
for (i = 0; i < 4; i++)
addr6p[i] &= mask6p[i];
}
@@ -2421,8 +2425,8 @@ allowaddr(char *s)
freeaddrinfo(res);
} else {
/* arg `s' is domain name */
-   ap.isnumeric = 0;
-   ap.a_name = s;
+   ap->isnumeric = 0;
+   

svn commit: r310277 - stable/11/sys/dev/usb

2016-12-19 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Dec 19 17:05:24 2016
New Revision: 310277
URL: https://svnweb.freebsd.org/changeset/base/310277

Log:
  MFC r307902:
  
  Make the USB attach strings in dmesg include product name.

Modified:
  stable/11/sys/dev/usb/usb_device.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/usb/usb_device.c
==
--- stable/11/sys/dev/usb/usb_device.c  Mon Dec 19 17:02:55 2016
(r310276)
+++ stable/11/sys/dev/usb/usb_device.c  Mon Dec 19 17:05:24 2016
(r310277)
@@ -1938,8 +1938,8 @@ config_done:
udev->ugen_symlink = usb_alloc_symlink(udev->ugen_name);
 
/* Announce device */
-   printf("%s: <%s> at %s\n", udev->ugen_name,
-   usb_get_manufacturer(udev),
+   printf("%s: <%s %s> at %s\n", udev->ugen_name,
+   usb_get_manufacturer(udev), usb_get_product(udev),
device_get_nameunit(udev->bus->bdev));
 #endif
 
@@ -2148,8 +2148,9 @@ usb_free_device(struct usb_device *udev,
 
 #if USB_HAVE_UGEN
if (!rebooting) {
-   printf("%s: <%s> at %s (disconnected)\n", udev->ugen_name,
-   usb_get_manufacturer(udev), device_get_nameunit(bus->bdev));
+   printf("%s: <%s %s> at %s (disconnected)\n", udev->ugen_name,
+   usb_get_manufacturer(udev), usb_get_product(udev),
+   device_get_nameunit(bus->bdev));
}
 
/* Destroy UGEN symlink, if any */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310276 - stable/11/lib/libusb

2016-12-19 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Dec 19 17:02:55 2016
New Revision: 310276
URL: https://svnweb.freebsd.org/changeset/base/310276

Log:
  MFC r307774:
  
  Fix libusb20_dev_get_desc(3) to use the "vendor product" order, not
  "product vendor". This is consistent with how it's generally done.
  
  The ordering is visible eg in usbconfig(8) output.

Modified:
  stable/11/lib/libusb/libusb20_ugen20.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libusb/libusb20_ugen20.c
==
--- stable/11/lib/libusb/libusb20_ugen20.c  Mon Dec 19 15:49:59 2016
(r310275)
+++ stable/11/lib/libusb/libusb20_ugen20.c  Mon Dec 19 17:02:55 2016
(r310276)
@@ -214,8 +214,8 @@ ugen20_enumerate(struct libusb20_device 
 
snprintf(pdev->usb_desc, sizeof(pdev->usb_desc),
USB_GENERIC_NAME "%u.%u: <%s %s> at usbus%u", pdev->bus_number,
-   pdev->device_address, devinfo.udi_product,
-   devinfo.udi_vendor, pdev->bus_number);
+   pdev->device_address, devinfo.udi_vendor,
+   devinfo.udi_product, pdev->bus_number);
 
error = 0;
 done:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r310138 - head/lib/libc/stdio

2016-12-19 Thread John Baldwin
On Friday, December 16, 2016 07:31:28 PM Eric van Gyzen wrote:
> On 12/16/2016 17:44, Warner Losh wrote:
> > On Fri, Dec 16, 2016 at 3:07 PM, John Baldwin  wrote:
> >> On Friday, December 16, 2016 04:53:04 PM Eric van Gyzen wrote:
> >>> On 12/16/2016 16:45, John Baldwin wrote:
>  On Friday, December 16, 2016 08:53:26 PM Dimitry Andric wrote:
> > On 16 Dec 2016, at 20:31, Baptiste Daroussin  wrote:
> >>
> >> On Fri, Dec 16, 2016 at 01:44:51AM +, Conrad E. Meyer wrote:
> >>> Author: cem
> >>> Date: Fri Dec 16 01:44:50 2016
> >>> New Revision: 310138
> >>> URL: https://svnweb.freebsd.org/changeset/base/310138
> >>>
> >>> Log:
> >>>  vfprintf(3): Add support for kernel %b format
> >>>
> >>>  This is a direct port of the kernel %b format.
> >>>
> >>>  I'm unclear on if (more) non-portable printf extensions will be a
> >>>  problem. I think it's desirable to have userspace formats include all
> >>>  kernel formats, but there may be competing goals I'm not aware of.
> >>>
> >>>  Reviewed by:no one, unfortunately
> >>>  Sponsored by:   Dell EMC Isilon
> >>>  Differential Revision:  https://reviews.freebsd.org/D8426
> >>>
> >>
> >> I really don't think it is a good idea, if used in userland it would 
> >> be make
> >> more of our code difficult to port elsewhere.
> >
> > Indeed, this is a bad idea.  These custom format specifiers should be
> > eliminated, not multiplied. :-)
> >
> >
> >> Other than that, it makes more difficult to use vanilla gcc with out 
> >> userland.
> >> and it is adding more complexity to be able to build freebsd from a 
> >> non freebsd
> >> system which some people are working on.
> >>
> >> Personnaly I would prefer to see those extensions removed from the 
> >> kernel rather
> >> than see them available in userland.
> >
> > Same here.
> >
> >
> >> Can't we use simple helper function instead?
> >
> > Yes, please.  Just take the snprintb(3) function from NetBSD:
> >
> > http://netbsd.gw.com/cgi-bin/man-cgi?snprintb+3+NetBSD-current
> 
>  In general I agree with something like this instead, but it is quite a 
>  bit more
>  tedious to use as you have to run it once to determine the length, 
>  allocate a
>  buffer, and then run it again.  Calling malloc() for that buffer isn't 
>  always
>  convenient in the kernel (though it should be fine in userland).  Having 
>  it live
>  in printf() itself means the output is generated to the stream without 
>  having to
>  manage a variable-sized intermediate buffer.
> >>>
> >>> I imagine most callers can simply use a char[sizeof(fmt)+C] on the stack, 
> >>> where
> >>> C is some constant that I haven't taken the time to calculate, at the 
> >>> risk of
> >>> making myself look foolish and unprofessional.
> >>
> >> Hmm, that might work, but it is still cumbersome.  Probably to make things 
> >> readable
> >> we'd end up with a wrapper:
> >>
> >> printb(uint val, const char *fmt)
> >> {
> >>char buf[strlen(fmt) + C];
> >>
> >>snprintb(...);
> >>printf("%s", buf);
> >> }
> > 
> > Sadly this "cure" is worse than the disease.
> 
> How about this cure?
> 
>   printf("reg=%b\n", value, FORMAT);
> 
>   // versus
> 
>   char buf[BITMASK_BUFFER_SIZE(FORMAT)];
>   printf("reg=%s\n", format_bitmask(buf, sizeof(buf), value, FORMAT));
> 
> That doesn't seem so bad.

The trick here is giving FORMAT twice.  For code that often uses %b that
is untenable.  You would have to make it a macro (or use printb which only
accepts it once which is why I suggested that approach instead).  But a
macro moves its definition out of context.  Here's an example to think about:

/*
 * Here we should probably set up flags indicating
 * whether or not various features are available.
 * The interesting ones are probably VME, PSE, PAE,
 * and PGE.  The code already assumes without bothering
 * to check that all CPUs >= Pentium have a TSC and
 * MSRs.
 */
printf("\n  Features=0x%b", cpu_feature,
"\020"
"\001FPU"   /* Integral FPU */
"\002VME"   /* Extended VM86 mode support */
"\003DE"/* Debugging Extensions (CR4.DE) */
"\004PSE"   /* 4MByte page tables */
"\005TSC"   /* Timestamp counter */
"\006MSR"   /* Machine specific registers */
"\007PAE"   /* Physical address extension */
"\010MCE"   /* Machine Check support */
 

Re: svn commit: r308371 - in stable/10: share/man/man4 sys/conf sys/dev/jedec_ts sys/modules/i2c sys/modules/i2c/jedec_ts

2016-12-19 Thread John Baldwin
On Wednesday, December 14, 2016 05:41:47 PM Andriy Gapon wrote:
> On 05/12/2016 23:49, John Baldwin wrote:
> > On Sunday, November 06, 2016 01:56:34 PM Andriy Gapon wrote:
> >> Author: avg
> >> Date: Sun Nov  6 13:56:34 2016
> >> New Revision: 308371
> >> URL: https://svnweb.freebsd.org/changeset/base/308371
> >>
> >> Log:
> >>   MFC r307768: jedec_ts: a driver for thermal sensors on memory modules
> >>
> >> Added:
> >>   stable/10/share/man/man4/jedec_ts.4
> >>  - copied unchanged from r307768, head/share/man/man4/jedec_ts.4
> >>   stable/10/sys/dev/jedec_ts/
> >>  - copied from r307768, head/sys/dev/jedec_ts/
> >>   stable/10/sys/modules/i2c/jedec_ts/
> >>  - copied from r307768, head/sys/modules/i2c/jedec_ts/
> >> Modified:
> >>   stable/10/sys/conf/NOTES
> >>   stable/10/sys/conf/files
> >>   stable/10/sys/modules/i2c/Makefile
> >> Directory Properties:
> >>   stable/10/   (props changed)
> > 
> > FYI, this doesn't work and has broken tinderbox builds on stable/10.
> > smbus_get_addr() doesn't exist on 10.  It was originally a hand-rolled
> > ivar wrapper that was removed in r93023 in 2002.  The function prototype
> > was not removed, so the compile works, but linking fails.  The stale
> > prototype is still present in smbconf.h in HEAD (and should be removed).
> > The "real" smbus_get_addr() was added back to smbconf.h along with an
> > implementation of smbus_read_ivar() in r281985.  Parts of that commit
> > probably need to be MFC'd to 10.
> > 
> 
> John,
> 
> thank you for catching this and sorry for the trouble.
> Could you please check if r310062 really fixes the problem?

Yes.  Well, it fixes linking of kernels at least.  Now make tinderbox
on 10 fails for the following kernels:

_.ia64.GENERIC: Maxmem is not available on ia64.  It is spelled
paddr_max instead.  The firewire code is trying to use Maxmem.
_.ia64.LINT: Same.
_.arm.LINT: Many link errors and warnings, though lack of 'kbd_*' symbols
seems to be the only actual errors.

I suspect you recently MFC'd changes to fwohci.c that are using Maxmem.
However, I'm not sure it is worth fixing fwohci on ia64.

-- 
John Baldwin
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r310242 - head/sys/dev/usb

2016-12-19 Thread John Baldwin
On Monday, December 19, 2016 09:28:13 AM Hans Petter Selasky wrote:
> Author: hselasky
> Date: Mon Dec 19 09:28:12 2016
> New Revision: 310242
> URL: https://svnweb.freebsd.org/changeset/base/310242
> 
> Log:
>   Defer USB enumeration until the SI_SUB_KICK_SCHEDULER is executed to avoid
>   boot panics in conjunction with the recently added EARLY_AP_STARTUP feature.
>   The panics happen due to using kernel facilities like callouts too early.
>   
>   Tested by:  jhb @
>   MFC after:  1 week

As mentioned in the thread, the patches to usb_hub.c weren't needed and the 
block
in usb_process.c can just be removed unconditionally since it should never 
execute
in the non-EARLY_AP_STARTUP case.

-- 
John Baldwin
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r307684 - head/sbin/camcontrol

2016-12-19 Thread Kenneth D. Merry
On Sat, Dec 17, 2016 at 20:50:15 +0100, Oliver Pinter wrote:
> On 12/12/16, Kenneth D. Merry  wrote:
> > On Sun, Dec 11, 2016 at 00:49:12 +0100, Oliver Pinter wrote:
> >> On 10/20/16, Kenneth D. Merry  wrote:
> >> > Author: ken
> >> > Date: Thu Oct 20 19:42:26 2016
> >> > New Revision: 307684
> >> > URL: https://svnweb.freebsd.org/changeset/base/307684
> >> >
> >> > Log:
> >> >   For CCBs allocated on the stack, we need to clear the entire CCB, not
> >> > just
> >> >   the header.  Otherwise stack garbage can lead to random flags getting
> >> > set.
> >> >
> >> >   This showed up as 'camcontrol rescan all' failing with EINVAL because
> >> > the
> >> >   address type wasn't CAM_DATA_VADDR.
> >> >
> >> >   sbin/camcontrol/camcontrol.c:
> >> >  In rescan_or_reset_bus(), bzero the stack-allocated CCBs before
> >> >  use instead of clearing the body.
> >> >
> >> >   MFC after: 3 days
> >> >   Sponsored by:  Spectra Logic
> >>
> >> The MFC of this commit is missed both for 10-STABLE and 11-STABLE. Is
> >> this still in plan to do?
> >
> > Done, thanks for the reminder!
> 
> Thanks!
> 
> Slightly related problem what I found on one of my INVARIANTS enabled
> kernel is the following:
> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=215356 . A similar
> change what this is required in smartmontools too.

Ahh, yes, sounds like the same basic issue.  Thanks for submitting it
upstream!

Ken
-- 
Kenneth Merry
k...@freebsd.org
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310275 - head/sys/cam/ctl

2016-12-19 Thread Alexander Motin
Author: mav
Date: Mon Dec 19 15:49:59 2016
New Revision: 310275
URL: https://svnweb.freebsd.org/changeset/base/310275

Log:
  Fix typo in function name.

Modified:
  head/sys/cam/ctl/ctl_error.c

Modified: head/sys/cam/ctl/ctl_error.c
==
--- head/sys/cam/ctl/ctl_error.cMon Dec 19 15:23:24 2016
(r310274)
+++ head/sys/cam/ctl/ctl_error.cMon Dec 19 15:49:59 2016
(r310275)
@@ -366,7 +366,7 @@ ctl_set_ua(struct ctl_scsiio *ctsio, int
 }
 
 static void
-ctl_ua_to_acsq(struct ctl_lun *lun, ctl_ua_type ua_to_build, int *asc,
+ctl_ua_to_ascq(struct ctl_lun *lun, ctl_ua_type ua_to_build, int *asc,
 int *ascq, ctl_ua_type *ua_to_clear, uint8_t **info)
 {
 
@@ -492,7 +492,7 @@ ctl_build_qae(struct ctl_lun *lun, uint3
ua_to_build = (1 << (ffs(ua) - 1));
ua_to_clear = ua_to_build;
info = NULL;
-   ctl_ua_to_acsq(lun, ua_to_build, , , _to_clear, );
+   ctl_ua_to_ascq(lun, ua_to_build, , , _to_clear, );
 
resp[0] = SSD_KEY_UNIT_ATTENTION;
if (ua_to_build == ua)
@@ -537,7 +537,7 @@ ctl_build_ua(struct ctl_lun *lun, uint32
ua_to_build = (1 << (ffs(ua[i]) - 1));
ua_to_clear = ua_to_build;
info = NULL;
-   ctl_ua_to_acsq(lun, ua_to_build, , , _to_clear, );
+   ctl_ua_to_ascq(lun, ua_to_build, , , _to_clear, );
 
ctl_set_sense_data(sense, lun, sense_format, /*current_error*/ 1,
/*sense_key*/ SSD_KEY_UNIT_ATTENTION, asc, ascq,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310274 - head

2016-12-19 Thread Ed Maste
Author: emaste
Date: Mon Dec 19 15:23:24 2016
New Revision: 310274
URL: https://svnweb.freebsd.org/changeset/base/310274

Log:
  Add ld.debug to ObsoleteFiles.inc
  
  After r293285 GNU ld is installed as /usr/bin/ld.bfd, and linked as
  /usr/bin/ld.  The debug file is /usr/lib/debug/usr/bin/ld.bfd.debug.
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Mon Dec 19 15:19:44 2016(r310273)
+++ head/ObsoleteFiles.inc  Mon Dec 19 15:23:24 2016(r310274)
@@ -642,6 +642,8 @@ OLD_FILES+=usr/share/mdocml/style.css
 OLD_DIRS+=usr/share/mdocml
 # 20160114: SA-16:06.snmpd
 OLD_FILES+=usr/share/examples/etc/snmpd.config
+# 20160107: GNU ld installed as ld.bfd and linked as ld
+OLD_FILES+=usr/lib/debug/usr/bin/ld.debug
 # 20151225: new clang import which bumps version from 3.7.0 to 3.7.1.
 OLD_FILES+=usr/lib/clang/3.7.0/include/sanitizer/allocator_interface.h
 OLD_FILES+=usr/lib/clang/3.7.0/include/sanitizer/asan_interface.h
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310273 - head/sys/conf

2016-12-19 Thread Ed Maste
Author: emaste
Date: Mon Dec 19 15:19:44 2016
New Revision: 310273
URL: https://svnweb.freebsd.org/changeset/base/310273

Log:
  newvers.sh: add -R option to include metadata only for unmodified src tree
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/conf/newvers.sh

Modified: head/sys/conf/newvers.sh
==
--- head/sys/conf/newvers.shMon Dec 19 15:18:31 2016(r310272)
+++ head/sys/conf/newvers.shMon Dec 19 15:19:44 2016(r310273)
@@ -37,6 +37,10 @@
 #  the output file.  This is intended to allow two builds
 #  done at different times and even by different people on
 #  different hosts to produce identical output.
+#
+# -R   Reproducible build if the tree represents an unmodified
+#  checkout from a version control system.  Metadata is
+#  included if the tree is modified.
 
 TYPE="FreeBSD"
 REVISION="12.0"
@@ -193,6 +197,9 @@ fi
 
 if [ -n "$svnversion" ] ; then
svn=`cd ${SYSDIR} && $svnversion 2>/dev/null`
+   if expr "$svn" : ".*M" >/dev/null; then
+   modified=true
+   fi
case "$svn" in
[0-9]*) svn=" r${svn}" ;;
*)  unset svn ;;
@@ -227,6 +234,7 @@ if [ -n "$git_cmd" ] ; then
if $git_cmd --work-tree=${VCSDIR}/.. diff-index \
--name-only HEAD | read dummy; then
git="${git}-dirty"
+   modified=true
fi
 fi
 
@@ -239,7 +247,10 @@ if [ -n "$p4_cmd" ] ; then
p4opened=`cd ${SYSDIR} && $p4_cmd opened ./... 2>&1`
case "$p4opened" in
File*) ;;
-   //*)p4version="${p4version}+edit" ;;
+   //*)
+   p4version="${p4version}+edit"
+   modified=true
+   ;;
esac
;;
*)  unset p4version ;;
@@ -264,6 +275,10 @@ while getopts r opt; do
r)
include_metadata=
;;
+   R)
+   if [ -z "${modified}" ]; then
+   include_metadata=
+   fi
esac
 done
 shift $((OPTIND - 1))
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310272 - in head/sys/cam: ctl scsi

2016-12-19 Thread Alexander Motin
Author: mav
Date: Mon Dec 19 15:18:31 2016
New Revision: 310272
URL: https://svnweb.freebsd.org/changeset/base/310272

Log:
  Add new bits into Extended Inquiry VPD page.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/scsi/scsi_all.h

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Mon Dec 19 15:09:30 2016(r310271)
+++ head/sys/cam/ctl/ctl.c  Mon Dec 19 15:18:31 2016(r310272)
@@ -9542,7 +9542,7 @@ ctl_inquiry_evpd_eid(struct ctl_scsiio *
 * attention for a particular IT nexus on all LUNs once we report
 * it to that nexus once.  This bit is required as of SPC-4.
 */
-   eid_ptr->flags4 = SVPD_EID_LUICLT;
+   eid_ptr->flags4 = SVPD_EID_LUICLR;
 
/*
 * XXX KDM in order to correctly answer this, we would need

Modified: head/sys/cam/scsi/scsi_all.h
==
--- head/sys/cam/scsi/scsi_all.hMon Dec 19 15:09:30 2016
(r310271)
+++ head/sys/cam/scsi/scsi_all.hMon Dec 19 15:18:31 2016
(r310272)
@@ -2476,10 +2476,17 @@ struct scsi_vpd_extended_inquiry_data
 #defineSVPD_EID_NV_SUP 0x02
 #defineSVPD_EID_V_SUP  0x01
uint8_t flags4;
+#defineSVPD_EID_NO_PI_CHK  0x20
 #defineSVPD_EID_P_I_I_SUP  0x10
-#defineSVPD_EID_LUICLT 0x01
+#defineSVPD_EID_LUICLR 0x01
uint8_t flags5;
+#defineSVPD_EID_LUCT_MASK  0xe0
+#defineSVPD_EID_LUCT_NOT_REP   0x00
+#defineSVPD_EID_LUCT_CONGL 0x20
+#defineSVPD_EID_LUCT_GROUP 0x40
 #defineSVPD_EID_R_SUP  0x10
+#defineSVPD_EID_RTD_SUP0x08
+#defineSVPD_EID_HSSRELEF   0x02
 #defineSVPD_EID_CBCS   0x01
uint8_t flags6;
 #defineSVPD_EID_MULTI_I_T_FW   0x0F
@@ -2490,10 +2497,16 @@ struct scsi_vpd_extended_inquiry_data
uint8_t est[2];
uint8_t flags7;
 #defineSVPD_EID_POA_SUP0x80
-#defineSVPD_EID_HRA_SUP0x80
-#defineSVPD_EID_VSA_SUP0x80
+#defineSVPD_EID_HRA_SUP0x40
+#defineSVPD_EID_VSA_SUP0x20
uint8_t max_sense_length;
-   uint8_t reserved2[50];
+   uint8_t bind_flags;
+#defineSVPD_EID_IBS0x80
+#defineSVPD_EID_IAS0x40
+#defineSVPD_EID_SAC0x04
+#defineSVPD_EID_NRD1   0x02
+#defineSVPD_EID_NRD0   0x01
+   uint8_t reserved2[49];
 };
 
 struct scsi_vpd_mode_page_policy_descr
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310271 - head/tools/build/options

2016-12-19 Thread Glen Barber
Author: gjb
Date: Mon Dec 19 15:09:30 2016
New Revision: 310271
URL: https://svnweb.freebsd.org/changeset/base/310271

Log:
  Comment the RCSID.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/tools/build/options/WITH_REPRODUCIBLE_BUILD

Modified: head/tools/build/options/WITH_REPRODUCIBLE_BUILD
==
--- head/tools/build/options/WITH_REPRODUCIBLE_BUILDMon Dec 19 15:05:46 
2016(r310270)
+++ head/tools/build/options/WITH_REPRODUCIBLE_BUILDMon Dec 19 15:09:30 
2016(r310271)
@@ -1,4 +1,4 @@
-$FreeBSD$
+.\" $FreeBSD$
 Set to exclude build metadata (such as the build time, user, or host)
 from the kernel, boot loaders, and uname output, so that builds produce
 bit-for-bit identical output.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310270 - head/share/man/man5

2016-12-19 Thread Ed Maste
Author: emaste
Date: Mon Dec 19 15:05:46 2016
New Revision: 310270
URL: https://svnweb.freebsd.org/changeset/base/310270

Log:
  Restore missing comment in src.conf.5
  
  I'm not sure how I managed to generate src.conf.5 without the comment;
  add it manually while looking into that.
  
  Reported by:  gjb

Modified:
  head/share/man/man5/src.conf.5

Modified: head/share/man/man5/src.conf.5
==
--- head/share/man/man5/src.conf.5  Mon Dec 19 14:54:06 2016
(r310269)
+++ head/share/man/man5/src.conf.5  Mon Dec 19 15:05:46 2016
(r310270)
@@ -1369,7 +1369,7 @@ This includes
 .Xr rsh 1 ,
 etc.
 .It Va WITH_REPRODUCIBLE_BUILD
-from FreeBSD: head/tools/build/options/WITH_REPRODUCIBLE_BUILD 310268 
2016-12-19 14:45:59Z emaste
+.\" from FreeBSD: head/tools/build/options/WITH_REPRODUCIBLE_BUILD 310268 
2016-12-19 14:45:59Z emaste
 Set to exclude build metadata (such as the build time, user, or host)
 from the kernel, boot loaders, and uname output, so that builds produce
 bit-for-bit identical output.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310269 - head/share/man/man5

2016-12-19 Thread Ed Maste
Author: emaste
Date: Mon Dec 19 14:54:06 2016
New Revision: 310269
URL: https://svnweb.freebsd.org/changeset/base/310269

Log:
  src.conf.5: regen after r310268 (WITH_REPRODUCIBLE_BUILD)

Modified:
  head/share/man/man5/src.conf.5

Modified: head/share/man/man5/src.conf.5
==
--- head/share/man/man5/src.conf.5  Mon Dec 19 14:45:59 2016
(r310268)
+++ head/share/man/man5/src.conf.5  Mon Dec 19 14:54:06 2016
(r310269)
@@ -1,7 +1,7 @@
 .\" DO NOT EDIT-- this file is automatically generated.
 .\" from FreeBSD: head/tools/build/options/makeman 306729 2016-10-05 20:12:00Z 
emaste
 .\" $FreeBSD$
-.Dd December 10, 2016
+.Dd December 19, 2016
 .Dt SRC.CONF 5
 .Os
 .Sh NAME
@@ -1368,6 +1368,11 @@ This includes
 .Xr rlogin 1 ,
 .Xr rsh 1 ,
 etc.
+.It Va WITH_REPRODUCIBLE_BUILD
+from FreeBSD: head/tools/build/options/WITH_REPRODUCIBLE_BUILD 310268 
2016-12-19 14:45:59Z emaste
+Set to exclude build metadata (such as the build time, user, or host)
+from the kernel, boot loaders, and uname output, so that builds produce
+bit-for-bit identical output.
 .It Va WITHOUT_RESCUE
 .\" from FreeBSD: head/tools/build/options/WITHOUT_RESCUE 156932 2006-03-21 
07:50:50Z ru
 Set to not build
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310268 - in head: share/mk sys/boot/common tools/build/options

2016-12-19 Thread Ed Maste
Author: emaste
Date: Mon Dec 19 14:45:59 2016
New Revision: 310268
URL: https://svnweb.freebsd.org/changeset/base/310268

Log:
  Build loaders reproducibly when WITH_REPRODUCIBLE_BUILD
  
  When WITH_REPRODUCIBLE_BUILD=yes is set in src.conf(5), eliminate the
  time, user, and host from the loader's version information.  This allows
  builds to produce bit-for-bit identical output.
  
  Reviewed by:  bapt
  MFC after:1 month
  Relnotes: yes
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D8842

Modified:
  head/share/mk/src.opts.mk
  head/sys/boot/common/Makefile.inc
  head/sys/boot/common/newvers.sh
  head/tools/build/options/WITH_REPRODUCIBLE_BUILD

Modified: head/share/mk/src.opts.mk
==
--- head/share/mk/src.opts.mk   Mon Dec 19 14:40:59 2016(r310267)
+++ head/share/mk/src.opts.mk   Mon Dec 19 14:45:59 2016(r310268)
@@ -190,6 +190,7 @@ __DEFAULT_NO_OPTIONS = \
 OFED \
 OPENLDAP \
 RCS \
+REPRODUCIBLE_BUILD \
 SHARED_TOOLCHAIN \
 SORT_THREADS \
 SVN \

Modified: head/sys/boot/common/Makefile.inc
==
--- head/sys/boot/common/Makefile.inc   Mon Dec 19 14:40:59 2016
(r310267)
+++ head/sys/boot/common/Makefile.inc   Mon Dec 19 14:45:59 2016
(r310268)
@@ -74,5 +74,9 @@ CFLAGS+=-I${.CURDIR}/../../../../lib/lib
 
 CLEANFILES+=   vers.c
 VERSION_FILE?= ${.CURDIR}/version
+.if ${MK_REPRODUCIBLE_BUILD} != no
+REPRO_FLAG=-r
+.endif
 vers.c: ${SRCTOP}/sys/boot/common/newvers.sh ${VERSION_FILE}
-   sh ${SRCTOP}/sys/boot/common/newvers.sh ${VERSION_FILE} ${NEWVERSWHAT}
+   sh ${SRCTOP}/sys/boot/common/newvers.sh ${REPRO_FLAG} ${VERSION_FILE} \
+   ${NEWVERSWHAT}

Modified: head/sys/boot/common/newvers.sh
==
--- head/sys/boot/common/newvers.sh Mon Dec 19 14:40:59 2016
(r310267)
+++ head/sys/boot/common/newvers.sh Mon Dec 19 14:45:59 2016
(r310268)
@@ -35,11 +35,26 @@
 tempfile=$(mktemp tmp.XX) || exit
 trap "rm -f $tempfile" EXIT INT TERM
 
+include_metadata=true
+while getopts r opt; do
+   case "$opt" in
+   r)
+   include_metadata=
+   ;;
+   esac
+done
+shift $((OPTIND - 1))
+
 LC_ALL=C; export LC_ALL
 u=${USER-root} h=${HOSTNAME-`hostname`} t=`date`
 #r=`head -n 6 $1 | tail -n 1 | awk -F: ' { print $1 } '`
 r=`awk -F: ' /^[0-9]\.[0-9]+:/ { print $1; exit }' $1`
 
-echo "char bootprog_info[] = \"FreeBSD/${3} ${2}, Revision ${r}\\n(${t} 
${u}@${h})\\n\";" > $tempfile
+bootprog_info="FreeBSD/${3} ${2}, Revision ${r}\\n"
+if [ -n "${include_metadata}" ]; then
+   bootprog_info="$bootprog_info(${t} ${u}@${h})\\n"
+fi
+
+echo "char bootprog_info[] = \"$bootprog_info\";" > $tempfile
 echo "unsigned bootprog_rev = ${r%%.*}${r##*.};" >> $tempfile
 mv $tempfile vers.c

Modified: head/tools/build/options/WITH_REPRODUCIBLE_BUILD
==
--- head/tools/build/options/WITH_REPRODUCIBLE_BUILDMon Dec 19 14:40:59 
2016(r310267)
+++ head/tools/build/options/WITH_REPRODUCIBLE_BUILDMon Dec 19 14:45:59 
2016(r310268)
@@ -1,3 +1,4 @@
 $FreeBSD$
-Set to exclude build metadata (build time, user, host and path) from the
-kernel and uname output.
+Set to exclude build metadata (such as the build time, user, or host)
+from the kernel, boot loaders, and uname output, so that builds produce
+bit-for-bit identical output.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310267 - in head/sys/boot: arm/uboot common efi/loader i386/loader mips/beri/loader mips/uboot pc98/loader powerpc/kboot powerpc/ofw powerpc/ps3 powerpc/uboot sparc64/loader userboot/u...

2016-12-19 Thread Ed Maste
Author: emaste
Date: Mon Dec 19 14:40:59 2016
New Revision: 310267
URL: https://svnweb.freebsd.org/changeset/base/310267

Log:
  Deduplicate loader vers.c Makefile rules
  
  The Makefile rule to create vers.c for loader version info was
  previously duplicated in each of the various loader Makefiles.
  Instead, share a common rule in Makefile.inc.
  
  Reviewed by:  bapt
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D8841

Modified:
  head/sys/boot/arm/uboot/Makefile
  head/sys/boot/common/Makefile.inc
  head/sys/boot/efi/loader/Makefile
  head/sys/boot/i386/loader/Makefile
  head/sys/boot/mips/beri/loader/Makefile
  head/sys/boot/mips/uboot/Makefile
  head/sys/boot/pc98/loader/Makefile
  head/sys/boot/powerpc/kboot/Makefile
  head/sys/boot/powerpc/ofw/Makefile
  head/sys/boot/powerpc/ps3/Makefile
  head/sys/boot/powerpc/uboot/Makefile
  head/sys/boot/sparc64/loader/Makefile
  head/sys/boot/userboot/userboot/Makefile

Modified: head/sys/boot/arm/uboot/Makefile
==
--- head/sys/boot/arm/uboot/MakefileMon Dec 19 14:19:52 2016
(r310266)
+++ head/sys/boot/arm/uboot/MakefileMon Dec 19 14:40:59 2016
(r310267)
@@ -90,7 +90,7 @@ LIBFICL=  ${.OBJDIR}/../../ficl/libficl.a
 CFLAGS+=   -I${.CURDIR}/../../common
 CFLAGS+=   -I.
 
-CLEANFILES+=   vers.c loader.help
+CLEANFILES+=   loader.help
 
 CFLAGS+=   -ffreestanding -msoft-float
 
@@ -119,9 +119,6 @@ LDADD=  ${LIBFICL} ${LIBUBOOT} ${LIBFDT}
 
 OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}
 
-vers.c:${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
-   sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
-
 loader.help: help.common help.uboot ${.CURDIR}/../../fdt/help.fdt
cat ${.ALLSRC} | \
awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}

Modified: head/sys/boot/common/Makefile.inc
==
--- head/sys/boot/common/Makefile.inc   Mon Dec 19 14:19:52 2016
(r310266)
+++ head/sys/boot/common/Makefile.inc   Mon Dec 19 14:40:59 2016
(r310267)
@@ -71,3 +71,8 @@ CFLAGS+=  -DBOOT_PROMPT_123
 SRCS+= install.c
 CFLAGS+=-I${.CURDIR}/../../../../lib/libstand
 .endif
+
+CLEANFILES+=   vers.c
+VERSION_FILE?= ${.CURDIR}/version
+vers.c: ${SRCTOP}/sys/boot/common/newvers.sh ${VERSION_FILE}
+   sh ${SRCTOP}/sys/boot/common/newvers.sh ${VERSION_FILE} ${NEWVERSWHAT}

Modified: head/sys/boot/efi/loader/Makefile
==
--- head/sys/boot/efi/loader/Makefile   Mon Dec 19 14:19:52 2016
(r310266)
+++ head/sys/boot/efi/loader/Makefile   Mon Dec 19 14:40:59 2016
(r310267)
@@ -115,13 +115,10 @@ FILESMODE_loader.efi= ${BINMODE}
 LDSCRIPT=  ${.CURDIR}/arch/${MACHINE}/ldscript.${MACHINE}
 LDFLAGS+=  -Wl,-T${LDSCRIPT} -Wl,-Bsymbolic -shared
 
-CLEANFILES+=   vers.c loader.efi
+CLEANFILES+=   loader.efi
 
 NEWVERSWHAT=   "EFI loader" ${MACHINE}
 
-vers.c:${.CURDIR}/../../common/newvers.sh 
${.CURDIR}/../../efi/loader/version
-   sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
-
 NM?=   nm
 OBJCOPY?=  objcopy
 

Modified: head/sys/boot/i386/loader/Makefile
==
--- head/sys/boot/i386/loader/Makefile  Mon Dec 19 14:19:52 2016
(r310266)
+++ head/sys/boot/i386/loader/Makefile  Mon Dec 19 14:40:59 2016
(r310267)
@@ -8,6 +8,7 @@ PROG=   ${LOADER}.sym
 MAN=   
 INTERNALPROG=
 NEWVERSWHAT?=  "bootstrap loader" x86
+VERSION_FILE=  ${.CURDIR}/../loader/version
 
 # architecture-specific loader code
 SRCS=  main.c conf.c vers.c
@@ -72,7 +73,7 @@ CFLAGS+=  -I${.CURDIR}/../../.. -D_STAND
 CFLAGS+=   -I${.CURDIR}/../../common
 CFLAGS+=   -I.
 
-CLEANFILES=vers.c ${LOADER} ${LOADER}.bin loader.help
+CLEANFILES=${LOADER} ${LOADER}.bin loader.help
 
 CFLAGS+=   -Wall
 LDFLAGS=   -static -Ttext 0x0
@@ -93,10 +94,6 @@ CFLAGS+= -I${.CURDIR}/../btx/lib
 # Pick up ../Makefile.inc early.
 .include 
 
-vers.c:${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../loader/version
-   sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../loader/version \
-   ${NEWVERSWHAT}
-
 ${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN}
btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \
-b ${BTXKERN} ${LOADER}.bin

Modified: head/sys/boot/mips/beri/loader/Makefile
==
--- head/sys/boot/mips/beri/loader/Makefile Mon Dec 19 14:19:52 2016
(r310266)
+++ head/sys/boot/mips/beri/loader/Makefile Mon Dec 19 14:40:59 2016
(r310267)
@@ -92,7 +92,7 @@ CFLAGS+=  

svn commit: r310266 - head/sys/cam/ctl

2016-12-19 Thread Alexander Motin
Author: mav
Date: Mon Dec 19 14:19:52 2016
New Revision: 310266
URL: https://svnweb.freebsd.org/changeset/base/310266

Log:
  Add support for NUAR bit in Control mode page.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/ctl/ctl.c

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Mon Dec 19 13:25:53 2016(r310265)
+++ head/sys/cam/ctl/ctl.c  Mon Dec 19 14:19:52 2016(r310266)
@@ -253,7 +253,7 @@ const static struct scsi_control_page co
/*page_code*/SMS_CONTROL_MODE_PAGE,
/*page_length*/sizeof(struct scsi_control_page) - 2,
/*rlec*/SCP_DSENSE,
-   /*queue_flags*/SCP_QUEUE_ALG_MASK,
+   /*queue_flags*/SCP_QUEUE_ALG_MASK | SCP_NUAR,
/*eca_and_aen*/SCP_SWP,
/*flags4*/0,
/*aen_holdoff_period*/{0, 0},
@@ -8440,12 +8440,11 @@ ctl_persistent_reserve_out(struct ctl_sc
lun->pr_res_type = 0;
 
/*
-* if this isn't an exclusive access
-* res generate UA for all other
-* registrants.
+* If this isn't an exclusive access reservation and NUAR
+* is not set, generate UA for all other registrants.
 */
-   if (type != SPR_TYPE_EX_AC
-&& type != SPR_TYPE_WR_EX) {
+   if (type != SPR_TYPE_EX_AC && type != SPR_TYPE_WR_EX &&
+   (lun->MODE_CTRL.queue_flags & SCP_NUAR) == 0) {
for (i = softc->init_min; i < softc->init_max; i++) {
if (i == residx || ctl_get_prkey(lun, i) == 0)
continue;
@@ -8595,11 +8594,12 @@ ctl_hndl_per_res_out_on_other_sc(union c
 
case CTL_PR_RELEASE:
/*
-* if this isn't an exclusive access res generate UA for all
-* other registrants.
+* If this isn't an exclusive access reservation and NUAR
+* is not set, generate UA for all other registrants.
 */
if (lun->pr_res_type != SPR_TYPE_EX_AC &&
-   lun->pr_res_type != SPR_TYPE_WR_EX) {
+   lun->pr_res_type != SPR_TYPE_WR_EX &&
+   (lun->MODE_CTRL.queue_flags & SCP_NUAR) == 0) {
for (i = softc->init_min; i < softc->init_max; i++)
if (i == residx || ctl_get_prkey(lun, i) == 0)
continue;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310265 - head/sys/cam/ctl

2016-12-19 Thread Alexander Motin
Author: mav
Date: Mon Dec 19 13:25:53 2016
New Revision: 310265
URL: https://svnweb.freebsd.org/changeset/base/310265

Log:
  Add set of macros to simplify code access to mode pages fields.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/ctl/ctl_error.c
  head/sys/cam/ctl/ctl_private.h

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Mon Dec 19 13:14:39 2016(r310264)
+++ head/sys/cam/ctl/ctl.c  Mon Dec 19 13:25:53 2016(r310265)
@@ -5869,21 +5869,19 @@ static void
 ctl_ie_timer(void *arg)
 {
struct ctl_lun *lun = arg;
-   struct scsi_info_exceptions_page *pg;
uint64_t t;
 
if (lun->ie_asc == 0)
return;
 
-   pg = >mode_pages.ie_page[CTL_PAGE_CURRENT];
-   if (pg->mrie == SIEP_MRIE_UA)
+   if (lun->MODE_IE.mrie == SIEP_MRIE_UA)
ctl_est_ua_all(lun, -1, CTL_UA_IE);
else
lun->ie_reported = 0;
 
-   if (lun->ie_reportcnt < scsi_4btoul(pg->report_count)) {
+   if (lun->ie_reportcnt < scsi_4btoul(lun->MODE_IE.report_count)) {
lun->ie_reportcnt++;
-   t = scsi_4btoul(pg->interval_timer);
+   t = scsi_4btoul(lun->MODE_IE.interval_timer);
if (t == 0 || t == UINT32_MAX)
t = 3000;  /* 5 min */
callout_schedule(>ie_callout, t * hz / 10);
@@ -6477,9 +6475,8 @@ ctl_mode_sense(struct ctl_scsiio *ctsio)
if (lun->be_lun->lun_type == T_DIRECT) {
header->dev_specific = 0x10; /* DPOFUA */
if ((lun->be_lun->flags & CTL_LUN_FLAG_READONLY) ||
-   (lun->mode_pages.control_page[CTL_PAGE_CURRENT]
-   .eca_and_aen & SCP_SWP) != 0)
-   header->dev_specific |= 0x80; /* WP */
+   (lun->MODE_CTRL.eca_and_aen & SCP_SWP) != 0)
+   header->dev_specific |= 0x80; /* WP */
}
if (dbd)
header->block_descr_len = 0;
@@ -6500,9 +6497,8 @@ ctl_mode_sense(struct ctl_scsiio *ctsio)
if (lun->be_lun->lun_type == T_DIRECT) {
header->dev_specific = 0x10; /* DPOFUA */
if ((lun->be_lun->flags & CTL_LUN_FLAG_READONLY) ||
-   (lun->mode_pages.control_page[CTL_PAGE_CURRENT]
-   .eca_and_aen & SCP_SWP) != 0)
-   header->dev_specific |= 0x80; /* WP */
+   (lun->MODE_CTRL.eca_and_aen & SCP_SWP) != 0)
+   header->dev_specific |= 0x80; /* WP */
}
if (dbd)
scsi_ulto2b(0, header->block_descr_len);
@@ -8807,12 +8803,10 @@ ctl_read_write(struct ctl_scsiio *ctsio)
 
/* Set FUA and/or DPO if caches are disabled. */
if (isread) {
-   if ((lun->mode_pages.caching_page[CTL_PAGE_CURRENT].flags1 &
-   SCP_RCD) != 0)
+   if ((lun->MODE_CACHING.flags1 & SCP_RCD) != 0)
flags |= CTL_LLF_FUA | CTL_LLF_DPO;
} else {
-   if ((lun->mode_pages.caching_page[CTL_PAGE_CURRENT].flags1 &
-   SCP_WCE) == 0)
+   if ((lun->MODE_CACHING.flags1 & SCP_WCE) == 0)
flags |= CTL_LLF_FUA;
}
 
@@ -8915,8 +8909,7 @@ ctl_cnw(struct ctl_scsiio *ctsio)
}
 
/* Set FUA if write cache is disabled. */
-   if ((lun->mode_pages.caching_page[CTL_PAGE_CURRENT].flags1 &
-   SCP_WCE) == 0)
+   if ((lun->MODE_CACHING.flags1 & SCP_WCE) == 0)
flags |= CTL_LLF_FUA;
 
ctsio->kern_total_len = 2 * num_blocks * lun->be_lun->blocksize;
@@ -9323,7 +9316,7 @@ ctl_request_sense(struct ctl_scsiio *cts
/*
 * Report informational exception if have one and allowed.
 */
-   if (lun->mode_pages.ie_page[CTL_PAGE_CURRENT].mrie != 
SIEP_MRIE_NO) {
+   if (lun->MODE_IE.mrie != SIEP_MRIE_NO) {
asc = lun->ie_asc;
ascq = lun->ie_ascq;
}
@@ -11088,8 +11081,8 @@ ctl_check_for_blockage(struct ctl_lun *l
return (ctl_extent_check(ooa_io, pending_io,
(lun->be_lun && lun->be_lun->serseq == CTL_LUN_SERSEQ_ON)));
case CTL_SER_EXTENTOPT:
-   if ((lun->mode_pages.control_page[CTL_PAGE_CURRENT].queue_flags
-   & SCP_QUEUE_ALG_MASK) != SCP_QUEUE_ALG_UNRESTRICTED)
+   if ((lun->MODE_CTRL.queue_flags & SCP_QUEUE_ALG_MASK) !=
+   SCP_QUEUE_ALG_UNRESTRICTED)
return (ctl_extent_check(ooa_io, pending_io,
(lun->be_lun &&
   

svn commit: r310264 - stable/10/sys/dev/mrsas

2016-12-19 Thread Kashyap D Desai
Author: kadesai
Date: Mon Dec 19 13:14:39 2016
New Revision: 310264
URL: https://svnweb.freebsd.org/changeset/base/310264

Log:
  MFC r309284-r309294
  
  r309294
  This patch upgrades driver version to 06.712.04.00-fbsd
  
  r309293
  This patch will add code to refire IOCTL commands after OCR.
  
  r309292
  This patch will unblock SYNCHRONIZE_CACHE command to firmware,
  i.e. don't block the SYNCHRONIZE_CACHE command at driver instead of passing 
it to firmware for all Gen3 controllers.
  
  r309291
  Wait for AEN task to be completed(if in queue) before resetting the controller
  and return without processing event in AEN thread, if controller reset is in 
progress.
  
  r309290
  This patch will add task management support in driver. Below is high level 
description:
  If a SCSI IO times out, then before initiating OCR, now the driver will try 
to send a
  target reset to the particular target for which the IO is timed out. If that 
also fails,
  then the driver will initiate OCR.
  
  r309289
  Process outstanding reply descriptors from all the reply descriptor post 
queues before initiating OCR.
  
  r309288
  Clean up reference to AEN command if abort AEN is succesful as the command is 
aborted.
  Did the same by setting sc->aen_cmd = NULL when aborting AEN is successful.
  
  r309287
  Update controller properties(read OCR capability bit) when 
MR_EVT_CTRL_PROP_CHANGED recieved.
  
  r309286
  Add sanity check in IO and IOCTL path not to process command further if 
controller is in
  HW_CRITICAL_ERROR.
  
  r309285
  Use a variable to indicate Gen3 controllers and remove all PCI ids based
  checks used for gen3 controllers.
  
  r309284
  High level description of new solution -
  Free MFI and MPT command from same context.
  Free both the command either from process (from where mfi-mpt pass-through 
was called) or from
  ISR context. Do not split freeing of MFI and MPT, because it creates the race 
condition which
  will do MFI/MPT list.

Modified:
  stable/10/sys/dev/mrsas/mrsas.c
  stable/10/sys/dev/mrsas/mrsas.h
  stable/10/sys/dev/mrsas/mrsas_cam.c
  stable/10/sys/dev/mrsas/mrsas_fp.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mrsas/mrsas.c
==
--- stable/10/sys/dev/mrsas/mrsas.c Mon Dec 19 12:27:01 2016
(r310263)
+++ stable/10/sys/dev/mrsas/mrsas.c Mon Dec 19 13:14:39 2016
(r310264)
@@ -110,6 +110,7 @@ int mrsas_issue_polled(struct mrsas_soft
 intmrsas_reset_ctrl(struct mrsas_softc *sc, u_int8_t reset_reason);
 intmrsas_wait_for_outstanding(struct mrsas_softc *sc, u_int8_t 
check_reason);
 int mrsas_complete_cmd(struct mrsas_softc *sc, u_int32_t MSIxIndex);
+int mrsas_reset_targets(struct mrsas_softc *sc);
 int
 mrsas_issue_blocked_cmd(struct mrsas_softc *sc,
 struct mrsas_mfi_cmd *cmd);
@@ -153,7 +154,6 @@ extern void mrsas_cam_detach(struct mrsa
 extern void mrsas_cmd_done(struct mrsas_softc *sc, struct mrsas_mpt_cmd *cmd);
 extern void mrsas_free_frame(struct mrsas_softc *sc, struct mrsas_mfi_cmd 
*cmd);
 extern int mrsas_alloc_mfi_cmds(struct mrsas_softc *sc);
-extern void mrsas_release_mpt_cmd(struct mrsas_mpt_cmd *cmd);
 extern struct mrsas_mpt_cmd *mrsas_get_mpt_cmd(struct mrsas_softc *sc);
 extern int mrsas_passthru(struct mrsas_softc *sc, void *arg, u_long ioctlCmd);
 extern uint8_t MR_ValidateMapInfo(struct mrsas_softc *sc);
@@ -307,28 +307,11 @@ mrsas_enable_intr(struct mrsas_softc *sc
 static int
 mrsas_clear_intr(struct mrsas_softc *sc)
 {
-   u_int32_t status, fw_status, fw_state;
+   u_int32_t status;
 
/* Read received interrupt */
status = mrsas_read_reg(sc, offsetof(mrsas_reg_set, 
outbound_intr_status));
 
-   /*
-* If FW state change interrupt is received, write to it again to
-* clear
-*/
-   if (status & MRSAS_FW_STATE_CHNG_INTERRUPT) {
-   fw_status = mrsas_read_reg(sc, offsetof(mrsas_reg_set,
-   outbound_scratch_pad));
-   fw_state = fw_status & MFI_STATE_MASK;
-   if (fw_state == MFI_STATE_FAULT) {
-   device_printf(sc->mrsas_dev, "FW is in FAULT state!\n");
-   if (sc->ocr_thread_active)
-   wakeup(>ocr_chan);
-   }
-   mrsas_write_reg(sc, offsetof(mrsas_reg_set, 
outbound_intr_status), status);
-   mrsas_read_reg(sc, offsetof(mrsas_reg_set, 
outbound_intr_status));
-   return (1);
-   }
/* Not our interrupt, so just return */
if (!(status & MFI_FUSION_ENABLE_INTERRUPT_MASK))
return (0);
@@ -449,6 +432,11 @@ mrsas_setup_sysctl(struct mrsas_softc *s
OID_AUTO, "reset_in_progress", CTLFLAG_RD,
>reset_in_progress, 0, "ocr in progress status");
 
+   SYSCTL_ADD_UINT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree),
+   OID_AUTO, 

svn commit: r310263 - stable/11/usr.sbin/iostat

2016-12-19 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Dec 19 12:27:01 2016
New Revision: 310263
URL: https://svnweb.freebsd.org/changeset/base/310263

Log:
  MFC r306095:
  
  Make the "r/s" and "w/s" fields in "iostat -x" a little bit wider;
  five chars is way too narrow for todays disks.

Modified:
  stable/11/usr.sbin/iostat/iostat.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/iostat/iostat.c
==
--- stable/11/usr.sbin/iostat/iostat.c  Mon Dec 19 12:25:30 2016
(r310262)
+++ stable/11/usr.sbin/iostat/iostat.c  Mon Dec 19 12:27:01 2016
(r310263)
@@ -807,7 +807,7 @@ devstats(int perf_select, long double et
printf("   cpu ");
printf("\n");
if (Iflag == 0) {
-   printf("device r/s   w/s kr/s kw/s "
+   printf("device   r/s w/s kr/s kw/s "
" ms/r  ms/w  ms/o  ms/t qlen  %%b  ");
} else {
printf("device   r/i w/i kr/i"
@@ -884,7 +884,7 @@ devstats(int perf_select, long double et
mb_per_second_write > ((long double).0005)/1024 ||
busy_pct > 0.5) {
if (Iflag == 0)
-   printf("%-8.8s %5d %5d %8.1Lf "
+   printf("%-8.8s %7d %7d %8.1Lf "
"%8.1Lf %5d %5d %5d %5d "
"%4" PRIu64 " %3.0Lf ",
devicename,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310262 - stable/11/lib/libc/sys

2016-12-19 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Dec 19 12:25:30 2016
New Revision: 310262
URL: https://svnweb.freebsd.org/changeset/base/310262

Log:
  MFC r308386:
  
  Document that getfsstat(2) called with MNT_NOWAIT skips file systems
  that are in the process of being unmounted.

Modified:
  stable/11/lib/libc/sys/getfsstat.2
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/lib/libc/sys/getfsstat.2
==
--- stable/11/lib/libc/sys/getfsstat.2  Mon Dec 19 12:22:32 2016
(r310261)
+++ stable/11/lib/libc/sys/getfsstat.2  Mon Dec 19 12:25:30 2016
(r310262)
@@ -28,7 +28,7 @@
 .\"@(#)getfsstat.2 8.3 (Berkeley) 5/25/95
 .\" $FreeBSD$
 .\"
-.Dd November 20, 2003
+.Dd November 6, 2016
 .Dt GETFSSTAT 2
 .Os
 .Sh NAME
@@ -88,6 +88,8 @@ Thus, some of the information will be ou
 .Fn getfsstat
 will not block waiting for information from a file system that is
 unable to respond.
+It will also skip any file system that is in the process of being
+unmounted, even if the unmount would eventually fail.
 .Sh RETURN VALUES
 Upon successful completion, the number of
 .Fa statfs
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310261 - stable/11/sys/fs/autofs

2016-12-19 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Dec 19 12:22:32 2016
New Revision: 310261
URL: https://svnweb.freebsd.org/changeset/base/310261

Log:
  MFC r308611:
  
  Remove spurious space.

Modified:
  stable/11/sys/fs/autofs/autofs.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/autofs/autofs.c
==
--- stable/11/sys/fs/autofs/autofs.cMon Dec 19 12:20:58 2016
(r310260)
+++ stable/11/sys/fs/autofs/autofs.cMon Dec 19 12:22:32 2016
(r310261)
@@ -61,7 +61,7 @@
  */
 
 #include 
- __FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD$");
 
 #include 
 #include 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310260 - stable/11/share/man/man9

2016-12-19 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Dec 19 12:20:58 2016
New Revision: 310260
URL: https://svnweb.freebsd.org/changeset/base/310260

Log:
  MFC r308637:
  
  Fix function prototypes in usbdi(9) man page, and tweak it a little.

Modified:
  stable/11/share/man/man9/usbdi.9
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/man/man9/usbdi.9
==
--- stable/11/share/man/man9/usbdi.9Mon Dec 19 11:44:41 2016
(r310259)
+++ stable/11/share/man/man9/usbdi.9Mon Dec 19 12:20:58 2016
(r310260)
@@ -24,7 +24,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"$FreeBSD$
-.Dd June 24, 2009
+.Dd November 14, 2016
 .Dt USBDI 9
 .Os
 .Sh NAME
@@ -84,60 +84,40 @@
 .In dev/usb/usb.h
 .In dev/usb/usbdi.h
 .In dev/usb/usbdi_util.h
-.Sh DESCRIPTION
-The Universal Serial Bus (USB) driver programming interface provides
-USB peripheral drivers with a host controller independent API for
-controlling and communicating with USB peripherals.
-The
-.Nm usb
-module supports both USB Host and USB Device side mode.
-.
-.Sh USB KERNEL PROGRAMMING
-Here is a list of commonly used functions:
-.Pp
-.
 .Ft "usb_error_t"
 .Fo "usbd_transfer_setup"
-.Fa "udev"
-.Fa "ifaces"
-.Fa "pxfer"
-.Fa "setup_start"
-.Fa "n_setup"
-.Fa "priv_sc"
-.Fa "priv_mtx"
+.Fa "struct usb_device *udev"
+.Fa "const uint8_t *ifaces"
+.Fa "struct usb_xfer **pxfer"
+.Fa "const struct usb_config *setup_start"
+.Fa "uint16_t n_setup"
+.Fa "void *priv_sc"
+.Fa "struct mtx *priv_mtx"
 .Fc
-.
-.Pp
-.
 .Ft "void"
 .Fo "usbd_transfer_unsetup"
-.Fa "pxfer"
-.Fa "n_setup"
+.Fa "struct usb_xfer **pxfer"
+.Fa "uint16_t n_setup"
 .Fc
-.
-.Pp
-.
 .Ft "void"
 .Fo "usbd_transfer_start"
-.Fa "xfer"
+.Fa "struct usb_xfer *xfer"
 .Fc
-.
-.Pp
-.
 .Ft "void"
 .Fo "usbd_transfer_stop"
-.Fa "xfer"
+.Fa "struct usb_xfer *xfer"
 .Fc
-.
-.Pp
-.
 .Ft "void"
 .Fo "usbd_transfer_drain"
-.Fa "xfer"
+.Fa "struct usb_xfer *xfer"
 .Fc
-.
-.
-.
+.Sh DESCRIPTION
+The Universal Serial Bus (USB) driver programming interface provides
+USB peripheral drivers with a host controller independent API for
+controlling and communicating with USB peripherals.
+The
+.Nm usb
+module supports both USB Host and USB Device side mode.
 .Sh USB TRANSFER MANAGEMENT FUNCTIONS
 The USB standard defines four types of USB transfers.
 .
@@ -552,7 +532,7 @@ for the 8-bytes of SETUP header.
 These 8-bytes are not counted by the "xfer->max_data_length"
 variable.
 .
-This flag can not be changed during operation.
+This flag cannot be changed during operation.
 .
 .
 .It ext_buffer
@@ -561,7 +541,7 @@ allocated.
 .
 Instead the USB client must supply a data buffer.
 .
-This flag can not be changed during operation.
+This flag cannot be changed during operation.
 .
 .
 .It manual_status
@@ -579,7 +559,7 @@ This flag can be changed during operatio
 .
 .It no_pipe_ok
 Setting this flag causes the USB_ERR_NO_PIPE error to be ignored.
-This flag can not be changed during operation.
+This flag cannot be changed during operation.
 .
 .
 .It stall_pipe
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310259 - head/sys/cam/ctl

2016-12-19 Thread Alexander Motin
Author: mav
Date: Mon Dec 19 11:44:41 2016
New Revision: 310259
URL: https://svnweb.freebsd.org/changeset/base/310259

Log:
  Following SPC-5, make REQUEST SENSE report "Logical unit not supported"
  in returned parameter data for not accessible LUNs.
  
  MFC after:2 weeks

Modified:
  head/sys/cam/ctl/ctl.c

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Mon Dec 19 11:02:49 2016(r310258)
+++ head/sys/cam/ctl/ctl.c  Mon Dec 19 11:44:41 2016(r310259)
@@ -9205,7 +9205,7 @@ ctl_request_sense(struct ctl_scsiio *cts
 {
struct scsi_request_sense *cdb;
struct scsi_sense_data *sense_ptr;
-   struct ctl_softc *ctl_softc;
+   struct ctl_softc *softc;
struct ctl_lun *lun;
uint32_t initidx;
int have_error;
@@ -9215,7 +9215,7 @@ ctl_request_sense(struct ctl_scsiio *cts
 
cdb = (struct scsi_request_sense *)ctsio->cdb;
 
-   ctl_softc = control_softc;
+   softc = control_softc;
lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr;
 
CTL_DEBUG_PRINT(("ctl_request_sense\n"));
@@ -9248,8 +9248,18 @@ ctl_request_sense(struct ctl_scsiio *cts
/*
 * If we don't have a LUN, we don't have any pending sense.
 */
-   if (lun == NULL)
-   goto no_sense;
+   if (lun == NULL ||
+   ((lun->flags & CTL_LUN_PRIMARY_SC) == 0 &&
+softc->ha_link < CTL_HA_LINK_UNKNOWN)) {
+   /* "Logical unit not supported" */
+   ctl_set_sense_data(sense_ptr, NULL, sense_format,
+   /*current_error*/ 1,
+   /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST,
+   /*asc*/ 0x25,
+   /*ascq*/ 0x00,
+   SSD_ELEM_NONE);
+   goto send;
+   }
 
have_error = 0;
initidx = ctl_get_initindex(>io_hdr.nexus);
@@ -9297,61 +9307,39 @@ ctl_request_sense(struct ctl_scsiio *cts
have_error = 1;
} else
 #endif
-   {
+   if (have_error == 0) {
ua_type = ctl_build_ua(lun, initidx, sense_ptr, sense_format);
if (ua_type != CTL_UA_NONE)
have_error = 1;
if (ua_type == CTL_UA_LUN_CHANGE) {
mtx_unlock(>lun_lock);
-   mtx_lock(_softc->ctl_lock);
-   ctl_clr_ua_allluns(ctl_softc, initidx, ua_type);
-   mtx_unlock(_softc->ctl_lock);
+   mtx_lock(>ctl_lock);
+   ctl_clr_ua_allluns(softc, initidx, ua_type);
+   mtx_unlock(>ctl_lock);
mtx_lock(>lun_lock);
}
-
}
-   mtx_unlock(>lun_lock);
-
-   /*
-* We already have a pending error, return it.
-*/
-   if (have_error != 0) {
+   if (have_error == 0) {
/*
-* We report the SCSI status as OK, since the status of the
-* request sense command itself is OK.
-* We report 0 for the sense length, because we aren't doing
-* autosense in this case.  We're reporting sense as
-* parameter data.
+* Report informational exception if have one and allowed.
 */
-   ctl_set_success(ctsio);
-   ctsio->io_hdr.flags |= CTL_FLAG_ALLOCATED;
-   ctsio->be_move_done = ctl_config_move_done;
-   ctl_datamove((union ctl_io *)ctsio);
-   return (CTL_RETVAL_COMPLETE);
+   if (lun->mode_pages.ie_page[CTL_PAGE_CURRENT].mrie != 
SIEP_MRIE_NO) {
+   asc = lun->ie_asc;
+   ascq = lun->ie_ascq;
+   }
+   ctl_set_sense_data(sense_ptr, lun, sense_format,
+   /*current_error*/ 1,
+   /*sense_key*/ SSD_KEY_NO_SENSE,
+   /*asc*/ asc,
+   /*ascq*/ ascq,
+   SSD_ELEM_NONE);
}
+   mtx_unlock(>lun_lock);
 
+send:
/*
-* No sense information to report, so we report that everything is
-* okay, unless we have allowed Informational Exception.
-*/
-   if (lun->mode_pages.ie_page[CTL_PAGE_CURRENT].mrie != SIEP_MRIE_NO) {
-   asc = lun->ie_asc;
-   ascq = lun->ie_ascq;
-   }
-
-no_sense:
-   ctl_set_sense_data(sense_ptr,
-  lun,
-  sense_format,
-  /*current_error*/ 1,
-  /*sense_key*/ SSD_KEY_NO_SENSE,
-  /*asc*/ asc,
-  /*ascq*/ ascq,
-  SSD_ELEM_NONE);
-
-   /*
-* We report 0 for the sense length, because we aren't doing
-* autosense in this case.  We're reporting sense as 

svn commit: r310258 - in head/sys: netinet netinet6

2016-12-19 Thread Andrey V. Elsukov
Author: ae
Date: Mon Dec 19 11:02:49 2016
New Revision: 310258
URL: https://svnweb.freebsd.org/changeset/base/310258

Log:
  ip[6]_tryforward does inbound and outbound packet firewall processing.
  This can lead to change of mbuf pointer (packet filter could do m_pullup(),
  NAT, etc). Also in case of change of destination address, tryforward can
  decide that packet should be handled by local system. In this case modified
  mbuf can be returned to the ip[6]_input(). To handle this correctly, check
  M_FASTFWD_OURS flag after return from ip[6]_tryforward. And if it is present,
  update variables that depend from mbuf pointer and skip another inbound
  firewall processing.
  
  No objection from:#network
  MFC after:3 weeks
  Sponsored by: Yandex LLC
  Differential Revision:https://reviews.freebsd.org/D8764

Modified:
  head/sys/netinet/ip_input.c
  head/sys/netinet6/ip6_input.c

Modified: head/sys/netinet/ip_input.c
==
--- head/sys/netinet/ip_input.c Mon Dec 19 10:25:47 2016(r310257)
+++ head/sys/netinet/ip_input.c Mon Dec 19 11:02:49 2016(r310258)
@@ -550,24 +550,35 @@ tooshort:
m_adj(m, ip_len - m->m_pkthdr.len);
}
 
-   /* Try to forward the packet, but if we fail continue */
+   /*
+* Try to forward the packet, but if we fail continue.
+* ip_tryforward() does inbound and outbound packet firewall
+* processing. If firewall has decided that destination becomes
+* our local address, it sets M_FASTFWD_OURS flag. In this
+* case skip another inbound firewall processing and update
+* ip pointer.
+*/
+   if (V_ipforwarding != 0
 #ifdef IPSEC
-   /* For now we do not handle IPSEC in tryforward. */
-   if (!key_havesp(IPSEC_DIR_INBOUND) && !key_havesp(IPSEC_DIR_OUTBOUND) &&
-   (V_ipforwarding == 1))
-   if (ip_tryforward(m) == NULL)
+   && !key_havesp(IPSEC_DIR_INBOUND)
+   && !key_havesp(IPSEC_DIR_OUTBOUND)
+#endif
+  ) {
+   if ((m = ip_tryforward(m)) == NULL)
return;
+   if (m->m_flags & M_FASTFWD_OURS) {
+   m->m_flags &= ~M_FASTFWD_OURS;
+   ip = mtod(m, struct ip *);
+   goto ours;
+   }
+   }
+#ifdef IPSEC
/*
 * Bypass packet filtering for packets previously handled by IPsec.
 */
if (ip_ipsec_filtertunnel(m))
goto passin;
-#else
-   if (V_ipforwarding == 1)
-   if (ip_tryforward(m) == NULL)
-   return;
-#endif /* IPSEC */
-
+#endif
/*
 * Run through list of hooks for input packets.
 *

Modified: head/sys/netinet6/ip6_input.c
==
--- head/sys/netinet6/ip6_input.c   Mon Dec 19 10:25:47 2016
(r310257)
+++ head/sys/netinet6/ip6_input.c   Mon Dec 19 11:02:49 2016
(r310258)
@@ -726,23 +726,36 @@ ip6_input(struct mbuf *m)
goto bad;
}
 #endif
-   /* Try to forward the packet, but if we fail continue */
+   /*
+* Try to forward the packet, but if we fail continue.
+* ip6_tryforward() does inbound and outbound packet firewall
+* processing. If firewall has decided that destination becomes
+* our local address, it sets M_FASTFWD_OURS flag. In this
+* case skip another inbound firewall processing and update
+* ip6 pointer.
+*/
+   if (V_ip6_forwarding != 0
 #ifdef IPSEC
-   if (V_ip6_forwarding != 0 && !key_havesp(IPSEC_DIR_INBOUND) &&
-   !key_havesp(IPSEC_DIR_OUTBOUND))
-   if (ip6_tryforward(m) == NULL)
+   && !key_havesp(IPSEC_DIR_INBOUND)
+   && !key_havesp(IPSEC_DIR_OUTBOUND)
+#endif
+   ) {
+   if ((m = ip6_tryforward(m)) == NULL)
return;
+   if (m->m_flags & M_FASTFWD_OURS) {
+   m->m_flags &= ~M_FASTFWD_OURS;
+   ours = 1;
+   ip6 = mtod(m, struct ip6_hdr *);
+   goto hbhcheck;
+   }
+   }
+#ifdef IPSEC
/*
 * Bypass packet filtering for packets previously handled by IPsec.
 */
if (ip6_ipsec_filtertunnel(m))
goto passin;
-#else
-   if (V_ip6_forwarding != 0)
-   if (ip6_tryforward(m) == NULL)
-   return;
-#endif /* IPSEC */
-
+#endif
/*
 * Run through list of hooks for input packets.
 *
@@ -750,12 +763,12 @@ ip6_input(struct mbuf *m)
 * (e.g. by NAT rewriting).  When this happens,
 * tell ip6_forward to do the right thing.
 */
-   odst = ip6->ip6_dst;
 
/* Jump over all PFIL processing if hooks are 

svn commit: r310257 - in head/sys/cam: ctl scsi

2016-12-19 Thread Alexander Motin
Author: mav
Date: Mon Dec 19 10:25:47 2016
New Revision: 310257
URL: https://svnweb.freebsd.org/changeset/base/310257

Log:
  Improve support for informational exceptions.
  
  While CTL still has no real events to report in this way (like SMART),
  it is possible to trigger false event by manually setting TEST bit in
  Informational Exceptions Control mode page, that can be useful for
  initiator testing.  This code supports all flavours of IE reporting:
  UNIT ATTENTION, RECOVERED ERROR and NO SENSE sense keys, REQUEST SENSE
  command and Informational Exceptions log page.
  
  MFC after:2 weeks
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/cam/ctl/ctl.c
  head/sys/cam/ctl/ctl.h
  head/sys/cam/ctl/ctl_error.c
  head/sys/cam/ctl/ctl_private.h
  head/sys/cam/scsi/scsi_all.h
  head/sys/cam/scsi/scsi_da.h

Modified: head/sys/cam/ctl/ctl.c
==
--- head/sys/cam/ctl/ctl.c  Mon Dec 19 10:00:56 2016(r310256)
+++ head/sys/cam/ctl/ctl.c  Mon Dec 19 10:25:47 2016(r310257)
@@ -93,25 +93,6 @@ struct ctl_softc *control_softc = NULL;
  * Note that these are default values only.  The actual values will be
  * filled in when the user does a mode sense.
  */
-const static struct copan_debugconf_subpage debugconf_page_default = {
-   DBGCNF_PAGE_CODE | SMPH_SPF,/* page_code */
-   DBGCNF_SUBPAGE_CODE,/* subpage */
-   {(sizeof(struct copan_debugconf_subpage) - 4) >> 8,
-(sizeof(struct copan_debugconf_subpage) - 4) >> 0}, /* page_length */
-   DBGCNF_VERSION, /* page_version */
-   {CTL_TIME_IO_DEFAULT_SECS>>8,
-CTL_TIME_IO_DEFAULT_SECS>>0},  /* ctl_time_io_secs */
-};
-
-const static struct copan_debugconf_subpage debugconf_page_changeable = {
-   DBGCNF_PAGE_CODE | SMPH_SPF,/* page_code */
-   DBGCNF_SUBPAGE_CODE,/* subpage */
-   {(sizeof(struct copan_debugconf_subpage) - 4) >> 8,
-(sizeof(struct copan_debugconf_subpage) - 4) >> 0}, /* page_length */
-   0,  /* page_version */
-   {0xff,0xff},/* ctl_time_io_secs */
-};
-
 const static struct scsi_da_rw_recovery_page rw_er_page_default = {
/*page_code*/SMS_RW_ERROR_RECOVERY_PAGE,
/*page_length*/sizeof(struct scsi_da_rw_recovery_page) - 2,
@@ -129,12 +110,12 @@ const static struct scsi_da_rw_recovery_
 const static struct scsi_da_rw_recovery_page rw_er_page_changeable = {
/*page_code*/SMS_RW_ERROR_RECOVERY_PAGE,
/*page_length*/sizeof(struct scsi_da_rw_recovery_page) - 2,
-   /*byte3*/0,
+   /*byte3*/SMS_RWER_PER,
/*read_retry_count*/0,
/*correction_span*/0,
/*head_offset_count*/0,
/*data_strobe_offset_cnt*/0,
-   /*byte8*/0,
+   /*byte8*/SMS_RWER_LBPERE,
/*write_retry_count*/0,
/*reserved2*/0,
/*recovery_time_limit*/{0, 0},
@@ -206,6 +187,24 @@ const static struct scsi_rigid_disk_page
/*reserved2*/ {0, 0}
 };
 
+const static struct scsi_da_verify_recovery_page verify_er_page_default = {
+   /*page_code*/SMS_VERIFY_ERROR_RECOVERY_PAGE,
+   /*page_length*/sizeof(struct scsi_da_verify_recovery_page) - 2,
+   /*byte3*/0,
+   /*read_retry_count*/0,
+   /*reserved*/{ 0, 0, 0, 0, 0, 0 },
+   /*recovery_time_limit*/{0, 0},
+};
+
+const static struct scsi_da_verify_recovery_page verify_er_page_changeable = {
+   /*page_code*/SMS_VERIFY_ERROR_RECOVERY_PAGE,
+   /*page_length*/sizeof(struct scsi_da_verify_recovery_page) - 2,
+   /*byte3*/SMS_VER_PER,
+   /*read_retry_count*/0,
+   /*reserved*/{ 0, 0, 0, 0, 0, 0 },
+   /*recovery_time_limit*/{0, 0},
+};
+
 const static struct scsi_caching_page caching_page_default = {
/*page_code*/SMS_CACHING_PAGE,
/*page_length*/sizeof(struct scsi_caching_page) - 2,
@@ -285,19 +284,20 @@ const static struct scsi_control_ext_pag
 const static struct scsi_info_exceptions_page ie_page_default = {
/*page_code*/SMS_INFO_EXCEPTIONS_PAGE,
/*page_length*/sizeof(struct scsi_info_exceptions_page) - 2,
-   /*info_flags*/SIEP_FLAGS_DEXCPT,
-   /*mrie*/0,
+   /*info_flags*/SIEP_FLAGS_EWASC,
+   /*mrie*/SIEP_MRIE_NO,
/*interval_timer*/{0, 0, 0, 0},
-   /*report_count*/{0, 0, 0, 0}
+   /*report_count*/{0, 0, 0, 1}
 };
 
 const static struct scsi_info_exceptions_page ie_page_changeable = {
/*page_code*/SMS_INFO_EXCEPTIONS_PAGE,
/*page_length*/sizeof(struct scsi_info_exceptions_page) - 2,
-   /*info_flags*/0,
-   /*mrie*/0,
-   /*interval_timer*/{0, 0, 0, 0},
-   /*report_count*/{0, 0, 0, 0}
+   /*info_flags*/SIEP_FLAGS_EWASC | SIEP_FLAGS_DEXCPT | SIEP_FLAGS_TEST |
+   SIEP_FLAGS_LOGERR,
+   /*mrie*/0x0f,
+   /*interval_timer*/{0xff, 0xff, 0xff, 0xff},
+   /*report_count*/{0xff, 0xff, 0xff, 0xff}
 };
 
 #define CTL_LBPM_LEN   

svn commit: r310256 - stable/8/sys/dev/acpica

2016-12-19 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Dec 19 10:00:56 2016
New Revision: 310256
URL: https://svnweb.freebsd.org/changeset/base/310256

Log:
  MFC r309400:
  Fix for endless recursion in the ACPI GPE handler during boot.
  
  When handling a GPE ACPI interrupt object the EcSpaceHandler()
  function can be called which checks the EC_EVENT_SCI bit and then
  recurse on the EcGpeQueryHandler() function. If there are multiple GPE
  events pending the EC_EVENT_SCI bit will be set at the next call to
  EcSpaceHandler() causing it to recurse again via the
  EcGpeQueryHandler() function. This leads to a slow never ending
  recursion during boot which prevents proper system startup, because
  the EC_EVENT_SCI bit never gets cleared in this scenario.
  
  The behaviour is reproducible with the ALASKA AMI in combination with
  a newer Skylake based mainboard in the following way:
  
  Enter BIOS and adjust the clock one hour forward. Save and exit the
  BIOS. System fails to boot due to the above mentioned bug in
  EcGpeQueryHandler() which was observed recursing multiple times.
  
  This patch adds a simple recursion guard to the EcGpeQueryHandler()
  function and also also adds logic to detect if new GPE events occurred
  during the execution of EcGpeQueryHandler() and then loop on this
  function instead of recursing.
  
  Reviewed by:  jhb

Modified:
  stable/8/sys/dev/acpica/acpi_ec.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/dev/   (props changed)
  stable/8/sys/dev/acpica/   (props changed)

Modified: stable/8/sys/dev/acpica/acpi_ec.c
==
--- stable/8/sys/dev/acpica/acpi_ec.c   Mon Dec 19 09:54:59 2016
(r310255)
+++ stable/8/sys/dev/acpica/acpi_ec.c   Mon Dec 19 10:00:56 2016
(r310256)
@@ -618,16 +618,14 @@ EcCheckStatus(struct acpi_ec_softc *sc, 
 }
 
 static void
-EcGpeQueryHandler(void *Context)
+EcGpeQueryHandlerSub(struct acpi_ec_softc *sc)
 {
-struct acpi_ec_softc   *sc = (struct acpi_ec_softc *)Context;
 UINT8  Data;
 ACPI_STATUSStatus;
 intretry;
 char   qxx[5];
 
 ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
-KASSERT(Context != NULL, ("EcGpeQueryHandler called with NULL"));
 
 /* Serialize user access with EcSpaceHandler(). */
 Status = EcLock(sc);
@@ -654,7 +652,6 @@ EcGpeQueryHandler(void *Context)
else
break;
 }
-sc->ec_sci_pend = FALSE;
 if (ACPI_FAILURE(Status)) {
EcUnlock(sc);
device_printf(sc->ec_dev, "GPE query failed: %s\n",
@@ -685,6 +682,29 @@ EcGpeQueryHandler(void *Context)
 }
 }
 
+static void
+EcGpeQueryHandler(void *Context)
+{
+struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context;
+int pending;
+
+KASSERT(Context != NULL, ("EcGpeQueryHandler called with NULL"));
+
+do {
+   /* Read the current pending count */
+   pending = atomic_load_acq_int(>ec_sci_pend);
+
+   /* Call GPE handler function */
+   EcGpeQueryHandlerSub(sc);
+
+   /*
+* Try to reset the pending count to zero. If this fails we
+* know another GPE event has occurred while handling the
+* current GPE event and need to loop.
+*/
+} while (!atomic_cmpset_int(>ec_sci_pend, pending, 0));
+}
+
 /*
  * The GPE handler is called when IBE/OBF or SCI events occur.  We are
  * called from an unknown lock context.
@@ -713,13 +733,14 @@ EcGpeHandler(void *Context)
  * It will run the query and _Qxx method later, under the lock.
  */
 EcStatus = EC_GET_CSR(sc);
-if ((EcStatus & EC_EVENT_SCI) && !sc->ec_sci_pend) {
+if ((EcStatus & EC_EVENT_SCI) &&
+   atomic_fetchadd_int(>ec_sci_pend, 1) == 0) {
CTR0(KTR_ACPI, "ec gpe queueing query handler");
Status = AcpiOsExecute(OSL_GPE_HANDLER, EcGpeQueryHandler, Context);
-   if (ACPI_SUCCESS(Status))
-   sc->ec_sci_pend = TRUE;
-   else
+   if (ACPI_FAILURE(Status)) {
printf("EcGpeHandler: queuing GPE query handler failed\n");
+   atomic_store_rel_int(>ec_sci_pend, 0);
+   }
 }
 return (0);
 }
@@ -766,7 +787,8 @@ EcSpaceHandler(UINT32 Function, ACPI_PHY
  * we call it directly here since our thread taskq is not active yet.
  */
 if (cold || rebooting || sc->ec_suspending) {
-   if ((EC_GET_CSR(sc) & EC_EVENT_SCI)) {
+   if ((EC_GET_CSR(sc) & EC_EVENT_SCI) &&
+   atomic_fetchadd_int(>ec_sci_pend, 1) == 0) {
CTR0(KTR_ACPI, "ec running gpe handler directly");
EcGpeQueryHandler(sc);
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310255 - stable/9/sys/dev/acpica

2016-12-19 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Dec 19 09:54:59 2016
New Revision: 310255
URL: https://svnweb.freebsd.org/changeset/base/310255

Log:
  MFC r309400:
  Fix for endless recursion in the ACPI GPE handler during boot.
  
  When handling a GPE ACPI interrupt object the EcSpaceHandler()
  function can be called which checks the EC_EVENT_SCI bit and then
  recurse on the EcGpeQueryHandler() function. If there are multiple GPE
  events pending the EC_EVENT_SCI bit will be set at the next call to
  EcSpaceHandler() causing it to recurse again via the
  EcGpeQueryHandler() function. This leads to a slow never ending
  recursion during boot which prevents proper system startup, because
  the EC_EVENT_SCI bit never gets cleared in this scenario.
  
  The behaviour is reproducible with the ALASKA AMI in combination with
  a newer Skylake based mainboard in the following way:
  
  Enter BIOS and adjust the clock one hour forward. Save and exit the
  BIOS. System fails to boot due to the above mentioned bug in
  EcGpeQueryHandler() which was observed recursing multiple times.
  
  This patch adds a simple recursion guard to the EcGpeQueryHandler()
  function and also also adds logic to detect if new GPE events occurred
  during the execution of EcGpeQueryHandler() and then loop on this
  function instead of recursing.
  
  Reviewed by:  jhb

Modified:
  stable/9/sys/dev/acpica/acpi_ec.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/dev/acpica/acpi_ec.c
==
--- stable/9/sys/dev/acpica/acpi_ec.c   Mon Dec 19 09:52:32 2016
(r310254)
+++ stable/9/sys/dev/acpica/acpi_ec.c   Mon Dec 19 09:54:59 2016
(r310255)
@@ -618,16 +618,14 @@ EcCheckStatus(struct acpi_ec_softc *sc, 
 }
 
 static void
-EcGpeQueryHandler(void *Context)
+EcGpeQueryHandlerSub(struct acpi_ec_softc *sc)
 {
-struct acpi_ec_softc   *sc = (struct acpi_ec_softc *)Context;
 UINT8  Data;
 ACPI_STATUSStatus;
 intretry;
 char   qxx[5];
 
 ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
-KASSERT(Context != NULL, ("EcGpeQueryHandler called with NULL"));
 
 /* Serialize user access with EcSpaceHandler(). */
 Status = EcLock(sc);
@@ -654,7 +652,6 @@ EcGpeQueryHandler(void *Context)
else
break;
 }
-sc->ec_sci_pend = FALSE;
 if (ACPI_FAILURE(Status)) {
EcUnlock(sc);
device_printf(sc->ec_dev, "GPE query failed: %s\n",
@@ -685,6 +682,29 @@ EcGpeQueryHandler(void *Context)
 }
 }
 
+static void
+EcGpeQueryHandler(void *Context)
+{
+struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context;
+int pending;
+
+KASSERT(Context != NULL, ("EcGpeQueryHandler called with NULL"));
+
+do {
+   /* Read the current pending count */
+   pending = atomic_load_acq_int(>ec_sci_pend);
+
+   /* Call GPE handler function */
+   EcGpeQueryHandlerSub(sc);
+
+   /*
+* Try to reset the pending count to zero. If this fails we
+* know another GPE event has occurred while handling the
+* current GPE event and need to loop.
+*/
+} while (!atomic_cmpset_int(>ec_sci_pend, pending, 0));
+}
+
 /*
  * The GPE handler is called when IBE/OBF or SCI events occur.  We are
  * called from an unknown lock context.
@@ -713,13 +733,14 @@ EcGpeHandler(ACPI_HANDLE GpeDevice, UINT
  * It will run the query and _Qxx method later, under the lock.
  */
 EcStatus = EC_GET_CSR(sc);
-if ((EcStatus & EC_EVENT_SCI) && !sc->ec_sci_pend) {
+if ((EcStatus & EC_EVENT_SCI) &&
+   atomic_fetchadd_int(>ec_sci_pend, 1) == 0) {
CTR0(KTR_ACPI, "ec gpe queueing query handler");
Status = AcpiOsExecute(OSL_GPE_HANDLER, EcGpeQueryHandler, Context);
-   if (ACPI_SUCCESS(Status))
-   sc->ec_sci_pend = TRUE;
-   else
+   if (ACPI_FAILURE(Status)) {
printf("EcGpeHandler: queuing GPE query handler failed\n");
+   atomic_store_rel_int(>ec_sci_pend, 0);
+   }
 }
 return (ACPI_REENABLE_GPE);
 }
@@ -766,7 +787,8 @@ EcSpaceHandler(UINT32 Function, ACPI_PHY
  * we call it directly here since our thread taskq is not active yet.
  */
 if (cold || rebooting || sc->ec_suspending) {
-   if ((EC_GET_CSR(sc) & EC_EVENT_SCI)) {
+   if ((EC_GET_CSR(sc) & EC_EVENT_SCI) &&
+   atomic_fetchadd_int(>ec_sci_pend, 1) == 0) {
CTR0(KTR_ACPI, "ec running gpe handler directly");
EcGpeQueryHandler(sc);
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310254 - stable/10/sys/dev/acpica

2016-12-19 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Dec 19 09:52:32 2016
New Revision: 310254
URL: https://svnweb.freebsd.org/changeset/base/310254

Log:
  MFC r309400:
  Fix for endless recursion in the ACPI GPE handler during boot.
  
  When handling a GPE ACPI interrupt object the EcSpaceHandler()
  function can be called which checks the EC_EVENT_SCI bit and then
  recurse on the EcGpeQueryHandler() function. If there are multiple GPE
  events pending the EC_EVENT_SCI bit will be set at the next call to
  EcSpaceHandler() causing it to recurse again via the
  EcGpeQueryHandler() function. This leads to a slow never ending
  recursion during boot which prevents proper system startup, because
  the EC_EVENT_SCI bit never gets cleared in this scenario.
  
  The behaviour is reproducible with the ALASKA AMI in combination with
  a newer Skylake based mainboard in the following way:
  
  Enter BIOS and adjust the clock one hour forward. Save and exit the
  BIOS. System fails to boot due to the above mentioned bug in
  EcGpeQueryHandler() which was observed recursing multiple times.
  
  This patch adds a simple recursion guard to the EcGpeQueryHandler()
  function and also also adds logic to detect if new GPE events occurred
  during the execution of EcGpeQueryHandler() and then loop on this
  function instead of recursing.
  
  Reviewed by:  jhb

Modified:
  stable/10/sys/dev/acpica/acpi_ec.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/acpica/acpi_ec.c
==
--- stable/10/sys/dev/acpica/acpi_ec.c  Mon Dec 19 09:51:17 2016
(r310253)
+++ stable/10/sys/dev/acpica/acpi_ec.c  Mon Dec 19 09:52:32 2016
(r310254)
@@ -618,16 +618,14 @@ EcCheckStatus(struct acpi_ec_softc *sc, 
 }
 
 static void
-EcGpeQueryHandler(void *Context)
+EcGpeQueryHandlerSub(struct acpi_ec_softc *sc)
 {
-struct acpi_ec_softc   *sc = (struct acpi_ec_softc *)Context;
 UINT8  Data;
 ACPI_STATUSStatus;
 intretry;
 char   qxx[5];
 
 ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
-KASSERT(Context != NULL, ("EcGpeQueryHandler called with NULL"));
 
 /* Serialize user access with EcSpaceHandler(). */
 Status = EcLock(sc);
@@ -652,7 +650,6 @@ EcGpeQueryHandler(void *Context)
EC_EVENT_INPUT_BUFFER_EMPTY)))
break;
 }
-sc->ec_sci_pend = FALSE;
 if (ACPI_FAILURE(Status)) {
EcUnlock(sc);
device_printf(sc->ec_dev, "GPE query failed: %s\n",
@@ -683,6 +680,29 @@ EcGpeQueryHandler(void *Context)
 }
 }
 
+static void
+EcGpeQueryHandler(void *Context)
+{
+struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context;
+int pending;
+
+KASSERT(Context != NULL, ("EcGpeQueryHandler called with NULL"));
+
+do {
+   /* Read the current pending count */
+   pending = atomic_load_acq_int(>ec_sci_pend);
+
+   /* Call GPE handler function */
+   EcGpeQueryHandlerSub(sc);
+
+   /*
+* Try to reset the pending count to zero. If this fails we
+* know another GPE event has occurred while handling the
+* current GPE event and need to loop.
+*/
+} while (!atomic_cmpset_int(>ec_sci_pend, pending, 0));
+}
+
 /*
  * The GPE handler is called when IBE/OBF or SCI events occur.  We are
  * called from an unknown lock context.
@@ -711,13 +731,14 @@ EcGpeHandler(ACPI_HANDLE GpeDevice, UINT
  * It will run the query and _Qxx method later, under the lock.
  */
 EcStatus = EC_GET_CSR(sc);
-if ((EcStatus & EC_EVENT_SCI) && !sc->ec_sci_pend) {
+if ((EcStatus & EC_EVENT_SCI) &&
+   atomic_fetchadd_int(>ec_sci_pend, 1) == 0) {
CTR0(KTR_ACPI, "ec gpe queueing query handler");
Status = AcpiOsExecute(OSL_GPE_HANDLER, EcGpeQueryHandler, Context);
-   if (ACPI_SUCCESS(Status))
-   sc->ec_sci_pend = TRUE;
-   else
+   if (ACPI_FAILURE(Status)) {
printf("EcGpeHandler: queuing GPE query handler failed\n");
+   atomic_store_rel_int(>ec_sci_pend, 0);
+   }
 }
 return (ACPI_REENABLE_GPE);
 }
@@ -764,7 +785,8 @@ EcSpaceHandler(UINT32 Function, ACPI_PHY
  * we call it directly here since our thread taskq is not active yet.
  */
 if (cold || rebooting || sc->ec_suspending) {
-   if ((EC_GET_CSR(sc) & EC_EVENT_SCI)) {
+   if ((EC_GET_CSR(sc) & EC_EVENT_SCI) &&
+   atomic_fetchadd_int(>ec_sci_pend, 1) == 0) {
CTR0(KTR_ACPI, "ec running gpe handler directly");
EcGpeQueryHandler(sc);
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310253 - stable/11/sys/dev/acpica

2016-12-19 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Dec 19 09:51:17 2016
New Revision: 310253
URL: https://svnweb.freebsd.org/changeset/base/310253

Log:
  MFC r309400:
  Fix for endless recursion in the ACPI GPE handler during boot.
  
  When handling a GPE ACPI interrupt object the EcSpaceHandler()
  function can be called which checks the EC_EVENT_SCI bit and then
  recurse on the EcGpeQueryHandler() function. If there are multiple GPE
  events pending the EC_EVENT_SCI bit will be set at the next call to
  EcSpaceHandler() causing it to recurse again via the
  EcGpeQueryHandler() function. This leads to a slow never ending
  recursion during boot which prevents proper system startup, because
  the EC_EVENT_SCI bit never gets cleared in this scenario.
  
  The behaviour is reproducible with the ALASKA AMI in combination with
  a newer Skylake based mainboard in the following way:
  
  Enter BIOS and adjust the clock one hour forward. Save and exit the
  BIOS. System fails to boot due to the above mentioned bug in
  EcGpeQueryHandler() which was observed recursing multiple times.
  
  This patch adds a simple recursion guard to the EcGpeQueryHandler()
  function and also also adds logic to detect if new GPE events occurred
  during the execution of EcGpeQueryHandler() and then loop on this
  function instead of recursing.
  
  Reviewed by:  jhb

Modified:
  stable/11/sys/dev/acpica/acpi_ec.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/acpica/acpi_ec.c
==
--- stable/11/sys/dev/acpica/acpi_ec.c  Mon Dec 19 09:49:16 2016
(r310252)
+++ stable/11/sys/dev/acpica/acpi_ec.c  Mon Dec 19 09:51:17 2016
(r310253)
@@ -613,16 +613,14 @@ EcCheckStatus(struct acpi_ec_softc *sc, 
 }
 
 static void
-EcGpeQueryHandler(void *Context)
+EcGpeQueryHandlerSub(struct acpi_ec_softc *sc)
 {
-struct acpi_ec_softc   *sc = (struct acpi_ec_softc *)Context;
 UINT8  Data;
 ACPI_STATUSStatus;
 intretry;
 char   qxx[5];
 
 ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
-KASSERT(Context != NULL, ("EcGpeQueryHandler called with NULL"));
 
 /* Serialize user access with EcSpaceHandler(). */
 Status = EcLock(sc);
@@ -647,7 +645,6 @@ EcGpeQueryHandler(void *Context)
EC_EVENT_INPUT_BUFFER_EMPTY)))
break;
 }
-sc->ec_sci_pend = FALSE;
 if (ACPI_FAILURE(Status)) {
EcUnlock(sc);
device_printf(sc->ec_dev, "GPE query failed: %s\n",
@@ -678,6 +675,29 @@ EcGpeQueryHandler(void *Context)
 }
 }
 
+static void
+EcGpeQueryHandler(void *Context)
+{
+struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context;
+int pending;
+
+KASSERT(Context != NULL, ("EcGpeQueryHandler called with NULL"));
+
+do {
+   /* Read the current pending count */
+   pending = atomic_load_acq_int(>ec_sci_pend);
+
+   /* Call GPE handler function */
+   EcGpeQueryHandlerSub(sc);
+
+   /*
+* Try to reset the pending count to zero. If this fails we
+* know another GPE event has occurred while handling the
+* current GPE event and need to loop.
+*/
+} while (!atomic_cmpset_int(>ec_sci_pend, pending, 0));
+}
+
 /*
  * The GPE handler is called when IBE/OBF or SCI events occur.  We are
  * called from an unknown lock context.
@@ -706,13 +726,14 @@ EcGpeHandler(ACPI_HANDLE GpeDevice, UINT
  * It will run the query and _Qxx method later, under the lock.
  */
 EcStatus = EC_GET_CSR(sc);
-if ((EcStatus & EC_EVENT_SCI) && !sc->ec_sci_pend) {
+if ((EcStatus & EC_EVENT_SCI) &&
+   atomic_fetchadd_int(>ec_sci_pend, 1) == 0) {
CTR0(KTR_ACPI, "ec gpe queueing query handler");
Status = AcpiOsExecute(OSL_GPE_HANDLER, EcGpeQueryHandler, Context);
-   if (ACPI_SUCCESS(Status))
-   sc->ec_sci_pend = TRUE;
-   else
+   if (ACPI_FAILURE(Status)) {
printf("EcGpeHandler: queuing GPE query handler failed\n");
+   atomic_store_rel_int(>ec_sci_pend, 0);
+   }
 }
 return (ACPI_REENABLE_GPE);
 }
@@ -759,7 +780,8 @@ EcSpaceHandler(UINT32 Function, ACPI_PHY
  * we call it directly here since our thread taskq is not active yet.
  */
 if (cold || rebooting || sc->ec_suspending) {
-   if ((EC_GET_CSR(sc) & EC_EVENT_SCI)) {
+   if ((EC_GET_CSR(sc) & EC_EVENT_SCI) &&
+   atomic_fetchadd_int(>ec_sci_pend, 1) == 0) {
CTR0(KTR_ACPI, "ec running gpe handler directly");
EcGpeQueryHandler(sc);
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310252 - stable/11/sys/compat/linuxkpi/common/include/linux

2016-12-19 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Dec 19 09:49:16 2016
New Revision: 310252
URL: https://svnweb.freebsd.org/changeset/base/310252

Log:
  MFC r309737:
  Add more LinuxKPI PCI definitions.
  
  Obtained from:kmacy @
  Sponsored by: Mellanox Technologies

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/pci.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/pci.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/pci.hMon Dec 19 
09:48:29 2016(r310251)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/pci.hMon Dec 19 
09:49:16 2016(r310252)
@@ -64,8 +64,18 @@ struct pci_device_id {
 
 #defineMODULE_DEVICE_TABLE(bus, table)
 #definePCI_ANY_ID  (-1)
+#definePCI_VENDOR_ID_APPLE 0x106b
+#definePCI_VENDOR_ID_ASUSTEK   0x1043
+#definePCI_VENDOR_ID_ATI   0x1002
+#definePCI_VENDOR_ID_DELL  0x1028
+#definePCI_VENDOR_ID_HP0x103c
+#definePCI_VENDOR_ID_IBM   0x1014
+#definePCI_VENDOR_ID_INTEL 0x8086
 #definePCI_VENDOR_ID_MELLANOX  0x15b3
+#definePCI_VENDOR_ID_SERVERWORKS   0x1166
+#definePCI_VENDOR_ID_SONY  0x104d
 #definePCI_VENDOR_ID_TOPSPIN   0x1867
+#definePCI_VENDOR_ID_VIA   0x1106
 #definePCI_DEVICE_ID_MELLANOX_TAVOR0x5a44
 #definePCI_DEVICE_ID_MELLANOX_TAVOR_BRIDGE 0x5a46
 #definePCI_DEVICE_ID_MELLANOX_ARBEL_COMPAT 0x6278
@@ -121,6 +131,10 @@ struct pci_device_id {
 #definePCI_EXP_LNKCAP2_SLS_5_0GB 0x04  /* Supported Link Speed 5.0GT/s 
*/
 #definePCI_EXP_LNKCAP2_SLS_8_0GB 0x08  /* Supported Link Speed 8.0GT/s 
*/
 
+#define PCI_EXP_LNKCTL_HAWDPCIEM_LINK_CTL_HAWD
+#define PCI_EXP_LNKCAP_CLKPM   0x0004
+#define PCI_EXP_DEVSTA_TRPND   0x0020
+
 #defineIORESOURCE_MEM  (1 << SYS_RES_MEMORY)
 #defineIORESOURCE_IO   (1 << SYS_RES_IOPORT)
 #defineIORESOURCE_IRQ  (1 << SYS_RES_IRQ)
@@ -133,9 +147,19 @@ enum pci_bus_speed {
 };
 
 enum pcie_link_width {
-   PCIE_LNK_WIDTH_UNKNOWN = -1,
+   PCIE_LNK_WIDTH_UNKNOWN = 0xFF,
 };
 
+typedef int pci_power_t;
+
+#define PCI_D0 PCI_POWERSTATE_D0
+#define PCI_D1 PCI_POWERSTATE_D1
+#define PCI_D2 PCI_POWERSTATE_D2
+#define PCI_D3hot  PCI_POWERSTATE_D3
+#define PCI_D3cold 4
+
+#define PCI_POWER_ERRORPCI_POWERSTATE_UNKNOWN
+
 struct pci_dev;
 
 struct pci_driver {
@@ -303,6 +327,14 @@ pci_set_master(struct pci_dev *pdev)
 }
 
 static inline int
+pci_set_power_state(struct pci_dev *pdev, int state)
+{
+
+   pci_set_powerstate(pdev->dev.bsddev, state);
+   return (0);
+}
+
+static inline int
 pci_clear_master(struct pci_dev *pdev)
 {
 
@@ -368,9 +400,23 @@ pci_disable_msix(struct pci_dev *pdev)
pci_release_msi(pdev->dev.bsddev);
 }
 
+static inline bus_addr_t
+pci_bus_address(struct pci_dev *pdev, int bar)
+{
+
+   return (pci_resource_start(pdev, bar));
+}
+
 #definePCI_CAP_ID_EXP  PCIY_EXPRESS
 #definePCI_CAP_ID_PCIX PCIY_PCIX
+#define PCI_CAP_ID_AGP  PCIY_AGP
+#define PCI_CAP_ID_PM   PCIY_PMG
 
+#define PCI_EXP_DEVCTL PCIER_DEVICE_CTL
+#define PCI_EXP_DEVCTL_PAYLOAD PCIEM_CTL_MAX_PAYLOAD
+#define PCI_EXP_DEVCTL_READRQ  PCIEM_CTL_MAX_READ_REQUEST
+#define PCI_EXP_LNKCTL PCIER_LINK_CTL
+#define PCI_EXP_LNKSTA PCIER_LINK_STA
 
 static inline int
 pci_find_capability(struct pci_dev *pdev, int capid)
@@ -410,7 +456,7 @@ pci_read_config_dword(struct pci_dev *pd
 
*val = (u32)pci_read_config(pdev->dev.bsddev, where, 4);
return (0);
-} 
+}
 
 static inline int
 pci_write_config_byte(struct pci_dev *pdev, int where, u8 val)
@@ -430,7 +476,7 @@ pci_write_config_word(struct pci_dev *pd
 
 static inline int
 pci_write_config_dword(struct pci_dev *pdev, int where, u32 val)
-{ 
+{
 
pci_write_config(pdev->dev.bsddev, where, val, 4);
return (0);
@@ -708,7 +754,8 @@ static bool pcie_capability_reg_implemen
 }
 }
 
-static inline int pcie_capability_read_dword(struct pci_dev *dev, int pos, u32 
*dst)
+static inline int
+pcie_capability_read_dword(struct pci_dev *dev, int pos, u32 *dst)
 {
 if (pos & 3)
 return -EINVAL;
@@ -719,7 +766,20 @@ static inline int pcie_capability_read_d
 return pci_read_config_dword(dev, pci_pcie_cap(dev) + pos, dst);
 }
 
-static inline int pcie_capability_write_word(struct pci_dev *dev, int pos, u16 
val)
+static inline int
+pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *dst)
+{
+if (pos & 3)
+return -EINVAL;
+
+if (!pcie_capability_reg_implemented(dev, pos))
+return -EINVAL;
+
+return 

svn commit: r310251 - stable/11/sys/compat/linuxkpi/common/include/linux

2016-12-19 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Dec 19 09:48:29 2016
New Revision: 310251
URL: https://svnweb.freebsd.org/changeset/base/310251

Log:
  MFC r309736:
  Prefer function macros over regular macros in the LinuxKPI.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/pci.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/pci.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/pci.hMon Dec 19 
09:47:34 2016(r310250)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/pci.hMon Dec 19 
09:48:29 2016(r310251)
@@ -537,9 +537,9 @@ static inline void pci_disable_sriov(str
 #definePCI_DMA_NONE3
 
 #definepci_pooldma_pool
-#define pci_pool_destroy   dma_pool_destroy
-#define pci_pool_alloc dma_pool_alloc
-#define pci_pool_free  dma_pool_free
+#definepci_pool_destroy(...)   dma_pool_destroy(__VA_ARGS__)
+#definepci_pool_alloc(...) dma_pool_alloc(__VA_ARGS__)
+#definepci_pool_free(...)  dma_pool_free(__VA_ARGS__)
 #definepci_pool_create(_name, _pdev, _size, _align, _alloc)
\
dma_pool_create(_name, &(_pdev)->dev, _size, _align, _alloc)
 #definepci_free_consistent(_hwdev, _size, _vaddr, _dma_handle) 
\
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310250 - in stable/11/sys/compat/linuxkpi/common: include/linux src

2016-12-19 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Dec 19 09:47:34 2016
New Revision: 310250
URL: https://svnweb.freebsd.org/changeset/base/310250

Log:
  MFC r309732:
  Prefix some _pci_xxx() functions in the Linux KPI with linux_ and make
  sure the IRQ number used by these functions is unsigned.
  
  Sponsored by:   Mellanox Technologies

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/interrupt.h
  stable/11/sys/compat/linuxkpi/common/include/linux/pci.h
  stable/11/sys/compat/linuxkpi/common/src/linux_pci.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/interrupt.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/interrupt.h  Mon Dec 
19 09:45:23 2016(r310249)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/interrupt.h  Mon Dec 
19 09:47:34 2016(r310250)
@@ -50,11 +50,11 @@ struct irq_ent {
void*arg;
irqreturn_t (*handler)(int, void *);
void*tag;
-   int  irq;
+   unsigned intirq;
 };
 
 static inline int
-linux_irq_rid(struct device *dev, int irq)
+linux_irq_rid(struct device *dev, unsigned int irq)
 {
if (irq == dev->irq)
return (0);
@@ -64,7 +64,7 @@ linux_irq_rid(struct device *dev, int ir
 extern void linux_irq_handler(void *);
 
 static inline struct irq_ent *
-linux_irq_ent(struct device *dev, int irq)
+linux_irq_ent(struct device *dev, unsigned int irq)
 {
struct irq_ent *irqe;
 
@@ -85,7 +85,7 @@ request_irq(unsigned int irq, irq_handle
int error;
int rid;
 
-   dev = _pci_find_irq_dev(irq);
+   dev = linux_pci_find_irq_dev(irq);
if (dev == NULL)
return -ENXIO;
rid = linux_irq_rid(dev, irq);
@@ -117,7 +117,7 @@ bind_irq_to_cpu(unsigned int irq, int cp
struct irq_ent *irqe;
struct device *dev;
 
-   dev = _pci_find_irq_dev(irq);
+   dev = linux_pci_find_irq_dev(irq);
if (dev == NULL)
return (-ENOENT);
 
@@ -135,7 +135,7 @@ free_irq(unsigned int irq, void *device)
struct device *dev;
int rid;
 
-   dev = _pci_find_irq_dev(irq);
+   dev = linux_pci_find_irq_dev(irq);
if (dev == NULL)
return;
rid = linux_irq_rid(dev, irq);

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/pci.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/pci.hMon Dec 19 
09:45:23 2016(r310249)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/pci.hMon Dec 19 
09:47:34 2016(r310250)
@@ -171,7 +171,7 @@ struct pci_dev {
 };
 
 static inline struct resource_list_entry *
-_pci_get_rle(struct pci_dev *pdev, int type, int rid)
+linux_pci_get_rle(struct pci_dev *pdev, int type, int rid)
 {
struct pci_devinfo *dinfo;
struct resource_list *rl;
@@ -182,18 +182,18 @@ _pci_get_rle(struct pci_dev *pdev, int t
 }
 
 static inline struct resource_list_entry *
-_pci_get_bar(struct pci_dev *pdev, int bar)
+linux_pci_get_bar(struct pci_dev *pdev, int bar)
 {
struct resource_list_entry *rle;
 
bar = PCIR_BAR(bar);
-   if ((rle = _pci_get_rle(pdev, SYS_RES_MEMORY, bar)) == NULL)
-   rle = _pci_get_rle(pdev, SYS_RES_IOPORT, bar);
+   if ((rle = linux_pci_get_rle(pdev, SYS_RES_MEMORY, bar)) == NULL)
+   rle = linux_pci_get_rle(pdev, SYS_RES_IOPORT, bar);
return (rle);
 }
 
 static inline struct device *
-_pci_find_irq_dev(unsigned int irq)
+linux_pci_find_irq_dev(unsigned int irq)
 {
struct pci_dev *pdev;
 
@@ -215,7 +215,7 @@ pci_resource_start(struct pci_dev *pdev,
 {
struct resource_list_entry *rle;
 
-   if ((rle = _pci_get_bar(pdev, bar)) == NULL)
+   if ((rle = linux_pci_get_bar(pdev, bar)) == NULL)
return (0);
return rle->start;
 }
@@ -225,7 +225,7 @@ pci_resource_len(struct pci_dev *pdev, i
 {
struct resource_list_entry *rle;
 
-   if ((rle = _pci_get_bar(pdev, bar)) == NULL)
+   if ((rle = linux_pci_get_bar(pdev, bar)) == NULL)
return (0);
return rle->count;
 }
@@ -331,7 +331,7 @@ pci_release_region(struct pci_dev *pdev,
 {
struct resource_list_entry *rle;
 
-   if ((rle = _pci_get_bar(pdev, bar)) == NULL)
+   if ((rle = linux_pci_get_bar(pdev, bar)) == NULL)
return;
bus_release_resource(pdev->dev.bsddev, rle->type, rle->rid, rle->res);
 }
@@ -477,7 +477,7 @@ pci_enable_msix(struct pci_dev *pdev, st
pci_release_msi(pdev->dev.bsddev);
return avail;
}
-   rle = _pci_get_rle(pdev, SYS_RES_IRQ, 1);
+   rle = linux_pci_get_rle(pdev, SYS_RES_IRQ, 1);
pdev->dev.msix = rle->start;
pdev->dev.msix_max = rle->start + 

svn commit: r310249 - stable/10/sys/netgraph

2016-12-19 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Dec 19 09:45:23 2016
New Revision: 310249
URL: https://svnweb.freebsd.org/changeset/base/310249

Log:
  MFC r309404:
  Fix return value from ng_uncallout().
  
  callout_stop() recently started returning -1 when the callout is already
  stopped, which is not handled by the netgraph code. Properly filter
  the return value. Netgraph callers only want to know if the callout
  was cancelled and not draining or already stopped.
  
  Discussed with:   julian, glebius

Modified:
  stable/10/sys/netgraph/ng_base.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netgraph/ng_base.c
==
--- stable/10/sys/netgraph/ng_base.cMon Dec 19 09:44:14 2016
(r310248)
+++ stable/10/sys/netgraph/ng_base.cMon Dec 19 09:45:23 2016
(r310249)
@@ -3823,7 +3823,11 @@ ng_uncallout(struct callout *c, node_p n
}
c->c_arg = NULL;
 
-   return (rval);
+   /*
+* Callers only want to know if the callout was cancelled and
+* not draining or stopped.
+*/
+   return (rval > 0);
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310248 - stable/11/sys/netgraph

2016-12-19 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Dec 19 09:44:14 2016
New Revision: 310248
URL: https://svnweb.freebsd.org/changeset/base/310248

Log:
  MFC r309404:
  Fix return value from ng_uncallout().
  
  callout_stop() recently started returning -1 when the callout is already
  stopped, which is not handled by the netgraph code. Properly filter
  the return value. Netgraph callers only want to know if the callout
  was cancelled and not draining or already stopped.
  
  Discussed with:   julian, glebius

Modified:
  stable/11/sys/netgraph/ng_base.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netgraph/ng_base.c
==
--- stable/11/sys/netgraph/ng_base.cMon Dec 19 09:42:43 2016
(r310247)
+++ stable/11/sys/netgraph/ng_base.cMon Dec 19 09:44:14 2016
(r310248)
@@ -3825,7 +3825,11 @@ ng_uncallout(struct callout *c, node_p n
}
c->c_arg = NULL;
 
-   return (rval);
+   /*
+* Callers only want to know if the callout was cancelled and
+* not draining or stopped.
+*/
+   return (rval > 0);
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310247 - stable/11/sys/compat/linuxkpi/common/include/linux

2016-12-19 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Dec 19 09:42:43 2016
New Revision: 310247
URL: https://svnweb.freebsd.org/changeset/base/310247

Log:
  MFC r309731:
  Prefix the Linux KPI's kmem_xxx() functions with linux_ to avoid
  conflict with the opensolaris kernel module.
  
  This patch solves a problem where the kernel linker will incorrectly
  resolve opensolaris kmem_xxx() functions as linuxkpi ones, which leads
  to a panic when these functions are used.
  
  Submitted by: gallatin @
  Sponsored by:   Mellanox Technologies

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/slab.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/slab.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/slab.h   Mon Dec 19 
09:41:49 2016(r310246)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/slab.h   Mon Dec 19 
09:42:43 2016(r310247)
@@ -55,7 +55,18 @@ MALLOC_DECLARE(M_KMALLOC);
 #definevmalloc(size)   kmalloc(size, GFP_KERNEL)
 #definevmalloc_node(size, node)kmalloc(size, GFP_KERNEL)
 
-struct kmem_cache {
+
+/*
+ * Prefix some functions with linux_ to avoid namespace conflict
+ * with the OpenSolaris code in the kernel.
+ */
+#definekmem_cache  linux_kmem_cache
+#definekmem_cache_create(...)  linux_kmem_cache_create(__VA_ARGS__)
+#definekmem_cache_alloc(...)   linux_kmem_cache_alloc(__VA_ARGS__)
+#definekmem_cache_free(...)linux_kmem_cache_free(__VA_ARGS__)
+#definekmem_cache_destroy(...) linux_kmem_cache_destroy(__VA_ARGS__)
+
+struct linux_kmem_cache {
uma_zone_t  cache_zone;
void(*cache_ctor)(void *);
 };
@@ -63,7 +74,7 @@ struct kmem_cache {
 #defineSLAB_HWCACHE_ALIGN  0x0001
 
 static inline int
-kmem_ctor(void *mem, int size, void *arg, int flags)
+linux_kmem_ctor(void *mem, int size, void *arg, int flags)
 {
void (*ctor)(void *);
 
@@ -74,7 +85,7 @@ kmem_ctor(void *mem, int size, void *arg
 }
 
 static inline struct kmem_cache *
-kmem_cache_create(char *name, size_t size, size_t align, u_long flags,
+linux_kmem_cache_create(char *name, size_t size, size_t align, u_long flags,
 void (*ctor)(void *))
 {
struct kmem_cache *c;
@@ -84,7 +95,7 @@ kmem_cache_create(char *name, size_t siz
align--;
if (flags & SLAB_HWCACHE_ALIGN)
align = UMA_ALIGN_CACHE;
-   c->cache_zone = uma_zcreate(name, size, ctor ? kmem_ctor : NULL,
+   c->cache_zone = uma_zcreate(name, size, ctor ? linux_kmem_ctor : NULL,
NULL, NULL, NULL, align, 0);
c->cache_ctor = ctor;
 
@@ -92,19 +103,19 @@ kmem_cache_create(char *name, size_t siz
 }
 
 static inline void *
-kmem_cache_alloc(struct kmem_cache *c, int flags)
+linux_kmem_cache_alloc(struct kmem_cache *c, int flags)
 {
return uma_zalloc_arg(c->cache_zone, c->cache_ctor, flags);
 }
 
 static inline void
-kmem_cache_free(struct kmem_cache *c, void *m)
+linux_kmem_cache_free(struct kmem_cache *c, void *m)
 {
uma_zfree(c->cache_zone, m);
 }
 
 static inline void
-kmem_cache_destroy(struct kmem_cache *c)
+linux_kmem_cache_destroy(struct kmem_cache *c)
 {
uma_zdestroy(c->cache_zone);
free(c, M_KMALLOC);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310246 - in stable/11/sys/compat/linuxkpi/common: include/linux src

2016-12-19 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Dec 19 09:41:49 2016
New Revision: 310246
URL: https://svnweb.freebsd.org/changeset/base/310246

Log:
  MFC r309733:
  MSIX can support more than 256 IRQs. Make sure the invalid IRQ number
  set in the LinuxKPI is big enough.
  
  Sponsored by:   Mellanox Technologies

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/device.h
  stable/11/sys/compat/linuxkpi/common/src/linux_pci.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/device.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/device.h Mon Dec 19 
09:40:29 2016(r310245)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/device.h Mon Dec 19 
09:41:49 2016(r310246)
@@ -70,6 +70,7 @@ struct device {
uint64_t*dma_mask;
void*driver_data;
unsigned intirq;
+#defineLINUX_IRQ_INVALID   65535
unsigned intmsix;
unsigned intmsix_max;
const struct attribute_group **groups;

Modified: stable/11/sys/compat/linuxkpi/common/src/linux_pci.c
==
--- stable/11/sys/compat/linuxkpi/common/src/linux_pci.cMon Dec 19 
09:40:29 2016(r310245)
+++ stable/11/sys/compat/linuxkpi/common/src/linux_pci.cMon Dec 19 
09:41:49 2016(r310246)
@@ -144,7 +144,7 @@ linux_pci_attach(device_t dev)
if (rle)
pdev->dev.irq = rle->start;
else
-   pdev->dev.irq = 255;
+   pdev->dev.irq = LINUX_IRQ_INVALID;
pdev->irq = pdev->dev.irq;
DROP_GIANT();
spin_lock(_lock);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310245 - stable/11/sys/compat/linuxkpi/common/include/linux

2016-12-19 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Dec 19 09:40:29 2016
New Revision: 310245
URL: https://svnweb.freebsd.org/changeset/base/310245

Log:
  MFC r309734:
  Avoid malloc() warnings when using the LinuxKPI by zero-checking
  the allocation flags.
  
  Obtained from:kmacy @
  Sponsored by:   Mellanox Technologies

Modified:
  stable/11/sys/compat/linuxkpi/common/include/linux/gfp.h
  stable/11/sys/compat/linuxkpi/common/include/linux/slab.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/gfp.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/gfp.hMon Dec 19 
09:38:34 2016(r310244)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/gfp.hMon Dec 19 
09:40:29 2016(r310245)
@@ -64,7 +64,7 @@
 #defineGFP_IOFSM_NOWAIT
 #defineGFP_NOIOM_NOWAIT
 #defineGFP_DMA32   0
-#defineGFP_TEMPORARY   0
+#defineGFP_TEMPORARY   M_NOWAIT
 
 static inline void *
 page_address(struct page *page)

Modified: stable/11/sys/compat/linuxkpi/common/include/linux/slab.h
==
--- stable/11/sys/compat/linuxkpi/common/include/linux/slab.h   Mon Dec 19 
09:38:34 2016(r310244)
+++ stable/11/sys/compat/linuxkpi/common/include/linux/slab.h   Mon Dec 19 
09:40:29 2016(r310245)
@@ -43,7 +43,7 @@ MALLOC_DECLARE(M_KMALLOC);
 
 #definekmalloc(size, flags)malloc((size), M_KMALLOC, 
(flags))
 #definekvmalloc(size)  kmalloc((size), 0)
-#definekzalloc(size, flags)kmalloc((size), (flags) | 
M_ZERO)
+#definekzalloc(size, flags)kmalloc((size), M_ZERO | 
((flags) ? (flags) : M_NOWAIT))
 #definekzalloc_node(size, flags, node) kzalloc(size, flags)
 #definekfree(ptr)  free(__DECONST(void *, (ptr)), 
M_KMALLOC)
 #definekfree_const(ptr)kfree(ptr)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r310172 - in head/sys/mips: conf ingenic

2016-12-19 Thread Andriy Gapon
On 16/12/2016 22:04, Jared McNeill wrote:
> Log:
>   Add support for Ingenic JZ4780 SMBus controller.

Just a note that it looks, swims and quacks like an I²C (I2C / IIC) controller 
:-)

>   Reviewed by:kan
>   Relnotes:   yes
>   Differential Revision:  https://reviews.freebsd.org/D8793
> 
> Added:
>   head/sys/mips/ingenic/jz4780_smb.c   (contents, props changed)
>   head/sys/mips/ingenic/jz4780_smb.h   (contents, props changed)
> Modified:
>   head/sys/mips/conf/JZ4780
>   head/sys/mips/ingenic/files.jz4780


-- 
Andriy Gapon
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Re: svn commit: r310171 - head/sys/sys

2016-12-19 Thread Ravi Pokala
-Original Message-
> From:  on behalf of Sepherosa Ziehau 
> 
> Date: 2016-12-18, Sunday at 23:02
> To: Dimitry Andric 
> Cc: , , 
> 
> Subject: Re: svn commit: r310171 - head/sys/sys
> 
> The following patch unbreaks the LINT builds on amd64 for me after this 
> commit:
> https://people.freebsd.org/~sephe/geom_sscanf.diff

Wouldn't it be better to use the SCN macros?

-Ravi (rpokala@)

> Please review it.
> 
> Thanks,
> sephe
> 
> 
> On Sat, Dec 17, 2016 at 3:49 AM, Dimitry Andric  wrote:
>> Author: dim
>> Date: Fri Dec 16 19:49:22 2016
>> New Revision: 310171
>> URL: https://svnweb.freebsd.org/changeset/base/310171
>>
>> Log:
>>   Add __scanflike attributes to the kernel's sscanf() and vsscanf()
>>   declarations.  This should help to catch future mismatches between
>>   format strings and arguments.
>>
>>   MFC after:1 week
>>
>> Modified:
>>   head/sys/sys/systm.h
>>
>> Modified: head/sys/sys/systm.h
>> ==
>> --- head/sys/sys/systm.hFri Dec 16 19:09:57 2016(r310170)
>> +++ head/sys/sys/systm.hFri Dec 16 19:49:22 2016(r310171)
>> @@ -227,8 +227,8 @@ int vsnprintf(char *, size_t, const char
>>  intvsnrprintf(char *, size_t, int, const char *, __va_list) 
>> __printflike(4, 0);
>>  intvsprintf(char *buf, const char *, __va_list) __printflike(2, 0);
>>  intttyprintf(struct tty *, const char *, ...) __printflike(2, 3);
>> -intsscanf(const char *, char const *, ...) __nonnull(1) __nonnull(2);
>> -intvsscanf(const char *, char const *, __va_list) __nonnull(1) 
>> __nonnull(2);
>> +intsscanf(const char *, char const *, ...) __nonnull(1) __nonnull(2) 
>> __scanflike(2, 3);
>> +intvsscanf(const char *, char const *, __va_list) __nonnull(1) 
>> __nonnull(2) __scanflike(2, 0);
>>  long   strtol(const char *, char **, int) __nonnull(1);
>>  u_long strtoul(const char *, char **, int) __nonnull(1);
>>  quad_t strtoq(const char *, char **, int) __nonnull(1);
>> ___
>> svn-src-all@freebsd.org mailing list
>> https://lists.freebsd.org/mailman/listinfo/svn-src-all
>> To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
> 
> -- 
> Tomorrow Will Never Die



___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310244 - stable/10/sys/dev/mlx5/mlx5_en

2016-12-19 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Dec 19 09:38:34 2016
New Revision: 310244
URL: https://svnweb.freebsd.org/changeset/base/310244

Log:
  MFC r309406:
  Remove useless NULL checks.
  
  NULL is not returned when allocating memory passing the M_WAITOK flag.
  
  Submitted by: trasz @
  Differential Revision:  https://reviews.freebsd.org/D5772
  Sponsored by:   Mellanox Technologies

Modified:
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c
  stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c
==
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Mon Dec 19 09:32:29 
2016(r310243)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Mon Dec 19 09:38:34 
2016(r310244)
@@ -854,8 +854,6 @@ mlx5e_create_main_flow_table(struct mlx5
u8 *dmac;
 
g = malloc(9 * sizeof(*g), M_MLX5EN, M_WAITOK | M_ZERO);
-   if (g == NULL)
-   return (-ENOMEM);
 
g[0].log_sz = 2;
g[0].match_criteria_enable = MLX5_MATCH_OUTER_HEADERS;
@@ -939,8 +937,6 @@ mlx5e_create_vlan_flow_table(struct mlx5
struct mlx5_flow_table_group *g;
 
g = malloc(2 * sizeof(*g), M_MLX5EN, M_WAITOK | M_ZERO);
-   if (g == NULL)
-   return (-ENOMEM);
 
g[0].log_sz = 12;
g[0].match_criteria_enable = MLX5_MATCH_OUTER_HEADERS;

Modified: stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon Dec 19 09:32:29 
2016(r310243)
+++ stable/10/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon Dec 19 09:38:34 
2016(r310244)
@@ -651,10 +651,6 @@ mlx5e_create_rq(struct mlx5e_channel *c,
 
wq_sz = mlx5_wq_ll_get_size(>wq);
rq->mbuf = malloc(wq_sz * sizeof(rq->mbuf[0]), M_MLX5EN, M_WAITOK | 
M_ZERO);
-   if (rq->mbuf == NULL) {
-   err = -ENOMEM;
-   goto err_rq_wq_destroy;
-   }
for (i = 0; i != wq_sz; i++) {
struct mlx5e_rx_wqe *wqe = mlx5_wq_ll_get_wqe(>wq, i);
uint32_t byte_count = rq->wqe_sz - MLX5E_NET_IP_ALIGN;
@@ -903,8 +899,6 @@ mlx5e_alloc_sq_db(struct mlx5e_sq *sq)
int x;
 
sq->mbuf = malloc(wq_sz * sizeof(sq->mbuf[0]), M_MLX5EN, M_WAITOK | 
M_ZERO);
-   if (sq->mbuf == NULL)
-   return (-ENOMEM);
 
/* Create DMA descriptor MAPs */
for (x = 0; x != wq_sz; x++) {
@@ -1492,9 +1486,6 @@ mlx5e_open_channel(struct mlx5e_priv *pr
int err;
 
c = malloc(sizeof(*c), M_MLX5EN, M_WAITOK | M_ZERO);
-   if (c == NULL)
-   return (-ENOMEM);
-
c->priv = priv;
c->ix = ix;
c->cpu = 0;
@@ -1705,8 +1696,6 @@ mlx5e_open_channels(struct mlx5e_priv *p
 
priv->channel = malloc(priv->params.num_channels *
sizeof(struct mlx5e_channel *), M_MLX5EN, M_WAITOK | M_ZERO);
-   if (priv->channel == NULL)
-   return (-ENOMEM);
 
mlx5e_build_channel_param(priv, );
for (i = 0; i < priv->params.num_channels; i++) {
@@ -2885,10 +2874,6 @@ mlx5e_create_ifp(struct mlx5_core_dev *m
return (NULL);
}
priv = malloc(sizeof(*priv), M_MLX5EN, M_WAITOK | M_ZERO);
-   if (priv == NULL) {
-   mlx5_core_err(mdev, "malloc() failed\n");
-   return (NULL);
-   }
mlx5e_priv_mtx_init(priv);
 
ifp = priv->ifp = if_alloc(IFT_ETHER);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310243 - stable/11/sys/dev/mlx5/mlx5_en

2016-12-19 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Dec 19 09:32:29 2016
New Revision: 310243
URL: https://svnweb.freebsd.org/changeset/base/310243

Log:
  MFC r309406:
  Remove useless NULL checks.
  
  NULL is not returned when allocating memory passing the M_WAITOK flag.
  
  Submitted by: trasz @
  Differential Revision:  https://reviews.freebsd.org/D5772
  Sponsored by:   Mellanox Technologies

Modified:
  stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c
  stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c
==
--- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Mon Dec 19 09:28:12 
2016(r310242)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_flow_table.c Mon Dec 19 09:32:29 
2016(r310243)
@@ -854,8 +854,6 @@ mlx5e_create_main_flow_table(struct mlx5
u8 *dmac;
 
g = malloc(9 * sizeof(*g), M_MLX5EN, M_WAITOK | M_ZERO);
-   if (g == NULL)
-   return (-ENOMEM);
 
g[0].log_sz = 2;
g[0].match_criteria_enable = MLX5_MATCH_OUTER_HEADERS;
@@ -939,8 +937,6 @@ mlx5e_create_vlan_flow_table(struct mlx5
struct mlx5_flow_table_group *g;
 
g = malloc(2 * sizeof(*g), M_MLX5EN, M_WAITOK | M_ZERO);
-   if (g == NULL)
-   return (-ENOMEM);
 
g[0].log_sz = 12;
g[0].match_criteria_enable = MLX5_MATCH_OUTER_HEADERS;

Modified: stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon Dec 19 09:28:12 
2016(r310242)
+++ stable/11/sys/dev/mlx5/mlx5_en/mlx5_en_main.c   Mon Dec 19 09:32:29 
2016(r310243)
@@ -656,10 +656,6 @@ mlx5e_create_rq(struct mlx5e_channel *c,
goto err_rq_wq_destroy;
 
rq->mbuf = malloc(wq_sz * sizeof(rq->mbuf[0]), M_MLX5EN, M_WAITOK | 
M_ZERO);
-   if (rq->mbuf == NULL) {
-   err = -ENOMEM;
-   goto err_lro_init;
-   }
for (i = 0; i != wq_sz; i++) {
struct mlx5e_rx_wqe *wqe = mlx5_wq_ll_get_wqe(>wq, i);
uint32_t byte_count = rq->wqe_sz - MLX5E_NET_IP_ALIGN;
@@ -686,7 +682,6 @@ mlx5e_create_rq(struct mlx5e_channel *c,
 
 err_rq_mbuf_free:
free(rq->mbuf, M_MLX5EN);
-err_lro_init:
tcp_lro_free(>lro);
 err_rq_wq_destroy:
mlx5_wq_destroy(>wq_ctrl);
@@ -897,8 +892,6 @@ mlx5e_alloc_sq_db(struct mlx5e_sq *sq)
int x;
 
sq->mbuf = malloc(wq_sz * sizeof(sq->mbuf[0]), M_MLX5EN, M_WAITOK | 
M_ZERO);
-   if (sq->mbuf == NULL)
-   return (-ENOMEM);
 
/* Create DMA descriptor MAPs */
for (x = 0; x != wq_sz; x++) {
@@ -1486,9 +1479,6 @@ mlx5e_open_channel(struct mlx5e_priv *pr
int err;
 
c = malloc(sizeof(*c), M_MLX5EN, M_WAITOK | M_ZERO);
-   if (c == NULL)
-   return (-ENOMEM);
-
c->priv = priv;
c->ix = ix;
c->cpu = 0;
@@ -1699,8 +1689,6 @@ mlx5e_open_channels(struct mlx5e_priv *p
 
priv->channel = malloc(priv->params.num_channels *
sizeof(struct mlx5e_channel *), M_MLX5EN, M_WAITOK | M_ZERO);
-   if (priv->channel == NULL)
-   return (-ENOMEM);
 
mlx5e_build_channel_param(priv, );
for (i = 0; i < priv->params.num_channels; i++) {
@@ -2879,10 +2867,6 @@ mlx5e_create_ifp(struct mlx5_core_dev *m
return (NULL);
}
priv = malloc(sizeof(*priv), M_MLX5EN, M_WAITOK | M_ZERO);
-   if (priv == NULL) {
-   mlx5_core_err(mdev, "malloc() failed\n");
-   return (NULL);
-   }
mlx5e_priv_mtx_init(priv);
 
ifp = priv->ifp = if_alloc(IFT_ETHER);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r310242 - head/sys/dev/usb

2016-12-19 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Dec 19 09:28:12 2016
New Revision: 310242
URL: https://svnweb.freebsd.org/changeset/base/310242

Log:
  Defer USB enumeration until the SI_SUB_KICK_SCHEDULER is executed to avoid
  boot panics in conjunction with the recently added EARLY_AP_STARTUP feature.
  The panics happen due to using kernel facilities like callouts too early.
  
  Tested by:jhb @
  MFC after:1 week

Modified:
  head/sys/dev/usb/usb_hub.c
  head/sys/dev/usb/usb_process.c

Modified: head/sys/dev/usb/usb_hub.c
==
--- head/sys/dev/usb/usb_hub.c  Mon Dec 19 07:48:04 2016(r310241)
+++ head/sys/dev/usb/usb_hub.c  Mon Dec 19 09:28:12 2016(r310242)
@@ -2261,6 +2261,11 @@ usb_needs_explore(struct usb_bus *bus, u
 
DPRINTF("\n");
 
+   if (cold != 0) {
+   DPRINTF("Cold\n");
+   return;
+   }
+
if (bus == NULL) {
DPRINTF("No bus pointer!\n");
return;
@@ -2326,6 +2331,26 @@ usb_needs_explore_all(void)
 }
 
 /**
+ * usb_needs_explore_init
+ *
+ * This function will ensure that the USB controllers are not enumerated
+ * until the "cold" variable is cleared.
+ **/
+static void
+usb_needs_explore_init(void *arg)
+{
+   /*
+* The cold variable should be cleared prior to this function
+* being called:
+*/
+   if (cold == 0)
+   usb_needs_explore_all();
+   else
+   DPRINTFN(-1, "Cold variable is still set!\n");
+}
+SYSINIT(usb_needs_explore_init, SI_SUB_KICK_SCHEDULER, SI_ORDER_SECOND, 
usb_needs_explore_init, NULL);
+
+/**
  * usb_bus_power_update
  *
  * This function will ensure that all USB devices on the given bus are

Modified: head/sys/dev/usb/usb_process.c
==
--- head/sys/dev/usb/usb_process.c  Mon Dec 19 07:48:04 2016
(r310241)
+++ head/sys/dev/usb/usb_process.c  Mon Dec 19 09:28:12 2016
(r310242)
@@ -455,14 +455,15 @@ usb_proc_drain(struct usb_process *up)
up->up_csleep = 0;
cv_signal(>up_cv);
}
+#ifndef EARLY_AP_STARTUP
/* Check if we are still cold booted */
-
if (cold) {
USB_THREAD_SUSPEND(up->up_ptr);
printf("WARNING: A USB process has "
"been left suspended\n");
break;
}
+#endif
cv_wait(>up_cv, up->up_mtx);
}
/* Check if someone is waiting - should not happen */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"