svn commit: r305455 - head/sys/dev/hyperv/netvsc

2016-09-05 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Sep  6 04:37:53 2016
New Revision: 305455
URL: https://svnweb.freebsd.org/changeset/base/305455

Log:
  hyperv/hn: Avoid bit fields for LSOv2 setup.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7786

Modified:
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  head/sys/dev/hyperv/netvsc/ndis.h

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Tue Sep  6 03:31:31 
2016(r305454)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Tue Sep  6 04:37:53 
2016(r305455)
@@ -910,6 +910,7 @@ hn_encap(struct hn_tx_ring *txr, struct 
}
 
if (m_head->m_pkthdr.csum_flags & CSUM_TSO) {
+#if defined(INET6) || defined(INET)
rndis_tcp_tso_info *tso_info;   
struct ether_vlan_header *eh;
int ether_len;
@@ -929,8 +930,6 @@ hn_encap(struct hn_tx_ring *txr, struct 
 
tso_info = (rndis_tcp_tso_info *)((uint8_t *)rppi +
rppi->per_packet_info_offset);
-   tso_info->lso_v2_xmit.type =
-   RNDIS_TCP_LARGE_SEND_OFFLOAD_V2_TYPE;
 
 #ifdef INET
if (m_head->m_pkthdr.csum_flags & CSUM_IP_TSO) {
@@ -940,13 +939,12 @@ hn_encap(struct hn_tx_ring *txr, struct 
struct tcphdr *th =
(struct tcphdr *)((caddr_t)ip + iph_len);
 
-   tso_info->lso_v2_xmit.ip_version =
-   RNDIS_TCP_LARGE_SEND_OFFLOAD_IPV4;
ip->ip_len = 0;
ip->ip_sum = 0;
-
th->th_sum = in_pseudo(ip->ip_src.s_addr,
ip->ip_dst.s_addr, htons(IPPROTO_TCP));
+   tso_info->value = NDIS_LSO2_INFO_MAKEIPV4(0,
+   m_head->m_pkthdr.tso_segsz);
}
 #endif
 #if defined(INET6) && defined(INET)
@@ -958,14 +956,13 @@ hn_encap(struct hn_tx_ring *txr, struct 
(m_head->m_data + ether_len);
struct tcphdr *th = (struct tcphdr *)(ip6 + 1);
 
-   tso_info->lso_v2_xmit.ip_version =
-   RNDIS_TCP_LARGE_SEND_OFFLOAD_IPV6;
ip6->ip6_plen = 0;
th->th_sum = in6_cksum_pseudo(ip6, 0, IPPROTO_TCP, 0);
+   tso_info->value = NDIS_LSO2_INFO_MAKEIPV6(0,
+   m_head->m_pkthdr.tso_segsz);
}
 #endif
-   tso_info->lso_v2_xmit.tcp_header_offset = 0;
-   tso_info->lso_v2_xmit.mss = m_head->m_pkthdr.tso_segsz;
+#endif /* INET6 || INET */
} else if (m_head->m_pkthdr.csum_flags & txr->hn_csum_assist) {
rndis_tcp_ip_csum_info *csum_info;
 

Modified: head/sys/dev/hyperv/netvsc/ndis.h
==
--- head/sys/dev/hyperv/netvsc/ndis.h   Tue Sep  6 03:31:31 2016
(r305454)
+++ head/sys/dev/hyperv/netvsc/ndis.h   Tue Sep  6 04:37:53 2016
(r305455)
@@ -231,4 +231,21 @@ struct ndis_rssprm_toeplitz {
 #defineNDIS_RXCSUM_INFO_TCPCS_INVAL0x0080
 #defineNDIS_RXCSUM_INFO_IPCS_INVAL 0x0100
 
+/* LSOv2 */
+#defineNDIS_LSO2_INFO_MSS_MASK 0x000f
+#defineNDIS_LSO2_INFO_THOFF_MASK   0x3ff0
+#defineNDIS_LSO2_INFO_ISLSO2   0x4000
+#defineNDIS_LSO2_INFO_ISIPV6   0x8000
+
+#defineNDIS_LSO2_INFO_MAKE(thoff, mss) \
+   uint32_t)(mss)) & NDIS_LSO2_INFO_MSS_MASK) |\
+uint32_t)(thoff)) & 0x3ff) << 20) |\
+NDIS_LSO2_INFO_ISLSO2)
+
+#defineNDIS_LSO2_INFO_MAKEIPV4(thoff, mss) \
+   NDIS_LSO2_INFO_MAKE((thoff), (mss))
+
+#defineNDIS_LSO2_INFO_MAKEIPV6(thoff, mss) \
+   (NDIS_LSO2_INFO_MAKE((thoff), (mss)) | NDIS_LSO2_INFO_ISIPV6)
+
 #endif /* !_NET_NDIS_H_ */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305454 - head/sys/dev/hyperv/netvsc

2016-09-05 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Sep  6 03:31:31 2016
New Revision: 305454
URL: https://svnweb.freebsd.org/changeset/base/305454

Log:
  hyperv/hn: Fix VLAN tag setup for outgoing VLAN packets.
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7785

Modified:
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
  head/sys/dev/hyperv/netvsc/ndis.h

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Tue Sep  6 03:20:06 
2016(r305453)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Tue Sep  6 03:31:31 
2016(r305454)
@@ -903,8 +903,10 @@ hn_encap(struct hn_tx_ring *txr, struct 
 
rppi_vlan_info = (ndis_8021q_info *)((uint8_t *)rppi +
rppi->per_packet_info_offset);
-   rppi_vlan_info->u1.s1.vlan_id =
-   m_head->m_pkthdr.ether_vtag & 0xfff;
+   rppi_vlan_info->u1.value = NDIS_VLAN_INFO_MAKE(
+   EVL_VLANOFTAG(m_head->m_pkthdr.ether_vtag),
+   EVL_PRIOFTAG(m_head->m_pkthdr.ether_vtag),
+   EVL_CFIOFTAG(m_head->m_pkthdr.ether_vtag));
}
 
if (m_head->m_pkthdr.csum_flags & CSUM_TSO) {

Modified: head/sys/dev/hyperv/netvsc/ndis.h
==
--- head/sys/dev/hyperv/netvsc/ndis.h   Tue Sep  6 03:20:06 2016
(r305453)
+++ head/sys/dev/hyperv/netvsc/ndis.h   Tue Sep  6 03:31:31 2016
(r305454)
@@ -213,7 +213,7 @@ struct ndis_rssprm_toeplitz {
 #defineNDIS_VLAN_INFO_CFI_MASK 0x0008
 #defineNDIS_VLAN_INFO_ID_MASK  0xfff0
 #defineNDIS_VLAN_INFO_MAKE(id, pri, cfi)   \
-(((pri) & NVIS_VLAN_INFO_PRI_MASK) |   \
+(((pri) & NDIS_VLAN_INFO_PRI_MASK) |   \
 (((cfi) & 0x1) << 3) | (((id) & 0xfff) << 4))
 #defineNDIS_VLAN_INFO_ID(inf)  (((inf) & 
NDIS_VLAN_INFO_ID_MASK) >> 4)
 #defineNDIS_VLAN_INFO_CFI(inf) (((inf) & 
NDIS_VLAN_INFO_CFI_MASK) >> 3)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305453 - in head/sys: dev/hyperv/netvsc net

2016-09-05 Thread Sepherosa Ziehau
Author: sephe
Date: Tue Sep  6 03:20:06 2016
New Revision: 305453
URL: https://svnweb.freebsd.org/changeset/base/305453

Log:
  hyperv/hn: Stringent RNDIS packet message length/offset check.
  
  While I'm here, use definition in net/rndis.h
  
  MFC after:1 week
  Sponsored by: Microsoft
  Differential Revision:https://reviews.freebsd.org/D7782

Modified:
  head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
  head/sys/net/rndis.h

Modified: head/sys/dev/hyperv/netvsc/hv_rndis_filter.c
==
--- head/sys/dev/hyperv/netvsc/hv_rndis_filter.cTue Sep  6 01:10:51 
2016(r305452)
+++ head/sys/dev/hyperv/netvsc/hv_rndis_filter.cTue Sep  6 03:20:06 
2016(r305453)
@@ -159,39 +159,22 @@ hv_rf_receive_indicate_status(struct hn_
 }
 
 static int
-hv_rf_find_recvinfo(const rndis_packet *rpkt, struct hn_recvinfo *info)
+hn_rndis_rxinfo(const void *info_data, int info_dlen, struct hn_recvinfo *info)
 {
-   const struct rndis_pktinfo *pi;
-   uint32_t mask = 0, len;
+   const struct rndis_pktinfo *pi = info_data;
+   uint32_t mask = 0;
 
-   info->vlan_info = HN_NDIS_VLAN_INFO_INVALID;
-   info->csum_info = HN_NDIS_RXCSUM_INFO_INVALID;
-   info->hash_info = HN_NDIS_HASH_INFO_INVALID;
-
-   if (rpkt->per_pkt_info_offset == 0)
-   return (0);
-   if (__predict_false(rpkt->per_pkt_info_offset &
-   (RNDIS_PKTINFO_ALIGN - 1)))
-   return (EINVAL);
-   if (__predict_false(rpkt->per_pkt_info_offset <
-   RNDIS_PACKET_MSG_OFFSET_MIN))
-   return (EINVAL);
-
-   pi = (const struct rndis_pktinfo *)
-   ((const uint8_t *)rpkt + rpkt->per_pkt_info_offset);
-   len = rpkt->per_pkt_info_length;
-
-   while (len != 0) {
+   while (info_dlen != 0) {
const void *data;
uint32_t dlen;
 
-   if (__predict_false(len < sizeof(*pi)))
+   if (__predict_false(info_dlen < sizeof(*pi)))
return (EINVAL);
-   if (__predict_false(len < pi->rm_size))
+   if (__predict_false(info_dlen < pi->rm_size))
return (EINVAL);
-   len -= pi->rm_size;
+   info_dlen -= pi->rm_size;
 
-   if (__predict_false(pi->rm_size & (RNDIS_PKTINFO_ALIGN - 1)))
+   if (__predict_false(pi->rm_size & RNDIS_PKTINFO_SIZE_ALIGNMASK))
return (EINVAL);
if (__predict_false(pi->rm_size < pi->rm_pktinfooffset))
return (EINVAL);
@@ -249,43 +232,183 @@ next:
return (0);
 }
 
+static __inline bool
+hn_rndis_check_overlap(int off, int len, int check_off, int check_len)
+{
+
+   if (off < check_off) {
+   if (__predict_true(off + len <= check_off))
+   return (false);
+   } else if (off > check_off) {
+   if (__predict_true(check_off + check_len <= off))
+   return (false);
+   }
+   return (true);
+}
+
 /*
  * RNDIS filter receive data
  */
 static void
 hv_rf_receive_data(struct hn_rx_ring *rxr, const void *data, int dlen)
 {
-   const rndis_msg *message = data;
-   const rndis_packet *rndis_pkt;
-   uint32_t data_offset;
+   const struct rndis_packet_msg *pkt;
struct hn_recvinfo info;
-
-   rndis_pkt = >msg.packet;
+   int data_off, pktinfo_off, data_len, pktinfo_len;
 
/*
-* Fixme:  Handle multiple rndis pkt msgs that may be enclosed in this
-* netvsc packet (ie tot_data_buf_len != message_length)
+* Check length.
 */
+   if (__predict_false(dlen < sizeof(*pkt))) {
+   if_printf(rxr->hn_ifp, "invalid RNDIS packet msg\n");
+   return;
+   }
+   pkt = data;
 
-   /* Remove rndis header, then pass data packet up the stack */
-   data_offset = RNDIS_HEADER_SIZE + rndis_pkt->data_offset;
+   if (__predict_false(dlen < pkt->rm_len)) {
+   if_printf(rxr->hn_ifp, "truncated RNDIS packet msg, "
+   "dlen %d, msglen %u\n", dlen, pkt->rm_len);
+   return;
+   }
+   if (__predict_false(pkt->rm_len <
+   pkt->rm_datalen + pkt->rm_oobdatalen + pkt->rm_pktinfolen)) {
+   if_printf(rxr->hn_ifp, "invalid RNDIS packet msglen, "
+   "msglen %u, data %u, oob %u, pktinfo %u\n",
+   pkt->rm_len, pkt->rm_datalen, pkt->rm_oobdatalen,
+   pkt->rm_pktinfolen);
+   return;
+   }
+   if (__predict_false(pkt->rm_datalen == 0)) {
+   if_printf(rxr->hn_ifp, "invalid RNDIS packet msg, no data\n");
+   return;
+   }
 
-   dlen -= data_offset;
-   if (dlen < rndis_pkt->data_length) {
-   if_printf(rxr->hn_ifp,
-   "total length %u is less than data length %u\n",

Re: svn commit: r305331 - in head/sys/cddl/contrib/opensolaris/uts/common: fs/zfs fs/zfs/sys sys/fs

2016-09-05 Thread Cy Schubert
In message , Andriy Gapon 
wri
tes:
> On 05/09/2016 23:47, Andriy Gapon wrote:
> > Alexander,
> > 
> > I belive that this commit accidentally breaks the following scenario:
> > zpool create tank /dev/xxx
> > zpool destroy tank
> > zpool create tank /dev/xxx
> > 
> > It seems that vdev_geom code is unaware of SPA_LOAD_CREATE state and it wou
> ld
> > try to match a device GUID, if it can be read, in addition to a name.
> 
> And a rather trivial (and maybe not quite correct) fix:
> 
> diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
> b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
> index 077983ca847c8..818052ba577ec 100644
> --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
> +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
> @@ -777,7 +777,8 @@ vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t *max
> _psize,
> 
>   if (vd->vdev_spa->spa_splitting_newspa ||
>   (vd->vdev_prevstate == VDEV_STATE_UNKNOWN &&
> -  vd->vdev_spa->spa_load_state == SPA_LOAD_NONE)) {
> +  vd->vdev_spa->spa_load_state == SPA_LOAD_NONE ||
> +  vd->vdev_spa->spa_load_state == SPA_LOAD_CREATE)) {
>   /*
>* We are dealing with a vdev that hasn't been previously
>* opened (since boot), and we are not loading an
> 
> 

This patch fixes mine as well:

bob# zpool create foobar /dev/da1p1
cannot create 'foobar': no such pool or dataset
bob# 

The at the time to-be-created pool's partiton was previously inhabited by 
NTFS.


-- 
Cheers,
Cy Schubert 
FreeBSD UNIX:     Web:  http://www.FreeBSD.org

The need of the many outweighs the greed of the few.


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


svn commit: r305452 - stable/11/share/timedef

2016-09-05 Thread Kevin Lo
Author: kevlo
Date: Tue Sep  6 01:10:51 2016
New Revision: 305452
URL: https://svnweb.freebsd.org/changeset/base/305452

Log:
  MFC r305265:
  
  Revert r304192 to fix short month names and replace %b with %_m in date_fmt
  for Chinese locales.
  
  As mentioned in the commit message of r289041, nl_langinfo(ABMON_*) only
  returned numbers when using a Chinese locale, this causes problems in
  applications that put the short month name and the day of the month together.
  
  Spotted by:   Ting-Wei Lan 

Modified:
  stable/11/share/timedef/zh_CN.GB2312.src
  stable/11/share/timedef/zh_CN.GBK.src
  stable/11/share/timedef/zh_CN.UTF-8.src
  stable/11/share/timedef/zh_CN.eucCN.src
  stable/11/share/timedef/zh_TW.Big5.src
  stable/11/share/timedef/zh_TW.UTF-8.src
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/share/timedef/zh_CN.GB2312.src
==
--- stable/11/share/timedef/zh_CN.GB2312.srcTue Sep  6 01:07:12 2016
(r305451)
+++ stable/11/share/timedef/zh_CN.GB2312.srcTue Sep  6 01:10:51 2016
(r305452)
@@ -4,18 +4,18 @@
 # -
 #
 # Short month names
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
+!!#1TB
+!!#2TB
+!!#3TB
+!!#4TB
+!!#5TB
+!!#6TB
+!!#7TB
+!!#8TB
+!!#9TB
+#1#0TB
+#1#1TB
+#1#2TB
 #
 # Long month names (as in a date)
 һ��
@@ -63,7 +63,7 @@
 
 #
 # date_fmt
-%Y��%b��%e�� %A %X %Z
+%Y��%_m��%e�� %A %X %Z
 #
 # Long month names (without case ending)
 һ��

Modified: stable/11/share/timedef/zh_CN.GBK.src
==
--- stable/11/share/timedef/zh_CN.GBK.src   Tue Sep  6 01:07:12 2016
(r305451)
+++ stable/11/share/timedef/zh_CN.GBK.src   Tue Sep  6 01:10:51 2016
(r305452)
@@ -4,18 +4,18 @@
 # -
 #
 # Short month names
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
+ 1��
+ 2��
+ 3��
+ 4��
+ 5��
+ 6��
+ 7��
+ 8��
+ 9��
+10��
+11��
+12��
 #
 # Long month names (as in a date)
 һ��
@@ -63,7 +63,7 @@
 
 #
 # date_fmt
-%Y��%b��%e�� %A %X %Z
+%Y��%_m��%e�� %A %X %Z
 #
 # Long month names (without case ending)
 һ��

Modified: stable/11/share/timedef/zh_CN.UTF-8.src
==
Binary file (source and/or target). No diff available.

Modified: stable/11/share/timedef/zh_CN.eucCN.src
==
--- stable/11/share/timedef/zh_CN.eucCN.src Tue Sep  6 01:07:12 2016
(r305451)
+++ stable/11/share/timedef/zh_CN.eucCN.src Tue Sep  6 01:10:51 2016
(r305452)
@@ -4,18 +4,18 @@
 # -
 #
 # Short month names
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
+��
+��
+��
+��
+��
+��
+��
+��
+��
+��
+��
+��
 #
 # Long month names (as in a date)
 һ��
@@ -63,7 +63,7 @@
 
 #
 # date_fmt
-%Y��%b��%e�� %A %X %Z
+%Y��%_m��%e�� %A %X %Z
 #
 # Long month names (without case ending)
 һ��

Modified: stable/11/share/timedef/zh_TW.Big5.src
==
--- stable/11/share/timedef/zh_TW.Big5.src  Tue Sep  6 01:07:12 2016
(r305451)
+++ stable/11/share/timedef/zh_TW.Big5.src  Tue Sep  6 01:10:51 2016
(r305452)
@@ -4,18 +4,18 @@
 # -
 #
 # Short month names
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
+�@
+�@
+�@
+�@
+�@
+�@
+�@
+�@
+�@
+��
+��
+��
 #
 # Long month names (as in a date)
 1��
@@ -63,7 +63,7 @@
 �U��
 #
 # date_fmt
-%Y�~%b��%e�� %A %X %Z
+%Y�~%_m��%e�� %A %X %Z
 #
 # Long month names (without case ending)
 1��

Modified: stable/11/share/timedef/zh_TW.UTF-8.src
==
--- stable/11/share/timedef/zh_TW.UTF-8.src Tue Sep  6 01:07:12 2016
(r305451)
+++ stable/11/share/timedef/zh_TW.UTF-8.src Tue Sep  6 01:10:51 2016
(r305452)
@@ -4,18 +4,18 @@
 # -
 #
 # Short month names
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11
-12
+ 1月
+ 2月
+ 3月
+ 4月
+ 5月
+ 6月
+ 7月
+ 8月
+ 9月
+10月
+11月
+12月
 #
 # Long month names (as in a date)
 1月
@@ -63,7 +63,7 @@
 下午
 #
 # date_fmt
-%Y年%b月%e日 %A %X %Z
+%Y年%_m月%e日 %A %X %Z
 #
 # Long month names (without case ending)
 1月
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

svn commit: r305451 - head/contrib/netbsd-tests/lib/libc/rpc

2016-09-05 Thread Ngie Cooper
Author: ngie
Date: Tue Sep  6 01:07:12 2016
New Revision: 305451
URL: https://svnweb.freebsd.org/changeset/base/305451

Log:
  Fix lib/libc/rpc test assumptions added in r305358
  
  - Require root in the tcp/udp subtests (it's needed on FreeBSD when
registering services).
  - Skip the tests if service registration fails.
  
  MFC after:59 days
  X-MFC with:   r305358
  Reported by:  Jenkins, rodrigc
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c

Modified: head/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c
==
--- head/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c  Tue Sep  6 00:53:20 
2016(r305450)
+++ head/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c  Tue Sep  6 01:07:12 
2016(r305451)
@@ -24,6 +24,13 @@ __RCSID("$NetBSD: t_rpc.c,v 1.9 2015/11/
return; \
 } while(/*CONSTCOND*/0)
 
+#ifdef __FreeBSD__
+#define SKIPXI(ev, msg, ...)   do {\
+   atf_tc_skip(msg, __VA_ARGS__);  \
+   return ev;  \
+} while(/*CONSTCOND*/0)
+#endif
+
 #else
 #define ERRX(ev, msg, ...) errx(ev, msg, __VA_ARGS__)
 #define SKIPX(ev, msg, ...)errx(ev, msg, __VA_ARGS__)
@@ -188,7 +195,13 @@ regtest(const char *hostname, const char
svc_fdset_init(p ? SVC_FDSET_POLL : 0);
 #endif
if (!svc_create(server, PROGNUM, VERSNUM, transp))
+#ifdef __NetBSD__
ERRX(EXIT_FAILURE, "Cannot create server %d", num);
+#else
+   {
+   SKIPXI(EXIT_FAILURE, "Cannot create server %d", num);
+   }
+#endif
 
switch ((pid = fork())) {
case 0:
@@ -335,6 +348,9 @@ ATF_TC(tcp);
 ATF_TC_HEAD(tcp, tc)
 {
atf_tc_set_md_var(tc, "descr", "Checks svc tcp (select)");
+#ifdef __FreeBSD__
+   atf_tc_set_md_var(tc, "require.user", "root");
+#endif
 }
 
 ATF_TC_BODY(tcp, tc)
@@ -347,6 +363,9 @@ ATF_TC(udp);
 ATF_TC_HEAD(udp, tc)
 {
atf_tc_set_md_var(tc, "descr", "Checks svc udp (select)");
+#ifdef __FreeBSD__
+   atf_tc_set_md_var(tc, "require.user", "root");
+#endif
 }
 
 ATF_TC_BODY(udp, tc)
@@ -359,6 +378,9 @@ ATF_TC(tcp_poll);
 ATF_TC_HEAD(tcp_poll, tc)
 {
atf_tc_set_md_var(tc, "descr", "Checks svc tcp (poll)");
+#ifdef __FreeBSD__
+   atf_tc_set_md_var(tc, "require.user", "root");
+#endif
 }
 
 ATF_TC_BODY(tcp_poll, tc)
@@ -371,6 +393,9 @@ ATF_TC(udp_poll);
 ATF_TC_HEAD(udp_poll, tc)
 {
atf_tc_set_md_var(tc, "descr", "Checks svc udp (poll)");
+#ifdef __FreeBSD__
+   atf_tc_set_md_var(tc, "require.user", "root");
+#endif
 }
 
 ATF_TC_BODY(udp_poll, tc)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305450 - stable/9/contrib/one-true-awk

2016-09-05 Thread Andrey A. Chernov
Author: ache
Date: Tue Sep  6 00:53:20 2016
New Revision: 305450
URL: https://svnweb.freebsd.org/changeset/base/305450

Log:
  MFC r305365
  
  The bug:
  $ echo x | awk '/[[:cntrl:]]/'
  x
  
  The NUL character in cntrl class truncates the pattern, and an empty
  pattern matches anything. The patch skips NUL as a quick fix.
  
  PR: 195792
  Submitted by:   kdrak...@zoho.com
  Approved by:b...@cs.princeton.edu (the author)

Modified:
  stable/9/contrib/one-true-awk/b.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/contrib/   (props changed)
  stable/9/contrib/one-true-awk/   (props changed)

Modified: stable/9/contrib/one-true-awk/b.c
==
--- stable/9/contrib/one-true-awk/b.c   Tue Sep  6 00:51:25 2016
(r305449)
+++ stable/9/contrib/one-true-awk/b.c   Tue Sep  6 00:53:20 2016
(r305450)
@@ -841,7 +841,7 @@ int relex(void) /* lexical analyzer for
if (cc->cc_name != NULL && prestr[1 + 
cc->cc_namelen] == ':' &&
prestr[2 + cc->cc_namelen] == ']') {
prestr += cc->cc_namelen + 3;
-   for (i = 0; i < NCHARS; i++) {
+   for (i = 1; i < NCHARS; i++) {
if (!adjbuf((char **) , 
, bp-buf+1, 100, (char **) , "relex2"))
FATAL("out of space for reg 
expr %.10s...", lastre);
if (cc->cc_func(i)) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305449 - head/lib/libc/tests/db

2016-09-05 Thread Ngie Cooper
Author: ngie
Date: Tue Sep  6 00:51:25 2016
New Revision: 305449
URL: https://svnweb.freebsd.org/changeset/base/305449

Log:
  Install h_db to unbreak some of the lib/libc/db testcases after
  r305358
  
  MFC after:59 days
  X-MFC with:   r305358
  Reported by:  Jenkins, rodrigc
  Sponsored by: EMC / Isilon Storage Division

Modified:
  head/lib/libc/tests/db/Makefile

Modified: head/lib/libc/tests/db/Makefile
==
--- head/lib/libc/tests/db/Makefile Tue Sep  6 00:33:54 2016
(r305448)
+++ head/lib/libc/tests/db/Makefile Tue Sep  6 00:51:25 2016
(r305449)
@@ -5,7 +5,7 @@ PACKAGE=tests
 BINDIR=${TESTSDIR}
 
 PROGS= h_db
-PROGS= h_lfsr
+PROGS+=h_lfsr
 
 ${PACKAGE}FILES+=  README
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305448 - stable/11/contrib/one-true-awk

2016-09-05 Thread Andrey A. Chernov
Author: ache
Date: Tue Sep  6 00:33:54 2016
New Revision: 305448
URL: https://svnweb.freebsd.org/changeset/base/305448

Log:
  MFC r305365
  
  The bug:
  $ echo x | awk '/[[:cntrl:]]/'
  x
  
  The NUL character in cntrl class truncates the pattern, and an empty
  pattern matches anything. The patch skips NUL as a quick fix.
  
  PR: 195792
  Submitted by:   kdrak...@zoho.com
  Approved by:b...@cs.princeton.edu (the author)

Modified:
  stable/11/contrib/one-true-awk/b.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/one-true-awk/b.c
==
--- stable/11/contrib/one-true-awk/b.c  Tue Sep  6 00:32:33 2016
(r305447)
+++ stable/11/contrib/one-true-awk/b.c  Tue Sep  6 00:33:54 2016
(r305448)
@@ -841,7 +841,7 @@ int relex(void) /* lexical analyzer for
if (cc->cc_name != NULL && prestr[1 + 
cc->cc_namelen] == ':' &&
prestr[2 + cc->cc_namelen] == ']') {
prestr += cc->cc_namelen + 3;
-   for (i = 0; i < NCHARS; i++) {
+   for (i = 1; i < NCHARS; i++) {
if (!adjbuf((char **) , 
, bp-buf+1, 100, (char **) , "relex2"))
FATAL("out of space for reg 
expr %.10s...", lastre);
if (cc->cc_func(i)) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305447 - stable/10/contrib/one-true-awk

2016-09-05 Thread Andrey A. Chernov
Author: ache
Date: Tue Sep  6 00:32:33 2016
New Revision: 305447
URL: https://svnweb.freebsd.org/changeset/base/305447

Log:
  MFC r305365
  
  The bug:
  $ echo x | awk '/[[:cntrl:]]/'
  x
  
  The NUL character in cntrl class truncates the pattern, and an empty
  pattern matches anything. The patch skips NUL as a quick fix.
  
  PR: 195792
  Submitted by:   kdrak...@zoho.com
  Approved by:b...@cs.princeton.edu (the author)

Modified:
  stable/10/contrib/one-true-awk/b.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/contrib/one-true-awk/b.c
==
--- stable/10/contrib/one-true-awk/b.c  Mon Sep  5 23:56:27 2016
(r305446)
+++ stable/10/contrib/one-true-awk/b.c  Tue Sep  6 00:32:33 2016
(r305447)
@@ -841,7 +841,7 @@ int relex(void) /* lexical analyzer for
if (cc->cc_name != NULL && prestr[1 + 
cc->cc_namelen] == ':' &&
prestr[2 + cc->cc_namelen] == ']') {
prestr += cc->cc_namelen + 3;
-   for (i = 0; i < NCHARS; i++) {
+   for (i = 1; i < NCHARS; i++) {
if (!adjbuf((char **) , 
, bp-buf+1, 100, (char **) , "relex2"))
FATAL("out of space for reg 
expr %.10s...", lastre);
if (cc->cc_func(i)) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305446 - in stable/11/sys: kern vm

2016-09-05 Thread Alan Cox
Author: alc
Date: Mon Sep  5 23:56:27 2016
New Revision: 305446
URL: https://svnweb.freebsd.org/changeset/base/305446

Log:
  MFC r304102
Eliminate unneeded vm_page_xbusy() and vm_page_xunbusy() operations when
neither vm_pager_has_page() nor vm_pager_get_pages() is called.

Modified:
  stable/11/sys/kern/kern_exec.c
  stable/11/sys/kern/uipc_shm.c
  stable/11/sys/vm/vm_glue.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/kern_exec.c
==
--- stable/11/sys/kern/kern_exec.c  Mon Sep  5 23:12:24 2016
(r305445)
+++ stable/11/sys/kern/kern_exec.c  Mon Sep  5 23:56:27 2016
(r305446)
@@ -984,8 +984,9 @@ exec_map_first_page(imgp)
 #if VM_NRESERVLEVEL > 0
vm_object_color(object, 0);
 #endif
-   ma[0] = vm_page_grab(object, 0, VM_ALLOC_NORMAL);
+   ma[0] = vm_page_grab(object, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY);
if (ma[0]->valid != VM_PAGE_BITS_ALL) {
+   vm_page_xbusy(ma[0]);
if (!vm_pager_has_page(object, 0, NULL, )) {
vm_page_lock(ma[0]);
vm_page_free(ma[0]);
@@ -1021,10 +1022,10 @@ exec_map_first_page(imgp)
VM_OBJECT_WUNLOCK(object);
return (EIO);
}
+   vm_page_xunbusy(ma[0]);
for (i = 1; i < initial_pagein; i++)
vm_page_readahead_finish(ma[i]);
}
-   vm_page_xunbusy(ma[0]);
vm_page_lock(ma[0]);
vm_page_hold(ma[0]);
vm_page_activate(ma[0]);

Modified: stable/11/sys/kern/uipc_shm.c
==
--- stable/11/sys/kern/uipc_shm.c   Mon Sep  5 23:12:24 2016
(r305445)
+++ stable/11/sys/kern/uipc_shm.c   Mon Sep  5 23:56:27 2016
(r305446)
@@ -182,8 +182,9 @@ uiomove_object_page(vm_object_t obj, siz
 * lock to page out tobj's pages because tobj is a OBJT_SWAP
 * type object.
 */
-   m = vm_page_grab(obj, idx, VM_ALLOC_NORMAL);
+   m = vm_page_grab(obj, idx, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY);
if (m->valid != VM_PAGE_BITS_ALL) {
+   vm_page_xbusy(m);
if (vm_pager_has_page(obj, idx, NULL, NULL)) {
rv = vm_pager_get_pages(obj, , 1, NULL, NULL);
if (rv != VM_PAGER_OK) {
@@ -198,8 +199,8 @@ uiomove_object_page(vm_object_t obj, siz
}
} else
vm_page_zero_invalid(m, TRUE);
+   vm_page_xunbusy(m);
}
-   vm_page_xunbusy(m);
vm_page_lock(m);
vm_page_hold(m);
if (m->queue == PQ_NONE) {

Modified: stable/11/sys/vm/vm_glue.c
==
--- stable/11/sys/vm/vm_glue.c  Mon Sep  5 23:12:24 2016(r305445)
+++ stable/11/sys/vm/vm_glue.c  Mon Sep  5 23:56:27 2016(r305446)
@@ -236,8 +236,9 @@ vm_imgact_hold_page(vm_object_t object, 
 
VM_OBJECT_WLOCK(object);
pindex = OFF_TO_IDX(offset);
-   m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL);
+   m = vm_page_grab(object, pindex, VM_ALLOC_NORMAL | VM_ALLOC_NOBUSY);
if (m->valid != VM_PAGE_BITS_ALL) {
+   vm_page_xbusy(m);
rv = vm_pager_get_pages(object, , 1, NULL, NULL);
if (rv != VM_PAGER_OK) {
vm_page_lock(m);
@@ -246,8 +247,8 @@ vm_imgact_hold_page(vm_object_t object, 
m = NULL;
goto out;
}
+   vm_page_xunbusy(m);
}
-   vm_page_xunbusy(m);
vm_page_lock(m);
vm_page_hold(m);
vm_page_activate(m);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


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

2016-09-05 Thread Navdeep Parhar
Author: np
Date: Mon Sep  5 23:12:24 2016
New Revision: 305445
URL: https://svnweb.freebsd.org/changeset/base/305445

Log:
  Fix send/recv limit mixup.

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

Modified: head/sys/dev/iscsi/iscsi.c
==
--- head/sys/dev/iscsi/iscsi.c  Mon Sep  5 22:11:46 2016(r305444)
+++ head/sys/dev/iscsi/iscsi.c  Mon Sep  5 23:12:24 2016(r305445)
@@ -1366,7 +1366,7 @@ iscsi_ioctl_daemon_wait(struct iscsi_sof
request->idr_limits.isl_max_recv_data_segment_length =
idl.idl_max_recv_data_segment_length;
request->idr_limits.isl_max_send_data_segment_length =
-   idl.idl_max_recv_data_segment_length;
+   idl.idl_max_send_data_segment_length;
request->idr_limits.isl_max_burst_length =
idl.idl_max_burst_length;
request->idr_limits.isl_first_burst_length =
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305444 - in head/sys/dev: bhnd bhnd/bcma bhnd/bhndb bhnd/cores/pmu bhnd/siba bwn

2016-09-05 Thread Landon J. Fuller
Author: landonf
Date: Mon Sep  5 22:11:46 2016
New Revision: 305444
URL: https://svnweb.freebsd.org/changeset/base/305444

Log:
  bhnd(4): Implement backplane interrupt handling.
  
  This adds bhnd(4) bus-level support for querying backplane interrupt vector
  routing, and delegating machine/bridge-specific interrupt handling to the
  concrete bhnd(4) driver implementation.
  
  On bhndb(4) bridged PCI devices, we provide the PCI/MSI interrupt directly
  to attached cores.
  
  On MIPS devices, we report a backplane interrupt count of 0, effectively
  disabling the bus-level interrupt assignment. This allows mips/broadcom
  to temporarily continue using hard-coded MIPS IRQs until bhnd_mips PIC
  support is implemented.
  
  Reviewed by:  mizhka
  Approved by:  adrian (mentor, implicit)

Modified:
  head/sys/dev/bhnd/bcma/bcma.c
  head/sys/dev/bhnd/bcma/bcma_dmp.h
  head/sys/dev/bhnd/bcma/bcmavar.h
  head/sys/dev/bhnd/bhnd.c
  head/sys/dev/bhnd/bhnd.h
  head/sys/dev/bhnd/bhnd_bus_if.m
  head/sys/dev/bhnd/bhnd_nexus.c
  head/sys/dev/bhnd/bhndb/bhnd_bhndb.c
  head/sys/dev/bhnd/bhndb/bhndb.c
  head/sys/dev/bhnd/bhndb/bhndb_pci.c
  head/sys/dev/bhnd/bhndb/bhndb_pcivar.h
  head/sys/dev/bhnd/cores/pmu/bhnd_pmu_subr.c
  head/sys/dev/bhnd/siba/siba.c
  head/sys/dev/bhnd/siba/siba_bhndb.c
  head/sys/dev/bhnd/siba/sibareg.h
  head/sys/dev/bhnd/siba/sibavar.h
  head/sys/dev/bwn/bwn_mac.c

Modified: head/sys/dev/bhnd/bcma/bcma.c
==
--- head/sys/dev/bhnd/bcma/bcma.c   Mon Sep  5 21:55:27 2016
(r305443)
+++ head/sys/dev/bhnd/bcma/bcma.c   Mon Sep  5 22:11:46 2016
(r305444)
@@ -41,8 +41,11 @@ __FBSDID("$FreeBSD$");
 
 #include "bcmavar.h"
 
+#include "bcma_dmp.h"
+
 #include "bcma_eromreg.h"
 #include "bcma_eromvar.h"
+
 #include 
 
 /* RID used when allocating EROM table */
@@ -434,6 +437,70 @@ bcma_get_region_addr(device_t dev, devic
return (ENOENT);
 }
 
+/**
+ * Default bcma(4) bus driver implementation of BHND_BUS_GET_INTR_COUNT().
+ * 
+ * This implementation consults @p child's agent register block,
+ * returning the number of interrupt output lines routed to @p child.
+ */
+int
+bcma_get_intr_count(device_t dev, device_t child)
+{
+   struct bcma_devinfo *dinfo;
+   uint32_t dmpcfg, oobw;
+
+   dinfo = device_get_ivars(child);
+
+   /* Agent block must be mapped */
+   if (dinfo->res_agent == NULL)
+   return (0);
+
+   /* Agent must support OOB */
+   dmpcfg = bhnd_bus_read_4(dinfo->res_agent, BCMA_DMP_CONFIG);
+   if (!BCMA_DMP_GET_FLAG(dmpcfg, BCMA_DMP_CFG_OOB))
+   return (0);
+
+   /* Return OOB width as interrupt count */
+   oobw = bhnd_bus_read_4(dinfo->res_agent,
+   BCMA_DMP_OOB_OUTWIDTH(BCMA_OOB_BANK_INTR));
+   if (oobw > BCMA_OOB_NUM_SEL) {
+   device_printf(dev, "ignoring invalid OOBOUTWIDTH for core %u: "
+   "%#x\n", BCMA_DINFO_COREIDX(dinfo), oobw);
+   return (0);
+   }
+   
+   return (oobw);
+}
+
+/**
+ * Default bcma(4) bus driver implementation of BHND_BUS_GET_CORE_IVEC().
+ * 
+ * This implementation consults @p child's agent register block,
+ * returning the interrupt output line routed to @p child, at OOB selector
+ * @p intr.
+ */
+int
+bcma_get_core_ivec(device_t dev, device_t child, u_int intr, uint32_t *ivec)
+{
+   struct bcma_devinfo *dinfo;
+   uint32_t oobsel;
+
+   dinfo = device_get_ivars(child);
+
+   /* Interrupt ID must be valid. */
+   if (intr >= bcma_get_intr_count(dev, child))
+   return (ENXIO);
+
+   /* Fetch OOBSEL busline value */
+   KASSERT(dinfo->res_agent != NULL, ("missing agent registers"));
+   oobsel = bhnd_bus_read_4(dinfo->res_agent, BCMA_DMP_OOBSELOUT(
+   BCMA_OOB_BANK_INTR, intr));
+   *ivec = (oobsel >> BCMA_DMP_OOBSEL_SHIFT(intr)) &
+   BCMA_DMP_OOBSEL_BUSLINE_MASK;
+
+   return (0);
+}
+
 static struct bhnd_devinfo *
 bcma_alloc_bhnd_dinfo(device_t dev)
 {
@@ -475,6 +542,8 @@ bcma_add_children(device_t bus)
/* Add all cores. */
bcma_erom = (struct bcma_erom *)erom;
while ((error = bcma_erom_next_corecfg(bcma_erom, )) == 0) {
+   int nintr;
+
/* Add the child device */
child = BUS_ADD_CHILD(bus, 0, NULL, -1);
if (child == NULL) {
@@ -494,6 +563,17 @@ bcma_add_children(device_t bus)
if ((error = bcma_dinfo_alloc_agent(bus, child, dinfo)))
goto cleanup;
 
+   /* Assign interrupts */
+   nintr = bhnd_get_intr_count(child);
+   for (int rid = 0; rid < nintr; rid++) {
+   error = BHND_BUS_ASSIGN_INTR(bus, child, rid);
+   if (error) {
+   device_printf(bus, "failed to assign interrupt "
+ 

svn commit: r305443 - head/sys/dev/bwn

2016-09-05 Thread Landon J. Fuller
Author: landonf
Date: Mon Sep  5 21:55:27 2016
New Revision: 305443
URL: https://svnweb.freebsd.org/changeset/base/305443

Log:
  bwn(4): ignore BCM4321's unpopulated USB11 host controller core.
  
  Broadcom Intensi-fi chipsets provided a common set of IP cores; on PCI/PCIe
  devices, the USB11 host controller is left floating.
  
  Approved by:  adrian (mentor, implicit)

Modified:
  head/sys/dev/bwn/if_bwn_pci.c
  head/sys/dev/bwn/if_bwn_pcivar.h

Modified: head/sys/dev/bwn/if_bwn_pci.c
==
--- head/sys/dev/bwn/if_bwn_pci.c   Mon Sep  5 21:48:16 2016
(r305442)
+++ head/sys/dev/bwn/if_bwn_pci.c   Mon Sep  5 21:55:27 2016
(r305443)
@@ -84,10 +84,12 @@ static const struct bwn_pci_device siba_
BWN_BCM_DEV(BCM4318_D11A,   "BCM4318 802.11a",
BWN_QUIRK_UNTESTED|BWN_QUIRK_WLAN_DUALCORE),
 
-   BWN_BCM_DEV(BCM4321_D11N,   "BCM4321 802.11n Dual-Band",0),
-   BWN_BCM_DEV(BCM4321_D11N2G, "BCM4321 802.11n 2GHz", 0),
+   BWN_BCM_DEV(BCM4321_D11N,   "BCM4321 802.11n Dual-Band",
+   BWN_QUIRK_USBH_UNPOPULATED),
+   BWN_BCM_DEV(BCM4321_D11N2G, "BCM4321 802.11n 2GHz",
+   BWN_QUIRK_USBH_UNPOPULATED),
BWN_BCM_DEV(BCM4321_D11N2G, "BCM4321 802.11n 5GHz",
-   BWN_QUIRK_UNTESTED),
+   BWN_QUIRK_UNTESTED|BWN_QUIRK_USBH_UNPOPULATED),
 
BWN_BCM_DEV(BCM4322_D11N,   "BCM4322 802.11n Dual-Band",0),
BWN_BCM_DEV(BCM4322_D11N2G, "BCM4322 802.11n 2GHz",
@@ -263,6 +265,9 @@ bwn_pci_is_core_disabled(device_t dev, d
case BHND_DEVCLASS_ENET_MAC:
case BHND_DEVCLASS_ENET_PHY:
return ((sc->quirks & BWN_QUIRK_ENET_HW_UNPOPULATED) != 0);
+   
+   case BHND_DEVCLASS_USB_HOST:
+   return ((sc->quirks & BWN_QUIRK_USBH_UNPOPULATED) != 0);
 
default:
return (false);

Modified: head/sys/dev/bwn/if_bwn_pcivar.h
==
--- head/sys/dev/bwn/if_bwn_pcivar.hMon Sep  5 21:48:16 2016
(r305442)
+++ head/sys/dev/bwn/if_bwn_pcivar.hMon Sep  5 21:55:27 2016
(r305443)
@@ -68,6 +68,13 @@ enum {
 * this quirk to treat these cores as unpopulated.
 */
BWN_QUIRK_ENET_HW_UNPOPULATED   = 1<<2,
+
+   /**
+* Some PCI/PCIe "Intensi-fi" chipsets shipped with floating USB
+* host controller cores; set this quirk to treat these cores as
+* unpopulated.
+*/
+   BWN_QUIRK_USBH_UNPOPULATED  = 1<<3,
 };
 
 /* PCI device descriptor */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r305368 - head/sys/kern

2016-09-05 Thread John Baldwin
On Monday, September 05, 2016 11:09:17 AM Mark Johnston wrote:
> On Mon, Sep 05, 2016 at 10:30:24AM -0700, John Baldwin wrote:
> > On Sunday, September 04, 2016 12:29:49 AM Mark Johnston wrote:
> > > Author: markj
> > > Date: Sun Sep  4 00:29:48 2016
> > > New Revision: 305368
> > > URL: https://svnweb.freebsd.org/changeset/base/305368
> > > 
> > > Log:
> > >   Micro-optimize sleepq_signal().
> > >   
> > >   Lift a comparison out of the loop that finds the highest-priority thread
> > >   on the queue.
> > >   
> > >   MFC after:  1 week
> > 
> > Could this safely use TAILQ_FOREACH_FROM?
> 
> Are you suggesting something like this?
> 
> besttd = TAILQ_FIRST(>sq_blocked[queue]);
> td = TAILQ_NEXT(besttd, td_slpq);
> TAILQ_FOREACH_FROM(td, >sq_blocked[queue], td_slpq) {
> ...
> 
> I think that would work, and it avoids visiting the first element
> unnecessarily when the queue contains more than one element. If the
> queue contains one element, we'd visit it because of
> TAILQ_FOREACH_FROM's surprising behaviour of iterating over the entire
> queue when the listelem is NULL.

I was hoping it was something equivalent to:

for (td = TAILQ_NEXT(besttd); td != NULL; td = TAILQ_NEXT(td)) {
...
}

I guess what we actually want is something like TAILQ_FOREACH_AFTER():

TAILQ_FOREACH_AFTER(td, besttd, >sq_blocked[queue], td_slpq)

that assumed bestttd was not NULL and so avoided the whole "scan the
whole thing".

For now you could perhaps open-code the above loop though?

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


svn commit: r305442 - head/sys/dev/bhnd

2016-09-05 Thread Landon J. Fuller
Author: landonf
Date: Mon Sep  5 21:48:16 2016
New Revision: 305442
URL: https://svnweb.freebsd.org/changeset/base/305442

Log:
  bhnd(4): Add device classes for USB host/dev/dual-mode controller cores.
  
  Approved by:  adrian (mentor, implicit)

Modified:
  head/sys/dev/bhnd/bhnd_subr.c
  head/sys/dev/bhnd/bhnd_types.h

Modified: head/sys/dev/bhnd/bhnd_subr.c
==
--- head/sys/dev/bhnd/bhnd_subr.c   Mon Sep  5 21:25:45 2016
(r305441)
+++ head/sys/dev/bhnd/bhnd_subr.c   Mon Sep  5 21:48:16 2016
(r305442)
@@ -71,7 +71,7 @@ static const struct bhnd_core_desc {
BHND_CDESC(BCM, MIPS,   CPU,"MIPS Core"),
BHND_CDESC(BCM, ENET,   ENET_MAC,   "Fast Ethernet MAC"),
BHND_CDESC(BCM, CODEC,  OTHER,  "V.90 Modem Codec"),
-   BHND_CDESC(BCM, USB,OTHER,  "USB 1.1 Device/Host 
Controller"),
+   BHND_CDESC(BCM, USB,USB_DUAL,   "USB 1.1 Device/Host 
Controller"),
BHND_CDESC(BCM, ADSL,   OTHER,  "ADSL Core"),
BHND_CDESC(BCM, ILINE100,   OTHER,  "iLine100 HPNA"),
BHND_CDESC(BCM, IPSEC,  OTHER,  "IPsec Accelerator"),
@@ -86,10 +86,10 @@ static const struct bhnd_core_desc {
BHND_CDESC(BCM, BPHY,   WLAN_PHY,   "802.11b PHY"),
BHND_CDESC(BCM, GPHY,   WLAN_PHY,   "802.11g PHY"),
BHND_CDESC(BCM, MIPS33, CPU,"MIPS3302 Core"),
-   BHND_CDESC(BCM, USB11H, OTHER,  "USB 1.1 Host 
Controller"),
-   BHND_CDESC(BCM, USB11D, OTHER,  "USB 1.1 Device Core"),
-   BHND_CDESC(BCM, USB20H, OTHER,  "USB 2.0 Host 
Controller"),
-   BHND_CDESC(BCM, USB20D, OTHER,  "USB 2.0 Device Core"),
+   BHND_CDESC(BCM, USB11H, USB_HOST,   "USB 1.1 Host 
Controller"),
+   BHND_CDESC(BCM, USB11D, USB_DEV,"USB 1.1 Device 
Controller"),
+   BHND_CDESC(BCM, USB20H, USB_HOST,   "USB 2.0 Host 
Controller"),
+   BHND_CDESC(BCM, USB20D, USB_DEV,"USB 2.0 Device 
Controller"),
BHND_CDESC(BCM, SDIOH,  OTHER,  "SDIO Host Controller"),
BHND_CDESC(BCM, ROBO,   OTHER,  "RoboSwitch"),
BHND_CDESC(BCM, ATA100, OTHER,  "Parallel ATA 
Controller"),
@@ -130,8 +130,8 @@ static const struct bhnd_core_desc {
BHND_CDESC(BCM, NS_PCIE2,   PCIE,   "PCIe Bridge (Gen2)"),
BHND_CDESC(BCM, NS_DMA, OTHER,  "DMA engine"),
BHND_CDESC(BCM, NS_SDIO,OTHER,  "SDIO 3.0 Host 
Controller"),
-   BHND_CDESC(BCM, NS_USB20H,  OTHER,  "USB 2.0 Host 
Controller"),
-   BHND_CDESC(BCM, NS_USB30H,  OTHER,  "USB 3.0 Host 
Controller"),
+   BHND_CDESC(BCM, NS_USB20H,  USB_HOST,   "USB 2.0 Host 
Controller"),
+   BHND_CDESC(BCM, NS_USB30H,  USB_HOST,   "USB 3.0 Host 
Controller"),
BHND_CDESC(BCM, NS_A9JTAG,  OTHER,  "ARM Cortex A9 JTAG 
Interface"),
BHND_CDESC(BCM, NS_DDR23_MEMC,  MEMC,   "Denali DDR2/DD3 Memory 
Controller"),
BHND_CDESC(BCM, NS_ROM, NVRAM,  "System ROM"),

Modified: head/sys/dev/bhnd/bhnd_types.h
==
--- head/sys/dev/bhnd/bhnd_types.h  Mon Sep  5 21:25:45 2016
(r305441)
+++ head/sys/dev/bhnd/bhnd_types.h  Mon Sep  5 21:48:16 2016
(r305442)
@@ -57,8 +57,11 @@ typedef enum {
BHND_DEVCLASS_SOC_BRIDGE,   /**< interconnect host bridge */
BHND_DEVCLASS_EROM, /**< bus device enumeration ROM */
BHND_DEVCLASS_NVRAM,/**< nvram/flash controller */
-   BHND_DEVCLASS_OTHER,/**< other / unknown */
+   BHND_DEVCLASS_USB_HOST, /**< USB host controller */
+   BHND_DEVCLASS_USB_DEV,  /**< USB device controller */
+   BHND_DEVCLASS_USB_DUAL, /**< USB host/device controller */
 
+   BHND_DEVCLASS_OTHER = 1000, /**< other / unknown */
BHND_DEVCLASS_INVALID   /**< no/invalid class */
 } bhnd_devclass_t;
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305441 - stable/11/sys/arm/allwinner

2016-09-05 Thread Emmanuel Vadot
Author: manu
Date: Mon Sep  5 21:25:45 2016
New Revision: 305441
URL: https://svnweb.freebsd.org/changeset/base/305441

Log:
  MFC r304509
  
  if_emac: Before generating a random MAC address, try using the SID rootkey
  to generate one. This is was U-Boot does to generate a random MAC so we end
  up with the same MAC address as if U-Boot did generate it.

Modified:
  stable/11/sys/arm/allwinner/if_emac.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/allwinner/if_emac.c
==
--- stable/11/sys/arm/allwinner/if_emac.c   Mon Sep  5 21:11:27 2016
(r305440)
+++ stable/11/sys/arm/allwinner/if_emac.c   Mon Sep  5 21:25:45 2016
(r305441)
@@ -77,6 +77,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include 
+#include 
 
 #include 
 
@@ -167,12 +168,17 @@ static void
 emac_get_hwaddr(struct emac_softc *sc, uint8_t *hwaddr)
 {
uint32_t val0, val1, rnd;
+   u_char rootkey[16];
 
/*
 * Try to get MAC address from running hardware.
 * If there is something non-zero there just use it.
 *
 * Otherwise set the address to a convenient locally assigned address,
+* using the SID rootkey.
+* This is was uboot does so we end up with the same mac as if uboot
+* did set it.
+* If we can't get the root key, generate a random one,
 * 'bsd' + random 24 low-order bits. 'b' is 0x62, which has the locally
 * assigned bit set, and the broadcast/multicast bit clear.
 */
@@ -186,13 +192,23 @@ emac_get_hwaddr(struct emac_softc *sc, u
hwaddr[4] = (val0 >> 8) & 0xff;
hwaddr[5] = (val0 >> 0) & 0xff;
} else {
-   rnd = arc4random() & 0x00ff;
-   hwaddr[0] = 'b';
-   hwaddr[1] = 's';
-   hwaddr[2] = 'd';
-   hwaddr[3] = (rnd >> 16) & 0xff;
-   hwaddr[4] = (rnd >> 8) & 0xff;
-   hwaddr[5] = (rnd >> 0) & 0xff;
+   if (aw_sid_get_rootkey(rootkey) == 0) {
+   hwaddr[0] = 0x2;
+   hwaddr[1] = rootkey[3];
+   hwaddr[2] = rootkey[12];
+   hwaddr[3] = rootkey[13];
+   hwaddr[4] = rootkey[14];
+   hwaddr[5] = rootkey[15];
+   }
+   else {
+   rnd = arc4random() & 0x00ff;
+   hwaddr[0] = 'b';
+   hwaddr[1] = 's';
+   hwaddr[2] = 'd';
+   hwaddr[3] = (rnd >> 16) & 0xff;
+   hwaddr[4] = (rnd >> 8) & 0xff;
+   hwaddr[5] = (rnd >> 0) & 0xff;
+   }
}
if (bootverbose)
printf("MAC address: %s\n", ether_sprintf(hwaddr));
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r305331 - in head/sys/cddl/contrib/opensolaris/uts/common: fs/zfs fs/zfs/sys sys/fs

2016-09-05 Thread Andriy Gapon
On 05/09/2016 23:47, Andriy Gapon wrote:
> Alexander,
> 
> I belive that this commit accidentally breaks the following scenario:
> zpool create tank /dev/xxx
> zpool destroy tank
> zpool create tank /dev/xxx
> 
> It seems that vdev_geom code is unaware of SPA_LOAD_CREATE state and it would
> try to match a device GUID, if it can be read, in addition to a name.

And a rather trivial (and maybe not quite correct) fix:

diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
index 077983ca847c8..818052ba577ec 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
@@ -777,7 +777,8 @@ vdev_geom_open(vdev_t *vd, uint64_t *psize, uint64_t 
*max_psize,

if (vd->vdev_spa->spa_splitting_newspa ||
(vd->vdev_prevstate == VDEV_STATE_UNKNOWN &&
-vd->vdev_spa->spa_load_state == SPA_LOAD_NONE)) {
+vd->vdev_spa->spa_load_state == SPA_LOAD_NONE ||
+vd->vdev_spa->spa_load_state == SPA_LOAD_CREATE)) {
/*
 * We are dealing with a vdev that hasn't been previously
 * opened (since boot), and we are not loading an


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


svn commit: r305440 - stable/11/sys/arm/allwinner

2016-09-05 Thread Emmanuel Vadot
Author: manu
Date: Mon Sep  5 21:11:27 2016
New Revision: 305440
URL: https://svnweb.freebsd.org/changeset/base/305440

Log:
  MFC r303087
  
  Add support for the SID (Security ID Module) on Allwinner A10 and A20.
  The rootkey is burnt at production and can't be changed, thus is can be used
  as a device unique ID or to generate a MAC address (This is was u-boot does).
  The rootkey is exposed as a sysctl (dev.aw_sid..rootkey).
  
  Reviewed by:  jmcneill
  Differential Revision:https://reviews.freebsd.org/D6383

Modified:
  stable/11/sys/arm/allwinner/aw_sid.c
  stable/11/sys/arm/allwinner/aw_sid.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/allwinner/aw_sid.c
==
--- stable/11/sys/arm/allwinner/aw_sid.cMon Sep  5 20:46:45 2016
(r305439)
+++ stable/11/sys/arm/allwinner/aw_sid.cMon Sep  5 21:11:27 2016
(r305440)
@@ -33,12 +33,14 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -50,13 +52,22 @@ __FBSDID("$FreeBSD$");
 #defineSID_THERMAL_CALIB0  (SID_SRAM + 0x34)
 #defineSID_THERMAL_CALIB1  (SID_SRAM + 0x38)
 
+enum sid_type {
+   A10_SID = 1,
+   A20_SID,
+   A83T_SID,
+};
+
 static struct ofw_compat_data compat_data[] = {
-   { "allwinner,sun8i-a83t-sid",   1 },
+   { "allwinner,sun4i-a10-sid",A10_SID},
+   { "allwinner,sun7i-a20-sid",A20_SID},
+   { "allwinner,sun8i-a83t-sid",   A83T_SID},
{ NULL, 0 }
 };
 
 struct aw_sid_softc {
struct resource *res;
+   int type;
 };
 
 static struct aw_sid_softc *aw_sid_sc;
@@ -66,9 +77,18 @@ static struct resource_spec aw_sid_spec[
{ -1, 0 }
 };
 
+enum sid_keys {
+   AW_SID_ROOT_KEY,
+};
+
+#defineROOT_KEY_OFF0x0
+#defineROOT_KEY_SIZE   4
+
 #defineRD4(sc, reg)bus_read_4((sc)->res, (reg))
 #defineWR4(sc, reg, val)   bus_write_4((sc)->res, (reg), (val))
 
+static int aw_sid_sysctl(SYSCTL_HANDLER_ARGS);
+
 static int
 aw_sid_probe(device_t dev)
 {
@@ -96,6 +116,19 @@ aw_sid_attach(device_t dev)
 
aw_sid_sc = sc;
 
+   sc->type = ofw_bus_search_compatible(dev, compat_data)->ocd_data;
+   switch (sc->type) {
+   case A10_SID:
+   case A20_SID:
+   SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
+   SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
+   OID_AUTO, "rootkey",
+   CTLTYPE_STRING | CTLFLAG_RD,
+   dev, AW_SID_ROOT_KEY, aw_sid_sysctl, "A", "Root Key");
+   break;
+   default:
+   break;
+   }
return (0);
 }
 
@@ -107,6 +140,8 @@ aw_sid_read_tscalib(uint32_t *calib0, ui
sc = aw_sid_sc;
if (sc == NULL)
return (ENXIO);
+   if (sc->type != A83T_SID)
+   return (ENXIO);
 
*calib0 = RD4(sc, SID_THERMAL_CALIB0);
*calib1 = RD4(sc, SID_THERMAL_CALIB1);
@@ -114,6 +149,45 @@ aw_sid_read_tscalib(uint32_t *calib0, ui
return (0);
 }
 
+int
+aw_sid_get_rootkey(u_char *out)
+{
+   struct aw_sid_softc *sc;
+   int i;
+   u_int tmp;
+
+   sc = aw_sid_sc;
+   if (sc == NULL)
+   return (ENXIO);
+   if (sc->type != A10_SID && sc->type != A20_SID)
+   return (ENXIO);
+
+   for (i = 0; i < ROOT_KEY_SIZE ; i++) {
+   tmp = RD4(aw_sid_sc, ROOT_KEY_OFF + (i * 4));
+   be32enc([i * 4], tmp);
+   }
+
+   return (0);
+}
+
+static int
+aw_sid_sysctl(SYSCTL_HANDLER_ARGS)
+{
+   enum sid_keys key = arg2;
+   u_char rootkey[16];
+   char out[33];
+
+   if (key != AW_SID_ROOT_KEY)
+   return (ENOENT);
+
+   if (aw_sid_get_rootkey(rootkey) != 0)
+   return (ENOENT);
+   snprintf(out, sizeof(out),
+ "%16D", rootkey, "");
+
+   return sysctl_handle_string(oidp, out, sizeof(out), req);
+}
+
 static device_method_t aw_sid_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, aw_sid_probe),

Modified: stable/11/sys/arm/allwinner/aw_sid.h
==
--- stable/11/sys/arm/allwinner/aw_sid.hMon Sep  5 20:46:45 2016
(r305439)
+++ stable/11/sys/arm/allwinner/aw_sid.hMon Sep  5 21:11:27 2016
(r305440)
@@ -30,5 +30,6 @@
 #define __AW_SID_H__
 
 intaw_sid_read_tscalib(uint32_t *, uint32_t *);
+intaw_sid_get_rootkey(u_char *out);
 
 #endif /* !__AW_SID_H__ */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to 

Re: svn commit: r305331 - in head/sys/cddl/contrib/opensolaris/uts/common: fs/zfs fs/zfs/sys sys/fs

2016-09-05 Thread Andriy Gapon
On 05/09/2016 23:47, Andriy Gapon wrote:
> Alexander,
> 
> I belive that this commit accidentally breaks the following scenario:
> zpool create tank /dev/xxx
> zpool destroy tank
> zpool create tank /dev/xxx
> 
> It seems that vdev_geom code is unaware of SPA_LOAD_CREATE state and it would
> try to match a device GUID, if it can be read, in addition to a name.

P.S.
I love hidden changes like this one in a bigger and apparently unrelated change.
Old Sun style.

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


Re: svn commit: r305331 - in head/sys/cddl/contrib/opensolaris/uts/common: fs/zfs fs/zfs/sys sys/fs

2016-09-05 Thread Andriy Gapon
On 03/09/2016 13:04, Alexander Motin wrote:
> Author: mav
> Date: Sat Sep  3 10:04:37 2016
> New Revision: 305331
> URL: https://svnweb.freebsd.org/changeset/base/305331
> 
> Log:
>   MFV r304155: 7090 zfs should improve allocation order and throttle 
> allocations
>   
>   illumos/illumos-gate@0f7643c7376dd69a08acbfc9d1d7d548b10c846a
>   
> https://github.com/illumos/illumos-gate/commit/0f7643c7376dd69a08acbfc9d1d7d548b
>   10c846a
>   
>   https://www.illumos.org/issues/7090
> When write I/Os are issued, they are issued in block order but the ZIO 
> pipelin
>   e
> will drive them asynchronously through the allocation stage which can 
> result i
>   n
> blocks being allocated out-of-order. It would be nice to preserve as much 
> of
> the logical order as possible.
> In addition, the allocations are equally scattered across all top-level 
> VDEVs
> but not all top-level VDEVs are created equally. The pipeline should be 
> able t
>   o
> detect devices that are more capable of handling allocations and should
> allocate more blocks to those devices. This allows for dynamic allocation
> distribution when devices are imbalanced as fuller devices will tend to be
> slower than empty devices.
> The change includes a new pool-wide allocation queue which would throttle 
> and
> order allocations in the ZIO pipeline. The queue would be ordered by 
> issued
> time and offset and would provide an initial amount of allocation of work 
> to
> each top-level vdev. The allocation logic utilizes a reservation system to
> reserve allocations that will be performed by the allocator. Once an 
> allocatio
>   n
> is successfully completed it's scheduled on a given top-level vdev. Each 
> top-
> level vdev maintains a maximum number of allocations that it can handle
> (mg_alloc_queue_depth). The pool-wide reserved allocations (top-levels *
> mg_alloc_queue_depth) are distributed across the top-level vdevs metaslab
> groups and round robin across all eligible metaslab groups to distribute 
> the
> work. As top-levels complete their work, they receive additional work 
> from the
> pool-wide allocation queue until the allocation queue is emptied.
>   
>   Reviewed by: Adam Leventhal 
>   Reviewed by: Alex Reece 
>   Reviewed by: Christopher Siden 
>   Reviewed by: Dan Kimmel 
>   Reviewed by: Matthew Ahrens 
>   Reviewed by: Paul Dagnelie 
>   Reviewed by: Prakash Surya 
>   Reviewed by: Sebastien Roy 
>   Approved by: Robert Mustacchi 
>   Author: George Wilson 
> 
> Modified:
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_cache.c
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c
>   head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
>   head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h
> Directory Properties:
>   head/sys/cddl/contrib/opensolaris/   (props changed)
...
> @@ -3720,6 +3719,7 @@ spa_create(const char *pool, nvlist_t *n
>   spa->spa_uberblock.ub_txg = txg - 1;
>   spa->spa_uberblock.ub_version = version;
>   spa->spa_ubsync = spa->spa_uberblock;
> + spa->spa_load_state = SPA_LOAD_CREATE;
>  
>   /*
>* Create "The Godfather" zio to hold all async IOs
> @@ -3905,6 +3905,7 @@ spa_create(const char *pool, nvlist_t *n
>*/
>   spa_evicting_os_wait(spa);
>   spa->spa_minref = refcount_count(>spa_refcount);
> + spa->spa_load_state = SPA_LOAD_NONE;
>  
>   mutex_exit(_namespace_lock);
>  
> @@ -5615,7 +5616,7 @@ spa_nvlist_lookup_by_guid(nvlist_t **nvp
...

Alexander,

I belive that this commit accidentally breaks the following scenario:
zpool create tank /dev/xxx
zpool destroy tank
zpool create tank /dev/xxx

It seems that vdev_geom code is unaware of SPA_LOAD_CREATE state and it would
try to match a device GUID, if it can be 

svn commit: r305439 - stable/11/sys/arm/allwinner

2016-09-05 Thread Emmanuel Vadot
Author: manu
Date: Mon Sep  5 20:46:45 2016
New Revision: 305439
URL: https://svnweb.freebsd.org/changeset/base/305439

Log:
  MFC r304290,r304649
  
  r304290:
  Only set pud settings if this is a pullup or pulldown configuration.
  This removes the need to set the MMC pins with pullups in our DTS.
  Thanks to jmcneill@ for spotting this.
  
  r304649:
  Do not include file from dt-bindings and simply use the already present 
defines.

Modified:
  stable/11/sys/arm/allwinner/a10_gpio.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/allwinner/a10_gpio.c
==
--- stable/11/sys/arm/allwinner/a10_gpio.c  Mon Sep  5 20:34:15 2016
(r305438)
+++ stable/11/sys/arm/allwinner/a10_gpio.c  Mon Sep  5 20:46:45 2016
(r305439)
@@ -585,7 +585,9 @@ aw_fdt_configure_pins(device_t dev, phan
a10_gpio_set_function(sc, pin_num, pin_func);
if (a10_gpio_get_drv(sc, pin_num) != pin_drive)
a10_gpio_set_drv(sc, pin_num, pin_drive);
-   if (a10_gpio_get_pud(sc, pin_num) != pin_pull)
+   if (a10_gpio_get_pud(sc, pin_num) != pin_pull &&
+   (pin_pull == A10_GPIO_PULLUP ||
+   pin_pull == A10_GPIO_PULLDOWN))
a10_gpio_set_pud(sc, pin_num, pin_pull);
A10_GPIO_UNLOCK(sc);
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305438 - stable/11/sys/arm/allwinner

2016-09-05 Thread Emmanuel Vadot
Author: manu
Date: Mon Sep  5 20:34:15 2016
New Revision: 305438
URL: https://svnweb.freebsd.org/changeset/base/305438

Log:
  MFC r304289
  
  a10_gpio_get_function now returns the whole function not only
  GPIO_INPUT/GPIO_OUTPUT.
  a10_gpio_get_pud now returns the whole pud not only PULLDOWN/PULLUP.
  Add a10_gpio_get_drv to get the current drive strenght.
  During fdt pin configure, avoid setting function/drive/pud if it's already in
  the correct value.
  
  Tested on Allwinner H3 and A20

Modified:
  stable/11/sys/arm/allwinner/a10_gpio.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/allwinner/a10_gpio.c
==
--- stable/11/sys/arm/allwinner/a10_gpio.c  Mon Sep  5 20:29:04 2016
(r305437)
+++ stable/11/sys/arm/allwinner/a10_gpio.c  Mon Sep  5 20:34:15 2016
(r305438)
@@ -196,14 +196,8 @@ a10_gpio_get_function(struct a10_gpio_so
offset = ((pin & 0x07) << 2);
 
func = A10_GPIO_READ(sc, A10_GPIO_GP_CFG(bank, pin >> 3));
-   switch ((func >> offset) & 0x7) {
-   case A10_GPIO_INPUT:
-   return (GPIO_PIN_INPUT);
-   case A10_GPIO_OUTPUT:
-   return (GPIO_PIN_OUTPUT);
-   }
 
-   return (0);
+   return ((func >> offset) & 0x7);
 }
 
 static int
@@ -243,14 +237,8 @@ a10_gpio_get_pud(struct a10_gpio_softc *
offset = ((pin & 0x0f) << 1);
 
val = A10_GPIO_READ(sc, A10_GPIO_GP_PUL(bank, pin >> 4));
-   switch ((val >> offset) & 0x3) {
-   case A10_GPIO_PULLDOWN:
-   return (GPIO_PIN_PULLDOWN);
-   case A10_GPIO_PULLUP:
-   return (GPIO_PIN_PULLUP);
-   }
 
-   return (0);
+   return ((val >> offset) & AW_GPIO_PUD_MASK);
 }
 
 static void
@@ -271,6 +259,23 @@ a10_gpio_set_pud(struct a10_gpio_softc *
A10_GPIO_WRITE(sc, A10_GPIO_GP_PUL(bank, pin >> 4), val);
 }
 
+static uint32_t
+a10_gpio_get_drv(struct a10_gpio_softc *sc, uint32_t pin)
+{
+   uint32_t bank, offset, val;
+
+   /* Must be called with lock held. */
+   A10_GPIO_LOCK_ASSERT(sc);
+
+   bank = sc->padconf->pins[pin].port;
+   pin = sc->padconf->pins[pin].pin;
+   offset = ((pin & 0x0f) << 1);
+
+   val = A10_GPIO_READ(sc, A10_GPIO_GP_DRV(bank, pin >> 4));
+
+   return ((val >> offset) & AW_GPIO_DRV_MASK);
+}
+
 static void
 a10_gpio_set_drv(struct a10_gpio_softc *sc, uint32_t pin, uint32_t drive)
 {
@@ -359,14 +364,39 @@ static int
 a10_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t *flags)
 {
struct a10_gpio_softc *sc;
+   uint32_t func;
+   uint32_t pud;
 
sc = device_get_softc(dev);
if (pin >= sc->padconf->npins)
return (EINVAL);
 
A10_GPIO_LOCK(sc);
-   *flags = a10_gpio_get_function(sc, pin);
-   *flags |= a10_gpio_get_pud(sc, pin);
+   func = a10_gpio_get_function(sc, pin);
+   switch (func) {
+   case A10_GPIO_INPUT:
+   *flags = GPIO_PIN_INPUT;
+   break;
+   case A10_GPIO_OUTPUT:
+   *flags = GPIO_PIN_OUTPUT;
+   break;
+   default:
+   *flags = 0;
+   break;
+   }
+
+   pud = a10_gpio_get_pud(sc, pin);
+   switch (pud) {
+   case A10_GPIO_PULLDOWN:
+   *flags |= GPIO_PIN_PULLDOWN;
+   break;
+   case A10_GPIO_PULLUP:
+   *flags |= GPIO_PIN_PULLUP;
+   break;
+   default:
+   break;
+   }
+
A10_GPIO_UNLOCK(sc);
 
return (0);
@@ -550,9 +580,13 @@ aw_fdt_configure_pins(device_t dev, phan
}
 
A10_GPIO_LOCK(sc);
-   a10_gpio_set_function(sc, pin_num, pin_func);
-   a10_gpio_set_drv(sc, pin_num, pin_drive);
-   a10_gpio_set_pud(sc, pin_num, pin_pull);
+
+   if (a10_gpio_get_function(sc, pin_num) != pin_func)
+   a10_gpio_set_function(sc, pin_num, pin_func);
+   if (a10_gpio_get_drv(sc, pin_num) != pin_drive)
+   a10_gpio_set_drv(sc, pin_num, pin_drive);
+   if (a10_gpio_get_pud(sc, pin_num) != pin_pull)
+   a10_gpio_set_pud(sc, pin_num, pin_pull);
A10_GPIO_UNLOCK(sc);
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305437 - stable/11/sys/arm/allwinner/a20

2016-09-05 Thread Emmanuel Vadot
Author: manu
Date: Mon Sep  5 20:29:04 2016
New Revision: 305437
URL: https://svnweb.freebsd.org/changeset/base/305437

Log:
  MFC r303186
  PC5 doesn't have mmc2 function.

Modified:
  stable/11/sys/arm/allwinner/a20/a20_padconf.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/allwinner/a20/a20_padconf.c
==
--- stable/11/sys/arm/allwinner/a20/a20_padconf.c   Mon Sep  5 20:17:18 
2016(r305436)
+++ stable/11/sys/arm/allwinner/a20/a20_padconf.c   Mon Sep  5 20:29:04 
2016(r305437)
@@ -87,7 +87,7 @@ const static struct allwinner_pins a20_p
{"PC2",  2, 2,  {"gpio_in", "gpio_out", "nand0", "spi0", NULL, NULL, 
NULL, NULL}},
{"PC3",  2, 3,  {"gpio_in", "gpio_out", "nand0", NULL, NULL, NULL, 
NULL, NULL}},
{"PC4",  2, 4,  {"gpio_in", "gpio_out", "nand0", NULL, NULL, NULL, 
NULL, NULL}},
-   {"PC5",  2, 5,  {"gpio_in", "gpio_out", "nand0", "mmc2", NULL, NULL, 
NULL, NULL}},
+   {"PC5",  2, 5,  {"gpio_in", "gpio_out", "nand0", NULL, NULL, NULL, 
NULL, NULL}},
{"PC6",  2, 6,  {"gpio_in", "gpio_out", "nand0", "mmc2", NULL, NULL, 
NULL, NULL}},
{"PC7",  2, 7,  {"gpio_in", "gpio_out", "nand0", "mmc2", NULL, NULL, 
NULL, NULL}},
{"PC8",  2, 8,  {"gpio_in", "gpio_out", "nand0", "mmc2", NULL, NULL, 
NULL, NULL}},
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305436 - in stable/11/sys: arm/allwinner arm/allwinner/a13 arm/allwinner/clk arm/conf conf

2016-09-05 Thread Emmanuel Vadot
Author: manu
Date: Mon Sep  5 20:17:18 2016
New Revision: 305436
URL: https://svnweb.freebsd.org/changeset/base/305436

Log:
  MFC r302472
  Add support for Allwinner A13.
  
  Reviewed by:  jmcneill
  Relnotes: yes
  Differential Revision:https://reviews.freebsd.org/D6809

Added:
  stable/11/sys/arm/allwinner/a13/
 - copied from r302472, head/sys/arm/allwinner/a13/
Modified:
  stable/11/sys/arm/allwinner/a10_codec.c
  stable/11/sys/arm/allwinner/a10_ehci.c
  stable/11/sys/arm/allwinner/a10_gpio.c
  stable/11/sys/arm/allwinner/allwinner_machdep.c
  stable/11/sys/arm/allwinner/aw_ccu.c
  stable/11/sys/arm/allwinner/clk/aw_gate.c
  stable/11/sys/arm/allwinner/clk/aw_pll.c
  stable/11/sys/arm/allwinner/clk/aw_usbclk.c
  stable/11/sys/arm/allwinner/std.a10
  stable/11/sys/arm/conf/A10
  stable/11/sys/conf/options.arm
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/allwinner/a10_codec.c
==
--- stable/11/sys/arm/allwinner/a10_codec.c Mon Sep  5 20:07:03 2016
(r305435)
+++ stable/11/sys/arm/allwinner/a10_codec.c Mon Sep  5 20:17:18 2016
(r305436)
@@ -720,13 +720,19 @@ CHANNEL_DECLARE(a10codec_chan);
  * Device interface
  */
 
+static struct ofw_compat_data compat_data[] = {
+   {"allwinner,sun4i-a10-codec", 1},
+   {"allwinner,sun7i-a20-codec", 1},
+   {NULL, 0},
+};
+
 static int
 a10codec_probe(device_t dev)
 {
if (!ofw_bus_status_okay(dev))
return (ENXIO);
 
-   if (!ofw_bus_is_compatible(dev, "allwinner,sun7i-a20-codec"))
+   if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
return (ENXIO);
 
device_set_desc(dev, "Allwinner Audio Codec");

Modified: stable/11/sys/arm/allwinner/a10_ehci.c
==
--- stable/11/sys/arm/allwinner/a10_ehci.c  Mon Sep  5 20:07:03 2016
(r305435)
+++ stable/11/sys/arm/allwinner/a10_ehci.c  Mon Sep  5 20:17:18 2016
(r305436)
@@ -112,6 +112,7 @@ static const struct aw_ehci_conf a31_ehc
 
 static struct ofw_compat_data compat_data[] = {
{ "allwinner,sun4i-a10-ehci",   (uintptr_t)_ehci_conf },
+   { "allwinner,sun5i-a13-ehci",   (uintptr_t)_ehci_conf },
{ "allwinner,sun6i-a31-ehci",   (uintptr_t)_ehci_conf },
{ "allwinner,sun7i-a20-ehci",   (uintptr_t)_ehci_conf },
{ "allwinner,sun8i-a83t-ehci",  (uintptr_t)_ehci_conf },

Modified: stable/11/sys/arm/allwinner/a10_gpio.c
==
--- stable/11/sys/arm/allwinner/a10_gpio.c  Mon Sep  5 20:07:03 2016
(r305435)
+++ stable/11/sys/arm/allwinner/a10_gpio.c  Mon Sep  5 20:17:18 2016
(r305436)
@@ -80,6 +80,11 @@ __FBSDID("$FreeBSD$");
 extern const struct allwinner_padconf a10_padconf;
 #endif
 
+/* Defined in a13_padconf.c */
+#ifdef SOC_ALLWINNER_A13
+extern const struct allwinner_padconf a13_padconf;
+#endif
+
 /* Defined in a20_padconf.c */
 #ifdef SOC_ALLWINNER_A20
 extern const struct allwinner_padconf a20_padconf;
@@ -115,6 +120,9 @@ static struct ofw_compat_data compat_dat
 #ifdef SOC_ALLWINNER_A10
{"allwinner,sun4i-a10-pinctrl", (uintptr_t)_padconf},
 #endif
+#ifdef SOC_ALLWINNER_A13
+   {"allwinner,sun5i-a13-pinctrl", (uintptr_t)_padconf},
+#endif
 #ifdef SOC_ALLWINNER_A20
{"allwinner,sun7i-a20-pinctrl", (uintptr_t)_padconf},
 #endif

Modified: stable/11/sys/arm/allwinner/allwinner_machdep.c
==
--- stable/11/sys/arm/allwinner/allwinner_machdep.c Mon Sep  5 20:07:03 
2016(r305435)
+++ stable/11/sys/arm/allwinner/allwinner_machdep.c Mon Sep  5 20:17:18 
2016(r305436)
@@ -68,6 +68,14 @@ a10_attach(platform_t plat)
 }
 
 static int
+a13_attach(platform_t plat)
+{
+   soc_type = ALLWINNERSOC_A13;
+   soc_family = ALLWINNERSOC_SUN5I;
+   return (0);
+}
+
+static int
 a20_attach(platform_t plat)
 {
soc_type = ALLWINNERSOC_A20;
@@ -169,6 +177,17 @@ static platform_method_t a10_methods[] =
 FDT_PLATFORM_DEF(a10, "a10", 0, "allwinner,sun4i-a10", 200);
 #endif
 
+#if defined(SOC_ALLWINNER_A13)
+static platform_method_t a13_methods[] = {
+   PLATFORMMETHOD(platform_attach, a13_attach),
+   PLATFORMMETHOD(platform_lastaddr,   allwinner_lastaddr),
+   PLATFORMMETHOD(platform_devmap_init,allwinner_devmap_init),
+
+   PLATFORMMETHOD_END,
+};
+FDT_PLATFORM_DEF(a13, "a13", 0, "allwinner,sun5i-a13", 200);
+#endif
+
 #if defined(SOC_ALLWINNER_A20)
 static platform_method_t a20_methods[] = {
PLATFORMMETHOD(platform_attach, a20_attach),

Modified: stable/11/sys/arm/allwinner/aw_ccu.c
==
--- 

svn commit: r305435 - stable/11/sys/arm/allwinner

2016-09-05 Thread Emmanuel Vadot
Author: manu
Date: Mon Sep  5 20:07:03 2016
New Revision: 305435
URL: https://svnweb.freebsd.org/changeset/base/305435

Log:
  MFC r302470
  Check that the pin function exists before setting it.
  This is needed for Allwinner A13 which has gpio pins with only "out" function.

Modified:
  stable/11/sys/arm/allwinner/a10_gpio.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/arm/allwinner/a10_gpio.c
==
--- stable/11/sys/arm/allwinner/a10_gpio.c  Mon Sep  5 19:42:35 2016
(r305434)
+++ stable/11/sys/arm/allwinner/a10_gpio.c  Mon Sep  5 20:07:03 2016
(r305435)
@@ -198,11 +198,15 @@ a10_gpio_get_function(struct a10_gpio_so
return (0);
 }
 
-static void
+static int
 a10_gpio_set_function(struct a10_gpio_softc *sc, uint32_t pin, uint32_t f)
 {
uint32_t bank, data, offset;
 
+   /* Check if the function exists in the padconf data */
+   if (sc->padconf->pins[pin].functions[f] == NULL)
+   return (EINVAL);
+
/* Must be called with lock held. */
A10_GPIO_LOCK_ASSERT(sc);
 
@@ -214,6 +218,8 @@ a10_gpio_set_function(struct a10_gpio_so
data &= ~(7 << offset);
data |= (f << offset);
A10_GPIO_WRITE(sc, A10_GPIO_GP_CFG(bank, pin >> 3), data);
+
+   return (0);
 }
 
 static uint32_t
@@ -275,9 +281,10 @@ a10_gpio_set_drv(struct a10_gpio_softc *
A10_GPIO_WRITE(sc, A10_GPIO_GP_DRV(bank, pin >> 4), val);
 }
 
-static void
+static int
 a10_gpio_pin_configure(struct a10_gpio_softc *sc, uint32_t pin, uint32_t flags)
 {
+   int err = 0;
 
/* Must be called with lock held. */
A10_GPIO_LOCK_ASSERT(sc);
@@ -285,11 +292,14 @@ a10_gpio_pin_configure(struct a10_gpio_s
/* Manage input/output. */
if (flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) {
if (flags & GPIO_PIN_OUTPUT)
-   a10_gpio_set_function(sc, pin, A10_GPIO_OUTPUT);
+   err = a10_gpio_set_function(sc, pin, A10_GPIO_OUTPUT);
else
-   a10_gpio_set_function(sc, pin, A10_GPIO_INPUT);
+   err = a10_gpio_set_function(sc, pin, A10_GPIO_INPUT);
}
 
+   if (err)
+   return (err);
+
/* Manage Pull-up/pull-down. */
if (flags & (GPIO_PIN_PULLUP | GPIO_PIN_PULLDOWN)) {
if (flags & GPIO_PIN_PULLUP)
@@ -298,6 +308,8 @@ a10_gpio_pin_configure(struct a10_gpio_s
a10_gpio_set_pud(sc, pin, A10_GPIO_PULLDOWN);
} else
a10_gpio_set_pud(sc, pin, A10_GPIO_NONE);
+
+   return (0);
 }
 
 static device_t
@@ -372,16 +384,17 @@ static int
 a10_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags)
 {
struct a10_gpio_softc *sc;
+   int err;
 
sc = device_get_softc(dev);
if (pin > sc->padconf->npins)
return (EINVAL);
 
A10_GPIO_LOCK(sc);
-   a10_gpio_pin_configure(sc, pin, flags);
+   err = a10_gpio_pin_configure(sc, pin, flags);
A10_GPIO_UNLOCK(sc);
 
-   return (0);
+   return (err);
 }
 
 static int
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305434 - head/sys/dev/usb/wlan

2016-09-05 Thread Andriy Voskoboinyk
Author: avos
Date: Mon Sep  5 19:42:35 2016
New Revision: 305434
URL: https://svnweb.freebsd.org/changeset/base/305434

Log:
  rum: do not restart device when protmode / rtsthreshold is changed.

Modified:
  head/sys/dev/usb/wlan/if_rum.c

Modified: head/sys/dev/usb/wlan/if_rum.c
==
--- head/sys/dev/usb/wlan/if_rum.c  Mon Sep  5 19:37:47 2016
(r305433)
+++ head/sys/dev/usb/wlan/if_rum.c  Mon Sep  5 19:42:35 2016
(r305434)
@@ -2692,6 +2692,8 @@ rum_reset(struct ieee80211vap *vap, u_lo
 
switch (cmd) {
case IEEE80211_IOC_POWERSAVE:
+   case IEEE80211_IOC_PROTMODE:
+   case IEEE80211_IOC_RTSTHRESHOLD:
error = 0;
break;
case IEEE80211_IOC_POWERSAVESLEEP:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305433 - head/sys/dev/cxgbe/tom

2016-09-05 Thread Navdeep Parhar
Author: np
Date: Mon Sep  5 19:37:47 2016
New Revision: 305433
URL: https://svnweb.freebsd.org/changeset/base/305433

Log:
  cxgbe/t4_tom: toepcb should be all-zero on allocation because the code
  that cleans up on failure assumes that non-NULL values indicate
  initialized items.
  
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/tom/t4_connect.c

Modified: head/sys/dev/cxgbe/tom/t4_connect.c
==
--- head/sys/dev/cxgbe/tom/t4_connect.c Mon Sep  5 18:42:21 2016
(r305432)
+++ head/sys/dev/cxgbe/tom/t4_connect.c Mon Sep  5 19:37:47 2016
(r305433)
@@ -332,7 +332,7 @@ t4_connect(struct toedev *tod, struct so
else
DONT_OFFLOAD_ACTIVE_OPEN(ENOTSUP);
 
-   toep = alloc_toepcb(vi, -1, -1, M_NOWAIT);
+   toep = alloc_toepcb(vi, -1, -1, M_NOWAIT | M_ZERO);
if (toep == NULL)
DONT_OFFLOAD_ACTIVE_OPEN(ENOMEM);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305432 - in head/sys/arm/ti: am335x cpsw

2016-09-05 Thread Luiz Otavio O Souza
Author: loos
Date: Mon Sep  5 18:42:21 2016
New Revision: 305432
URL: https://svnweb.freebsd.org/changeset/base/305432

Log:
  Revert r305119, move the control module register data to am335x_scm.h and
  fix if_cpsw.c to include the correct header.
  
  Discussed with:   bz

Modified:
  head/sys/arm/ti/am335x/am335x_scm.h
  head/sys/arm/ti/cpsw/if_cpsw.c
  head/sys/arm/ti/cpsw/if_cpswreg.h

Modified: head/sys/arm/ti/am335x/am335x_scm.h
==
--- head/sys/arm/ti/am335x/am335x_scm.h Mon Sep  5 18:05:45 2016
(r305431)
+++ head/sys/arm/ti/am335x/am335x_scm.h Mon Sep  5 18:42:21 2016
(r305432)
@@ -42,6 +42,8 @@
 #defineSCM_USB_STS00x624
 #defineSCM_USB_CTRL1   0x628
 #defineSCM_USB_STS10x62C
+#defineSCM_MAC_ID0_LO  0x630
+#defineSCM_MAC_ID0_HI  0x634
 #defineSCM_PWMSS_CTRL  0x664
 
 #endif /* __AM335X_SCM_H__ */

Modified: head/sys/arm/ti/cpsw/if_cpsw.c
==
--- head/sys/arm/ti/cpsw/if_cpsw.c  Mon Sep  5 18:05:45 2016
(r305431)
+++ head/sys/arm/ti/cpsw/if_cpsw.c  Mon Sep  5 18:42:21 2016
(r305432)
@@ -78,6 +78,9 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+#include 
+
 #include 
 #include 
 
@@ -87,8 +90,6 @@ __FBSDID("$FreeBSD$");
 
 #include "if_cpswreg.h"
 #include "if_cpswvar.h"
- 
-#include 
 
 #include "miibus_if.h"
 
@@ -1019,14 +1020,14 @@ cpswp_attach(device_t dev)
IFQ_SET_READY(>if_snd);
 
/* Get high part of MAC address from control module (mac_id[0|1]_hi) */
-   ti_scm_reg_read_4(CPSW_MAC_ID0_HI + sc->unit * 8, );
+   ti_scm_reg_read_4(SCM_MAC_ID0_HI + sc->unit * 8, );
mac_addr[0] = reg & 0xFF;
mac_addr[1] = (reg >>  8) & 0xFF;
mac_addr[2] = (reg >> 16) & 0xFF;
mac_addr[3] = (reg >> 24) & 0xFF;
 
/* Get low part of MAC address from control module (mac_id[0|1]_lo) */
-   ti_scm_reg_read_4(CPSW_MAC_ID0_LO + sc->unit * 8, );
+   ti_scm_reg_read_4(SCM_MAC_ID0_LO + sc->unit * 8, );
mac_addr[4] = reg & 0xFF;
mac_addr[5] = (reg >>  8) & 0xFF;
 

Modified: head/sys/arm/ti/cpsw/if_cpswreg.h
==
--- head/sys/arm/ti/cpsw/if_cpswreg.h   Mon Sep  5 18:05:45 2016
(r305431)
+++ head/sys/arm/ti/cpsw/if_cpswreg.h   Mon Sep  5 18:42:21 2016
(r305432)
@@ -46,9 +46,6 @@
 #defineCPSW_PORT_P_SA_LO(p)(CPSW_PORT_OFFSET + 0x120 + 
((p-1) * 0x100))
 #defineCPSW_PORT_P_SA_HI(p)(CPSW_PORT_OFFSET + 0x124 + 
((p-1) * 0x100))
 
-#defineCPSW_MAC_ID0_LO 0x0630
-#defineCPSW_MAC_ID0_HI 0x0634
-
 #defineCPSW_CPDMA_OFFSET   0x0800
 #defineCPSW_CPDMA_TX_CONTROL   (CPSW_CPDMA_OFFSET + 0x04)
 #defineCPSW_CPDMA_TX_TEARDOWN  (CPSW_CPDMA_OFFSET + 0x08)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r305368 - head/sys/kern

2016-09-05 Thread Mark Johnston
On Mon, Sep 05, 2016 at 10:30:24AM -0700, John Baldwin wrote:
> On Sunday, September 04, 2016 12:29:49 AM Mark Johnston wrote:
> > Author: markj
> > Date: Sun Sep  4 00:29:48 2016
> > New Revision: 305368
> > URL: https://svnweb.freebsd.org/changeset/base/305368
> > 
> > Log:
> >   Micro-optimize sleepq_signal().
> >   
> >   Lift a comparison out of the loop that finds the highest-priority thread
> >   on the queue.
> >   
> >   MFC after:1 week
> 
> Could this safely use TAILQ_FOREACH_FROM?

Are you suggesting something like this?

besttd = TAILQ_FIRST(>sq_blocked[queue]);
td = TAILQ_NEXT(besttd, td_slpq);
TAILQ_FOREACH_FROM(td, >sq_blocked[queue], td_slpq) {
...

I think that would work, and it avoids visiting the first element
unnecessarily when the queue contains more than one element. If the
queue contains one element, we'd visit it because of
TAILQ_FOREACH_FROM's surprising behaviour of iterating over the entire
queue when the listelem is NULL.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305430 - head/contrib/gcclibs/libcpp

2016-09-05 Thread Dimitry Andric
Author: dim
Date: Mon Sep  5 18:02:37 2016
New Revision: 305430
URL: https://svnweb.freebsd.org/changeset/base/305430

Log:
  Define libcpp's HAVE_DESIGNATED_INITIALIZERS in a defined and portable
  way.
  
  MFC after:3 days

Modified:
  head/contrib/gcclibs/libcpp/system.h

Modified: head/contrib/gcclibs/libcpp/system.h
==
--- head/contrib/gcclibs/libcpp/system.hMon Sep  5 17:56:52 2016
(r305429)
+++ head/contrib/gcclibs/libcpp/system.hMon Sep  5 18:02:37 2016
(r305430)
@@ -347,9 +347,12 @@ extern void abort (void);
??? C99 designated initializers are not supported by most C++
compilers, including G++.  -- gdr, 2005-05-18  */
 #if !defined(HAVE_DESIGNATED_INITIALIZERS)
-#define HAVE_DESIGNATED_INITIALIZERS \
-  ((!defined(__cplusplus) && (GCC_VERSION >= 2007)) \
-   || (__STDC_VERSION__ >= 199901L))
+# if (!defined(__cplusplus) && (GCC_VERSION >= 2007)) \
+ ||(__STDC_VERSION__ >= 199901L)
+#  define HAVE_DESIGNATED_INITIALIZERS 1
+# else
+#  define HAVE_DESIGNATED_INITIALIZERS 0
+# endif
 #endif
 
 /* Be conservative and only use enum bitfields with GCC.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305429 - in stable/9/usr.sbin/cron: cron crontab

2016-09-05 Thread Ed Maste
Author: emaste
Date: Mon Sep  5 17:56:52 2016
New Revision: 305429
URL: https://svnweb.freebsd.org/changeset/base/305429

Log:
  MFC r305269: cron: use existing maximum username constant MAXLOGNAME
  
  Previously cron had its own maximum username length limit, which was
  smaller than the system's MAXLOGNAME. This could lead to crontab -u
  updating the wrong user's crontab (if the name was truncated, and
  matched another user).
  
  PR:   212305
  Reported by:  Andrii Kuzik

Modified:
  stable/9/usr.sbin/cron/cron/cron.h
  stable/9/usr.sbin/cron/crontab/crontab.c
Directory Properties:
  stable/9/usr.sbin/cron/   (props changed)
  stable/9/usr.sbin/cron/crontab/   (props changed)

Modified: stable/9/usr.sbin/cron/cron/cron.h
==
--- stable/9/usr.sbin/cron/cron/cron.h  Mon Sep  5 17:20:12 2016
(r305428)
+++ stable/9/usr.sbin/cron/cron/cron.h  Mon Sep  5 17:56:52 2016
(r305429)
@@ -73,7 +73,6 @@
 #defineMAX_COMMAND 1000/* max length of internally generated 
cmd */
 #defineMAX_ENVSTR  1000/* max length of envvar=value\0 strings 
*/
 #defineMAX_TEMPSTR 100 /* obvious */
-#defineMAX_UNAME   20  /* max length of username, should be 
overkill */
 #defineROOT_UID0   /* don't change this, it really must be 
root */
 #defineROOT_USER   "root"  /* ditto */
 #defineSYS_NAME"*system*" /* magic owner name for system 
crontab */

Modified: stable/9/usr.sbin/cron/crontab/crontab.c
==
--- stable/9/usr.sbin/cron/crontab/crontab.cMon Sep  5 17:20:12 2016
(r305428)
+++ stable/9/usr.sbin/cron/crontab/crontab.cMon Sep  5 17:56:52 2016
(r305429)
@@ -28,6 +28,7 @@ static const char rcsid[] =
 
 #defineMAIN_PROGRAM
 
+#include 
 #include "cron.h"
 #include 
 #include 
@@ -57,7 +58,7 @@ static char   *Options[] = { "???", "list"
 
 
 static PID_T   Pid;
-static charUser[MAX_UNAME], RealUser[MAX_UNAME];
+static charUser[MAXLOGNAME], RealUser[MAXLOGNAME];
 static charFilename[MAX_FNAME];
 static FILE*NewCrontab;
 static int CheckErrorCount;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r305368 - head/sys/kern

2016-09-05 Thread John Baldwin
On Sunday, September 04, 2016 12:29:49 AM Mark Johnston wrote:
> Author: markj
> Date: Sun Sep  4 00:29:48 2016
> New Revision: 305368
> URL: https://svnweb.freebsd.org/changeset/base/305368
> 
> Log:
>   Micro-optimize sleepq_signal().
>   
>   Lift a comparison out of the loop that finds the highest-priority thread
>   on the queue.
>   
>   MFC after:  1 week

Could this safely use TAILQ_FOREACH_FROM?

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


svn commit: r305427 - in releng/11.0/usr.sbin/cron: cron crontab

2016-09-05 Thread Ed Maste
Author: emaste
Date: Mon Sep  5 16:43:57 2016
New Revision: 305427
URL: https://svnweb.freebsd.org/changeset/base/305427

Log:
  MFS r305423: cron: use existing maximum username constant MAXLOGNAME
  
  Previously cron had its own maximum username length limit, which was
  smaller than the system's MAXLOGNAME. This could lead to crontab -u
  updating the wrong user's crontab (if the name was truncated, and
  matched another user).
  
  PR:   212305
  Reported by:  Andrii Kuzik
  Approved by:  re (kib)
  MFH:  r305269

Modified:
  releng/11.0/usr.sbin/cron/cron/cron.h
  releng/11.0/usr.sbin/cron/crontab/crontab.c
Directory Properties:
  releng/11.0/   (props changed)

Modified: releng/11.0/usr.sbin/cron/cron/cron.h
==
--- releng/11.0/usr.sbin/cron/cron/cron.h   Mon Sep  5 16:06:52 2016
(r305426)
+++ releng/11.0/usr.sbin/cron/cron/cron.h   Mon Sep  5 16:43:57 2016
(r305427)
@@ -73,7 +73,6 @@
 #defineMAX_COMMAND 1000/* max length of internally generated 
cmd */
 #defineMAX_ENVSTR  1000/* max length of envvar=value\0 strings 
*/
 #defineMAX_TEMPSTR 100 /* obvious */
-#defineMAX_UNAME   20  /* max length of username, should be 
overkill */
 #defineROOT_UID0   /* don't change this, it really must be 
root */
 #defineROOT_USER   "root"  /* ditto */
 #defineSYS_NAME"*system*" /* magic owner name for system 
crontab */

Modified: releng/11.0/usr.sbin/cron/crontab/crontab.c
==
--- releng/11.0/usr.sbin/cron/crontab/crontab.c Mon Sep  5 16:06:52 2016
(r305426)
+++ releng/11.0/usr.sbin/cron/crontab/crontab.c Mon Sep  5 16:43:57 2016
(r305427)
@@ -28,6 +28,7 @@ static const char rcsid[] =
 
 #defineMAIN_PROGRAM
 
+#include 
 #include "cron.h"
 #include 
 #include 
@@ -57,7 +58,7 @@ static char   *Options[] = { "???", "list"
 
 
 static PID_T   Pid;
-static charUser[MAX_UNAME], RealUser[MAX_UNAME];
+static charUser[MAXLOGNAME], RealUser[MAXLOGNAME];
 static charFilename[MAX_FNAME];
 static FILE*NewCrontab;
 static int CheckErrorCount;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305426 - in head/sys: dev/bhnd/cores/usb mips/broadcom mips/conf

2016-09-05 Thread Michael Zhilin
Author: mizhka
Date: Mon Sep  5 16:06:52 2016
New Revision: 305426
URL: https://svnweb.freebsd.org/changeset/base/305426

Log:
  [BHND/USB] Port of EHCI/OHCI support from ZRouter
  
  This patch adds driver implementation for BHND USB core. Driver has been
  imported from ZRouter project with small adaptions for FreeBSD 11.
  
  Also it's enabled for BroadCom MIPS74k boards by default. It's fully tested
  on Asus boards (RT-N16: external USB, RT-N53: USB bus between SoC and WiFi
  chips).
  
  Reviewed by:adrian (mentor), ray
  Approved by:  adrian (mentor)
  Obtained from:ZRouter
  Differential Revision:  https://reviews.freebsd.org/D7781

Added:
  head/sys/dev/bhnd/cores/usb/
  head/sys/dev/bhnd/cores/usb/bhnd_ehci.c   (contents, props changed)
  head/sys/dev/bhnd/cores/usb/bhnd_ohci.c   (contents, props changed)
  head/sys/dev/bhnd/cores/usb/bhnd_usb.c   (contents, props changed)
  head/sys/dev/bhnd/cores/usb/bhnd_usbvar.h   (contents, props changed)
Modified:
  head/sys/mips/broadcom/files.broadcom
  head/sys/mips/conf/BCM

Added: head/sys/dev/bhnd/cores/usb/bhnd_ehci.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/bhnd/cores/usb/bhnd_ehci.c Mon Sep  5 16:06:52 2016
(r305426)
@@ -0,0 +1,267 @@
+/*-
+ * Copyright (C) 2008 MARVELL INTERNATIONAL LTD.
+ * Copyright (c) 2010, Aleksandr Rybalko 
+ * All rights reserved.
+ *
+ * Developed by Semihalf.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of MARVELL nor the names of contributors
+ *may be used to endorse or promote products derived from this software
+ *without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+/*
+ * BHND attachment driver for the USB Enhanced Host Controller.
+ * Ported from ZRouter with insignificant adaptations for FreeBSD11.
+ */
+
+#include "opt_bus.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#defineEHCI_HC_DEVSTR  "Broadcom EHCI"
+
+#defineUSB_BRIDGE_INTR_CAUSE   0x210
+#defineUSB_BRIDGE_INTR_MASK0x214
+
+static device_attach_t bhnd_ehci_attach;
+static device_detach_t bhnd_ehci_detach;
+
+static int bhnd_ehci_probe(device_t self);
+static voidbhnd_ehci_post_reset(struct ehci_softc *ehci_softc);
+
+static int
+bhnd_ehci_probe(device_t self)
+{
+
+   device_set_desc(self, EHCI_HC_DEVSTR);
+
+   return (BUS_PROBE_DEFAULT);
+}
+
+static void
+bhnd_ehci_post_reset(struct ehci_softc *ehci_softc)
+{
+uint32_t   usbmode;
+
+/* Force HOST mode */
+usbmode = EOREAD4(ehci_softc, EHCI_USBMODE_NOLPM);
+usbmode &= ~EHCI_UM_CM;
+usbmode |= EHCI_UM_CM_HOST;
+EOWRITE4(ehci_softc, EHCI_USBMODE_NOLPM, usbmode);
+}
+
+static int
+bhnd_ehci_attach(device_t self)
+{
+   ehci_softc_t*sc;
+   int  err;
+   int  rid;
+
+   sc = device_get_softc(self);
+   /* initialise some bus fields */
+   sc->sc_bus.parent = self;
+   sc->sc_bus.devices = sc->sc_devices;
+   sc->sc_bus.devices_max = EHCI_MAX_DEVICES;
+   sc->sc_bus.usbrev = USB_REV_2_0;
+   sc->sc_bus.dma_bits = 32;
+
+   /* get all DMA memory */
+   if ((err = usb_bus_mem_alloc_all(>sc_bus, USB_GET_DMA_TAG(self),
+   _iterate_hw_softc)) != 0) 

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

2016-09-05 Thread Mark Johnston
Author: markj
Date: Mon Sep  5 16:04:40 2016
New Revision: 305425
URL: https://svnweb.freebsd.org/changeset/base/305425

Log:
  Remove an unreachable return state from ARM's minidumpsys().
  
  Submitted by: Dominik Ermel 
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D7787

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

Modified: head/sys/arm/arm/minidump_machdep.c
==
--- head/sys/arm/arm/minidump_machdep.c Mon Sep  5 15:50:40 2016
(r305424)
+++ head/sys/arm/arm/minidump_machdep.c Mon Sep  5 16:04:40 2016
(r305425)
@@ -369,7 +369,6 @@ fail:
else
printf("\n** DUMP FAILED (ERROR %d) **\n", error);
return (error);
-   return (0);
 }
 
 void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305424 - in stable/10/usr.sbin/cron: cron crontab

2016-09-05 Thread Ed Maste
Author: emaste
Date: Mon Sep  5 15:50:40 2016
New Revision: 305424
URL: https://svnweb.freebsd.org/changeset/base/305424

Log:
  MFC r305269: cron: use existing maximum username constant MAXLOGNAME
  
  Previously cron had its own maximum username length limit, which was
  smaller than the system's MAXLOGNAME. This could lead to crontab -u
  updating the wrong user's crontab (if the name was truncated, and
  matched another user).
  
  PR:   212305
  Reported by:  Andrii Kuzik

Modified:
  stable/10/usr.sbin/cron/cron/cron.h
  stable/10/usr.sbin/cron/crontab/crontab.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/cron/cron/cron.h
==
--- stable/10/usr.sbin/cron/cron/cron.h Mon Sep  5 15:43:22 2016
(r305423)
+++ stable/10/usr.sbin/cron/cron/cron.h Mon Sep  5 15:50:40 2016
(r305424)
@@ -73,7 +73,6 @@
 #defineMAX_COMMAND 1000/* max length of internally generated 
cmd */
 #defineMAX_ENVSTR  1000/* max length of envvar=value\0 strings 
*/
 #defineMAX_TEMPSTR 100 /* obvious */
-#defineMAX_UNAME   20  /* max length of username, should be 
overkill */
 #defineROOT_UID0   /* don't change this, it really must be 
root */
 #defineROOT_USER   "root"  /* ditto */
 #defineSYS_NAME"*system*" /* magic owner name for system 
crontab */

Modified: stable/10/usr.sbin/cron/crontab/crontab.c
==
--- stable/10/usr.sbin/cron/crontab/crontab.c   Mon Sep  5 15:43:22 2016
(r305423)
+++ stable/10/usr.sbin/cron/crontab/crontab.c   Mon Sep  5 15:50:40 2016
(r305424)
@@ -28,6 +28,7 @@ static const char rcsid[] =
 
 #defineMAIN_PROGRAM
 
+#include 
 #include "cron.h"
 #include 
 #include 
@@ -57,7 +58,7 @@ static char   *Options[] = { "???", "list"
 
 
 static PID_T   Pid;
-static charUser[MAX_UNAME], RealUser[MAX_UNAME];
+static charUser[MAXLOGNAME], RealUser[MAXLOGNAME];
 static charFilename[MAX_FNAME];
 static FILE*NewCrontab;
 static int CheckErrorCount;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305423 - in stable/11/usr.sbin/cron: cron crontab

2016-09-05 Thread Ed Maste
Author: emaste
Date: Mon Sep  5 15:43:22 2016
New Revision: 305423
URL: https://svnweb.freebsd.org/changeset/base/305423

Log:
  MFC r305269: cron: use existing maximum username constant MAXLOGNAME
  
  Previously cron had its own maximum username length limit, which was
  smaller than the system's MAXLOGNAME. This could lead to crontab -u
  updating the wrong user's crontab (if the name was truncated, and
  matched another user).
  
  PR:   212305
  Reported by:  Andrii Kuzik

Modified:
  stable/11/usr.sbin/cron/cron/cron.h
  stable/11/usr.sbin/cron/crontab/crontab.c

Modified: stable/11/usr.sbin/cron/cron/cron.h
==
--- stable/11/usr.sbin/cron/cron/cron.h Mon Sep  5 15:40:41 2016
(r305422)
+++ stable/11/usr.sbin/cron/cron/cron.h Mon Sep  5 15:43:22 2016
(r305423)
@@ -73,7 +73,6 @@
 #defineMAX_COMMAND 1000/* max length of internally generated 
cmd */
 #defineMAX_ENVSTR  1000/* max length of envvar=value\0 strings 
*/
 #defineMAX_TEMPSTR 100 /* obvious */
-#defineMAX_UNAME   20  /* max length of username, should be 
overkill */
 #defineROOT_UID0   /* don't change this, it really must be 
root */
 #defineROOT_USER   "root"  /* ditto */
 #defineSYS_NAME"*system*" /* magic owner name for system 
crontab */

Modified: stable/11/usr.sbin/cron/crontab/crontab.c
==
--- stable/11/usr.sbin/cron/crontab/crontab.c   Mon Sep  5 15:40:41 2016
(r305422)
+++ stable/11/usr.sbin/cron/crontab/crontab.c   Mon Sep  5 15:43:22 2016
(r305423)
@@ -28,6 +28,7 @@ static const char rcsid[] =
 
 #defineMAIN_PROGRAM
 
+#include 
 #include "cron.h"
 #include 
 #include 
@@ -57,7 +58,7 @@ static char   *Options[] = { "???", "list"
 
 
 static PID_T   Pid;
-static charUser[MAX_UNAME], RealUser[MAX_UNAME];
+static charUser[MAXLOGNAME], RealUser[MAXLOGNAME];
 static charFilename[MAX_FNAME];
 static FILE*NewCrontab;
 static int CheckErrorCount;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305422 - in head: contrib/libarchive contrib/libarchive/libarchive contrib/libarchive/libarchive/test lib/libarchive

2016-09-05 Thread Martin Matuska
Author: mm
Date: Mon Sep  5 15:40:41 2016
New Revision: 305422
URL: https://svnweb.freebsd.org/changeset/base/305422

Log:
  MFV r305420:
  Sync libarchive with vendor
  
  Vendor issues fixed:
  PR #777: Multiple bugfixes for setup_acls()
  
  This includes a bugfix for a bug that caused ACLs not to be read properly
  for files and directories inside subdirectories and as a result not being
  stored or being incorrectly stored in tar archives.
  
  MFC after:3 days

Added:
  head/contrib/libarchive/README.md
 - copied unchanged from r305420, vendor/libarchive/dist/README.md
Deleted:
  head/contrib/libarchive/README
Modified:
  head/contrib/libarchive/libarchive/archive_acl.c
  head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c
  head/contrib/libarchive/libarchive/archive_read_disk_posix.c
  head/contrib/libarchive/libarchive/test/test_acl_freebsd_posix1e.c
  head/lib/libarchive/config_freebsd.h
Directory Properties:
  head/contrib/libarchive/   (props changed)
  head/contrib/libarchive/libarchive/   (props changed)

Copied: head/contrib/libarchive/README.md (from r305420, 
vendor/libarchive/dist/README.md)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/contrib/libarchive/README.md   Mon Sep  5 15:40:41 2016
(r305422, copy of r305420, vendor/libarchive/dist/README.md)
@@ -0,0 +1,222 @@
+# Welcome to libarchive!
+
+The libarchive project develops a portable, efficient C library that
+can read and write streaming archives in a variety of formats.  It
+also includes implementations of the common `tar`, `cpio`, and `zcat`
+command-line tools that use the libarchive library.
+
+## Questions?  Issues?
+
+* http://www.libarchive.org is the home for ongoing
+  libarchive development, including documentation,
+  and links to the libarchive mailing lists.
+* To report an issue, use the issue tracker at
+  https://github.com/libarchive/libarchive/issues
+* To submit an enhancement to libarchive, please
+  submit a pull request via GitHub: 
https://github.com/libarchive/libarchive/pulls
+
+## Contents of the Distribution
+
+This distribution bundle includes the following major components:
+
+* **libarchive**: a library for reading and writing streaming archives
+* **tar**: the 'bsdtar' program is a full-featured 'tar' implementation built 
on libarchive
+* **cpio**: the 'bsdcpio' program is a different interface to essentially the 
same functionality
+* **cat**: the 'bsdcat' program is a simple replacement tool for zcat, bzcat, 
xzcat, and such
+* **examples**: Some small example programs that you may find useful.
+* **examples/minitar**: a compact sample demonstrating use of libarchive.
+* **contrib**:  Various items sent to me by third parties; please contact the 
authors with any questions.
+
+The top-level directory contains the following information files:
+
+* **NEWS** - highlights of recent changes
+* **COPYING** - what you can do with this
+* **INSTALL** - installation instructions
+* **README** - this file
+* **CMakeLists.txt** - input for "cmake" build tool, see INSTALL
+* **configure** - configuration script, see INSTALL for details.  If your copy 
of the source lacks a `configure` script, you can try to construct it by 
running the script in `build/autogen.sh` (or use `cmake`).
+
+The following files in the top-level directory are used by the 'configure' 
script:
+* `Makefile.am`, `aclocal.m4`, `configure.ac` - used to build this 
distribution, only needed by maintainers
+* `Makefile.in`, `config.h.in` - templates used by configure script
+
+## Documentation
+
+In addition to the informational articles and documentation
+in the online [libarchive Wiki](https://github.com/libarchive/libarchive/wiki),
+the distribution also includes a number of manual pages:
+
+ * bsdtar.1 explains the use of the bsdtar program
+ * bsdcpio.1 explains the use of the bsdcpio program
+ * bsdcat.1 explains the use of the bsdcat program
+ * libarchive.3 gives an overview of the library as a whole
+ * archive_read.3, archive_write.3, archive_write_disk.3, and
+   archive_read_disk.3 provide detailed calling sequences for the read
+   and write APIs
+ * archive_entry.3 details the "struct archive_entry" utility class
+ * archive_internals.3 provides some insight into libarchive's
+   internal structure and operation.
+ * libarchive-formats.5 documents the file formats supported by the library
+ * cpio.5, mtree.5, and tar.5 provide detailed information about these
+   popular archive formats, including hard-to-find details about
+   modern cpio and tar variants.
+
+The manual pages above are provided in the 'doc' directory in
+a number of different formats.
+
+You should also read the copious comments in `archive.h` and the
+source code for the sample programs for more details.  Please let us
+know about any errors or omissions you find.
+
+## Supported Formats
+
+Currently, the library 

svn commit: r305421 - in head/sys: dev/usb dev/usb/template sys

2016-09-05 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Sep  5 15:35:58 2016
New Revision: 305421
URL: https://svnweb.freebsd.org/changeset/base/305421

Log:
  Resolve deadlock between device_detach() and usbd_do_request_flags()
  by reviving the SX control request lock and refining which lock
  protects the common scratch area in "struct usb_device".
  
  The SX control request lock was removed by r246759 because it caused a
  lock order reversal with the USB enumeration lock inside
  usbd_transfer_setup() as a function of r246616. It was thought that
  reducing the number of locks would resolve the LOR, but because some
  USB device drivers use usbd_do_request_flags() inside callback
  functions, like in taskqueues, a deadlock may occur when these are
  drained from device_detach(). By restoring the SX control request
  lock usbd_do_request_flags() is allowed to complete its execution
  when a USB device driver is detaching. By using the SX control request
  lock to protect the scratch area, the LOR introduced by r246616 is
  also resolved.
  
  Bump the FreeBSD version while at it to force recompilation of all USB
  kernel modules.
  
  Found by: avos@
  MFC after:1 week

Modified:
  head/sys/dev/usb/template/usb_template.c
  head/sys/dev/usb/usb_device.c
  head/sys/dev/usb/usb_device.h
  head/sys/dev/usb/usb_generic.c
  head/sys/dev/usb/usb_request.c
  head/sys/dev/usb/usb_transfer.c
  head/sys/dev/usb/usb_util.c
  head/sys/sys/param.h

Modified: head/sys/dev/usb/template/usb_template.c
==
--- head/sys/dev/usb/template/usb_template.cMon Sep  5 15:20:55 2016
(r305420)
+++ head/sys/dev/usb/template/usb_template.cMon Sep  5 15:35:58 2016
(r305421)
@@ -1245,7 +1245,7 @@ usb_temp_setup(struct usb_device *udev,
return (0);
 
/* Protect scratch area */
-   do_unlock = usbd_enum_lock(udev);
+   do_unlock = usbd_ctrl_lock(udev);
 
uts = udev->scratch.temp_setup;
 
@@ -1324,7 +1324,7 @@ done:
if (error)
usb_temp_unsetup(udev);
if (do_unlock)
-   usbd_enum_unlock(udev);
+   usbd_ctrl_unlock(udev);
return (error);
 }
 

Modified: head/sys/dev/usb/usb_device.c
==
--- head/sys/dev/usb/usb_device.c   Mon Sep  5 15:20:55 2016
(r305420)
+++ head/sys/dev/usb/usb_device.c   Mon Sep  5 15:35:58 2016
(r305421)
@@ -1585,6 +1585,7 @@ usb_alloc_device(device_t parent_dev, st
/* initialise our SX-lock */
sx_init_flags(>enum_sx, "USB config SX lock", SX_DUPOK);
sx_init_flags(>sr_sx, "USB suspend and resume SX lock", 
SX_NOWITNESS);
+   sx_init_flags(>ctrl_sx, "USB control transfer SX lock", SX_DUPOK);
 
cv_init(>ctrlreq_cv, "WCTRL");
cv_init(>ref_cv, "UGONE");
@@ -1770,7 +1771,7 @@ usb_alloc_device(device_t parent_dev, st
 */
 
/* Protect scratch area */
-   do_unlock = usbd_enum_lock(udev);
+   do_unlock = usbd_ctrl_lock(udev);
 
scratch_ptr = udev->scratch.data;
 
@@ -1821,7 +1822,7 @@ usb_alloc_device(device_t parent_dev, st
}
 
if (do_unlock)
-   usbd_enum_unlock(udev);
+   usbd_ctrl_unlock(udev);
 
/* assume 100mA bus powered for now. Changed when configured. */
udev->power = USB_MIN_POWER;
@@ -2195,6 +2196,7 @@ usb_free_device(struct usb_device *udev,

sx_destroy(>enum_sx);
sx_destroy(>sr_sx);
+   sx_destroy(>ctrl_sx);
 
cv_destroy(>ctrlreq_cv);
cv_destroy(>ref_cv);
@@ -2358,7 +2360,7 @@ usbd_set_device_strings(struct usb_devic
uint8_t do_unlock;
 
/* Protect scratch area */
-   do_unlock = usbd_enum_lock(udev);
+   do_unlock = usbd_ctrl_lock(udev);
 
temp_ptr = (char *)udev->scratch.data;
temp_size = sizeof(udev->scratch.data);
@@ -2418,7 +2420,7 @@ usbd_set_device_strings(struct usb_devic
}
 
if (do_unlock)
-   usbd_enum_unlock(udev);
+   usbd_ctrl_unlock(udev);
 }
 
 /*
@@ -2825,6 +2827,40 @@ usbd_enum_is_locked(struct usb_device *u
 }
 
 /*
+ * The following function is used to serialize access to USB control
+ * transfers and the USB scratch area. If the lock is already grabbed
+ * this function returns zero. Else a value of one is returned.
+ */
+uint8_t
+usbd_ctrl_lock(struct usb_device *udev)
+{
+   if (sx_xlocked(>ctrl_sx))
+   return (0);
+   sx_xlock(>ctrl_sx);
+
+   /*
+* We need to allow suspend and resume at this point, else the
+* control transfer will timeout if the device is suspended!
+*/
+   if (usbd_enum_is_locked(udev))
+   usbd_sr_unlock(udev);
+   return (1);
+}
+
+void
+usbd_ctrl_unlock(struct usb_device *udev)
+{
+   sx_xunlock(>ctrl_sx);
+
+   /*
+* Restore the suspend and resume lock 

svn commit: r305420 - in vendor/libarchive/dist: . build/cmake libarchive libarchive/test

2016-09-05 Thread Martin Matuska
Author: mm
Date: Mon Sep  5 15:20:55 2016
New Revision: 305420
URL: https://svnweb.freebsd.org/changeset/base/305420

Log:
  Update vendor/libarchive to git b4099917d6893ed77af24caff1156e044ebd4fa5
  
  Vendor issues fixed:
  PR #777: Multiple bugfixes for setup_acls()
  
  This fixes a bug that caused ACLs not to be read properly for files and
  directories inside subdirectories and as a result not being stored in tar
  archives.

Added:
  vendor/libarchive/dist/README.md
Deleted:
  vendor/libarchive/dist/README
Modified:
  vendor/libarchive/dist/CMakeLists.txt
  vendor/libarchive/dist/build/cmake/config.h.in
  vendor/libarchive/dist/configure.ac
  vendor/libarchive/dist/libarchive/archive_acl.c
  vendor/libarchive/dist/libarchive/archive_read_disk_entry_from_file.c
  vendor/libarchive/dist/libarchive/archive_read_disk_posix.c
  vendor/libarchive/dist/libarchive/config_freebsd.h
  vendor/libarchive/dist/libarchive/test/test_acl_freebsd_posix1e.c

Modified: vendor/libarchive/dist/CMakeLists.txt
==
--- vendor/libarchive/dist/CMakeLists.txt   Mon Sep  5 13:45:45 2016
(r305419)
+++ vendor/libarchive/dist/CMakeLists.txt   Mon Sep  5 15:20:55 2016
(r305420)
@@ -1278,6 +1278,10 @@ CHECK_C_SOURCE_COMPILES(
   "#include \n#include \nint main(void) { struct 
vfsconf v; return sizeof(v);}"
   HAVE_STRUCT_VFSCONF)
 
+CHECK_C_SOURCE_COMPILES(
+  "#include \n#include \nint main(void) { struct 
xvfsconf v; return sizeof(v);}"
+  HAVE_STRUCT_XVFSCONF)
+
 # Make sure we have the POSIX version of readdir_r, not the
 # older 2-argument version.
 CHECK_C_SOURCE_COMPILES(
@@ -1600,6 +1604,7 @@ IF(ENABLE_ACL)
   # test for specific permissions in a permset.)  Linux uses the obvious
   # name, FreeBSD adds _np to mark it as "non-Posix extension."
   # Test for both as a double-check that we really have POSIX-style ACL 
support.
+  CHECK_FUNCTION_EXISTS(acl_get_fd_np HAVE_ACL_GET_FD_NP)
   CHECK_FUNCTION_EXISTS(acl_get_perm HAVE_ACL_GET_PERM)
   CHECK_FUNCTION_EXISTS(acl_get_perm_np HAVE_ACL_GET_PERM_NP)
   CHECK_FUNCTION_EXISTS(acl_get_link HAVE_ACL_GET_LINK)

Added: vendor/libarchive/dist/README.md
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ vendor/libarchive/dist/README.mdMon Sep  5 15:20:55 2016
(r305420)
@@ -0,0 +1,222 @@
+# Welcome to libarchive!
+
+The libarchive project develops a portable, efficient C library that
+can read and write streaming archives in a variety of formats.  It
+also includes implementations of the common `tar`, `cpio`, and `zcat`
+command-line tools that use the libarchive library.
+
+## Questions?  Issues?
+
+* http://www.libarchive.org is the home for ongoing
+  libarchive development, including documentation,
+  and links to the libarchive mailing lists.
+* To report an issue, use the issue tracker at
+  https://github.com/libarchive/libarchive/issues
+* To submit an enhancement to libarchive, please
+  submit a pull request via GitHub: 
https://github.com/libarchive/libarchive/pulls
+
+## Contents of the Distribution
+
+This distribution bundle includes the following major components:
+
+* **libarchive**: a library for reading and writing streaming archives
+* **tar**: the 'bsdtar' program is a full-featured 'tar' implementation built 
on libarchive
+* **cpio**: the 'bsdcpio' program is a different interface to essentially the 
same functionality
+* **cat**: the 'bsdcat' program is a simple replacement tool for zcat, bzcat, 
xzcat, and such
+* **examples**: Some small example programs that you may find useful.
+* **examples/minitar**: a compact sample demonstrating use of libarchive.
+* **contrib**:  Various items sent to me by third parties; please contact the 
authors with any questions.
+
+The top-level directory contains the following information files:
+
+* **NEWS** - highlights of recent changes
+* **COPYING** - what you can do with this
+* **INSTALL** - installation instructions
+* **README** - this file
+* **CMakeLists.txt** - input for "cmake" build tool, see INSTALL
+* **configure** - configuration script, see INSTALL for details.  If your copy 
of the source lacks a `configure` script, you can try to construct it by 
running the script in `build/autogen.sh` (or use `cmake`).
+
+The following files in the top-level directory are used by the 'configure' 
script:
+* `Makefile.am`, `aclocal.m4`, `configure.ac` - used to build this 
distribution, only needed by maintainers
+* `Makefile.in`, `config.h.in` - templates used by configure script
+
+## Documentation
+
+In addition to the informational articles and documentation
+in the online [libarchive Wiki](https://github.com/libarchive/libarchive/wiki),
+the distribution also includes a number of manual pages:
+
+ * bsdtar.1 explains the use of the bsdtar program
+ * bsdcpio.1 explains the use of the bsdcpio program
+ * 

svn commit: r305419 - in head/sys/arm: allwinner conf

2016-09-05 Thread Jared McNeill
Author: jmcneill
Date: Mon Sep  5 13:45:45 2016
New Revision: 305419
URL: https://svnweb.freebsd.org/changeset/base/305419

Log:
  Add sy8106a to Allwinner kernel. This regulator is used to control VDD_CPUX
  and is connected to R_TWI on some H3-based Orange Pi boards.

Modified:
  head/sys/arm/allwinner/files.allwinner
  head/sys/arm/conf/ALLWINNER

Modified: head/sys/arm/allwinner/files.allwinner
==
--- head/sys/arm/allwinner/files.allwinner  Mon Sep  5 13:39:54 2016
(r305418)
+++ head/sys/arm/allwinner/files.allwinner  Mon Sep  5 13:45:45 2016
(r305419)
@@ -28,6 +28,7 @@ dev/usb/controller/generic_ohci.c option
 dev/usb/controller/generic_usb_if.moptionalohci
 arm/allwinner/aw_sid.c standard
 arm/allwinner/aw_thermal.c standard
+dev/iicbus/sy8106a.c   optionalsy8106a
 #arm/allwinner/console.c   standard
 
 arm/allwinner/a10_fb.c optionalvt

Modified: head/sys/arm/conf/ALLWINNER
==
--- head/sys/arm/conf/ALLWINNER Mon Sep  5 13:39:54 2016(r305418)
+++ head/sys/arm/conf/ALLWINNER Mon Sep  5 13:45:45 2016(r305419)
@@ -81,6 +81,7 @@ devicetwsi
 device rsb
 device axp209  # AXP209 Power Management Unit
 device axp81x  # AXP813/818 Power Management Unit
+device sy8106a # SY8106A Buck Regulator
 
 # GPIO
 device gpio
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305418 - head/sys/dev/iicbus

2016-09-05 Thread Jared McNeill
Author: jmcneill
Date: Mon Sep  5 13:39:54 2016
New Revision: 305418
URL: https://svnweb.freebsd.org/changeset/base/305418

Log:
  Add driver for Silergy Corp. SY8106A buck regulator.

Added:
  head/sys/dev/iicbus/sy8106a.c   (contents, props changed)

Added: head/sys/dev/iicbus/sy8106a.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/iicbus/sy8106a.c   Mon Sep  5 13:39:54 2016
(r305418)
@@ -0,0 +1,302 @@
+/*-
+ * Copyright (c) 2016 Jared McNeill 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * Silergy Corp. SY8106A buck regulator
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+#include "iicbus_if.h"
+#include "regdev_if.h"
+
+#defineVOUT1_SEL   0x01
+#define SEL_GO (1 << 7)
+#define SEL_VOLTAGE_MASK   0x7f
+#define SEL_VOLTAGE_BASE   68  /* uV */
+#define SEL_VOLTAGE_STEP   1   /* uV */
+#defineVOUT_COM0x02
+#define COM_DISABLE(1 << 0)
+#defineSYS_STATUS  0x06
+
+static struct ofw_compat_data compat_data[] = {
+   { "silergy,sy8106a",1 },
+   { NULL, 0 }
+};
+
+struct sy8106a_reg_sc {
+   struct regnode  *regnode;
+   device_tbase_dev;
+   phandle_t   xref;
+   struct regnode_std_param *param;
+};
+
+struct sy8106a_softc {
+   uint16_taddr;
+
+   /* Regulator */
+   struct sy8106a_reg_sc   *reg;
+};
+
+static int
+sy8106a_read(device_t dev, uint8_t reg, uint8_t *data, uint8_t size)
+{
+   struct sy8106a_softc *sc;
+   struct iic_msg msg[2];
+
+   sc = device_get_softc(dev);
+
+   msg[0].slave = sc->addr;
+   msg[0].flags = IIC_M_WR;
+   msg[0].len = 1;
+   msg[0].buf = 
+
+   msg[1].slave = sc->addr;
+   msg[1].flags = IIC_M_RD;
+   msg[1].len = size;
+   msg[1].buf = data;
+
+   return (iicbus_transfer(dev, msg, 2));
+}
+
+static int
+sy8106a_write(device_t dev, uint8_t reg, uint8_t val)
+{
+   struct sy8106a_softc *sc;
+   struct iic_msg msg;
+   uint8_t buffer[2];
+
+   sc = device_get_softc(dev);
+
+   buffer[0] = reg;
+   buffer[1] = val;
+
+   msg.slave = sc->addr;
+   msg.flags = IIC_M_WR;
+   msg.len = 2;
+   msg.buf = buffer;
+
+   return (iicbus_transfer(dev, , 1));
+}
+
+static int
+sy8106a_regnode_init(struct regnode *regnode)
+{
+   return (0);
+}
+
+static int
+sy8106a_regnode_enable(struct regnode *regnode, bool enable, int *udelay)
+{
+   struct sy8106a_reg_sc *sc;
+   uint8_t val;
+
+   sc = regnode_get_softc(regnode);
+
+   sy8106a_read(sc->base_dev, VOUT_COM, , 1);
+   if (enable)
+   val &= ~COM_DISABLE;
+   else
+   val |= COM_DISABLE;
+   sy8106a_write(sc->base_dev, VOUT_COM, val);
+
+   *udelay = sc->param->ramp_delay;
+
+   return (0);
+}
+
+static int
+sy8106a_regnode_set_voltage(struct regnode *regnode, int min_uvolt,
+int max_uvolt, int *udelay)
+{
+   struct sy8106a_reg_sc *sc;
+   int cur_uvolt;
+   uint8_t val, oval;
+
+   sc = regnode_get_softc(regnode);
+
+   /* Get current voltage */
+   sy8106a_read(sc->base_dev, VOUT1_SEL, , 1);
+   cur_uvolt = (oval & SEL_VOLTAGE_MASK) * SEL_VOLTAGE_STEP +
+   SEL_VOLTAGE_BASE;
+
+   /* Set new voltage */
+

svn commit: r305417 - head/sys/arm/allwinner/clk

2016-09-05 Thread Jared McNeill
Author: jmcneill
Date: Mon Sep  5 12:36:54 2016
New Revision: 305417
URL: https://svnweb.freebsd.org/changeset/base/305417

Log:
  Add support for Allwinner H3 PLL_CPUX.
  
  The H3 PLL_CPUX register looks exactly like the one found in A23, but we
  need to follow a specific protocol when making adjustments to the clock.

Modified:
  head/sys/arm/allwinner/clk/aw_pll.c

Modified: head/sys/arm/allwinner/clk/aw_pll.c
==
--- head/sys/arm/allwinner/clk/aw_pll.c Mon Sep  5 11:05:14 2016
(r305416)
+++ head/sys/arm/allwinner/clk/aw_pll.c Mon Sep  5 12:36:54 2016
(r305417)
@@ -187,6 +187,7 @@ static struct aw_pll_factor aw_a23_pll1_
PLLFACTOR(16, 1, 0, 0, 81600),
PLLFACTOR(20, 1, 0, 0, 100800),
PLLFACTOR(24, 1, 0, 0, 12),
+   PLLFACTOR(26, 1, 0, 0, 129600),
 };
 
 enum aw_pll_type {
@@ -201,6 +202,7 @@ enum aw_pll_type {
AWPLL_A31_PLL6,
AWPLL_A64_PLLHSIC,
AWPLL_A80_PLL4,
+   AWPLL_H3_PLL1,
 };
 
 struct aw_pll_sc {
@@ -627,6 +629,72 @@ a23_pll1_recalc(struct aw_pll_sc *sc, ui
 }
 
 static int
+h3_pll1_set_freq(struct aw_pll_sc *sc, uint64_t fin, uint64_t *fout,
+int flags)
+{
+   struct aw_pll_factor *f;
+   uint32_t val, n, k, m, p;
+   int i;
+
+   f = NULL;
+   for (i = 0; i < nitems(aw_a23_pll1_factors); i++) {
+   if (aw_a23_pll1_factors[i].freq == *fout) {
+   f = _a23_pll1_factors[i];
+   break;
+   }
+   }
+   if (f == NULL)
+   return (EINVAL);
+
+   DEVICE_LOCK(sc);
+   PLL_READ(sc, );
+
+   n = (val & A23_PLL1_FACTOR_N) >> A23_PLL1_FACTOR_N_SHIFT;
+   k = (val & A23_PLL1_FACTOR_K) >> A23_PLL1_FACTOR_K_SHIFT;
+   m = (val & A23_PLL1_FACTOR_M) >> A23_PLL1_FACTOR_M_SHIFT;
+   p = (val & A23_PLL1_FACTOR_P) >> A23_PLL1_FACTOR_P_SHIFT;
+
+   if (p < f->p) {
+   val &= ~A23_PLL1_FACTOR_P;
+   val |= (f->p << A23_PLL1_FACTOR_P_SHIFT);
+   PLL_WRITE(sc, val);
+   DELAY(2000);
+   }
+
+   if (m < f->m) {
+   val &= ~A23_PLL1_FACTOR_M;
+   val |= (f->m << A23_PLL1_FACTOR_M_SHIFT);
+   PLL_WRITE(sc, val);
+   DELAY(2000);
+   }
+
+   val &= ~(A23_PLL1_FACTOR_N|A23_PLL1_FACTOR_K);
+   val |= (f->n << A23_PLL1_FACTOR_N_SHIFT);
+   val |= (f->k << A23_PLL1_FACTOR_K_SHIFT);
+   PLL_WRITE(sc, val);
+   DELAY(2000);
+
+   if (m > f->m) {
+   val &= ~A23_PLL1_FACTOR_M;
+   val |= (f->m << A23_PLL1_FACTOR_M_SHIFT);
+   PLL_WRITE(sc, val);
+   DELAY(2000);
+   }
+
+   if (p > f->p) {
+   val &= ~A23_PLL1_FACTOR_P;
+   val |= (f->p << A23_PLL1_FACTOR_P_SHIFT);
+   PLL_WRITE(sc, val);
+   DELAY(2000);
+   }
+
+   DEVICE_UNLOCK(sc);
+
+   return (0);
+   
+}
+
+static int
 a31_pll1_recalc(struct aw_pll_sc *sc, uint64_t *freq)
 {
uint32_t val, m, n, k;
@@ -775,6 +843,7 @@ static struct aw_pll_funcs aw_pll_func[]
PLL(AWPLL_A31_PLL6, a31_pll6_recalc, NULL, a31_pll6_init),
PLL(AWPLL_A80_PLL4, a80_pll4_recalc, NULL, NULL),
PLL(AWPLL_A64_PLLHSIC, a64_pllhsic_recalc, NULL, a64_pllhsic_init),
+   PLL(AWPLL_H3_PLL1, a23_pll1_recalc, h3_pll1_set_freq, NULL),
 };
 
 static struct ofw_compat_data compat_data[] = {
@@ -787,6 +856,7 @@ static struct ofw_compat_data compat_dat
{ "allwinner,sun6i-a31-pll1-clk",   AWPLL_A31_PLL1 },
{ "allwinner,sun6i-a31-pll6-clk",   AWPLL_A31_PLL6 },
{ "allwinner,sun8i-a23-pll1-clk",   AWPLL_A23_PLL1 },
+   { "allwinner,sun8i-h3-pll1-clk",AWPLL_H3_PLL1 },
{ "allwinner,sun9i-a80-pll4-clk",   AWPLL_A80_PLL4 },
{ "allwinner,sun50i-a64-pllhsic-clk",   AWPLL_A64_PLLHSIC },
{ NULL, 0 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305416 - in head/sys/arm/allwinner: . clk

2016-09-05 Thread Jared McNeill
Author: jmcneill
Date: Mon Sep  5 11:05:14 2016
New Revision: 305416
URL: https://svnweb.freebsd.org/changeset/base/305416

Log:
  Add support for the Allwinner H3 Thermal Sensor Controller. The H3 embeds
  a single thermal sensor located in the CPU.

Modified:
  head/sys/arm/allwinner/aw_thermal.c
  head/sys/arm/allwinner/clk/aw_thsclk.c
  head/sys/arm/allwinner/files.allwinner

Modified: head/sys/arm/allwinner/aw_thermal.c
==
--- head/sys/arm/allwinner/aw_thermal.c Mon Sep  5 08:42:36 2016
(r305415)
+++ head/sys/arm/allwinner/aw_thermal.c Mon Sep  5 11:05:14 2016
(r305416)
@@ -82,16 +82,26 @@ __FBSDID("$FreeBSD$");
 #defineA83T_FILTER 0x4
 #defineA83T_INTC   0x1000
 #defineA83T_TEMP_BASE  2719000
+#defineA83T_TEMP_MUL   1000
 #defineA83T_TEMP_DIV   14186
 #defineA83T_CLK_RATE   2400
 
 #defineA64_ADC_ACQUIRE_TIME0x190
 #defineA64_FILTER  0x6
-#define A64_INTC   0x18000
+#defineA64_INTC0x18000
 #defineA64_TEMP_BASE   217
+#defineA64_TEMP_MUL1000
 #defineA64_TEMP_DIV8560
 #defineA64_CLK_RATE400
 
+#defineH3_ADC_ACQUIRE_TIME 0x3f
+#defineH3_FILTER   0x6
+#defineH3_INTC 0x191000
+#defineH3_TEMP_BASE21700
+#defineH3_TEMP_MUL 121168
+#defineH3_TEMP_DIV 100
+#defineH3_CLK_RATE 400
+
 #defineTEMP_C_TO_K 273
 #defineSENSOR_ENABLE_ALL   (SENSOR0_EN|SENSOR1_EN|SENSOR2_EN)
 #defineSHUT_INT_ALL
(SHUT_INT0_STS|SHUT_INT1_STS|SHUT_INT2_STS)
@@ -110,8 +120,10 @@ struct aw_thermal_config {
uint32_tadc_acquire_time;
uint32_tfilter;
uint32_tintc;
-   uint32_ttemp_base;
-   uint32_ttemp_div;
+   int temp_base;
+   int temp_mul;
+   int temp_div;
+   int calib;
 };
 
 static const struct aw_thermal_config a83t_config = {
@@ -135,7 +147,9 @@ static const struct aw_thermal_config a8
.filter = A83T_FILTER,
.intc = A83T_INTC,
.temp_base = A83T_TEMP_BASE,
+   .temp_mul = A83T_TEMP_MUL,
.temp_div = A83T_TEMP_DIV,
+   .calib = 1,
 };
 
 static const struct aw_thermal_config a64_config = {
@@ -159,11 +173,30 @@ static const struct aw_thermal_config a6
.filter = A64_FILTER,
.intc = A64_INTC,
.temp_base = A64_TEMP_BASE,
+   .temp_mul = A64_TEMP_MUL,
.temp_div = A64_TEMP_DIV,
 };
 
+static const struct aw_thermal_config h3_config = {
+   .nsensors = 1,
+   .sensors = {
+   [0] = {
+   .name = "cpu",
+   .desc = "CPU temperature",
+   },
+   },
+   .clk_rate = H3_CLK_RATE,
+   .adc_acquire_time = H3_ADC_ACQUIRE_TIME,
+   .filter = H3_FILTER,
+   .intc = H3_INTC,
+   .temp_base = H3_TEMP_BASE,
+   .temp_mul = H3_TEMP_MUL,
+   .temp_div = H3_TEMP_DIV,
+};
+
 static struct ofw_compat_data compat_data[] = {
{ "allwinner,sun8i-a83t-ts",(uintptr_t)_config },
+   { "allwinner,sun8i-h3-ts",  (uintptr_t)_config },
{ "allwinner,sun50i-a64-ts",(uintptr_t)_config },
{ NULL, (uintptr_t)NULL }
 };
@@ -191,14 +224,16 @@ aw_thermal_init(struct aw_thermal_softc 
uint32_t calib0, calib1;
int error;
 
-   /* Read calibration settings from SRAM */
-   error = aw_sid_read_tscalib(, );
-   if (error != 0)
-   return (error);
-
-   /* Write calibration settings to thermal controller */
-   WR4(sc, THS_CALIB0, calib0);
-   WR4(sc, THS_CALIB1, calib1);
+   if (sc->conf->calib) {
+   /* Read calibration settings from SRAM */
+   error = aw_sid_read_tscalib(, );
+   if (error != 0)
+   return (error);
+
+   /* Write calibration settings to thermal controller */
+   WR4(sc, THS_CALIB0, calib0);
+   WR4(sc, THS_CALIB1, calib1);
+   }
 
/* Configure ADC acquire time (CLK_IN/(N+1)) and enable sensors */
WR4(sc, THS_CTRL1, ADC_CALI_EN);
@@ -221,7 +256,8 @@ aw_thermal_init(struct aw_thermal_softc 
 static int
 aw_thermal_reg_to_temp(struct aw_thermal_softc *sc, uint32_t val)
 {
-   return ((sc->conf->temp_base - val * 1000) / sc->conf->temp_div);
+   return ((sc->conf->temp_base - (val * sc->conf->temp_mul)) /
+   

svn commit: r305415 - head/usr.sbin/bsdinstall/partedit

2016-09-05 Thread Wojciech Macek
Author: wma
Date: Mon Sep  5 08:42:36 2016
New Revision: 305415
URL: https://svnweb.freebsd.org/changeset/base/305415

Log:
  bsdinstall: add warning when unsupported partition is modified
  
  Right now is possible to modify bootable partition type to
  non-bootable type without getting warning from partedit.
  Example: if you auto parition drive for arm64, you will
  get freebsd-ufs as bootable partition; now you are able
  to change bootable partition type to freebsd-zfs; there
  will be no warning and the system will install but
  will not be bootable afterwards.
  
  After this fix, partedit will issue the same warning it
  does when user attempts to create bootable partition of
  not supported type, notyfing a user about incoming
  problem and allowing to think the decision over before
  commiting the schema.
  
  This has been tested on amd64 and arm64.
  
  Obtained from: Semihalf
  Submitted by:  Dominik Ermel 
  Sponsored by:  Cavium
  Reviewed by:   nwhitehorn
  Differential Revision: https://reviews.freebsd.org/D6879

Modified:
  head/usr.sbin/bsdinstall/partedit/gpart_ops.c

Modified: head/usr.sbin/bsdinstall/partedit/gpart_ops.c
==
--- head/usr.sbin/bsdinstall/partedit/gpart_ops.c   Mon Sep  5 08:27:04 
2016(r305414)
+++ head/usr.sbin/bsdinstall/partedit/gpart_ops.c   Mon Sep  5 08:42:36 
2016(r305415)
@@ -617,6 +617,20 @@ editpart:
if (choice) /* Cancel pressed */
goto endedit;
 
+   /* If this is the root partition, check that this fs is bootable */
+   if (strcmp(items[2].text, "/") == 0 && !is_fs_bootable(scheme,
+   items[0].text)) {
+   char message[512];
+   sprintf(message, "This file system (%s) is not bootable "
+   "on this system. Are you sure you want to proceed?",
+   items[0].text);
+   dialog_vars.defaultno = TRUE;
+   choice = dialog_yesno("Warning", message, 0, 0);
+   dialog_vars.defaultno = FALSE;
+   if (choice == 1) /* cancel */
+   goto editpart;
+   }
+
/* Check if the label has a / in it */
if (strchr(items[3].text, '/') != NULL) {
dialog_msgbox("Error", "Label contains a /, which is not an "
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305414 - in head: contrib/top usr.bin/top

2016-09-05 Thread Dag-Erling Smørgrav
Author: des
Date: Mon Sep  5 08:27:04 2016
New Revision: 305414
URL: https://svnweb.freebsd.org/changeset/base/305414

Log:
  Add a toggle to display the approximate amount of swap used by each
  process.  We don't *quite* pull that number out of our backside, as
  the actual number is difficult to determine without modifying the VM
  system to report it, but it's still useful to get an idea of what's
  going on when a machine unexpectedly starts swapping.
  
  MFC after:1 week

Modified:
  head/contrib/top/commands.c
  head/contrib/top/machine.h
  head/contrib/top/top.c
  head/contrib/top/top.xs
  head/usr.bin/top/machine.c

Modified: head/contrib/top/commands.c
==
--- head/contrib/top/commands.c Mon Sep  5 06:46:04 2016(r305413)
+++ head/contrib/top/commands.c Mon Sep  5 08:27:04 2016(r305414)
@@ -104,6 +104,7 @@ S   - toggle the displaying of syste
 a   - toggle the displaying of process titles\n\
 t   - toggle the display of this process\n\
 u   - display processes for only one user (+ selects all users)\n\
+w   - toggle the display of swap use for each process\n\
 z   - toggle the displaying of the system idle process\n\
 \n\
 \n", stdout);

Modified: head/contrib/top/machine.h
==
--- head/contrib/top/machine.h  Mon Sep  5 06:46:04 2016(r305413)
+++ head/contrib/top/machine.h  Mon Sep  5 08:27:04 2016(r305414)
@@ -72,6 +72,7 @@ struct process_select
 int wcpu;  /* show weighted cpu */
 int jid;   /* only this jid (unless jid == -1) */
 int jail;  /* show jail ID */
+int swap;  /* show swap usage */
 int kidle; /* show per-CPU idle threads */
 char *command; /* only this command (unless == NULL) */
 };
@@ -82,8 +83,8 @@ char  *format_header();
 char   *format_next_process();
 voidtoggle_pcpustats(void);
 voidget_system_info(struct system_info *si);
-int machine_init(struct statics *statics, char do_unames);
-int proc_owner(int pid);
+int machine_init(struct statics *statics, char do_unames);
+int proc_owner(int pid);
 
 /* non-int routines typically used by the machine dependent module */
 char   *printable();

Modified: head/contrib/top/top.c
==
--- head/contrib/top/top.c  Mon Sep  5 06:46:04 2016(r305413)
+++ head/contrib/top/top.c  Mon Sep  5 08:27:04 2016(r305414)
@@ -188,9 +188,9 @@ char *argv[];
 fd_set readfds;
 
 #ifdef ORDER
-static char command_chars[] = "\f qh?en#sdkriIutHmSCajzPJo";
+static char command_chars[] = "\f qh?en#sdkriIutHmSCajzPJwo";
 #else
-static char command_chars[] = "\f qh?en#sdkriIutHmSCajzPJ";
+static char command_chars[] = "\f qh?en#sdkriIutHmSCajzPJw";
 #endif
 /* these defines enumerate the "strchr"s of the commands in command_chars */
 #define CMD_redraw 0
@@ -219,8 +219,9 @@ char *argv[];
 #define CMD_kidletog   22
 #define CMD_pcputog23
 #define CMD_jail   24
+#define CMD_swaptog25
 #ifdef ORDER
-#define CMD_order   25
+#define CMD_order   26
 #endif
 
 /* set the buffer for stdout */
@@ -254,6 +255,7 @@ char *argv[];
 ps.wcpu= 1;
 ps.jid = -1;
 ps.jail= No;
+ps.swap= No;
 ps.kidle   = Yes;
 ps.command = NULL;
 
@@ -280,7 +282,7 @@ char *argv[];
optind = 1;
}
 
-   while ((i = getopt(ac, av, "CSIHPabijJ:nquvzs:d:U:m:o:t")) != EOF)
+   while ((i = getopt(ac, av, "CSIHPabijJ:nquvzs:d:U:m:o:tw")) != EOF)
{
switch(i)
{
@@ -418,6 +420,10 @@ char *argv[];
pcpu_stats = !pcpu_stats;
break;
 
+ case 'w':
+   ps.swap = 1;
+   break;
+
  case 'z':
ps.kidle = !ps.kidle;
break;
@@ -1141,6 +1147,15 @@ restart:
reset_display();
putchar('\r');
break;
+   case CMD_swaptog:
+   ps.swap = !ps.swap;
+   new_message(MT_standout | MT_delayed,
+   " %sisplaying per-process swap usage.",
+   ps.swap ? "D" : "Not d");
+   header_text = format_header(uname_field);
+   reset_display();
+   putchar('\r');
+   break;
default:
new_message(MT_standout, " BAD CASE IN 
SWITCH!");
putchar('\r');

Modified: head/contrib/top/top.xs

svn commit: r305413 - head/lib/libc/stdio

2016-09-05 Thread Andrey A. Chernov
Author: ache
Date: Mon Sep  5 06:46:04 2016
New Revision: 305413
URL: https://svnweb.freebsd.org/changeset/base/305413

Log:
  Fix error handling.
  
  MFC after:  3 days

Modified:
  head/lib/libc/stdio/fgets.c

Modified: head/lib/libc/stdio/fgets.c
==
--- head/lib/libc/stdio/fgets.c Mon Sep  5 06:10:51 2016(r305412)
+++ head/lib/libc/stdio/fgets.c Mon Sep  5 06:46:04 2016(r305413)
@@ -37,6 +37,7 @@ static char sccsid[] = "@(#)fgets.c   8.2 
 __FBSDID("$FreeBSD$");
 
 #include "namespace.h"
+#include 
 #include 
 #include 
 #include "un-namespace.h"
@@ -55,11 +56,16 @@ fgets(char * __restrict buf, int n, FILE
char *s;
unsigned char *p, *t;
 
-   if (n <= 0) /* sanity check */
-   return (NULL);
-
FLOCKFILE(fp);
ORIENT(fp, -1);
+
+   if (n <= 0) {   /* sanity check */
+   fp->_flags |= __SERR;
+   errno = EINVAL;
+   FUNLOCKFILE(fp);
+   return (NULL);
+   }
+
s = buf;
n--;/* leave space for NUL */
while (n != 0) {
@@ -69,7 +75,7 @@ fgets(char * __restrict buf, int n, FILE
if ((len = fp->_r) <= 0) {
if (__srefill(fp)) {
/* EOF/error: stop with partial or no line */
-   if (s == buf) {
+   if (!__sfeof(fp) || s == buf) {
FUNLOCKFILE(fp);
return (NULL);
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r305412 - head/lib/libc/stdio

2016-09-05 Thread Andrey A. Chernov
Author: ache
Date: Mon Sep  5 06:10:51 2016
New Revision: 305412
URL: https://svnweb.freebsd.org/changeset/base/305412

Log:
  Fix n == 1 case. Here should be no physical read (fill buffer) attempt
  (we read n - 1 chars with the room for NUL, see fgets()),
  and no NULL return.
  
  MFC after:  3 days

Modified:
  head/lib/libc/stdio/fgetws.c

Modified: head/lib/libc/stdio/fgetws.c
==
--- head/lib/libc/stdio/fgetws.cMon Sep  5 05:07:40 2016
(r305411)
+++ head/lib/libc/stdio/fgetws.cMon Sep  5 06:10:51 2016
(r305412)
@@ -62,10 +62,14 @@ fgetws_l(wchar_t * __restrict ws, int n,
goto error;
}
 
+   wsp = ws;
+   if (n == 1)
+   goto ok;
+
if (fp->_r <= 0 && __srefill(fp))
/* EOF or ferror */
goto error;
-   wsp = ws;
+
sret = 0;
do {
src = fp->_p;
@@ -107,9 +111,9 @@ fgetws_l(wchar_t * __restrict ws, int n,
if (wsp == ws)
/* EOF */
goto error;
+ok:
*wsp = L'\0';
FUNLOCKFILE(fp);
-
return (ws);
 
 error:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"