svn commit: r296891 - in head/sys: cam dev/arcmsr dev/iir dev/isci dev/ncr dev/ppbus

2016-03-14 Thread Warner Losh
Author: imp
Date: Tue Mar 15 05:17:29 2016
New Revision: 296891
URL: https://svnweb.freebsd.org/changeset/base/296891

Log:
  Make sure we check for CAM_CDB_POINTER for all drivers. Also, for the
  drivers I've touched, filter out CAM_CDB_PHYS.
  
  Differential Revision: https://reviews.freebsd.org/D5585

Modified:
  head/sys/cam/cam_ccb.h
  head/sys/dev/arcmsr/arcmsr.c
  head/sys/dev/iir/iir.c
  head/sys/dev/isci/isci_controller.c
  head/sys/dev/isci/isci_io_request.c
  head/sys/dev/ncr/ncr.c
  head/sys/dev/ppbus/vpo.c

Modified: head/sys/cam/cam_ccb.h
==
--- head/sys/cam/cam_ccb.h  Tue Mar 15 04:56:39 2016(r296890)
+++ head/sys/cam/cam_ccb.h  Tue Mar 15 05:17:29 2016(r296891)
@@ -725,6 +725,13 @@ struct ccb_scsiio {
u_int  init_id; /* initiator id of who selected */
 };
 
+static __inline uint8_t *
+scsiio_cdb_ptr(struct ccb_scsiio *ccb)
+{
+   return ((ccb->ccb_h.flags & CAM_CDB_POINTER) ?
+   ccb->cdb_io.cdb_ptr : ccb->cdb_io.cdb_bytes);
+}
+
 /*
  * ATA I/O Request CCB used for the XPT_ATA_IO function code.
  */

Modified: head/sys/dev/arcmsr/arcmsr.c
==
--- head/sys/dev/arcmsr/arcmsr.cTue Mar 15 04:56:39 2016
(r296890)
+++ head/sys/dev/arcmsr/arcmsr.cTue Mar 15 05:17:29 2016
(r296891)
@@ -872,7 +872,7 @@ static void arcmsr_srb_timeout(void *arg
ARCMSR_LOCK_ACQUIRE(>isr_lock);
if(srb->srb_state == ARCMSR_SRB_START)
{
-   cmd = srb->pccb->csio.cdb_io.cdb_bytes[0];
+   cmd = scsiio_cdb_ptr(>pccb->csio)[0];
srb->srb_state = ARCMSR_SRB_TIMEOUT;
srb->pccb->ccb_h.status |= CAM_CMD_TIMEOUT;
arcmsr_srb_complete(srb, 1);
@@ -997,7 +997,7 @@ static void arcmsr_build_srb(struct Comm
arcmsr_cdb->LUN = pccb->ccb_h.target_lun;
arcmsr_cdb->Function = 1;
arcmsr_cdb->CdbLength = (u_int8_t)pcsio->cdb_len;
-   bcopy(pcsio->cdb_io.cdb_bytes, arcmsr_cdb->Cdb, pcsio->cdb_len);
+   bcopy(scsiio_cdb_ptr(pcsio), arcmsr_cdb->Cdb, pcsio->cdb_len);
if(nseg != 0) {
struct AdapterControlBlock *acb = srb->acb;
bus_dmasync_op_t op;
@@ -2453,10 +2453,11 @@ static int arcmsr_iop_message_xfer(struc
struct CMD_MESSAGE_FIELD *pcmdmessagefld;
int retvalue = 0, transfer_len = 0;
char *buffer;
-   u_int32_t controlcode = (u_int32_t ) pccb->csio.cdb_io.cdb_bytes[5] << 
24 |
-   (u_int32_t ) pccb->csio.cdb_io.cdb_bytes[6] << 
16 |
-   (u_int32_t ) pccb->csio.cdb_io.cdb_bytes[7] << 
8  |
-   (u_int32_t ) pccb->csio.cdb_io.cdb_bytes[8];
+   uint8_t *ptr = scsiio_cdb_ptr(>csio);
+   u_int32_t controlcode = (u_int32_t ) ptr[5] << 24 |
+   (u_int32_t ) ptr[6] << 16 |
+   (u_int32_t ) ptr[7] << 8  |
+   (u_int32_t ) ptr[8];
/* 4 bytes: Areca io control code */
if ((pccb->ccb_h.flags & CAM_DATA_MASK) == CAM_DATA_VADDR) {
buffer = pccb->csio.data_ptr;
@@ -2683,7 +2684,7 @@ static void arcmsr_execute_srb(void *arg
if(acb->devstate[target][lun] == ARECA_RAID_GONE) {
u_int8_t block_cmd, cmd;
 
-   cmd = pccb->csio.cdb_io.cdb_bytes[0];
+   cmd = scsiio_cdb_ptr(>csio)[0];
block_cmd = cmd & 0x0f;
if(block_cmd == 0x08 || block_cmd == 0x0a) {
printf("arcmsr%d:block 'read/write' command "
@@ -2800,7 +2801,7 @@ static void arcmsr_handle_virtual_comman
return;
}
pccb->ccb_h.status |= CAM_REQ_CMP;
-   switch (pccb->csio.cdb_io.cdb_bytes[0]) {
+   switch (scsiio_cdb_ptr(>csio)[0]) {
case INQUIRY: {
unsigned char inqdata[36];
char *buffer = pccb->csio.data_ptr;
@@ -2853,6 +2854,12 @@ static void arcmsr_action(struct cam_sim
int target = pccb->ccb_h.target_id;
int error;
 
+   if (pccb->ccb_h.flags & CAM_CDB_PHYS) {
+   pccb->ccb_h.status = CAM_REQ_INVALID;
+   xpt_done(pccb);
+   return;
+   }
+
if(target == 16) {
/* virtual device for iop message transfer */
arcmsr_handle_virtual_command(acb, pccb);

Modified: head/sys/dev/iir/iir.c
==
--- head/sys/dev/iir/iir.c  Tue Mar 15 04:56:39 2016(r296890)
+++ head/sys/dev/iir/iir.c  Tue Mar 15 05:17:29 2016(r296891)

svn commit: r296892 - head/sys/boot/efi

2016-03-14 Thread Warner Losh
Author: imp
Date: Tue Mar 15 05:17:31 2016
New Revision: 296892
URL: https://svnweb.freebsd.org/changeset/base/296892

Log:
  ms_abi is supported with gcc 4.5 or newer, so build it with gcc if it
  is 4.5 or newer.

Modified:
  head/sys/boot/efi/Makefile

Modified: head/sys/boot/efi/Makefile
==
--- head/sys/boot/efi/Makefile  Tue Mar 15 05:17:29 2016(r296891)
+++ head/sys/boot/efi/Makefile  Tue Mar 15 05:17:31 2016(r296892)
@@ -2,8 +2,9 @@
 
 .include 
 
-# In-tree GCC does not support __attribute__((ms_abi)).
-.if ${COMPILER_TYPE} != "gcc"
+# In-tree GCC does not support __attribute__((ms_abi)), but gcc newer
+# than 4.5 supports it.
+.if ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} >= 404500
 
 .if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "arm"
 .if ${MK_FDT} != "no"
@@ -17,7 +18,6 @@ SUBDIR+=  fdt
 SUBDIR+=   libefi loader boot1
 .endif
 
-.endif # ${COMPILER_TYPE} != "gcc"
+.endif # ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} >= 404500
 
 .include 
-
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296890 - head/sys/dev/mfi

2016-03-14 Thread Warner Losh
Author: imp
Date: Tue Mar 15 04:56:39 2016
New Revision: 296890
URL: https://svnweb.freebsd.org/changeset/base/296890

Log:
  Remove bare & 0x3; it encodes the values of BIO_READ and
  BIO_WRITE. It's also unnecessary since the only cases in this switch
  are those two.

Modified:
  head/sys/dev/mfi/mfi.c

Modified: head/sys/dev/mfi/mfi.c
==
--- head/sys/dev/mfi/mfi.c  Tue Mar 15 04:42:37 2016(r296889)
+++ head/sys/dev/mfi/mfi.c  Tue Mar 15 04:56:39 2016(r296890)
@@ -2141,7 +2141,7 @@ mfi_build_syspdio(struct mfi_softc *sc, 
pass = >cm_frame->pass;
bzero(pass->cdb, 16);
pass->header.cmd = MFI_CMD_PD_SCSI_IO;
-   switch (bio->bio_cmd & 0x03) {
+   switch (bio->bio_cmd) {
case BIO_READ:
flags = MFI_CMD_DATAIN | MFI_CMD_BIO;
readop = 1;
@@ -2200,7 +2200,7 @@ mfi_build_ldio(struct mfi_softc *sc, str
bzero(cm->cm_frame, sizeof(union mfi_frame));
cm->cm_frame->header.context = context;
io = >cm_frame->io;
-   switch (bio->bio_cmd & 0x03) {
+   switch (bio->bio_cmd) {
case BIO_READ:
io->header.cmd = MFI_CMD_LD_READ;
flags = MFI_CMD_DATAIN | MFI_CMD_BIO;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296889 - in head: etc/mtree share/man/man7 tools/build/mk usr.sbin usr.sbin/uathload

2016-03-14 Thread Warner Losh
Author: imp
Date: Tue Mar 15 04:42:37 2016
New Revision: 296889
URL: https://svnweb.freebsd.org/changeset/base/296889

Log:
  Just install ar5523.bin into /usr/share/firmware and stop compiling it
  in.
  
  Differential Review: https://reviews.freebsd.org/D5639

Modified:
  head/etc/mtree/BSD.usr.dist
  head/share/man/man7/hier.7
  head/tools/build/mk/OptionalObsoleteFiles.inc
  head/usr.sbin/Makefile
  head/usr.sbin/uathload/Makefile
  head/usr.sbin/uathload/uathload.c

Modified: head/etc/mtree/BSD.usr.dist
==
--- head/etc/mtree/BSD.usr.dist Tue Mar 15 04:03:15 2016(r296888)
+++ head/etc/mtree/BSD.usr.dist Tue Mar 15 04:42:37 2016(r296889)
@@ -428,6 +428,8 @@
 uefisign
 ..
 ..
+firmware
+..
 games
 fortune
 ..

Modified: head/share/man/man7/hier.7
==
--- head/share/man/man7/hier.7  Tue Mar 15 04:03:15 2016(r296888)
+++ head/share/man/man7/hier.7  Tue Mar 15 04:42:37 2016(r296889)
@@ -28,7 +28,7 @@
 .\"@(#)hier.7  8.1 (Berkeley) 6/5/93
 .\" $FreeBSD$
 .\"
-.Dd October 2, 2015
+.Dd March 15, 2016
 .Dt HIER 7
 .Os
 .Sh NAME
@@ -545,6 +545,8 @@ Chinese translations of documents in /us
 .Pp
 .It Pa examples/
 various examples for users and programmers
+.It Pa firmware/
+Firmware images loaded by user land programs
 .It Pa games/
 ASCII text files used by various games
 .It Pa groff_font/

Modified: head/tools/build/mk/OptionalObsoleteFiles.inc
==
--- head/tools/build/mk/OptionalObsoleteFiles.inc   Tue Mar 15 04:03:15 
2016(r296888)
+++ head/tools/build/mk/OptionalObsoleteFiles.inc   Tue Mar 15 04:42:37 
2016(r296889)
@@ -8024,6 +8024,7 @@ OLD_FILES+=usr/share/examples/libusb20/c
 OLD_FILES+=usr/share/examples/libusb20/util.c
 OLD_FILES+=usr/share/examples/libusb20/util.h
 OLD_DIRS+=usr/share/examples/libusb20
+OLD_FILES+=usr/share/firmware/ar5523.bin
 OLD_FILES+=usr/share/man/man1/uhsoctl.1.gz
 OLD_FILES+=usr/share/man/man1/usbhidaction.1.gz
 OLD_FILES+=usr/share/man/man1/usbhidctl.1.gz

Modified: head/usr.sbin/Makefile
==
--- head/usr.sbin/Makefile  Tue Mar 15 04:03:15 2016(r296888)
+++ head/usr.sbin/Makefile  Tue Mar 15 04:42:37 2016(r296889)
@@ -194,9 +194,7 @@ SUBDIR.${MK_TIMED}+=timed
 SUBDIR.${MK_TOOLCHAIN}+=   config
 SUBDIR.${MK_TOOLCHAIN}+=   crunch
 SUBDIR.${MK_UNBOUND}+= unbound
-.if !(${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 50200)
 SUBDIR.${MK_USB}+= uathload
-.endif
 SUBDIR.${MK_USB}+= uhsoctl
 SUBDIR.${MK_USB}+= usbconfig
 SUBDIR.${MK_USB}+= usbdump

Modified: head/usr.sbin/uathload/Makefile
==
--- head/usr.sbin/uathload/Makefile Tue Mar 15 04:03:15 2016
(r296888)
+++ head/usr.sbin/uathload/Makefile Tue Mar 15 04:42:37 2016
(r296889)
@@ -3,28 +3,14 @@
 PROG=  uathload
 MAN=   uathload.8
 
-SRCS=  uathload.c ar5523.bin
+SRCS=  uathload.c
+FILES= ar5523.bin
+FILESDIR=  ${SHAREDIR}/firmware
+FILESMODE= 444
 
 CLEANFILES=ar5523.bin
 
-# It's hard to tag ar5523.o with the proper gnu note saying that it has a
-# non-executable stack, so ld doesn't properly mark his executable as
-# not having an executable stack. Mark it explicitly, but only for those
-# platforms that support his feature (otherwise signals don't work).
-# Note: Newer versions of ld than is in the tree ignore -z.
-.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} 
== "powerpc" || ${MACHINE_ARCH} == "powerpc64"
-LDFLAGS+=  -Wl,-z,noexecstack
-.endif
-
-# The conversion from .bin to .o doesn't always produce a pedantically correct
-# .o's. And it doesn't matter, so turn off the mismatch warnings since it is
-# pure data. On mips64 here's no easy way to produce a proper .o.
-LDFLAGS+=  -Wl,--no-warn-mismatch
-
 ar5523.bin: ${.CURDIR}/../../sys/contrib/dev/uath/ar5523.bin.uu
uudecode -p ${.CURDIR}/../../sys/contrib/dev/uath/ar5523.bin.uu > 
${.TARGET}
 
-ar5523.o: ar5523.bin
-   ${LD} -b binary -d -warn-common -r -d -o ${.TARGET} ar5523.bin
-
 .include 

Modified: head/usr.sbin/uathload/uathload.c
==
--- head/usr.sbin/uathload/uathload.c   Tue Mar 15 04:03:15 2016
(r296888)
+++ head/usr.sbin/uathload/uathload.c   Tue Mar 15 04:42:37 2016
(r296889)
@@ -140,23 +140,19 @@ main(int argc, char *argv[])
if (argc > 1)
usage();
 
-   if (argc == 1) {
+   if (argc == 1)
fwname = argv[0];
-   fw = open(fwname, O_RDONLY, 0);
-  

Re: svn commit: r296825 - in head/sys: arm/conf arm/mv arm/mv/armada38x boot/fdt/dts/arm

2016-03-14 Thread Andrew Turner
On Mon, 14 Mar 2016 07:05:41 + (UTC)
Wojciech Macek  wrote:

> Author: wma
> Date: Mon Mar 14 07:05:41 2016
> New Revision: 296825
> URL: https://svnweb.freebsd.org/changeset/base/296825
> 
> Log:
>   Make MPIC compatible with ARM_INTRNG
>   
>   After ARM_INTRNG introduction, MPIC code needed several
> modifications:
>   - IRQ resource and its handler added
>   -  several DEVMETHODs of INTRNG interface implemented
>   -  defines enhanced to ensure code compiles as well for AXP as for
> A38X
>   - added dummy MSI_IRQ, ERR_IRQ defines for Armada38x
>   - MPIC driver was added to files.armada38x, ARM_INTRNG option
> enabled in kernconf file and regs of MPIC corrected in dts file.
>   
>   Instead of modifying Armada38X DTS, offsets to CPU registers
> defined in driver were changed. That required restoring 'reg'
> property of mpic node in ArmadaXP to state compliant with Linux DTS.
>   
>   Additionally, required ARM_INTRNG definitions were added to
> mv_common.c. 
>   Submitted by:  Bartosz Szczepanek 
>   Obtained from: Semihalf
>   Sponsored by:  Stormshield
>   Reviewed by:   adrian, andrew, ian, skra
>   Approved by:   cognet (mentor)
>   Differential Revision: https://reviews.freebsd.org/D5030
> 
> Modified:
>   head/sys/arm/conf/ARMADA38X
>   head/sys/arm/mv/armada38x/files.armada38x
>   head/sys/arm/mv/mpic.c
>   head/sys/arm/mv/mvreg.h
>   head/sys/boot/fdt/dts/arm/db78460.dts
> 
> Modified: head/sys/arm/conf/ARMADA38X
> ==
> --- head/sys/arm/conf/ARMADA38X   Mon Mar 14 06:30:37
> 2016  (r296824) +++ head/sys/arm/conf/ARMADA38X   Mon Mar
> 14 07:05:41 2016  (r296825) @@ -23,6 +23,7 @@ options
> SCHED_ULE # ULE scheduler #options
> SCHED_4BSD# 4BSD scheduler 
>  options  SMP
> +options  ARM_INTRNG

This file already had ARM_INTRNG set. It now has it twice.

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


Re: svn commit: r296880 - in head: share/man/man9 sys/kern sys/sys

2016-03-14 Thread Ravi Pokala
-Original Message-

From:  on behalf of Gleb Smirnoff 

Date: 2016-03-14, Monday at 17:05
To: , , 

Subject: svn commit: r296880 - in head: share/man/man9 sys/kern sys/sys

>Author: glebius
>Date: Tue Mar 15 00:05:00 2016
>New Revision: 296880
>URL: https://svnweb.freebsd.org/changeset/base/296880
>
>Log:
>  Provide sysctl(9) macro to deal with array of counter(9).

Hi Gleb,


To make sure I'm reading this correctly:

(1) The sysctl operates on an opaque array of (uint64_t)s. The elements of the 
array are not individually accessible.

(2) Reading the sysctl populates each element of the userspace array by calling 
counter_u64_fetch() on the corresponding element of the kernelspace array.

(3) Writing the sysctl clears the kernelspace array by calling 
counter_u64_zero() on each element.

For example, if you have a bunch of device statistics, this interface will let 
you get or clear them all in one shot, but they won't have distinct names. You 
would have to define an enum to set up names for the array indices.

Does that sound correct?

Thanks,

Ravi (rpokala@)

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


Re: svn commit: r296861 - in head/sys: arm/arm powerpc/powerpc

2016-03-14 Thread Andrew Turner
On Mon, 14 Mar 2016 14:55:15 + (UTC)
"Bjoern A. Zeeb"  wrote:

> Author: bz
> Date: Mon Mar 14 14:55:15 2016
> New Revision: 296861
> URL: https://svnweb.freebsd.org/changeset/base/296861
> 
> Log:
>   Only check for SYS_freebsd6_lseek if the syscall code is defined.
>   Whether this is the right or best solution is unclear but it fixes
> the build for now.

We should make it an error if someone tries to build an ARM kernel with
COMPAT_FREEBSD6. I think there was some support for ARM in 6, however we
have switched the ABI since then so any old programs will now fail to
run.

Having it would be even more of a bug on armv6. This was added for 10.0
and, given running arm (v4/v5) programs on an armv6 kernel is
unsupported there should be no reason to include it in the kernel.

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


svn commit: r296885 - head/sys/mips/mips

2016-03-14 Thread Maxim Sobolev
Author: sobomax
Date: Tue Mar 15 01:17:38 2016
New Revision: 296885
URL: https://svnweb.freebsd.org/changeset/base/296885

Log:
  Fix build with HWPMC_HOOKS enabled.

Modified:
  head/sys/mips/mips/mips_pic.c

Modified: head/sys/mips/mips/mips_pic.c
==
--- head/sys/mips/mips/mips_pic.c   Tue Mar 15 00:24:50 2016
(r296884)
+++ head/sys/mips/mips/mips_pic.c   Tue Mar 15 01:17:38 2016
(r296885)
@@ -48,6 +48,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -217,8 +219,11 @@ mips_pic_intr(void *arg)
KASSERT(i == 0, ("all interrupts handled"));
 
 #ifdef HWPMC_HOOKS
-   if (pmc_hook && (PCPU_GET(curthread)->td_pflags & TDP_CALLCHAIN))
+   if (pmc_hook && (PCPU_GET(curthread)->td_pflags & TDP_CALLCHAIN)) {
+   struct trapframe *tf = PCPU_GET(curthread)->td_intr_frame;
+
pmc_hook(PCPU_GET(curthread), PMC_FN_USER_CALLCHAIN, tf);
+   }
 #endif
return (FILTER_HANDLED);
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r296880 - in head: share/man/man9 sys/kern sys/sys

2016-03-14 Thread Gleb Smirnoff
On Tue, Mar 15, 2016 at 01:16:38AM +0100, Mateusz Guzik wrote:
M> On Tue, Mar 15, 2016 at 12:05:00AM +, Gleb Smirnoff wrote:
M> > +int
M> > +sysctl_handle_counter_u64_array(SYSCTL_HANDLER_ARGS)
M> > +{
M> > +  uint64_t *out;
M> > +  int error;
M> > +
M> > +  out = malloc(arg2 * sizeof(uint64_t), M_TEMP, M_WAITOK);
M> > +  for (int i = 0; i < arg2; i++)
M> > +  out[i] = counter_u64_fetch(((counter_u64_t *)arg1)[i]);
M> > +
M> > +  error = SYSCTL_OUT(req, out, arg2 * sizeof(uint64_t));
M> > +
M> > +  if (error || !req->newptr)
M> > +  return (error);
M> > +
M> > +  /*
M> > +   * Any write attempt to a counter zeroes it.
M> > +   */
M> > +  for (int i = 0; i < arg2; i++)
M> > +  counter_u64_zero(((counter_u64_t *)arg1)[i]);
M> > + 
M> > +  return (0);
M> > +}
M> > 
M> 
M> This never frees tha allocated buffer.
M> 
M> It would be better to just put stuff to userspace in a loop and avoid
M> allocations entirely. but does not look like there are no friendly
M> macros for that.

Thanks, Mateusz! Pointy hat is mine.

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


svn commit: r296883 - head/sys/kern

2016-03-14 Thread Gleb Smirnoff
Author: glebius
Date: Tue Mar 15 00:21:32 2016
New Revision: 296883
URL: https://svnweb.freebsd.org/changeset/base/296883

Log:
  Free the temporary buffer in sysctl_handle_counter_u64_array().
  
  Submitted by: mjg

Modified:
  head/sys/kern/subr_counter.c

Modified: head/sys/kern/subr_counter.c
==
--- head/sys/kern/subr_counter.cTue Mar 15 00:19:30 2016
(r296882)
+++ head/sys/kern/subr_counter.cTue Mar 15 00:21:32 2016
(r296883)
@@ -106,6 +106,7 @@ sysctl_handle_counter_u64_array(SYSCTL_H
out[i] = counter_u64_fetch(((counter_u64_t *)arg1)[i]);
 
error = SYSCTL_OUT(req, out, arg2 * sizeof(uint64_t));
+   free(out, M_TEMP);
 
if (error || !req->newptr)
return (error);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296882 - head/usr.bin/netstat

2016-03-14 Thread Gleb Smirnoff
Author: glebius
Date: Tue Mar 15 00:19:30 2016
New Revision: 296882
URL: https://svnweb.freebsd.org/changeset/base/296882

Log:
  Print running TCP connection counts with TCP statistics.

Modified:
  head/usr.bin/netstat/inet.c
  head/usr.bin/netstat/main.c
  head/usr.bin/netstat/netstat.h
  head/usr.bin/netstat/nlist_symbols

Modified: head/usr.bin/netstat/inet.c
==
--- head/usr.bin/netstat/inet.c Tue Mar 15 00:15:10 2016(r296881)
+++ head/usr.bin/netstat/inet.c Tue Mar 15 00:19:30 2016(r296882)
@@ -82,6 +82,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include "netstat.h"
+#include "nl_defs.h"
 
 char   *inetname(struct in_addr *);
 void   inetprint(const char *, struct in_addr *, int, const char *, int,
@@ -638,6 +639,7 @@ void
 tcp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
 {
struct tcpstat tcpstat;
+   uint64_t tcps_states[TCP_NSTATES];
 
 #ifdef INET6
if (tcp_done != 0)
@@ -650,6 +652,10 @@ tcp_stats(u_long off, const char *name, 
sizeof(tcpstat), kread_counters) != 0)
return;
 
+   if (fetch_stats_ro("net.inet.tcp.states", nl[N_TCPS_STATES].n_value,
+   _states, sizeof(tcps_states), kread_counters) != 0)
+   return;
+
xo_open_container("tcp");
xo_emit("{T:/%s}:\n", name);
 
@@ -853,6 +859,28 @@ tcp_stats(u_long off, const char *name, 
  #undef p2a
  #undef p3
xo_close_container("ecn");
+
+   xo_open_container("TCP connection count by state");
+   xo_emit("{T:/TCP connection count by state}:\n");
+   for (int i = 0; i < TCP_NSTATES; i++) {
+   /*
+* XXXGL: is there a way in libxo to use %s
+* in the "content string" of a format
+* string? I failed to do that, that's why
+* a temporary buffer is used to construct
+* format string for xo_emit().
+*/
+   char fmtbuf[80];
+
+   if (sflag > 1 && tcps_states[i] == 0)
+   continue;
+   snprintf(fmtbuf, sizeof(fmtbuf), "\t{:%s/%%ju} "
+"{Np:/connection ,connections} in %s state\n",
+   tcpstates[i], tcpstates[i]);
+   xo_emit(fmtbuf, (uintmax_t )tcps_states[i]);
+   }
+   xo_close_container("TCP connection count by state");
+
xo_close_container("tcp");
 }
 

Modified: head/usr.bin/netstat/main.c
==
--- head/usr.bin/netstat/main.c Tue Mar 15 00:15:10 2016(r296881)
+++ head/usr.bin/netstat/main.c Tue Mar 15 00:19:30 2016(r296882)
@@ -551,15 +551,15 @@ main(int argc, char *argv[])
exit(0);
 }
 
-int
-fetch_stats(const char *sysctlname, u_long off, void *stats, size_t len,
-int (*kreadfn)(u_long, void *, size_t))
+static int
+fetch_stats_internal(const char *sysctlname, u_long off, void *stats,
+size_t len, kreadfn_t kreadfn, int zero)
 {
int error;
 
if (live) {
memset(stats, 0, len);
-   if (zflag)
+   if (zero)
error = sysctlbyname(sysctlname, NULL, NULL, stats,
len);
else
@@ -574,6 +574,23 @@ fetch_stats(const char *sysctlname, u_lo
return (error);
 }
 
+int
+fetch_stats(const char *sysctlname, u_long off, void *stats,
+size_t len, kreadfn_t kreadfn)
+{
+
+   return (fetch_stats_internal(sysctlname, off, stats, len, kreadfn,
+zflag));
+}
+
+int
+fetch_stats_ro(const char *sysctlname, u_long off, void *stats,
+size_t len, kreadfn_t kreadfn)
+{
+
+   return (fetch_stats_internal(sysctlname, off, stats, len, kreadfn, 0));
+}
+
 /*
  * Print out protocol statistics or control blocks (per sflag).
  * If the interface was not specifically requested, and the symbol

Modified: head/usr.bin/netstat/netstat.h
==
--- head/usr.bin/netstat/netstat.h  Tue Mar 15 00:15:10 2016
(r296881)
+++ head/usr.bin/netstat/netstat.h  Tue Mar 15 00:19:30 2016
(r296882)
@@ -63,8 +63,10 @@ extern int   unit;   /* unit number for abov
 
 extern int live;   /* true if we are examining a live system */
 
-intfetch_stats(const char *sysctlname, u_long addr, void *stats,
-   size_t len, int (*kreadfn)(u_long, void *, size_t));
+typedefint kreadfn_t(u_long, void *, size_t);
+intfetch_stats(const char *, u_long, void *, size_t, kreadfn_t);
+intfetch_stats_ro(const char *, u_long, void *, size_t, kreadfn_t);
+
 intkread(u_long addr, void *buf, size_t size);
 uint64_t kread_counter(u_long addr);
 intkread_counters(u_long addr, void *buf, size_t size);

Modified: head/usr.bin/netstat/nlist_symbols

Re: svn commit: r296880 - in head: share/man/man9 sys/kern sys/sys

2016-03-14 Thread Mateusz Guzik
On Tue, Mar 15, 2016 at 12:05:00AM +, Gleb Smirnoff wrote:
> +int
> +sysctl_handle_counter_u64_array(SYSCTL_HANDLER_ARGS)
> +{
> + uint64_t *out;
> + int error;
> +
> + out = malloc(arg2 * sizeof(uint64_t), M_TEMP, M_WAITOK);
> + for (int i = 0; i < arg2; i++)
> + out[i] = counter_u64_fetch(((counter_u64_t *)arg1)[i]);
> +
> + error = SYSCTL_OUT(req, out, arg2 * sizeof(uint64_t));
> +
> + if (error || !req->newptr)
> + return (error);
> +
> + /*
> +  * Any write attempt to a counter zeroes it.
> +  */
> + for (int i = 0; i < arg2; i++)
> + counter_u64_zero(((counter_u64_t *)arg1)[i]);
> + 
> + return (0);
> +}
> 

This never frees tha allocated buffer.

It would be better to just put stuff to userspace in a loop and avoid
allocations entirely. but does not look like there are no friendly
macros for that.

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


svn commit: r296881 - in head: contrib/bsnmp/snmp_mibII sys/netinet

2016-03-14 Thread Gleb Smirnoff
Author: glebius
Date: Tue Mar 15 00:15:10 2016
New Revision: 296881
URL: https://svnweb.freebsd.org/changeset/base/296881

Log:
  Redo r294869. The array of counters for TCP states doesn't belong to
  struct tcpstat, because the structure can be zeroed out by netstat(1) -z,
  and of course running connection counts shouldn't be touched.
  
  Place running connection counts into separate array, and provide
  separate read-only sysctl oid for it.

Modified:
  head/contrib/bsnmp/snmp_mibII/mibII_tcp.c
  head/sys/netinet/tcp_input.c
  head/sys/netinet/tcp_subr.c
  head/sys/netinet/tcp_syncache.c
  head/sys/netinet/tcp_timewait.c
  head/sys/netinet/tcp_usrreq.c
  head/sys/netinet/tcp_var.h

Modified: head/contrib/bsnmp/snmp_mibII/mibII_tcp.c
==
--- head/contrib/bsnmp/snmp_mibII/mibII_tcp.c   Tue Mar 15 00:05:00 2016
(r296880)
+++ head/contrib/bsnmp/snmp_mibII/mibII_tcp.c   Tue Mar 15 00:15:10 2016
(r296881)
@@ -47,6 +47,7 @@ struct tcp_index {
 static uint64_t tcp_tick;
 static uint64_t tcp_stats_tick;
 static struct tcpstat tcpstat;
+static uint64_t tcps_states[TCP_NSTATES];
 static struct xinpgen *xinpgen;
 static size_t xinpgen_len;
 static u_int tcp_total;
@@ -78,6 +79,17 @@ fetch_tcp_stats(void)
return (-1);
}
 
+   len = sizeof(tcps_states);
+   if (sysctlbyname("net.inet.tcp.states", _states, , NULL,
+   0) == -1) {
+   syslog(LOG_ERR, "net.inet.tcp.states: %m");
+   return (-1);
+   }
+   if (len != sizeof(tcps_states)) {
+   syslog(LOG_ERR, "net.inet.tcp.states: wrong size");
+   return (-1);
+   }
+
tcp_stats_tick = get_ticks();
 
return (0);
@@ -231,8 +243,8 @@ op_tcp(struct snmp_context *ctx __unused
break;
 
  case LEAF_tcpCurrEstab:
-   value->v.uint32 = tcpstat.tcps_states[TCPS_ESTABLISHED] +
-   tcpstat.tcps_states[TCPS_CLOSE_WAIT];
+   value->v.uint32 = tcps_states[TCPS_ESTABLISHED] +
+   tcps_states[TCPS_CLOSE_WAIT];
break;
 
  case LEAF_tcpInSegs:

Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cTue Mar 15 00:05:00 2016
(r296880)
+++ head/sys/netinet/tcp_input.cTue Mar 15 00:15:10 2016
(r296881)
@@ -235,16 +235,39 @@ VNET_DEFINE(struct inpcbhead, tcb);
 VNET_DEFINE(struct inpcbinfo, tcbinfo);
 
 /*
- * TCP statistics are stored in an "array" of counter(9)s.
+ * TCP statistics are stored in an array of counter(9)s, which size matches
+ * size of struct tcpstat.  TCP running connection count is a regular array.
  */
 VNET_PCPUSTAT_DEFINE(struct tcpstat, tcpstat);
-VNET_PCPUSTAT_SYSINIT(tcpstat);
 SYSCTL_VNET_PCPUSTAT(_net_inet_tcp, TCPCTL_STATS, stats, struct tcpstat,
 tcpstat, "TCP statistics (struct tcpstat, netinet/tcp_var.h)");
+VNET_DEFINE(counter_u64_t, tcps_states[TCP_NSTATES]);
+SYSCTL_COUNTER_U64_ARRAY(_net_inet_tcp, TCPCTL_STATES, states, CTLFLAG_RD |
+CTLFLAG_VNET, _NAME(tcps_states), TCP_NSTATES,
+"TCP connection counts by TCP state");
+
+static void
+tcp_vnet_init(const void *unused)
+{
+
+   COUNTER_ARRAY_ALLOC(VNET(tcps_states), TCP_NSTATES, M_WAITOK);
+   VNET_PCPUSTAT_ALLOC(tcpstat, M_WAITOK);
+}
+VNET_SYSINIT(tcp_vnet_init, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY,
+tcp_vnet_init, NULL);
 
 #ifdef VIMAGE
-VNET_PCPUSTAT_SYSUNINIT(tcpstat);
+static void
+tcp_vnet_uninit(const void *unused)
+{
+
+   COUNTER_ARRAY_FREE(VNET(tcps_states), TCP_NSTATES);
+   VNET_PCPUSTAT_FREE(tcpstat);
+}
+VNET_SYSUNINIT(tcp_vnet_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY,
+tcp_vnet_uninit, NULL);
 #endif /* VIMAGE */
+
 /*
  * Kernel module interface for updating tcpstat.  The argument is an index
  * into tcpstat treated as an array.

Modified: head/sys/netinet/tcp_subr.c
==
--- head/sys/netinet/tcp_subr.c Tue Mar 15 00:05:00 2016(r296880)
+++ head/sys/netinet/tcp_subr.c Tue Mar 15 00:15:10 2016(r296881)
@@ -1542,7 +1542,7 @@ tcp_close(struct tcpcb *tp)
 #endif
in_pcbdrop(inp);
TCPSTAT_INC(tcps_closed);
-   TCPSTAT_DEC(tcps_states[tp->t_state]);
+   TCPSTATES_DEC(tp->t_state);
KASSERT(inp->inp_socket != NULL, ("tcp_close: inp_socket NULL"));
so = inp->inp_socket;
soisdisconnected(so);
@@ -1665,7 +1665,7 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS)
 */
if (req->oldptr == NULL) {
n = V_tcbinfo.ipi_count +
-   TCPSTAT_FETCH(tcps_states[TCPS_SYN_RECEIVED]);
+   counter_u64_fetch(VNET(tcps_states)[TCPS_SYN_RECEIVED]);
n += imax(n / 8, 10);
req->oldidx = 2 * (sizeof xig) + n * sizeof(struct xtcpcb);

svn commit: r296880 - in head: share/man/man9 sys/kern sys/sys

2016-03-14 Thread Gleb Smirnoff
Author: glebius
Date: Tue Mar 15 00:05:00 2016
New Revision: 296880
URL: https://svnweb.freebsd.org/changeset/base/296880

Log:
  Provide sysctl(9) macro to deal with array of counter(9).

Modified:
  head/share/man/man9/counter.9
  head/sys/kern/subr_counter.c
  head/sys/sys/sysctl.h

Modified: head/share/man/man9/counter.9
==
--- head/share/man/man9/counter.9   Mon Mar 14 23:49:16 2016
(r296879)
+++ head/share/man/man9/counter.9   Tue Mar 15 00:05:00 2016
(r296880)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 7, 2014
+.Dd March 14, 2016
 .Dt COUNTER 9
 .Os
 .Sh NAME
@@ -54,6 +54,8 @@
 .In sys/sysctl.h
 .Fn SYSCTL_COUNTER_U64 parent nbr name access ptr descr
 .Fn SYSCTL_ADD_COUNTER_U64 ctx parent nbr name access ptr descr
+.Fn SYSCTL_COUNTER_U64_ARRAY parent nbr name access ptr len descr
+.Fn SYSCTL_ADD_COUNTER_U64_ARRAY ctx parent nbr name access ptr len descr
 .Sh DESCRIPTION
 .Nm
 is a generic facility to create counters
@@ -150,6 +152,40 @@ argument should be a pointer to allocate
 A read of the oid returns value obtained through
 .Fn counter_u64_fetch .
 Any write to the oid zeroes it.
+.It Fn SYSCTL_COUNTER_U64_ARRAY parent nbr name access ptr len descr
+Declare a static
+.Xr sysctl  
+oid that would represent an array of
+.Nm .
+The
+.Fa ptr
+argument should be a pointer to allocated array of
+.Vt counter_u64_t's .
+The
+.Fa len
+argument should specify number of elements in the array.
+A read of the oid returns len-sized array of
+.Vt uint64_t
+values  obtained through
+.Fn counter_u64_fetch .
+Any write to the oid zeroes all array elements.
+.It Fn SYSCTL_ADD_COUNTER_U64_ARRAY ctx parent nbr name access ptr len descr
+Create a
+.Xr sysctl
+oid that would represent an array of 
+.Nm .
+The
+.Fa ptr
+argument should be a pointer to allocated array of
+.Vt counter_u64_t's .
+The
+.Fa len
+argument should specify number of elements in the array.
+A read of the oid returns len-sized array of 
+.Vt uint64_t 
+values  obtained through
+.Fn counter_u64_fetch .
+Any write to the oid zeroes all array elements.
 .El
 .Sh IMPLEMENTATION DETAILS
 On all architectures

Modified: head/sys/kern/subr_counter.c
==
--- head/sys/kern/subr_counter.cMon Mar 14 23:49:16 2016
(r296879)
+++ head/sys/kern/subr_counter.cTue Mar 15 00:05:00 2016
(r296880)
@@ -94,3 +94,27 @@ sysctl_handle_counter_u64(SYSCTL_HANDLER
 
return (0);
 }
+
+int
+sysctl_handle_counter_u64_array(SYSCTL_HANDLER_ARGS)
+{
+   uint64_t *out;
+   int error;
+
+   out = malloc(arg2 * sizeof(uint64_t), M_TEMP, M_WAITOK);
+   for (int i = 0; i < arg2; i++)
+   out[i] = counter_u64_fetch(((counter_u64_t *)arg1)[i]);
+
+   error = SYSCTL_OUT(req, out, arg2 * sizeof(uint64_t));
+
+   if (error || !req->newptr)
+   return (error);
+
+   /*
+* Any write attempt to a counter zeroes it.
+*/
+   for (int i = 0; i < arg2; i++)
+   counter_u64_zero(((counter_u64_t *)arg1)[i]);
+ 
+   return (0);
+}

Modified: head/sys/sys/sysctl.h
==
--- head/sys/sys/sysctl.h   Mon Mar 14 23:49:16 2016(r296879)
+++ head/sys/sys/sysctl.h   Tue Mar 15 00:05:00 2016(r296880)
@@ -204,6 +204,7 @@ int sysctl_handle_long(SYSCTL_HANDLER_AR
 int sysctl_handle_string(SYSCTL_HANDLER_ARGS);
 int sysctl_handle_opaque(SYSCTL_HANDLER_ARGS);
 int sysctl_handle_counter_u64(SYSCTL_HANDLER_ARGS);
+int sysctl_handle_counter_u64_array(SYSCTL_HANDLER_ARGS);
 
 int sysctl_handle_uma_zone_max(SYSCTL_HANDLER_ARGS);
 int sysctl_handle_uma_zone_cur(SYSCTL_HANDLER_ARGS);
@@ -648,6 +649,26 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e
__ptr, 0, sysctl_handle_counter_u64, "QU", __DESCR(descr)); \
 })
 
+/* Oid for an array of counter(9)s.  The pointer and length must be non zero. 
*/
+#defineSYSCTL_COUNTER_U64_ARRAY(parent, nbr, name, access, ptr, len, 
descr) \
+   SYSCTL_OID(parent, nbr, name,   \
+   CTLTYPE_OPAQUE | CTLFLAG_MPSAFE | (access), \
+   (ptr), (len), sysctl_handle_counter_u64_array, "S", descr); \
+   CTASSERT(((access) & CTLTYPE) == 0 ||   \
+   ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE)
+
+#defineSYSCTL_ADD_COUNTER_U64_ARRAY(ctx, parent, nbr, name, access,
\
+ptr, len, descr)   \
+({ \
+   counter_u64_t *__ptr = (ptr);   \
+   CTASSERT(((access) & CTLTYPE) == 0 ||   \
+   ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE);  \
+   

svn commit: r296873 - head/usr.bin/finger

2016-03-14 Thread Kurt Lidl
Author: lidl
Date: Mon Mar 14 22:20:22 2016
New Revision: 296873
URL: https://svnweb.freebsd.org/changeset/base/296873

Log:
  Do not truncate office phones in finger's summary listing
  
  When finger is invoked as as "finger username", it produces the
  long listing by default, and phones numbers are pretty-printed
  by the prphone() function. When invoked as just "finger", the
  same pretty-printing happens, but is truncated at 9 characters.
  Given the summary listing is already greater than 80 columns,
  making it even wider is of no harm.
  
  Approved by:  rpaulo (mentor)
  Differential Revision:https://reviews.freebsd.org/D5638

Modified:
  head/usr.bin/finger/sprint.c

Modified: head/usr.bin/finger/sprint.c
==
--- head/usr.bin/finger/sprint.cMon Mar 14 21:00:16 2016
(r296872)
+++ head/usr.bin/finger/sprint.cMon Mar 14 22:20:22 2016
(r296873)
@@ -149,7 +149,7 @@ office:
else if (pn->officephone)
(void)printf(" %-7.7s", " ");
if (pn->officephone)
-   (void)printf(" %-.9s",
+   (void)printf(" %-.15s",
prphone(pn->officephone));
} else
(void)printf(" %.*s", MAXHOSTNAME, w->host);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r296826 - in head/sys/arm: conf mv

2016-03-14 Thread Bruce Simpson

On 14/03/16 07:14, Wojciech Macek wrote:

Log:
   Add support for USB3.0 on Armada38x


Very cool. Do you know if any Armada (or other embedded) XHCI 
implementations like this support XHCI Debug Port 1.0 ?


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


Re: svn commit: r296799 - head/usr.bin/grep/regex

2016-03-14 Thread Ed Maste
On 13 March 2016 at 10:53, Ian Lepore  wrote:
> Author: ian
> Date: Sun Mar 13 14:53:12 2016
> New Revision: 296799
> URL: https://svnweb.freebsd.org/changeset/base/296799
>
> Log:
>   Fix a bug in bsdgrep that caused the program to hang in a tight loop for
>   some combinations of command line options and search patterns.

Thanks for this!

I found a PR for bsdgrep (172677) that claims buildworld
WITHOUT_GNU_GREP_COMPAT and WITH_BSDGREP fails but I haven't looked
into it further.

There are also quite a few bsdgrep PRs open if someone wants to take a look.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2016-03-14 Thread Ed Maste
On 14 March 2016 at 16:34, Gleb Smirnoff  wrote:
> Author: glebius
> Date: Mon Mar 14 20:34:30 2016
> New Revision: 296871
> URL: https://svnweb.freebsd.org/changeset/base/296871
>
> Log:
>   Revert r296868. The cast is useful to protect against passing incorrect
>   argument type to the macro.
>
>   Submitted by: rstone

It seems like this ought to have a comment so someone doesn't apply
the same cleanup in the future :)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296871 - head/sys/sys

2016-03-14 Thread Gleb Smirnoff
Author: glebius
Date: Mon Mar 14 20:34:30 2016
New Revision: 296871
URL: https://svnweb.freebsd.org/changeset/base/296871

Log:
  Revert r296868. The cast is useful to protect against passing incorrect
  argument type to the macro.
  
  Submitted by: rstone

Modified:
  head/sys/sys/sysctl.h

Modified: head/sys/sys/sysctl.h
==
--- head/sys/sys/sysctl.h   Mon Mar 14 18:57:09 2016(r296870)
+++ head/sys/sys/sysctl.h   Mon Mar 14 20:34:30 2016(r296871)
@@ -640,11 +640,12 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e
 
 #defineSYSCTL_ADD_COUNTER_U64(ctx, parent, nbr, name, access, ptr, 
descr) \
 ({ \
+   counter_u64_t *__ptr = (ptr);   \
CTASSERT(((access) & CTLTYPE) == 0 ||   \
((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64); \
sysctl_add_oid(ctx, parent, nbr, name,  \
CTLTYPE_U64 | CTLFLAG_MPSAFE | (access),\
-   ptr, 0, sysctl_handle_counter_u64, "QU", __DESCR(descr));   \
+   __ptr, 0, sysctl_handle_counter_u64, "QU", __DESCR(descr)); \
 })
 
 /* Oid for an opaque object.  Specified by a pointer and a length. */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2016-03-14 Thread Gleb Smirnoff
On Mon, Mar 14, 2016 at 02:31:37PM -0400, Ryan Stone wrote:
R> On Mon, Mar 14, 2016 at 2:07 PM, Gleb Smirnoff  wrote:
R> 
R> >   Remove useless cast in SYSCTL_ADD_COUNTER_U64 macro.
R> >
R> 
R> Is it useless?  I believe that the point is to give a compiler error if an
R> incompatible pointer type was passed as the ptr parameter.

Thanks for explanation! I will back out.

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


svn commit: r296870 - head/etc/autofs

2016-03-14 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Mar 14 18:57:09 2016
New Revision: 296870
URL: https://svnweb.freebsd.org/changeset/base/296870

Log:
  Restore accidentaly removed comment line.
  
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/etc/autofs/special_media

Modified: head/etc/autofs/special_media
==
--- head/etc/autofs/special_media   Mon Mar 14 18:54:29 2016
(r296869)
+++ head/etc/autofs/special_media   Mon Mar 14 18:57:09 2016
(r296870)
@@ -21,6 +21,7 @@ print_available() {
_label="${_fstype_and_label#* }"
# Replace plus signs and slashes with minuses;
# leading plus signs have special meaning in maps,
+   # and multi-component keys are just not supported.
_label="$(echo ${_label} | sed 's,[+/],-,g')"
echo "${_label}"
continue
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


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

2016-03-14 Thread Ryan Stone
On Mon, Mar 14, 2016 at 2:07 PM, Gleb Smirnoff  wrote:

>   Remove useless cast in SYSCTL_ADD_COUNTER_U64 macro.
>

Is it useless?  I believe that the point is to give a compiler error if an
incompatible pointer type was passed as the ptr parameter.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296868 - head/sys/sys

2016-03-14 Thread Gleb Smirnoff
Author: glebius
Date: Mon Mar 14 18:07:59 2016
New Revision: 296868
URL: https://svnweb.freebsd.org/changeset/base/296868

Log:
  Remove useless cast in SYSCTL_ADD_COUNTER_U64 macro.

Modified:
  head/sys/sys/sysctl.h

Modified: head/sys/sys/sysctl.h
==
--- head/sys/sys/sysctl.h   Mon Mar 14 18:06:59 2016(r296867)
+++ head/sys/sys/sysctl.h   Mon Mar 14 18:07:59 2016(r296868)
@@ -640,12 +640,11 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_e
 
 #defineSYSCTL_ADD_COUNTER_U64(ctx, parent, nbr, name, access, ptr, 
descr) \
 ({ \
-   counter_u64_t *__ptr = (ptr);   \
CTASSERT(((access) & CTLTYPE) == 0 ||   \
((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64); \
sysctl_add_oid(ctx, parent, nbr, name,  \
CTLTYPE_U64 | CTLFLAG_MPSAFE | (access),\
-   __ptr, 0, sysctl_handle_counter_u64, "QU", __DESCR(descr)); \
+   ptr, 0, sysctl_handle_counter_u64, "QU", __DESCR(descr));   \
 })
 
 /* Oid for an opaque object.  Specified by a pointer and a length. */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296867 - head/sys/netinet

2016-03-14 Thread Gleb Smirnoff
Author: glebius
Date: Mon Mar 14 18:06:59 2016
New Revision: 296867
URL: https://svnweb.freebsd.org/changeset/base/296867

Log:
  Comment fix: statistics are not read-only.

Modified:
  head/sys/netinet/tcp_var.h

Modified: head/sys/netinet/tcp_var.h
==
--- head/sys/netinet/tcp_var.h  Mon Mar 14 17:45:39 2016(r296866)
+++ head/sys/netinet/tcp_var.h  Mon Mar 14 18:06:59 2016(r296867)
@@ -666,7 +666,7 @@ struct  xtcpcb {
  */
 #defineTCPCTL_DO_RFC1323   1   /* use RFC-1323 extensions */
 #defineTCPCTL_MSSDFLT  3   /* MSS default */
-#define TCPCTL_STATS   4   /* statistics (read-only) */
+#define TCPCTL_STATS   4   /* statistics */
 #defineTCPCTL_RTTDFLT  5   /* default RTT estimate */
 #defineTCPCTL_KEEPIDLE 6   /* keepalive idle timer */
 #defineTCPCTL_KEEPINTVL7   /* interval to send keepalives 
*/
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296866 - head/etc/autofs

2016-03-14 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Mar 14 17:45:39 2016
New Revision: 296866
URL: https://svnweb.freebsd.org/changeset/base/296866

Log:
  Fix autofs handling of filesystem labels containing plus signs and slashes.
  
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/etc/autofs/special_media

Modified: head/etc/autofs/special_media
==
--- head/etc/autofs/special_media   Mon Mar 14 17:41:17 2016
(r296865)
+++ head/etc/autofs/special_media   Mon Mar 14 17:45:39 2016
(r296866)
@@ -19,6 +19,9 @@ print_available() {
_fstype="${_fstype_and_label%% *}"
if [ "${_fstype}" != "${_fstype_and_label}" ]; then
_label="${_fstype_and_label#* }"
+   # Replace plus signs and slashes with minuses;
+   # leading plus signs have special meaning in maps,
+   _label="$(echo ${_label} | sed 's,[+/],-,g')"
echo "${_label}"
continue
fi
@@ -54,6 +57,10 @@ print_one() {
fi
 
_label="${_fstype_and_label#* }"
+   # Replace plus signs and slashes with minuses;
+   # leading plus signs have special meaning in maps,
+   # and multi-component keys are just not supported.
+   _label="$(echo ${_label} | sed 's,[+/],-,g')"
if [ "${_label}" != "${_key}" ]; then
# Labels don't match, try another device.
continue
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296865 - in head: sys/dev/pci sys/sys usr.sbin/iovctl

2016-03-14 Thread Ryan Stone
Author: rstone
Date: Mon Mar 14 17:41:17 2016
New Revision: 296865
URL: https://svnweb.freebsd.org/changeset/base/296865

Log:
  Clean up repeated "All rights reserved"

Modified:
  head/sys/dev/pci/pci_iov.c
  head/sys/dev/pci/pci_iov_private.h
  head/sys/dev/pci/pci_iov_schema.c
  head/sys/dev/pci/schema_private.h
  head/sys/sys/iov.h
  head/sys/sys/iov_schema.h
  head/usr.sbin/iovctl/iovctl.c
  head/usr.sbin/iovctl/iovctl.h
  head/usr.sbin/iovctl/parse.c
  head/usr.sbin/iovctl/validate.c

Modified: head/sys/dev/pci/pci_iov.c
==
--- head/sys/dev/pci/pci_iov.c  Mon Mar 14 16:52:05 2016(r296864)
+++ head/sys/dev/pci/pci_iov.c  Mon Mar 14 17:41:17 2016(r296865)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2013-2015 Sandvine Inc.  All rights reserved.
+ * Copyright (c) 2013-2015 Sandvine Inc.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/sys/dev/pci/pci_iov_private.h
==
--- head/sys/dev/pci/pci_iov_private.h  Mon Mar 14 16:52:05 2016
(r296864)
+++ head/sys/dev/pci/pci_iov_private.h  Mon Mar 14 17:41:17 2016
(r296865)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2013-2015 Sandvine Inc.  All rights reserved.
+ * Copyright (c) 2013-2015 Sandvine Inc.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/sys/dev/pci/pci_iov_schema.c
==
--- head/sys/dev/pci/pci_iov_schema.c   Mon Mar 14 16:52:05 2016
(r296864)
+++ head/sys/dev/pci/pci_iov_schema.c   Mon Mar 14 17:41:17 2016
(r296865)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2014-2015 Sandvine Inc.  All rights reserved.
+ * Copyright (c) 2014-2015 Sandvine Inc.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/sys/dev/pci/schema_private.h
==
--- head/sys/dev/pci/schema_private.h   Mon Mar 14 16:52:05 2016
(r296864)
+++ head/sys/dev/pci/schema_private.h   Mon Mar 14 17:41:17 2016
(r296865)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2014 Sandvine Inc.  All rights reserved.
+ * Copyright (c) 2014 Sandvine Inc.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/sys/sys/iov.h
==
--- head/sys/sys/iov.h  Mon Mar 14 16:52:05 2016(r296864)
+++ head/sys/sys/iov.h  Mon Mar 14 17:41:17 2016(r296865)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2013-2015 Sandvine Inc.  All rights reserved.
+ * Copyright (c) 2013-2015 Sandvine Inc.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/sys/sys/iov_schema.h
==
--- head/sys/sys/iov_schema.h   Mon Mar 14 16:52:05 2016(r296864)
+++ head/sys/sys/iov_schema.h   Mon Mar 14 17:41:17 2016(r296865)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2014-2015 Sandvine Inc.  All rights reserved.
+ * Copyright (c) 2014-2015 Sandvine Inc.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/usr.sbin/iovctl/iovctl.c
==
--- head/usr.sbin/iovctl/iovctl.c   Mon Mar 14 16:52:05 2016
(r296864)
+++ head/usr.sbin/iovctl/iovctl.c   Mon Mar 14 17:41:17 2016
(r296865)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2013-2015 Sandvine Inc.  All rights reserved.
+ * Copyright (c) 2013-2015 Sandvine Inc.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/usr.sbin/iovctl/iovctl.h
==
--- head/usr.sbin/iovctl/iovctl.h   Mon Mar 14 16:52:05 2016
(r296864)
+++ head/usr.sbin/iovctl/iovctl.h   Mon Mar 14 17:41:17 2016
(r296865)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2013-2015 Sandvine Inc.  All rights reserved.
+ * Copyright (c) 2013-2015 Sandvine Inc.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: head/usr.sbin/iovctl/parse.c
==
--- head/usr.sbin/iovctl/parse.cMon Mar 14 16:52:05 2016
(r296864)
+++ head/usr.sbin/iovctl/parse.cMon Mar 14 17:41:17 2016
(r296865)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2014-2015 Sandvine Inc.  All rights reserved.
+ * Copyright (c) 2014-2015 Sandvine Inc.
  * All rights reserved.
  *
  * Redistribution and use in source and 

svn commit: r296864 - head/sys/net80211

2016-03-14 Thread Adrian Chadd
Author: adrian
Date: Mon Mar 14 16:52:05 2016
New Revision: 296864
URL: https://svnweb.freebsd.org/changeset/base/296864

Log:
  class -> i_class.  Thanks C++.
  
  Noticed by: jbeich@

Modified:
  head/sys/net80211/ieee80211.h

Modified: head/sys/net80211/ieee80211.h
==
--- head/sys/net80211/ieee80211.h   Mon Mar 14 16:27:43 2016
(r296863)
+++ head/sys/net80211/ieee80211.h   Mon Mar 14 16:52:05 2016
(r296864)
@@ -797,7 +797,7 @@ struct ieee80211_bss_load_ie {
 struct ieee80211_ap_chan_report_ie {
uint8_t ie;
uint8_t len;
-   uint8_t class; /* operating class */
+   uint8_t i_class; /* operating class */
/* Annex E, E.1 Country information and operating classes */
uint8_t chan_list[0];
 } __packed;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r296823 - in head: sbin/ifconfig sys/net80211

2016-03-14 Thread Adrian Chadd
oops! I'll fix now

Thanks!


-a


On 14 March 2016 at 09:00, Jan Beich  wrote:
> Adrian Chadd  writes:
>
>> Author: adrian
>> Date: Mon Mar 14 04:39:35 2016
>> New Revision: 296823
>> URL: https://svnweb.freebsd.org/changeset/base/296823
>>
>> Log:
>>   [net80211] handle unlisted information elements.
>>
>>   This displays the IE names in ifconfig but it doesn't yet decode things.
>>
>>   Submitted by: Idwer Vollering 
>>   Differential Revision:  https://reviews.freebsd.org/D3782
> [...]
>> Modified: head/sys/net80211/ieee80211.h
> [...]
>> +struct ieee80211_ap_chan_report_ie {
>> + uint8_t ie;
>> + uint8_t len;
>> + uint8_t class; /* operating class */
>
> "class" is a reserved keyword in C++. www/firefox implements wifi
> geolocation in C++, so it's now broken. www/chromium is probably also
> affected.
>
>   In file included from netwerk/wifi/Unified_cpp_netwerk_wifi0.cpp:20:
>   In file included from netwerk/wifi/nsWifiScannerFreeBSD.cpp:19:
>   In file included from /usr/include/net80211/ieee80211_ioctl.h:35:
>   /usr/include/net80211/ieee80211.h:800:11: error: declaration of anonymous 
> class must be a definition
>   uint8_t class; /* operating class */
>   ^
>   1 error generated.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296863 - head

2016-03-14 Thread Edward Tomasz Napierala
Author: trasz
Date: Mon Mar 14 16:27:43 2016
New Revision: 296863
URL: https://svnweb.freebsd.org/changeset/base/296863

Log:
  Add myself to MAINTAINERS.
  
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/MAINTAINERS

Modified: head/MAINTAINERS
==
--- head/MAINTAINERSMon Mar 14 16:19:50 2016(r296862)
+++ head/MAINTAINERSMon Mar 14 16:27:43 2016(r296863)
@@ -102,3 +102,6 @@ usr.sbin/dpvdteske  Pre-commit review re
 usr.sbin/pkg   pkg@Please coordinate behavior or flag changes with pkg 
team.
 usr.sbin/sysrc dteske  Pre-commit phabricator review requested. Keep in sync 
with bsdconfig(8) sysrc.subr.
 vmm(4) neel,grehan Pre-commit review requested.
+autofs(5)  trasz   Pre-commit review recommended.
+iscsi(4)   trasz   Pre-commit review recommended.
+rctl(8)trasz   Pre-commit review recommended.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296862 - head/sys/dev/drm2/i915

2016-03-14 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Mar 14 16:19:50 2016
New Revision: 296862
URL: https://svnweb.freebsd.org/changeset/base/296862

Log:
  Fix the printf for PAE kernels where it'd be long long to unbreak
  the build.

Modified:
  head/sys/dev/drm2/i915/i915_gem_gtt.c

Modified: head/sys/dev/drm2/i915/i915_gem_gtt.c
==
--- head/sys/dev/drm2/i915/i915_gem_gtt.c   Mon Mar 14 14:55:15 2016
(r296861)
+++ head/sys/dev/drm2/i915/i915_gem_gtt.c   Mon Mar 14 16:19:50 2016
(r296862)
@@ -565,9 +565,10 @@ void i915_gem_init_global_gtt(struct drm
i915_ggtt_clear_range(dev, start / PAGE_SIZE, (end-start) / PAGE_SIZE);
 
device_printf(dev->dev,
-   "taking over the fictitious range 0x%lx-0x%lx\n",
-   dev_priv->mm.gtt_base_addr + start,
-   dev_priv->mm.gtt_base_addr + start + 
dev_priv->mm.mappable_gtt_total);
+   "taking over the fictitious range 0x%jx-0x%jx\n",
+   (uintmax_t)(dev_priv->mm.gtt_base_addr + start),
+   (uintmax_t)(dev_priv->mm.gtt_base_addr + start +
+   dev_priv->mm.mappable_gtt_total));
vm_phys_fictitious_reg_range(dev_priv->mm.gtt_base_addr + start,
dev_priv->mm.gtt_base_addr + start + 
dev_priv->mm.mappable_gtt_total,
VM_MEMATTR_WRITE_COMBINING);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r296823 - in head: sbin/ifconfig sys/net80211

2016-03-14 Thread Jan Beich
Adrian Chadd  writes:

> Author: adrian
> Date: Mon Mar 14 04:39:35 2016
> New Revision: 296823
> URL: https://svnweb.freebsd.org/changeset/base/296823
>
> Log:
>   [net80211] handle unlisted information elements.
>   
>   This displays the IE names in ifconfig but it doesn't yet decode things.
>   
>   Submitted by: Idwer Vollering 
>   Differential Revision:  https://reviews.freebsd.org/D3782
[...]
> Modified: head/sys/net80211/ieee80211.h
[...]
> +struct ieee80211_ap_chan_report_ie {
> + uint8_t ie;
> + uint8_t len;
> + uint8_t class; /* operating class */

"class" is a reserved keyword in C++. www/firefox implements wifi
geolocation in C++, so it's now broken. www/chromium is probably also
affected.

  In file included from netwerk/wifi/Unified_cpp_netwerk_wifi0.cpp:20:
  In file included from netwerk/wifi/nsWifiScannerFreeBSD.cpp:19:
  In file included from /usr/include/net80211/ieee80211_ioctl.h:35:
  /usr/include/net80211/ieee80211.h:800:11: error: declaration of anonymous 
class must be a definition
  uint8_t class; /* operating class */
  ^
  1 error generated.


signature.asc
Description: PGP signature


Re: svn commit: r296825 - in head/sys: arm/conf arm/mv arm/mv/armada38x boot/fdt/dts/arm

2016-03-14 Thread Bjoern A. Zeeb

> On 14 Mar 2016, at 07:05 , Wojciech Macek  wrote:
> 
> Author: wma
> Date: Mon Mar 14 07:05:41 2016
> New Revision: 296825
> URL: https://svnweb.freebsd.org/changeset/base/296825
> 
> Log:
>  Make MPIC compatible with ARM_INTRNG
> 
>  After ARM_INTRNG introduction, MPIC code needed several modifications:
>  - IRQ resource and its handler added
>  -  several DEVMETHODs of INTRNG interface implemented
>  -  defines enhanced to ensure code compiles as well for AXP as for A38X
>  - added dummy MSI_IRQ, ERR_IRQ defines for Armada38x
>  - MPIC driver was added to files.armada38x, ARM_INTRNG option enabled in
>kernconf file and regs of MPIC corrected in dts file.
> 
>  Instead of modifying Armada38X DTS, offsets to CPU registers defined in
>  driver were changed. That required restoring 'reg' property of mpic node
>  in ArmadaXP to state compliant with Linux DTS.
> 
>  Additionally, required ARM_INTRNG definitions were added to mv_common.c.
> 
>  Submitted by:  Bartosz Szczepanek 
>  Obtained from: Semihalf
>  Sponsored by:  Stormshield
>  Reviewed by:   adrian, andrew, ian, skra
>  Approved by:   cognet (mentor)
>  Differential Revision: https://reviews.freebsd.org/D5030
> 
> Modified:
>  head/sys/arm/conf/ARMADA38X
>  head/sys/arm/mv/armada38x/files.armada38x
>  head/sys/arm/mv/mpic.c
>  head/sys/arm/mv/mvreg.h
>  head/sys/boot/fdt/dts/arm/db78460.dts
> 
> Modified: head/sys/arm/mv/mpic.c
> ==
> --- head/sys/arm/mv/mpic.cMon Mar 14 06:30:37 2016(r296824)
> +++ head/sys/arm/mv/mpic.cMon Mar 14 07:05:41 2016(r296825)
> 
> @@ -48,11 +54,16 @@ __FBSDID("$FreeBSD$");
> #include 
> 
> #include 
> +#include 


This redefines at least IRQ_MASK now in this file and breaks the build.  Can 
you have a look and fix it?


Thanks,
/bz



— 
Bjoern A. Zeeb  Charles Haddon Spurgeon:
"Friendship is one of the sweetest joys of life.  Many might have failed
 beneath the bitterness of their trial  had they not found a friend."

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

svn commit: r296861 - in head/sys: arm/arm powerpc/powerpc

2016-03-14 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Mar 14 14:55:15 2016
New Revision: 296861
URL: https://svnweb.freebsd.org/changeset/base/296861

Log:
  Only check for SYS_freebsd6_lseek if the syscall code is defined.
  Whether this is the right or best solution is unclear but it fixes the
  build for now.

Modified:
  head/sys/arm/arm/vm_machdep.c
  head/sys/powerpc/powerpc/exec_machdep.c

Modified: head/sys/arm/arm/vm_machdep.c
==
--- head/sys/arm/arm/vm_machdep.c   Mon Mar 14 14:15:26 2016
(r296860)
+++ head/sys/arm/arm/vm_machdep.c   Mon Mar 14 14:55:15 2016
(r296861)
@@ -40,6 +40,8 @@
  * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
  */
 
+#include "opt_compat.h"
+
 #include 
 __FBSDID("$FreeBSD$");
 
@@ -180,7 +182,7 @@ cpu_set_syscall_retval(struct thread *td
/*
 * __syscall returns an off_t while most other syscalls return an
 * int. As an off_t is 64-bits and an int is 32-bits we need to
-* place the returned data into r1. As the lseek and frerebsd6_lseek
+* place the returned data into r1. As the lseek and freebsd6_lseek
 * syscalls also return an off_t they do not need this fixup.
 */
call = frame->tf_r7;
@@ -189,8 +191,11 @@ cpu_set_syscall_retval(struct thread *td
register_t code = ap[_QUAD_LOWWORD];
if (td->td_proc->p_sysent->sv_mask)
code &= td->td_proc->p_sysent->sv_mask;
-   fixup = (code != SYS_freebsd6_lseek && code != SYS_lseek)
-   ? 1 : 0;
+   fixup = (
+#if defined(COMPAT_FREEBSD6) && defined(SYS_freebsd6_lseek)
+   code != SYS_freebsd6_lseek &&
+#endif
+   code != SYS_lseek) ? 1 : 0;
}
 #endif
 

Modified: head/sys/powerpc/powerpc/exec_machdep.c
==
--- head/sys/powerpc/powerpc/exec_machdep.c Mon Mar 14 14:15:26 2016
(r296860)
+++ head/sys/powerpc/powerpc/exec_machdep.c Mon Mar 14 14:55:15 2016
(r296861)
@@ -879,8 +879,11 @@ cpu_set_syscall_retval(struct thread *td
int code = tf->fixreg[FIRSTARG + 1];
if (p->p_sysent->sv_mask)
code &= p->p_sysent->sv_mask;
-   fixup = (code != SYS_freebsd6_lseek && code != SYS_lseek) ?
-   1 : 0;
+   fixup = (
+#if defined(COMPAT_FREEBSD6) && defined(SYS_freebsd6_lseek)
+   code != SYS_freebsd6_lseek &&
+#endif
+   code != SYS_lseek) ?  1 : 0;
} else
fixup = 0;
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r296829 - head/usr.sbin/bhyve

2016-03-14 Thread Slawa Olhovchenkov
On Mon, Mar 14, 2016 at 08:48:16AM +, George V. Neville-Neil wrote:

> Author: gnn
> Date: Mon Mar 14 08:48:16 2016
> New Revision: 296829
> URL: https://svnweb.freebsd.org/changeset/base/296829
> 
> Log:
>   Fix typo: nmd->cur_tx_ring should be used in pci_vtnet_netmap_writev()
>   The buffer length should be checked to avoid overflow, but there
>   is no API to get the slot length, so the hardcoded value is used.

What about netmap_ring:nr_buf_size?

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


svn commit: r296829 - head/usr.sbin/bhyve

2016-03-14 Thread George V. Neville-Neil
Author: gnn
Date: Mon Mar 14 08:48:16 2016
New Revision: 296829
URL: https://svnweb.freebsd.org/changeset/base/296829

Log:
  Fix typo: nmd->cur_tx_ring should be used in pci_vtnet_netmap_writev()
  The buffer length should be checked to avoid overflow, but there
  is no API to get the slot length, so the hardcoded value is used.
  Return the currently-first request chain back to the available
  queue if there are no more packets.
  Report the link as up if we managed to open vale port.
  Use consistent coding style.
  
  Submitted by: btw
  MFC after: 1 week
  Differential Revision:https://reviews.freebsd.org/D5595

Modified:
  head/usr.sbin/bhyve/pci_virtio_net.c

Modified: head/usr.sbin/bhyve/pci_virtio_net.c
==
--- head/usr.sbin/bhyve/pci_virtio_net.cMon Mar 14 07:26:38 2016
(r296828)
+++ head/usr.sbin/bhyve/pci_virtio_net.cMon Mar 14 08:48:16 2016
(r296829)
@@ -381,7 +381,7 @@ pci_vtnet_tap_rx(struct pci_vtnet_softc 
vq_endchains(vq, 1);
 }
 
-static int
+static __inline int
 pci_vtnet_netmap_writev(struct nm_desc *nmd, struct iovec *iov, int iovcnt)
 {
int r, i;
@@ -396,7 +396,7 @@ pci_vtnet_netmap_writev(struct nm_desc *
r++;
if (r > nmd->last_tx_ring)
r = nmd->first_tx_ring;
-   if (r == nmd->cur_rx_ring)
+   if (r == nmd->cur_tx_ring)
break;
continue;
}
@@ -405,6 +405,8 @@ pci_vtnet_netmap_writev(struct nm_desc *
buf = NETMAP_BUF(ring, idx);
 
for (i = 0; i < iovcnt; i++) {
+   if (len + iov[i].iov_len > 2048)
+   break;
memcpy([len], iov[i].iov_base, iov[i].iov_len);
len += iov[i].iov_len;
}
@@ -418,7 +420,7 @@ pci_vtnet_netmap_writev(struct nm_desc *
return (len);
 }
 
-static inline int
+static __inline int
 pci_vtnet_netmap_readv(struct nm_desc *nmd, struct iovec *iov, int iovcnt)
 {
int len = 0;
@@ -548,6 +550,7 @@ pci_vtnet_netmap_rx(struct pci_vtnet_sof
 * No more packets, but still some avail ring
 * entries.  Interrupt if needed/appropriate.
 */
+   vq_retchain(vq);
vq_endchains(vq, 0);
return;
}
@@ -884,8 +887,9 @@ pci_vtnet_init(struct vmctx *ctx, struct
pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_TYPE_NET);
pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR);
 
-   /* Link is up if we managed to open tap device. */
-   sc->vsc_config.status = (opts == NULL || sc->vsc_tapfd >= 0);
+   /* Link is up if we managed to open tap device or vale port. */
+   sc->vsc_config.status = (opts == NULL || sc->vsc_tapfd >= 0 ||
+   sc->vsc_nmd != NULL);

/* use BAR 1 to map MSI-X table and PBA, if we're using MSI-X */
if (vi_intr_init(>vsc_vs, 1, fbsdrun_virtio_msix()))
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296828 - head/sys/arm64/arm64

2016-03-14 Thread Wojciech Macek
Author: wma
Date: Mon Mar 14 07:26:38 2016
New Revision: 296828
URL: https://svnweb.freebsd.org/changeset/base/296828

Log:
  pmap arm64: fixing pmap_invalidate_range
  
  It seems that if range within one page is given this page will not be
  invalidated at all. Clean it up.
  
  Submitted by:  Dominik Ermel 
  Obtained from: Semihalf
  Sponsored by:  Cavium
  Reviewed by:   wma, zbb
  Approved by:   cognet (mentor)
  Differential Revision: https://reviews.freebsd.org/D5569

Modified:
  head/sys/arm64/arm64/pmap.c

Modified: head/sys/arm64/arm64/pmap.c
==
--- head/sys/arm64/arm64/pmap.c Mon Mar 14 07:24:08 2016(r296827)
+++ head/sys/arm64/arm64/pmap.c Mon Mar 14 07:26:38 2016(r296828)
@@ -772,12 +772,10 @@ pmap_invalidate_range(pmap_t pmap, vm_of
vm_offset_t addr;
 
sched_pin();
-   sva >>= PAGE_SHIFT;
-   eva >>= PAGE_SHIFT;
__asm __volatile("dsb   sy");
-   for (addr = sva; addr < eva; addr++) {
+   for (addr = sva; addr < eva; addr += PAGE_SIZE) {
__asm __volatile(
-   "tlbi vaae1is, %0" : : "r"(addr));
+   "tlbi vaae1is, %0" : : "r"(addr >> PAGE_SHIFT));
}
__asm __volatile(
"dsb  sy\n"
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r296827 - head/sys/dev/usb/controller

2016-03-14 Thread Wojciech Macek
Author: wma
Date: Mon Mar 14 07:24:08 2016
New Revision: 296827
URL: https://svnweb.freebsd.org/changeset/base/296827

Log:
  Add xhci_mv.c
  
  Add missing xhci driver for Marvell systems.
  
  Submitted by:  Bartosz Szczepanek 
  Obtained from: Semihalf
  Sponsored by:  Stormshield
  Reviewed by:   hselasky
  Approved by:   cognet (mentor)
  Differential Revision: https://reviews.freebsd.org/D5031

Added:
  head/sys/dev/usb/controller/xhci_mv.c   (contents, props changed)

Added: head/sys/dev/usb/controller/xhci_mv.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/usb/controller/xhci_mv.c   Mon Mar 14 07:24:08 2016
(r296827)
@@ -0,0 +1,232 @@
+/*-
+ * Copyright (c) 2015 Semihalf.
+ * Copyright (c) 2015 Stormshield.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include "opt_bus.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#defineXHCI_HC_DEVSTR  "Marvell Integrated USB 3.0 controller"
+#defineXHCI_HC_VENDOR  "Marvell"
+
+#defineIS_DMA_32B  1
+
+static device_attach_t xhci_attach;
+static device_detach_t xhci_detach;
+
+static struct ofw_compat_data compat_data[] = {
+   {"marvell,armada-380-xhci", true},
+   {NULL,  false}
+};
+
+static int
+xhci_probe(device_t dev)
+{
+
+   if (!ofw_bus_status_okay(dev))
+   return (ENXIO);
+
+   if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data)
+   return (ENXIO);
+
+   device_set_desc(dev, XHCI_HC_DEVSTR);
+
+   return (BUS_PROBE_DEFAULT);
+}
+
+static int
+xhci_attach(device_t dev)
+{
+   struct xhci_softc *sc = device_get_softc(dev);
+   int err = 0, rid = 0;
+
+   sc->sc_bus.parent = dev;
+   sc->sc_bus.devices = sc->sc_devices;
+   sc->sc_bus.devices_max = XHCI_MAX_DEVICES;
+
+   sc->sc_io_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, ,
+   RF_ACTIVE);
+   if (sc->sc_io_res == NULL) {
+   device_printf(dev, "Failed to map memory\n");
+   xhci_detach(dev);
+   return (ENXIO);
+   }
+
+   sc->sc_io_tag = rman_get_bustag(sc->sc_io_res);
+   sc->sc_io_hdl = rman_get_bushandle(sc->sc_io_res);
+   sc->sc_io_size = rman_get_size(sc->sc_io_res);
+
+   sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, ,
+   RF_SHAREABLE | RF_ACTIVE);
+   if (sc->sc_irq_res == NULL) {
+   device_printf(dev, "Failed to allocate IRQ\n");
+   xhci_detach(dev);
+   return (ENXIO);
+   }
+
+   sc->sc_bus.bdev = device_add_child(dev, "usbus", -1);
+   if (sc->sc_bus.bdev == NULL) {
+   device_printf(dev, "Failed to add USB device\n");
+   xhci_detach(dev);
+   return (ENXIO);
+   }
+
+   device_set_ivars(sc->sc_bus.bdev, >sc_bus);
+
+   sprintf(sc->sc_vendor, XHCI_HC_VENDOR);
+   device_set_desc(sc->sc_bus.bdev, XHCI_HC_DEVSTR);
+
+   err = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE,
+   NULL, (driver_intr_t *)xhci_interrupt, sc, >sc_intr_hdl);
+   if (err != 0) {
+   device_printf(dev, "Failed to setup error IRQ, %d\n", err);
+   

svn commit: r296826 - in head/sys/arm: conf mv

2016-03-14 Thread Wojciech Macek
Author: wma
Date: Mon Mar 14 07:14:34 2016
New Revision: 296826
URL: https://svnweb.freebsd.org/changeset/base/296826

Log:
  Add support for USB3.0 on Armada38x
  
  This commit provides attachment of xhci-platform for A38X boards, making
  it possible to mount FreeBSD world from USB3.0 flash. 'xhci' device was
  added to files.mv (as optional) and kernconf of Armada38x was enhanced.
  
  It was also necessary to open programmable memory windows of USB3.0.
  fdt_win_setup needed improvement so it's able to traverse through
  children of internal-regs node.
  
  Submitted by:  Bartosz Szczepanek 
  Obtained from: Semihalf
  Sponsored by:  Stormshield
  Reviewed by:   hselasky
  Approved by:   cognet (mentor)
  Differential Revision: https://reviews.freebsd.org/D5031

Modified:
  head/sys/arm/conf/ARMADA38X
  head/sys/arm/mv/files.mv
  head/sys/arm/mv/mv_common.c
  head/sys/arm/mv/mvwin.h

Modified: head/sys/arm/conf/ARMADA38X
==
--- head/sys/arm/conf/ARMADA38X Mon Mar 14 07:05:41 2016(r296825)
+++ head/sys/arm/conf/ARMADA38X Mon Mar 14 07:14:34 2016(r296826)
@@ -71,6 +71,7 @@ devicempcore_timer
 # USB
 device usb
 device ehci
+device xhci
 device umass
 device scbus
 device pass

Modified: head/sys/arm/mv/files.mv
==
--- head/sys/arm/mv/files.mvMon Mar 14 07:05:41 2016(r296825)
+++ head/sys/arm/mv/files.mvMon Mar 14 07:14:34 2016(r296826)
@@ -27,5 +27,6 @@ dev/nand/nfc_mv.c optionalnand
 dev/mvs/mvs_soc.c  optionalmvs
 dev/uart/uart_dev_ns8250.c optionaluart
 dev/usb/controller/ehci_mv.c   optionalehci
+dev/usb/controller/xhci_mv.c   optionalxhci
 
 kern/kern_clocksource.cstandard

Modified: head/sys/arm/mv/mv_common.c
==
--- head/sys/arm/mv/mv_common.c Mon Mar 14 07:05:41 2016(r296825)
+++ head/sys/arm/mv/mv_common.c Mon Mar 14 07:14:34 2016(r296826)
@@ -79,6 +79,7 @@ static int win_eth_can_remap(int i);
 static int decode_win_cpu_valid(void);
 #endif
 static int decode_win_usb_valid(void);
+static int decode_win_usb3_valid(void);
 static int decode_win_eth_valid(void);
 static int decode_win_pcie_valid(void);
 static int decode_win_sata_valid(void);
@@ -93,6 +94,7 @@ static void decode_win_cpu_setup(void);
 static int decode_win_sdram_fixup(void);
 #endif
 static void decode_win_usb_setup(u_long);
+static void decode_win_usb3_setup(u_long);
 static void decode_win_eth_setup(u_long);
 static void decode_win_sata_setup(u_long);
 
@@ -100,6 +102,7 @@ static void decode_win_idma_setup(u_long
 static void decode_win_xor_setup(u_long);
 
 static void decode_win_usb_dump(u_long);
+static void decode_win_usb3_dump(u_long);
 static void decode_win_eth_dump(u_long base);
 static void decode_win_idma_dump(u_long base);
 static void decode_win_xor_dump(u_long base);
@@ -134,6 +137,7 @@ struct soc_node_spec {
 static struct soc_node_spec soc_nodes[] = {
{ "mrvl,ge", _win_eth_setup, _win_eth_dump },
{ "mrvl,usb-ehci", _win_usb_setup, _win_usb_dump },
+   { "marvell,armada-380-xhci", _win_usb3_setup, 
_win_usb3_dump },
{ "mrvl,sata", _win_sata_setup, NULL },
{ "mrvl,xor", _win_xor_setup, _win_xor_dump },
{ "mrvl,idma", _win_idma_setup, _win_idma_dump },
@@ -559,7 +563,7 @@ soc_decode_win(void)
if (!decode_win_cpu_valid() || !decode_win_usb_valid() ||
!decode_win_eth_valid() || !decode_win_idma_valid() ||
!decode_win_pcie_valid() || !decode_win_sata_valid() ||
-   !decode_win_xor_valid())
+   !decode_win_xor_valid() || !decode_win_usb3_valid())
return (EINVAL);
 
decode_win_cpu_setup();
@@ -567,7 +571,7 @@ soc_decode_win(void)
if (!decode_win_usb_valid() ||
!decode_win_eth_valid() || !decode_win_idma_valid() ||
!decode_win_pcie_valid() || !decode_win_sata_valid() ||
-   !decode_win_xor_valid())
+   !decode_win_xor_valid() || !decode_win_usb3_valid())
return (EINVAL);
 #endif
if (MV_DUMP_WIN)
@@ -600,6 +604,13 @@ WIN_REG_BASE_IDX_RD(win_usb, br, MV_WIN_
 WIN_REG_BASE_IDX_WR(win_usb, cr, MV_WIN_USB_CTRL)
 WIN_REG_BASE_IDX_WR(win_usb, br, MV_WIN_USB_BASE)
 
+#ifdef SOC_MV_ARMADA38X
+WIN_REG_BASE_IDX_RD(win_usb3, cr, MV_WIN_USB3_CTRL)
+WIN_REG_BASE_IDX_RD(win_usb3, br, MV_WIN_USB3_BASE)
+WIN_REG_BASE_IDX_WR(win_usb3, cr, MV_WIN_USB3_CTRL)
+WIN_REG_BASE_IDX_WR(win_usb3, br, MV_WIN_USB3_BASE)
+#endif
+
 WIN_REG_BASE_IDX_RD(win_eth, br, MV_WIN_ETH_BASE)
 WIN_REG_BASE_IDX_RD(win_eth, sz, MV_WIN_ETH_SIZE)
 WIN_REG_BASE_IDX_RD(win_eth, har, MV_WIN_ETH_REMAP)
@@ 

svn commit: r296825 - in head/sys: arm/conf arm/mv arm/mv/armada38x boot/fdt/dts/arm

2016-03-14 Thread Wojciech Macek
Author: wma
Date: Mon Mar 14 07:05:41 2016
New Revision: 296825
URL: https://svnweb.freebsd.org/changeset/base/296825

Log:
  Make MPIC compatible with ARM_INTRNG
  
  After ARM_INTRNG introduction, MPIC code needed several modifications:
  - IRQ resource and its handler added
  -  several DEVMETHODs of INTRNG interface implemented
  -  defines enhanced to ensure code compiles as well for AXP as for A38X
  - added dummy MSI_IRQ, ERR_IRQ defines for Armada38x
  - MPIC driver was added to files.armada38x, ARM_INTRNG option enabled in
kernconf file and regs of MPIC corrected in dts file.
  
  Instead of modifying Armada38X DTS, offsets to CPU registers defined in
  driver were changed. That required restoring 'reg' property of mpic node
  in ArmadaXP to state compliant with Linux DTS.
  
  Additionally, required ARM_INTRNG definitions were added to mv_common.c.
  
  Submitted by:  Bartosz Szczepanek 
  Obtained from: Semihalf
  Sponsored by:  Stormshield
  Reviewed by:   adrian, andrew, ian, skra
  Approved by:   cognet (mentor)
  Differential Revision: https://reviews.freebsd.org/D5030

Modified:
  head/sys/arm/conf/ARMADA38X
  head/sys/arm/mv/armada38x/files.armada38x
  head/sys/arm/mv/mpic.c
  head/sys/arm/mv/mvreg.h
  head/sys/boot/fdt/dts/arm/db78460.dts

Modified: head/sys/arm/conf/ARMADA38X
==
--- head/sys/arm/conf/ARMADA38X Mon Mar 14 06:30:37 2016(r296824)
+++ head/sys/arm/conf/ARMADA38X Mon Mar 14 07:05:41 2016(r296825)
@@ -23,6 +23,7 @@ options   SCHED_ULE   # ULE scheduler
 #options   SCHED_4BSD  # 4BSD scheduler
 
 optionsSMP
+optionsARM_INTRNG
 
 # Debugging
 #options   DEBUG

Modified: head/sys/arm/mv/armada38x/files.armada38x
==
--- head/sys/arm/mv/armada38x/files.armada38x   Mon Mar 14 06:30:37 2016
(r296824)
+++ head/sys/arm/mv/armada38x/files.armada38x   Mon Mar 14 07:05:41 2016
(r296825)
@@ -1,4 +1,5 @@
 # $FreeBSD$
+arm/mv/mpic.c  standard
 
 arm/mv/armada38x/armada38x.c   standard
 arm/mv/armada38x/armada38x_mp.coptional smp

Modified: head/sys/arm/mv/mpic.c
==
--- head/sys/arm/mv/mpic.c  Mon Mar 14 06:30:37 2016(r296824)
+++ head/sys/arm/mv/mpic.c  Mon Mar 14 07:05:41 2016(r296825)
@@ -33,14 +33,20 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_platform.h"
+
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
+#include 
 #include 
+#include 
 
 #include 
 #include 
@@ -48,11 +54,16 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
 #include 
 
+#ifdef ARM_INTRNG
+#include "pic_if.h"
+#endif
+
 #ifdef DEBUG
 #define debugf(fmt, args...) do { printf("%s(): ", __func__);  \
 printf(fmt,##args); } while (0)
@@ -60,46 +71,63 @@ __FBSDID("$FreeBSD$");
 #define debugf(fmt, args...)
 #endif
 
-#define MPIC_INT_ERR   4
-#define MPIC_INT_MSI   96
+#defineMPIC_INT_ERR4
+#defineMPIC_INT_MSI96
 
-#define IRQ_MASK   0x3ff
+#defineIRQ_MASK0x3ff
 
-#define MPIC_CTRL  0x0
-#define MPIC_SOFT_INT  0x4
-#define MPIC_SOFT_INT_DRBL1(1 << 5)
-#define MPIC_ERR_CAUSE 0x20
-#define MPIC_ISE   0x30
-#define MPIC_ICE   0x34
-
-
-#define MPIC_IN_DRBL   0x78
-#define MPIC_IN_DRBL_MASK  0x7c
-#define MPIC_CTP   0xb0
-#define MPIC_CTP   0xb0
-#define MPIC_IIACK 0xb4
-#define MPIC_ISM   0xb8
-#define MPIC_ICM   0xbc
-#define MPIC_ERR_MASK  0xec0
+#defineMPIC_CTRL   0x0
+#defineMPIC_SOFT_INT   0x4
+#defineMPIC_SOFT_INT_DRBL1 (1 << 5)
+#defineMPIC_ERR_CAUSE  0x20
+#defineMPIC_ISE0x30
+#defineMPIC_ICE0x34
+#defineMPIC_INT_CTL(irq)   (0x100 + (irq)*4)
+
+#defineMPIC_INT_IRQ_FIQ_MASK(cpuid)(0x101 << (cpuid))
+#defineMPIC_CTRL_NIRQS(ctrl)   (((ctrl) >> 2) & 0x3ff)
+
+#defineMPIC_IN_DRBL0x08
+#defineMPIC_IN_DRBL_MASK   0x0c
+#defineMPIC_PPI_CAUSE  0x10
+#defineMPIC_CTP0x40
+#defineMPIC_IIACK  0x44
+#defineMPIC_ISM0x48
+#defineMPIC_ICM0x4c
+#defineMPIC_ERR_MASK   0xe50
+
+#defineMPIC_PPI32
 
 struct mv_mpic_softc {
device_tsc_dev;
-   struct resource *   mpic_res[3];
+   struct resource *   mpic_res[4];

svn commit: r296824 - head/sys/arm/arm

2016-03-14 Thread Wojciech Macek
Author: wma
Date: Mon Mar 14 06:30:37 2016
New Revision: 296824
URL: https://svnweb.freebsd.org/changeset/base/296824

Log:
  Fix GIC interrupt decoding in INTRNG code
  
 Bug was already fixed in not-INTRNG code, it needs to be corrected
 here as well.  Source: https://reviews.freebsd.org/rS294422
  
  Submitted by:  Bartosz Szczepanek 
  Obtained from: Semihalf
  Sponsored by:  Stormshield
  Reviewed by:   cognet, wma
  Approved by:   cognet (mentor)
  Differential Revision: https://reviews.freebsd.org/D5029

Modified:
  head/sys/arm/arm/gic.c

Modified: head/sys/arm/arm/gic.c
==
--- head/sys/arm/arm/gic.c  Mon Mar 14 04:39:35 2016(r296823)
+++ head/sys/arm/arm/gic.c  Mon Mar 14 06:30:37 2016(r296824)
@@ -755,7 +755,7 @@ gic_map_fdt(struct arm_gic_softc *sc, st
 * The hardware only supports active-high-level or rising-edge.
 */
tripol = isrc->isrc_cells[2];
-   if (tripol & 0x0a) {
+   if (tripol & 0x0a && irq >= GIC_FIRST_SPI) {
device_printf(sc->gic_dev,
   "unsupported trigger/polarity configuration "
   "0x%02x\n",  tripol & 0x0f);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"