svn commit: r300015 - in head/sys: conf dev/bhnd dev/bhnd/bhndb dev/bhnd/cores/chipc dev/bhnd/cores/pci dev/bhnd/cores/pcie2 dev/bhnd/siba modules/bhnd/cores/bhnd_pci modules/bhnd/cores/bhnd_pci_ho...

2016-05-16 Thread Adrian Chadd
Author: adrian
Date: Tue May 17 06:52:53 2016
New Revision: 300015
URL: https://svnweb.freebsd.org/changeset/base/300015

Log:
  [bhnd] Finish bhnd(4) PCI/PCIe-G1 hostb support.
  
  Now that we've got access to SPROM and can access board identification,
  this implements all known remaining hardware work-arounds for the bhnd(4)
  PCI and PCIe-G1 cores operating endpoint mode.
  
  Additionally, this adds an initial set of skeleton PCIe-G2 hostb and pcib
  drivers, required by fullmac and newer softmac devices.
  
  Submitted by: Landon Fuller 
  Differential Revision:https://reviews.freebsd.org/D6377

Added:
  head/sys/dev/bhnd/cores/pcie2/
  head/sys/dev/bhnd/cores/pcie2/bhnd_pcie2.c   (contents, props changed)
  head/sys/dev/bhnd/cores/pcie2/bhnd_pcie2_hostb.c   (contents, props changed)
  head/sys/dev/bhnd/cores/pcie2/bhnd_pcie2_hostbvar.h   (contents, props 
changed)
  head/sys/dev/bhnd/cores/pcie2/bhnd_pcie2_reg.h   (contents, props changed)
  head/sys/dev/bhnd/cores/pcie2/bhnd_pcie2_var.h   (contents, props changed)
  head/sys/dev/bhnd/cores/pcie2/bhnd_pcie2b.c   (contents, props changed)
  head/sys/dev/bhnd/cores/pcie2/bhnd_pcie2b_var.h   (contents, props changed)
Modified:
  head/sys/conf/files
  head/sys/dev/bhnd/bhnd.h
  head/sys/dev/bhnd/bhnd_ids.h
  head/sys/dev/bhnd/bhnd_subr.c
  head/sys/dev/bhnd/bhndb/bhndb_pci.c
  head/sys/dev/bhnd/bhndb/bhndb_pcireg.h
  head/sys/dev/bhnd/cores/chipc/bhnd_chipc_if.m
  head/sys/dev/bhnd/cores/chipc/chipc.c
  head/sys/dev/bhnd/cores/pci/bhnd_pci.c
  head/sys/dev/bhnd/cores/pci/bhnd_pci_hostb.c
  head/sys/dev/bhnd/cores/pci/bhnd_pci_hostbvar.h
  head/sys/dev/bhnd/cores/pci/bhnd_pcib.c
  head/sys/dev/bhnd/cores/pci/bhnd_pcireg.h
  head/sys/dev/bhnd/siba/siba.c
  head/sys/dev/bhnd/siba/siba_bhndb.c
  head/sys/dev/bhnd/siba/sibavar.h
  head/sys/modules/bhnd/cores/bhnd_pci/Makefile
  head/sys/modules/bhnd/cores/bhnd_pci_hostb/Makefile
  head/sys/modules/bhnd/cores/bhnd_pcib/Makefile

Modified: head/sys/conf/files
==
--- head/sys/conf/files Tue May 17 06:45:25 2016(r300014)
+++ head/sys/conf/files Tue May 17 06:52:53 2016(r300015)
@@ -1142,6 +1142,9 @@ dev/bhnd/cores/chipc/bhnd_chipc_if.m  opt
 dev/bhnd/cores/pci/bhnd_pci.c  optional bhndbus pci | bhnd pci
 dev/bhnd/cores/pci/bhnd_pci_hostb.coptional bhndbus pci | bhndb pci
 dev/bhnd/cores/pci/bhnd_pcib.c optional bhnd_pcib bhnd pci
+dev/bhnd/cores/pcie2/bhnd_pcie2.c  optional bhndbus pci | bhnd pci
+dev/bhnd/cores/pcie2/bhnd_pcie2_hostb.coptional bhndbus pci | bhndb pci
+dev/bhnd/cores/pcie2/bhnd_pcie2b.c optional bhnd_pcie2b bhnd pci
 dev/bhnd/nvram/bhnd_nvram_if.m optional bhndbus | bhnd
 dev/bhnd/nvram/bhnd_sprom.coptional bhndbus | bhnd
 dev/bhnd/nvram/nvram_subr.coptional bhndbus | bhnd

Modified: head/sys/dev/bhnd/bhnd.h
==
--- head/sys/dev/bhnd/bhnd.hTue May 17 06:45:25 2016(r300014)
+++ head/sys/dev/bhnd/bhnd.hTue May 17 06:52:53 2016(r300015)
@@ -318,8 +318,8 @@ struct bhnd_chip_match {
.match_bvendor = 1, .board_vendor = _vend
 
 /** Set the required board type within a bhnd_chip_match instance */
-#defineBHND_CHIP_BT(_btype)\
-   .match_btype = 1, .board_type = BHND_BOARD_BCM ## _btype
+#defineBHND_CHIP_BTYPE(_btype) \
+   .match_btype = 1, .board_type = BHND_BOARD_ ## _btype
 
 /** Set the required SROM revision range within a bhnd_chip_match instance */
 #defineBHND_CHIP_SROMREV(_rev) \
@@ -331,7 +331,7 @@ struct bhnd_chip_match {
 
 /** Set the required board vendor and type within a bhnd_chip_match instance */
 #defineBHND_CHIP_BVT(_vend, _type) \
-   BHND_CHIP_BVEND(_vend), BHND_CHIP_BTYPE(_type)
+   BHND_CHIP_BVENDOR(_vend), BHND_CHIP_BTYPE(_type)
 
 /** Set the required board vendor, type, and revision within a bhnd_chip_match
  *  instance */
@@ -429,6 +429,9 @@ device_t bhnd_match_child(device_t de
 device_tbhnd_find_child(device_t dev,
 bhnd_devclass_t class, int unit);
 
+device_tbhnd_find_bridge_root(device_t dev,
+devclass_t bus_class);
+
 const struct bhnd_core_info*bhnd_match_core(
 const struct bhnd_core_info *cores,
 u_int num_cores,

Modified: head/sys/dev/bhnd/bhnd_ids.h
==
--- head/sys/dev/bhnd/bhnd_ids.hTue May 17 06:45:25 2016
(r300014)
+++ head/sys/dev/bhnd/bhnd_ids.hTue May 17 06:52:53 2016
(r300015)
@@ -26,8 +26,6 @@
 #ifndef _BHND_BHND_IDS_H_
 #define _BHND_BHND_IDS_H_
 
-
-
 /*
  * JEDEC JEP-106 Core Vend

svn commit: r300014 - in head/sys: boot/fdt/dts/mips mips/mediatek

2016-05-16 Thread Stanislav Galabov
Author: sgalabov
Date: Tue May 17 06:45:25 2016
New Revision: 300014
URL: https://svnweb.freebsd.org/changeset/base/300014

Log:
  Add proper PCIe init for MT7628/MT7688 SoCs
  
  PCIe PHY needs different initialization on MT7628/MT7688 SoCs than it does
  on MT7620.
  However, LEDE (and OpenWRT) dts files have the PCIe node for MT7628/MT7688
  as compatible with mt7620-pci.
  We already can handle this properly in our driver, so we just need to add
  compat strings to fbsd-mt7628an.dtsi and the PCIe driver.
  
  Approved by:  adrian (mentor)
  Sponsored by: Smartcom - Bulgaria AD
  Differential Revision:https://reviews.freebsd.org/D6395

Modified:
  head/sys/boot/fdt/dts/mips/fbsd-mt7628an.dtsi
  head/sys/mips/mediatek/mtk_pcie.c

Modified: head/sys/boot/fdt/dts/mips/fbsd-mt7628an.dtsi
==
--- head/sys/boot/fdt/dts/mips/fbsd-mt7628an.dtsi   Tue May 17 06:42:24 
2016(r300013)
+++ head/sys/boot/fdt/dts/mips/fbsd-mt7628an.dtsi   Tue May 17 06:45:25 
2016(r300014)
@@ -36,4 +36,5 @@
 * different values for the reg property
 */
reg = <0x1014 0x1>;
+   compatible = "mediatek,mt7628-pci";
 };

Modified: head/sys/mips/mediatek/mtk_pcie.c
==
--- head/sys/mips/mediatek/mtk_pcie.c   Tue May 17 06:42:24 2016
(r300013)
+++ head/sys/mips/mediatek/mtk_pcie.c   Tue May 17 06:45:25 2016
(r300014)
@@ -203,6 +203,7 @@ mtk_pci_ranges(phandle_t node, struct mt
 static struct ofw_compat_data compat_data[] = {
{ "ralink,rt3883-pci",  MTK_SOC_RT3883 },
{ "mediatek,mt7620-pci",MTK_SOC_MT7620A },
+   { "mediatek,mt7628-pci",MTK_SOC_MT7628 },
{ "mediatek,mt7621-pci",MTK_SOC_MT7621 },
{ NULL, MTK_SOC_UNKNOWN }
 };
___
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: r300013 - in head/sys: boot/fdt/dts/mips gnu/dts/mips

2016-05-16 Thread Stanislav Galabov
Author: sgalabov
Date: Tue May 17 06:42:24 2016
New Revision: 300013
URL: https://svnweb.freebsd.org/changeset/base/300013

Log:
  Import LEDE dts files for Ralink/Mediatek
  
  This is an import of the reworked LEDE dts files. Besides other things
  they make it easier for us to reuse.
  
  The only diffs left are for the following SoCs:
  MT7620A (fbsd-mt7620a.dtsi)
  MT7621 (fbsd-mt7621.dtsi)
  MT7628 (fbsd-mt7628an.dtsi)
  RT3883 (fbsd-rt3883.dtsi)
  
  So we include the fbsd-*.dtsi files at the end of the original LEDE dtsi
  files, using '#include "fbsd-.dtsi"'.
  For example, for MT7621, the LEDE dtsi file is mt7621.dtsi. At the end of
  it we add:
  #include "fbsd-mt7621.dtsi"
  
  Approved by:  adrian (mentor)
  Obtained from:LEDE project
  Sponsored by: Smartcom - Bulgaria AD
  Differential Revision:https://reviews.freebsd.org/D6394

Added:
  head/sys/gnu/dts/mips/CS-QR10.dts   (contents, props changed)
  head/sys/gnu/dts/mips/MZK-EX300NP.dts   (contents, props changed)
  head/sys/gnu/dts/mips/MZK-EX750NP.dts   (contents, props changed)
  head/sys/gnu/dts/mips/SK-WB8.dts   (contents, props changed)
  head/sys/gnu/dts/mips/WNDR3700V5.dts   (contents, props changed)
  head/sys/gnu/dts/mips/WRH-300CR.dts   (contents, props changed)
  head/sys/gnu/dts/mips/ZBT-WG3526.dts   (contents, props changed)
Deleted:
  head/sys/boot/fdt/dts/mips/fbsd-mt7620n.dtsi
  head/sys/boot/fdt/dts/mips/fbsd-rt2880.dtsi
  head/sys/boot/fdt/dts/mips/fbsd-rt3050.dtsi
  head/sys/boot/fdt/dts/mips/fbsd-rt3352.dtsi
  head/sys/boot/fdt/dts/mips/fbsd-rt5350.dtsi
Modified:
  head/sys/boot/fdt/dts/mips/fbsd-mt7620a.dtsi
  head/sys/boot/fdt/dts/mips/fbsd-mt7621.dtsi
  head/sys/boot/fdt/dts/mips/fbsd-mt7628an.dtsi
  head/sys/boot/fdt/dts/mips/fbsd-rt3883.dtsi
  head/sys/gnu/dts/mips/3G-6200N.dts
  head/sys/gnu/dts/mips/3G-6200NL.dts
  head/sys/gnu/dts/mips/3G150B.dts
  head/sys/gnu/dts/mips/3G300M.dts
  head/sys/gnu/dts/mips/A5-V11.dts
  head/sys/gnu/dts/mips/AI-BR100.dts
  head/sys/gnu/dts/mips/AIR3GII.dts
  head/sys/gnu/dts/mips/ALL0239-3G.dts
  head/sys/gnu/dts/mips/ALL0256N-4M.dts
  head/sys/gnu/dts/mips/ALL0256N-8M.dts
  head/sys/gnu/dts/mips/ALL5002.dts
  head/sys/gnu/dts/mips/ALL5003.dts
  head/sys/gnu/dts/mips/AR670W.dts
  head/sys/gnu/dts/mips/AR725W.dts
  head/sys/gnu/dts/mips/ASL26555-16M.dts
  head/sys/gnu/dts/mips/ASL26555-8M.dts
  head/sys/gnu/dts/mips/ATP-52B.dts
  head/sys/gnu/dts/mips/AWAPN2403.dts
  head/sys/gnu/dts/mips/AWM002-4M.dtsi
  head/sys/gnu/dts/mips/AWM002-8M.dtsi
  head/sys/gnu/dts/mips/AWM002-EVB-4M.dts
  head/sys/gnu/dts/mips/AWM002-EVB-8M.dts
  head/sys/gnu/dts/mips/AWM002.dtsi
  head/sys/gnu/dts/mips/AWM003-EVB.dts
  head/sys/gnu/dts/mips/ArcherC20i.dts
  head/sys/gnu/dts/mips/BC2.dts
  head/sys/gnu/dts/mips/BR-6425.dts
  head/sys/gnu/dts/mips/BR-6475ND.dts
  head/sys/gnu/dts/mips/BROADWAY.dts
  head/sys/gnu/dts/mips/CARAMBOLA.dts
  head/sys/gnu/dts/mips/CF-WR800N.dts
  head/sys/gnu/dts/mips/CY-SWR1100.dts
  head/sys/gnu/dts/mips/D105.dts
  head/sys/gnu/dts/mips/DAP-1350.dts
  head/sys/gnu/dts/mips/DB-WRT01.dts
  head/sys/gnu/dts/mips/DCS-930.dts
  head/sys/gnu/dts/mips/DCS-930L-B1.dts
  head/sys/gnu/dts/mips/DIR-300-B1.dts
  head/sys/gnu/dts/mips/DIR-300-B7.dts
  head/sys/gnu/dts/mips/DIR-320-B1.dts
  head/sys/gnu/dts/mips/DIR-600-B1.dts
  head/sys/gnu/dts/mips/DIR-600-B2.dts
  head/sys/gnu/dts/mips/DIR-610-A1.dts
  head/sys/gnu/dts/mips/DIR-615-D.dts
  head/sys/gnu/dts/mips/DIR-615-H1.dts
  head/sys/gnu/dts/mips/DIR-620-A1.dts
  head/sys/gnu/dts/mips/DIR-620-D1.dts
  head/sys/gnu/dts/mips/DIR-645.dts
  head/sys/gnu/dts/mips/DIR-810L.dts
  head/sys/gnu/dts/mips/DIR-860L-B1.dts
  head/sys/gnu/dts/mips/E1700.dts
  head/sys/gnu/dts/mips/ESR-9753.dts
  head/sys/gnu/dts/mips/EX2700.dts
  head/sys/gnu/dts/mips/F5D8235_V1.dts
  head/sys/gnu/dts/mips/F5D8235_V2.dts
  head/sys/gnu/dts/mips/F7C027.dts
  head/sys/gnu/dts/mips/FIREWRT.dts
  head/sys/gnu/dts/mips/FONERA20N.dts
  head/sys/gnu/dts/mips/FREESTATION5.dts
  head/sys/gnu/dts/mips/GL-MT300A.dts
  head/sys/gnu/dts/mips/GL-MT300N.dts
  head/sys/gnu/dts/mips/GL-MT750.dts
  head/sys/gnu/dts/mips/HC5661.dts
  head/sys/gnu/dts/mips/HC5761.dts
  head/sys/gnu/dts/mips/HC5861.dts
  head/sys/gnu/dts/mips/HC5XXX.dtsi
  head/sys/gnu/dts/mips/HG255D.dts
  head/sys/gnu/dts/mips/HLKRM04.dts
  head/sys/gnu/dts/mips/HPM.dts
  head/sys/gnu/dts/mips/HT-TM02.dts
  head/sys/gnu/dts/mips/HW550-3G.dts
  head/sys/gnu/dts/mips/IP2202.dts
  head/sys/gnu/dts/mips/JHR-N805R.dts
  head/sys/gnu/dts/mips/JHR-N825R.dts
  head/sys/gnu/dts/mips/JHR-N926R.dts
  head/sys/gnu/dts/mips/LINKIT7688.dts
  head/sys/gnu/dts/mips/M2M.dts
  head/sys/gnu/dts/mips/M3.dts
  head/sys/gnu/dts/mips/M4-4M.dts
  head/sys/gnu/dts/mips/M4-8M.dts
  head/sys/gnu/dts/mips/MINIEMBPLUG.dts
  head/sys/gnu/dts/mips/MINIEMBWIFI.dts
  head/sys/gnu/dts/mips/MIWIFI-MINI.dts
  head/sys/gnu/dts/mips/MIWIFI-NANO.dts
  head/sys/gnu/dts/mips/MLW221.dts
  head/sys/gnu/dts/mips/MLWG2.dts
  head/sys/gnu/d

svn commit: r300012 - head/sys/dev/etherswitch/mtkswitch

2016-05-16 Thread Stanislav Galabov
Author: sgalabov
Date: Tue May 17 06:30:46 2016
New Revision: 300012
URL: https://svnweb.freebsd.org/changeset/base/300012

Log:
  Fix issues with mt762x etherswitch driver
  
  Fix issues that crept in with initial import.
  
  Approved by:  adrian (mentor)
  Sponsored by: Smartcom - Bulgaria AD
  Differential Revision:https://reviews.freebsd.org/D6393

Modified:
  head/sys/dev/etherswitch/mtkswitch/mtkswitch_mt7620.c
  head/sys/dev/etherswitch/mtkswitch/mtkswitch_mt7620.h

Modified: head/sys/dev/etherswitch/mtkswitch/mtkswitch_mt7620.c
==
--- head/sys/dev/etherswitch/mtkswitch/mtkswitch_mt7620.c   Tue May 17 
06:28:03 2016(r300011)
+++ head/sys/dev/etherswitch/mtkswitch/mtkswitch_mt7620.c   Tue May 17 
06:30:46 2016(r300012)
@@ -119,7 +119,6 @@ static uint32_t
 mtkswitch_reg_read32(struct mtkswitch_softc *sc, int reg)
 {
 
-   MTKSWITCH_LOCK_ASSERT(sc, MA_OWNED);
return (MTKSWITCH_READ(sc, reg));
 }
 
@@ -127,7 +126,6 @@ static uint32_t
 mtkswitch_reg_write32(struct mtkswitch_softc *sc, int reg, uint32_t val)
 {
 
-   MTKSWITCH_LOCK_ASSERT(sc, MA_OWNED);
MTKSWITCH_WRITE(sc, reg, val);
return (0);
 }
@@ -230,15 +228,21 @@ mtkswitch_port_init(struct mtkswitch_sof
/* Called early and hence unlocked */
 
/* Set the port to secure mode */
-   sc->hal.mtkswitch_write(sc, MTKSWITCH_PCR(port), PCR_PORT_VLAN_SECURE);
+   val = sc->hal.mtkswitch_read(sc, MTKSWITCH_PCR(port));
+   val |= PCR_PORT_VLAN_SECURE;
+   sc->hal.mtkswitch_write(sc, MTKSWITCH_PCR(port), val);
 
/* Set port's vlan_attr to user port */
val = sc->hal.mtkswitch_read(sc, MTKSWITCH_PVC(port));
-   val &= PVC_VLAN_ATTR_MASK;
+   val &= ~PVC_VLAN_ATTR_MASK;
sc->hal.mtkswitch_write(sc, MTKSWITCH_PVC(port), val);
 
+   val = PMCR_CFG_DEFAULT;
+   if (port == sc->cpuport)
+   val |= PMCR_FORCE_LINK | PMCR_FORCE_DPX | PMCR_FORCE_SPD_1000 |
+   PMCR_FORCE_MODE;
/* Set port's MAC to default settings */
-   sc->hal.mtkswitch_write(sc, MTKSWITCH_PMCR(port), PMCR_CFG_DEFAULT);
+   sc->hal.mtkswitch_write(sc, MTKSWITCH_PMCR(port), val);
 }
 
 static uint32_t
@@ -353,13 +357,12 @@ mtkswitch_vlan_init_hw(struct mtkswitch_
 
MTKSWITCH_LOCK_ASSERT(sc, MA_NOTOWNED);
MTKSWITCH_LOCK(sc);
-
/* Reset all VLANs to defaults first */
for (i = 0; i < sc->info.es_nvlangroups; i++) {
mtkswitch_invalidate_vlan(sc, i);
if (sc->sc_switchtype == MTK_SWITCH_MT7620) {
val = sc->hal.mtkswitch_read(sc, MTKSWITCH_VTIM(i));
-   val &= (VTIM_MASK << VTIM_OFF(i));
+   val &= ~(VTIM_MASK << VTIM_OFF(i));
val |= ((i + 1) << VTIM_OFF(i));
sc->hal.mtkswitch_write(sc, MTKSWITCH_VTIM(i), val);
}
@@ -464,7 +467,7 @@ mtkswitch_vlan_setvgroup(struct mtkswitc
if (sc->sc_switchtype == MTK_SWITCH_MT7620) {
val = sc->hal.mtkswitch_read(sc,
MTKSWITCH_VTIM(v->es_vlangroup));
-   val &= (VTIM_MASK << VTIM_OFF(v->es_vlangroup));
+   val &= ~(VTIM_MASK << VTIM_OFF(v->es_vlangroup));
val |= ((v->es_vid & VTIM_MASK) << VTIM_OFF(v->es_vlangroup));
sc->hal.mtkswitch_write(sc, MTKSWITCH_VTIM(v->es_vlangroup),
val);

Modified: head/sys/dev/etherswitch/mtkswitch/mtkswitch_mt7620.h
==
--- head/sys/dev/etherswitch/mtkswitch/mtkswitch_mt7620.h   Tue May 17 
06:28:03 2016(r300011)
+++ head/sys/dev/etherswitch/mtkswitch/mtkswitch_mt7620.h   Tue May 17 
06:30:46 2016(r300012)
@@ -85,13 +85,21 @@
 #definePPBV_VID_MASK   0xfff
 
 #defineMTKSWITCH_PMCR(x)   MTKSWITCH_PORTREG(0x3000, (x))
+#definePMCR_FORCE_LINK (1u<<0)
+#definePMCR_FORCE_DPX  (1u<<1)
+#definePMCR_FORCE_SPD_1000 (2u<<2)
+#definePMCR_FORCE_TX_FC(1u<<4)
+#definePMCR_FORCE_RX_FC(1u<<5)
 #definePMCR_BACKPR_EN  (1u<<8)
 #definePMCR_BKOFF_EN   (1u<<9)
 #definePMCR_MAC_RX_EN  (1u<<13)
 #definePMCR_MAC_TX_EN  (1u<<14)
+#definePMCR_FORCE_MODE (1u<<15)
+#definePMCR_RES_1  (1u<<16)
 #definePMCR_IPG_CFG_RND(1u<<18)
 #definePMCR_CFG_DEFAULT(PMCR_BACKPR_EN | PMCR_BKOFF_EN 
| \
-   PMCR_MAC_RX_EN | PMCR_MAC_TX_EN | PMCR_IPG_CFG_RND)
+   PMCR_MAC_RX_EN | PMCR_MAC_TX_EN | PMCR_IPG_CFG_RND |  \
+   PMCR_FORCE_RX_FC | PMCR_FORC

svn commit: r300011 - head/sys/dev/sfxge/common

2016-05-16 Thread Andrew Rybchenko
Author: arybchik
Date: Tue May 17 06:28:03 2016
New Revision: 300011
URL: https://svnweb.freebsd.org/changeset/base/300011

Log:
  sfxge(4): only raise an exception after MC assert or reboot in the common code
  
  Fix efx_mcdi_request_poll so it only raises an exception if EIO is
  reported from a detected MC assert or reboot. This prevents
  an unnecessary exception being raised if an MCDI response error code
  is trandlated to EIO.
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week
  Differential Revision:  https://reviews.freebsd.org/D6392

Modified:
  head/sys/dev/sfxge/common/efx_mcdi.c

Modified: head/sys/dev/sfxge/common/efx_mcdi.c
==
--- head/sys/dev/sfxge/common/efx_mcdi.cTue May 17 06:27:19 2016
(r300010)
+++ head/sys/dev/sfxge/common/efx_mcdi.cTue May 17 06:28:03 2016
(r300011)
@@ -519,6 +519,11 @@ efx_mcdi_request_poll(
if ((rc = efx_mcdi_poll_reboot(enp)) != 0) {
emip->emi_pending_req = NULL;
EFSYS_UNLOCK(enp->en_eslp, state);
+
+   /* Reboot/Assertion */
+   if (rc == EIO || rc == EINTR)
+   efx_mcdi_raise_exception(enp, emrp, rc);
+
goto fail1;
}
}
@@ -553,10 +558,6 @@ fail1:
if (!emrp->emr_quiet)
EFSYS_PROBE1(fail1, efx_rc_t, rc);
 
-   /* Reboot/Assertion */
-   if (rc == EIO || rc == EINTR)
-   efx_mcdi_raise_exception(enp, emrp, rc);
-
return (B_TRUE);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r300010 - head/sys/dev/sfxge/common

2016-05-16 Thread Andrew Rybchenko
Author: arybchik
Date: Tue May 17 06:27:19 2016
New Revision: 300010
URL: https://svnweb.freebsd.org/changeset/base/300010

Log:
  sfxge(4): restore clearing of MCDI new epoch flag in common code
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week
  Differential Revision:  https://reviews.freebsd.org/D6390

Modified:
  head/sys/dev/sfxge/common/efx_mcdi.c

Modified: head/sys/dev/sfxge/common/efx_mcdi.c
==
--- head/sys/dev/sfxge/common/efx_mcdi.cTue May 17 06:26:02 2016
(r39)
+++ head/sys/dev/sfxge/common/efx_mcdi.cTue May 17 06:27:19 2016
(r300010)
@@ -535,6 +535,9 @@ efx_mcdi_request_poll(
/* Request complete */
emip->emi_pending_req = NULL;
 
+   /* Ensure stale MCDI requests fail after an MC reboot. */
+   emip->emi_new_epoch = B_FALSE;
+
EFSYS_UNLOCK(enp->en_eslp, state);
 
if ((rc = emrp->emr_rc) != 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: r300009 - head/sys/dev/sfxge/common

2016-05-16 Thread Andrew Rybchenko
Author: arybchik
Date: Tue May 17 06:26:02 2016
New Revision: 39
URL: https://svnweb.freebsd.org/changeset/base/39

Log:
  sfxge(4): fix Medford timer quantum calculation in common code
  
  The event/timer block used sysclk in Huntington, but has been
  moved to the dpcpu clock domain for Medford. Fix the computed
  timer quantum to use the right clock.
  
  Submitted by:   Andy Moreton 
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week
  Differential Revision:  https://reviews.freebsd.org/D6389

Modified:
  head/sys/dev/sfxge/common/ef10_impl.h
  head/sys/dev/sfxge/common/ef10_nic.c
  head/sys/dev/sfxge/common/hunt_nic.c
  head/sys/dev/sfxge/common/medford_nic.c

Modified: head/sys/dev/sfxge/common/ef10_impl.h
==
--- head/sys/dev/sfxge/common/ef10_impl.h   Tue May 17 06:25:00 2016
(r38)
+++ head/sys/dev/sfxge/common/ef10_impl.h   Tue May 17 06:26:02 2016
(r39)
@@ -1061,7 +1061,9 @@ efx_mcdi_get_mac_address_vf(
 extern __checkReturn   efx_rc_t
 efx_mcdi_get_clock(
__inefx_nic_t *enp,
-   __out   uint32_t *sys_freqp);
+   __out   uint32_t *sys_freqp,
+   __out   uint32_t *dpcpu_freqp);
+
 
 extern __checkReturn   efx_rc_t
 efx_mcdi_get_vector_cfg(

Modified: head/sys/dev/sfxge/common/ef10_nic.c
==
--- head/sys/dev/sfxge/common/ef10_nic.cTue May 17 06:25:00 2016
(r38)
+++ head/sys/dev/sfxge/common/ef10_nic.cTue May 17 06:26:02 2016
(r39)
@@ -389,7 +389,8 @@ fail1:
__checkReturn   efx_rc_t
 efx_mcdi_get_clock(
__inefx_nic_t *enp,
-   __out   uint32_t *sys_freqp)
+   __out   uint32_t *sys_freqp,
+   __out   uint32_t *dpcpu_freqp)
 {
efx_mcdi_req_t req;
uint8_t payload[MAX(MC_CMD_GET_CLOCK_IN_LEN,
@@ -423,9 +424,16 @@ efx_mcdi_get_clock(
rc = EINVAL;
goto fail3;
}
+   *dpcpu_freqp = MCDI_OUT_DWORD(req, GET_CLOCK_OUT_DPCPU_FREQ);
+   if (*dpcpu_freqp == 0) {
+   rc = EINVAL;
+   goto fail4;
+   }
 
return (0);
 
+fail4:
+   EFSYS_PROBE(fail4);
 fail3:
EFSYS_PROBE(fail3);
 fail2:

Modified: head/sys/dev/sfxge/common/hunt_nic.c
==
--- head/sys/dev/sfxge/common/hunt_nic.cTue May 17 06:25:00 2016
(r38)
+++ head/sys/dev/sfxge/common/hunt_nic.cTue May 17 06:26:02 2016
(r39)
@@ -114,7 +114,7 @@ hunt_board_cfg(
uint32_t vf;
uint32_t mask;
uint32_t flags;
-   uint32_t sysclk;
+   uint32_t sysclk, dpcpu_clk;
uint32_t base, nvec;
uint32_t bandwidth;
efx_rc_t rc;
@@ -274,13 +274,13 @@ hunt_board_cfg(
goto fail10;
}
 
-   /* Get sysclk frequency (in MHz). */
-   if ((rc = efx_mcdi_get_clock(enp, &sysclk)) != 0)
+   /* Get clock frequencies (in MHz). */
+   if ((rc = efx_mcdi_get_clock(enp, &sysclk, &dpcpu_clk)) != 0)
goto fail11;
 
/*
-* The timer quantum is 1536 sysclk cycles, documented for the
-* EV_TMR_VAL field of EV_TIMER_TBL. Scale for MHz and ns units.
+* The Huntington timer quantum is 1536 sysclk cycles, documented for
+* the EV_TMR_VAL field of EV_TIMER_TBL. Scale for MHz and ns units.
 */
encp->enc_evq_timer_quantum_ns = 1536000UL / sysclk; /* 1536 cycles */
if (encp->enc_bug35388_workaround) {

Modified: head/sys/dev/sfxge/common/medford_nic.c
==
--- head/sys/dev/sfxge/common/medford_nic.c Tue May 17 06:25:00 2016
(r38)
+++ head/sys/dev/sfxge/common/medford_nic.c Tue May 17 06:26:02 2016
(r39)
@@ -141,7 +141,7 @@ medford_board_cfg(
uint32_t pf;
uint32_t vf;
uint32_t mask;
-   uint32_t sysclk;
+   uint32_t sysclk, dpcpu_clk;
uint32_t base, nvec;
uint32_t end_padding;
uint32_t bandwidth;
@@ -231,15 +231,15 @@ medford_board_cfg(
/* Chained multicast is always enabled on Medford */
encp->enc_bug26807_workaround = B_TRUE;
 
-   /* Get sysclk frequency (in MHz). */
-   if ((rc = efx_mcdi_get_clock(enp, &sysclk)) != 0)
+   /* Get clock frequencies (in MHz). */
+   if ((rc = efx_mcdi_get_clock(enp, &sysclk, &dpcpu_clk)) != 0)
goto fail8;
 
/*
-* The timer quantum is 1536 sysclk cycles, documented for the
-* EV_TMR_VAL field of EV_TIMER_TBL. Scale for MHz and ns units.
+* The Medford timer quantum is 1536 dpcpu_clk cycles, documented for
+* the EV_TMR_VAL field of EV_TIMER_TBL. Scale for MHz and ns units.
 

svn commit: r300008 - head/sys/dev/sfxge/common

2016-05-16 Thread Andrew Rybchenko
Author: arybchik
Date: Tue May 17 06:25:00 2016
New Revision: 38
URL: https://svnweb.freebsd.org/changeset/base/38

Log:
  sfxge(4): query and use current MTU if setting the MTU fails
  
  This allows the driver to fall back to the largest usable MTU if a
  user attempts to configure an unprivileged function with an MTU higher
  than that of the attached port.
  
  Submitted by:   Mark Spender 
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week
  Differential Revision:  https://reviews.freebsd.org/D6387

Modified:
  head/sys/dev/sfxge/common/ef10_impl.h
  head/sys/dev/sfxge/common/ef10_mac.c
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_impl.h
  head/sys/dev/sfxge/common/efx_mac.c
  head/sys/dev/sfxge/common/siena_impl.h
  head/sys/dev/sfxge/common/siena_mac.c

Modified: head/sys/dev/sfxge/common/ef10_impl.h
==
--- head/sys/dev/sfxge/common/ef10_impl.h   Tue May 17 06:23:50 2016
(r37)
+++ head/sys/dev/sfxge/common/ef10_impl.h   Tue May 17 06:25:00 2016
(r38)
@@ -236,6 +236,11 @@ ef10_mac_pdu_set(
__inefx_nic_t *enp);
 
 extern __checkReturn   efx_rc_t
+ef10_mac_pdu_get(
+   __inefx_nic_t *enp,
+   __out   size_t *pdu);
+
+extern __checkReturn   efx_rc_t
 ef10_mac_reconfigure(
__inefx_nic_t *enp);
 

Modified: head/sys/dev/sfxge/common/ef10_mac.c
==
--- head/sys/dev/sfxge/common/ef10_mac.cTue May 17 06:23:50 2016
(r37)
+++ head/sys/dev/sfxge/common/ef10_mac.cTue May 17 06:25:00 2016
(r38)
@@ -199,6 +199,53 @@ fail1:
return (rc);
 }
 
+static __checkReturn   efx_rc_t
+efx_mcdi_mtu_get(
+   __inefx_nic_t *enp,
+   __out   size_t *mtu)
+{
+   efx_mcdi_req_t req;
+   uint8_t payload[MAX(MC_CMD_SET_MAC_EXT_IN_LEN,
+   MC_CMD_SET_MAC_V2_OUT_LEN)];
+   efx_rc_t rc;
+
+   (void) memset(payload, 0, sizeof (payload));
+   req.emr_cmd = MC_CMD_SET_MAC;
+   req.emr_in_buf = payload;
+   req.emr_in_length = MC_CMD_SET_MAC_EXT_IN_LEN;
+   req.emr_out_buf = payload;
+   req.emr_out_length = MC_CMD_SET_MAC_V2_OUT_LEN;
+
+   /*
+* With MC_CMD_SET_MAC_EXT_IN_CONTROL set to 0, this just queries the
+* MTU.  This should always be supported on Medford, but it is not
+* supported on older Huntington firmware.
+*/
+   MCDI_IN_SET_DWORD(req, SET_MAC_EXT_IN_CONTROL, 0);
+
+   efx_mcdi_execute(enp, &req);
+
+   if (req.emr_rc != 0) {
+   rc = req.emr_rc;
+   goto fail1;
+   }
+   if (req.emr_out_length_used < MC_CMD_SET_MAC_V2_OUT_MTU_OFST + 4) {
+   rc = EMSGSIZE;
+   goto fail2;
+   }
+
+   *mtu = MCDI_OUT_DWORD(req, SET_MAC_V2_OUT_MTU);
+
+   return (0);
+
+fail2:
+   EFSYS_PROBE(fail2);
+fail1:
+   EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+   return (rc);
+}
+
__checkReturn   efx_rc_t
 ef10_mac_pdu_set(
__inefx_nic_t *enp)
@@ -230,6 +277,24 @@ fail1:
return (rc);
 }
 
+   __checkReturn   efx_rc_t
+ef10_mac_pdu_get(
+   __inefx_nic_t *enp,
+   __out   size_t *pdu)
+{
+   efx_rc_t rc;
+
+   if ((rc = efx_mcdi_mtu_get(enp, pdu)) != 0)
+   goto fail1;
+
+   return (0);
+
+fail1:
+   EFSYS_PROBE1(fail1, efx_rc_t, rc);
+
+   return (rc);
+}
+
 __checkReturn  efx_rc_t
 ef10_mac_reconfigure(
__inefx_nic_t *enp)

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Tue May 17 06:23:50 2016
(r37)
+++ head/sys/dev/sfxge/common/efx.h Tue May 17 06:25:00 2016
(r38)
@@ -442,18 +442,30 @@ typedef enum efx_link_mode_e {
 
 #defineEFX_MAC_SDU_MAX 9202
 
-#defineEFX_MAC_PDU(_sdu)   \
-   P2ROUNDUP(((_sdu)   \
-   + /* EtherII */ 14  \
-   + /* VLAN */ 4  \
-   + /* CRC */ 4   \
-   + /* bug16011 */ 16),   \
-   (1 << 3))
+#defineEFX_MAC_PDU_ADJUSTMENT  \
+   (/* EtherII */ 14   \
+   + /* VLAN */ 4  \
+   + /* CRC */ 4   \
+   + /* bug16011 */ 16)\
+
+#defineEFX_MAC_PDU(_sdu)   \
+   P2ROUNDUP((_sdu) + EFX_MAC_PDU_ADJUSTMENT, 8)
+
+/*
+ * Due to the P2ROUNDUP in EFX_MAC_PDU(), EFX_MAC_SD

svn commit: r300007 - head/sys/dev/sfxge/common

2016-05-16 Thread Andrew Rybchenko
Author: arybchik
Date: Tue May 17 06:23:50 2016
New Revision: 37
URL: https://svnweb.freebsd.org/changeset/base/37

Log:
  sfxge(4): store licensing state in efx_lic
  
  Check licensing support at NIC startup to avoid multiple checks later.
  As state is stored, licensing initialisation is moved later in start
  procedure.
  
  Submitted by:   Richard Houldsworth 
  Sponsored by:   Solarflare Communications, Inc.
  MFC after:  1 week
  Differential Revision:  https://reviews.freebsd.org/D6385

Modified:
  head/sys/dev/sfxge/common/efx.h
  head/sys/dev/sfxge/common/efx_impl.h
  head/sys/dev/sfxge/common/efx_lic.c
  head/sys/dev/sfxge/common/efx_nic.c

Modified: head/sys/dev/sfxge/common/efx.h
==
--- head/sys/dev/sfxge/common/efx.h Tue May 17 06:04:33 2016
(r36)
+++ head/sys/dev/sfxge/common/efx.h Tue May 17 06:23:50 2016
(r37)
@@ -2314,6 +2314,10 @@ extern   void
 efx_lic_fini(
__inefx_nic_t *enp);
 
+extern __checkReturn   boolean_t
+efx_lic_check_support(
+   __inefx_nic_t *enp);
+
 extern __checkReturn   efx_rc_t
 efx_lic_update_licenses(
__inefx_nic_t *enp);

Modified: head/sys/dev/sfxge/common/efx_impl.h
==
--- head/sys/dev/sfxge/common/efx_impl.hTue May 17 06:04:33 2016
(r36)
+++ head/sys/dev/sfxge/common/efx_impl.hTue May 17 06:23:50 2016
(r37)
@@ -636,6 +636,7 @@ struct efx_nic_s {
uint32_ten_vport_id;
 #if EFSYS_OPT_LICENSING
const efx_lic_ops_t *en_elop;
+   boolean_t   en_licensing_supported;
 #endif
union {
 #if EFSYS_OPT_SIENA

Modified: head/sys/dev/sfxge/common/efx_lic.c
==
--- head/sys/dev/sfxge/common/efx_lic.c Tue May 17 06:04:33 2016
(r36)
+++ head/sys/dev/sfxge/common/efx_lic.c Tue May 17 06:23:50 2016
(r37)
@@ -1330,6 +1330,7 @@ efx_lic_init(
__inefx_nic_t *enp)
 {
const efx_lic_ops_t *elop;
+   efx_key_stats_t eks;
efx_rc_t rc;
 
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
@@ -1365,6 +1366,13 @@ efx_lic_init(
enp->en_elop = elop;
enp->en_mod_flags |= EFX_MOD_LIC;
 
+   /* Probe for support */
+   if (efx_lic_get_key_stats(enp, &eks) == 0) {
+   enp->en_licensing_supported = B_TRUE;
+   } else {
+   enp->en_licensing_supported = B_FALSE;
+   }
+
return (0);
 
 fail1:
@@ -1373,6 +1381,17 @@ fail1:
return (rc);
 }
 
+extern __checkReturn   boolean_t
+efx_lic_check_support(
+   __inefx_nic_t *enp)
+{
+   EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
+   EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE);
+   EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_LIC);
+
+   return enp->en_licensing_supported;
+}
+
void
 efx_lic_fini(
__inefx_nic_t *enp)

Modified: head/sys/dev/sfxge/common/efx_nic.c
==
--- head/sys/dev/sfxge/common/efx_nic.c Tue May 17 06:04:33 2016
(r36)
+++ head/sys/dev/sfxge/common/efx_nic.c Tue May 17 06:23:50 2016
(r37)
@@ -580,7 +580,7 @@ efx_nic_reset(
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
EFSYS_ASSERT(enp->en_mod_flags & EFX_MOD_PROBE);
/*
-* All modules except the MCDI, PROBE, NVRAM, VPD, MON, LIC
+* All modules except the MCDI, PROBE, NVRAM, VPD, MON
 * (which we do not reset here) must have been shut down or never
 * initialized.
 *
@@ -590,7 +590,7 @@ efx_nic_reset(
 */
mod_flags = enp->en_mod_flags;
mod_flags &= ~(EFX_MOD_MCDI | EFX_MOD_PROBE | EFX_MOD_NVRAM |
-   EFX_MOD_VPD | EFX_MOD_MON | EFX_MOD_LIC);
+   EFX_MOD_VPD | EFX_MOD_MON);
EFSYS_ASSERT3U(mod_flags, ==, 0);
if (mod_flags != 0) {
rc = EINVAL;
___
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: r300005 - head/usr.bin/ncal

2016-05-16 Thread Don Lewis
On 16 May, Conrad Meyer wrote:
> On Mon, May 16, 2016 at 10:05 PM, Don Lewis  wrote:
>> Author: truckman
>> Date: Tue May 17 05:05:30 2016
>> New Revision: 35
>> URL: https://svnweb.freebsd.org/changeset/base/35
>>
>> Log:
>>   swprintf() and apparently wcsftime() want the their output buffer size
>>   specified in terms of the the number of wide characters and not
>>   sizeof(buffer).
>> ...
>> Modified: head/usr.bin/ncal/ncal.c
>> ==
>> --- head/usr.bin/ncal/ncal.cTue May 17 04:53:21 2016(r34)
>> +++ head/usr.bin/ncal/ncal.cTue May 17 05:05:30 2016(r35)
>> @@ -642,8 +642,8 @@ monthrangeb(int y, int m, int jd_flag, i
>> wprintf(L"%-*ls  ",
>> mw, wcenter(ws, year[i].name, mw));
>> else {
>> -   swprintf(ws, sizeof(ws), L"%-ls %d",
>> -   year[i].name, M2Y(m + i));
>> +   swprintf(ws, sizeof(ws)/sizeof(ws[0]),
> 
> Normally we spell this nitems(ws).
> 
>> +   L"%-ls %d", year[i].name, M2Y(m + i));
>> wprintf(L"%-*ls  ", mw, wcenter(ws1, ws, 
>> mw));
>> }
>> printf("\n");
>> @@ -958,7 +958,7 @@ mkweekdays(struct weekdays *wds)
>>
>> for (i = 0; i != 7; i++) {
>> tm.tm_wday = (i+1) % 7;
>> -   wcsftime(buf, sizeof(buf), L"%a", &tm);
>> +   wcsftime(buf, sizeof(buf)/sizeof(buf[0]), L"%a", &tm);
> 
> This one can be nitems(buf) too.
> 
>> for (len = 2; len > 0; --len) {
>> if ((width = wcswidth(buf, len)) <= 2)
>> break;
>>

I thought about that, but I didn't see any obvious signs that
 was included.

___
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: r300006 - head/sys/dev/ral

2016-05-16 Thread Kevin Lo
Author: kevlo
Date: Tue May 17 06:04:33 2016
New Revision: 36
URL: https://svnweb.freebsd.org/changeset/base/36

Log:
  The EEPROM is lying about antennas.  Don't hardcode things based on the chip
  version which is not what the vendor driver happens to do.

Modified:
  head/sys/dev/ral/rt2860.c
  head/sys/dev/ral/rt2860reg.h
  head/sys/dev/ral/rt2860var.h

Modified: head/sys/dev/ral/rt2860.c
==
--- head/sys/dev/ral/rt2860.c   Tue May 17 05:05:30 2016(r35)
+++ head/sys/dev/ral/rt2860.c   Tue May 17 06:04:33 2016(r36)
@@ -165,7 +165,7 @@ static void rt2860_delete_key(struct iee
struct ieee80211_node *, struct ieee80211_key *);
 #endif
 static int8_t  rt2860_rssi2dbm(struct rt2860_softc *, uint8_t, uint8_t);
-static const char *rt2860_get_rf(uint8_t);
+static const char *rt2860_get_rf(uint16_t);
 static int rt2860_read_eeprom(struct rt2860_softc *,
uint8_t macaddr[IEEE80211_ADDR_LEN]);
 static int rt2860_bbp_init(struct rt2860_softc *);
@@ -3307,7 +3307,7 @@ b4inc(uint32_t b32, int8_t delta)
 }
 
 static const char *
-rt2860_get_rf(uint8_t rev)
+rt2860_get_rf(uint16_t rev)
 {
switch (rev) {
case RT2860_RF_2820:return "RT2820";
@@ -3321,6 +3321,7 @@ rt2860_get_rf(uint8_t rev)
case RT3070_RF_3052:return "RT3052";
case RT3070_RF_3320:return "RT3320";
case RT3070_RF_3053:return "RT3053";
+   case RT5390_RF_5360:return "RT5360";
case RT5390_RF_5390:return "RT5390";
default:return "unknown";
}
@@ -3343,9 +3344,11 @@ rt2860_read_eeprom(struct rt2860_softc *
sc->sc_srom_read = rt3090_efuse_read_2;
}
 
+#ifdef RAL_DEBUG
/* read EEPROM version */
val = rt2860_srom_read(sc, RT2860_EEPROM_VERSION);
DPRINTF(("EEPROM rev=%d, FAE=%d\n", val >> 8, val & 0xff));
+#endif
 
/* read MAC address */
val = rt2860_srom_read(sc, RT2860_EEPROM_MAC01);
@@ -3358,9 +3361,11 @@ rt2860_read_eeprom(struct rt2860_softc *
macaddr[4] = val & 0xff;
macaddr[5] = val >> 8;
 
+#ifdef RAL_DEBUG
/* read country code */
val = rt2860_srom_read(sc, RT2860_EEPROM_COUNTRY);
DPRINTF(("EEPROM region code=0x%04x\n", val));
+#endif
 
/* read vendor BBP settings */
for (i = 0; i < 8; i++) {
@@ -3402,39 +3407,12 @@ rt2860_read_eeprom(struct rt2860_softc *
 
/* read RF information */
val = rt2860_srom_read(sc, RT2860_EEPROM_ANTENNA);
-   if (val == 0x) {
-   DPRINTF(("invalid EEPROM antenna info, using default\n"));
-   if (sc->mac_ver >= 0x5390) {
-   /* default to RF5390 */
-   sc->rf_rev = RT5390_RF_5390;
-   sc->ntxchains = (sc->mac_ver == 0x5392) ? 2 : 1;
-   sc->nrxchains = (sc->mac_ver == 0x5392) ? 2 : 1;
-   } else if (sc->mac_ver == 0x3593) {
-   /* default to RF3053 3T3R */
-   sc->rf_rev = RT3070_RF_3053;
-   sc->ntxchains = 3;
-   sc->nrxchains = 3;
-   } else if (sc->mac_ver >= 0x3071) {
-   /* default to RF3020 1T1R */
-   sc->rf_rev = RT3070_RF_3020;
-   sc->ntxchains = 1;
-   sc->nrxchains = 1;
-   } else {
-   /* default to RF2820 1T2R */
-   sc->rf_rev = RT2860_RF_2820;
-   sc->ntxchains = 1;
-   sc->nrxchains = 2;
-   }
-   } else {
+   if (sc->mac_ver >= 0x5390)
+   sc->rf_rev = rt2860_srom_read(sc, RT2860_EEPROM_CHIPID);
+   else
sc->rf_rev = (val >> 8) & 0xf;
-   if (sc->mac_ver >= 0x5390) {
-   sc->ntxchains = (sc->mac_ver == 0x5392) ? 2 : 1;
-   sc->nrxchains = (sc->mac_ver == 0x5392) ? 2 : 1;
-   } else {
-   sc->ntxchains = (val >> 4) & 0xf;
-   sc->nrxchains = val & 0xf;
-   }
-   }
+   sc->ntxchains = (val >> 4) & 0xf;
+   sc->nrxchains = val & 0xf;
DPRINTF(("EEPROM RF rev=0x%02x chains=%dT%dR\n",
sc->rf_rev, sc->ntxchains, sc->nrxchains));
 

Modified: head/sys/dev/ral/rt2860reg.h
==
--- head/sys/dev/ral/rt2860reg.hTue May 17 05:05:30 2016
(r35)
+++ head/sys/dev/ral/rt2860reg.hTue May 17 06:04:33 2016
(r36)
@@ -900,18 +900,19 @@ struct rt2860_rxwi {
 #define RT2860_RF3 1
 #define RT2860_RF4 3
 
-#define RT2860_RF_2820 1   /* 2T3R */
-#define RT2860_RF_2850 2   /* dual-band 2T3R */
-#define RT2860_RF_2720 3   /* 1T2R */
-#

Re: svn commit: r300005 - head/usr.bin/ncal

2016-05-16 Thread Conrad Meyer
On Mon, May 16, 2016 at 10:05 PM, Don Lewis  wrote:
> Author: truckman
> Date: Tue May 17 05:05:30 2016
> New Revision: 35
> URL: https://svnweb.freebsd.org/changeset/base/35
>
> Log:
>   swprintf() and apparently wcsftime() want the their output buffer size
>   specified in terms of the the number of wide characters and not
>   sizeof(buffer).
> ...
> Modified: head/usr.bin/ncal/ncal.c
> ==
> --- head/usr.bin/ncal/ncal.cTue May 17 04:53:21 2016(r34)
> +++ head/usr.bin/ncal/ncal.cTue May 17 05:05:30 2016(r35)
> @@ -642,8 +642,8 @@ monthrangeb(int y, int m, int jd_flag, i
> wprintf(L"%-*ls  ",
> mw, wcenter(ws, year[i].name, mw));
> else {
> -   swprintf(ws, sizeof(ws), L"%-ls %d",
> -   year[i].name, M2Y(m + i));
> +   swprintf(ws, sizeof(ws)/sizeof(ws[0]),

Normally we spell this nitems(ws).

> +   L"%-ls %d", year[i].name, M2Y(m + i));
> wprintf(L"%-*ls  ", mw, wcenter(ws1, ws, mw));
> }
> printf("\n");
> @@ -958,7 +958,7 @@ mkweekdays(struct weekdays *wds)
>
> for (i = 0; i != 7; i++) {
> tm.tm_wday = (i+1) % 7;
> -   wcsftime(buf, sizeof(buf), L"%a", &tm);
> +   wcsftime(buf, sizeof(buf)/sizeof(buf[0]), L"%a", &tm);

This one can be nitems(buf) too.

> for (len = 2; len > 0; --len) {
> if ((width = wcswidth(buf, len)) <= 2)
> break;
>

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


Re: svn commit: r300000 - head/sys/mips/conf

2016-05-16 Thread Sepherosa Ziehau
On Tue, May 17, 2016 at 8:31 AM, Adrian Chadd  wrote:
> Author: adrian
> Date: Tue May 17 00:31:37 2016
> New Revision: 30
> URL: https://svnweb.freebsd.org/changeset/base/30

30!  Congrats! :P
___
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: r300005 - head/usr.bin/ncal

2016-05-16 Thread Don Lewis
Author: truckman
Date: Tue May 17 05:05:30 2016
New Revision: 35
URL: https://svnweb.freebsd.org/changeset/base/35

Log:
  swprintf() and apparently wcsftime() want the their output buffer size
  specified in terms of the the number of wide characters and not
  sizeof(buffer).
  
  Reported by:  Coverity
  CID:  1007605, 1007606
  MFC after:1 week

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

Modified: head/usr.bin/ncal/ncal.c
==
--- head/usr.bin/ncal/ncal.cTue May 17 04:53:21 2016(r34)
+++ head/usr.bin/ncal/ncal.cTue May 17 05:05:30 2016(r35)
@@ -642,8 +642,8 @@ monthrangeb(int y, int m, int jd_flag, i
wprintf(L"%-*ls  ",
mw, wcenter(ws, year[i].name, mw));
else {
-   swprintf(ws, sizeof(ws), L"%-ls %d",
-   year[i].name, M2Y(m + i));
+   swprintf(ws, sizeof(ws)/sizeof(ws[0]),
+   L"%-ls %d", year[i].name, M2Y(m + i));
wprintf(L"%-*ls  ", mw, wcenter(ws1, ws, mw));
}
printf("\n");
@@ -958,7 +958,7 @@ mkweekdays(struct weekdays *wds)
 
for (i = 0; i != 7; i++) {
tm.tm_wday = (i+1) % 7;
-   wcsftime(buf, sizeof(buf), L"%a", &tm);
+   wcsftime(buf, sizeof(buf)/sizeof(buf[0]), L"%a", &tm);
for (len = 2; len > 0; --len) {
if ((width = wcswidth(buf, len)) <= 2)
break;
___
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: r300004 - stable/10/sys/netinet

2016-05-16 Thread Sepherosa Ziehau
Author: sephe
Date: Tue May 17 04:53:21 2016
New Revision: 34
URL: https://svnweb.freebsd.org/changeset/base/34

Log:
  MFC r298769, r299315
  
  r298769
  =
  tcp/syncache: Set flowid and hash type properly for SYN|ACK
  
  So the underlying drivers can use it to select the sending queue
  properly for SYN|ACK instead of rolling their own hash.
  
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D6120
  
  r299315
  =
  tcp/syncache: Add comment for syncache_respond
  
  Suggested by:   hiren, hps
  Reviewed by:sbruno
  Sponsored by:   Microsoft OSTC
  Differential Revision:  https://reviews.freebsd.org/D6148

Modified:
  stable/10/sys/netinet/tcp_syncache.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netinet/tcp_syncache.c
==
--- stable/10/sys/netinet/tcp_syncache.cTue May 17 04:40:00 2016
(r33)
+++ stable/10/sys/netinet/tcp_syncache.cTue May 17 04:53:21 2016
(r34)
@@ -124,7 +124,7 @@ SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO,
 static void syncache_drop(struct syncache *, struct syncache_head *);
 static void syncache_free(struct syncache *);
 static void syncache_insert(struct syncache *, struct syncache_head *);
-static int  syncache_respond(struct syncache *);
+static int  syncache_respond(struct syncache *, const struct mbuf *);
 static struct   socket *syncache_socket(struct syncache *, struct socket *,
struct mbuf *m);
 static int  syncache_sysctl_count(SYSCTL_HANDLER_ARGS);
@@ -480,7 +480,7 @@ syncache_timer(void *xsch)
free(s, M_TCPLOG);
}
 
-   (void) syncache_respond(sc);
+   (void) syncache_respond(sc, NULL);
TCPSTAT_INC(tcps_sc_retransmitted);
syncache_timeout(sc, sch, 0);
}
@@ -1307,7 +1307,7 @@ syncache_add(struct in_conninfo *inc, st
s, __func__);
free(s, M_TCPLOG);
}
-   if (syncache_respond(sc) == 0) {
+   if (syncache_respond(sc, m) == 0) {
sc->sc_rxmits = 0;
syncache_timeout(sc, sch, 1);
TCPSTAT_INC(tcps_sndacks);
@@ -1476,7 +1476,7 @@ skip_alloc:
/*
 * Do a standard 3-way handshake.
 */
-   if (syncache_respond(sc) == 0) {
+   if (syncache_respond(sc, m) == 0) {
if (V_tcp_syncookies && V_tcp_syncookiesonly && sc != &scs)
syncache_free(sc);
else if (sc != &scs)
@@ -1506,8 +1506,12 @@ tfo_done:
return (rv);
 }
 
+/*
+ * Send SYN|ACK to the peer.  Either in response to the peer's SYN,
+ * i.e. m0 != NULL, or upon 3WHS ACK timeout, i.e. m0 == NULL.
+ */
 static int
-syncache_respond(struct syncache *sc)
+syncache_respond(struct syncache *sc, const struct mbuf *m0)
 {
struct ip *ip = NULL;
struct mbuf *m;
@@ -1664,6 +1668,15 @@ syncache_respond(struct syncache *sc)
 
M_SETFIB(m, sc->sc_inc.inc_fibnum);
m->m_pkthdr.csum_data = offsetof(struct tcphdr, th_sum);
+   /*
+* If we have peer's SYN and it has a flowid, then let's assign it to
+* our SYN|ACK.  ip6_output() and ip_output() will not assign flowid
+* to SYN|ACK due to lack of inp here.
+*/
+   if (m0 != NULL && M_HASHTYPE_GET(m0) != M_HASHTYPE_NONE) {
+   m->m_pkthdr.flowid = m0->m_pkthdr.flowid;
+   M_HASHTYPE_SET(m, M_HASHTYPE_GET(m0));
+   }
 #ifdef INET6
if (sc->sc_inc.inc_flags & INC_ISIPV6) {
m->m_pkthdr.csum_flags = CSUM_TCP_IPV6;
___
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: r300003 - head/share/man/man4

2016-05-16 Thread Greg Lehey
Author: grog
Date: Tue May 17 04:40:00 2016
New Revision: 33
URL: https://svnweb.freebsd.org/changeset/base/33

Log:
  Correct use of incorrect grammar.

Modified:
  head/share/man/man4/gdb.4

Modified: head/share/man/man4/gdb.4
==
--- head/share/man/man4/gdb.4   Tue May 17 04:03:45 2016(r32)
+++ head/share/man/man4/gdb.4   Tue May 17 04:40:00 2016(r33)
@@ -595,7 +595,7 @@ run the link at more than 9600 bps.
 Firewire connections do not have this problem.
 .Pp
 The debugging macros
-.Dq "just grown" .
+.Dq "just growed" .
 In general, the person who wrote them did so while looking for a specific
 problem, so they may not be general enough, and they may behave badly when used
 in ways for which they were not intended, even if those ways make sense.
___
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: r300002 - head/usr.sbin/rarpd

2016-05-16 Thread Don Lewis
Author: truckman
Date: Tue May 17 04:03:45 2016
New Revision: 32
URL: https://svnweb.freebsd.org/changeset/base/32

Log:
  When clearing rtmsg, pass &rtmsg to bzero() instead of the address of
  just the header
  
  Reported by:  Coverity
  CID:  1007568, 1194256
  MFC after:1 week

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

Modified: head/usr.sbin/rarpd/rarpd.c
==
--- head/usr.sbin/rarpd/rarpd.c Tue May 17 00:32:36 2016(r31)
+++ head/usr.sbin/rarpd/rarpd.c Tue May 17 04:03:45 2016(r32)
@@ -739,7 +739,7 @@ update_arptab(u_char *ep, in_addr_t ipad
 
/* Get the type and interface index */
rt = &rtmsg.rthdr;
-   bzero(rt, sizeof(rtmsg));
+   bzero(&rtmsg, sizeof(rtmsg));
rt->rtm_version = RTM_VERSION;
rt->rtm_addrs = RTA_DST;
rt->rtm_type = RTM_GET;
___
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: r299997 - head/sys/boot/i386/zfsboot

2016-05-16 Thread Ngie Cooper
On Mon, May 16, 2016 at 5:24 PM, Peter Wemm  wrote:
> Author: peter
> Date: Tue May 17 00:24:53 2016
> New Revision: 27
> URL: https://svnweb.freebsd.org/changeset/base/27
>
> Log:
>   Attempt to fix r299660:
>   slba is used only for the GPT case.
>   elba is used if either GPT or LOADER_GELI_SUPPORT is enabled.

Ugh -- sorry :(...

Pointyhat to: ngie
___
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: r299995 - head/usr.bin/kdump

2016-05-16 Thread Simon J. Gerraty
Ngie Cooper  wrote:
> Please use `!= 0` for explicitness.

Sure.

___
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: r300001 - head/sys/net

2016-05-16 Thread Bjoern A. Zeeb
Author: bz
Date: Tue May 17 00:32:36 2016
New Revision: 31
URL: https://svnweb.freebsd.org/changeset/base/31

Log:
  Mark the unused arguments of various SYSINIT functions __unused.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/net/vnet.c

Modified: head/sys/net/vnet.c
==
--- head/sys/net/vnet.c Tue May 17 00:31:37 2016(r30)
+++ head/sys/net/vnet.c Tue May 17 00:32:36 2016(r31)
@@ -304,7 +304,7 @@ vnet_destroy(struct vnet *vnet)
  * Boot time initialization and allocation of virtual network stacks.
  */
 static void
-vnet_init_prelink(void *arg)
+vnet_init_prelink(void *arg __unused)
 {
 
rw_init(&vnet_rwlock, "vnet_rwlock");
@@ -316,7 +316,7 @@ SYSINIT(vnet_init_prelink, SI_SUB_VNET_P
 vnet_init_prelink, NULL);
 
 static void
-vnet0_init(void *arg)
+vnet0_init(void *arg __unused)
 {
 
/* Warn people before take off - in case we crash early. */
@@ -333,7 +333,7 @@ vnet0_init(void *arg)
 SYSINIT(vnet0_init, SI_SUB_VNET, SI_ORDER_FIRST, vnet0_init, NULL);
 
 static void
-vnet_init_done(void *unused)
+vnet_init_done(void *unused __unused)
 {
 
curvnet = 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: r300000 - head/sys/mips/conf

2016-05-16 Thread Adrian Chadd
Author: adrian
Date: Tue May 17 00:31:37 2016
New Revision: 30
URL: https://svnweb.freebsd.org/changeset/base/30

Log:
  [mips] also add otus/urtwn USB modules.
  
  I'm using both AR933x (because the boards fit in small boxes) as well
  as AR934x for doing USB wifi testing on MIPS.
  
  So far so good, for both of them.

Modified:
  head/sys/mips/conf/AR933X_BASE

Modified: head/sys/mips/conf/AR933X_BASE
==
--- head/sys/mips/conf/AR933X_BASE  Tue May 17 00:30:34 2016
(r29)
+++ head/sys/mips/conf/AR933X_BASE  Tue May 17 00:31:37 2016
(r30)
@@ -20,7 +20,7 @@ files "../atheros/files.ar71xx"
 hints  "AR933X_BASE.hints"
 
 makeoptionsDEBUG=-g#Build kernel with gdb(1) debug symbols
-makeoptionsMODULES_OVERRIDE="gpio ar71xx if_gif if_vlan if_gre if_bridge 
bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp 
wlan_rssadapt wlan_amrr hwpmc ipfw"
+makeoptionsMODULES_OVERRIDE="gpio ar71xx if_gif if_vlan if_gre if_bridge 
bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp 
wlan_rssadapt wlan_amrr hwpmc ipfw urtwn urtwnfw otus otusfw"
 
 optionsDDB
 optionsKDB
___
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: r299999 - head/sys/mips/conf

2016-05-16 Thread Adrian Chadd
Author: adrian
Date: Tue May 17 00:30:34 2016
New Revision: 29
URL: https://svnweb.freebsd.org/changeset/base/29

Log:
  [mips] add urtwn and otus NIC modules.
  
  I'm using this platform for testing USB wifi on MIPS.

Modified:
  head/sys/mips/conf/AR934X_BASE

Modified: head/sys/mips/conf/AR934X_BASE
==
--- head/sys/mips/conf/AR934X_BASE  Tue May 17 00:27:18 2016
(r28)
+++ head/sys/mips/conf/AR934X_BASE  Tue May 17 00:30:34 2016
(r29)
@@ -20,7 +20,7 @@ files "../atheros/files.ar71xx"
 hints  "AR934X_BASE.hints"
 
 makeoptionsDEBUG=-g#Build kernel with gdb(1) debug symbols
-makeoptionsMODULES_OVERRIDE="gpio ar71xx if_gif if_gre if_vlan if_bridge 
bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp 
wlan_rssadapt wlan_amrr ath ath_ahb hwpmc ipfw ipfw_nat libalias"
+makeoptionsMODULES_OVERRIDE="gpio ar71xx if_gif if_gre if_vlan if_bridge 
bridgestp usb wlan wlan_xauth wlan_acl wlan_wep wlan_tkip wlan_ccmp 
wlan_rssadapt wlan_amrr ath ath_ahb hwpmc ipfw ipfw_nat libalias urtwn urtwnfw 
otus otusfw"
 # makeoptions  MODULES_OVERRIDE=""
 
 optionsDDB
___
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: r299998 - head/usr.bin/kdump

2016-05-16 Thread Simon J. Gerraty
Author: sjg
Date: Tue May 17 00:27:18 2016
New Revision: 28
URL: https://svnweb.freebsd.org/changeset/base/28

Log:
  Use != 0 to be clear

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

Modified: head/usr.bin/kdump/kdump.c
==
--- head/usr.bin/kdump/kdump.c  Tue May 17 00:24:53 2016(r27)
+++ head/usr.bin/kdump/kdump.c  Tue May 17 00:27:18 2016(r28)
@@ -298,7 +298,7 @@ main(int argc, char *argv[])
m = malloc(size = 1025);
if (m == NULL)
errx(1, "%s", strerror(ENOMEM));
-   if (strcmp(tracefile, "-"))
+   if (strcmp(tracefile, "-") != 0)
if (!freopen(tracefile, "r", stdin))
err(1, "%s", tracefile);
 
___
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: r299556 - head/sys/dev/ixl

2016-05-16 Thread Adrian Chadd
Hi,

ixl doesn't build on -HEAD. The netmap ixl bits also aren't building
for me. What gives? :)


-a
___
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: r299997 - head/sys/boot/i386/zfsboot

2016-05-16 Thread Peter Wemm
Author: peter
Date: Tue May 17 00:24:53 2016
New Revision: 27
URL: https://svnweb.freebsd.org/changeset/base/27

Log:
  Attempt to fix r299660:
  slba is used only for the GPT case.
  elba is used if either GPT or LOADER_GELI_SUPPORT is enabled.

Modified:
  head/sys/boot/i386/zfsboot/zfsboot.c

Modified: head/sys/boot/i386/zfsboot/zfsboot.c
==
--- head/sys/boot/i386/zfsboot/zfsboot.cTue May 17 00:23:46 2016
(r26)
+++ head/sys/boot/i386/zfsboot/zfsboot.cTue May 17 00:24:53 2016
(r27)
@@ -397,10 +397,12 @@ probe_drive(struct dsk *dsk)
 struct gpt_hdr hdr;
 struct gpt_ent *ent;
 unsigned part, entries_per_sec;
+daddr_t slba;
 #endif
-#ifdef LOADER_GELI_SUPPORT
-daddr_t slba, elba;
+#if defined(GPT) || defined(LOADER_GELI_SUPPORT)
+daddr_t elba;
 #endif
+
 struct dos_partition *dp;
 char *sec;
 unsigned 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: r299996 - in head/sys/dev/bhnd: . bcma bhndb cores/chipc cores/pci nvram siba

2016-05-16 Thread Adrian Chadd
Author: adrian
Date: Tue May 17 00:23:46 2016
New Revision: 26
URL: https://svnweb.freebsd.org/changeset/base/26

Log:
  [bhnd] Centralize fetching of board information
  
  Centralizes fetching of board information (vendor, type, revision, etc),
  and adds support for matching quirks against board identification info.
  
  * Adds a BHND_BUS_READ_BOARD_INFO(), allowing bhnd bus/bus parent(s) to
handle implementation-specific fetching of board info.
  * Integrates board type constants from the latest Broadcom ISC-licensed
bcmdevs.h included in dd-wrt's Broadcom driver source drops.
  * Adds support for matching on chip/board quirks to bhnd_device_quirks()/
bhnd_chip_quirks().
  * Use the new board/chip quirk matching to match Apple devices that failed
to set BFL2_PCIEWAR_OVR in SROM.
  
  Submitted by: Landon Fuller 
  Differential Revision:https://reviews.freebsd.org/D6361

Modified:
  head/sys/dev/bhnd/bcma/bcma_bhndb.c
  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_ids.h
  head/sys/dev/bhnd/bhnd_subr.c
  head/sys/dev/bhnd/bhndb/bhndb.c
  head/sys/dev/bhnd/bhndb/bhndb_if.m
  head/sys/dev/bhnd/bhndb/bhndb_pci.c
  head/sys/dev/bhnd/cores/chipc/chipc.c
  head/sys/dev/bhnd/cores/pci/bhnd_pci.c
  head/sys/dev/bhnd/cores/pci/bhnd_pci_hostb.c
  head/sys/dev/bhnd/cores/pci/bhnd_pci_hostbvar.h
  head/sys/dev/bhnd/nvram/nvram_map
  head/sys/dev/bhnd/siba/siba_bhndb.c

Modified: head/sys/dev/bhnd/bcma/bcma_bhndb.c
==
--- head/sys/dev/bhnd/bcma/bcma_bhndb.c Tue May 17 00:08:43 2016
(r25)
+++ head/sys/dev/bhnd/bcma/bcma_bhndb.c Tue May 17 00:23:46 2016
(r26)
@@ -166,6 +166,20 @@ bcma_bhndb_resume_child(device_t dev, de
return (0);
 }
 
+static int
+bcma_bhndb_read_board_info(device_t dev, device_t child,
+struct bhnd_board_info *info)
+{
+   int error;
+
+   /* Initialize with NVRAM-derived values */
+   if ((error = bhnd_bus_generic_read_board_info(dev, child, info)))
+   return (error);
+
+   /* Let the bridge fill in any additional data */
+   return (BHNDB_POPULATE_BOARD_INFO(device_get_parent(dev), dev, info));
+}
+
 static device_method_t bcma_bhndb_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, bcma_bhndb_probe),
@@ -175,6 +189,9 @@ static device_method_t bcma_bhndb_method
DEVMETHOD(bus_suspend_child,bcma_bhndb_suspend_child),
DEVMETHOD(bus_resume_child, bcma_bhndb_resume_child),
 
+   /* BHND interface */
+   DEVMETHOD(bhnd_bus_read_board_info, bcma_bhndb_read_board_info),
+
DEVMETHOD_END
 };
 

Modified: head/sys/dev/bhnd/bhnd.c
==
--- head/sys/dev/bhnd/bhnd.cTue May 17 00:08:43 2016(r25)
+++ head/sys/dev/bhnd/bhnd.cTue May 17 00:23:46 2016(r26)
@@ -58,11 +58,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#include "nvram/bhnd_nvram.h"
-
-#include "bhnd_chipc_if.h"
-#include "bhnd_nvram_if.h"
-
 #include "bhnd.h"
 #include "bhndvar.h"
 
@@ -85,8 +80,6 @@ static const struct bhnd_nomatch {
{ BHND_MFGID_INVALID,   BHND_COREID_INVALID,false   }
 };
 
-static device_tfind_nvram_child(device_t dev);
-
 static int compare_ascending_probe_order(const void *lhs,
const void *rhs);
 static int compare_descending_probe_order(const void *lhs,
@@ -314,7 +307,9 @@ bhnd_generic_get_probe_order(device_t de
 {
switch (bhnd_get_class(child)) {
case BHND_DEVCLASS_CC:
-   return (BHND_PROBE_BUS + BHND_PROBE_ORDER_FIRST);
+   /* Must be early enough to provide NVRAM access to the
+* host bridge */
+   return (BHND_PROBE_ROOT + BHND_PROBE_ORDER_FIRST);
 
case BHND_DEVCLASS_CC_B:
/* fall through */
@@ -381,68 +376,6 @@ bhnd_generic_is_region_valid(device_t de
 }
 
 /**
- * Find an NVRAM child device on @p dev, if any.
- * 
- * @retval device_t An NVRAM device.
- * @retval NULL If no NVRAM device is found.
- */
-static device_t
-find_nvram_child(device_t dev)
-{
-   device_tchipc, nvram;
-
-   /* Look for a directly-attached NVRAM child */
-   nvram = device_find_child(dev, "bhnd_nvram", 0);
-   if (nvram != NULL)
-   return (nvram);
-
-   /* Remaining checks are only applicable when searching a bhnd(4)
-* bus. */
-   if (device_get_devclass(dev) != bhnd_devclass)
-   return (NULL);
-
-   /* Look for a ChipCommon device */
-   if ((chipc = bhnd_find_child(dev, BHND_DEVCLASS_CC, -1)) != NULL) {
-   bhnd_nvram_src_t src;
-
-   /* Query the NVRAM source and determine whether it's
-* accessible via the ChipCommon device */
- 

Re: svn commit: r299995 - head/usr.bin/kdump

2016-05-16 Thread Ngie Cooper
On Mon, May 16, 2016 at 5:08 PM, Simon J. Gerraty  wrote:
> Author: sjg
> Date: Tue May 17 00:08:43 2016
> New Revision: 25
> URL: https://svnweb.freebsd.org/changeset/base/25
>
> Log:
>   Allow -f - to read from stdin.
>
> Modified:
>   head/usr.bin/kdump/kdump.c
>
> Modified: head/usr.bin/kdump/kdump.c
> ==
> --- head/usr.bin/kdump/kdump.c  Tue May 17 00:00:01 2016(r24)
> +++ head/usr.bin/kdump/kdump.c  Tue May 17 00:08:43 2016(r25)
> @@ -298,8 +298,9 @@ main(int argc, char *argv[])
> m = malloc(size = 1025);
> if (m == NULL)
> errx(1, "%s", strerror(ENOMEM));
> -   if (!freopen(tracefile, "r", stdin))
> -   err(1, "%s", tracefile);
> +   if (strcmp(tracefile, "-"))

Please use `!= 0` for explicitness.
Thanks,
-Ngie
___
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: r299995 - head/usr.bin/kdump

2016-05-16 Thread Simon J. Gerraty
Author: sjg
Date: Tue May 17 00:08:43 2016
New Revision: 25
URL: https://svnweb.freebsd.org/changeset/base/25

Log:
  Allow -f - to read from stdin.

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

Modified: head/usr.bin/kdump/kdump.c
==
--- head/usr.bin/kdump/kdump.c  Tue May 17 00:00:01 2016(r24)
+++ head/usr.bin/kdump/kdump.c  Tue May 17 00:08:43 2016(r25)
@@ -298,8 +298,9 @@ main(int argc, char *argv[])
m = malloc(size = 1025);
if (m == NULL)
errx(1, "%s", strerror(ENOMEM));
-   if (!freopen(tracefile, "r", stdin))
-   err(1, "%s", tracefile);
+   if (strcmp(tracefile, "-"))
+   if (!freopen(tracefile, "r", stdin))
+   err(1, "%s", tracefile);
 
strerror_init();
localtime_init();
___
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: r299994 - in head/sys/mips: broadcom conf

2016-05-16 Thread Adrian Chadd
Author: adrian
Date: Tue May 17 00:00:01 2016
New Revision: 24
URL: https://svnweb.freebsd.org/changeset/base/24

Log:
  [mips/broadcom] Add initial support for Broadcom MIPS processor
  
  Relies on BHND(4) driver.
  
  There files contains machine-dependent code for Broadcom MIPS processor and
  provide UART driver.
  
  This is a work in progress; it and the current bhnd code is enough to boot
  on the ASUS RT-N16 and RT-N53 platforms.
  
  Submitted by: Michael Zhilin 
  Differential Revision:https://reviews.freebsd.org/D6251

Added:
  head/sys/mips/broadcom/bcm_machdep.c   (contents, props changed)
  head/sys/mips/broadcom/bcm_socinfo.c   (contents, props changed)
  head/sys/mips/broadcom/bcm_socinfo.h   (contents, props changed)
  head/sys/mips/broadcom/files.broadcom   (contents, props changed)
  head/sys/mips/broadcom/std.broadcom   (contents, props changed)
  head/sys/mips/broadcom/uart_bus_chipc.c   (contents, props changed)
  head/sys/mips/broadcom/uart_cpu_chipc.c   (contents, props changed)
  head/sys/mips/conf/BCM   (contents, props changed)
  head/sys/mips/conf/BCM.hints   (contents, props changed)

Added: head/sys/mips/broadcom/bcm_machdep.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/mips/broadcom/bcm_machdep.cTue May 17 00:00:01 2016
(r24)
@@ -0,0 +1,221 @@
+/*-
+ * Copyright (c) 2007 Bruce M. Simpson.
+ * Copyright (c) 2016 Michael Zhilin 
+ *
+ * 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 AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include "opt_ddb.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 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include "bcm_socinfo.h"
+
+#ifdef CFE
+#include 
+#endif
+
+#if 0
+#define BROADCOM_TRACE 0
+#endif
+
+extern int *edata;
+extern int *end;
+
+void
+platform_cpu_init()
+{
+   /* Nothing special */
+}
+
+static void
+mips_init(void)
+{
+   int i, j;
+
+   printf("entry: mips_init()\n");
+
+#ifdef CFE
+   /*
+* Query DRAM memory map from CFE.
+*/
+   physmem = 0;
+   for (i = 0; i < 10; i += 2) {
+   int result;
+   uint64_t addr, len, type;
+
+   result = cfe_enummem(i / 2, 0, &addr, &len, &type);
+   if (result < 0) {
+#ifdef BROADCOM_TRACE
+   printf("There is no phys memory for: %d\n", i);
+#endif
+   phys_avail[i] = phys_avail[i + 1] = 0;
+   break;
+   }
+   if (type != CFE_MI_AVAILABLE){
+#ifdef BROADCOM_TRACE
+   printf("phys memory is not available: %d\n", i);
+#endif
+   continue;
+   }
+
+   phys_avail[i] = addr;
+   if (i == 0 && addr == 0) {
+   /*
+* If this is the first physical memory segment probed
+* from CFE, omit the region at the start of physical
+* memory where the kernel has been loaded.
+*/
+   phys_avail[i] += MIPS_KSEG0_TO_PHYS(kernel_kseg0_end);
+   }
+#ifdef BROADCOM_TRACE
+   printf("phys memory is available for: %d\n", i);
+   printf(" => addr =  %jx\n", addr);
+   

svn commit: r299993 - head/sys/conf

2016-05-16 Thread Adrian Chadd
Author: adrian
Date: Mon May 16 23:56:31 2016
New Revision: 23
URL: https://svnweb.freebsd.org/changeset/base/23

Log:
  [mips] Improve MIPS trampoline code
  
  This patch fix trampoline build. inckern.S increases stack and calls _startC
  of elf_trampoline, so inckern.S should be called before elf_trampoline. 
gcc4.2 puts
  text (code) into image according to order of source files in this call, so 
order has changed.
  
  In addition make will install trampoline kernel. It allows to use kernel for 
firmware build.
  
  Submitted by: Michael Zhilin 
  Differential Revision:https://reviews.freebsd.org/D6242

Modified:
  head/sys/conf/Makefile.mips

Modified: head/sys/conf/Makefile.mips
==
--- head/sys/conf/Makefile.mips Mon May 16 23:54:28 2016(r22)
+++ head/sys/conf/Makefile.mips Mon May 16 23:56:31 2016(r23)
@@ -62,6 +62,7 @@ ASM_CFLAGS+=${CFLAGS} -D_LOCORE -DLOCORE
 
 .if !defined(WITHOUT_KERNEL_TRAMPOLINE)
 KERNEL_EXTRA=trampoline
+KERNEL_EXTRA_INSTALL=${KERNEL_KO}.tramp.bin
 trampoline: ${KERNEL_KO}.tramp.bin
 ${KERNEL_KO}.tramp.bin: ${KERNEL_KO} $S/$M/$M/elf_trampoline.c \
$S/$M/$M/inckern.S 
@@ -72,7 +73,7 @@ ${KERNEL_KO}.tramp.bin: ${KERNEL_KO} $S/
${CC} -O -nostdlib -I. -I$S ${TRAMP_EXTRA_FLAGS} ${TRAMP_LDFLAGS} 
-Xlinker \
-T -Xlinker ${LDSCRIPT_NAME}.tramp.noheader \
-DKERNNAME="\"${KERNEL_KO}.tmp\"" -DELFSIZE=${TRAMP_ELFSIZE} \
-   $S/$M/$M/elf_trampoline.c $S/$M/$M/inckern.S \
+   $S/$M/$M/inckern.S $S/$M/$M/elf_trampoline.c \
-o ${KERNEL_KO}.tramp.elf
${OBJCOPY} -S -O binary ${KERNEL_KO}.tramp.elf \
${KERNEL_KO}.tramp.bin
___
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: r299992 - head/sys/mips/broadcom

2016-05-16 Thread Adrian Chadd
Author: adrian
Date: Mon May 16 23:54:28 2016
New Revision: 22
URL: https://svnweb.freebsd.org/changeset/base/22

Log:
  [mips/broadcom] Add initial code for interrupts on the Broadcom MIPS processor
  
  Broadcom MIPS processor doesn't reset TI flag if additional manipulation
  is done.
  
  Thanks to @sobomax!

Added:
  head/sys/mips/broadcom/
  head/sys/mips/broadcom/bcm_mipscore.c   (contents, props changed)
  head/sys/mips/broadcom/bcm_mipscore.h   (contents, props changed)

Added: head/sys/mips/broadcom/bcm_mipscore.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/mips/broadcom/bcm_mipscore.c   Mon May 16 23:54:28 2016
(r22)
@@ -0,0 +1,123 @@
+/*-
+ * Copyright (c) 2016 Michael Zhilin 
+ * 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,
+ *without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ *redistribution must be conditioned upon including a substantially
+ *similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "bcm_mipscore.h"
+
+static const struct resource_spec mipscore_rspec[MIPSCORE_MAX_RSPEC] = {
+   { SYS_RES_MEMORY,   0,  RF_ACTIVE },
+   { -1, -1, 0 }
+};
+
+struct bhnd_device mipscore_match[] = {
+   BHND_MIPS_DEVICE(MIPS,  "BHND MIPS processor",  NULL),
+   BHND_MIPS_DEVICE(MIPS33,"BHND MIPS3302 processor",  NULL),
+   BHND_MIPS_DEVICE(MIPS74K,   "BHND MIPS74K processor",   NULL),
+   BHND_DEVICE_END
+};
+
+static int
+mipscore_probe(device_t dev)
+{
+   const struct bhnd_device *id;
+
+   id = bhnd_device_lookup(dev, mipscore_match, sizeof(mipscore_match[0]));
+   if (id == NULL)
+   return (ENXIO);
+
+   bhnd_set_default_core_desc(dev);
+   return (BUS_PROBE_DEFAULT);
+}
+
+static int
+mipscore_attach(device_t dev)
+{
+   struct mipscore_softc   *sc;
+   struct resource *res;
+   uint32_t intmask;
+   uint16_t devid;
+   int  error;
+
+   sc = device_get_softc(dev);
+   devid = bhnd_get_device(dev);
+
+   sc->devid = devid;
+   sc->dev = dev;
+
+   /* Allocate bus resources */
+   memcpy(sc->rspec, mipscore_rspec, sizeof(sc->rspec));
+   error = bhnd_alloc_resources(dev, sc->rspec, sc->res);
+   if (error)
+   return (error);
+
+   res = sc->res[0]->res;
+   if (res == NULL)
+   return (ENXIO);
+
+   if (devid == BHND_COREID_MIPS74K) {
+   intmask = (1 << 31);
+   /* Use intmask5 register to route the timer interrupt */
+   bus_write_4(res, offsetof(struct mipscore_regs, intmask[5]),
+   intmask);
+   }
+
+   return (0);
+}
+
+static device_method_t mipscore_methods[] = {
+   DEVMETHOD(device_probe, mipscore_probe),
+   DEVMETHOD(device_attach,mipscore_attach),
+   DEVMETHOD_END
+};
+
+devclass_t bhnd_mipscore_devclass;
+
+DEFINE_CLASS_0(bhnd_mipscore, mipscore_driver, mipscore_methods,
+   sizeof(struct mipscore_softc));
+DRIVER_MODULE(bhnd_mipscore, bhnd, mipscore_driver, bhnd_mipscore_devclass,
+   0, 0);
+MODULE_VERSION(bhnd_mipscore, 1);

Added: head/sys/mips/broadcom/bcm_mipscore.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/mips/broadcom/b

svn commit: r299991 - head/usr.sbin/ppp

2016-05-16 Thread Don Lewis
Author: truckman
Date: Mon May 16 23:47:08 2016
New Revision: 21
URL: https://svnweb.freebsd.org/changeset/base/21

Log:
  Don't walk off the end of the array when proto isn't explicitly
  listed above.  Instead update the catch-all "Others" bucket.
  
  Reported by:  Coverity
  CID:  1007571, 1007572
  MFC after:1 week

Modified:
  head/usr.sbin/ppp/link.c

Modified: head/usr.sbin/ppp/link.c
==
--- head/usr.sbin/ppp/link.cMon May 16 23:40:32 2016(r20)
+++ head/usr.sbin/ppp/link.cMon May 16 23:47:08 2016(r21)
@@ -209,7 +209,7 @@ static struct protostatheader {
   { PROTO_LQR, "LQR" },
   { PROTO_CHAP, "CHAP" },
   { PROTO_MP, "MULTILINK" },
-  { 0, "Others" }
+  { 0, "Others" }  /* must be last */
 };
 
 void
@@ -218,13 +218,13 @@ link_ProtocolRecord(struct link *l, u_sh
   int i;
 
   for (i = 0; i < NPROTOSTAT; i++)
-if (ProtocolStat[i].number == proto)
+if (ProtocolStat[i].number == proto || ProtocolStat[i].number == 0) {
+  if (type == PROTO_IN)
+l->proto_in[i]++;
+  else
+l->proto_out[i]++;
   break;
-
-  if (type == PROTO_IN)
-l->proto_in[i]++;
-  else
-l->proto_out[i]++;
+}
 }
 
 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: r299990 - in head/sys: conf dev/bhnd

2016-05-16 Thread Adrian Chadd
Author: adrian
Date: Mon May 16 23:40:32 2016
New Revision: 20
URL: https://svnweb.freebsd.org/changeset/base/20

Log:
  [bhnd] Add logging macros to BHND.
  
  There are 5 logging levels:
  
  * ERROR
  * WARN
  * INFO
  * DEBUG
  * TRACE
  
  There are 2 logging context:
  
  * with
  * without device
  
  DEBUG and TRACE records are printed only if bootverbose.
  Logging records are printed with source code line information if acceptable
  logging level is DEBUG or TRACE.
  
  Submitted by: Michael Zhilin 
  Differential Revision:https://reviews.freebsd.org/D6247

Added:
  head/sys/dev/bhnd/bhnd_debug.h   (contents, props changed)
Modified:
  head/sys/conf/NOTES
  head/sys/conf/options
  head/sys/dev/bhnd/bhnd.h

Modified: head/sys/conf/NOTES
==
--- head/sys/conf/NOTES Mon May 16 23:37:18 2016(r299989)
+++ head/sys/conf/NOTES Mon May 16 23:40:32 2016(r20)
@@ -3061,3 +3061,6 @@ options   EM_MULTIQUEUE # Activate multiq
 # zlib I/O stream support
 # This enables support for compressed core dumps.
 optionsGZIO
+
+# BHND(4) drivers
+optionsBHND_LOGLEVEL   # Logging threshold level
\ No newline at end of file

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Mon May 16 23:37:18 2016(r299989)
+++ head/sys/conf/options   Mon May 16 23:40:32 2016(r20)
@@ -979,3 +979,6 @@ RANDOM_ENABLE_UMA   opt_global.h
 
 # Intel em(4) driver
 EM_MULTIQUEUE  opt_em.h
+
+# BHND(4) driver
+BHND_LOGLEVEL  opt_global.h

Modified: head/sys/dev/bhnd/bhnd.h
==
--- head/sys/dev/bhnd/bhnd.hMon May 16 23:37:18 2016(r299989)
+++ head/sys/dev/bhnd/bhnd.hMon May 16 23:40:32 2016(r20)
@@ -39,6 +39,7 @@
 
 #include "bhnd_ids.h"
 #include "bhnd_types.h"
+#include "bhnd_debug.h"
 #include "bhnd_bus_if.h"
 
 extern devclass_t bhnd_devclass;

Added: head/sys/dev/bhnd/bhnd_debug.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/bhnd/bhnd_debug.h  Mon May 16 23:40:32 2016
(r20)
@@ -0,0 +1,192 @@
+/*-
+ * Copyright (c) 2016 Michael Zhilin 
+ * 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,
+ *without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ *similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ *redistribution must be conditioned upon including a substantially
+ *similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES.
+ */
+
+/* $FreeBSD$ */
+
+/*
+ * This file provides set of macros for logging:
+ *  - BHND_ and
+ *  - BHND__DEV
+ * where LEVEL = {ERROR,WARN,INFO,DEBUG}
+ *
+ * BHND_ macros is proxies to printf call and accept same parameters,
+ * for instance:
+ * BHND_INFO("register %d has value %d", reg, val);
+ *
+ * BHND__DEV macros is proxies to device_printf call and accept
+ * same parameters, for instance:
+ * BHND_INFO_DEV(dev, "register %d has value %d", reg, val);
+ *
+ * All macros contains newline char at the end of each call
+ *
+ * ERROR, WARN, INFO messages are printed only if:
+ * - log message level is lower than BHND_LOGGING (logging threshold)
+ *
+ * DEBUG, TRACE messages are printed only if:
+ * - bootverbose and
+ * - log message level is lower than BHND_LOGGING (logging threshold)
+ *
+ * In addition, for debugging purpose log message contains information about
+ * file name and line number if BHND_LOGGING is more than BHND_INFO_LEVEL
+ *
+ * NOTE: macros starting with underscore (_) are private and should be not used
+ *
+ * To override logging (for instance, fo

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

2016-05-16 Thread Adrian Chadd
Author: adrian
Date: Mon May 16 23:37:18 2016
New Revision: 299989
URL: https://svnweb.freebsd.org/changeset/base/299989

Log:
  [bhnd] Add support for matching of MIPS & ARM cores
  
  Extend macros for MIPS & ARM cores. Now only BCM cores can be matched by 
matching mechanism.
  
  Submitted by: Michael Zhilin 
  Differential Revision:https://reviews.freebsd.org/D6246

Modified:
  head/sys/dev/bhnd/bhnd.h

Modified: head/sys/dev/bhnd/bhnd.h
==
--- head/sys/dev/bhnd/bhnd.hMon May 16 23:29:04 2016(r299988)
+++ head/sys/dev/bhnd/bhnd.hMon May 16 23:37:18 2016(r299989)
@@ -316,12 +316,18 @@ struct bhnd_device {
uint32_t device_flags;  /**< required 
BHND_DF_* flags */
 };
 
-#define_BHND_DEVICE(_device, _desc, _quirks, _flags, ...)  \
-   { BHND_CORE_MATCH(BHND_MFGID_BCM, BHND_COREID_ ## _device, \
+#define_BHND_DEVICE(_vendor, _device, _desc, _quirks, _flags, ...) 
\
+   { BHND_CORE_MATCH(BHND_MFGID_ ## _vendor, BHND_COREID_ ## _device, \
BHND_HWREV_ANY), _desc, _quirks, _flags }
 
+#defineBHND_MIPS_DEVICE(_device, _desc, _quirks, ...)  \
+   _BHND_DEVICE(MIPS, _device, _desc, _quirks, ## __VA_ARGS__, 0)
+
+#defineBHND_ARM_DEVICE(_device, _desc, _quirks, ...)   \
+   _BHND_DEVICE(ARM, _device, _desc, _quirks, ## __VA_ARGS__, 0)
+
 #defineBHND_DEVICE(_device, _desc, _quirks, ...)   \
-   _BHND_DEVICE(_device, _desc, _quirks, ## __VA_ARGS__, 0)
+   _BHND_DEVICE(BCM, _device, _desc, _quirks, ## __VA_ARGS__, 0)
 
 #defineBHND_DEVICE_END { BHND_CORE_MATCH_ANY, NULL, 
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: r299988 - head/usr.sbin/rpc.statd

2016-05-16 Thread Don Lewis
Author: truckman
Date: Mon May 16 23:29:04 2016
New Revision: 299988
URL: https://svnweb.freebsd.org/changeset/base/299988

Log:
  Set ai2 to NULL in in find_host() before the loop and after calling
  freeaddrinfo() on it to indicate that it doesn't point to a valid
  addrinfo list.  This fixes this Coverity issues:
1006368 Uninitialized pointer read
1018506 Double free
1305590 Resource leak
  that can be triggered in the hp->hostname[0] != '\0' case.
  
  Don't treat a character as a boolean.
  
  Fix these Coverity issues:
1009293 Unchecked return value from library
1194246 Wrong size argument
  by tweaking the status file extend code.
  
  Reported by:  Coverity
  CID:  1006368, 1018506, 1305590, 1009293, 1194246
  Reviewed by:  rmacklem
  Feedback from:hrs
  MFC after:1 week
  Differential Revision:D6398

Modified:
  head/usr.sbin/rpc.statd/file.c

Modified: head/usr.sbin/rpc.statd/file.c
==
--- head/usr.sbin/rpc.statd/file.c  Mon May 16 23:20:19 2016
(r299987)
+++ head/usr.sbin/rpc.statd/file.c  Mon May 16 23:29:04 2016
(r299988)
@@ -82,6 +82,7 @@ HostInfo *find_host(char *hostname, int 
   struct addrinfo *ai1, *ai2;
   int i;
 
+  ai2 = NULL;
   if (getaddrinfo(hostname, NULL, NULL, &ai1) != 0)
 ai1 = NULL;
   for (i = 0, hp = status_info->hosts; i < status_info->noOfHosts; i++, hp++)
@@ -91,7 +92,7 @@ HostInfo *find_host(char *hostname, int 
   result = hp;
   break;
 }
-if (hp->hostname[0] && 
+if (hp->hostname[0] != '\0' &&
getaddrinfo(hp->hostname, NULL, NULL, &ai2) != 0)
   ai2 = NULL;
 if (ai1 && ai2)
@@ -113,8 +114,10 @@ HostInfo *find_host(char *hostname, int 
if (result)
 break;
 }
-if (ai2)
+if (ai2) {
   freeaddrinfo(ai2);
+  ai2 = NULL;
+}
 if (!spare_slot && !hp->monList && !hp->notifyReqd)
   spare_slot = hp;
   }
@@ -134,9 +137,8 @@ HostInfo *find_host(char *hostname, int 
 if (desired_size > status_file_len)
 {
   /* Extend file by writing 1 byte of junk at the desired end pos  */
-  lseek(status_fd, desired_size - 1, SEEK_SET);
-  i = write(status_fd, &i, 1);
-  if (i < 1)
+  if (lseek(status_fd, desired_size - 1, SEEK_SET) == -1 ||
+  write(status_fd, "\0", 1) < 0)
   {
syslog(LOG_ERR, "Unable to extend status file");
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: r299986 - head/usr.sbin/rpc.lockd

2016-05-16 Thread Don Lewis
Author: truckman
Date: Mon May 16 23:00:48 2016
New Revision: 299986
URL: https://svnweb.freebsd.org/changeset/base/299986

Log:
  Actually use the loop interation limit so carefully computed on the
  previous line to prevent buffer overflow.  This turns out to not be
  important because the upstream xdr code already capped the object
  size at the proper value.  Using the correct limit here looks a lot
  less scary and should please Coverity.
  
  Reported by:  Coverity
  CID:  1199309, 1199310
  MFC after:1 week

Modified:
  head/usr.sbin/rpc.lockd/lock_proc.c

Modified: head/usr.sbin/rpc.lockd/lock_proc.c
==
--- head/usr.sbin/rpc.lockd/lock_proc.c Mon May 16 22:57:36 2016
(r299985)
+++ head/usr.sbin/rpc.lockd/lock_proc.c Mon May 16 23:00:48 2016
(r299986)
@@ -112,7 +112,7 @@ log_netobj(netobj *obj)
}
/* Prevent the security hazard from the buffer overflow */
maxlen = (obj->n_len < MAX_NETOBJ_SZ ? obj->n_len : MAX_NETOBJ_SZ);
-   for (i=0, tmp1 = objvalbuffer, tmp2 = objascbuffer; i < obj->n_len;
+   for (i=0, tmp1 = objvalbuffer, tmp2 = objascbuffer; i < maxlen;
i++, tmp1 +=2, tmp2 +=1) {
sprintf(tmp1,"%02X",*(obj->n_bytes+i));
sprintf(tmp2,"%c",*(obj->n_bytes+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: r299985 - head/sys/dev/bwn

2016-05-16 Thread Adrian Chadd
Author: adrian
Date: Mon May 16 22:57:36 2016
New Revision: 299985
URL: https://svnweb.freebsd.org/changeset/base/299985

Log:
  [bwn] add opt_wlan.h / opt_bwn.h for build-time control
  
  This is a separate commit as I have local changes to bwn for now and
  this needs a manual merge/commit.
  
  Sponsored by: Palm Springs

Modified:
  head/sys/dev/bwn/if_bwn.c

Modified: head/sys/dev/bwn/if_bwn.c
==
--- head/sys/dev/bwn/if_bwn.c   Mon May 16 22:56:45 2016(r299984)
+++ head/sys/dev/bwn/if_bwn.c   Mon May 16 22:57:36 2016(r299985)
@@ -34,6 +34,9 @@ __FBSDID("$FreeBSD$");
  * The Broadcom Wireless LAN controller driver.
  */
 
+#include "opt_bwn.h"
+#include "opt_wlan.h"
+
 #include 
 #include 
 #include 
___
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: r299753 - head/sys/fs/fuse

2016-05-16 Thread Rick Macklem
Alexey Dokuchaev wrote:
> On Sat, May 14, 2016 at 08:03:22PM +, Rick Macklem wrote:
> > New Revision: 299753
> > URL: https://svnweb.freebsd.org/changeset/base/299753
> > 
> > Log:
> >   Fix fuse to use DIRECT_IO when required.
> >   
> >   When a file is opened write-only and a partial block was written,
> >   buffered I/O would try and read the whole block in. This would
> >   result in a hung thread, since there was no open (fuse filehandle)
> >   that allowed reading. This patch avoids the problem by forcing
> >   DIRECT_IO for this case.
> >   It also sets DIRECT_IO when the file system specifies the FN_DIRECTIO
> >   flag in its reply to the open.
> 
> Since you're at fuse now, perhaps you could also have a look at PR 195000?
> 
> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195000
> 
> ./danfe
> 
I was able to test the patch and it stops the crash.
I took out the MPASS() call because I didn't see why it should panic
for VFIFO instead of returning EINVAL like the rest.

If you'd like to commit it, email soon. Otherwise I will commit it.

Thanks for pointing this out, rick
___
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: r299984 - head/sys/dev/bwn

2016-05-16 Thread Adrian Chadd
Author: adrian
Date: Mon May 16 22:56:45 2016
New Revision: 299984
URL: https://svnweb.freebsd.org/changeset/base/299984

Log:
  [bwn] add opt_wlan.h and opt_bwn.h so we can enable bwn debugging as 
appropriate.
  
  Tested:
  
  * BCM4322, STA mode (11a)
  
  Sponsored by: Palm Springs

Modified:
  head/sys/dev/bwn/bwn_mac.c
  head/sys/dev/bwn/if_bwn_debug.h
  head/sys/dev/bwn/if_bwn_pci.c
  head/sys/dev/bwn/if_bwn_phy_common.c
  head/sys/dev/bwn/if_bwn_phy_g.c
  head/sys/dev/bwn/if_bwn_phy_lp.c
  head/sys/dev/bwn/if_bwn_util.c

Modified: head/sys/dev/bwn/bwn_mac.c
==
--- head/sys/dev/bwn/bwn_mac.c  Mon May 16 22:42:09 2016(r299983)
+++ head/sys/dev/bwn/bwn_mac.c  Mon May 16 22:56:45 2016(r299984)
@@ -30,6 +30,9 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_bwn.h"
+#include "opt_wlan.h"
+
 #include 
 #include 
 #include 

Modified: head/sys/dev/bwn/if_bwn_debug.h
==
--- head/sys/dev/bwn/if_bwn_debug.h Mon May 16 22:42:09 2016
(r299983)
+++ head/sys/dev/bwn/if_bwn_debug.h Mon May 16 22:56:45 2016
(r299984)
@@ -32,8 +32,6 @@
 #ifndef__IF_BWN_DEBUG_H__
 #define__IF_BWN_DEBUG_H__
 
-#defineBWN_DEBUG
-
 enum {
BWN_DEBUG_XMIT  = 0x0001,   /* basic xmit operation */
BWN_DEBUG_RECV  = 0x0002,   /* basic recv operation */

Modified: head/sys/dev/bwn/if_bwn_pci.c
==
--- head/sys/dev/bwn/if_bwn_pci.c   Mon May 16 22:42:09 2016
(r299983)
+++ head/sys/dev/bwn/if_bwn_pci.c   Mon May 16 22:56:45 2016
(r299984)
@@ -30,6 +30,9 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_bwn.h"
+#include "opt_wlan.h"
+
 #include 
 #include 
 #include 

Modified: head/sys/dev/bwn/if_bwn_phy_common.c
==
--- head/sys/dev/bwn/if_bwn_phy_common.cMon May 16 22:42:09 2016
(r299983)
+++ head/sys/dev/bwn/if_bwn_phy_common.cMon May 16 22:56:45 2016
(r299984)
@@ -31,6 +31,9 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_bwn.h"
+#include "opt_wlan.h"
+
 /*
  * The Broadcom Wireless LAN controller driver.
  */

Modified: head/sys/dev/bwn/if_bwn_phy_g.c
==
--- head/sys/dev/bwn/if_bwn_phy_g.c Mon May 16 22:42:09 2016
(r299983)
+++ head/sys/dev/bwn/if_bwn_phy_g.c Mon May 16 22:56:45 2016
(r299984)
@@ -30,6 +30,9 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_bwn.h"
+#include "opt_wlan.h"
+
 /*
  * The Broadcom Wireless LAN controller driver.
  */

Modified: head/sys/dev/bwn/if_bwn_phy_lp.c
==
--- head/sys/dev/bwn/if_bwn_phy_lp.cMon May 16 22:42:09 2016
(r299983)
+++ head/sys/dev/bwn/if_bwn_phy_lp.cMon May 16 22:56:45 2016
(r299984)
@@ -30,6 +30,9 @@
 #include 
 __FBSDID("$FreeBSD$");
 
+#include "opt_bwn.h"
+#include "opt_wlan.h"
+
 /*
  * The Broadcom Wireless LAN controller driver.
  */

Modified: head/sys/dev/bwn/if_bwn_util.c
==
--- head/sys/dev/bwn/if_bwn_util.c  Mon May 16 22:42:09 2016
(r299983)
+++ head/sys/dev/bwn/if_bwn_util.c  Mon May 16 22:56:45 2016
(r299984)
@@ -34,6 +34,9 @@ __FBSDID("$FreeBSD$");
  * The Broadcom Wireless LAN controller driver.
  */
 
+#include "opt_bwn.h"
+#include "opt_wlan.h"
+
 #include 
 #include 
 #include 
___
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: r299983 - in stable/10: crypto/openssl/crypto crypto/openssl/crypto/perlasm secure/lib/libcrypto/i386

2016-05-16 Thread Jung-uk Kim
Author: jkim
Date: Mon May 16 22:42:09 2016
New Revision: 299983
URL: https://svnweb.freebsd.org/changeset/base/299983

Log:
  Hide OPENSSL_cpuid_setup and OPENSSL_ia32cap_P symbols from libcrypto.so.
  Note this is a direct commit because it is merged from OpenSSL upstream and
  head (OpenSSL 1.0.2 branch) already has the same change:
  
  https://github.com/openssl/openssl/commit/6206682

Modified:
  stable/10/crypto/openssl/crypto/perlasm/x86asm.pl
  stable/10/crypto/openssl/crypto/perlasm/x86gas.pl
  stable/10/crypto/openssl/crypto/x86cpuid.pl
  stable/10/secure/lib/libcrypto/i386/x86cpuid.S

Modified: stable/10/crypto/openssl/crypto/perlasm/x86asm.pl
==
--- stable/10/crypto/openssl/crypto/perlasm/x86asm.pl   Mon May 16 22:39:17 
2016(r299982)
+++ stable/10/crypto/openssl/crypto/perlasm/x86asm.pl   Mon May 16 22:42:09 
2016(r299983)
@@ -257,4 +257,6 @@ EOF
 &file($filename);
 }
 
+sub ::hidden {}
+
 1;

Modified: stable/10/crypto/openssl/crypto/perlasm/x86gas.pl
==
--- stable/10/crypto/openssl/crypto/perlasm/x86gas.pl   Mon May 16 22:39:17 
2016(r299982)
+++ stable/10/crypto/openssl/crypto/perlasm/x86gas.pl   Mon May 16 22:42:09 
2016(r299983)
@@ -250,4 +250,6 @@ ___
 sub ::dataseg
 {   push(@out,".data\n");   }
 
+*::hidden = sub { push(@out,".hidden\t$nmdecor$_[0]\n"); } if ($::elf);
+
 1;

Modified: stable/10/crypto/openssl/crypto/x86cpuid.pl
==
--- stable/10/crypto/openssl/crypto/x86cpuid.pl Mon May 16 22:39:17 2016
(r299982)
+++ stable/10/crypto/openssl/crypto/x86cpuid.pl Mon May 16 22:42:09 2016
(r299983)
@@ -355,4 +355,7 @@ for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA3
 
 &initseg("OPENSSL_cpuid_setup");
 
+&hidden("OPENSSL_cpuid_setup");
+&hidden("OPENSSL_ia32cap_P");
+
 &asm_finish();

Modified: stable/10/secure/lib/libcrypto/i386/x86cpuid.S
==
--- stable/10/secure/lib/libcrypto/i386/x86cpuid.S  Mon May 16 22:39:17 
2016(r299982)
+++ stable/10/secure/lib/libcrypto/i386/x86cpuid.S  Mon May 16 22:42:09 
2016(r299983)
@@ -344,6 +344,8 @@ OPENSSL_ia32_rdrand:
cmovel  %ecx,%eax
ret
 .size  OPENSSL_ia32_rdrand,.-.L_OPENSSL_ia32_rdrand_begin
+.hiddenOPENSSL_cpuid_setup
+.hiddenOPENSSL_ia32cap_P
 .comm  OPENSSL_ia32cap_P,8,4
 .section   .init
callOPENSSL_cpuid_setup
@@ -679,6 +681,8 @@ OPENSSL_ia32_rdrand:
cmovel  %ecx,%eax
ret
 .size  OPENSSL_ia32_rdrand,.-.L_OPENSSL_ia32_rdrand_begin
+.hiddenOPENSSL_cpuid_setup
+.hiddenOPENSSL_ia32cap_P
 .comm  OPENSSL_ia32cap_P,8,4
 .section   .init
callOPENSSL_cpuid_setup
___
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: r299982 - head/sys/dev/bwn

2016-05-16 Thread Adrian Chadd
Author: adrian
Date: Mon May 16 22:39:17 2016
New Revision: 299982
URL: https://svnweb.freebsd.org/changeset/base/299982

Log:
  [bwn] switch to ieee80211_add_channel()
  
  This is an updated version of D6140.
  
  Tested:
  
  * BCM4321 11abgn, STA mode (11a)
  
  Submitted by: avos
  Differential Revision:https://reviews.freebsd.org/D6140

Modified:
  head/sys/dev/bwn/if_bwn.c

Modified: head/sys/dev/bwn/if_bwn.c
==
--- head/sys/dev/bwn/if_bwn.c   Mon May 16 22:36:10 2016(r299981)
+++ head/sys/dev/bwn/if_bwn.c   Mon May 16 22:39:17 2016(r299982)
@@ -128,7 +128,7 @@ static int  bwn_setup_channels(struct bwn
 static voidbwn_shm_ctlword(struct bwn_mac *, uint16_t,
uint16_t);
 static voidbwn_addchannels(struct ieee80211_channel [], int, int *,
-   const struct bwn_channelinfo *, int);
+   const struct bwn_channelinfo *, const uint8_t []);
 static int bwn_raw_xmit(struct ieee80211_node *, struct mbuf *,
const struct ieee80211_bpf_params *);
 static voidbwn_updateslot(struct ieee80211com *);
@@ -1459,14 +1459,12 @@ error:
return (ENODEV);
 }
 
-#defineIEEE80211_CHAN_HTG  (IEEE80211_CHAN_HT | IEEE80211_CHAN_G)
-#defineIEEE80211_CHAN_HTA  (IEEE80211_CHAN_HT | IEEE80211_CHAN_A)
-
 static int
 bwn_setup_channels(struct bwn_mac *mac, int have_bg, int have_a)
 {
struct bwn_softc *sc = mac->mac_sc;
struct ieee80211com *ic = &sc->sc_ic;
+   uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
 
memset(ic->ic_channels, 0, sizeof(ic->ic_channels));
ic->ic_nchans = 0;
@@ -1476,26 +1474,20 @@ bwn_setup_channels(struct bwn_mac *mac, 
have_bg,
have_a);
 
-   if (have_bg)
+   if (have_bg) {
+   memset(bands, 0, sizeof(bands));
+   setbit(bands, IEEE80211_MODE_11B);
+   setbit(bands, IEEE80211_MODE_11G);
bwn_addchannels(ic->ic_channels, IEEE80211_CHAN_MAX,
-   &ic->ic_nchans, &bwn_chantable_bg, IEEE80211_CHAN_G);
-#if 0
-   if (mac->mac_phy.type == BWN_PHYTYPE_N) {
-   if (have_a)
-   bwn_addchannels(ic->ic_channels, IEEE80211_CHAN_MAX,
-   &ic->ic_nchans, &bwn_chantable_n,
-   IEEE80211_CHAN_HTA);
-   } else {
-   if (have_a)
-   bwn_addchannels(ic->ic_channels, IEEE80211_CHAN_MAX,
-   &ic->ic_nchans, &bwn_chantable_a,
-   IEEE80211_CHAN_A);
+   &ic->ic_nchans, &bwn_chantable_bg, bands);
}
-#endif
-   if (have_a)
+
+   if (have_a) {
+   memset(bands, 0, sizeof(bands));
+   setbit(bands, IEEE80211_MODE_11A);
bwn_addchannels(ic->ic_channels, IEEE80211_CHAN_MAX,
-   &ic->ic_nchans, &bwn_chantable_a,
-   IEEE80211_CHAN_A);
+   &ic->ic_nchans, &bwn_chantable_a, bands);
+   }
 
mac->mac_phy.supports_2ghz = have_bg;
mac->mac_phy.supports_5ghz = have_a;
@@ -1609,63 +1601,16 @@ bwn_shm_write_2(struct bwn_mac *mac, uin
 }
 
 static void
-bwn_addchan(struct ieee80211_channel *c, int freq, int flags, int ieee,
-int txpow)
-{
-
-   c->ic_freq = freq;
-   c->ic_flags = flags;
-   c->ic_ieee = ieee;
-   c->ic_minpower = 0;
-   c->ic_maxpower = 2 * txpow;
-   c->ic_maxregpower = txpow;
-}
-
-static void
 bwn_addchannels(struct ieee80211_channel chans[], int maxchans, int *nchans,
-const struct bwn_channelinfo *ci, int flags)
+const struct bwn_channelinfo *ci, const uint8_t bands[])
 {
-   struct ieee80211_channel *c;
-   int i;
+   int i, error;
 
-   c = &chans[*nchans];
+   for (i = 0, error = 0; i < ci->nchannels && error == 0; i++) {
+   const struct bwn_channel *hc = &ci->channels[i];
 
-   for (i = 0; i < ci->nchannels; i++) {
-   const struct bwn_channel *hc;
-
-   hc = &ci->channels[i];
-   if (*nchans >= maxchans)
-   break;
-   bwn_addchan(c, hc->freq, flags, hc->ieee, hc->maxTxPow);
-   c++, (*nchans)++;
-   if (flags == IEEE80211_CHAN_G || flags == IEEE80211_CHAN_HTG) {
-   /* g channel have a separate b-only entry */
-   if (*nchans >= maxchans)
-   break;
-   c[0] = c[-1];
-   c[-1].ic_flags = IEEE80211_CHAN_B;
-   c++, (*nchans)++;
-   }
-   if (flags == IEEE80211_CHAN_HTG) {
-   /* HT g channel have a separate g-only entry */
-   if (*nchans >= maxchans)
-   break;
-   c[-1].ic_flag

svn commit: r299977 - head/sys/dev/acpica/Osd

2016-05-16 Thread John Baldwin
Author: jhb
Date: Mon May 16 21:33:31 2016
New Revision: 299977
URL: https://svnweb.freebsd.org/changeset/base/299977

Log:
  Use polling spin loops for timeouts during early boot.
  
  Some ACPI operations such as mutex acquires and event waits accept a
  timeout.  The ACPI OSD layer implements these timeouts by using regular
  sleep timeouts.  However, this doesn't work during early boot before
  event timers are setup.  Instead, use polling combined with DELAY()
  to spin.
  
  This fixes booting on upcoming Intel systems with Kaby Lake processors.
  
  Tested by:"Jeffrey E Pieper" 
  Reviewed by:  jimharris
  MFC after:1 week

Modified:
  head/sys/dev/acpica/Osd/OsdSynch.c

Modified: head/sys/dev/acpica/Osd/OsdSynch.c
==
--- head/sys/dev/acpica/Osd/OsdSynch.c  Mon May 16 20:26:30 2016
(r299976)
+++ head/sys/dev/acpica/Osd/OsdSynch.c  Mon May 16 21:33:31 2016
(r299977)
@@ -188,6 +188,23 @@ AcpiOsWaitSemaphore(ACPI_SEMAPHORE Handl
}
break;
default:
+   if (cold) {
+   /*
+* Just spin polling the semaphore once a
+* millisecond.
+*/
+   while (!ACPISEM_AVAIL(as, Units)) {
+   if (Timeout == 0) {
+   status = AE_TIME;
+   break;
+   }
+   Timeout--;
+   mtx_unlock(&as->as_lock);
+   DELAY(1000);
+   mtx_lock(&as->as_lock);
+   }
+   break;
+   }
tmo = timeout2hz(Timeout);
while (!ACPISEM_AVAIL(as, Units)) {
prevtick = ticks;
@@ -381,6 +398,23 @@ AcpiOsAcquireMutex(ACPI_MUTEX Handle, UI
}
break;
default:
+   if (cold) {
+   /*
+* Just spin polling the mutex once a
+* millisecond.
+*/
+   while (!ACPIMTX_AVAIL(am)) {
+   if (Timeout == 0) {
+   status = AE_TIME;
+   break;
+   }
+   Timeout--;
+   mtx_unlock(&am->am_lock);
+   DELAY(1000);
+   mtx_lock(&am->am_lock);
+   }
+   break;
+   }
tmo = timeout2hz(Timeout);
while (!ACPIMTX_AVAIL(am)) {
prevtick = ticks;
___
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: r299753 - head/sys/fs/fuse

2016-05-16 Thread Rick Macklem
Alexey Dokuchaev wrote:
> On Sat, May 14, 2016 at 08:03:22PM +, Rick Macklem wrote:
> > New Revision: 299753
> > URL: https://svnweb.freebsd.org/changeset/base/299753
> > 
> > Log:
> >   Fix fuse to use DIRECT_IO when required.
> >   
> >   When a file is opened write-only and a partial block was written,
> >   buffered I/O would try and read the whole block in. This would
> >   result in a hung thread, since there was no open (fuse filehandle)
> >   that allowed reading. This patch avoids the problem by forcing
> >   DIRECT_IO for this case.
> >   It also sets DIRECT_IO when the file system specifies the FN_DIRECTIO
> >   flag in its reply to the open.
> 
> Since you're at fuse now, perhaps you could also have a look at PR 195000?
> 
> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195000
> 
> ./danfe
> 
Yea, the patch in PR#195000 looks ok. I'll try to reproduce the crash and if
I can test the patch, I can commit it.
Or would you prefer to do so?

I think fuse can be made to handle special files by  creating separate tables
of vop methods (like the NFS client does), but that is a fair amount of work, so
I think committing this patch to stop the crash makes sense in the meantime.

rick
___
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: r299976 - head/sys/dev/bwn

2016-05-16 Thread Adrian Chadd
Author: adrian
Date: Mon May 16 20:26:30 2016
New Revision: 299976
URL: https://svnweb.freebsd.org/changeset/base/299976

Log:
  [bwn] check DUALPHY; add BCM4322 to the don't-override list.
  
  * DUALPHY in TGSHIGH tells us there's a phy that is dualband, rather than
two separate PHYs/MACs (which we almost but don't quite yet support.)
Use it.
  
  * Add the BCM4322 PCI ID to the list of devices we don't override.
This means the 2g/5g flags are preserved, and thus we get 5GHz
operation (with N-PHY, of course.)
  
  Tested:
  
  * BCM4311, STA mode (11bg)
  * BCM4312, STA mode (11bg)
  * BCM4321, STA mode (11abg)
  
  Sponsored by: Palm Springs

Modified:
  head/sys/dev/bwn/if_bwn.c

Modified: head/sys/dev/bwn/if_bwn.c
==
--- head/sys/dev/bwn/if_bwn.c   Mon May 16 20:22:52 2016(r299975)
+++ head/sys/dev/bwn/if_bwn.c   Mon May 16 20:26:30 2016(r299976)
@@ -1147,15 +1147,32 @@ bwn_attach_core(struct bwn_mac *mac)
siba_powerup(sc->sc_dev, 0);
 
high = siba_read_4(sc->sc_dev, SIBA_TGSHIGH);
+
+   /*
+* Guess at whether it has A-PHY or G-PHY.
+* This is just used for resetting the core to probe things;
+* we will re-guess once it's all up and working.
+*
+* XXX TODO: there's the TGSHIGH DUALPHY flag based on
+* the PHY revision.
+*/
bwn_reset_core(mac, !!(high & BWN_TGSHIGH_HAVE_2GHZ));
+
+   /*
+* Get the PHY version.
+*/
error = bwn_phy_getinfo(mac, high);
if (error)
goto fail;
 
-   /* XXX need bhnd */
+   /* XXX TODO need bhnd */
if (bwn_is_bus_siba(mac)) {
have_a = (high & BWN_TGSHIGH_HAVE_5GHZ) ? 1 : 0;
have_bg = (high & BWN_TGSHIGH_HAVE_2GHZ) ? 1 : 0;
+   if (high & BWN_TGSHIGH_DUALPHY) {
+   have_bg = 1;
+   have_a = 1;
+   }
} else {
device_printf(sc->sc_dev, "%s: not siba; bailing\n", __func__);
error = ENXIO;
@@ -1175,7 +1192,8 @@ bwn_attach_core(struct bwn_mac *mac)
 
if (siba_get_pci_device(sc->sc_dev) != 0x4312 &&
siba_get_pci_device(sc->sc_dev) != 0x4319 &&
-   siba_get_pci_device(sc->sc_dev) != 0x4324) {
+   siba_get_pci_device(sc->sc_dev) != 0x4324 &&
+   siba_get_pci_device(sc->sc_dev) != 0x4328) {
have_a = have_bg = 0;
if (mac->mac_phy.type == BWN_PHYTYPE_A)
have_a = 1;
@@ -1187,9 +1205,17 @@ bwn_attach_core(struct bwn_mac *mac)
KASSERT(0 == 1, ("%s: unknown phy type (%d)", __func__,
mac->mac_phy.type));
}
-   /* XXX turns off PHY A because it's not supported */
+
+   /*
+* XXX turns off PHY A because it's not supported.
+* Implement PHY-A support so we can use it for PHY-G
+* dual-band support.
+*/
if (mac->mac_phy.type != BWN_PHYTYPE_LP &&
mac->mac_phy.type != BWN_PHYTYPE_N) {
+   device_printf(sc->sc_dev,
+   "%s: forcing 2GHz only; missing PHY-A support\n",
+   __func__);
have_a = 0;
have_bg = 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: r299975 - head/sys/dev/siba

2016-05-16 Thread Adrian Chadd
Author: adrian
Date: Mon May 16 20:22:52 2016
New Revision: 299975
URL: https://svnweb.freebsd.org/changeset/base/299975

Log:
  [siba] fix up debugging.
  
  * unbreak non-debug builds - don't default to debugging SCAN; that was
left-over from my testing.
  * include opt_siba.h, now that it's generated as appropriate.
  * stick the debug enum outside the debug block, just so it's there for
any code that wants to set siba_debug for some reason (like say,
my debugging muckup.)
  * make DPRINTF() use __VA_ARGS__ for formatting too, so it correctly
handles printing w/ no args.
  * Make DPRINTF() use device_printf().
  
  Sponsored by: Palm Springs

Modified:
  head/sys/dev/siba/siba_core.c

Modified: head/sys/dev/siba/siba_core.c
==
--- head/sys/dev/siba/siba_core.c   Mon May 16 20:18:54 2016
(r299974)
+++ head/sys/dev/siba/siba_core.c   Mon May 16 20:22:52 2016
(r299975)
@@ -34,6 +34,8 @@ __FBSDID("$FreeBSD$");
  * the Sonics Silicon Backplane driver.
  */
 
+#include "opt_siba.h"
+
 #include 
 #include 
 #include 
@@ -60,7 +62,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#ifdef SIBA_DEBUG
 enum {
SIBA_DEBUG_SCAN = 0x0001,   /* scan */
SIBA_DEBUG_PMU  = 0x0002,   /* PMU */
@@ -70,13 +71,16 @@ enum {
SIBA_DEBUG_CORE = 0x0020,   /* handling cores */
SIBA_DEBUG_ANY  = 0x
 };
-#define DPRINTF(siba, m, fmt, ...) do {\
-   if (siba->siba_debug & (m)) \
-   printf(fmt, __VA_ARGS__);   \
+
+#ifdef SIBA_DEBUG
+#define DPRINTF(siba, m, ...) do { \
+   if (siba->siba_debug & (m)) \
+   device_printf(siba->siba_dev, __VA_ARGS__); \
 } while (0)
 #else
-#define DPRINTF(siba, m, fmt, ...) do { (void) siba; } while (0)
+#define DPRINTF(siba, m, ...) do { (void) siba; } while (0)
 #endif
+
 #defineN(a)(sizeof(a) / sizeof(a[0]))
 
 static voidsiba_pci_gpio(struct siba_softc *, uint32_t, int);
@@ -184,8 +188,6 @@ siba_core_attach(struct siba_softc *siba
 
siba->siba_ops = &siba_pci_ops;
 
-   siba->siba_debug = SIBA_DEBUG_SCAN;
-
siba_pci_gpio(siba, SIBA_GPIO_CRYSTAL | SIBA_GPIO_PLL, 1);
siba_scan(siba);
 
___
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: r299974 - head/sys/conf

2016-05-16 Thread Adrian Chadd
Author: adrian
Date: Mon May 16 20:18:54 2016
New Revision: 299974
URL: https://svnweb.freebsd.org/changeset/base/299974

Log:
  [siba] add SIBA_DEBUG option.
  
  Sponsored by: Palm Springs

Modified:
  head/sys/conf/options

Modified: head/sys/conf/options
==
--- head/sys/conf/options   Mon May 16 20:04:38 2016(r299973)
+++ head/sys/conf/options   Mon May 16 20:18:54 2016(r299974)
@@ -857,6 +857,9 @@ BWI_DEBUG_VERBOSE   opt_bwi.h
 # options for the Brodacom BCM43xx driver (bwn)
 BWN_DEBUG  opt_bwn.h
 
+# Options for the SIBA driver
+SIBA_DEBUG opt_siba.h
+
 # options for the Marvell 8335 wireless driver
 MALO_DEBUG opt_malo.h
 MALO_TXBUF opt_malo.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"


Re: svn commit: r299930 - in head/sys/compat/linuxkpi/common: include/linux src

2016-05-16 Thread Conrad Meyer
On Mon, May 16, 2016 at 2:16 AM, Hans Petter Selasky
 wrote:
> Author: hselasky
> Date: Mon May 16 09:16:15 2016
> New Revision: 299930
> URL: https://svnweb.freebsd.org/changeset/base/299930
>
> Log:
>   Properly implement "cpu_has_clflush" macro.
> ...
> @@ -51,6 +51,10 @@ __FBSDID("$FreeBSD$");
>
>  #include 
>
> +#if defined(__i386__) || defined(__amd64__)
> +#include 
> +#endif
> +
>  #include 
>  #include 
>  #include 
> @@ -67,6 +71,7 @@ __FBSDID("$FreeBSD$");
>  #include 
>  #include 
>  #include 
> +#include 

Hi Hans,

In Linux code, usually linux/kernel.h is included first.  In FreeBSD,
we mostly sort alphabetically.  Pick a system, but this is the wrong
place for this include :-).

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


svn commit: r299973 - head/sys/dev/ow

2016-05-16 Thread Pedro F. Giffuni
Author: pfg
Date: Mon May 16 20:04:38 2016
New Revision: 299973
URL: https://svnweb.freebsd.org/changeset/base/299973

Log:
  dev/ow: Tag an unreachable switch default.
  
  Coverity reports an uninitialized "dir" in case the switch defaults
  without hitting any case. Respect the original intent and quell the
  false positive with the relatively new __unreachable() builtin.
  
  CID:  1331566

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

Modified: head/sys/dev/ow/ow.c
==
--- head/sys/dev/ow/ow.cMon May 16 20:00:09 2016(r299972)
+++ head/sys/dev/ow/ow.cMon May 16 20:04:38 2016(r299973)
@@ -401,6 +401,8 @@ again:
if (++retries > 5)
return (EIO);
goto again;
+   default: /* NOTREACHED */
+   __unreachable();
}
if (dir) {
OWLL_WRITE_ONE(lldev, &timing_regular);
___
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: r299972 - head/sys/boot/efi/libefi

2016-05-16 Thread Pedro F. Giffuni
Author: pfg
Date: Mon May 16 20:00:09 2016
New Revision: 299972
URL: https://svnweb.freebsd.org/changeset/base/299972

Log:
  libefi: Tag an unreachable switch default.
  
  Coverity reports an uninitialized "len" in case the switch defaults
  without hitting any case. Respect the original intent and quell the
  false positive with the relatively new __unreachable() builtin.
  
  CID:  1347796

Modified:
  head/sys/boot/efi/libefi/efi_console.c

Modified: head/sys/boot/efi/libefi/efi_console.c
==
--- head/sys/boot/efi/libefi/efi_console.c  Mon May 16 19:48:02 2016
(r299971)
+++ head/sys/boot/efi/libefi/efi_console.c  Mon May 16 20:00:09 2016
(r299972)
@@ -266,6 +266,8 @@ CL(int direction)
case 2: /* entire line */
len = x;
break;
+   default:/* NOTREACHED */
+   __unreachable();
}
 
if (cury == y - 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"


Re: svn commit: r299839 - head/etc/rc.d

2016-05-16 Thread Ngie Cooper
On Sun, May 15, 2016 at 9:45 AM, Ian Lepore  wrote:
> On Sun, 2016-05-15 at 04:38 +, Garrett Cooper wrote:
>> Author: ngie
>> Date: Sun May 15 04:38:50 2016
>> New Revision: 299839
>> URL: https://svnweb.freebsd.org/changeset/base/299839
>>
>> Log:
>>   Make FILESYSTEMS, dumpon, and var not depend on zfs and zvol
>>
>>   Make zfs and zvol come before all of the items that depended on
>> them
>>   previously
>
> I'm trying to figure out why these changes are needed.  rcorder works
> just fine when a requirement has no providers (yes, it whines, but
> that's why /etc/rc invokes it with 2>/dev/null).  If FILESYSTEMS
> requires zfs and nothing provides zfs, then it's as if the requirement
> weren't in the list at all.
>
> The manpage for rcorder is wrong, the DIAGNOSTICS section implies that
> rcorder will abort on a missing requirement, but it doesn't.
>
> Changing requirements to BEFOREs seems like it has a lot of potential
> for messing with peoples' out-of-tree customizations.  (And for some
> reason I've always had the impression that BEFORE was to be avoided in
> the base rc files, but I can't remember why I think that.)

Hi Ian,
Answering both you and Ravi, I agree that the general boot case
will "just work" (tm), but it masks issues. In the vanilla case,
/etc/rc redirects stderr to /dev/null . This unfortunately hides both
missing rc.d dependencies called out as REQUIREs, as well as circular
dependencies (which you might notice if you ran rcorder on the
directory after r287197 on head -- see:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=202726 ), which
means that if anyone is running rcorder without directing the stderr
to /dev/null, they'll be confused by circular dependencies or missing
PROVIDEs if rc.d script aren't installed; I do this sometimes by
cd'ing to the etc/rc.d directory and running rcorder `make -VFILES`.
Anytime there's a circular dependency, rcorder tosses the whole thing
out and screws up the boot order.
In the $work case, we use a different system internally at $work
for running parallel boot that calculates rc.d script dependencies in
a lot more pedantic way. If a dependency is missing, our boot will
fail, so we've created a bunch of dummy provides for missing rc.d
scripts that are REQUIREments that we don't install. This bloats the
rc.d graph more than necessary.
All in all, this entire thing is a mess; I'm just shuffling deck
chairs right now so I can replace boards and refinish parts of the
metaphorical deck enough that things will work "ok" for 11.0-RELEASE.
I'll talk with mmacy about launchd and come up with an official
proposal for how to move forward with boot in 12.0, because rc is a
dated system and needs to be replaced with something more performant
and more flexible/logical (run things based on events instead of a
one-time static boot order).
Thanks,
-Ngie
___
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: r299971 - head/usr.bin/chat

2016-05-16 Thread Don Lewis
Author: truckman
Date: Mon May 16 19:48:02 2016
New Revision: 299971
URL: https://svnweb.freebsd.org/changeset/base/299971

Log:
  Fix off by one error that overflowed the rep_len array when doing
  the final NUL termination.
  
  Reported by:  Coverity
  CID:  1007617
  MFC after:1 week

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

Modified: head/usr.bin/chat/chat.c
==
--- head/usr.bin/chat/chat.cMon May 16 19:42:38 2016(r299970)
+++ head/usr.bin/chat/chat.cMon May 16 19:48:02 2016(r299971)
@@ -521,7 +521,7 @@ void terminate(int status)
size_t rep_len;
 
rep_len = strlen(report_buffer);
-   while (rep_len + 1 <= sizeof(report_buffer)) {
+   while (rep_len + 1 < sizeof(report_buffer)) {
alarm(1);
c = get_char();
alarm(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: r299970 - head/sys/ddb

2016-05-16 Thread Pedro F. Giffuni
Author: pfg
Date: Mon May 16 19:42:38 2016
New Revision: 299970
URL: https://svnweb.freebsd.org/changeset/base/299970

Log:
  Add a small set of logical operators to DDB command language.
  
  This are based on Mach3.
  Documentation is pending but has been promised.
  
  Submitted by: Dan Partelly
  Reviewed by:  adrian, jhb (older version)
  
  Differential Revision:https://reviews.freebsd.org/D4230
  RelNotes: yes

Modified:
  head/sys/ddb/db_examine.c
  head/sys/ddb/db_expr.c
  head/sys/ddb/db_lex.c
  head/sys/ddb/db_lex.h

Modified: head/sys/ddb/db_examine.c
==
--- head/sys/ddb/db_examine.c   Mon May 16 19:39:05 2016(r299969)
+++ head/sys/ddb/db_examine.c   Mon May 16 19:42:38 2016(r299970)
@@ -225,6 +225,10 @@ db_print_cmd(db_expr_t addr, bool have_a
else
db_printf("\\%03o", (int)value);
break;
+   default:
+   db_print_format = 'x';
+   db_error("Syntax error: unsupported print modifier\n");
+   /*NOTREACHED*/
}
db_printf("\n");
 }

Modified: head/sys/ddb/db_expr.c
==
--- head/sys/ddb/db_expr.c  Mon May 16 19:39:05 2016(r299969)
+++ head/sys/ddb/db_expr.c  Mon May 16 19:42:38 2016(r299970)
@@ -43,6 +43,9 @@ static bool   db_mult_expr(db_expr_t *valu
 static booldb_shift_expr(db_expr_t *valuep);
 static booldb_term(db_expr_t *valuep);
 static booldb_unary(db_expr_t *valuep);
+static booldb_logical_or_expr(db_expr_t *valuep);
+static booldb_logical_and_expr(db_expr_t *valuep);
+static booldb_logical_relation_expr(db_expr_t *valuep);
 
 static bool
 db_term(db_expr_t *valuep)
@@ -108,19 +111,40 @@ db_unary(db_expr_t *valuep)
t = db_read_token();
if (t == tMINUS) {
if (!db_unary(valuep)) {
-   db_error("Syntax error\n");
+   db_printf("Expression syntax error after '%c'\n", '-');
+   db_error(NULL);
/*NOTREACHED*/
}
*valuep = -*valuep;
return (true);
}
+   if (t == tEXCL) {
+   if(!db_unary(valuep)) {
+   db_printf("Expression syntax error after '%c'\n", '!');
+   db_error(NULL);
+   /* NOTREACHED  */
+   }
+   *valuep = (!(*valuep));
+   return (true);
+   }
+   if (t == tBIT_NOT) {
+   if(!db_unary(valuep)) {
+   db_printf("Expression syntax error after '%c'\n", '~');
+   db_error(NULL);
+   /* NOTREACHED */
+   }
+   *valuep = (~(*valuep));
+   return (true);
+   }
if (t == tSTAR) {
/* indirection */
if (!db_unary(valuep)) {
-   db_error("Syntax error\n");
+   db_printf("Expression syntax error after '%c'\n", '*');
+   db_error(NULL);
/*NOTREACHED*/
}
-   *valuep = db_get_value((db_addr_t)*valuep, sizeof(void *), false);
+   *valuep = db_get_value((db_addr_t)*valuep, sizeof(void *),
+   false);
return (true);
}
db_unread_token(t);
@@ -137,24 +161,31 @@ db_mult_expr(db_expr_t *valuep)
return (false);
 
t = db_read_token();
-   while (t == tSTAR || t == tSLASH || t == tPCT || t == tHASH) {
+   while (t == tSTAR || t == tSLASH || t == tPCT || t == tHASH ||
+   t == tBIT_AND ) {
if (!db_term(&rhs)) {
-   db_error("Syntax error\n");
+   db_printf("Expression syntax error after '%c'\n", '!');
+   db_error(NULL);
/*NOTREACHED*/
}
-   if (t == tSTAR)
-   lhs *= rhs;
-   else {
-   if (rhs == 0) {
-   db_error("Divide by 0\n");
-   /*NOTREACHED*/
-   }
-   if (t == tSLASH)
-   lhs /= rhs;
-   else if (t == tPCT)
-   lhs %= rhs;
-   else
-   lhs = roundup(lhs, rhs);
+   switch(t)  {
+   case tSTAR:
+   lhs *= rhs;
+   break;
+   case tBIT_AND:
+   lhs &= rhs;
+   break;
+   default:
+   if (rhs == 0) {
+   db_error("Divide by 0\n");
+   /*NOTREACHED*/
+   }
+   if (t == tSLASH)
+   lhs /= rhs;
+   else if (t == tPCT)
+   lhs %= rhs;
+   else
+   lhs = roundup(lhs, rhs);
}
t = db_read_token();
}
@@ -168,20 +199,32 @@ db_add_expr(db_expr_t *valuep)
 {
db_expr_t  

svn commit: r299969 - head/sys/dev/siba

2016-05-16 Thread Adrian Chadd
Author: adrian
Date: Mon May 16 19:39:05 2016
New Revision: 299969
URL: https://svnweb.freebsd.org/changeset/base/299969

Log:
  [siba] make the debug code somewhat useful again.
  
  It's still not configurable by a kernel option; that'll come next.
  
  Sponsored by: Palm Springs

Modified:
  head/sys/dev/siba/siba_core.c
  head/sys/dev/siba/sibavar.h

Modified: head/sys/dev/siba/siba_core.c
==
--- head/sys/dev/siba/siba_core.c   Mon May 16 19:33:23 2016
(r299968)
+++ head/sys/dev/siba/siba_core.c   Mon May 16 19:39:05 2016
(r299969)
@@ -184,6 +184,8 @@ siba_core_attach(struct siba_softc *siba
 
siba->siba_ops = &siba_pci_ops;
 
+   siba->siba_debug = SIBA_DEBUG_SCAN;
+
siba_pci_gpio(siba, SIBA_GPIO_CRYSTAL | SIBA_GPIO_PLL, 1);
siba_scan(siba);
 
@@ -332,7 +334,8 @@ siba_scan(struct siba_softc *siba)
DPRINTF(siba, SIBA_DEBUG_SCAN,
"core %d (%s) found (cc %#xrev %#x vendor %#x)\n",
i, siba_core_name(sd->sd_id.sd_device),
-   sd->sd_id.sd_device, sd->sd_id.sd_rev, sd->sd_id.vendor);
+   sd->sd_id.sd_device, sd->sd_id.sd_rev,
+   sd->sd_id.sd_vendor);
 
switch (sd->sd_id.sd_device) {
case SIBA_DEVID_CHIPCOMMON:

Modified: head/sys/dev/siba/sibavar.h
==
--- head/sys/dev/siba/sibavar.h Mon May 16 19:33:23 2016(r299968)
+++ head/sys/dev/siba/sibavar.h Mon May 16 19:39:05 2016(r299969)
@@ -604,6 +604,7 @@ struct siba_softc {
bus_addr_t  siba_maddr;
bus_size_t  siba_msize;
uint8_t siba_ncores;
+   uint32_tsiba_debug;
 
/*
 * the following variables are only used for siba_bwn bridge.
___
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: r299967 - stable/10/share/man/man4

2016-05-16 Thread Stephen McConnell
Author: slm
Date: Mon May 16 19:32:38 2016
New Revision: 299967
URL: https://svnweb.freebsd.org/changeset/base/299967

Log:
  MFC r299276
  
  Updates to mpr driver man page.
  
  - Add 3216 and 3224 support.
  - Add SSU, chain_alloc_fail, and spinup_wait_time information.
  - Clear up some sentences.
  - Correct some typos.

Modified:
  stable/10/share/man/man4/mpr.4
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man4/mpr.4
==
--- stable/10/share/man/man4/mpr.4  Mon May 16 19:30:27 2016
(r299966)
+++ stable/10/share/man/man4/mpr.4  Mon May 16 19:32:38 2016
(r299967)
@@ -1,6 +1,8 @@
 .\"
 .\" Copyright (c) 2010 Spectra Logic Corporation
 .\" Copyright (c) 2014 LSI Corp
+.\" Copyright (c) 2016 Avago Technologies
+.\" Copyright (c) 2016 Broadcom Ltd.
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -31,55 +33,62 @@
 .\" mpr driver man page.
 .\"
 .\" Author: Ken Merry 
-.\" Author: Stephen McConnell 
+.\" Author: Stephen McConnell 
 .\"
 .\" $Id$
 .\" $FreeBSD$
 .\"
-.Dd May 2, 2014
+.Dd April 29, 2016
 .Dt MPR 4
 .Os
 .Sh NAME
 .Nm mpr
 .Nd "LSI Fusion-MPT 3 IT/IR 12Gb/s Serial Attached SCSI/SATA driver"
 .Sh SYNOPSIS
-To compile this driver into the kernel, place the following lines in your
-kernel configuration file:
+To compile this driver into the kernel, place these lines in the kernel
+configuration file:
 .Bd -ragged -offset indent
 .Cd "device pci"
 .Cd "device scbus"
 .Cd "device mpr"
 .Ed
 .Pp
-Alternatively, to load the driver as a
-module at boot time, place the following line in
+The driver can be loaded as a module at boot time by placing this line in
 .Xr loader.conf 5 :
 .Bd -literal -offset indent
 mpr_load="YES"
 .Ed
 .Sh DESCRIPTION
 The
-.Nm 
-driver provides support for LSI Fusion-MPT 3 IT/IR
+.Nm
+driver provides support for Broadcom Ltd./Avago Tech (LSI)
+Fusion-MPT 3 IT/IR
 .Tn SAS
 controllers.
 .Sh HARDWARE
-The following controllers are supported by the
+These controllers are supported by the
 .Nm
 driver:
 .Pp
 .Bl -bullet -compact
 .It
-LSI SAS 3004 (4 Port SAS)
+Broadcom Ltd./Avago Tech (LSI) SAS 3004 (4 Port SAS)
+.It
+Broadcom Ltd./Avago Tech (LSI) SAS 3008 (8 Port SAS)
 .It
-LSI SAS 3008 (8 Port SAS)
+Broadcom Ltd./Avago Tech (LSI) SAS 3108 (8 Port SAS)
 .It
-LSI SAS 3108 (8 Port SAS)
+Broadcom Ltd./Avago Tech (LSI) SAS 3216 (16 Port SAS)
+.It
+Broadcom Ltd./Avago Tech (LSI) SAS 3224 (24 Port SAS)
 .El
 .Sh CONFIGURATION
+.Pp
+In all tunable descriptions below, X represents the adapter number.
+.Pp
 To disable MSI interrupts for all
 .Nm
-driver instances, set the following tunable value in
+driver instances, set this tunable value in
 .Xr loader.conf 5 :
 .Bd -literal -offset indent
 hw.mpr.disable_msi=1
@@ -87,17 +96,15 @@ hw.mpr.disable_msi=1
 .Pp
 To disable MSI interrupts for a specific
 .Nm
-driver instance, set the following tunable value in
+driver instance, set this tunable value in
 .Xr loader.conf 5 :
 .Bd -literal -offset indent
 dev.mpr.X.disable_msi=1
 .Ed
 .Pp
-where X is the adapter number.
-.Pp
 To disable MSI-X interrupts for all
 .Nm
-driver instances, set the following tunable value in
+driver instances, set this tunable value in
 .Xr loader.conf 5 :
 .Bd -literal -offset indent
 hw.mpr.disable_msix=1
@@ -105,73 +112,134 @@ hw.mpr.disable_msix=1
 .Pp
 To disable MSI-X interrupts for a specific
 .Nm
-driver instance, set the following tunable value in
+driver instance, set this tunable value in
 .Xr loader.conf 5 :
 .Bd -literal -offset indent
 dev.mpr.X.disable_msix=1
 .Ed
 .Pp
 To set the maximum number of DMA chains allocated for all adapters, set
-the following variable in
+this tunable in
 .Xr loader.conf 5 :
 .Bd -literal -offset indent
 hw.mpr.max_chains=
 .Ed
 .Pp
 To set the maximum number of DMA chains allocated for a specific adapter,
-set the following variable in
+set this tunable in
 .Xr loader.conf 5 :
 .Bd -literal -offset indent
 dev.mpr.X.max_chains=
 .Ed
 .Pp
-This variable may also be viewed via
-.Xr sysctl 8
-to see the maximum set for a given adapter.
+The default max_chains value is 2048.
 .Pp
-The current number of free chain frames may be seen via the
+The current number of free chain frames is stored in the
 dev.mpr.X.chain_free
 .Xr sysctl 8
 variable.
 .Pp
-The lowest number of free chain frames may be seen via the
+The lowest number of free chain frames seen since boot is stored in the
 dev.mpr.X.chain_free_lowwater
 .Xr sysctl 8
 variable.
 .Pp
+The number of times that chain frame allocations have failed since boot is
+stored in the
+dev.mpr.X.chain_alloc_fail
+.Xr sysctl 8
+variable.
+This can be used to determine whether the max_chains tunable should be
+increased to help performance.
+.Pp
 The current number of active I/O commands is shown in the
 dev.mpr.X.io_cmds_active
 .Xr sysctl 8
 variable.
 .Pp
-The maximum number of 

svn commit: r299966 - in stable/10: secure/lib/libcrypto secure/lib/libcrypto/amd64 secure/lib/libcrypto/i386 sys/sys

2016-05-16 Thread Jung-uk Kim
Author: jkim
Date: Mon May 16 19:30:27 2016
New Revision: 299966
URL: https://svnweb.freebsd.org/changeset/base/299966

Log:
  - Make libcrypto.so position independent on i386.
  - Enable linker error when libcrypto.so contains a relocation against text.
  - Add "Do not modify" comment to generated source files.
  - Set CC environment variable for Perl scripts to enable AVX instructions.
  - Update __FreeBSD_version to indicate libcrypto.so is position independent.
  
  Note this is a direct commit because head has OpenSSL 1.0.2 branch but based
  on r299389, r299462, r299464, r299479, and r299480.

Added:
  stable/10/secure/lib/libcrypto/i386/aes-586.S
 - copied, changed from r299965, 
stable/10/secure/lib/libcrypto/i386/aes-586.s
  stable/10/secure/lib/libcrypto/i386/aesni-x86.S
 - copied, changed from r299965, 
stable/10/secure/lib/libcrypto/i386/aesni-x86.s
  stable/10/secure/lib/libcrypto/i386/bf-586.S
 - copied, changed from r299965, 
stable/10/secure/lib/libcrypto/i386/bf-586.s
  stable/10/secure/lib/libcrypto/i386/bf-686.S
 - copied, changed from r299965, 
stable/10/secure/lib/libcrypto/i386/bf-686.s
  stable/10/secure/lib/libcrypto/i386/bn-586.S
 - copied, changed from r299965, 
stable/10/secure/lib/libcrypto/i386/bn-586.s
  stable/10/secure/lib/libcrypto/i386/cast-586.S
 - copied, changed from r299965, 
stable/10/secure/lib/libcrypto/i386/cast-586.s
  stable/10/secure/lib/libcrypto/i386/cmll-x86.S
 - copied, changed from r299965, 
stable/10/secure/lib/libcrypto/i386/cmll-x86.s
  stable/10/secure/lib/libcrypto/i386/co-586.S
 - copied, changed from r299965, 
stable/10/secure/lib/libcrypto/i386/co-586.s
  stable/10/secure/lib/libcrypto/i386/crypt586.S
 - copied, changed from r299965, 
stable/10/secure/lib/libcrypto/i386/crypt586.s
  stable/10/secure/lib/libcrypto/i386/des-586.S
 - copied, changed from r299965, 
stable/10/secure/lib/libcrypto/i386/des-586.s
  stable/10/secure/lib/libcrypto/i386/ghash-x86.S
 - copied, changed from r299965, 
stable/10/secure/lib/libcrypto/i386/ghash-x86.s
  stable/10/secure/lib/libcrypto/i386/md5-586.S
 - copied, changed from r299965, 
stable/10/secure/lib/libcrypto/i386/md5-586.s
  stable/10/secure/lib/libcrypto/i386/rc4-586.S
 - copied, changed from r299965, 
stable/10/secure/lib/libcrypto/i386/rc4-586.s
  stable/10/secure/lib/libcrypto/i386/rc5-586.S
 - copied, changed from r299965, 
stable/10/secure/lib/libcrypto/i386/rc5-586.s
  stable/10/secure/lib/libcrypto/i386/rmd-586.S
 - copied, changed from r299965, 
stable/10/secure/lib/libcrypto/i386/rmd-586.s
  stable/10/secure/lib/libcrypto/i386/sha1-586.S
 - copied, changed from r299965, 
stable/10/secure/lib/libcrypto/i386/sha1-586.s
  stable/10/secure/lib/libcrypto/i386/sha256-586.S
 - copied, changed from r299965, 
stable/10/secure/lib/libcrypto/i386/sha256-586.s
  stable/10/secure/lib/libcrypto/i386/sha512-586.S
 - copied, changed from r299965, 
stable/10/secure/lib/libcrypto/i386/sha512-586.s
  stable/10/secure/lib/libcrypto/i386/vpaes-x86.S
 - copied, changed from r299965, 
stable/10/secure/lib/libcrypto/i386/vpaes-x86.s
  stable/10/secure/lib/libcrypto/i386/wp-mmx.S
 - copied, changed from r299965, 
stable/10/secure/lib/libcrypto/i386/wp-mmx.s
  stable/10/secure/lib/libcrypto/i386/x86-gf2m.S
 - copied, changed from r299965, 
stable/10/secure/lib/libcrypto/i386/x86-gf2m.s
  stable/10/secure/lib/libcrypto/i386/x86-mont.S
 - copied, changed from r299965, 
stable/10/secure/lib/libcrypto/i386/x86-mont.s
  stable/10/secure/lib/libcrypto/i386/x86cpuid.S
 - copied, changed from r299965, 
stable/10/secure/lib/libcrypto/i386/x86cpuid.s
Deleted:
  stable/10/secure/lib/libcrypto/i386/aes-586.s
  stable/10/secure/lib/libcrypto/i386/aesni-x86.s
  stable/10/secure/lib/libcrypto/i386/bf-586.s
  stable/10/secure/lib/libcrypto/i386/bf-686.s
  stable/10/secure/lib/libcrypto/i386/bn-586.s
  stable/10/secure/lib/libcrypto/i386/cast-586.s
  stable/10/secure/lib/libcrypto/i386/cmll-x86.s
  stable/10/secure/lib/libcrypto/i386/co-586.s
  stable/10/secure/lib/libcrypto/i386/crypt586.s
  stable/10/secure/lib/libcrypto/i386/des-586.s
  stable/10/secure/lib/libcrypto/i386/ghash-x86.s
  stable/10/secure/lib/libcrypto/i386/md5-586.s
  stable/10/secure/lib/libcrypto/i386/rc4-586.s
  stable/10/secure/lib/libcrypto/i386/rc5-586.s
  stable/10/secure/lib/libcrypto/i386/rmd-586.s
  stable/10/secure/lib/libcrypto/i386/sha1-586.s
  stable/10/secure/lib/libcrypto/i386/sha256-586.s
  stable/10/secure/lib/libcrypto/i386/sha512-586.s
  stable/10/secure/lib/libcrypto/i386/vpaes-x86.s
  stable/10/secure/lib/libcrypto/i386/wp-mmx.s
  stable/10/secure/lib/libcrypto/i386/x86-gf2m.s
  stable/10/secure/lib/libcrypto/i386/x86-mont.s
  stable/10/secure/lib/libcrypto/i386/x86cpuid.s
Modified:
  stable/10/secure/lib/libcrypto/Makefile
  stable/10/secure/lib/libcrypto/Makefile.asm
  stable/10/secure/lib/libcrypto/amd64/aes-x86_64.S
  stable/10/secure/lib/libcrypto/amd64/aesni

svn commit: r299965 - head/sys/dev/urtwn

2016-05-16 Thread Andriy Voskoboinyk
Author: avos
Date: Mon May 16 19:10:59 2016
New Revision: 299965
URL: https://svnweb.freebsd.org/changeset/base/299965

Log:
  urtwn: add support for hardware multicast filter setup.
  
  Tested with RTL8188EU and RTL8188CUS.

Modified:
  head/sys/dev/urtwn/if_urtwn.c

Modified: head/sys/dev/urtwn/if_urtwn.c
==
--- head/sys/dev/urtwn/if_urtwn.c   Mon May 16 19:10:35 2016
(r299964)
+++ head/sys/dev/urtwn/if_urtwn.c   Mon May 16 19:10:59 2016
(r299965)
@@ -356,6 +356,8 @@ static void urtwn_update_slot(struct ie
 static voidurtwn_update_slot_cb(struct urtwn_softc *,
union sec_param *);
 static voidurtwn_update_aifs(struct urtwn_softc *, uint8_t);
+static uint8_t urtwn_get_multi_pos(const uint8_t[]);
+static voidurtwn_set_multi(struct urtwn_softc *);
 static voidurtwn_set_promisc(struct urtwn_softc *);
 static voidurtwn_update_promisc(struct ieee80211com *);
 static voidurtwn_update_mcast(struct ieee80211com *);
@@ -4359,9 +4361,8 @@ urtwn_rxfilter_init(struct urtwn_softc *
 
URTWN_ASSERT_LOCKED(sc);
 
-   /* Accept all multicast frames. */
-   urtwn_write_4(sc, R92C_MAR + 0, 0x);
-   urtwn_write_4(sc, R92C_MAR + 4, 0x);
+   /* Setup multicast filter. */
+   urtwn_set_multi(sc);
 
/* Filter for management frames. */
filter = 0x7f3f;
@@ -4822,6 +4823,67 @@ urtwn_update_aifs(struct urtwn_softc *sc
 }
 }
 
+static uint8_t
+urtwn_get_multi_pos(const uint8_t maddr[])
+{
+   uint64_t mask = 0x4d101df481b4;
+   uint8_t pos = 0x27; /* initial value */
+   int i, j;
+
+   for (i = 0; i < IEEE80211_ADDR_LEN; i++)
+   for (j = (i == 0) ? 1 : 0; j < 8; j++)
+   if ((maddr[i] >> j) & 1)
+   pos ^= (mask >> (i * 8 + j - 1));
+
+   pos &= 0x3f;
+
+   return (pos);
+}
+
+static void
+urtwn_set_multi(struct urtwn_softc *sc)
+{
+   struct ieee80211com *ic = &sc->sc_ic;
+   uint32_t mfilt[2];
+
+   URTWN_ASSERT_LOCKED(sc);
+
+   /* general structure was copied from ath(4). */
+   if (ic->ic_allmulti == 0) {
+   struct ieee80211vap *vap;
+   struct ifnet *ifp;
+   struct ifmultiaddr *ifma;
+
+   /*
+* Merge multicast addresses to form the hardware filter.
+*/
+   mfilt[0] = mfilt[1] = 0;
+   TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
+   ifp = vap->iv_ifp;
+   if_maddr_rlock(ifp);
+   TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
+   caddr_t dl;
+   uint8_t pos;
+
+   dl = LLADDR((struct sockaddr_dl *)
+   ifma->ifma_addr);
+   pos = urtwn_get_multi_pos(dl);
+
+   mfilt[pos / 32] |= (1 << (pos % 32));
+   }
+   if_maddr_runlock(ifp);
+   }
+   } else
+   mfilt[0] = mfilt[1] = ~0;
+
+
+   urtwn_write_4(sc, R92C_MAR + 0, mfilt[0]);
+   urtwn_write_4(sc, R92C_MAR + 4, mfilt[1]);
+
+   URTWN_DPRINTF(sc, URTWN_DEBUG_STATE, "%s: MC filter %08x:%08x\n",
+__func__, mfilt[0], mfilt[1]);
+}
+
 static void
 urtwn_set_promisc(struct urtwn_softc *sc)
 {
@@ -4877,7 +4939,12 @@ urtwn_update_promisc(struct ieee80211com
 static void
 urtwn_update_mcast(struct ieee80211com *ic)
 {
-   /* XXX do nothing?  */
+   struct urtwn_softc *sc = ic->ic_softc;
+
+   URTWN_LOCK(sc);
+   if (sc->sc_flags & URTWN_RUNNING)
+   urtwn_set_multi(sc);
+   URTWN_UNLOCK(sc);
 }
 
 static struct ieee80211_node *
___
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: r299964 - in stable/10/crypto/openssl/crypto: aes/asm sha/asm

2016-05-16 Thread Jung-uk Kim
Author: jkim
Date: Mon May 16 19:10:35 2016
New Revision: 299964
URL: https://svnweb.freebsd.org/changeset/base/299964

Log:
  Detect Clang to support AVX instructions on x86 platforms.
  Note head (OpenSSL 1.0.2 branch) has similar changes.

Modified:
  stable/10/crypto/openssl/crypto/aes/asm/aesni-sha1-x86_64.pl
  stable/10/crypto/openssl/crypto/sha/asm/sha1-586.pl
  stable/10/crypto/openssl/crypto/sha/asm/sha1-x86_64.pl

Modified: stable/10/crypto/openssl/crypto/aes/asm/aesni-sha1-x86_64.pl
==
--- stable/10/crypto/openssl/crypto/aes/asm/aesni-sha1-x86_64.plMon May 
16 19:07:58 2016(r299963)
+++ stable/10/crypto/openssl/crypto/aes/asm/aesni-sha1-x86_64.plMon May 
16 19:10:35 2016(r299964)
@@ -68,6 +68,7 @@ $avx=1 if (!$avx && $win64 && ($flavour 
 $avx=1 if (!$avx && $win64 && ($flavour =~ /masm/ || $ENV{ASM} =~ /ml64/) &&
   `ml64 2>&1` =~ /Version ([0-9]+)\./ &&
   $1>=10);
+$avx=1 if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on 
LLVM) ([3-9]\.[0-9]+)/ && $2>=3.0);
 
 open OUT,"| \"$^X\" $xlate $flavour $output";
 *STDOUT=*OUT;

Modified: stable/10/crypto/openssl/crypto/sha/asm/sha1-586.pl
==
--- stable/10/crypto/openssl/crypto/sha/asm/sha1-586.pl Mon May 16 19:07:58 
2016(r299963)
+++ stable/10/crypto/openssl/crypto/sha/asm/sha1-586.pl Mon May 16 19:10:35 
2016(r299964)
@@ -116,6 +116,9 @@ $ymm=1 if ($xmm && !$ymm && $ARGV[0] eq 
`nasm -v 2>&1` =~ /NASM version ([2-9]\.[0-9]+)/ &&
$1>=2.03);  # first version supporting AVX
 
+$ymm=1 if ($xmm && !$ymm && `$ENV{CC} -v 2>&1` =~ /(^clang version|based on 
LLVM) ([3-9]\.[0-9]+)/ &&
+   $2>=3.0);   # first version supporting AVX
+
 &external_label("OPENSSL_ia32cap_P") if ($xmm);
 
 

Modified: stable/10/crypto/openssl/crypto/sha/asm/sha1-x86_64.pl
==
--- stable/10/crypto/openssl/crypto/sha/asm/sha1-x86_64.pl  Mon May 16 
19:07:58 2016(r299963)
+++ stable/10/crypto/openssl/crypto/sha/asm/sha1-x86_64.pl  Mon May 16 
19:10:35 2016(r299964)
@@ -81,6 +81,8 @@ $avx=1 if (!$avx && $win64 && ($flavour 
 $avx=1 if (!$avx && $win64 && ($flavour =~ /masm/ || $ENV{ASM} =~ /ml64/) &&
   `ml64 2>&1` =~ /Version ([0-9]+)\./ &&
   $1>=10);
+$avx=1 if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on 
LLVM) ([3-9]\.[0-9]+)/ &&
+  $2>=3.0);
 
 open OUT,"| \"$^X\" $xlate $flavour $output";
 *STDOUT=*OUT;
___
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: r299963 - head/sys/arm/conf

2016-05-16 Thread Bjoern A. Zeeb
Author: bz
Date: Mon May 16 19:07:58 2016
New Revision: 299963
URL: https://svnweb.freebsd.org/changeset/base/299963

Log:
  Add HWPMC_HOOKS to std.armv6 to make them available
  so the module could be loaded.
  
  Discussed with:   andrew
  Reviewed by:  andrew
  Sponsored by: DARPA/AFRL
  Differential Revision:https://reviews.freebsd.org/D6359

Modified:
  head/sys/arm/conf/TEGRA124
  head/sys/arm/conf/std.armv6

Modified: head/sys/arm/conf/TEGRA124
==
--- head/sys/arm/conf/TEGRA124  Mon May 16 18:47:53 2016(r299962)
+++ head/sys/arm/conf/TEGRA124  Mon May 16 19:07:58 2016(r299963)
@@ -154,4 +154,3 @@ device  fdt_pinctrl
 # SoC-specific devices
 
 #devicehwpmc
-#options   HWPMC_HOOKS

Modified: head/sys/arm/conf/std.armv6
==
--- head/sys/arm/conf/std.armv6 Mon May 16 18:47:53 2016(r299962)
+++ head/sys/arm/conf/std.armv6 Mon May 16 19:07:58 2016(r299963)
@@ -36,6 +36,7 @@ options   SYSVSEM # SYSV-style semaphor
 options_KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time 
extensions
 optionsPRINTF_BUFR_SIZE=128# Prevent printf output being 
interspersed.
 optionsKBD_INSTALL_CDEV# install a CDEV entry in /dev
+optionsHWPMC_HOOKS # Necessary kernel hooks for hwpmc(4)
 optionsFREEBSD_BOOT_LOADER # Process metadata passed from loader(8)
 optionsVFP # Enable floating point hardware support
 
___
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: r299962 - in stable/10/sys/dev/mpr: . mpi

2016-05-16 Thread Stephen McConnell
Author: slm
Date: Mon May 16 18:47:53 2016
New Revision: 299962
URL: https://svnweb.freebsd.org/changeset/base/299962

Log:
  MFC r299263, r299265, r299266, r299267, r299268, r299269, r299270, r299271,
  r299272, r299274, r299275
  
  - (r299263) Update MPI headers to version 42.
  - (r299265) Several style changes and add copyrights for 2016.
  - (r299266) Add support for the Broadcom (Avago/LSI) 9305 16 and 24 port 
HBA's.
  - (r299267) No log bit in IOCStatus and endian-safe changes.
  
  Use MPI2_IOCSTATUS_MASK when checking IOCStatus to mask off the log bit, and
  make a few more things endian-safe.
  
  - (r299268) Change logging level for a debug string to use MPR_LOG instead of
  MPR_INFO.
  
  - (r299269) Fix possible use of invalid pointer.
  
  It was possible to use an invalid pointer to get the target ID value. To fix
  this, initialize a local Target ID variable to an invalid value and change 
that
  variable to a valid value only if the pointer to the Target ID is not NULL.
  
  - (r299270) No need to set the MPRSAS_SHUTDOWN flag because it's never used.
  - (r299271) Use callout_reset_sbt() instead of callout_reset() if FreeBSD ver
  is >= 129
  
  - (r299272) done_ccb pointer can be used if it is NULL.
  
  To prevent this, move check for done_ccb == NULL to before done_ccb is used in
  mprsas_stop_unit_done().
  
  - (r299274) Disks can go missing until a reboot is done in some cases.
  
  This is due to the DevHandle not being released, which causes the Firmware to
  not allow that disk to be re-added.
  
  - (r299275) Bump version of mpr driver to 13.00.00.00-fbsd

Modified:
  stable/10/sys/dev/mpr/mpi/mpi2.h
  stable/10/sys/dev/mpr/mpi/mpi2_cnfg.h
  stable/10/sys/dev/mpr/mpi/mpi2_hbd.h
  stable/10/sys/dev/mpr/mpi/mpi2_history.txt
  stable/10/sys/dev/mpr/mpi/mpi2_init.h
  stable/10/sys/dev/mpr/mpi/mpi2_ioc.h
  stable/10/sys/dev/mpr/mpi/mpi2_ra.h
  stable/10/sys/dev/mpr/mpi/mpi2_raid.h
  stable/10/sys/dev/mpr/mpi/mpi2_sas.h
  stable/10/sys/dev/mpr/mpi/mpi2_targ.h
  stable/10/sys/dev/mpr/mpi/mpi2_tool.h
  stable/10/sys/dev/mpr/mpi/mpi2_type.h
  stable/10/sys/dev/mpr/mpr.c
  stable/10/sys/dev/mpr/mpr_config.c
  stable/10/sys/dev/mpr/mpr_ioctl.h
  stable/10/sys/dev/mpr/mpr_mapping.c
  stable/10/sys/dev/mpr/mpr_mapping.h
  stable/10/sys/dev/mpr/mpr_pci.c
  stable/10/sys/dev/mpr/mpr_sas.c
  stable/10/sys/dev/mpr/mpr_sas.h
  stable/10/sys/dev/mpr/mpr_sas_lsi.c
  stable/10/sys/dev/mpr/mpr_table.c
  stable/10/sys/dev/mpr/mpr_user.c
  stable/10/sys/dev/mpr/mprvar.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mpr/mpi/mpi2.h
==
--- stable/10/sys/dev/mpr/mpi/mpi2.hMon May 16 18:11:53 2016
(r299961)
+++ stable/10/sys/dev/mpr/mpi/mpi2.hMon May 16 18:47:53 2016
(r299962)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (c) 2012-2015 LSI Corp.
- * Copyright (c) 2013-2015 Avago Technologies
+ * Copyright (c) 2013-2016 Avago Technologies
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -34,7 +34,8 @@
 
 /*
  *  Copyright (c) 2000-2015 LSI Corporation.
- *  Copyright (c) 2013-2015 Avago Technologies
+ *  Copyright (c) 2013-2016 Avago Technologies
+ *  All rights reserved.
  *
  *
  *   Name:  mpi2.h
@@ -43,7 +44,7 @@
  *  scatter/gather formats.
  *  Creation Date:  June 21, 2006
  *
- *  mpi2.h Version:  02.00.33
+ *  mpi2.h Version:  02.00.42
  *
  *  NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25
  *prefix are for use only on MPI v2.5 products, and must not be used
@@ -125,6 +126,22 @@
  *  04-17-13  02.00.31  Bumped MPI2_HEADER_VERSION_UNIT.
  *  08-19-13  02.00.32  Bumped MPI2_HEADER_VERSION_UNIT.
  *  12-05-13  02.00.33  Bumped MPI2_HEADER_VERSION_UNIT.
+ *  01-08-14  02.00.34  Bumped MPI2_HEADER_VERSION_UNIT.
+ *  06-13-14  02.00.35  Bumped MPI2_HEADER_VERSION_UNIT.
+ *  11-18-14  02.00.36  Updated copyright information.
+ *  Bumped MPI2_HEADER_VERSION_UNIT.
+ *  03-16-15  02.00.37  Updated for MPI v2.6.
+ *  Bumped MPI2_HEADER_VERSION_UNIT.
+ *  Added Scratchpad registers to
+ *  MPI2_SYSTEM_INTERFACE_REGS.
+ *  Added MPI2_DIAG_SBR_RELOAD.
+ *  Added MPI2_IOCSTATUS_INSUFFICIENT_POWER.
+ *  03-19-15  02.00.38  Bumped MPI2_HEADER_VERSION_UNIT.
+ *  05-25-15  02.00.39  Bumped MPI2_HEADER_VERSION_UNIT
+ *  08-25-15  02.00.40  Bumped MPI2_HEADER_VERSION_UNIT.
+ *  Added V7 HostDiagnostic register defines
+ *  12-15-15  02.00.41  Bumped MPI_HEADER_VERSION_UNIT
+ *  01-01-16  02.00.42  Bumped MPI_HEADER_VERSION_UNIT
  *  --
  */
 
@@ -160,8 +177,15 @@
 #define MPI2_VERSION_02_05  (0x0205)
 
 
+/* minor version for MPI v2.6 compatible products */
+#

Re: svn commit: r299746 - in head/sys: cddl/dev/dtrace cddl/dev/dtrace/amd64 cddl/dev/dtrace/i386 cddl/dev/dtrace/powerpc conf dev/acpica dev/hwpmc dev/hyperv/vmbus dev/xen/control geom/eli kern net s

2016-05-16 Thread John Baldwin
On Monday, May 16, 2016 01:25:56 PM Julian Elischer wrote:
> On 15/05/2016 2:22 AM, John Baldwin wrote:
> > Author: jhb
> > Date: Sat May 14 18:22:52 2016
> > New Revision: 299746
> > URL: https://svnweb.freebsd.org/changeset/base/299746
> >
> > Log:
> >Add an EARLY_AP_STARTUP option to start APs earlier during boot.


 
> >As a transition aid, the new behavior is available under a new kernel
> >option (EARLY_AP_STARTUP).  This will allow the option to be turned off
> >if need be during initial testing.  I plan to enable this on x86 by
> >default in a followup commit in the next few days and to have all
> >platforms moved over before 11.0.  Once the transition is complete,
> >the option will be removed along with the !EARLY_AP_STARTUP code.



> John, This feels as though it should be settable with a tuneable 
> variable. Can you think
> of a good way to do this other than having two sysinit entries and making
> the tuneable "enable" the right one? There is no tuneable/sysinit 
> interaction otherwise.

The idea is for the !EARLY_AP_STARTUP code to be temporary, so I think
adding a tunable is probably a bit much to add in terms of overhead for
something that should be temporary.

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


Re: svn commit: r299960 - head/sys/compat/linuxkpi/common/include/linux

2016-05-16 Thread Ngie Cooper
On Mon, May 16, 2016 at 10:41 AM, Hans Petter Selasky
 wrote:
> Author: hselasky
> Date: Mon May 16 17:41:25 2016
> New Revision: 299960
> URL: https://svnweb.freebsd.org/changeset/base/299960
>
> Log:
>   Only lock Giant when needed in the LinuxKPI.
>
>   Suggested by: ngie @
>   MFC after:1 week
>   Sponsored by: Mellanox Technologies

Thanks!
___
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: r299961 - stable/10/sys/cam/scsi

2016-05-16 Thread Alan Somers
Author: asomers
Date: Mon May 16 18:11:53 2016
New Revision: 299961
URL: https://svnweb.freebsd.org/changeset/base/299961

Log:
  MFC  298212
  
  Add the ability to read a SAS device's Target Port NAA designator
  
sys/cam/scsi/scsi_all.h
sys/cam/scsi/scsi_all.c
Add the scsi_devid_is_port_naa helper function

Modified:
  stable/10/sys/cam/scsi/scsi_all.c
  stable/10/sys/cam/scsi/scsi_all.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/scsi/scsi_all.c
==
--- stable/10/sys/cam/scsi/scsi_all.c   Mon May 16 17:41:25 2016
(r299960)
+++ stable/10/sys/cam/scsi/scsi_all.c   Mon May 16 18:11:53 2016
(r299961)
@@ -5626,6 +5626,19 @@ scsi_devid_is_lun_name(uint8_t *bufp)
return 1;
 }
 
+int
+scsi_devid_is_port_naa(uint8_t *bufp)
+{
+   struct scsi_vpd_id_descriptor *descr;
+
+   descr = (struct scsi_vpd_id_descriptor *)bufp;
+   if ((descr->id_type & SVPD_ID_ASSOC_MASK) != SVPD_ID_ASSOC_PORT)
+   return 0;
+   if ((descr->id_type & SVPD_ID_TYPE_MASK) != SVPD_ID_TYPE_NAA)
+   return 0;
+   return 1;
+}
+
 struct scsi_vpd_id_descriptor *
 scsi_get_devid_desc(struct scsi_vpd_id_descriptor *desc, uint32_t len,
 scsi_devid_checkfn_t ck_fn)

Modified: stable/10/sys/cam/scsi/scsi_all.h
==
--- stable/10/sys/cam/scsi/scsi_all.h   Mon May 16 17:41:25 2016
(r299960)
+++ stable/10/sys/cam/scsi/scsi_all.h   Mon May 16 18:11:53 2016
(r299961)
@@ -3659,6 +3659,7 @@ int   scsi_devid_is_lun_eui64(uint8_t *bu
 intscsi_devid_is_lun_naa(uint8_t *bufp);
 intscsi_devid_is_lun_name(uint8_t *bufp);
 intscsi_devid_is_lun_t10(uint8_t *bufp);
+intscsi_devid_is_port_naa(uint8_t *bufp);
 struct scsi_vpd_id_descriptor *
scsi_get_devid(struct scsi_vpd_device_id *id, uint32_t len,
   scsi_devid_checkfn_t ck_fn);
___
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: r299960 - head/sys/compat/linuxkpi/common/include/linux

2016-05-16 Thread Hans Petter Selasky
Author: hselasky
Date: Mon May 16 17:41:25 2016
New Revision: 299960
URL: https://svnweb.freebsd.org/changeset/base/299960

Log:
  Only lock Giant when needed in the LinuxKPI.
  
  Suggested by: ngie @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/device.h

Modified: head/sys/compat/linuxkpi/common/include/linux/device.h
==
--- head/sys/compat/linuxkpi/common/include/linux/device.h  Mon May 16 
17:32:28 2016(r299959)
+++ head/sys/compat/linuxkpi/common/include/linux/device.h  Mon May 16 
17:41:25 2016(r299960)
@@ -333,10 +333,11 @@ device_unregister(struct device *dev)
bsddev = dev->bsddev;
dev->bsddev = NULL;
 
-   mtx_lock(&Giant);
-   if (bsddev != NULL)
+   if (bsddev != NULL) {
+   mtx_lock(&Giant);
device_delete_child(device_get_parent(bsddev), bsddev);
-   mtx_unlock(&Giant);
+   mtx_unlock(&Giant);
+   }
put_device(dev);
 }
 
@@ -348,10 +349,11 @@ device_del(struct device *dev)
bsddev = dev->bsddev;
dev->bsddev = NULL;
 
-   mtx_lock(&Giant);
-   if (bsddev != NULL)
+   if (bsddev != NULL) {
+   mtx_lock(&Giant);
device_delete_child(device_get_parent(bsddev), bsddev);
-   mtx_unlock(&Giant);
+   mtx_unlock(&Giant);
+   }
 }
 
 struct device *device_create(struct class *class, struct device *parent,
___
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: r299933 - in head/sys: compat/linuxkpi/common/include/linux sys

2016-05-16 Thread Hans Petter Selasky

On 05/16/16 18:51, Ngie Cooper (yaneurabeya) wrote:



On May 16, 2016, at 09:47, Hans Petter Selasky  wrote:

On 05/16/16 18:31, Ngie Cooper (yaneurabeya) wrote:

Dumb question — couldn’t we run the check without locking Giant, then delete 
the child, e.g.

if (bsddev != NULL) {
   mtx_lock(&Giant);
   device_delete_child(device_get_parent(bsddev), bsddev);
   mtx_unlock(&Giant);
}
put_device(dev);


I guess so. Does it make a difference for you?


First off, how often does the bsddev == NULL case occur?

If it doesn’t occur often, doing this increases contention on Giant 
unnecessarily…


In general this piece of code is called very rarely. I'll look into it.

--HPS

___
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: r299944 - in head/sys: arm64/arm64 conf

2016-05-16 Thread Ed Maste
On 16 May 2016 at 12:08, Zbigniew Bodek  wrote:
> Hello Andrew,
>
> I think committing this code should be preceded by at least brief review.

I agree, review makes sense especially in the case of GICv3 and other
files that originated in the ThunderX work or are closely tied to that
platform.
___
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: r299958 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-05-16 Thread Alan Somers
Author: asomers
Date: Mon May 16 17:23:57 2016
New Revision: 299958
URL: https://svnweb.freebsd.org/changeset/base/299958

Log:
  MFC r298072
  
  Don't corrupt ZFS label's physpath attribute when booting while a disk is
  missing
  
  Prior to this change, vdev_geom_open_by_path would call vdev_geom_attach
  prior to verifying the device's GUIDs.  vdev_geom_attach calls
  vdev_geom_attrchange to set the physpath in the vdev object.  The result is
  that if the disk could not be found, then the labels for other disks in the
  same TLD would overwrite the missing disk's physpath with the physpath of
  whichever disk currently has the same devname as the missing one used to
  have.

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
Mon May 16 17:18:26 2016(r299957)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
Mon May 16 17:23:57 2016(r299958)
@@ -241,9 +241,6 @@ vdev_geom_attach(struct g_provider *pp, 
cp->private = vd;
vd->vdev_tsd = cp;
 
-   /* Fetch initial physical path information for this device. */
-   vdev_geom_attrchanged(cp, "GEOM::physpath");
-   
cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE;
return (cp);
 }
@@ -796,6 +793,10 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi
}
}
 
+   /* Fetch initial physical path information for this device. */
+   if (cp != NULL)
+   vdev_geom_attrchanged(cp, "GEOM::physpath");
+   
g_topology_unlock();
PICKUP_GIANT();
if (cp == 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: r299957 - head/sys/dev/isp

2016-05-16 Thread Alexander Motin
Author: mav
Date: Mon May 16 17:18:26 2016
New Revision: 299957
URL: https://svnweb.freebsd.org/changeset/base/299957

Log:
  Reduce verbosity of "now sending synthesized status" message.
  
  MFC after:1 week

Modified:
  head/sys/dev/isp/isp_freebsd.c

Modified: head/sys/dev/isp/isp_freebsd.c
==
--- head/sys/dev/isp/isp_freebsd.c  Mon May 16 17:06:44 2016
(r299956)
+++ head/sys/dev/isp/isp_freebsd.c  Mon May 16 17:18:26 2016
(r299957)
@@ -1363,7 +1363,7 @@ isp_target_start_ctio(ispsoftc_t *isp, u
 * and status, don't do it again and do the status portion now.
 */
if (atp->sendst) {
-   isp_prt(isp, ISP_LOGTINFO, "[0x%x] now sending 
synthesized status orig_dl=%u xfered=%u bit=%u",
+   isp_prt(isp, ISP_LOGTDEBUG0, "[0x%x] now sending 
synthesized status orig_dl=%u xfered=%u bit=%u",
cso->tag_id, atp->orig_datalen, atp->bytes_xfered, 
atp->bytes_in_transit);
xfrlen = 0; /* we already did the data transfer */
atp->sendst = 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"


Re: svn commit: r299933 - in head/sys: compat/linuxkpi/common/include/linux sys

2016-05-16 Thread Ngie Cooper (yaneurabeya)

> On May 16, 2016, at 09:47, Hans Petter Selasky  wrote:
> 
> On 05/16/16 18:31, Ngie Cooper (yaneurabeya) wrote:
>> Dumb question — couldn’t we run the check without locking Giant, then delete 
>> the child, e.g.
>> 
>> if (bsddev != NULL) {
>>mtx_lock(&Giant);
>>device_delete_child(device_get_parent(bsddev), bsddev);
>>mtx_unlock(&Giant);
>> }
>> put_device(dev);
> 
> I guess so. Does it make a difference for you?

First off, how often does the bsddev == NULL case occur?

If it doesn’t occur often, doing this increases contention on Giant 
unnecessarily…

Thanks,
-Ngie
___
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: r299955 - head/sys/dev/isp

2016-05-16 Thread Alexander Motin
Author: mav
Date: Mon May 16 16:44:34 2016
New Revision: 299955
URL: https://svnweb.freebsd.org/changeset/base/299955

Log:
  No need to check login status for ZOMBIE ports.
  
  ZOMBIE ports are always logged out, and so initiator may try to relogin.
  
  MFC after:1 weeks

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

Modified: head/sys/dev/isp/isp.c
==
--- head/sys/dev/isp/isp.c  Mon May 16 16:29:56 2016(r299954)
+++ head/sys/dev/isp/isp.c  Mon May 16 16:44:34 2016(r299955)
@@ -3808,6 +3808,9 @@ fail:
goto fail;
}
 
+   if (lp->state == FC_PORTDB_STATE_ZOMBIE)
+   goto relogin;
+
/*
 * See if we're still logged into it.
 *
___
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: r299933 - in head/sys: compat/linuxkpi/common/include/linux sys

2016-05-16 Thread Hans Petter Selasky

On 05/16/16 18:31, Ngie Cooper (yaneurabeya) wrote:

Dumb question — couldn’t we run the check without locking Giant, then delete 
the child, e.g.

if (bsddev != NULL) {
mtx_lock(&Giant);
device_delete_child(device_get_parent(bsddev), bsddev);
mtx_unlock(&Giant);
}
put_device(dev);


I guess so. Does it make a difference for you?

--HPS
___
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: r299952 - head/usr.bin/ldd

2016-05-16 Thread Don Lewis
Author: truckman
Date: Mon May 16 16:01:46 2016
New Revision: 299952
URL: https://svnweb.freebsd.org/changeset/base/299952

Log:
  Increase size of argv[] array to avoid running off the end.
  
  Reported by:  Coverity
  CID:  1193819
  MFC after:1 week

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

Modified: head/usr.bin/ldd/ldd.c
==
--- head/usr.bin/ldd/ldd.c  Mon May 16 15:48:56 2016(r299951)
+++ head/usr.bin/ldd/ldd.c  Mon May 16 16:01:46 2016(r299952)
@@ -88,7 +88,7 @@ static void   usage(void);
 static int
 execldd32(char *file, char *fmt1, char *fmt2, int aflag, int vflag)
 {
-   char *argv[8];
+   char *argv[9];
int i, rval, status;
 
LDD_UNSETENV("TRACE_LOADED_OBJECTS");
___
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: r299933 - in head/sys: compat/linuxkpi/common/include/linux sys

2016-05-16 Thread Ngie Cooper (yaneurabeya)

> On May 16, 2016, at 02:56, Hans Petter Selasky  wrote:
> 
> Author: hselasky
> Date: Mon May 16 09:56:48 2016
> New Revision: 299933
> URL: https://svnweb.freebsd.org/changeset/base/299933
> 
> Log:
>  Implement more Linux device related functions in the LinuxKPI. While
>  at it use NULL for some pointer checks.
> 
>  Bump the FreeBSD version to force recompilation of all kernel modules
>  due to a structure size change.
> 
>  Obtained from:   kmacy @
>  MFC after:   1 week
>  Sponsored by:Mellanox Technologies
> 
> Modified:
>  head/sys/compat/linuxkpi/common/include/linux/device.h
>  head/sys/sys/param.h
> 
> Modified: head/sys/compat/linuxkpi/common/include/linux/device.h
> ==
> --- head/sys/compat/linuxkpi/common/include/linux/device.hMon May 16 
> 09:31:44 2016(r299932)
> +++ head/sys/compat/linuxkpi/common/include/linux/device.hMon May 16 
> 09:56:48 2016(r299933)
> @@ -31,6 +31,7 @@
> #ifndef   _LINUX_DEVICE_H_
> #define   _LINUX_DEVICE_H_
> 
> +#include 
> #include 
> #include 
> #include 
> @@ -71,6 +72,7 @@ struct device {
>   unsigned intirq;
>   unsigned intmsix;
>   unsigned intmsix_max;
> + const struct attribute_group **groups;
> };
> 
> extern struct device linux_root_device;
> @@ -127,11 +129,12 @@ show_class_attr_string(struct class *cla
> #define   dev_err(dev, fmt, ...)  device_printf((dev)->bsddev, fmt, 
> ##__VA_ARGS__)
> #define   dev_warn(dev, fmt, ...) device_printf((dev)->bsddev, fmt, 
> ##__VA_ARGS__)
> #define   dev_info(dev, fmt, ...) device_printf((dev)->bsddev, fmt, 
> ##__VA_ARGS__)
> +#define  dev_notice(dev, fmt, ...)   device_printf((dev)->bsddev, 
> fmt, ##__VA_ARGS__)
> #define   dev_printk(lvl, dev, fmt, ...)  
> \
>   device_printf((dev)->bsddev, fmt, ##__VA_ARGS__)
> 
> static inline void *
> -dev_get_drvdata(struct device *dev)
> +dev_get_drvdata(const struct device *dev)
> {
> 
>   return dev->driver_data;
> @@ -191,11 +194,106 @@ class_unregister(struct class *class)
>   kobject_put(&class->kobj);
> }
> 
> +static inline struct device *kobj_to_dev(struct kobject *kobj)
> +{
> + return container_of(kobj, struct device, kobj);
> +}
> +
> /*
> - * Devices are registered and created for exporting to sysfs.  create
> + * Devices are registered and created for exporting to sysfs. Create
>  * implies register and register assumes the device fields have been
>  * setup appropriately before being called.
>  */
> +static inline void
> +device_initialize(struct device *dev)
> +{
> + device_t bsddev;
> +
> + bsddev = NULL;
> + if (dev->devt) {
> + int unit = MINOR(dev->devt);
> + bsddev = devclass_get_device(dev->class->bsdclass, unit);
> + }
> + if (bsddev != NULL)
> + device_set_softc(bsddev, dev);
> +
> + dev->bsddev = bsddev;
> + kobject_init(&dev->kobj, &linux_dev_ktype);
> +}
> +
> +static inline int
> +device_add(struct device *dev)
> +{
> + if (dev->bsddev != NULL) {
> + if (dev->devt == 0)
> + dev->devt = makedev(0, device_get_unit(dev->bsddev));
> + }
> + kobject_add(&dev->kobj, &dev->class->kobj, dev_name(dev));
> + return (0);
> +}
> +
> +static inline void
> +device_create_release(struct device *dev)
> +{
> + kfree(dev);
> +}
> +
> +static inline struct device *
> +device_create_groups_vargs(struct class *class, struct device *parent,
> +dev_t devt, void *drvdata, const struct attribute_group **groups,
> +const char *fmt, va_list args)
> +{
> + struct device *dev = NULL;
> + int retval = -ENODEV;
> +
> + if (class == NULL || IS_ERR(class))
> + goto error;
> +
> + dev = kzalloc(sizeof(*dev), GFP_KERNEL);
> + if (!dev) {
> + retval = -ENOMEM;
> + goto error;
> + }
> +
> + device_initialize(dev);
> + dev->devt = devt;
> + dev->class = class;
> + dev->parent = parent;
> + dev->groups = groups;
> + dev->release = device_create_release;
> + dev->bsddev = devclass_get_device(dev->class->bsdclass, MINOR(devt));
> + dev_set_drvdata(dev, drvdata);
> +
> + retval = kobject_set_name_vargs(&dev->kobj, fmt, args);
> + if (retval)
> + goto error;
> +
> + retval = device_add(dev);
> + if (retval)
> + goto error;
> +
> + return dev;
> +
> +error:
> + put_device(dev);
> + return ERR_PTR(retval);
> +}
> +
> +static inline struct device *
> +device_create_with_groups(struct class *class,
> +struct device *parent, dev_t devt, void *drvdata,
> +const struct attribute_group **groups, const char *fmt, ...)
> +{
> + va_list vargs;
> + struct device *dev;
> +
> + va_start(vargs, fmt);
> + dev = device_create_groups_vargs(class, parent, devt, drvdata,
> + groups, fmt, 

svn commit: r299954 - stable/10/sbin/restore

2016-05-16 Thread Pedro F. Giffuni
Author: pfg
Date: Mon May 16 16:29:56 2016
New Revision: 299954
URL: https://svnweb.freebsd.org/changeset/base/299954

Log:
  MFC r298901:
  restore: promote some getfiles() parameters to size_t.
  
  This is based on a change from OpenBSD:
  
"Fix restore so that it can actually restore files larger than 4GB by
changing the type of "size" to off_t in getfiles() plus little dependent
type cleanup, from Daniel Lucq."
  
  It is an important for machines with 32 bit longs.
  While here unsign the flags, also from OpenBSD.
  
  Obtained from:OpenBSD (with changes)

Modified:
  stable/10/sbin/restore/dirs.c
  stable/10/sbin/restore/extern.h
  stable/10/sbin/restore/tape.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/restore/dirs.c
==
--- stable/10/sbin/restore/dirs.c   Mon May 16 16:16:46 2016
(r299953)
+++ stable/10/sbin/restore/dirs.c   Mon May 16 16:29:56 2016
(r299954)
@@ -85,7 +85,7 @@ struct modeinfo {
mode_t mode;
uid_t uid;
gid_t gid;
-   int flags;
+   u_int flags;
int extsize;
 };
 
@@ -115,8 +115,8 @@ static struct inotab*allocinotab(struct
 static void flushent(void);
 static struct inotab   *inotablookup(ino_t);
 static RST_DIR *opendirfile(const char *);
-static void putdir(char *, long);
-static void putdirattrs(char *, long);
+static void putdir(char *, size_t);
+static void putdirattrs(char *, size_t);
 static void putent(struct direct *);
 static void rst_seekdir(RST_DIR *, long, long);
 static long rst_telldir(RST_DIR *);
@@ -323,10 +323,10 @@ searchdir(ino_t   inum, char *name)
  * Put the directory entries in the directory file
  */
 static void
-putdir(char *buf, long size)
+putdir(char *buf, size_t size)
 {
struct direct *dp;
-   long loc, i;
+   size_t loc, i;
 
for (loc = 0; loc < size; ) {
dp = (struct direct *)(buf + loc);
@@ -356,12 +356,12 @@ putdir(char *buf, long size)
   "reclen not multiple of 4 ");
if (dp->d_reclen < DIRSIZ(0, dp))
vprintf(stdout,
-  "reclen less than DIRSIZ (%d < %zu) ",
+  "reclen less than DIRSIZ (%u < %zu) ",
   dp->d_reclen, DIRSIZ(0, dp));
 #if NAME_MAX < 255
if (dp->d_namlen > NAME_MAX)
vprintf(stdout,
-  "reclen name too big (%d > %d) ",
+  "reclen name too big (%u > %u) ",
   dp->d_namlen, NAME_MAX);
 #endif
vprintf(stdout, "\n");
@@ -418,7 +418,7 @@ flushent(void)
  * Save extended attributes for a directory entry to a file.
  */
 static void
-putdirattrs(char *buf, long size)
+putdirattrs(char *buf, size_t size)
 {
 
if (mf != NULL && fwrite(buf, size, 1, mf) != 1)

Modified: stable/10/sbin/restore/extern.h
==
--- stable/10/sbin/restore/extern.h Mon May 16 16:16:46 2016
(r299953)
+++ stable/10/sbin/restore/extern.h Mon May 16 16:29:56 2016
(r299954)
@@ -54,8 +54,8 @@ void   freeentry(struct entry *);
 voidfreename(char *);
 int genliteraldir(char *, ino_t);
 char   *gentempname(struct entry *);
-voidgetfile(void (*)(char *, long), void (*)(char *, long),
-   void (*)(char *, long));
+voidgetfile(void (*)(char *, size_t), void (*)(char *, size_t),
+   void (*)(char *, size_t));
 voidgetvol(long);
 voidinitsymtable(char *);
 int inodetype(ino_t);
@@ -98,7 +98,7 @@ void   swabst(u_char *, u_char *);
 voidtreescan(char *, ino_t, long (*)(char *, ino_t, int));
 ino_t   upperbnd(ino_t);
 longverifyfile(char *, ino_t, int);
-voidxtrnull(char *, long);
+voidxtrnull(char *, size_t);
 
 /* From ../dump/dumprmt.c */
 void   rmtclose(void);

Modified: stable/10/sbin/restore/tape.c
==
--- stable/10/sbin/restore/tape.c   Mon May 16 16:16:46 2016
(r299953)
+++ stable/10/sbin/restore/tape.c   Mon May 16 16:29:56 2016
(r299954)
@@ -104,7 +104,7 @@ static int   checksum(int *);
 static void findinode(struct s_spcl *);
 static void findtapeblksize(void);
 static char*setupextattr(int);
-static void xtrattr(char *, long);
+static void xtrattr(char *, size_t);
 static void set_extattr_link(char *, void *, int);
 static void set_extattr_fd

svn commit: r299953 - head/usr.sbin/makefs

2016-05-16 Thread Don Lewis
Author: truckman
Date: Mon May 16 16:16:46 2016
New Revision: 299953
URL: https://svnweb.freebsd.org/changeset/base/299953

Log:
  Fix an off by one error to avoid overflowing rp[].
  
  Reported by:  Coverity
  CID:  1007579

Modified:
  head/usr.sbin/makefs/mtree.c

Modified: head/usr.sbin/makefs/mtree.c
==
--- head/usr.sbin/makefs/mtree.cMon May 16 16:01:46 2016
(r299952)
+++ head/usr.sbin/makefs/mtree.cMon May 16 16:16:46 2016
(r299953)
@@ -150,7 +150,7 @@ mtree_file_path(fsnode *node)
 
depth = 0;
rp[depth] = node->name;
-   for (pnode = node->parent; pnode && depth < MAKEFS_MAX_TREE_DEPTH;
+   for (pnode = node->parent; pnode && depth < MAKEFS_MAX_TREE_DEPTH - 1;
 pnode = pnode->parent) {
if (strcmp(pnode->name, ".") == 0)
break;
___
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: r299953 - head/usr.sbin/makefs

2016-05-16 Thread Don Lewis
On 16 May, To: src-committ...@freebsd.org wrote:
> Author: truckman
> Date: Mon May 16 16:16:46 2016
> New Revision: 299953
> URL: https://svnweb.freebsd.org/changeset/base/299953
> 
> Log:
>   Fix an off by one error to avoid overflowing rp[].
>   
>   Reported by:Coverity
>   CID:1007579
> 
> Modified:
>   head/usr.sbin/makefs/mtree.c

MFC after:  1 week
___
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: r299944 - in head/sys: arm64/arm64 conf

2016-05-16 Thread Zbigniew Bodek
Hello Andrew,

I think committing this code should be preceded by at least brief review.
Few remarks to the code found on the first glance below.

Kind regards
zbb

2016-05-16 16:07 GMT+02:00 Andrew Turner :

> Author: andrew
> Date: Mon May 16 14:07:43 2016
> New Revision: 299944
> URL: https://svnweb.freebsd.org/changeset/base/299944
>
> Log:
>   Add intrng support to the GICv3 driver. It lacks ITS support so won't
> handle
>   MSI or MSI-X interrupts, however this is enought to boot FreeBSD under
> the
>   ARM Foundation Model with a GICv3 interrupt controller.
>
>   Approved by:  ABT Systems Ltd
>   Relnotes: yes
>   Sponsored by: The FreeBSD Foundation
>
> Modified:
>   head/sys/arm64/arm64/gic_v3.c
>   head/sys/arm64/arm64/gic_v3_fdt.c
>   head/sys/arm64/arm64/gic_v3_var.h
>   head/sys/conf/files.arm64
>
> Modified: head/sys/arm64/arm64/gic_v3.c
>
> ==
> --- head/sys/arm64/arm64/gic_v3.c   Mon May 16 13:39:04 2016
> (r299943)
> +++ head/sys/arm64/arm64/gic_v3.c   Mon May 16 14:07:43 2016
> (r299944)
> @@ -1,7 +1,10 @@
>  /*-
> - * Copyright (c) 2015 The FreeBSD Foundation
> + * Copyright (c) 2015-2016 The FreeBSD Foundation
>   * All rights reserved.
>   *
> + * This software was developed by Andrew Turner under
> + * the sponsorship of the FreeBSD Foundation.
> + *
>   * This software was developed by Semihalf under
>   * the sponsorship of the FreeBSD Foundation.
>   *
> @@ -27,6 +30,8 @@
>   * SUCH DAMAGE.
>   */
>
> +#include "opt_platform.h"
> +
>  #include 
>  __FBSDID("$FreeBSD$");
>
> @@ -58,6 +63,28 @@ __FBSDID("$FreeBSD$");
>  #include "gic_v3_reg.h"
>  #include "gic_v3_var.h"
>
> +#ifdef INTRNG
> +static pic_disable_intr_t gic_v3_disable_intr;
> +static pic_enable_intr_t gic_v3_enable_intr;
> +static pic_map_intr_t gic_v3_map_intr;
> +static pic_setup_intr_t gic_v3_setup_intr;
> +static pic_teardown_intr_t gic_v3_teardown_intr;
> +static pic_post_filter_t gic_v3_post_filter;
> +static pic_post_ithread_t gic_v3_post_ithread;
> +static pic_pre_ithread_t gic_v3_pre_ithread;
> +static pic_bind_intr_t gic_v3_bind_intr;
> +#ifdef SMP
> +static pic_init_secondary_t gic_v3_init_secondary;
> +static pic_ipi_send_t gic_v3_ipi_send;
> +static pic_ipi_setup_t gic_v3_ipi_setup;
> +#endif
> +
> +static u_int gic_irq_cpu;
> +#ifdef SMP
> +static u_int sgi_to_ipi[GIC_LAST_SGI - GIC_FIRST_SGI + 1];
> +static u_int sgi_first_unused = GIC_FIRST_SGI;
> +#endif
> +#else
>  /* Device and PIC methods */
>  static int gic_v3_bind(device_t, u_int, u_int);
>  static void gic_v3_dispatch(device_t, struct trapframe *);
> @@ -68,11 +95,29 @@ static void gic_v3_unmask_irq(device_t,
>  static void gic_v3_init_secondary(device_t);
>  static void gic_v3_ipi_send(device_t, cpuset_t, u_int);
>  #endif
> +#endif
>
>  static device_method_t gic_v3_methods[] = {
> /* Device interface */
> DEVMETHOD(device_detach,gic_v3_detach),
>
> +#ifdef INTRNG
> +   /* Interrupt controller interface */
> +   DEVMETHOD(pic_disable_intr, gic_v3_disable_intr),
> +   DEVMETHOD(pic_enable_intr,  gic_v3_enable_intr),
> +   DEVMETHOD(pic_map_intr, gic_v3_map_intr),
> +   DEVMETHOD(pic_setup_intr,   gic_v3_setup_intr),
> +   DEVMETHOD(pic_teardown_intr,gic_v3_teardown_intr),
> +   DEVMETHOD(pic_post_filter,  gic_v3_post_filter),
> +   DEVMETHOD(pic_post_ithread, gic_v3_post_ithread),
> +   DEVMETHOD(pic_pre_ithread,  gic_v3_pre_ithread),
> +#ifdef SMP
> +   DEVMETHOD(pic_bind_intr,gic_v3_bind_intr),
> +   DEVMETHOD(pic_init_secondary,   gic_v3_init_secondary),
> +   DEVMETHOD(pic_ipi_send, gic_v3_ipi_send),
> +   DEVMETHOD(pic_ipi_setup,gic_v3_ipi_setup),
> +#endif
> +#else
> /* PIC interface */
> DEVMETHOD(pic_bind, gic_v3_bind),
> DEVMETHOD(pic_dispatch, gic_v3_dispatch),
> @@ -83,6 +128,8 @@ static device_method_t gic_v3_methods[]
> DEVMETHOD(pic_init_secondary,   gic_v3_init_secondary),
> DEVMETHOD(pic_ipi_send, gic_v3_ipi_send),
>  #endif
> +#endif
> +
> /* End */
> DEVMETHOD_END
>  };
> @@ -144,6 +191,10 @@ gic_v3_attach(device_t dev)
> int rid;
> int err;
> size_t i;
> +#ifdef INTRNG
> +   u_int irq;
> +   const char *name;
> +#endif
>
> sc = device_get_softc(dev);
> sc->gic_registered = FALSE;
> @@ -192,6 +243,36 @@ gic_v3_attach(device_t dev)
> if (sc->gic_nirqs > GIC_I_NUM_MAX)
> sc->gic_nirqs = GIC_I_NUM_MAX;
>
> +#ifdef INTRNG
> +   sc->gic_irqs = malloc(sizeof(*sc->gic_irqs) * sc->gic_nirqs,
> +   M_GIC_V3, M_WAITOK | M_ZERO);
> +   name = device_get_nameunit(dev);
> +   for (irq = 0; irq < sc->gic_nirqs; irq++) {
> +   struct intr_irqsrc *isrc;
> +
> +   sc->gic_irqs[irq].gi_irq = irq;
> +   sc->gic_irqs[ir

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

2016-05-16 Thread Andriy Gapon
Author: avg
Date: Mon May 16 15:48:56 2016
New Revision: 299951
URL: https://svnweb.freebsd.org/changeset/base/299951

Log:
  do not destroy 'snapdir' when it becomes  inactive
  
  That was just wrong.  In fact, we can safely keep this static entry when
  it's inactive.
  Now the destructive action is moved to the reclaim method and the
  function is renamed from zfsctl_snapdir_inactive(0 to
  zfsctl_snapdir_reclaim().
  
  Also, we can use gfs_vop_reclaim() instead of gfs_dir_inactive() +
  kmem_free().
  
  Lastly, we can just assert that the node does not any children when it
  is reclaimed, even on the force unmount.  That's because zfs_umount()
  does an extra vflush() pass which should destroy all snapshot-mountpoint
  vnodes that are the snapdir's children.
  
  MFC after:5 weeks

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon May 
16 15:42:59 2016(r299950)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon May 
16 15:48:56 2016(r299951)
@@ -454,25 +454,6 @@ zfsctl_shares_fid(ap)
return (error);
 }
 
-static int
-zfsctl_common_reclaim(ap)
-   struct vop_reclaim_args /* {
-   struct vnode *a_vp;
-   struct thread *a_td;
-   } */ *ap;
-{
-   vnode_t *vp = ap->a_vp;
-
-   /*
-* Destroy the vm object and flush associated pages.
-*/
-   vnode_destroy_vobject(vp);
-   VI_LOCK(vp);
-   vp->v_data = NULL;
-   VI_UNLOCK(vp);
-   return (0);
-}
-
 /*
  * .zfs inode namespace
  *
@@ -1377,8 +1358,8 @@ zfsctl_snapdir_getattr(ap)
 
 /* ARGSUSED */
 static int
-zfsctl_snapdir_inactive(ap)
-   struct vop_inactive_args /* {
+zfsctl_snapdir_reclaim(ap)
+   struct vop_reclaim_args /* {
struct vnode *a_vp;
struct thread *a_td;
} */ *ap;
@@ -1387,21 +1368,10 @@ zfsctl_snapdir_inactive(ap)
zfsctl_snapdir_t *sdp = vp->v_data;
zfs_snapentry_t *sep;
 
-   /*
-* On forced unmount we have to free snapshots from here.
-*/
-   mutex_enter(&sdp->sd_lock);
-   while ((sep = avl_first(&sdp->sd_snaps)) != NULL) {
-   avl_remove(&sdp->sd_snaps, sep);
-   kmem_free(sep->se_name, strlen(sep->se_name) + 1);
-   kmem_free(sep, sizeof (zfs_snapentry_t));
-   }
-   mutex_exit(&sdp->sd_lock);
-   gfs_dir_inactive(vp);
ASSERT(avl_numnodes(&sdp->sd_snaps) == 0);
mutex_destroy(&sdp->sd_lock);
avl_destroy(&sdp->sd_snaps);
-   kmem_free(sdp, sizeof (zfsctl_snapdir_t));
+   gfs_vop_reclaim(ap);
 
return (0);
 }
@@ -1448,8 +1418,8 @@ static struct vop_vector zfsctl_ops_snap
.vop_mkdir =zfsctl_freebsd_snapdir_mkdir,
.vop_readdir =  gfs_vop_readdir,
.vop_lookup =   zfsctl_snapdir_lookup,
-   .vop_inactive = zfsctl_snapdir_inactive,
-   .vop_reclaim =  zfsctl_common_reclaim,
+   .vop_inactive = VOP_NULL,
+   .vop_reclaim =  zfsctl_snapdir_reclaim,
.vop_fid =  zfsctl_common_fid,
 };
 
___
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: r299950 - head/lib/libbsdstat

2016-05-16 Thread Don Lewis
Author: truckman
Date: Mon May 16 15:42:59 2016
New Revision: 299950
URL: https://svnweb.freebsd.org/changeset/base/299950

Log:
  Fix off by one error in index limit calculation
  
  Reported by:  Coverity
  CID:  1193826

Modified:
  head/lib/libbsdstat/bsdstat.c

Modified: head/lib/libbsdstat/bsdstat.c
==
--- head/lib/libbsdstat/bsdstat.c   Mon May 16 15:37:41 2016
(r299949)
+++ head/lib/libbsdstat/bsdstat.c   Mon May 16 15:42:59 2016
(r299950)
@@ -53,7 +53,7 @@ bsdstat_setfmt(struct bsdstat *sf, const
"skipped\n", sf->name, tok);
continue;
}
-   if (j+3 > (int) sizeof(sf->fmts)) {
+   if (j+4 > (int) sizeof(sf->fmts)) {
fprintf(stderr, "%s: not enough room for all stats; "
"stopped at %s\n", sf->name, tok);
break;
___
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: r299949 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-05-16 Thread Andriy Gapon
Author: avg
Date: Mon May 16 15:37:41 2016
New Revision: 299949
URL: https://svnweb.freebsd.org/changeset/base/299949

Log:
  try to recycle "snap" vnodes as soon as possible
  
  Those vnodes should not linger.  "Stale" nodes may get out of
  synchronization with actual snapshots.  For example if we destroy a
  snapshot and create a new one with the same name.  Or when we rename a
  snapshot.
  
  While there fix the argument type for zfsctl_snapshot_reclaim().
  Also, its original argument can be passed to gfs_vop_reclaim() directly.
  
  Bug 209093 could be related although I have not specifically verified
  that.  Referencing just in case.
  
  PR:   209093
  MFC after:5 weeks

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon May 
16 15:32:02 2016(r299948)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon May 
16 15:37:41 2016(r299949)
@@ -1490,17 +1490,28 @@ zfsctl_snapshot_mknode(vnode_t *pvp, uin
return (vp);
 }
 
+static int
+zfsctl_snapshot_inactive(ap)
+   struct vop_inactive_args /* {
+   struct vnode *a_vp;
+   struct thread *a_td;
+   } */ *ap;
+{
+   vnode_t *vp = ap->a_vp;
+
+   vrecycle(vp);
+   return (0);
+}
 
 static int
 zfsctl_snapshot_reclaim(ap)
-   struct vop_inactive_args /* {
+   struct vop_reclaim_args /* {
struct vnode *a_vp;
struct thread *a_td;
} */ *ap;
 {
vnode_t *vp = ap->a_vp;
cred_t *cr = ap->a_td->td_ucred;
-   struct vop_reclaim_args iap;
zfsctl_snapdir_t *sdp;
zfs_snapentry_t *sep, *next;
int locked;
@@ -1543,8 +1554,7 @@ zfsctl_snapshot_reclaim(ap)
 * "active".  If we lookup the same name again we will end up
 * creating a new vnode.
 */
-   iap.a_vp = vp;
-   gfs_vop_reclaim(&iap);
+   gfs_vop_reclaim(ap);
return (0);
 
 }
@@ -1597,7 +1607,7 @@ zfsctl_snapshot_vptocnp(struct vop_vptoc
  */
 static struct vop_vector zfsctl_ops_snapshot = {
.vop_default =  &default_vnodeops,
-   .vop_inactive = VOP_NULL,
+   .vop_inactive = zfsctl_snapshot_inactive,
.vop_reclaim =  zfsctl_snapshot_reclaim,
.vop_vptocnp =  zfsctl_snapshot_vptocnp,
 };
___
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: r299926 - head/lib/libpam/modules/pam_unix

2016-05-16 Thread Don Lewis
On 16 May, Ed Maste wrote:
> On 16 May 2016 at 04:34, Don Lewis  wrote:
>> Author: truckman
>> Date: Mon May 16 08:34:17 2016
>> New Revision: 299926
>> URL: https://svnweb.freebsd.org/changeset/base/299926
>>
>> Log:
>>   Hoist the getpwnam() call outside the first if/else block in
>>   pam_sm_chauthtok().  Set user = getlogin() inside the true
>>   branch so that it is initialized for the following PAM_LOG()
>>   call.  This is how it is done in pam_sm_authenticate().
> 
> Unfortunately this triggers a warning on powerpc/powerpc64:
> 
> /scratch/tmp/emaste/freebsd/lib/libpam/modules/pam_unix/pam_unix.c: In
> function 'pam_sm_chauthtok':
> /scratch/tmp/emaste/freebsd/lib/libpam/modules/pam_unix/pam_unix.c:278:
> warning: 'retval' may be used uninitialized in this function
> 
> I don't see why GCC warns now and did not before, though.

Strange ...

It turns out that Coverity did notice this, CID 1018711.  It should be
fixed by r299948.

___
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: r299948 - head/lib/libpam/modules/pam_unix

2016-05-16 Thread Don Lewis
Author: truckman
Date: Mon May 16 15:32:02 2016
New Revision: 299948
URL: https://svnweb.freebsd.org/changeset/base/299948

Log:
  Set retval in the empty password case to avoid a path through the
  code that fails to set retval before falling through to the final
  return().
  
  Reported by:  emaste
  Reported by:  Coverity
  CID:  1018711
  MFC after:1 week

Modified:
  head/lib/libpam/modules/pam_unix/pam_unix.c

Modified: head/lib/libpam/modules/pam_unix/pam_unix.c
==
--- head/lib/libpam/modules/pam_unix/pam_unix.c Mon May 16 15:28:39 2016
(r299947)
+++ head/lib/libpam/modules/pam_unix/pam_unix.c Mon May 16 15:32:02 2016
(r299948)
@@ -332,6 +332,7 @@ pam_sm_chauthtok(pam_handle_t *pamh, int
 * XXX check PAM_DISALLOW_NULL_AUTHTOK
 */
old_pass = "";
+   retval = PAM_SUCCESS;
} else {
retval = pam_get_authtok(pamh,
PAM_OLDAUTHTOK, &old_pass, 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: r299947 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-05-16 Thread Andriy Gapon
Author: avg
Date: Mon May 16 15:28:39 2016
New Revision: 299947
URL: https://svnweb.freebsd.org/changeset/base/299947

Log:
  fix locking in zfsctl_root_lookup
  
  Dropping the root vnode's lock after VFS_ROOT() didn't really help the
  fact that we acquired the lock while holding its child's, .zfs, lock
  while performing the operaiton.
  So, directly use zfs_zget() to get the root vnode.
  
  While there simplify the code in zfsctl_freebsd_root_lookup.
  We know that .zfs is always exclusively locked.
  We know that there is already a reference on *vpp, so no need for an
  extra one.
  Account for the fact that .. lookup may ask for a different lock type,
  not necessarily LK_EXCLUSIVE.  And handle a possible failure to acquire
  the lock given the lock flags.
  
  MFC after:5 weeks

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon May 
16 15:13:16 2016(r299946)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon May 
16 15:28:39 2016(r299947)
@@ -537,9 +537,20 @@ zfsctl_root_lookup(vnode_t *dvp, char *n
ZFS_ENTER(zfsvfs);
 
if (strcmp(nm, "..") == 0) {
+#ifdef illumos
err = VFS_ROOT(dvp->v_vfsp, LK_EXCLUSIVE, vpp);
+#else
+   /*
+* NB: can not use VFS_ROOT here as it would acquire
+* the vnode lock of the parent (root) vnode while
+* holding the child's (.zfs) lock.
+*/
+   znode_t *rootzp;
+
+   err = zfs_zget(zfsvfs, zfsvfs->z_root, &rootzp);
if (err == 0)
-   VOP_UNLOCK(*vpp, 0);
+   *vpp = ZTOV(rootzp);
+#endif
} else {
err = gfs_vop_lookup(dvp, nm, vpp, pnp, flags, rdir,
cr, ct, direntflags, realpnp);
@@ -601,10 +612,10 @@ zfsctl_freebsd_root_lookup(ap)
vnode_t **vpp = ap->a_vpp;
cred_t *cr = ap->a_cnp->cn_cred;
int flags = ap->a_cnp->cn_flags;
+   int lkflags = ap->a_cnp->cn_lkflags;
int nameiop = ap->a_cnp->cn_nameiop;
char nm[NAME_MAX + 1];
int err;
-   int ltype;
 
if ((flags & ISLASTCN) && (nameiop == RENAME || nameiop == CREATE))
return (EOPNOTSUPP);
@@ -613,16 +624,15 @@ zfsctl_freebsd_root_lookup(ap)
strlcpy(nm, ap->a_cnp->cn_nameptr, ap->a_cnp->cn_namelen + 1);
err = zfsctl_root_lookup(dvp, nm, vpp, NULL, 0, NULL, cr, NULL, NULL, 
NULL);
if (err == 0 && (nm[0] != '.' || nm[1] != '\0')) {
-   ltype = VOP_ISLOCKED(dvp);
-   if (flags & ISDOTDOT) {
-   VN_HOLD(*vpp);
+   if (flags & ISDOTDOT)
VOP_UNLOCK(dvp, 0);
+   err = vn_lock(*vpp, lkflags);
+   if (err != 0) {
+   vrele(*vpp);
+   *vpp = NULL;
}
-   vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY);
-   if (flags & ISDOTDOT) {
-   VN_RELE(*vpp);
-   vn_lock(dvp, ltype| LK_RETRY);
-   }
+   if (flags & ISDOTDOT)
+   vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
}
 
return (err);
___
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: r299946 - in head/sys/cddl/contrib/opensolaris/uts/common/fs: . zfs

2016-05-16 Thread Andriy Gapon
Author: avg
Date: Mon May 16 15:13:16 2016
New Revision: 299946
URL: https://svnweb.freebsd.org/changeset/base/299946

Log:
  gfs_lookup_dot() does not have to acquire any locks
  
  In fact, that was dangerous.  For example, zfsctl_snapshot_reclaim()
  calls gfs_dir_lookup() on ".." path and that ends up calling
  gfs_lookup_dot() which violated locking order by acquiring the parent's
  directory vnode lock after the child's vnode lock.
  
  Also, the previous behavior was inconsistent as gfs_dir_lookup()
  returned a locked vnode for . and .. lookups, but not for any other.
  
  Now gfs_lookup_dot() just references a resulting vnode and the locking
  is done in its consumers, where necessary.
  Note that we do not enable shared locking support for any gfs / zfsctl
  vnodes.
  
  This commit partially reverts r273641.
  
  MFC after:5 weeks

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c   Mon May 16 
15:03:52 2016(r299945)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c   Mon May 16 
15:13:16 2016(r299946)
@@ -442,19 +442,9 @@ gfs_lookup_dot(vnode_t **vpp, vnode_t *d
*vpp = dvp;
return (0);
} else if (strcmp(nm, "..") == 0) {
-   if (pvp == NULL) {
-   ASSERT(dvp->v_flag & VROOT);
-   VN_HOLD(dvp);
-   *vpp = dvp;
-   ASSERT_VOP_ELOCKED(dvp, "gfs_lookup_dot: non-locked 
dvp");
-   } else {
-   ltype = VOP_ISLOCKED(dvp);
-   VOP_UNLOCK(dvp, 0);
-   VN_HOLD(pvp);
-   *vpp = pvp;
-   vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY);
-   vn_lock(dvp, ltype | LK_RETRY);
-   }
+   ASSERT(pvp != NULL);
+   VN_HOLD(pvp);
+   *vpp = pvp;
return (0);
}
 

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon May 
16 15:03:52 2016(r299945)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon May 
16 15:13:16 2016(r299946)
@@ -987,6 +987,11 @@ zfsctl_snapdir_lookup(ap)
 
ZFS_ENTER(zfsvfs);
if (gfs_lookup_dot(vpp, dvp, zfsvfs->z_ctldir, nm) == 0) {
+   if (nm[0] == '.' && nm[1] == '.' && nm[2] =='\0') {
+   VOP_UNLOCK(dvp, 0);
+   VERIFY0(vn_lock(*vpp, LK_EXCLUSIVE));
+   VERIFY0(vn_lock(dvp, LK_EXCLUSIVE));
+   }
ZFS_EXIT(zfsvfs);
return (0);
}
@@ -1151,6 +1156,11 @@ zfsctl_shares_lookup(ap)
strlcpy(nm, cnp->cn_nameptr, cnp->cn_namelen + 1);
 
if (gfs_lookup_dot(vpp, dvp, zfsvfs->z_ctldir, nm) == 0) {
+   if (nm[0] == '.' && nm[1] == '.' && nm[2] =='\0') {
+   VOP_UNLOCK(dvp, 0);
+   VERIFY0(vn_lock(*vpp, LK_EXCLUSIVE));
+   VERIFY0(vn_lock(dvp, LK_EXCLUSIVE));
+   }
ZFS_EXIT(zfsvfs);
return (0);
}
@@ -1488,7 +1498,6 @@ zfsctl_snapshot_reclaim(ap)
 
VERIFY(gfs_dir_lookup(vp, "..", &dvp, cr, 0, NULL, NULL) == 0);
sdp = dvp->v_data;
-   VOP_UNLOCK(dvp, 0);
/* this may already have been unmounted */
if (sdp == NULL) {
VN_RELE(dvp);
___
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: r299945 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-05-16 Thread Andriy Gapon
Author: avg
Date: Mon May 16 15:03:52 2016
New Revision: 299945
URL: https://svnweb.freebsd.org/changeset/base/299945

Log:
  avoid deadlock between zfsctl_snapdir_lookup and zfsctl_snapshot_reclaim
  
  The former acquired a snap vnode lock while holding sd_lock while the
  latter does the opposite.
  
  The solution is drop sd_lock before acquiring the vnode lock.  That
  should be okay as we are still holding a lock on the 'snapshot'
  directory in the exclusive mode.  That lock ensures that there are no
  concurrent lookups in the directory and thus no concurrent mount attempts.
  
  But now we have to account for the possibility that the snap vnode
  might get reclaim after we drop sd_lock and before we can get
  the node lock.  So, check for that case and retry.
  
  MFC after:5 weeks

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon May 
16 14:07:43 2016(r299944)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon May 
16 15:03:52 2016(r299945)
@@ -1011,6 +1011,7 @@ zfsctl_snapdir_lookup(ap)
 #endif
}
 
+relookup:
mutex_enter(&sdp->sd_lock);
search.se_name = (char *)nm;
if ((sep = avl_find(&sdp->sd_snaps, &search, &where)) != NULL) {
@@ -1085,7 +1086,16 @@ domount:
(void) snprintf(mountpoint, mountpoint_len,
"%s/" ZFS_CTLDIR_NAME "/snapshot/%s",
dvp->v_vfsp->mnt_stat.f_mntonname, nm);
-   VERIFY0(vn_lock(*vpp, LK_EXCLUSIVE));
+   mutex_exit(&sdp->sd_lock);
+
+   /*
+* The vnode may get reclaimed between dropping sd_lock and
+* getting the vnode lock.
+* */
+   err = vn_lock(*vpp, LK_EXCLUSIVE);
+   if (err == ENOENT)
+   goto relookup;
+   VERIFY0(err);
err = mount_snapshot(curthread, vpp, "zfs", mountpoint, snapname, 0);
kmem_free(mountpoint, mountpoint_len);
if (err == 0) {
@@ -1100,7 +1110,6 @@ domount:
VTOZ(*vpp)->z_zfsvfs->z_parent = zfsvfs;
(*vpp)->v_flag &= ~VROOT;
}
-   mutex_exit(&sdp->sd_lock);
ZFS_EXIT(zfsvfs);
 
 #ifdef illumos
___
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: r299944 - in head/sys: arm64/arm64 conf

2016-05-16 Thread Andrew Turner
Author: andrew
Date: Mon May 16 14:07:43 2016
New Revision: 299944
URL: https://svnweb.freebsd.org/changeset/base/299944

Log:
  Add intrng support to the GICv3 driver. It lacks ITS support so won't handle
  MSI or MSI-X interrupts, however this is enought to boot FreeBSD under the
  ARM Foundation Model with a GICv3 interrupt controller.
  
  Approved by:  ABT Systems Ltd
  Relnotes: yes
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/gic_v3.c
  head/sys/arm64/arm64/gic_v3_fdt.c
  head/sys/arm64/arm64/gic_v3_var.h
  head/sys/conf/files.arm64

Modified: head/sys/arm64/arm64/gic_v3.c
==
--- head/sys/arm64/arm64/gic_v3.c   Mon May 16 13:39:04 2016
(r299943)
+++ head/sys/arm64/arm64/gic_v3.c   Mon May 16 14:07:43 2016
(r299944)
@@ -1,7 +1,10 @@
 /*-
- * Copyright (c) 2015 The FreeBSD Foundation
+ * Copyright (c) 2015-2016 The FreeBSD Foundation
  * All rights reserved.
  *
+ * This software was developed by Andrew Turner under
+ * the sponsorship of the FreeBSD Foundation.
+ *
  * This software was developed by Semihalf under
  * the sponsorship of the FreeBSD Foundation.
  *
@@ -27,6 +30,8 @@
  * SUCH DAMAGE.
  */
 
+#include "opt_platform.h"
+
 #include 
 __FBSDID("$FreeBSD$");
 
@@ -58,6 +63,28 @@ __FBSDID("$FreeBSD$");
 #include "gic_v3_reg.h"
 #include "gic_v3_var.h"
 
+#ifdef INTRNG
+static pic_disable_intr_t gic_v3_disable_intr;
+static pic_enable_intr_t gic_v3_enable_intr;
+static pic_map_intr_t gic_v3_map_intr;
+static pic_setup_intr_t gic_v3_setup_intr;
+static pic_teardown_intr_t gic_v3_teardown_intr;
+static pic_post_filter_t gic_v3_post_filter;
+static pic_post_ithread_t gic_v3_post_ithread;
+static pic_pre_ithread_t gic_v3_pre_ithread;
+static pic_bind_intr_t gic_v3_bind_intr;
+#ifdef SMP
+static pic_init_secondary_t gic_v3_init_secondary;
+static pic_ipi_send_t gic_v3_ipi_send;
+static pic_ipi_setup_t gic_v3_ipi_setup;
+#endif
+
+static u_int gic_irq_cpu;
+#ifdef SMP
+static u_int sgi_to_ipi[GIC_LAST_SGI - GIC_FIRST_SGI + 1];
+static u_int sgi_first_unused = GIC_FIRST_SGI;
+#endif
+#else
 /* Device and PIC methods */
 static int gic_v3_bind(device_t, u_int, u_int);
 static void gic_v3_dispatch(device_t, struct trapframe *);
@@ -68,11 +95,29 @@ static void gic_v3_unmask_irq(device_t, 
 static void gic_v3_init_secondary(device_t);
 static void gic_v3_ipi_send(device_t, cpuset_t, u_int);
 #endif
+#endif
 
 static device_method_t gic_v3_methods[] = {
/* Device interface */
DEVMETHOD(device_detach,gic_v3_detach),
 
+#ifdef INTRNG
+   /* Interrupt controller interface */
+   DEVMETHOD(pic_disable_intr, gic_v3_disable_intr),
+   DEVMETHOD(pic_enable_intr,  gic_v3_enable_intr),
+   DEVMETHOD(pic_map_intr, gic_v3_map_intr),
+   DEVMETHOD(pic_setup_intr,   gic_v3_setup_intr),
+   DEVMETHOD(pic_teardown_intr,gic_v3_teardown_intr),
+   DEVMETHOD(pic_post_filter,  gic_v3_post_filter),
+   DEVMETHOD(pic_post_ithread, gic_v3_post_ithread),
+   DEVMETHOD(pic_pre_ithread,  gic_v3_pre_ithread),
+#ifdef SMP
+   DEVMETHOD(pic_bind_intr,gic_v3_bind_intr),
+   DEVMETHOD(pic_init_secondary,   gic_v3_init_secondary),
+   DEVMETHOD(pic_ipi_send, gic_v3_ipi_send),
+   DEVMETHOD(pic_ipi_setup,gic_v3_ipi_setup),
+#endif
+#else
/* PIC interface */
DEVMETHOD(pic_bind, gic_v3_bind),
DEVMETHOD(pic_dispatch, gic_v3_dispatch),
@@ -83,6 +128,8 @@ static device_method_t gic_v3_methods[] 
DEVMETHOD(pic_init_secondary,   gic_v3_init_secondary),
DEVMETHOD(pic_ipi_send, gic_v3_ipi_send),
 #endif
+#endif
+
/* End */
DEVMETHOD_END
 };
@@ -144,6 +191,10 @@ gic_v3_attach(device_t dev)
int rid;
int err;
size_t i;
+#ifdef INTRNG
+   u_int irq;
+   const char *name;
+#endif
 
sc = device_get_softc(dev);
sc->gic_registered = FALSE;
@@ -192,6 +243,36 @@ gic_v3_attach(device_t dev)
if (sc->gic_nirqs > GIC_I_NUM_MAX)
sc->gic_nirqs = GIC_I_NUM_MAX;
 
+#ifdef INTRNG
+   sc->gic_irqs = malloc(sizeof(*sc->gic_irqs) * sc->gic_nirqs,
+   M_GIC_V3, M_WAITOK | M_ZERO);
+   name = device_get_nameunit(dev);
+   for (irq = 0; irq < sc->gic_nirqs; irq++) {
+   struct intr_irqsrc *isrc;
+
+   sc->gic_irqs[irq].gi_irq = irq;
+   sc->gic_irqs[irq].gi_pol = INTR_POLARITY_CONFORM;
+   sc->gic_irqs[irq].gi_trig = INTR_TRIGGER_CONFORM;
+
+   isrc = &sc->gic_irqs[irq].gi_isrc;
+   if (irq <= GIC_LAST_SGI) {
+   err = intr_isrc_register(isrc, sc->dev,
+   INTR_ISRCF_IPI, "%s,i%u", name, irq - 
GIC_FIRST_SGI);
+   } else if (irq <= GIC_LAST_PPI) {
+   err = intr_isrc_register(isrc, sc->de

Re: svn commit: r299926 - head/lib/libpam/modules/pam_unix

2016-05-16 Thread Ed Maste
On 16 May 2016 at 04:34, Don Lewis  wrote:
> Author: truckman
> Date: Mon May 16 08:34:17 2016
> New Revision: 299926
> URL: https://svnweb.freebsd.org/changeset/base/299926
>
> Log:
>   Hoist the getpwnam() call outside the first if/else block in
>   pam_sm_chauthtok().  Set user = getlogin() inside the true
>   branch so that it is initialized for the following PAM_LOG()
>   call.  This is how it is done in pam_sm_authenticate().

Unfortunately this triggers a warning on powerpc/powerpc64:

/scratch/tmp/emaste/freebsd/lib/libpam/modules/pam_unix/pam_unix.c: In
function 'pam_sm_chauthtok':
/scratch/tmp/emaste/freebsd/lib/libpam/modules/pam_unix/pam_unix.c:278:
warning: 'retval' may be used uninitialized in this function

I don't see why GCC warns now and did not before, though.
___
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: r299943 - head/lib/libthr

2016-05-16 Thread Jilles Tjoelker
Author: jilles
Date: Mon May 16 13:39:04 2016
New Revision: 299943
URL: https://svnweb.freebsd.org/changeset/base/299943

Log:
  libthr(3): Fix xref to _umtx_op(2) now that we have it.

Modified:
  head/lib/libthr/libthr.3

Modified: head/lib/libthr/libthr.3
==
--- head/lib/libthr/libthr.3Mon May 16 12:56:28 2016(r299942)
+++ head/lib/libthr/libthr.3Mon May 16 13:39:04 2016(r299943)
@@ -118,7 +118,7 @@ environment variable.
 If both the spin and yield loops
 failed to acquire the lock, the thread is taken off the CPU and
 put to sleep in the kernel with the
-.Xr umtx 2
+.Xr _umtx_op 2
 syscall.
 The kernel wakes up a thread and hands the ownership of the lock to
 the woken thread when the lock becomes available.
@@ -236,7 +236,7 @@ logs.
 .Xr ld-elf.so.1 1 ,
 .Xr getrlimit 2 ,
 .Xr errno 2 ,
-.Xr umtx 2 ,
+.Xr _umtx_op 2 ,
 .Xr dlclose 3 ,
 .Xr dlopen 3 ,
 .Xr getenv 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"


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

2016-05-16 Thread Konstantin Belousov
On Tue, Apr 19, 2016 at 09:26:41AM -0700, John Baldwin wrote:
> On Tuesday, April 19, 2016 07:05:00 PM Konstantin Belousov wrote:
> > On Tue, Apr 19, 2016 at 11:49:31AM -0400, Allan Jude wrote:
> > > On 2016-04-19 05:30, Konstantin Belousov wrote:
> > > > On Mon, Apr 18, 2016 at 07:43:04PM -0400, Allan Jude wrote:
> > > >> On 2016-04-18 19:36, Adrian Chadd wrote:
> > > >>> Someone pointed out how this bloats out memory requirement in loader.
> > > >>>
> > > >>> Did anyone check that?
> > > >>>
> > > >>> -adrian
> > > >>>
> > > >>
> > > >> I tested down to 128mb of ram in QEMU, booted from the installer ISO, 
> > > >> did the install, and booted the installed system without issue.
> > > > 
> > > > 64MB is^H^H was very much useful and workable i386 config. i386 kernel
> > > > does fit into the 32M but current automatic tuning prevents usermode
> > > > from operating. Little manual tuning make 32M on tolerable.
> > > > 
> > > > Making loader require 64M is a regression. At very least, it is
> > > > impossible to test low mem configs anymore.
> > > > 
> > > 
> > > Would a src.conf knob make sense, to use a smaller value when targeting
> > > small systems, while keeping the advantages when using more reasonable
> > > systems?
> > > 
> > > Or we could make these changes to the HEAP and bcache size specific to
> > > 64bit platforms?
> > I do not consider neither the current state, nor the two proposed
> > changes, acceptable. Loader is same on 32 and 64 bit x86 machines, so
> > how would you reconfigure it on 64bit machine ? Non-default knob is too
> > obscure and hard to communicate, people would try to use 32M and see
> > that it breaks, just abandoning the idea of trying.
> > 
> > Either default-built loader should size itself dynamically based on the
> > available memory, perhaps capping heap at 64MB starting from the 128MB
> > configs, or, assuming that we consider 32MB be the absolute minimal
> > workable config, loader could set HEAP to 8MB.
> > 
> > Dynamic heap size is theoretically best, but it might be hard to do
> > if memory map is retrieved after heap is configured (I do not know).
> 
> We retreive the memory map first and parse the SMAP to pick the best
> "spot" for the heap.  (We prefer to put it "away" from the location
> where we load the kernel + modules.)  Choosing a dynamic size for the
> heap should be quite doable.  Fixing libstand's malloc() to try to
> "grow" when necessary would be nice for the EFI case as well, but that
> is a larger change.

It was a month since this commit was made.  Is there any progress with
fixing the regression on small machines ?

BTW, as a data point, I happen to have to run stripped-down i386 current
kernel on 32MB machine, and saw around 11MB left to usermode after the
init and /bin/sh were started for singlemode.   Kernel was stripped, but
not too much stripped (unused drivers removed).
___
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: r299942 - in head/usr.bin/xinstall: . tests

2016-05-16 Thread Baptiste Daroussin
On Mon, May 16, 2016 at 12:56:28PM +, Jilles Tjoelker wrote:
> Author: jilles
> Date: Mon May 16 12:56:28 2016
> New Revision: 299942
> URL: https://svnweb.freebsd.org/changeset/base/299942
> 
> Log:
>   install: Revert utimensat usage (r299850).
>   
>   This should fix the build on older stable/10, since install is a bootstrap
>   tool.
>   
>   Pending a decision how to fix this properly, revert utimensat usage. Copies
>   with the -p option will again appear older than the original almost always,
>   but -p is not commonly used.

You could add a utimensat stub into libstand to workaround the issue?

Best regards,
Bapt


signature.asc
Description: PGP signature


svn commit: r299942 - in head/usr.bin/xinstall: . tests

2016-05-16 Thread Jilles Tjoelker
Author: jilles
Date: Mon May 16 12:56:28 2016
New Revision: 299942
URL: https://svnweb.freebsd.org/changeset/base/299942

Log:
  install: Revert utimensat usage (r299850).
  
  This should fix the build on older stable/10, since install is a bootstrap
  tool.
  
  Pending a decision how to fix this properly, revert utimensat usage. Copies
  with the -p option will again appear older than the original almost always,
  but -p is not commonly used.

Modified:
  head/usr.bin/xinstall/tests/install_test.sh
  head/usr.bin/xinstall/xinstall.c

Modified: head/usr.bin/xinstall/tests/install_test.sh
==
--- head/usr.bin/xinstall/tests/install_test.sh Mon May 16 12:18:30 2016
(r299941)
+++ head/usr.bin/xinstall/tests/install_test.sh Mon May 16 12:56:28 2016
(r299942)
@@ -64,12 +64,6 @@ copy_to_nonexistent_backup_safe_body() {
copy_to_nonexistent_with_opts -b -B.bak -S
 }
 
-atf_test_case copy_to_nonexistent_preserving
-copy_to_nonexistent_preserving_body() {
-   copy_to_nonexistent_with_opts -p
-   [ ! testf -ot copyf ] || atf_fail "bad timestamp 2"
-}
-
 copy_self_with_opts() {
printf 'test\n123\r456\r\n789\0z' >testf
printf 'test\n123\r456\r\n789\0z' >testf2
@@ -313,7 +307,6 @@ atf_init_test_cases() {
atf_add_test_case copy_to_nonexistent_safe_comparing
atf_add_test_case copy_to_nonexistent_backup
atf_add_test_case copy_to_nonexistent_backup_safe
-   atf_add_test_case copy_to_nonexistent_preserving
atf_add_test_case copy_self
atf_add_test_case copy_self_safe
atf_add_test_case copy_self_comparing

Modified: head/usr.bin/xinstall/xinstall.c
==
--- head/usr.bin/xinstall/xinstall.cMon May 16 12:18:30 2016
(r299941)
+++ head/usr.bin/xinstall/xinstall.cMon May 16 12:56:28 2016
(r299942)
@@ -131,7 +131,7 @@ static void do_symlink(const char *, con
 static voidmakelink(const char *, const char *, const struct stat *);
 static voidinstall(const char *, const char *, u_long, u_int);
 static voidinstall_dir(char *);
-static voidmetadata_log(const char *, const char *, struct timespec *,
+static voidmetadata_log(const char *, const char *, struct timeval *,
const char *, const char *, off_t);
 static int parseid(const char *, id_t *);
 static voidstrip(const char *);
@@ -722,7 +722,7 @@ static void
 install(const char *from_name, const char *to_name, u_long fset, u_int flags)
 {
struct stat from_sb, temp_sb, to_sb;
-   struct timespec tsb[2];
+   struct timeval tvb[2];
int devnull, files_match, from_fd, serrno, target;
int tempcopy, temp_fd, to_fd;
char backup[MAXPATHLEN], *p, pathbuf[MAXPATHLEN], tempfile[MAXPATHLEN];
@@ -857,9 +857,11 @@ install(const char *from_name, const cha
 * Need to preserve target file times, though.
 */
if (to_sb.st_nlink != 1) {
-   tsb[0] = to_sb.st_atim;
-   tsb[1] = to_sb.st_mtim;
-   (void)utimensat(AT_FDCWD, tempfile, tsb, 0);
+   tvb[0].tv_sec = to_sb.st_atime;
+   tvb[0].tv_usec = 0;
+   tvb[1].tv_sec = to_sb.st_mtime;
+   tvb[1].tv_usec = 0;
+   (void)utimes(tempfile, tvb);
} else {
files_match = 1;
(void)unlink(tempfile);
@@ -914,9 +916,11 @@ install(const char *from_name, const cha
 * Preserve the timestamp of the source file if necessary.
 */
if (dopreserve && !files_match && !devnull) {
-   tsb[0] = from_sb.st_atim;
-   tsb[1] = from_sb.st_mtim;
-   (void)utimensat(AT_FDCWD, to_name, tsb, 0);
+   tvb[0].tv_sec = from_sb.st_atime;
+   tvb[0].tv_usec = 0;
+   tvb[1].tv_sec = from_sb.st_mtime;
+   tvb[1].tv_usec = 0;
+   (void)utimes(to_name, tvb);
}
 
if (fstat(to_fd, &to_sb) == -1) {
@@ -985,7 +989,7 @@ install(const char *from_name, const cha
if (!devnull)
(void)close(from_fd);
 
-   metadata_log(to_name, "file", tsb, NULL, digestresult, to_sb.st_size);
+   metadata_log(to_name, "file", tvb, NULL, digestresult, to_sb.st_size);
free(digestresult);
 }
 
@@ -1297,7 +1301,7 @@ again:
  * or to allow integrity checks to be performed.
  */
 static void
-metadata_log(const char *path, const char *type, struct timespec *ts,
+metadata_log(const char *path, const char *type, struct timeval *tv,
const char *slink, const char *digestresult, off_t size)
 {
static const char e

svn commit: r299941 - head/sys/dev/pci

2016-05-16 Thread Andrew Turner
Author: andrew
Date: Mon May 16 12:18:30 2016
New Revision: 299941
URL: https://svnweb.freebsd.org/changeset/base/299941

Log:
  Call ofw_bus_msimap to find the parent MSI controller, it may not use the
  msi-parent property.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/pci/pci_host_generic.c
  head/sys/dev/pci/pci_host_generic.h

Modified: head/sys/dev/pci/pci_host_generic.c
==
--- head/sys/dev/pci/pci_host_generic.c Mon May 16 12:15:19 2016
(r299940)
+++ head/sys/dev/pci/pci_host_generic.c Mon May 16 12:18:30 2016
(r299941)
@@ -235,10 +235,6 @@ pci_host_generic_attach(device_t dev)
node = ofw_bus_get_node(dev);
ofw_bus_setup_iinfo(node, &sc->pci_iinfo, sizeof(cell_t));
 
-   /* Find the MSI interrupt handler */
-   OF_searchencprop(node, "msi-parent", &sc->msi_parent,
-   sizeof(sc->msi_parent));
-
device_add_child(dev, "pci", -1);
return (bus_generic_attach(dev));
 }
@@ -671,10 +667,11 @@ generic_pcie_alloc_msi(device_t pci, dev
 int *irqs)
 {
 #if defined(INTRNG)
-   struct generic_pcie_softc *sc;
+   phandle_t msi_parent;
 
-   sc = device_get_softc(pci);
-   return (intr_alloc_msi(pci, child, sc->msi_parent, count, maxcount,
+   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), &msi_parent,
+   NULL);
+   return (intr_alloc_msi(pci, child, msi_parent, count, maxcount,
irqs));
 #elif defined(__aarch64__)
return (arm_alloc_msi(pci, child, count, maxcount, irqs));
@@ -687,10 +684,11 @@ static int
 generic_pcie_release_msi(device_t pci, device_t child, int count, int *irqs)
 {
 #if defined(INTRNG)
-   struct generic_pcie_softc *sc;
+   phandle_t msi_parent;
 
-   sc = device_get_softc(pci);
-   return (intr_release_msi(pci, child, sc->msi_parent, count, irqs));
+   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), &msi_parent,
+   NULL);
+   return (intr_release_msi(pci, child, msi_parent, count, irqs));
 #elif defined(__aarch64__)
return (arm_release_msi(pci, child, count, irqs));
 #else
@@ -703,10 +701,11 @@ generic_pcie_map_msi(device_t pci, devic
 uint32_t *data)
 {
 #if defined(INTRNG)
-   struct generic_pcie_softc *sc;
+   phandle_t msi_parent;
 
-   sc = device_get_softc(pci);
-   return (intr_map_msi(pci, child, sc->msi_parent, irq, addr, data));
+   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), &msi_parent,
+   NULL);
+   return (intr_map_msi(pci, child, msi_parent, irq, addr, data));
 #elif defined(__aarch64__)
return (arm_map_msi(pci, child, irq, addr, data));
 #else
@@ -718,10 +717,11 @@ static int
 generic_pcie_alloc_msix(device_t pci, device_t child, int *irq)
 {
 #if defined(INTRNG)
-   struct generic_pcie_softc *sc;
+   phandle_t msi_parent;
 
-   sc = device_get_softc(pci);
-   return (intr_alloc_msix(pci, child, sc->msi_parent, irq));
+   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), &msi_parent,
+   NULL);
+   return (intr_alloc_msix(pci, child, msi_parent, irq));
 #elif defined(__aarch64__)
return (arm_alloc_msix(pci, child, irq));
 #else
@@ -733,10 +733,11 @@ static int
 generic_pcie_release_msix(device_t pci, device_t child, int irq)
 {
 #if defined(INTRNG)
-   struct generic_pcie_softc *sc;
+   phandle_t msi_parent;
 
-   sc = device_get_softc(pci);
-   return (intr_release_msix(pci, child, sc->msi_parent, irq));
+   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), &msi_parent,
+   NULL);
+   return (intr_release_msix(pci, child, msi_parent, irq));
 #elif defined(__aarch64__)
return (arm_release_msix(pci, child, irq));
 #else

Modified: head/sys/dev/pci/pci_host_generic.h
==
--- head/sys/dev/pci/pci_host_generic.h Mon May 16 12:15:19 2016
(r299940)
+++ head/sys/dev/pci/pci_host_generic.h Mon May 16 12:18:30 2016
(r299941)
@@ -60,7 +60,6 @@ struct generic_pcie_softc {
bus_space_handle_t  ioh;
 #ifdef FDT
struct ofw_bus_iinfopci_iinfo;
-   phandle_t   msi_parent;
 #endif
 };
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r299940 - in head/sys/cddl: compat/opensolaris/kern contrib/opensolaris/uts/common/fs/zfs

2016-05-16 Thread Andriy Gapon
Author: avg
Date: Mon May 16 12:15:19 2016
New Revision: 299940
URL: https://svnweb.freebsd.org/changeset/base/299940

Log:
  fix a vnode reference leak caused by illumos compat traverse()
  
  This commit partially reverts r273641 which introduced the leak.
  It did so to accomodate for some consumers of traverse() that expected
  the starting vnode to stay as-is.  But that introduced the leak in the
  case when a mounted filesystem was found and its root vnode was
  returned.
  
  r299914 removed the troublesome consumers and now there is no reason to
  keep the starting vnode.  So, now the new rules are:
  - if there is no mounted filesystem, then nothing is changed
  - otherwise the starting vnode is always released
  - the root vnode of the mounted filesystem is returned locked and
referenced in the case of success
  
  MFC after:5 weeks
  X-MFC after:  r299914

Modified:
  head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c

Modified: head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c
==
--- head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c  Mon May 16 
12:02:06 2016(r299939)
+++ head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c  Mon May 16 
12:15:19 2016(r299940)
@@ -89,13 +89,14 @@ traverse(vnode_t **cvpp, int lktype)
if (vfsp == NULL)
break;
error = vfs_busy(vfsp, 0);
+
/*
 * tvp is NULL for *cvpp vnode, which we can't unlock.
-* At least some callers expect the reference to be
-* maintained to the original *cvpp
 */
if (tvp != NULL)
vput(cvp);
+   else
+   vrele(cvp);
if (error)
return (error);
 

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon May 
16 12:02:06 2016(r299939)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon May 
16 12:15:19 2016(r299940)
@@ -1018,7 +1018,6 @@ zfsctl_snapdir_lookup(ap)
VN_HOLD(*vpp);
err = traverse(vpp, LK_EXCLUSIVE | LK_RETRY);
if (err != 0) {
-   VN_RELE(*vpp);
*vpp = NULL;
} else if (*vpp == sep->se_root) {
/*
@@ -1613,16 +1612,15 @@ zfsctl_lookup_objset(vfs_t *vfsp, uint64
 */
error = traverse(&vp, LK_SHARED | LK_RETRY);
if (error == 0) {
-   if (vp == sep->se_root)
+   if (vp == sep->se_root) {
+   VN_RELE(vp);/* release covered vp */
error = SET_ERROR(EINVAL);
-   else
+   } else {
*zfsvfsp = VTOZ(vp)->z_zfsvfs;
+   VN_URELE(vp);   /* put snapshot's root vp */
+   }
}
mutex_exit(&sdp->sd_lock);
-   if (error == 0)
-   VN_URELE(vp);
-   else
-   VN_RELE(vp);
} else {
error = SET_ERROR(EINVAL);
mutex_exit(&sdp->sd_lock);
___
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: r299939 - head/sys/arm64/arm64

2016-05-16 Thread Andrew Turner
Author: andrew
Date: Mon May 16 12:02:06 2016
New Revision: 299939
URL: https://svnweb.freebsd.org/changeset/base/299939

Log:
  Move the call to intr_pic_init_secondary to the same place as in the
  non-intrng case.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/mp_machdep.c

Modified: head/sys/arm64/arm64/mp_machdep.c
==
--- head/sys/arm64/arm64/mp_machdep.c   Mon May 16 11:48:43 2016
(r299938)
+++ head/sys/arm64/arm64/mp_machdep.c   Mon May 16 12:02:06 2016
(r299939)
@@ -275,7 +275,9 @@ init_secondary(uint64_t cpu)
 */
identify_cpu();
 
-#ifndef INTRNG
+#ifdef INTRNG
+   intr_pic_init_secondary();
+#else
/* Configure the interrupt controller */
arm_init_secondary();
 
@@ -306,10 +308,6 @@ init_secondary(uint64_t cpu)
 
mtx_unlock_spin(&ap_boot_mtx);
 
-#ifdef INTRNG
-   intr_pic_init_secondary();
-#endif
-
/* Enter the scheduler */
sched_throw(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"


Re: svn commit: r299934 - head/sys/arm64/cavium

2016-05-16 Thread Andrew Turner
On Mon, 16 May 2016 12:52:39 +0200
Zbigniew Bodek  wrote:

> Are these ThunderX related commits going to be reviewed or tested by
> anyone that uses ThunderX?

I have been testing on the Pass 1.1 and Pass 2.0 ThunderX units in the
cluster.

Andrew
___
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: r299938 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-05-16 Thread Andriy Gapon
Author: avg
Date: Mon May 16 11:48:43 2016
New Revision: 299938
URL: https://svnweb.freebsd.org/changeset/base/299938

Log:
  fix up r299902: mount_snapshot requires that the covered vnode is locked
  
  Previously that was not strictly enforced.
  
  MFC after:4 weeks
  X-MFC with:   r299902

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

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon May 
16 10:51:35 2016(r299937)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.cMon May 
16 11:48:43 2016(r299938)
@@ -1086,6 +1086,7 @@ domount:
(void) snprintf(mountpoint, mountpoint_len,
"%s/" ZFS_CTLDIR_NAME "/snapshot/%s",
dvp->v_vfsp->mnt_stat.f_mntonname, nm);
+   VERIFY0(vn_lock(*vpp, LK_EXCLUSIVE));
err = mount_snapshot(curthread, vpp, "zfs", mountpoint, snapname, 0);
kmem_free(mountpoint, mountpoint_len);
if (err == 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"


Re: svn commit: r299934 - head/sys/arm64/cavium

2016-05-16 Thread Zbigniew Bodek
Are these ThunderX related commits going to be reviewed or tested by anyone
that uses ThunderX?

Kind regards
zbb

2016-05-16 12:03 GMT+02:00 Andrew Turner :

> Author: andrew
> Date: Mon May 16 10:03:57 2016
> New Revision: 299934
> URL: https://svnweb.freebsd.org/changeset/base/299934
>
> Log:
>   Teach the ThunderX PCI PEM driver about intrng. This will be used later
>   when arm64 is supported by intrng.
>
>   Obtained from:ABT Systems Ltd
>   Sponsored by: The FreeBSD Foundation
>
> Modified:
>   head/sys/arm64/cavium/thunder_pcie_pem_fdt.c
>
> Modified: head/sys/arm64/cavium/thunder_pcie_pem_fdt.c
>
> ==
> --- head/sys/arm64/cavium/thunder_pcie_pem_fdt.cMon May 16
> 09:56:48 2016(r299933)
> +++ head/sys/arm64/cavium/thunder_pcie_pem_fdt.cMon May 16
> 10:03:57 2016(r299934)
> @@ -109,6 +109,60 @@ thunder_pem_fdt_probe(device_t dev)
> return (ENXIO);
>  }
>
> +#ifdef INTRNG
> +static int
> +thunder_pem_fdt_alloc_msi(device_t pci, device_t child, int count, int
> maxcount,
> +int *irqs)
> +{
> +   phandle_t msi_parent;
> +
> +   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child),
> &msi_parent,
> +   NULL);
> +   return (intr_alloc_msi(pci, child, msi_parent, count, maxcount,
> +   irqs));
> +}
> +
> +static int
> +thunder_pem_fdt_release_msi(device_t pci, device_t child, int count, int
> *irqs)
> +{
> +   phandle_t msi_parent;
> +
> +   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child),
> &msi_parent,
> +   NULL);
> +   return (intr_release_msi(pci, child, msi_parent, count, irqs));
> +}
> +
> +static int
> +thunder_pem_fdt_alloc_msix(device_t pci, device_t child, int *irq)
> +{
> +   phandle_t msi_parent;
> +
> +   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child),
> &msi_parent,
> +   NULL);
> +   return (intr_alloc_msix(pci, child, msi_parent, irq));
> +}
> +
> +static int
> +thunder_pem_fdt_release_msix(device_t pci, device_t child, int irq)
> +{
> +   phandle_t msi_parent;
> +
> +   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child),
> &msi_parent,
> +   NULL);
> +   return (intr_release_msix(pci, child, msi_parent, irq));
> +}
> +
> +static int
> +thunder_pem_fdt_map_msi(device_t pci, device_t child, int irq, uint64_t
> *addr,
> +uint32_t *data)
> +{
> +   phandle_t msi_parent;
> +
> +   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child),
> &msi_parent,
> +   NULL);
> +   return (intr_map_msi(pci, child, msi_parent, irq, addr, data));
> +}
> +#else
>  static int
>  thunder_pem_fdt_alloc_msi(device_t pci, device_t child, int count, int
> maxcount,
>  int *irqs)
> @@ -145,6 +199,7 @@ thunder_pem_fdt_map_msi(device_t pci, de
>
> return (arm_map_msi(pci, child, irq, addr, data));
>  }
> +#endif
>
>  static int
>  thunder_pem_fdt_get_id(device_t dev, device_t child, enum pci_id_type
> type,
> ___
> 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-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: r299937 - head/sys/dev/rtwn

2016-05-16 Thread Andriy Voskoboinyk
Author: avos
Date: Mon May 16 10:51:35 2016
New Revision: 299937
URL: https://svnweb.freebsd.org/changeset/base/299937

Log:
  rtwn: fix double free in raw xmit path.
  
  Reported by:  mva

Modified:
  head/sys/dev/rtwn/if_rtwn.c

Modified: head/sys/dev/rtwn/if_rtwn.c
==
--- head/sys/dev/rtwn/if_rtwn.c Mon May 16 10:48:51 2016(r299936)
+++ head/sys/dev/rtwn/if_rtwn.c Mon May 16 10:51:35 2016(r299937)
@@ -1789,7 +1789,6 @@ rtwn_raw_xmit(struct ieee80211_node *ni,
}
 
if (rtwn_tx(sc, m, ni) != 0) {
-   m_freem(m);
RTWN_UNLOCK(sc);
return (EIO);
}
___
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: r299936 - in head/sys: arm64/arm64 arm64/include conf

2016-05-16 Thread Andrew Turner
Author: andrew
Date: Mon May 16 10:48:51 2016
New Revision: 299936
URL: https://svnweb.freebsd.org/changeset/base/299936

Log:
  Add support for intrng to arm64. As the GICv3 drivers will need to be
  updated, and until further testing can be done, this is disabled for now.
  
  It is expected arm64 will switch to this interface, and the old interface
  will be removed before 11.0 is released.
  
  Obtained from:ABT Systems Ltd
  Relnotes: yes
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/autoconf.c
  head/sys/arm64/arm64/mp_machdep.c
  head/sys/arm64/arm64/nexus.c
  head/sys/arm64/include/intr.h
  head/sys/conf/files.arm64
  head/sys/conf/options.arm64

Modified: head/sys/arm64/arm64/autoconf.c
==
--- head/sys/arm64/arm64/autoconf.c Mon May 16 10:34:55 2016
(r299935)
+++ head/sys/arm64/arm64/autoconf.c Mon May 16 10:48:51 2016
(r299936)
@@ -80,7 +80,13 @@ configure(void *dummy)
 static void
 configure_final(void *dummy)
 {
+
+#ifdef INTRNG
+   /* Enable interrupt reception on this CPU */
+   intr_enable();
+#else
arm_enable_intr();
+#endif
cninit_finish(); 
 
if (bootverbose)

Modified: head/sys/arm64/arm64/mp_machdep.c
==
--- head/sys/arm64/arm64/mp_machdep.c   Mon May 16 10:34:55 2016
(r299935)
+++ head/sys/arm64/arm64/mp_machdep.c   Mon May 16 10:48:51 2016
(r299936)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2015 The FreeBSD Foundation
+ * Copyright (c) 2015-2016 The FreeBSD Foundation
  * All rights reserved.
  *
  * This software was developed by Andrew Turner under
@@ -65,6 +65,29 @@ __FBSDID("$FreeBSD$");
 
 #include 
 
+#ifdef INTRNG
+#include "pic_if.h"
+
+typedef void intr_ipi_send_t(void *, cpuset_t, u_int);
+typedef void intr_ipi_handler_t(void *);
+
+#define INTR_IPI_NAMELEN   (MAXCOMLEN + 1)
+struct intr_ipi {
+   intr_ipi_handler_t *ii_handler;
+   void *  ii_handler_arg;
+   intr_ipi_send_t *   ii_send;
+   void *  ii_send_arg;
+   charii_name[INTR_IPI_NAMELEN];
+   u_long *ii_count;
+};
+
+static struct intr_ipi ipi_sources[INTR_IPI_COUNT];
+
+static struct intr_ipi *intr_ipi_lookup(u_int);
+static void intr_pic_ipi_setup(u_int, const char *, intr_ipi_handler_t *,
+void *);
+#endif /* INTRNG */
+
 boolean_t ofw_cpu_reg(phandle_t node, u_int, cell_t *);
 
 extern struct pcpu __pcpu[];
@@ -184,9 +207,18 @@ release_aps(void *dummy __unused)
 {
int cpu, i;
 
+#ifdef INTRNG
+   intr_pic_ipi_setup(IPI_AST, "ast", ipi_ast, NULL);
+   intr_pic_ipi_setup(IPI_PREEMPT, "preempt", ipi_preempt, NULL);
+   intr_pic_ipi_setup(IPI_RENDEZVOUS, "rendezvous", ipi_rendezvous, NULL);
+   intr_pic_ipi_setup(IPI_STOP, "stop", ipi_stop, NULL);
+   intr_pic_ipi_setup(IPI_STOP_HARD, "stop hard", ipi_stop, NULL);
+   intr_pic_ipi_setup(IPI_HARDCLOCK, "hardclock", ipi_hardclock, NULL);
+#else
/* Setup the IPI handler */
for (i = 0; i < INTR_IPI_COUNT; i++)
arm_setup_ipihandler(ipi_handler, i);
+#endif
 
atomic_store_rel_int(&aps_ready, 1);
/* Wake up the other CPUs */
@@ -214,7 +246,9 @@ void
 init_secondary(uint64_t cpu)
 {
struct pcpu *pcpup;
+#ifndef INTRNG
int i;
+#endif
 
pcpup = &__pcpu[cpu];
/*
@@ -241,11 +275,13 @@ init_secondary(uint64_t cpu)
 */
identify_cpu();
 
+#ifndef INTRNG
/* Configure the interrupt controller */
arm_init_secondary();
 
for (i = 0; i < INTR_IPI_COUNT; i++)
arm_unmask_ipi(i);
+#endif
 
/* Start per-CPU event timers. */
cpu_initclocks_ap();
@@ -270,6 +306,10 @@ init_secondary(uint64_t cpu)
 
mtx_unlock_spin(&ap_boot_mtx);
 
+#ifdef INTRNG
+   intr_pic_init_secondary();
+#endif
+
/* Enter the scheduler */
sched_throw(NULL);
 
@@ -277,6 +317,64 @@ init_secondary(uint64_t cpu)
/* NOTREACHED */
 }
 
+#ifdef INTRNG
+/*
+ *  Send IPI thru interrupt controller.
+ */
+static void
+pic_ipi_send(void *arg, cpuset_t cpus, u_int ipi)
+{
+
+   KASSERT(intr_irq_root_dev != NULL, ("%s: no root attached", __func__));
+   PIC_IPI_SEND(intr_irq_root_dev, arg, cpus, ipi);
+}
+
+/*
+ *  Setup IPI handler on interrupt controller.
+ *
+ *  Not SMP coherent.
+ */
+static void
+intr_pic_ipi_setup(u_int ipi, const char *name, intr_ipi_handler_t *hand,
+void *arg)
+{
+   struct intr_irqsrc *isrc;
+   struct intr_ipi *ii;
+   int error;
+
+   KASSERT(intr_irq_root_dev != NULL, ("%s: no root attached", __func__));
+   KASSERT(hand != NULL, ("%s: ipi %u no handler", __func__, ipi));
+
+   error = PIC_IPI_SETUP(intr_irq_root_dev, ipi, &isrc);
+   if (error != 0)
+   return;
+
+   isr

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

2016-05-16 Thread Andrew Turner
Author: andrew
Date: Mon May 16 10:03:57 2016
New Revision: 299934
URL: https://svnweb.freebsd.org/changeset/base/299934

Log:
  Teach the ThunderX PCI PEM driver about intrng. This will be used later
  when arm64 is supported by intrng.
  
  Obtained from:ABT Systems Ltd
  Sponsored by: The FreeBSD Foundation

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

Modified: head/sys/arm64/cavium/thunder_pcie_pem_fdt.c
==
--- head/sys/arm64/cavium/thunder_pcie_pem_fdt.cMon May 16 09:56:48 
2016(r299933)
+++ head/sys/arm64/cavium/thunder_pcie_pem_fdt.cMon May 16 10:03:57 
2016(r299934)
@@ -109,6 +109,60 @@ thunder_pem_fdt_probe(device_t dev)
return (ENXIO);
 }
 
+#ifdef INTRNG
+static int
+thunder_pem_fdt_alloc_msi(device_t pci, device_t child, int count, int 
maxcount,
+int *irqs)
+{
+   phandle_t msi_parent;
+
+   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), &msi_parent,
+   NULL);
+   return (intr_alloc_msi(pci, child, msi_parent, count, maxcount,
+   irqs));
+}
+
+static int
+thunder_pem_fdt_release_msi(device_t pci, device_t child, int count, int *irqs)
+{
+   phandle_t msi_parent;
+
+   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), &msi_parent,
+   NULL);
+   return (intr_release_msi(pci, child, msi_parent, count, irqs));
+}
+
+static int
+thunder_pem_fdt_alloc_msix(device_t pci, device_t child, int *irq)
+{
+   phandle_t msi_parent;
+
+   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), &msi_parent,
+   NULL);
+   return (intr_alloc_msix(pci, child, msi_parent, irq));
+}
+
+static int
+thunder_pem_fdt_release_msix(device_t pci, device_t child, int irq)
+{
+   phandle_t msi_parent;
+
+   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), &msi_parent,
+   NULL);
+   return (intr_release_msix(pci, child, msi_parent, irq));
+}
+
+static int
+thunder_pem_fdt_map_msi(device_t pci, device_t child, int irq, uint64_t *addr,
+uint32_t *data)
+{
+   phandle_t msi_parent;
+
+   ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), &msi_parent,
+   NULL);
+   return (intr_map_msi(pci, child, msi_parent, irq, addr, data));
+}
+#else
 static int
 thunder_pem_fdt_alloc_msi(device_t pci, device_t child, int count, int 
maxcount,
 int *irqs)
@@ -145,6 +199,7 @@ thunder_pem_fdt_map_msi(device_t pci, de
 
return (arm_map_msi(pci, child, irq, addr, data));
 }
+#endif
 
 static int
 thunder_pem_fdt_get_id(device_t dev, device_t child, enum pci_id_type type,
___
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: r299933 - in head/sys: compat/linuxkpi/common/include/linux sys

2016-05-16 Thread Hans Petter Selasky
Author: hselasky
Date: Mon May 16 09:56:48 2016
New Revision: 299933
URL: https://svnweb.freebsd.org/changeset/base/299933

Log:
  Implement more Linux device related functions in the LinuxKPI. While
  at it use NULL for some pointer checks.
  
  Bump the FreeBSD version to force recompilation of all kernel modules
  due to a structure size change.
  
  Obtained from:kmacy @
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/device.h
  head/sys/sys/param.h

Modified: head/sys/compat/linuxkpi/common/include/linux/device.h
==
--- head/sys/compat/linuxkpi/common/include/linux/device.h  Mon May 16 
09:31:44 2016(r299932)
+++ head/sys/compat/linuxkpi/common/include/linux/device.h  Mon May 16 
09:56:48 2016(r299933)
@@ -31,6 +31,7 @@
 #ifndef_LINUX_DEVICE_H_
 #define_LINUX_DEVICE_H_
 
+#include 
 #include 
 #include 
 #include 
@@ -71,6 +72,7 @@ struct device {
unsigned intirq;
unsigned intmsix;
unsigned intmsix_max;
+   const struct attribute_group **groups;
 };
 
 extern struct device linux_root_device;
@@ -127,11 +129,12 @@ show_class_attr_string(struct class *cla
 #definedev_err(dev, fmt, ...)  device_printf((dev)->bsddev, fmt, 
##__VA_ARGS__)
 #definedev_warn(dev, fmt, ...) device_printf((dev)->bsddev, fmt, 
##__VA_ARGS__)
 #definedev_info(dev, fmt, ...) device_printf((dev)->bsddev, fmt, 
##__VA_ARGS__)
+#definedev_notice(dev, fmt, ...)   device_printf((dev)->bsddev, 
fmt, ##__VA_ARGS__)
 #definedev_printk(lvl, dev, fmt, ...)  
\
device_printf((dev)->bsddev, fmt, ##__VA_ARGS__)
 
 static inline void *
-dev_get_drvdata(struct device *dev)
+dev_get_drvdata(const struct device *dev)
 {
 
return dev->driver_data;
@@ -191,11 +194,106 @@ class_unregister(struct class *class)
kobject_put(&class->kobj);
 }
 
+static inline struct device *kobj_to_dev(struct kobject *kobj)
+{
+   return container_of(kobj, struct device, kobj);
+}
+
 /*
- * Devices are registered and created for exporting to sysfs.  create
+ * Devices are registered and created for exporting to sysfs. Create
  * implies register and register assumes the device fields have been
  * setup appropriately before being called.
  */
+static inline void
+device_initialize(struct device *dev)
+{
+   device_t bsddev;
+
+   bsddev = NULL;
+   if (dev->devt) {
+   int unit = MINOR(dev->devt);
+   bsddev = devclass_get_device(dev->class->bsdclass, unit);
+   }
+   if (bsddev != NULL)
+   device_set_softc(bsddev, dev);
+
+   dev->bsddev = bsddev;
+   kobject_init(&dev->kobj, &linux_dev_ktype);
+}
+
+static inline int
+device_add(struct device *dev)
+{  
+   if (dev->bsddev != NULL) {
+   if (dev->devt == 0)
+   dev->devt = makedev(0, device_get_unit(dev->bsddev));
+   }
+   kobject_add(&dev->kobj, &dev->class->kobj, dev_name(dev));
+   return (0);
+}
+
+static inline void
+device_create_release(struct device *dev)
+{
+   kfree(dev);
+}
+
+static inline struct device *
+device_create_groups_vargs(struct class *class, struct device *parent,
+dev_t devt, void *drvdata, const struct attribute_group **groups,
+const char *fmt, va_list args)
+{
+   struct device *dev = NULL;
+   int retval = -ENODEV;
+
+   if (class == NULL || IS_ERR(class))
+   goto error;
+
+   dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+   if (!dev) {
+   retval = -ENOMEM;
+   goto error;
+   }
+
+   device_initialize(dev);
+   dev->devt = devt;
+   dev->class = class;
+   dev->parent = parent;
+   dev->groups = groups;
+   dev->release = device_create_release;
+   dev->bsddev = devclass_get_device(dev->class->bsdclass, MINOR(devt));
+   dev_set_drvdata(dev, drvdata);
+
+   retval = kobject_set_name_vargs(&dev->kobj, fmt, args);
+   if (retval)
+   goto error;
+
+   retval = device_add(dev);
+   if (retval)
+   goto error;
+
+   return dev;
+
+error:
+   put_device(dev);
+   return ERR_PTR(retval);
+}
+
+static inline struct device *
+device_create_with_groups(struct class *class,
+struct device *parent, dev_t devt, void *drvdata,
+const struct attribute_group **groups, const char *fmt, ...)
+{
+   va_list vargs;
+   struct device *dev;
+
+   va_start(vargs, fmt);
+   dev = device_create_groups_vargs(class, parent, devt, drvdata,
+   groups, fmt, vargs);
+   va_end(vargs);
+   return dev;
+}
+
 static inline int
 device_register(struct device *dev)
 {
@@ -233,13 +331,29 @@ device_unregister(struct device *dev)
device_t bsddev;
 
bsddev = dev->bsdd

  1   2   >