svn commit: r298389 - in head/sys: dev/malo dev/mwl net80211

2016-04-20 Thread Andriy Voskoboinyk
Author: avos
Date: Thu Apr 21 05:47:47 2016
New Revision: 298389
URL: https://svnweb.freebsd.org/changeset/base/298389

Log:
  net80211: enable promiscuous mode state change for non-monitor/ahdemo modes
  
  - Allow to enable/disable promiscuous mode when:
* interface is not a member of bridge, or;
* request was issued by user (ifconfig wlan0 promisc), or;
* interface is in MONITOR or AHDEMO mode.
  - Drop local workarounds in mwl(4) and malo(4).
  
  Tested with:
  - Intel 3945BG, STA mode;
  - RTL8188CUS, MONITOR mode;
  
  Reviewed by:  adrian
  Differential Revision:https://reviews.freebsd.org/D5472

Modified:
  head/sys/dev/malo/if_malo.c
  head/sys/dev/mwl/if_mwl.c
  head/sys/net80211/ieee80211.c
  head/sys/net80211/ieee80211_ioctl.c

Modified: head/sys/dev/malo/if_malo.c
==
--- head/sys/dev/malo/if_malo.c Thu Apr 21 05:24:47 2016(r298388)
+++ head/sys/dev/malo/if_malo.c Thu Apr 21 05:47:47 2016(r298389)
@@ -1570,14 +1570,7 @@ malo_mode_init(struct malo_softc *sc)
struct ieee80211com *ic = >malo_ic;
struct malo_hal *mh = sc->malo_mh;
 
-   /*
-* NB: Ignore promisc in hostap mode; it's set by the
-* bridge.  This is wrong but we have no way to
-* identify internal requests (from the bridge)
-* versus external requests such as for tcpdump.
-*/
-   malo_hal_setpromisc(mh, ic->ic_promisc > 0 &&
-   ic->ic_opmode != IEEE80211_M_HOSTAP);
+   malo_hal_setpromisc(mh, ic->ic_promisc > 0);
malo_setmcastfilter(sc);
 
return ENXIO;

Modified: head/sys/dev/mwl/if_mwl.c
==
--- head/sys/dev/mwl/if_mwl.c   Thu Apr 21 05:24:47 2016(r298388)
+++ head/sys/dev/mwl/if_mwl.c   Thu Apr 21 05:47:47 2016(r298389)
@@ -1753,14 +1753,7 @@ mwl_mode_init(struct mwl_softc *sc)
struct ieee80211com *ic = >sc_ic;
struct mwl_hal *mh = sc->sc_mh;
 
-   /*
-* NB: Ignore promisc in hostap mode; it's set by the
-* bridge.  This is wrong but we have no way to
-* identify internal requests (from the bridge)
-* versus external requests such as for tcpdump.
-*/
-   mwl_hal_setpromisc(mh, ic->ic_promisc > 0 &&
-   ic->ic_opmode != IEEE80211_M_HOSTAP);
+   mwl_hal_setpromisc(mh, ic->ic_promisc > 0);
mwl_setmcastfilter(sc);
 
return 0;

Modified: head/sys/net80211/ieee80211.c
==
--- head/sys/net80211/ieee80211.c   Thu Apr 21 05:24:47 2016
(r298388)
+++ head/sys/net80211/ieee80211.c   Thu Apr 21 05:47:47 2016
(r298389)
@@ -704,16 +704,6 @@ ieee80211_promisc(struct ieee80211vap *v
 {
struct ieee80211com *ic = vap->iv_ic;
 
-   /*
-* XXX the bridge sets PROMISC but we don't want to
-* enable it on the device, discard here so all the
-* drivers don't need to special-case it
-*/
-   if (!(vap->iv_opmode == IEEE80211_M_MONITOR ||
- (vap->iv_opmode == IEEE80211_M_AHDEMO &&
-  (vap->iv_caps & IEEE80211_C_TDMA) == 0)))
-   return;
-
IEEE80211_LOCK_ASSERT(ic);
 
if (on) {

Modified: head/sys/net80211/ieee80211_ioctl.c
==
--- head/sys/net80211/ieee80211_ioctl.c Thu Apr 21 05:24:47 2016
(r298388)
+++ head/sys/net80211/ieee80211_ioctl.c Thu Apr 21 05:47:47 2016
(r298389)
@@ -3306,11 +3306,27 @@ ieee80211_ioctl(struct ifnet *ifp, u_lon
switch (cmd) {
case SIOCSIFFLAGS:
IEEE80211_LOCK(ic);
-   if ((ifp->if_flags ^ vap->iv_ifflags) & IFF_PROMISC)
-   ieee80211_promisc(vap, ifp->if_flags & IFF_PROMISC);
-   if ((ifp->if_flags ^ vap->iv_ifflags) & IFF_ALLMULTI)
+   if ((ifp->if_flags ^ vap->iv_ifflags) & IFF_PROMISC) {
+   /*
+* Enable promiscuous mode when:
+* 1. Interface is not a member of bridge, or
+* 2. Requested by user, or
+* 3. In monitor (or adhoc-demo) mode.
+*/
+   if (ifp->if_bridge == NULL ||
+   (ifp->if_flags & IFF_PPROMISC) != 0 ||
+   vap->iv_opmode == IEEE80211_M_MONITOR ||
+   (vap->iv_opmode == IEEE80211_M_AHDEMO &&
+   (vap->iv_caps & IEEE80211_C_TDMA) == 0)) {
+   ieee80211_promisc(vap,
+   ifp->if_flags & IFF_PROMISC);
+   vap->iv_ifflags ^= IFF_PROMISC;
+   }
+   }
+   if ((ifp->if_flags ^ 

svn commit: r298388 - head/usr.bin/units

2016-04-20 Thread Eitan Adler
Author: eadler
Date: Thu Apr 21 05:24:47 2016
New Revision: 298388
URL: https://svnweb.freebsd.org/changeset/base/298388

Log:
  Bring a little more compability with GNU units 2.12
  - notionally support a 'history file' flag. This doesn't do much now,
but is there to prevent scripts written against GNU units from
breaking
  - correctly gracefully quit rather than exit (this will make it easier
to support a history file in the future)
  - remove the "t" flag from fopen which was there to support windows. We
have not supported windows since at the latest, the introduction of
capsicum.

Modified:
  head/usr.bin/units/units.1
  head/usr.bin/units/units.c

Modified: head/usr.bin/units/units.1
==
--- head/usr.bin/units/units.1  Thu Apr 21 04:33:07 2016(r298387)
+++ head/usr.bin/units/units.1  Thu Apr 21 05:24:47 2016(r298388)
@@ -8,6 +8,7 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl f Ar filename
+.Op Fl H Ar filename
 .Op Fl qvUV
 .Op Ar from-unit to-unit
 .Sh OPTIONS
@@ -17,6 +18,8 @@ The following options are available:
 Show an overview of options
 .It Fl f Ar filename No , Fl -file Ar filename
 Specify the name of the units data file to load.
+.It Fl H Ar filename No , Fl -historyfile Ar filename
+Ignored, for compatibility with GNU units.
 .It Fl e , Fl -exponential
 Behave as if -o '%6e' was typed.
 .It Fl q No , Fl -quiet

Modified: head/usr.bin/units/units.c
==
--- head/usr.bin/units/units.c  Thu Apr 21 04:33:07 2016(r298387)
+++ head/usr.bin/units/units.c  Thu Apr 21 05:24:47 2016(r298388)
@@ -33,10 +33,8 @@ static const char rcsid[] =
 
 #include 
 
-#define_PATH_UNITSLIB  "/usr/share/misc/definitions.units"
-
 #ifndef UNITSFILE
-#define UNITSFILE _PATH_UNITSLIB
+#define UNITSFILE "/usr/share/misc/definitions.units"
 #endif
 
 #define MAXUNITS 1000
@@ -47,6 +45,7 @@ static const char rcsid[] =
 #define PRIMITIVECHAR '!'
 
 static const char *powerstring = "^";
+static const char *numfmt = "%.8g";
 
 static struct {
char *uname;
@@ -128,12 +127,12 @@ readunits(const char *userfile)
linenum = 0;
 
if (userfile) {
-   unitfile = fopen(userfile, "rt");
+   unitfile = fopen(userfile, "r");
if (!unitfile)
errx(1, "unable to open units file '%s'", userfile);
}
else {
-   unitfile = fopen(UNITSFILE, "rt");
+   unitfile = fopen(UNITSFILE, "r");
if (!unitfile) {
char *direc, *env;
char filename[1000];
@@ -255,7 +254,7 @@ showunit(struct unittype * theunit)
int printedslash;
int counter = 1;
 
-   printf("%.8g", theunit->factor);
+   printf(numfmt, theunit->factor);
if (theunit->offset)
printf("&%.8g", theunit->offset);
for (ptr = theunit->numerator; *ptr; ptr++) {
@@ -723,7 +722,7 @@ static void 
 usage(void)
 {
fprintf(stderr,
-   "usage: units [-f unitsfile] [-UVq] [from-unit to-unit]\n");
+   "usage: units [-f unitsfile] [-H historyfile] [-UVq] [from-unit 
to-unit]\n");
exit(3);
 }
 
@@ -731,6 +730,7 @@ static struct option longopts[] = {
{"help", no_argument, NULL, 'h'},
{"exponential", no_argument, NULL, 'e'},
{"file", required_argument, NULL, 'f'},
+   {"history", required_argument, NULL, 'H'},
{"output-format", required_argument, NULL, 'o'},
{"quiet", no_argument, NULL, 'q'},
{"terse", no_argument, NULL, 't'},
@@ -749,15 +749,19 @@ main(int argc, char **argv)
int optchar;
bool quiet;
bool readfile;
+   bool quit;
History *inhistory;
EditLine *el;
HistEvent ev;
int inputsz;
+   char const * history_file;
 
quiet = false;
readfile = false;
-   outputformat = "%.8g";
-   while ((optchar = getopt_long(argc, argv, "+ehf:oqtvUV", longopts, 
NULL)) != -1) {
+   history_file = NULL;
+   outputformat = numfmt;
+   quit = false;
+   while ((optchar = getopt_long(argc, argv, "+ehf:oqtvHUV", longopts, 
NULL)) != -1) {
switch (optchar) {
case 'e':
outputformat = "%6e";
@@ -769,6 +773,9 @@ main(int argc, char **argv)
else
readunits(optarg);
break;
+   case 'H':
+   history_file = optarg;
+   break;
case 'q':
quiet = true;
break;
@@ -833,31 +840,41 @@ main(int argc, char **argv)
if (!quiet)
printf("%d units, %d prefixes\n", unitcount,
prefixcount);
-   for (;;) {

Re: svn commit: r298257 - head/usr.bin/units

2016-04-20 Thread Eitan Adler
On 19 April 2016 at 00:28, Xin LI  wrote:
> Author: delphij
> Date: Tue Apr 19 07:28:39 2016
> New Revision: 298257
> URL: https://svnweb.freebsd.org/changeset/base/298257
>
> Log:
>   Fix build breakage introduced by r298253.

Thanks! I forgot to commit this file.


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


svn commit: r298387 - head

2016-04-20 Thread Eitan Adler
Author: eadler
Date: Thu Apr 21 04:33:07 2016
New Revision: 298387
URL: https://svnweb.freebsd.org/changeset/base/298387

Log:
  Remove project.name which is a product of a bygone era.

Modified:
  head/.arcconfig

Modified: head/.arcconfig
==
--- head/.arcconfig Thu Apr 21 03:17:53 2016(r298386)
+++ head/.arcconfig Thu Apr 21 04:33:07 2016(r298387)
@@ -1,5 +1,4 @@
 {
-   "project.name": "S",
"repository.callsign" : "S",
"phabricator.uri" : "https://reviews.freebsd.org/;,
"history.immutable" : true
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r298381 - head/usr.sbin/mpsutil

2016-04-20 Thread Ngie Cooper
On Wed, Apr 20, 2016 at 2:32 PM, Baptiste Daroussin  wrote:
> Author: bapt
> Date: Wed Apr 20 21:32:34 2016
> New Revision: 298381
> URL: https://svnweb.freebsd.org/changeset/base/298381
>
> Log:

...

>   While here fix a test logic

Which was testing `sas1 == NULL`, but I can't figure that out without
looking at the diff.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r298374 - head/usr.sbin/mpsutil

2016-04-20 Thread Ngie Cooper
On Wed, Apr 20, 2016 at 2:11 PM, Baptiste Daroussin  wrote:
> Author: bapt
> Date: Wed Apr 20 21:11:49 2016
> New Revision: 298374
> URL: https://svnweb.freebsd.org/changeset/base/298374
>
> Log:
>   Plug leaks
>
>   Reported by:  Coverity
>   CID:  1340155 and 1340156
>   MFC after:1 week

This could have been simplified via a strategically placed goto...
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r298386 - head/share/dtrace

2016-04-20 Thread George V. Neville-Neil
Author: gnn
Date: Thu Apr 21 03:17:53 2016
New Revision: 298386
URL: https://svnweb.freebsd.org/changeset/base/298386

Log:
  Add the address at which the routine returned.
  
  MFC after:1 week
  Sponsored by: Rubicon Communications (Netgate)

Modified:
  head/share/dtrace/retval

Modified: head/share/dtrace/retval
==
--- head/share/dtrace/retvalWed Apr 20 23:56:25 2016(r298385)
+++ head/share/dtrace/retvalThu Apr 21 03:17:53 2016(r298386)
@@ -37,6 +37,6 @@
 #pragma D option quiet
 
 fbt::$1:return {
-   printf("%s %d\n", probefunc, arg1);
+   printf("%s+0x%x returned %d\n", probefunc, arg0, arg1);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r298367 - head/lib/libc/locale

2016-04-20 Thread Andrey Chernov
On 21.04.2016 3:57, Andrey Chernov wrote:
> On 20.04.2016 23:44, Baptiste Daroussin wrote:
>> Author: bapt
>> Date: Wed Apr 20 20:44:30 2016
>> New Revision: 298367
>> URL: https://svnweb.freebsd.org/changeset/base/298367
>>
>> Log:
>>   Check the returned value of memchr(3) before using it
>>   
>>   Reported by:   Coverity
>>   CID:   1338530
>>
>> Modified:
>>   head/lib/libc/locale/ascii.c
>>
>> Modified: head/lib/libc/locale/ascii.c
>> ==
>> --- head/lib/libc/locale/ascii.c Wed Apr 20 20:43:05 2016
>> (r298366)
>> +++ head/lib/libc/locale/ascii.c Wed Apr 20 20:44:30 2016
>> (r298367)
>> @@ -133,11 +133,14 @@ _ascii_mbsnrtowcs(wchar_t * __restrict d
>>  
>>  if (dst == NULL) {
>>  s = memchr(*src, '\0', nms);
>> +if (s == NULL)
>> +return (nms);
>> +
>>  if (*s & 0x80) {
>>  errno = EILSEQ;
>>  return ((size_t)-1);
>>  }
>> -return (s != NULL ? s - *src : nms);
>> +return (s - *src);
>>  }
>>  
>>  s = *src;
>>
> 
> The whole code is incorrect, only the very first char is checked, there
> must be a loop like in -stable:
> 
>   if (dst == NULL) {
> for (s = *src; nms > 0 && *s != '\0'; s++, nms--) {
> if (*s & 0x80) {
> errno = EILSEQ;
> return ((size_t)-1);
> }
> }
> return (s - *src);
>   }
> 
> Since svn history is lost on deleting, I don't know why incorrect
> version was committed.
> 

Typo, the very first == the very last, i.e. only NUL char is checked
which always pass.

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


Re: svn commit: r298367 - head/lib/libc/locale

2016-04-20 Thread Andrey Chernov
On 20.04.2016 23:44, Baptiste Daroussin wrote:
> Author: bapt
> Date: Wed Apr 20 20:44:30 2016
> New Revision: 298367
> URL: https://svnweb.freebsd.org/changeset/base/298367
> 
> Log:
>   Check the returned value of memchr(3) before using it
>   
>   Reported by:Coverity
>   CID:1338530
> 
> Modified:
>   head/lib/libc/locale/ascii.c
> 
> Modified: head/lib/libc/locale/ascii.c
> ==
> --- head/lib/libc/locale/ascii.c  Wed Apr 20 20:43:05 2016
> (r298366)
> +++ head/lib/libc/locale/ascii.c  Wed Apr 20 20:44:30 2016
> (r298367)
> @@ -133,11 +133,14 @@ _ascii_mbsnrtowcs(wchar_t * __restrict d
>  
>   if (dst == NULL) {
>   s = memchr(*src, '\0', nms);
> + if (s == NULL)
> + return (nms);
> +
>   if (*s & 0x80) {
>   errno = EILSEQ;
>   return ((size_t)-1);
>   }
> - return (s != NULL ? s - *src : nms);
> + return (s - *src);
>   }
>  
>   s = *src;
> 

The whole code is incorrect, only the very first char is checked, there
must be a loop like in -stable:

if (dst == NULL) {
for (s = *src; nms > 0 && *s != '\0'; s++, nms--) {
if (*s & 0x80) {
errno = EILSEQ;
return ((size_t)-1);
}
}
return (s - *src);
}

Since svn history is lost on deleting, I don't know why incorrect
version was committed.

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


svn commit: r298385 - head/sbin/dhclient

2016-04-20 Thread Sepherosa Ziehau
Author: sephe
Date: Wed Apr 20 23:56:25 2016
New Revision: 298385
URL: https://svnweb.freebsd.org/changeset/base/298385

Log:
  dhclient: Log a warning instead of bailing upon "illegal" options
  
  In Azure, the DHCP servers add private option (id 0xf5), which contains
  binary form of an IPv4 address. Once this option is converted to string
  form, it could contain '$', e.g.
  
  IPv4 address: 100.72.36.54
  binary form: 0x64 0x48 0x24 0x36
  string form: "dH$6"
  
  dhclient bails upon "illegal" options like the above example, thus the
  VM bring-up will fail.
  
  Also as a side note, this "illegal" option detection was added in
  OpenBSD ~11years ago:
  
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sbin/dhclient/dhclient.c?rev=1.50=text/x-cvsweb-markup
  
  And it was removed along with the removal of script support in OpenBSD
  ~3years ago:
  
http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sbin/dhclient/dhclient.c?rev=1.159=text/x-cvsweb-markup
  
  Reported by:  Hongxiong Xian 
  Reviewed by:  jhb, Dexuan Cui 
  Tested by:Hongxiong Xian 
  Analyzed by:  Dong Liu 
  MFC after:1 week
  Sponsored by: Microsoft OSTC
  Differential Revision:https://reviews.freebsd.org/D5853

Modified:
  head/sbin/dhclient/dhclient.c

Modified: head/sbin/dhclient/dhclient.c
==
--- head/sbin/dhclient/dhclient.c   Wed Apr 20 22:41:19 2016
(r298384)
+++ head/sbin/dhclient/dhclient.c   Wed Apr 20 23:56:25 2016
(r298385)
@@ -2275,6 +2275,17 @@ script_set_env(struct client_state *clie
 {
int i, j, namelen;
 
+   /* No `` or $() command substitution allowed in environment values! */
+   for (j=0; j < strlen(value); j++)
+   switch (value[j]) {
+   case '`':
+   case '$':
+   warning("illegal character (%c) in value '%s'",
+   value[j], value);
+   /* Ignore this option */
+   return;
+   }
+
namelen = strlen(name);
 
for (i = 0; client->scriptEnv[i]; i++)
@@ -2311,16 +2322,6 @@ script_set_env(struct client_state *clie
strlen(value) + 1);
if (client->scriptEnv[i] == NULL)
error("script_set_env: no memory for variable assignment");
-
-   /* No `` or $() command substitution allowed in environment values! */
-   for (j=0; j < strlen(value); j++)
-   switch (value[j]) {
-   case '`':
-   case '$':
-   error("illegal character (%c) in value '%s'", value[j],
-   value);
-   /* not reached */
-   }
snprintf(client->scriptEnv[i], strlen(prefix) + strlen(name) +
1 + strlen(value) + 1, "%s%s=%s", prefix, name, value);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r298384 - head/sys/conf

2016-04-20 Thread Wojciech Macek
Author: wma
Date: Wed Apr 20 22:41:19 2016
New Revision: 298384
URL: https://svnweb.freebsd.org/changeset/base/298384

Log:
  Revert r298357
  
  Revert workaround fixed by r298361

Modified:
  head/sys/conf/kern.post.mk

Modified: head/sys/conf/kern.post.mk
==
--- head/sys/conf/kern.post.mk  Wed Apr 20 22:38:00 2016(r298383)
+++ head/sys/conf/kern.post.mk  Wed Apr 20 22:41:19 2016(r298384)
@@ -364,8 +364,6 @@ embedfs_${MFS_IMAGE:T:R}.o: ${MFS_IMAGE}
--output-target ${EMBEDFS_FORMAT.${MACHINE_ARCH}} \
--binary-architecture ${EMBEDFS_ARCH.${MACHINE_ARCH}} \
${MFS_IMAGE} ${.TARGET}
-   # Provide set of two distinct regexp to work around an elfcopy bug
-   # fixed in r298361 (last three).
${OBJCOPY} \
--rename-section .data=mfs,contents,alloc,load,readonly,data \
--redefine-sym \
@@ -374,12 +372,6 @@ embedfs_${MFS_IMAGE:T:R}.o: ${MFS_IMAGE}
_binary_${MFS_IMAGE:C,[^[:alnum:]],_,g}_start=mfs_root \
--redefine-sym \
_binary_${MFS_IMAGE:C,[^[:alnum:]],_,g}_end=mfs_root_end \
-   --redefine-sym \
-   _binary_${MFS_IMAGE:C,[^-/[:alnum:]],_,g}_size=__mfs_root_size \
-   --redefine-sym \
-   _binary_${MFS_IMAGE:C,[^-/[:alnum:]],_,g}_start=mfs_root \
-   --redefine-sym \
-   _binary_${MFS_IMAGE:C,[^-/[:alnum:]],_,g}_end=mfs_root_end \
${.TARGET}
 .endif
 .endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r298383 - head/sys/arm/broadcom/bcm2835

2016-04-20 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Wed Apr 20 22:38:00 2016
New Revision: 298383
URL: https://svnweb.freebsd.org/changeset/base/298383

Log:
  Force framebuffer virtual viewport to be the same as physical
  
  VideoCore reports garbage in viewport geometry fields unless
  viewport was set previously by earlier stage boot loader. So
  when booting FreeBSD kernel directly from VideoCore's start.elf
  framebuffer intialization fails due to invalid vxres, vyres
  values. Make sure we request viewport to be equal to physical
  resolution
  
  Submitted by: Sylvain Garrigues 

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_fb.c
  head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c
  head/sys/arm/broadcom/bcm2835/bcm2835_mbox.c
  head/sys/arm/broadcom/bcm2835/bcm2835_mbox_prop.h

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_fb.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_fb.c  Wed Apr 20 21:37:32 2016
(r298382)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_fb.c  Wed Apr 20 22:38:00 2016
(r298383)
@@ -149,6 +149,9 @@ bcm_fb_attach(device_t dev)
if (bcm2835_mbox_fb_get_w_h() != 0)
return (ENXIO);
fb.bpp = FB_DEPTH;
+   fb.vxres = fb.xres;
+   fb.vyres = fb.yres;
+   fb.xoffset = fb.yoffset = 0;
if (bcm2835_mbox_fb_init() != 0)
return (ENXIO);
 

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c Wed Apr 20 21:37:32 2016
(r298382)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_fbd.c Wed Apr 20 22:38:00 2016
(r298383)
@@ -80,6 +80,10 @@ bcm_fb_init(struct bcmsc_softc *sc, stru
return (ENXIO);
fb->bpp = FB_DEPTH;
 
+   fb->vxres = fb->xres;
+   fb->vyres = fb->yres;
+   fb->xoffset = fb->yoffset = 0;
+
if ((err = bcm2835_mbox_fb_init(fb)) != 0) {
device_printf(sc->dev, "bcm2835_mbox_fb_init failed, err=%d\n", 
err);
return (ENXIO);

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_mbox.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_mbox.cWed Apr 20 21:37:32 
2016(r298382)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_mbox.cWed Apr 20 22:38:00 
2016(r298383)
@@ -475,20 +475,12 @@ bcm2835_mbox_fb_get_w_h(struct bcm2835_f
msg.hdr.code = BCM2835_MBOX_CODE_REQ;
BCM2835_MBOX_INIT_TAG(_w_h, GET_PHYSICAL_W_H);
msg.physical_w_h.tag_hdr.val_len = 0;
-   BCM2835_MBOX_INIT_TAG(_w_h, GET_VIRTUAL_W_H);
-   msg.virtual_w_h.tag_hdr.val_len = 0;
-   BCM2835_MBOX_INIT_TAG(, GET_VIRTUAL_OFFSET);
-   msg.offset.tag_hdr.val_len = 0;
msg.end_tag = 0;
 
err = bcm2835_mbox_property(, sizeof(msg));
if (err == 0) {
fb->xres = msg.physical_w_h.body.resp.width;
fb->yres = msg.physical_w_h.body.resp.height;
-   fb->vxres = msg.virtual_w_h.body.resp.width;
-   fb->vyres = msg.virtual_w_h.body.resp.height;
-   fb->xoffset = msg.offset.body.resp.x;
-   fb->yoffset = msg.offset.body.resp.y;
}
 
return (err);

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_mbox_prop.h
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_mbox_prop.h   Wed Apr 20 21:37:32 
2016(r298382)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_mbox_prop.h   Wed Apr 20 22:38:00 
2016(r298383)
@@ -469,8 +469,6 @@ struct bcm2835_fb_config {
 struct msg_fb_get_w_h {
struct bcm2835_mbox_hdr hdr;
struct bcm2835_mbox_tag_fb_w_h physical_w_h;
-   struct bcm2835_mbox_tag_fb_w_h virtual_w_h;
-   struct bcm2835_mbox_tag_virtual_offset offset;
uint32_t end_tag;
 };
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r298377 - head/sys/dev/acpica

2016-04-20 Thread Jung-uk Kim
On 04/20/16 06:27 PM, John Baldwin wrote:
> On Wednesday, April 20, 2016 09:21:47 PM Jung-uk Kim wrote:
>> Author: jkim
>> Date: Wed Apr 20 21:21:47 2016
>> New Revision: 298377
>> URL: https://svnweb.freebsd.org/changeset/base/298377
>>
>> Log:
>>   Remove query flag from acpi_EvaluateOSC().  This function does not support
>>   return buffer (yet).
> 
> Hmm, I should probably fix that then instead?  The PCI variant is (now)
> incorrectly assuming it gets the buffer back in the array it passed in.
> The 5.0 spec at least says that the returned values are identical in
> length to the array passed in.  We could either add a new parameter for
> the outputs or copy them to the inputs.  Perhaps the former is better?

Yes and yes.

> I'd still prefer to set caps[0] in the common code since it is not
> UUID-specific but something all _OSC callers have to do.

Agreed iff we implement the return buffer.

Jung-uk Kim



signature.asc
Description: OpenPGP digital signature


Re: svn commit: r298372 - head/sys/dev/acpica

2016-04-20 Thread John Baldwin
On Wednesday, April 20, 2016 08:58:30 PM John Baldwin wrote:
> Author: jhb
> Date: Wed Apr 20 20:58:30 2016
> New Revision: 298372
> URL: https://svnweb.freebsd.org/changeset/base/298372
> 
> Log:
>   Invoke _OSC on Host-PCI bridges.
>   
>   Tell the firmware that we support PCI-express config space access
>   and MSI.

We should perhaps have some constants for some of the _OSC related fields.
I'm surprised ACPI-CA doesn't include constants for at least the return
values in the first word _OSC returns since that is defined by ACPI and
common to all the different _OSC variants.

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


Re: svn commit: r298377 - head/sys/dev/acpica

2016-04-20 Thread John Baldwin
On Wednesday, April 20, 2016 09:21:47 PM Jung-uk Kim wrote:
> Author: jkim
> Date: Wed Apr 20 21:21:47 2016
> New Revision: 298377
> URL: https://svnweb.freebsd.org/changeset/base/298377
> 
> Log:
>   Remove query flag from acpi_EvaluateOSC().  This function does not support
>   return buffer (yet).

Hmm, I should probably fix that then instead?  The PCI variant is (now)
incorrectly assuming it gets the buffer back in the array it passed in.
The 5.0 spec at least says that the returned values are identical in
length to the array passed in.  We could either add a new parameter for
the outputs or copy them to the inputs.  Perhaps the former is better?

I'd still prefer to set caps[0] in the common code since it is not
UUID-specific but something all _OSC callers have to do.

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


svn commit: r298382 - head/usr.sbin/sesutil

2016-04-20 Thread Baptiste Daroussin
Author: bapt
Date: Wed Apr 20 21:37:32 2016
New Revision: 298382
URL: https://svnweb.freebsd.org/changeset/base/298382

Log:
  Plug memory leak
  
  Reported by:  coverity
  CID:  1331664, 1331665

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

Modified: head/usr.sbin/sesutil/sesutil.c
==
--- head/usr.sbin/sesutil/sesutil.c Wed Apr 20 21:32:34 2016
(r298381)
+++ head/usr.sbin/sesutil/sesutil.c Wed Apr 20 21:37:32 2016
(r298382)
@@ -272,6 +272,7 @@ sesled(int argc, char **argv, bool setfa
}
}
}
+   free(objp);
close(fd);
}
globfree();
@@ -424,6 +425,7 @@ objmap(int argc, char **argv __unused)
sbuf_delete(extra);
free(e_devname.elm_devnames);
}
+   free(e_ptr);
close(fd);
}
globfree();
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r298381 - head/usr.sbin/mpsutil

2016-04-20 Thread Baptiste Daroussin
Author: bapt
Date: Wed Apr 20 21:32:34 2016
New Revision: 298381
URL: https://svnweb.freebsd.org/changeset/base/298381

Log:
  Plug various resources leak
  While here fix a test logic
  
  Reported by:  coverity
  CID:  1332096, 1332097, 1332098, 1332099, 1332100, 1332101, 1332102
  MFC after:1 week

Modified:
  head/usr.sbin/mpsutil/mps_show.c

Modified: head/usr.sbin/mpsutil/mps_show.c
==
--- head/usr.sbin/mpsutil/mps_show.cWed Apr 20 21:30:56 2016
(r298380)
+++ head/usr.sbin/mpsutil/mps_show.cWed Apr 20 21:32:34 2016
(r298381)
@@ -139,15 +139,19 @@ show_adapter(int ac, char **av)
if (sas0 == NULL) {
error = errno;
warn("Error retrieving SAS IO Unit page %d", IOCStatus);
+   free(sas0);
+   close(fd);
return (error);
}
 
sas1 = mps_read_extended_config_page(fd,
MPI2_CONFIG_EXTPAGETYPE_SAS_IO_UNIT,
MPI2_SASIOUNITPAGE1_PAGEVERSION, 1, 0, );
-   if (sas0 == NULL) {
+   if (sas1 == NULL) {
error = errno;
warn("Error retrieving SAS IO Unit page %d", IOCStatus);
+   free(sas0);
+   close(fd);
return (error);
}
printf("\n");
@@ -266,12 +270,14 @@ show_adapters(int ac, char **av)
error = errno;
warn("Failed to get controller info");
close(fd);
+   free(facts);
return (error);
}
if (man0->Header.PageLength < sizeof(*man0) / 4) {
warnx("Invalid controller info");
close(fd);
free(man0);
+   free(facts);
return (EINVAL);
}
printf("/dev/mp%s%d\t%16s %16s%08x\n",
@@ -476,6 +482,7 @@ show_devices(int ac, char **av)
break;
error = errno;
warn("Error retrieving device page");
+   close(fd);
return (error);
}
handle = device->DevHandle;
@@ -515,6 +522,8 @@ show_devices(int ac, char **av)
error = errno;
warn("Error retrieving expander page 1: 
0x%x",
IOCStatus);
+   close(fd);
+   free(device);
return (error);
}
speed = " ";
@@ -579,6 +588,7 @@ show_enclosures(int ac, char **av)
break;
error = errno;
warn("Error retrieving enclosure page");
+   close(fd);
return (error);
}
type = get_enc_type(enc->Flags, );
@@ -629,6 +639,7 @@ show_expanders(int ac, char **av)
break;
error = errno;
warn("Error retrieving expander page 0");
+   close(fd);
return (error);
}
 
@@ -766,6 +777,7 @@ show_cfgpage(int ac, char **av)
printf("Page 0x%x: %s %d, %s\n", page, pgname, num, pgattr);
hexdump(data, len, NULL, HD_REVERSED | 4);
free(data);
+   close(fd);
return (0);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r298380 - head/sys/dev/acpica

2016-04-20 Thread Jung-uk Kim
Author: jkim
Date: Wed Apr 20 21:30:56 2016
New Revision: 298380
URL: https://svnweb.freebsd.org/changeset/base/298380

Log:
  Prefer sizeof(*pointer) over sizeof(type).  No funtional change.

Modified:
  head/sys/dev/acpica/acpi.c

Modified: head/sys/dev/acpica/acpi.c
==
--- head/sys/dev/acpica/acpi.c  Wed Apr 20 21:26:59 2016(r298379)
+++ head/sys/dev/acpica/acpi.c  Wed Apr 20 21:30:56 2016(r298380)
@@ -2497,7 +2497,7 @@ acpi_EvaluateOSC(ACPI_HANDLE handle, uin
arg[2].Type = ACPI_TYPE_INTEGER;
arg[2].Integer.Value = count;
arg[3].Type = ACPI_TYPE_BUFFER;
-   arg[3].Buffer.Length = count * sizeof(uint32_t);
+   arg[3].Buffer.Length = count * sizeof(*caps);
arg[3].Buffer.Pointer = (uint8_t *)caps;
return (AcpiEvaluateObject(handle, "_OSC", , NULL));
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r298379 - head/sys/dev/acpica

2016-04-20 Thread Jung-uk Kim
Author: jkim
Date: Wed Apr 20 21:26:59 2016
New Revision: 298379
URL: https://svnweb.freebsd.org/changeset/base/298379

Log:
  There is no need to use array any more.  No functional change.

Modified:
  head/sys/dev/acpica/acpi_cpu.c

Modified: head/sys/dev/acpica/acpi_cpu.c
==
--- head/sys/dev/acpica/acpi_cpu.c  Wed Apr 20 21:23:42 2016
(r298378)
+++ head/sys/dev/acpica/acpi_cpu.c  Wed Apr 20 21:26:59 2016
(r298379)
@@ -296,7 +296,7 @@ static int
 acpi_cpu_attach(device_t dev)
 {
 ACPI_BUFFER   buf;
-ACPI_OBJECT   arg[1], *obj;
+ACPI_OBJECT   arg, *obj;
 ACPI_OBJECT_LIST  arglist;
 struct pcpu   *pcpu_data;
 struct acpi_cpu_softc *sc;
@@ -399,11 +399,11 @@ acpi_cpu_attach(device_t dev)
device_printf(dev, "_OSC returned status %#x\n", cap_set[0]);
}
else {
-   arglist.Pointer = arg;
+   arglist.Pointer = 
arglist.Count = 1;
-   arg[0].Type = ACPI_TYPE_BUFFER;
-   arg[0].Buffer.Length = sizeof(cap_set);
-   arg[0].Buffer.Pointer = (uint8_t *)cap_set;
+   arg.Type = ACPI_TYPE_BUFFER;
+   arg.Buffer.Length = sizeof(cap_set);
+   arg.Buffer.Pointer = (uint8_t *)cap_set;
cap_set[0] = 1; /* revision */
cap_set[1] = 1; /* number of capabilities integers */
cap_set[2] = sc->cpu_features;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r298378 - head/usr.bin/localedef

2016-04-20 Thread Baptiste Daroussin
Author: bapt
Date: Wed Apr 20 21:23:42 2016
New Revision: 298378
URL: https://svnweb.freebsd.org/changeset/base/298378

Log:
  Plug memory leaks
  
  Reported by:  Coverity
  CID=  1338535, 1338536, 1338542, 1338569, 1338570

Modified:
  head/usr.bin/localedef/collate.c
  head/usr.bin/localedef/time.c

Modified: head/usr.bin/localedef/collate.c
==
--- head/usr.bin/localedef/collate.cWed Apr 20 21:21:47 2016
(r298377)
+++ head/usr.bin/localedef/collate.cWed Apr 20 21:23:42 2016
(r298378)
@@ -502,6 +502,7 @@ define_collsym(char *name)
 * This should never happen because we are only called
 * for undefined symbols.
 */
+   free(sym);
INTERR;
return;
}
@@ -538,6 +539,7 @@ get_collundef(char *name)
if (((ud = calloc(sizeof (*ud), 1)) == NULL) ||
((ud->name = strdup(name)) == NULL)) {
fprintf(stderr,"out of memory");
+   free(ud);
return (NULL);
}
for (i = 0; i < NUM_WT; i++) {
@@ -812,6 +814,7 @@ define_collelem(char *name, wchar_t *wcs
if ((RB_FIND(elem_by_symbol, _by_symbol, e) != NULL) ||
(RB_FIND(elem_by_expand, _by_expand, e) != NULL)) {
fprintf(stderr, "duplicate collating element definition");
+   free(e);
return;
}
RB_INSERT(elem_by_symbol, _by_symbol, e);

Modified: head/usr.bin/localedef/time.c
==
--- head/usr.bin/localedef/time.c   Wed Apr 20 21:21:47 2016
(r298377)
+++ head/usr.bin/localedef/time.c   Wed Apr 20 21:23:42 2016
(r298378)
@@ -87,6 +87,7 @@ add_time_str(wchar_t *wcs)
case T_ERA_T_FMT:
case T_ERA_D_T_FMT:
/* Silently ignore it. */
+   free(str);
break;
default:
free(str);
@@ -139,6 +140,7 @@ add_time_list(wchar_t *wcs)
tm.pm = str;
} else {
fprintf(stderr,"too many list elements");
+   free(str);
}
break;
case T_ALT_DIGITS:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r298377 - head/sys/dev/acpica

2016-04-20 Thread Jung-uk Kim
Author: jkim
Date: Wed Apr 20 21:21:47 2016
New Revision: 298377
URL: https://svnweb.freebsd.org/changeset/base/298377

Log:
  Remove query flag from acpi_EvaluateOSC().  This function does not support
  return buffer (yet).

Modified:
  head/sys/dev/acpica/acpi.c
  head/sys/dev/acpica/acpi_cpu.c
  head/sys/dev/acpica/acpi_pcib_acpi.c
  head/sys/dev/acpica/acpivar.h

Modified: head/sys/dev/acpica/acpi.c
==
--- head/sys/dev/acpica/acpi.c  Wed Apr 20 21:15:55 2016(r298376)
+++ head/sys/dev/acpica/acpi.c  Wed Apr 20 21:21:47 2016(r298377)
@@ -2482,7 +2482,7 @@ acpi_AppendBufferResource(ACPI_BUFFER *b
 
 ACPI_STATUS
 acpi_EvaluateOSC(ACPI_HANDLE handle, uint8_t *uuid, int revision, int count,
-uint32_t *caps, bool query)
+uint32_t *caps)
 {
ACPI_OBJECT arg[4];
ACPI_OBJECT_LIST arglist;
@@ -2499,7 +2499,6 @@ acpi_EvaluateOSC(ACPI_HANDLE handle, uin
arg[3].Type = ACPI_TYPE_BUFFER;
arg[3].Buffer.Length = count * sizeof(uint32_t);
arg[3].Buffer.Pointer = (uint8_t *)caps;
-   caps[0] = query ? 1 : 0;
return (AcpiEvaluateObject(handle, "_OSC", , NULL));
 }
 

Modified: head/sys/dev/acpica/acpi_cpu.c
==
--- head/sys/dev/acpica/acpi_cpu.c  Wed Apr 20 21:15:55 2016
(r298376)
+++ head/sys/dev/acpica/acpi_cpu.c  Wed Apr 20 21:21:47 2016
(r298377)
@@ -391,9 +391,9 @@ acpi_cpu_attach(device_t dev)
  * Intel Processor Vendor-Specific ACPI Interface Specification.
  */
 if (sc->cpu_features) {
+   cap_set[0] = 0;
cap_set[1] = sc->cpu_features;
-   status = acpi_EvaluateOSC(sc->cpu_handle, cpu_oscuuid, 1, 2, cap_set,
-   false);
+   status = acpi_EvaluateOSC(sc->cpu_handle, cpu_oscuuid, 1, 2, cap_set);
if (ACPI_SUCCESS(status)) {
if (cap_set[0] != 0)
device_printf(dev, "_OSC returned status %#x\n", cap_set[0]);

Modified: head/sys/dev/acpica/acpi_pcib_acpi.c
==
--- head/sys/dev/acpica/acpi_pcib_acpi.cWed Apr 20 21:15:55 2016
(r298376)
+++ head/sys/dev/acpica/acpi_pcib_acpi.cWed Apr 20 21:21:47 2016
(r298377)
@@ -306,6 +306,9 @@ acpi_pcib_osc(struct acpi_hpcib_softc *s
0x96, 0x57, 0x74, 0x41, 0xc0, 0x3d, 0xd7, 0x66
};
 
+   /* Query Support Flag */
+   cap_set[0] = 0;
+
/* Support Field: Extended PCI Config Space, MSI */
cap_set[1] = 0x11;
 
@@ -313,7 +316,7 @@ acpi_pcib_osc(struct acpi_hpcib_softc *s
cap_set[2] = 0;
 
status = acpi_EvaluateOSC(sc->ap_handle, pci_host_bridge_uuid, 1,
-   nitems(cap_set), cap_set, false);
+   nitems(cap_set), cap_set);
if (ACPI_FAILURE(status)) {
if (status == AE_NOT_FOUND)
return;

Modified: head/sys/dev/acpica/acpivar.h
==
--- head/sys/dev/acpica/acpivar.h   Wed Apr 20 21:15:55 2016
(r298376)
+++ head/sys/dev/acpica/acpivar.h   Wed Apr 20 21:21:47 2016
(r298377)
@@ -336,7 +336,7 @@ ACPI_STATUS acpi_FindIndexedResource(ACP
 ACPI_STATUSacpi_AppendBufferResource(ACPI_BUFFER *buf,
ACPI_RESOURCE *res);
 ACPI_STATUSacpi_EvaluateOSC(ACPI_HANDLE handle, uint8_t *uuid,
-   int revision, int count, uint32_t *caps, bool query);
+   int revision, int count, uint32_t *caps);
 ACPI_STATUSacpi_OverrideInterruptLevel(UINT32 InterruptNumber);
 ACPI_STATUSacpi_SetIntrModel(int model);
 intacpi_ReqSleepState(struct acpi_softc *sc, int state);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r298376 - head/sys/net80211

2016-04-20 Thread Andriy Voskoboinyk
Author: avos
Date: Wed Apr 20 21:15:55 2016
New Revision: 298376
URL: https://svnweb.freebsd.org/changeset/base/298376

Log:
  net80211: hide subtype mask & shift in function call.
  
  Hide subtype mask/shift (which is used for index calculation
  in ieee80211_mgt_subtype_name[] array) in function call.
  
  Tested with RTL8188CUS, STA mode.
  
  Reviewed by:  adrian
  Differential Revision:https://reviews.freebsd.org/D5369

Modified:
  head/sys/net80211/ieee80211_adhoc.c
  head/sys/net80211/ieee80211_hostap.c
  head/sys/net80211/ieee80211_input.c
  head/sys/net80211/ieee80211_input.h
  head/sys/net80211/ieee80211_mesh.c
  head/sys/net80211/ieee80211_output.c
  head/sys/net80211/ieee80211_proto.c
  head/sys/net80211/ieee80211_proto.h
  head/sys/net80211/ieee80211_scan.c
  head/sys/net80211/ieee80211_sta.c
  head/sys/net80211/ieee80211_tdma.c
  head/sys/net80211/ieee80211_wds.c

Modified: head/sys/net80211/ieee80211_adhoc.c
==
--- head/sys/net80211/ieee80211_adhoc.c Wed Apr 20 21:13:24 2016
(r298375)
+++ head/sys/net80211/ieee80211_adhoc.c Wed Apr 20 21:15:55 2016
(r298376)
@@ -613,8 +613,7 @@ adhoc_input(struct ieee80211_node *ni, s
if ((ieee80211_msg_debug(vap) && doprint(vap, subtype)) ||
ieee80211_msg_dumppkts(vap)) {
if_printf(ifp, "received %s from %s rssi %d\n",
-   ieee80211_mgt_subtype_name[subtype >>
-   IEEE80211_FC0_SUBTYPE_SHIFT],
+   ieee80211_mgt_subtype_name(subtype),
ether_sprintf(wh->i_addr2), rssi);
}
 #endif

Modified: head/sys/net80211/ieee80211_hostap.c
==
--- head/sys/net80211/ieee80211_hostap.cWed Apr 20 21:13:24 2016
(r298375)
+++ head/sys/net80211/ieee80211_hostap.cWed Apr 20 21:15:55 2016
(r298376)
@@ -831,8 +831,7 @@ hostap_input(struct ieee80211_node *ni, 
if ((ieee80211_msg_debug(vap) && doprint(vap, subtype)) ||
ieee80211_msg_dumppkts(vap)) {
if_printf(ifp, "received %s from %s rssi %d\n",
-   ieee80211_mgt_subtype_name[subtype >>
-   IEEE80211_FC0_SUBTYPE_SHIFT],
+   ieee80211_mgt_subtype_name(subtype),
ether_sprintf(wh->i_addr2), rssi);
}
 #endif
@@ -2184,8 +2183,7 @@ hostap_recv_mgmt(struct ieee80211_node *
}
IEEE80211_NOTE(vap, IEEE80211_MSG_AUTH, ni,
"recv %s (reason: %d (%s))",
-   ieee80211_mgt_subtype_name[subtype >>
-   IEEE80211_FC0_SUBTYPE_SHIFT],
+   ieee80211_mgt_subtype_name(subtype),
reason, ieee80211_reason_to_string(reason));
if (ni != vap->iv_bss)
ieee80211_node_leave(ni);

Modified: head/sys/net80211/ieee80211_input.c
==
--- head/sys/net80211/ieee80211_input.c Wed Apr 20 21:13:24 2016
(r298375)
+++ head/sys/net80211/ieee80211_input.c Wed Apr 20 21:15:55 2016
(r298376)
@@ -930,12 +930,8 @@ ieee80211_discard_frame(const struct iee
 
if_printf(vap->iv_ifp, "[%s] discard ",
ether_sprintf(ieee80211_getbssid(vap, wh)));
-   if (type == NULL) {
-   printf("%s frame, ", ieee80211_mgt_subtype_name[
-   (wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) >>
-   IEEE80211_FC0_SUBTYPE_SHIFT]);
-   } else
-   printf("%s frame, ", type);
+   printf("%s frame, ", type != NULL ? type :
+   ieee80211_mgt_subtype_name(wh->i_fc[0]));
va_start(ap, fmt);
vprintf(fmt, ap);
va_end(ap);

Modified: head/sys/net80211/ieee80211_input.h
==
--- head/sys/net80211/ieee80211_input.h Wed Apr 20 21:13:24 2016
(r298375)
+++ head/sys/net80211/ieee80211_input.h Wed Apr 20 21:15:55 2016
(r298376)
@@ -62,8 +62,7 @@ void  ieee80211_ssid_mismatch(struct ieee
memcmp((_ssid) + 2, (_ni)->ni_essid, (_ssid)[1]) != 0)) {   \
if (ieee80211_msg_input(vap))   \
ieee80211_ssid_mismatch(vap,\
-   ieee80211_mgt_subtype_name[subtype >>   \
-   IEEE80211_FC0_SUBTYPE_SHIFT],   \
+   ieee80211_mgt_subtype_name(subtype),\
wh->i_addr2, _ssid);\
vap->iv_stats.is_rx_ssidmismatch++; \
_action;

svn commit: r298375 - head/sys/netsmb

2016-04-20 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Apr 20 21:13:24 2016
New Revision: 298375
URL: https://svnweb.freebsd.org/changeset/base/298375

Log:
  Remove unused SMB_DIALECT_MAX macro.
  
  Found by: jhb

Modified:
  head/sys/netsmb/smb_smb.c

Modified: head/sys/netsmb/smb_smb.c
==
--- head/sys/netsmb/smb_smb.c   Wed Apr 20 21:11:49 2016(r298374)
+++ head/sys/netsmb/smb_smb.c   Wed Apr 20 21:13:24 2016(r298375)
@@ -68,8 +68,6 @@ static struct smb_dialect smb_dialects[]
{-1,NULL}
 };
 
-#defineSMB_DIALECT_MAX (nitems(smb_dialects) - 2)
-
 static u_int32_t
 smb_vc_maxread(struct smb_vc *vcp)
 {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r298374 - head/usr.sbin/mpsutil

2016-04-20 Thread Baptiste Daroussin
Author: bapt
Date: Wed Apr 20 21:11:49 2016
New Revision: 298374
URL: https://svnweb.freebsd.org/changeset/base/298374

Log:
  Plug leaks
  
  Reported by:  Coverity
  CID:  1340155 and 1340156
  MFC after:1 week

Modified:
  head/usr.sbin/mpsutil/mps_flash.c

Modified: head/usr.sbin/mpsutil/mps_flash.c
==
--- head/usr.sbin/mpsutil/mps_flash.c   Wed Apr 20 21:04:39 2016
(r298373)
+++ head/usr.sbin/mpsutil/mps_flash.c   Wed Apr 20 21:11:49 2016
(r298374)
@@ -83,6 +83,7 @@ flash_save(int argc, char **argv)
 
if ((size = mps_firmware_get(fd, _buffer, bios)) < 0) {
warnx("Fail to save %s", argv[1]);
+   close(fd);
return (1);
}
 
@@ -100,6 +101,7 @@ flash_save(int argc, char **argv)
error = errno;
warn("write");
free(firmware_buffer);
+   close(fd);
return (error);
}
written += ret;
@@ -189,12 +191,14 @@ flash_update(int argc, char **argv)
warnx("Invalid bios: no boot record magic number");
munmap(mem, st.st_size);
close(fd);
+   free(facts);
return (1);
}
if ((st.st_size % 512) != 0) {
warnx("Invalid bios: size not a multiple of 512");
munmap(mem, st.st_size);
close(fd);
+   free(facts);
return (1);
}
} else {
@@ -206,6 +210,7 @@ flash_update(int argc, char **argv)
warnx("  Image Vendor ID: %04x", fwheader->VendorID);
munmap(mem, st.st_size);
close(fd);
+   free(facts);
return (1);
}
 
@@ -215,6 +220,7 @@ flash_update(int argc, char **argv)
warnx("  Image Product ID: %04x", fwheader->ProductID);
munmap(mem, st.st_size);
close(fd);
+   free(facts);
return (1);
}
}
@@ -224,11 +230,13 @@ flash_update(int argc, char **argv)
warnx("Fail to update %s", argv[1]);
munmap(mem, st.st_size);
close(fd);
+   free(facts);
return (1);
}
 
munmap(mem, st.st_size);
close(fd);
+   free(facts);
printf("%s successfully updated\n", argv[1]);
return (0);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r298373 - head/sys/net

2016-04-20 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Apr 20 21:04:39 2016
New Revision: 298373
URL: https://svnweb.freebsd.org/changeset/base/298373

Log:
  Add more fields from struct ifnet needed during debugging a kernel panic.
  Move if_fib into the right place.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/net/if_debug.c

Modified: head/sys/net/if_debug.c
==
--- head/sys/net/if_debug.c Wed Apr 20 20:58:30 2016(r298372)
+++ head/sys/net/if_debug.c Wed Apr 20 21:04:39 2016(r298373)
@@ -65,6 +65,9 @@ if_show_ifnet(struct ifnet *ifp)
IF_DB_PRINTF("%d", if_index_reserved);
IF_DB_PRINTF("%p", if_softc);
IF_DB_PRINTF("%p", if_l2com);
+   IF_DB_PRINTF("%p", if_afdata);
+   IF_DB_PRINTF("%d", if_afdata_initialized);
+   IF_DB_PRINTF("%u", if_fib);
IF_DB_PRINTF("%p", if_vnet);
IF_DB_PRINTF("%p", if_home_vnet);
IF_DB_PRINTF("%p", if_vlantrunk);
@@ -87,7 +90,6 @@ if_show_ifnet(struct ifnet *ifp)
IF_DB_PRINTF("%d", if_snd.ifq_drv_maxlen);
IF_DB_PRINTF("%d", if_snd.altq_type);
IF_DB_PRINTF("%x", if_snd.altq_flags);
-   IF_DB_PRINTF("%u", if_fib);
 #undef IF_DB_PRINTF
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r298370 - head/sys/dev/acpica

2016-04-20 Thread John Baldwin
Author: jhb
Date: Wed Apr 20 20:55:58 2016
New Revision: 298370
URL: https://svnweb.freebsd.org/changeset/base/298370

Log:
  Add a wrapper for evaluating _OSC methods.
  
  This wrapper does not translate errors in the first word to ACPI
  error status returns.  Use this wrapper in the acpi_cpu(4) driver in
  place of the existing _OSC code.  While here, fix a bug where the wrong
  count of words was passed when invoking _OSC.
  
  Reviewed by:  jkim
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D6022

Modified:
  head/sys/dev/acpica/acpi.c
  head/sys/dev/acpica/acpi_cpu.c
  head/sys/dev/acpica/acpivar.h

Modified: head/sys/dev/acpica/acpi.c
==
--- head/sys/dev/acpica/acpi.c  Wed Apr 20 20:54:47 2016(r298369)
+++ head/sys/dev/acpica/acpi.c  Wed Apr 20 20:55:58 2016(r298370)
@@ -2480,6 +2480,29 @@ acpi_AppendBufferResource(ACPI_BUFFER *b
 return (AE_OK);
 }
 
+ACPI_STATUS
+acpi_EvaluateOSC(ACPI_HANDLE handle, uint8_t *uuid, int revision, int count,
+uint32_t *caps, bool query)
+{
+   ACPI_OBJECT arg[4];
+   ACPI_OBJECT_LIST arglist;
+
+   arglist.Pointer = arg;
+   arglist.Count = 4;
+   arg[0].Type = ACPI_TYPE_BUFFER;
+   arg[0].Buffer.Length = ACPI_UUID_LENGTH;
+   arg[0].Buffer.Pointer = uuid;
+   arg[1].Type = ACPI_TYPE_INTEGER;
+   arg[1].Integer.Value = revision;
+   arg[2].Type = ACPI_TYPE_INTEGER;
+   arg[2].Integer.Value = count;
+   arg[3].Type = ACPI_TYPE_BUFFER;
+   arg[3].Buffer.Length = count * sizeof(uint32_t);
+   arg[3].Buffer.Pointer = (uint8_t *)caps;
+   caps[0] = query ? 1 : 0;
+   return (AcpiEvaluateObject(handle, "_OSC", , NULL));
+}
+
 /*
  * Set interrupt model.
  */

Modified: head/sys/dev/acpica/acpi_cpu.c
==
--- head/sys/dev/acpica/acpi_cpu.c  Wed Apr 20 20:54:47 2016
(r298369)
+++ head/sys/dev/acpica/acpi_cpu.c  Wed Apr 20 20:55:58 2016
(r298370)
@@ -296,7 +296,7 @@ static int
 acpi_cpu_attach(device_t dev)
 {
 ACPI_BUFFER   buf;
-ACPI_OBJECT   arg[4], *obj;
+ACPI_OBJECT   arg[1], *obj;
 ACPI_OBJECT_LIST  arglist;
 struct pcpu   *pcpu_data;
 struct acpi_cpu_softc *sc;
@@ -391,21 +391,9 @@ acpi_cpu_attach(device_t dev)
  * Intel Processor Vendor-Specific ACPI Interface Specification.
  */
 if (sc->cpu_features) {
-   arglist.Pointer = arg;
-   arglist.Count = 4;
-   arg[0].Type = ACPI_TYPE_BUFFER;
-   arg[0].Buffer.Length = sizeof(cpu_oscuuid);
-   arg[0].Buffer.Pointer = cpu_oscuuid;/* UUID */
-   arg[1].Type = ACPI_TYPE_INTEGER;
-   arg[1].Integer.Value = 1;   /* revision */
-   arg[2].Type = ACPI_TYPE_INTEGER;
-   arg[2].Integer.Value = 1;   /* count */
-   arg[3].Type = ACPI_TYPE_BUFFER;
-   arg[3].Buffer.Length = sizeof(cap_set); /* Capabilities buffer */
-   arg[3].Buffer.Pointer = (uint8_t *)cap_set;
-   cap_set[0] = 0; /* status */
cap_set[1] = sc->cpu_features;
-   status = AcpiEvaluateObject(sc->cpu_handle, "_OSC", , NULL);
+   status = acpi_EvaluateOSC(sc->cpu_handle, cpu_oscuuid, 1, 2, cap_set,
+   false);
if (ACPI_SUCCESS(status)) {
if (cap_set[0] != 0)
device_printf(dev, "_OSC returned status %#x\n", cap_set[0]);

Modified: head/sys/dev/acpica/acpivar.h
==
--- head/sys/dev/acpica/acpivar.h   Wed Apr 20 20:54:47 2016
(r298369)
+++ head/sys/dev/acpica/acpivar.h   Wed Apr 20 20:55:58 2016
(r298370)
@@ -335,6 +335,8 @@ ACPI_STATUS acpi_FindIndexedResource(ACP
ACPI_RESOURCE **resp);
 ACPI_STATUSacpi_AppendBufferResource(ACPI_BUFFER *buf,
ACPI_RESOURCE *res);
+ACPI_STATUSacpi_EvaluateOSC(ACPI_HANDLE handle, uint8_t *uuid,
+   int revision, int count, uint32_t *caps, bool query);
 ACPI_STATUSacpi_OverrideInterruptLevel(UINT32 InterruptNumber);
 ACPI_STATUSacpi_SetIntrModel(int model);
 intacpi_ReqSleepState(struct acpi_softc *sc, int state);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r298369 - head/usr.bin/at

2016-04-20 Thread Baptiste Daroussin
Author: bapt
Date: Wed Apr 20 20:54:47 2016
New Revision: 298369
URL: https://svnweb.freebsd.org/changeset/base/298369

Log:
  Fix typo: actually test the return of strchr(3)
  
  Reported by:  Coverity
  CID:  1007335
  MFC after:3 days

Modified:
  head/usr.bin/at/at.c

Modified: head/usr.bin/at/at.c
==
--- head/usr.bin/at/at.cWed Apr 20 20:48:54 2016(r298368)
+++ head/usr.bin/at/at.cWed Apr 20 20:54:47 2016(r298369)
@@ -351,7 +351,7 @@ writefile(time_t runtimer, char queue)
char *eqp;
 
eqp = strchr(*atenv, '=');
-   if (ap == NULL)
+   if (eqp == NULL)
eqp = *atenv;
else
{
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r298372 - head/sys/dev/acpica

2016-04-20 Thread John Baldwin
Author: jhb
Date: Wed Apr 20 20:58:30 2016
New Revision: 298372
URL: https://svnweb.freebsd.org/changeset/base/298372

Log:
  Invoke _OSC on Host-PCI bridges.
  
  Tell the firmware that we support PCI-express config space access
  and MSI.
  
  Reviewed by:  jkim
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D6023

Modified:
  head/sys/dev/acpica/acpi_pcib_acpi.c

Modified: head/sys/dev/acpica/acpi_pcib_acpi.c
==
--- head/sys/dev/acpica/acpi_pcib_acpi.cWed Apr 20 20:56:06 2016
(r298371)
+++ head/sys/dev/acpica/acpi_pcib_acpi.cWed Apr 20 20:58:30 2016
(r298372)
@@ -295,6 +295,40 @@ first_decoded_bus(struct acpi_hpcib_soft
 }
 #endif
 
+static void
+acpi_pcib_osc(struct acpi_hpcib_softc *sc)
+{
+   ACPI_STATUS status;
+   uint32_t cap_set[3];
+
+   static uint8_t pci_host_bridge_uuid[ACPI_UUID_LENGTH] = {
+   0x5b, 0x4d, 0xdb, 0x33, 0xf7, 0x1f, 0x1c, 0x40,
+   0x96, 0x57, 0x74, 0x41, 0xc0, 0x3d, 0xd7, 0x66
+   };
+
+   /* Support Field: Extended PCI Config Space, MSI */
+   cap_set[1] = 0x11;
+
+   /* Control Field */
+   cap_set[2] = 0;
+
+   status = acpi_EvaluateOSC(sc->ap_handle, pci_host_bridge_uuid, 1,
+   nitems(cap_set), cap_set, false);
+   if (ACPI_FAILURE(status)) {
+   if (status == AE_NOT_FOUND)
+   return;
+   device_printf(sc->ap_dev, "_OSC failed: %s\n",
+   AcpiFormatException(status));
+   return;
+   }
+
+   if (cap_set[0] != 0) {
+   device_printf(sc->ap_dev, "_OSC returned error %#x\n",
+   cap_set[0]);
+   return;
+   }
+}
+
 static int
 acpi_pcib_acpi_attach(device_t dev)
 {
@@ -321,6 +355,8 @@ acpi_pcib_acpi_attach(device_t dev)
 if (!acpi_DeviceIsPresent(dev))
return (ENXIO);
 
+acpi_pcib_osc(sc);
+
 /*
  * Get our segment number by evaluating _SEG.
  * It's OK for this to not exist.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r298371 - head/usr.bin/whereis

2016-04-20 Thread Baptiste Daroussin
Author: bapt
Date: Wed Apr 20 20:56:06 2016
New Revision: 298371
URL: https://svnweb.freebsd.org/changeset/base/298371

Log:
  Fix bad checking of the return of realloc(3)
  
  Reported by:  Coverity
  CID:  1007335
  MFC after:3 days

Modified:
  head/usr.bin/whereis/whereis.c

Modified: head/usr.bin/whereis/whereis.c
==
--- head/usr.bin/whereis/whereis.c  Wed Apr 20 20:55:58 2016
(r298370)
+++ head/usr.bin/whereis/whereis.c  Wed Apr 20 20:56:06 2016
(r298371)
@@ -207,7 +207,7 @@ decolonify(char *s, ccharp **cppp, int *
*cp = '\0';
if (strlen(s) && !contains(*cppp, s)) {
*cppp = realloc(*cppp, (*ip + 2) * sizeof(char *));
-   if (cppp == NULL)
+   if (*cppp == NULL)
abort();
(*cppp)[*ip] = s;
(*cppp)[*ip + 1] = NULL;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r298368 - head/contrib/netbsd-tests/lib/libc/ssp

2016-04-20 Thread Garrett Cooper
Author: ngie
Date: Wed Apr 20 20:48:54 2016
New Revision: 298368
URL: https://svnweb.freebsd.org/changeset/base/298368

Log:
  Fix coverity issue with contrib/netbsd-tests/lib/libc/ssp/h_read.c
  
  Ensure opening /dev/zero succeeds. Abort the test if it doesn't.
  
  Also, use _PATH_DEVZERO instead of hardcoding "/dev/zero"
  
  MFC after: 2 weeks
  CID: 1251410
  Reported by: Coverity
  Sponsored by: EMC / Isilon Storage Division"

Modified:
  head/contrib/netbsd-tests/lib/libc/ssp/h_read.c

Modified: head/contrib/netbsd-tests/lib/libc/ssp/h_read.c
==
--- head/contrib/netbsd-tests/lib/libc/ssp/h_read.c Wed Apr 20 20:44:30 
2016(r298367)
+++ head/contrib/netbsd-tests/lib/libc/ssp/h_read.c Wed Apr 20 20:48:54 
2016(r298368)
@@ -38,6 +38,7 @@ __RCSID("$NetBSD: h_read.c,v 1.1 2010/12
 
 #ifdef __FreeBSD__
 #include 
+#include 
 
 int
 main(int argc, char *argv[])
@@ -46,7 +47,8 @@ main(int argc, char *argv[])
int fd, n;
size_t len = atoi(argv[1]);
 
-   fd = open("/dev/zero", O_RDONLY);
+   if ((fd = open(_PATH_DEVZERO, O_RDONLY)) == -1);
+   abort();
if ((n = read(fd, b, len)) == -1)
abort();
(void)printf("%s\n", b);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r298367 - head/lib/libc/locale

2016-04-20 Thread Baptiste Daroussin
Author: bapt
Date: Wed Apr 20 20:44:30 2016
New Revision: 298367
URL: https://svnweb.freebsd.org/changeset/base/298367

Log:
  Check the returned value of memchr(3) before using it
  
  Reported by:  Coverity
  CID:  1338530

Modified:
  head/lib/libc/locale/ascii.c

Modified: head/lib/libc/locale/ascii.c
==
--- head/lib/libc/locale/ascii.cWed Apr 20 20:43:05 2016
(r298366)
+++ head/lib/libc/locale/ascii.cWed Apr 20 20:44:30 2016
(r298367)
@@ -133,11 +133,14 @@ _ascii_mbsnrtowcs(wchar_t * __restrict d
 
if (dst == NULL) {
s = memchr(*src, '\0', nms);
+   if (s == NULL)
+   return (nms);
+
if (*s & 0x80) {
errno = EILSEQ;
return ((size_t)-1);
}
-   return (s != NULL ? s - *src : nms);
+   return (s - *src);
}
 
s = *src;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r298366 - head/contrib/netbsd-tests/lib/libc/sys

2016-04-20 Thread Garrett Cooper
Author: ngie
Date: Wed Apr 20 20:43:05 2016
New Revision: 298366
URL: https://svnweb.freebsd.org/changeset/base/298366

Log:
  Fix coverity issues with contrib/netbsd-tests/lib/libc/sys/t_connect.c
  
  - Ensure socket(2) calls succeed
  - Don't leak slist allocated by earlier socket(2) call
  
  MFC after: 2 weeks
  CID: 976773, 1251405
  Reported by: Coverity
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/contrib/netbsd-tests/lib/libc/sys/t_connect.c

Modified: head/contrib/netbsd-tests/lib/libc/sys/t_connect.c
==
--- head/contrib/netbsd-tests/lib/libc/sys/t_connect.c  Wed Apr 20 20:37:58 
2016(r298365)
+++ head/contrib/netbsd-tests/lib/libc/sys/t_connect.c  Wed Apr 20 20:43:05 
2016(r298366)
@@ -56,6 +56,11 @@ ATF_TC_BODY(connect_low_port, tc)
slist = socket(AF_INET, SOCK_STREAM, 0);
sd = socket(AF_INET, SOCK_STREAM, 0);
 
+#ifdef __FreeBSD__
+   ATF_REQUIRE(sd > 0);
+   ATF_REQUIRE(slist > 0);
+#endif
+
/* bind listening socket */
memset(, 0, sizeof(sinlist));
sinlist.sin_family = AF_INET;
@@ -92,6 +97,9 @@ ATF_TC_BODY(connect_low_port, tc)
ATF_REQUIRE(ntohs(sin.sin_port) <= IPPORT_RESERVEDMAX);
 
close(sd);
+#ifdef __FreeBSD__
+   close(slist);
+#endif
 }
 
 ATF_TP_ADD_TCS(tp)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r298365 - head/sys/dev/hwpmc

2016-04-20 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Apr 20 20:37:58 2016
New Revision: 298365
URL: https://svnweb.freebsd.org/changeset/base/298365

Log:
  Remove unused e500_event_codes_size.
  
  Found by: jhb

Modified:
  head/sys/dev/hwpmc/hwpmc_e500.c

Modified: head/sys/dev/hwpmc/hwpmc_e500.c
==
--- head/sys/dev/hwpmc/hwpmc_e500.c Wed Apr 20 20:30:18 2016
(r298364)
+++ head/sys/dev/hwpmc/hwpmc_e500.c Wed Apr 20 20:37:58 2016
(r298365)
@@ -242,9 +242,6 @@ static struct e500_event_code_map e500_e
PMC_E500MC_ONLY(STWCX_FAILURES, 180),
 };
 
-const size_t e500_event_codes_size = 
-   sizeof(e500_event_codes) / sizeof(e500_event_codes[0]);
-
 static pmc_value_t
 e500_pmcn_read(unsigned int pmc)
 {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r298364 - head/sys/net80211

2016-04-20 Thread Andriy Voskoboinyk
Author: avos
Date: Wed Apr 20 20:30:18 2016
New Revision: 298364
URL: https://svnweb.freebsd.org/changeset/base/298364

Log:
  net80211: provide descriptions for reason codes
  
  Add text description for deauth/disassoc/etc reason codes
  in addition to 'reason: ' string.
  
  Reviewed by:  adrian
  Obtained from:IEEE Std 802.11-2012, 8.4.1.7 "Reason Code field"
  Differential Revision:https://reviews.freebsd.org/D5367

Modified:
  head/sys/net80211/ieee80211_hostap.c
  head/sys/net80211/ieee80211_ht.c
  head/sys/net80211/ieee80211_ioctl.c
  head/sys/net80211/ieee80211_mesh.c
  head/sys/net80211/ieee80211_output.c
  head/sys/net80211/ieee80211_proto.c
  head/sys/net80211/ieee80211_proto.h
  head/sys/net80211/ieee80211_sta.c

Modified: head/sys/net80211/ieee80211_hostap.c
==
--- head/sys/net80211/ieee80211_hostap.cWed Apr 20 20:22:48 2016
(r298363)
+++ head/sys/net80211/ieee80211_hostap.cWed Apr 20 20:30:18 2016
(r298364)
@@ -2183,8 +2183,10 @@ hostap_recv_mgmt(struct ieee80211_node *
IEEE80211_NODE_STAT(ni, rx_disassoc);
}
IEEE80211_NOTE(vap, IEEE80211_MSG_AUTH, ni,
-   "recv %s (reason %d)", ieee80211_mgt_subtype_name[subtype >>
-   IEEE80211_FC0_SUBTYPE_SHIFT], reason);
+   "recv %s (reason: %d (%s))",
+   ieee80211_mgt_subtype_name[subtype >>
+   IEEE80211_FC0_SUBTYPE_SHIFT],
+   reason, ieee80211_reason_to_string(reason));
if (ni != vap->iv_bss)
ieee80211_node_leave(ni);
break;

Modified: head/sys/net80211/ieee80211_ht.c
==
--- head/sys/net80211/ieee80211_ht.cWed Apr 20 20:22:48 2016
(r298363)
+++ head/sys/net80211/ieee80211_ht.cWed Apr 20 20:30:18 2016
(r298364)
@@ -2243,8 +2243,9 @@ ieee80211_ampdu_stop(struct ieee80211_no
tap->txa_flags &= ~IEEE80211_AGGR_BARPEND;
if (IEEE80211_AMPDU_RUNNING(tap)) {
IEEE80211_NOTE(vap, IEEE80211_MSG_ACTION | IEEE80211_MSG_11N,
-   ni, "%s: stop BA stream for TID %d (reason %d)",
-   __func__, tap->txa_tid, reason);
+   ni, "%s: stop BA stream for TID %d (reason: %d (%s))",
+   __func__, tap->txa_tid, reason,
+   ieee80211_reason_to_string(reason));
vap->iv_stats.is_ampdu_stop++;
 
ic->ic_addba_stop(ni, tap);
@@ -2255,8 +2256,9 @@ ieee80211_ampdu_stop(struct ieee80211_no
IEEE80211_ACTION_BA_DELBA, args);
} else {
IEEE80211_NOTE(vap, IEEE80211_MSG_ACTION | IEEE80211_MSG_11N,
-   ni, "%s: BA stream for TID %d not running (reason %d)",
-   __func__, tap->txa_tid, reason);
+   ni, "%s: BA stream for TID %d not running "
+   "(reason: %d (%s))", __func__, tap->txa_tid, reason,
+   ieee80211_reason_to_string(reason));
vap->iv_stats.is_ampdu_stop_failed++;
}
 }
@@ -2584,8 +2586,8 @@ ht_send_action_ba_delba(struct ieee80211
   | args[1]
   ;
IEEE80211_NOTE(vap, IEEE80211_MSG_ACTION | IEEE80211_MSG_11N, ni,
-   "send DELBA action: tid %d, initiator %d reason %d",
-   args[0], args[1], args[2]);
+   "send DELBA action: tid %d, initiator %d reason %d (%s)",
+   args[0], args[1], args[2], ieee80211_reason_to_string(args[2]));
 
IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE,
"ieee80211_ref_node (%s:%u) %p<%s> refcnt %d\n", __func__, __LINE__,

Modified: head/sys/net80211/ieee80211_ioctl.c
==
--- head/sys/net80211/ieee80211_ioctl.c Wed Apr 20 20:22:48 2016
(r298363)
+++ head/sys/net80211/ieee80211_ioctl.c Wed Apr 20 20:30:18 2016
(r298364)
@@ -1281,18 +1281,20 @@ mlmedebug(struct ieee80211vap *vap, cons
if (op == IEEE80211_MLME_AUTH) {
IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_IOCTL |
IEEE80211_MSG_STATE | IEEE80211_MSG_AUTH, mac,
-   "station authenticate %s via MLME (reason %d)",
+   "station authenticate %s via MLME (reason: %d (%s))",
reason == IEEE80211_STATUS_SUCCESS ? "ACCEPT" : "REJECT",
-   reason);
+   reason, ieee80211_reason_to_string(reason));
} else if (!(IEEE80211_MLME_ASSOC <= op && op <= IEEE80211_MLME_AUTH)) {
IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_ANY, mac,
-   "unknown MLME request %d (reason %d)", op, reason);
+   "unknown MLME request %d (reason: %d (%s))", op, reason,
+  

svn commit: r298363 - head/gnu/usr.bin/gdb/kgdb

2016-04-20 Thread Wojciech Macek
Author: wma
Date: Wed Apr 20 20:22:48 2016
New Revision: 298363
URL: https://svnweb.freebsd.org/changeset/base/298363

Log:
  Add missing function prototypes in KGDB
  
  This fixes the build broken by r298358

Modified:
  head/gnu/usr.bin/gdb/kgdb/main.c
  head/gnu/usr.bin/gdb/kgdb/trgt_amd64.c
  head/gnu/usr.bin/gdb/kgdb/trgt_i386.c
  head/gnu/usr.bin/gdb/kgdb/trgt_mips.c
  head/gnu/usr.bin/gdb/kgdb/trgt_powerpc.c
  head/gnu/usr.bin/gdb/kgdb/trgt_powerpc64.c
  head/gnu/usr.bin/gdb/kgdb/trgt_sparc64.c

Modified: head/gnu/usr.bin/gdb/kgdb/main.c
==
--- head/gnu/usr.bin/gdb/kgdb/main.cWed Apr 20 19:21:26 2016
(r298362)
+++ head/gnu/usr.bin/gdb/kgdb/main.cWed Apr 20 20:22:48 2016
(r298363)
@@ -474,9 +474,7 @@ main(int argc, char *argv[])
add_arg(, NULL);
 
init_ui_hook = kgdb_init;
-#if TARGET_CPUARCH == arm
frame_tdep_pc_fixup = kgdb_trgt_pc_fixup;
-#endif
kgdb_sniffer_kluge = kgdb_trgt_trapframe_sniffer;
 
return (gdb_main());

Modified: head/gnu/usr.bin/gdb/kgdb/trgt_amd64.c
==
--- head/gnu/usr.bin/gdb/kgdb/trgt_amd64.c  Wed Apr 20 19:21:26 2016
(r298362)
+++ head/gnu/usr.bin/gdb/kgdb/trgt_amd64.c  Wed Apr 20 20:22:48 2016
(r298363)
@@ -195,3 +195,16 @@ kgdb_trgt_trapframe_sniffer(struct frame
/* printf("%s: %lx =%s\n", __func__, pc, pname); */
return (NULL);
 }
+
+/*
+ * This function ensures, that the PC is inside the
+ * function section which is understood by GDB.
+ *
+ * Return 0 when fixup is necessary, -1 otherwise.
+ */
+int
+kgdb_trgt_pc_fixup(CORE_ADDR *pc __unused)
+{
+
+   return (-1);
+}

Modified: head/gnu/usr.bin/gdb/kgdb/trgt_i386.c
==
--- head/gnu/usr.bin/gdb/kgdb/trgt_i386.c   Wed Apr 20 19:21:26 2016
(r298362)
+++ head/gnu/usr.bin/gdb/kgdb/trgt_i386.c   Wed Apr 20 20:22:48 2016
(r298363)
@@ -385,3 +385,16 @@ kgdb_trgt_trapframe_sniffer(struct frame
/* printf("%s: %llx =%s\n", __func__, pc, pname); */
return (NULL);
 }
+
+/*
+ * This function ensures, that the PC is inside the
+ * function section which is understood by GDB.
+ *
+ * Return 0 when fixup is necessary, -1 otherwise.
+ */
+int
+kgdb_trgt_pc_fixup(CORE_ADDR *pc __unused)
+{
+
+   return (-1);
+}

Modified: head/gnu/usr.bin/gdb/kgdb/trgt_mips.c
==
--- head/gnu/usr.bin/gdb/kgdb/trgt_mips.c   Wed Apr 20 19:21:26 2016
(r298362)
+++ head/gnu/usr.bin/gdb/kgdb/trgt_mips.c   Wed Apr 20 20:22:48 2016
(r298363)
@@ -238,3 +238,16 @@ kgdb_trgt_trapframe_sniffer(struct frame
 #endif
return (NULL);
 }
+
+/*
+ * This function ensures, that the PC is inside the
+ * function section which is understood by GDB.
+ *
+ * Return 0 when fixup is necessary, -1 otherwise.
+ */
+int
+kgdb_trgt_pc_fixup(CORE_ADDR *pc __unused)
+{
+
+   return (-1);
+}

Modified: head/gnu/usr.bin/gdb/kgdb/trgt_powerpc.c
==
--- head/gnu/usr.bin/gdb/kgdb/trgt_powerpc.cWed Apr 20 19:21:26 2016
(r298362)
+++ head/gnu/usr.bin/gdb/kgdb/trgt_powerpc.cWed Apr 20 20:22:48 2016
(r298363)
@@ -199,3 +199,16 @@ kgdb_trgt_trapframe_sniffer(struct frame
/* printf("%s: %llx =%s\n", __func__, pc, pname); */
return (NULL);
 }
+
+/*
+ * This function ensures, that the PC is inside the
+ * function section which is understood by GDB.
+ *
+ * Return 0 when fixup is necessary, -1 otherwise.
+ */
+int
+kgdb_trgt_pc_fixup(CORE_ADDR *pc __unused)
+{
+
+   return (-1);
+}

Modified: head/gnu/usr.bin/gdb/kgdb/trgt_powerpc64.c
==
--- head/gnu/usr.bin/gdb/kgdb/trgt_powerpc64.c  Wed Apr 20 19:21:26 2016
(r298362)
+++ head/gnu/usr.bin/gdb/kgdb/trgt_powerpc64.c  Wed Apr 20 20:22:48 2016
(r298363)
@@ -196,3 +196,16 @@ kgdb_trgt_trapframe_sniffer(struct frame
/* printf("%s: %llx =%s\n", __func__, pc, pname); */
return (NULL);
 }
+
+/*
+ * This function ensures, that the PC is inside the
+ * function section which is understood by GDB.
+ *
+ * Return 0 when fixup is necessary, -1 otherwise.
+ */
+int
+kgdb_trgt_pc_fixup(CORE_ADDR *pc __unused)
+{
+
+   return (-1);
+}

Modified: head/gnu/usr.bin/gdb/kgdb/trgt_sparc64.c
==
--- head/gnu/usr.bin/gdb/kgdb/trgt_sparc64.cWed Apr 20 19:21:26 2016
(r298362)
+++ head/gnu/usr.bin/gdb/kgdb/trgt_sparc64.cWed Apr 20 20:22:48 2016
(r298363)
@@ -203,3 +203,16 @@ kgdb_trgt_trapframe_sniffer(struct frame
/* printf("%s: %lx =%s\n", __func__, pc, pname); 

Re: svn commit: r298358 - in head: contrib/gdb/gdb gnu/usr.bin/gdb/kgdb

2016-04-20 Thread Wojciech Macek
Fixed.

2016-04-20 13:09 GMT-07:00 Ngie Cooper (yaneurabeya) 
:

>
> > On Apr 20, 2016, at 10:58, Wojciech Macek  wrote:
> >
> > Author: wma
> > Date: Wed Apr 20 17:58:13 2016
> > New Revision: 298358
> > URL: https://svnweb.freebsd.org/changeset/base/298358
> >
> > Log:
> >  Fix KGDB backtrace on ARM
> >
> >  Modify trapframe decoding to properly analyze trapframe.
> >
> >  Provide method for fixup_pc. It happens, that in some kernel
> >  functions, the GDB stack frame decoder cannot determine both
> >  func name and frame size. This is because these functions
> >  either contain invalid instruction, or their format does
> >  not match standard schema. Detect that scenarios and move
> >  PC accordingly to jump into known function schema, which
> >  GDB is able to parse.
> >
> >  Obtained from: Semihalf
> >  Sponsored by:  Juniper Networks
> >  Reviewed by:   kib, zbb
> >  Differential Revision: https://reviews.freebsd.org/D5976
>
> This broke the build on i386:
> https://jenkins.freebsd.org/job/FreeBSD_HEAD_i386/2909/ .
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r298358 - in head: contrib/gdb/gdb gnu/usr.bin/gdb/kgdb

2016-04-20 Thread Ngie Cooper (yaneurabeya)

> On Apr 20, 2016, at 10:58, Wojciech Macek  wrote:
> 
> Author: wma
> Date: Wed Apr 20 17:58:13 2016
> New Revision: 298358
> URL: https://svnweb.freebsd.org/changeset/base/298358
> 
> Log:
>  Fix KGDB backtrace on ARM
> 
>  Modify trapframe decoding to properly analyze trapframe.
> 
>  Provide method for fixup_pc. It happens, that in some kernel
>  functions, the GDB stack frame decoder cannot determine both
>  func name and frame size. This is because these functions
>  either contain invalid instruction, or their format does
>  not match standard schema. Detect that scenarios and move
>  PC accordingly to jump into known function schema, which
>  GDB is able to parse.
> 
>  Obtained from: Semihalf
>  Sponsored by:  Juniper Networks
>  Reviewed by:   kib, zbb
>  Differential Revision: https://reviews.freebsd.org/D5976

This broke the build on i386: 
https://jenkins.freebsd.org/job/FreeBSD_HEAD_i386/2909/ .
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r298362 - head/sys/conf

2016-04-20 Thread Ed Maste
Author: emaste
Date: Wed Apr 20 19:21:26 2016
New Revision: 298362
URL: https://svnweb.freebsd.org/changeset/base/298362

Log:
  Update comment added in r298357
  
  The additional regex replacements are actully required due to an
  elfcopy bug which is now fixed (by r298361), not a Clang/GCC issue.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/conf/kern.post.mk

Modified: head/sys/conf/kern.post.mk
==
--- head/sys/conf/kern.post.mk  Wed Apr 20 19:13:00 2016(r298361)
+++ head/sys/conf/kern.post.mk  Wed Apr 20 19:21:26 2016(r298362)
@@ -364,9 +364,8 @@ embedfs_${MFS_IMAGE:T:R}.o: ${MFS_IMAGE}
--output-target ${EMBEDFS_FORMAT.${MACHINE_ARCH}} \
--binary-architecture ${EMBEDFS_ARCH.${MACHINE_ARCH}} \
${MFS_IMAGE} ${.TARGET}
-   # Provide set of two distinct regexp to match for GCC (first three)
-   # and for CLANG >= 3.8.0 (last three). First three should be removed
-   # once support for GCC and CLANG < 3.8.0 is abandoned.
+   # Provide set of two distinct regexp to work around an elfcopy bug
+   # fixed in r298361 (last three).
${OBJCOPY} \
--rename-section .data=mfs,contents,alloc,load,readonly,data \
--redefine-sym \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r298361 - head/contrib/elftoolchain/elfcopy

2016-04-20 Thread Ed Maste
Author: emaste
Date: Wed Apr 20 19:13:00 2016
New Revision: 298361
URL: https://svnweb.freebsd.org/changeset/base/298361

Log:
  elfcopy: map all !alnum characters to '_' in binary input symbol names
  
  This matches bfd and gold.
  
  Obtained from:ELF Tool Chain r3445
  Sponsored by: The FreeBSD Foundation

Modified:
  head/contrib/elftoolchain/elfcopy/binary.c

Modified: head/contrib/elftoolchain/elfcopy/binary.c
==
--- head/contrib/elftoolchain/elfcopy/binary.c  Wed Apr 20 18:48:39 2016
(r298360)
+++ head/contrib/elftoolchain/elfcopy/binary.c  Wed Apr 20 19:13:00 2016
(r298361)
@@ -26,6 +26,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -213,9 +214,9 @@ create_elf_from_binary(struct elfcopy *e
 
if ((sym_basename = strdup(ifn)) == NULL)
err(1, "strdup");
-   p = sym_basename;
-   while ((p = strchr(p, '.')) != NULL)
-   *p++ = '_';
+   for (p = sym_basename; *p != '\0'; p++)
+   if (!isalnum(*p))
+   *p = '_';
 #define_GEN_SYMNAME(S) do {
\
snprintf(name, sizeof(name), "%s%s%s", "_binary_", sym_basename, S); \
 } while (0)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r298360 - head/sys/net80211

2016-04-20 Thread Andriy Voskoboinyk
Author: avos
Date: Wed Apr 20 18:48:39 2016
New Revision: 298360
URL: https://svnweb.freebsd.org/changeset/base/298360

Log:
  net80211 (trivial, noop): remove duplicate check from hostap_recv_mgmt()
  
  Differential Revision:https://reviews.freebsd.org/D5483

Modified:
  head/sys/net80211/ieee80211_hostap.c

Modified: head/sys/net80211/ieee80211_hostap.c
==
--- head/sys/net80211/ieee80211_hostap.cWed Apr 20 18:29:30 2016
(r298359)
+++ head/sys/net80211/ieee80211_hostap.cWed Apr 20 18:48:39 2016
(r298360)
@@ -1677,18 +1677,19 @@ hostap_recv_mgmt(struct ieee80211_node *
efrm = mtod(m0, uint8_t *) + m0->m_len;
switch (subtype) {
case IEEE80211_FC0_SUBTYPE_PROBE_RESP:
-   case IEEE80211_FC0_SUBTYPE_BEACON: {
-   struct ieee80211_scanparams scan;
/*
 * We process beacon/probe response frames when scanning;
 * otherwise we check beacon frames for overlapping non-ERP
 * BSS in 11g and/or overlapping legacy BSS when in HT.
-*/ 
-   if ((ic->ic_flags & IEEE80211_F_SCAN) == 0 &&
-   subtype == IEEE80211_FC0_SUBTYPE_PROBE_RESP) {
+*/
+   if ((ic->ic_flags & IEEE80211_F_SCAN) == 0) {
vap->iv_stats.is_rx_mgtdiscard++;
return;
}
+   /* FALLTHROUGH */
+   case IEEE80211_FC0_SUBTYPE_BEACON: {
+   struct ieee80211_scanparams scan;
+
/* NB: accept off-channel frames */
/* XXX TODO: use rxstatus to determine off-channel details */
if (ieee80211_parse_beacon(ni, m0, ic->ic_curchan, ) &~ 
IEEE80211_BPARSE_OFFCHAN)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r298247 - head/sbin/fdisk_pc98

2016-04-20 Thread John Baldwin
On Wednesday, April 20, 2016 01:06:38 PM Bruce Evans wrote:
> On Wed, 20 Apr 2016, Marcelo Araujo wrote:
> 
> > 2016-04-20 0:16 GMT+08:00 John Baldwin :
> >
> >> On Tuesday, April 19, 2016 04:46:13 AM Marcelo Araujo wrote:
> >>> Author: araujo
> >>> Date: Tue Apr 19 04:46:13 2016
> >>> New Revision: 298247
> >>> URL: https://svnweb.freebsd.org/changeset/base/298247
> >>>
> >>> Log:
> >>>   Remove redundant parenthesis.
> >>>
> >>>   Submitted by:   pfg
> >>>   MFC after:  2 weeks.
> 
> I don't realling like churnging to the nonstandard nitems().  Use
> of the nonstandard  is bad enough.

I think it's not that bad from a readability standpoint.  Other languages
have fairly concise syntax for 'for-each' loops and this provides a
closer variant of that for statically sized arrays.  TAILQ_FOREACH() is
still nicer of course.  One could imagine doing some sort of
ARRAY_FOREACH() that was:

#define ARRAY_FOREACH(p, array)\
for (size_t __i = 0, (p) = &(array)[0]; __i < nitems((array)); __i++, 
(p)++)

(This requires C99 to handle __i)

Perhaps better is this:

#define ARRAY_FOREACH(p, array) \
for ((p) = &(array)[0]; (p) < &(array)[nitems((array))]; (p)++)

(No need for __i)

> >> For this case, it might be better to remove numentries and use
> >> nitems() directly in the one place it is used.  I would probably
> >> even do this as a for-loop:
> >>
> >> struct part_type *ptr;
> >> int counter;
> >>
> >> for (counter = 0, ptr = part_types; counter < nitems(part_types);
> >> counter++, ptr++) {
> >> if (ptr->type == (type & 0x7f))
> >> return (ptr->name);
> >> }
> >> return ("unknown");
> >>
> >> If you renamed 'counter' to 'i' you could probably fit it all on one line.
> 
> 'ptr' is also not a usefully verbose name.  If its name is longer than that
> of 'p', then it could more usefully give a hint of the pointer type (pp or
> ptp).
> 
> nitimems() is not even easy to use.  It is of course undocumented, but
> if we look at its internals we can see that its type is the binary
> promotion of size_t.  This type is normally size_t again, thus normally
> unsigned.  Broken compilers might warn about this.  Only broken ones
> would, since it is clear that 'counter' always has a small non-negative
> value.  Such warnings are often "fixed" by unimproving the code using
> casts.  Here the old code uses a temporary variable of type int.
> Consistently broken compilers might warn about assigning the unsigned
> expression to this signed variable.

Yes, I end up using 'unsigned' with it often due to compile warnings for
sign mismatches on comparison.

> Churnging too much (also remove excessive parentheses and braces) gives:
> 
>   size_t i;   /* XXX: I don't like unsigned types, but... */
> 
>   for (i = 0; i < nitems(part_types); i++)
>   if (part_types[i].type == type & 0x7f)
>   return (part_types[i].name);
>   return ("unknown");

This would work for me (unless folks actually like the ARRAY_FOREACH()
idea).

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


svn commit: r298359 - in head/sys: dev/ath dev/otus dev/rtwn dev/urtwn net80211

2016-04-20 Thread Andriy Voskoboinyk
Author: avos
Date: Wed Apr 20 18:29:30 2016
New Revision: 298359
URL: https://svnweb.freebsd.org/changeset/base/298359

Log:
  net80211: replace internal LE_READ_*/LE_WRITE_* macro with system
  le*dec / le*enc functions.
  
  Replace net80211 specific macros with system-wide bytestream
  encoding/decoding functions:
  - LE_READ_2 ->  le16dec
  - LE_READ_4 ->  le32dec
  - LE_WRITE_2 -> le16enc
  - LE_WRITE_4 -> le32enc
  
  + drop ieee80211_input.h include, where it was included for these
  operations only.
  
  Reviewed by:  adrian
  Differential Revision:https://reviews.freebsd.org/D6030

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_ath_beacon.c
  head/sys/dev/ath/if_ath_misc.h
  head/sys/dev/ath/if_ath_rx.c
  head/sys/dev/otus/if_otus.c
  head/sys/dev/rtwn/if_rtwn.c
  head/sys/dev/rtwn/if_rtwnreg.h
  head/sys/dev/urtwn/if_urtwn.c
  head/sys/net80211/ieee80211_hostap.c
  head/sys/net80211/ieee80211_ht.c
  head/sys/net80211/ieee80211_hwmp.c
  head/sys/net80211/ieee80211_input.c
  head/sys/net80211/ieee80211_input.h
  head/sys/net80211/ieee80211_mesh.c
  head/sys/net80211/ieee80211_output.c
  head/sys/net80211/ieee80211_scan_sta.c
  head/sys/net80211/ieee80211_sta.c
  head/sys/net80211/ieee80211_superg.c

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Wed Apr 20 17:58:13 2016(r298358)
+++ head/sys/dev/ath/if_ath.c   Wed Apr 20 18:29:30 2016(r298359)
@@ -3483,10 +3483,10 @@ ath_update_mcast_hw(struct ath_softc *sc
/* calculate XOR of eight 6bit values */
dl = LLADDR((struct sockaddr_dl *)
ifma->ifma_addr);
-   val = LE_READ_4(dl + 0);
+   val = le32dec(dl + 0);
pos = (val >> 18) ^ (val >> 12) ^ (val >> 6) ^
val;
-   val = LE_READ_4(dl + 3);
+   val = le32dec(dl + 3);
pos ^= (val >> 18) ^ (val >> 12) ^ (val >> 6) ^
val;
pos &= 0x3f;

Modified: head/sys/dev/ath/if_ath_beacon.c
==
--- head/sys/dev/ath/if_ath_beacon.cWed Apr 20 17:58:13 2016
(r298358)
+++ head/sys/dev/ath/if_ath_beacon.cWed Apr 20 18:29:30 2016
(r298359)
@@ -942,11 +942,11 @@ ath_beacon_config(struct ath_softc *sc, 
ATH_UNLOCK(sc);
 
/* extract tstamp from last beacon and convert to TU */
-   nexttbtt = TSF_TO_TU(LE_READ_4(ni->ni_tstamp.data + 4),
-LE_READ_4(ni->ni_tstamp.data));
+   nexttbtt = TSF_TO_TU(le32dec(ni->ni_tstamp.data + 4),
+le32dec(ni->ni_tstamp.data));
 
-   tsf_beacon = ((uint64_t) LE_READ_4(ni->ni_tstamp.data + 4)) << 32;
-   tsf_beacon |= LE_READ_4(ni->ni_tstamp.data);
+   tsf_beacon = ((uint64_t) le32dec(ni->ni_tstamp.data + 4)) << 32;
+   tsf_beacon |= le32dec(ni->ni_tstamp.data);
 
if (ic->ic_opmode == IEEE80211_M_HOSTAP ||
ic->ic_opmode == IEEE80211_M_MBSS) {

Modified: head/sys/dev/ath/if_ath_misc.h
==
--- head/sys/dev/ath/if_ath_misc.h  Wed Apr 20 17:58:13 2016
(r298358)
+++ head/sys/dev/ath/if_ath_misc.h  Wed Apr 20 18:29:30 2016
(r298359)
@@ -39,15 +39,6 @@
  * and into something else.
  */
 
-/* unaligned little endian access */
-#define LE_READ_2(p)   \
-   ((u_int16_t)\
-u_int8_t *)(p))[0]  ) | (((u_int8_t *)(p))[1] <<  8)))
-#define LE_READ_4(p)   \
-   ((u_int32_t)\
-u_int8_t *)(p))[0]  ) | (((u_int8_t *)(p))[1] <<  8) | \
- (((u_int8_t *)(p))[2] << 16) | (((u_int8_t *)(p))[3] << 24)))
-
 extern int ath_rxbuf;
 extern int ath_txbuf;
 extern int ath_txbuf_mgmt;

Modified: head/sys/dev/ath/if_ath_rx.c
==
--- head/sys/dev/ath/if_ath_rx.cWed Apr 20 17:58:13 2016
(r298358)
+++ head/sys/dev/ath/if_ath_rx.cWed Apr 20 18:29:30 2016
(r298359)
@@ -344,8 +344,8 @@ ath_recv_mgmt(struct ieee80211_node *ni,
uint64_t tsf_beacon_target;
int tsf_intval;
 
-   tsf_beacon_old = ((uint64_t) LE_READ_4(ni->ni_tstamp.data + 4)) << 32;
-   tsf_beacon_old |= LE_READ_4(ni->ni_tstamp.data);
+   tsf_beacon_old = ((uint64_t) le32dec(ni->ni_tstamp.data + 4)) << 32;
+   tsf_beacon_old |= le32dec(ni->ni_tstamp.data);
 
 #define

svn commit: r298358 - in head: contrib/gdb/gdb gnu/usr.bin/gdb/kgdb

2016-04-20 Thread Wojciech Macek
Author: wma
Date: Wed Apr 20 17:58:13 2016
New Revision: 298358
URL: https://svnweb.freebsd.org/changeset/base/298358

Log:
  Fix KGDB backtrace on ARM
  
  Modify trapframe decoding to properly analyze trapframe.
  
  Provide method for fixup_pc. It happens, that in some kernel
  functions, the GDB stack frame decoder cannot determine both
  func name and frame size. This is because these functions
  either contain invalid instruction, or their format does
  not match standard schema. Detect that scenarios and move
  PC accordingly to jump into known function schema, which
  GDB is able to parse.
  
  Obtained from: Semihalf
  Sponsored by:  Juniper Networks
  Reviewed by:   kib, zbb
  Differential Revision: https://reviews.freebsd.org/D5976

Modified:
  head/contrib/gdb/gdb/arm-tdep.c
  head/contrib/gdb/gdb/frame.c
  head/contrib/gdb/gdb/frame.h
  head/gnu/usr.bin/gdb/kgdb/kgdb.h
  head/gnu/usr.bin/gdb/kgdb/main.c
  head/gnu/usr.bin/gdb/kgdb/trgt_arm.c

Modified: head/contrib/gdb/gdb/arm-tdep.c
==
--- head/contrib/gdb/gdb/arm-tdep.c Wed Apr 20 17:54:53 2016
(r298357)
+++ head/contrib/gdb/gdb/arm-tdep.c Wed Apr 20 17:58:13 2016
(r298358)
@@ -678,6 +678,9 @@ arm_scan_prologue (struct frame_info *ne
   cache->framesize = 0;
   cache->frameoffset = 0;
 
+  if (frame_tdep_pc_fixup)
+   frame_tdep_pc_fixup(_pc);
+
   /* Check for Thumb prologue.  */
   if (arm_pc_is_thumb (prev_pc))
 {
@@ -914,7 +917,6 @@ arm_make_prologue_cache (struct frame_in
   cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
 
   arm_scan_prologue (next_frame, cache);
-
   unwound_fp = frame_unwind_register_unsigned (next_frame, cache->framereg);
   if (unwound_fp == 0)
 return cache;

Modified: head/contrib/gdb/gdb/frame.c
==
--- head/contrib/gdb/gdb/frame.cWed Apr 20 17:54:53 2016
(r298357)
+++ head/contrib/gdb/gdb/frame.cWed Apr 20 17:58:13 2016
(r298358)
@@ -136,6 +136,7 @@ static int frame_debug;
 static int backtrace_past_main;
 static unsigned int backtrace_limit = UINT_MAX;
 
+int (*frame_tdep_pc_fixup)(CORE_ADDR *pc);
 
 void
 fprint_frame_id (struct ui_file *file, struct frame_id id)
@@ -2010,6 +2011,9 @@ frame_unwind_address_in_block (struct fr
   /* A draft address.  */
   CORE_ADDR pc = frame_pc_unwind (next_frame);
 
+  if ((frame_tdep_pc_fixup != NULL) && (frame_tdep_pc_fixup() == 0))
+   return pc;
+
   /* If THIS frame is not inner most (i.e., NEXT isn't the sentinel),
  and NEXT is `normal' (i.e., not a sigtramp, dummy, ) THIS
  frame's PC ends up pointing at the instruction fallowing the

Modified: head/contrib/gdb/gdb/frame.h
==
--- head/contrib/gdb/gdb/frame.hWed Apr 20 17:54:53 2016
(r298357)
+++ head/contrib/gdb/gdb/frame.hWed Apr 20 17:58:13 2016
(r298358)
@@ -702,4 +702,6 @@ extern struct frame_info *deprecated_fra
code.  */
 extern int legacy_frame_p (struct gdbarch *gdbarch);
 
+extern int (*frame_tdep_pc_fixup)(CORE_ADDR *pc);
+
 #endif /* !defined (FRAME_H)  */

Modified: head/gnu/usr.bin/gdb/kgdb/kgdb.h
==
--- head/gnu/usr.bin/gdb/kgdb/kgdb.hWed Apr 20 17:54:53 2016
(r298357)
+++ head/gnu/usr.bin/gdb/kgdb/kgdb.hWed Apr 20 17:58:13 2016
(r298358)
@@ -75,4 +75,7 @@ CORE_ADDR kgdb_parse_1(const char *, int
 #definekgdb_parse(exp) kgdb_parse_1((exp), 0)
 #definekgdb_parse_quiet(exp)   kgdb_parse_1((exp), 1)
 
+extern int (*arm_tdep_pc_fixup)(CORE_ADDR *pc);
+int kgdb_trgt_pc_fixup(CORE_ADDR *pc);
+
 #endif /* _KGDB_H_ */

Modified: head/gnu/usr.bin/gdb/kgdb/main.c
==
--- head/gnu/usr.bin/gdb/kgdb/main.cWed Apr 20 17:54:53 2016
(r298357)
+++ head/gnu/usr.bin/gdb/kgdb/main.cWed Apr 20 17:58:13 2016
(r298358)
@@ -474,7 +474,9 @@ main(int argc, char *argv[])
add_arg(, NULL);
 
init_ui_hook = kgdb_init;
-
+#if TARGET_CPUARCH == arm
+   frame_tdep_pc_fixup = kgdb_trgt_pc_fixup;
+#endif
kgdb_sniffer_kluge = kgdb_trgt_trapframe_sniffer;
 
return (gdb_main());

Modified: head/gnu/usr.bin/gdb/kgdb/trgt_arm.c
==
--- head/gnu/usr.bin/gdb/kgdb/trgt_arm.cWed Apr 20 17:54:53 2016
(r298357)
+++ head/gnu/usr.bin/gdb/kgdb/trgt_arm.cWed Apr 20 17:58:13 2016
(r298358)
@@ -96,6 +96,7 @@ kgdb_trgt_new_objfile(struct objfile *ob
 struct kgdb_frame_cache {
CORE_ADDR   fp;
CORE_ADDR   sp;
+   CORE_ADDR   pc;
 };
 
 static int kgdb_trgt_frame_offset[26] = {
@@ -135,6 

svn commit: r298357 - head/sys/conf

2016-04-20 Thread Wojciech Macek
Author: wma
Date: Wed Apr 20 17:54:53 2016
New Revision: 298357
URL: https://svnweb.freebsd.org/changeset/base/298357

Log:
  Fix MFS symbol redefinition with clang 3.8.0
  
  Newest CLANG objcpy uses different name parsing.
  Modify regexp to match (i.e. avoid substitution
  of "/" or "-" with "_").
  
  Obtained from: Semihalf
  Sponsored by:  Juniper Networks
  Reviewed by:   hselasky, zbb
  Differential Revision: https://reviews.freebsd.org/D5873

Modified:
  head/sys/conf/kern.post.mk

Modified: head/sys/conf/kern.post.mk
==
--- head/sys/conf/kern.post.mk  Wed Apr 20 17:28:21 2016(r298356)
+++ head/sys/conf/kern.post.mk  Wed Apr 20 17:54:53 2016(r298357)
@@ -364,6 +364,9 @@ embedfs_${MFS_IMAGE:T:R}.o: ${MFS_IMAGE}
--output-target ${EMBEDFS_FORMAT.${MACHINE_ARCH}} \
--binary-architecture ${EMBEDFS_ARCH.${MACHINE_ARCH}} \
${MFS_IMAGE} ${.TARGET}
+   # Provide set of two distinct regexp to match for GCC (first three)
+   # and for CLANG >= 3.8.0 (last three). First three should be removed
+   # once support for GCC and CLANG < 3.8.0 is abandoned.
${OBJCOPY} \
--rename-section .data=mfs,contents,alloc,load,readonly,data \
--redefine-sym \
@@ -372,6 +375,12 @@ embedfs_${MFS_IMAGE:T:R}.o: ${MFS_IMAGE}
_binary_${MFS_IMAGE:C,[^[:alnum:]],_,g}_start=mfs_root \
--redefine-sym \
_binary_${MFS_IMAGE:C,[^[:alnum:]],_,g}_end=mfs_root_end \
+   --redefine-sym \
+   _binary_${MFS_IMAGE:C,[^-/[:alnum:]],_,g}_size=__mfs_root_size \
+   --redefine-sym \
+   _binary_${MFS_IMAGE:C,[^-/[:alnum:]],_,g}_start=mfs_root \
+   --redefine-sym \
+   _binary_${MFS_IMAGE:C,[^-/[:alnum:]],_,g}_end=mfs_root_end \
${.TARGET}
 .endif
 .endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r298356 - head/sys/kern

2016-04-20 Thread Konstantin Belousov
Author: kib
Date: Wed Apr 20 17:28:21 2016
New Revision: 298356
URL: https://svnweb.freebsd.org/changeset/base/298356

Log:
  Arm and arm64 both have fueword() implemented for some time.  Correct
  the comment.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/subr_uio.c

Modified: head/sys/kern/subr_uio.c
==
--- head/sys/kern/subr_uio.cWed Apr 20 17:05:32 2016(r298355)
+++ head/sys/kern/subr_uio.cWed Apr 20 17:28:21 2016(r298356)
@@ -500,8 +500,8 @@ copyout_unmap(struct thread *td, vm_offs
 /*
  * XXXKIB The temporal implementation of fue*() functions which do not
  * handle usermode -1 properly, mixing it with the fault code.  Keep
- * this until MD code is written.  Currently sparc64, mips and arm do
- * not have proper implementation.
+ * this until MD code is written.  Currently sparc64 and mips do not
+ * have proper implementation.
  */
 
 int
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-04-20 Thread Peter Grehan
Author: grehan
Date: Wed Apr 20 17:05:32 2016
New Revision: 298355
URL: https://svnweb.freebsd.org/changeset/base/298355

Log:
  Don't use SYSDIR to avoid conflicts with existing usage.
  Also, use SRCTOP to locate the top of the source tree
  instead of a relative path.
  
  PR:   208856

Modified:
  head/usr.sbin/bhyve/Makefile

Modified: head/usr.sbin/bhyve/Makefile
==
--- head/usr.sbin/bhyve/MakefileWed Apr 20 16:19:44 2016
(r298354)
+++ head/usr.sbin/bhyve/MakefileWed Apr 20 17:05:32 2016
(r298355)
@@ -9,7 +9,7 @@ DEBUG_FLAGS= -g -O0
 
 MAN=   bhyve.8
 
-SYSDIR?=${.CURDIR}/../..
+BHYVE_SYSDIR?=${SRCTOP}
 
 SRCS=  \
atkbdc.c\
@@ -45,7 +45,7 @@ SRCS= \
xmsr.c  \
spinup_ap.c
 
-.PATH:  ${SYSDIR}/sys/amd64/vmm
+.PATH:  ${BHYVE_SYSDIR}/sys/amd64/vmm
 SRCS+= vmm_instruction_emul.c
 
 LIBADD=vmmapi md pthread
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r298354 - in head/sys: ddb geom/part kern netinet netinet6

2016-04-20 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Apr 20 16:19:44 2016
New Revision: 298354
URL: https://svnweb.freebsd.org/changeset/base/298354

Log:
  Indentation issues.
  
  Contract some lines leftover from r298310.
  
  Mea culpa.

Modified:
  head/sys/ddb/db_variables.c
  head/sys/geom/part/g_part_bsd.c
  head/sys/geom/part/g_part_ebr.c
  head/sys/geom/part/g_part_ldm.c
  head/sys/geom/part/g_part_mbr.c
  head/sys/kern/sysv_msg.c
  head/sys/kern/sysv_sem.c
  head/sys/netinet/tcp_syncache.c
  head/sys/netinet6/in6_proto.c

Modified: head/sys/ddb/db_variables.c
==
--- head/sys/ddb/db_variables.c Wed Apr 20 16:03:53 2016(r298353)
+++ head/sys/ddb/db_variables.c Wed Apr 20 16:19:44 2016(r298354)
@@ -53,8 +53,7 @@ static struct db_variable db_vars[] = {
{ "db_vnet",NULL, db_var_db_vnet },
 #endif
 };
-static struct db_variable *db_evars =
-   db_vars + nitems(db_vars);
+static struct db_variable *db_evars = db_vars + nitems(db_vars);
 
 static int
 db_find_variable(struct db_variable **varp)

Modified: head/sys/geom/part/g_part_bsd.c
==
--- head/sys/geom/part/g_part_bsd.c Wed Apr 20 16:03:53 2016
(r298353)
+++ head/sys/geom/part/g_part_bsd.c Wed Apr 20 16:19:44 2016
(r298354)
@@ -140,8 +140,7 @@ bsd_parse_type(const char *type, uint8_t
*fstype = (u_int)lt;
return (0);
}
-   for (i = 0;
-   i < nitems(bsd_alias_match); i++) {
+   for (i = 0; i < nitems(bsd_alias_match); i++) {
alias = g_part_alias_name(bsd_alias_match[i].alias);
if (strcasecmp(type, alias) == 0) {
*fstype = bsd_alias_match[i].type;

Modified: head/sys/geom/part/g_part_ebr.c
==
--- head/sys/geom/part/g_part_ebr.c Wed Apr 20 16:03:53 2016
(r298353)
+++ head/sys/geom/part/g_part_ebr.c Wed Apr 20 16:19:44 2016
(r298354)
@@ -188,8 +188,7 @@ ebr_parse_type(const char *type, u_char 
*dp_typ = (u_char)lt;
return (0);
}
-   for (i = 0;
-   i < nitems(ebr_alias_match); i++) {
+   for (i = 0; i < nitems(ebr_alias_match); i++) {
alias = g_part_alias_name(ebr_alias_match[i].alias);
if (strcasecmp(type, alias) == 0) {
*dp_typ = ebr_alias_match[i].typ;
@@ -603,8 +602,7 @@ g_part_ebr_type(struct g_part_table *bas
int i;
 
entry = (struct g_part_ebr_entry *)baseentry;
-   for (i = 0;
-   i < nitems(ebr_alias_match); i++) {
+   for (i = 0; i < nitems(ebr_alias_match); i++) {
if (ebr_alias_match[i].typ == entry->ent.dp_typ)
return (g_part_alias_name(ebr_alias_match[i].alias));
}

Modified: head/sys/geom/part/g_part_ldm.c
==
--- head/sys/geom/part/g_part_ldm.c Wed Apr 20 16:03:53 2016
(r298353)
+++ head/sys/geom/part/g_part_ldm.c Wed Apr 20 16:19:44 2016
(r298354)
@@ -453,8 +453,7 @@ ldm_privhdr_check(struct ldm_db *db, str
cp2->provider->mediasize / cp2->provider->sectorsize - 1;
} else
last = pp->mediasize / pp->sectorsize - 1;
-   for (found = 0, i = is_gpt;
-   i < nitems(ldm_ph_off); i++) {
+   for (found = 0, i = is_gpt; i < nitems(ldm_ph_off); i++) {
offset = ldm_ph_off[i];
/*
 * In the GPT case consumer is attached to the LDM metadata
@@ -1468,8 +1467,7 @@ g_part_ldm_type(struct g_part_table *bas
int i;
 
entry = (struct g_part_ldm_entry *)baseentry;
-   for (i = 0;
-   i < nitems(ldm_alias_match); i++) {
+   for (i = 0; i < nitems(ldm_alias_match); i++) {
if (ldm_alias_match[i].typ == entry->type)
return (g_part_alias_name(ldm_alias_match[i].alias));
}

Modified: head/sys/geom/part/g_part_mbr.c
==
--- head/sys/geom/part/g_part_mbr.c Wed Apr 20 16:03:53 2016
(r298353)
+++ head/sys/geom/part/g_part_mbr.c Wed Apr 20 16:19:44 2016
(r298354)
@@ -158,8 +158,7 @@ mbr_parse_type(const char *type, u_char 
*dp_typ = (u_char)lt;
return (0);
}
-   for (i = 0;
-   i < nitems(mbr_alias_match); i++) {
+   for (i = 0; i < nitems(mbr_alias_match); i++) {
alias = g_part_alias_name(mbr_alias_match[i].alias);
if (strcasecmp(type, alias) == 0) {
*dp_typ = mbr_alias_match[i].typ;
@@ -560,8 +559,7 @@ g_part_mbr_type(struct g_part_table *bas
int i;
 
entry = (struct g_part_mbr_entry 

svn commit: r298353 - head/lib/libc/net

2016-04-20 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Apr 20 16:03:53 2016
New Revision: 298353
URL: https://svnweb.freebsd.org/changeset/base/298353

Log:
  Minor indentation issue.

Modified:
  head/lib/libc/net/ip6opt.c

Modified: head/lib/libc/net/ip6opt.c
==
--- head/lib/libc/net/ip6opt.c  Wed Apr 20 15:45:55 2016(r298352)
+++ head/lib/libc/net/ip6opt.c  Wed Apr 20 16:03:53 2016(r298353)
@@ -199,8 +199,7 @@ inet6_option_alloc(struct cmsghdr *cmsg,
 
/* calculate pad length before the option. */
off = bp - (u_char *)eh;
-   padlen = roundup2(off % multx, multx) -
-   (off % multx);
+   padlen = roundup2(off % multx, multx) - (off % multx);
padlen += plusy;
padlen %= multx;/* keep the pad as short as possible */
/* insert padding */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r298247 - head/sbin/fdisk_pc98

2016-04-20 Thread Pedro Giffuni



On 04/20/16 10:15, Bruce Evans wrote:

On Wed, 20 Apr 2016, Conrad Meyer wrote:


On Wed, Apr 20, 2016 at 7:33 AM, Pedro Giffuni  wrote:

One of the things I dislike is that most of the macros are in
lowercase. Lowercase would make sense if these were inline functions
but inline functions have disadvantages for these use cases.
OTOH, if they were uppercase, they would not be very easy on the eyes,
which is the current advantage.


Lower case is correct if nitems is a safe macro.  I think it is safe,
because its parameter must be an array and an expression with side
effects can't be an array.



Ahh .. so I guess it's not that bad then :-/.


You bring up a good point.  Obviously nitems() can't be an inline
function, but roundup2() and friends could.  Is there any reason not
to change them over to inline functions?


1. Namespace pollution.  Adding nitems() to sys/param.h already broke
   anything using that name.



Yes, and there's nothing to do now.


2. roundup2() and friends can't be inline functions without unportable
   complications to make them type-generic.  No one ever did this for
   the more important imin() family of inline functions.  4.4BSD removed
   the MAX() and MIN() macros in the kernel to enforce use of the imin()
   family, but this gave type errors and was routed around by restoring
   the macros, first in scattered places and then back in sys/param.h.



I see, the imin() stuff is in sys/libkern.h. Looks like a nice use case
for coccinelle.

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


svn commit: r298352 - in head/sys: arm/amlogic/aml8726 arm/arm arm/at91 arm/mv/armadaxp arm/ti/cpsw arm/xscale/ixp425 mips/mips pc98/cbus powerpc/powerpc powerpc/pseries sparc64/sparc64

2016-04-20 Thread Pedro F. Giffuni
Author: pfg
Date: Wed Apr 20 15:45:55 2016
New Revision: 298352
URL: https://svnweb.freebsd.org/changeset/base/298352

Log:
  Use our nitems() macro when param.h is available.
  
  Replacements specific to arm, mips, pc98, powerpc and sparc64.
  
  Discussed in: freebsd-current

Modified:
  head/sys/arm/amlogic/aml8726/aml8726_clkmsr.c
  head/sys/arm/arm/db_interface.c
  head/sys/arm/at91/at91_pmc.c
  head/sys/arm/mv/armadaxp/armadaxp.c
  head/sys/arm/ti/cpsw/if_cpsw.c
  head/sys/arm/xscale/ixp425/ixp425.c
  head/sys/mips/mips/db_interface.c
  head/sys/pc98/cbus/gdc.c
  head/sys/pc98/cbus/pckbd.c
  head/sys/pc98/cbus/scterm-sck.c
  head/sys/powerpc/powerpc/db_trace.c
  head/sys/powerpc/pseries/xics.c
  head/sys/sparc64/sparc64/db_trace.c
  head/sys/sparc64/sparc64/elf_machdep.c
  head/sys/sparc64/sparc64/trap.c

Modified: head/sys/arm/amlogic/aml8726/aml8726_clkmsr.c
==
--- head/sys/arm/amlogic/aml8726/aml8726_clkmsr.c   Wed Apr 20 15:31:03 
2016(r298351)
+++ head/sys/arm/amlogic/aml8726/aml8726_clkmsr.c   Wed Apr 20 15:45:55 
2016(r298352)
@@ -69,8 +69,7 @@ static struct aml8726_clkmsr_clk {
 
 #defineAML_CLKMSR_CLK810
 
-#defineAML_CLKMSR_NCLKS(sizeof(aml8726_clkmsr_clks) \
-/ sizeof(aml8726_clkmsr_clks[0]))
+#defineAML_CLKMSR_NCLKSnitems(aml8726_clkmsr_clks)
 
 struct aml8726_clkmsr_softc {
device_tdev;

Modified: head/sys/arm/arm/db_interface.c
==
--- head/sys/arm/arm/db_interface.c Wed Apr 20 15:31:03 2016
(r298351)
+++ head/sys/arm/arm/db_interface.c Wed Apr 20 15:45:55 2016
(r298352)
@@ -100,7 +100,7 @@ struct db_variable db_regs[] = {
{ "irq_sp", , db_access_irq_sp, },
 };
 
-struct db_variable *db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]);
+struct db_variable *db_eregs = db_regs + nitems(db_regs);
 
 int
 db_access_und_sp(struct db_variable *vp, db_expr_t *valp, int rw)

Modified: head/sys/arm/at91/at91_pmc.c
==
--- head/sys/arm/at91/at91_pmc.cWed Apr 20 15:31:03 2016
(r298351)
+++ head/sys/arm/at91/at91_pmc.cWed Apr 20 15:45:55 2016
(r298352)
@@ -320,7 +320,7 @@ at91_pmc_clock_add(const char *name, uin
else
clk->parent = parent;
 
-   for (i = 0; i < sizeof(clock_list) / sizeof(clock_list[0]); i++) {
+   for (i = 0; i < nitems(clock_list); i++) {
if (clock_list[i] == NULL) {
clock_list[i] = clk;
return (clk);
@@ -358,7 +358,7 @@ at91_pmc_clock_ref(const char *name)
 {
int i;
 
-   for (i = 0; i < sizeof(clock_list) / sizeof(clock_list[0]); i++) {
+   for (i = 0; i < nitems(clock_list); i++) {
if (clock_list[i] == NULL)
break;
if (strcmp(name, clock_list[i]->name) == 0)
@@ -484,7 +484,7 @@ static const unsigned int at91_main_cloc
1200, 12288000, 1356, 14318180, 14745600,
1600, 17344700, 18432000, 2000
 };
-#defineMAIN_CLOCK_TBL_LEN  (sizeof(at91_main_clock_tbl) / 
sizeof(*at91_main_clock_tbl))
+#defineMAIN_CLOCK_TBL_LEN  nitems(at91_main_clock_tbl)
 #endif
 
 static unsigned int

Modified: head/sys/arm/mv/armadaxp/armadaxp.c
==
--- head/sys/arm/mv/armadaxp/armadaxp.c Wed Apr 20 15:31:03 2016
(r298351)
+++ head/sys/arm/mv/armadaxp/armadaxp.c Wed Apr 20 15:45:55 2016
(r298352)
@@ -150,13 +150,13 @@ count_l2clk(void)
sar_fab_freq = FAB_FREQ_FIELD(sar_reg);
 
/* Check if CPU frequency field has correct value */
-   array_size = sizeof(cpu_clock_table) / sizeof(cpu_clock_table[0]);
+   array_size = nitems(cpu_clock_table);
if (sar_cpu_freq >= array_size)
panic("Reserved value in cpu frequency configuration field: "
"%d", sar_cpu_freq);
 
/* Check if fabric frequency field has correct value */
-   array_size = sizeof(freq_conf_table) / sizeof(freq_conf_table[0]);
+   array_size = nitems(freq_conf_table);
if (sar_fab_freq >= array_size)
panic("Reserved value in fabric frequency configuration field: "
"%d", sar_fab_freq);

Modified: head/sys/arm/ti/cpsw/if_cpsw.c
==
--- head/sys/arm/ti/cpsw/if_cpsw.c  Wed Apr 20 15:31:03 2016
(r298351)
+++ head/sys/arm/ti/cpsw/if_cpsw.c  Wed Apr 20 15:45:55 2016
(r298352)
@@ -470,7 +470,7 @@ cpsw_init_slots(struct cpsw_softc *sc)
STAILQ_INIT(>avail);
 
/* Put the slot descriptors onto the global avail list. */
-   for (i = 0; 

svn commit: r298351 - head/sys/nlm

2016-04-20 Thread Sean Bruno
Author: sbruno
Date: Wed Apr 20 15:31:03 2016
New Revision: 298351
URL: https://svnweb.freebsd.org/changeset/base/298351

Log:
  Avoid a possible heap overflow in our nlm code by limiting the number
  of service to the arbitrary value of 256.  Log an appropriate message
  that indicates the hard limit.
  
  PR:   208808
  Submitted by: ct...@hardenedbsd.org
  Reviewed by:  dfr
  Obtained from:HardenedBSD
  MFC after:2 weeks

Modified:
  head/sys/nlm/nlm_prot_impl.c

Modified: head/sys/nlm/nlm_prot_impl.c
==
--- head/sys/nlm/nlm_prot_impl.cWed Apr 20 14:47:16 2016
(r298350)
+++ head/sys/nlm/nlm_prot_impl.cWed Apr 20 15:31:03 2016
(r298351)
@@ -1439,6 +1439,12 @@ nlm_register_services(SVCPOOL *pool, int
return (EINVAL);
}
 
+   if (addr_count < 0 || addr_count > 256 ) {
+   NLM_ERR("NLM:  too many service addresses (%d) given, "
+   "max 256 - can't start server\n", addr_count);
+   return (EINVAL);
+   }
+
xprts = malloc(addr_count * sizeof(SVCXPRT *), M_NLM, M_WAITOK|M_ZERO);
for (i = 0; i < version_count; i++) {
for (j = 0; j < addr_count; j++) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r298230 - in head: lib/libstand sys/boot/common sys/boot/efi/libefi sys/boot/efi/loader sys/boot/i386/libfirewire sys/boot/i386/libi386 sys/boot/i386/loader sys/boot/mips/beri/loader s

2016-04-20 Thread Warner Losh
On Wed, Apr 20, 2016 at 2:45 AM, Konstantin Belousov 
wrote:

> On Tue, Apr 19, 2016 at 11:29:18AM -0600, Ian Lepore wrote:
> > On Tue, 2016-04-19 at 11:49 -0400, Allan Jude wrote:
> > > On 2016-04-19 05:30, Konstantin Belousov wrote:
> > > > On Mon, Apr 18, 2016 at 07:43:04PM -0400, Allan Jude wrote:
> > > > > On 2016-04-18 19:36, Adrian Chadd wrote:
> > > > > > Someone pointed out how this bloats out memory requirement in
> > > > > > loader.
> > > > > >
> > > > > > Did anyone check that?
> > > > > >
> > > > > > -adrian
> > > > > >
> > > > >
> > > > > I tested down to 128mb of ram in QEMU, booted from the installer
> > > > > ISO,
> > > > > did the install, and booted the installed system without issue.
> > > >
> > > > 64MB is^H^H was very much useful and workable i386 config. i386
> > > > kernel
> > > > does fit into the 32M but current automatic tuning prevents
> > > > usermode
> > > > from operating. Little manual tuning make 32M on tolerable.
> > > >
> > > > Making loader require 64M is a regression. At very least, it is
> > > > impossible to test low mem configs anymore.
> > > >
> > >
> > > Would a src.conf knob make sense, to use a smaller value when
> > > targeting
> > > small systems, while keeping the advantages when using more
> > > reasonable
> > > systems?
> > >
> > > Or we could make these changes to the HEAP and bcache size specific
> > > to
> > > 64bit platforms?
> > >
> >
> > Exactly which "small systems" are we talking about here?  From what I
> > saw in the commit, all of this affects only i386 and amd64 and pc98
> > right now, not arm or mips or other systems that often have < 64MB ram.
> >
> > I take care of some really old legacy embedded systems at customer
> > sites, and even so, with stuff dating back to the 2003-ish timeframe,
> > the smallest i386 memory I have to deal with is 64MB.  Are there really
> > x86 systems that need to run in 32MB or less of ram these days, and use
> > BIOS or EFI to boot?
> Most of the VM/core system work is performed on the x86 machines, I mean
> the debugging and testing, and not compiling.  Consider this first-hand
> experience.
>
> That is, not being able to check a change on 32MB x86 machine means,
> for significant number of developers, that the change cannot be tested
> on 32M machine at all. I leave the exercise of predicting the FreeBSD
> behaviour on 32MB MIPS or ARM arches, after the x86 is left to require
> 128MB at least for several months, to interested readers.
>
> What I wrote above is the only my concern, I do not know for sure if there
> are any production-important installations where x86 FreeBSD of recent
> versions run on, say, 64MB.  As I noted elsewere, 64MB is enough to have
> userspace fully operational.  32MB  is not, but it is still useful for
> kernel-only use.


32MB on arm is tight. Some heroics on tuning and you can still run on
32MB boards. But it is a lot of heroics, at least for ARM. Some minor
tweaking
gets 64MB to perform well, at least for the DNS / DHCP server I run on
mine.

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


Re: svn commit: r298247 - head/sbin/fdisk_pc98

2016-04-20 Thread Bruce Evans

On Wed, 20 Apr 2016, Conrad Meyer wrote:


On Wed, Apr 20, 2016 at 7:33 AM, Pedro Giffuni  wrote:

One of the things I dislike is that most of the macros are in
lowercase. Lowercase would make sense if these were inline functions
but inline functions have disadvantages for these use cases.
OTOH, if they were uppercase, they would not be very easy on the eyes,
which is the current advantage.


Lower case is correct if nitems is a safe macro.  I think it is safe,
because its parameter must be an array and an expression with side
effects can't be an array.


You bring up a good point.  Obviously nitems() can't be an inline
function, but roundup2() and friends could.  Is there any reason not
to change them over to inline functions?


1. Namespace pollution.  Adding nitems() to sys/param.h already broke
   anything using that name.

2. roundup2() and friends can't be inline functions without unportable
   complications to make them type-generic.  No one ever did this for
   the more important imin() family of inline functions.  4.4BSD removed
   the MAX() and MIN() macros in the kernel to enforce use of the imin()
   family, but this gave type errors and was routed around by restoring
   the macros, first in scattered places and then back in sys/param.h.

   2-arg type-generic functions are especially difficult since they have
   N^2 combinations where N is approximately the number of types in
   inttypes.h.  There are 8 basic types just for 8/16/32/64 bits signed
   and unsigned.  For compaibility, the result type must be the same as
   what the macro gives.

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


Re: svn commit: r298247 - head/sbin/fdisk_pc98

2016-04-20 Thread Pedro Giffuni



On 04/20/16 10:04, Pedro Giffuni wrote:



On 04/20/16 09:41, Conrad Meyer wrote:

On Wed, Apr 20, 2016 at 7:33 AM, Pedro Giffuni  wrote:

One of the things I dislike is that most of the macros are in
lowercase. Lowercase would make sense if these were inline functions
but inline functions have disadvantages for these use cases.
OTOH, if they were uppercase, they would not be very easy on the eyes,
which is the current advantage.



You bring up a good point.  Obviously nitems() can't be an inline
function, but roundup2() and friends could.  Is there any reason not
to change them over to inline functions?



That would be interesting. The question would be if there are type
issues. I guess most uses require ints but some many use size_t.



s/many/may/

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


Re: svn commit: r298247 - head/sbin/fdisk_pc98

2016-04-20 Thread Pedro Giffuni



On 04/20/16 09:41, Conrad Meyer wrote:

On Wed, Apr 20, 2016 at 7:33 AM, Pedro Giffuni  wrote:

One of the things I dislike is that most of the macros are in
lowercase. Lowercase would make sense if these were inline functions
but inline functions have disadvantages for these use cases.
OTOH, if they were uppercase, they would not be very easy on the eyes,
which is the current advantage.



You bring up a good point.  Obviously nitems() can't be an inline
function, but roundup2() and friends could.  Is there any reason not
to change them over to inline functions?



That would be interesting. The question would be if there are type
issues. I guess most uses require ints but some many use size_t.

If you are willing to try that, have a look at his patch:

https://people.freebsd.org/~pfg/patches/sys-roundup2.diff

I also have a coccinelle "patch" to replace howmany()
and roundup().

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


svn commit: r298350 - in head/sys: dev/rt mips/mediatek

2016-04-20 Thread Stanislav Galabov
Author: sgalabov
Date: Wed Apr 20 14:47:16 2016
New Revision: 298350
URL: https://svnweb.freebsd.org/changeset/base/298350

Log:
  Add compat strings used by OpenWRT to some Mediatek/Ralink drivers
  
  Approved by:  adrian (mentor)
  Sponsored by: Smartcom - Bulgaria AD
  Differential Revision:https://reviews.freebsd.org/D5995

Modified:
  head/sys/dev/rt/if_rt.c
  head/sys/mips/mediatek/mtk_pcie.c
  head/sys/mips/mediatek/mtk_usb_phy.c

Modified: head/sys/dev/rt/if_rt.c
==
--- head/sys/dev/rt/if_rt.c Wed Apr 20 14:36:45 2016(r298349)
+++ head/sys/dev/rt/if_rt.c Wed Apr 20 14:47:16 2016(r298350)
@@ -104,6 +104,7 @@ static const struct ofw_compat_data rt_c
{ "ralink,rt3883-eth",  RT_CHIPID_RT3050 },
{ "ralink,rt5350-eth",  RT_CHIPID_RT5350 },
{ "ralink,mt7620a-eth", RT_CHIPID_MT7620 },
+   { "mediatek,mt7620-eth",RT_CHIPID_MT7620 },
{ "ralink,mt7621-eth",  RT_CHIPID_MT7621 },
{ "mediatek,mt7621-eth",RT_CHIPID_MT7621 },
{ NULL, 0 }

Modified: head/sys/mips/mediatek/mtk_pcie.c
==
--- head/sys/mips/mediatek/mtk_pcie.c   Wed Apr 20 14:36:45 2016
(r298349)
+++ head/sys/mips/mediatek/mtk_pcie.c   Wed Apr 20 14:47:16 2016
(r298350)
@@ -201,13 +201,9 @@ mtk_pci_ranges(phandle_t node, struct mt
 }
 
 static struct ofw_compat_data compat_data[] = {
-   { "ralink,rt3662-pcie", MTK_SOC_RT3883 },
-   { "ralink,rt3883-pcie", MTK_SOC_RT3883 },
-   { "ralink,mt7620a-pcie",MTK_SOC_MT7620A },
-   { "ralink,mt7621-pcie", MTK_SOC_MT7621 },
+   { "ralink,rt3883-pci",  MTK_SOC_RT3883 },
+   { "mediatek,mt7620-pci",MTK_SOC_MT7620A },
{ "mediatek,mt7621-pci",MTK_SOC_MT7621 },
-   { "ralink,mt7628-pcie", MTK_SOC_MT7628 },
-   { "ralink,mt7688-pcie", MTK_SOC_MT7628 },
{ NULL, MTK_SOC_UNKNOWN }
 };
 

Modified: head/sys/mips/mediatek/mtk_usb_phy.c
==
--- head/sys/mips/mediatek/mtk_usb_phy.cWed Apr 20 14:36:45 2016
(r298349)
+++ head/sys/mips/mediatek/mtk_usb_phy.cWed Apr 20 14:47:16 2016
(r298350)
@@ -85,6 +85,7 @@ static void mtk_usb_phy_mt7628_init(devi
 
 static struct ofw_compat_data compat_data[] = {
{ "ralink,mt7620-usbphy",   MTK_SOC_MT7620A },
+   { "mediatek,mt7620-usbphy", MTK_SOC_MT7620A },
{ "ralink,mt7628an-usbphy", MTK_SOC_MT7628 },
{ "ralink,rt3352-usbphy",   MTK_SOC_RT3352 },
{ "ralink,rt3050-usbphy",   MTK_SOC_RT3050 },
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r298247 - head/sbin/fdisk_pc98

2016-04-20 Thread Conrad Meyer
On Wed, Apr 20, 2016 at 7:33 AM, Pedro Giffuni  wrote:
> One of the things I dislike is that most of the macros are in
> lowercase. Lowercase would make sense if these were inline functions
> but inline functions have disadvantages for these use cases.
> OTOH, if they were uppercase, they would not be very easy on the eyes,
> which is the current advantage.


You bring up a good point.  Obviously nitems() can't be an inline
function, but roundup2() and friends could.  Is there any reason not
to change them over to inline functions?

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


svn commit: r298349 - head/sys/mips/mediatek

2016-04-20 Thread Stanislav Galabov
Author: sgalabov
Date: Wed Apr 20 14:36:45 2016
New Revision: 298349
URL: https://svnweb.freebsd.org/changeset/base/298349

Log:
  Rework mtk_gpio_v1 driver
  
  This revision makes the mtk_gpio_v1 driver read its register map property
  from the OpenWRT dts files.
  
  Approved by:  adrian (mentor)
  Sponsored by: Smartcom - Bulgaria AD
  Differential Revision:https://reviews.freebsd.org/D6029

Modified:
  head/sys/mips/mediatek/mtk_gpio_v1.c

Modified: head/sys/mips/mediatek/mtk_gpio_v1.c
==
--- head/sys/mips/mediatek/mtk_gpio_v1.cWed Apr 20 14:35:00 2016
(r298348)
+++ head/sys/mips/mediatek/mtk_gpio_v1.cWed Apr 20 14:36:45 2016
(r298349)
@@ -59,6 +59,20 @@ __FBSDID("$FreeBSD$");
 
 #define MTK_GPIO_PINS 32
 
+enum mtk_gpio_regs {
+   GPIO_PIOINT = 0,
+   GPIO_PIOEDGE,
+   GPIO_PIORENA,
+   GPIO_PIOFENA,
+   GPIO_PIODATA,
+   GPIO_PIODIR,
+   GPIO_PIOPOL,
+   GPIO_PIOSET,
+   GPIO_PIORESET,
+   GPIO_PIOTOG,
+   GPIO_PIOMAX
+};
+
 struct mtk_gpio_pin_irqsrc {
struct intr_irqsrc  isrc;
u_int   irq;
@@ -81,6 +95,7 @@ struct mtk_gpio_softc {
struct mtk_gpio_pin pins[MTK_GPIO_PINS];
void*intrhand;
 
+   uint8_t regs[GPIO_PIOMAX];
uint32_tnum_pins;
uint8_t do_remap;
 };
@@ -105,20 +120,10 @@ static int mtk_gpio_intr(void *arg);
 "mtk_gpio", MTX_SPIN)
 #define MTK_GPIO_LOCK_DESTROY(sc)  mtx_destroy(&(sc)->mtx)
 
-#define MTK_WRITE_4(sc, reg, val)  bus_write_4((sc)->res[0], (reg), (val))
-#define MTK_READ_4(sc, reg)bus_read_4((sc)->res[0], (reg))
-
-/* Register definitions */
-#define GPIO_PIOINT(_sc)   0x
-#define GPIO_PIOEDGE(_sc)  0x0004
-#define GPIO_PIORENA(_sc)  0x0008
-#define GPIO_PIOFENA(_sc)  0x000C
-#define GPIO_PIODATA(_sc)  ((_sc)->do_remap ? 0x0020 : 0x0010)
-#define GPIO_PIODIR(_sc)   ((_sc)->do_remap ? 0x0024 : 0x0014)
-#define GPIO_PIOPOL(_sc)   ((_sc)->do_remap ? 0x0028 : 0x0018)
-#define GPIO_PIOSET(_sc)   ((_sc)->do_remap ? 0x002C : 0x001C)
-#define GPIO_PIORESET(_sc) ((_sc)->do_remap ? 0x0030 : 0x0020)
-#define GPIO_PIOTOG(_sc)   ((_sc)->do_remap ? 0x0034 : 0x0024)
+#define MTK_WRITE_4(sc, reg, val)  \
+bus_write_4((sc)->res[0], (sc)->regs[(reg)], (val))
+#define MTK_READ_4(sc, reg)\
+bus_read_4((sc)->res[0], (sc)->regs[(reg)])
 
 static struct ofw_compat_data compat_data[] = {
{ "ralink,rt2880-gpio", 1 },
@@ -182,12 +187,12 @@ mtk_gpio_pin_set_direction(struct mtk_gp
if (!(sc->pins[pin].pin_caps & dir))
return (EINVAL);
 
-   regval = MTK_READ_4(sc, GPIO_PIODIR(sc));
+   regval = MTK_READ_4(sc, GPIO_PIODIR);
if (dir == GPIO_PIN_INPUT)
regval &= ~mask;
else
regval |= mask;
-   MTK_WRITE_4(sc, GPIO_PIODIR(sc), regval);
+   MTK_WRITE_4(sc, GPIO_PIODIR, regval);
 
sc->pins[pin].pin_flags &= ~(GPIO_PIN_INPUT | GPIO_PIN_OUTPUT);
sc->pins[pin].pin_flags |= dir;
@@ -200,12 +205,12 @@ mtk_gpio_pin_set_invert(struct mtk_gpio_
 {
uint32_t regval, mask = (1u << pin);
 
-   regval = MTK_READ_4(sc, GPIO_PIOPOL(sc));
+   regval = MTK_READ_4(sc, GPIO_PIOPOL);
if (val)
regval |= mask;
else
regval &= ~mask;
-   MTK_WRITE_4(sc, GPIO_PIOPOL(sc), regval);
+   MTK_WRITE_4(sc, GPIO_PIOPOL, regval);
sc->pins[pin].pin_flags &= ~(GPIO_PIN_INVIN | GPIO_PIN_INVOUT);
sc->pins[pin].pin_flags |= val;
 
@@ -221,25 +226,25 @@ mtk_gpio_pin_probe(struct mtk_gpio_softc
/* Clear cached gpio config */
sc->pins[pin].pin_flags = 0;
 
-   val = MTK_READ_4(sc, GPIO_PIORENA(sc)) |
-   MTK_READ_4(sc, GPIO_PIOFENA(sc));
+   val = MTK_READ_4(sc, GPIO_PIORENA) |
+   MTK_READ_4(sc, GPIO_PIOFENA);
if (val & mask) {
/* Pin is in interrupt mode */
sc->pins[pin].intr_trigger = INTR_TRIGGER_EDGE;
-   val = MTK_READ_4(sc, GPIO_PIORENA(sc));
+   val = MTK_READ_4(sc, GPIO_PIORENA);
if (val & mask)
sc->pins[pin].intr_polarity = INTR_POLARITY_HIGH;
else
sc->pins[pin].intr_polarity = INTR_POLARITY_LOW;
}
 
-   val = MTK_READ_4(sc, GPIO_PIODIR(sc));
+   val = MTK_READ_4(sc, GPIO_PIODIR);
if (val & mask)
sc->pins[pin].pin_flags |= GPIO_PIN_OUTPUT;
else
sc->pins[pin].pin_flags |= GPIO_PIN_INPUT;
 
-   val = MTK_READ_4(sc, GPIO_PIOPOL(sc));
+   val = MTK_READ_4(sc, GPIO_PIOPOL);
if (val & mask) {
if 

svn commit: r298348 - head/sys/mips/mediatek

2016-04-20 Thread Stanislav Galabov
Author: sgalabov
Date: Wed Apr 20 14:35:00 2016
New Revision: 298348
URL: https://svnweb.freebsd.org/changeset/base/298348

Log:
  Introduce OpenWRT compatible pinctrl driver for Mediatek/Ralink SoCs
  
  The driver can read and parse the OpenWRT pinctrl dts entries.
  
  Approved by:  adrian (mentor)
  Sponsored by: Smartcom - Bulgaria AD
  Differential Revision:https://reviews.freebsd.org/D5999

Added:
  head/sys/mips/mediatek/mtk_pinctrl.h   (contents, props changed)
Modified:
  head/sys/mips/mediatek/mtk_pinctrl.c

Modified: head/sys/mips/mediatek/mtk_pinctrl.c
==
--- head/sys/mips/mediatek/mtk_pinctrl.cWed Apr 20 14:33:00 2016
(r298347)
+++ head/sys/mips/mediatek/mtk_pinctrl.cWed Apr 20 14:35:00 2016
(r298348)
@@ -40,11 +40,13 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#include 
+#include 
 
 #include "fdt_pinctrl_if.h"
 
 static const struct ofw_compat_data compat_data[] = {
-   { "ralink,rt2880-pinctrl",  1 },
+   { "ralink,rt2880-pinmux",   1 },
 
/* Sentinel */
{ NULL, 0 }
@@ -74,21 +76,142 @@ mtk_pinctrl_attach(device_t dev)
return (ENXIO);
}
 
-   fdt_pinctrl_register(dev, "pinctrl-single,bits");
+   if (bootverbose)
+   device_printf(dev, "GPIO mode start: 0x%08x\n",
+   mtk_sysctl_get(SYSCTL_GPIOMODE));
+
+   fdt_pinctrl_register(dev, NULL);
fdt_pinctrl_configure_tree(dev);
 
if (bootverbose)
-   device_printf(dev, "GPIO mode: 0x%08x\n",
+   device_printf(dev, "GPIO mode end  : 0x%08x\n",
mtk_sysctl_get(SYSCTL_GPIOMODE));
 
return (0);
 }
 
 static int
+mtk_pinctrl_process_entry(device_t dev, struct mtk_pin_group *table,
+const char *group, char *func)
+{
+   uint32_t val;
+   int found = 0, i, j;
+
+   for (i = 0; table[i].name != NULL; i++) {
+if (strcmp(table[i].name, group) == 0) {
+   found = 1;
+break;
+   }
+}
+
+   if (!found)
+   return (ENOENT);
+
+for (j = 0; j < table[i].funcnum; j++) {
+if (strcmp(table[i].functions[j].name, func) == 0) {
+val = mtk_sysctl_get(table[i].sysc_reg);
+val &= ~(table[i].mask << table[i].offset);
+val |= (table[i].functions[j].value << 
table[i].offset);
+mtk_sysctl_set(table[i].sysc_reg, val);
+return (0);
+   }
+   }
+
+   return (ENOENT);
+}
+
+static int
+mtk_pinctrl_process_node(device_t dev, struct mtk_pin_group *table,
+phandle_t node)
+{
+   const char **group_list = NULL;
+   char *pin_function = NULL;
+   int ret, num_groups, i;
+
+   ret = 0;
+
+   num_groups = ofw_bus_string_list_to_array(node, "ralink,group",
+   _list);
+
+   if (num_groups <= 0)
+   return (ENOENT);
+
+   if (OF_getprop_alloc(node, "ralink,function", sizeof(*pin_function),
+(void **)_function) == -1) {
+   ret = ENOENT;
+   goto out;
+   }
+
+   for (i = 0; i < num_groups; i++) {
+   if ((ret = mtk_pinctrl_process_entry(dev, table, group_list[i],
+   pin_function)) != 0)
+   goto out;
+   }
+
+out:
+   free(group_list, M_OFWPROP);
+   free(pin_function, M_OFWPROP);
+   return (ret);
+}
+
+static int
 mtk_pinctrl_configure(device_t dev, phandle_t cfgxref)
 {
+   struct mtk_pin_group *pintable;
+   phandle_t node, child;
+   uint32_t socid;
+   int ret;
+
+   node = OF_node_from_xref(cfgxref);
+   ret = 0;
+
+   /* Now, get the system type, so we can get the proper GPIO mode array */
+   socid = mtk_soc_get_socid();
+
+   switch (socid) {
+   case MTK_SOC_RT3050: /* fallthrough */
+   case MTK_SOC_RT3052:
+   case MTK_SOC_RT3350:
+   pintable = rt3050_pintable;
+   break;
+   case MTK_SOC_RT3352:
+   pintable = rt3352_pintable;
+   break;
+   case MTK_SOC_RT3662: /* fallthrough */
+   case MTK_SOC_RT3883:
+   pintable = rt3883_pintable;
+   break;
+   case MTK_SOC_RT5350:
+   pintable = rt5350_pintable;
+   break;
+   case MTK_SOC_MT7620A: /* fallthrough */
+   case MTK_SOC_MT7620N:
+   pintable = mt7620_pintable;
+   break;
+   case MTK_SOC_MT7628: /* fallthrough */
+   case MTK_SOC_MT7688:
+   pintable = mt7628_pintable;
+   break;
+   case MTK_SOC_MT7621:
+   pintable = mt7621_pintable;
+   break;
+   default:
+   ret = ENOENT;
+   goto out;
+

svn commit: r298347 - head/sys/dev/flash

2016-04-20 Thread Stanislav Galabov
Author: sgalabov
Date: Wed Apr 20 14:33:00 2016
New Revision: 298347
URL: https://svnweb.freebsd.org/changeset/base/298347

Log:
  Modify mx25l FDT compatible device handling
  
  If we cannot establish compatibility by only looking at the compat_data we
  also check the flash_devices structure's names for a compatible device.
  
  Approved by:  adrian (mentor)
  Sponsored by: Smartcom - Bulgaria AD
  Differential Revision:https://reviews.freebsd.org/D6026

Modified:
  head/sys/dev/flash/mx25l.c

Modified: head/sys/dev/flash/mx25l.c
==
--- head/sys/dev/flash/mx25l.c  Wed Apr 20 14:31:01 2016(r298346)
+++ head/sys/dev/flash/mx25l.c  Wed Apr 20 14:33:00 2016(r298347)
@@ -443,12 +443,26 @@ static struct ofw_compat_data compat_dat
 static int
 mx25l_probe(device_t dev)
 {
-
 #ifdef FDT
+   int i;
+
if (!ofw_bus_status_okay(dev))
return (ENXIO);
-   if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
-   return (ENXIO);
+
+   /* First try to match the compatible property to the compat_data */
+   if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 1)
+   goto found;
+
+   /*
+* Next, try to find a compatible device using the names in the
+* flash_devices structure
+*/
+   for (i = 0; i < nitems(flash_devices); i++)
+   if (ofw_bus_is_compatible(dev, flash_devices[i].name))
+   goto found;
+
+   return (ENXIO);
+found:
 #endif
device_set_desc(dev, "M25Pxx Flash Family");
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r298247 - head/sbin/fdisk_pc98

2016-04-20 Thread Pedro Giffuni



On 04/19/16 22:06, Bruce Evans wrote:

On Wed, 20 Apr 2016, Marcelo Araujo wrote:


2016-04-20 0:16 GMT+08:00 John Baldwin :


On Tuesday, April 19, 2016 04:46:13 AM Marcelo Araujo wrote:

Author: araujo
Date: Tue Apr 19 04:46:13 2016
New Revision: 298247
URL: https://svnweb.freebsd.org/changeset/base/298247

Log:
  Remove redundant parenthesis.

  Submitted by:   pfg
  MFC after:  2 weeks.


I don't realling like churnging to the nonstandard nitems().  Use
of the nonstandard  is bad enough.



TBH, I am not joyful about them either, however it does improve 
readability so it makes sense only in the cases where sys/param.h

is already in use.

One of the things I dislike is that most of the macros are in
lowercase. Lowercase would make sense if these were inline functions
but inline functions have disadvantages for these use cases.
OTOH, if they were uppercase, they would not be very easy on the eyes,
which is the current advantage.

No way out of it :(.

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


svn commit: r298346 - head/sys/boot/fdt/dts/mips

2016-04-20 Thread Stanislav Galabov
Author: sgalabov
Date: Wed Apr 20 14:31:01 2016
New Revision: 298346
URL: https://svnweb.freebsd.org/changeset/base/298346

Log:
  Include resets and clocks properties for PCI in FreeBSD RT3883 dtsi file
  
  This change is required so that RT3662/RT3883 PCI can function correctly
  
  Approved by:  adrian (mentor)
  Sponsored by: Smartcom - Bulgaria AD
  Differential Revision:https://reviews.freebsd.org/D6028

Modified:
  head/sys/boot/fdt/dts/mips/fbsd-rt3883.dtsi

Modified: head/sys/boot/fdt/dts/mips/fbsd-rt3883.dtsi
==
--- head/sys/boot/fdt/dts/mips/fbsd-rt3883.dtsi Wed Apr 20 14:29:03 2016
(r298345)
+++ head/sys/boot/fdt/dts/mips/fbsd-rt3883.dtsi Wed Apr 20 14:31:01 2016
(r298346)
@@ -46,5 +46,8 @@
 
interrupt-parent = <>;
interrupts = <4>;
+
+   resets = < 23>;
+   clocks = < 21>;
};
 };
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r298345 - head/sys/gnu/dts/mips

2016-04-20 Thread Stanislav Galabov
Author: sgalabov
Date: Wed Apr 20 14:29:03 2016
New Revision: 298345
URL: https://svnweb.freebsd.org/changeset/base/298345

Log:
  Change OpenWRT imported dtsi files
  
  Change '#include ' to '/include/ "fbsd-*"' in [rm]t*.dtsi
  
  Basically the pre-import work on OpenWRT's dts/dtsi files boils down to:
  
  for f in `ls [mr]t*.dtsi`; do
  printf '\n/include/ "fbsd-$f"\n' >> $f
  done
  
  Approved by:  adrian (mentor)
  Sponsored by: Smartcom - Bulgaria AD
  Differential Revision:https://reviews.freebsd.org/D5993

Modified:
  head/sys/gnu/dts/mips/mt7620a.dtsi
  head/sys/gnu/dts/mips/mt7620n.dtsi
  head/sys/gnu/dts/mips/mt7621.dtsi
  head/sys/gnu/dts/mips/mt7628an.dtsi
  head/sys/gnu/dts/mips/rt2880.dtsi
  head/sys/gnu/dts/mips/rt3050.dtsi
  head/sys/gnu/dts/mips/rt3352.dtsi
  head/sys/gnu/dts/mips/rt3883.dtsi
  head/sys/gnu/dts/mips/rt5350.dtsi

Modified: head/sys/gnu/dts/mips/mt7620a.dtsi
==
--- head/sys/gnu/dts/mips/mt7620a.dtsi  Wed Apr 20 14:12:40 2016
(r298344)
+++ head/sys/gnu/dts/mips/mt7620a.dtsi  Wed Apr 20 14:29:03 2016
(r298345)
@@ -535,4 +535,4 @@
};
 };
 
-#include 
+/include/ "fbsd-mt7620a.dtsi"

Modified: head/sys/gnu/dts/mips/mt7620n.dtsi
==
--- head/sys/gnu/dts/mips/mt7620n.dtsi  Wed Apr 20 14:12:40 2016
(r298344)
+++ head/sys/gnu/dts/mips/mt7620n.dtsi  Wed Apr 20 14:29:03 2016
(r298345)
@@ -334,4 +334,4 @@
};
 };
 
-#include 
+/include/ "fbsd-mt7620n.dtsi"

Modified: head/sys/gnu/dts/mips/mt7621.dtsi
==
--- head/sys/gnu/dts/mips/mt7621.dtsi   Wed Apr 20 14:12:40 2016
(r298344)
+++ head/sys/gnu/dts/mips/mt7621.dtsi   Wed Apr 20 14:29:03 2016
(r298345)
@@ -374,4 +374,4 @@
};
 };
 
-#include 
+/include/ "fbsd-mt7621.dtsi"

Modified: head/sys/gnu/dts/mips/mt7628an.dtsi
==
--- head/sys/gnu/dts/mips/mt7628an.dtsi Wed Apr 20 14:12:40 2016
(r298344)
+++ head/sys/gnu/dts/mips/mt7628an.dtsi Wed Apr 20 14:29:03 2016
(r298345)
@@ -456,4 +456,4 @@
};
 };
 
-#include 
+/include/ "fbsd-mt7628an.dtsi"

Modified: head/sys/gnu/dts/mips/rt2880.dtsi
==
--- head/sys/gnu/dts/mips/rt2880.dtsi   Wed Apr 20 14:12:40 2016
(r298344)
+++ head/sys/gnu/dts/mips/rt2880.dtsi   Wed Apr 20 14:29:03 2016
(r298345)
@@ -193,4 +193,4 @@
};
 };
 
-#include 
+/include/ "fbsd-rt2880.dtsi"

Modified: head/sys/gnu/dts/mips/rt3050.dtsi
==
--- head/sys/gnu/dts/mips/rt3050.dtsi   Wed Apr 20 14:12:40 2016
(r298344)
+++ head/sys/gnu/dts/mips/rt3050.dtsi   Wed Apr 20 14:29:03 2016
(r298345)
@@ -262,4 +262,4 @@
};
 };
 
-#include 
+/include/ "fbsd-rt3050.dtsi"

Modified: head/sys/gnu/dts/mips/rt3352.dtsi
==
--- head/sys/gnu/dts/mips/rt3352.dtsi   Wed Apr 20 14:12:40 2016
(r298344)
+++ head/sys/gnu/dts/mips/rt3352.dtsi   Wed Apr 20 14:29:03 2016
(r298345)
@@ -290,4 +290,4 @@
};
 };
 
-#include 
+/include/ "fbsd-rt3352.dtsi"

Modified: head/sys/gnu/dts/mips/rt3883.dtsi
==
--- head/sys/gnu/dts/mips/rt3883.dtsi   Wed Apr 20 14:12:40 2016
(r298344)
+++ head/sys/gnu/dts/mips/rt3883.dtsi   Wed Apr 20 14:29:03 2016
(r298345)
@@ -402,4 +402,4 @@
};
 };
 
-#include 
+/include/ "fbsd-rt3883.dtsi"

Modified: head/sys/gnu/dts/mips/rt5350.dtsi
==
--- head/sys/gnu/dts/mips/rt5350.dtsi   Wed Apr 20 14:12:40 2016
(r298344)
+++ head/sys/gnu/dts/mips/rt5350.dtsi   Wed Apr 20 14:29:03 2016
(r298345)
@@ -331,4 +331,4 @@
};
 };
 
-#include 
+/include/ "fbsd-rt5350.dtsi"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r298344 - head/sys/arm64/cavium

2016-04-20 Thread Andrew Turner
Author: andrew
Date: Wed Apr 20 14:12:40 2016
New Revision: 298344
URL: https://svnweb.freebsd.org/changeset/base/298344

Log:
  Group the ThunderX PCIe PEM newbus methods to help find them.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/cavium/thunder_pcie_pem.c

Modified: head/sys/arm64/cavium/thunder_pcie_pem.c
==
--- head/sys/arm64/cavium/thunder_pcie_pem.cWed Apr 20 13:23:06 2016
(r298343)
+++ head/sys/arm64/cavium/thunder_pcie_pem.cWed Apr 20 14:12:40 2016
(r298344)
@@ -161,9 +161,8 @@ static device_method_t thunder_pem_metho
DEVMETHOD(device_probe, thunder_pem_probe),
DEVMETHOD(device_attach,thunder_pem_attach),
DEVMETHOD(device_detach,thunder_pem_detach),
-   DEVMETHOD(pcib_maxslots,thunder_pem_maxslots),
-   DEVMETHOD(pcib_read_config, thunder_pem_read_config),
-   DEVMETHOD(pcib_write_config,thunder_pem_write_config),
+
+   /* Bus interface */
DEVMETHOD(bus_read_ivar,thunder_pem_read_ivar),
DEVMETHOD(bus_write_ivar,   thunder_pem_write_ivar),
DEVMETHOD(bus_alloc_resource,   thunder_pem_alloc_resource),
@@ -174,6 +173,10 @@ static device_method_t thunder_pem_metho
DEVMETHOD(bus_setup_intr,   bus_generic_setup_intr),
DEVMETHOD(bus_teardown_intr,bus_generic_teardown_intr),
 
+   /* pcib interface */
+   DEVMETHOD(pcib_maxslots,thunder_pem_maxslots),
+   DEVMETHOD(pcib_read_config, thunder_pem_read_config),
+   DEVMETHOD(pcib_write_config,thunder_pem_write_config),
DEVMETHOD(pcib_map_msi, thunder_pem_map_msi),
DEVMETHOD(pcib_alloc_msix,  thunder_pem_alloc_msix),
DEVMETHOD(pcib_release_msix,thunder_pem_release_msix),
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r298343 - head/sys/arm64/cavium

2016-04-20 Thread Andrew Turner
Author: andrew
Date: Wed Apr 20 13:23:06 2016
New Revision: 298343
URL: https://svnweb.freebsd.org/changeset/base/298343

Log:
  Pull out the MSI/MSI-X handling calls to simplify future intrng
  integration.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/cavium/thunder_pcie_pem.c

Modified: head/sys/arm64/cavium/thunder_pcie_pem.c
==
--- head/sys/arm64/cavium/thunder_pcie_pem.cWed Apr 20 07:44:50 2016
(r298342)
+++ head/sys/arm64/cavium/thunder_pcie_pem.cWed Apr 20 13:23:06 2016
(r298343)
@@ -126,6 +126,11 @@ static int thunder_pem_adjust_resource(d
 struct resource *, rman_res_t, rman_res_t);
 static struct resource * thunder_pem_alloc_resource(device_t, device_t, int,
 int *, rman_res_t, rman_res_t, rman_res_t, u_int);
+static int thunder_pem_alloc_msi(device_t, device_t, int, int, int *);
+static int thunder_pem_release_msi(device_t, device_t, int, int *);
+static int thunder_pem_map_msi(device_t, device_t, int, uint64_t *, uint32_t 
*);
+static int thunder_pem_alloc_msix(device_t, device_t, int *);
+static int thunder_pem_release_msix(device_t, device_t, int);
 static int thunder_pem_attach(device_t);
 static int thunder_pem_deactivate_resource(device_t, device_t, int, int,
 struct resource *);
@@ -169,11 +174,12 @@ static device_method_t thunder_pem_metho
DEVMETHOD(bus_setup_intr,   bus_generic_setup_intr),
DEVMETHOD(bus_teardown_intr,bus_generic_teardown_intr),
 
-   DEVMETHOD(pcib_map_msi, arm_map_msi),
-   DEVMETHOD(pcib_alloc_msix,  arm_alloc_msix),
-   DEVMETHOD(pcib_release_msix,arm_release_msix),
-   DEVMETHOD(pcib_alloc_msi,   arm_alloc_msi),
-   DEVMETHOD(pcib_release_msi, arm_release_msi),
+   DEVMETHOD(pcib_map_msi, thunder_pem_map_msi),
+   DEVMETHOD(pcib_alloc_msix,  thunder_pem_alloc_msix),
+   DEVMETHOD(pcib_release_msix,thunder_pem_release_msix),
+   DEVMETHOD(pcib_alloc_msi,   thunder_pem_alloc_msi),
+   DEVMETHOD(pcib_release_msi, thunder_pem_release_msi),
+
DEVMETHOD_END
 };
 
@@ -315,6 +321,43 @@ thunder_pem_adjust_resource(device_t dev
 }
 
 static int
+thunder_pem_alloc_msi(device_t pci, device_t child, int count, int maxcount,
+int *irqs)
+{
+
+   return (arm_alloc_msi(pci, child, count, maxcount, irqs));
+}
+
+static int
+thunder_pem_release_msi(device_t pci, device_t child, int count, int *irqs)
+{
+
+   return (arm_release_msi(pci, child, count, irqs));
+}
+
+static int
+thunder_pem_map_msi(device_t pci, device_t child, int irq, uint64_t *addr,
+uint32_t *data)
+{
+
+   return (arm_map_msi(pci, child, irq, addr, data));
+}
+
+static int
+thunder_pem_alloc_msix(device_t pci, device_t child, int *irq)
+{
+
+   return (arm_alloc_msix(pci, child, irq));
+}
+
+static int
+thunder_pem_release_msix(device_t pci, device_t child, int irq)
+{
+
+   return (arm_release_msix(pci, child, irq));
+}
+
+static int
 thunder_pem_identify(device_t dev)
 {
struct thunder_pem_softc *sc;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r298230 - in head: lib/libstand sys/boot/common sys/boot/efi/libefi sys/boot/efi/loader sys/boot/i386/libfirewire sys/boot/i386/libi386 sys/boot/i386/loader sys/boot/mips/beri/loader s

2016-04-20 Thread Konstantin Belousov
On Tue, Apr 19, 2016 at 11:29:18AM -0600, Ian Lepore wrote:
> On Tue, 2016-04-19 at 11:49 -0400, Allan Jude wrote:
> > On 2016-04-19 05:30, Konstantin Belousov wrote:
> > > On Mon, Apr 18, 2016 at 07:43:04PM -0400, Allan Jude wrote:
> > > > On 2016-04-18 19:36, Adrian Chadd wrote:
> > > > > Someone pointed out how this bloats out memory requirement in
> > > > > loader.
> > > > > 
> > > > > Did anyone check that?
> > > > > 
> > > > > -adrian
> > > > > 
> > > > 
> > > > I tested down to 128mb of ram in QEMU, booted from the installer
> > > > ISO, 
> > > > did the install, and booted the installed system without issue.
> > > 
> > > 64MB is^H^H was very much useful and workable i386 config. i386
> > > kernel
> > > does fit into the 32M but current automatic tuning prevents
> > > usermode
> > > from operating. Little manual tuning make 32M on tolerable.
> > > 
> > > Making loader require 64M is a regression. At very least, it is
> > > impossible to test low mem configs anymore.
> > > 
> > 
> > Would a src.conf knob make sense, to use a smaller value when
> > targeting
> > small systems, while keeping the advantages when using more
> > reasonable
> > systems?
> > 
> > Or we could make these changes to the HEAP and bcache size specific
> > to
> > 64bit platforms?
> > 
> 
> Exactly which "small systems" are we talking about here?  From what I
> saw in the commit, all of this affects only i386 and amd64 and pc98
> right now, not arm or mips or other systems that often have < 64MB ram.
> 
> I take care of some really old legacy embedded systems at customer
> sites, and even so, with stuff dating back to the 2003-ish timeframe,
> the smallest i386 memory I have to deal with is 64MB.  Are there really
> x86 systems that need to run in 32MB or less of ram these days, and use
> BIOS or EFI to boot?
Most of the VM/core system work is performed on the x86 machines, I mean
the debugging and testing, and not compiling.  Consider this first-hand
experience.

That is, not being able to check a change on 32MB x86 machine means,
for significant number of developers, that the change cannot be tested
on 32M machine at all. I leave the exercise of predicting the FreeBSD
behaviour on 32MB MIPS or ARM arches, after the x86 is left to require
128MB at least for several months, to interested readers.

What I wrote above is the only my concern, I do not know for sure if there
are any production-important installations where x86 FreeBSD of recent
versions run on, say, 64MB.  As I noted elsewere, 64MB is enough to have
userspace fully operational.  32MB  is not, but it is still useful for
kernel-only use.

> 
> On a related note, can this stuff be used for u-boot and other non-x86
> -BIOS flavors of loader(8)?  If so, then a buildtime knob or the
> ability to set the heap and/or cache size at runtime after figuring out
> how much ram is available would be good features to have.
> 
> -- Ian
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r298342 - head/sys/ofed/drivers/infiniband/core

2016-04-20 Thread Hans Petter Selasky
Author: hselasky
Date: Wed Apr 20 07:44:50 2016
New Revision: 298342
URL: https://svnweb.freebsd.org/changeset/base/298342

Log:
  Fix inverted priv check calls. Priv check returns zero on success and
  an error code on failure. Refer to man 9 priv_check .
  
  Sponsored by: Mellanox Technologies
  MFC after:1 week

Modified:
  head/sys/ofed/drivers/infiniband/core/uverbs_cmd.c

Modified: head/sys/ofed/drivers/infiniband/core/uverbs_cmd.c
==
--- head/sys/ofed/drivers/infiniband/core/uverbs_cmd.c  Wed Apr 20 06:29:03 
2016(r298341)
+++ head/sys/ofed/drivers/infiniband/core/uverbs_cmd.c  Wed Apr 20 07:44:50 
2016(r298342)
@@ -1613,7 +1613,7 @@ ssize_t ib_uverbs_create_qp(struct ib_uv
response = (void __user *) (unsigned long) cmd->response;
 
if (!disable_raw_qp_enforcement &&
-   cmd->qp_type == IB_QPT_RAW_PACKET && !priv_check(curthread, 
PRIV_NET_RAW))
+   cmd->qp_type == IB_QPT_RAW_PACKET && priv_check(curthread, 
PRIV_NET_RAW))
return -EPERM;
 
INIT_UDATA(, buf + cmd_size, response + resp_size,
@@ -3377,7 +3377,7 @@ int ib_uverbs_ex_create_flow(struct ib_u
if (cmd.comp_mask)
return -EINVAL;
 
-   if (!priv_check(curthread, PRIV_NET_RAW) && !disable_raw_qp_enforcement)
+   if (priv_check(curthread, PRIV_NET_RAW) && !disable_raw_qp_enforcement)
return -EPERM;
 
if (cmd.flow_attr.num_of_specs > IB_FLOW_SPEC_SUPPORT_LAYERS)
@@ -3686,7 +3686,7 @@ ssize_t ib_uverbs_exp_create_qp(struct i
return ret;
 
if (!disable_raw_qp_enforcement &&
-   cmd_exp.qp_type == IB_QPT_RAW_PACKET && !priv_check(curthread,
+   cmd_exp.qp_type == IB_QPT_RAW_PACKET && priv_check(curthread,
PRIV_NET_RAW))
return -EPERM;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-04-20 Thread Roman Bogorodskiy
Author: novel (ports committer)
Date: Wed Apr 20 06:29:03 2016
New Revision: 298341
URL: https://svnweb.freebsd.org/changeset/base/298341

Log:
  Update the bhyve(8) man page:
  
   - Document powering off by sending SIGTERM signal
   - Document exit codes
  
  Reviewed by:  wblock, neel
  Approved by:  wblock
  Differential Revision:D5982

Modified:
  head/usr.sbin/bhyve/bhyve.8

Modified: head/usr.sbin/bhyve/bhyve.8
==
--- head/usr.sbin/bhyve/bhyve.8 Wed Apr 20 05:13:36 2016(r298340)
+++ head/usr.sbin/bhyve/bhyve.8 Wed Apr 20 06:29:03 2016(r298341)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 7, 2015
+.Dd April 18, 2016
 .Dt BHYVE 8
 .Os
 .Sh NAME
@@ -289,6 +289,27 @@ Alphanumeric name of the guest.
 This should be the same as that created by
 .Xr bhyveload 8 .
 .El
+.Sh SIGNAL HANDLING
+.Nm
+deals with the following signals:
+.Pp
+.Bl -tag -width indent -compact
+.It SIGTERM
+Trigger ACPI poweroff for a VM
+.El
+.Sh EXIT STATUS
+Exit status indicates how the VM was terminated:
+.Pp
+.Bl -tag -width indent -compact
+.It 0
+rebooted
+.It 1
+powered off
+.It 2
+halted
+.It 3
+triple fault
+.El
 .Sh EXAMPLES
 The guest operating system must have been loaded with
 .Xr bhyveload 8
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"