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

2019-07-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jul 30 06:57:02 UTC 2019

Modified Files:
src/sys/arch/arm/cortex: a9wdt.c

Log Message:
Fix loop to calculate prescaler divisor.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/cortex/a9wdt.c

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/cortex

2019-07-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jul 30 06:57:02 UTC 2019

Modified Files:
src/sys/arch/arm/cortex: a9wdt.c

Log Message:
Fix loop to calculate prescaler divisor.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/cortex/a9wdt.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/cortex/a9wdt.c
diff -u src/sys/arch/arm/cortex/a9wdt.c:1.7 src/sys/arch/arm/cortex/a9wdt.c:1.8
--- src/sys/arch/arm/cortex/a9wdt.c:1.7	Fri Dec 29 11:07:03 2017
+++ src/sys/arch/arm/cortex/a9wdt.c	Tue Jul 30 06:57:02 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: a9wdt.c,v 1.7 2017/12/29 11:07:03 skrll Exp $	*/
+/*	$NetBSD: a9wdt.c,v 1.8 2019/07/30 06:57:02 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: a9wdt.c,v 1.7 2017/12/29 11:07:03 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: a9wdt.c,v 1.8 2019/07/30 06:57:02 skrll Exp $");
 
 #include 
 #include 
@@ -214,7 +214,7 @@ a9wdt_attach(device_t parent, device_t s
 		/*
 		 * Let's hope the timer frequency isn't prime.
 		 */
-		for (size_t div = 256; div >= 2; div++) {
+		for (size_t div = 256; div >= 2; div--) {
 			if (sc->sc_freq % div == 0) {
 sc->sc_wdog_prescaler = div;
 break;



CVS commit: src/sys/arch

2019-07-29 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Tue Jul 30 06:52:58 UTC 2019

Modified Files:
src/sys/arch/arm/imx: imxi2c.c
src/sys/arch/arm/imx/fdt: files.imx6
src/sys/arch/evbarm/conf: IMX
Added Files:
src/sys/arch/arm/imx/fdt: imx6_i2c.c

Log Message:
Add IIC support.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/imxi2c.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/fdt/files.imx6
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/imx/fdt/imx6_i2c.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/conf/IMX

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



CVS commit: src/sys/arch

2019-07-29 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Tue Jul 30 06:52:58 UTC 2019

Modified Files:
src/sys/arch/arm/imx: imxi2c.c
src/sys/arch/arm/imx/fdt: files.imx6
src/sys/arch/evbarm/conf: IMX
Added Files:
src/sys/arch/arm/imx/fdt: imx6_i2c.c

Log Message:
Add IIC support.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/imxi2c.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/fdt/files.imx6
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/imx/fdt/imx6_i2c.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/conf/IMX

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/imx/imxi2c.c
diff -u src/sys/arch/arm/imx/imxi2c.c:1.2 src/sys/arch/arm/imx/imxi2c.c:1.3
--- src/sys/arch/arm/imx/imxi2c.c:1.2	Fri Mar 27 05:31:23 2015
+++ src/sys/arch/arm/imx/imxi2c.c	Tue Jul 30 06:52:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imxi2c.c,v 1.2 2015/03/27 05:31:23 hkenken Exp $	*/
+/*	$NetBSD: imxi2c.c,v 1.3 2019/07/30 06:52:57 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2012, 2015 Genetec Corporation.  All rights reserved.
@@ -27,9 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imxi2c.c,v 1.2 2015/03/27 05:31:23 hkenken Exp $");
-
-#include "opt_imx.h"
+__KERNEL_RCSID(0, "$NetBSD: imxi2c.c,v 1.3 2019/07/30 06:52:57 hkenken Exp $");
 
 #include 
 #include 
@@ -39,12 +37,10 @@ __KERNEL_RCSID(0, "$NetBSD: imxi2c.c,v 1
 #include 
 #include 
 
-struct clk_div {
+static const struct clk_div {
 	uint8_t ic_val;
 	int div;
-};
-
-static const struct clk_div imxi2c_clk_div[] = {
+} imxi2c_clk_div[] = {
 	{0x20, 22},   {0x21, 24},   {0x22, 26},   {0x23, 28},
 	{0x00, 30},   {0x01, 32},   {0x24, 32},   {0x02, 36},
 	{0x25, 36},   {0x26, 40},   {0x03, 42},   {0x27, 44},

Index: src/sys/arch/arm/imx/fdt/files.imx6
diff -u src/sys/arch/arm/imx/fdt/files.imx6:1.3 src/sys/arch/arm/imx/fdt/files.imx6:1.4
--- src/sys/arch/arm/imx/fdt/files.imx6:1.3	Tue Jul 30 06:26:31 2019
+++ src/sys/arch/arm/imx/fdt/files.imx6	Tue Jul 30 06:52:57 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx6,v 1.3 2019/07/30 06:26:31 hkenken Exp $
+#	$NetBSD: files.imx6,v 1.4 2019/07/30 06:52:57 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX6
 #
@@ -78,3 +78,9 @@ device	imxpcie: pcibus
 attach	imxpcie at fdt with imxpcie_fdt
 file	arch/arm/imx/imxpcie.c			imxpcie
 file	arch/arm/imx/fdt/imx6_pcie.c		imxpcie_fdt
+
+# iMX iic Controler
+device	imxi2c: motoi2c, i2cbus, i2cexec
+attach	imxi2c at fdt
+file	arch/arm/imx/imxi2c.c			imxi2c
+file	arch/arm/imx/fdt/imx6_i2c.c		imxi2c

Index: src/sys/arch/evbarm/conf/IMX
diff -u src/sys/arch/evbarm/conf/IMX:1.1 src/sys/arch/evbarm/conf/IMX:1.2
--- src/sys/arch/evbarm/conf/IMX:1.1	Wed Jul 24 13:12:34 2019
+++ src/sys/arch/evbarm/conf/IMX	Tue Jul 30 06:52:57 2019
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: IMX,v 1.1 2019/07/24 13:12:34 hkenken Exp $
+#	$NetBSD: IMX,v 1.2 2019/07/30 06:52:57 hkenken Exp $
 #
 #	NXP(Freescale) I.MX family SoCs
 #
@@ -130,5 +130,9 @@ pci*		at imxpcie?
 ppb*		at pci? dev ? function ?
 pci*		at ppb?
 
+# IIC
+imxi2c* 	at fdt?
+iic*		at imxi2c?
+
 cinclude "arch/evbarm/conf/IMX.local"
 

Added files:

Index: src/sys/arch/arm/imx/fdt/imx6_i2c.c
diff -u /dev/null src/sys/arch/arm/imx/fdt/imx6_i2c.c:1.1
--- /dev/null	Tue Jul 30 06:52:58 2019
+++ src/sys/arch/arm/imx/fdt/imx6_i2c.c	Tue Jul 30 06:52:57 2019
@@ -0,0 +1,80 @@
+/*	$NetBSD: imx6_i2c.c,v 1.1 2019/07/30 06:52:57 hkenken Exp $	*/
+/*-
+ * Copyright (c) 2019 Genetec Corporation.  All rights reserved.
+ * Written by Hashimoto Kenichi for Genetec Corporation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#include 
+__KERNEL_RCSID(0, "$NetBSD: imx6_i2c.c,v 1.1 2019/07/30 06:52:57 hkenken Exp 

CVS commit: src/sys/dev/usb

2019-07-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jul 30 06:35:03 UTC 2019

Modified Files:
src/sys/dev/usb: if_smscvar.h

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/usb/if_smscvar.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/if_smscvar.h
diff -u src/sys/dev/usb/if_smscvar.h:1.6 src/sys/dev/usb/if_smscvar.h:1.7
--- src/sys/dev/usb/if_smscvar.h:1.6	Sat Sep  8 13:10:08 2018
+++ src/sys/dev/usb/if_smscvar.h	Tue Jul 30 06:35:03 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_smscvar.h,v 1.6 2018/09/08 13:10:08 mlelstv Exp $	*/
+/*	$NetBSD: if_smscvar.h,v 1.7 2019/07/30 06:35:03 skrll Exp $	*/
 
 /*	$OpenBSD: if_smscreg.h,v 1.2 2012/09/27 12:38:11 jsg Exp $	*/
 /*-
@@ -98,7 +98,6 @@ struct smsc_softc {
 #define	SMSC_FLAG_LINK  0x0001
 
 	struct if_percpuq *sc_ipq;		/* softint-based input queues */
-
 };
 
 #define SMSC_MIN_BUFSZ		2048



CVS commit: src/sys/dev/usb

2019-07-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jul 30 06:35:03 UTC 2019

Modified Files:
src/sys/dev/usb: if_smscvar.h

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/usb/if_smscvar.h

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/imx

2019-07-29 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Tue Jul 30 06:26:31 UTC 2019

Modified Files:
src/sys/arch/arm/imx: if_enet.c if_enet_imx6.c if_enet_imx7.c
src/sys/arch/arm/imx/fdt: files.imx6 if_enet_imx.c

Log Message:
Remove fdtbus_gpio_release() from enet_phy_reset().


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/arm/imx/if_enet.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/imx/if_enet_imx6.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/if_enet_imx7.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/fdt/files.imx6
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/fdt/if_enet_imx.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/imx/if_enet.c
diff -u src/sys/arch/arm/imx/if_enet.c:1.24 src/sys/arch/arm/imx/if_enet.c:1.25
--- src/sys/arch/arm/imx/if_enet.c:1.24	Tue Jul 23 06:36:36 2019
+++ src/sys/arch/arm/imx/if_enet.c	Tue Jul 30 06:26:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet.c,v 1.24 2019/07/23 06:36:36 hkenken Exp $	*/
+/*	$NetBSD: if_enet.c,v 1.25 2019/07/30 06:26:31 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.24 2019/07/23 06:36:36 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.25 2019/07/30 06:26:31 hkenken Exp $");
 
 #include "vlan.h"
 
@@ -166,9 +166,6 @@ static void enet_drain_rxbuf(struct enet
 static int enet_alloc_dma(struct enet_softc *, size_t, void **,
 			  bus_dmamap_t *);
 
-CFATTACH_DECL_NEW(enet, sizeof(struct enet_softc),
-enet_match, enet_attach, NULL, NULL);
-
 int
 enet_attach_common(device_t self)
 {

Index: src/sys/arch/arm/imx/if_enet_imx6.c
diff -u src/sys/arch/arm/imx/if_enet_imx6.c:1.5 src/sys/arch/arm/imx/if_enet_imx6.c:1.6
--- src/sys/arch/arm/imx/if_enet_imx6.c:1.5	Tue Jul 23 06:36:36 2019
+++ src/sys/arch/arm/imx/if_enet_imx6.c	Tue Jul 30 06:26:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet_imx6.c,v 1.5 2019/07/23 06:36:36 hkenken Exp $	*/
+/*	$NetBSD: if_enet_imx6.c,v 1.6 2019/07/30 06:26:31 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_enet_imx6.c,v 1.5 2019/07/23 06:36:36 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet_imx6.c,v 1.6 2019/07/30 06:26:31 hkenken Exp $");
 
 #include "locators.h"
 #include "imxccm.h"
@@ -47,6 +47,9 @@ __KERNEL_RCSID(0, "$NetBSD: if_enet_imx6
 #include 
 #include 
 
+CFATTACH_DECL_NEW(enet, sizeof(struct enet_softc),
+enet_match, enet_attach, NULL, NULL);
+
 static int enet_init_clocks(struct enet_softc *);
 
 int

Index: src/sys/arch/arm/imx/if_enet_imx7.c
diff -u src/sys/arch/arm/imx/if_enet_imx7.c:1.3 src/sys/arch/arm/imx/if_enet_imx7.c:1.4
--- src/sys/arch/arm/imx/if_enet_imx7.c:1.3	Tue Jul 23 06:36:36 2019
+++ src/sys/arch/arm/imx/if_enet_imx7.c	Tue Jul 30 06:26:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet_imx7.c,v 1.3 2019/07/23 06:36:36 hkenken Exp $	*/
+/*	$NetBSD: if_enet_imx7.c,v 1.4 2019/07/30 06:26:31 hkenken Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_enet_imx7.c,v 1.3 2019/07/23 06:36:36 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet_imx7.c,v 1.4 2019/07/30 06:26:31 hkenken Exp $");
 
 #include "locators.h"
 #include "imxccm.h"
@@ -46,6 +46,9 @@ __KERNEL_RCSID(0, "$NetBSD: if_enet_imx7
 #include 
 #include 
 
+CFATTACH_DECL_NEW(enet, sizeof(struct enet_softc),
+enet_match, enet_attach, NULL, NULL);
+
 static void get_mac_from_ocotp(struct enet_softc *, device_t self,
 const char *);
 

Index: src/sys/arch/arm/imx/fdt/files.imx6
diff -u src/sys/arch/arm/imx/fdt/files.imx6:1.2 src/sys/arch/arm/imx/fdt/files.imx6:1.3
--- src/sys/arch/arm/imx/fdt/files.imx6:1.2	Sat Jul 27 08:02:04 2019
+++ src/sys/arch/arm/imx/fdt/files.imx6	Tue Jul 30 06:26:31 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.imx6,v 1.2 2019/07/27 08:02:04 skrll Exp $
+#	$NetBSD: files.imx6,v 1.3 2019/07/30 06:26:31 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX6
 #
@@ -48,9 +48,9 @@ defflag opt_imxuart.h			IMXUARTCONSOLE
 
 # FEC
 device	enet: ether, ifnet, arp, mii, bus_dma_generic
-attach	enet at fdt
+attach	enet at fdt with enet_fdt
 file	arch/arm/imx/if_enet.c		enet
-file	arch/arm/imx/fdt/if_enet_imx.c	enet
+file	arch/arm/imx/fdt/if_enet_imx.c	enet_fdt
 
 # SATA
 attach	ahcisata at fdt with imx6_ahcisata

Index: src/sys/arch/arm/imx/fdt/if_enet_imx.c
diff -u src/sys/arch/arm/imx/fdt/if_enet_imx.c:1.1 src/sys/arch/arm/imx/fdt/if_enet_imx.c:1.2
--- src/sys/arch/arm/imx/fdt/if_enet_imx.c:1.1	Wed Jul 24 13:12:33 2019
+++ src/sys/arch/arm/imx/fdt/if_enet_imx.c	Tue Jul 30 06:26:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet_imx.c,v 1.1 2019/07/24 13:12:33 hkenken Exp $	*/
+/*	$NetBSD: if_enet_imx.c,v 1.2 2019/07/30 06:26:31 hkenken Exp $	*/
 /*-
  * Copyright (c) 2019 Genetec Corporation.  All rights reserved.
  * Wri

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

2019-07-29 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Tue Jul 30 06:26:31 UTC 2019

Modified Files:
src/sys/arch/arm/imx: if_enet.c if_enet_imx6.c if_enet_imx7.c
src/sys/arch/arm/imx/fdt: files.imx6 if_enet_imx.c

Log Message:
Remove fdtbus_gpio_release() from enet_phy_reset().


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/arm/imx/if_enet.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/imx/if_enet_imx6.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/if_enet_imx7.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/fdt/files.imx6
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/fdt/if_enet_imx.c

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



CVS commit: src/sys/dev/pci

2019-07-29 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jul 30 04:42:29 UTC 2019

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

Log Message:
- rnd_add_*() call must be serialized. Unserialized accesses broke the
  sc->rnd_source structure and caused off by one in kern_rndq.c's
  rnd_add_data_ts(). This problem was found by kUBSan. Make krndsource_t's
  data per queue-pair and call rnd_add_uint32() in wm_txrxintr_msix(). One of
  the reason why rnd_add_uint32() calls were moved from wm_{tx,rx}eof() is that
  rnd(9) manual page says "To allow the system to gather the timing information
  accurately, this call should be placed within the actual hardware interrupt
  service routine."
- Pass a better value to rnd_add_uint32() in wm_intr_legacy().

XXX pullup-8.


To generate a diff of this commit:
cvs rdiff -u -r1.644 -r1.645 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.644 src/sys/dev/pci/if_wm.c:1.645
--- src/sys/dev/pci/if_wm.c:1.644	Fri Jul 26 09:26:56 2019
+++ src/sys/dev/pci/if_wm.c	Tue Jul 30 04:42:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.644 2019/07/26 09:26:56 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.645 2019/07/30 04:42:29 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.644 2019/07/26 09:26:56 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.645 2019/07/30 04:42:29 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -234,7 +234,7 @@ static int wm_watchdog_timeout = WM_WATC
  * packet.  We allocate 256 receive descriptors, each with a 2k
  * buffer (MCLBYTES), which gives us room for 50 jumbo packets.
  */
-#define	WM_NRXDESC		256
+#define	WM_NRXDESC		256U
 #define	WM_NRXDESC_MASK		(WM_NRXDESC - 1)
 #define	WM_NEXTRX(x)		(((x) + 1) & WM_NRXDESC_MASK)
 #define	WM_PREVRX(x)		(((x) - 1) & WM_NRXDESC_MASK)
@@ -458,6 +458,7 @@ struct wm_queue {
 	struct wm_rxqueue wmq_rxq;
 
 	void *wmq_si;
+	krndsource_t rnd_source;	/* random source */
 };
 
 struct wm_phyop {
@@ -587,8 +588,6 @@ struct wm_softc {
 
 	int sc_mchash_type;		/* multicast filter offset */
 
-	krndsource_t rnd_source;	/* random source */
-
 	struct if_percpuq *sc_ipq;	/* softint-based input queues */
 
 	kmutex_t *sc_core_lock;		/* lock for softc operations */
@@ -2956,8 +2955,6 @@ alloc_retry:
 	ether_ifattach(ifp, enaddr);
 	ether_set_ifflags_cb(&sc->sc_ethercom, wm_ifflags_cb);
 	if_register(ifp);
-	rnd_attach_source(&sc->rnd_source, xname, RND_TYPE_NET,
-	RND_FLAG_DEFAULT);
 
 #ifdef WM_EVENT_COUNTERS
 	/* Attach event counters. */
@@ -3012,8 +3009,6 @@ wm_detach(device_t self, int flags __unu
 	evcnt_detach(&sc->sc_ev_rx_macctl);
 #endif /* WM_EVENT_COUNTERS */
 
-	rnd_detach_source(&sc->rnd_source);
-
 	/* Tell the firmware about the release */
 	WM_CORE_LOCK(sc);
 	wm_release_manageability(sc);
@@ -6831,6 +6826,15 @@ wm_alloc_txrx_queues(struct wm_softc *sc
 	if (error)
 		goto fail_2;
 
+	for (i = 0; i < sc->sc_nqueues; i++) {
+		char rndname[16];
+
+		snprintf(rndname, sizeof(rndname), "%sTXRX%d",
+		device_xname(sc->sc_dev), i);
+		rnd_attach_source(&sc->sc_queue[i].rnd_source, rndname,
+		RND_TYPE_NET, RND_FLAG_DEFAULT);
+	}
+
 	return 0;
 
  fail_2:
@@ -6866,6 +6870,9 @@ wm_free_txrx_queues(struct wm_softc *sc)
 {
 	int i;
 
+	for (i = 0; i < sc->sc_nqueues; i++)
+		rnd_detach_source(&sc->sc_queue[i].rnd_source);
+
 	for (i = 0; i < sc->sc_nqueues; i++) {
 		struct wm_rxqueue *rxq = &sc->sc_queue[i].wmq_rxq;
 
@@ -8532,9 +8539,6 @@ wm_txeof(struct wm_txqueue *txq, u_int l
 	DPRINTF(WM_DEBUG_TX,
 	("%s: TX: txsdirty -> %d\n", device_xname(sc->sc_dev), i));
 
-	if (count != 0)
-		rnd_add_uint32(&sc->rnd_source, count);
-
 	/*
 	 * If there are no more pending transmissions, cancel the watchdog
 	 * timer.
@@ -8948,9 +8952,6 @@ wm_rxeof(struct wm_rxqueue *rxq, u_int l
 			break;
 	}
 
-	if (count != 0)
-		rnd_add_uint32(&sc->rnd_source, count);
-
 	DPRINTF(WM_DEBUG_RX,
 	("%s: RX: rxptr -> %d\n", device_xname(sc->sc_dev), i));
 
@@ -9416,6 +9417,8 @@ wm_intr_legacy(void *arg)
 		 * So, we can call wm_rxeof() in interrupt context.
 		 */
 		wm_rxeof(rxq, UINT_MAX);
+		/* Fill lower bits with RX index. See below for the upper. */
+		rndval |= rxq->rxq_ptr & WM_NRXDESC_MASK;
 
 		mutex_exit(rxq->rxq_lock);
 		mutex_enter(txq->txq_lock);
@@ -9434,6 +9437,8 @@ wm_intr_legacy(void *arg)
 		}
 #endif
 		wm_txeof(txq, UINT_MAX);
+		/* Fill upper bits with TX index. See above for the lower. */
+		rndval = txq->txq_next * WM_NRXDESC;
 
 		mutex_exit(txq->txq_lock);
 		WM_CORE_LOCK(sc);
@@ -9458,7 +9463,7 @@ wm_intr_legacy(void *arg)
 		}
 	}
 
-	rnd_add_uint32(&sc->rnd_source, rndval);
+	rnd_add_uint32(&sc->sc_queue[0].rnd_source, rndval);
 
 	if (handled) {
 		/* Try to get more packets going. 

CVS commit: src/sys/dev/pci

2019-07-29 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jul 30 04:42:29 UTC 2019

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

Log Message:
- rnd_add_*() call must be serialized. Unserialized accesses broke the
  sc->rnd_source structure and caused off by one in kern_rndq.c's
  rnd_add_data_ts(). This problem was found by kUBSan. Make krndsource_t's
  data per queue-pair and call rnd_add_uint32() in wm_txrxintr_msix(). One of
  the reason why rnd_add_uint32() calls were moved from wm_{tx,rx}eof() is that
  rnd(9) manual page says "To allow the system to gather the timing information
  accurately, this call should be placed within the actual hardware interrupt
  service routine."
- Pass a better value to rnd_add_uint32() in wm_intr_legacy().

XXX pullup-8.


To generate a diff of this commit:
cvs rdiff -u -r1.644 -r1.645 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.



CVS commit: src/etc

2019-07-29 Thread Greg Troxel
Module Name:src
Committed By:   gdt
Date:   Mon Jul 29 17:53:20 UTC 2019

Modified Files:
src/etc: MAKEDEV.tmpl

Log Message:
MAKEDEV.tmpl: Create nodes for 16 USB hubs

As proposed on current-users, but with better formatting.


To generate a diff of this commit:
cvs rdiff -u -r1.204 -r1.205 src/etc/MAKEDEV.tmpl

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

Modified files:

Index: src/etc/MAKEDEV.tmpl
diff -u src/etc/MAKEDEV.tmpl:1.204 src/etc/MAKEDEV.tmpl:1.205
--- src/etc/MAKEDEV.tmpl:1.204	Fri May 31 13:15:00 2019
+++ src/etc/MAKEDEV.tmpl	Mon Jul 29 17:53:20 2019
@@ -1,5 +1,5 @@
 #!/bin/sh -
-#	$NetBSD: MAKEDEV.tmpl,v 1.204 2019/05/31 13:15:00 nia Exp $
+#	$NetBSD: MAKEDEV.tmpl,v 1.205 2019/07/29 17:53:20 gdt Exp $
 #
 # Copyright (c) 2003,2007,2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -914,6 +914,7 @@ ramdisk)
 
 usbs)
 	makedev usb usb0 usb1 usb2 usb3 usb4 usb5 usb6 usb7
+	makedev usb8 usb9 usb10 usb11 usb12 usb13 usb14 usb15
 	makedev uhid0 uhid1 uhid2 uhid3 uhid4 uhid5
 	makedev uhid6 uhid7 uhid8 uhid9 uhid10 uhid11
 	makedev uhid12 uhid13 uhid14 uhid15



CVS commit: src/etc

2019-07-29 Thread Greg Troxel
Module Name:src
Committed By:   gdt
Date:   Mon Jul 29 17:53:20 UTC 2019

Modified Files:
src/etc: MAKEDEV.tmpl

Log Message:
MAKEDEV.tmpl: Create nodes for 16 USB hubs

As proposed on current-users, but with better formatting.


To generate a diff of this commit:
cvs rdiff -u -r1.204 -r1.205 src/etc/MAKEDEV.tmpl

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



Re: CVS commit: src/sys/dev/rasops

2019-07-29 Thread Rin Okuyama

Thank you for rapid response. I was relieved to hear that.
Let me apologize again for the breakage, and thank you
very much for bisectioning the problem.

rin

On 2019/07/30 2:34, Ryo ONODERA wrote:

Hi,

Rin Okuyama  writes:


I committed a (possible) fix:
http://mail-index.netbsd.org/source-changes/2019/07/29/msg107649.html

Could you try rasops_putchar_width.h 1.8?


With rasops_putchar_width.h 1.8, NetBSD/amd64-current on
my laptop works fine again.

Thanks for your quick fix.


Thanks,
rin




Re: CVS commit: src/sys/dev/rasops

2019-07-29 Thread Ryo ONODERA
Hi,

Rin Okuyama  writes:

> I committed a (possible) fix:
> http://mail-index.netbsd.org/source-changes/2019/07/29/msg107649.html
>
> Could you try rasops_putchar_width.h 1.8?

With rasops_putchar_width.h 1.8, NetBSD/amd64-current on
my laptop works fine again.

Thanks for your quick fix.

> Thanks,
> rin

-- 
Ryo ONODERA // r...@tetera.org
PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3


Re: CVS commit: src/sys/dev/rasops

2019-07-29 Thread Rin Okuyama

I committed a (possible) fix:
http://mail-index.netbsd.org/source-changes/2019/07/29/msg107649.html

Could you try rasops_putchar_width.h 1.8?

Thanks,
rin

On 2019/07/30 1:32, Ryo ONODERA wrote:

Hi,

"Rin Okuyama"  writes:


Module Name:src
Committed By:   rin
Date:   Mon Jul 29 03:01:09 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops2.c rasops4.c rasops_putchar_width.h

Log Message:
Convert rasops2.c and rasops4.c to use rasops_putchar_width.h.
Style.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/rasops/rasops2.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/rasops/rasops4.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/rasops/rasops_putchar_width.h

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


Thanks for your hard work.

After this commit, my laptop stops just after 1 character, [, is
displayed.
Latest src tree with partial reverts to
src/sys/dev/rasops/rasops2.c 1.25
src/sys/dev/rasops/rasops4.c 1.19
src/sys/dev/rasops/rasops_putchar_width.h 1.6
works fine.

Could you take a look at my problem?

The dmesg on my laptop is as follows:

Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
2018, 2019 The NetBSD Foundation, Inc.  All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California.  All rights reserved.

NetBSD 8.99.51 (DTRACE7) #8: Tue Jul 30 01:23:26 JST 2019
ryoon@brownie:/usr/world/8.99/amd64/obj/sys/arch/amd64/compile/DTRACE7
total memory = 16132 MB
avail memory = 15639 MB
cpu_rng: RDSEED
timecounter: Timecounters tick every 10.000 msec
Kernelized RAIDframe activated
running cgd selftest aes-xts-256 aes-xts-512 done
acpibat* disabled
acpibat* already disabled
timecounter: Timecounter "i8254" frequency 1193182 Hz quality 100
efi: systbl at pa 2ff15018
HP HP Spectre x360 Convertible 13-ae0xx ( )
mainbus0 (root)
ACPI: RSDP 0x2F36 24 (v02 HPQOEM)
ACPI: XSDT 0x2F3600C0 FC (v01 HPQOEM SLIC-MPC 01072009 HP   
00010013)
ACPI: FACP 0x2F39AC60 000114 (v06 HPQOEM SLIC-MPC 01072009 HP   
00010013)
ACPI: DSDT 0x2F360248 03AA13 (v02 HPQOEM 83B9 01072009 ACPI 
20160422)
ACPI: FACS 0x2F7EAF00 40
ACPI: APIC 0x2F39AD78 BC (v03 HPQOEM 83B9 01072009 HP   
00010013)
ACPI: FPDT 0x2F39AE38 44 (v01 HPQOEM 83B9 01072009 HP   
00010013)
ACPI: FIDT 0x2F39AE80 9C (v01 HPQOEM 83B9 01072009 HP   
00010013)
ACPI: MCFG 0x2F39AF20 3C (v01 HPQOEM 83B9 01072009 HP   
0097)
ACPI: SSDT 0x2F39AF60 0003A3 (v01 HPQOEM 83B9 1000 ACPI 
20160422)
ACPI: SSDT 0x2F39B308 005D97 (v02 HPQOEM 83B9 1000 ACPI 
20160422)
ACPI: MSDM 0x2F3A10A0 55 (v03 HPQOEM SLIC-MPC 0001 HP   
00010013)
ACPI: SSDT 0x2F3A10F8 003156 (v02 HPQOEM 83B9 3000 ACPI 
20160422)
ACPI: HPET 0x2F3A4250 38 (v01 HPQOEM 83B9 0001 HP   
005F)
ACPI: SSDT 0x2F3A4288 24 (v02 HPQOEM 83B9  ACPI 
20160422)
ACPI: UEFI 0x2F3A42B0 42 (v01 HPQOEM 83B9 0002 HP   
0113)
ACPI: SSDT 0x2F3A42F8 0017AE (v02 HPQOEM 83B9 3000 ACPI 
20160422)
ACPI: LPIT 0x2F3A5AA8 94 (v01 HPQOEM 83B9  HP   
005F)
ACPI: SSDT 0x2F3A5B40 000141 (v02 HPQOEM 83B9  ACPI 
20160422)
ACPI: SSDT 0x2F3A5C88 00029F (v02 HPQOEM 83B9  ACPI 
20160422)
ACPI: SSDT 0x2F3A5F28 0011E7 (v02 HPQOEM 83B9 1000 ACPI 
20160422)
ACPI: SSDT 0x2F3A7110 00023D (v02 HPQOEM 83B9  ACPI 
20160422)
ACPI: DBGP 0x2F3A7350 34 (v01 HPQOEM 83B9 0002 HP   
005F)
ACPI: DBG2 0x2F3A7388 54 (v00 HPQOEM 83B9 0002 HP   
005F)
ACPI: DMAR 0x2F3A73E0 000114 (v01 HPQOEM 83B9 0001 HP   
0001)
ACPI: NHLT 0x2F3A74F8 2D (v00 HPQOEM 83B9 0002 HP   
0113)
ACPI: SSDT 0x2F3A7528 66 (v01 HPQOEM 83B9 0001 ACPI 
20160422)
ACPI: TPM2 0x2F3A7590 34 (v03 HPQOEM 83B9 0001 HP   
)
ACPI: ASF! 0x2F3A75C8 A0 (v32 HPQOEM 83B9 0001 HP   
000F4240)
ACPI: WSMT 0x2F3A7668 28 (v01 HPQOEM 83B9 01072009 HP   
00010013)
ACPI: BGRT 0x2F3A7690 38 (v01 HPQOEM 83B9 01072009 HP   
00010013)
ACPI: 11 ACPI AML tables successfully acquired and loaded
ioapic0 at mainbus0 apid 2: pa 0xfec0, version 0x20, 120 pins
x2APIC available but disabled by DMAR table
cpu0 at mainbus0 apid 0
cpu0: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz, id 0x806ea
cpu0: package 0, core 0, smt 0
cpu1 at mainbus0 apid 2
cpu1: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz, id 0x806ea
cpu1: package 0, core 1, smt 0
cpu2 at mainbus0 apid 4
cpu2: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz, id 0x806ea
cpu2: package 0, 

CVS commit: src/sys/dev/rasops

2019-07-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul 29 17:22:19 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops1_putchar_width.h rasops_putchar_width.h

Log Message:
Try to fix problem reported by ryoon:
http://mail-index.netbsd.org/source-changes-d/2019/07/29/msg011516.html

There are apparent bugs for shadow framebuffer. Sorry for the breakage.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/rasops/rasops1_putchar_width.h
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/rasops/rasops_putchar_width.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/rasops/rasops1_putchar_width.h
diff -u src/sys/dev/rasops/rasops1_putchar_width.h:1.1 src/sys/dev/rasops/rasops1_putchar_width.h:1.2
--- src/sys/dev/rasops/rasops1_putchar_width.h:1.1	Mon Jul 29 02:57:41 2019
+++ src/sys/dev/rasops/rasops1_putchar_width.h	Mon Jul 29 17:22:19 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops1_putchar_width.h,v 1.1 2019/07/29 02:57:41 rin Exp $ */
+/* $NetBSD: rasops1_putchar_width.h,v 1.2 2019/07/29 17:22:19 rin Exp $ */
 
 /* NetBSD: rasops1.c,v 1.28 2019/07/25 03:02:44 rin Exp */
 /*-
@@ -94,9 +94,7 @@ PUTCHAR_WIDTH(RASOPS_WIDTH)(void *cookie
 		while (height--) {
 			*rp = bg;
 			DELTA(rp, rs, COPY_UNIT *);
-		}
-		if (ri->ri_hwbits) {
-			while (height--) {
+			if (ri->ri_hwbits) {
 *hrp = bg;
 DELTA(hrp, rs, COPY_UNIT *);
 			}

Index: src/sys/dev/rasops/rasops_putchar_width.h
diff -u src/sys/dev/rasops/rasops_putchar_width.h:1.7 src/sys/dev/rasops/rasops_putchar_width.h:1.8
--- src/sys/dev/rasops/rasops_putchar_width.h:1.7	Mon Jul 29 03:01:09 2019
+++ src/sys/dev/rasops/rasops_putchar_width.h	Mon Jul 29 17:22:19 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops_putchar_width.h,v 1.7 2019/07/29 03:01:09 rin Exp $ */
+/* $NetBSD: rasops_putchar_width.h,v 1.8 2019/07/29 17:22:19 rin Exp $ */
 
 /* NetBSD: rasops8.c,v 1.41 2019/07/25 03:02:44 rin Exp  */
 /*-
@@ -252,9 +252,7 @@ PUTCHAR_WIDTH(RASOPS_DEPTH, RASOPS_WIDTH
 		while (height--) {
 			SUBST_STAMP(rp, 0);
 			DELTA(rp, ri->ri_stride, STAMP_TYPE *);
-		}
-		if (ri->ri_hwbits) {
-			while (height--) {
+			if (ri->ri_hwbits) {
 SUBST_STAMP(hrp, 0);
 DELTA(hrp, ri->ri_stride, STAMP_TYPE *);
 			}



CVS commit: src/sys/dev/rasops

2019-07-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul 29 17:22:19 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops1_putchar_width.h rasops_putchar_width.h

Log Message:
Try to fix problem reported by ryoon:
http://mail-index.netbsd.org/source-changes-d/2019/07/29/msg011516.html

There are apparent bugs for shadow framebuffer. Sorry for the breakage.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/rasops/rasops1_putchar_width.h
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/rasops/rasops_putchar_width.h

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



Re: CVS commit: src/sys/dev/rasops

2019-07-29 Thread Rin Okuyama

Hi,

Oops, sorry for breakage! Can you try the attached patch please?

Thanks,
rin

On 2019/07/30 1:32, Ryo ONODERA wrote:

Hi,

"Rin Okuyama"  writes:


Module Name:src
Committed By:   rin
Date:   Mon Jul 29 03:01:09 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops2.c rasops4.c rasops_putchar_width.h

Log Message:
Convert rasops2.c and rasops4.c to use rasops_putchar_width.h.
Style.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/rasops/rasops2.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/rasops/rasops4.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/rasops/rasops_putchar_width.h

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


Thanks for your hard work.

After this commit, my laptop stops just after 1 character, [, is
displayed.
Latest src tree with partial reverts to
src/sys/dev/rasops/rasops2.c 1.25
src/sys/dev/rasops/rasops4.c 1.19
src/sys/dev/rasops/rasops_putchar_width.h 1.6
works fine.

Could you take a look at my problem?

The dmesg on my laptop is as follows:

Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
2018, 2019 The NetBSD Foundation, Inc.  All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California.  All rights reserved.

NetBSD 8.99.51 (DTRACE7) #8: Tue Jul 30 01:23:26 JST 2019
ryoon@brownie:/usr/world/8.99/amd64/obj/sys/arch/amd64/compile/DTRACE7
total memory = 16132 MB
avail memory = 15639 MB
cpu_rng: RDSEED
timecounter: Timecounters tick every 10.000 msec
Kernelized RAIDframe activated
running cgd selftest aes-xts-256 aes-xts-512 done
acpibat* disabled
acpibat* already disabled
timecounter: Timecounter "i8254" frequency 1193182 Hz quality 100
efi: systbl at pa 2ff15018
HP HP Spectre x360 Convertible 13-ae0xx ( )
mainbus0 (root)
ACPI: RSDP 0x2F36 24 (v02 HPQOEM)
ACPI: XSDT 0x2F3600C0 FC (v01 HPQOEM SLIC-MPC 01072009 HP   
00010013)
ACPI: FACP 0x2F39AC60 000114 (v06 HPQOEM SLIC-MPC 01072009 HP   
00010013)
ACPI: DSDT 0x2F360248 03AA13 (v02 HPQOEM 83B9 01072009 ACPI 
20160422)
ACPI: FACS 0x2F7EAF00 40
ACPI: APIC 0x2F39AD78 BC (v03 HPQOEM 83B9 01072009 HP   
00010013)
ACPI: FPDT 0x2F39AE38 44 (v01 HPQOEM 83B9 01072009 HP   
00010013)
ACPI: FIDT 0x2F39AE80 9C (v01 HPQOEM 83B9 01072009 HP   
00010013)
ACPI: MCFG 0x2F39AF20 3C (v01 HPQOEM 83B9 01072009 HP   
0097)
ACPI: SSDT 0x2F39AF60 0003A3 (v01 HPQOEM 83B9 1000 ACPI 
20160422)
ACPI: SSDT 0x2F39B308 005D97 (v02 HPQOEM 83B9 1000 ACPI 
20160422)
ACPI: MSDM 0x2F3A10A0 55 (v03 HPQOEM SLIC-MPC 0001 HP   
00010013)
ACPI: SSDT 0x2F3A10F8 003156 (v02 HPQOEM 83B9 3000 ACPI 
20160422)
ACPI: HPET 0x2F3A4250 38 (v01 HPQOEM 83B9 0001 HP   
005F)
ACPI: SSDT 0x2F3A4288 24 (v02 HPQOEM 83B9  ACPI 
20160422)
ACPI: UEFI 0x2F3A42B0 42 (v01 HPQOEM 83B9 0002 HP   
0113)
ACPI: SSDT 0x2F3A42F8 0017AE (v02 HPQOEM 83B9 3000 ACPI 
20160422)
ACPI: LPIT 0x2F3A5AA8 94 (v01 HPQOEM 83B9  HP   
005F)
ACPI: SSDT 0x2F3A5B40 000141 (v02 HPQOEM 83B9  ACPI 
20160422)
ACPI: SSDT 0x2F3A5C88 00029F (v02 HPQOEM 83B9  ACPI 
20160422)
ACPI: SSDT 0x2F3A5F28 0011E7 (v02 HPQOEM 83B9 1000 ACPI 
20160422)
ACPI: SSDT 0x2F3A7110 00023D (v02 HPQOEM 83B9  ACPI 
20160422)
ACPI: DBGP 0x2F3A7350 34 (v01 HPQOEM 83B9 0002 HP   
005F)
ACPI: DBG2 0x2F3A7388 54 (v00 HPQOEM 83B9 0002 HP   
005F)
ACPI: DMAR 0x2F3A73E0 000114 (v01 HPQOEM 83B9 0001 HP   
0001)
ACPI: NHLT 0x2F3A74F8 2D (v00 HPQOEM 83B9 0002 HP   
0113)
ACPI: SSDT 0x2F3A7528 66 (v01 HPQOEM 83B9 0001 ACPI 
20160422)
ACPI: TPM2 0x2F3A7590 34 (v03 HPQOEM 83B9 0001 HP   
)
ACPI: ASF! 0x2F3A75C8 A0 (v32 HPQOEM 83B9 0001 HP   
000F4240)
ACPI: WSMT 0x2F3A7668 28 (v01 HPQOEM 83B9 01072009 HP   
00010013)
ACPI: BGRT 0x2F3A7690 38 (v01 HPQOEM 83B9 01072009 HP   
00010013)
ACPI: 11 ACPI AML tables successfully acquired and loaded
ioapic0 at mainbus0 apid 2: pa 0xfec0, version 0x20, 120 pins
x2APIC available but disabled by DMAR table
cpu0 at mainbus0 apid 0
cpu0: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz, id 0x806ea
cpu0: package 0, core 0, smt 0
cpu1 at mainbus0 apid 2
cpu1: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz, id 0x806ea
cpu1: package 0, core 1, smt 0
cpu2 at mainbus0 apid 4
cpu2: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz, id 0x806ea
cpu2: package 0, core 2, smt 0
cpu3 at mainbus0 apid 6
cpu3: Intel(R) Core(TM) i7-8550U CP

Re: CVS commit: src/sys/dev/rasops

2019-07-29 Thread Ryo ONODERA
Hi,

"Rin Okuyama"  writes:

> Module Name:  src
> Committed By: rin
> Date: Mon Jul 29 03:01:09 UTC 2019
>
> Modified Files:
>   src/sys/dev/rasops: rasops2.c rasops4.c rasops_putchar_width.h
>
> Log Message:
> Convert rasops2.c and rasops4.c to use rasops_putchar_width.h.
> Style.
>
>
> To generate a diff of this commit:
> cvs rdiff -u -r1.25 -r1.26 src/sys/dev/rasops/rasops2.c
> cvs rdiff -u -r1.19 -r1.20 src/sys/dev/rasops/rasops4.c
> cvs rdiff -u -r1.6 -r1.7 src/sys/dev/rasops/rasops_putchar_width.h
>
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.

Thanks for your hard work.

After this commit, my laptop stops just after 1 character, [, is
displayed.
Latest src tree with partial reverts to
src/sys/dev/rasops/rasops2.c 1.25
src/sys/dev/rasops/rasops4.c 1.19
src/sys/dev/rasops/rasops_putchar_width.h 1.6
works fine.

Could you take a look at my problem?

The dmesg on my laptop is as follows:

Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
2018, 2019 The NetBSD Foundation, Inc.  All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
The Regents of the University of California.  All rights reserved.

NetBSD 8.99.51 (DTRACE7) #8: Tue Jul 30 01:23:26 JST 2019
ryoon@brownie:/usr/world/8.99/amd64/obj/sys/arch/amd64/compile/DTRACE7
total memory = 16132 MB
avail memory = 15639 MB
cpu_rng: RDSEED
timecounter: Timecounters tick every 10.000 msec
Kernelized RAIDframe activated
running cgd selftest aes-xts-256 aes-xts-512 done
acpibat* disabled
acpibat* already disabled
timecounter: Timecounter "i8254" frequency 1193182 Hz quality 100
efi: systbl at pa 2ff15018
HP HP Spectre x360 Convertible 13-ae0xx ( )
mainbus0 (root)
ACPI: RSDP 0x2F36 24 (v02 HPQOEM)
ACPI: XSDT 0x2F3600C0 FC (v01 HPQOEM SLIC-MPC 01072009 HP   
00010013)
ACPI: FACP 0x2F39AC60 000114 (v06 HPQOEM SLIC-MPC 01072009 HP   
00010013)
ACPI: DSDT 0x2F360248 03AA13 (v02 HPQOEM 83B9 01072009 ACPI 
20160422)
ACPI: FACS 0x2F7EAF00 40
ACPI: APIC 0x2F39AD78 BC (v03 HPQOEM 83B9 01072009 HP   
00010013)
ACPI: FPDT 0x2F39AE38 44 (v01 HPQOEM 83B9 01072009 HP   
00010013)
ACPI: FIDT 0x2F39AE80 9C (v01 HPQOEM 83B9 01072009 HP   
00010013)
ACPI: MCFG 0x2F39AF20 3C (v01 HPQOEM 83B9 01072009 HP   
0097)
ACPI: SSDT 0x2F39AF60 0003A3 (v01 HPQOEM 83B9 1000 ACPI 
20160422)
ACPI: SSDT 0x2F39B308 005D97 (v02 HPQOEM 83B9 1000 ACPI 
20160422)
ACPI: MSDM 0x2F3A10A0 55 (v03 HPQOEM SLIC-MPC 0001 HP   
00010013)
ACPI: SSDT 0x2F3A10F8 003156 (v02 HPQOEM 83B9 3000 ACPI 
20160422)
ACPI: HPET 0x2F3A4250 38 (v01 HPQOEM 83B9 0001 HP   
005F)
ACPI: SSDT 0x2F3A4288 24 (v02 HPQOEM 83B9  ACPI 
20160422)
ACPI: UEFI 0x2F3A42B0 42 (v01 HPQOEM 83B9 0002 HP   
0113)
ACPI: SSDT 0x2F3A42F8 0017AE (v02 HPQOEM 83B9 3000 ACPI 
20160422)
ACPI: LPIT 0x2F3A5AA8 94 (v01 HPQOEM 83B9  HP   
005F)
ACPI: SSDT 0x2F3A5B40 000141 (v02 HPQOEM 83B9  ACPI 
20160422)
ACPI: SSDT 0x2F3A5C88 00029F (v02 HPQOEM 83B9  ACPI 
20160422)
ACPI: SSDT 0x2F3A5F28 0011E7 (v02 HPQOEM 83B9 1000 ACPI 
20160422)
ACPI: SSDT 0x2F3A7110 00023D (v02 HPQOEM 83B9  ACPI 
20160422)
ACPI: DBGP 0x2F3A7350 34 (v01 HPQOEM 83B9 0002 HP   
005F)
ACPI: DBG2 0x2F3A7388 54 (v00 HPQOEM 83B9 0002 HP   
005F)
ACPI: DMAR 0x2F3A73E0 000114 (v01 HPQOEM 83B9 0001 HP   
0001)
ACPI: NHLT 0x2F3A74F8 2D (v00 HPQOEM 83B9 0002 HP   
0113)
ACPI: SSDT 0x2F3A7528 66 (v01 HPQOEM 83B9 0001 ACPI 
20160422)
ACPI: TPM2 0x2F3A7590 34 (v03 HPQOEM 83B9 0001 HP   
)
ACPI: ASF! 0x2F3A75C8 A0 (v32 HPQOEM 83B9 0001 HP   
000F4240)
ACPI: WSMT 0x2F3A7668 28 (v01 HPQOEM 83B9 01072009 HP   
00010013)
ACPI: BGRT 0x2F3A7690 38 (v01 HPQOEM 83B9 01072009 HP   
00010013)
ACPI: 11 ACPI AML tables successfully acquired and loaded
ioapic0 at mainbus0 apid 2: pa 0xfec0, version 0x20, 120 pins
x2APIC available but disabled by DMAR table
cpu0 at mainbus0 apid 0
cpu0: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz, id 0x806ea
cpu0: package 0, core 0, smt 0
cpu1 at mainbus0 apid 2
cpu1: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz, id 0x806ea
cpu1: package 0, core 1, smt 0
cpu2 at mainbus0 apid 4
cpu2: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz, id 0x806ea
cpu2: package 0, core 2, smt 0
cpu3 at mainbus0 apid 6
cpu3: Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz, id 0x806ea
cpu3: package 0, core 3, smt 0
cpu4 at mainbus0 apid 1
cpu4: Intel(R) Core(TM)

CVS commit: src/sys/dev/rasops

2019-07-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul 29 16:17:29 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops.c rasops24.c

Log Message:
Hmmm, color was still strange for 24bpp on little endian machine,
only when font width is 12.

We need to use different devcmap for that case, if we wish to share
codes for other depths/font widths as possible as we can.

XXX
What should we do for big endian? I have no big endian machines with
24bpp framebuffer...


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/dev/rasops/rasops.c
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/rasops/rasops24.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/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.96 src/sys/dev/rasops/rasops.c:1.97
--- src/sys/dev/rasops/rasops.c:1.96	Mon Jul 29 14:43:14 2019
+++ src/sys/dev/rasops/rasops.c	Mon Jul 29 16:17:29 2019
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.96 2019/07/29 14:43:14 rin Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.97 2019/07/29 16:17:29 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.96 2019/07/29 14:43:14 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.97 2019/07/29 16:17:29 rin Exp $");
 
 #include "opt_rasops.h"
 #include "rasops_glue.h"
@@ -901,8 +901,18 @@ rasops_init_devcmap(struct rasops_info *
 			c |= c << 16;
 		else if (ri->ri_depth == 24) {
 #if BYTE_ORDER == LITTLE_ENDIAN
-			c = (c & 0xff) << 16 | (c & 0x00ff00) |
-			(c & 0xff) >> 16;
+#  ifndef RASOPS_SMALL
+			if (ri->ri_font->fontwidth != 12)
+#  endif
+c = (c & 0xff) << 16 | (c & 0x00ff00) |
+(c & 0xff) >> 16;
+#  ifndef RASOPS_SMALL
+			else
+c = (c & 0xff) | (c & 0x00ff00) << 8 |
+(c & 0xff) >> 8;
+#  endif
+#else
+			/* XXXRO What should we do here? */
 #endif
 			c |= (c & 0xff) << 24;
 		}

Index: src/sys/dev/rasops/rasops24.c
diff -u src/sys/dev/rasops/rasops24.c:1.37 src/sys/dev/rasops/rasops24.c:1.38
--- src/sys/dev/rasops/rasops24.c:1.37	Mon Jul 29 14:06:32 2019
+++ src/sys/dev/rasops/rasops24.c	Mon Jul 29 16:17:29 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops24.c,v 1.37 2019/07/29 14:06:32 rin Exp $	*/
+/* 	$NetBSD: rasops24.c,v 1.38 2019/07/29 16:17:29 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.37 2019/07/29 14:06:32 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.38 2019/07/29 16:17:29 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -80,6 +80,14 @@ void
 rasops24_init(struct rasops_info *ri)
 {
 
+#ifndef RASOPS_SMALL
+	/*
+	 * Different devcmap's are used depending on font widths,
+	 * therefore we need reset stamp here.
+	 */
+	stamp_attr = 0;
+#endif
+
 	if (ri->ri_rnum == 0) {
 		ri->ri_rnum = ri->ri_gnum = ri->ri_bnum = 8;
 



CVS commit: src/sys/dev/rasops

2019-07-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul 29 16:17:29 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops.c rasops24.c

Log Message:
Hmmm, color was still strange for 24bpp on little endian machine,
only when font width is 12.

We need to use different devcmap for that case, if we wish to share
codes for other depths/font widths as possible as we can.

XXX
What should we do for big endian? I have no big endian machines with
24bpp framebuffer...


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/dev/rasops/rasops.c
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/rasops/rasops24.c

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



CVS commit: src/sys/dev/rasops

2019-07-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul 29 14:59:25 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops_putchar_aa.h

Log Message:
Simplify and tiny optimization.


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

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



CVS commit: src/sys/dev/rasops

2019-07-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul 29 14:59:25 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops_putchar_aa.h

Log Message:
Simplify and tiny optimization.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/rasops/rasops_putchar_aa.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/rasops/rasops_putchar_aa.h
diff -u src/sys/dev/rasops/rasops_putchar_aa.h:1.2 src/sys/dev/rasops/rasops_putchar_aa.h:1.3
--- src/sys/dev/rasops/rasops_putchar_aa.h:1.2	Mon Jul 29 14:06:32 2019
+++ src/sys/dev/rasops/rasops_putchar_aa.h	Mon Jul 29 14:59:25 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops_putchar_aa.h,v 1.2 2019/07/29 14:06:32 rin Exp $ */
+/* $NetBSD: rasops_putchar_aa.h,v 1.3 2019/07/29 14:59:25 rin Exp $ */
 
 /* NetBSD: rasops8.c,v 1.43 2019/07/28 12:06:10 rin Exp */
 /*-
@@ -51,30 +51,23 @@
 #endif
 
 #if RASOPS_DEPTH != 24
+#define	COLOR_TYPE	PIXEL_TYPE
 #define	PIXEL_LEN	sizeof(PIXEL_TYPE)
 #define	BUF_LEN		MAX_WIDTH
 #define	SET_PIXEL(x, c)	buf[x] = clr[c]
-#endif /* RASOPS_DEPTH != 24 */
+#endif
 
 #if RASOPS_DEPTH == 24
+#define	COLOR_TYPE	uint32_t
 #define	PIXEL_LEN	3
 #define	BUF_LEN		(MAX_WIDTH * 3)
-#  if BYTE_ORDER == LITTLE_ENDIAN
-#define	ROFF		(ri->ri_rpos / 8)
-#define	GOFF		(ri->ri_gpos / 8)
-#define	BOFF		(ri->ri_bpos / 8)
-#  else	/* BIG_ENDIAN XXX not tested */
-#define	ROFF		(2 - ri->ri_rpos / 8)
-#define	GOFF		(2 - ri->ri_gpos / 8)
-#define	BOFF		(2 - ri->ri_bpos / 8)
-#  endif
 #define	SET_PIXEL(x, c)\
 	do {	\
-		buf[3 * x + ROFF] = r[c];	\
-		buf[3 * x + GOFF] = g[c];	\
-		buf[3 * x + BOFF] = b[c];	\
+		buf[3 * x + 0] = clr[c] >> 16;	\
+		buf[3 * x + 1] = clr[c] >> 8;	\
+		buf[3 * x + 2] = clr[c];	\
 	} while (0 /* CONSTCOND */)
-#endif /* RASOPS_DEPTH == 24 */
+#endif
 
 #if RASOPS_DEPTH != 8
 #define	SET_BUF(c)	for (x = 0; x < width; x++) { SET_PIXEL(x, c); }
@@ -92,9 +85,7 @@ PUTCHAR_AA(RASOPS_DEPTH)(void *cookie, i
 	uint8_t *fr, aval;
 	PIXEL_TYPE *rp, *hp, R, G, B;
 	PIXEL_TYPE buf[BUF_LEN] __attribute__ ((aligned(8))); /* XXX */
-#if RASOPS_DEPTH != 24
-	PIXEL_TYPE clr[2];
-#endif
+	COLOR_TYPE clr[2];
 
 	hp = NULL;	/* XXX GCC */
 
@@ -123,23 +114,8 @@ PUTCHAR_AA(RASOPS_DEPTH)(void *cookie, i
 	if (__predict_false(width > MAX_WIDTH))
 		width = MAX_WIDTH;
 
-#if RASOPS_DEPTH != 24
-	clr[0] = (PIXEL_TYPE)ri->ri_devcmap[((uint32_t)attr >> 16) & 0xf];
-	clr[1] = (PIXEL_TYPE)ri->ri_devcmap[((uint32_t)attr >> 24) & 0xf];
-#endif
-
-	/*
-	 * This is independent to positions/lengths of RGB in pixel.
-	 */
-	off[0] = (((uint32_t)attr >> 16) & 0xf) * 3;
-	off[1] = (((uint32_t)attr >> 24) & 0xf) * 3;
-
-	r[0] = rasops_cmap[off[0]];
-	r[1] = rasops_cmap[off[1]];
-	g[0] = rasops_cmap[off[0] + 1];
-	g[1] = rasops_cmap[off[1] + 1];
-	b[0] = rasops_cmap[off[0] + 2];
-	b[1] = rasops_cmap[off[1] + 2];
+	clr[0] = (COLOR_TYPE)ri->ri_devcmap[((uint32_t)attr >> 16) & 0xf];
+	clr[1] = (COLOR_TYPE)ri->ri_devcmap[((uint32_t)attr >> 24) & 0xf];
 
 	if (uc == ' ') {
 		SET_BUF(0);
@@ -154,6 +130,19 @@ PUTCHAR_AA(RASOPS_DEPTH)(void *cookie, i
 	} else {
 		fr = FONT_GLYPH(uc, font, ri);
 
+		/*
+	 	 * This is independent to positions/lengths of RGB in pixel.
+	 	 */
+		off[0] = (((uint32_t)attr >> 16) & 0xf) * 3;
+		off[1] = (((uint32_t)attr >> 24) & 0xf) * 3;
+
+		r[0] = rasops_cmap[off[0]];
+		r[1] = rasops_cmap[off[1]];
+		g[0] = rasops_cmap[off[0] + 1];
+		g[1] = rasops_cmap[off[1] + 1];
+		b[0] = rasops_cmap[off[0] + 2];
+		b[1] = rasops_cmap[off[1] + 2];
+
 		for (y = 0; y < height; y++) {
 			for (x = 0; x < width; x++) {
 aval = *fr;
@@ -179,9 +168,21 @@ PUTCHAR_AA(RASOPS_DEPTH)(void *cookie, i
 #endif
 
 #if RASOPS_DEPTH == 24
+#  if BYTE_ORDER == LITTLE_ENDIAN
+#define	ROFF	(ri->ri_rpos / 8)
+#define	GOFF	(ri->ri_gpos / 8)
+#define	BOFF	(ri->ri_bpos / 8)
+#  else	/* BIG_ENDIAN XXX not tested */
+#define	ROFF	(2 - ri->ri_rpos / 8)
+#define	GOFF	(2 - ri->ri_gpos / 8)
+#define	BOFF	(2 - ri->ri_bpos / 8)
+#  endif
 	buf[3 * x + ROFF] = R;
 	buf[3 * x + GOFF] = G;
 	buf[3 * x + BOFF] = B;
+#undef	ROFF
+#undef	GOFF
+#undef	BOFF
 #endif
 }
 			}
@@ -212,11 +213,7 @@ PUTCHAR_AA(RASOPS_DEPTH)(void *cookie, i
 #undef	MAX_WIDTH
 
 #undef	PIXEL_TYPE
+#undef	COLOR_TYPE
 #undef	PIXEL_LEN
 #undef	SET_PIXEL
-
-#undef	ROFF
-#undef	GOFF
-#undef	BOFF
-
 #undef	SET_BUF



CVS commit: src/sys/dev/rasops

2019-07-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul 29 14:43:14 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops.c

Log Message:
Fix color on 24bpp screen for little endian.


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/dev/rasops/rasops.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/rasops/rasops.c
diff -u src/sys/dev/rasops/rasops.c:1.95 src/sys/dev/rasops/rasops.c:1.96
--- src/sys/dev/rasops/rasops.c:1.95	Mon Jul 29 01:04:20 2019
+++ src/sys/dev/rasops/rasops.c	Mon Jul 29 14:43:14 2019
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops.c,v 1.95 2019/07/29 01:04:20 rin Exp $	*/
+/*	 $NetBSD: rasops.c,v 1.96 2019/07/29 14:43:14 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.95 2019/07/29 01:04:20 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.96 2019/07/29 14:43:14 rin Exp $");
 
 #include "opt_rasops.h"
 #include "rasops_glue.h"
@@ -899,8 +899,13 @@ rasops_init_devcmap(struct rasops_info *
 			c |= c << 16;
 		} else if (ri->ri_depth == 15 || ri->ri_depth == 16)
 			c |= c << 16;
-		else if (ri->ri_depth == 24)
+		else if (ri->ri_depth == 24) {
+#if BYTE_ORDER == LITTLE_ENDIAN
+			c = (c & 0xff) << 16 | (c & 0x00ff00) |
+			(c & 0xff) >> 16;
+#endif
 			c |= (c & 0xff) << 24;
+		}
 
 		/* 24bpp does bswap on the fly. {32,16,15}bpp do it here. */
 		if ((ri->ri_flg & RI_BSWAP) == 0)



CVS commit: src/sys/dev/rasops

2019-07-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul 29 14:43:14 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops.c

Log Message:
Fix color on 24bpp screen for little endian.


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/dev/rasops/rasops.c

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



CVS commit: src/sys/dev/wsfb

2019-07-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul 29 14:07:37 UTC 2019

Modified Files:
src/sys/dev/wsfb: genfb.c

Log Message:
Enable anti-aliasing for depth 24.
Style.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/wsfb/genfb.c

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



CVS commit: src/sys/dev/wsfb

2019-07-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul 29 14:07:37 UTC 2019

Modified Files:
src/sys/dev/wsfb: genfb.c

Log Message:
Enable anti-aliasing for depth 24.
Style.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/wsfb/genfb.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/wsfb/genfb.c
diff -u src/sys/dev/wsfb/genfb.c:1.66 src/sys/dev/wsfb/genfb.c:1.67
--- src/sys/dev/wsfb/genfb.c:1.66	Sun Jul 28 02:42:48 2019
+++ src/sys/dev/wsfb/genfb.c	Mon Jul 29 14:07:37 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfb.c,v 1.66 2019/07/28 02:42:48 rin Exp $ */
+/*	$NetBSD: genfb.c,v 1.67 2019/07/29 14:07:37 rin Exp $ */
 
 /*-
  * Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.66 2019/07/28 02:42:48 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.67 2019/07/29 14:07:37 rin Exp $");
 
 #include 
 #include 
@@ -557,16 +557,13 @@ genfb_init_screen(void *cookie, struct v
 		scr->scr_flags |= VCONS_DONT_READ;
 	}
 
-	if (existing && sc->sc_want_clear) {
+	if (existing && sc->sc_want_clear)
 		ri->ri_flg |= RI_CLEAR;
-	}
 
 	if (ri->ri_depth == 32 || ri->ri_depth == 24) {
-		bool is_bgr = false;
+		ri->ri_flg |= RI_ENABLE_ALPHA;
 
-		if (ri->ri_depth == 32) {
-			ri->ri_flg |= RI_ENABLE_ALPHA;
-		}
+		bool is_bgr = false;
 		prop_dictionary_get_bool(device_properties(sc->sc_dev),
 		"is_bgr", &is_bgr);
 		if (is_bgr) {



CVS commit: src/sys/dev/rasops

2019-07-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul 29 14:06:32 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops24.c rasops_putchar_aa.h

Log Message:
Support anti-aliasing for depth 24.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/rasops/rasops24.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/rasops/rasops_putchar_aa.h

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



CVS commit: src/sys/dev/rasops

2019-07-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul 29 14:06:32 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops24.c rasops_putchar_aa.h

Log Message:
Support anti-aliasing for depth 24.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/rasops/rasops24.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/rasops/rasops_putchar_aa.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/rasops/rasops24.c
diff -u src/sys/dev/rasops/rasops24.c:1.36 src/sys/dev/rasops/rasops24.c:1.37
--- src/sys/dev/rasops/rasops24.c:1.36	Sun Jul 28 12:06:10 2019
+++ src/sys/dev/rasops/rasops24.c	Mon Jul 29 14:06:32 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops24.c,v 1.36 2019/07/28 12:06:10 rin Exp $	*/
+/* 	$NetBSD: rasops24.c,v 1.37 2019/07/29 14:06:32 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.36 2019/07/28 12:06:10 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops24.c,v 1.37 2019/07/29 14:06:32 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -48,6 +48,7 @@ __KERNEL_RCSID(0, "$NetBSD: rasops24.c,v
 static void 	rasops24_erasecols(void *, int, int, int, long);
 static void 	rasops24_eraserows(void *, int, int, long);
 static void 	rasops24_putchar(void *, int, int, u_int, long);
+static void 	rasops24_putchar_aa(void *, int, int, u_int, long);
 #ifndef RASOPS_SMALL
 static void 	rasops24_putchar8(void *, int, int, u_int, long);
 static void 	rasops24_putchar12(void *, int, int, u_int, long);
@@ -90,6 +91,11 @@ rasops24_init(struct rasops_info *ri)
 	ri->ri_ops.erasecols = rasops24_erasecols;
 	ri->ri_ops.eraserows = rasops24_eraserows;
 
+	if (FONT_IS_ALPHA(ri->ri_font)) {
+		ri->ri_ops.putchar = rasops24_putchar_aa;
+		return;
+	}
+
 	switch (ri->ri_font->fontwidth) {
 #ifndef RASOPS_SMALL
 	case 8:
@@ -110,6 +116,7 @@ rasops24_init(struct rasops_info *ri)
 
 #define	RASOPS_DEPTH	24
 #include "rasops_putchar.h"
+#include "rasops_putchar_aa.h"
 
 #ifndef RASOPS_SMALL
 /*

Index: src/sys/dev/rasops/rasops_putchar_aa.h
diff -u src/sys/dev/rasops/rasops_putchar_aa.h:1.1 src/sys/dev/rasops/rasops_putchar_aa.h:1.2
--- src/sys/dev/rasops/rasops_putchar_aa.h:1.1	Mon Jul 29 10:55:56 2019
+++ src/sys/dev/rasops/rasops_putchar_aa.h	Mon Jul 29 14:06:32 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops_putchar_aa.h,v 1.1 2019/07/29 10:55:56 rin Exp $ */
+/* $NetBSD: rasops_putchar_aa.h,v 1.2 2019/07/29 14:06:32 rin Exp $ */
 
 /* NetBSD: rasops8.c,v 1.43 2019/07/28 12:06:10 rin Exp */
 /*-
@@ -30,7 +30,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#if RASOPS_DEPTH != 8 && RASOPS_DEPTH != 15 && /* RASOPS_DEPTH != 24 && */ \
+#if RASOPS_DEPTH != 8 && RASOPS_DEPTH != 15 && RASOPS_DEPTH != 24 && \
 RASOPS_DEPTH != 32
 #error "Depth not supported"
 #endif
@@ -38,33 +38,63 @@
 #define	PUTCHAR_AA(depth)	PUTCHAR_AA1(depth)
 #define	PUTCHAR_AA1(depth)	rasops ## depth ## _putchar_aa
 
+#define	MAX_WIDTH	64	/* XXX */
+
 #if   RASOPS_DEPTH == 8
 #define	PIXEL_TYPE	uint8_t
-#define	PIXEL_BITS	8
 #elif RASOPS_DEPTH == 15
 #define	PIXEL_TYPE	uint16_t
-#define	PIXEL_BITS	16
+#elif RASOPS_DEPTH == 24
+#define	PIXEL_TYPE	uint8_t
 #elif RASOPS_DEPTH == 32
 #define	PIXEL_TYPE	uint32_t
-#define	PIXEL_BITS	32
 #endif
 
-#define	MAX_WIDTH	64	/* XXX */
+#if RASOPS_DEPTH != 24
+#define	PIXEL_LEN	sizeof(PIXEL_TYPE)
+#define	BUF_LEN		MAX_WIDTH
+#define	SET_PIXEL(x, c)	buf[x] = clr[c]
+#endif /* RASOPS_DEPTH != 24 */
+
+#if RASOPS_DEPTH == 24
+#define	PIXEL_LEN	3
+#define	BUF_LEN		(MAX_WIDTH * 3)
+#  if BYTE_ORDER == LITTLE_ENDIAN
+#define	ROFF		(ri->ri_rpos / 8)
+#define	GOFF		(ri->ri_gpos / 8)
+#define	BOFF		(ri->ri_bpos / 8)
+#  else	/* BIG_ENDIAN XXX not tested */
+#define	ROFF		(2 - ri->ri_rpos / 8)
+#define	GOFF		(2 - ri->ri_gpos / 8)
+#define	BOFF		(2 - ri->ri_bpos / 8)
+#  endif
+#define	SET_PIXEL(x, c)\
+	do {	\
+		buf[3 * x + ROFF] = r[c];	\
+		buf[3 * x + GOFF] = g[c];	\
+		buf[3 * x + BOFF] = b[c];	\
+	} while (0 /* CONSTCOND */)
+#endif /* RASOPS_DEPTH == 24 */
+
+#if RASOPS_DEPTH != 8
+#define	SET_BUF(c)	for (x = 0; x < width; x++) { SET_PIXEL(x, c); }
+#else
+#define	SET_BUF(c)	memset(buf, clr[c], width)
+#endif
 
 static void
 PUTCHAR_AA(RASOPS_DEPTH)(void *cookie, int row, int col, u_int uc, long attr)
 {
 	struct rasops_info *ri = (struct rasops_info *)cookie;
 	struct wsdisplay_font *font = PICK_FONT(ri, uc);
-	int height, width, bgo, fgo, x, y;
-	uint8_t *fr, r0, r1, g0, g1, b0, b1, aval;
-#if RASOPS_DEPTH == 8
-	uint16_t r, g, b;
-#else
-	PIXEL_TYPE r, g, b;
+	int height, width, x, y, off[2];
+	uint16_t r[2], g[2], b[2];
+	uint8_t *fr, aval;
+	PIXEL_TYPE *rp, *hp, R, G, B;
+	PIXEL_TYPE buf[BUF_LEN] __attribute__ ((aligned(8))); /* XXX */
+#if RASOPS_DEPTH != 24
+	PIXEL_TYPE clr[2];
 #endif
-	PIXEL_TYPE *rp, *hp, bg, fg, pixel;
-	PIXEL_TYPE buf[MAX_WIDTH] __attribute__ ((aligned(8))); /* XXX */
 
 	hp = NULL;	/* XXX 

CVS commit: src/sys/arch/i386/stand/efiboot

2019-07-29 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Jul 29 12:37:26 UTC 2019

Modified Files:
src/sys/arch/i386/stand/efiboot: efiboot.c

Log Message:
Added missing efi_memory_probe() call.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/i386/stand/efiboot/efiboot.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/i386/stand/efiboot/efiboot.c
diff -u src/sys/arch/i386/stand/efiboot/efiboot.c:1.9 src/sys/arch/i386/stand/efiboot/efiboot.c:1.10
--- src/sys/arch/i386/stand/efiboot/efiboot.c:1.9	Mon Jul 29 11:28:51 2019
+++ src/sys/arch/i386/stand/efiboot/efiboot.c	Mon Jul 29 12:37:26 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: efiboot.c,v 1.9 2019/07/29 11:28:51 nonaka Exp $	*/
+/*	$NetBSD: efiboot.c,v 1.10 2019/07/29 12:37:26 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -88,6 +88,7 @@ efi_main(EFI_HANDLE imageHandle, EFI_SYS
 		}
 	}
 
+	efi_memory_probe();
 	efi_disk_probe();
 	efi_pxe_probe();
 	efi_net_probe();



CVS commit: src/sys/arch/i386/stand/efiboot

2019-07-29 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Jul 29 12:37:26 UTC 2019

Modified Files:
src/sys/arch/i386/stand/efiboot: efiboot.c

Log Message:
Added missing efi_memory_probe() call.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/i386/stand/efiboot/efiboot.c

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



CVS commit: src/sys/dev/ic

2019-07-29 Thread Greg Troxel
Module Name:src
Committed By:   gdt
Date:   Mon Jul 29 12:07:57 UTC 2019

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

Log Message:
sys/dev/ic/mfi.c: Add missing break in switch

(The entire switch is guarded by MFI_DEBUG and is known not to build.)
Reported by Oskar.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/dev/ic/mfi.c

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



CVS commit: src/sys/dev/ic

2019-07-29 Thread Greg Troxel
Module Name:src
Committed By:   gdt
Date:   Mon Jul 29 12:07:57 UTC 2019

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

Log Message:
sys/dev/ic/mfi.c: Add missing break in switch

(The entire switch is guarded by MFI_DEBUG and is known not to build.)
Reported by Oskar.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/dev/ic/mfi.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/mfi.c
diff -u src/sys/dev/ic/mfi.c:1.60 src/sys/dev/ic/mfi.c:1.61
--- src/sys/dev/ic/mfi.c:1.60	Sat Nov 24 18:10:29 2018
+++ src/sys/dev/ic/mfi.c	Mon Jul 29 12:07:57 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: mfi.c,v 1.60 2018/11/24 18:10:29 bouyer Exp $ */
+/* $NetBSD: mfi.c,v 1.61 2019/07/29 12:07:57 gdt Exp $ */
 /* $OpenBSD: mfi.c,v 1.66 2006/11/28 23:59:45 dlg Exp $ */
 
 /*
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.60 2018/11/24 18:10:29 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.61 2019/07/29 12:07:57 gdt Exp $");
 
 #include "bio.h"
 
@@ -869,6 +869,7 @@ mfi_get_bbu(struct mfi_softc *sc, struct
 		stat->detail.bbu.remaining_capacity ,
 		stat->detail.bbu.full_charge_capacity ,
 		stat->detail.bbu.is_SOH_good);
+		break;
 	default:
 		printf("\n");
 	}



CVS commit: src/sys/arch/i386/stand/efiboot

2019-07-29 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Jul 29 11:33:07 UTC 2019

Modified Files:
src/sys/arch/i386/stand/efiboot: efimemory.c

Log Message:
Sync the output of memmap command to the output of stand/efiboot mem command.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/i386/stand/efiboot/efimemory.c

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



CVS commit: src/sys/arch/i386/stand/efiboot

2019-07-29 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Jul 29 11:33:07 UTC 2019

Modified Files:
src/sys/arch/i386/stand/efiboot: efimemory.c

Log Message:
Sync the output of memmap command to the output of stand/efiboot mem command.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/i386/stand/efiboot/efimemory.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/i386/stand/efiboot/efimemory.c
diff -u src/sys/arch/i386/stand/efiboot/efimemory.c:1.7 src/sys/arch/i386/stand/efiboot/efimemory.c:1.8
--- src/sys/arch/i386/stand/efiboot/efimemory.c:1.7	Mon Jul 29 11:28:51 2019
+++ src/sys/arch/i386/stand/efiboot/efimemory.c	Mon Jul 29 11:33:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: efimemory.c,v 1.7 2019/07/29 11:28:51 nonaka Exp $	*/
+/*	$NetBSD: efimemory.c,v 1.8 2019/07/29 11:33:07 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -30,38 +30,22 @@
 
 #include 
 
-static const char *memtypes[] = {
-	"unknown",
-	"available",
-	"reserved",
-	"ACPI reclaimable",
-	"ACPI NVS",
-	"unusable",
-	"disabled",
-	"Persistent",
-	"undefined (8)",
-	"undefined (9)",
-	"undefined (10)",
-	"undefined (11)",
-	"Persistent (Legacy)"
-};
-
-static const char *efimemtypes[] = {
-	"Reserved",
-	"LoaderCode",
-	"LoaderData",
-	"BootServicesCode",
-	"BootServicesData",
-	"RuntimeServicesCode",
-	"RuntimeServicesData",
-	"ConventionalMemory",
-	"UnusableMemory",
-	"ACPIReclaimMemory",
-	"ACPIMemoryNVS",
-	"MemoryMappedIO",
-	"MemoryMappedIOPortSpace",
-	"PalCode",
-	"PersistentMemory",
+static const char *efi_memory_type[] = {
+	[EfiReservedMemoryType]		= "Reserved Memory Type",
+	[EfiLoaderCode]			= "Loader Code",
+	[EfiLoaderData]			= "Loader Data",
+	[EfiBootServicesCode]		= "Boot Services Code",
+	[EfiBootServicesData]		= "Boot Services Data",
+	[EfiRuntimeServicesCode]	= "Runtime Services Code",
+	[EfiRuntimeServicesData]	= "Runtime Services Data",
+	[EfiConventionalMemory]		= "Conventional Memory",
+	[EfiUnusableMemory]		= "Unusable Memory",
+	[EfiACPIReclaimMemory]		= "ACPI Reclaim Memory",
+	[EfiACPIMemoryNVS]		= "ACPI Memory NVS",
+	[EfiMemoryMappedIO]		= "MMIO",
+	[EfiMemoryMappedIOPortSpace]	= "MMIO (Port Space)",
+	[EfiPalCode]			= "Pal Code",
+	[EfiPersistentMemory]		= "Persistent Memory",
 };
 
 #ifndef KERN_LOADSPACE_SIZE
@@ -355,9 +339,8 @@ efi_memory_show_map(bool sorted, bool co
 	EFI_MEMORY_DESCRIPTOR *mdtop, *md, *next;
 	UINTN i, NoEntries, MapKey, DescriptorSize;
 	UINT32 DescriptorVersion;
-	char memstr[32], efimemstr[32];
-	int memtype;
-	UINTN cols, rows, row = 0;
+	char efimemstr[32];
+	UINTN cols, rows, row;
 
 	status = uefi_call_wrapper(ST->ConOut->QueryMode, 4, ST->ConOut,
 	ST->ConOut->Mode->Mode, &cols, &rows);
@@ -371,24 +354,23 @@ efi_memory_show_map(bool sorted, bool co
 	if (compact)
 		efi_memory_compact_map(mdtop, &NoEntries, DescriptorSize);
 
+	printf("%-22s  %-16s  %-16s  %-16s\n", "Type", "Start", "End", "Attributes");
+	printf("--      \n");
+	row = 2;
+
 	for (i = 0, md = mdtop; i < NoEntries; i++, md = next) {
 		next = NextMemoryDescriptor(md, DescriptorSize);
 
-		memtype = getmemtype(md);
-		if (memtype >= __arraycount(memtypes))
-			snprintf(memstr, sizeof(memstr), "unknown (%d)",
-			memtype);
-		if (md->Type >= __arraycount(efimemtypes))
+		if (md->Type >= __arraycount(efi_memory_type))
 			snprintf(efimemstr, sizeof(efimemstr), "unknown (%d)",
 			md->Type);
-		printf("%016" PRIxMAX "/%016" PRIxMAX ": %s [%s]\n",
+		printf("%-22s  %016" PRIxMAX "  %016" PRIxMAX "  %016" PRIxMAX "\n",
+		md->Type >= __arraycount(efi_memory_type) ?
+		  efimemstr : efi_memory_type[md->Type],
 		(uintmax_t)md->PhysicalStart,
 		(uintmax_t)md->PhysicalStart +
 		  md->NumberOfPages * EFI_PAGE_SIZE - 1,
-		memtype >= __arraycount(memtypes) ?
-		  memstr : memtypes[memtype],
-		md->Type >= __arraycount(efimemtypes) ?
-		  efimemstr : efimemtypes[md->Type]);
+		(uintmax_t)md->Attribute);
 
 		if (++row >= rows) {
 			row = 0;



CVS commit: src/sys/arch/i386/stand/efiboot

2019-07-29 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Jul 29 11:28:51 UTC 2019

Modified Files:
src/sys/arch/i386/stand/efiboot: boot.c efiboot.c efiboot.h efimemory.c

Log Message:
Added BTINFO_EFIMEMMAP compaction support to x86 efiboot.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/i386/stand/efiboot/boot.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/i386/stand/efiboot/efiboot.c \
src/sys/arch/i386/stand/efiboot/efiboot.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/i386/stand/efiboot/efimemory.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/i386/stand/efiboot/boot.c
diff -u src/sys/arch/i386/stand/efiboot/boot.c:1.12 src/sys/arch/i386/stand/efiboot/boot.c:1.13
--- src/sys/arch/i386/stand/efiboot/boot.c:1.12	Fri Jul 26 12:09:48 2019
+++ src/sys/arch/i386/stand/efiboot/boot.c	Mon Jul 29 11:28:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.12 2019/07/26 12:09:48 nonaka Exp $	*/
+/*	$NetBSD: boot.c,v 1.13 2019/07/29 11:28:51 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -351,7 +351,7 @@ command_help(char *arg)
 #if LIBSA_ENABLE_LS_OP
 	   "ls [path]\n"
 #endif
-	   "memmap [{sorted|unsorted}]\n"
+	   "memmap [{sorted|unsorted|compact}]\n"
 #ifndef SMALL
 	   "menu (reenters boot menu, if defined in boot.cfg)\n"
 #endif
@@ -613,18 +613,21 @@ void
 command_memmap(char *arg)
 {
 	bool sorted = true;
+	bool compact = false;
 
 	if (*arg == '\0' || strcmp(arg, "sorted") == 0)
 		/* Already sorted is true. */;
 	else if (strcmp(arg, "unsorted") == 0)
 		sorted = false;
+	else if (strcmp(arg, "compact") == 0)
+		compact = true;
 	else {
 		printf("invalid flag, "
-		"must be 'sorted' or 'unsorted'.\n");
+		"must be 'sorted', 'unsorted' or 'compact'.\n");
 		return;
 	}
 
-	efi_memory_show_map(sorted);
+	efi_memory_show_map(sorted, compact);
 }
 
 void

Index: src/sys/arch/i386/stand/efiboot/efiboot.c
diff -u src/sys/arch/i386/stand/efiboot/efiboot.c:1.8 src/sys/arch/i386/stand/efiboot/efiboot.c:1.9
--- src/sys/arch/i386/stand/efiboot/efiboot.c:1.8	Fri Jun  8 11:52:30 2018
+++ src/sys/arch/i386/stand/efiboot/efiboot.c	Mon Jul 29 11:28:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: efiboot.c,v 1.8 2018/06/08 11:52:30 nonaka Exp $	*/
+/*	$NetBSD: efiboot.c,v 1.9 2019/07/29 11:28:51 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -134,6 +134,7 @@ efi_cleanup(void)
 	}
 	efi_cleanuped = true;
 
+	efi_memory_compact_map(desc, &NoEntries, DescriptorSize);
 	allocsz = sizeof(struct btinfo_efimemmap) - 1
 	+ NoEntries * DescriptorSize;
 	bim = alloc(allocsz);
Index: src/sys/arch/i386/stand/efiboot/efiboot.h
diff -u src/sys/arch/i386/stand/efiboot/efiboot.h:1.8 src/sys/arch/i386/stand/efiboot/efiboot.h:1.9
--- src/sys/arch/i386/stand/efiboot/efiboot.h:1.8	Wed Apr 11 10:32:09 2018
+++ src/sys/arch/i386/stand/efiboot/efiboot.h	Mon Jul 29 11:28:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: efiboot.h,v 1.8 2018/04/11 10:32:09 nonaka Exp $	*/
+/*	$NetBSD: efiboot.h,v 1.9 2019/07/29 11:28:51 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -80,9 +80,11 @@ void efi_disk_show(void);
 
 /* efimemory.c */
 void efi_memory_probe(void);
-void efi_memory_show_map(bool);
+void efi_memory_show_map(bool, bool);
 EFI_MEMORY_DESCRIPTOR *efi_memory_get_map(UINTN *, UINTN *, UINTN *, UINT32 *,
 bool);
+EFI_MEMORY_DESCRIPTOR *efi_memory_compact_map(EFI_MEMORY_DESCRIPTOR *, UINTN *,
+UINTN);
 
 /* efinet.c */
 void efi_net_probe(void);

Index: src/sys/arch/i386/stand/efiboot/efimemory.c
diff -u src/sys/arch/i386/stand/efiboot/efimemory.c:1.6 src/sys/arch/i386/stand/efiboot/efimemory.c:1.7
--- src/sys/arch/i386/stand/efiboot/efimemory.c:1.6	Fri Jul 26 12:09:48 2019
+++ src/sys/arch/i386/stand/efiboot/efimemory.c	Mon Jul 29 11:28:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: efimemory.c,v 1.6 2019/07/26 12:09:48 nonaka Exp $	*/
+/*	$NetBSD: efimemory.c,v 1.7 2019/07/29 11:28:51 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -107,7 +107,7 @@ EFI_MEMORY_DESCRIPTOR *
 efi_memory_get_map(UINTN *NoEntries, UINTN *MapKey, UINTN *DescriptorSize,
 UINT32 *DescriptorVersion, bool sorted)
 {
-	EFI_MEMORY_DESCRIPTOR *desc, *md, *next, *target, tmp;
+	EFI_MEMORY_DESCRIPTOR *desc, *md, *next, *target, *tmp;
 	UINTN i, j;
 
 	*NoEntries = 0;
@@ -119,17 +119,93 @@ efi_memory_get_map(UINTN *NoEntries, UIN
 	if (!sorted)
 		return desc;
 
+	tmp = alloc(*DescriptorSize);
+	if (tmp == NULL)
+		return desc;
+
 	for (i = 0, md = desc; i < *NoEntries - 1; i++, md = next) {
 		target = next = NextMemoryDescriptor(md, *DescriptorSize);
 		for (j = i + 1; j < *NoEntries; j++) {
 			if (md->PhysicalStart > target->PhysicalStart) {
-CopyMem(&tmp, md, sizeof(*md));
-CopyMem(md, target, sizeof(*md));
-CopyMem(target, &tmp, sizeof(*md));
+CopyMem(tmp, md, *DescriptorSize);
+CopyMem(md, target, *DescriptorSize);
+CopyMem(target

CVS commit: src/sys/arch/i386/stand/efiboot

2019-07-29 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Jul 29 11:28:51 UTC 2019

Modified Files:
src/sys/arch/i386/stand/efiboot: boot.c efiboot.c efiboot.h efimemory.c

Log Message:
Added BTINFO_EFIMEMMAP compaction support to x86 efiboot.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/i386/stand/efiboot/boot.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/i386/stand/efiboot/efiboot.c \
src/sys/arch/i386/stand/efiboot/efiboot.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/i386/stand/efiboot/efimemory.c

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



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

2019-07-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 29 11:11:19 UTC 2019

Modified Files:
src/sys/arch/evbarm/conf: CUBOX-I

Log Message:
The CUBOX-I boards have Cortex-A9 cpus, so force -march=armv7-a
when compiling this kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/evbarm/conf/CUBOX-I

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



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

2019-07-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Jul 29 11:11:19 UTC 2019

Modified Files:
src/sys/arch/evbarm/conf: CUBOX-I

Log Message:
The CUBOX-I boards have Cortex-A9 cpus, so force -march=armv7-a
when compiling this kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/evbarm/conf/CUBOX-I

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/evbarm/conf/CUBOX-I
diff -u src/sys/arch/evbarm/conf/CUBOX-I:1.21 src/sys/arch/evbarm/conf/CUBOX-I:1.22
--- src/sys/arch/evbarm/conf/CUBOX-I:1.21	Wed Jul 24 12:33:18 2019
+++ src/sys/arch/evbarm/conf/CUBOX-I	Mon Jul 29 11:11:19 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CUBOX-I,v 1.21 2019/07/24 12:33:18 hkenken Exp $
+# $NetBSD: CUBOX-I,v 1.22 2019/07/29 11:11:19 martin Exp $
 #
 # CuBox-i
 # - http://www.solid-run.com/products/cubox-i-mini-computer/
@@ -21,6 +21,7 @@ options 	CPU_CORTEXA9
 options 	IMX6
 options 	MULTIPROCESSOR
 options 	PMAPCOUNTERS
+makeoptions	CPUFLAGS="-march=armv7-a -mfpu=vfpv3"
 
 # Standard system options
 



CVS commit: src/sys/dev/rasops

2019-07-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul 29 10:55:56 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops15.c rasops32.c rasops8.c
Added Files:
src/sys/dev/rasops: rasops_putchar_aa.h

Log Message:
Factor out putchar_aa functions into rasops_putchar_aa.h, which includes
the following fixes:

- stop using memset to framebuffer for depth 8
- correctly support non-standard positions/lengths of RGB bits in pixel


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/rasops/rasops15.c
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/rasops/rasops32.c
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/rasops/rasops8.c
cvs rdiff -u -r0 -r1.1 src/sys/dev/rasops/rasops_putchar_aa.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/rasops/rasops15.c
diff -u src/sys/dev/rasops/rasops15.c:1.30 src/sys/dev/rasops/rasops15.c:1.31
--- src/sys/dev/rasops/rasops15.c:1.30	Sun Jul 28 12:06:10 2019
+++ src/sys/dev/rasops/rasops15.c	Mon Jul 29 10:55:56 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops15.c,v 1.30 2019/07/28 12:06:10 rin Exp $	*/
+/* 	$NetBSD: rasops15.c,v 1.31 2019/07/29 10:55:56 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.30 2019/07/28 12:06:10 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops15.c,v 1.31 2019/07/29 10:55:56 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -110,97 +110,7 @@ rasops15_init(struct rasops_info *ri)
 
 #define	RASOPS_DEPTH	15
 #include "rasops_putchar.h"
-
-static void
-rasops15_putchar_aa(void *cookie, int row, int col, u_int uc, long attr)
-{
-	int width, height, cnt, clr[2];
-	struct rasops_info *ri = (struct rasops_info *)cookie;
-	struct wsdisplay_font *font = PICK_FONT(ri, uc);
-	uint16_t *dp, *rp;
-	uint8_t *rrp;
-	uint8_t *fr;
-	uint16_t buffer[64]; /* XXX */
-	int x, y, r, g, b, aval;
-	int r1, g1, b1, r0, g0, b0, fgo, bgo;
-
-#ifdef RASOPS_CLIPPING
-	/* Catches 'row < 0' case too */
-	if ((unsigned)row >= (unsigned)ri->ri_rows)
-		return;
-
-	if ((unsigned)col >= (unsigned)ri->ri_cols)
-		return;
-#endif
-
-	/* check if character fits into font limits */
-	if (!CHAR_IN_FONT(uc, font))
-		return;
-
-	rrp = (ri->ri_bits + row*ri->ri_yscale + col*ri->ri_xscale);
-	rp = (uint16_t *)rrp;
-
-	height = font->fontheight;
-	width = font->fontwidth;
-
-	clr[0] = ri->ri_devcmap[((uint32_t)attr >> 16) & 0xf];
-	clr[1] = ri->ri_devcmap[((uint32_t)attr >> 24) & 0xf];
-
-	if (uc == ' ') {
-	for (cnt = 0; cnt < width; cnt++)
-	buffer[cnt] = clr[0];
-		for (y = 0; y < height; y++) {
-			dp = rp;
-			DELTA(rp, ri->ri_stride, uint16_t *);
-			memcpy(dp, buffer, width << 1);
-		}
-	} else {
-		fr = FONT_GLYPH(uc, font, ri);
-
-		fgo = (((uint32_t)attr >> 24) & 0xf) * 3;
-		bgo = (((uint32_t)attr >> 16) & 0xf) * 3;
-
-		r0 = rasops_cmap[bgo];
-		r1 = rasops_cmap[fgo];
-		g0 = rasops_cmap[bgo + 1];
-		g1 = rasops_cmap[fgo + 1];
-		b0 = rasops_cmap[bgo + 2];
-		b1 = rasops_cmap[fgo + 2];
-
-		for (y = 0; y < height; y++) {
-			dp = (uint16_t *)(rrp + ri->ri_stride * y);
-			for (x = 0; x < width; x++) {
-aval = *fr;
-if (aval == 0) {
-	buffer[x] = clr[0];
-} else if (aval == 255) {
-	buffer[x] = clr[1];
-} else {
-	r = aval * r1 + (255 - aval) * r0;
-	g = aval * g1 + (255 - aval) * g0;
-	b = aval * b1 + (255 - aval) * b0;
-	buffer[x] =
-	((r >> (16 - ri->ri_rnum)) <<
-		ri->ri_rpos) |
-	((g >> (16 - ri->ri_gnum)) <<
-	ri->ri_gpos) |
-	((b >> (16 - ri->ri_bnum)) <<
-		ri->ri_bpos);
-}
-fr++;
-			}
-			memcpy(dp, buffer, width << 1);
-		}
-	}
-
-	/* Do underline */
-	if ((attr & WSATTR_UNDERLINE) != 0) {
-	rp = (uint16_t *)rrp;
-		DELTA(rp, (ri->ri_stride * (height - 2)), uint16_t *);
-		while (width--)
-			*rp++ = clr[1];
-	}
-}
+#include "rasops_putchar_aa.h"
 
 #ifndef RASOPS_SMALL
 /*

Index: src/sys/dev/rasops/rasops32.c
diff -u src/sys/dev/rasops/rasops32.c:1.38 src/sys/dev/rasops/rasops32.c:1.39
--- src/sys/dev/rasops/rasops32.c:1.38	Sun Jul 28 12:06:10 2019
+++ src/sys/dev/rasops/rasops32.c	Mon Jul 29 10:55:56 2019
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops32.c,v 1.38 2019/07/28 12:06:10 rin Exp $	*/
+/*	 $NetBSD: rasops32.c,v 1.39 2019/07/29 10:55:56 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops32.c,v 1.38 2019/07/28 12:06:10 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops32.c,v 1.39 2019/07/29 10:55:56 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -109,91 +109,7 @@ rasops32_init(struct rasops_info *ri)
 
 #define	RASOPS_DEPTH	32
 #include "rasops_putchar.h"
-
-static void
-rasops32_putchar_aa(void *cookie, int row, int col, u_int uc, long attr)
-{
-	int width, height, cnt, clr[2];
-	struct rasops_info *ri = (struct rasops_info *)cookie;
-	struct wsdi

CVS commit: src/sys/dev/rasops

2019-07-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul 29 10:55:56 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops15.c rasops32.c rasops8.c
Added Files:
src/sys/dev/rasops: rasops_putchar_aa.h

Log Message:
Factor out putchar_aa functions into rasops_putchar_aa.h, which includes
the following fixes:

- stop using memset to framebuffer for depth 8
- correctly support non-standard positions/lengths of RGB bits in pixel


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/rasops/rasops15.c
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/rasops/rasops32.c
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/rasops/rasops8.c
cvs rdiff -u -r0 -r1.1 src/sys/dev/rasops/rasops_putchar_aa.h

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



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

2019-07-29 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Mon Jul 29 10:28:58 UTC 2019

Modified Files:
src/sys/arch/x86/pci: if_vmx.c

Log Message:
make vmx(4)'s *_process_limit tunable.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/x86/pci/if_vmx.c

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



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

2019-07-29 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Mon Jul 29 10:28:58 UTC 2019

Modified Files:
src/sys/arch/x86/pci: if_vmx.c

Log Message:
make vmx(4)'s *_process_limit tunable.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/x86/pci/if_vmx.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/pci/if_vmx.c
diff -u src/sys/arch/x86/pci/if_vmx.c:1.43 src/sys/arch/x86/pci/if_vmx.c:1.44
--- src/sys/arch/x86/pci/if_vmx.c:1.43	Mon Jul 29 10:24:18 2019
+++ src/sys/arch/x86/pci/if_vmx.c	Mon Jul 29 10:28:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vmx.c,v 1.43 2019/07/29 10:24:18 knakahara Exp $	*/
+/*	$NetBSD: if_vmx.c,v 1.44 2019/07/29 10:28:57 knakahara Exp $	*/
 /*	$OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $	*/
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.43 2019/07/29 10:24:18 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.44 2019/07/29 10:28:57 knakahara Exp $");
 
 #include 
 #include 
@@ -291,6 +291,8 @@ struct vmxnet3_softc {
 	u_int vmx_tx_intr_process_limit;
 	u_int vmx_rx_process_limit;
 	u_int vmx_tx_process_limit;
+
+	struct sysctllog *vmx_sysctllog;
 };
 
 #define VMXNET3_STAT
@@ -337,6 +339,7 @@ int vmxnet3_setup_msi_interrupt(struct v
 int vmxnet3_setup_legacy_interrupt(struct vmxnet3_softc *);
 void vmxnet3_set_interrupt_idx(struct vmxnet3_softc *);
 int vmxnet3_setup_interrupts(struct vmxnet3_softc *);
+int vmxnet3_setup_sysctl(struct vmxnet3_softc *);
 
 int vmxnet3_init_rxq(struct vmxnet3_softc *, int);
 int vmxnet3_init_txq(struct vmxnet3_softc *, int);
@@ -615,6 +618,10 @@ vmxnet3_attach(device_t parent, device_t
 	if (error)
 		return;
 
+	error = vmxnet3_setup_sysctl(sc);
+	if (error)
+		return;
+
 	sc->vmx_flags |= VMXNET3_FLAG_ATTACHED;
 }
 
@@ -639,6 +646,8 @@ vmxnet3_detach(device_t self, int flags)
 		if_detach(ifp);
 	}
 
+	sysctl_teardown(&sc->vmx_sysctllog);
+
 	vmxnet3_free_interrupts(sc);
 
 	vmxnet3_free_data(sc);
@@ -1813,6 +1822,69 @@ vmxnet3_setup_interface(struct vmxnet3_s
 	return (0);
 }
 
+int
+vmxnet3_setup_sysctl(struct vmxnet3_softc *sc)
+{
+	const char *devname;
+	struct sysctllog **log;
+	const struct sysctlnode *rnode, *rxnode, *txnode;
+	int error;
+
+	log = &sc->vmx_sysctllog;
+	devname = device_xname(sc->vmx_dev);
+
+	error = sysctl_createv(log, 0, NULL, &rnode,
+	0, CTLTYPE_NODE, devname,
+	SYSCTL_DESCR("vmxnet3 information and settings"),
+	NULL, 0, NULL, 0, CTL_HW, CTL_CREATE, CTL_EOL);
+	if (error)
+		goto out;
+
+	error = sysctl_createv(log, 0, &rnode, &rxnode,
+	0, CTLTYPE_NODE, "rx",
+	SYSCTL_DESCR("vmxnet3 information and settings for Rx"),
+	NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL);
+	if (error)
+		goto out;
+	error = sysctl_createv(log, 0, &rxnode, NULL,
+	CTLFLAG_READWRITE, CTLTYPE_INT, "intr_process_limit",
+	SYSCTL_DESCR("max number of Rx packets to process for interrupt processing"),
+	NULL, 0, &sc->vmx_rx_intr_process_limit, 0, CTL_CREATE, CTL_EOL);
+	if (error)
+		goto out;
+	error = sysctl_createv(log, 0, &rxnode, NULL,
+	CTLFLAG_READWRITE, CTLTYPE_INT, "process_limit",
+	SYSCTL_DESCR("max number of Rx packets to process for deferred processing"),
+	NULL, 0, &sc->vmx_rx_process_limit, 0, CTL_CREATE, CTL_EOL);
+	if (error)
+		goto out;
+
+	error = sysctl_createv(log, 0, &rnode, &txnode,
+	0, CTLTYPE_NODE, "tx",
+	SYSCTL_DESCR("vmxnet3 information and settings for Tx"),
+	NULL, 0, NULL, 0, CTL_CREATE, CTL_EOL);
+	if (error)
+		goto out;
+	error = sysctl_createv(log, 0, &txnode, NULL,
+	CTLFLAG_READWRITE, CTLTYPE_INT, "intr_process_limit",
+	SYSCTL_DESCR("max number of Tx packets to process for interrupt processing"),
+	NULL, 0, &sc->vmx_tx_intr_process_limit, 0, CTL_CREATE, CTL_EOL);
+	if (error)
+		goto out;
+	error = sysctl_createv(log, 0, &txnode, NULL,
+	CTLFLAG_READWRITE, CTLTYPE_INT, "process_limit",
+	SYSCTL_DESCR("max number of Tx packets to process for deferred processing"),
+	NULL, 0, &sc->vmx_tx_process_limit, 0, CTL_CREATE, CTL_EOL);
+
+out:
+	if (error) {
+		aprint_error_dev(sc->vmx_dev,
+		"unable to create sysctl node\n");
+		sysctl_teardown(log);
+	}
+	return error;
+}
+
 void
 vmxnet3_evintr(struct vmxnet3_softc *sc)
 {



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

2019-07-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jul 29 10:25:30 UTC 2019

Modified Files:
src/sys/arch/evbarm/conf: std.imx6ul

Log Message:
Remove duplicate options TPIDRPRW_IS_CURCPU


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/conf/std.imx6ul

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/evbarm/conf/std.imx6ul
diff -u src/sys/arch/evbarm/conf/std.imx6ul:1.5 src/sys/arch/evbarm/conf/std.imx6ul:1.6
--- src/sys/arch/evbarm/conf/std.imx6ul:1.5	Thu Oct 18 09:01:54 2018
+++ src/sys/arch/evbarm/conf/std.imx6ul	Mon Jul 29 10:25:30 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: std.imx6ul,v 1.5 2018/10/18 09:01:54 skrll Exp $
+#	$NetBSD: std.imx6ul,v 1.6 2019/07/29 10:25:30 skrll Exp $
 #
 # standard NetBSD/evbarm options for i.MX6UL
 
@@ -23,7 +23,6 @@ options 	__HAVE_FAST_SOFTINTS		# should 
 options 	__HAVE_GENERIC_START
 #options 	__HAVE_MM_MD_DIRECT_MAPPED_PHYS
 #options 	PMAP_NEED_ALLOC_POOLPAGE
-options 	TPIDRPRW_IS_CURCPU
 
 makeoptions 	BOARDMKFRAG="${THISARM}/conf/mk.imx6ul"
 makeoptions 	CPPFLAGS+="-I$S/../../../include"



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

2019-07-29 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jul 29 10:25:30 UTC 2019

Modified Files:
src/sys/arch/evbarm/conf: std.imx6ul

Log Message:
Remove duplicate options TPIDRPRW_IS_CURCPU


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/conf/std.imx6ul

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



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

2019-07-29 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Mon Jul 29 10:24:18 UTC 2019

Modified Files:
src/sys/arch/x86/pci: if_vmx.c

Log Message:
vmx(4) uses deferred interrupt handlering like ixg(4).


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/x86/pci/if_vmx.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/pci/if_vmx.c
diff -u src/sys/arch/x86/pci/if_vmx.c:1.42 src/sys/arch/x86/pci/if_vmx.c:1.43
--- src/sys/arch/x86/pci/if_vmx.c:1.42	Mon Jul 29 09:45:16 2019
+++ src/sys/arch/x86/pci/if_vmx.c	Mon Jul 29 10:24:18 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vmx.c,v 1.42 2019/07/29 09:45:16 knakahara Exp $	*/
+/*	$NetBSD: if_vmx.c,v 1.43 2019/07/29 10:24:18 knakahara Exp $	*/
 /*	$OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $	*/
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.42 2019/07/29 09:45:16 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.43 2019/07/29 10:24:18 knakahara Exp $");
 
 #include 
 #include 
@@ -83,6 +83,20 @@ __KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1
 #define VMXNET3_WATCHDOG_TIMEOUT	5
 
 /*
+ * Default value for vmx_intr_{rx,tx}_process_limit which is used for
+ * max number of packets to process for interrupt handler
+ */
+#define VMXNET3_RX_INTR_PROCESS_LIMIT 0U
+#define VMXNET3_TX_INTR_PROCESS_LIMIT 256
+
+/*
+ * Default value for vmx_{rx,tx}_process_limit which is used for
+ * max number of packets to process for deferred processing
+ */
+#define VMXNET3_RX_PROCESS_LIMIT 256
+#define VMXNET3_TX_PROCESS_LIMIT 256
+
+/*
  * IP protocols that we can perform Tx checksum offloading of.
  */
 #define VMXNET3_CSUM_OFFLOAD \
@@ -209,6 +223,8 @@ struct vmxnet3_queue {
 
 	struct vmxnet3_txqueue vxq_txqueue;
 	struct vmxnet3_rxqueue vxq_rxqueue;
+
+	void *vxq_si;
 };
 
 struct vmxnet3_statistics {
@@ -270,6 +286,11 @@ struct vmxnet3_softc {
 	int vmx_max_ntxqueues;
 	int vmx_max_nrxqueues;
 	uint8_t vmx_lladdr[ETHER_ADDR_LEN];
+
+	u_int vmx_rx_intr_process_limit;
+	u_int vmx_tx_intr_process_limit;
+	u_int vmx_rx_process_limit;
+	u_int vmx_tx_process_limit;
 };
 
 #define VMXNET3_STAT
@@ -342,7 +363,7 @@ void vmxnet3_free_data(struct vmxnet3_so
 int vmxnet3_setup_interface(struct vmxnet3_softc *);
 
 void vmxnet3_evintr(struct vmxnet3_softc *);
-void vmxnet3_txq_eof(struct vmxnet3_txqueue *);
+bool vmxnet3_txq_eof(struct vmxnet3_txqueue *, u_int);
 int vmxnet3_newbuf(struct vmxnet3_softc *, struct vmxnet3_rxring *);
 void vmxnet3_rxq_eof_discard(struct vmxnet3_rxqueue *,
 struct vmxnet3_rxring *, int);
@@ -350,9 +371,10 @@ void vmxnet3_rxq_discard_chain(struct vm
 void vmxnet3_rx_csum(struct vmxnet3_rxcompdesc *, struct mbuf *);
 void vmxnet3_rxq_input(struct vmxnet3_rxqueue *,
 struct vmxnet3_rxcompdesc *, struct mbuf *);
-void vmxnet3_rxq_eof(struct vmxnet3_rxqueue *);
+bool vmxnet3_rxq_eof(struct vmxnet3_rxqueue *, u_int);
 int vmxnet3_legacy_intr(void *);
 int vmxnet3_txrxq_intr(void *);
+void vmxnet3_handle_queue(void *);
 int vmxnet3_event_intr(void *);
 
 void vmxnet3_txstop(struct vmxnet3_softc *, struct vmxnet3_txqueue *);
@@ -819,6 +841,10 @@ vmxnet3_free_interrupts(struct vmxnet3_s
 	int i;
 
 	for (i = 0; i < sc->vmx_nintrs; i++) {
+		struct vmxnet3_queue *vmxq =  &sc->vmx_queue[i];
+
+		softint_disestablish(vmxq->vxq_si);
+		vmxq->vxq_si = NULL;
 		pci_intr_disestablish(pc, sc->vmx_ihs[i]);
 	}
 	pci_intr_release(pc, sc->vmx_intrs, sc->vmx_nintrs);
@@ -859,6 +885,14 @@ vmxnet3_setup_msix_interrupts(struct vmx
 		}
 		aprint_normal_dev(sc->vmx_dev, "txrx interrupting at %s\n", intrstr);
 
+		vmxq->vxq_si = softint_establish(SOFTINT_NET | SOFTINT_MPSAFE,
+		vmxnet3_handle_queue, vmxq);
+		if (vmxq->vxq_si == NULL) {
+			aprint_error_dev(sc->vmx_dev,
+			"softint_establish for vxq_si failed\n");
+			return (-1);
+		}
+
 		vmxq->vxq_intr_idx = intr_idx;
 	}
 
@@ -886,6 +920,7 @@ vmxnet3_setup_msi_interrupt(struct vmxne
 	pci_chipset_tag_t pc = sc->vmx_pa->pa_pc;
 	pci_intr_handle_t *intr;
 	void **ihs;
+	struct vmxnet3_queue *vmxq;
 	int i;
 	const char *intrstr;
 	char intrbuf[PCI_INTRSTR_LEN];
@@ -893,6 +928,7 @@ vmxnet3_setup_msi_interrupt(struct vmxne
 
 	intr = &sc->vmx_intrs[0];
 	ihs = sc->vmx_ihs;
+	vmxq = &sc->vmx_queue[0];
 
 	intrstr = pci_intr_string(pc, *intr, intrbuf, sizeof(intrbuf));
 
@@ -907,6 +943,14 @@ vmxnet3_setup_msi_interrupt(struct vmxne
 	}
 	aprint_normal_dev(sc->vmx_dev, "interrupting at %s\n", intrstr);
 
+	vmxq->vxq_si = softint_establish(SOFTINT_NET | SOFTINT_MPSAFE,
+	vmxnet3_handle_queue, vmxq);
+	if (vmxq->vxq_si == NULL) {
+		aprint_error_dev(sc->vmx_dev,
+		"softint_establish for vxq_si failed\n");
+		return (-1);
+	}
+
 	for (i = 0; i < MIN(sc->vmx_nrxqueues, sc->vmx_nrxqueues); i++)
 		sc->vmx_queue[i].vxq_intr_idx = 0;
 	sc->vmx_event_intr_idx = 0;
@@ -920,6 +964,7 @@ vmxnet3_setup_legacy_interrupt(struct vm
 	pci_chipset_

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

2019-07-29 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Mon Jul 29 10:24:18 UTC 2019

Modified Files:
src/sys/arch/x86/pci: if_vmx.c

Log Message:
vmx(4) uses deferred interrupt handlering like ixg(4).


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/x86/pci/if_vmx.c

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



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

2019-07-29 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Mon Jul 29 09:45:16 UTC 2019

Modified Files:
src/sys/arch/x86/pci: if_vmx.c

Log Message:
Fix missing NULL check after softint_establish().


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/x86/pci/if_vmx.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/pci/if_vmx.c
diff -u src/sys/arch/x86/pci/if_vmx.c:1.41 src/sys/arch/x86/pci/if_vmx.c:1.42
--- src/sys/arch/x86/pci/if_vmx.c:1.41	Mon Jul 29 02:20:59 2019
+++ src/sys/arch/x86/pci/if_vmx.c	Mon Jul 29 09:45:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vmx.c,v 1.41 2019/07/29 02:20:59 knakahara Exp $	*/
+/*	$NetBSD: if_vmx.c,v 1.42 2019/07/29 09:45:16 knakahara Exp $	*/
 /*	$OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $	*/
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.41 2019/07/29 02:20:59 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.42 2019/07/29 09:45:16 knakahara Exp $");
 
 #include 
 #include 
@@ -1046,6 +1046,12 @@ vmxnet3_init_txq(struct vmxnet3_softc *s
 
 	txq->vxtxq_si = softint_establish(SOFTINT_NET | SOFTINT_MPSAFE,
 	vmxnet3_deferred_transmit, txq);
+	if (txq->vxtxq_si == NULL) {
+		mutex_obj_free(txq->vxtxq_mtx);
+		aprint_error_dev(sc->vmx_dev,
+		"softint_establish for vxtxq_si failed\n");
+		return ENOMEM;
+	}
 
 	txr->vxtxr_ndesc = sc->vmx_ntxdescs;
 	txr->vxtxr_txbuf = kmem_zalloc(txr->vxtxr_ndesc *



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

2019-07-29 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Mon Jul 29 09:45:16 UTC 2019

Modified Files:
src/sys/arch/x86/pci: if_vmx.c

Log Message:
Fix missing NULL check after softint_establish().


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/x86/pci/if_vmx.c

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



CVS commit: src/sys/kern

2019-07-29 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Jul 29 09:42:17 UTC 2019

Modified Files:
src/sys/kern: uipc_usrreq.c

Log Message:
Fix info leak: the padding after the header causes uninitialized heap
memory to be copied to userland in sys_recvmsg().


To generate a diff of this commit:
cvs rdiff -u -r1.193 -r1.194 src/sys/kern/uipc_usrreq.c

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



CVS commit: src/sys/kern

2019-07-29 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Jul 29 09:42:17 UTC 2019

Modified Files:
src/sys/kern: uipc_usrreq.c

Log Message:
Fix info leak: the padding after the header causes uninitialized heap
memory to be copied to userland in sys_recvmsg().


To generate a diff of this commit:
cvs rdiff -u -r1.193 -r1.194 src/sys/kern/uipc_usrreq.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/kern/uipc_usrreq.c
diff -u src/sys/kern/uipc_usrreq.c:1.193 src/sys/kern/uipc_usrreq.c:1.194
--- src/sys/kern/uipc_usrreq.c:1.193	Mon Jun  3 06:04:20 2019
+++ src/sys/kern/uipc_usrreq.c	Mon Jul 29 09:42:17 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_usrreq.c,v 1.193 2019/06/03 06:04:20 msaitoh Exp $	*/
+/*	$NetBSD: uipc_usrreq.c,v 1.194 2019/07/29 09:42:17 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2004, 2008, 2009 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.193 2019/06/03 06:04:20 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.194 2019/07/29 09:42:17 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1573,6 +1573,7 @@ unp_internalize(struct mbuf **controlp)
 		goto out;
 	}
 	memcpy(newcm, cm, sizeof(struct cmsghdr));
+	memset(newcm + 1, 0, CMSG_LEN(0) - sizeof(struct cmsghdr));
 	files = (file_t **)CMSG_DATA(newcm);
 
 	/*



CVS commit: src/usr.sbin/user

2019-07-29 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Jul 29 09:33:21 UTC 2019

Modified Files:
src/usr.sbin/user: user.c

Log Message:
Fix warning in userdel -r.

If the 'rm -rf' works, then the home directory does not exist any more,
and rmdir() on it will return an error (ENOENT). Catch and ignore it.

Avoids:

# useradd -m foo
# userdel -r foo
userdel: Unable to remove all files in `/home/foo': No such file or directory


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/usr.sbin/user/user.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/user/user.c
diff -u src/usr.sbin/user/user.c:1.132 src/usr.sbin/user/user.c:1.133
--- src/usr.sbin/user/user.c:1.132	Sun Jun 10 07:52:05 2018
+++ src/usr.sbin/user/user.c	Mon Jul 29 09:33:21 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: user.c,v 1.132 2018/06/10 07:52:05 zafer Exp $ */
+/* $NetBSD: user.c,v 1.133 2019/07/29 09:33:21 wiz Exp $ */
 
 /*
  * Copyright (c) 1999 Alistair G. Crooks.  All rights reserved.
@@ -33,7 +33,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 1999\
  The NetBSD Foundation, Inc.  All rights reserved.");
-__RCSID("$NetBSD: user.c,v 1.132 2018/06/10 07:52:05 zafer Exp $");
+__RCSID("$NetBSD: user.c,v 1.133 2019/07/29 09:33:21 wiz Exp $");
 #endif
 
 #include 
@@ -300,7 +300,7 @@ removehomedir(struct passwd *pwp)
 	(void)asystem("%s -rf %s > /dev/null 2>&1 || true", _PATH_RM,
 		  pwp->pw_dir);
 	(void)seteuid(0);
-	if (rmdir(pwp->pw_dir) < 0) {
+	if (rmdir(pwp->pw_dir) < 0 && errno != ENOENT) {
 		warn("Unable to remove all files in `%s'", pwp->pw_dir);
 		return 0;
 	}



CVS commit: src/usr.sbin/user

2019-07-29 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Jul 29 09:33:21 UTC 2019

Modified Files:
src/usr.sbin/user: user.c

Log Message:
Fix warning in userdel -r.

If the 'rm -rf' works, then the home directory does not exist any more,
and rmdir() on it will return an error (ENOENT). Catch and ignore it.

Avoids:

# useradd -m foo
# userdel -r foo
userdel: Unable to remove all files in `/home/foo': No such file or directory


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/usr.sbin/user/user.c

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



CVS commit: src/sys/dev/rasops

2019-07-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul 29 08:13:50 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops.h rasops1.c rasops_putchar.h

Log Message:
Avoid undefined behavior when converting unaligned be32 data to
host integer, found by kUBSan.

Pointed out by msaitoh.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/rasops/rasops.h
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/rasops/rasops1.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/rasops/rasops_putchar.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/rasops/rasops.h
diff -u src/sys/dev/rasops/rasops.h:1.37 src/sys/dev/rasops/rasops.h:1.38
--- src/sys/dev/rasops/rasops.h:1.37	Sun Jul 28 12:06:10 2019
+++ src/sys/dev/rasops/rasops.h	Mon Jul 29 08:13:50 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops.h,v 1.37 2019/07/28 12:06:10 rin Exp $ */
+/* 	$NetBSD: rasops.h,v 1.38 2019/07/29 08:13:50 rin Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -153,6 +153,18 @@ struct rasops_info {
 	((uint8_t *)(font)->data + ((uc) - ((font)->firstchar)) *	\
 	(ri)->ri_fontscale)
 
+static __inline uint32_t
+be32uatoh(uint8_t *p)
+{
+	uint32_t u;
+
+	u  = p[0]; u <<= 8;
+	u |= p[1]; u <<= 8;
+	u |= p[2]; u <<= 8;
+	u |= p[3];
+	return u;
+}
+
 /*
  * rasops_init().
  *

Index: src/sys/dev/rasops/rasops1.c
diff -u src/sys/dev/rasops/rasops1.c:1.29 src/sys/dev/rasops/rasops1.c:1.30
--- src/sys/dev/rasops/rasops1.c:1.29	Mon Jul 29 02:57:41 2019
+++ src/sys/dev/rasops/rasops1.c	Mon Jul 29 08:13:50 2019
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops1.c,v 1.29 2019/07/29 02:57:41 rin Exp $	*/
+/* 	$NetBSD: rasops1.c,v 1.30 2019/07/29 08:13:50 rin Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rasops1.c,v 1.29 2019/07/29 02:57:41 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops1.c,v 1.30 2019/07/29 08:13:50 rin Exp $");
 
 #include "opt_rasops.h"
 
@@ -151,8 +151,7 @@ rasops1_putchar(void *cookie, int row, i
 		} else {
 			while (height--) {
 tmp = *rp & lmask;
-fb = fr[3] | (fr[2] << 8) |
-(fr[1] << 16) | (fr[0] << 24);
+fb = be32uatoh(fr);
 fr += fs;
 if (bg)
 	fb = ~fb;
@@ -202,8 +201,7 @@ rasops1_putchar(void *cookie, int row, i
 			while (height--) {
 tmp0 = rp[0] & lmask;
 tmp1 = rp[1] & rmask;
-fb = fr[3] | (fr[2] << 8) |
-(fr[1] << 16) | (fr[0] << 24);
+fb = be32uatoh(fr);
 fr += fs;
 if (bg)
 	fb = ~fb;

Index: src/sys/dev/rasops/rasops_putchar.h
diff -u src/sys/dev/rasops/rasops_putchar.h:1.3 src/sys/dev/rasops/rasops_putchar.h:1.4
--- src/sys/dev/rasops/rasops_putchar.h:1.3	Sun Jul 28 12:10:52 2019
+++ src/sys/dev/rasops/rasops_putchar.h	Mon Jul 29 08:13:50 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: rasops_putchar.h,v 1.3 2019/07/28 12:10:52 rin Exp $ */
+/* $NetBSD: rasops_putchar.h,v 1.4 2019/07/29 08:13:50 rin Exp $ */
 
 /* NetBSD: rasops8.c,v 1.41 2019/07/25 03:02:44 rin Exp  */
 /*-
@@ -70,7 +70,8 @@ PUTCHAR(RASOPS_DEPTH)(void *cookie, int 
 {
 	struct rasops_info *ri = (struct rasops_info *)cookie;
 	struct wsdisplay_font *font = PICK_FONT(ri, uc);
-	int width, height, cnt, fs, fb;
+	int width, height, cnt, fs;
+	uint32_t fb;
 	uint8_t *dp, *rp, *hp, *hrp, *fr;
 	CLR_TYPE clr[2];
 
@@ -124,8 +125,7 @@ PUTCHAR(RASOPS_DEPTH)(void *cookie, int 
 hp = hrp;
 hrp += ri->ri_stride;
 			}
-			fb = fr[3] | (fr[2] << 8) | (fr[1] << 16) |
-			(fr[0] << 24);
+			fb = be32uatoh(fr);
 			fr += fs;
 			for (cnt = width; cnt; cnt--) {
 SUBST_CLR(dp, (fb >> 31) & 1);



CVS commit: src/sys/dev/rasops

2019-07-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Jul 29 08:13:50 UTC 2019

Modified Files:
src/sys/dev/rasops: rasops.h rasops1.c rasops_putchar.h

Log Message:
Avoid undefined behavior when converting unaligned be32 data to
host integer, found by kUBSan.

Pointed out by msaitoh.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/rasops/rasops.h
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/rasops/rasops1.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/rasops/rasops_putchar.h

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



CVS commit: src/external/gpl3/gcc/dist/libstdc++-v3/config/locale/dragonfly

2019-07-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jul 29 08:03:48 UTC 2019

Modified Files:
src/external/gpl3/gcc/dist/libstdc++-v3/config/locale/dragonfly:
codecvt_members.cc

Log Message:
Remove extra paren


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \

src/external/gpl3/gcc/dist/libstdc++-v3/config/locale/dragonfly/codecvt_members.cc

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/libstdc++-v3/config/locale/dragonfly/codecvt_members.cc
diff -u src/external/gpl3/gcc/dist/libstdc++-v3/config/locale/dragonfly/codecvt_members.cc:1.3 src/external/gpl3/gcc/dist/libstdc++-v3/config/locale/dragonfly/codecvt_members.cc:1.4
--- src/external/gpl3/gcc/dist/libstdc++-v3/config/locale/dragonfly/codecvt_members.cc:1.3	Mon Jul 29 03:59:47 2019
+++ src/external/gpl3/gcc/dist/libstdc++-v3/config/locale/dragonfly/codecvt_members.cc	Mon Jul 29 04:03:47 2019
@@ -232,7 +232,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	const extern_type* __tmp_from = __from;
 	size_t __conv = mbsnrtowcs_l(__to, &__from,
    __from_chunk_end - __from,
-   __max, &__state),
+   __max, &__state,
    (locale_t)_M_c_locale_codecvt);
 	if (__conv == static_cast(-1))
 	  {



CVS commit: src/external/gpl3/gcc/dist/libstdc++-v3/config/locale/dragonfly

2019-07-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jul 29 08:03:48 UTC 2019

Modified Files:
src/external/gpl3/gcc/dist/libstdc++-v3/config/locale/dragonfly:
codecvt_members.cc

Log Message:
Remove extra paren


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \

src/external/gpl3/gcc/dist/libstdc++-v3/config/locale/dragonfly/codecvt_members.cc

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



CVS commit: src/external/gpl3/gcc/dist/libstdc++-v3/config/locale/dragonfly

2019-07-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jul 29 07:59:47 UTC 2019

Modified Files:
src/external/gpl3/gcc/dist/libstdc++-v3/config/locale/dragonfly:
codecvt_members.cc

Log Message:
remove extra paren


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \

src/external/gpl3/gcc/dist/libstdc++-v3/config/locale/dragonfly/codecvt_members.cc

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



CVS commit: src/external/gpl3/gcc/dist/libstdc++-v3/config/locale/dragonfly

2019-07-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jul 29 07:59:47 UTC 2019

Modified Files:
src/external/gpl3/gcc/dist/libstdc++-v3/config/locale/dragonfly:
codecvt_members.cc

Log Message:
remove extra paren


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \

src/external/gpl3/gcc/dist/libstdc++-v3/config/locale/dragonfly/codecvt_members.cc

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/libstdc++-v3/config/locale/dragonfly/codecvt_members.cc
diff -u src/external/gpl3/gcc/dist/libstdc++-v3/config/locale/dragonfly/codecvt_members.cc:1.2 src/external/gpl3/gcc/dist/libstdc++-v3/config/locale/dragonfly/codecvt_members.cc:1.3
--- src/external/gpl3/gcc/dist/libstdc++-v3/config/locale/dragonfly/codecvt_members.cc:1.2	Sun Jul 28 13:41:21 2019
+++ src/external/gpl3/gcc/dist/libstdc++-v3/config/locale/dragonfly/codecvt_members.cc	Mon Jul 29 03:59:47 2019
@@ -149,7 +149,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	for (;; ++__to_next, __from += __conv)
 	  {
 		__conv = mbrtowc_l(__to_next, __from, __from_end - __from,
- &__tmp_state), (locale_t)_M_c_locale_codecvt);
+ &__tmp_state, (locale_t)_M_c_locale_codecvt);
 		if (__conv == static_cast(-1)
 		|| __conv == static_cast(-2))
 		  break;