Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Jan 2015 03:01:41 +0000 (UTC)
From:      Garrett Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r277785 - in projects/building-blocks: contrib/llvm/lib/Target/AArch64 contrib/llvm/patches contrib/llvm/tools/clang/include/clang/Driver contrib/llvm/tools/clang/lib/Driver contrib/tcp...
Message-ID:  <201501270301.t0R31ftK043752@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ngie
Date: Tue Jan 27 03:01:40 2015
New Revision: 277785
URL: https://svnweb.freebsd.org/changeset/base/277785

Log:
  MFhead @ r277783

Added:
  projects/building-blocks/contrib/llvm/patches/patch-29-llvm-r226664-aarch64-x18.diff
     - copied unchanged from r277783, head/contrib/llvm/patches/patch-29-llvm-r226664-aarch64-x18.diff
  projects/building-blocks/contrib/llvm/patches/patch-30-clang-r227062-fixes-x18.diff
     - copied unchanged from r277783, head/contrib/llvm/patches/patch-30-clang-r227062-fixes-x18.diff
  projects/building-blocks/sys/arm/arm/pmu.c
     - copied unchanged from r277783, head/sys/arm/arm/pmu.c
Deleted:
  projects/building-blocks/usr.sbin/pw/tests/pw_groupshow.sh
  projects/building-blocks/usr.sbin/pw/tests/pw_usershow.sh
Modified:
  projects/building-blocks/contrib/llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp
  projects/building-blocks/contrib/llvm/tools/clang/include/clang/Driver/Options.td
  projects/building-blocks/contrib/llvm/tools/clang/lib/Driver/Tools.cpp
  projects/building-blocks/contrib/tcpdump/print-ip.c
  projects/building-blocks/contrib/tcpdump/print-sl.c
  projects/building-blocks/sys/arm/arm/mem.c
  projects/building-blocks/sys/boot/fdt/dts/arm/am335x.dtsi
  projects/building-blocks/sys/cam/scsi/scsi_da.c
  projects/building-blocks/sys/dev/cxgbe/t4_main.c
  projects/building-blocks/sys/dev/cxgbe/tom/t4_ddp.c
  projects/building-blocks/sys/kern/subr_sglist.c
  projects/building-blocks/sys/modules/iscsi/Makefile
  projects/building-blocks/usr.sbin/pw/pw_group.c
  projects/building-blocks/usr.sbin/pw/pw_user.c
  projects/building-blocks/usr.sbin/pw/tests/Makefile
Directory Properties:
  projects/building-blocks/   (props changed)
  projects/building-blocks/contrib/llvm/   (props changed)
  projects/building-blocks/contrib/llvm/tools/clang/   (props changed)
  projects/building-blocks/contrib/tcpdump/   (props changed)
  projects/building-blocks/sys/   (props changed)
  projects/building-blocks/sys/boot/   (props changed)

Modified: projects/building-blocks/contrib/llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp
==============================================================================
--- projects/building-blocks/contrib/llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp	Tue Jan 27 02:42:41 2015	(r277784)
+++ projects/building-blocks/contrib/llvm/lib/Target/AArch64/AArch64RegisterInfo.cpp	Tue Jan 27 03:01:40 2015	(r277785)
@@ -33,6 +33,10 @@ using namespace llvm;
 #define GET_REGINFO_TARGET_DESC
 #include "AArch64GenRegisterInfo.inc"
 
+static cl::opt<bool>
+ReserveX18("aarch64-reserve-x18", cl::Hidden,
+          cl::desc("Reserve X18, making it unavailable as GPR"));
+
 AArch64RegisterInfo::AArch64RegisterInfo(const AArch64InstrInfo *tii,
                                          const AArch64Subtarget *sti)
     : AArch64GenRegisterInfo(AArch64::LR), TII(tii), STI(sti) {}
@@ -90,7 +94,7 @@ AArch64RegisterInfo::getReservedRegs(con
     Reserved.set(AArch64::W29);
   }
 
-  if (STI->isTargetDarwin()) {
+  if (STI->isTargetDarwin() || ReserveX18) {
     Reserved.set(AArch64::X18); // Platform register
     Reserved.set(AArch64::W18);
   }
@@ -117,7 +121,7 @@ bool AArch64RegisterInfo::isReservedReg(
     return true;
   case AArch64::X18:
   case AArch64::W18:
-    return STI->isTargetDarwin();
+    return STI->isTargetDarwin() || ReserveX18;
   case AArch64::FP:
   case AArch64::W29:
     return TFI->hasFP(MF) || STI->isTargetDarwin();
@@ -379,7 +383,7 @@ unsigned AArch64RegisterInfo::getRegPres
   case AArch64::GPR64commonRegClassID:
     return 32 - 1                                      // XZR/SP
            - (TFI->hasFP(MF) || STI->isTargetDarwin()) // FP
-           - STI->isTargetDarwin() // X18 reserved as platform register
+           - (STI->isTargetDarwin() || ReserveX18) // X18 reserved as platform register
            - hasBasePointer(MF);   // X19
   case AArch64::FPR8RegClassID:
   case AArch64::FPR16RegClassID:

Copied: projects/building-blocks/contrib/llvm/patches/patch-29-llvm-r226664-aarch64-x18.diff (from r277783, head/contrib/llvm/patches/patch-29-llvm-r226664-aarch64-x18.diff)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/building-blocks/contrib/llvm/patches/patch-29-llvm-r226664-aarch64-x18.diff	Tue Jan 27 03:01:40 2015	(r277785, copy of r277783, head/contrib/llvm/patches/patch-29-llvm-r226664-aarch64-x18.diff)
@@ -0,0 +1,83 @@
+Pull in r226664 from upstream llvm trunk (by Tim Northover):
+
+  AArch64: add backend option to reserve x18 (platform register)
+
+  AAPCS64 says that it's up to the platform to specify whether x18 is
+  reserved, and a first step on that way is to add a flag controlling
+  it.
+
+  From: Andrew Turner <andrew@fubar.geek.nz>
+
+Introduced here: http://svnweb.freebsd.org/changeset/base/277774
+
+Index: lib/Target/AArch64/AArch64RegisterInfo.cpp
+===================================================================
+--- lib/Target/AArch64/AArch64RegisterInfo.cpp
++++ lib/Target/AArch64/AArch64RegisterInfo.cpp
+@@ -33,6 +33,10 @@ using namespace llvm;
+ #define GET_REGINFO_TARGET_DESC
+ #include "AArch64GenRegisterInfo.inc"
+ 
++static cl::opt<bool>
++ReserveX18("aarch64-reserve-x18", cl::Hidden,
++          cl::desc("Reserve X18, making it unavailable as GPR"));
++
+ AArch64RegisterInfo::AArch64RegisterInfo(const AArch64InstrInfo *tii,
+                                          const AArch64Subtarget *sti)
+     : AArch64GenRegisterInfo(AArch64::LR), TII(tii), STI(sti) {}
+@@ -90,7 +94,7 @@ AArch64RegisterInfo::getReservedRegs(const Machine
+     Reserved.set(AArch64::W29);
+   }
+ 
+-  if (STI->isTargetDarwin()) {
++  if (STI->isTargetDarwin() || ReserveX18) {
+     Reserved.set(AArch64::X18); // Platform register
+     Reserved.set(AArch64::W18);
+   }
+@@ -117,7 +121,7 @@ bool AArch64RegisterInfo::isReservedReg(const Mach
+     return true;
+   case AArch64::X18:
+   case AArch64::W18:
+-    return STI->isTargetDarwin();
++    return STI->isTargetDarwin() || ReserveX18;
+   case AArch64::FP:
+   case AArch64::W29:
+     return TFI->hasFP(MF) || STI->isTargetDarwin();
+@@ -379,7 +383,7 @@ unsigned AArch64RegisterInfo::getRegPressureLimit(
+   case AArch64::GPR64commonRegClassID:
+     return 32 - 1                                      // XZR/SP
+            - (TFI->hasFP(MF) || STI->isTargetDarwin()) // FP
+-           - STI->isTargetDarwin() // X18 reserved as platform register
++           - (STI->isTargetDarwin() || ReserveX18) // X18 reserved as platform register
+            - hasBasePointer(MF);   // X19
+   case AArch64::FPR8RegClassID:
+   case AArch64::FPR16RegClassID:
+Index: test/CodeGen/AArch64/arm64-platform-reg.ll
+===================================================================
+--- test/CodeGen/AArch64/arm64-platform-reg.ll
++++ test/CodeGen/AArch64/arm64-platform-reg.ll
+@@ -1,4 +1,5 @@
+-; RUN: llc -mtriple=arm64-apple-ios -o - %s | FileCheck %s --check-prefix=CHECK-DARWIN
++; RUN: llc -mtriple=arm64-apple-ios -o - %s | FileCheck %s --check-prefix=CHECK-RESERVE-X18
++; RUN: llc -mtriple=arm64-freebsd-gnu -aarch64-reserve-x18 -o - %s | FileCheck %s --check-prefix=CHECK-RESERVE-X18
+ ; RUN: llc -mtriple=arm64-linux-gnu -o - %s | FileCheck %s
+ 
+ ; x18 is reserved as a platform register on Darwin but not on other
+@@ -16,11 +17,11 @@ define void @keep_live() {
+ ; CHECK: ldr x18
+ ; CHECK: str x18
+ 
+-; CHECK-DARWIN-NOT: ldr fp
+-; CHECK-DARWIN-NOT: ldr x18
+-; CHECK-DARWIN: Spill
+-; CHECK-DARWIN-NOT: ldr fp
+-; CHECK-DARWIN-NOT: ldr x18
+-; CHECK-DARWIN: ret
++; CHECK-RESERVE-X18-NOT: ldr fp
++; CHECK-RESERVE-X18-NOT: ldr x18
++; CHECK-RESERVE-X18: Spill
++; CHECK-RESERVE-X18-NOT: ldr fp
++; CHECK-RESERVE-X18-NOT: ldr x18
++; CHECK-RESERVE-X18: ret
+   ret void
+ }

Copied: projects/building-blocks/contrib/llvm/patches/patch-30-clang-r227062-fixes-x18.diff (from r277783, head/contrib/llvm/patches/patch-30-clang-r227062-fixes-x18.diff)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/building-blocks/contrib/llvm/patches/patch-30-clang-r227062-fixes-x18.diff	Tue Jan 27 03:01:40 2015	(r277785, copy of r277783, head/contrib/llvm/patches/patch-30-clang-r227062-fixes-x18.diff)
@@ -0,0 +1,54 @@
+Pull in r227062 from upstream clang trunk (by Renato Golin):
+
+  Allows Clang to use LLVM's fixes-x18 option
+
+  This patch allows clang to have llvm reserve the x18
+  platform register on AArch64. FreeBSD will use this in the kernel for
+  per-cpu data but has no need to reserve this register in userland so
+  will need this flag to reserve it.
+
+  This uses llvm r226664 to allow this register to be reserved.
+
+  Patch by Andrew Turner.
+
+Introduced here: http://svnweb.freebsd.org/changeset/base/277775
+
+Index: tools/clang/include/clang/Driver/Options.td
+===================================================================
+--- tools/clang/include/clang/Driver/Options.td
++++ tools/clang/include/clang/Driver/Options.td
+@@ -1141,6 +1141,9 @@ def mno_long_calls : Flag<["-"], "mno-long-calls">
+ def mgeneral_regs_only : Flag<["-"], "mgeneral-regs-only">, Group<m_aarch64_Features_Group>,
+   HelpText<"Generate code which only uses the general purpose registers (AArch64 only)">;
+ 
++def ffixed_x18 : Flag<["-"], "ffixed-x18">, Group<m_aarch64_Features_Group>,
++  HelpText<"Reserve the x18 register (AArch64 only)">;
++
+ def mvsx : Flag<["-"], "mvsx">, Group<m_ppc_Features_Group>;
+ def mno_vsx : Flag<["-"], "mno-vsx">, Group<m_ppc_Features_Group>;
+ def mfprnd : Flag<["-"], "mfprnd">, Group<m_ppc_Features_Group>;
+Index: tools/clang/lib/Driver/Tools.cpp
+===================================================================
+--- tools/clang/lib/Driver/Tools.cpp
++++ tools/clang/lib/Driver/Tools.cpp
+@@ -887,6 +887,11 @@ void Clang::AddAArch64TargetArgs(const ArgList &Ar
+     if (A->getOption().matches(options::OPT_mno_global_merge))
+       CmdArgs.push_back("-mno-global-merge");
+   }
++
++  if (Args.hasArg(options::OPT_ffixed_x18)) {
++    CmdArgs.push_back("-backend-option");
++    CmdArgs.push_back("-aarch64-reserve-x18");
++  }
+ }
+ 
+ // Get CPU and ABI names. They are not independent
+Index: tools/clang/test/Driver/aarch64-fixed-x18.c
+===================================================================
+--- tools/clang/test/Driver/aarch64-fixed-x18.c
++++ tools/clang/test/Driver/aarch64-fixed-x18.c
+@@ -0,0 +1,4 @@
++// RUN: %clang -target aarch64-none-gnu -ffixed-x18 -### %s 2> %t
++// RUN: FileCheck --check-prefix=CHECK-FIXED-X18 < %t %s
++
++// CHECK-FIXED-X18: "-backend-option" "-aarch64-reserve-x18"

Modified: projects/building-blocks/contrib/llvm/tools/clang/include/clang/Driver/Options.td
==============================================================================
--- projects/building-blocks/contrib/llvm/tools/clang/include/clang/Driver/Options.td	Tue Jan 27 02:42:41 2015	(r277784)
+++ projects/building-blocks/contrib/llvm/tools/clang/include/clang/Driver/Options.td	Tue Jan 27 03:01:40 2015	(r277785)
@@ -1141,6 +1141,9 @@ def mno_long_calls : Flag<["-"], "mno-lo
 def mgeneral_regs_only : Flag<["-"], "mgeneral-regs-only">, Group<m_aarch64_Features_Group>,
   HelpText<"Generate code which only uses the general purpose registers (AArch64 only)">;
 
+def ffixed_x18 : Flag<["-"], "ffixed-x18">, Group<m_aarch64_Features_Group>,
+  HelpText<"Reserve the x18 register (AArch64 only)">;
+
 def mvsx : Flag<["-"], "mvsx">, Group<m_ppc_Features_Group>;
 def mno_vsx : Flag<["-"], "mno-vsx">, Group<m_ppc_Features_Group>;
 def mfprnd : Flag<["-"], "mfprnd">, Group<m_ppc_Features_Group>;

Modified: projects/building-blocks/contrib/llvm/tools/clang/lib/Driver/Tools.cpp
==============================================================================
--- projects/building-blocks/contrib/llvm/tools/clang/lib/Driver/Tools.cpp	Tue Jan 27 02:42:41 2015	(r277784)
+++ projects/building-blocks/contrib/llvm/tools/clang/lib/Driver/Tools.cpp	Tue Jan 27 03:01:40 2015	(r277785)
@@ -887,6 +887,11 @@ void Clang::AddAArch64TargetArgs(const A
     if (A->getOption().matches(options::OPT_mno_global_merge))
       CmdArgs.push_back("-mno-global-merge");
   }
+
+  if (Args.hasArg(options::OPT_ffixed_x18)) {
+    CmdArgs.push_back("-backend-option");
+    CmdArgs.push_back("-aarch64-reserve-x18");
+  }
 }
 
 // Get CPU and ABI names. They are not independent

Modified: projects/building-blocks/contrib/tcpdump/print-ip.c
==============================================================================
--- projects/building-blocks/contrib/tcpdump/print-ip.c	Tue Jan 27 02:42:41 2015	(r277784)
+++ projects/building-blocks/contrib/tcpdump/print-ip.c	Tue Jan 27 03:01:40 2015	(r277785)
@@ -537,6 +537,7 @@ ip_print(netdissect_options *ndo,
 	struct protoent *proto;
 
 	ipds->ip = (const struct ip *)bp;
+	ND_TCHECK(ipds->ip->ip_vhl);
 	if (IP_V(ipds->ip) != 4) { /* print version if != 4 */
 	    ND_PRINT((ndo, "IP%u ", IP_V(ipds->ip)));
 	    if (IP_V(ipds->ip) == 6)
@@ -545,10 +546,7 @@ ip_print(netdissect_options *ndo,
 	else if (!ndo->ndo_eflag)
 		ND_PRINT((ndo, "IP "));
 
-	if ((u_char *)(ipds->ip + 1) > ndo->ndo_snapend) {
-		ND_PRINT((ndo, "%s", tstr));
-		return;
-	}
+	ND_TCHECK(*ipds->ip);
 	if (length < sizeof (struct ip)) {
 		ND_PRINT((ndo, "truncated-ip %u", length));
 		return;
@@ -677,6 +675,11 @@ ip_print(netdissect_options *ndo,
 				ND_PRINT((ndo, " ip-proto-%d", ipds->ip->ip_p));
 		}
 	}
+	return;
+
+trunc:
+	ND_PRINT((ndo, "%s", tstr));
+	return;
 }
 
 void

Modified: projects/building-blocks/contrib/tcpdump/print-sl.c
==============================================================================
--- projects/building-blocks/contrib/tcpdump/print-sl.c	Tue Jan 27 02:42:41 2015	(r277784)
+++ projects/building-blocks/contrib/tcpdump/print-sl.c	Tue Jan 27 03:01:40 2015	(r277785)
@@ -64,7 +64,7 @@ sl_if_print(netdissect_options *ndo,
 	register u_int length = h->len;
 	register const struct ip *ip;
 
-	if (caplen < SLIP_HDRLEN) {
+	if (caplen < SLIP_HDRLEN || length < SLIP_HDRLEN) {
 		ND_PRINT((ndo, "%s", tstr));
 		return (caplen);
 	}

Modified: projects/building-blocks/sys/arm/arm/mem.c
==============================================================================
--- projects/building-blocks/sys/arm/arm/mem.c	Tue Jan 27 02:42:41 2015	(r277784)
+++ projects/building-blocks/sys/arm/arm/mem.c	Tue Jan 27 03:01:40 2015	(r277785)
@@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/mutex.h>
 #include <sys/proc.h>
 #include <sys/signalvar.h>
+#include <sys/sx.h>
 #include <sys/systm.h>
 #include <sys/uio.h>
 
@@ -72,6 +73,9 @@ MALLOC_DEFINE(M_MEMDESC, "memdesc", "mem
 
 struct mem_range_softc mem_range_softc;
 
+static struct sx tmppt_lock;
+SX_SYSINIT(tmppt, &tmppt_lock, "mem4map");
+
 /* ARGSUSED */
 int
 memrw(struct cdev *dev, struct uio *uio, int flags)
@@ -107,6 +111,7 @@ memrw(struct cdev *dev, struct uio *uio,
 			}
 			if (!address_valid)
 				return (EINVAL);
+			sx_xlock(&tmppt_lock);
 			pmap_kenter((vm_offset_t)_tmppt, v);
 			o = (int)uio->uio_offset & PAGE_MASK;
 			c = (u_int)(PAGE_SIZE - ((int)iov->iov_base & PAGE_MASK));
@@ -114,6 +119,7 @@ memrw(struct cdev *dev, struct uio *uio,
 			c = min(c, (u_int)iov->iov_len);
 			error = uiomove((caddr_t)&_tmppt[o], (int)c, uio);
 			pmap_qremove((vm_offset_t)_tmppt, 1);
+			sx_xunlock(&tmppt_lock);
 			continue;
 		}
 		else if (dev2unit(dev) == CDEV_MINOR_KMEM) {

Copied: projects/building-blocks/sys/arm/arm/pmu.c (from r277783, head/sys/arm/arm/pmu.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ projects/building-blocks/sys/arm/arm/pmu.c	Tue Jan 27 03:01:40 2015	(r277785, copy of r277783, head/sys/arm/arm/pmu.c)
@@ -0,0 +1,157 @@
+/*-
+ * Copyright (c) 2015 Ruslan Bukin <br@bsdpad.com>
+ * All rights reserved.
+ *
+ * This software was developed by SRI International and the University of
+ * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
+ * ("CTSRD"), as part of the DARPA CRASH research programme.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Performance Monitoring Unit
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "opt_hwpmc_hooks.h"
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+#include <sys/malloc.h>
+#include <sys/rman.h>
+#include <sys/timeet.h>
+#include <sys/timetc.h>
+#include <sys/pmc.h>
+#include <sys/pmckern.h>
+
+#include <dev/fdt/fdt_common.h>
+#include <dev/ofw/openfirm.h>
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/ofw_bus_subr.h>
+
+#include <machine/bus.h>
+#include <machine/fdt.h>
+#include <machine/cpu.h>
+#include <machine/intr.h>
+
+struct pmu_softc {
+	struct resource		*res[1];
+	device_t		dev;
+	void			*ih;
+};
+
+static struct ofw_compat_data compat_data[] = {
+	{"arm,cortex-a17-pmu",	1},
+	{"arm,cortex-a15-pmu",	1},
+	{"arm,cortex-a12-pmu",	1},
+	{"arm,cortex-a9-pmu",	1},
+	{"arm,cortex-a8-pmu",	1},
+	{"arm,cortex-a7-pmu",	1},
+	{"arm,cortex-a5-pmu",	1},
+	{"arm,arm11mpcore-pmu",	1},
+	{"arm,arm1176-pmu",	1},
+	{"arm,arm1136-pmu",	1},
+	{"qcom,krait-pmu",	1},
+	{NULL,			0}
+};
+
+static struct resource_spec pmu_spec[] = {
+	{ SYS_RES_IRQ,		0,	RF_ACTIVE },
+	{ -1, 0 }
+};
+
+static int
+pmu_intr(void *arg)
+{
+	struct trapframe *tf;
+
+	tf = arg;
+
+#ifdef HWPMC_HOOKS
+	if (pmc_intr)
+		(*pmc_intr)(PCPU_GET(cpuid), tf);
+#endif
+
+	return (FILTER_HANDLED);
+}
+
+static int
+pmu_probe(device_t dev)
+{
+
+	if (!ofw_bus_status_okay(dev))
+		return (ENXIO);
+
+	if (ofw_bus_search_compatible(dev, compat_data)->ocd_data != 0) {
+		device_set_desc(dev, "Performance Monitoring Unit");
+		return (BUS_PROBE_DEFAULT);
+	}
+
+	return (ENXIO);
+}
+
+static int
+pmu_attach(device_t dev)
+{
+	struct pmu_softc *sc;
+	int err;
+
+	sc = device_get_softc(dev);
+	sc->dev = dev;
+
+	if (bus_alloc_resources(dev, pmu_spec, sc->res)) {
+		device_printf(dev, "could not allocate resources\n");
+		return (ENXIO);
+	}
+
+	/* Setup interrupt handler */
+	err = bus_setup_intr(dev, sc->res[0], INTR_MPSAFE | INTR_TYPE_MISC,
+	    pmu_intr, NULL, NULL, &sc->ih);
+	if (err) {
+		device_printf(dev, "Unable to setup interrupt handler.\n");
+		return (ENXIO);
+	}
+
+	return (0);
+}
+
+static device_method_t pmu_methods[] = {
+	DEVMETHOD(device_probe,		pmu_probe),
+	DEVMETHOD(device_attach,	pmu_attach),
+	{ 0, 0 }
+};
+
+static driver_t pmu_driver = {
+	"pmu",
+	pmu_methods,
+	sizeof(struct pmu_softc),
+};
+
+static devclass_t pmu_devclass;
+
+DRIVER_MODULE(pmu, simplebus, pmu_driver, pmu_devclass, 0, 0);

Modified: projects/building-blocks/sys/boot/fdt/dts/arm/am335x.dtsi
==============================================================================
--- projects/building-blocks/sys/boot/fdt/dts/arm/am335x.dtsi	Tue Jan 27 02:42:41 2015	(r277784)
+++ projects/building-blocks/sys/boot/fdt/dts/arm/am335x.dtsi	Tue Jan 27 03:01:40 2015	(r277785)
@@ -47,6 +47,11 @@
 			reg =	< 0x48200000 0x1000 >;
 		};
 
+		pmu {
+			compatible = "arm,cortex-a8-pmu";
+			interrupts = <3>;
+		};
+
 		scm@44e10000 {
 			compatible = "ti,scm";
 			reg =	< 0x44e10000 0x2000 >;

Modified: projects/building-blocks/sys/cam/scsi/scsi_da.c
==============================================================================
--- projects/building-blocks/sys/cam/scsi/scsi_da.c	Tue Jan 27 02:42:41 2015	(r277784)
+++ projects/building-blocks/sys/cam/scsi/scsi_da.c	Tue Jan 27 03:01:40 2015	(r277785)
@@ -1910,18 +1910,18 @@ dadeletemaxsize(struct da_softc *softc, 
 		sectors = (off_t)ATA_DSM_RANGE_MAX * softc->trim_max_ranges;
 		break;
 	case DA_DELETE_WS16:
-		sectors = (off_t)min(softc->ws_max_blks, WS16_MAX_BLKS);
+		sectors = omin(softc->ws_max_blks, WS16_MAX_BLKS);
 		break;
 	case DA_DELETE_ZERO:
 	case DA_DELETE_WS10:
-		sectors = (off_t)min(softc->ws_max_blks, WS10_MAX_BLKS);
+		sectors = omin(softc->ws_max_blks, WS10_MAX_BLKS);
 		break;
 	default:
 		return 0;
 	}
 
 	return (off_t)softc->params.secsize *
-	    min(sectors, (off_t)softc->params.sectors);
+	    omin(sectors, softc->params.sectors);
 }
 
 static void
@@ -2684,7 +2684,7 @@ da_delete_trim(struct cam_periph *periph
 
 		/* Try to extend the previous range. */
 		if (lba == lastlba) {
-			c = min(count, ATA_DSM_RANGE_MAX - lastcount);
+			c = omin(count, ATA_DSM_RANGE_MAX - lastcount);
 			lastcount += c;
 			off = (ranges - 1) * 8;
 			buf[off + 6] = lastcount & 0xff;
@@ -2694,7 +2694,7 @@ da_delete_trim(struct cam_periph *periph
 		}
 
 		while (count > 0) {
-			c = min(count, ATA_DSM_RANGE_MAX);
+			c = omin(count, ATA_DSM_RANGE_MAX);
 			off = ranges * 8;
 
 			buf[off + 0] = lba & 0xff;
@@ -2770,7 +2770,7 @@ da_delete_ws(struct cam_periph *periph, 
 			    "%s issuing short delete %ld > %ld\n",
 			    da_delete_method_desc[softc->delete_method],
 			    count, ws_max_blks);
-			count = min(count, ws_max_blks);
+			count = omin(count, ws_max_blks);
 			break;
 		}
 		bp1 = bioq_first(&softc->delete_queue);

Modified: projects/building-blocks/sys/dev/cxgbe/t4_main.c
==============================================================================
--- projects/building-blocks/sys/dev/cxgbe/t4_main.c	Tue Jan 27 02:42:41 2015	(r277784)
+++ projects/building-blocks/sys/dev/cxgbe/t4_main.c	Tue Jan 27 03:01:40 2015	(r277785)
@@ -3292,6 +3292,12 @@ cxgbe_uninit_synchronized(struct port_in
 
 	ASSERT_SYNCHRONIZED_OP(sc);
 
+	if (!(pi->flags & PORT_INIT_DONE)) {
+		KASSERT(!(ifp->if_drv_flags & IFF_DRV_RUNNING),
+		    ("uninited port is running"));
+		return (0);
+	}
+
 	/*
 	 * Disable the VI so that all its data in either direction is discarded
 	 * by the MPS.  Leave everything else (the queues, interrupts, and 1Hz

Modified: projects/building-blocks/sys/dev/cxgbe/tom/t4_ddp.c
==============================================================================
--- projects/building-blocks/sys/dev/cxgbe/tom/t4_ddp.c	Tue Jan 27 02:42:41 2015	(r277784)
+++ projects/building-blocks/sys/dev/cxgbe/tom/t4_ddp.c	Tue Jan 27 03:01:40 2015	(r277785)
@@ -852,9 +852,9 @@ handle_ddp(struct socket *so, struct uio
 	SOCKBUF_LOCK_ASSERT(sb);
 
 #if 0
-	if (sb->sb_cc + sc->tt.ddp_thres > uio->uio_resid) {
+	if (sbused(sb) + sc->tt.ddp_thres > uio->uio_resid) {
 		CTR4(KTR_CXGBE, "%s: sb_cc %d, threshold %d, resid %d",
-		    __func__, sb->sb_cc, sc->tt.ddp_thres, uio->uio_resid);
+		    __func__, sbused(sb), sc->tt.ddp_thres, uio->uio_resid);
 	}
 #endif
 
@@ -1057,9 +1057,9 @@ t4_soreceive_ddp(struct socket *so, stru
 
 	/* Prevent other readers from entering the socket. */
 	error = sblock(sb, SBLOCKWAIT(flags));
+	SOCKBUF_LOCK(sb);
 	if (error)
 		goto out;
-	SOCKBUF_LOCK(sb);
 
 	/* Easy one, no space to copyout anything. */
 	if (uio->uio_resid == 0) {
@@ -1081,8 +1081,8 @@ restart:
 
 		/* uio should be just as it was at entry */
 		KASSERT(oresid == uio->uio_resid,
-		    ("%s: oresid = %d, uio_resid = %zd, sbused = %d",
-		    __func__, oresid, uio->uio_resid, sbused(sb)));
+		    ("%s: oresid = %d, uio_resid = %zd, sbavail = %d",
+		    __func__, oresid, uio->uio_resid, sbavail(sb)));
 
 		error = handle_ddp(so, uio, flags, 0);
 		ddp_handled = 1;
@@ -1092,7 +1092,7 @@ restart:
 
 	/* Abort if socket has reported problems. */
 	if (so->so_error) {
-		if (sbused(sb))
+		if (sbavail(sb))
 			goto deliver;
 		if (oresid > uio->uio_resid)
 			goto out;
@@ -1104,32 +1104,32 @@ restart:
 
 	/* Door is closed.  Deliver what is left, if any. */
 	if (sb->sb_state & SBS_CANTRCVMORE) {
-		if (sbused(sb))
+		if (sbavail(sb))
 			goto deliver;
 		else
 			goto out;
 	}
 
 	/* Socket buffer is empty and we shall not block. */
-	if (sbused(sb) == 0 &&
+	if (sbavail(sb) == 0 &&
 	    ((so->so_state & SS_NBIO) || (flags & (MSG_DONTWAIT|MSG_NBIO)))) {
 		error = EAGAIN;
 		goto out;
 	}
 
 	/* Socket buffer got some data that we shall deliver now. */
-	if (sbused(sb) && !(flags & MSG_WAITALL) &&
+	if (sbavail(sb) > 0 && !(flags & MSG_WAITALL) &&
 	    ((so->so_state & SS_NBIO) ||
 	     (flags & (MSG_DONTWAIT|MSG_NBIO)) ||
-	     sbused(sb) >= sb->sb_lowat ||
-	     sbused(sb) >= uio->uio_resid ||
-	     sbused(sb) >= sb->sb_hiwat) ) {
+	     sbavail(sb) >= sb->sb_lowat ||
+	     sbavail(sb) >= uio->uio_resid ||
+	     sbavail(sb) >= sb->sb_hiwat) ) {
 		goto deliver;
 	}
 
 	/* On MSG_WAITALL we must wait until all data or error arrives. */
 	if ((flags & MSG_WAITALL) &&
-	    (sbused(sb) >= uio->uio_resid || sbused(sb) >= sb->sb_lowat))
+	    (sbavail(sb) >= uio->uio_resid || sbavail(sb) >= sb->sb_lowat))
 		goto deliver;
 
 	/*
@@ -1148,7 +1148,7 @@ restart:
 
 deliver:
 	SOCKBUF_LOCK_ASSERT(&so->so_rcv);
-	KASSERT(sbused(sb) > 0, ("%s: sockbuf empty", __func__));
+	KASSERT(sbavail(sb) > 0, ("%s: sockbuf empty", __func__));
 	KASSERT(sb->sb_mb != NULL, ("%s: sb_mb == NULL", __func__));
 
 	if (sb->sb_flags & SB_DDP_INDICATE && !ddp_handled)
@@ -1159,7 +1159,7 @@ deliver:
 		uio->uio_td->td_ru.ru_msgrcv++;
 
 	/* Fill uio until full or current end of socket buffer is reached. */
-	len = min(uio->uio_resid, sbused(sb));
+	len = min(uio->uio_resid, sbavail(sb));
 	if (mp0 != NULL) {
 		/* Dequeue as many mbufs as possible. */
 		if (!(flags & MSG_PEEK) && len >= sb->sb_mb->m_len) {

Modified: projects/building-blocks/sys/kern/subr_sglist.c
==============================================================================
--- projects/building-blocks/sys/kern/subr_sglist.c	Tue Jan 27 02:42:41 2015	(r277784)
+++ projects/building-blocks/sys/kern/subr_sglist.c	Tue Jan 27 03:01:40 2015	(r277785)
@@ -216,6 +216,9 @@ void
 sglist_free(struct sglist *sg)
 {
 
+	if (sg == NULL)
+		return;
+
 	if (refcount_release(&sg->sg_refs))
 		free(sg, M_SGLIST);
 }

Modified: projects/building-blocks/sys/modules/iscsi/Makefile
==============================================================================
--- projects/building-blocks/sys/modules/iscsi/Makefile	Tue Jan 27 02:42:41 2015	(r277784)
+++ projects/building-blocks/sys/modules/iscsi/Makefile	Tue Jan 27 03:01:40 2015	(r277785)
@@ -4,22 +4,12 @@
 KMOD=	iscsi
 
 SRCS=	iscsi.c
-.if defined(ICL_RDMA)
-SRCS+=	icl_rdma.c
-.else
 SRCS+=	icl.c
-.endif
 SRCS+=	icl_proxy.c
 SRCS+=	opt_cam.h
 SRCS+=	bus_if.h
 SRCS+=	device_if.h
 
-# Those below are required for RDMA.
-SRCS+=	vnode_if.h
-SRCS+=	opt_inet.h
-SRCS+=	opt_inet6.h
-
-CFLAGS+= -I${.CURDIR}/../../ofed/include
 #CFLAGS+=-DICL_KERNEL_PROXY
 
 .include <bsd.kmod.mk>

Modified: projects/building-blocks/usr.sbin/pw/pw_group.c
==============================================================================
--- projects/building-blocks/usr.sbin/pw/pw_group.c	Tue Jan 27 02:42:41 2015	(r277784)
+++ projects/building-blocks/usr.sbin/pw/pw_group.c	Tue Jan 27 03:01:40 2015	(r277785)
@@ -68,11 +68,7 @@ pw_group(struct userconf * cnf, int mode
 	};
 
 	if (a_gid != NULL) {
-		const char *teststr;
-		teststr = a_gid->val;
-		if (*teststr == '-')
-			teststr++;
-		if (strspn(teststr, "0123456789") != strlen(teststr))
+		if (strspn(a_gid->val, "0123456789") != strlen(a_gid->val))
 			errx(EX_USAGE, "-g expects a number");
 	}
 

Modified: projects/building-blocks/usr.sbin/pw/pw_user.c
==============================================================================
--- projects/building-blocks/usr.sbin/pw/pw_user.c	Tue Jan 27 02:42:41 2015	(r277784)
+++ projects/building-blocks/usr.sbin/pw/pw_user.c	Tue Jan 27 03:01:40 2015	(r277785)
@@ -322,10 +322,7 @@ pw_user(struct userconf * cnf, int mode,
 			a_name = NULL;
 		}
 	} else {
-		const char *teststr = a_uid->val;
-		if (*teststr == '-')
-			teststr++;
-		if (strspn(teststr, "0123456789") != strlen(teststr))
+		if (strspn(a_uid->val, "0123456789") != strlen(a_uid->val))
 			errx(EX_USAGE, "-u expects a number");
 	}
 

Modified: projects/building-blocks/usr.sbin/pw/tests/Makefile
==============================================================================
--- projects/building-blocks/usr.sbin/pw/tests/Makefile	Tue Jan 27 02:42:41 2015	(r277784)
+++ projects/building-blocks/usr.sbin/pw/tests/Makefile	Tue Jan 27 03:01:40 2015	(r277785)
@@ -9,11 +9,9 @@ ATF_TESTS_SH=	pw_etcdir \
 		pw_lock \
 		pw_groupdel \
 		pw_groupmod \
-		pw_groupshow \
 		pw_useradd \
 		pw_userdel \
-		pw_usermod \
-		pw_usershow
+		pw_usermod
 
 .for tp in ${ATF_TESTS_SH}
 TEST_METADATA.${tp}+=	required_user="root"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501270301.t0R31ftK043752>