CVS commit: src/crypto/external/bsd/openssl/dist/crypto

2018-11-19 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Tue Nov 20 07:30:18 UTC 2018

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto: armcap.c ppccap.c

Log Message:
Don't expose a getauxval symbol.

The code already knows how to handle it, but it assumes anyone who uses
GCC or clang might resolve the getauxval function to something eventually.

The only time we will expose getauxval is if a package tries to substitute
getauxval too, and then code will start having mysterious failures.

getauxval is purely a linux function (as far as I can see), so limit it to
that.

PR pkg/53387, PR port-arm/53386


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/crypto/external/bsd/openssl/dist/crypto/armcap.c
cvs rdiff -u -r1.8 -r1.9 src/crypto/external/bsd/openssl/dist/crypto/ppccap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/crypto/external/bsd/openssl/dist/crypto/armcap.c
diff -u src/crypto/external/bsd/openssl/dist/crypto/armcap.c:1.7 src/crypto/external/bsd/openssl/dist/crypto/armcap.c:1.8
--- src/crypto/external/bsd/openssl/dist/crypto/armcap.c:1.7	Sun Sep 23 13:32:55 2018
+++ src/crypto/external/bsd/openssl/dist/crypto/armcap.c	Tue Nov 20 07:30:17 2018
@@ -70,7 +70,7 @@ void OPENSSL_cpuid_setup(void) __attribu
  * Use a weak reference to getauxval() so we can use it if it is available but
  * don't break the build if it is not.
  */
-# if defined(__GNUC__) && __GNUC__>=2 && defined(__ELF__)
+# if defined(__linux__)
 extern unsigned long getauxval(unsigned long type) __attribute__ ((weak));
 # else
 static unsigned long (*getauxval) (unsigned long) = NULL;

Index: src/crypto/external/bsd/openssl/dist/crypto/ppccap.c
diff -u src/crypto/external/bsd/openssl/dist/crypto/ppccap.c:1.8 src/crypto/external/bsd/openssl/dist/crypto/ppccap.c:1.9
--- src/crypto/external/bsd/openssl/dist/crypto/ppccap.c:1.8	Sun Sep 23 13:32:55 2018
+++ src/crypto/external/bsd/openssl/dist/crypto/ppccap.c	Tue Nov 20 07:30:17 2018
@@ -178,7 +178,7 @@ void OPENSSL_madd300_probe(void);
  * feature detection, not *run-time*. In other words if we link with
  * symbol present, it's expected to be present even at run-time.
  */
-#if defined(__GNUC__) && __GNUC__>=2 && defined(__ELF__)
+#if defined(__linux__)
 extern unsigned long getauxval(unsigned long type) __attribute__ ((weak));
 #else
 static unsigned long (*getauxval) (unsigned long) = NULL;



CVS commit: src/usr.sbin/tprof

2018-11-19 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Nov 20 06:43:26 UTC 2018

Modified Files:
src/usr.sbin/tprof: tprof.8

Log Message:
Note support for Intel Silvermont/Airmont.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/tprof/tprof.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/tprof/tprof.8
diff -u src/usr.sbin/tprof/tprof.8:1.10 src/usr.sbin/tprof/tprof.8:1.11
--- src/usr.sbin/tprof/tprof.8:1.10	Tue Jul 24 10:05:36 2018
+++ src/usr.sbin/tprof/tprof.8	Tue Nov 20 06:43:26 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: tprof.8,v 1.10 2018/07/24 10:05:36 maxv Exp $
+.\"	$NetBSD: tprof.8,v 1.11 2018/11/20 06:43:26 maxv Exp $
 .\"
 .\" Copyright (c)2011 YAMAMOTO Takashi,
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd July 24, 2018
+.Dd November 20, 2018
 .Dt TPROF 8
 .Os
 .Sh NAME
@@ -133,6 +133,8 @@ x86 AMD Family 10h
 x86 Intel Generic (all Intel CPUs)
 .It
 x86 Intel Skylake/Kabylake
+.It
+x86 Intel Silvermont/Airmont
 .El
 .Sh DIAGNOSTICS
 The



CVS commit: src/sys/dev/pci

2018-11-19 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Nov 20 04:04:42 UTC 2018

Modified Files:
src/sys/dev/pci: if_wm.c

Log Message:
- Add wm_oem_bits_config_ich8lan() to control LPLU and GbE setting base on
  the NVM's info.
- Modify wm_enable_wakeup() to reduce difference against FreeBSD and Linux.
  This modification affects to ICH8 and newer devices. I217 Rapid Start
  Technology support have not written yet (it's TODO).


To generate a diff of this commit:
cvs rdiff -u -r1.599 -r1.600 src/sys/dev/pci/if_wm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.599 src/sys/dev/pci/if_wm.c:1.600
--- src/sys/dev/pci/if_wm.c:1.599	Tue Nov 20 03:52:03 2018
+++ src/sys/dev/pci/if_wm.c	Tue Nov 20 04:04:42 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.599 2018/11/20 03:52:03 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.600 2018/11/20 04:04:42 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.599 2018/11/20 03:52:03 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.600 2018/11/20 04:04:42 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -720,6 +720,7 @@ static void	wm_get_cfg_done(struct wm_so
 static void	wm_phy_post_reset(struct wm_softc *);
 static int	wm_write_smbus_addr(struct wm_softc *);
 static void	wm_init_lcd_from_nvm(struct wm_softc *);
+static int	wm_oem_bits_config_ich8lan(struct wm_softc *, bool);
 static void	wm_initialize_hardware_bits(struct wm_softc *);
 static uint32_t	wm_rxpbs_adjust_82580(uint32_t);
 static void	wm_reset_phy(struct wm_softc *);
@@ -955,6 +956,7 @@ static void	wm_get_wakeup(struct wm_soft
 static int	wm_ulp_disable(struct wm_softc *);
 static void	wm_enable_phy_wakeup(struct wm_softc *);
 static void	wm_igp3_phy_powerdown_workaround_ich8lan(struct wm_softc *);
+static void	wm_suspend_workarounds_ich8lan(struct wm_softc *);
 static void	wm_enable_wakeup(struct wm_softc *);
 static void	wm_disable_aspm(struct wm_softc *);
 /* LPLU (Low Power Link Up) */
@@ -3878,7 +3880,8 @@ wm_phy_post_reset(struct wm_softc *sc)
 	/* Configure the LCD with the extended configuration region in NVM */
 	wm_init_lcd_from_nvm(sc);
 
-	/* XXX Configure the LCD with the OEM bits in NVM */
+	/* Configure the LCD with the OEM bits in NVM */
+	wm_oem_bits_config_ich8lan(sc, true);
 
 	if (sc->sc_type == WM_T_PCH2) {
 		/* Ungate automatic PHY configuration on non-managed 82579 */
@@ -4031,6 +4034,72 @@ release:	
 	return;
 }
 
+/*
+ *  wm_oem_bits_config_ich8lan - SW-based LCD Configuration
+ *  @sc:   pointer to the HW structure
+ *  @d0_state: boolean if entering d0 or d3 device state
+ *
+ *  SW will configure Gbe Disable and LPLU based on the NVM. The four bits are
+ *  collectively called OEM bits.  The OEM Write Enable bit and SW Config bit
+ *  in NVM determines whether HW should configure LPLU and Gbe Disable.
+ */
+int
+wm_oem_bits_config_ich8lan(struct wm_softc *sc, bool d0_state)
+{
+	uint32_t mac_reg;
+	uint16_t oem_reg;
+	int rv;
+
+	if (sc->sc_type < WM_T_PCH)
+		return 0;
+
+	rv = sc->phy.acquire(sc);
+	if (rv != 0)
+		return rv;
+
+	if (sc->sc_type == WM_T_PCH) {
+		mac_reg = CSR_READ(sc, WMREG_EXTCNFCTR);
+		if ((mac_reg & EXTCNFCTR_OEM_WRITE_ENABLE) != 0)
+			goto release;
+	}
+
+	mac_reg = CSR_READ(sc, WMREG_FEXTNVM);
+	if ((mac_reg & FEXTNVM_SW_CONFIG_ICH8M) == 0)
+		goto release;
+
+	mac_reg = CSR_READ(sc, WMREG_PHY_CTRL);
+	
+	rv = wm_gmii_hv_readreg_locked(sc->sc_dev, 1, HV_OEM_BITS, _reg);
+	if (rv != 0)
+		goto release;
+	oem_reg &= ~(HV_OEM_BITS_A1KDIS | HV_OEM_BITS_LPLU);
+
+	if (d0_state) {
+		if ((mac_reg & PHY_CTRL_GBE_DIS) != 0)
+			oem_reg |= HV_OEM_BITS_A1KDIS;
+		if ((mac_reg & PHY_CTRL_D0A_LPLU) != 0)
+			oem_reg |= HV_OEM_BITS_LPLU;
+	} else {
+		if ((mac_reg & (PHY_CTRL_GBE_DIS | PHY_CTRL_NOND0A_GBE_DIS))
+		!= 0)
+			oem_reg |= HV_OEM_BITS_A1KDIS;
+		if ((mac_reg & (PHY_CTRL_D0A_LPLU | PHY_CTRL_NOND0A_LPLU))
+		!= 0)
+			oem_reg |= HV_OEM_BITS_LPLU;
+	}
+
+	/* Set Restart auto-neg to activate the bits */
+	if ((d0_state || (sc->sc_type != WM_T_PCH))
+	&& (wm_phy_resetisblocked(sc) == false))
+		oem_reg |= HV_OEM_BITS_ANEGNOW;
+
+	rv = wm_gmii_hv_writereg_locked(sc->sc_dev, 1, HV_OEM_BITS, oem_reg);
+
+release:
+	sc->phy.release(sc);
+
+	return rv;
+}
 
 /* Init hardware bits */
 void
@@ -14121,6 +14190,85 @@ wm_igp3_phy_powerdown_workaround_ich8lan
 	}
 }
 
+/*
+ *  e1000_suspend_workarounds_ich8lan - workarounds needed during S0->Sx
+ *  @sc: pointer to the HW structure
+ *
+ *  During S0 to Sx transition, it is possible the link remains at gig
+ *  instead of negotiating to a lower speed.  Before going to Sx, set
+ *  'Gig Disable' to force link speed negotiation to a lower speed based on
+ *  the LPLU setting in the NVM or custom setting.  For 

CVS commit: src/sys/dev/pci

2018-11-19 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Nov 20 03:52:03 UTC 2018

Modified Files:
src/sys/dev/pci: if_wm.c

Log Message:
- Fix a bug that i82578 PHY can't detect correctly.
- Print PHY OUI and model number if a PHY's can't be identified.

XXX pullup-[78]


To generate a diff of this commit:
cvs rdiff -u -r1.598 -r1.599 src/sys/dev/pci/if_wm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.598 src/sys/dev/pci/if_wm.c:1.599
--- src/sys/dev/pci/if_wm.c:1.598	Mon Nov 19 06:38:58 2018
+++ src/sys/dev/pci/if_wm.c	Tue Nov 20 03:52:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.598 2018/11/19 06:38:58 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.599 2018/11/20 03:52:03 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.598 2018/11/19 06:38:58 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.599 2018/11/20 03:52:03 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -9564,7 +9564,7 @@ wm_gmii_setup_phytype(struct wm_softc *s
 	} else {
 		/* It's not the first call. Use PHY OUI and model */
 		switch (phy_oui) {
-		case MII_OUI_ATHEROS: /* XXX ??? */
+		case MII_OUI_ATTANSIC: /* XXX ??? */
 			switch (phy_model) {
 			case 0x0004: /* XXX */
 new_phytype = WMPHY_82578;
@@ -9641,8 +9641,9 @@ wm_gmii_setup_phytype(struct wm_softc *s
 			break;
 		}
 		if (new_phytype == WMPHY_UNKNOWN)
-			aprint_verbose_dev(dev, "%s: unknown PHY model\n",
-			__func__);
+			aprint_verbose_dev(dev,
+			"%s: unknown PHY model. OUI=%06x, model=%04x\n",
+			__func__, phy_oui, phy_model);
 
 		if ((sc->sc_phytype != WMPHY_UNKNOWN)
 		&& (sc->sc_phytype != new_phytype )) {



CVS commit: src

2018-11-19 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Nov 20 01:59:51 UTC 2018

Modified Files:
src/external/gpl3/gcc.old/dist/gcc/config/aarch64: driver-aarch64.c
src/external/gpl3/gcc/dist/gcc/config/aarch64: driver-aarch64.c
src/sys/arch/aarch64/aarch64: aarch64_machdep.c cpu.c genassym.cf
src/sys/arch/aarch64/include: armreg.h cpu.h
src/usr.sbin/cpuctl/arch: aarch64.c

Log Message:
rewrite the CPU identification on arm64:

- publish per-cpu data
- publish a whole bunch of info in struct aarch64_sysctl_cpu_id
  instead of various individual nodes (there are 16 total.)
- add MIDR extractor bits
- define ARMv8.2-A id_aa64mmfr2_el1 and id_aa64zfr0_el1 regs,
  but avoid using them until we make sure they exist.  (these
  members are added to aarch64_sysctl_cpu_id to avoid future
  compat issues.)

the arm32 and aarch32 version of these need to be adjusted as
well (and aarch32 data published at all.)  still trying to
work out how to make the same userland binary running on a
real arm32 or an aarch32 system can work sanely here.

ok ryo@.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/gpl3/gcc.old/dist/gcc/config/aarch64/driver-aarch64.c
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/external/gpl3/gcc/dist/gcc/config/aarch64/driver-aarch64.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/aarch64/aarch64/aarch64_machdep.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/aarch64/aarch64/cpu.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/aarch64/aarch64/genassym.cf
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/aarch64/include/armreg.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/aarch64/include/cpu.h
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/cpuctl/arch/aarch64.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gcc.old/dist/gcc/config/aarch64/driver-aarch64.c
diff -u src/external/gpl3/gcc.old/dist/gcc/config/aarch64/driver-aarch64.c:1.1.1.1 src/external/gpl3/gcc.old/dist/gcc/config/aarch64/driver-aarch64.c:1.2
--- src/external/gpl3/gcc.old/dist/gcc/config/aarch64/driver-aarch64.c:1.1.1.1	Wed Aug  1 22:18:36 2018
+++ src/external/gpl3/gcc.old/dist/gcc/config/aarch64/driver-aarch64.c	Tue Nov 20 01:59:51 2018
@@ -22,6 +22,7 @@
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
+#include "diagnostic-core.h"
 
 /* Defined in common/config/aarch64/aarch64-common.c.  */
 std::string aarch64_get_extension_string_for_isa_flags (unsigned long,
@@ -145,6 +146,208 @@ contains_string_p (const char** arr, con
ARGC and ARGV are set depending on the actual arguments given
in the spec.  */
 
+#ifdef __NetBSD__
+/* The NetBSD/arm64 platform does not export linux-style cpuinfo,
+   but the data is available via a sysctl(3) interface.  */
+#include 
+#include 
+#include 
+
+const char *
+host_detect_local_cpu (int argc, const char **argv)
+{
+  const char *arch_id = NULL;
+  const char *res = NULL;
+  static const int num_exts = ARRAY_SIZE (aarch64_extensions);
+  char buf[128];
+  bool arch = false;
+  bool tune = false;
+  bool cpu = false;
+  unsigned int i, curcpu;
+  unsigned int core_idx = 0;
+  const char* imps[2] = { NULL, NULL };
+  const char* cores[2] = { NULL, NULL };
+  unsigned int n_cores = 0;
+  unsigned int n_imps = 0;
+  bool processed_exts = false;
+  const char *ext_string = "";
+  unsigned long extension_flags = 0;
+  unsigned long default_flags = 0;
+  size_t len;
+  char impl_buf[8];
+  char part_buf[8];
+  int mib[2], ncpu;
+
+  gcc_assert (argc);
+
+  if (!argv[0])
+goto not_found;
+
+  /* Are we processing -march, mtune or mcpu?  */
+  arch = strcmp (argv[0], "arch") == 0;
+  if (!arch)
+tune = strcmp (argv[0], "tune") == 0;
+
+  if (!arch && !tune)
+cpu = strcmp (argv[0], "cpu") == 0;
+
+  if (!arch && !tune && !cpu)
+goto not_found;
+
+  mib[0] = CTL_HW;
+  mib[1] = HW_NCPU; 
+  len = sizeof(ncpu);
+  if (sysctl(mib, 2, , , NULL, 0) == -1)
+goto not_found;
+
+  for (curcpu = 0; curcpu < ncpu; curcpu++)
+{
+  char path[128];
+  struct aarch64_sysctl_cpu_id id;
+
+  len = sizeof id;
+  snprintf(path, sizeof path, "machdep.cpu%d.cpu_id", curcpu);
+  if (sysctlbyname(path, , , NULL, 0) != 0)
+goto not_found;
+
+  snprintf(impl_buf, sizeof impl_buf, "0x%02x",
+	   (int)__SHIFTOUT(id.ac_midr, MIDR_EL1_IMPL));
+  snprintf(part_buf, sizeof part_buf, "0x%02x",
+	   (int)__SHIFTOUT(id.ac_midr, MIDR_EL1_PARTNUM));
+
+  for (i = 0; aarch64_cpu_data[i].name != NULL; i++)
+if (strstr (impl_buf, aarch64_cpu_data[i].implementer_id) != NULL
+&& !contains_string_p (imps, aarch64_cpu_data[i].implementer_id))
+  {
+if (n_imps == 2)
+  goto not_found;
+
+imps[n_imps++] = aarch64_cpu_data[i].implementer_id;
+
+break;
+  }
+
+  for (i = 0; aarch64_cpu_data[i].name != NULL; i++)
+if (strstr (part_buf, 

CVS commit: src/libexec/httpd

2018-11-19 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Nov 20 01:23:06 UTC 2018

Modified Files:
src/libexec/httpd: bozohttpd.h

Log Message:
also fix have_dynamic_content from the previous previous.  re-order
the debug and dynamic content to match the same pattern as everything
else so similar problems are less likely in the future.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/libexec/httpd/bozohttpd.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/httpd/bozohttpd.h
diff -u src/libexec/httpd/bozohttpd.h:1.53 src/libexec/httpd/bozohttpd.h:1.54
--- src/libexec/httpd/bozohttpd.h:1.53	Tue Nov 20 01:19:51 2018
+++ src/libexec/httpd/bozohttpd.h	Tue Nov 20 01:23:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: bozohttpd.h,v 1.53 2018/11/20 01:19:51 mrg Exp $	*/
+/*	$NetBSD: bozohttpd.h,v 1.54 2018/11/20 01:23:06 mrg Exp $	*/
 
 /*	$eterna: bozohttpd.h,v 1.39 2011/11/18 09:21:15 mrg Exp $	*/
 
@@ -222,13 +222,13 @@ typedef struct bozoprefs_t {
 #define BOZO_DEAD
 #endif
 
-#ifndef NO_DEBUG
+#ifdef NO_DEBUG
+#define	debug(x)
+#define have_debug	(0)
+#else
 void	debug__(bozohttpd_t *, int, const char *, ...) BOZO_PRINTFLIKE(3, 4);
 #define debug(x)	debug__ x
 #define have_debug	(1)
-#else
-#define	debug(x)
-#define have_debug	(0)
 #endif /* NO_DEBUG */
 
 int	bozo_http_error(bozohttpd_t *, int, bozo_httpreq_t *, const char *);
@@ -365,11 +365,11 @@ const char *bozo_content_type(bozo_httpr
 const char *bozo_content_encoding(bozo_httpreq_t *, const char *);
 bozo_content_map_t *bozo_match_content_map(bozohttpd_t *, const char *, int);
 bozo_content_map_t *bozo_get_content_map(bozohttpd_t *, const char *);
-#ifndef NO_DYNAMIC_CONTENT
-void	bozo_add_content_map_mime(bozohttpd_t *, const char *, const char *,
-  const char *, const char *);
+#ifdef NO_DYNAMIC_CONTENT
 #define have_dynamic_content(0)
 #else
+void	bozo_add_content_map_mime(bozohttpd_t *, const char *, const char *,
+  const char *, const char *);
 #define have_dynamic_content(1)
 #endif
 



CVS commit: src/libexec/httpd

2018-11-19 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Nov 20 01:15:50 UTC 2018

Modified Files:
src/libexec/httpd: bozohttpd.h main.c

Log Message:
move some #if support into bozohttpd.h.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/libexec/httpd/bozohttpd.h
cvs rdiff -u -r1.17 -r1.18 src/libexec/httpd/main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/httpd/bozohttpd.h
diff -u src/libexec/httpd/bozohttpd.h:1.51 src/libexec/httpd/bozohttpd.h:1.52
--- src/libexec/httpd/bozohttpd.h:1.51	Tue Nov 20 01:06:46 2018
+++ src/libexec/httpd/bozohttpd.h	Tue Nov 20 01:15:50 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: bozohttpd.h,v 1.51 2018/11/20 01:06:46 mrg Exp $	*/
+/*	$NetBSD: bozohttpd.h,v 1.52 2018/11/20 01:15:50 mrg Exp $	*/
 
 /*	$eterna: bozohttpd.h,v 1.39 2011/11/18 09:21:15 mrg Exp $	*/
 
@@ -225,8 +225,10 @@ typedef struct bozoprefs_t {
 #ifndef NO_DEBUG
 void	debug__(bozohttpd_t *, int, const char *, ...) BOZO_PRINTFLIKE(3, 4);
 #define debug(x)	debug__ x
+#define have_debug	(0)
 #else
 #define	debug(x)
+#define have_debug	(1)
 #endif /* NO_DEBUG */
 
 int	bozo_http_error(bozohttpd_t *, int, bozo_httpreq_t *, const char *);
@@ -256,19 +258,23 @@ char	*bozostrdup(bozohttpd_t *, bozo_htt
 
 #define bozo_noop	do { /* nothing */ } while (/*CONSTCOND*/0)
 
+#define have_all	(1)
+
 /* ssl-bozo.c */
 #ifdef NO_SSL_SUPPORT
-#define bozo_ssl_set_opts(w, x, y)	bozo_noop
-#define bozo_ssl_set_ciphers(w, x, y)	bozo_noop
-#define bozo_ssl_init(x)		bozo_noop
-#define bozo_ssl_accept(x)		(0)
-#define bozo_ssl_destroy(x)		bozo_noop
+#define bozo_ssl_set_opts(w, x, y)			bozo_noop
+#define bozo_ssl_set_ciphers(w, x, y)			bozo_noop
+#define bozo_ssl_init(x)bozo_noop
+#define bozo_ssl_accept(x)(0)
+#define bozo_ssl_destroy(x)bozo_noop
+#define have_ssl	(0)
 #else
 void	bozo_ssl_set_opts(bozohttpd_t *, const char *, const char *);
 void	bozo_ssl_set_ciphers(bozohttpd_t *, const char *);
 void	bozo_ssl_init(bozohttpd_t *);
 int	bozo_ssl_accept(bozohttpd_t *);
 void	bozo_ssl_destroy(bozohttpd_t *);
+#define have_ssl	(1)
 #endif
 
 
@@ -283,64 +289,74 @@ void	bozo_auth_check_401(bozo_httpreq_t 
 void	bozo_auth_cgi_setenv(bozo_httpreq_t *, char ***);
 int	bozo_auth_cgi_count(bozo_httpreq_t *);
 #else
-#define	bozo_auth_init(x)			bozo_noop
-#define	bozo_auth_check(x, y)			0
-#define	bozo_auth_cleanup(x)			bozo_noop
-#define	bozo_auth_check_headers(y, z, a, b)	0
-#define	bozo_auth_check_special_files(x, y)	0
-#define	bozo_auth_check_401(x, y)		bozo_noop
-#define	bozo_auth_cgi_setenv(x, y)		bozo_noop
-#define	bozo_auth_cgi_count(x)			0
+#define	bozo_auth_init(x)bozo_noop
+#define	bozo_auth_check(x, y)(0)
+#define	bozo_auth_cleanup(x)bozo_noop
+#define	bozo_auth_check_headers(y, z, a, b)		(0)
+#define	bozo_auth_check_special_files(x, y)		(0)
+#define	bozo_auth_check_401(x, y)			bozo_noop
+#define	bozo_auth_cgi_setenv(x, y)			bozo_noop
+#define	bozo_auth_cgi_count(x)(0)
 #endif /* DO_HTPASSWD */
 
 
 /* cgi-bozo.c */
 #ifdef NO_CGIBIN_SUPPORT
-#define	bozo_process_cgi(h)0
+#define	bozo_process_cgi(h)(0)
+#define have_cgibin	(0)
 #else
 void	bozo_cgi_setbin(bozohttpd_t *, const char *);
 void	bozo_setenv(bozohttpd_t *, const char *, const char *, char **);
 int	bozo_process_cgi(bozo_httpreq_t *);
 void	bozo_add_content_map_cgi(bozohttpd_t *, const char *, const char *);
+#define have_cgibin	(1)
 #endif /* NO_CGIBIN_SUPPORT */
 
 
 /* lua-bozo.c */
 #ifdef NO_LUA_SUPPORT
-#define bozo_process_lua(h)0
+#define bozo_process_lua(h)(0)
+#define have_lua	(0)
 #else
 void	bozo_add_lua_map(bozohttpd_t *, const char *, const char *);
 int	bozo_process_lua(bozo_httpreq_t *);
+#define have_lua	(1)
 #endif /* NO_LUA_SUPPORT */
 
 
 /* daemon-bozo.c */
 #ifdef NO_DAEMON_MODE
 #define bozo_daemon_init(x)bozo_noop
-#define bozo_daemon_fork(x)0
+#define bozo_daemon_fork(x)(0)
 #define bozo_daemon_closefds(x)bozo_noop
+#define have_daemon_mode(0)
 #else
 void	bozo_daemon_init(bozohttpd_t *);
 int	bozo_daemon_fork(bozohttpd_t *);
 void	bozo_daemon_closefds(bozohttpd_t *);
+#define have_daemon_mode(1)
 #endif /* NO_DAEMON_MODE */
 
 
 /* tilde-luzah-bozo.c */
 #ifdef NO_USER_SUPPORT
-#define bozo_user_transform(x)0
+#define bozo_user_transform(x)(0)
 #define bozo_user_free(x)/* nothing */
+#define have_user	(0)
 #else
 int	bozo_user_transform(bozo_httpreq_t *);
 #define bozo_user_free(x)free(x)
+#define have_user	(1)
 #endif /* NO_USER_SUPPORT */
 
 
 /* dir-index-bozo.c */
 #ifdef NO_DIRINDEX_SUPPORT
-#define bozo_dir_index(a, b, c)0
+#define bozo_dir_index(a, b, c)(0)
+#define have_dirindex	(0)
 #else
 int	bozo_dir_index(bozo_httpreq_t *, const char *, int);
+#define have_dirindex	(1)
 #endif /* NO_DIRINDEX_SUPPORT */
 
 
@@ -352,6 +368,9 @@ bozo_content_map_t *bozo_get_content_map
 

CVS commit: src/libexec/httpd

2018-11-19 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Nov 20 01:19:52 UTC 2018

Modified Files:
src/libexec/httpd: bozohttpd.h

Log Message:
fix previous: have_debug was reversed.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/libexec/httpd/bozohttpd.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/libexec/httpd/bozohttpd.h
diff -u src/libexec/httpd/bozohttpd.h:1.52 src/libexec/httpd/bozohttpd.h:1.53
--- src/libexec/httpd/bozohttpd.h:1.52	Tue Nov 20 01:15:50 2018
+++ src/libexec/httpd/bozohttpd.h	Tue Nov 20 01:19:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: bozohttpd.h,v 1.52 2018/11/20 01:15:50 mrg Exp $	*/
+/*	$NetBSD: bozohttpd.h,v 1.53 2018/11/20 01:19:51 mrg Exp $	*/
 
 /*	$eterna: bozohttpd.h,v 1.39 2011/11/18 09:21:15 mrg Exp $	*/
 
@@ -225,10 +225,10 @@ typedef struct bozoprefs_t {
 #ifndef NO_DEBUG
 void	debug__(bozohttpd_t *, int, const char *, ...) BOZO_PRINTFLIKE(3, 4);
 #define debug(x)	debug__ x
-#define have_debug	(0)
+#define have_debug	(1)
 #else
 #define	debug(x)
-#define have_debug	(1)
+#define have_debug	(0)
 #endif /* NO_DEBUG */
 
 int	bozo_http_error(bozohttpd_t *, int, bozo_httpreq_t *, const char *);



CVS commit: src/libexec/httpd

2018-11-19 Thread matthew green
l Z Ar cert privkey
 .Op Fl c Ar cgibin
@@ -236,6 +237,19 @@ Sets the internal server version to
 .Ar server_software .
 .It Fl s
 Forces logging to be set to stderr always.
+.It Fl T Ar type timeout
+Set the timeout for
+.Ar type
+to
+.Ar timeout .
+The valid values of
+.Ar type
+are
+.Dq initial timeout ,
+.Dq header timeout ,
+and
+.Dq request timeout .
+The default values are 30 seconds, 10 seconds and 600 seconds, respectively.
 .It Fl t Ar chrootdir
 Makes
 .Nm
@@ -585,7 +599,7 @@ The focus has always been simplicity and
 and regular code audits.
 This manual documents
 .Nm
-version 20181118.
+version 20181119.
 .Sh AUTHORS
 .An -nosplit
 .Nm

Index: src/libexec/httpd/bozohttpd.c
diff -u src/libexec/httpd/bozohttpd.c:1.89 src/libexec/httpd/bozohttpd.c:1.90
--- src/libexec/httpd/bozohttpd.c:1.89	Mon Nov 19 04:12:22 2018
+++ src/libexec/httpd/bozohttpd.c	Tue Nov 20 01:06:46 2018
@@ -1,9 +1,9 @@
-/*	$NetBSD: bozohttpd.c,v 1.89 2018/11/19 04:12:22 mrg Exp $	*/
+/*	$NetBSD: bozohttpd.c,v 1.90 2018/11/20 01:06:46 mrg Exp $	*/
 
 /*	$eterna: bozohttpd.c,v 1.178 2011/11/18 09:21:15 mrg Exp $	*/
 
 /*
- * Copyright (c) 1997-2017 Matthew R. Green
+ * Copyright (c) 1997-2018 Matthew R. Green
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -109,7 +109,7 @@
 #define INDEX_HTML		"index.html"
 #endif
 #ifndef SERVER_SOFTWARE
-#define SERVER_SOFTWARE		"bozohttpd/20181118"
+#define SERVER_SOFTWARE		"bozohttpd/20181119"
 #endif
 #ifndef DIRECT_ACCESS_FILE
 #define DIRECT_ACCESS_FILE	".bzdirect"
@@ -166,8 +166,19 @@
 
 #include "bozohttpd.h"
 
-#ifndef MAX_WAIT_TIME
-#define	MAX_WAIT_TIME	60	/* hang around for 60 seconds max */
+#ifndef INITIAL_TIMEOUT
+#define	INITIAL_TIMEOUT		"30"	/* wait for 30 seconds initially */
+#endif
+#ifndef HEADER_WAIT_TIME
+#define	HEADER_WAIT_TIME	"10"	/* need more headers every 10 seconds */
+#endif
+#ifndef TOTAL_MAX_REQ_TIME
+#define	TOTAL_MAX_REQ_TIME	"600"	/* must have total request in 600 */
+#endif	/* seconds */
+
+/* if monotonic time is not available try real time. */
+#ifndef CLOCK_MONOTONIC
+#define CLOCK_MONOTONIC CLOCK_REALTIME
 #endif
 
 /* variables and functions */
@@ -175,7 +186,7 @@
 #define LOG_FTP LOG_DAEMON
 #endif
 
-volatile sig_atomic_t	alarmhit;
+volatile sig_atomic_t	timeout_hit;
 
 /*
  * check there's enough space in the prefs and names arrays.
@@ -378,7 +389,34 @@ bozo_clean_request(bozo_httpreq_t *reque
 static void
 alarmer(int sig)
 {
-	alarmhit = 1;
+	timeout_hit = 1;
+}
+
+
+/*
+ * set a timeout for "initial", "header", or "request".
+ */
+int
+bozo_set_timeout(bozohttpd_t *httpd, bozoprefs_t *prefs,
+		 const char *target, const char *time)
+{
+	const char *cur, *timeouts[] = {
+		"initial timeout",
+		"header timeout",
+		"request timeout",
+		NULL,
+	};
+	/* adjust minlen if more timeouts appear with conflicting names */
+	const size_t minlen = 1;
+	size_t len = strlen(target);
+
+	for (cur = timeouts[0]; len >= minlen && *cur; cur++) {
+		if (strncmp(target, cur, len) == 0) {
+			bozo_set_pref(httpd, prefs, cur, time);
+			return 0;
+		}
+	}
+	return 1;
 }
 
 /*
@@ -575,6 +613,7 @@ bozo_read_request(bozohttpd_t *httpd)
 	int	line = 0;
 	socklen_t slen;
 	bozo_httpreq_t *request;
+	struct timespec ots, ts;
 
 	/*
 	 * if we're in daemon mode, bozo_daemon_fork() will return here twice
@@ -657,10 +696,39 @@ bozo_read_request(bozohttpd_t *httpd)
 	sa.sa_flags = 0;
 	sigaction(SIGALRM, , NULL);
 
-	alarm(MAX_WAIT_TIME);
+	
+	if (clock_gettime(CLOCK_MONOTONIC, ) != 0) {
+		(void)bozo_http_error(httpd, 500, NULL,
+			"clock_gettime failed");
+		goto cleanup;
+	}
+
+	alarm(httpd->initial_timeout);
 	while ((str = bozodgetln(httpd, STDIN_FILENO, , bozo_read)) != NULL) {
 		alarm(0);
-		if (alarmhit) {
+
+		if (clock_gettime(CLOCK_MONOTONIC, ) != 0) {
+			(void)bozo_http_error(httpd, 500, NULL,
+"clock_gettime failed");
+			goto cleanup;
+		}
+		/*
+		 * don't timeout if old tv_sec is not more than current
+		 * tv_sec, or if current tv_sec is less than the request
+		 * timeout (these shouldn't happen, but the first could
+		 * if monotonic time is not available.)
+		 *
+		 * the other timeout and header size checks should ensure
+		 * that even if time it set backwards or forwards a very
+		 * long way, timeout will eventually happen, even if this
+		 * one fails.
+		 */
+		if (ts.tv_sec > ots.tv_sec &&
+		ts.tv_sec > httpd->request_timeout &&
+		ts.tv_sec - httpd->request_timeout > ots.tv_sec)
+			timeout_hit = 1;
+
+		if (timeout_hit) {
 			(void)bozo_http_error(httpd, 408, NULL,
 	"request timed out");
 			goto cleanup;
@@ -668,7 +736,6 @@ bozo_read_request(bozohttpd_t *httpd)
 		line++;
 
 		if (line == 1) {
-
 			if (len < 1) {
 (void)bozo_http_error(httpd, 404,

CVS commit: src/sys/arch/x86/x86

2018-11-19 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Nov 19 22:21:33 UTC 2018

Modified Files:
src/sys/arch/x86/x86: identcpu.c

Log Message:
enable XSAVE (and hence AVX) under XEN by default, fixes PR kern/50332

okayed by maxv@


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/x86/x86/identcpu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.82 src/sys/arch/x86/x86/identcpu.c:1.83
--- src/sys/arch/x86/x86/identcpu.c:1.82	Sat Nov 10 11:08:54 2018
+++ src/sys/arch/x86/x86/identcpu.c	Mon Nov 19 22:21:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.82 2018/11/10 11:08:54 maxv Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.83 2018/11/19 22:21:32 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.82 2018/11/10 11:08:54 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.83 2018/11/19 22:21:32 jdolecek Exp $");
 
 #include "opt_xen.h"
 
@@ -822,9 +822,7 @@ cpu_probe_fpu(struct cpu_info *ci)
 	 * supervisor trap. OSXSAVE flag seems to be reliably set according
 	 * to whether XSAVE is actually available.
 	 */
-#ifdef XEN_USE_XSAVE
 	if ((ci->ci_feat_val[1] & CPUID2_OSXSAVE) == 0)
-#endif
 		return;
 #endif
 



CVS commit: src/sys/dev/ic

2018-11-19 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Nov 19 22:05:23 UTC 2018

Modified Files:
src/sys/dev/ic: ahcisata_core.c

Log Message:
during SRST (softreset), make a short delay between the RST set and
clear; SATA specifies minimum 5 usec for the toggle period, and
some controllers (seems usually on AMD motherboards) actually require it

this fixes the 'clearing WDCTL_RST failed' error in PR kern/53307
and PR kern/53524

confirmed working on a ASUS Prime A320M-K mainboard by me, and by Patrick
Welche on another Ryzen system

XXX pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/ic/ahcisata_core.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/ahcisata_core.c
diff -u src/sys/dev/ic/ahcisata_core.c:1.68 src/sys/dev/ic/ahcisata_core.c:1.69
--- src/sys/dev/ic/ahcisata_core.c:1.68	Mon Nov 19 21:52:24 2018
+++ src/sys/dev/ic/ahcisata_core.c	Mon Nov 19 22:05:22 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_core.c,v 1.68 2018/11/19 21:52:24 jdolecek Exp $	*/
+/*	$NetBSD: ahcisata_core.c,v 1.69 2018/11/19 22:05:22 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.68 2018/11/19 21:52:24 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.69 2018/11/19 22:05:22 jdolecek Exp $");
 
 #include 
 #include 
@@ -841,6 +841,13 @@ ahci_do_reset_drive(struct ata_channel *
 		break;
 	}
 
+	/*
+	 * SATA specification has toggle period for SRST bit of 5 usec. Some
+	 * controllers fail to process the SRST clear operation unless
+	 * we wait for at least this period between the set and clear commands.
+	 */
+	ata_delay(chp, 10, "ahcirstw", flags);
+
 	cmd_h->cmdh_flags = htole16(RHD_FISLEN / 4 |
 	(drive << AHCI_CMDH_F_PMP_SHIFT));
 	cmd_h->cmdh_prdbc = 0;



CVS commit: src/sys/dev/ic

2018-11-19 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Nov 19 21:52:24 UTC 2018

Modified Files:
src/sys/dev/ic: ahcisata_core.c

Log Message:
if softreset during PMP detection fails, disable PMP, reset port and continue
with sig detected after the initial COMRESET

this does not yet fix the infamous 'clearing WDCTL_RST failed', but at least
now the disk is detected and usable when it happens

tested on AMD system with ASUS Prime A320M-K, similar to one from PR kern/53524


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/dev/ic/ahcisata_core.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/ahcisata_core.c
diff -u src/sys/dev/ic/ahcisata_core.c:1.67 src/sys/dev/ic/ahcisata_core.c:1.68
--- src/sys/dev/ic/ahcisata_core.c:1.67	Mon Nov 19 19:52:08 2018
+++ src/sys/dev/ic/ahcisata_core.c	Mon Nov 19 21:52:24 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_core.c,v 1.67 2018/11/19 19:52:08 jdolecek Exp $	*/
+/*	$NetBSD: ahcisata_core.c,v 1.68 2018/11/19 21:52:24 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.67 2018/11/19 19:52:08 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.68 2018/11/19 21:52:24 jdolecek Exp $");
 
 #include 
 #include 
@@ -791,13 +791,11 @@ ahci_do_reset_drive(struct ata_channel *
 	struct ahci_softc *sc = (struct ahci_softc *)chp->ch_atac;
 	struct ahci_cmd_tbl *cmd_tbl;
 	struct ahci_cmd_header *cmd_h;
-	int i;
+	int i, error = 0;
 	uint32_t sig;
 
-	KASSERT((AHCI_READ(sc, AHCI_P_CMD(chp->ch_channel)) & AHCI_P_CMD_CR) == 0);
 	ata_channel_lock_owned(chp);
 
-again:
 	/* clear port interrupt register */
 	AHCI_WRITE(sc, AHCI_P_IS(chp->ch_channel), 0x);
 	/* clear SErrors and start operations */
@@ -809,6 +807,9 @@ again:
 		 */
 		ahci_channel_start(sc, chp, flags, 1);
 	} else {
+		/* Can't handle command still running without CLO */
+		KASSERT((AHCI_READ(sc, AHCI_P_CMD(chp->ch_channel)) & AHCI_P_CMD_CR) == 0);
+
 		ahci_channel_start(sc, chp, flags, 0);
 	}
 	if (drive > 0) {
@@ -834,12 +835,12 @@ again:
 	case TIMEOUT:
 		aprint_error("%s port %d: setting WDCTL_RST failed "
 		"for drive %d\n", AHCINAME(sc), chp->ch_channel, drive);
-		if (sigp)
-			*sigp = 0x;
+		error = EBUSY;
 		goto end;
 	default:
 		break;
 	}
+
 	cmd_h->cmdh_flags = htole16(RHD_FISLEN / 4 |
 	(drive << AHCI_CMDH_F_PMP_SHIFT));
 	cmd_h->cmdh_prdbc = 0;
@@ -850,21 +851,9 @@ again:
 	switch (ahci_exec_fis(chp, 310, flags, c_slot)) {
 	case ERR_DF:
 	case TIMEOUT:
-		if ((sc->sc_ahci_quirks & AHCI_QUIRK_BADPMPRESET) != 0 &&
-		drive == PMP_PORT_CTL) {
-			/*
-			 * some controllers fails to reset when
-			 * targeting a PMP but a single drive is attached.
-			 * try again with port 0
-			 */
-			drive = 0;
-			ahci_channel_stop(sc, chp, flags);
-			goto again;
-		}
 		aprint_error("%s port %d: clearing WDCTL_RST failed "
 		"for drive %d\n", AHCINAME(sc), chp->ch_channel, drive);
-		if (sigp)
-			*sigp = 0x;
+		error = EBUSY;
 		goto end;
 	default:
 		break;
@@ -885,8 +874,6 @@ skip_reset:
 	if (i == AHCI_RST_WAIT) {
 		aprint_error("%s: BSY never cleared, TD 0x%x\n",
 		AHCINAME(sc), sig);
-		if (sigp)
-			*sigp = 0x;
 		goto end;
 	}
 	AHCIDEBUG_PRINT(("%s: BSY took %d ms\n", AHCINAME(sc), i * 10),
@@ -904,7 +891,7 @@ end:
 	AHCI_WRITE(sc, AHCI_P_IS(chp->ch_channel), 0x);
 	ahci_channel_start(sc, chp, flags,
 	(sc->sc_ahci_cap & AHCI_CAP_CLO) ? 1 : 0);
-	return 0;
+	return error;
 }
 
 static void
@@ -972,6 +959,7 @@ ahci_probe_drive(struct ata_channel *chp
 	struct ahci_channel *achp = (struct ahci_channel *)chp;
 	uint32_t sig;
 	uint8_t c_slot;
+	int error;
 
 	ata_channel_lock(chp);
 
@@ -993,9 +981,24 @@ ahci_probe_drive(struct ata_channel *chp
 	achp->ahcic_sstatus, AT_WAIT)) {
 	case SStatus_DET_DEV:
 		ata_delay(chp, 500, "ahcidv", AT_WAIT);
+
+		/* Initial value, used in case the soft reset fails */
+		sig = AHCI_READ(sc, AHCI_P_SIG(chp->ch_channel));
+
 		if (sc->sc_ahci_cap & AHCI_CAP_SPM) {
-			ahci_do_reset_drive(chp, PMP_PORT_CTL, AT_WAIT, ,
-			c_slot);
+			error = ahci_do_reset_drive(chp, PMP_PORT_CTL, AT_WAIT,
+			, c_slot);
+
+			/* If probe for PMP failed, just fallback to drive 0 */
+			if (error) {
+aprint_error("%s port %d: drive %d reset "
+"failing, disabling PMP\n",
+AHCINAME(sc), chp->ch_channel,
+PMP_PORT_CTL);
+
+sc->sc_ahci_cap &= ~AHCI_CAP_SPM;
+ahci_reset_channel(chp, AT_WAIT);
+			}
 		} else {
 			ahci_do_reset_drive(chp, 0, AT_WAIT, , c_slot);
 		}



CVS commit: src/lib/libnvmm

2018-11-19 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Nov 19 21:45:37 UTC 2018

Modified Files:
src/lib/libnvmm: libnvmm.c

Log Message:
Fix error handling of realloc, and use memmove because the areas overlap;
noted by agc@. These _nvmm_area_add/delete functions don't make a lot of
sense right now and will likely be rewritten to match the behavior
expected by Qemu; but still fix for the time being.

Also fix a collision check while here.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libnvmm/libnvmm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libnvmm/libnvmm.c
diff -u src/lib/libnvmm/libnvmm.c:1.1 src/lib/libnvmm/libnvmm.c:1.2
--- src/lib/libnvmm/libnvmm.c:1.1	Sat Nov 10 09:28:56 2018
+++ src/lib/libnvmm/libnvmm.c	Mon Nov 19 21:45:37 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: libnvmm.c,v 1.1 2018/11/10 09:28:56 maxv Exp $	*/
+/*	$NetBSD: libnvmm.c,v 1.2 2018/11/19 21:45:37 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -60,8 +60,8 @@ _nvmm_area_add(struct nvmm_machine *mach
 		gpa < mach->areas[i].gpa + mach->areas[i].size) {
 			goto error;
 		}
-		if (gpa + size >= mach->areas[i].gpa &&
-		gpa + size < mach->areas[i].gpa + mach->areas[i].size) {
+		if (gpa + size > mach->areas[i].gpa &&
+		gpa + size <= mach->areas[i].gpa + mach->areas[i].size) {
 			goto error;
 		}
 		if (gpa < mach->areas[i].gpa &&
@@ -70,13 +70,13 @@ _nvmm_area_add(struct nvmm_machine *mach
 		}
 	}
 
-	mach->nareas++;
-	ptr = realloc(mach->areas, mach->nareas * sizeof(struct nvmm_area));
+	ptr = realloc(mach->areas, (mach->nareas + 1) *
+	sizeof(struct nvmm_area));
 	if (ptr == NULL)
 		return -1;
 	mach->areas = ptr;
 
-	area = >areas[mach->nareas-1];
+	area = >areas[mach->nareas++];
 	area->gpa = gpa;
 	area->hva = hva;
 	area->size = size;
@@ -106,7 +106,7 @@ _nvmm_area_delete(struct nvmm_machine *m
 		return -1;
 	}
 
-	memcpy(>areas[i], >areas[i+1],
+	memmove(>areas[i], >areas[i+1],
 	(mach->nareas - i - 1) * sizeof(struct nvmm_area));
 	mach->nareas--;
 



CVS commit: src/sys/arch

2018-11-19 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Nov 19 20:44:52 UTC 2018

Modified Files:
src/sys/arch/amd64/include: pmap.h
src/sys/arch/i386/include: pmap.h
src/sys/arch/x86/include: pmap.h
src/sys/arch/x86/x86: pmap.c

Log Message:
Introduce pl_pi, will be used soon.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/amd64/include/pmap.h
cvs rdiff -u -r1.120 -r1.121 src/sys/arch/i386/include/pmap.h
cvs rdiff -u -r1.90 -r1.91 src/sys/arch/x86/include/pmap.h
cvs rdiff -u -r1.311 -r1.312 src/sys/arch/x86/x86/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/include/pmap.h
diff -u src/sys/arch/amd64/include/pmap.h:1.57 src/sys/arch/amd64/include/pmap.h:1.58
--- src/sys/arch/amd64/include/pmap.h:1.57	Mon Nov 19 20:28:01 2018
+++ src/sys/arch/amd64/include/pmap.h	Mon Nov 19 20:44:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.57 2018/11/19 20:28:01 maxv Exp $	*/
+/*	$NetBSD: pmap.h,v 1.58 2018/11/19 20:44:51 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -150,6 +150,7 @@ extern pt_entry_t *pte_base;
 #define NKL2_START_ENTRIES	0
 #define NKL1_START_ENTRIES	0
 
+#define PTP_MASK_INITIALIZER	{ L1_MASK, L2_MASK, L3_MASK, L4_MASK }
 #define PTP_FRAME_INITIALIZER	{ L1_FRAME, L2_FRAME, L3_FRAME, L4_FRAME }
 #define PTP_SHIFT_INITIALIZER	{ L1_SHIFT, L2_SHIFT, L3_SHIFT, L4_SHIFT }
 #define NKPTP_INITIALIZER	{ NKL1_START_ENTRIES, NKL2_START_ENTRIES, \

Index: src/sys/arch/i386/include/pmap.h
diff -u src/sys/arch/i386/include/pmap.h:1.120 src/sys/arch/i386/include/pmap.h:1.121
--- src/sys/arch/i386/include/pmap.h:1.120	Mon Nov 19 20:28:01 2018
+++ src/sys/arch/i386/include/pmap.h	Mon Nov 19 20:44:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.120 2018/11/19 20:28:01 maxv Exp $	*/
+/*	$NetBSD: pmap.h,v 1.121 2018/11/19 20:44:51 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -267,6 +267,7 @@
 #endif  /* !XEN */
 #define NPDPG			(PAGE_SIZE / sizeof (pd_entry_t))
 
+#define PTP_MASK_INITIALIZER	{ L1_MASK, L2_MASK }
 #define PTP_FRAME_INITIALIZER	{ L1_FRAME, L2_FRAME }
 #define PTP_SHIFT_INITIALIZER	{ L1_SHIFT, L2_SHIFT }
 #define NKPTP_INITIALIZER	{ NKL1_START_ENTRIES, NKL2_START_ENTRIES }

Index: src/sys/arch/x86/include/pmap.h
diff -u src/sys/arch/x86/include/pmap.h:1.90 src/sys/arch/x86/include/pmap.h:1.91
--- src/sys/arch/x86/include/pmap.h:1.90	Mon Nov 19 20:28:01 2018
+++ src/sys/arch/x86/include/pmap.h	Mon Nov 19 20:44:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.90 2018/11/19 20:28:01 maxv Exp $	*/
+/*	$NetBSD: pmap.h,v 1.91 2018/11/19 20:44:51 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -75,6 +75,8 @@
 #define pl2_pi(VA)	(((VA_SIGN_POS(VA)) & L2_MASK) >> L2_SHIFT)
 #define pl3_pi(VA)	(((VA_SIGN_POS(VA)) & L3_MASK) >> L3_SHIFT)
 #define pl4_pi(VA)	(((VA_SIGN_POS(VA)) & L4_MASK) >> L4_SHIFT)
+#define pl_pi(va, lvl) \
+(((VA_SIGN_POS(va)) & ptp_masks[(lvl)-1]) >> ptp_shifts[(lvl)-1])
 
 /*
  * pl*_i: generate index into pde/pte arrays in virtual space

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.311 src/sys/arch/x86/x86/pmap.c:1.312
--- src/sys/arch/x86/x86/pmap.c:1.311	Mon Nov 19 20:28:01 2018
+++ src/sys/arch/x86/x86/pmap.c	Mon Nov 19 20:44:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.311 2018/11/19 20:28:01 maxv Exp $	*/
+/*	$NetBSD: pmap.c,v 1.312 2018/11/19 20:44:51 maxv Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.311 2018/11/19 20:28:01 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.312 2018/11/19 20:44:51 maxv Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -239,6 +239,7 @@ __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.3
  *   lock it when adding or removing pmaps from this list.
  */
 
+const vaddr_t ptp_masks[] = PTP_MASK_INITIALIZER;
 const vaddr_t ptp_frames[] = PTP_FRAME_INITIALIZER;
 const int ptp_shifts[] = PTP_SHIFT_INITIALIZER;
 const long nkptpmax[] = NKPTPMAX_INITIALIZER;



CVS commit: src/lib/libcurses

2018-11-19 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Mon Nov 19 20:37:04 UTC 2018

Modified Files:
src/lib/libcurses: background.c

Log Message:
wbkgd - when updating window rendition for the new background character,
it's the old background characters that need to be updated, not spaces.

While here, simplify and also fix the bug introduced in 1.20 (that
lost the default color) - actually use the results of wbkgdset().


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/lib/libcurses/background.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libcurses/background.c
diff -u src/lib/libcurses/background.c:1.24 src/lib/libcurses/background.c:1.25
--- src/lib/libcurses/background.c:1.24	Sun Nov 18 22:53:22 2018
+++ src/lib/libcurses/background.c	Mon Nov 19 20:37:04 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: background.c,v 1.24 2018/11/18 22:53:22 uwe Exp $	*/
+/*	$NetBSD: background.c,v 1.25 2018/11/19 20:37:04 uwe Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: background.c,v 1.24 2018/11/18 22:53:22 uwe Exp $");
+__RCSID("$NetBSD: background.c,v 1.25 2018/11/19 20:37:04 uwe Exp $");
 #endif/* not lint */
 
 #include 
@@ -89,32 +89,33 @@ wbkgdset(WINDOW *win, chtype ch)
 int
 wbkgd(WINDOW *win, chtype ch)
 {
-	int	y, x;
+	chtype obch;
+	int y, x;
 
 #ifdef DEBUG
 	__CTRACE(__CTRACE_ATTR, "wbkgd: (%p), '%s', %08x\n",
 	win, unctrl(ch & __CHARTEXT), ch & __ATTRIBUTES);
 #endif
+	obch = win->bch;
 	wbkgdset(win, ch);
 
-	for (y = 0; y < win->maxy; y++)
+	for (y = 0; y < win->maxy; y++) {
 		for (x = 0; x < win->maxx; x++) {
-			/* Copy character if space */
-			if (ch & __CHARTEXT && win->alines[y]->line[x].ch == ' ')
-win->alines[y]->line[x].ch = ch & __CHARTEXT;
-			/* Merge attributes */
-			if (win->alines[y]->line[x].attr & __ALTCHARSET)
-win->alines[y]->line[x].attr =
-(ch & __ATTRIBUTES) | __ALTCHARSET;
-			else
-win->alines[y]->line[x].attr =
-ch & __ATTRIBUTES;
+			__LDATA *cp = >alines[y]->line[x];
+
+			/* Update/switch background characters */
+			if (cp->ch == obch)
+cp->ch = win->bch;
+
+			/* Update/merge attributes */
+			cp->attr = win->battr | (cp->attr & __ALTCHARSET);
 #ifdef HAVE_WCHAR
-			SET_WCOL(win->alines[y]->line[x], 1);
+			SET_WCOL(*cp, 1);
 #endif
 		}
+	}
 	__touchwin(win);
-	return(OK);
+	return OK;
 }
 
 /*



CVS commit: src/sys/arch

2018-11-19 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Nov 19 20:28:01 UTC 2018

Modified Files:
src/sys/arch/amd64/include: pmap.h
src/sys/arch/i386/include: pmap.h
src/sys/arch/x86/include: pmap.h
src/sys/arch/x86/x86: pmap.c svs.c

Log Message:
Rename 'mask' -> 'frame', we will use the real 'mask' soon.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/amd64/include/pmap.h
cvs rdiff -u -r1.119 -r1.120 src/sys/arch/i386/include/pmap.h
cvs rdiff -u -r1.89 -r1.90 src/sys/arch/x86/include/pmap.h
cvs rdiff -u -r1.310 -r1.311 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/x86/x86/svs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/include/pmap.h
diff -u src/sys/arch/amd64/include/pmap.h:1.56 src/sys/arch/amd64/include/pmap.h:1.57
--- src/sys/arch/amd64/include/pmap.h:1.56	Wed Aug 29 06:28:50 2018
+++ src/sys/arch/amd64/include/pmap.h	Mon Nov 19 20:28:01 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.56 2018/08/29 06:28:50 maxv Exp $	*/
+/*	$NetBSD: pmap.h,v 1.57 2018/11/19 20:28:01 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -150,7 +150,7 @@ extern pt_entry_t *pte_base;
 #define NKL2_START_ENTRIES	0
 #define NKL1_START_ENTRIES	0
 
-#define PTP_MASK_INITIALIZER	{ L1_FRAME, L2_FRAME, L3_FRAME, L4_FRAME }
+#define PTP_FRAME_INITIALIZER	{ L1_FRAME, L2_FRAME, L3_FRAME, L4_FRAME }
 #define PTP_SHIFT_INITIALIZER	{ L1_SHIFT, L2_SHIFT, L3_SHIFT, L4_SHIFT }
 #define NKPTP_INITIALIZER	{ NKL1_START_ENTRIES, NKL2_START_ENTRIES, \
   NKL3_START_ENTRIES, NKL4_START_ENTRIES }

Index: src/sys/arch/i386/include/pmap.h
diff -u src/sys/arch/i386/include/pmap.h:1.119 src/sys/arch/i386/include/pmap.h:1.120
--- src/sys/arch/i386/include/pmap.h:1.119	Wed Jul 25 11:47:07 2018
+++ src/sys/arch/i386/include/pmap.h	Mon Nov 19 20:28:01 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.119 2018/07/25 11:47:07 maxv Exp $	*/
+/*	$NetBSD: pmap.h,v 1.120 2018/11/19 20:28:01 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -267,7 +267,7 @@
 #endif  /* !XEN */
 #define NPDPG			(PAGE_SIZE / sizeof (pd_entry_t))
 
-#define PTP_MASK_INITIALIZER	{ L1_FRAME, L2_FRAME }
+#define PTP_FRAME_INITIALIZER	{ L1_FRAME, L2_FRAME }
 #define PTP_SHIFT_INITIALIZER	{ L1_SHIFT, L2_SHIFT }
 #define NKPTP_INITIALIZER	{ NKL1_START_ENTRIES, NKL2_START_ENTRIES }
 #define NKPTPMAX_INITIALIZER	{ NKL1_MAX_ENTRIES, NKL2_MAX_ENTRIES }

Index: src/sys/arch/x86/include/pmap.h
diff -u src/sys/arch/x86/include/pmap.h:1.89 src/sys/arch/x86/include/pmap.h:1.90
--- src/sys/arch/x86/include/pmap.h:1.89	Wed Nov  7 07:14:51 2018
+++ src/sys/arch/x86/include/pmap.h	Mon Nov 19 20:28:01 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.89 2018/11/07 07:14:51 maxv Exp $	*/
+/*	$NetBSD: pmap.h,v 1.90 2018/11/19 20:28:01 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -86,9 +86,9 @@
 #define pl3_i(VA)	(((VA_SIGN_POS(VA)) & L3_FRAME) >> L3_SHIFT)
 #define pl4_i(VA)	(((VA_SIGN_POS(VA)) & L4_FRAME) >> L4_SHIFT)
 #define pl_i(va, lvl) \
-(((VA_SIGN_POS(va)) & ptp_masks[(lvl)-1]) >> ptp_shifts[(lvl)-1])
+(((VA_SIGN_POS(va)) & ptp_frames[(lvl)-1]) >> ptp_shifts[(lvl)-1])
 
-#define	pl_i_roundup(va, lvl)	pl_i((va)+ ~ptp_masks[(lvl)-1], (lvl))
+#define	pl_i_roundup(va, lvl)	pl_i((va)+ ~ptp_frames[(lvl)-1], (lvl))
 
 /*
  * PTP macros:

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.310 src/sys/arch/x86/x86/pmap.c:1.311
--- src/sys/arch/x86/x86/pmap.c:1.310	Wed Nov  7 07:14:51 2018
+++ src/sys/arch/x86/x86/pmap.c	Mon Nov 19 20:28:01 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.310 2018/11/07 07:14:51 maxv Exp $	*/
+/*	$NetBSD: pmap.c,v 1.311 2018/11/19 20:28:01 maxv Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.310 2018/11/07 07:14:51 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.311 2018/11/19 20:28:01 maxv Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -239,7 +239,7 @@ __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.3
  *   lock it when adding or removing pmaps from this list.
  */
 
-const vaddr_t ptp_masks[] = PTP_MASK_INITIALIZER;
+const vaddr_t ptp_frames[] = PTP_FRAME_INITIALIZER;
 const int ptp_shifts[] = PTP_SHIFT_INITIALIZER;
 const long nkptpmax[] = NKPTPMAX_INITIALIZER;
 const long nbpd[] = NBPD_INITIALIZER;
@@ -3539,7 +3539,7 @@ pmap_remove(struct pmap *pmap, vaddr_t s
 			/*
 			 * skip a range corresponding to an invalid pde.
 			 */
-			blkendva = (va & ptp_masks[lvl - 1]) + nbpd[lvl - 1];
+			blkendva = (va & ptp_frames[lvl - 1]) + nbpd[lvl - 1];
  			continue;
 		}
 

Index: src/sys/arch/x86/x86/svs.c
diff -u src/sys/arch/x86/x86/svs.c:1.20 src/sys/arch/x86/x86/svs.c:1.21
--- 

CVS commit: src/distrib

2018-11-19 Thread Aymeric Vincent
Module Name:src
Committed By:   aymeric
Date:   Mon Nov 19 20:05:37 UTC 2018

Modified Files:
src/distrib/amd64/uefi-installimage: Makefile.bootimage
src/distrib/common/bootimage: Makefile.bootimage

Log Message:
Make building boot images work with xz sets on non-NetBSD hosts.

NetBSD gzip is not toolified so we can't assume the host gzip will be able
to decompress xz files. Use the toolified xz instead in the USE_XZ_SETS case.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/distrib/amd64/uefi-installimage/Makefile.bootimage
cvs rdiff -u -r1.18 -r1.19 src/distrib/common/bootimage/Makefile.bootimage

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/amd64/uefi-installimage/Makefile.bootimage
diff -u src/distrib/amd64/uefi-installimage/Makefile.bootimage:1.7 src/distrib/amd64/uefi-installimage/Makefile.bootimage:1.8
--- src/distrib/amd64/uefi-installimage/Makefile.bootimage:1.7	Sun Oct  7 10:33:44 2018
+++ src/distrib/amd64/uefi-installimage/Makefile.bootimage	Mon Nov 19 20:05:37 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.bootimage,v 1.7 2018/10/07 10:33:44 martin Exp $
+#	$NetBSD: Makefile.bootimage,v 1.8 2018/11/19 20:05:37 aymeric Exp $
 #
 # Copyright (c) 2009, 2010, 2011 Izumi Tsutsui.  All rights reserved.
 #
@@ -228,6 +228,7 @@ SETS_DEFAULT+=	xbase xcomp xetc xfont xs
 .endif
 
 KERN_SET?=	kern-GENERIC
+COMPRESS_PROGRAM=${"${USE_XZ_SETS:Uno}"!="no":?${TOOL_XZ}:${TOOL_GZIP}}
 TAR_SUFF=	${"${USE_XZ_SETS:Uno}"!="no":?tar.xz:tgz}
 SETS?=		${SETS_DEFAULT}
 IMG_SETS=	${KERN_SET} ${SETS}
@@ -263,7 +264,9 @@ ${TARGETFS}: prepare_md_post pre-targetf
 		false; 			\
 	fi
 	@echo Extracting ${set}.${TAR_SUFF} ...
-	@(cd ${WORKDIR}; ${TOOL_PAX} ${PAX_TIMESTAMP} -rnz -f ${SETS_DIR}/${set}.${TAR_SUFF} .)
+	@(cd ${WORKDIR}; ${TOOL_PAX} ${PAX_TIMESTAMP} -rn \
+		--use-compress-program=${COMPRESS_PROGRAM:Q} \
+		-f ${SETS_DIR}/${set}.${TAR_SUFF} .)
 .endfor
 .if defined(SECONDARY_BOOT)
 	@echo Copying secondary boot...

Index: src/distrib/common/bootimage/Makefile.bootimage
diff -u src/distrib/common/bootimage/Makefile.bootimage:1.18 src/distrib/common/bootimage/Makefile.bootimage:1.19
--- src/distrib/common/bootimage/Makefile.bootimage:1.18	Sun Oct  7 18:07:00 2018
+++ src/distrib/common/bootimage/Makefile.bootimage	Mon Nov 19 20:05:37 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.bootimage,v 1.18 2018/10/07 18:07:00 martin Exp $
+#	$NetBSD: Makefile.bootimage,v 1.19 2018/11/19 20:05:37 aymeric Exp $
 #
 # Copyright (c) 2009, 2010, 2011 Izumi Tsutsui.  All rights reserved.
 #
@@ -217,6 +217,7 @@ WORKFSTAB?=	work.fstab
 WORKRCCONF?=	work.rc.conf
 WORKFS?=work.rootfs
 TARGETFS?=  imgroot.fs
+COMPRESS_PROGRAM=${"${USE_XZ_SETS:Uno}"!="no":?${TOOL_XZ}:${TOOL_GZIP}}
 TAR_SUFF=	${"${USE_XZ_SETS:Uno}"!="no":?tar.xz:tgz}
 
 CLEANFILES+=	${WORKSPEC} ${WORKFSTAB} ${WORKRCCONF} ${WORKFS}
@@ -237,7 +238,9 @@ ${TARGETFS}: prepare_md_post
 		false; 			\
 	fi
 	@echo Extracting ${set}.${TAR_SUFF} ...
-	@(cd ${WORKDIR}; ${TOOL_PAX} ${PAX_TIMESTAMP} -rnz -f ${SETS_DIR}/${set}.${TAR_SUFF} .)
+	@(cd ${WORKDIR}; ${TOOL_PAX} ${PAX_TIMESTAMP} -rn \
+		--use-compress-program=${COMPRESS_PROGRAM:Q} \
+		-f ${SETS_DIR}/${set}.${TAR_SUFF} .)
 .endfor
 .if defined(SECONDARY_BOOT)
 	@echo Copying secondary boot...



CVS commit: src

2018-11-19 Thread Aymeric Vincent
Module Name:src
Committed By:   aymeric
Date:   Mon Nov 19 20:00:28 UTC 2018

Modified Files:
src/share/mk: bsd.own.mk
src/tools/xz-bin: Makefile

Log Message:
Prepend ${_TOOL_PREFIX} to xz, too.


To generate a diff of this commit:
cvs rdiff -u -r1.1083 -r1.1084 src/share/mk/bsd.own.mk
cvs rdiff -u -r1.1 -r1.2 src/tools/xz-bin/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1083 src/share/mk/bsd.own.mk:1.1084
--- src/share/mk/bsd.own.mk:1.1083	Thu Nov 15 09:23:50 2018
+++ src/share/mk/bsd.own.mk	Mon Nov 19 20:00:28 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1083 2018/11/15 09:23:50 martin Exp $
+#	$NetBSD: bsd.own.mk,v 1.1084 2018/11/19 20:00:28 aymeric Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -420,7 +420,7 @@ TOOL_NCDCS=		${TOOLDIR}/bin/${_TOOL_PREF
 TOOL_PAX=		${TOOLDIR}/bin/${_TOOL_PREFIX}pax
 TOOL_PIC=		${TOOLDIR}/bin/${_TOOL_PREFIX}pic
 TOOL_PIGZ=		${TOOLDIR}/bin/${_TOOL_PREFIX}pigz
-TOOL_XZ=		${TOOLDIR}/bin/xz
+TOOL_XZ=		${TOOLDIR}/bin/${_TOOL_PREFIX}xz
 TOOL_PKG_CREATE=	${TOOLDIR}/bin/${_TOOL_PREFIX}pkg_create
 TOOL_POWERPCMKBOOTIMAGE=${TOOLDIR}/bin/${_TOOL_PREFIX}powerpc-mkbootimage
 TOOL_PWD_MKDB=		${TOOLDIR}/bin/${_TOOL_PREFIX}pwd_mkdb

Index: src/tools/xz-bin/Makefile
diff -u src/tools/xz-bin/Makefile:1.1 src/tools/xz-bin/Makefile:1.2
--- src/tools/xz-bin/Makefile:1.1	Tue Sep 25 05:42:08 2018
+++ src/tools/xz-bin/Makefile	Mon Nov 19 20:00:28 2018
@@ -1,6 +1,6 @@
-#	$NetBSD: Makefile,v 1.1 2018/09/25 05:42:08 joerg Exp $
+#	$NetBSD: Makefile,v 1.2 2018/11/19 20:00:28 aymeric Exp $
 
-HOSTPROG=	xz
+HOSTPROG=	${_TOOL_PREFIX}xz
 HOST_SRCDIR=	external/public-domain/xz/bin/xz
 
 .include "${.PARSEDIR}/../xz-include/Makefile.inc"



CVS commit: src/sys/dev/ic

2018-11-19 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Nov 19 19:52:08 UTC 2018

Modified Files:
src/sys/dev/ic: ahcisata_core.c siisata.c

Log Message:
consistently use the SATA correct 'port %d' instead of 'channel', some
whitespace fixes


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/ic/ahcisata_core.c
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/ic/siisata.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/ahcisata_core.c
diff -u src/sys/dev/ic/ahcisata_core.c:1.66 src/sys/dev/ic/ahcisata_core.c:1.67
--- src/sys/dev/ic/ahcisata_core.c:1.66	Fri Nov  2 21:27:30 2018
+++ src/sys/dev/ic/ahcisata_core.c	Mon Nov 19 19:52:08 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_core.c,v 1.66 2018/11/02 21:27:30 jdolecek Exp $	*/
+/*	$NetBSD: ahcisata_core.c,v 1.67 2018/11/19 19:52:08 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.66 2018/11/02 21:27:30 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_core.c,v 1.67 2018/11/19 19:52:08 jdolecek Exp $");
 
 #include 
 #include 
@@ -456,19 +456,19 @@ ahci_attach(struct ahci_softc *sc)
 		ahci_setup_port(sc, i);
 		if (bus_space_subregion(sc->sc_ahcit, sc->sc_ahcih,
 		AHCI_P_SSTS(i), 4,  >ahcic_sstatus) != 0) {
-			aprint_error("%s: couldn't map channel %d "
+			aprint_error("%s: couldn't map port %d "
 			"sata_status regs\n", AHCINAME(sc), i);
 			break;
 		}
 		if (bus_space_subregion(sc->sc_ahcit, sc->sc_ahcih,
 		AHCI_P_SCTL(i), 4,  >ahcic_scontrol) != 0) {
-			aprint_error("%s: couldn't map channel %d "
+			aprint_error("%s: couldn't map port %d "
 			"sata_control regs\n", AHCINAME(sc), i);
 			break;
 		}
 		if (bus_space_subregion(sc->sc_ahcit, sc->sc_ahcih,
 		AHCI_P_SERR(i), 4,  >ahcic_serror) != 0) {
-			aprint_error("%s: couldn't map channel %d "
+			aprint_error("%s: couldn't map port %d "
 			"sata_error regs\n", AHCINAME(sc), i);
 			break;
 		}
@@ -771,14 +771,14 @@ ahci_exec_fis(struct ata_channel *chp, i
  */
 return ERROR;
 			}
-			aprint_debug("%s channel %d: error 0x%x sending FIS\n",
+			aprint_debug("%s port %d: error 0x%x sending FIS\n",
 			AHCINAME(sc), chp->ch_channel, is);
 			return ERR_DF;
 		}
 		ata_delay(chp, 10, "ahcifis", flags);
 	}
 
-	aprint_debug("%s channel %d: timeout sending FIS\n",
+	aprint_debug("%s port %d: timeout sending FIS\n",
 	AHCINAME(sc), chp->ch_channel);
 	return TIMEOUT;
 }
@@ -829,10 +829,10 @@ again:
 	cmd_tbl->cmdt_cfis[fis_type] = RHD_FISTYPE;
 	cmd_tbl->cmdt_cfis[rhd_c] = drive;
 	cmd_tbl->cmdt_cfis[rhd_control] = WDCTL_RST;
-	switch(ahci_exec_fis(chp, 100, flags, c_slot)) {
+	switch (ahci_exec_fis(chp, 100, flags, c_slot)) {
 	case ERR_DF:
 	case TIMEOUT:
-		aprint_error("%s channel %d: setting WDCTL_RST failed "
+		aprint_error("%s port %d: setting WDCTL_RST failed "
 		"for drive %d\n", AHCINAME(sc), chp->ch_channel, drive);
 		if (sigp)
 			*sigp = 0x;
@@ -847,7 +847,7 @@ again:
 	cmd_tbl->cmdt_cfis[fis_type] = RHD_FISTYPE;
 	cmd_tbl->cmdt_cfis[rhd_c] = drive;
 	cmd_tbl->cmdt_cfis[rhd_control] = 0;
-	switch(ahci_exec_fis(chp, 310, flags, c_slot)) {
+	switch (ahci_exec_fis(chp, 310, flags, c_slot)) {
 	case ERR_DF:
 	case TIMEOUT:
 		if ((sc->sc_ahci_quirks & AHCI_QUIRK_BADPMPRESET) != 0 &&
@@ -861,7 +861,7 @@ again:
 			ahci_channel_stop(sc, chp, flags);
 			goto again;
 		}
-		aprint_error("%s channel %d: clearing WDCTL_RST failed "
+		aprint_error("%s port %d: clearing WDCTL_RST failed "
 		"for drive %d\n", AHCINAME(sc), chp->ch_channel, drive);
 		if (sigp)
 			*sigp = 0x;
@@ -930,7 +930,7 @@ ahci_reset_channel(struct ata_channel *c
 	ahci_channel_start(sc, chp, flags,
 	(sc->sc_ahci_cap & AHCI_CAP_CLO) ? 1 : 0);
 	/* wait 31s for BSY to clear */
-	for (i = 0; i ch_channel));
 		if ((AHCI_TFD_ST(tfd) & WDCS_BSY) == 0)
 			break;
@@ -1193,7 +1193,7 @@ ahci_cmd_kill_xfer(struct ata_channel *c
 	struct ata_command *ata_c = >c_ata_c;
 	bool deactivate = true;
 
-	AHCIDEBUG_PRINT(("ahci_cmd_kill_xfer channel %d\n", chp->ch_channel),
+	AHCIDEBUG_PRINT(("ahci_cmd_kill_xfer port %d\n", chp->ch_channel),
 	DEBUG_FUNCS);
 
 	switch (reason) {
@@ -1226,7 +1226,7 @@ ahci_cmd_complete(struct ata_channel *ch
 	struct ata_command *ata_c = >c_ata_c;
 	struct ahci_channel *achp = (struct ahci_channel *)chp;
 
-	AHCIDEBUG_PRINT(("ahci_cmd_complete channel %d CMD 0x%x CI 0x%x\n",
+	AHCIDEBUG_PRINT(("ahci_cmd_complete port %d CMD 0x%x CI 0x%x\n",
 	chp->ch_channel,
 	AHCI_READ(AHCI_CH2SC(chp), AHCI_P_CMD(chp->ch_channel)),
 	AHCI_READ(AHCI_CH2SC(chp), AHCI_P_CI(chp->ch_channel))),
@@ -1268,7 +1268,7 @@ ahci_cmd_done(struct ata_channel *chp, s
 	uint16_t *idwordbuf;
 	int i;
 
-	AHCIDEBUG_PRINT(("ahci_cmd_done channel %d flags %#x/%#x\n",
+	AHCIDEBUG_PRINT(("ahci_cmd_done port %d flags 

CVS commit: src/distrib/sets/lists/comp

2018-11-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Nov 19 19:10:39 UTC 2018

Modified Files:
src/distrib/sets/lists/comp: md.amd64

Log Message:
add nvmm lint library


To generate a diff of this commit:
cvs rdiff -u -r1.262 -r1.263 src/distrib/sets/lists/comp/md.amd64

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/comp/md.amd64
diff -u src/distrib/sets/lists/comp/md.amd64:1.262 src/distrib/sets/lists/comp/md.amd64:1.263
--- src/distrib/sets/lists/comp/md.amd64:1.262	Sun Nov 11 07:03:07 2018
+++ src/distrib/sets/lists/comp/md.amd64	Mon Nov 19 14:10:39 2018
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.262 2018/11/11 12:03:07 maxv Exp $
+# $NetBSD: md.amd64,v 1.263 2018/11/19 19:10:39 christos Exp $
 
 ./usr/include/amd64comp-c-include
 ./usr/include/amd64/ansi.h			comp-c-include
@@ -860,6 +860,7 @@
 ./usr/libdata/ldscripts/i386nbsd.xn		comp-util-bin		binutils
 ./usr/libdata/ldscripts/i386nbsd.xr		comp-util-bin		binutils
 ./usr/libdata/ldscripts/i386nbsd.xu		comp-util-bin		binutils
+./usr/libdata/lint/llib-lnvmm.ln		comp-c-lintlib		lint
 ./usr/libdata/lint/llib-lx86_64.ln		comp-c-lintlib		lint
 ./usr/share/ldscripts/elf_i386.x		comp-obsolete		obsolete
 ./usr/share/ldscripts/elf_i386.xbn		comp-obsolete		obsolete



CVS commit: src/share/misc

2018-11-19 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Mon Nov 19 18:29:59 UTC 2018

Modified Files:
src/share/misc: acronyms.comp

Log Message:
"What You See Is All You Get" - Brian Kernighan


To generate a diff of this commit:
cvs rdiff -u -r1.216 -r1.217 src/share/misc/acronyms.comp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/misc/acronyms.comp
diff -u src/share/misc/acronyms.comp:1.216 src/share/misc/acronyms.comp:1.217
--- src/share/misc/acronyms.comp:1.216	Tue Sep 25 20:50:10 2018
+++ src/share/misc/acronyms.comp	Mon Nov 19 18:29:59 2018
@@ -1,4 +1,4 @@
-$NetBSD: acronyms.comp,v 1.216 2018/09/25 20:50:10 sevan Exp $
+$NetBSD: acronyms.comp,v 1.217 2018/11/19 18:29:59 sevan Exp $
 3WHS	three-way handshake
 8VSB	8-state vestigial side band modulation
 AA	anti-aliasing
@@ -1548,6 +1548,7 @@ WS	web services
 WTC	write through caching
 WWAN	wireless wide area network
 WWW	world wide web
+WYSIAYG	what you see is all you get
 WYSIWYG	what you see is what you get
 XBAR	crossbar
 XDMCP	X Display Manager control protocol



CVS commit: src/sys/dev/nvmm/x86

2018-11-19 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Nov 19 17:35:12 UTC 2018

Modified Files:
src/sys/dev/nvmm/x86: nvmm_x86_svm.c

Log Message:
Rename one constant, for clarity.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/nvmm/x86/nvmm_x86_svm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/nvmm/x86/nvmm_x86_svm.c
diff -u src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.3 src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.4
--- src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.3	Wed Nov 14 19:14:40 2018
+++ src/sys/dev/nvmm/x86/nvmm_x86_svm.c	Mon Nov 19 17:35:12 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm_x86_svm.c,v 1.3 2018/11/14 19:14:40 maxv Exp $	*/
+/*	$NetBSD: nvmm_x86_svm.c,v 1.4 2018/11/19 17:35:12 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.3 2018/11/14 19:14:40 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.4 2018/11/19 17:35:12 maxv Exp $");
 
 #include 
 #include 
@@ -770,7 +770,7 @@ svm_exit_cpuid(struct nvmm_machine *mach
 #define SVM_EXIT_IO_SZ8		__BIT(4)
 #define SVM_EXIT_IO_REP		__BIT(3)
 #define SVM_EXIT_IO_STR		__BIT(2)
-#define SVM_EXIT_IO_TYPE	__BIT(0)
+#define SVM_EXIT_IO_IN		__BIT(0)
 
 static const int seg_to_nvmm[] = {
 	[0] = NVMM_X64_SEG_ES,
@@ -791,7 +791,7 @@ svm_exit_io(struct nvmm_machine *mach, s
 
 	exit->reason = NVMM_EXIT_IO;
 
-	if (info & SVM_EXIT_IO_TYPE) {
+	if (info & SVM_EXIT_IO_IN) {
 		exit->u.io.type = NVMM_EXIT_IO_IN;
 	} else {
 		exit->u.io.type = NVMM_EXIT_IO_OUT;



CVS commit: src/usr.sbin/sysinst

2018-11-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 19 17:17:43 UTC 2018

Modified Files:
src/usr.sbin/sysinst: defs.h util.c

Log Message:
Split positional argument string expansion from msg display, we can make
good use of it elsewhere too.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/sysinst/defs.h
cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/sysinst/util.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/sysinst/defs.h
diff -u src/usr.sbin/sysinst/defs.h:1.26 src/usr.sbin/sysinst/defs.h:1.27
--- src/usr.sbin/sysinst/defs.h:1.26	Thu Nov 15 10:23:32 2018
+++ src/usr.sbin/sysinst/defs.h	Mon Nov 19 17:17:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.26 2018/11/15 10:23:32 martin Exp $	*/
+/*	$NetBSD: defs.h,v 1.27 2018/11/19 17:17:43 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -553,6 +553,7 @@ void	do_reinstall_sets(void);
 void	restore_etc(void);
 
 /* from util.c */
+char*	str_arg_subst(const char *, size_t, const char **);
 void	msg_display_subst(const char *, size_t, ...);
 int	ask_yesno(const char *);
 int	ask_noyes(const char *);

Index: src/usr.sbin/sysinst/util.c
diff -u src/usr.sbin/sysinst/util.c:1.17 src/usr.sbin/sysinst/util.c:1.18
--- src/usr.sbin/sysinst/util.c:1.17	Thu Nov 15 10:23:32 2018
+++ src/usr.sbin/sysinst/util.c	Mon Nov 19 17:17:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: util.c,v 1.17 2018/11/15 10:23:32 martin Exp $	*/
+/*	$NetBSD: util.c,v 1.18 2018/11/19 17:17:43 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1795,29 +1795,17 @@ set_postfix(const char *set_name)
 }
 
 /*
- * Replace positional arguments (encoded as $0 .. $N) in the
- * message by the strings passed as ...
+ * Replace positional arguments (encoded as $0 .. $N) in the string
+ * passed by the contents of the passed argument array.
+ * Caller must free() the result string.
  */
-void
-msg_display_subst(const char *master, size_t argc, ...)
+char*
+str_arg_subst(const char *src, size_t argc, const char **argv)
 {
-	va_list ap;
-	const char **args, **arg;
-	const char *src, *p, *last;
+	const char *p, *last;
 	char *out, *t;
 	size_t len;
 
-	args = malloc(sizeof(const char *)*argc);
-	if (args == NULL)
-		return;
-
-	arg = args;
-	va_start(ap, argc);
-	for (size_t i = 0; i < argc; i++)
-		*arg++ = va_arg(ap, const char*);
-	va_end(ap);
-
-	src = msg_string(master);
 	len = strlen(src);
 	for (p = strchr(src, '$'); p; p = strchr(p+1, '$')) {
 		char *endp = NULL;
@@ -1827,17 +1815,15 @@ msg_display_subst(const char *master, si
 		/* $ followed by a correct numeric position? */
 		n = strtou(p+1, , 10, 0, INT_MAX, );
 		if ((e == 0 || e == ENOTSUP) && n < argc) {
-			len += strlen(args[n]);
+			len += strlen(argv[n]);
 			len -= endp-p;
 			p = endp-1;
 		}
 	}
 
 	out = malloc(len+1);
-	if (out == NULL) {
-		free(args);
-		return;
-	}
+	if (out == NULL)
+		return NULL;
 
 	t = out;
 	for (last = src, p = strchr(src, '$'); p; p = strchr(p+1, '$')) {
@@ -1851,8 +1837,8 @@ msg_display_subst(const char *master, si
 			size_t l = p-last;
 			memcpy(t, last, l);
 			t += l;
-			strcpy(t, args[n]);
-			t += strlen(args[n]);
+			strcpy(t, argv[n]);
+			t += strlen(argv[n]);
 			last = endp;
 		}
 	}
@@ -1864,9 +1850,35 @@ msg_display_subst(const char *master, si
 	}
 	assert((size_t)(t-out) == len);
 
-	msg_display(out);
+	return out;
+}
+
+/*
+ * Replace positional arguments (encoded as $0 .. $N) in the
+ * message by the strings passed as ...
+ */
+void
+msg_display_subst(const char *master, size_t argc, ...)
+{
+	va_list ap;
+	const char **args, **arg;
+	char *out;
+
+	args = malloc(sizeof(const char *)*argc);
+	if (args == NULL)
+		return;
+
+	arg = args;
+	va_start(ap, argc);
+	for (size_t i = 0; i < argc; i++)
+		*arg++ = va_arg(ap, const char*);
+	va_end(ap);
 
-	free(out);
+	out = str_arg_subst(msg_string(master), argc, args);
+	if (out != NULL) {
+		msg_display(out);
+		free(out);
+	}
 	free(args);
 }
 



CVS commit: src/sys/arch/amd64/include

2018-11-19 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Nov 19 15:43:32 UTC 2018

Modified Files:
src/sys/arch/amd64/include: frame.h

Log Message:
Fix editing screwup in previous...   noted by Rin Okuyama (thanks!)


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/amd64/include/frame.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/include/frame.h
diff -u src/sys/arch/amd64/include/frame.h:1.19 src/sys/arch/amd64/include/frame.h:1.20
--- src/sys/arch/amd64/include/frame.h:1.19	Mon Nov 19 10:05:09 2018
+++ src/sys/arch/amd64/include/frame.h	Mon Nov 19 15:43:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: frame.h,v 1.19 2018/11/19 10:05:09 kre Exp $	*/
+/*	$NetBSD: frame.h,v 1.20 2018/11/19 15:43:32 kre Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -101,8 +101,8 @@ struct intrframe {
 /*
  * Need arch independany way to access IP and CS from intrframe
  */
-#define	_INTRFRAME_IP	if_tf.tf_cs
-#define	_INTRFRAME_CS	if_tf.tf_rip
+#define	_INTRFRAME_CS	if_tf.tf_cs
+#define	_INTRFRAME_IP	if_tf.tf_rip
 #endif
 
 /*



CVS commit: src/sys/arch/arm/fdt

2018-11-19 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Nov 19 13:54:15 UTC 2018

Modified Files:
src/sys/arch/arm/fdt: gicv3_fdt.c

Log Message:
avoid NULL deref in gicv3_fdt_disestablish()


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/fdt/gicv3_fdt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/fdt/gicv3_fdt.c
diff -u src/sys/arch/arm/fdt/gicv3_fdt.c:1.4 src/sys/arch/arm/fdt/gicv3_fdt.c:1.5
--- src/sys/arch/arm/fdt/gicv3_fdt.c:1.4	Sat Nov 10 01:24:06 2018
+++ src/sys/arch/arm/fdt/gicv3_fdt.c	Mon Nov 19 13:54:15 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3_fdt.c,v 1.4 2018/11/10 01:24:06 jmcneill Exp $ */
+/* $NetBSD: gicv3_fdt.c,v 1.5 2018/11/19 13:54:15 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2015-2018 Jared McNeill 
@@ -29,7 +29,7 @@
 #define	_INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gicv3_fdt.c,v 1.4 2018/11/10 01:24:06 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gicv3_fdt.c,v 1.5 2018/11/19 13:54:15 jakllsch Exp $");
 
 #include 
 #include 
@@ -310,7 +310,7 @@ gicv3_fdt_disestablish(device_t dev, voi
 
 	for (n = 0; n < GICV3_MAXIRQ; n++) {
 		firq = sc->sc_irq[n];
-		if (firq->intr_ih != ih)
+		if (firq == NULL || firq->intr_ih != ih)
 			continue;
 
 		KASSERT(firq->intr_refcnt > 0);



CVS commit: src/sys/arch/evbarm/conf

2018-11-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Nov 19 13:28:48 UTC 2018

Removed Files:
src/sys/arch/evbarm/conf: RPI64

Log Message:
Remove RPI64 in favour of GENERIC64.  RPI64 was used during testing.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r0 src/sys/arch/evbarm/conf/RPI64

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/arm/fdt

2018-11-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Nov 19 11:08:16 UTC 2018

Modified Files:
src/sys/arch/arm/fdt: pcihost_fdt.c

Log Message:
Clear PCI_FLAGS_IO_OKAY as we don't support it yet.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/fdt/pcihost_fdt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/fdt/pcihost_fdt.c
diff -u src/sys/arch/arm/fdt/pcihost_fdt.c:1.5 src/sys/arch/arm/fdt/pcihost_fdt.c:1.6
--- src/sys/arch/arm/fdt/pcihost_fdt.c:1.5	Fri Nov 16 19:32:01 2018
+++ src/sys/arch/arm/fdt/pcihost_fdt.c	Mon Nov 19 11:08:16 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: pcihost_fdt.c,v 1.5 2018/11/16 19:32:01 jakllsch Exp $ */
+/* $NetBSD: pcihost_fdt.c,v 1.6 2018/11/19 11:08:16 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pcihost_fdt.c,v 1.5 2018/11/16 19:32:01 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcihost_fdt.c,v 1.6 2018/11/19 11:08:16 jmcneill Exp $");
 
 #include 
 #include 
@@ -203,15 +203,14 @@ pcihost_attach(device_t parent, device_t
 	pba.pba_flags = PCI_FLAGS_MRL_OKAY |
 			PCI_FLAGS_MRM_OKAY |
 			PCI_FLAGS_MWI_OKAY |
-			PCI_FLAGS_MEM_OKAY |
-			PCI_FLAGS_IO_OKAY;
+			PCI_FLAGS_MEM_OKAY;
 #ifdef __HAVE_PCI_MSI_MSIX
 	if (sc->sc_type == PCIHOST_ECAM) {
 		pba.pba_flags |= PCI_FLAGS_MSI_OKAY |
  PCI_FLAGS_MSIX_OKAY;
 	}
 #endif
-	pba.pba_iot = sc->sc_bst;
+	pba.pba_iot = 0;
 	pba.pba_memt = sc->sc_bst;
 	pba.pba_dmat = sc->sc_dmat;
 #ifdef _PCI_HAVE_DMA64



CVS commit: src/sys/external/bsd/drm2/include/linux/regulator

2018-11-19 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Mon Nov 19 10:48:59 UTC 2018

Modified Files:
src/sys/external/bsd/drm2/include/linux/regulator: consumer.h

Log Message:
include machine/limits.h for INT_MAX


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/include/linux/regulator/consumer.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/include/linux/regulator/consumer.h
diff -u src/sys/external/bsd/drm2/include/linux/regulator/consumer.h:1.4 src/sys/external/bsd/drm2/include/linux/regulator/consumer.h:1.5
--- src/sys/external/bsd/drm2/include/linux/regulator/consumer.h:1.4	Mon Aug 27 15:29:54 2018
+++ src/sys/external/bsd/drm2/include/linux/regulator/consumer.h	Mon Nov 19 10:48:59 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: consumer.h,v 1.4 2018/08/27 15:29:54 riastradh Exp $	*/
+/*	$NetBSD: consumer.h,v 1.5 2018/11/19 10:48:59 maya Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -38,6 +38,7 @@
 
 #ifdef FDT
 
+#include 
 #include 
 
 struct regulator {



CVS commit: src/sys/arch

2018-11-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Nov 19 10:45:48 UTC 2018

Modified Files:
src/sys/arch/aarch64/aarch64: bus_space.c
src/sys/arch/arm/acpi: acpipchb.c
src/sys/arch/arm/arm32: armv7_generic_space.c
src/sys/arch/arm/include: bus_defs.h

Log Message:
On second thought, get rid of "bs_base" from struct bus_space and use a
custom bs_map for acpipchb instead.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/aarch64/aarch64/bus_space.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/acpi/acpipchb.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/arm32/armv7_generic_space.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/include/bus_defs.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/aarch64/aarch64/bus_space.c
diff -u src/sys/arch/aarch64/aarch64/bus_space.c:1.6 src/sys/arch/aarch64/aarch64/bus_space.c:1.7
--- src/sys/arch/aarch64/aarch64/bus_space.c:1.6	Sun Nov 18 20:21:48 2018
+++ src/sys/arch/aarch64/aarch64/bus_space.c	Mon Nov 19 10:45:47 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_space.c,v 1.6 2018/11/18 20:21:48 jmcneill Exp $ */
+/* $NetBSD: bus_space.c,v 1.7 2018/11/19 10:45:47 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: bus_space.c,v 1.6 2018/11/18 20:21:48 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bus_space.c,v 1.7 2018/11/19 10:45:47 jmcneill Exp $");
 
 #include 
 #include 
@@ -46,7 +46,6 @@ bs_protos(generic_dsb)
 struct bus_space arm_generic_bs_tag = {
 	.bs_cookie = _generic_bs_tag,
 
-	.bs_base = 0,
 	.bs_stride = 0,
 	.bs_flags = 0,
 
@@ -169,7 +168,6 @@ struct bus_space arm_generic_bs_tag = {
 struct bus_space aarch64_generic_dsb_bs_tag = {
 	.bs_cookie = _generic_dsb_bs_tag,
 
-	.bs_base = 0,
 	.bs_stride = 0,
 	.bs_flags = 0,
 
@@ -292,7 +290,6 @@ struct bus_space aarch64_generic_dsb_bs_
 struct bus_space arm_generic_a4x_bs_tag = {
 	.bs_cookie = _generic_a4x_bs_tag,
 
-	.bs_base = 0,
 	.bs_stride = 2,
 	.bs_flags = 0,
 
@@ -415,7 +412,6 @@ struct bus_space arm_generic_a4x_bs_tag 
 struct bus_space aarch64_generic_a4x_dsb_bs_tag = {
 	.bs_cookie = _generic_a4x_dsb_bs_tag,
 
-	.bs_base = 0,
 	.bs_stride = 2,
 	.bs_flags = 0,
 
@@ -539,15 +535,11 @@ int
 generic_bs_map(void *t, bus_addr_t bpa, bus_size_t size, int flag,
 bus_space_handle_t *bshp)
 {
-	const struct bus_space *bs = t;
 	const struct pmap_devmap *pd;
 	paddr_t startpa, endpa, pa;
 	vaddr_t va;
 	int pmapflags;
 
-	if (bs)
-		bpa += bs->bs_base;
-
 	if ((pd = pmap_devmap_find_pa(bpa, size)) != NULL) {
 		*bshp = pd->pd_va + (bpa - pd->pd_pa);
 		return 0;

Index: src/sys/arch/arm/acpi/acpipchb.c
diff -u src/sys/arch/arm/acpi/acpipchb.c:1.6 src/sys/arch/arm/acpi/acpipchb.c:1.7
--- src/sys/arch/arm/acpi/acpipchb.c:1.6	Sun Nov 18 20:22:20 2018
+++ src/sys/arch/arm/acpi/acpipchb.c	Mon Nov 19 10:45:47 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: acpipchb.c,v 1.6 2018/11/18 20:22:20 jmcneill Exp $ */
+/* $NetBSD: acpipchb.c,v 1.7 2018/11/19 10:45:47 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpipchb.c,v 1.6 2018/11/18 20:22:20 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpipchb.c,v 1.7 2018/11/19 10:45:47 jmcneill Exp $");
 
 #include 
 #include 
@@ -59,6 +59,17 @@ __KERNEL_RCSID(0, "$NetBSD: acpipchb.c,v
 
 #define	PCIHOST_CACHELINE_SIZE		arm_dcache_align
 
+struct acpipchb_bus_space {
+	struct bus_space	bs;
+
+	bus_addr_t		min;
+	bus_addr_t		max;
+	bus_addr_t		offset;
+
+	int			(*map)(void *, bus_addr_t, bus_size_t,
+   int, bus_space_handle_t *);
+};
+
 struct acpipchb_softc {
 	device_t		sc_dev;
 
@@ -68,7 +79,7 @@ struct acpipchb_softc {
 	ACPI_HANDLE		sc_handle;
 	ACPI_INTEGER		sc_bus;
 
-	struct bus_space	sc_pciio_bst;
+	struct acpipchb_bus_space sc_pciio_bst;
 };
 
 static struct arm32_dma_range ahcipchb_coherent_ranges[] = {
@@ -163,11 +174,24 @@ struct acpipchb_setup_pciio_args {
 	struct pcibus_attach_args *pba;
 };
 
+static int
+acpipchb_bus_space_map(void *t, bus_addr_t bpa, bus_size_t size, int flag,
+bus_space_handle_t *bshp)
+{
+	struct acpipchb_bus_space * const abs = t;
+
+	if (bpa < abs->min || bpa + size >= abs->max)
+		return ERANGE;
+
+	return abs->map(t, bpa + abs->offset, size, flag, bshp);
+}
+
 static ACPI_STATUS
 acpipchb_setup_pciio_cb(ACPI_RESOURCE *res, void *ctx)
 {
 	struct acpipchb_setup_pciio_args * const args = ctx;
 	struct acpipchb_softc * const sc = args->sc;
+	struct acpipchb_bus_space * const abs = >sc_pciio_bst;
 	struct pcibus_attach_args *pba = args->pba;
 
 	if (res->Type != ACPI_RESOURCE_TYPE_ADDRESS32 &&
@@ -177,23 +201,27 @@ acpipchb_setup_pciio_cb(ACPI_RESOURCE *r
 	if (res->Data.Address.ResourceType != ACPI_IO_RANGE)
 		return AE_OK;
 
-	sc->sc_pciio_bst = *pba->pba_memt;
-	sc->sc_pciio_bst.bs_cookie = >sc_pciio_bst;
+	abs->bs 

CVS commit: src/sys/dev

2018-11-19 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Mon Nov 19 10:14:40 UTC 2018

Modified Files:
src/sys/dev: audio_dai.h

Log Message:
include less headers, just the right one, suggested by thorpej


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/audio_dai.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/audio_dai.h
diff -u src/sys/dev/audio_dai.h:1.3 src/sys/dev/audio_dai.h:1.4
--- src/sys/dev/audio_dai.h:1.3	Mon Nov 19 09:23:05 2018
+++ src/sys/dev/audio_dai.h	Mon Nov 19 10:14:40 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: audio_dai.h,v 1.3 2018/11/19 09:23:05 maya Exp $ */
+/* $NetBSD: audio_dai.h,v 1.4 2018/11/19 10:14:40 maya Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -29,8 +29,7 @@
 #ifndef _DEV_AUDIO_DAI_H
 #define _DEV_AUDIO_DAI_H
 
-#include 
-
+#include 
 #include 
 
 #define	AUDIO_DAI_FORMAT_MASK		__BITS(3,0)



CVS commit: src/sys/arch

2018-11-19 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Nov 19 10:05:09 UTC 2018

Modified Files:
src/sys/arch/amd64/include: frame.h
src/sys/arch/i386/include: frame.h
src/sys/arch/xen/x86: hypervisor_machdep.c

Log Message:
Hide differences between i386 and amd64 interrupt frames so XEN does
not need to know there is one.   Hopefully unbreak i386 build.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/amd64/include/frame.h
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/i386/include/frame.h
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/xen/x86/hypervisor_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/include/frame.h
diff -u src/sys/arch/amd64/include/frame.h:1.18 src/sys/arch/amd64/include/frame.h:1.19
--- src/sys/arch/amd64/include/frame.h:1.18	Wed Jun 14 00:40:05 2017
+++ src/sys/arch/amd64/include/frame.h	Mon Nov 19 10:05:09 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: frame.h,v 1.18 2017/06/14 00:40:05 chs Exp $	*/
+/*	$NetBSD: frame.h,v 1.19 2018/11/19 10:05:09 kre Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -97,6 +97,14 @@ struct intrframe {
 	struct trapframe if_tf;
 };
 
+#ifdef XEN
+/*
+ * Need arch independany way to access IP and CS from intrframe
+ */
+#define	_INTRFRAME_IP	if_tf.tf_cs
+#define	_INTRFRAME_CS	if_tf.tf_rip
+#endif
+
 /*
  * Stack frame inside cpu_switchto()
  */

Index: src/sys/arch/i386/include/frame.h
diff -u src/sys/arch/i386/include/frame.h:1.37 src/sys/arch/i386/include/frame.h:1.38
--- src/sys/arch/i386/include/frame.h:1.37	Sat Aug 12 13:11:23 2017
+++ src/sys/arch/i386/include/frame.h	Mon Nov 19 10:05:09 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: frame.h,v 1.37 2017/08/12 13:11:23 maxv Exp $	*/
+/*	$NetBSD: frame.h,v 1.38 2018/11/19 10:05:09 kre Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -129,6 +129,14 @@ struct intrframe {
 	int	if_ss;
 };
 
+#ifdef XEN
+/*
+ * need arch independant way to access ip and cs from intrframe
+ */
+#define	_INTRFRAME_CS	if_cs
+#define	_INTRFRAME_IP	if_eip
+#endif
+
 /*
  * Stack frame inside cpu_switchto()
  */

Index: src/sys/arch/xen/x86/hypervisor_machdep.c
diff -u src/sys/arch/xen/x86/hypervisor_machdep.c:1.32 src/sys/arch/xen/x86/hypervisor_machdep.c:1.33
--- src/sys/arch/xen/x86/hypervisor_machdep.c:1.32	Sun Nov 18 23:50:48 2018
+++ src/sys/arch/xen/x86/hypervisor_machdep.c	Mon Nov 19 10:05:09 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: hypervisor_machdep.c,v 1.32 2018/11/18 23:50:48 cherry Exp $	*/
+/*	$NetBSD: hypervisor_machdep.c,v 1.33 2018/11/19 10:05:09 kre Exp $	*/
 
 /*
  *
@@ -54,7 +54,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.32 2018/11/18 23:50:48 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.33 2018/11/19 10:05:09 kre Exp $");
 
 #include 
 #include 
@@ -263,8 +263,8 @@ do_hypervisor_callback(struct intrframe 
 
 	/* Save trapframe for clock handler */
 	KASSERT(regs != NULL);
-	ci->ci_xen_clockf_usermode = USERMODE(regs->if_tf.tf_cs);
-	ci->ci_xen_clockf_pc = regs->if_tf.tf_rip;
+	ci->ci_xen_clockf_usermode = USERMODE(regs->_INTRFRAME_CS);
+	ci->ci_xen_clockf_pc = regs->_INTRFRAME_IP;
 
 	// DDD printf("do_hypervisor_callback\n");
 



CVS commit: src/sys/dev

2018-11-19 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Mon Nov 19 09:23:05 UTC 2018

Modified Files:
src/sys/dev: audio_dai.h

Log Message:
include sys/param.h for EINVAL used in this header.

(Make it more standalone)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/audio_dai.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/audio_dai.h
diff -u src/sys/dev/audio_dai.h:1.2 src/sys/dev/audio_dai.h:1.3
--- src/sys/dev/audio_dai.h:1.2	Fri May 11 22:48:55 2018
+++ src/sys/dev/audio_dai.h	Mon Nov 19 09:23:05 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: audio_dai.h,v 1.2 2018/05/11 22:48:55 jmcneill Exp $ */
+/* $NetBSD: audio_dai.h,v 1.3 2018/11/19 09:23:05 maya Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -29,6 +29,8 @@
 #ifndef _DEV_AUDIO_DAI_H
 #define _DEV_AUDIO_DAI_H
 
+#include 
+
 #include 
 
 #define	AUDIO_DAI_FORMAT_MASK		__BITS(3,0)



CVS commit: src/external/apache2/mDNSResponder/dist/mDNSPosix

2018-11-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Nov 19 08:14:28 UTC 2018

Modified Files:
src/external/apache2/mDNSResponder/dist/mDNSPosix: mDNSPosix.c

Log Message:
It is not an error if we did not find any IPv4 interfaces. It could
be the case we never have V4 interfaces (in a V6 system) so this
is bogus. The code was recently changed to ignore loopback interfaces.
If mdnsd was started too early, this means that no interfaces would
be found (since interfaces down, with no addresses, or tentative
are ignored). I put back the loopback interfaces yesterday to avoid
this error, but this seems like the left hand not knowing what the
right hand does because whoever removed the loopback interfaces
from the list, did not read the 'self discovery' comment and the
special code that deals with loopback in this file. Nevertheless,
I think it is better to ignore the loopback interfaces in the long
run, but it is ok to keep them around since the code is handling
them just fine (and works both with and without them).


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 \
src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c
diff -u src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.15 src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.16
--- src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c:1.15	Sun Feb 25 15:04:56 2018
+++ src/external/apache2/mDNSResponder/dist/mDNSPosix/mDNSPosix.c	Mon Nov 19 03:14:28 2018
@@ -977,7 +977,9 @@ mDNSlocal int SetupInterfaceList(mDNS *c
 assert(m != NULL);
 debugf("SetupInterfaceList");
 
+#if 0
 if (intfList == NULL) err = ENOENT;
+#endif
 
 #if HAVE_IPV6
 if (err == 0)   /* Link the IPv6 list to the end of the IPv4 list */