svn commit: r229375 - head/sys/dev/iwn

2012-01-03 Thread Bernhard Schmidt
Author: bschmidt
Date: Tue Jan  3 09:42:31 2012
New Revision: 229375
URL: http://svn.freebsd.org/changeset/base/229375

Log:
  Don't rely on MCS7 being at index 7 while determining the amount
  of antennas to use. Not all APs enable all MCS rates.
  
  Poked by: Lucius Windschuh lwindschuh at googlemail dot com
  MFC after:1 week

Modified:
  head/sys/dev/iwn/if_iwn.c

Modified: head/sys/dev/iwn/if_iwn.c
==
--- head/sys/dev/iwn/if_iwn.c   Tue Jan  3 09:42:08 2012(r229374)
+++ head/sys/dev/iwn/if_iwn.c   Tue Jan  3 09:42:31 2012(r229375)
@@ -2128,7 +2128,7 @@ iwn_newassoc(struct ieee80211_node *ni, 
plcp |= IWN_RFLAG_SGI;
} else if (ni-ni_htcap  IEEE80211_HTCAP_SHORTGI20)
plcp |= IWN_RFLAG_SGI;
-   if (i  7)
+   if (RV(ni-ni_htrates.rs_rates[i])  7)
plcp |= IWN_RFLAG_ANT(txant1 | txant2);
else
plcp |= IWN_RFLAG_ANT(txant1);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


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

2012-01-03 Thread Kevin Lo
Author: kevlo
Date: Tue Jan  3 10:01:12 2012
New Revision: 229379
URL: http://svn.freebsd.org/changeset/base/229379

Log:
  Add support for Intel EG20T serial ports

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

Modified: head/sys/dev/uart/uart_bus_pci.c
==
--- head/sys/dev/uart/uart_bus_pci.cTue Jan  3 09:51:34 2012
(r229378)
+++ head/sys/dev/uart/uart_bus_pci.cTue Jan  3 10:01:12 2012
(r229379)
@@ -112,6 +112,10 @@ static struct pci_id pci_ns8250_ids[] = 
0x10, 16384000 },
 { 0x151f, 0x, 0x, 0, TOPIC Semiconductor TP560 56k modem, 0x10 },
 { 0x8086, 0x1c3d, 0x, 0, Intel AMT - KT Controller, 0x10 },
+{ 0x8086, 0x8811, 0x, 0, Intel EG20T Serial Port 0, 0x10 },
+{ 0x8086, 0x8812, 0x, 0, Intel EG20T Serial Port 1, 0x10 },
+{ 0x8086, 0x8813, 0x, 0, Intel EG20T Serial Port 2, 0x10 },
+{ 0x8086, 0x8814, 0x, 0, Intel EG20T Serial Port 3, 0x10 },
 { 0x9710, 0x9820, 0x1000, 1, NetMos NM9820 Serial Port, 0x10 },
 { 0x9710, 0x9835, 0x1000, 1, NetMos NM9835 Serial Port, 0x10 },
 { 0x9710, 0x9865, 0xa000, 0x1000, NetMos NM9865 Serial Port, 0x10 },
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r229384 - head/usr.sbin/quotaon

2012-01-03 Thread Ed Schouten
Author: ed
Date: Tue Jan  3 11:08:58 2012
New Revision: 229384
URL: http://svn.freebsd.org/changeset/base/229384

Log:
  Simply use getprogname() to obtain the name of the process.

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

Modified: head/usr.sbin/quotaon/quotaon.c
==
--- head/usr.sbin/quotaon/quotaon.c Tue Jan  3 10:36:38 2012
(r229383)
+++ head/usr.sbin/quotaon/quotaon.c Tue Jan  3 11:08:58 2012
(r229384)
@@ -75,13 +75,11 @@ int
 main(int argc, char **argv)
 {
struct fstab *fs;
-   char *whoami;
+   const char *whoami;
long argnum, done = 0;
int ch, i, offmode = 0, errs = 0;
 
-   whoami = rindex(*argv, '/') + 1;
-   if (whoami == (char *)1)
-   whoami = *argv;
+   whoami = getprogname();
if (strcmp(whoami, quotaoff) == 0)
offmode++;
else if (strcmp(whoami, quotaon) != 0)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r229385 - head/usr.sbin/bsnmpd/tools/libbsnmptools

2012-01-03 Thread Ed Schouten
Author: ed
Date: Tue Jan  3 11:10:15 2012
New Revision: 229385
URL: http://svn.freebsd.org/changeset/base/229385

Log:
  Fix subtle typo: compare against idx -- not index.
  
  In this contest, index refers to the index(3) function. In this case it
  doesn't really harm, as this function is never called with idx == NULL.
  
  MFC after:2 weeks

Modified:
  head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c

Modified: head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c
==
--- head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c Tue Jan  3 11:08:58 
2012(r229384)
+++ head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c Tue Jan  3 11:10:15 
2012(r229385)
@@ -469,7 +469,7 @@ snmp_leaf_insert(struct snmp_toolinfo *s
 static int32_t
 snmp_index_insert(struct snmp_idxlist *headp, struct index *idx)
 {
-   if (headp == NULL || index == NULL)
+   if (headp == NULL || idx == NULL)
return (-1);
 
STAILQ_INSERT_TAIL(headp, idx, link);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r229386 - head/usr.bin/talk

2012-01-03 Thread Ed Schouten
Author: ed
Date: Tue Jan  3 11:13:07 2012
New Revision: 229386
URL: http://svn.freebsd.org/changeset/base/229386

Log:
  Remove hand-written version of strcspn().
  
  The code searches for the first occurence of @, : or !. Upon failure, it
  returns the index of \0. This is exactly what strcspn() does.

Modified:
  head/usr.bin/talk/get_names.c

Modified: head/usr.bin/talk/get_names.c
==
--- head/usr.bin/talk/get_names.c   Tue Jan  3 11:10:15 2012
(r229385)
+++ head/usr.bin/talk/get_names.c   Tue Jan  3 11:13:07 2012
(r229386)
@@ -80,8 +80,7 @@ get_names(int argc, char *argv[])
gethostname(hostname, sizeof (hostname));
my_machine_name = hostname;
/* check for, and strip out, the machine name of the target */
-   for (cp = argv[1]; *cp  !index(@:!, *cp); cp++)
-   ;
+   cp = argv[1] + strcspn(argv[1], @:!);
if (*cp == '\0') {
/* this is a local to local talk */
his_name = argv[1];
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r229368 - in head: lib/libc lib/libc/arm/string lib/libc/i386/string lib/libc/mips/string lib/libc/string lib/libstand sys/boot/userboot/libstand

2012-01-03 Thread Bruce Evans

On Tue, 3 Jan 2012, Ed Schouten wrote:


Log:
 Merge index() and strchr() together.

 As I looked through the C library, I noticed the FreeBSD MIPS port has a
 hand-written version of index(). This is nice, if it weren't for the
 fact that most applications call strchr() instead.

 Also, on the other architectures index() and strchr() are identical,
 meaning we have two identical pieces of code in the C library and
 statically linked applications.


Only in statically linked applications that used both, since they weren't
actually identical -- they were intentionally put in separate object files
to avoid this problem.  (In asm, you don't need symbol magic to declare
strong aliases, but just use 2 .globl labels together.  But this is usually
wrong since it doesn't keep things separate enough.  Some files use
#include to implement the multiple copies.  For example, amd64 and i386
don't bother optimizing memcpy() over memmove(), but make it a copy in
a separate file.  The i386 index.S and strchr.S were not so good -- they
duplicated the code.)


 Solve this by naming the actual file strchr.[cS] and let it use
 __strong_reference()/STRONG_ALIAS() to provide the index() routine. Do
 the same for rindex()/strrchr().


This breaks the Standard C namespace.  When they are in the same object
file, there is no way to get the standard name without getting the
nonstandard name.  So the following C-standard-conforming C program
now gets a linkage error (multiple definition of `index'), at least with
static linkage:

#include string.h
int index;
void foo(const char *p) { return strchr(p, '1'); }

When they were in separate object files, the nonstandard name just added
to the general pollution in the libc runtime in a way that doesn't seem
to cause any problems in practice, since it is orthogonal to any uses of
the name in a conforming application.

We mostly use weak references in libraries, to avoid problems like
this.  In libc, there were just 2 __strong_reference()s and 111
__weak_reference()s.  One of the oldest weak references is from
__vfscanf to vfscanf.  This is used to implement a bug in C90: C90
doesn't have vfscanf, so it must not be in libc in a way that conflicts
with any application symbol named vfscanf.  libc needs vfscanf's
functionality internally, and doesn't want to duplicate the whole
thing.  So it puts the functionality in __vfscanf and always uses that
internally, and provides the duplication solely as a weak symbol.  The
symbol remains weak, and C90 remains sort of supported, although the
bug is fixed in C99 (it has vfscanf).  There are also _many_ (but not
nearly all?) POSIX symbols that are handled as weak references.
Internally, they have names like _open and weak symbols like `open'
(for some reason, both _open and `open' are shown by nm as weak).
These are implemented more magically using include/*namespace.h and
macros in asm files.  I got the count of 111 by grepping for the C
macro.  This missed all the asm macros.  Grepping for ' W ' in libc.a
shows 1024 weak references.  That's almost 30% of all symbols (there
are 2195 ' T ' symbols).  nm doesn't seem to provide a way to show
what the symbols are aliases for.  It is worse for strong symbols
(shows them both as ' T ').



 This seems to make the C libraries and static binaries slightly smaller,
 but this reduction in size seems negligible.


Duplication of the object file (except for the global symbols) is best,
and may be required, even for the example of memcpy being identical
to memmove given above.  It is useful to be able to put a breakpoint
at memcpy without having it trigger when memmove is called, and the C
standard might require memcpy and memmove to have different addresses.
Similarly for profiling.  You want logically different functions to
have different addresses.  I wonder if gprof knows enough about symbols
to prefer strchr over index if they are strong aliases for each other.

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


Re: svn commit: r229198 - in head: share/man/man9 sys/conf sys/libkern sys/sys

2012-01-03 Thread Pawel Jakub Dawidek
On Sun, Jan 01, 2012 at 08:26:11PM +, Ed Schouten wrote:
 Author: ed
 Date: Sun Jan  1 20:26:11 2012
 New Revision: 229198
 URL: http://svn.freebsd.org/changeset/base/229198
 
 Log:
   Introducing memcchr(3).
   
   It seems two of the file system drivers we have in the tree, namely ufs
   and ext3, use a function called `skpc()'. The meaning of this function
   does not seem to be documented in FreeBSD, but it turns out one needs to
   be a VAX programmer to understand what it does.
   
   SPKC is an instruction on the VAX that does the opposite of memchr(). It
   searches for the non-equal character. Add a new function called
   memcchr() to the tree that has the following advantages over skpc():
   
   - It has a name that makes more sense than skpc(). Just like strcspn()
 matches the complement of strspn(), memcchr() is the complement of
 memchr().
   
   - It is faster than skpc(). Similar to our strlen() in libc, it compares
 entire words, instead of single bytes. It seems that for this routine
 this yields a sixfold performance increase on amd64.
   
   - It has a man page.
 
 Added:
   head/share/man/man9/memcchr.3   (contents, props changed)

Shouldn't this be memcchr.9?

-- 
Pawel Jakub Dawidek   http://www.wheelsystems.com
FreeBSD committer http://www.FreeBSD.org
Am I Evil? Yes, I Am! http://yomoli.com


pgpbTrCrW4t05.pgp
Description: PGP signature


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

2012-01-03 Thread John Baldwin
Author: jhb
Date: Tue Jan  3 16:22:29 2012
New Revision: 229390
URL: http://svn.freebsd.org/changeset/base/229390

Log:
  Use TAILQ_FOREACH() instead of TAILQ_FOREACH_SAFE() for some loops that
  do not modify the queues they iterate over.
  
  Submitted by: glebius

Modified:
  head/sys/netinet/igmp.c
  head/sys/netinet6/in6.c
  head/sys/netinet6/mld6.c

Modified: head/sys/netinet/igmp.c
==
--- head/sys/netinet/igmp.c Tue Jan  3 13:16:47 2012(r229389)
+++ head/sys/netinet/igmp.c Tue Jan  3 16:22:29 2012(r229390)
@@ -1642,7 +1642,7 @@ igmp_fasttimo_vnet(void)
struct ifqueue   qrq;   /* Query response packets */
struct ifnet*ifp;
struct igmp_ifinfo  *igi;
-   struct ifmultiaddr  *ifma, *tifma;
+   struct ifmultiaddr  *ifma;
struct in_multi *inm;
int  loop, uri_fasthz;
 
@@ -1709,8 +1709,7 @@ igmp_fasttimo_vnet(void)
}
 
IF_ADDR_LOCK(ifp);
-   TAILQ_FOREACH_SAFE(ifma, ifp-if_multiaddrs, ifma_link,
-   tifma) {
+   TAILQ_FOREACH(ifma, ifp-if_multiaddrs, ifma_link) {
if (ifma-ifma_addr-sa_family != AF_INET ||
ifma-ifma_protospec == NULL)
continue;
@@ -3321,7 +3320,7 @@ igmp_v3_merge_state_changes(struct in_mu
 static void
 igmp_v3_dispatch_general_query(struct igmp_ifinfo *igi)
 {
-   struct ifmultiaddr  *ifma, *tifma;
+   struct ifmultiaddr  *ifma;
struct ifnet*ifp;
struct in_multi *inm;
int  retval, loop;
@@ -3335,7 +3334,7 @@ igmp_v3_dispatch_general_query(struct ig
ifp = igi-igi_ifp;
 
IF_ADDR_LOCK(ifp);
-   TAILQ_FOREACH_SAFE(ifma, ifp-if_multiaddrs, ifma_link, tifma) {
+   TAILQ_FOREACH(ifma, ifp-if_multiaddrs, ifma_link) {
if (ifma-ifma_addr-sa_family != AF_INET ||
ifma-ifma_protospec == NULL)
continue;

Modified: head/sys/netinet6/in6.c
==
--- head/sys/netinet6/in6.c Tue Jan  3 13:16:47 2012(r229389)
+++ head/sys/netinet6/in6.c Tue Jan  3 16:22:29 2012(r229390)
@@ -1325,7 +1325,7 @@ in6_purgeaddr(struct ifaddr *ifa)
struct sockaddr_in6 mltaddr, mltmask;
int plen, error;
struct rtentry *rt;
-   struct ifaddr *ifa0, *nifa;
+   struct ifaddr *ifa0;
 
if (ifa-ifa_carp)
(*carp_detach_p)(ifa);
@@ -1336,7 +1336,7 @@ in6_purgeaddr(struct ifaddr *ifa)
 * address routes
 */
IF_ADDR_LOCK(ifp);
-   TAILQ_FOREACH_SAFE(ifa0, ifp-if_addrhead, ifa_link, nifa) {
+   TAILQ_FOREACH(ifa0, ifp-if_addrhead, ifa_link) {
if ((ifa0-ifa_addr-sa_family != AF_INET6) ||
memcmp(satosin6(ifa0-ifa_addr)-sin6_addr,
   ia-ia_addr.sin6_addr, 

Modified: head/sys/netinet6/mld6.c
==
--- head/sys/netinet6/mld6.cTue Jan  3 13:16:47 2012(r229389)
+++ head/sys/netinet6/mld6.cTue Jan  3 16:22:29 2012(r229390)
@@ -2976,7 +2976,7 @@ mld_v2_merge_state_changes(struct in6_mu
 static void
 mld_v2_dispatch_general_query(struct mld_ifinfo *mli)
 {
-   struct ifmultiaddr  *ifma, *tifma;
+   struct ifmultiaddr  *ifma;
struct ifnet*ifp;
struct in6_multi*inm;
int  retval;
@@ -2990,7 +2990,7 @@ mld_v2_dispatch_general_query(struct mld
ifp = mli-mli_ifp;
 
IF_ADDR_LOCK(ifp);
-   TAILQ_FOREACH_SAFE(ifma, ifp-if_multiaddrs, ifma_link, tifma) {
+   TAILQ_FOREACH(ifma, ifp-if_multiaddrs, ifma_link) {
if (ifma-ifma_addr-sa_family != AF_INET6 ||
ifma-ifma_protospec == NULL)
continue;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


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

2012-01-03 Thread Alexander Motin
Author: mav
Date: Tue Jan  3 17:04:09 2012
New Revision: 229395
URL: http://svn.freebsd.org/changeset/base/229395

Log:
  Add support for CDRIOCGETBLOCKSIZE and CDRIOCSETBLOCKSIZE IOCTLs to control
  sector size same as acd driver does. Together with r228808 and r228847 this
  allows existing multimedia/vlc to play Audio CDs via CAM cd driver.
  
  PR:   ports/162190
  MFC after:1 week

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

Modified: head/sys/cam/scsi/scsi_cd.c
==
--- head/sys/cam/scsi/scsi_cd.c Tue Jan  3 16:54:47 2012(r229394)
+++ head/sys/cam/scsi/scsi_cd.c Tue Jan  3 17:04:09 2012(r229395)
@@ -2685,6 +2685,16 @@ cdioctl(struct disk *dp, u_long cmd, voi
error = cdsetspeed(periph, CDR_MAX_SPEED, *(u_int32_t *)addr);
cam_periph_unlock(periph);
break;
+   case CDRIOCGETBLOCKSIZE:
+   *(int *)addr = softc-params.blksize;
+   break;
+   case CDRIOCSETBLOCKSIZE:
+   if (*(int *)addr = 0) {
+   error = EINVAL;
+   break;
+   }
+   softc-disk-d_sectorsize = softc-params.blksize = *(int 
*)addr;
+   break;
case DVDIOCSENDKEY:
case DVDIOCREPORTKEY: {
struct dvd_authinfo *authinfo;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r229400 - head/sys

2012-01-03 Thread John Baldwin
Author: jhb
Date: Tue Jan  3 17:31:27 2012
New Revision: 229400
URL: http://svn.freebsd.org/changeset/base/229400

Log:
  Improve the cscope target's handling of MD directories.  Automatically
  include the MACHINE_CPUARCH directory if it differents from MACHINE when
  building an index for a single machine.  Also, include the 'x86' directory
  when building an index for i386, pc98, or amd64.
  
  MFC after:1 week

Modified:
  head/sys/Makefile

Modified: head/sys/Makefile
==
--- head/sys/Makefile   Tue Jan  3 17:19:57 2012(r229399)
+++ head/sys/Makefile   Tue Jan  3 17:31:27 2012(r229400)
@@ -13,10 +13,18 @@ CSCOPEDIRS= boot bsm cam cddl compat con
netgraph netinet netinet6 netipsec netipx netnatm netncp \
netsmb nfs nfsclient nfsserver nlm opencrypto \
pci rpc security sys ufs vm xdr xen ${CSCOPE_ARCHDIR}
+.if !defined(CSCOPE_ARCHDIR)
 .if defined(ALL_ARCH)
-CSCOPE_ARCHDIR ?= amd64 arm i386 ia64 mips pc98 powerpc sparc64 x86
+CSCOPE_ARCHDIR = amd64 arm i386 ia64 mips pc98 powerpc sparc64 x86
 .else
-CSCOPE_ARCHDIR ?= ${MACHINE}
+CSCOPE_ARCHDIR = ${MACHINE} 
+.if ${MACHINE} != ${MACHINE_CPUARCH}
+CSCOPE_ARCHDIR += ${MACHINE_CPUARCH}
+.endif
+.if ${MACHINE_CPUARCH} == i386 || ${MACHINE_CPUARCH} == amd64
+CSCOPE_ARCHDIR += x86
+.endif
+.endif
 .endif
 
 # Loadable kernel modules
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r229368 - in head: lib/libc lib/libc/arm/string lib/libc/i386/string lib/libc/mips/string lib/libc/string lib/libstand sys/boot/userboot/libstand

2012-01-03 Thread Ed Schouten
Hi Bruce,

* Bruce Evans b...@optusnet.com.au, 20120103 16:49:
 This breaks the Standard C namespace.  When they are in the same object
 file, there is no way to get the standard name without getting the
 nonstandard name.  So the following C-standard-conforming C program
 now gets a linkage error (multiple definition of `index'), at least with
 static linkage:
 
 #include string.h
 int index;
 void foo(const char *p) { return strchr(p, '1'); }

Though I sympathize, this problem is not just limited to strchr(). There
are other portions of the C library that use index() as well. For
example, if you use ttyent.h, ttyslot(), one of the exec*() functions
or the NIS functions, you already get index() linked into your binary.

 [...] and the C
 standard might require memcpy and memmove to have different addresses.

I just skimmed through the standard, and if I haven't overlooked
anything, no such requirement is made. Also, I can imagine a compiler
with good support for link-time optimisation can already merge equal
pieces of code together, making it even harder to reason about
inequality of function addresses.

Still, I am willing to address the issues you raised. index() and
rindex() aren't that important nowadays and I have a patchset ready in
my home directory that converts almost all apps in the base system to
use strchr() anyway.

As I don't feel like polluting the MI strchr() implementations with
index()/rindex() support, would it be okay if I implement index() and
rindex() as simple C functions that call into strchr() and strrchr()?

-- 
 Ed Schouten e...@80386.nl
 WWW: http://80386.nl/


pgpMurKu1KaVy.pgp
Description: PGP signature


svn commit: r229401 - head/sys/dev/if_ndis

2012-01-03 Thread Dimitry Andric
Author: dim
Date: Tue Jan  3 18:40:41 2012
New Revision: 229401
URL: http://svn.freebsd.org/changeset/base/229401

Log:
  In sys/dev/if_ndis/if_ndis_pccard.c, fix a bug where a garbage rid was
  passed to resource_list_add().  The rid that was just returned by
  bus_alloc_resource_any() should have been used instead.
  
  Reviewed by:  jhb
  MFC after:1 week

Modified:
  head/sys/dev/if_ndis/if_ndis_pccard.c

Modified: head/sys/dev/if_ndis/if_ndis_pccard.c
==
--- head/sys/dev/if_ndis/if_ndis_pccard.c   Tue Jan  3 17:31:27 2012
(r229400)
+++ head/sys/dev/if_ndis/if_ndis_pccard.c   Tue Jan  3 18:40:41 2012
(r229401)
@@ -207,7 +207,7 @@ ndis_attach_pccard(dev)
goto fail;
}
sc-ndis_rescnt++;
-   resource_list_add(sc-ndis_rl, SYS_RES_IOPORT, rid,
+   resource_list_add(sc-ndis_rl, SYS_RES_IOPORT, sc-ndis_io_rid,
rman_get_start(sc-ndis_res_io), rman_get_end(sc-ndis_res_io),
rman_get_size(sc-ndis_res_io));
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r229402 - head/sys/compat/linux

2012-01-03 Thread Dimitry Andric
Author: dim
Date: Tue Jan  3 18:49:39 2012
New Revision: 229402
URL: http://svn.freebsd.org/changeset/base/229402

Log:
  In sys/compat/linux/linux_ioctl.c, work around a warning when a pointer
  is compared to an integer, by casting the pointer to l_uintptr_t.  No
  functional difference on both i386 and amd64.
  
  Reviewed by:  ed, jhb
  MFC after:1 week

Modified:
  head/sys/compat/linux/linux_ioctl.c

Modified: head/sys/compat/linux/linux_ioctl.c
==
--- head/sys/compat/linux/linux_ioctl.c Tue Jan  3 18:40:41 2012
(r229401)
+++ head/sys/compat/linux/linux_ioctl.c Tue Jan  3 18:49:39 2012
(r229402)
@@ -2182,7 +2182,7 @@ linux_ifconf(struct thread *td, struct i
 
CURVNET_SET(TD_TO_VNET(td));
/* handle the 'request buffer size' case */
-   if (ifc.ifc_buf == PTROUT(NULL)) {
+   if ((l_uintptr_t)ifc.ifc_buf == PTROUT(NULL)) {
ifc.ifc_len = 0;
IFNET_RLOCK();
TAILQ_FOREACH(ifp, V_ifnet, if_link) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r229403 - in head: games/fortune/fortune lib/libc/gen lib/libc/net lib/libcam lib/libstand lib/libutil libexec/mknetid libexec/rlogind sbin/bsdlabel sbin/dump sbin/fsck_ffs sbin/ipfw sb...

2012-01-03 Thread Ed Schouten
Author: ed
Date: Tue Jan  3 18:51:58 2012
New Revision: 229403
URL: http://svn.freebsd.org/changeset/base/229403

Log:
  Replace index() and rindex() calls with strchr() and strrchr().
  
  The index() and rindex() functions were marked LEGACY in the 2001
  revision of POSIX and were subsequently removed from the 2008 revision.
  The strchr() and strrchr() functions are part of the C standard.
  
  This makes the source code a lot more consistent, as most of these C
  files also call into other str*() routines. In fact, about a dozen
  already perform strchr() calls.

Modified:
  head/games/fortune/fortune/fortune.c
  head/lib/libc/gen/exec.c
  head/lib/libc/gen/getttyent.c
  head/lib/libc/gen/timezone.c
  head/lib/libc/net/gethostbynis.c
  head/lib/libc/net/getnetbynis.c
  head/lib/libcam/camlib.c
  head/lib/libstand/bootp.c
  head/lib/libutil/quotafile.c
  head/libexec/mknetid/parse_group.c
  head/libexec/rlogind/rlogind.c
  head/sbin/bsdlabel/bsdlabel.c
  head/sbin/dump/main.c
  head/sbin/fsck_ffs/pass2.c
  head/sbin/ipfw/main.c
  head/sbin/shutdown/shutdown.c
  head/sys/boot/common/interp_parse.c
  head/sys/boot/ofw/common/main.c
  head/sys/boot/ofw/libofw/ofw_net.c
  head/usr.bin/cksum/cksum.c
  head/usr.bin/compress/compress.c
  head/usr.bin/finger/finger.c
  head/usr.bin/hexdump/display.c
  head/usr.bin/hexdump/hexdump.c
  head/usr.bin/hexdump/hexsyntax.c
  head/usr.bin/hexdump/parse.c
  head/usr.bin/locate/locate/fastfind.c
  head/usr.bin/locate/locate/util.c
  head/usr.bin/netstat/if.c
  head/usr.bin/netstat/inet.c
  head/usr.bin/netstat/inet6.c
  head/usr.bin/netstat/sctp.c
  head/usr.bin/rlogin/rlogin.c
  head/usr.bin/rpcgen/rpc_main.c
  head/usr.bin/systat/devs.c
  head/usr.bin/systat/netcmds.c
  head/usr.bin/systat/netstat.c
  head/usr.bin/tftp/main.c
  head/usr.bin/tr/str.c
  head/usr.bin/tset/map.c
  head/usr.bin/tset/term.c
  head/usr.bin/tset/wrterm.c
  head/usr.sbin/bootparamd/bootparamd/bootparamd.c
  head/usr.sbin/config/main.c
  head/usr.sbin/config/mkmakefile.c
  head/usr.sbin/inetd/inetd.c
  head/usr.sbin/ipfwpcap/ipfwpcap.c
  head/usr.sbin/mtree/spec.c
  head/usr.sbin/newsyslog/newsyslog.c
  head/usr.sbin/rwhod/rwhod.c
  head/usr.sbin/sade/variable.c

Modified: head/games/fortune/fortune/fortune.c
==
--- head/games/fortune/fortune/fortune.cTue Jan  3 18:49:39 2012
(r229402)
+++ head/games/fortune/fortune/fortune.cTue Jan  3 18:51:58 2012
(r229403)
@@ -683,7 +683,7 @@ all_forts(FILEDESC *fp, char *offensive)
obscene-fd = fd;
obscene-inf = NULL;
obscene-path = offensive;
-   if ((sp = rindex(offensive, '/')) == NULL)
+   if ((sp = strrchr(offensive, '/')) == NULL)
obscene-name = offensive;
else
obscene-name = ++sp;
@@ -785,7 +785,7 @@ is_fortfile(const char *file, char **dat
}
}
 
-   if ((sp = rindex(file, '/')) == NULL)
+   if ((sp = strrchr(file, '/')) == NULL)
sp = file;
else
sp++;
@@ -797,7 +797,7 @@ is_fortfile(const char *file, char **dat
DPRINTF(2, (stderr, FALSE (check fortunes only)\n));
return (FALSE);
}
-   if ((sp = rindex(sp, '.')) != NULL) {
+   if ((sp = strrchr(sp, '.')) != NULL) {
sp++;
for (i = 0; suflist[i] != NULL; i++)
if (strcmp(sp, suflist[i]) == 0) {

Modified: head/lib/libc/gen/exec.c
==
--- head/lib/libc/gen/exec.cTue Jan  3 18:49:39 2012(r229402)
+++ head/lib/libc/gen/exec.cTue Jan  3 18:51:58 2012(r229403)
@@ -159,7 +159,7 @@ execvPe(const char *name, const char *pa
eacces = 0;
 
/* If it's an absolute or relative path name, it's easy. */
-   if (index(name, '/')) {
+   if (strchr(name, '/')) {
bp = name;
cur = NULL;
goto retry;

Modified: head/lib/libc/gen/getttyent.c
==
--- head/lib/libc/gen/getttyent.c   Tue Jan  3 18:49:39 2012
(r229402)
+++ head/lib/libc/gen/getttyent.c   Tue Jan  3 18:51:58 2012
(r229403)
@@ -78,7 +78,7 @@ getttyent(void)
if (!fgets(p = line, lbsize, tf))
return (NULL);
/* extend buffer if line was too big, and retry */
-   while (!index(p, '\n')  !feof(tf)) {
+   while (!strchr(p, '\n')  !feof(tf)) {
i = strlen(p);
lbsize += MALLOCCHUNK;
if ((p = realloc(line, lbsize)) == NULL) {
@@ -148,7 +148,7 @@ getttyent(void)
tty.ty_comment = p;
if (*p == 0)
tty.ty_comment = 0;
-   if ( (p = index(p, '\n')) )
+   if ((p = strchr(p, 

svn commit: r229407 - head/sys/fs/ntfs

2012-01-03 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Jan  3 19:09:01 2012
New Revision: 229407
URL: http://svn.freebsd.org/changeset/base/229407

Log:
  Minor cleanups to ntfs code
  
  bzero - memset
  rename variables to avoid shadowing.
  
  PR:   142401
  Obtained from:NetBSD
  Approved by   jhb (mentor)

Modified:
  head/sys/fs/ntfs/ntfs_compr.c
  head/sys/fs/ntfs/ntfs_subr.c

Modified: head/sys/fs/ntfs/ntfs_compr.c
==
--- head/sys/fs/ntfs/ntfs_compr.c   Tue Jan  3 19:01:54 2012
(r229406)
+++ head/sys/fs/ntfs/ntfs_compr.c   Tue Jan  3 19:09:01 2012
(r229407)
@@ -42,7 +42,7 @@
 
 int
 ntfs_uncompblock(
-   u_int8_t * buf,
+   u_int8_t * dbuf,
u_int8_t * cbuf)
 {
u_int32_t   ctag;
@@ -60,8 +60,8 @@ ntfs_uncompblock(
dprintf((ntfs_uncompblock: len: %x instead of %d\n,
len, 0xfff));
}
-   memcpy(buf, cbuf + 2, len + 1);
-   bzero(buf + len + 1, NTFS_COMPBLOCK_SIZE - 1 - len);
+   memcpy(dbuf, cbuf + 2, len + 1);
+   memset(dbuf + len + 1, 0, NTFS_COMPBLOCK_SIZE - 1 - len);
return len + 3;
}
cpos = 2;
@@ -78,12 +78,12 @@ ntfs_uncompblock(
boff = -1 - (GET_UINT16(cbuf + cpos)  dshift);
blen = 3 + (GET_UINT16(cbuf + cpos)  lmask);
for (j = 0; (j  blen)  (pos  
NTFS_COMPBLOCK_SIZE); j++) {
-   buf[pos] = buf[pos + boff];
+   dbuf[pos] = dbuf[pos + boff];
pos++;
}
cpos += 2;
} else {
-   buf[pos++] = cbuf[cpos++];
+   dbuf[pos++] = cbuf[cpos++];
}
ctag = 1;
}

Modified: head/sys/fs/ntfs/ntfs_subr.c
==
--- head/sys/fs/ntfs/ntfs_subr.cTue Jan  3 19:01:54 2012
(r229406)
+++ head/sys/fs/ntfs/ntfs_subr.cTue Jan  3 19:09:01 2012
(r229407)
@@ -1636,7 +1636,7 @@ ntfs_readntvattr_plain(
for(; remains; remains--)
uiomove(, 1, uio);
} else 
-   bzero(data, tocopy);
+   memset(data, 0, tocopy);
data = data + tocopy;
}
cnt++;
@@ -1783,7 +1783,7 @@ ntfs_readattr(
uiomove(, 1, uio);
}
else
-   bzero(data, tocopy);
+   memset(data, 0, tocopy);
} else {
error = ntfs_uncompunit(ntmp, uup, cup);
if (error)
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r229408 - head/sys/mips/cavium/usb

2012-01-03 Thread Oleksandr Tymoshenko
Author: gonzo
Date: Tue Jan  3 19:10:37 2012
New Revision: 229408
URL: http://svn.freebsd.org/changeset/base/229408

Log:
  - Octeon-SDK strictly requires multi_count to be zero for
  full and low speed devices.

Modified:
  head/sys/mips/cavium/usb/octusb.c

Modified: head/sys/mips/cavium/usb/octusb.c
==
--- head/sys/mips/cavium/usb/octusb.c   Tue Jan  3 19:09:01 2012
(r229407)
+++ head/sys/mips/cavium/usb/octusb.c   Tue Jan  3 19:10:37 2012
(r229408)
@@ -169,7 +169,7 @@ octusb_host_alloc_endpoint(struct octusb
(td-qh-ep_num  UE_DIR_IN) ? CVMX_USB_DIRECTION_IN :
CVMX_USB_DIRECTION_OUT,
td-qh-ep_interval,
-   td-qh-ep_mult,
+   (td-qh-dev_speed == USB_SPEED_HIGH) ? td-qh-ep_mult : 0,
td-qh-hs_hub_addr,
td-qh-hs_hub_port);
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r229413 - in head/contrib/compiler-rt: . lib

2012-01-03 Thread Ed Schouten
Author: ed
Date: Tue Jan  3 19:41:36 2012
New Revision: 229413
URL: http://svn.freebsd.org/changeset/base/229413

Log:
  Import compiler-rt r147467.
  
  The compiler-rt shipped with FreeBSD is now based on unmodified upstream
  sources.

Modified:
  head/contrib/compiler-rt/LICENSE.TXT
  head/contrib/compiler-rt/lib/trampoline_setup.c
Directory Properties:
  head/contrib/compiler-rt/   (props changed)

Modified: head/contrib/compiler-rt/LICENSE.TXT
==
--- head/contrib/compiler-rt/LICENSE.TXTTue Jan  3 19:39:27 2012
(r229412)
+++ head/contrib/compiler-rt/LICENSE.TXTTue Jan  3 19:41:36 2012
(r229413)
@@ -14,7 +14,7 @@ Full text of the relevant licenses is in
 University of Illinois/NCSA
 Open Source License
 
-Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
+Copyright (c) 2009-2012 by the contributors listed in CREDITS.TXT
 
 All rights reserved.
 
@@ -55,7 +55,7 @@ SOFTWARE.
 
 ==
 
-Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
+Copyright (c) 2009-2012 by the contributors listed in CREDITS.TXT
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the Software), to deal

Modified: head/contrib/compiler-rt/lib/trampoline_setup.c
==
--- head/contrib/compiler-rt/lib/trampoline_setup.c Tue Jan  3 19:39:27 
2012(r229412)
+++ head/contrib/compiler-rt/lib/trampoline_setup.c Tue Jan  3 19:41:36 
2012(r229413)
@@ -44,4 +44,4 @@ void __trampoline_setup(uint32_t* trampO
 /* clear instruction cache */
 __clear_cache(trampOnStack, trampOnStack[10]);
 }
-#endif /* __ppc__ */
+#endif /* __ppc__  !defined(__powerpc64__) */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r229414 - head/sys/netinet6

2012-01-03 Thread John Baldwin
Author: jhb
Date: Tue Jan  3 19:44:36 2012
New Revision: 229414
URL: http://svn.freebsd.org/changeset/base/229414

Log:
  Grab a reference on the matching interface address (ifa) in the handling
  of the SIOC[DG]LIFADDR icotls before dropping the IF_ADDR_LOCK() and
  release the reference after using it.  This prevents the address from
  being potentially freed out from under the ioctl handler.
  
  Reviewed by:  bz
  MFC after:1 week

Modified:
  head/sys/netinet6/in6.c

Modified: head/sys/netinet6/in6.c
==
--- head/sys/netinet6/in6.c Tue Jan  3 19:41:36 2012(r229413)
+++ head/sys/netinet6/in6.c Tue Jan  3 19:44:36 2012(r229414)
@@ -1767,6 +1767,8 @@ in6_lifaddr_ioctl(struct socket *so, u_l
if (IN6_ARE_ADDR_EQUAL(candidate, match))
break;
}
+   if (ifa != NULL)
+   ifa_ref(ifa);
IF_ADDR_UNLOCK(ifp);
if (!ifa)
return EADDRNOTAVAIL;
@@ -1779,16 +1781,20 @@ in6_lifaddr_ioctl(struct socket *so, u_l
bcopy(ia-ia_addr, iflr-addr, ia-ia_addr.sin6_len);
error = sa6_recoverscope(
(struct sockaddr_in6 *)iflr-addr);
-   if (error != 0)
+   if (error != 0) {
+   ifa_free(ifa);
return (error);
+   }
 
if ((ifp-if_flags  IFF_POINTOPOINT) != 0) {
bcopy(ia-ia_dstaddr, iflr-dstaddr,
ia-ia_dstaddr.sin6_len);
error = sa6_recoverscope(
(struct sockaddr_in6 *)iflr-dstaddr);
-   if (error != 0)
+   if (error != 0) {
+   ifa_free(ifa);
return (error);
+   }
} else
bzero(iflr-dstaddr, sizeof(iflr-dstaddr));
 
@@ -1796,6 +1802,7 @@ in6_lifaddr_ioctl(struct socket *so, u_l
in6_mask2len(ia-ia_prefixmask.sin6_addr, NULL);
 
iflr-flags = ia-ia6_flags;/* XXX */
+   ifa_free(ifa);
 
return 0;
} else {
@@ -1819,6 +1826,7 @@ in6_lifaddr_ioctl(struct socket *so, u_l
ia-ia_prefixmask.sin6_len);
 
ifra.ifra_flags = ia-ia6_flags;
+   ifa_free(ifa);
return in6_control(so, SIOCDIFADDR_IN6, (caddr_t)ifra,
ifp, td);
}
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r229415 - head/lib/libvgl

2012-01-03 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Jan  3 19:47:32 2012
New Revision: 229415
URL: http://svn.freebsd.org/changeset/base/229415

Log:
  Integrate the line drawing algorithm from the book Graphic Gems 1.
  
  http://www.graphicsgems.org/
  
  At the time it claimed to be 3-4 times faster than the traditional
  algorithm.
  
  PR:   18769
  Approved by:  jhb (mentor)
  MFC after:2 weeks

Modified:
  head/lib/libvgl/simple.c

Modified: head/lib/libvgl/simple.c
==
--- head/lib/libvgl/simple.cTue Jan  3 19:44:36 2012(r229414)
+++ head/lib/libvgl/simple.cTue Jan  3 19:47:32 2012(r229415)
@@ -198,36 +198,205 @@ get_planar:
   return 0;/* XXX black? */
 }
 
+ /*
+  * Symmetric Double Step Line Algorithm by Brian Wyvill from
+  * Graphics Gems, Academic Press, 1990.
+  */
+
+#define SL_SWAP(a,b)   {a^=b; b^=a; a^=b;}
+#define SL_ABSOLUTE(i,j,k) ( (i-j)*(k = ( (i-j)0 ? -1 : 1)))
+
+void
+plot(VGLBitmap * object, int x, int y, int flag, byte color)
+{
+  /* non-zero flag indicates the pixels need swapping back. */
+  if (flag)
+VGLSetXY(object, y, x, color);
+  else
+VGLSetXY(object, x, y, color);
+}
+
+
 void
 VGLLine(VGLBitmap *object, int x1, int y1, int x2, int y2, u_long color)
 {
-  int d, x, y, ax, ay, sx, sy, dx, dy;
+  int dx, dy, incr1, incr2, D, x, y, xend, c, pixels_left;
+  int sign_x, sign_y, step, reverse, i;
 
-  dx = x2-x1; ax = ABS(dx)1; sx = SGN(dx); x = x1;
-  dy = y2-y1; ay = ABS(dy)1; sy = SGN(dy); y = y1;
+  dx = SL_ABSOLUTE(x2, x1, sign_x);
+  dy = SL_ABSOLUTE(y2, y1, sign_y);
+  /* decide increment sign by the slope sign */
+  if (sign_x == sign_y)
+step = 1;
+  else
+step = -1;
+
+  if (dy  dx) {   /* chooses axis of greatest movement (make dx) */
+SL_SWAP(x1, y1);
+SL_SWAP(x2, y2);
+SL_SWAP(dx, dy);
+reverse = 1;
+  } else
+reverse = 0;
+  /* note error check for dx==0 should be included here */
+  if (x1  x2) {  /* start from the smaller coordinate */
+x = x2;
+y = y2;
+x1 = x1;
+y1 = y1;
+  } else {
+x = x1;
+y = y1;
+x1 = x2;
+y1 = y2;
+  }
+
+
+  /* Note dx=n implies 0 - n or (dx+1) pixels to be set */
+  /* Go round loop dx/4 times then plot last 0,1,2 or 3 pixels */
+  /* In fact (dx-1)/4 as 2 pixels are already plotted */
+  xend = (dx - 1) / 4;
+  pixels_left = (dx - 1) % 4;  /* number of pixels left over at the
+   * end */
+  plot(object, x, y, reverse, color);
+  if (pixels_left  0)
+return;  /* plot only one pixel for zero length
+   * vectors */
+  plot(object, x1, y1, reverse, color);  /* plot first two points */
+  incr2 = 4 * dy - 2 * dx;
+  if (incr2  0) {/* slope less than 1/2 */
+c = 2 * dy;
+incr1 = 2 * c;
+D = incr1 - dx;
+
+for (i = 0; i  xend; i++) {  /* plotting loop */
+  ++x;
+  --x1;
+  if (D  0) {
+/* pattern 1 forwards */
+plot(object, x, y, reverse, color);
+plot(object, ++x, y, reverse, color);
+/* pattern 1 backwards */
+plot(object, x1, y1, reverse, color);
+plot(object, --x1, y1, reverse, color);
+D += incr1;
+  } else {
+if (D  c) {
+  /* pattern 2 forwards */
+  plot(object, x, y, reverse, color);
+  plot(object, ++x, y += step, reverse,
+  color);
+  /* pattern 2 backwards */
+  plot(object, x1, y1, reverse, color);
+  plot(object, --x1, y1 -= step, reverse,
+  color);
+} else {
+  /* pattern 3 forwards */
+  plot(object, x, y += step, reverse, color);
+  plot(object, ++x, y, reverse, color);
+  /* pattern 3 backwards */
+  plot(object, x1, y1 -= step, reverse,
+  color);
+  plot(object, --x1, y1, reverse, color);
+}
+D += incr2;
+  }
+}  /* end for */
 
-  if (axay) { /* x dominant */
-d = ay-(ax1);
-for (;;) {
-  VGLSetXY(object, x, y, color);
-  if (x==x2)
-   break;
-  if (d=0) {
-   y += sy; d -= ax;
+/* plot last pattern */
+if (pixels_left) {
+  if (D  0) {
+plot(object, ++x, y, reverse, color);  /* pattern 1 */
+if (pixels_left  1)
+  plot(object, ++x, y, reverse, color);
+if (pixels_left  2)
+  plot(object, --x1, y1, reverse, color);
+  } else {
+if (D  c) {
+  plot(object, ++x, y, reverse, color);  /* pattern 2  */
+  if (pixels_left  1)
+plot(object, ++x, y += step, reverse, color);
+  if (pixels_left  2)
+plot(object, --x1, y1, reverse, color);
+} else {
+  /* pattern 3 */
+  plot(object, ++x, y += step, reverse, color);
+  if (pixels_left  1)
+plot(object, ++x, y, reverse, color);
+  if (pixels_left  2)
+plot(object, --x1, y1 -= 

svn commit: r229416 - head/sys/dev/tws

2012-01-03 Thread Xin LI
Author: delphij
Date: Tue Jan  3 20:17:35 2012
New Revision: 229416
URL: http://svn.freebsd.org/changeset/base/229416

Log:
  Don't forget to release queue lock when allocation of memory failed.
  
  Submitted by: Sascha Wildner saw online de
  Obtained from:DragonFly
  MFC after:2 weeks

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

Modified: head/sys/dev/tws/tws.c
==
--- head/sys/dev/tws/tws.c  Tue Jan  3 19:47:32 2012(r229415)
+++ head/sys/dev/tws/tws.c  Tue Jan  3 20:17:35 2012(r229416)
@@ -685,6 +685,7 @@ tws_init_reqs(struct tws_softc *sc, u_in
 {
 if (bus_dmamap_create(sc-data_tag, 0, sc-reqs[i].dma_map)) {
 /* log a ENOMEM failure msg here */
+   mtx_unlock(sc-q_lock);
 return(FAILURE);
 } 
 sc-reqs[i].cmd_pkt =  cmd_buf[i];
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r229423 - head/sys/dev/qlxgb

2012-01-03 Thread Dimitry Andric
Author: dim
Date: Tue Jan  3 20:51:26 2012
New Revision: 229423
URL: http://svn.freebsd.org/changeset/base/229423

Log:
  In sys/dev/qlxgb/qla_misc.c, fix a copy/paste issue.  Clang complained
  the variable 'val' was uninitialized when used.  Instead, 'sig' should
  have been printed.
  
  Reviewed by:  davidcs
  MFC after:1 week

Modified:
  head/sys/dev/qlxgb/qla_misc.c

Modified: head/sys/dev/qlxgb/qla_misc.c
==
--- head/sys/dev/qlxgb/qla_misc.c   Tue Jan  3 20:50:48 2012
(r229422)
+++ head/sys/dev/qlxgb/qla_misc.c   Tue Jan  3 20:51:26 2012
(r229423)
@@ -407,7 +407,7 @@ qla_crb_init(qla_host_t *ha)
addr_val_t *addr_val_map, *avmap;
 
qla_rd_flash32(ha, 0, sig);
-   QL_DPRINT2((ha-pci_dev, %s: val[0] = 0x%08x\n, __func__, val));
+   QL_DPRINT2((ha-pci_dev, %s: val[0] = 0x%08x\n, __func__, sig));
 
qla_rd_flash32(ha, 4, val);
QL_DPRINT2((ha-pci_dev, %s: val[4] = 0x%08x\n, __func__, val));
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r229425 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2012-01-03 Thread Dimitry Andric
Author: dim
Date: Tue Jan  3 20:53:07 2012
New Revision: 229425
URL: http://svn.freebsd.org/changeset/base/229425

Log:
  In sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c, check the
  the number of links against LINK_MAX (which is INT16_MAX), not against
  UINT32_MAX.  Otherwise, the constant would implicitly be converted to
  -1.
  
  Reviewed by:  pjd
  MFC after:1 week

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Jan 
 3 20:52:05 2012(r229424)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Jan 
 3 20:53:07 2012(r229425)
@@ -2698,7 +2698,7 @@ zfs_getattr(vnode_t *vp, vattr_t *vap, i
links = zp-z_links + 1;
else
links = zp-z_links;
-   vap-va_nlink = MIN(links, UINT32_MAX); /* nlink_t limit! */
+   vap-va_nlink = MIN(links, LINK_MAX);   /* nlink_t limit! */
vap-va_size = zp-z_size;
 #ifdef sun
vap-va_rdev = vp-v_rdev;
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r229427 - head/sys/x86/acpica

2012-01-03 Thread John Baldwin
Author: jhb
Date: Tue Jan  3 20:53:58 2012
New Revision: 229427
URL: http://svn.freebsd.org/changeset/base/229427

Log:
  Fix a few bugs in the SRAT parsing code:
  - Actually increment ndomain when building our list of known domains
so that we can properly renumber them to be 0-based and dense.
  - If the number of domains exceeds the configured maximum (VM_NDOMAIN),
bail out of processing the SRAT and disable NUMA rather than hitting an
obscure panic later.
  - Don't bother parsing the SRAT at all if VM_NDOMAIN is set to 1 to
disable NUMA (the default).
  
  Reported by:  phk (2)
  MFC after:1 week

Modified:
  head/sys/x86/acpica/srat.c

Modified: head/sys/x86/acpica/srat.c
==
--- head/sys/x86/acpica/srat.c  Tue Jan  3 20:53:16 2012(r229426)
+++ head/sys/x86/acpica/srat.c  Tue Jan  3 20:53:58 2012(r229427)
@@ -45,6 +45,7 @@ __FBSDID($FreeBSD$);
 
 #include dev/acpica/acpivar.h
 
+#if VM_NDOMAIN  1
 struct cpu_info {
int enabled:1;
int has_memory:1;
@@ -237,9 +238,9 @@ check_phys_avail(void)
 
 /*
  * Renumber the memory domains to be compact and zero-based if not
- * already.
+ * already.  Returns an error if there are too many domains.
  */
-static void
+static int
 renumber_domains(void)
 {
int domains[VM_PHYSSEG_MAX];
@@ -261,6 +262,11 @@ renumber_domains(void)
for (j = ndomain; j  slot; j--)
domains[j] = domains[j - 1];
domains[slot] = mem_info[i].domain;
+   ndomain++;
+   if (ndomain  VM_NDOMAIN) {
+   printf(SRAT: Too many memory domains\n);
+   return (EFBIG);
+   }
}
 
/* Renumber each domain to its index in the sorted 'domains' list. */
@@ -280,6 +286,7 @@ renumber_domains(void)
if (cpus[j].enabled  cpus[j].domain == domains[i])
cpus[j].domain = i;
}
+   return (0);
 }
 
 /*
@@ -306,13 +313,12 @@ parse_srat(void *dummy)
srat_walk_table(srat_parse_entry, error);
acpi_unmap_table(srat);
srat = NULL;
-   if (error || check_domains() != 0 || check_phys_avail() != 0) {
+   if (error || check_domains() != 0 || check_phys_avail() != 0 ||
+   renumber_domains() != 0) {
srat_physaddr = 0;
return;
}
 
-   renumber_domains();
-
/* Point vm_phys at our memory affinity table. */
mem_affinity = mem_info;
 }
@@ -354,3 +360,4 @@ srat_set_cpus(void *dummy)
}
 }
 SYSINIT(srat_set_cpus, SI_SUB_CPU, SI_ORDER_ANY, srat_set_cpus, NULL);
+#endif /* VM_NDOMAIN  1 */
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r229428 - head/sys/fs/nullfs

2012-01-03 Thread Konstantin Belousov
Author: kib
Date: Tue Jan  3 21:03:20 2012
New Revision: 229428
URL: http://svn.freebsd.org/changeset/base/229428

Log:
  Document the state of the lowervp vnode for null_nodeget().
  
  Tested by:pho
  MFC after:1 week

Modified:
  head/sys/fs/nullfs/null_subr.c

Modified: head/sys/fs/nullfs/null_subr.c
==
--- head/sys/fs/nullfs/null_subr.c  Tue Jan  3 20:53:58 2012
(r229427)
+++ head/sys/fs/nullfs/null_subr.c  Tue Jan  3 21:03:20 2012
(r229428)
@@ -198,6 +198,9 @@ null_nodeget(mp, lowervp, vpp)
struct vnode *vp;
int error;
 
+   ASSERT_VOP_LOCKED(lowervp, lowervp);
+   KASSERT(lowervp-v_usecount = 1, (Unreferenced vnode %p\n, vp));
+
/* Lookup the hash firstly */
*vpp = null_hashget(mp, lowervp);
if (*vpp != NULL) {
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r229429 - head/sys/kern

2012-01-03 Thread John Baldwin
Author: jhb
Date: Tue Jan  3 21:03:28 2012
New Revision: 229429
URL: http://svn.freebsd.org/changeset/base/229429

Log:
  Some small fixes to CPU accounting for threads:
  - Only initialize the per-cpu switchticks and switchtime in sched_throw()
for the very first context switch on APs during boot.  This avoids a
small gap between the middle of thread_exit() and sched_throw() where
time is not accounted to any thread.
  - In thread_exit(), update the timestamp bookkeeping to track the changes
to mi_switch() introduced by td_rux so that the code once again matches
the comment claiming it is mimicing mi_switch().  Specifically, only
update the per-thread stats directly and depend on ruxagg() to update
p_rux rather than adjusting p_rux directly.  While here, move the
timestamp bookkeeping as late in the function as possible.
  
  Reviewed by:  bde, kib
  MFC after:1 week

Modified:
  head/sys/kern/kern_thread.c
  head/sys/kern/sched_4bsd.c
  head/sys/kern/sched_ule.c

Modified: head/sys/kern/kern_thread.c
==
--- head/sys/kern/kern_thread.c Tue Jan  3 21:03:20 2012(r229428)
+++ head/sys/kern/kern_thread.c Tue Jan  3 21:03:28 2012(r229429)
@@ -381,7 +381,7 @@ thread_free(struct thread *td)
 void
 thread_exit(void)
 {
-   uint64_t new_switchtime;
+   uint64_t runtime, new_switchtime;
struct thread *td;
struct thread *td2;
struct proc *p;
@@ -410,15 +410,6 @@ thread_exit(void)
 */
cpu_thread_exit(td);/* XXXSMP */
 
-   /* Do the same timestamp bookkeeping that mi_switch() would do. */
-   new_switchtime = cpu_ticks();
-   p-p_rux.rux_runtime += (new_switchtime - PCPU_GET(switchtime));
-   PCPU_SET(switchtime, new_switchtime);
-   PCPU_SET(switchticks, ticks);
-   PCPU_INC(cnt.v_swtch);
-   /* Save our resource usage in our process. */
-   td-td_ru.ru_nvcsw++;
-   rucollect(p-p_ru, td-td_ru);
/*
 * The last thread is left attached to the process
 * So that the whole bundle gets recycled. Skip
@@ -467,7 +458,21 @@ thread_exit(void)
PMC_SWITCH_CONTEXT(td, PMC_FN_CSW_OUT);
 #endif
PROC_UNLOCK(p);
+
+   /* Do the same timestamp bookkeeping that mi_switch() would do. */
+   new_switchtime = cpu_ticks();
+   runtime = new_switchtime - PCPU_GET(switchtime);
+   td-td_runtime += runtime;
+   td-td_incruntime += runtime;
+   PCPU_SET(switchtime, new_switchtime);
+   PCPU_SET(switchticks, ticks);
+   PCPU_INC(cnt.v_swtch);
+
+   /* Save our resource usage in our process. */
+   td-td_ru.ru_nvcsw++;
ruxagg(p, td);
+   rucollect(p-p_ru, td-td_ru);
+
thread_lock(td);
PROC_SUNLOCK(p);
td-td_state = TDS_INACTIVE;

Modified: head/sys/kern/sched_4bsd.c
==
--- head/sys/kern/sched_4bsd.c  Tue Jan  3 21:03:20 2012(r229428)
+++ head/sys/kern/sched_4bsd.c  Tue Jan  3 21:03:28 2012(r229429)
@@ -1572,14 +1572,14 @@ sched_throw(struct thread *td)
if (td == NULL) {
mtx_lock_spin(sched_lock);
spinlock_exit();
+   PCPU_SET(switchtime, cpu_ticks());
+   PCPU_SET(switchticks, ticks);
} else {
lock_profile_release_lock(sched_lock.lock_object);
MPASS(td-td_lock == sched_lock);
}
mtx_assert(sched_lock, MA_OWNED);
KASSERT(curthread-td_md.md_spinlock_count == 1, (invalid count));
-   PCPU_SET(switchtime, cpu_ticks());
-   PCPU_SET(switchticks, ticks);
cpu_throw(td, choosethread());  /* doesn't return */
 }
 

Modified: head/sys/kern/sched_ule.c
==
--- head/sys/kern/sched_ule.c   Tue Jan  3 21:03:20 2012(r229428)
+++ head/sys/kern/sched_ule.c   Tue Jan  3 21:03:28 2012(r229429)
@@ -2587,6 +2587,8 @@ sched_throw(struct thread *td)
/* Correct spinlock nesting and acquire the correct lock. */
TDQ_LOCK(tdq);
spinlock_exit();
+   PCPU_SET(switchtime, cpu_ticks());
+   PCPU_SET(switchticks, ticks);
} else {
MPASS(td-td_lock == TDQ_LOCKPTR(tdq));
tdq_load_rem(tdq, td);
@@ -2595,8 +2597,6 @@ sched_throw(struct thread *td)
KASSERT(curthread-td_md.md_spinlock_count == 1, (invalid count));
newtd = choosethread();
TDQ_LOCKPTR(tdq)-mtx_lock = (uintptr_t)newtd;
-   PCPU_SET(switchtime, cpu_ticks());
-   PCPU_SET(switchticks, ticks);
cpu_throw(td, newtd);   /* doesn't return */
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail 

svn commit: r229430 - in head/sys: conf dev/sound/pci modules/sound/driver/emu10k1

2012-01-03 Thread Pedro F. Giffuni
Author: pfg
Date: Tue Jan  3 21:04:54 2012
New Revision: 229430
URL: http://svn.freebsd.org/changeset/base/229430

Log:
  Replace a GPL'd header in the emu10k1 snd driver code.
  
  This brings in the emuxkireg.h from NetBSD (dev/pci) which
  is used for the same purpose but is smaller. The emu10k1
  is now free from the GPL.
  
  PR:   153901
  Obtained from:NetBSD
  Approved by:  core (mentor implicit)
  MFC after:2 weeks

Added:
  head/sys/dev/sound/pci/emuxkireg.h   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/dev/sound/pci/emu10k1.c
  head/sys/modules/sound/driver/emu10k1/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Tue Jan  3 21:03:28 2012(r229429)
+++ head/sys/conf/files Tue Jan  3 21:04:54 2012(r229430)
@@ -50,7 +50,7 @@ aic79xx_reg_print.c   optional ahd pci

 aic79xx_reg_print.ooptional ahd pci ahd_reg_pretty_print  \
compile-with${NORMAL_C}  \
no-implicit-rule local
-emu10k1-alsa%diked.h   optional snd_emu10k1 | snd_emu10kx \
+emu10k1-alsa%diked.h   optional snd_emu10kx   \
dependency  $S/tools/sound/emu10k1-mkalsa.sh 
$S/gnu/dev/sound/pci/emu10k1-alsa.h \
compile-withCC='${CC}' AWK=${AWK} sh 
$S/tools/sound/emu10k1-mkalsa.sh $S/gnu/dev/sound/pci/emu10k1-alsa.h 
emu10k1-alsa%diked.h \
no-obj no-implicit-rule before-depend  \
@@ -1732,9 +1732,7 @@ dev/sound/pci/csa.c   optional snd_csa pc
warning kernel contains GPL contaminated csaimg.h header
 dev/sound/pci/csapcm.c optional snd_csa pci
 dev/sound/pci/ds1.coptional snd_ds1 pci
-dev/sound/pci/emu10k1.coptional snd_emu10k1 pci \
-   dependency emu10k1-alsa%diked.h \
-   warning kernel contains GPL contaminated emu10k1 headers
+dev/sound/pci/emu10k1.coptional snd_emu10k1 pci
 dev/sound/pci/emu10kx.coptional snd_emu10kx pci \
dependency emu10k1-alsa%diked.h \
dependency p16v-alsa%diked.h \

Modified: head/sys/dev/sound/pci/emu10k1.c
==
--- head/sys/dev/sound/pci/emu10k1.cTue Jan  3 21:03:28 2012
(r229429)
+++ head/sys/dev/sound/pci/emu10k1.cTue Jan  3 21:04:54 2012
(r229430)
@@ -32,7 +32,7 @@
 
 #include dev/sound/pcm/sound.h
 #include dev/sound/pcm/ac97.h
-#include emu10k1-alsa%diked.h
+#include dev/sound/pci/emuxkireg.h
 
 #include dev/pci/pcireg.h
 #include dev/pci/pcivar.h
@@ -66,12 +66,94 @@ SND_DECLARE_FILE($FreeBSD$);
 
 #defineENABLE  0x
 #defineDISABLE 0x
-#defineENV_ON  DCYSUSV_CHANNELENABLE_MASK
+#defineENV_ON  EMU_CHAN_DCYSUSV_CHANNELENABLE_MASK
 #defineENV_OFF 0x00/* XXX: should this be 1? */
 
-#defineA_IOCFG_GPOUT_A 0x40/* Analog Output */
-#defineA_IOCFG_GPOUT_D 0x04/* Digital Output */
-#defineA_IOCFG_GPOUT_AD (A_IOCFG_GPOUT_A|A_IOCFG_GPOUT_D)  /* 
A_IOCFG_GPOUT0 */
+#defineEMU_A_IOCFG_GPOUT_A 0x40
+#defineEMU_A_IOCFG_GPOUT_D 0x04
+#defineEMU_A_IOCFG_GPOUT_AD (EMU_A_IOCFG_GPOUT_A|EMU_A_IOCFG_GPOUT_D)  
/* EMU_A_IOCFG_GPOUT0 */
+
+#defineEMU_HCFG_GPOUT1 0x0800
+
+/* instruction set */
+#define iACC3   0x06
+#define iMACINT0 0x04
+#define iINTERP  0x0e
+
+#define C_ 0x40
+#define C_0001 0x41
+#define C_0004 0x44
+#define C_4000 0x4d
+/* Audigy constants */
+#define A_C_   0xc0
+#define A_C_4000   0xcd
+
+/* GPRs */
+#define FXBUS(x)   (0x00 + (x))
+#define EXTIN(x)   (0x10 + (x))
+#define EXTOUT(x)  (0x20 + (x))
+
+#define GPR(x) (EMU_FXGPREGBASE + (x))
+#define A_EXTIN(x) (0x40 + (x))
+#define A_FXBUS(x) (0x00 + (x))
+#define A_EXTOUT(x)(0x60 + (x))
+#define A_GPR(x)   (EMU_A_FXGPREGBASE + (x))
+
+/* FX buses */
+#define FXBUS_PCM_LEFT 0x00
+#define FXBUS_PCM_RIGHT0x01
+#define FXBUS_MIDI_LEFT0x04
+#define FXBUS_MIDI_RIGHT   0x05
+#define FXBUS_MIDI_REVERB  0x0c
+#define FXBUS_MIDI_CHORUS  0x0d
+
+/* Inputs */
+#define EXTIN_AC97_L   0x00
+#define EXTIN_AC97_R   0x01
+#define EXTIN_SPDIF_CD_L   0x02
+#define EXTIN_SPDIF_CD_R   0x03
+#define EXTIN_TOSLINK_L0x06
+#define EXTIN_TOSLINK_R0x07
+#define EXTIN_COAX_SPDIF_L 0x0a
+#define EXTIN_COAX_SPDIF_R 0x0b
+/* Audigy Inputs */
+#define A_EXTIN_AC97_L 0x00
+#define A_EXTIN_AC97_R 0x01
+
+/* Outputs */
+#define EXTOUT_AC97_L 0x00
+#define EXTOUT_AC97_R 0x01
+#define EXTOUT_TOSLINK_L   0x02
+#define EXTOUT_TOSLINK_R   0x03
+#define 

svn commit: r229431 - head/sys/fs/nullfs

2012-01-03 Thread Konstantin Belousov
Author: kib
Date: Tue Jan  3 21:09:07 2012
New Revision: 229431
URL: http://svn.freebsd.org/changeset/base/229431

Log:
  Do the vput() for the lowervp in the null_nodeget() for error case too.
  Several callers of null_nodeget() did the cleanup itself, but several
  missed it, most prominent being null_bypass(). Remove the cleanup from
  the callers, now null_nodeget() handles lowervp free itself.
  
  Reported and tested by:   pho
  MFC after:1 week

Modified:
  head/sys/fs/nullfs/null_subr.c
  head/sys/fs/nullfs/null_vfsops.c
  head/sys/fs/nullfs/null_vnops.c

Modified: head/sys/fs/nullfs/null_subr.c
==
--- head/sys/fs/nullfs/null_subr.c  Tue Jan  3 21:04:54 2012
(r229430)
+++ head/sys/fs/nullfs/null_subr.c  Tue Jan  3 21:09:07 2012
(r229431)
@@ -171,6 +171,8 @@ null_hashins(mp, xp)
 static void
 null_insmntque_dtr(struct vnode *vp, void *xp)
 {
+
+   vput(((struct null_node *)xp)-null_lowervp);
vp-v_data = NULL;
vp-v_vnlock = vp-v_lock;
free(xp, M_NULLFSNODE);
@@ -226,6 +228,7 @@ null_nodeget(mp, lowervp, vpp)
 
error = getnewvnode(null, mp, null_vnodeops, vp);
if (error) {
+   vput(lowervp);
free(xp, M_NULLFSNODE);
return (error);
}

Modified: head/sys/fs/nullfs/null_vfsops.c
==
--- head/sys/fs/nullfs/null_vfsops.cTue Jan  3 21:04:54 2012
(r229430)
+++ head/sys/fs/nullfs/null_vfsops.cTue Jan  3 21:09:07 2012
(r229431)
@@ -157,8 +157,7 @@ nullfs_mount(struct mount *mp)
 * Make sure the node alias worked
 */
if (error) {
-   vrele(lowerrootvp);
-   free(xmp, M_NULLFSMNT); /* XXX */
+   free(xmp, M_NULLFSMNT);
return (error);
}
 

Modified: head/sys/fs/nullfs/null_vnops.c
==
--- head/sys/fs/nullfs/null_vnops.c Tue Jan  3 21:04:54 2012
(r229430)
+++ head/sys/fs/nullfs/null_vnops.c Tue Jan  3 21:09:07 2012
(r229431)
@@ -365,9 +365,7 @@ null_lookup(struct vop_lookup_args *ap)
vrele(lvp);
} else {
error = null_nodeget(dvp-v_mount, lvp, vp);
-   if (error)
-   vput(lvp);
-   else
+   if (error == 0)
*ap-a_vpp = vp;
}
}
@@ -809,9 +807,7 @@ null_vptocnp(struct vop_vptocnp_args *ap
NULLVPTOLOWERVP(*dvp);
 #endif
VOP_UNLOCK(*dvp, 0); /* keep reference on *dvp */
-   } else
-   vput(ldvp);
-
+   }
vn_lock(vp, locked | LK_RETRY);
return (error);
 }
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r229430 - in head/sys: conf dev/sound/pci modules/sound/driver/emu10k1

2012-01-03 Thread John Baldwin
On Tuesday, January 03, 2012 4:04:54 pm Pedro F. Giffuni wrote:
 Author: pfg
 Date: Tue Jan  3 21:04:54 2012
 New Revision: 229430
 URL: http://svn.freebsd.org/changeset/base/229430
 
 Log:
   Replace a GPL'd header in the emu10k1 snd driver code.
   
   This brings in the emuxkireg.h from NetBSD (dev/pci) which
   is used for the same purpose but is smaller. The emu10k1
   is now free from the GPL.

Is this a common-enough chipset to enable in GENERIC now that it is safe to
do so?

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


Re: svn commit: r229430 - in head/sys: conf dev/sound/pci modules/sound/driver/emu10k1

2012-01-03 Thread Ed Schouten
Hi John,

* John Baldwin j...@freebsd.org, 20120103 22:15:
 Is this a common-enough chipset to enable in GENERIC now that it is safe to
 do so?

I would guess so, especially on i386 boxes.

-- 
 Ed Schouten e...@80386.nl
 WWW: http://80386.nl/


pgpuD7CcMV2dh.pgp
Description: PGP signature


Re: svn commit: r229430 - in head/sys: conf dev/sound/pci modules/sound/driver/emu10k1

2012-01-03 Thread Pedro Giffuni
Hi;

--- Mar 3/1/12, John Baldwin j...@freebsd.org ha scritto:
...
 On Tuesday, January 03, 2012 4:04:54
 pm Pedro F. Giffuni wrote:
  Author: pfg
  Date: Tue Jan  3 21:04:54 2012
  New Revision: 229430
  URL: http://svn.freebsd.org/changeset/base/229430
  
  Log:
    Replace a GPL'd header in the emu10k1
 snd driver code.
    
    This brings in the emuxkireg.h from
 NetBSD (dev/pci) which
    is used for the same purpose but is
 smaller. The emu10k1
    is now free from the GPL.
 
 Is this a common-enough chipset to enable in GENERIC now
 that it is safe to do so?
 

It's probably very common in PC emulators so it will be
important to MFC into stable.

FWIW, two other cards (maestro3 and csaimg) are based on
headers from OSS that are now under a BSD license.

The maestro3 is done (kern/153920) and is next in my
list but it's getting difficult to find testers for
this old stuff.

Cheers,

Pedro.

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


Re: svn commit: r229430 - in head/sys: conf dev/sound/pci modules/sound/driver/emu10k1

2012-01-03 Thread Garrett Cooper
On Tue, Jan 3, 2012 at 2:16 PM, Pedro Giffuni p...@freebsd.org wrote:
 Hi;

 --- Mar 3/1/12, John Baldwin j...@freebsd.org ha scritto:
 ...
 On Tuesday, January 03, 2012 4:04:54
 pm Pedro F. Giffuni wrote:
  Author: pfg
  Date: Tue Jan  3 21:04:54 2012
  New Revision: 229430
  URL: http://svn.freebsd.org/changeset/base/229430
 
  Log:
    Replace a GPL'd header in the emu10k1
 snd driver code.
 
    This brings in the emuxkireg.h from
 NetBSD (dev/pci) which
    is used for the same purpose but is
 smaller. The emu10k1
    is now free from the GPL.

 Is this a common-enough chipset to enable in GENERIC now
 that it is safe to do so?


 It's probably very common in PC emulators so it will be
 important to MFC into stable.

 FWIW, two other cards (maestro3 and csaimg) are based on
 headers from OSS that are now under a BSD license.

 The maestro3 is done (kern/153920) and is next in my
 list but it's getting difficult to find testers for
 this old stuff.

Can the same be done for emu10kx ?

Someday it would be nice to have xfi support in the tree, but that's a
missing driver that even the OSS maintainer was scared to touch
because of the complexity of the code.

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


svn commit: r229436 - head/tools/tools/net80211/wesside/wesside

2012-01-03 Thread Pawel Jakub Dawidek
Author: pjd
Date: Tue Jan  3 22:52:29 2012
New Revision: 229436
URL: http://svn.freebsd.org/changeset/base/229436

Log:
  Fix an obvious typo. We do want to specify file permission when we pass 
O_CREAT.

Modified:
  head/tools/tools/net80211/wesside/wesside/wesside.c

Modified: head/tools/tools/net80211/wesside/wesside/wesside.c
==
--- head/tools/tools/net80211/wesside/wesside/wesside.c Tue Jan  3 22:36:12 
2012(r229435)
+++ head/tools/tools/net80211/wesside/wesside/wesside.c Tue Jan  3 22:52:29 
2012(r229436)
@@ -2091,7 +2091,7 @@ void save_key(unsigned char *key, int le
strcat(k, :);
}
 
-   fd = open(KEY_FILE, O_WRONLY | O_CREAT | 0644);
+   fd = open(KEY_FILE, O_WRONLY | O_CREAT, 0644);
if (fd == -1)
err(1, open());
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r229430 - in head/sys: conf dev/sound/pci modules/sound/driver/emu10k1

2012-01-03 Thread Pedro Giffuni


--- Mar 3/1/12, Garrett Cooper yaneg...@gmail.com ha scritto:
...
 
 Can the same be done for emu10kx ?
 
No :(. The two extra headers are GPL'd and the author doesn't
want to hear about BSDs.

 Someday it would be nice to have xfi support in the tree,
 but that's a missing driver that even the OSS maintainer
 was scared to touch because of the complexity of the code.
 

Apparently Creative released a GPLd driver for linux(ALSA),
but it was not in working shape.

Cheers,

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


Re: svn commit: r229430 - in head/sys: conf dev/sound/pci modules/sound/driver/emu10k1

2012-01-03 Thread Garrett Cooper
On Tue, Jan 3, 2012 at 2:44 PM, Pedro Giffuni p...@freebsd.org wrote:


 --- Mar 3/1/12, Garrett Cooper yaneg...@gmail.com ha scritto:
 ...

 Can the same be done for emu10kx ?

 No :(. The two extra headers are GPL'd and the author doesn't
 want to hear about BSDs.

 Someday it would be nice to have xfi support in the tree,
 but that's a missing driver that even the OSS maintainer
 was scared to touch because of the complexity of the code.


 Apparently Creative released a GPLd driver for linux(ALSA),
 but it was not in working shape.

The ALSA driver worked back when I tried it out 2 years ago. I
asked for them to release an OSS version, but of course they ignored
by request, then some months later released an ALSA version.
There's a preliminary xfi driver in OSS 4.x (and OSS still has a
BSD compatible license), but it's far from complete [and the author is
aware of this :)].
Thanks!
-Garrett
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r229459 - head/lib/libc/sys

2012-01-03 Thread Xin LI
Author: delphij
Date: Wed Jan  4 02:04:20 2012
New Revision: 229459
URL: http://svn.freebsd.org/changeset/base/229459

Log:
  Document the fact that chroot(2) is no longer part of POSIX since SUSv3
  and add a SECURITY CONSIDERATIONS section for recommended practices.

Modified:
  head/lib/libc/sys/chroot.2

Modified: head/lib/libc/sys/chroot.2
==
--- head/lib/libc/sys/chroot.2  Wed Jan  4 02:03:15 2012(r229458)
+++ head/lib/libc/sys/chroot.2  Wed Jan  4 02:04:20 2012(r229459)
@@ -28,7 +28,7 @@
 .\ @(#)chroot.2   8.1 (Berkeley) 6/4/93
 .\ $FreeBSD$
 .\
-.Dd June 4, 1993
+.Dd January 3, 2012
 .Dt CHROOT 2
 .Os
 .Sh NAME
@@ -134,9 +134,27 @@ The
 .Fn chroot
 system call appeared in
 .Bx 4.2 .
+It was marked as
+.Dq legacy
+in
+.St -susv2 ,
+and was removed in subsequent standards.
 .Sh BUGS
 If the process is able to change its working directory to the target
 directory, but another access control check fails (such as a check for
 open directories, or a MAC check), it is possible that this system
 call may return an error, with the working directory of the process
 left changed.
+.Sh SECURITY CONSIDERATIONS
+The system have many hardcoded paths to files where it may load after
+the process starts.
+It is generally recommended to drop privileges immediately after a
+successful
+.Nm
+call,
+and restrict write access to a limited subtree of the
+.Nm
+root,
+for instance,
+setup the sandbox so that the sandboxed user will have no write
+access to any well-known system directories.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r229463 - head/sys/boot/pc98/libpc98

2012-01-03 Thread Takahashi Yoshihiro
Author: nyan
Date: Wed Jan  4 03:54:30 2012
New Revision: 229463
URL: http://svn.freebsd.org/changeset/base/229463

Log:
  MFi386: revision 229435
  
Add special loader environment variables 'comconsole_port' and
'comconsole_pcidev'.
  
  MFC after:2 weeks

Modified:
  head/sys/boot/pc98/libpc98/comconsole.c

Modified: head/sys/boot/pc98/libpc98/comconsole.c
==
--- head/sys/boot/pc98/libpc98/comconsole.c Wed Jan  4 03:49:41 2012
(r229462)
+++ head/sys/boot/pc98/libpc98/comconsole.c Wed Jan  4 03:54:30 2012
(r229463)
@@ -30,6 +30,7 @@ __FBSDID($FreeBSD$);
 #include bootstrap.h
 #include machine/cpufunc.h
 #include dev/ic/ns16550.h
+#include dev/pci/pcireg.h
 #include libi386.h
 
 #define COMC_FMT   0x3 /* 8N1 */
@@ -49,14 +50,23 @@ static int  comc_init(int arg);
 static voidcomc_putchar(int c);
 static int comc_getchar(void);
 static int comc_getspeed(void);
+static voidset_hw_console_hint(void);
 static int comc_ischar(void);
-static int comc_parsespeed(const char *string);
-static voidcomc_setup(int speed);
+static int comc_parseint(const char *string);
+static uint32_t comc_parse_pcidev(const char *string);
+static int comc_pcidev_set(struct env_var *ev, int flags,
+   const void *value);
+static int comc_pcidev_handle(uint32_t locator);
+static int comc_port_set(struct env_var *ev, int flags,
+   const void *value);
+static voidcomc_setup(int speed, int port);
 static int comc_speed_set(struct env_var *ev, int flags,
const void *value);
 
 static int comc_started;
 static int comc_curspeed;
+static int comc_port = COMPORT;
+static uint32_tcomc_locator;
 
 struct console comconsole = {
 comconsole,
@@ -72,9 +82,10 @@ struct console comconsole = {
 static void
 comc_probe(struct console *cp)
 {
-char speedbuf[16];
-char *cons, *speedenv;
-int speed;
+char intbuf[16];
+char *cons, *env;
+int speed, port;
+uint32_t locator;
 
 /* XXX check the BIOS equipment list? */
 cp-c_flags |= (C_PRESENTIN | C_PRESENTOUT);
@@ -90,16 +101,40 @@ comc_probe(struct console *cp)
getenv(boot_multicons) != NULL) {
comc_curspeed = comc_getspeed();
}
-   speedenv = getenv(comconsole_speed);
-   if (speedenv != NULL) {
-   speed = comc_parsespeed(speedenv);
+
+   env = getenv(comconsole_speed);
+   if (env != NULL) {
+   speed = comc_parseint(env);
if (speed  0)
comc_curspeed = speed;
}
 
-   sprintf(speedbuf, %d, comc_curspeed);
+   sprintf(intbuf, %d, comc_curspeed);
unsetenv(comconsole_speed);
-   env_setenv(comconsole_speed, EV_VOLATILE, speedbuf, comc_speed_set,
+   env_setenv(comconsole_speed, EV_VOLATILE, intbuf, comc_speed_set,
+   env_nounset);
+
+   env = getenv(comconsole_port);
+   if (env != NULL) {
+   port = comc_parseint(env);
+   if (port  0)
+   comc_port = port;
+   }
+
+   sprintf(intbuf, %d, comc_port);
+   unsetenv(comconsole_port);
+   env_setenv(comconsole_port, EV_VOLATILE, intbuf, comc_port_set,
+   env_nounset);
+
+   env = getenv(comconsole_pcidev);
+   if (env != NULL) {
+   locator = comc_parse_pcidev(env);
+   if (locator != 0)
+   comc_pcidev_handle(locator);
+   }
+
+   unsetenv(comconsole_pcidev);
+   env_setenv(comconsole_pcidev, EV_VOLATILE, env, comc_pcidev_set,
env_nounset);
 }
 }
@@ -111,7 +146,7 @@ comc_init(int arg)
return 0;
 comc_started = 1;
 
-comc_setup(comc_curspeed);
+comc_setup(comc_curspeed, comc_port);
 
 return(0);
 }
@@ -122,8 +157,8 @@ comc_putchar(int c)
 int wait;
 
 for (wait = COMC_TXWAIT; wait  0; wait--)
-if (inb(COMPORT + com_lsr)  LSR_TXRDY) {
-   outb(COMPORT + com_data, (u_char)c);
+if (inb(comc_port + com_lsr)  LSR_TXRDY) {
+   outb(comc_port + com_data, (u_char)c);
break;
}
 }
@@ -131,13 +166,13 @@ comc_putchar(int c)
 static int
 comc_getchar(void)
 {
-return(comc_ischar() ? inb(COMPORT + com_data) : -1);
+return(comc_ischar() ? inb(comc_port + com_data) : -1);
 }
 
 static int
 comc_ischar(void)
 {
-return(inb(COMPORT + com_lsr)  LSR_RXRDY);
+return(inb(comc_port + com_lsr)  LSR_RXRDY);
 }
 
 static int
@@ -145,13 +180,33 @@ comc_speed_set(struct env_var *ev, int f
 {
 int speed;
 
-if (value == NULL || (speed = comc_parsespeed(value)) = 0) {
+if (value == NULL || (speed = comc_parseint(value)) = 0) {
printf(Invalid speed\n);
return (CMD_ERROR);
 }
 
 if (comc_started  comc_curspeed != speed)
-   comc_setup(speed);
+   comc_setup(speed, comc_port);
+
+

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

2012-01-03 Thread Adrian Chadd
Author: adrian
Date: Wed Jan  4 04:17:03 2012
New Revision: 229464
URL: http://svn.freebsd.org/changeset/base/229464

Log:
  Add a couple more SPI flash device IDs found in commercial
  consumer wireless kit.
  
  Submitted by: Stefan Bethke s...@lassitu.de

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

Modified: head/sys/dev/flash/mx25l.c
==
--- head/sys/dev/flash/mx25l.c  Wed Jan  4 03:54:30 2012(r229463)
+++ head/sys/dev/flash/mx25l.c  Wed Jan  4 04:17:03 2012(r229464)
@@ -101,7 +101,9 @@ struct mx25l_flash_ident flash_devices[]
{ mx25ll64,  0xc2, 0x2017, 64 * 1024, 128, FL_NONE },
{ mx25ll128, 0xc2, 0x2018, 64 * 1024, 256, FL_ERASE_4K | FL_ERASE_32K 
},
{ s25fl128,  0x01, 0x2018, 64 * 1024, 256, FL_NONE },
+   { s25s1032,  0x01, 0x0215, 64 * 1024, 64,  FL_NONE },
{ s25sl064a, 0x01, 0x0216, 64 * 1024, 128, FL_NONE },
+   { w25q64bv,  0xef, 0x4017, 64 * 1024, 128, FL_ERASE_4K },
 };
 
 static uint8_t
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r229465 - head/sys/netinet6

2012-01-03 Thread Gleb Smirnoff
Author: glebius
Date: Wed Jan  4 07:01:23 2012
New Revision: 229465
URL: http://svn.freebsd.org/changeset/base/229465

Log:
  Use correct locking when traversing interface address list.
  
  Reviewed by:  bz

Modified:
  head/sys/netinet6/in6.c

Modified: head/sys/netinet6/in6.c
==
--- head/sys/netinet6/in6.c Wed Jan  4 04:17:03 2012(r229464)
+++ head/sys/netinet6/in6.c Wed Jan  4 07:01:23 2012(r229465)
@@ -2244,9 +2244,7 @@ in6_ifawithifp(struct ifnet *ifp, struct
IF_ADDR_UNLOCK(ifp);
return (besta);
}
-   IF_ADDR_UNLOCK(ifp);
 
-   IN6_IFADDR_RLOCK();
TAILQ_FOREACH(ifa, ifp-if_addrhead, ifa_link) {
if (ifa-ifa_addr-sa_family != AF_INET6)
continue;
@@ -2264,10 +2262,10 @@ in6_ifawithifp(struct ifnet *ifp, struct
 
if (ifa != NULL)
ifa_ref(ifa);
-   IN6_IFADDR_RUNLOCK();
+   IF_ADDR_UNLOCK(ifp);
return (struct in6_ifaddr *)ifa;
}
-   IN6_IFADDR_RUNLOCK();
+   IF_ADDR_UNLOCK(ifp);
 
/* use the last-resort values, that are, deprecated addresses */
if (dep[0])
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r229466 - head/usr.sbin/mptable

2012-01-03 Thread Pawel Jakub Dawidek
Author: pjd
Date: Wed Jan  4 07:04:43 2012
New Revision: 229466
URL: http://svn.freebsd.org/changeset/base/229466

Log:
  Add an missing argument to open(2). If O_CREAT flag is specified,
  file permission has to be specified as well.

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

Modified: head/usr.sbin/mptable/mptable.c
==
--- head/usr.sbin/mptable/mptable.c Wed Jan  4 07:01:23 2012
(r229465)
+++ head/usr.sbin/mptable/mptable.c Wed Jan  4 07:04:43 2012
(r229466)
@@ -828,7 +828,7 @@ MPConfigTableHeader( u_int32_t pap )
 intofd;
 u_char dumpbuf[ 4096 ];
 
-ofd = open( /tmp/mpdump, O_CREAT | O_RDWR );
+ofd = open( /tmp/mpdump, O_CREAT | O_RDWR, 0666 );
 seekEntry( paddr );
 readEntry( dumpbuf, 1024 );
 write( ofd, dumpbuf, 1024 );
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r229467 - head/usr.sbin/uhsoctl

2012-01-03 Thread Pawel Jakub Dawidek
Author: pjd
Date: Wed Jan  4 07:21:37 2012
New Revision: 229467
URL: http://svn.freebsd.org/changeset/base/229467

Log:
  Add an missing argument to open(2). If O_CREAT flag is specified,
  file permission has to be specified as well.

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

Modified: head/usr.sbin/uhsoctl/uhsoctl.c
==
--- head/usr.sbin/uhsoctl/uhsoctl.c Wed Jan  4 07:04:43 2012
(r229466)
+++ head/usr.sbin/uhsoctl/uhsoctl.c Wed Jan  4 07:21:37 2012
(r229467)
@@ -455,7 +455,7 @@ set_nameservers(struct ctx *ctx, const c
free(ctx-ns);
}
 
-   fd = open(respath, O_RDWR | O_CREAT | O_NOFOLLOW);
+   fd = open(respath, O_RDWR | O_CREAT | O_NOFOLLOW, 0666);
if (fd  0)
return (-1);
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


svn commit: r229468 - head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io

2012-01-03 Thread Pawel Jakub Dawidek
Author: pjd
Date: Wed Jan  4 07:25:10 2012
New Revision: 229468
URL: http://svn.freebsd.org/changeset/base/229468

Log:
  Add missing file permission to open(O_CREAT) call. This doesn't really matter
  here, as we open /dev/null for test purposes, but it is useful for consistency
  and further grepping for such bugs.

Modified:
  head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.c

Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.c
==
--- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.c   
Wed Jan  4 07:21:37 2012(r229467)
+++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.c   
Wed Jan  4 07:25:10 2012(r229468)
@@ -82,7 +82,7 @@ main(int argc, char *argv[])
 
fds[n++] = open(file, O_RDWR | O_APPEND | O_CREAT | O_DSYNC |
O_LARGEFILE | O_NOCTTY | O_NONBLOCK | O_NDELAY | O_RSYNC |
-   O_SYNC | O_TRUNC | O_XATTR);
+   O_SYNC | O_TRUNC | O_XATTR, 0666);
 
fds[n++] = open(file, O_RDWR);
(void) lseek(fds[n - 1], 123, SEEK_SET);
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


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

2012-01-03 Thread Fabien Thomas
Author: fabient
Date: Wed Jan  4 07:33:06 2012
New Revision: 229469
URL: http://svn.freebsd.org/changeset/base/229469

Log:
  Add missing MSR programming for some events.
  
  Submitted by: Davide Italiano davide.itali...@gmail.com
  MFC after:3 days

Modified:
  head/sys/dev/hwpmc/hwpmc_uncore.c
  head/sys/dev/hwpmc/hwpmc_uncore.h
  head/sys/dev/hwpmc/pmc_events.h

Modified: head/sys/dev/hwpmc/hwpmc_uncore.c
==
--- head/sys/dev/hwpmc/hwpmc_uncore.c   Wed Jan  4 07:25:10 2012
(r229468)
+++ head/sys/dev/hwpmc/hwpmc_uncore.c   Wed Jan  4 07:33:06 2012
(r229469)
@@ -545,8 +545,14 @@ static struct ucp_event_descr ucp_events
 
 UCPDESCR(0CH_01H, 0x0C, 0x01, UCP_F_FM | UCP_F_WM),
 UCPDESCR(0CH_02H, 0x0C, 0x02, UCP_F_FM | UCP_F_WM),
-UCPDESCR(0CH_04H, 0x0C, 0x04, UCP_F_FM | UCP_F_WM),
-UCPDESCR(0CH_08H, 0x0C, 0x08, UCP_F_FM | UCP_F_WM),
+UCPDESCR(0CH_04H_E, 0x0C, 0x04, UCP_F_FM | UCP_F_WM),
+UCPDESCR(0CH_04H_F, 0x0C, 0x04, UCP_F_FM | UCP_F_WM),
+UCPDESCR(0CH_04H_M, 0x0C, 0x04, UCP_F_FM | UCP_F_WM),
+UCPDESCR(0CH_04H_S, 0x0C, 0x04, UCP_F_FM | UCP_F_WM),
+UCPDESCR(0CH_08H_E, 0x0C, 0x08, UCP_F_FM | UCP_F_WM),
+UCPDESCR(0CH_08H_F, 0x0C, 0x08, UCP_F_FM | UCP_F_WM),
+UCPDESCR(0CH_08H_M, 0x0C, 0x08, UCP_F_FM | UCP_F_WM),
+UCPDESCR(0CH_08H_S, 0x0C, 0x08, UCP_F_FM | UCP_F_WM),
 
 UCPDESCR(20H_01H, 0x20, 0x01, UCP_F_FM | UCP_F_I7 | UCP_F_WM),
 UCPDESCR(20H_02H, 0x20, 0x02, UCP_F_FM | UCP_F_I7 | UCP_F_WM),
@@ -965,6 +971,36 @@ ucp_start_pmc(int cpu, int ri)
PMCDBG(MDP,STA,2, ucp-start/2 cpu=%d ri=%d evselmsr=0x%x evsel=0x%x,
cpu, ri, UCP_EVSEL0 + ri, evsel);
 
+   /* Event specific configuration. */
+   switch (pm-pm_event) {
+   case PMC_EV_UCP_EVENT_0CH_04H_E:
+   wrmsr(MSR_GQ_SNOOP_MESF,0x2);
+   break;
+   case PMC_EV_UCP_EVENT_0CH_04H_F:
+   wrmsr(MSR_GQ_SNOOP_MESF,0x8);
+   break;
+   case PMC_EV_UCP_EVENT_0CH_04H_M:
+   wrmsr(MSR_GQ_SNOOP_MESF,0x1);
+   break;
+   case PMC_EV_UCP_EVENT_0CH_04H_S:
+   wrmsr(MSR_GQ_SNOOP_MESF,0x4);
+   break;
+   case PMC_EV_UCP_EVENT_0CH_08H_E:
+   wrmsr(MSR_GQ_SNOOP_MESF,0x2);
+   break;
+   case PMC_EV_UCP_EVENT_0CH_08H_F:
+   wrmsr(MSR_GQ_SNOOP_MESF,0x8);
+   break;  
+   case PMC_EV_UCP_EVENT_0CH_08H_M:
+   wrmsr(MSR_GQ_SNOOP_MESF,0x1);
+   break;
+   case PMC_EV_UCP_EVENT_0CH_08H_S:
+   wrmsr(MSR_GQ_SNOOP_MESF,0x4);
+   break;
+   default:
+   break;
+   }
+
wrmsr(UCP_EVSEL0 + ri, evsel);
 
do {

Modified: head/sys/dev/hwpmc/hwpmc_uncore.h
==
--- head/sys/dev/hwpmc/hwpmc_uncore.h   Wed Jan  4 07:25:10 2012
(r229468)
+++ head/sys/dev/hwpmc/hwpmc_uncore.h   Wed Jan  4 07:33:06 2012
(r229469)
@@ -87,11 +87,18 @@ struct pmc_md_ucp_op_pmcallocate {
 #defineUC_GLOBAL_CTRL  0x391
 #defineUC_GLOBAL_OVF_CTRL  0x393
 
+
 #defineUC_GLOBAL_STATUS_FLAG_CLRCHG(1ULL  63)
 #defineUC_GLOBAL_STATUS_FLAG_OVFPMI(1ULL  61)
 #defineUC_GLOBAL_CTRL_FLAG_FRZ (1ULL  63)
 #defineUC_GLOBAL_CTRL_FLAG_ENPMICORE0  (1ULL  48)
 
+/*
+ * Model specific registers.
+ */
+
+#define MSR_GQ_SNOOP_MESF  0x301
+
 struct pmc_md_ucf_pmc {
uint64_tpm_ucf_ctrl;
 };

Modified: head/sys/dev/hwpmc/pmc_events.h
==
--- head/sys/dev/hwpmc/pmc_events.h Wed Jan  4 07:25:10 2012
(r229468)
+++ head/sys/dev/hwpmc/pmc_events.h Wed Jan  4 07:33:06 2012
(r229469)
@@ -2388,8 +2388,14 @@ __PMC_EV(UCP, EVENT_0BH_10H) \
 __PMC_EV(UCP, EVENT_0BH_1FH)   \
 __PMC_EV(UCP, EVENT_0CH_01H)   \
 __PMC_EV(UCP, EVENT_0CH_02H)   \
-__PMC_EV(UCP, EVENT_0CH_04H)   \
-__PMC_EV(UCP, EVENT_0CH_08H)   \
+__PMC_EV(UCP, EVENT_0CH_04H_E) \
+__PMC_EV(UCP, EVENT_0CH_04H_F) \
+__PMC_EV(UCP, EVENT_0CH_04H_M) \
+__PMC_EV(UCP, EVENT_0CH_04H_S) \
+__PMC_EV(UCP, EVENT_0CH_08H_E) \
+__PMC_EV(UCP, EVENT_0CH_08H_F) \
+__PMC_EV(UCP, EVENT_0CH_08H_M) \
+__PMC_EV(UCP, EVENT_0CH_08H_S) \
 __PMC_EV(UCP, EVENT_20H_01H)   \
 __PMC_EV(UCP, EVENT_20H_02H)   \
 __PMC_EV(UCP, EVENT_20H_04H)   \
@@ -2789,8 +2795,14 @@ __PMC_EV_ALIAS(L3_LINES_OUT.F_STATE, U
 __PMC_EV_ALIAS(L3_LINES_OUT.ANY, UCP_EVENT_0BH_1FH)  \
 

svn commit: r229470 - in head: lib/libpmc sys/dev/hwpmc

2012-01-03 Thread Fabien Thomas
Author: fabient
Date: Wed Jan  4 07:58:36 2012
New Revision: 229470
URL: http://svn.freebsd.org/changeset/base/229470

Log:
  Update PMC events from October 2011 Intel documentation.
  
  Submitted by: Davide Italiano davide.itali...@gmail.com
  MFC after:3 days

Modified:
  head/lib/libpmc/pmc.corei7.3
  head/sys/dev/hwpmc/hwpmc_core.c
  head/sys/dev/hwpmc/pmc_events.h

Modified: head/lib/libpmc/pmc.corei7.3
==
--- head/lib/libpmc/pmc.corei7.3Wed Jan  4 07:33:06 2012
(r229469)
+++ head/lib/libpmc/pmc.corei7.3Wed Jan  4 07:58:36 2012
(r229470)
@@ -200,10 +200,6 @@ Number of cache load STLB hits
 .Pq Event 08H , Umask 20H
 Number of DTLB cache load misses where the low part of the linear to
 physical address translation was missed.
-.It Li DTLB_LOAD_MISSES.PDP_MISS
-.Pq Event 08H , Umask 40H
-Number of DTLB cache load misses where the high part of the linear to
-physical address translation was missed.
 .It Li DTLB_LOAD_MISSES.LARGE_WALK_COMPLETED
 .Pq Event 08H , Umask 80H
 Counts number of completed large page walks due to load miss in the STLB.
@@ -646,10 +642,6 @@ Counter 0, 1 only
 Counts all data reads and writes (speculated and retired) from cacheable
 memory, including locked operations.
 Counter 0, 1 only
-.It Li L1D_PEND_MISS.LOAD_BUFFERS_FULL
-.Pq Event 48H , Umask 02H
-Counts cycles of L1 data cache load fill buffers full.
-Counter 0, 1 only
 .It Li DTLB_MISSES.ANY
 .Pq Event 49H , Umask 01H
 Counts the number of misses in the STLB which causes a page walk.
@@ -660,6 +652,12 @@ Counts number of misses in the STLB whic
 .Pq Event 49H , Umask 10H
 Counts the number of DTLB first level misses that hit in the second level
 TLB. This event is only relevant if the core contains multiple DTLB levels.
+.It Li DTLB_MISSES.PDE_MISS
+.Pq Event 49H , Umask 20H
+Number of DTLB misses caused by low part of address, includes references to 2M 
pages because 2M pages do not use the PDE.
+.It Li DTLB_MISSES.LARGE_WALK_COMPLETED
+.Pq Event 49H , Umask 80H
+Counts number of misses in the STLB which resulted in a completed page walk 
for large pages.
 .It Li LOAD_HIT_PRE
 .Pq Event 4CH , Umask 01H
 Counts load operations sent to the L1 data cache while a previous SSE
@@ -1205,9 +1203,6 @@ The BPU clear leads to 2 cycle bubble in
 .Pq Event E8H , Umask 02H
 Counts late Branch Prediction Unit clears due to Most Recently Used
 conflicts. The PBU clear leads to a 3 cycle bubble in the Front End.
-.It Li BPU_CLEARS.ANY
-.Pq Event E8H , Umask 03H
-Counts all BPU clears.
 .It Li L2_TRANSACTIONS.LOAD
 .Pq Event F0H , Umask 01H
 Counts L2 load operations due to HW prefetch or demand loads.

Modified: head/sys/dev/hwpmc/hwpmc_core.c
==
--- head/sys/dev/hwpmc/hwpmc_core.c Wed Jan  4 07:33:06 2012
(r229469)
+++ head/sys/dev/hwpmc/hwpmc_core.c Wed Jan  4 07:58:36 2012
(r229470)
@@ -642,7 +642,7 @@ static struct iap_event_descr iap_events
 IAPDESCR(08H_09H, 0x08, 0x09, IAP_F_FM | IAP_F_CA),
 IAPDESCR(08H_10H, 0x08, 0x10, IAP_F_FM | IAP_F_I7 | IAP_F_WM),
 IAPDESCR(08H_20H, 0x08, 0x20, IAP_F_FM | IAP_F_I7 | IAP_F_WM),
-IAPDESCR(08H_40H, 0x08, 0x40, IAP_F_FM | IAP_F_I7),
+IAPDESCR(08H_40H, 0x08, 0x40, IAP_F_FM | IAP_F_I7O),
 IAPDESCR(08H_80H, 0x08, 0x80, IAP_F_FM | IAP_F_I7),
 
 IAPDESCR(09H_01H, 0x09, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7O),
@@ -845,7 +845,7 @@ static struct iap_event_descr iap_events
 IAPDESCR(47H_00H, 0x47, 0x00, IAP_F_FM | IAP_F_ALLCPUSCORE2),
 
 IAPDESCR(48H_00H, 0x48, 0x00, IAP_F_FM | IAP_F_ALLCPUSCORE2),
-IAPDESCR(48H_02H, 0x48, 0x02, IAP_F_FM | IAP_F_I7),
+IAPDESCR(48H_02H, 0x48, 0x02, IAP_F_FM | IAP_F_I7O),
 
 IAPDESCR(49H_00H, 0x49, 0x00, IAP_F_FM | IAP_F_CC),
 IAPDESCR(49H_01H, 0x49, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2 |
@@ -854,9 +854,9 @@ static struct iap_event_descr iap_events
 IAP_F_I7 | IAP_F_WM),
 IAPDESCR(49H_04H, 0x49, 0x04, IAP_F_FM | IAP_F_WM),
 IAPDESCR(49H_10H, 0x49, 0x10, IAP_F_FM | IAP_F_I7 | IAP_F_WM),
-IAPDESCR(49H_20H, 0x49, 0x20, IAP_F_FM | IAP_F_I7O),
+IAPDESCR(49H_20H, 0x49, 0x20, IAP_F_FM | IAP_F_I7),
 IAPDESCR(49H_40H, 0x49, 0x40, IAP_F_FM | IAP_F_I7O),
-IAPDESCR(49H_80H, 0x49, 0x80, IAP_F_FM | IAP_F_WM | IAP_F_I7O),
+IAPDESCR(49H_80H, 0x49, 0x80, IAP_F_FM | IAP_F_WM | IAP_F_I7),
 
 IAPDESCR(4BH_00H, 0x4B, 0x00, IAP_F_FM | IAP_F_ALLCPUSCORE2),
 IAPDESCR(4BH_01H, 0x4B, 0x01, IAP_F_FM | IAP_F_ALLCPUSCORE2 | IAP_F_I7O),
@@ -1306,7 +1306,7 @@ static struct iap_event_descr iap_events
 
 IAPDESCR(E8H_01H, 0xE8, 0x01, IAP_F_FM | IAP_F_I7 | IAP_F_WM),
 IAPDESCR(E8H_02H, 0xE8, 0x02, IAP_F_FM | IAP_F_I7 | IAP_F_WM),
-IAPDESCR(E8H_03H, 0xE8, 0x03, IAP_F_FM | IAP_F_I7),
+IAPDESCR(E8H_03H, 0xE8, 0x03, IAP_F_FM | IAP_F_I7O),
 
 IAPDESCR(ECH_01H, 0xEC, 0x01,