Re: svn commit: r278004 - head/sys/dev/drm2/radeon

2015-01-31 Thread Bruce Evans

On Sat, 31 Jan 2015, Dimitry Andric wrote:


Log:
 Constify a number of accesses in drm2's radeon drivers to avoid
 -Wcast-qual warnings.  No functional change.


This is much better than using __DECONST(), but still has bogus casts.


Modified: head/sys/dev/drm2/radeon/ni.c
==
--- head/sys/dev/drm2/radeon/ni.c   Sat Jan 31 22:07:38 2015
(r278003)
+++ head/sys/dev/drm2/radeon/ni.c   Sat Jan 31 22:18:52 2015
(r278004)
@@ -182,7 +182,7 @@ int ni_mc_load_microcode(struct radeon_d
{
const __be32 *fw_data;
u32 mem_type, running, blackout = 0;
-   u32 *io_mc_regs;
+   const u32 *io_mc_regs;
int i, ucode_size, regs_size;

if (!rdev->mc_fw)


Part of the correct change.


@@ -190,23 +190,23 @@ int ni_mc_load_microcode(struct radeon_d

switch (rdev->family) {
case CHIP_BARTS:
-   io_mc_regs = (u32 *)&barts_io_mc_regs;


Old bogus cast.  The array has const elements, but the pointer was
not even to non-const elements (it was to an array type).  A case was
used to break the warning about at least the non-const part of this.
But -Wcast-qual restored the warning.


+   io_mc_regs = (const u32 *)&barts_io_mc_regs;


New bogus cast.  Now that the pointer type actually matches the data
element type, no cast is needed.  However &barts_io_mc_regs isn't
actually a pointer to a data element.  It is a pointer to the array,
which has a different type.  The array type might actually be
important here, since the array is multi-dimensional and only a
pointer to an array could keep track of (most of) the dimensions.
However the code want a pointer to an element, since it wants to
treat the array as variable-size although its data is fixed-size,
and C's array indexing is no good except for fixed dimentsions.


ucode_size = BTC_MC_UCODE_SIZE;
regs_size = BTC_IO_MC_REGS_SIZE;


It keeps track of one of the dimensions here.  The other one is presumably
fixed at 2.  I forget whether it is the first or last dimension that is
not needed for array indexing.


break;


So the bogus cast was also explicitly converting from an array type to
its element type.  That conversion is normally done implicitly by
assignment because the types are compatible enough for this not to
break type safety.  However, perhaps it is not actually safe for
multi-dimensional arrays or arrays with const elements.  Really
strict type warnings would warn about implicitly and and explicitly
converting pointers to arrays.  Anyway, it is clearer to point to the
first element:

io_mc_regs = &barts_io_mc_regs[0][0];


case CHIP_TURKS:
-   io_mc_regs = (u32 *)&turks_io_mc_regs;
+   io_mc_regs = (const u32 *)&turks_io_mc_regs;
ucode_size = BTC_MC_UCODE_SIZE;
regs_size = BTC_IO_MC_REGS_SIZE;
break;


Similarly for the other bogus casts.

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


svn commit: r278020 - head/sys/boot/powerpc/kboot

2015-01-31 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Sun Feb  1 02:02:50 2015
New Revision: 278020
URL: https://svnweb.freebsd.org/changeset/base/278020

Log:
  Allow this to work with disks greater than 4 GB and with names not beginning
  with "s".

Modified:
  head/sys/boot/powerpc/kboot/host_syscall.S
  head/sys/boot/powerpc/kboot/host_syscall.h
  head/sys/boot/powerpc/kboot/hostdisk.c

Modified: head/sys/boot/powerpc/kboot/host_syscall.S
==
--- head/sys/boot/powerpc/kboot/host_syscall.S  Sun Feb  1 01:53:59 2015
(r278019)
+++ head/sys/boot/powerpc/kboot/host_syscall.S  Sun Feb  1 02:02:50 2015
(r278020)
@@ -1,3 +1,8 @@
+/*
+ * 
+ * $FreeBSD$
+ */
+
 #include 
 
 ENTRY(host_read)
@@ -16,7 +21,10 @@ ENTRY(host_write)
blr
 
 ENTRY(host_seek)
-   li %r0, 19 # SYS_lseek
+   mr %r4,%r5
+   mr %r5,%r6
+   mr %r6,%r7
+   li %r0, 140 # SYS_llseek
sc
blr
 

Modified: head/sys/boot/powerpc/kboot/host_syscall.h
==
--- head/sys/boot/powerpc/kboot/host_syscall.h  Sun Feb  1 01:53:59 2015
(r278019)
+++ head/sys/boot/powerpc/kboot/host_syscall.h  Sun Feb  1 02:02:50 2015
(r278020)
@@ -32,7 +32,7 @@
 
 ssize_t host_read(int fd, void *buf, size_t nbyte);
 ssize_t host_write(int fd, const void *buf, size_t nbyte);
-ssize_t host_seek(int fd, int offset, int whence);
+ssize_t host_seek(int fd, int64_t offset, int whence);
 int host_open(char *path, int flags, int mode);
 int host_close(int fd);
 void *host_mmap(void *addr, size_t len, int prot, int flags, int fd, int);

Modified: head/sys/boot/powerpc/kboot/hostdisk.c
==
--- head/sys/boot/powerpc/kboot/hostdisk.c  Sun Feb  1 01:53:59 2015
(r278019)
+++ head/sys/boot/powerpc/kboot/hostdisk.c  Sun Feb  1 02:02:50 2015
(r278020)
@@ -40,7 +40,7 @@ static int hostdisk_ioctl(struct open_fi
 static void hostdisk_print(int verbose);
 
 struct devsw hostdisk = {
-   "s",
+   "/dev",
DEVT_DISK,
hostdisk_init,
hostdisk_strategy,
@@ -67,8 +67,10 @@ hostdisk_strategy(void *devdata, int fla

pos = dblk * 512;
 
-   if (host_seek(desc->d_unit, pos, 0) < 0)
+   if (host_seek(desc->d_unit, pos, 0) < 0) {
+   printf("Seek error\n");
return (EIO);
+   }
n = host_read(desc->d_unit, buf, size);
 
if (n < 0)
@@ -82,22 +84,19 @@ static int
 hostdisk_open(struct open_file *f, ...)
 {
struct devdesc *desc;
-   char *path;
va_list vl;
 
va_start(vl, f);
desc = va_arg(vl, struct devdesc *);
va_end(vl);
 
-   path = malloc(strlen((char *)(desc->d_opendata)) + 6);
-   strcpy(path, "/dev/");
-   strcat(path, (char *)(desc->d_opendata));
+   desc->d_unit = host_open(desc->d_opendata, O_RDONLY, 0);
 
-   desc->d_unit = host_open(path, O_RDONLY, 0);
-   free(path);
-
-   if (desc->d_unit <= 0)
+   if (desc->d_unit <= 0) {
+   printf("hostdisk_open: couldn't open %s: %d\n",
+   desc->d_opendata, desc->d_unit);
return (ENOENT);
+   }
 
return (0);
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r278016 - head/contrib/libcxxrt

2015-01-31 Thread Dimitry Andric
Author: dim
Date: Sat Jan 31 23:31:45 2015
New Revision: 278016
URL: https://svnweb.freebsd.org/changeset/base/278016

Log:
  Import libcxxrt master 1cb607e89f6135bbc10f3d3b6fba1f983e258dcc.
  
  Interesting fixes:
  1cb607e   Correct gcc version check for __cxa_begin_catch() declaration
with or without throw()
  
  MFC after:3 days

Modified:
  head/contrib/libcxxrt/exception.cc
Directory Properties:
  head/contrib/libcxxrt/   (props changed)

Modified: head/contrib/libcxxrt/exception.cc
==
--- head/contrib/libcxxrt/exception.cc  Sat Jan 31 23:24:25 2015
(r278015)
+++ head/contrib/libcxxrt/exception.cc  Sat Jan 31 23:31:45 2015
(r278016)
@@ -673,7 +673,7 @@ static _Unwind_Reason_Code trace(struct 
  * If the failure happened by falling off the end of the stack without finding
  * a handler, prints a back trace before aborting.
  */
-#if __GNUC__ > 3 && __GNUC_MINOR__ > 2
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
 extern "C" void *__cxa_begin_catch(void *e) throw();
 #else
 extern "C" void *__cxa_begin_catch(void *e);
@@ -1191,7 +1191,7 @@ BEGIN_PERSONALITY_FUNCTION(__gxx_persona
  * pointer to the caught exception, which is either the adjusted pointer (for
  * C++ exceptions) of the unadjusted pointer (for foreign exceptions).
  */
-#if __GNUC__ > 3 && __GNUC_MINOR__ > 2
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
 extern "C" void *__cxa_begin_catch(void *e) throw()
 #else
 extern "C" void *__cxa_begin_catch(void *e)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r278012 - head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt

2015-01-31 Thread Mark Johnston
Author: markj
Date: Sat Jan 31 23:12:29 2015
New Revision: 278012
URL: https://svnweb.freebsd.org/changeset/base/278012

Log:
  Fix mktemp(1) usage.
  
  MFC after:1 week

Modified:
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh
==
--- 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh
Sat Jan 31 23:11:57 2015(r278011)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.corruptenv.ksh
Sat Jan 31 23:12:29 2015(r278012)
@@ -48,7 +48,7 @@ fi
 
 dtrace="$1"
 startdir="$PWD"
-dir=$(mktemp -td drtiXX)
+dir=$(mktemp -d -t drtiXX)
 if (( $? != 0 )); then
print -u2 'Could not create safe temporary directory'
exit 2
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r278011 - head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid

2015-01-31 Thread Mark Johnston
Author: markj
Date: Sat Jan 31 23:11:57 2015
New Revision: 278011
URL: https://svnweb.freebsd.org/changeset/base/278011

Log:
  Use syscall::exit instead of the nonexistent syscall::rexit.
  
  MFC after:1 week

Modified:
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.vfork.d

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.vfork.d
==
--- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.vfork.d
Sat Jan 31 23:08:29 2015(r278010)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.vfork.d
Sat Jan 31 23:11:57 2015(r278011)
@@ -54,7 +54,7 @@ pid$1:a.out:go:
exit(1);
 }
 
-syscall::rexit:entry
+syscall::exit:entry
 /pid == $1/
 {
exit(0);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r278010 - head/contrib/libcxxrt

2015-01-31 Thread Dimitry Andric
Author: dim
Date: Sat Jan 31 23:08:29 2015
New Revision: 278010
URL: https://svnweb.freebsd.org/changeset/base/278010

Log:
  Revert r256642, not only to reduce diffs against upstream libcxxrt, but
  also because it is the wrong approach: comparing typeinfo names deeply
  causes trouble if two loaded DSOs use independent types of the same
  name.
  
  In addition, this particular change was never merged to FreeBSD 10.x and
  9.x, so let's get rid of it before it ends up in an 11.x release.
  
  Discussed with:   theraven, joerg@netbsd

Modified:
  head/contrib/libcxxrt/typeinfo.cc

Modified: head/contrib/libcxxrt/typeinfo.cc
==
--- head/contrib/libcxxrt/typeinfo.cc   Sat Jan 31 23:02:27 2015
(r278009)
+++ head/contrib/libcxxrt/typeinfo.cc   Sat Jan 31 23:08:29 2015
(r278010)
@@ -35,23 +35,15 @@ type_info::~type_info() {}
 
 bool type_info::operator==(const type_info &other) const
 {
-#ifdef LIBCXXRT_MERGED_TYPEINFO
return __type_name == other.__type_name;
-#else
-   return __type_name == other.__type_name || strcmp(__type_name, 
other.__type_name) == 0;
-#endif
 }
 bool type_info::operator!=(const type_info &other) const
 {
-   return !operator==(other);
+   return __type_name != other.__type_name;
 }
 bool type_info::before(const type_info &other) const
 {
-#ifdef LIBCXXRT_MERGED_TYPEINFO
return __type_name < other.__type_name;
-#else
-   return strcmp(__type_name, other.__type_name) < 0;
-#endif
 }
 const char* type_info::name() const
 {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r278009 - in head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common: misc usdt

2015-01-31 Thread Mark Johnston
Author: markj
Date: Sat Jan 31 23:02:27 2015
New Revision: 278009
URL: https://svnweb.freebsd.org/changeset/base/278009

Log:
  Remove hard-coded invocations of gcc; use cc(1) instead.
  
  MFC after:1 week

Modified:
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.include.ksh
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noreap.ksh
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noreapring.ksh
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.reap.ksh

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.include.ksh
==
--- 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.include.ksh   
Sat Jan 31 22:56:38 2015(r278008)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/misc/tst.include.ksh   
Sat Jan 31 23:02:27 2015(r278009)
@@ -31,7 +31,6 @@ if [ $# != 1 ]; then
 fi
 
 dtrace=$1
-CC=/usr/bin/gcc
 CFLAGS=
 
 doit()
@@ -47,7 +46,7 @@ void
 main()
 {}
 EOF
-   if $CC $CFLAGS -o $cofile $cfile >/dev/null 2>&1; then
+   if cc $CFLAGS -o $cofile $cfile >/dev/null 2>&1; then
$dtrace -xerrtags -C -s /dev/stdin \
>/dev/null 2>$errfile <
@@ -67,11 +66,6 @@ EOF
rm -f $cofile $cfile 2>/dev/null
 }
 
-if [ ! -x $CC ]; then
-   echo "$0: bad compiler: $CC" >& 2
-   exit 1
-fi
-
 concurrency=`psrinfo | wc -l`
 let concurrency=concurrency*4
 let i=0

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noreap.ksh
==
--- 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noreap.ksh
Sat Jan 31 22:56:38 2015(r278008)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noreap.ksh
Sat Jan 31 23:02:27 2015(r278009)
@@ -51,7 +51,7 @@ provider test_prov {
 };
 EOF
 
-gcc -c test.c
+cc -c test.c
 if [ $? -ne 0 ]; then
print -u2 "failed to compile test.c"
exit 1
@@ -61,7 +61,7 @@ if [ $? -ne 0 ]; then
print -u2 "failed to create DOF"
exit 1
 fi
-gcc -o test test.o prov.o
+cc -o test test.o prov.o
 if [ $? -ne 0 ]; then
print -u2 "failed to link final executable"
exit 1

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noreapring.ksh
==
--- 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noreapring.ksh
Sat Jan 31 22:56:38 2015(r278008)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.noreapring.ksh
Sat Jan 31 23:02:27 2015(r278009)
@@ -51,7 +51,7 @@ provider test_prov {
 };
 EOF
 
-gcc -c test.c
+cc -c test.c
 if [ $? -ne 0 ]; then
print -u2 "failed to compile test.c"
exit 1
@@ -61,7 +61,7 @@ if [ $? -ne 0 ]; then
print -u2 "failed to create DOF"
exit 1
 fi
-gcc -o test test.o prov.o
+cc -o test test.o prov.o
 if [ $? -ne 0 ]; then
print -u2 "failed to link final executable"
exit 1

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.reap.ksh
==
--- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.reap.ksh  
Sat Jan 31 22:56:38 2015(r278008)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.reap.ksh  
Sat Jan 31 23:02:27 2015(r278009)
@@ -51,7 +51,7 @@ provider test_prov {
 };
 EOF
 
-gcc -c test.c
+cc -c test.c
 if [ $? -ne 0 ]; then
print -u2 "failed to compile test.c"
exit 1
@@ -61,7 +61,7 @@ if [ $? -ne 0 ]; then
print -u2 "failed to create DOF"
exit 1
 fi
-gcc -o test test.o prov.o
+cc -o test test.o prov.o
 if [ $? -ne 0 ]; then
print -u2 "failed to link final executable"
exit 1
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r278008 - head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt

2015-01-31 Thread Mark Johnston
Author: markj
Date: Sat Jan 31 22:56:38 2015
New Revision: 278008
URL: https://svnweb.freebsd.org/changeset/base/278008

Log:
  Remove a makefile that isn't present upstream.
  
  MFC after:1 week

Deleted:
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/Makefile
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r278007 - head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting

2015-01-31 Thread Mark Johnston
Author: markj
Date: Sat Jan 31 22:53:18 2015
New Revision: 278007
URL: https://svnweb.freebsd.org/changeset/base/278007

Log:
  Fix a number of DTrace scripting tests:
  * Avoid hard-coding program paths.
  * Use -x when searching for oneself in ps(1) output.
  * Use the correct keyword (egid instead of pgid) in tst.egid.ksh.
  
  MFC after:1 week

Modified:
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.D_MACRO_UNUSED.overflow.ksh
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.arguments.ksh
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.euid.ksh
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.gid.ksh
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.ppid.ksh
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.projid.ksh
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.sid.ksh
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.stringmacro.ksh
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.taskid.ksh
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.uid.ksh

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.D_MACRO_UNUSED.overflow.ksh
==
--- 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.D_MACRO_UNUSED.overflow.ksh
  Sat Jan 31 22:38:43 2015(r278006)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.D_MACRO_UNUSED.overflow.ksh
  Sat Jan 31 22:53:18 2015(r278007)
@@ -41,7 +41,7 @@ if [ $# != 1 ]; then
 fi
 
 dtrace=$1
-bname=`/bin/basename $0`
+bname=`basename $0`
 dfilename=/var/tmp/$bname.$$.d
 
 ## Create .d file

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.arguments.ksh
==
--- 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.arguments.ksh
Sat Jan 31 22:38:43 2015(r278006)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.arguments.ksh
Sat Jan 31 22:53:18 2015(r278007)
@@ -42,7 +42,7 @@ fi
 
 dtrace=$1
 
-bname=`/usr/bin/basename $0`
+bname=`basename $0`
 
 dfilename=/var/tmp/$bname.$$
 

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh
==
--- 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh 
Sat Jan 31 22:38:43 2015(r278006)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.egid.ksh 
Sat Jan 31 22:53:18 2015(r278007)
@@ -43,7 +43,7 @@ if [ $# != 1 ]; then
 fi
 
 dtrace=$1
-bname=`/usr/bin/basename $0`
+bname=`basename $0`
 dfilename=/var/tmp/$bname.$$.d
 
 ## Create .d file
@@ -77,7 +77,7 @@ fi
 
 #Get the groupid of the calling process using ps
 
-groupid=`ps -o pid,pgid | grep "$$ " | awk '{print $2}' 2>/dev/null`
+groupid=`ps -x -o pid,egid | grep "$$ " | awk '{print $2}' 2>/dev/null`
 if [ $? -ne 0 ]; then
print -u2 "unable to get uid of the current process with pid = $$"
exit 1
@@ -93,5 +93,5 @@ fi
 
 #Cleanup leftovers
 
-/bin/rm -f $dfilename
+rm -f $dfilename
 exit 0

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.euid.ksh
==
--- 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.euid.ksh 
Sat Jan 31 22:38:43 2015(r278006)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.euid.ksh 
Sat Jan 31 22:53:18 2015(r278007)
@@ -41,7 +41,7 @@ if [ $# != 1 ]; then
 fi
 
 dtrace=$1
-bname=`/bin/basename $0`
+bname=`basename $0`
 dfilename=/var/tmp/$bname.$$
 
 ## Create .d file
@@ -69,7 +69,7 @@ EOF
 
 chmod 555 $dfilename
 
-userid=`ps -o pid,uid | grep "$$ " | awk '{print $2}' 2>/dev/null`
+userid=`ps -x -o pid,uid | grep "$$ " | awk '{print $2}' 2>/dev/null`
 if [ $? -ne 0 ]; then
print -u2 "unable to get uid of the current process with pid = $$"
exit 1
@@ -82,5 +82,5 @@ if [ $? -ne 0 ]; then
exit 1
 fi
 
-#/bin/rm -f $dfilename
+rm -f $dfilename
 exit 0

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.gid.ksh
==
--- 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.gid.ksh  
Sat Jan 31 22:38:43 2015(r278006)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scripting/tst.gid.ksh  
Sat Jan 31 22:53:18 2015(r278007)
@@ -41,7 +41,7 @@ i

svn commit: r278006 - head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc

2015-01-31 Thread Mark Johnston
Author: markj
Date: Sat Jan 31 22:38:43 2015
New Revision: 278006
URL: https://svnweb.freebsd.org/changeset/base/278006

Log:
  Fix some proc provider tests:
  * Avoid hard-coding program paths, except when it's necessary in order to
override the use of a shell builtin.
  * Translate struct proc through psinfo_t so that we can access process
arguments via the pr_psargs field of psinfo_t.
  * Replace uses of pstop and prun with kill(1).
  
  MFC after:1 week

Modified:
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.discard.ksh
  
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.exitkilled.ksh
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.signal.ksh

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.discard.ksh
==
--- 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.discard.ksh   
Sat Jan 31 22:26:39 2015(r278005)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.discard.ksh   
Sat Jan 31 22:38:43 2015(r278006)
@@ -37,7 +37,8 @@ script()
$dtrace -s /dev/stdin pr_psargs == "$longsleep" && args[2] == SIGHUP/
+   xlate(args[1])->pr_psargs == "$longsleep" &&
+   args[2] == SIGHUP/
{
exit(0);
}
@@ -48,7 +49,7 @@ killer()
 {
while true; do
sleep 1
-   /usr/bin/kill -HUP $child
+   kill -HUP $child
done
 }
 
@@ -58,7 +59,7 @@ if [ $# != 1 ]; then
 fi
 
 dtrace=$1
-longsleep="/usr/bin/sleep 1"
+longsleep="/bin/sleep 1"
 
 /usr/bin/nohup $longsleep &
 child=$!

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.exitkilled.ksh
==
--- 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.exitkilled.ksh
Sat Jan 31 22:26:39 2015(r278005)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.exitkilled.ksh
Sat Jan 31 22:38:43 2015(r278006)
@@ -48,7 +48,7 @@ sleeper()
 {
while true; do
$longsleep &
-   /usr/bin/sleep 1
+   sleep 1
kill -9 $!
done
 }
@@ -59,7 +59,7 @@ if [ $# != 1 ]; then
 fi
 
 dtrace=$1
-longsleep="/usr/bin/sleep 1"
+longsleep="/bin/sleep 1"
 
 sleeper &
 child=$!
@@ -67,9 +67,9 @@ child=$!
 script
 status=$?
 
-pstop $child
+kill -STOP $child
 pkill -P $child
 kill $child
-prun $child
+kill -CONT $child
 
 exit $status

Modified: 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.signal.ksh
==
--- 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.signal.ksh
Sat Jan 31 22:26:39 2015(r278005)
+++ 
head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/proc/tst.signal.ksh
Sat Jan 31 22:38:43 2015(r278006)
@@ -37,7 +37,8 @@ script()
$dtrace -s /dev/stdin pr_psargs == "$longsleep" && args[2] == SIGUSR1/
+   xlate(args[1])->pr_psargs == "$longsleep" &&
+   args[2] == SIGUSR1/
{
/*
 * This is guaranteed to not race with signal-handle.
@@ -58,7 +59,7 @@ sleeper()
while true; do
$longsleep &
sleep 1
-   /usr/bin/kill -USR1 $!
+   kill -USR1 $!
done
 }
 
@@ -68,7 +69,7 @@ if [ $# != 1 ]; then
 fi
 
 dtrace=$1
-longsleep="/usr/bin/sleep 1"
+longsleep="/bin/sleep 1"
 
 sleeper &
 child=$!
@@ -76,9 +77,9 @@ child=$!
 script
 status=$?
 
-pstop $child
+kill -STOP $child
 pkill -P $child
 kill $child
-prun $child
+kill -CONT $child
 
 exit $status
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r278004 - head/sys/dev/drm2/radeon

2015-01-31 Thread Dimitry Andric
Author: dim
Date: Sat Jan 31 22:18:52 2015
New Revision: 278004
URL: https://svnweb.freebsd.org/changeset/base/278004

Log:
  Constify a number of accesses in drm2's radeon drivers to avoid
  -Wcast-qual warnings.  No functional change.
  
  Reviewed by:  dumbbell
  MFC after:3 days
  Differential Revision: https://reviews.freebsd.org/D1727

Modified:
  head/sys/dev/drm2/radeon/ni.c
  head/sys/dev/drm2/radeon/si.c

Modified: head/sys/dev/drm2/radeon/ni.c
==
--- head/sys/dev/drm2/radeon/ni.c   Sat Jan 31 22:07:38 2015
(r278003)
+++ head/sys/dev/drm2/radeon/ni.c   Sat Jan 31 22:18:52 2015
(r278004)
@@ -182,7 +182,7 @@ int ni_mc_load_microcode(struct radeon_d
 {
const __be32 *fw_data;
u32 mem_type, running, blackout = 0;
-   u32 *io_mc_regs;
+   const u32 *io_mc_regs;
int i, ucode_size, regs_size;
 
if (!rdev->mc_fw)
@@ -190,23 +190,23 @@ int ni_mc_load_microcode(struct radeon_d
 
switch (rdev->family) {
case CHIP_BARTS:
-   io_mc_regs = (u32 *)&barts_io_mc_regs;
+   io_mc_regs = (const u32 *)&barts_io_mc_regs;
ucode_size = BTC_MC_UCODE_SIZE;
regs_size = BTC_IO_MC_REGS_SIZE;
break;
case CHIP_TURKS:
-   io_mc_regs = (u32 *)&turks_io_mc_regs;
+   io_mc_regs = (const u32 *)&turks_io_mc_regs;
ucode_size = BTC_MC_UCODE_SIZE;
regs_size = BTC_IO_MC_REGS_SIZE;
break;
case CHIP_CAICOS:
default:
-   io_mc_regs = (u32 *)&caicos_io_mc_regs;
+   io_mc_regs = (const u32 *)&caicos_io_mc_regs;
ucode_size = BTC_MC_UCODE_SIZE;
regs_size = BTC_IO_MC_REGS_SIZE;
break;
case CHIP_CAYMAN:
-   io_mc_regs = (u32 *)&cayman_io_mc_regs;
+   io_mc_regs = (const u32 *)&cayman_io_mc_regs;
ucode_size = CAYMAN_MC_UCODE_SIZE;
regs_size = BTC_IO_MC_REGS_SIZE;
break;

Modified: head/sys/dev/drm2/radeon/si.c
==
--- head/sys/dev/drm2/radeon/si.c   Sat Jan 31 22:07:38 2015
(r278003)
+++ head/sys/dev/drm2/radeon/si.c   Sat Jan 31 22:18:52 2015
(r278004)
@@ -182,7 +182,7 @@ static int si_mc_load_microcode(struct r
 {
const __be32 *fw_data;
u32 running, blackout = 0;
-   u32 *io_mc_regs;
+   const u32 *io_mc_regs;
int i, ucode_size, regs_size;
 
if (!rdev->mc_fw)
@@ -190,18 +190,18 @@ static int si_mc_load_microcode(struct r
 
switch (rdev->family) {
case CHIP_TAHITI:
-   io_mc_regs = (u32 *)&tahiti_io_mc_regs;
+   io_mc_regs = (const u32 *)&tahiti_io_mc_regs;
ucode_size = SI_MC_UCODE_SIZE;
regs_size = TAHITI_IO_MC_REGS_SIZE;
break;
case CHIP_PITCAIRN:
-   io_mc_regs = (u32 *)&pitcairn_io_mc_regs;
+   io_mc_regs = (const u32 *)&pitcairn_io_mc_regs;
ucode_size = SI_MC_UCODE_SIZE;
regs_size = TAHITI_IO_MC_REGS_SIZE;
break;
case CHIP_VERDE:
default:
-   io_mc_regs = (u32 *)&verde_io_mc_regs;
+   io_mc_regs = (const u32 *)&verde_io_mc_regs;
ucode_size = SI_MC_UCODE_SIZE;
regs_size = TAHITI_IO_MC_REGS_SIZE;
break;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r278001 - in head/sys: amd64/amd64 amd64/ia32 arm/arm i386/i386 mips/mips powerpc/powerpc sparc64/sparc64 sys

2015-01-31 Thread Konstantin Belousov
Author: kib
Date: Sat Jan 31 21:43:46 2015
New Revision: 278001
URL: https://svnweb.freebsd.org/changeset/base/278001

Log:
  Do not qualify the mcontext_t *mcp argument for set_mcontext(9) as
  const.  On x86, even after the machine context is supposedly read into
  the struct ucontext, lazy FPU state save code might only mark the FPU
  data as hardware-owned.  Later, set_fpcontext() needs to fetch the
  state from hardware, modifying the *mcp.
  
  The set_mcontext(9) is called from sigreturn(2) and setcontext(2)
  implementations and old create_thread(2) interface, which throw the
  *mcp out after the set_mcontext() call.
  
  Reported by:  dim
  Discussed with:   jhb
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/amd64/amd64/machdep.c
  head/sys/amd64/ia32/ia32_signal.c
  head/sys/arm/arm/machdep.c
  head/sys/i386/i386/machdep.c
  head/sys/mips/mips/freebsd32_machdep.c
  head/sys/mips/mips/pm_machdep.c
  head/sys/powerpc/powerpc/exec_machdep.c
  head/sys/sparc64/sparc64/machdep.c
  head/sys/sys/ucontext.h

Modified: head/sys/amd64/amd64/machdep.c
==
--- head/sys/amd64/amd64/machdep.c  Sat Jan 31 21:31:53 2015
(r278000)
+++ head/sys/amd64/amd64/machdep.c  Sat Jan 31 21:43:46 2015
(r278001)
@@ -157,7 +157,7 @@ extern u_int64_t hammer_time(u_int64_t, 
 static void cpu_startup(void *);
 static void get_fpcontext(struct thread *td, mcontext_t *mcp,
 char *xfpusave, size_t xfpusave_len);
-static int  set_fpcontext(struct thread *td, const mcontext_t *mcp,
+static int  set_fpcontext(struct thread *td, mcontext_t *mcp,
 char *xfpustate, size_t xfpustate_len);
 SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL);
 
@@ -2480,7 +2480,7 @@ get_mcontext(struct thread *td, mcontext
  * touch the cs selector.
  */
 int
-set_mcontext(struct thread *td, const mcontext_t *mcp)
+set_mcontext(struct thread *td, mcontext_t *mcp)
 {
struct pcb *pcb;
struct trapframe *tp;
@@ -2567,7 +2567,7 @@ get_fpcontext(struct thread *td, mcontex
 }
 
 static int
-set_fpcontext(struct thread *td, const mcontext_t *mcp, char *xfpustate,
+set_fpcontext(struct thread *td, mcontext_t *mcp, char *xfpustate,
 size_t xfpustate_len)
 {
struct savefpu *fpstate;

Modified: head/sys/amd64/ia32/ia32_signal.c
==
--- head/sys/amd64/ia32/ia32_signal.c   Sat Jan 31 21:31:53 2015
(r278000)
+++ head/sys/amd64/ia32/ia32_signal.c   Sat Jan 31 21:43:46 2015
(r278001)
@@ -118,7 +118,7 @@ ia32_get_fpcontext(struct thread *td, st
 }
 
 static int
-ia32_set_fpcontext(struct thread *td, const struct ia32_mcontext *mcp,
+ia32_set_fpcontext(struct thread *td, struct ia32_mcontext *mcp,
 char *xfpustate, size_t xfpustate_len)
 {
int error;
@@ -197,7 +197,7 @@ ia32_get_mcontext(struct thread *td, str
  * touch the cs selector.
  */
 static int
-ia32_set_mcontext(struct thread *td, const struct ia32_mcontext *mcp)
+ia32_set_mcontext(struct thread *td, struct ia32_mcontext *mcp)
 {
struct trapframe *tp;
char *xfpustate;

Modified: head/sys/arm/arm/machdep.c
==
--- head/sys/arm/arm/machdep.c  Sat Jan 31 21:31:53 2015(r278000)
+++ head/sys/arm/arm/machdep.c  Sat Jan 31 21:43:46 2015(r278001)
@@ -700,7 +700,7 @@ get_mcontext(struct thread *td, mcontext
  * touch the cs selector.
  */
 int
-set_mcontext(struct thread *td, const mcontext_t *mcp)
+set_mcontext(struct thread *td, mcontext_t *mcp)
 {
struct trapframe *tf = td->td_frame;
const __greg_t *gr = mcp->__gregs;

Modified: head/sys/i386/i386/machdep.c
==
--- head/sys/i386/i386/machdep.cSat Jan 31 21:31:53 2015
(r278000)
+++ head/sys/i386/i386/machdep.cSat Jan 31 21:43:46 2015
(r278001)
@@ -195,7 +195,7 @@ static void cpu_startup(void *);
 static void fpstate_drop(struct thread *td);
 static void get_fpcontext(struct thread *td, mcontext_t *mcp,
 char *xfpusave, size_t xfpusave_len);
-static int  set_fpcontext(struct thread *td, const mcontext_t *mcp,
+static int  set_fpcontext(struct thread *td, mcontext_t *mcp,
 char *xfpustate, size_t xfpustate_len);
 #ifdef CPU_ENABLE_SSE
 static void set_fpregs_xmm(struct save87 *, struct savexmm *);
@@ -3856,7 +3856,7 @@ get_mcontext(struct thread *td, mcontext
  * touch the cs selector.
  */
 int
-set_mcontext(struct thread *td, const mcontext_t *mcp)
+set_mcontext(struct thread *td, mcontext_t *mcp)
 {
struct trapframe *tp;
char *xfpustate;
@@ -3934,7 +3934,7 @@ get_fpcontext(struct thread *td, mcontex
 }
 
 static int
-set_fpcontext(struct thread *td, const mcontext_t *mcp, char *xfpustate,
+set_fpcontext(struct thread *td, mcontext_t *mcp, c

svn commit: r278000 - head/sys/fs/tmpfs

2015-01-31 Thread Konstantin Belousov
Author: kib
Date: Sat Jan 31 21:31:53 2015
New Revision: 278000
URL: https://svnweb.freebsd.org/changeset/base/278000

Log:
  Update directory times immediately after an entry is created or
  removed.  Postponing it until tmpfs_getattr() is called causes
  discordant values reported for file times vs. directory times.
  
  Reported and tested by:   madpilot
  Sponsored by: The FreeBSD Foundation
  MFC after:1 week

Modified:
  head/sys/fs/tmpfs/tmpfs_subr.c

Modified: head/sys/fs/tmpfs/tmpfs_subr.c
==
--- head/sys/fs/tmpfs/tmpfs_subr.c  Sat Jan 31 20:49:30 2015
(r277999)
+++ head/sys/fs/tmpfs/tmpfs_subr.c  Sat Jan 31 21:31:53 2015
(r278000)
@@ -991,6 +991,7 @@ tmpfs_dir_attach(struct vnode *vp, struc
dnode->tn_size += sizeof(struct tmpfs_dirent);
dnode->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED | \
TMPFS_NODE_MODIFIED;
+   tmpfs_update(vp);
 }
 
 /*
@@ -1036,6 +1037,7 @@ tmpfs_dir_detach(struct vnode *vp, struc
dnode->tn_size -= sizeof(struct tmpfs_dirent);
dnode->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_CHANGED | \
TMPFS_NODE_MODIFIED;
+   tmpfs_update(vp);
 }
 
 void
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277998 - head/sys/arm/include

2015-01-31 Thread Andrew Turner
Author: andrew
Date: Sat Jan 31 19:55:12 2015
New Revision: 277998
URL: https://svnweb.freebsd.org/changeset/base/277998

Log:
  Stop using load-multiple with lr and pc. This has been deprecated in ARMv7
  and clang 3.6 warns about it. As this is used in libc and we build it with
  -Werror this warning becomes an error stopping the build.

Modified:
  head/sys/arm/include/profile.h

Modified: head/sys/arm/include/profile.h
==
--- head/sys/arm/include/profile.h  Sat Jan 31 19:42:08 2015
(r277997)
+++ head/sys/arm/include/profile.h  Sat Jan 31 19:55:12 2015
(r277998)
@@ -86,7 +86,12 @@ typedef u_long   fptrdiff_t;
/*  \
 * Restore registers that were trashed during mcount\
 */ \
-   __asm__("ldmfd  sp!, {r0-r3, lr, pc}");
+   __asm__("ldmfd  sp!, {r0-r3, lr}"); \
+   /*  \
+* Return to the caller. Loading lr and pc in one instruction   \
+* is deprecated on ARMv7 so we need this on it's own.  \
+*/ \
+   __asm__("ldmfd  sp!, {pc}");
 void bintr(void);
 void btrap(void);
 void eintr(void);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277997 - head/sys/boot/powerpc/kboot

2015-01-31 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Sat Jan 31 19:42:08 2015
New Revision: 277997
URL: https://svnweb.freebsd.org/changeset/base/277997

Log:
  Relocate kernel to high address space (a static + 64 MB for now) to avoid
  conflicts with the Linux host kernel. This lets you kexec an unmodified
  GENERIC64.

Modified:
  head/sys/boot/powerpc/kboot/conf.c
  head/sys/boot/powerpc/kboot/kerneltramp.S
  head/sys/boot/powerpc/kboot/main.c
  head/sys/boot/powerpc/kboot/ppc64_elf_freebsd.c

Modified: head/sys/boot/powerpc/kboot/conf.c
==
--- head/sys/boot/powerpc/kboot/conf.c  Sat Jan 31 19:32:14 2015
(r277996)
+++ head/sys/boot/powerpc/kboot/conf.c  Sat Jan 31 19:42:08 2015
(r277997)
@@ -115,7 +115,3 @@ struct console *consoles[] = {
 NULL
 };
 
-/*
- * reloc - our load address
- */
-vm_offset_treloc = RELOC;

Modified: head/sys/boot/powerpc/kboot/kerneltramp.S
==
--- head/sys/boot/powerpc/kboot/kerneltramp.S   Sat Jan 31 19:32:14 2015
(r277996)
+++ head/sys/boot/powerpc/kboot/kerneltramp.S   Sat Jan 31 19:42:08 2015
(r277997)
@@ -9,6 +9,7 @@
  * to the absolute address 0x60. Here we implement a loop waiting on the 
release
  * of a lock by the kernel at 0x40.
  * 
+ * $FreeBSD$
  */
 
 #include 
@@ -39,7 +40,6 @@ CNAME(kerneltramp):
mflr%r8
mtlr%r9
lwz %r3,0(%r8)
-   ld  %r3,0(%r3)  /* Resolve function descriptor */
mtctr   %r3
lwz %r3,4(%r8)
lwz %r4,8(%r8)

Modified: head/sys/boot/powerpc/kboot/main.c
==
--- head/sys/boot/powerpc/kboot/main.c  Sat Jan 31 19:32:14 2015
(r277996)
+++ head/sys/boot/powerpc/kboot/main.c  Sat Jan 31 19:42:08 2015
(r277997)
@@ -48,6 +48,7 @@ ssize_t kboot_copyin(const void *src, vm
 ssize_t kboot_copyout(vm_offset_t src, void *dest, const size_t len);
 ssize_t kboot_readin(const int fd, vm_offset_t dest, const size_t len);
 int kboot_autoload(void);
+uint64_t kboot_loadaddr(u_int type, void *data, uint64_t addr);
 int kboot_setcurrdev(struct env_var *ev, int flags, const void *value);
 
 extern int command_fdt_internal(int argc, char *argv[]);
@@ -116,6 +117,7 @@ main(int argc, const char **argv)
archsw.arch_copyout = kboot_copyout;
archsw.arch_readin = kboot_readin;
archsw.arch_autoload = kboot_autoload;
+   archsw.arch_loadaddr = kboot_loadaddr;
 
printf("\n");
printf("%s, Revision %s\n", bootprog_name, bootprog_rev);
@@ -282,6 +284,22 @@ kboot_autoload(void)
return (0);
 }
 
+uint64_t
+kboot_loadaddr(u_int type, void *data, uint64_t addr)
+{
+   /*
+* Need to stay out of the way of Linux. /chosen/linux,kernel-end does
+* a better job here, but use a fixed offset for now.
+*/
+
+   if (type == LOAD_ELF)
+   addr = roundup(addr, PAGE_SIZE);
+   else
+   addr += 64*1024*1024; /* Stay out of the way of Linux */
+
+   return (addr);
+}
+
 void
 _start(int argc, const char **argv, char **env)
 {

Modified: head/sys/boot/powerpc/kboot/ppc64_elf_freebsd.c
==
--- head/sys/boot/powerpc/kboot/ppc64_elf_freebsd.c Sat Jan 31 19:32:14 
2015(r277996)
+++ head/sys/boot/powerpc/kboot/ppc64_elf_freebsd.c Sat Jan 31 19:42:08 
2015(r277997)
@@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$");
 #include "host_syscall.h"
 
 extern charend[];
-extern vm_offset_t reloc;  /* From /conf.c */
 extern void*kerneltramp;
 extern size_t  szkerneltramp;
 extern int nkexec_segments;
@@ -68,17 +67,22 @@ ppc64_elf_exec(struct preloaded_file *fp
Elf_Ehdr*e;
int error;
uint32_t*trampoline;
-   vm_offset_t trampolinebase = 96*1024*1024; /* XXX */
+   uint64_tentry;
+   vm_offset_t trampolinebase;
 
if ((fmp = file_findmetadata(fp, MODINFOMD_ELFHDR)) == NULL) {
return(EFTYPE);
}
e = (Elf_Ehdr *)&fmp->md_data;
+
+   /* Figure out where to put it */
+   trampolinebase = archsw.arch_loadaddr(LOAD_RAW, NULL, 0);

-   /* Handle function descriptor */
+   /* Set up interesting values in function descriptor */
trampoline = malloc(szkerneltramp);
memcpy(trampoline, &kerneltramp, szkerneltramp);
-   trampoline[2] = e->e_entry;
+   archsw.arch_copyout(e->e_entry + elf64_relocation_offset, &entry, 8);
+   trampoline[2] = entry + elf64_relocation_offset;
trampoline[4] = 0; /* Phys. mem offset */
trampoline[5] = 0; /* OF entry point */
 
@@ -88,7 +92,8 @@ ppc64_elf_exec(struct preloaded_file *fp
trampo

svn commit: r277996 - in head/sys: arm/allwinner arm/altera/socfpga arm/broadcom/bcm2835 arm/freescale/imx arm/freescale/vybrid arm/lpc arm/rockchip arm/samsung/exynos arm/ti arm/xilinx arm/xscale/...

2015-01-31 Thread Luiz Otavio O Souza
Author: loos
Date: Sat Jan 31 19:32:14 2015
New Revision: 277996
URL: https://svnweb.freebsd.org/changeset/base/277996

Log:
  Implement GPIO_GET_BUS() method for all GPIO drivers.
  
  Add helper routines to deal with attach and detach of gpiobus and gpioc
  devices that are common to all drivers.

Modified:
  head/sys/arm/allwinner/a10_gpio.c
  head/sys/arm/altera/socfpga/socfpga_gpio.c
  head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c
  head/sys/arm/freescale/imx/imx_gpio.c
  head/sys/arm/freescale/vybrid/vf_gpio.c
  head/sys/arm/lpc/lpc_gpio.c
  head/sys/arm/rockchip/rk30xx_gpio.c
  head/sys/arm/samsung/exynos/exynos5_pad.c
  head/sys/arm/ti/ti_gpio.c
  head/sys/arm/ti/ti_gpio.h
  head/sys/arm/xilinx/zy7_gpio.c
  head/sys/arm/xscale/ixp425/avila_gpio.c
  head/sys/arm/xscale/ixp425/cambria_gpio.c
  head/sys/dev/gpio/gpiobus.c
  head/sys/dev/gpio/gpiobusvar.h
  head/sys/mips/atheros/ar71xx_gpio.c
  head/sys/mips/atheros/ar71xx_gpiovar.h
  head/sys/mips/cavium/octeon_gpio.c
  head/sys/mips/cavium/octeon_gpiovar.h
  head/sys/mips/rt305x/rt305x_gpio.c
  head/sys/mips/rt305x/rt305x_gpiovar.h

Modified: head/sys/arm/allwinner/a10_gpio.c
==
--- head/sys/arm/allwinner/a10_gpio.c   Sat Jan 31 19:29:28 2015
(r277995)
+++ head/sys/arm/allwinner/a10_gpio.c   Sat Jan 31 19:32:14 2015
(r277996)
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -75,6 +76,7 @@ __FBSDID("$FreeBSD$");
 
 struct a10_gpio_softc {
device_tsc_dev;
+   device_tsc_busdev;
struct mtx  sc_mtx;
struct resource *   sc_mem_res;
struct resource *   sc_irq_res;
@@ -217,6 +219,16 @@ a10_gpio_pin_configure(struct a10_gpio_s
A10_GPIO_UNLOCK(sc);
 }
 
+static device_t
+a10_gpio_get_bus(device_t dev)
+{
+   struct a10_gpio_softc *sc;
+
+   sc = device_get_softc(dev);
+
+   return (sc->sc_busdev);
+}
+
 static int
 a10_gpio_pin_max(device_t dev, int *maxpin)
 {
@@ -458,13 +470,12 @@ a10_gpio_attach(device_t dev)
sc->sc_gpio_pins[i].gp_flags = a10_gpio_func_flag(func);
}
sc->sc_gpio_npins = i;
-
-   device_add_child(dev, "gpioc", -1);
-   device_add_child(dev, "gpiobus", -1);
-
a10_gpio_sc = sc;
+   sc->sc_busdev = gpiobus_attach_bus(dev);
+   if (sc->sc_busdev == NULL)
+   goto fail;
 
-   return (bus_generic_attach(dev));
+   return (0);
 
 fail:
if (sc->sc_irq_res)
@@ -490,6 +501,7 @@ static device_method_t a10_gpio_methods[
DEVMETHOD(device_detach,a10_gpio_detach),
 
/* GPIO protocol */
+   DEVMETHOD(gpio_get_bus, a10_gpio_get_bus),
DEVMETHOD(gpio_pin_max, a10_gpio_pin_max),
DEVMETHOD(gpio_pin_getname, a10_gpio_pin_getname),
DEVMETHOD(gpio_pin_getflags,a10_gpio_pin_getflags),

Modified: head/sys/arm/altera/socfpga/socfpga_gpio.c
==
--- head/sys/arm/altera/socfpga/socfpga_gpio.c  Sat Jan 31 19:29:28 2015
(r277995)
+++ head/sys/arm/altera/socfpga/socfpga_gpio.c  Sat Jan 31 19:32:14 2015
(r277996)
@@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -107,6 +108,7 @@ enum port_no {
 /*
  * GPIO interface
  */
+static device_t socfpga_gpio_get_bus(device_t);
 static int socfpga_gpio_pin_max(device_t, int *);
 static int socfpga_gpio_pin_getcaps(device_t, uint32_t, uint32_t *);
 static int socfpga_gpio_pin_getname(device_t, uint32_t, char *);
@@ -122,6 +124,7 @@ struct socfpga_gpio_softc {
bus_space_handle_t  bsh;
 
device_tdev;
+   device_tbusdev;
struct mtx  sc_mtx;
int gpio_npins;
struct gpio_pin gpio_pins[NR_GPIO_MAX];
@@ -196,11 +199,24 @@ socfpga_gpio_attach(device_t dev)
snprintf(sc->gpio_pins[i].gp_name, GPIOMAXNAME,
"socfpga_gpio%d.%d", device_get_unit(dev), i);
}
+   sc->busdev = gpiobus_attach_bus(dev);
+   if (sc->busdev == NULL) {
+   bus_release_resources(dev, socfpga_gpio_spec, sc->res);
+   mtx_destroy(&sc->sc_mtx);
+   return (ENXIO);
+   }
+
+   return (0);
+}
 
-   device_add_child(dev, "gpioc", -1);
-   device_add_child(dev, "gpiobus", -1);
+static device_t
+socfpga_gpio_get_bus(device_t dev)
+{
+   struct socfpga_gpio_softc *sc;
+
+   sc = device_get_softc(dev);
 
-   return (bus_generic_attach(dev));
+   return (sc->busdev);
 }
 
 static int
@@ -415,6 +431,7 @@ static device_method_t socfpga_gpio_meth
DEVMETHOD(device_attach,socfpga_gpio_attach),
 
/* GPIO protocol */
+   DEVMETHOD(gpio_get_bus, socfpga_gpio_get_bus)

svn commit: r277991 - head/sys/boot/powerpc/kboot

2015-01-31 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Sat Jan 31 19:18:09 2015
New Revision: 277991
URL: https://svnweb.freebsd.org/changeset/base/277991

Log:
  Add FDT reservations for memory areas used by OPAL or RTAS runtime firmware.
  This allows a kexec'ed kernel to boot multiuser under PHYP.

Modified:
  head/sys/boot/powerpc/kboot/kbootfdt.c

Modified: head/sys/boot/powerpc/kboot/kbootfdt.c
==
--- head/sys/boot/powerpc/kboot/kbootfdt.c  Sat Jan 31 19:16:51 2015
(r277990)
+++ head/sys/boot/powerpc/kboot/kbootfdt.c  Sat Jan 31 19:18:09 2015
(r277991)
@@ -110,12 +110,32 @@ fdt_linux_fixups(void *fdtp)
 */
 
offset = fdt_path_offset(fdtp, "/memory@0");
-   if (offset > 0) {
+   if (offset > 0)
fdt_delprop(fdtp, offset, "available");
-   /*
-* XXX: add real available properties to reflect RTAS, etc.
-* reservations?
-*/
+
+   /*
+* Add reservations for OPAL and RTAS state if present
+*/
+
+   offset = fdt_path_offset(fdtp, "/ibm,opal");
+   if (offset > 0) {
+   uint64_t *base, *size;
+   base = fdt_getprop(fdtp, offset, "opal-base-address",
+   &len);
+   size = fdt_getprop(fdtp, offset, "opal-runtime-size",
+   &len);
+   if (base != NULL && size != NULL)
+   fdt_add_mem_rsv(fdtp, fdt64_to_cpu(*base),
+   fdt64_to_cpu(*size));
+   }
+   offset = fdt_path_offset(fdtp, "/rtas");
+   if (offset > 0) {
+   uint32_t *base, *size;
+   base = fdt_getprop(fdtp, offset, "linux,rtas-base", &len);
+   size = fdt_getprop(fdtp, offset, "rtas-size", &len);
+   if (base != NULL && size != NULL)
+   fdt_add_mem_rsv(fdtp, fdt32_to_cpu(*base),
+   fdt32_to_cpu(*size));
}
 
/*
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277990 - in head: . sys/conf

2015-01-31 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Sat Jan 31 19:16:51 2015
New Revision: 277990
URL: https://svnweb.freebsd.org/changeset/base/277990

Log:
  Build the powerpc64 kernel as a position-independent executable. At startup,
  it processes its own ELF relocations and can be loaded and run in place at
  any physical/virtual address.
  
  NB: This requires an updated loader to boot!
  
  Relnotes: yes

Modified:
  head/UPDATING
  head/sys/conf/Makefile.powerpc

Modified: head/UPDATING
==
--- head/UPDATING   Sat Jan 31 18:57:45 2015(r277989)
+++ head/UPDATING   Sat Jan 31 19:16:51 2015(r277990)
@@ -31,6 +31,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
+20150131:
+   The powerpc64 kernel has been changed to a position-independent
+   executable. This can only be booted with a new version of loader(8),
+   so make sure to update both world and kernel before rebooting.
+
 20150118:
Clang and llvm have been upgraded to 3.5.1 release.  This is a bugfix
only release, no new features have been added.  Please see the 20141231

Modified: head/sys/conf/Makefile.powerpc
==
--- head/sys/conf/Makefile.powerpc  Sat Jan 31 18:57:45 2015
(r277989)
+++ head/sys/conf/Makefile.powerpc  Sat Jan 31 19:16:51 2015
(r277990)
@@ -37,6 +37,11 @@ INCLUDES+= -I$S/contrib/libfdt
 
 CFLAGS+= -msoft-float -Wa,-many
 
+.if ${MACHINE_ARCH} == "powerpc64"
+CFLAGS+= -fPIC
+LDFLAGS+= -pie
+.endif
+
 .if !empty(DDB_ENABLED)
 CFLAGS+=   -fno-omit-frame-pointer
 .endif
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277989 - head/sys/dev/fdt

2015-01-31 Thread Ian Lepore
Author: ian
Date: Sat Jan 31 18:57:45 2015
New Revision: 277989
URL: https://svnweb.freebsd.org/changeset/base/277989

Log:
  Fix whitespace glitch from prior comit.

Modified:
  head/sys/dev/fdt/fdt_clock.c

Modified: head/sys/dev/fdt/fdt_clock.c
==
--- head/sys/dev/fdt/fdt_clock.cSat Jan 31 18:42:51 2015
(r277988)
+++ head/sys/dev/fdt/fdt_clock.cSat Jan 31 18:57:45 2015
(r277989)
@@ -150,7 +150,7 @@ fdt_clock_register_provider(device_t pro
 {
 
OF_device_register_xref(
-OF_xref_from_node(ofw_bus_get_node(provider)), provider);
+   OF_xref_from_node(ofw_bus_get_node(provider)), provider);
 }
 
 void
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277988 - head/sys/boot/common

2015-01-31 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Sat Jan 31 18:42:51 2015
New Revision: 277988
URL: https://svnweb.freebsd.org/changeset/base/277988

Log:
  Add code to support loading relocatable kernels at offsets that are not
  zero.

Modified:
  head/sys/boot/common/load_elf.c

Modified: head/sys/boot/common/load_elf.c
==
--- head/sys/boot/common/load_elf.c Sat Jan 31 18:39:32 2015
(r277987)
+++ head/sys/boot/common/load_elf.c Sat Jan 31 18:42:51 2015
(r277988)
@@ -193,8 +193,9 @@ __elfN(loadfile_raw)(char *filename, u_i
/* 
 * Calculate destination address based on kernel entrypoint 
 */
-   dest = (ehdr->e_entry & ~PAGE_MASK);
-   if (dest == 0) {
+if (ehdr->e_type == ET_EXEC)
+   dest = (ehdr->e_entry & ~PAGE_MASK);
+   if ((ehdr->e_entry & ~PAGE_MASK) == 0) {
printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadfile: not a kernel 
(maybe static binary?)\n");
err = EPERM;
goto oerr;
@@ -315,7 +316,7 @@ __elfN(loadimage)(struct preloaded_file 
 ret = 0;
 firstaddr = lastaddr = 0;
 ehdr = ef->ehdr;
-if (ef->kernel) {
+if (ehdr->e_type == ET_EXEC) {
 #if defined(__i386__) || defined(__amd64__)
 #if __ELF_WORD_SIZE == 64
off = - (off & 0xff00ull);/* x86_64 relocates after locore 
*/
@@ -369,10 +370,12 @@ __elfN(loadimage)(struct preloaded_file 
 #else
off = 0;/* other archs use direct mapped kernels */
 #endif
-   __elfN(relocation_offset) = off;
 }
 ef->off = off;
 
+if (ef->kernel)
+   __elfN(relocation_offset) = off;
+
 if ((ehdr->e_phoff + ehdr->e_phnum * sizeof(*phdr)) > ef->firstlen) {
printf("elf" __XSTRING(__ELF_WORD_SIZE) "_loadimage: program header not 
within first page\n");
goto out;
@@ -729,7 +732,7 @@ __elfN(load_modmetadata)(struct preloade
if (err != 0)
goto out;
 
-   if (ef.ehdr->e_type == ET_EXEC) {
+   if (ef.kernel == 1 || ef.ehdr->e_type == ET_EXEC) {
ef.kernel = 1;
} else if (ef.ehdr->e_type != ET_DYN) {
err = EFTYPE;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277987 - head/sys/powerpc/ofw

2015-01-31 Thread Nathan Whitehorn
Author: nwhitehorn
Date: Sat Jan 31 18:39:32 2015
New Revision: 277987
URL: https://svnweb.freebsd.org/changeset/base/277987

Log:
  Correctness improvements for removing FDT excluded memory areas.

Modified:
  head/sys/powerpc/ofw/ofw_machdep.c

Modified: head/sys/powerpc/ofw/ofw_machdep.c
==
--- head/sys/powerpc/ofw/ofw_machdep.c  Sat Jan 31 17:45:48 2015
(r277986)
+++ head/sys/powerpc/ofw/ofw_machdep.c  Sat Jan 31 18:39:32 2015
(r277987)
@@ -259,16 +259,14 @@ excise_fdt_reserved(struct mem_region *a
if (fdtmap[j].address + fdtmap[j].size < 
avail[i].mr_start + avail[i].mr_size) {
avail[asz].mr_start =
-   roundup2(fdtmap[j].address +
-   fdtmap[j].size, PAGE_SIZE);
+   fdtmap[j].address + fdtmap[j].size;
avail[asz].mr_size = avail[i].mr_start +
 avail[i].mr_size -
 avail[asz].mr_start;
asz++;
}
 
-   avail[i].mr_size =
-   rounddown2(fdtmap[j].address, PAGE_MASK) -
+   avail[i].mr_size = fdtmap[j].address -
avail[i].mr_start;
}
 
@@ -282,8 +280,10 @@ excise_fdt_reserved(struct mem_region *a
avail[i].mr_start && fdtmap[j].address +
fdtmap[j].size < avail[i].mr_start +
avail[i].mr_size) {
+   avail[i].mr_size += avail[i].mr_start;
avail[i].mr_start =
-   roundup2(fdtmap[j].address + 
fdtmap[j].size,PAGE_MASK);
+   fdtmap[j].address + fdtmap[j].size;
+   avail[i].mr_size -= avail[i].mr_start;
}
}
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277983 - head/include

2015-01-31 Thread Jilles Tjoelker
Author: jilles
Date: Sat Jan 31 16:39:26 2015
New Revision: 277983
URL: https://svnweb.freebsd.org/changeset/base/277983

Log:
  Ensure #include  is sufficient for using SEM_VALUE_MAX.
  
  Discussed with:   pluknet

Modified:
  head/include/semaphore.h

Modified: head/include/semaphore.h
==
--- head/include/semaphore.hSat Jan 31 16:34:39 2015(r277982)
+++ head/include/semaphore.hSat Jan 31 16:39:26 2015(r277983)
@@ -36,6 +36,8 @@
 #include 
 #include 
 
+#include 
+
 struct _sem {
__uint32_t  _magic;
struct _usem2   _kern;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277982 - head/contrib/tcpdump

2015-01-31 Thread Pedro F. Giffuni
Author: pfg
Date: Sat Jan 31 16:34:39 2015
New Revision: 277982
URL: https://svnweb.freebsd.org/changeset/base/277982

Log:
  MFV   r277981:
  Upstream fixes for issues found with afl (Issue #417).
  
  - Fix length checking.
  
  Check both the captured length and the on-the-wire length (the latter
  *should* be greater than or equal to the former, but that's not
  guaranteed).
  
  Add some additional length checks, so neither caplen nor length
  underflow.
  
  If we stop dissecting because the packet is too short, return 1, not 0,
  as we've "dissected" what we can; 0 means "this is LLC+SNAP with an OUI
  of 0 and an unknown Ethertype".
  
  commit:   743bcecdc92f88b118ec7aac4f68b606601205cc
  
  - Clean up length checks.
  
  Check only the amount of length that matters at any given point; yes,
  this means we do multiple checks, but so it goes.
  
  We don't need to check for LLC+SNAP - llc_print() does that for us.  We
  do, however, need to check to make sure we can safely skip the Fore
  header.
  
  commit:   5c65e7532fa16308e01299988852b0dc5b027559

Modified:
  head/contrib/tcpdump/print-atm.c
  head/contrib/tcpdump/print-llc.c
Directory Properties:
  head/contrib/tcpdump/   (props changed)

Modified: head/contrib/tcpdump/print-atm.c
==
--- head/contrib/tcpdump/print-atm.cSat Jan 31 16:26:21 2015
(r277981)
+++ head/contrib/tcpdump/print-atm.cSat Jan 31 16:34:39 2015
(r277982)
@@ -167,7 +167,7 @@ atm_if_print(netdissect_options *ndo,
uint32_t llchdr;
u_int hdrlen = 0;
 
-   if (caplen < 8) {
+   if (caplen < 1 || length < 1) {
ND_PRINT((ndo, "%s", tstr));
return (caplen);
}
@@ -181,6 +181,15 @@ atm_if_print(netdissect_options *ndo,
 }
 
/*
+* Must have at least a DSAP, an SSAP, and the first byte of the
+* control field.
+*/
+   if (caplen < 3 || length < 3) {
+   ND_PRINT((ndo, "%s", tstr));
+   return (caplen);
+   }
+
+   /*
 * Extract the presumed LLC header into a variable, for quick
 * testing.
 * Then check for a header that's neither a header for a SNAP
@@ -207,6 +216,10 @@ atm_if_print(netdissect_options *ndo,
 * packets?  If so, could it be changed to use a
 * new DLT_IEEE802_6 value if we added it?
 */
+   if (caplen < 20 || length < 20) {
+   ND_PRINT((ndo, "%s", tstr));
+   return (caplen);
+   }
if (ndo->ndo_eflag)
ND_PRINT((ndo, "%08x%08x %08x%08x ",
   EXTRACT_32BITS(p),

Modified: head/contrib/tcpdump/print-llc.c
==
--- head/contrib/tcpdump/print-llc.cSat Jan 31 16:26:21 2015
(r277981)
+++ head/contrib/tcpdump/print-llc.cSat Jan 31 16:34:39 2015
(r277982)
@@ -153,10 +153,10 @@ llc_print(netdissect_options *ndo, const
 
*extracted_ethertype = 0;
 
-   if (caplen < 3) {
+   if (caplen < 3 || length < 3) {
ND_PRINT((ndo, "[|llc]"));
ND_DEFAULTPRINT((u_char *)p, caplen);
-   return(0);
+   return (1);
}
 
dsap_field = *p;
@@ -179,10 +179,10 @@ llc_print(netdissect_options *ndo, const
 * The control field in I and S frames is
 * 2 bytes...
 */
-   if (caplen < 4) {
+   if (caplen < 4 || length < 4) {
ND_PRINT((ndo, "[|llc]"));
ND_DEFAULTPRINT((u_char *)p, caplen);
-   return(0);
+   return (1);
}
 
/*
@@ -242,6 +242,11 @@ llc_print(netdissect_options *ndo, const
 
if (ssap == LLCSAP_IP && dsap == LLCSAP_IP &&
control == LLC_UI) {
+   if (caplen < 4 || length < 4) {
+   ND_PRINT((ndo, "[|llc]"));
+   ND_DEFAULTPRINT((u_char *)p, caplen);
+   return (1);
+   }
ip_print(ndo, p+4, length-4);
return (1);
}
@@ -370,6 +375,8 @@ snap_print(netdissect_options *ndo, cons
register int ret;
 
ND_TCHECK2(*p, 5);
+   if (caplen < 5 || length < 5)
+   goto trunc;
orgcode = EXTRACT_24BITS(p);
et = EXTRACT_16BITS(p + 3);
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277980 - head/sys/dev/gpio

2015-01-31 Thread Luiz Otavio O Souza
Author: loos
Date: Sat Jan 31 15:50:19 2015
New Revision: 277980
URL: https://svnweb.freebsd.org/changeset/base/277980

Log:
  Implement a new method to retrieve the gpiobus reference from a GPIO
  controller.
  
  The gpiobus is responsible to keep track of the used pins and serialize
  the access to pins.
  
  Some of these features are important to devices that do not descend
  directly from gpiobus and as such cannot make use of its features (one
  classic example is gpioc that is attached to the GPIO controller and could
  not, until now, make use of the gpiobus locking).

Modified:
  head/sys/dev/gpio/gpio_if.m

Modified: head/sys/dev/gpio/gpio_if.m
==
--- head/sys/dev/gpio/gpio_if.m Sat Jan 31 15:41:01 2015(r277979)
+++ head/sys/dev/gpio/gpio_if.m Sat Jan 31 15:50:19 2015(r277980)
@@ -32,6 +32,13 @@
 INTERFACE gpio;
 
 CODE {
+   static device_t
+   gpio_default_get_bus(void)
+   {
+
+   return (NULL);
+   }
+
static int
gpio_default_map_gpios(device_t bus, phandle_t dev,
phandle_t gparent, int gcells, pcell_t *gpios, uint32_t *pin,
@@ -56,6 +63,13 @@ HEADER {
 };
 
 #
+# Return the gpiobus device reference
+#
+METHOD device_t get_bus {
+   device_t dev;
+} DEFAULT gpio_default_get_bus;
+
+#
 # Get maximum pin number
 #
 METHOD int pin_max {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277979 - head/bin/ps

2015-01-31 Thread Pedro F. Giffuni
Author: pfg
Date: Sat Jan 31 15:41:01 2015
New Revision: 277979
URL: https://svnweb.freebsd.org/changeset/base/277979

Log:
  Prevent access to an uninitialized variable
  
  The "-h" option may access an uninitialized value. Prevent it
  by properly initializing the value.
  
  CID:  1006559

Modified:
  head/bin/ps/ps.c

Modified: head/bin/ps/ps.c
==
--- head/bin/ps/ps.cSat Jan 31 15:22:45 2015(r277978)
+++ head/bin/ps/ps.cSat Jan 31 15:41:01 2015(r277979)
@@ -178,7 +178,7 @@ main(int argc, char *argv[])
KINFO *kinfo = NULL, *next_KINFO;
KINFO_STR *ks;
struct varent *vent;
-   struct winsize ws;
+   struct winsize ws = { .ws_row = 0 };
const char *nlistf, *memf, *fmtstr, *str;
char *cols;
int all, ch, elem, flag, _fmt, i, lineno, linelen, left;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277977 - head/sys/dev/iscsi

2015-01-31 Thread Edward Tomasz Napierala
Author: trasz
Date: Sat Jan 31 15:21:54 2015
New Revision: 277977
URL: https://svnweb.freebsd.org/changeset/base/277977

Log:
  Drop unneeded include.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/iscsi/icl_wrappers.h

Modified: head/sys/dev/iscsi/icl_wrappers.h
==
--- head/sys/dev/iscsi/icl_wrappers.h   Sat Jan 31 15:20:58 2015
(r277976)
+++ head/sys/dev/iscsi/icl_wrappers.h   Sat Jan 31 15:21:54 2015
(r277977)
@@ -38,7 +38,6 @@
 #defineICL_WRAPPERS_H
 
 #include 
-#include 
 
 #include 
 #include 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277978 - head/sys/dev/iscsi

2015-01-31 Thread Edward Tomasz Napierala
Author: trasz
Date: Sat Jan 31 15:22:45 2015
New Revision: 277978
URL: https://svnweb.freebsd.org/changeset/base/277978

Log:
  Use proper module name in MODULE_VERSION().
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/iscsi/icl_soft.c

Modified: head/sys/dev/iscsi/icl_soft.c
==
--- head/sys/dev/iscsi/icl_soft.c   Sat Jan 31 15:21:54 2015
(r277977)
+++ head/sys/dev/iscsi/icl_soft.c   Sat Jan 31 15:22:45 2015
(r277978)
@@ -1534,4 +1534,4 @@ moduledata_t icl_soft_data = {
 
 DECLARE_MODULE(icl_soft, icl_soft_data, SI_SUB_DRIVERS, SI_ORDER_MIDDLE);
 MODULE_DEPEND(icl_soft, icl, 1, 1, 1);
-MODULE_VERSION(icl, 1);
+MODULE_VERSION(icl_soft, 1);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277976 - head/sys/conf

2015-01-31 Thread Edward Tomasz Napierala
Author: trasz
Date: Sat Jan 31 15:20:58 2015
New Revision: 277976
URL: https://svnweb.freebsd.org/changeset/base/277976

Log:
  Fix build with "device iscsi" in kernel config.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/conf/files

Modified: head/sys/conf/files
==
--- head/sys/conf/files Sat Jan 31 14:31:12 2015(r277975)
+++ head/sys/conf/files Sat Jan 31 15:20:58 2015(r277976)
@@ -1520,6 +1520,7 @@ ipw_monitor.fwoptional ipwmonitorfw |
no-obj no-implicit-rule \
clean   "ipw_monitor.fw"
 dev/iscsi/icl.coptional iscsi | ctl 
+dev/iscsi/icl_conn_if.moptional iscsi | ctl 
 dev/iscsi/icl_proxy.c  optional iscsi | ctl
 dev/iscsi/icl_soft.c   optional iscsi | ctl 
 dev/iscsi/iscsi.c  optional iscsi scbus
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277974 - head/sys/dev/usb/input

2015-01-31 Thread Dimitry Andric
Author: dim
Date: Sat Jan 31 14:18:46 2015
New Revision: 277974
URL: https://svnweb.freebsd.org/changeset/base/277974

Log:
  Fix a bunch of -Wcast-qual warnings in sys/dev/usb/input/uhid.c, by
  using __DECONST.  No functional change.
  
  Reviewed by:  hselasky
  Differential Revision: https://reviews.freebsd.org/D1743

Modified:
  head/sys/dev/usb/input/uhid.c

Modified: head/sys/dev/usb/input/uhid.c
==
--- head/sys/dev/usb/input/uhid.c   Sat Jan 31 13:53:29 2015
(r277973)
+++ head/sys/dev/usb/input/uhid.c   Sat Jan 31 14:18:46 2015
(r277974)
@@ -734,7 +734,7 @@ uhid_attach(device_t dev)
if (uaa->info.idProduct == USB_PRODUCT_WACOM_GRAPHIRE) {
 
sc->sc_repdesc_size = 
sizeof(uhid_graphire_report_descr);
-   sc->sc_repdesc_ptr = (void 
*)&uhid_graphire_report_descr;
+   sc->sc_repdesc_ptr = __DECONST(void *, 
&uhid_graphire_report_descr);
sc->sc_flags |= UHID_FLAG_STATIC_DESC;
 
} else if (uaa->info.idProduct == 
USB_PRODUCT_WACOM_GRAPHIRE3_4X5) {
@@ -755,7 +755,7 @@ uhid_attach(device_t dev)
usbd_errstr(error));
}
sc->sc_repdesc_size = 
sizeof(uhid_graphire3_4x5_report_descr);
-   sc->sc_repdesc_ptr = (void 
*)&uhid_graphire3_4x5_report_descr;
+   sc->sc_repdesc_ptr = __DECONST(void *, 
&uhid_graphire3_4x5_report_descr);
sc->sc_flags |= UHID_FLAG_STATIC_DESC;
}
} else if ((uaa->info.bInterfaceClass == UICLASS_VENDOR) &&
@@ -775,7 +775,7 @@ uhid_attach(device_t dev)
}
/* the Xbox 360 gamepad has no report descriptor */
sc->sc_repdesc_size = sizeof(uhid_xb360gp_report_descr);
-   sc->sc_repdesc_ptr = (void *)&uhid_xb360gp_report_descr;
+   sc->sc_repdesc_ptr = __DECONST(void *, 
&uhid_xb360gp_report_descr);
sc->sc_flags |= UHID_FLAG_STATIC_DESC;
}
if (sc->sc_repdesc_ptr == NULL) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277973 - head/bin/sh

2015-01-31 Thread Jilles Tjoelker
Author: jilles
Date: Sat Jan 31 13:53:29 2015
New Revision: 277973
URL: https://svnweb.freebsd.org/changeset/base/277973

Log:
  sh: Abort a wait builtin on any trapped signal.
  
  This is required by POSIX.
  
  PR:   197210
  Reported by:  ache
  MFC after:2 weeks

Modified:
  head/bin/sh/jobs.c
  head/bin/sh/trap.c

Modified: head/bin/sh/jobs.c
==
--- head/bin/sh/jobs.c  Sat Jan 31 12:58:04 2015(r277972)
+++ head/bin/sh/jobs.c  Sat Jan 31 13:53:29 2015(r277973)
@@ -87,8 +87,8 @@ static int ttyfd = -1;
 
 /* mode flags for dowait */
 #define DOWAIT_BLOCK   0x1 /* wait until a child exits */
-#define DOWAIT_SIG 0x2 /* if DOWAIT_BLOCK, abort on SIGINT/SIGQUIT */
-#define DOWAIT_SIG_ANY 0x4 /* if DOWAIT_SIG, abort on any signal */
+#define DOWAIT_SIG 0x2 /* if DOWAIT_BLOCK, abort on signal */
+#define DOWAIT_SIG_TRAP0x4 /* if DOWAIT_SIG, abort on trapped signal 
only */
 
 #if JOBS
 static void restartjob(struct job *);
@@ -1028,7 +1028,7 @@ waitforjob(struct job *jp, int *origstat
TRACE(("waitforjob(%%%td) called\n", jp - jobtab + 1));
while (jp->state == 0)
if (dowait(DOWAIT_BLOCK | (Tflag ? DOWAIT_SIG |
-   DOWAIT_SIG_ANY : 0), jp) == -1)
+   DOWAIT_SIG_TRAP : 0), jp) == -1)
dotrap();
 #if JOBS
if (jp->jobctl) {
@@ -1120,7 +1120,7 @@ dowait(int mode, struct job *job)
TRACE(("wait returns %d, status=%d\n", (int)pid, status));
if (pid == 0 && (mode & DOWAIT_SIG) != 0) {
pid = -1;
-   if (((mode & DOWAIT_SIG_ANY) != 0 ?
+   if (((mode & DOWAIT_SIG_TRAP) != 0 ?
pendingsig : pendingsig_waitcmd) != 0) {
errno = EINTR;
break;

Modified: head/bin/sh/trap.c
==
--- head/bin/sh/trap.c  Sat Jan 31 12:58:04 2015(r277972)
+++ head/bin/sh/trap.c  Sat Jan 31 13:53:29 2015(r277973)
@@ -74,7 +74,7 @@ __FBSDID("$FreeBSD$");
 
 static char sigmode[NSIG]; /* current value of signal */
 volatile sig_atomic_t pendingsig;  /* indicates some signal received */
-volatile sig_atomic_t pendingsig_waitcmd;  /* indicates SIGINT/SIGQUIT 
received */
+volatile sig_atomic_t pendingsig_waitcmd;  /* indicates wait builtin 
should be interrupted */
 static int in_dotrap;  /* do we execute in a trap handler? */
 static char *volatile trap[NSIG];  /* trap handler commands */
 static volatile sig_atomic_t gotsig[NSIG];
@@ -400,6 +400,7 @@ onsig(int signo)
(signo != SIGCHLD || !ignore_sigchld)) {
gotsig[signo] = 1;
pendingsig = signo;
+   pendingsig_waitcmd = signo;
}
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277972 - head/sys/fs/tmpfs

2015-01-31 Thread Konstantin Belousov
Author: kib
Date: Sat Jan 31 12:58:04 2015
New Revision: 277972
URL: https://svnweb.freebsd.org/changeset/base/277972

Log:
  Remove single-use boolean.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/fs/tmpfs/tmpfs_vnops.c

Modified: head/sys/fs/tmpfs/tmpfs_vnops.c
==
--- head/sys/fs/tmpfs/tmpfs_vnops.c Sat Jan 31 12:43:30 2015
(r277971)
+++ head/sys/fs/tmpfs/tmpfs_vnops.c Sat Jan 31 12:58:04 2015
(r277972)
@@ -453,7 +453,6 @@ tmpfs_write(struct vop_write_args *v)
struct tmpfs_node *node;
off_t oldsize;
int error, ioflag;
-   boolean_t extended;
 
vp = v->a_vp;
uio = v->a_uio;
@@ -473,8 +472,7 @@ tmpfs_write(struct vop_write_args *v)
return (EFBIG);
if (vn_rlimit_fsize(vp, uio, uio->uio_td))
return (EFBIG);
-   extended = uio->uio_offset + uio->uio_resid > node->tn_size;
-   if (extended) {
+   if (uio->uio_offset + uio->uio_resid > node->tn_size) {
error = tmpfs_reg_resize(vp, uio->uio_offset + uio->uio_resid,
FALSE);
if (error != 0)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277971 - in head/sys/mips: atheros cavium rt305x

2015-01-31 Thread Luiz Otavio O Souza
Author: loos
Date: Sat Jan 31 12:43:30 2015
New Revision: 277971
URL: https://svnweb.freebsd.org/changeset/base/277971

Log:
  Replace spaces with tabs, this will easier future changes on softc
  structure.
  
  No functional changes.

Modified:
  head/sys/mips/atheros/ar71xx_gpiovar.h
  head/sys/mips/cavium/octeon_gpiovar.h
  head/sys/mips/rt305x/rt305x_gpiovar.h

Modified: head/sys/mips/atheros/ar71xx_gpiovar.h
==
--- head/sys/mips/atheros/ar71xx_gpiovar.h  Sat Jan 31 12:27:40 2015
(r277970)
+++ head/sys/mips/atheros/ar71xx_gpiovar.h  Sat Jan 31 12:43:30 2015
(r277971)
@@ -57,12 +57,12 @@
 
 struct ar71xx_gpio_softc {
device_tdev;
-struct mtx gpio_mtx;
-struct resource*gpio_mem_res;
-intgpio_mem_rid;
-struct resource*gpio_irq_res;
-intgpio_irq_rid;
-void   *gpio_ih;
+   struct mtx  gpio_mtx;
+   struct resource *gpio_mem_res;
+   int gpio_mem_rid;
+   struct resource *gpio_irq_res;
+   int gpio_irq_rid;
+   void*gpio_ih;
int gpio_npins;
struct gpio_pin *gpio_pins;
 };

Modified: head/sys/mips/cavium/octeon_gpiovar.h
==
--- head/sys/mips/cavium/octeon_gpiovar.h   Sat Jan 31 12:27:40 2015
(r277970)
+++ head/sys/mips/cavium/octeon_gpiovar.h   Sat Jan 31 12:43:30 2015
(r277971)
@@ -43,11 +43,11 @@
 
 struct octeon_gpio_softc {
device_tdev;
-struct mtx gpio_mtx;
-struct resource*gpio_irq_res[OCTEON_GPIO_IRQS];
-intgpio_irq_rid[OCTEON_GPIO_IRQS];
-void   *gpio_ih[OCTEON_GPIO_IRQS];
-void   *gpio_intr_cookies[OCTEON_GPIO_IRQS];
+   struct mtx  gpio_mtx;
+   struct resource *gpio_irq_res[OCTEON_GPIO_IRQS];
+   int gpio_irq_rid[OCTEON_GPIO_IRQS];
+   void*gpio_ih[OCTEON_GPIO_IRQS];
+   void*gpio_intr_cookies[OCTEON_GPIO_IRQS];
int gpio_npins;
struct gpio_pin gpio_pins[OCTEON_GPIO_PINS];
 };

Modified: head/sys/mips/rt305x/rt305x_gpiovar.h
==
--- head/sys/mips/rt305x/rt305x_gpiovar.h   Sat Jan 31 12:27:40 2015
(r277970)
+++ head/sys/mips/rt305x/rt305x_gpiovar.h   Sat Jan 31 12:43:30 2015
(r277971)
@@ -30,12 +30,12 @@
 
 struct rt305x_gpio_softc {
device_tdev;
-struct mtx gpio_mtx;
-struct resource*gpio_mem_res;
-intgpio_mem_rid;
-struct resource*gpio_irq_res;
-intgpio_irq_rid;
-void   *gpio_ih;
+   struct mtx  gpio_mtx;
+   struct resource *gpio_mem_res;
+   int gpio_mem_rid;
+   struct resource *gpio_irq_res;
+   int gpio_irq_rid;
+   void*gpio_ih;
int gpio_npins;
struct gpio_pin gpio_pins[NGPIO];
int reset_gpio;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277970 - head/sys/kern

2015-01-31 Thread Konstantin Belousov
Author: kib
Date: Sat Jan 31 12:27:40 2015
New Revision: 277970
URL: https://svnweb.freebsd.org/changeset/base/277970

Log:
  The dependency chain for priority-inheritance mutexes could be
  subverted by userspace into cycle.  Both umtx_propagate_priority() and
  umtx_repropagate_priority() would then loop infinitely, owning the
  spinlock.
  
  Check for the cycle using standard Floyd' algorithm before doing the
  pass in the affected functions.  Add simple check for condition of
  tricking the thread into a wait for itself, which could be easily
  simulated by usermode without race.
  
  Found by: Eric van Gyzen 
  In collaboration with:Eric van Gyzen 
  Tested by:pho
  MFC after:1 week

Modified:
  head/sys/kern/kern_umtx.c

Modified: head/sys/kern/kern_umtx.c
==
--- head/sys/kern/kern_umtx.c   Sat Jan 31 12:27:18 2015(r277969)
+++ head/sys/kern/kern_umtx.c   Sat Jan 31 12:27:40 2015(r277970)
@@ -1302,6 +1302,47 @@ umtx_pi_adjust_thread(struct umtx_pi *pi
return (1);
 }
 
+static struct umtx_pi *
+umtx_pi_next(struct umtx_pi *pi)
+{
+   struct umtx_q *uq_owner;
+
+   if (pi->pi_owner == NULL)
+   return (NULL);
+   uq_owner = pi->pi_owner->td_umtxq;
+   if (uq_owner == NULL)
+   return (NULL);
+   return (uq_owner->uq_pi_blocked);
+}
+
+/*
+ * Floyd's Cycle-Finding Algorithm.
+ */
+static bool
+umtx_pi_check_loop(struct umtx_pi *pi)
+{
+   struct umtx_pi *pi1;/* fast iterator */
+
+   mtx_assert(&umtx_lock, MA_OWNED);
+   if (pi == NULL)
+   return (false);
+   pi1 = pi;
+   for (;;) {
+   pi = umtx_pi_next(pi);
+   if (pi == NULL)
+   break;
+   pi1 = umtx_pi_next(pi1);
+   if (pi1 == NULL)
+   break;
+   pi1 = umtx_pi_next(pi1);
+   if (pi1 == NULL)
+   break;
+   if (pi == pi1)
+   return (true);
+   }
+   return (false);
+}
+
 /*
  * Propagate priority when a thread is blocked on POSIX
  * PI mutex.
@@ -1319,6 +1360,8 @@ umtx_propagate_priority(struct thread *t
pi = uq->uq_pi_blocked;
if (pi == NULL)
return;
+   if (umtx_pi_check_loop(pi))
+   return;
 
for (;;) {
td = pi->pi_owner;
@@ -1362,6 +1405,8 @@ umtx_repropagate_priority(struct umtx_pi
 
mtx_assert(&umtx_lock, MA_OWNED);
 
+   if (umtx_pi_check_loop(pi))
+   return;
while (pi != NULL && pi->pi_owner != NULL) {
pri = PRI_MAX;
uq_owner = pi->pi_owner->td_umtxq;
@@ -1694,6 +1739,11 @@ do_lock_pi(struct thread *td, struct umu
continue;
}
 
+   if ((owner & ~UMUTEX_CONTESTED) == id) {
+   error = EDEADLK;
+   break;
+   }
+
if (try != 0) {
error = EBUSY;
break;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277969 - head/sys/fs/tmpfs

2015-01-31 Thread Konstantin Belousov
Author: kib
Date: Sat Jan 31 12:27:18 2015
New Revision: 277969
URL: https://svnweb.freebsd.org/changeset/base/277969

Log:
  POSIX states that write(2) "shall mark for update the last data
  modification and last file status change timestamps of the file".
  Currently, tmpfs only modifies ctime when file was extended.  Since
  r277828 followed tmpfs_write(), mmaped writes also do not modify
  ctime.
  
  Fix this, by updating both ctime and mtime for writes to tmpfs files.
  
  Sponsored by: The FreeBSD Foundation
  MFC after:2 weeks

Modified:
  head/sys/fs/tmpfs/tmpfs_subr.c
  head/sys/fs/tmpfs/tmpfs_vnops.c

Modified: head/sys/fs/tmpfs/tmpfs_subr.c
==
--- head/sys/fs/tmpfs/tmpfs_subr.c  Sat Jan 31 12:17:07 2015
(r277968)
+++ head/sys/fs/tmpfs/tmpfs_subr.c  Sat Jan 31 12:27:18 2015
(r277969)
@@ -1434,7 +1434,8 @@ tmpfs_check_mtime(struct vnode *vp)
if ((obj->flags & OBJ_TMPFS_DIRTY) != 0) {
obj->flags &= ~OBJ_TMPFS_DIRTY;
node = VP_TO_TMPFS_NODE(vp);
-   node->tn_status |= TMPFS_NODE_MODIFIED;
+   node->tn_status |= TMPFS_NODE_MODIFIED |
+   TMPFS_NODE_CHANGED;
}
VM_OBJECT_WUNLOCK(obj);
}

Modified: head/sys/fs/tmpfs/tmpfs_vnops.c
==
--- head/sys/fs/tmpfs/tmpfs_vnops.c Sat Jan 31 12:17:07 2015
(r277968)
+++ head/sys/fs/tmpfs/tmpfs_vnops.c Sat Jan 31 12:27:18 2015
(r277969)
@@ -483,7 +483,7 @@ tmpfs_write(struct vop_write_args *v)
 
error = uiomove_object(node->tn_reg.tn_aobj, node->tn_size, uio);
node->tn_status |= TMPFS_NODE_ACCESSED | TMPFS_NODE_MODIFIED |
-   (extended ? TMPFS_NODE_CHANGED : 0);
+   TMPFS_NODE_CHANGED;
if (node->tn_mode & (S_ISUID | S_ISGID)) {
if (priv_check_cred(v->a_cred, PRIV_VFS_RETAINSUGID, 0))
node->tn_mode &= ~(S_ISUID | S_ISGID);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r277968 - in head/sys: arm/allwinner arm/altera/socfpga arm/freescale/imx arm/freescale/vybrid arm/rockchip arm/samsung/exynos arm/ti mips/atheros mips/cavium mips/rt305x

2015-01-31 Thread Luiz Otavio O Souza
Author: loos
Date: Sat Jan 31 12:17:07 2015
New Revision: 277968
URL: https://svnweb.freebsd.org/changeset/base/277968

Log:
  Clean up and fix the device detach routine and the failure path on GPIO
  drivers.
  
  This paves the way for upcoming work.

Modified:
  head/sys/arm/allwinner/a10_gpio.c
  head/sys/arm/altera/socfpga/socfpga_gpio.c
  head/sys/arm/freescale/imx/imx_gpio.c
  head/sys/arm/freescale/vybrid/vf_gpio.c
  head/sys/arm/rockchip/rk30xx_gpio.c
  head/sys/arm/samsung/exynos/exynos5_pad.c
  head/sys/arm/ti/ti_gpio.c
  head/sys/mips/atheros/ar71xx_gpio.c
  head/sys/mips/cavium/octeon_gpio.c
  head/sys/mips/rt305x/rt305x_gpio.c

Modified: head/sys/arm/allwinner/a10_gpio.c
==
--- head/sys/arm/allwinner/a10_gpio.c   Sat Jan 31 11:24:26 2015
(r277967)
+++ head/sys/arm/allwinner/a10_gpio.c   Sat Jan 31 12:17:07 2015
(r277968)
@@ -427,7 +427,7 @@ a10_gpio_attach(device_t dev)
RF_ACTIVE);
if (!sc->sc_mem_res) {
device_printf(dev, "cannot allocate memory window\n");
-   return (ENXIO);
+   goto fail;
}
 
sc->sc_bst = rman_get_bustag(sc->sc_mem_res);
@@ -437,9 +437,8 @@ a10_gpio_attach(device_t dev)
sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
RF_ACTIVE);
if (!sc->sc_irq_res) {
-   bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res);
device_printf(dev, "cannot allocate interrupt\n");
-   return (ENXIO);
+   goto fail;
}
 
/* Find our node. */
@@ -472,6 +471,8 @@ fail:
bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq_res);
if (sc->sc_mem_res)
bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res);
+   mtx_destroy(&sc->sc_mtx);
+
return (ENXIO);
 }
 

Modified: head/sys/arm/altera/socfpga/socfpga_gpio.c
==
--- head/sys/arm/altera/socfpga/socfpga_gpio.c  Sat Jan 31 11:24:26 2015
(r277967)
+++ head/sys/arm/altera/socfpga/socfpga_gpio.c  Sat Jan 31 12:17:07 2015
(r277968)
@@ -163,6 +163,7 @@ socfpga_gpio_attach(device_t dev)
 
if (bus_alloc_resources(dev, socfpga_gpio_spec, sc->res)) {
device_printf(dev, "could not allocate resources\n");
+   mtx_destroy(&sc->sc_mtx);
return (ENXIO);
}
 

Modified: head/sys/arm/freescale/imx/imx_gpio.c
==
--- head/sys/arm/freescale/imx/imx_gpio.c   Sat Jan 31 11:24:26 2015
(r277967)
+++ head/sys/arm/freescale/imx/imx_gpio.c   Sat Jan 31 12:17:07 2015
(r277968)
@@ -389,6 +389,8 @@ imx51_gpio_attach(device_t dev)
 
if (bus_alloc_resources(dev, imx_gpio_spec, sc->sc_res)) {
device_printf(dev, "could not allocate resources\n");
+   bus_release_resources(dev, imx_gpio_spec, sc->sc_res);
+   mtx_destroy(&sc->sc_mtx);
return (ENXIO);
}
 
@@ -411,6 +413,7 @@ imx51_gpio_attach(device_t dev)
imx51_gpio_intr, NULL, sc, &sc->gpio_ih[irq]))) {
device_printf(dev,
"WARNING: unable to register interrupt handler\n");
+   imx51_gpio_detach(dev);
return (ENXIO);
}
}
@@ -434,6 +437,7 @@ imx51_gpio_attach(device_t dev)
 static int
 imx51_gpio_detach(device_t dev)
 {
+   int irq;
struct imx51_gpio_softc *sc;
 
sc = device_get_softc(dev);
@@ -441,13 +445,12 @@ imx51_gpio_detach(device_t dev)
KASSERT(mtx_initialized(&sc->sc_mtx), ("gpio mutex not initialized"));
 
bus_generic_detach(dev);
-
-   if (sc->sc_res[3])
-   bus_release_resources(dev, imx_gpio0irq_spec, &sc->sc_res[3]);
-
-   if (sc->sc_res[0])
-   bus_release_resources(dev, imx_gpio_spec, sc->sc_res);
-
+   for (irq = 1; irq <= sc->sc_l_irq; irq ++) {
+   if (sc->gpio_ih[irq])
+   bus_teardown_intr(dev, sc->sc_res[irq], 
sc->gpio_ih[irq]);
+   }
+   bus_release_resources(dev, imx_gpio0irq_spec, &sc->sc_res[3]);
+   bus_release_resources(dev, imx_gpio_spec, sc->sc_res);
mtx_destroy(&sc->sc_mtx);
 
return(0);

Modified: head/sys/arm/freescale/vybrid/vf_gpio.c
==
--- head/sys/arm/freescale/vybrid/vf_gpio.c Sat Jan 31 11:24:26 2015
(r277967)
+++ head/sys/arm/freescale/vybrid/vf_gpio.c Sat Jan 31 12:17:07 2015
(r277968)
@@ -125,6 +125,7 @@ vf_gpio_attach(device_t dev)
 
if (bus_alloc_resources(dev, vf_gpio_spec, sc->res)) {
device_printf(dev, "could not allocate resources\n");
+  

Re: svn commit: r277959 - head/sys/dev/drm2/i915

2015-01-31 Thread Alexander Motin
On 31.01.2015 04:13, Adrian Chadd wrote:
> Author: adrian
> Date: Sat Jan 31 02:13:25 2015
> New Revision: 277959
> URL: https://svnweb.freebsd.org/changeset/base/277959
> 
> Log:
>   Fix backlight for ivybridge based laptops (and whatever else comes through
>   this codepath.)
>   
>   (1<<30) is documented as BLM_PCH_OVERRIDE_ENABLE, which the current
>   i915 driver in Linux only sets for broadwell chips.
>   
>   This fixes the backlight control on the Lenovo X230.

I've just updated my IvyBridge Asus UX31A after last few months and
brightness control is now working! Yay! Thanks to everybody related!

The odd effect though is that backlight is getting disabled as soon as
xorg starts. First press of hardware brightness keys fixes the issue,
but first time I was quite confused. Any idea what may set such default?

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


svn commit: r277964 - head/sys/dev/iscsi

2015-01-31 Thread Edward Tomasz Napierala
Author: trasz
Date: Sat Jan 31 08:03:56 2015
New Revision: 277964
URL: https://svnweb.freebsd.org/changeset/base/277964

Log:
  Add two files missed in r277963.
  
  Sponsored by: The FreeBSD Foundation

Added:
  head/sys/dev/iscsi/icl_conn_if.m   (contents, props changed)
  head/sys/dev/iscsi/icl_wrappers.h   (contents, props changed)

Added: head/sys/dev/iscsi/icl_conn_if.m
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/iscsi/icl_conn_if.mSat Jan 31 08:03:56 2015
(r277964)
@@ -0,0 +1,87 @@
+#-
+# Copyright (c) 2014 The FreeBSD Foundation
+# All rights reserved.
+#
+# This software was developed by Edward Tomasz Napierala under sponsorship
+# from the FreeBSD Foundation.
+#
+# 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.
+#
+# $FreeBSD$
+#
+
+#include 
+
+INTERFACE icl_conn;
+
+METHOD size_t pdu_data_segment_length {
+   struct icl_conn *_ic;
+   const struct icl_pdu *_ip;
+};
+
+METHOD int pdu_append_data {
+   struct icl_conn *_ic;
+   struct icl_pdu *_ip;
+   const void *_addr;
+   size_t _len;
+   int _flags;
+};
+
+METHOD void pdu_get_data {
+   struct icl_conn *_ic;
+   struct icl_pdu *_ip;
+   size_t _off;
+   void *_addr;
+   size_t _len;
+};
+
+METHOD void pdu_queue {
+   struct icl_conn *_ic;
+   struct icl_pdu *_ip;
+};
+
+METHOD void pdu_free {
+   struct icl_conn *_ic;
+   struct icl_pdu *_ip;
+};
+
+METHOD struct icl_pdu * new_pdu {
+   struct icl_conn *_ic;
+   int _flags;
+};
+
+METHOD void free {
+   struct icl_conn *_ic;
+};
+
+METHOD int handoff {
+   struct icl_conn *_ic;
+   int _fd;
+};
+
+METHOD void close {
+   struct icl_conn *_ic;
+};
+
+METHOD bool connected {
+   struct icl_conn *_ic;
+};

Added: head/sys/dev/iscsi/icl_wrappers.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/iscsi/icl_wrappers.h   Sat Jan 31 08:03:56 2015
(r277964)
@@ -0,0 +1,116 @@
+/*-
+ * Copyright (c) 2014 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * This software was developed by Edward Tomasz Napierala under sponsorship
+ * from the FreeBSD Foundation.
+ *
+ * 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.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * This file is used to provide the initiator and target with a prettier
+ *