CVS commit: src/sys/dev/mii

2019-01-06 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jan  7 05:01:11 UTC 2019

Modified Files:
src/sys/dev/mii: rlphy.c

Log Message:
 Fix a bug that rlphy might ignore the link partner's advertised speed.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/mii/rlphy.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/mii/rlphy.c
diff -u src/sys/dev/mii/rlphy.c:1.30 src/sys/dev/mii/rlphy.c:1.31
--- src/sys/dev/mii/rlphy.c:1.30	Thu Jul  7 06:55:41 2016
+++ src/sys/dev/mii/rlphy.c	Mon Jan  7 05:01:10 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rlphy.c,v 1.30 2016/07/07 06:55:41 msaitoh Exp $	*/
+/*	$NetBSD: rlphy.c,v 1.31 2019/01/07 05:01:10 msaitoh Exp $	*/
 /*	$OpenBSD: rlphy.c,v 1.20 2005/07/31 05:27:30 pvalchev Exp $	*/
 
 /*
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rlphy.c,v 1.30 2016/07/07 06:55:41 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rlphy.c,v 1.31 2019/01/07 05:01:10 msaitoh Exp $");
 
 #include 
 #include 
@@ -209,7 +209,7 @@ rlphy_status(struct mii_softc *sc)
 	struct rlphy_softc *rsc = (void *)sc;
 	struct mii_data *mii = sc->mii_pdata;
 	struct ifmedia_entry *ife = mii->mii_media.ifm_cur;
-	int bmsr, bmcr, anlpar;
+	int bmsr, bmcr, anar, anlpar, result;
 
 	mii->mii_media_status = IFM_AVALID;
 	mii->mii_media_active = IFM_ETHER;
@@ -240,17 +240,19 @@ rlphy_status(struct mii_softc *sc)
 			return;
 		}
 
-		if ((anlpar = PHY_READ(sc, MII_ANAR) &
-		PHY_READ(sc, MII_ANLPAR))) {
-			if (anlpar & ANLPAR_TX_FD)
+		anar = PHY_READ(sc, MII_ANAR);
+		anlpar = PHY_READ(sc, MII_ANLPAR);
+		result = anar & anlpar;
+		if (result != 0) {
+			if (result & ANLPAR_TX_FD)
 mii->mii_media_active |= IFM_100_TX|IFM_FDX;
-			else if (anlpar & ANLPAR_T4)
+			else if (result & ANLPAR_T4)
 mii->mii_media_active |= IFM_100_T4|IFM_HDX;
-			else if (anlpar & ANLPAR_TX)
+			else if (result & ANLPAR_TX)
 mii->mii_media_active |= IFM_100_TX|IFM_HDX;
-			else if (anlpar & ANLPAR_10_FD)
+			else if (result & ANLPAR_10_FD)
 mii->mii_media_active |= IFM_10_T|IFM_FDX;
-			else if (anlpar & ANLPAR_10)
+			else if (result & ANLPAR_10)
 mii->mii_media_active |= IFM_10_T|IFM_HDX;
 			else
 mii->mii_media_active |= IFM_NONE;



CVS commit: src/sys/dev/usb

2019-01-06 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Jan  7 03:00:39 UTC 2019

Modified Files:
src/sys/dev/usb: xhci.c xhcivar.h

Log Message:
Seperate xHCI and xhci(4) TRB structs so as to avoid some of them
(the ones that the hardware doesn't touch) ending up less-aligned
than the compiler assumed.

Additionally, fix the most obvious problems that xhci(4) had on
big endian systems.

Briefly tested on a Jetson TK1 in LE and BE w/ evbarm GENERIC kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/dev/usb/xhci.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/usb/xhcivar.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/usb/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.100 src/sys/dev/usb/xhci.c:1.101
--- src/sys/dev/usb/xhci.c:1.100	Sun Oct 28 21:36:34 2018
+++ src/sys/dev/usb/xhci.c	Mon Jan  7 03:00:39 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.100 2018/10/28 21:36:34 mrg Exp $	*/
+/*	$NetBSD: xhci.c,v 1.101 2019/01/07 03:00:39 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.100 2018/10/28 21:36:34 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.101 2019/01/07 03:00:39 jakllsch Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -155,9 +155,9 @@ static void xhci_host_dequeue(struct xhc
 static usbd_status xhci_set_dequeue(struct usbd_pipe *);
 
 static usbd_status xhci_do_command(struct xhci_softc * const,
-struct xhci_trb * const, int);
+struct xhci_soft_trb * const, int);
 static usbd_status xhci_do_command_locked(struct xhci_softc * const,
-struct xhci_trb * const, int);
+struct xhci_soft_trb * const, int);
 static usbd_status xhci_init_slot(struct usbd_device *, uint32_t);
 static void xhci_free_slot(struct xhci_softc *, struct xhci_slot *, int, int);
 static usbd_status xhci_set_address(struct usbd_device *, uint32_t, bool);
@@ -505,6 +505,15 @@ xhci_ring_trbp(struct xhci_ring * const 
 }
 
 static inline void
+xhci_soft_trb_put(struct xhci_soft_trb * const trb,
+uint64_t parameter, uint32_t status, uint32_t control)
+{
+	trb->trb_0 = parameter;
+	trb->trb_2 = status;
+	trb->trb_3 = control;
+}
+
+static inline void
 xhci_trb_put(struct xhci_trb * const trb, uint64_t parameter, uint32_t status,
 uint32_t control)
 {
@@ -1385,7 +1394,7 @@ xhci_configure_endpoint(struct usbd_pipe
 #ifdef USB_DEBUG
 	const u_int dci = xhci_ep_get_dci(pipe->up_endpoint->ue_edesc);
 #endif
-	struct xhci_trb trb;
+	struct xhci_soft_trb trb;
 	usbd_status err;
 
 	XHCIHIST_FUNC(); XHCIHIST_CALLED();
@@ -1441,7 +1450,7 @@ xhci_reset_endpoint_locked(struct usbd_p
 	struct xhci_softc * const sc = XHCI_PIPE2SC(pipe);
 	struct xhci_slot * const xs = pipe->up_dev->ud_hcpriv;
 	const u_int dci = xhci_ep_get_dci(pipe->up_endpoint->ue_edesc);
-	struct xhci_trb trb;
+	struct xhci_soft_trb trb;
 	usbd_status err;
 
 	XHCIHIST_FUNC(); XHCIHIST_CALLED();
@@ -1482,7 +1491,7 @@ xhci_stop_endpoint(struct usbd_pipe *pip
 {
 	struct xhci_softc * const sc = XHCI_PIPE2SC(pipe);
 	struct xhci_slot * const xs = pipe->up_dev->ud_hcpriv;
-	struct xhci_trb trb;
+	struct xhci_soft_trb trb;
 	usbd_status err;
 	const u_int dci = xhci_ep_get_dci(pipe->up_endpoint->ue_edesc);
 
@@ -1517,7 +1526,7 @@ xhci_set_dequeue_locked(struct usbd_pipe
 	struct xhci_slot * const xs = pipe->up_dev->ud_hcpriv;
 	const u_int dci = xhci_ep_get_dci(pipe->up_endpoint->ue_edesc);
 	struct xhci_ring * const xr = >xs_ep[dci].xe_tr;
-	struct xhci_trb trb;
+	struct xhci_soft_trb trb;
 	usbd_status err;
 
 	XHCIHIST_FUNC(); XHCIHIST_CALLED();
@@ -1631,7 +1640,7 @@ xhci_close_pipe(struct usbd_pipe *pipe)
 	struct xhci_slot * const xs = pipe->up_dev->ud_hcpriv;
 	usb_endpoint_descriptor_t * const ed = pipe->up_endpoint->ue_edesc;
 	const u_int dci = xhci_ep_get_dci(ed);
-	struct xhci_trb trb;
+	struct xhci_soft_trb trb;
 	uint32_t *cp;
 
 	XHCIHIST_FUNC(); XHCIHIST_CALLED();
@@ -2532,7 +2541,7 @@ xhci_ring_free(struct xhci_softc * const
 
 static void
 xhci_ring_put(struct xhci_softc * const sc, struct xhci_ring * const xr,
-void *cookie, struct xhci_trb * const trbs, size_t ntrbs)
+void *cookie, struct xhci_soft_trb * const trbs, size_t ntrbs)
 {
 	size_t i;
 	u_int ri;
@@ -2687,7 +2696,7 @@ xhci_abort_command(struct xhci_softc *sc
  */
 static usbd_status
 xhci_do_command_locked(struct xhci_softc * const sc,
-struct xhci_trb * const trb, int timeout)
+struct xhci_soft_trb * const trb, int timeout)
 {
 	struct xhci_ring * const cr = >sc_cr;
 	usbd_status err;
@@ -2757,7 +2766,7 @@ timedout:
 }
 
 static usbd_status
-xhci_do_command(struct xhci_softc * const sc, struct xhci_trb * const trb,
+xhci_do_command(struct xhci_softc * const sc, struct xhci_soft_trb * const trb,
 int timeout)
 {
 
@@ -2771,7 +2780,7 @@ xhci_do_command(struct xhci_softc * cons
 static usbd_status
 xhci_enable_slot(struct 

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

2019-01-06 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Mon Jan  7 01:44:59 UTC 2019

Modified Files:
src/sys/arch/macppc/conf: GENERIC_601 GENERIC_MD INSTALL INSTALL_601

Log Message:
increase MEMORY_DISK_ROOT_SIZE slightly to avoid running out of space
when doing some sysinst options.

Add ahc and rtk options for my testing convenience.  The 601 kernels
are still small enough for netbooting.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/macppc/conf/GENERIC_601
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/macppc/conf/GENERIC_MD
cvs rdiff -u -r1.128 -r1.129 src/sys/arch/macppc/conf/INSTALL
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/macppc/conf/INSTALL_601

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/macppc/conf/GENERIC_601
diff -u src/sys/arch/macppc/conf/GENERIC_601:1.22 src/sys/arch/macppc/conf/GENERIC_601:1.23
--- src/sys/arch/macppc/conf/GENERIC_601:1.22	Mon Nov 12 20:03:42 2018
+++ src/sys/arch/macppc/conf/GENERIC_601	Mon Jan  7 01:44:59 2019
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC_601,v 1.22 2018/11/12 20:03:42 scole Exp $
+# $NetBSD: GENERIC_601,v 1.23 2019/01/07 01:44:59 scole Exp $
 #
 # GENERIC machine description file
 # 
@@ -28,7 +28,7 @@ include 	"arch/macppc/conf/std.macppc.60
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-ident 		"GENERIC-$Revision: 1.22 $"
+ident 		"GENERIC-$Revision: 1.23 $"
 
 maxusers	32
 
@@ -207,7 +207,7 @@ pchb*	at pci? dev ? function ?	# PCI-Hos
 ppb*	at pci? dev ? function ?	# PCI-PCI bridges
 
 # PCI SCSI controllers
-#ahc*	at pci? dev ? function ?	# Adaptec 294x, aic78x0 SCSI
+ahc*	at pci? dev ? function ?	# Adaptec 294x, aic78x0 SCSI
 
 # Display devices
 #
@@ -371,8 +371,8 @@ pseudo-device   drvctl
 
 #options PAX_MPROTECT=0			# PaX mprotect(2) restrictions
 
-#rlphy*	at mii? phy ?			# Realtek 8139/8201L PHYs
-#rtk*	at pci? dev ? function ?	# Realtek 8129/8139
+rlphy*	at mii? phy ?			# Realtek 8139/8201L PHYs
+rtk*	at pci? dev ? function ?	# Realtek 8129/8139
 
 #rgephy* at mii? phy ?			# Realtek 8169S/8110S internal PHYs
 #ral*	at pci? dev ? function ?	# Ralink Technology RT25x0 802.11a/b/g

Index: src/sys/arch/macppc/conf/GENERIC_MD
diff -u src/sys/arch/macppc/conf/GENERIC_MD:1.16 src/sys/arch/macppc/conf/GENERIC_MD:1.17
--- src/sys/arch/macppc/conf/GENERIC_MD:1.16	Sun Aug 10 17:58:51 2014
+++ src/sys/arch/macppc/conf/GENERIC_MD	Mon Jan  7 01:44:59 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: GENERIC_MD,v 1.16 2014/08/10 17:58:51 joerg Exp $
+#	$NetBSD: GENERIC_MD,v 1.17 2019/01/07 01:44:59 scole Exp $
 #
 # GENERIC_MD config file
 #
@@ -8,5 +8,5 @@ include "arch/macppc/conf/GENERIC"
 # Enable the hooks used for initializing the ram-disk.
 options 	MEMORY_DISK_HOOKS
 options 	MEMORY_DISK_IS_ROOT	# Force root on ram-disk
-options 	MEMORY_DISK_ROOT_SIZE=5120	# 2560 KiB
+options 	MEMORY_DISK_ROOT_SIZE=5760	# 2880 KiB
 options 	MEMORY_DISK_RBFLAGS=RB_SINGLE	# boot in single-user mode

Index: src/sys/arch/macppc/conf/INSTALL
diff -u src/sys/arch/macppc/conf/INSTALL:1.128 src/sys/arch/macppc/conf/INSTALL:1.129
--- src/sys/arch/macppc/conf/INSTALL:1.128	Fri Aug 31 18:11:20 2018
+++ src/sys/arch/macppc/conf/INSTALL	Mon Jan  7 01:44:59 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: INSTALL,v 1.128 2018/08/31 18:11:20 sevan Exp $
+#	$NetBSD: INSTALL,v 1.129 2019/01/07 01:44:59 scole Exp $
 #
 # config file for INSTALL FLOPPY
 #
@@ -17,7 +17,7 @@ options 	RTC_OFFSET=0	# hardware clock i
 options 	MEMORY_DISK_HOOKS
 options 	MEMORY_DISK_IS_ROOT	# Force root on ram-disk
 options 	MEMORY_DISK_SERVER=0	# no userspace memory disk support
-options 	MEMORY_DISK_ROOT_SIZE=5120	# 2560 KiB
+options 	MEMORY_DISK_ROOT_SIZE=5760	# 2880 KiB
 options 	MEMORY_DISK_RBFLAGS=RB_SINGLE	# boot in single-user mode
 
 options 	USERCONF	# userconf(4) support

Index: src/sys/arch/macppc/conf/INSTALL_601
diff -u src/sys/arch/macppc/conf/INSTALL_601:1.1 src/sys/arch/macppc/conf/INSTALL_601:1.2
--- src/sys/arch/macppc/conf/INSTALL_601:1.1	Mon Nov 12 20:07:47 2018
+++ src/sys/arch/macppc/conf/INSTALL_601	Mon Jan  7 01:44:59 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: INSTALL_601,v 1.1 2018/11/12 20:07:47 scole Exp $
+#	$NetBSD: INSTALL_601,v 1.2 2019/01/07 01:44:59 scole Exp $
 #
 # config file for INSTALL
 #
@@ -19,7 +19,7 @@ options 	RTC_OFFSET=0	# hardware clock i
 options 	MEMORY_DISK_HOOKS
 options 	MEMORY_DISK_IS_ROOT	# Force root on ram-disk
 options 	MEMORY_DISK_SERVER=0	# no userspace memory disk support
-options 	MEMORY_DISK_ROOT_SIZE=5120	# 2560 KiB
+options 	MEMORY_DISK_ROOT_SIZE=5760	# 2880 KiB
 options 	MEMORY_DISK_RBFLAGS=RB_SINGLE	# boot in single-user mode
 
 options 	USERCONF	# userconf(4) support
@@ -72,6 +72,9 @@ pci*	at ppb? bus ?
 pchb*	at pci? dev ? function ?	# PCI-Host bridges
 ppb*	at pci? dev ? function ?	# PCI-PCI bridges
 
+# PCI SCSI controllers
+ahc*	at pci? dev ? function ?	# Adaptec 294x, aic78x0 SCSI
+
 # Display devices
 #
 # The 7200's onboard 

CVS commit: src/sys/dev

2019-01-06 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jan  7 01:43:22 UTC 2019

Modified Files:
src/sys/dev/mii: inbmphyreg.h
src/sys/dev/pci: if_wm.c

Log Message:
 Add EEE(802.3az) support for I350, I210, I211, PCH2 and newer.

 Not yet for I354(C2000). It'll be supported after implementing MI MII clause
45 register read/write API.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/mii/inbmphyreg.h
cvs rdiff -u -r1.613 -r1.614 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/mii/inbmphyreg.h
diff -u src/sys/dev/mii/inbmphyreg.h:1.15 src/sys/dev/mii/inbmphyreg.h:1.16
--- src/sys/dev/mii/inbmphyreg.h:1.15	Thu Dec 20 09:32:12 2018
+++ src/sys/dev/mii/inbmphyreg.h	Mon Jan  7 01:43:22 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: inbmphyreg.h,v 1.15 2018/12/20 09:32:12 msaitoh Exp $	*/
+/*	$NetBSD: inbmphyreg.h,v 1.16 2019/01/07 01:43:22 msaitoh Exp $	*/
 /***
 Copyright (c) 2001-2015, Intel Corporation 
 All rights reserved.
@@ -78,6 +78,19 @@ POSSIBILITY OF SUCH DAMAGE.
 #define BME1000_PSCR_DOWNSHIFT_COUNTER_MASK 0x7000
 #define BME1000_PSCR_DOWNSHIFT_COUNTER_SHIFT12
 
+/* Extended Management Interface (EMI) Registers */
+#define I82579_EMI_ADDR	0x10
+#define I82579_EMI_DATA	0x11
+#define I82579_EEE_ADVERTISEMENT 0x040e  /* IEEE MMD Register 7.60 */
+#define I82579_EEE_LP_ABILITY	0x040f   /* IEEE MMD Register 7.61 */
+#define I82579_EEE_PCS_STATUS	0x182e
+#define I82579_LPI_PLL_SHUT	0x4412
+#define I82579_LPI_PLL_SHUT_100		__BIT(2) /* 100M LPI PLL Shut Enable */
+#define I217_EEE_PCS_STATUS	0x9401   /* IEEE MMD Register 3.1 */
+#define I217_EEE_CAPABILITY	0x8000   /* IEEE MMD Register 3.20 */
+#define I217_EEE_ADVERTISEMENT	0x8001   /* IEEE MMD Register 7.60 */
+#define I217_EEE_LP_ABILITY	0x8002   /* IEEE MMD Register 7.61 */
+
 /* BM PHY Copper Specific Status */
 #define BM_CS_STATUS		BME1000_REG(0, 17)
 #define BM_CS_STATUS_LINK_UP	0x0400

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.613 src/sys/dev/pci/if_wm.c:1.614
--- src/sys/dev/pci/if_wm.c:1.613	Thu Jan  3 08:46:03 2019
+++ src/sys/dev/pci/if_wm.c	Mon Jan  7 01:43:22 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.613 2019/01/03 08:46:03 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.614 2019/01/07 01:43:22 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.613 2019/01/03 08:46:03 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.614 2019/01/07 01:43:22 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -129,6 +129,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -514,7 +515,9 @@ struct wm_softc {
 	int sc_funcid;			/* unit number of the chip (0 to 3) */
 	int sc_flags;			/* flags; see below */
 	int sc_if_flags;		/* last if_flags */
+	int sc_ec_capenable;		/* last ec_capenable */
 	int sc_flowflags;		/* 802.3x flow control flags */
+	uint16_t eee_lp_ability;	/* EEE link partner's ability */
 	int sc_align_tweak;
 
 	void *sc_ihs[WM_MAX_NINTR];	/*
@@ -852,10 +855,16 @@ static int	wm_kmrn_readreg(struct wm_sof
 static int	wm_kmrn_readreg_locked(struct wm_softc *, int, uint16_t *);
 static int	wm_kmrn_writereg(struct wm_softc *, int, uint16_t);
 static int	wm_kmrn_writereg_locked(struct wm_softc *, int, uint16_t);
+/* EMI register related */
+static int	wm_access_emi_reg_locked(device_t, int, uint16_t *, bool);
+static int	wm_read_emi_reg_locked(device_t, int, uint16_t *);
+static int	wm_write_emi_reg_locked(device_t, int, uint16_t);
 /* SGMII */
 static bool	wm_sgmii_uses_mdio(struct wm_softc *);
 static int	wm_sgmii_readreg(device_t, int, int);
+static int	wm_sgmii_readreg_locked(device_t, int, int, uint16_t *);
 static void	wm_sgmii_writereg(device_t, int, int, int);
+static int	wm_sgmii_writereg_locked(device_t, int, int, uint16_t);
 /* TBI related */
 static bool	wm_tbi_havesignal(struct wm_softc *, uint32_t);
 static void	wm_tbi_mediainit(struct wm_softc *);
@@ -967,7 +976,9 @@ static void	wm_disable_aspm(struct wm_so
 /* LPLU (Low Power Link Up) */
 static void	wm_lplu_d0_disable(struct wm_softc *);
 /* EEE */
-static void	wm_set_eee_i350(struct wm_softc *);
+static int	wm_set_eee_i350(struct wm_softc *);
+static int	wm_set_eee_pchlan(struct wm_softc *);
+static int	wm_set_eee(struct wm_softc *);
 
 /*
  * Workarounds (mainly PHY related).
@@ -2758,12 +2769,22 @@ alloc_retry:
 			sc->sc_mediatype = WM_MEDIATYPE_COPPER;
 		}
 	}
-	snprintb(buf, sizeof(buf), WM_FLAGS, sc->sc_flags);
-	aprint_verbose_dev(sc->sc_dev, "%s\n", buf);
+
+	if (sc->sc_type >= WM_T_PCH2)
+		sc->sc_flags |= WM_F_EEE;
+	else if ((sc->sc_type >= WM_T_I350) && (sc->sc_type <= WM_T_I211)
+	&& (sc->sc_mediatype 

CVS commit: src/distrib/macppc/floppies/ramdisk

2019-01-06 Thread Sean Cole
Module Name:src
Committed By:   scole
Date:   Mon Jan  7 01:39:26 UTC 2019

Modified Files:
src/distrib/macppc/floppies/ramdisk: Makefile

Log Message:
increase IMAGESIZE slightly to avoid running out of space when doing some 
sysinst options


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/distrib/macppc/floppies/ramdisk/Makefile

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

Modified files:

Index: src/distrib/macppc/floppies/ramdisk/Makefile
diff -u src/distrib/macppc/floppies/ramdisk/Makefile:1.49 src/distrib/macppc/floppies/ramdisk/Makefile:1.50
--- src/distrib/macppc/floppies/ramdisk/Makefile:1.49	Mon Nov 12 20:11:39 2018
+++ src/distrib/macppc/floppies/ramdisk/Makefile	Mon Jan  7 01:39:26 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.49 2018/11/12 20:11:39 scole Exp $
+#	$NetBSD: Makefile,v 1.50 2019/01/07 01:39:26 scole Exp $
 
 .include 
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -8,7 +8,7 @@ IMAGE=		ramdisk.fs
 #   src/sys/arch/macppc/conf/INSTALL
 #   src/sys/arch/macppc/conf/INSTALL_601
 #   src/sys/arch/macppc/conf/GENERIC_MD
-IMAGESIZE=	2560k
+IMAGESIZE=	2880k
 MAKEFS_FLAGS+=	-f 15
 
 WARNS=		1



CVS commit: src/sys/dev/mii

2019-01-06 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jan  7 01:37:05 UTC 2019

Modified Files:
src/sys/dev/mii: mdio.h

Log Message:
 Add definitions of EEE advertisement(7.60) and EEE LP ability(7.61).


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/mii/mdio.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/mii/mdio.h
diff -u src/sys/dev/mii/mdio.h:1.9 src/sys/dev/mii/mdio.h:1.10
--- src/sys/dev/mii/mdio.h:1.9	Fri Jul  6 01:58:12 2018
+++ src/sys/dev/mii/mdio.h	Mon Jan  7 01:37:05 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: mdio.h,v 1.9 2018/07/06 01:58:12 msaitoh Exp $	*/
+/*	$NetBSD: mdio.h,v 1.10 2019/01/07 01:37:05 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -633,7 +633,22 @@
 #define MDIO_AN_BPETHSTAT	48  /* BP Ethernet status */
 	/* Values 49 to 59 are reserved */
 #define	MDIO_AN_EEEADVERT	60  /* EEE advertisement */
+#define	AN_EEEADVERT_100G_CR4	0x2000	/* 100GBASE-CR4 */
+#define	AN_EEEADVERT_100G_KR4	0x1000	/* 100GBASE-KR4 */
+#define	AN_EEEADVERT_100G_KP4	0x0800	/* 100GBASE-KP4 */
+#define	AN_EEEADVERT_100G_CR10	0x0400	/* 100GBASE-CR10 */
+#define	AN_EEEADVERT_40G_CR4	0x0100	/* 40GBASE-CR4 */
+#define	AN_EEEADVERT_40G_KR4	0x0080	/* 40GBASE-KR4 */
+#define	AN_EEEADVERT_10G_KR	0x0040	/* 10GBASE-KR */
+#define	AN_EEEADVERT_10G_KX4	0x0020	/* 10GBASE-KX4 */
+#define	AN_EEEADVERT_1000_KX	0x0010	/* 1000BASE-KX */
+#define	AN_EEEADVERT_10G_T	0x0008	/* 10GBASE-T */
+#define	AN_EEEADVERT_1000_T	0x0004	/* 1000BASE-T */
+#define	AN_EEEADVERT_100_TX	0x0002	/* 100BASE-TX */
+
 #define	MDIO_AN_EEELPABLTY	61  /* EEE LP ability */
+	/* bitmap is the same as MDIO_AN_EEEADVERT(7.60) */
+
 	/* Values 62 to 32767 are reserved */
 	/* Values 32768 to 65535 are vendor specific */
 



CVS commit: src/sys/dev/hdaudio

2019-01-06 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Jan  7 01:03:05 UTC 2019

Modified Files:
src/sys/dev/hdaudio: hdaudioreg.h

Log Message:
s/1 << 31/1u << 31/.

XXX someone could __BIT() etc this file.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/hdaudio/hdaudioreg.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/hdaudio/hdaudioreg.h
diff -u src/sys/dev/hdaudio/hdaudioreg.h:1.2 src/sys/dev/hdaudio/hdaudioreg.h:1.3
--- src/sys/dev/hdaudio/hdaudioreg.h:1.2	Sat Oct 28 06:24:24 2017
+++ src/sys/dev/hdaudio/hdaudioreg.h	Mon Jan  7 01:03:05 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudioreg.h,v 1.2 2017/10/28 06:24:24 riastradh Exp $ */
+/* $NetBSD: hdaudioreg.h,v 1.3 2019/01/07 01:03:05 mrg Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd 
@@ -65,10 +65,10 @@
 #define	 HDAUDIO_STATESTS_SDIWAKE	0x7fff
 #define	HDAUDIO_MMIO_GSTS	0x010
 #define	HDAUDIO_MMIO_INTCTL	0x020
-#define	 HDAUDIO_INTCTL_GIE		(1 << 31)
+#define	 HDAUDIO_INTCTL_GIE		(1u << 31)
 #define	 HDAUDIO_INTCTL_CIE		(1 << 30)
 #define	HDAUDIO_MMIO_INTSTS	0x024
-#define	 HDAUDIO_INTSTS_GIS		(1 << 31)
+#define	 HDAUDIO_INTSTS_GIS		(1u << 31)
 #define	 HDAUDIO_INTSTS_CIS		(1 << 30)
 #define	 HDAUDIO_INTSTS_SIS_MASK	0x3fff
 #define	HDAUDIO_MMIO_WALCLK	0x030
@@ -225,7 +225,7 @@
 #define	  COP_GPIO_COUNT_NUM_GPIO(x)		  ((x) & 0xff)
 #define	 COP_VOLUME_KNOB_CAPABILITIES		 0x13
 #define	 COP_HDMI_LPCM_CAD			 0x20
-#define	  COP_LPCM_CAD_44_1_MS			  (1 << 31)
+#define	  COP_LPCM_CAD_44_1_MS			  (1u << 31)
 #define	  COP_LPCM_CAD_44_1			  (1 << 30)
 #define	  COP_LPCM_CAD_192K_24BIT		  (1 << 29)
 #define	  COP_LPCM_CAD_192K_20BIT		  (1 << 28)
@@ -292,7 +292,7 @@
 #define	CORB_SET_UNSOLICITED_RESPONSE		0x708
 #define	 COP_SET_UNSOLICITED_RESPONSE_ENABLE	 (1 << 7)
 #define	CORB_GET_PIN_SENSE			0xf09
-#define	 COP_GET_PIN_SENSE_PRESENSE_DETECT	 (1 << 31)
+#define	 COP_GET_PIN_SENSE_PRESENSE_DETECT	 (1u << 31)
 #define	 COP_GET_PIN_SENSE_ELD_VALID		 (1 << 30) /* digital */
 #define	 COP_GET_PIN_SENSE_IMPEDENCE_SENSE(x)	 ((x) & 0x7fff) /* analog */
 #define	CORB_SET_PIN_SENSE			0x709
@@ -390,7 +390,7 @@
 #define	 COP_DIP_PI_AUDIO_INFO			 COP_DIP_PI_GP(0)
 #define	 COP_DIP_BUFFER_SIZE(x)			 ((x) & 0xff)
 #define	CORB_GET_HDMI_ELD_DATA			0xf2f
-#define	 COP_ELD_VALID (1 << 31)
+#define	 COP_ELD_VALID (1u << 31)
 #define	 COP_ELD_DATA(x)			 (((x) >> 0) & 0xff)
 #define	CORB_GET_HDMI_DIP_INDEX			0xf30
 #define	CORB_SET_HDMI_DIP_INDEX			0x730



CVS commit: src/doc

2019-01-06 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Jan  6 22:30:02 UTC 2019

Modified Files:
src/doc: 3RDPARTY

Log Message:
Fix edito.


To generate a diff of this commit:
cvs rdiff -u -r1.1587 -r1.1588 src/doc/3RDPARTY

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1587 src/doc/3RDPARTY:1.1588
--- src/doc/3RDPARTY:1.1587	Sat Jan  5 21:49:10 2019
+++ src/doc/3RDPARTY	Sun Jan  6 22:30:02 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1587 2019/01/05 21:49:10 christos Exp $
+#	$NetBSD: 3RDPARTY,v 1.1588 2019/01/06 22:30:02 wiz Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1225,7 +1225,7 @@ Old versions are available from Purdue (
 
 Package:	root.cache
 Version:	2018111402 (November 14, 2018)
-Current Vers:	2018070901 (November 14, 2018)
+Current Vers:	2018111402 (November 14, 2018)
 Maintainer:	InterNIC
 Archive Site:	ftp://ftp.internic.net/domain/named.root
 Home Page:	ftp://ftp.internic.net/domain/named.root



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64

2019-01-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan  6 22:22:26 UTC 2019

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64:
sha256p8-ppc.S sha512p8-ppc.S

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/sha256p8-ppc.S 
\
src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/sha512p8-ppc.S

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/lib/libcrypto/arch/powerpc64/sha256p8-ppc.S
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/sha256p8-ppc.S:1.2 src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/sha256p8-ppc.S:1.3
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/sha256p8-ppc.S:1.2	Sun Sep 23 09:33:05 2018
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/sha256p8-ppc.S	Sun Jan  6 17:22:26 2019
@@ -24,7 +24,7 @@ sha256_block_p8:
 	stvx	30,10,1
 	stvx	31,11,1
 	li	11,-4096+255
-	stw	12,428(1)
+	stw	12,332(1)
 	li	10,0x10
 	std	26,336(1)
 	li	26,0x20
@@ -626,24 +626,17 @@ L16_xx:
 	vperm	4,4,7,9
 	.long	0x7C001F19
 	.long	0x7C8A1F19
-	li	10,207
+	addi	11,1,207
 	mtlr	8
-	li	11,223
 	mtspr	256,12
-	lvx	24,10,1
-	addi	10,10,32
-	lvx	25,11,1
-	addi	11,11,32
-	lvx	26,10,1
-	addi	10,10,32
-	lvx	27,11,1
-	addi	11,11,32
-	lvx	28,10,1
-	addi	10,10,32
-	lvx	29,11,1
-	addi	11,11,32
-	lvx	30,10,1
-	lvx	31,11,1
+	lvx	24,0,11
+	lvx	25,10,11
+	lvx	26,26,11
+	lvx	27,27,11
+	lvx	28,28,11
+	lvx	29,29,11
+	lvx	30,30,11
+	lvx	31,31,11
 	ld	26,336(1)
 	ld	27,344(1)
 	ld	28,352(1)
Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/sha512p8-ppc.S
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/sha512p8-ppc.S:1.2 src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/sha512p8-ppc.S:1.3
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/sha512p8-ppc.S:1.2	Sun Sep 23 09:33:05 2018
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc64/sha512p8-ppc.S	Sun Jan  6 17:22:26 2019
@@ -24,7 +24,7 @@ sha512_block_p8:
 	stvx	30,10,1
 	stvx	31,11,1
 	li	11,-4096+255
-	stw	12,428(1)
+	stw	12,332(1)
 	li	10,0x10
 	std	26,336(1)
 	li	26,0x20
@@ -628,24 +628,17 @@ L16_xx:
 	.long	0x7C4A1F99
 	.long	0x7C9A1F99
 	.long	0x7CDB1F99
-	li	10,207
+	addi	11,1,207
 	mtlr	8
-	li	11,223
 	mtspr	256,12
-	lvx	24,10,1
-	addi	10,10,32
-	lvx	25,11,1
-	addi	11,11,32
-	lvx	26,10,1
-	addi	10,10,32
-	lvx	27,11,1
-	addi	11,11,32
-	lvx	28,10,1
-	addi	10,10,32
-	lvx	29,11,1
-	addi	11,11,32
-	lvx	30,10,1
-	lvx	31,11,1
+	lvx	24,0,11
+	lvx	25,10,11
+	lvx	26,26,11
+	lvx	27,27,11
+	lvx	28,28,11
+	lvx	29,29,11
+	lvx	30,30,11
+	lvx	31,31,11
 	ld	26,336(1)
 	ld	27,344(1)
 	ld	28,352(1)



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc

2019-01-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan  6 22:22:02 UTC 2019

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc: ppccpuid.S
sha256p8-ppc.S sha512p8-ppc.S

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/ppccpuid.S
cvs rdiff -u -r1.2 -r1.3 \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/sha256p8-ppc.S \
src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/sha512p8-ppc.S

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/lib/libcrypto/arch/powerpc/ppccpuid.S
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/ppccpuid.S:1.10 src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/ppccpuid.S:1.11
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/ppccpuid.S:1.10	Sat Mar  3 22:25:18 2018
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/ppccpuid.S	Sun Jan  6 17:22:02 2019
@@ -106,6 +106,17 @@ OPENSSL_atomic_add:
 .type	OPENSSL_rdtsc,@function
 .align	4
 OPENSSL_rdtsc:
+	mfspr	0,287
+	srwi	0,0,0x10
+	cmplwi	0,0x1
+	bgt	.Loop_rdtsc
+.Loop_rdtsc_601:
+	mfrtcu	5
+	mfrtcl	3
+	mfrtcu	4
+	.long	0x7c042840
+	bne	.Loop_rdtsc_601
+	blr	
 .Loop_rdtsc:
 	mftbu	5
 	mftb	3

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/sha256p8-ppc.S
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/sha256p8-ppc.S:1.2 src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/sha256p8-ppc.S:1.3
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/sha256p8-ppc.S:1.2	Sun Sep 23 09:33:04 2018
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/sha256p8-ppc.S	Sun Jan  6 17:22:02 2019
@@ -24,7 +24,7 @@ sha256_block_p8:
 	stvx	30,10,1
 	stvx	31,11,1
 	li	11,-4096+255
-	stw	12,348(1)
+	stw	12,300(1)
 	li	10,0x10
 	stw	26,304(1)
 	li	26,0x20
@@ -626,24 +626,17 @@ L16_xx:
 	vperm	4,4,7,9
 	.long	0x7C001F19
 	.long	0x7C8A1F19
-	li	10,175
+	addi	11,1,175
 	mtlr	8
-	li	11,191
 	mtspr	256,12
-	lvx	24,10,1
-	addi	10,10,32
-	lvx	25,11,1
-	addi	11,11,32
-	lvx	26,10,1
-	addi	10,10,32
-	lvx	27,11,1
-	addi	11,11,32
-	lvx	28,10,1
-	addi	10,10,32
-	lvx	29,11,1
-	addi	11,11,32
-	lvx	30,10,1
-	lvx	31,11,1
+	lvx	24,0,11
+	lvx	25,10,11
+	lvx	26,26,11
+	lvx	27,27,11
+	lvx	28,28,11
+	lvx	29,29,11
+	lvx	30,30,11
+	lvx	31,31,11
 	lwz	26,304(1)
 	lwz	27,308(1)
 	lwz	28,312(1)
Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/sha512p8-ppc.S
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/sha512p8-ppc.S:1.2 src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/sha512p8-ppc.S:1.3
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/sha512p8-ppc.S:1.2	Sun Sep 23 09:33:04 2018
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/powerpc/sha512p8-ppc.S	Sun Jan  6 17:22:02 2019
@@ -24,7 +24,7 @@ sha512_block_p8:
 	stvx	30,10,1
 	stvx	31,11,1
 	li	11,-4096+255
-	stw	12,348(1)
+	stw	12,300(1)
 	li	10,0x10
 	stw	26,304(1)
 	li	26,0x20
@@ -628,24 +628,17 @@ L16_xx:
 	.long	0x7C4A1F99
 	.long	0x7C9A1F99
 	.long	0x7CDB1F99
-	li	10,175
+	addi	11,1,175
 	mtlr	8
-	li	11,191
 	mtspr	256,12
-	lvx	24,10,1
-	addi	10,10,32
-	lvx	25,11,1
-	addi	11,11,32
-	lvx	26,10,1
-	addi	10,10,32
-	lvx	27,11,1
-	addi	11,11,32
-	lvx	28,10,1
-	addi	10,10,32
-	lvx	29,11,1
-	addi	11,11,32
-	lvx	30,10,1
-	lvx	31,11,1
+	lvx	24,0,11
+	lvx	25,10,11
+	lvx	26,26,11
+	lvx	27,27,11
+	lvx	28,28,11
+	lvx	29,29,11
+	lvx	30,30,11
+	lvx	31,31,11
 	lwz	26,304(1)
 	lwz	27,308(1)
 	lwz	28,312(1)



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

2019-01-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan  6 22:20:50 UTC 2019

Modified Files:
src/crypto/external/bsd/openssl/dist/crypto: ppccpuid.pl

Log Message:
PR/53838: Scole Mail: OPENSSL_rdtsc() is reading a time counter
for randomness, and the powerpc code uses mftbu and mftb for access.
The 601 is different than other powerpcs. It doesn't have a time
base register (TBR), but a real time clock (RTC) so it needs to
use different calls like mfrtcu/mfrtcl instead.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/crypto/external/bsd/openssl/dist/crypto/ppccpuid.pl

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/ppccpuid.pl
diff -u src/crypto/external/bsd/openssl/dist/crypto/ppccpuid.pl:1.6 src/crypto/external/bsd/openssl/dist/crypto/ppccpuid.pl:1.7
--- src/crypto/external/bsd/openssl/dist/crypto/ppccpuid.pl:1.6	Thu Feb  8 16:51:24 2018
+++ src/crypto/external/bsd/openssl/dist/crypto/ppccpuid.pl	Sun Jan  6 17:20:50 2019
@@ -132,6 +132,17 @@ $code.=<<___	if ($flavour =~ /64/);
 	mftb	r3
 ___
 $code.=<<___	if ($flavour !~ /64/);
+	mfspr	r0,287
+	srwi	r0,r0,0x10
+	cmplwi	r0,0x1
+	bgt	.Loop_rdtsc
+.Loop_rdtsc_601:	
+	mfrtcu	r5
+	mfrtcl	r3
+	mfrtcu	r4
+	cmplw	r4,r5
+	bne	.Loop_rdtsc_601
+	blr
 Loop_rdtsc:
 	mftbu	r5
 	mftb	r3



CVS commit: src/libexec/ld.elf_so

2019-01-06 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Jan  6 19:44:54 UTC 2019

Modified Files:
src/libexec/ld.elf_so: map_object.c

Log Message:
When loading a non-PIE main binary, the virtual address must match.
Use MAP_TRYFIXED and verify that the result matches the expectation.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/libexec/ld.elf_so/map_object.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/ld.elf_so/map_object.c
diff -u src/libexec/ld.elf_so/map_object.c:1.59 src/libexec/ld.elf_so/map_object.c:1.60
--- src/libexec/ld.elf_so/map_object.c:1.59	Fri Jan  4 19:54:56 2019
+++ src/libexec/ld.elf_so/map_object.c	Sun Jan  6 19:44:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: map_object.c,v 1.59 2019/01/04 19:54:56 joerg Exp $	 */
+/*	$NetBSD: map_object.c,v 1.60 2019/01/06 19:44:54 joerg Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -34,7 +34,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: map_object.c,v 1.59 2019/01/04 19:54:56 joerg Exp $");
+__RCSID("$NetBSD: map_object.c,v 1.60 2019/01/06 19:44:54 joerg Exp $");
 #endif /* not lint */
 
 #include 
@@ -82,7 +82,7 @@ _rtld_map_object(const char *path, int f
 	Elf_Addr	 base_vlimit;
 	Elf_Addr	 text_vlimit;
 	int		 text_flags;
-	caddr_t		 base_addr;
+	void		*base_addr;
 	Elf_Off		 data_offset;
 	Elf_Addr	 data_vaddr;
 	Elf_Addr	 data_vlimit;
@@ -339,10 +339,12 @@ _rtld_map_object(const char *path, int f
 		mapflags = MAP_ALIGNED(log2);
 	}
 
-#ifdef RTLD_LOADER
-	base_addr = obj->isdynamic ? NULL : (caddr_t)base_vaddr;
-#else
 	base_addr = NULL;
+#ifdef RTLD_LOADER
+	if (!obj->isdynamic) {
+		mapflags |= MAP_TRYFIXED;
+		base_addr = (void *)(uintptr_t)base_vaddr;
+	}
 #endif
 	mapsize = base_vlimit - base_vaddr;
 	mapbase = mmap(base_addr, mapsize, text_flags,
@@ -352,6 +354,12 @@ _rtld_map_object(const char *path, int f
 		xstrerror(errno));
 		goto bad;
 	}
+#ifdef RTLD_LOADER
+	if (!obj->isdynamic && mapbase != base_addr) {
+		_rtld_error("mmap of executable at correct address failed");
+		goto bad;
+	}
+#endif
 
 	/* Overlay the data segment onto the proper region. */
 	data_addr = mapbase + (data_vaddr - base_vaddr);



CVS commit: src/doc

2019-01-06 Thread Leonardo Taccari
Module Name:src
Committed By:   leot
Date:   Sun Jan  6 18:56:52 UTC 2019

Modified Files:
src/doc: CHANGES

Log Message:
Adjust year in latest acpi(4) entry


To generate a diff of this commit:
cvs rdiff -u -r1.2484 -r1.2485 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2484 src/doc/CHANGES:1.2485
--- src/doc/CHANGES:1.2484	Sat Jan  5 21:49:45 2019
+++ src/doc/CHANGES	Sun Jan  6 18:56:52 2019
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2484 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2485 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -286,5 +286,5 @@ Changes from NetBSD 8.0 to NetBSD 9.0:
 	services(5), protocols(5): Pull iana-generated services and protocols
 	[christos 20190103]
 	wpa: Import wpa_supplicant and hostapd 2.7. [christos 20190104]
-	acpi(4): Updated ACPICA to 20181213. [christos 20180104]
+	acpi(4): Updated ACPICA to 20181213. [christos 20190104]
 	tmux(1): Imported 2.8. [christos 20190104]



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

2019-01-06 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jan  6 18:32:54 UTC 2019

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

Log Message:
Add more VMCB fields. Also remove debugging code I mistakenly committed
in the previous revision. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 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.10 src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.11
--- src/sys/dev/nvmm/x86/nvmm_x86_svm.c:1.10	Sun Jan  6 16:10:51 2019
+++ src/sys/dev/nvmm/x86/nvmm_x86_svm.c	Sun Jan  6 18:32:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm_x86_svm.c,v 1.10 2019/01/06 16:10:51 maxv Exp $	*/
+/*	$NetBSD: nvmm_x86_svm.c,v 1.11 2019/01/06 18:32:54 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.10 2019/01/06 16:10:51 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86_svm.c,v 1.11 2019/01/06 18:32:54 maxv Exp $");
 
 #include 
 #include 
@@ -368,7 +368,18 @@ struct vmcb_ctrl {
 	uint64_t nrip;
 	uint8_t	inst_len;
 	uint8_t	inst_bytes[15];
-	uint8_t	pad[800];
+	uint64_t avic_abpp;
+	uint64_t rsvd3;
+	uint64_t avic_ltp;
+
+	uint64_t avic_phys;
+#define VMCB_CTRL_AVIC_PHYS_TABLE_PTR	__BITS(51,12)
+#define VMCB_CTRL_AVIC_PHYS_MAX_INDEX	__BITS(7,0)
+
+	uint64_t rsvd4;
+	uint64_t vmcb_ptr;
+
+	uint8_t	pad[752];
 } __packed;
 
 CTASSERT(sizeof(struct vmcb_ctrl) == 1024);
@@ -1238,10 +1249,6 @@ svm_vcpu_run(struct nvmm_machine *mach, 
 			break;
 		}
 
-		if (vmcb->ctrl.exitintinfo & VMCB_CTRL_EXITINTINFO_V) {
-			printf("WAS PROCESSING!\n");
-		}
-
 		/* If no reason to return to userland, keep rolling. */
 		if (curcpu()->ci_schedstate.spc_flags & SPCF_SHOULDYIELD) {
 			break;



CVS commit: src/external/gpl3/gcc/dist/gcc/config

2019-01-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan  6 18:15:53 UTC 2019

Modified Files:
src/external/gpl3/gcc/dist/gcc/config: netbsd.h

Log Message:
now that our profiled c library is pic, we can use it in shared objects


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/external/gpl3/gcc/dist/gcc/config/netbsd.h

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/dist/gcc/config/netbsd.h
diff -u src/external/gpl3/gcc/dist/gcc/config/netbsd.h:1.23 src/external/gpl3/gcc/dist/gcc/config/netbsd.h:1.24
--- src/external/gpl3/gcc/dist/gcc/config/netbsd.h:1.23	Fri Jan  4 13:36:50 2019
+++ src/external/gpl3/gcc/dist/gcc/config/netbsd.h	Sun Jan  6 13:15:53 2019
@@ -119,7 +119,11 @@ along with GCC; see the file COPYING3.  
%{!pg:-lposix}}		\
  %{p:-lposix_p}		\
  %{pg:-lposix_p}}		\
-   %{shared:-lc}		\
+   %{shared:			\
+ %{!p:			\
+   %{!pg:-lc}}		\
+ %{p:-lc_p}			\
+   %{pg:-lc_p}}		\
%{!shared:			\
  %{!symbolic:		\
%{!p:			\
@@ -133,7 +137,11 @@ along with GCC; see the file COPYING3.  
%{!pg:-lposix}}		\
  %{p:-lposix_p}		\
  %{pg:-lposix_p}}		\
-   %{shared:-lc}		\
+   %{shared:			\
+ %{!p:			\
+   %{!pg:-lc}}		\
+ %{p:-lc_p}			\
+   %{pg:-lc_p}}		\
%{!shared:			\
  %{!symbolic:		\
%{!p:			\



CVS commit: src/external/gpl3/gcc.old/dist/gcc/config

2019-01-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan  6 18:15:18 UTC 2019

Modified Files:
src/external/gpl3/gcc.old/dist/gcc/config: netbsd.h

Log Message:
now that our profiled c library is pic we can use it in shared objects


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/gpl3/gcc.old/dist/gcc/config/netbsd.h

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/netbsd.h
diff -u src/external/gpl3/gcc.old/dist/gcc/config/netbsd.h:1.8 src/external/gpl3/gcc.old/dist/gcc/config/netbsd.h:1.9
--- src/external/gpl3/gcc.old/dist/gcc/config/netbsd.h:1.8	Fri Jan  4 13:35:45 2019
+++ src/external/gpl3/gcc.old/dist/gcc/config/netbsd.h	Sun Jan  6 13:15:18 2019
@@ -119,7 +119,11 @@ along with GCC; see the file COPYING3.  
%{!pg:-lposix}}		\
  %{p:-lposix_p}		\
  %{pg:-lposix_p}}		\
-   %{shared:-lc}		\
+   %{shared:			\
+ %{!p:			\
+   %{!pg:-lc}}		\
+ %{p:-lc_p}			\
+   %{pg:-lc_p}}		\
%{!shared:			\
  %{!symbolic:		\
%{!p:			\
@@ -133,7 +137,11 @@ along with GCC; see the file COPYING3.  
%{!pg:-lposix}}		\
  %{p:-lposix_p}		\
  %{pg:-lposix_p}}		\
-   %{shared:-lc}		\
+   %{shared:			\
+ %{!p:			\
+   %{!pg:-lc}}		\
+ %{p:-lc_p}			\
+   %{pg:-lc_p}}		\
%{!shared:			\
  %{!symbolic:		\
%{!p:			\



CVS commit: src/lib/libc/gmon

2019-01-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan  6 18:14:10 UTC 2019

Modified Files:
src/lib/libc/gmon: Makefile.inc

Log Message:
use the pico objects if we are making a PIC profiled library.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/lib/libc/gmon/Makefile.inc

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

Modified files:

Index: src/lib/libc/gmon/Makefile.inc
diff -u src/lib/libc/gmon/Makefile.inc:1.13 src/lib/libc/gmon/Makefile.inc:1.14
--- src/lib/libc/gmon/Makefile.inc:1.13	Mon Feb  5 17:12:37 2018
+++ src/lib/libc/gmon/Makefile.inc	Sun Jan  6 13:14:10 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.13 2018/02/05 22:12:37 mrg Exp $
+#	$NetBSD: Makefile.inc,v 1.14 2019/01/06 18:14:10 christos Exp $
 #	@(#)Makefile.inc	8.1 (Berkeley) 6/4/93
 
 # gmon sources
@@ -26,8 +26,9 @@ COPTS.mcount.c+=${${ACTIVE_CXX} == "gcc"
 
 
 # mcount and gmon cannot be compiled with profiling
-mcount.po: mcount.o
-	cp mcount.o mcount.po
+GMONOBJEXT=${${MKPIC} != "no":?pico:o}
+mcount.po: mcount.${GMONOBJEXT}
+	cp mcount.${GMONOBJEXT} mcount.po
 
-gmon.po: gmon.o
-	cp gmon.o gmon.po
+gmon.po: gmon.${GMONOBJEXT}
+	cp gmon.${GMONOBJEXT} gmon.po



CVS commit: src/share/mk

2019-01-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan  6 17:02:32 UTC 2019

Modified Files:
src/share/mk: bsd.lib.mk

Log Message:
Since g++ uses stdc++_p when building with -pg make this PIC on the
platforms where PIC is available, so that linking shared objects with
-pg works, without needing to create a shared library version of the
profiled libraries.


To generate a diff of this commit:
cvs rdiff -u -r1.377 -r1.378 src/share/mk/bsd.lib.mk

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.lib.mk
diff -u src/share/mk/bsd.lib.mk:1.377 src/share/mk/bsd.lib.mk:1.378
--- src/share/mk/bsd.lib.mk:1.377	Wed Jul 25 19:34:25 2018
+++ src/share/mk/bsd.lib.mk	Sun Jan  6 12:02:32 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.lib.mk,v 1.377 2018/07/25 23:34:25 kamil Exp $
+#	$NetBSD: bsd.lib.mk,v 1.378 2019/01/06 17:02:32 christos Exp $
 #	@(#)bsd.lib.mk	8.3 (Berkeley) 4/22/94
 
 .include 
@@ -57,6 +57,11 @@ CFLAGS+=${PIE_CFLAGS}
 AFLAGS+=${PIE_AFLAGS}
 .endif
 
+PGFLAGS+=	-pg
+.if ${MKPIC} != "no"
+PGFLAGS+=	-fPIC
+.endif
+
 # Libraries that this may depend upon.
 .if defined(LIBDPLIBS) && ${MKPIC} != "no"# {
 .for _lib _dir in ${LIBDPLIBS}
@@ -230,7 +235,7 @@ LIBSTRIPSHLIBOBJS=	yes
 
 .c.po:
 	${_MKTARGET_COMPILE}
-	${COMPILE.c} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET}
+	${COMPILE.c} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${PGFLAGS} ${.IMPSRC} -o ${.TARGET}
 .if defined(CTFCONVERT)
 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
 .endif
@@ -258,7 +263,7 @@ LIBSTRIPSHLIBOBJS=	yes
 
 .cc.po .cpp.po .cxx.po .C.po:
 	${_MKTARGET_COMPILE}
-	${COMPILE.cc} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} -pg ${.IMPSRC} -o ${.TARGET}
+	${COMPILE.cc} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${PGFLAGS} ${.IMPSRC} -o ${.TARGET}
 .if defined(LIBSTRIPCOBJS)
 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
 .endif
@@ -286,7 +291,7 @@ LIBSTRIPSHLIBOBJS=	yes
 
 .f.po:
 	${_MKTARGET_COMPILE}
-	${COMPILE.f} ${PROFFLAGS} -pg ${.IMPSRC} -o ${.TARGET}
+	${COMPILE.f} ${PROFFLAGS} ${PGFLAGS} ${.IMPSRC} -o ${.TARGET}
 .if defined(CTFCONVERT)
 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
 .endif
@@ -321,7 +326,7 @@ LIBSTRIPSHLIBOBJS=	yes
 
 .m.po:
 	${_MKTARGET_COMPILE}
-	${COMPILE.m} ${PROFFLAGS} -pg ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
+	${COMPILE.m} ${PROFFLAGS} ${PGFLAGS} ${OBJCOPTS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
 .if defined(CTFCONVERT)
 	${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
 .endif



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

2019-01-06 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jan  6 16:19:12 UTC 2019

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

Log Message:
Flush the host TLB too when dealing with a guest pmap. The pmap is not
active on the host so the pages aren't cached; but the recursive PTE
entries may have been cached by our pmap code.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/x86/x86_tlb.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/x86_tlb.c
diff -u src/sys/arch/x86/x86/x86_tlb.c:1.3 src/sys/arch/x86/x86/x86_tlb.c:1.4
--- src/sys/arch/x86/x86/x86_tlb.c:1.3	Wed Nov  7 07:14:51 2018
+++ src/sys/arch/x86/x86/x86_tlb.c	Sun Jan  6 16:19:12 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_tlb.c,v 1.3 2018/11/07 07:14:51 maxv Exp $	*/
+/*	$NetBSD: x86_tlb.c,v 1.4 2019/01/06 16:19:12 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008-2012 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: x86_tlb.c,v 1.3 2018/11/07 07:14:51 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_tlb.c,v 1.4 2019/01/06 16:19:12 maxv Exp $");
 
 #include 
 #include 
@@ -229,7 +229,6 @@ pmap_tlb_shootdown(struct pmap *pm, vadd
 
 	if (__predict_false(pm->pm_tlb_flush != NULL)) {
 		(*pm->pm_tlb_flush)(pm);
-		return;
 	}
 
 	/*



CVS commit: src

2019-01-06 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jan  6 16:13:51 UTC 2019

Modified Files:
src/sys/arch/x86/x86: identcpu.c
src/usr.sbin/cpuctl/arch: i386.c

Log Message:
Handle the NVMM signature.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/x86/x86/identcpu.c
cvs rdiff -u -r1.90 -r1.91 src/usr.sbin/cpuctl/arch/i386.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.84 src/sys/arch/x86/x86/identcpu.c:1.85
--- src/sys/arch/x86/x86/identcpu.c:1.84	Sun Dec 16 10:42:32 2018
+++ src/sys/arch/x86/x86/identcpu.c	Sun Jan  6 16:13:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.84 2018/12/16 10:42:32 maxv Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.85 2019/01/06 16:13:51 maxv 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.84 2018/12/16 10:42:32 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.85 2019/01/06 16:13:51 maxv Exp $");
 
 #include "opt_xen.h"
 
@@ -1118,6 +1118,7 @@ identify_hypervisor(void)
 vm_guest = VM_GUEST_KVM;
 			/* FreeBSD bhyve: "bhyve bhyve " */
 			/* OpenBSD vmm:   "OpenBSDVMM58" */
+			/* NetBSD nvmm:   "___ NVMM ___" */
 		}
 		return;
 	}

Index: src/usr.sbin/cpuctl/arch/i386.c
diff -u src/usr.sbin/cpuctl/arch/i386.c:1.90 src/usr.sbin/cpuctl/arch/i386.c:1.91
--- src/usr.sbin/cpuctl/arch/i386.c:1.90	Mon Nov 26 04:45:13 2018
+++ src/usr.sbin/cpuctl/arch/i386.c	Sun Jan  6 16:13:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386.c,v 1.90 2018/11/26 04:45:13 msaitoh Exp $	*/
+/*	$NetBSD: i386.c,v 1.91 2019/01/06 16:13:51 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: i386.c,v 1.90 2018/11/26 04:45:13 msaitoh Exp $");
+__RCSID("$NetBSD: i386.c,v 1.91 2019/01/06 16:13:51 maxv Exp $");
 #endif /* not lint */
 
 #include 
@@ -1718,6 +1718,7 @@ cpu_probe_hv_features(struct cpu_info *c
 		 * Microsoft	"Microsoft Hv"
 		 * VMware	"VMwareVMware"
 		 * Xen		"XenVMMXenVMM"
+		 * NetBSD	"___ NVMM ___"
 		 */
 		if (strncmp(hv_sig, "KVMKVMKVM", 9) == 0)
 			hv_name = "KVM";
@@ -1727,6 +1728,8 @@ cpu_probe_hv_features(struct cpu_info *c
 			hv_name = "VMware";
 		else if (strncmp(hv_sig, "XenVMMXenVMM", 12) == 0)
 			hv_name = "Xen";
+		else if (strncmp(hv_sig, "___ NVMM ___", 12) == 0)
+			hv_name = "NVMM";
 		else
 			hv_name = "unknown";
 



CVS commit: src

2019-01-06 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jan  6 16:10:51 UTC 2019

Modified Files:
src/lib/libnvmm: libnvmm.3 libnvmm_x86.c nvmm.h
src/sys/dev/nvmm: nvmm.c nvmm.h
src/sys/dev/nvmm/x86: nvmm_x86.h nvmm_x86_svm.c

Log Message:
Improvements and fixes in NVMM.

Kernel driver:

 * Don't take an extra (unneeded) reference to the UAO.

 * Provide npc for HLT. I'm not really happy with it right now, will
   likely be revisited.

 * Add the INT_SHADOW, INT_WINDOW_EXIT and NMI_WINDOW_EXIT states. Provide
   them in the exitstate too.

 * Don't take the TPR into account when processing INTs. The virtualizer
   can do that itself (Qemu already does).

 * Provide a hypervisor signature in CPUID, and hide SVM.

 * Ignore certain MSRs. One special case is MSR_NB_CFG in which we set
   NB_CFG_INITAPICCPUIDLO. Allow reads of MSR_TSC.

 * If the LWP has pending signals or softints, leave, rather than waiting
   for a rescheduling to happen later. This reduces interrupt processing
   time in the guest (Qemu sends a signal to the thread, and now we leave
   right away). This could be improved even more by sending an actual IPI
   to the CPU, but I'll see later.

Libnvmm:

 * Fix the MMU translation of large pages, we need to add the lower bits
   too.

 * Change the IO and Mem structures to take a pointer rather than a
   static array. This provides more flexibility.

 * Batch together the str+rep IO transactions. We do one big memory
   read/write, and then send the IO commands to the hypervisor all at
   once. This considerably increases performance.

 * Decode MOVZX.

With these changes in place, Qemu+NVMM works. I can install NetBSD 8.0
in a VM with multiple VCPUs, connect to the network, etc.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libnvmm/libnvmm.3
cvs rdiff -u -r1.9 -r1.10 src/lib/libnvmm/libnvmm_x86.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libnvmm/nvmm.h
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/nvmm/nvmm.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/nvmm/nvmm.h
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/nvmm/x86/nvmm_x86.h
cvs rdiff -u -r1.9 -r1.10 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/lib/libnvmm/libnvmm.3
diff -u src/lib/libnvmm/libnvmm.3:1.6 src/lib/libnvmm/libnvmm.3:1.7
--- src/lib/libnvmm/libnvmm.3:1.6	Thu Dec 27 07:22:31 2018
+++ src/lib/libnvmm/libnvmm.3	Sun Jan  6 16:10:51 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: libnvmm.3,v 1.6 2018/12/27 07:22:31 maxv Exp $
+.\"	$NetBSD: libnvmm.3,v 1.7 2019/01/06 16:10:51 maxv Exp $
 .\"
 .\" Copyright (c) 2018 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd December 26, 2018
+.Dd January 06, 2019
 .Dt LIBNVMM 3
 .Os
 .Sh NAME
@@ -242,8 +242,6 @@ on CPU
 .Fa cpuid
 from machine
 .Fa mach .
-.Fa cb
-will be called to handle the transaction.
 See
 .Sx I/O Assist
 below for details.
@@ -255,8 +253,6 @@ on CPU
 .Fa cpuid
 from machine
 .Fa mach .
-.Fa cb
-will be called to handle the transaction.
 See
 .Sx Mem Assist
 below for details.
@@ -415,7 +411,7 @@ struct nvmm_io {
 	uint64_t port;
 	bool in;
 	size_t size;
-	uint8_t data[8];
+	uint8_t *data;
 };
 .Ed
 .Pp
@@ -463,7 +459,7 @@ struct nvmm_mem {
 	gpaddr_t gpa;
 	bool write;
 	size_t size;
-	uint8_t data[8];
+	uint8_t *data;
 };
 .Ed
 .Pp

Index: src/lib/libnvmm/libnvmm_x86.c
diff -u src/lib/libnvmm/libnvmm_x86.c:1.9 src/lib/libnvmm/libnvmm_x86.c:1.10
--- src/lib/libnvmm/libnvmm_x86.c:1.9	Fri Jan  4 10:25:39 2019
+++ src/lib/libnvmm/libnvmm_x86.c	Sun Jan  6 16:10:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: libnvmm_x86.c,v 1.9 2019/01/04 10:25:39 maxv Exp $	*/
+/*	$NetBSD: libnvmm_x86.c,v 1.10 2019/01/06 16:10:51 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -45,6 +45,8 @@
 
 #include "nvmm.h"
 
+#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
+
 #include 
 
 extern struct nvmm_callbacks __callbacks;
@@ -83,6 +85,11 @@ nvmm_vcpu_dump(struct nvmm_machine *mach
 		(void *)state.segs[i].limit,
 		state.segs[i].attrib.p, state.segs[i].attrib.def32);
 	}
+	printf("| -> MSR_EFER=%p\n", (void *)state.msrs[NVMM_X64_MSR_EFER]);
+	printf("| -> CR0=%p\n", (void *)state.crs[NVMM_X64_CR_CR0]);
+	printf("| -> CR3=%p\n", (void *)state.crs[NVMM_X64_CR_CR3]);
+	printf("| -> CR4=%p\n", (void *)state.crs[NVMM_X64_CR_CR4]);
+	printf("| -> CR8=%p\n", (void *)state.crs[NVMM_X64_CR_CR8]);
 	printf("| -> CPL=%p\n", (void *)state.misc[NVMM_X64_MISC_CPL]);
 
 	return 0;
@@ -131,6 +138,7 @@ x86_gva_to_gpa_32bit(struct nvmm_machine
 		return -1;
 	if (pte & PG_PS) {
 		*gpa = (pte & PTE32_L2_FRAME);
+		*gpa = *gpa + (gva & PTE32_L1_MASK);
 		return 0;
 	}
 
@@ -215,6 +223,7 @@ x86_gva_to_gpa_32bit_pae(struct nvmm_mac
 		return -1;
 	if (pte & PG_PS) {
 		*gpa = (pte & PTE32_PAE_L2_FRAME);
+		*gpa = 

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

2019-01-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan  6 15:37:18 UTC 2019

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

Log Message:
restore original now that weak symbols are gone


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/x86/x86/procfs_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/x86/x86/procfs_machdep.c
diff -u src/sys/arch/x86/x86/procfs_machdep.c:1.26 src/sys/arch/x86/x86/procfs_machdep.c:1.27
--- src/sys/arch/x86/x86/procfs_machdep.c:1.26	Sat Jan  5 15:32:02 2019
+++ src/sys/arch/x86/x86/procfs_machdep.c	Sun Jan  6 10:37:17 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.26 2019/01/05 20:32:02 christos Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.27 2019/01/06 15:37:17 christos Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.26 2019/01/05 20:32:02 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.27 2019/01/06 15:37:17 christos Exp $");
 
 #include 
 #include 
@@ -447,12 +447,7 @@ procfs_getonecpu(int xcpu, struct cpu_in
 	i386_fpu_fdivbug ? "yes" : "no",	/* an old pentium */
 #endif
 	ci->ci_max_cpuid,
-#ifdef notyet
-	// XXX: Fixme Weak symbols are not supported in modules
 	(rcr0() & CR0_WP) ? "yes" : "no",
-#else
-	"no",
-#endif
 	featurebuf,
 	ci->ci_cflush_lsize
 	);



CVS commit: src/sys/arch

2019-01-06 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sun Jan  6 14:35:31 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: cpufunc.S
src/sys/arch/i386/i386: cpufunc.S i386func.S
src/sys/arch/xen/x86: xenfunc.c

Log Message:
Rollback http://mail-index.netbsd.org/source-changes/2018/12/22/msg101629.html

This change breaks module loading due to weak alias being unsupported
in the kernel module linker.

Requested by maxv@ and others as it affects their work.

No immediate decision on a replacement method is available, but other options
suggested include pre-processing, conditional compilation (#ifdef etc) and other
source level methods to avoid linktime decision making.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/amd64/amd64/cpufunc.S
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/i386/i386/cpufunc.S
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/i386/i386/i386func.S
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/xen/x86/xenfunc.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/amd64/cpufunc.S
diff -u src/sys/arch/amd64/amd64/cpufunc.S:1.34 src/sys/arch/amd64/amd64/cpufunc.S:1.35
--- src/sys/arch/amd64/amd64/cpufunc.S:1.34	Sat Dec 22 21:27:22 2018
+++ src/sys/arch/amd64/amd64/cpufunc.S	Sun Jan  6 14:35:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc.S,v 1.34 2018/12/22 21:27:22 cherry Exp $	*/
+/*	$NetBSD: cpufunc.S,v 1.35 2019/01/06 14:35:31 cherry Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -63,53 +63,18 @@ ENTRY(x86_mfence)
 	ret
 END(x86_mfence)
 
-/*
- * These functions below should always be accessed via the corresponding wrapper
- * function names defined in x86/include/cpufunc.h and exported as WEAK_ALIAS()
- *
- * We use this rather roundabout method so that a runtime wrapper function may
- * be made available for PVHVM, which could override both native and PV aliases
- * and decide which to invoke at run time.
- */
-
-WEAK_ALIAS(invlpg, amd64_invlpg)
-WEAK_ALIAS(lidt, amd64_lidt)
-WEAK_ALIAS(lldt, amd64_lldt)
-WEAK_ALIAS(ltr, amd64_ltr)
-WEAK_ALIAS(lcr0, amd64_lcr0)
-WEAK_ALIAS(rcr0, amd64_rcr0)
-WEAK_ALIAS(rcr2, amd64_rcr2)
-WEAK_ALIAS(lcr2, amd64_lcr2)
-WEAK_ALIAS(rcr3, amd64_rcr3)
-WEAK_ALIAS(lcr3, amd64_lcr3)
-WEAK_ALIAS(tlbflush, amd64_tlbflush)
-WEAK_ALIAS(tlbflushg, amd64_tlbflushg)
-WEAK_ALIAS(rdr0, amd64_rdr0)
-WEAK_ALIAS(ldr0, amd64_ldr0)
-WEAK_ALIAS(rdr1, amd64_rdr1)
-WEAK_ALIAS(ldr1, amd64_ldr1)
-WEAK_ALIAS(rdr2, amd64_rdr2)
-WEAK_ALIAS(ldr2, amd64_ldr2)
-WEAK_ALIAS(rdr3, amd64_rdr3)
-WEAK_ALIAS(ldr3, amd64_ldr3)
-WEAK_ALIAS(rdr6, amd64_rdr6)
-WEAK_ALIAS(ldr6, amd64_ldr6)
-WEAK_ALIAS(rdr7, amd64_rdr7)
-WEAK_ALIAS(ldr7, amd64_ldr7)
-WEAK_ALIAS(wbinvd, amd64_wbinvd)
-
 #ifndef XEN
-ENTRY(amd64_invlpg)
+ENTRY(invlpg)
 	invlpg	(%rdi)
 	ret
-END(amd64_invlpg)
+END(invlpg)
 
-ENTRY(amd64_lidt)
+ENTRY(lidt)
 	lidt	(%rdi)
 	ret
-END(amd64_lidt)
+END(lidt)
 
-ENTRY(amd64_lldt)
+ENTRY(lldt)
 	cmpl	%edi, CPUVAR(CURLDT)
 	jne	1f
 	ret
@@ -117,42 +82,42 @@ ENTRY(amd64_lldt)
 	movl	%edi, CPUVAR(CURLDT)
 	lldt	%di
 	ret
-END(amd64_lldt)
+END(lldt)
 
-ENTRY(amd64_ltr)
+ENTRY(ltr)
 	ltr	%di
 	ret
-END(amd64_ltr)
+END(ltr)
 
-ENTRY(amd64_lcr0)
+ENTRY(lcr0)
 	movq	%rdi, %cr0
 	ret
-END(amd64_lcr0)
+END(lcr0)
 
-ENTRY(amd64_rcr0)
+ENTRY(rcr0)
 	movq	%cr0, %rax
 	ret
-END(amd64_rcr0)
+END(rcr0)
 
-ENTRY(amd64_lcr2)
+ENTRY(lcr2)
 	movq	%rdi, %cr2
 	ret
-END(amd64_lcr2)
+END(lcr2)
 
-ENTRY(amd64_rcr2)
+ENTRY(rcr2)
 	movq	%cr2, %rax
 	ret
-END(amd64_rcr2)
+END(rcr2)
 
-ENTRY(amd64_lcr3)
+ENTRY(lcr3)
 	movq	%rdi, %cr3
 	ret
-END(amd64_lcr3)
+END(lcr3)
 
-ENTRY(amd64_rcr3)
+ENTRY(rcr3)
 	movq	%cr3, %rax
 	ret
-END(amd64_rcr3)
+END(rcr3)
 #endif
 
 ENTRY(lcr4)
@@ -194,7 +159,7 @@ END(rcr8)
  * If PGE is not in use, we reload CR3.
  */
 #ifndef XEN
-ENTRY(amd64_tlbflushg)
+ENTRY(tlbflushg)
 	movq	%cr4, %rax
 	testq	$CR4_PGE, %rax
 	jz	1f
@@ -203,74 +168,74 @@ ENTRY(amd64_tlbflushg)
 	movq	%rdx, %cr4
 	movq	%rax, %cr4
 	ret
-END(amd64_tlbflushg)
+END(tlbflushg)
 
-ENTRY(amd64_tlbflush)
+ENTRY(tlbflush)
 1:
 	movq	%cr3, %rax
 	movq	%rax, %cr3
 	ret
-END(amd64_tlbflush)
+END(tlbflush)
 
-ENTRY(amd64_ldr0)
+ENTRY(ldr0)
 	movq	%rdi, %dr0
 	ret
-END(amd64_ldr0)
+END(ldr0)
 
-ENTRY(amd64_rdr0)
+ENTRY(rdr0)
 	movq	%dr0, %rax
 	ret
-END(amd64_rdr0)
+END(rdr0)
 
-ENTRY(amd64_ldr1)
+ENTRY(ldr1)
 	movq	%rdi, %dr1
 	ret
-END(amd64_ldr1)
+END(ldr1)
 
-ENTRY(amd64_rdr1)
+ENTRY(rdr1)
 	movq	%dr1, %rax
 	ret
-END(amd64_rdr1)
+END(rdr1)
 
-ENTRY(amd64_ldr2)
+ENTRY(ldr2)
 	movq	%rdi, %dr2
 	ret
-END(amd64_ldr2)
+END(ldr2)
 
-ENTRY(amd64_rdr2)
+ENTRY(rdr2)
 	movq	%dr2, %rax
 	ret
-END(amd64_rdr2)
+END(rdr2)
 
-ENTRY(amd64_ldr3)
+ENTRY(ldr3)
 	movq	%rdi, %dr3
 	ret
-END(amd64_ldr3)
+END(ldr3)
 
-ENTRY(amd64_rdr3)
+ENTRY(rdr3)
 	movq	%dr3, %rax
 	ret
-END(amd64_rdr3)
+END(rdr3)
 
-ENTRY(amd64_ldr6)
+ENTRY(ldr6)
 	movq	%rdi, %dr6
 	ret
-END(amd64_ldr6)

CVS commit: src/sys/arch/powerpc/oea

2019-01-06 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Sun Jan  6 11:20:53 UTC 2019

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
Only execute dssall when the CPU has the Altivec instruction set extension.


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/arch/powerpc/oea/cpu_subr.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/powerpc/oea/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.97 src/sys/arch/powerpc/oea/cpu_subr.c:1.98
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.97	Fri Jun 15 23:11:39 2018
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Sun Jan  6 11:20:53 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.97 2018/06/15 23:11:39 uwe Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.98 2019/01/06 11:20:53 phx Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.97 2018/06/15 23:11:39 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.98 2019/01/06 11:20:53 phx Exp $");
 
 #include "opt_ppcparam.h"
 #include "opt_ppccache.h"
@@ -329,10 +329,12 @@ cpu_idlespin(void)
 	if (powersave <= 0)
 		return;
 
-	__asm volatile(
 #if defined(_ARCH_PPC64) || defined (PPC_OEA64_BRIDGE)
-		"dssall;"
+	if (cpu_altivec)
+		__asm volatile("dssall");
 #endif
+
+	__asm volatile(
 		"sync;"
 		"mfmsr	%0;"
 		"oris	%0,%0,%1@h;"	/* enter power saving mode */



CVS commit: src/usr.bin/menuc

2019-01-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jan  6 11:08:35 UTC 2019

Modified Files:
src/usr.bin/menuc: menu_sys.def

Log Message:
Fix a potential NULL deref in previous - some menus start up with no
"opts" array allocated yet.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/usr.bin/menuc/menu_sys.def

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

Modified files:

Index: src/usr.bin/menuc/menu_sys.def
diff -u src/usr.bin/menuc/menu_sys.def:1.62 src/usr.bin/menuc/menu_sys.def:1.63
--- src/usr.bin/menuc/menu_sys.def:1.62	Fri Jan  4 15:27:19 2019
+++ src/usr.bin/menuc/menu_sys.def	Sun Jan  6 11:08:34 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: menu_sys.def,v 1.62 2019/01/04 15:27:19 martin Exp $	*/
+/*	$NetBSD: menu_sys.def,v 1.63 2019/01/06 11:08:34 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -693,7 +693,7 @@ process_menu(int num, void *arg)
 	m->topline = 0;
 	if ((m->mopt & (MC_DFLTEXIT | MC_NOEXITOPT)) == MC_DFLTEXIT) {
 		m->cursel = -1;
-	} else {
+	} else if (m->opts != NULL) {
 		for (m->cursel = 0; m->cursel < m->numopts; m->cursel++)
 			if ((m->opts[m->cursel].opt_flags & OPT_IGNORE) == 0)
 break;