From owner-svn-src-stable-9@FreeBSD.ORG Mon Apr 13 22:22:35 2015 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0AC212FE; Mon, 13 Apr 2015 22:22:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A8C011D3; Mon, 13 Apr 2015 22:22:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t3DMMYqR054874; Mon, 13 Apr 2015 22:22:34 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t3DMMYLH054873; Mon, 13 Apr 2015 22:22:34 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201504132222.t3DMMYLH054873@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Mon, 13 Apr 2015 22:22:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r281505 - in stable: 10/usr.sbin/acpi/acpidump 8/usr.sbin/acpi/acpidump 9/usr.sbin/acpi/acpidump X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Apr 2015 22:22:35 -0000 Author: jkim Date: Mon Apr 13 22:22:32 2015 New Revision: 281505 URL: https://svnweb.freebsd.org/changeset/base/281505 Log: MFC: r281331 Do not crash when RSDT/XSDT contains an empty entry. Modified: stable/9/usr.sbin/acpi/acpidump/acpi.c Directory Properties: stable/9/usr.sbin/acpi/acpidump/ (props changed) Changes in other areas also in this revision: Modified: stable/10/usr.sbin/acpi/acpidump/acpi.c stable/8/usr.sbin/acpi/acpidump/acpi.c Directory Properties: stable/10/ (props changed) stable/8/usr.sbin/acpi/acpidump/ (props changed) Modified: stable/9/usr.sbin/acpi/acpidump/acpi.c ============================================================================== --- stable/9/usr.sbin/acpi/acpidump/acpi.c Mon Apr 13 21:33:49 2015 (r281504) +++ stable/9/usr.sbin/acpi/acpidump/acpi.c Mon Apr 13 22:22:32 2015 (r281505) @@ -818,17 +818,10 @@ acpi_print_rsdt(ACPI_TABLE_HEADER *rsdp) for (i = 0; i < entries; i++) { if (i > 0) printf(", "); - switch (addr_size) { - case 4: + if (addr_size == 4) addr = le32toh(rsdt->TableOffsetEntry[i]); - break; - case 8: + else addr = le64toh(xsdt->TableOffsetEntry[i]); - break; - default: - addr = 0; - } - assert(addr != 0); printf("0x%08lx", addr); } printf(" }\n"); @@ -1085,17 +1078,12 @@ acpi_handle_rsdt(ACPI_TABLE_HEADER *rsdp xsdt = (ACPI_TABLE_XSDT *)rsdp; entries = (rsdp->Length - sizeof(ACPI_TABLE_HEADER)) / addr_size; for (i = 0; i < entries; i++) { - switch (addr_size) { - case 4: + if (addr_size == 4) addr = le32toh(rsdt->TableOffsetEntry[i]); - break; - case 8: + else addr = le64toh(xsdt->TableOffsetEntry[i]); - break; - default: - assert((addr = 0)); - } - + if (addr == 0) + continue; sdp = (ACPI_TABLE_HEADER *)acpi_map_sdt(addr); if (acpi_checksum(sdp, sdp->Length)) { warnx("RSDT entry %d (sig %.4s) is corrupt", i, @@ -1288,16 +1276,12 @@ sdt_from_rsdt(ACPI_TABLE_HEADER *rsdp, c xsdt = (ACPI_TABLE_XSDT *)rsdp; entries = (rsdp->Length - sizeof(ACPI_TABLE_HEADER)) / addr_size; for (i = 0; i < entries; i++) { - switch (addr_size) { - case 4: + if (addr_size == 4) addr = le32toh(rsdt->TableOffsetEntry[i]); - break; - case 8: + else addr = le64toh(xsdt->TableOffsetEntry[i]); - break; - default: - assert((addr = 0)); - } + if (addr == 0) + continue; sdt = (ACPI_TABLE_HEADER *)acpi_map_sdt(addr); if (last != NULL) { if (sdt == last) From owner-svn-src-stable-9@FreeBSD.ORG Tue Apr 14 09:59:00 2015 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 90F8F645; Tue, 14 Apr 2015 09:59:00 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6190B644; Tue, 14 Apr 2015 09:59:00 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t3E9x0IM082140; Tue, 14 Apr 2015 09:59:00 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t3E9wxiF082130; Tue, 14 Apr 2015 09:58:59 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201504140958.t3E9wxiF082130@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 14 Apr 2015 09:58:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r281521 - in stable/9: sys/rpc usr.sbin/nfsd X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Apr 2015 09:59:00 -0000 Author: mav Date: Tue Apr 14 09:58:58 2015 New Revision: 281521 URL: https://svnweb.freebsd.org/changeset/base/281521 Log: MFC r281199: Remove hard limits on number of accepting NFS connections. Limits of 5 connections set long ago creates problems for SPEC benchmark. Make the NFS follow system-wide maximum. Modified: stable/9/sys/rpc/svc_generic.c stable/9/sys/rpc/svc_vc.c stable/9/usr.sbin/nfsd/nfsd.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) stable/9/usr.sbin/ (props changed) stable/9/usr.sbin/nfsd/ (props changed) Modified: stable/9/sys/rpc/svc_generic.c ============================================================================== --- stable/9/sys/rpc/svc_generic.c Tue Apr 14 09:58:10 2015 (r281520) +++ stable/9/sys/rpc/svc_generic.c Tue Apr 14 09:58:58 2015 (r281521) @@ -168,7 +168,7 @@ svc_tp_create( taddr = uaddr2taddr(nconf, uaddr); bind.addr = *taddr; free(taddr, M_RPC); - bind.qlen = SOMAXCONN; + bind.qlen = -1; xprt = svc_tli_create(pool, NULL, nconf, &bind, 0, 0); free(bind.addr.buf, M_RPC); } else { @@ -256,7 +256,7 @@ svc_tli_create( goto freedata; } } - solisten(so, SOMAXCONN, curthread); + solisten(so, -1, curthread); } else { if (bindresvport(so, (struct sockaddr *)bindaddr->addr.buf)) { Modified: stable/9/sys/rpc/svc_vc.c ============================================================================== --- stable/9/sys/rpc/svc_vc.c Tue Apr 14 09:58:10 2015 (r281520) +++ stable/9/sys/rpc/svc_vc.c Tue Apr 14 09:58:58 2015 (r281521) @@ -178,7 +178,7 @@ svc_vc_create(SVCPOOL *pool, struct sock xprt_register(xprt); - solisten(so, SOMAXCONN, curthread); + solisten(so, -1, curthread); SOCKBUF_LOCK(&so->so_rcv); xprt->xp_upcallset = 1; Modified: stable/9/usr.sbin/nfsd/nfsd.c ============================================================================== --- stable/9/usr.sbin/nfsd/nfsd.c Tue Apr 14 09:58:10 2015 (r281520) +++ stable/9/usr.sbin/nfsd/nfsd.c Tue Apr 14 09:58:58 2015 (r281521) @@ -605,7 +605,7 @@ main(int argc, char **argv) bindhost[i]); nfsd_exit(1); } - if (listen(tcpsock, 5) < 0) { + if (listen(tcpsock, -1) < 0) { syslog(LOG_ERR, "listen failed"); nfsd_exit(1); } @@ -680,7 +680,7 @@ main(int argc, char **argv) bindhost[i]); nfsd_exit(1); } - if (listen(tcp6sock, 5) < 0) { + if (listen(tcp6sock, -1) < 0) { syslog(LOG_ERR, "listen failed"); nfsd_exit(1); } From owner-svn-src-stable-9@FreeBSD.ORG Tue Apr 14 18:46:43 2015 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 956D222D; Tue, 14 Apr 2015 18:46:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 80501D80; Tue, 14 Apr 2015 18:46:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t3EIkhhT034329; Tue, 14 Apr 2015 18:46:43 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t3EIkhiO034328; Tue, 14 Apr 2015 18:46:43 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201504141846.t3EIkhiO034328@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 14 Apr 2015 18:46:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r281534 - stable/9/sbin/newfs_msdos X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Apr 2015 18:46:43 -0000 Author: pfg Date: Tue Apr 14 18:46:42 2015 New Revision: 281534 URL: https://svnweb.freebsd.org/changeset/base/281534 Log: MFC r281320: Update documented OEM string in newfs_msdos(8). This was updated in r203868 to better match the naming scheme in other OSs that use FAT. Modified: stable/9/sbin/newfs_msdos/newfs_msdos.8 Directory Properties: stable/9/sbin/newfs_msdos/ (props changed) Modified: stable/9/sbin/newfs_msdos/newfs_msdos.8 ============================================================================== --- stable/9/sbin/newfs_msdos/newfs_msdos.8 Tue Apr 14 18:45:30 2015 (r281533) +++ stable/9/sbin/newfs_msdos/newfs_msdos.8 Tue Apr 14 18:46:42 2015 (r281534) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 1, 2013 +.Dd April 9, 2015 .Dt NEWFS_MSDOS 8 .Os .Sh NAME @@ -112,7 +112,7 @@ only those characters permitted in regul .It Fl O Ar OEM OEM string (up to 8 characters). The default is -.Qq Li "BSD 4.4" . +.Qq Li "BSD4.4 " . .It Fl S Ar sector-size Number of bytes per sector. Acceptable values are powers of 2 From owner-svn-src-stable-9@FreeBSD.ORG Tue Apr 14 20:05:31 2015 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8B68CFC2; Tue, 14 Apr 2015 20:05:31 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7636C95B; Tue, 14 Apr 2015 20:05:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t3EK5VN8073993; Tue, 14 Apr 2015 20:05:31 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t3EK5TYR073983; Tue, 14 Apr 2015 20:05:29 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201504142005.t3EK5TYR073983@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 14 Apr 2015 20:05:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r281538 - in stable: 10/sys/sys 9/sys/sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Apr 2015 20:05:31 -0000 Author: jhb Date: Tue Apr 14 20:05:26 2015 New Revision: 281538 URL: https://svnweb.freebsd.org/changeset/base/281538 Log: MFC 278474,278476,280279: Expand the bitcount*() API and use it to implement CPU_COUNT for cpusets. 278474: Use __builtin_popcnt() to implement a BIT_COUNT() operation for bitsets and use this to implement CPU_COUNT() to count the number of CPUs in a cpuset. 278476: Use __builtin_popcountl() instead of __builtin_popcount(). 280279: Expand the bitcount* API to support 64-bit integers, plain ints and longs and create a "hidden" API that can be used in other system headers without adding namespace pollution. - If the POPCNT instruction is enabled at compile time, use __builtin_popcount*() to implement __bitcount*(), otherwise fall back to software implementations. - Use the existing bitcount16() and bitcount32() from to implement the non-POPCNT __bitcount16() and __bitcount32() in . - For the non-POPCNT __bitcount64(), use a similar SWAR method on 64-bit systems. For 32-bit systems, use two __bitcount32() operations on the two halves. - Use __bitcount32() to provide a __bitcount() that operates on plain ints. - Use either __bitcount32() or __bitcount64() to provide a __bitcountl() that operates on longs. - Add public bitcount*() wrappers for __bitcount*() for use in the kernel in . - Use __bitcountl() instead of __builtin_popcountl() in BIT_COUNT(). Modified: stable/9/sys/sys/bitset.h stable/9/sys/sys/cpuset.h stable/9/sys/sys/libkern.h stable/9/sys/sys/systm.h stable/9/sys/sys/types.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/sys/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/sys/bitset.h stable/10/sys/sys/cpuset.h stable/10/sys/sys/libkern.h stable/10/sys/sys/systm.h stable/10/sys/sys/types.h Directory Properties: stable/10/ (props changed) Modified: stable/9/sys/sys/bitset.h ============================================================================== --- stable/9/sys/sys/bitset.h Tue Apr 14 19:18:34 2015 (r281537) +++ stable/9/sys/sys/bitset.h Tue Apr 14 20:05:26 2015 (r281538) @@ -165,4 +165,14 @@ __bit; \ }) +#define BIT_COUNT(_s, p) __extension__ ({ \ + __size_t __i; \ + int __count; \ + \ + __count = 0; \ + for (__i = 0; __i < __bitset_words((_s)); __i++) \ + __count += __bitcountl((p)->__bits[__i]); \ + __count; \ +}) + #endif /* !_SYS_BITSET_H_ */ Modified: stable/9/sys/sys/cpuset.h ============================================================================== --- stable/9/sys/sys/cpuset.h Tue Apr 14 19:18:34 2015 (r281537) +++ stable/9/sys/sys/cpuset.h Tue Apr 14 20:05:26 2015 (r281538) @@ -58,6 +58,7 @@ #define CPU_OR_ATOMIC(d, s) BIT_OR_ATOMIC(CPU_SETSIZE, d, s) #define CPU_COPY_STORE_REL(f, t) BIT_COPY_STORE_REL(CPU_SETSIZE, f, t) #define CPU_FFS(p) BIT_FFS(CPU_SETSIZE, p) +#define CPU_COUNT(p) BIT_COUNT(CPU_SETSIZE, p) /* * Valid cpulevel_t values. Modified: stable/9/sys/sys/libkern.h ============================================================================== --- stable/9/sys/sys/libkern.h Tue Apr 14 19:18:34 2015 (r281537) +++ stable/9/sys/sys/libkern.h Tue Apr 14 20:05:26 2015 (r281538) @@ -94,6 +94,12 @@ int fls(int); #ifndef HAVE_INLINE_FLSL int flsl(long); #endif +#define bitcount64(x) __bitcount64((uint64_t)(x)) +#define bitcount32(x) __bitcount32((uint32_t)(x)) +#define bitcount16(x) __bitcount16((uint16_t)(x)) +#define bitcountl(x) __bitcountl((u_long)(x)) +#define bitcount(x) __bitcount((u_int)(x)) + int fnmatch(const char *, const char *, int); int locc(int, char *, u_int); void *memchr(const void *s, int c, size_t n); Modified: stable/9/sys/sys/systm.h ============================================================================== --- stable/9/sys/sys/systm.h Tue Apr 14 19:18:34 2015 (r281537) +++ stable/9/sys/sys/systm.h Tue Apr 14 20:05:26 2015 (r281538) @@ -392,31 +392,4 @@ int alloc_unr_specific(struct unrhdr *uh int alloc_unrl(struct unrhdr *uh); void free_unr(struct unrhdr *uh, u_int item); -/* - * Population count algorithm using SWAR approach - * - "SIMD Within A Register". - */ -static __inline uint32_t -bitcount32(uint32_t x) -{ - - x = (x & 0x55555555) + ((x & 0xaaaaaaaa) >> 1); - x = (x & 0x33333333) + ((x & 0xcccccccc) >> 2); - x = (x + (x >> 4)) & 0x0f0f0f0f; - x = (x + (x >> 8)); - x = (x + (x >> 16)) & 0x000000ff; - return (x); -} - -static __inline uint16_t -bitcount16(uint32_t x) -{ - - x = (x & 0x5555) + ((x & 0xaaaa) >> 1); - x = (x & 0x3333) + ((x & 0xcccc) >> 2); - x = (x + (x >> 4)) & 0x0f0f; - x = (x + (x >> 8)) & 0x00ff; - return (x); -} - #endif /* !_SYS_SYSTM_H_ */ Modified: stable/9/sys/sys/types.h ============================================================================== --- stable/9/sys/sys/types.h Tue Apr 14 19:18:34 2015 (r281537) +++ stable/9/sys/sys/types.h Tue Apr 14 20:05:26 2015 (r281538) @@ -283,6 +283,68 @@ typedef _Bool bool; #include +#ifdef __POPCNT__ +#define __bitcount64(x) __builtin_popcountll((__uint64_t)(x)) +#define __bitcount32(x) __builtin_popcount((__uint32_t)(x)) +#define __bitcount16(x) __builtin_popcount((__uint16_t)(x)) +#define __bitcountl(x) __builtin_popcountl((unsigned long)(x)) +#define __bitcount(x) __builtin_popcount((unsigned int)(x)) +#else +/* + * Population count algorithm using SWAR approach + * - "SIMD Within A Register". + */ +static __inline __uint16_t +__bitcount16(__uint16_t _x) +{ + + _x = (_x & 0x5555) + ((_x & 0xaaaa) >> 1); + _x = (_x & 0x3333) + ((_x & 0xcccc) >> 2); + _x = (_x + (_x >> 4)) & 0x0f0f; + _x = (_x + (_x >> 8)) & 0x00ff; + return (_x); +} + +static __inline __uint32_t +__bitcount32(__uint32_t _x) +{ + + _x = (_x & 0x55555555) + ((_x & 0xaaaaaaaa) >> 1); + _x = (_x & 0x33333333) + ((_x & 0xcccccccc) >> 2); + _x = (_x + (_x >> 4)) & 0x0f0f0f0f; + _x = (_x + (_x >> 8)); + _x = (_x + (_x >> 16)) & 0x000000ff; + return (_x); +} + +#ifdef __LP64__ +static __inline __uint64_t +__bitcount64(__uint64_t _x) +{ + + _x = (_x & 0x5555555555555555) + ((_x & 0xaaaaaaaaaaaaaaaa) >> 1); + _x = (_x & 0x3333333333333333) + ((_x & 0xcccccccccccccccc) >> 2); + _x = (_x + (_x >> 4)) & 0x0f0f0f0f0f0f0f0f; + _x = (_x + (_x >> 8)); + _x = (_x + (_x >> 16)); + _x = (_x + (_x >> 32)) & 0x000000ff; + return (_x); +} + +#define __bitcountl(x) __bitcount64((unsigned long)(x)) +#else +static __inline __uint64_t +__bitcount64(__uint64_t _x) +{ + + return (__bitcount32(_x >> 32) + __bitcount32(_x)); +} + +#define __bitcountl(x) __bitcount32((unsigned long)(x)) +#endif +#define __bitcount(x) __bitcount32((unsigned int)(x)) +#endif + /* * minor() gives a cookie instead of an index since we don't want to * change the meanings of bits 0-15 or waste time and space shifting From owner-svn-src-stable-9@FreeBSD.ORG Wed Apr 15 22:15:25 2015 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 009433AF; Wed, 15 Apr 2015 22:15:24 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C6FEACCB; Wed, 15 Apr 2015 22:15:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t3FMFO6R024658; Wed, 15 Apr 2015 22:15:24 GMT (envelope-from rakuco@FreeBSD.org) Received: (from rakuco@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t3FMFOYu024657; Wed, 15 Apr 2015 22:15:24 GMT (envelope-from rakuco@FreeBSD.org) Message-Id: <201504152215.t3FMFOYu024657@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rakuco set sender to rakuco@FreeBSD.org using -f From: Raphael Kubo da Costa Date: Wed, 15 Apr 2015 22:15:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r281568 - stable/9/usr.sbin/bluetooth/bthidd X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Apr 2015 22:15:25 -0000 Author: rakuco (ports committer) Date: Wed Apr 15 22:15:23 2015 New Revision: 281568 URL: https://svnweb.freebsd.org/changeset/base/281568 Log: MFC r281116. bthidd: Consider usage ranges when dealing with array inputs. So far, we were always using HID_USAGE() to determine the Usage ID of a certain HID report input item. This does not work as intended if a field is an array and the allowed usages are specified with a usage range, as HID_USAGE() will return 0. We need to use the field value as an index in the usage range list in this case instead. This makes the volume keys in a Microsoft Bluetooth Mobile Keyboard 5000 be properly recognized. The relevant part of the HID report looks like this: 0xA1, 0x01, // Collection (Application) 0x85, 0x07, // Report ID (7) 0x05, 0x0C, // Usage Page (Consumer) 0x19, 0x00, // Usage Minimum (Unassigned) 0x2A, 0xFF, 0x03, // Usage Maximum (0x03FF) 0x95, 0x01, // Report Count (1) 0x75, 0x10, // Report Size (16) 0x15, 0x00, // Logical Minimum (0) 0x27, 0xFF, 0x03, 0x00, 0x00, // Logical Maximum (1023) 0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred // State,No Null Position) When a key such as "volume down" is pressed, the following data is transferred through Interrupt In: 0x07 0xEA 0x00 Differential Revision: https://reviews.freebsd.org/D2229 Reviewed by: emax Approved by: emax Modified: stable/9/usr.sbin/bluetooth/bthidd/hid.c Directory Properties: stable/9/usr.sbin/bluetooth/bthidd/ (props changed) Modified: stable/9/usr.sbin/bluetooth/bthidd/hid.c ============================================================================== --- stable/9/usr.sbin/bluetooth/bthidd/hid.c Wed Apr 15 22:07:51 2015 (r281567) +++ stable/9/usr.sbin/bluetooth/bthidd/hid.c Wed Apr 15 22:15:23 2015 (r281568) @@ -165,9 +165,21 @@ hid_interrupt(bthid_session_p s, uint8_t continue; page = HID_PAGE(h.usage); - usage = HID_USAGE(h.usage); val = hid_get_data(data, &h); + /* + * When the input field is an array and the usage is specified + * with a range instead of an ID, we have to derive the actual + * usage by using the item value as an index in the usage range + * list. + */ + if ((h.flags & HIO_VARIABLE)) { + usage = HID_USAGE(h.usage); + } else { + const uint32_t usage_offset = val - h.logical_minimum; + usage = HID_USAGE(h.usage_minimum + usage_offset); + } + switch (page) { case HUP_GENERIC_DESKTOP: switch (usage) { From owner-svn-src-stable-9@FreeBSD.ORG Wed Apr 15 22:17:17 2015 Return-Path: Delivered-To: svn-src-stable-9@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 92B18506; Wed, 15 Apr 2015 22:17:17 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D4EDCEA; Wed, 15 Apr 2015 22:17:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t3FMHHDs025001; Wed, 15 Apr 2015 22:17:17 GMT (envelope-from rakuco@FreeBSD.org) Received: (from rakuco@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t3FMHHdk025000; Wed, 15 Apr 2015 22:17:17 GMT (envelope-from rakuco@FreeBSD.org) Message-Id: <201504152217.t3FMHHdk025000@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rakuco set sender to rakuco@FreeBSD.org using -f From: Raphael Kubo da Costa Date: Wed, 15 Apr 2015 22:17:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r281569 - stable/9/usr.sbin/bluetooth/bthidd X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Apr 2015 22:17:17 -0000 Author: rakuco (ports committer) Date: Wed Apr 15 22:17:16 2015 New Revision: 281569 URL: https://svnweb.freebsd.org/changeset/base/281569 Log: MFC r281146. bthidd: Remove unused macros from hid.c. ASIZE() was never used, and min() stopped being used in r207812. Differential Revision: https://reviews.freebsd.org/D2230 Reviewed by: emax Approved by: emax Modified: stable/9/usr.sbin/bluetooth/bthidd/hid.c Directory Properties: stable/9/usr.sbin/bluetooth/bthidd/ (props changed) Modified: stable/9/usr.sbin/bluetooth/bthidd/hid.c ============================================================================== --- stable/9/usr.sbin/bluetooth/bthidd/hid.c Wed Apr 15 22:15:23 2015 (r281568) +++ stable/9/usr.sbin/bluetooth/bthidd/hid.c Wed Apr 15 22:17:16 2015 (r281569) @@ -48,12 +48,6 @@ #include "bthidd.h" #include "kbd.h" -#undef min -#define min(x, y) (((x) < (y))? (x) : (y)) - -#undef ASIZE -#define ASIZE(a) (sizeof(a)/sizeof(a[0])) - /* * Process data from control channel */