CVS commit: src/sys/dev/pci

2022-12-20 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Wed Dec 21 05:19:15 UTC 2022

Modified Files:
src/sys/dev/pci: if_rge.c if_rgereg.h

Log Message:
Update the Rx descriptor based on the vendor driver for Linux.

This fixes a panic on RTL8125.
Patch from OpenBSD if_rge.c r1.20, if_rgereg.h r1.8.

Tested by msaitoh@n.o.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/pci/if_rge.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/if_rgereg.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/pci/if_rge.c
diff -u src/sys/dev/pci/if_rge.c:1.24 src/sys/dev/pci/if_rge.c:1.25
--- src/sys/dev/pci/if_rge.c:1.24	Sat Sep 24 18:12:42 2022
+++ src/sys/dev/pci/if_rge.c	Wed Dec 21 05:19:15 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_rge.c,v 1.24 2022/09/24 18:12:42 thorpej Exp $	*/
+/*	$NetBSD: if_rge.c,v 1.25 2022/12/21 05:19:15 nonaka Exp $	*/
 /*	$OpenBSD: if_rge.c,v 1.9 2020/12/12 11:48:53 jan Exp $	*/
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.24 2022/09/24 18:12:42 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.25 2022/12/21 05:19:15 nonaka Exp $");
 
 #include 
 
@@ -1132,22 +1132,16 @@ rge_newbuf(struct rge_softc *sc, int idx
 	/* Map the segments into RX descriptors. */
 	r = >rge_ldata.rge_rx_list[idx];
 
-	if (RGE_OWN(r)) {
-		device_printf(sc->sc_dev, "tried to map busy RX descriptor\n");
-		goto out;
-	}
-
 	rxq->rxq_mbuf = m;
 
-	r->rge_extsts = 0;
-	r->rge_addrlo = htole32(RGE_ADDR_LO(rxmap->dm_segs[0].ds_addr));
-	r->rge_addrhi = htole32(RGE_ADDR_HI(rxmap->dm_segs[0].ds_addr));
+	r->hi_qword1.rx_qword4.rge_extsts = 0;
+	r->hi_qword0.rge_addr = htole64(rxmap->dm_segs[0].ds_addr);
 
-	r->rge_cmdsts = htole32(rxmap->dm_segs[0].ds_len);
+	r->hi_qword1.rx_qword4.rge_cmdsts = htole32(rxmap->dm_segs[0].ds_len);
 	if (idx == RGE_RX_LIST_CNT - 1)
-		r->rge_cmdsts |= htole32(RGE_RDCMDSTS_EOR);
+		r->hi_qword1.rx_qword4.rge_cmdsts |= htole32(RGE_RDCMDSTS_EOR);
 
-	r->rge_cmdsts |= htole32(RGE_RDCMDSTS_OWN);
+	r->hi_qword1.rx_qword4.rge_cmdsts |= htole32(RGE_RDCMDSTS_OWN);
 
 	bus_dmamap_sync(sc->sc_dmat, sc->rge_ldata.rge_rx_list_map,
 	idx * sizeof(struct rge_rx_desc), sizeof(struct rge_rx_desc),
@@ -1167,11 +1161,11 @@ rge_discard_rxbuf(struct rge_softc *sc, 
 
 	r = >rge_ldata.rge_rx_list[idx];
 
-	r->rge_cmdsts = htole32(RGE_JUMBO_FRAMELEN);
-	r->rge_extsts = 0;
+	r->hi_qword1.rx_qword4.rge_cmdsts = htole32(RGE_JUMBO_FRAMELEN);
+	r->hi_qword1.rx_qword4.rge_extsts = 0;
 	if (idx == RGE_RX_LIST_CNT - 1)
-		r->rge_cmdsts |= htole32(RGE_RDCMDSTS_EOR);
-	r->rge_cmdsts |= htole32(RGE_RDCMDSTS_OWN);
+		r->hi_qword1.rx_qword4.rge_cmdsts |= htole32(RGE_RDCMDSTS_EOR);
+	r->hi_qword1.rx_qword4.rge_cmdsts |= htole32(RGE_RDCMDSTS_OWN);
 
 	bus_dmamap_sync(sc->sc_dmat, sc->rge_ldata.rge_rx_list_map,
 	idx * sizeof(struct rge_rx_desc), sizeof(struct rge_rx_desc),
@@ -1235,8 +1229,8 @@ rge_rxeof(struct rge_softc *sc)
 		if (RGE_OWN(cur_rx))
 			break;
 
-		rxstat = letoh32(cur_rx->rge_cmdsts);
-		extsts = letoh32(cur_rx->rge_extsts);
+		rxstat = letoh32(cur_rx->hi_qword1.rx_qword4.rge_cmdsts);
+		extsts = letoh32(cur_rx->hi_qword1.rx_qword4.rge_extsts);
 
 		total_len = RGE_RXBYTES(cur_rx);
 		rxq = >rge_ldata.rge_rxq[i];
@@ -1317,16 +1311,16 @@ rge_rxeof(struct rge_softc *sc)
 
 #if notyet
 		/* Check IP header checksum. */
-		if (!(rxstat & RGE_RDCMDSTS_IPCSUMERR) &&
+		if (!(extsts & RGE_RDEXTSTS_IPCSUMERR) &&
 		(extsts & RGE_RDEXTSTS_IPV4))
 			m->m_pkthdr.csum_flags |= M_IPV4_CSUM_IN_OK;
 
 		/* Check TCP/UDP checksum. */
 		if ((extsts & (RGE_RDEXTSTS_IPV4 | RGE_RDEXTSTS_IPV6)) &&
-		(((rxstat & RGE_RDCMDSTS_TCPPKT) &&
-		!(rxstat & RGE_RDCMDSTS_TCPCSUMERR)) ||
-		((rxstat & RGE_RDCMDSTS_UDPPKT) &&
-		!(rxstat & RGE_RDCMDSTS_UDPCSUMERR
+		(((extsts & RGE_RDEXTSTS_TCPPKT) &&
+		!(extsts & RGE_RDEXTSTS_TCPCSUMERR)) ||
+		((extsts & RGE_RDEXTSTS_UDPPKT) &&
+		!(extsts & RGE_RDEXTSTS_UDPCSUMERR
 			m->m_pkthdr.csum_flags |= M_TCP_CSUM_IN_OK |
 			M_UDP_CSUM_IN_OK;
 #endif

Index: src/sys/dev/pci/if_rgereg.h
diff -u src/sys/dev/pci/if_rgereg.h:1.6 src/sys/dev/pci/if_rgereg.h:1.7
--- src/sys/dev/pci/if_rgereg.h:1.6	Sun Aug 28 07:44:23 2022
+++ src/sys/dev/pci/if_rgereg.h	Wed Dec 21 05:19:15 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_rgereg.h,v 1.6 2022/08/28 07:44:23 skrll Exp $	*/
+/*	$NetBSD: if_rgereg.h,v 1.7 2022/12/21 05:19:15 nonaka Exp $	*/
 /*	$OpenBSD: if_rgereg.h,v 1.6 2020/12/24 01:00:00 kevlo Exp $	*/
 
 /*
@@ -188,9 +188,10 @@
 #define RGE_NEXT_RX_DESC(x)	(((x) + 1) % RGE_RX_LIST_CNT)
 #define RGE_ADDR_LO(y)		((uint64_t) (y) & 0x)
 #define RGE_ADDR_HI(y)		((uint64_t) (y) >> 32)
-#define RGE_OWN(x)		(letoh32((x)->rge_cmdsts) & RGE_RDCMDSTS_OWN)
-#define RGE_RXBYTES(x)  (letoh32((x)->rge_cmdsts) & \
-RGE_RDCMDSTS_FRAGLEN)
+#define RGE_OWN(x)			\
+

CVS commit: src/sys/dev/pci

2022-12-20 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Wed Dec 21 05:19:15 UTC 2022

Modified Files:
src/sys/dev/pci: if_rge.c if_rgereg.h

Log Message:
Update the Rx descriptor based on the vendor driver for Linux.

This fixes a panic on RTL8125.
Patch from OpenBSD if_rge.c r1.20, if_rgereg.h r1.8.

Tested by msaitoh@n.o.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/pci/if_rge.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/if_rgereg.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/landisk/stand/boot

2022-08-24 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Wed Aug 24 14:22:36 UTC 2022

Modified Files:
src/sys/arch/landisk/stand/boot: getsecs.c

Log Message:
Added missing copyright and license notice.

Pointed out by miod@o.o., Thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/landisk/stand/boot/getsecs.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/landisk/stand/boot

2022-08-24 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Wed Aug 24 14:22:36 UTC 2022

Modified Files:
src/sys/arch/landisk/stand/boot: getsecs.c

Log Message:
Added missing copyright and license notice.

Pointed out by miod@o.o., Thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/landisk/stand/boot/getsecs.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/landisk/stand/boot/getsecs.c
diff -u src/sys/arch/landisk/stand/boot/getsecs.c:1.3 src/sys/arch/landisk/stand/boot/getsecs.c:1.4
--- src/sys/arch/landisk/stand/boot/getsecs.c:1.3	Mon Jan 12 11:32:44 2009
+++ src/sys/arch/landisk/stand/boot/getsecs.c	Wed Aug 24 14:22:35 2022
@@ -1,4 +1,30 @@
-/*	$NetBSD: getsecs.c,v 1.3 2009/01/12 11:32:44 tsutsui Exp $	*/
+/*	$NetBSD: getsecs.c,v 1.4 2022/08/24 14:22:35 nonaka Exp $	*/
+
+/*-
+ * Copyright (c) 2005 NONAKA Kimihiro
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
 
 #include 
 #include 



CVS commit: src/sys

2022-05-20 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri May 20 13:55:17 UTC 2022

Modified Files:
src/sys/arch/x86/x86: hyperv.c
src/sys/dev/hyperv: files.hyperv hyperv_common.c hypervreg.h
hypervvar.h if_hvn.c if_hvnreg.h vmbus.c vmbusvar.h

Log Message:
Improve Hyper-V support.

vmbus(4):
 - Added support for multichannel.

hvn(4):
 - Added support for multichannel.
 - Added support for change MTU.
 - Added support for TX aggregation.
 - Improve VLAN support.
 - Improve checksum offload support.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/x86/x86/hyperv.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/hyperv/files.hyperv \
src/sys/dev/hyperv/if_hvnreg.h
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/hyperv/hyperv_common.c \
src/sys/dev/hyperv/hypervvar.h
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/hyperv/hypervreg.h
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/hyperv/if_hvn.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/hyperv/vmbus.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/hyperv/vmbusvar.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

2019-11-29 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Sat Nov 30 05:28:28 UTC 2019

Modified Files:
src/sys/arch/x86/include: genfb_machdep.h
src/sys/arch/x86/x86: genfb_machdep.c hyperv.c

Log Message:
Prevent panic when attaching genfb if using a serial console with Hyper-V Gen.2.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/include/genfb_machdep.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/x86/x86/genfb_machdep.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/x86/x86/hyperv.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/include/genfb_machdep.h
diff -u src/sys/arch/x86/include/genfb_machdep.h:1.3 src/sys/arch/x86/include/genfb_machdep.h:1.4
--- src/sys/arch/x86/include/genfb_machdep.h:1.3	Wed Feb  9 13:24:23 2011
+++ src/sys/arch/x86/include/genfb_machdep.h	Sat Nov 30 05:28:28 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: genfb_machdep.h,v 1.3 2011/02/09 13:24:23 jmcneill Exp $ */
+/* $NetBSD: genfb_machdep.h,v 1.4 2019/11/30 05:28:28 nonaka Exp $ */
 
 /*-
  * Copyright (c) 2009 Jared D. McNeill 
@@ -29,6 +29,7 @@
 #ifndef _X86_GENFB_MACHDEP_H
 #define _X86_GENFB_MACHDEP_H
 
+int	x86_genfb_init(void);
 int	x86_genfb_cnattach(void);
 void	x86_genfb_mtrr_init(uint64_t, uint32_t);
 void	x86_genfb_set_console_dev(device_t);

Index: src/sys/arch/x86/x86/genfb_machdep.c
diff -u src/sys/arch/x86/x86/genfb_machdep.c:1.14 src/sys/arch/x86/x86/genfb_machdep.c:1.15
--- src/sys/arch/x86/x86/genfb_machdep.c:1.14	Tue Oct  1 18:00:08 2019
+++ src/sys/arch/x86/x86/genfb_machdep.c	Sat Nov 30 05:28:28 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: genfb_machdep.c,v 1.14 2019/10/01 18:00:08 chs Exp $ */
+/* $NetBSD: genfb_machdep.c,v 1.15 2019/11/30 05:28:28 nonaka Exp $ */
 
 /*-
  * Copyright (c) 2009 Jared D. McNeill 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genfb_machdep.c,v 1.14 2019/10/01 18:00:08 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb_machdep.c,v 1.15 2019/11/30 05:28:28 nonaka Exp $");
 
 #include "opt_mtrr.h"
 
@@ -136,23 +136,19 @@ x86_genfb_mtrr_init(uint64_t physaddr, u
 }
 
 int
-x86_genfb_cnattach(void)
+x86_genfb_init(void)
 {
-	static int ncalls = 0;
+	static int inited, attached;
 	struct rasops_info *ri = _genfb_console_screen.scr_ri;
 	const struct btinfo_framebuffer *fbinfo;
 	bus_space_tag_t t = x86_bus_space_mem;
 	bus_space_handle_t h;
 	void *bits;
-	long defattr;
 	int err;
 
-	/* XXX jmcneill
-	 *  Defer console initialization until UVM is initialized
-	 */
-	++ncalls;
-	if (ncalls < 3)
-		return -1;
+	if (inited)
+		return attached;
+	inited = 1;
 
 	memset(_genfb_console_screen, 0, sizeof(x86_genfb_console_screen));
 
@@ -202,6 +198,27 @@ x86_genfb_cnattach(void)
 	x86_genfb_stdscreen.textops = >ri_ops;
 	x86_genfb_stdscreen.capabilities = ri->ri_caps;
 
+	attached = 1;
+	return 1;
+}
+
+int
+x86_genfb_cnattach(void)
+{
+	static int ncalls = 0;
+	struct rasops_info *ri = _genfb_console_screen.scr_ri;
+	long defattr;
+
+	/* XXX jmcneill
+	 *  Defer console initialization until UVM is initialized
+	 */
+	++ncalls;
+	if (ncalls < 3)
+		return -1;
+
+	if (!x86_genfb_init())
+		return 0;
+
 	ri->ri_ops.allocattr(ri, 0, 0, 0, );
 	wsdisplay_preattach(_genfb_stdscreen, ri, 0, 0, defattr);
 
@@ -209,6 +226,12 @@ x86_genfb_cnattach(void)
 }
 #else	/* NWSDISPLAY > 0 && NGENFB > 0 */
 int
+x86_genfb_init(void)
+{
+	return 0;
+}
+
+int
 x86_genfb_cnattach(void)
 {
 	return 0;

Index: src/sys/arch/x86/x86/hyperv.c
diff -u src/sys/arch/x86/x86/hyperv.c:1.4 src/sys/arch/x86/x86/hyperv.c:1.5
--- src/sys/arch/x86/x86/hyperv.c:1.4	Mon Jun  3 09:51:04 2019
+++ src/sys/arch/x86/x86/hyperv.c	Sat Nov 30 05:28:28 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperv.c,v 1.4 2019/06/03 09:51:04 nonaka Exp $	*/
+/*	$NetBSD: hyperv.c,v 1.5 2019/11/30 05:28:28 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2009-2012,2016-2017 Microsoft Corp.
@@ -33,7 +33,7 @@
  */
 #include 
 #ifdef __KERNEL_RCSID
-__KERNEL_RCSID(0, "$NetBSD: hyperv.c,v 1.4 2019/06/03 09:51:04 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperv.c,v 1.5 2019/11/30 05:28:28 nonaka Exp $");
 #endif
 #ifdef __FBSDID
 __FBSDID("$FreeBSD: head/sys/dev/hyperv/vmbus/hyperv.c 331757 2018-03-30 02:25:12Z emaste $");
@@ -70,7 +70,7 @@ __FBSDID("$FreeBSD: head/sys/dev/hyperv/
 #include 
 
 #include 
-#include 
+#include 
 
 #include 
 #include 
@@ -1103,6 +1103,9 @@ device_hyperv_register(device_t dev, voi
 		sizeof(*aa->aa_type)) == 0) {
 			prop_dictionary_t dict = device_properties(dev);
 
+			/* Initialize genfb for serial console */
+			x86_genfb_init();
+
 			/*
 			 * framebuffer drivers other than genfb can work
 			 * without the address property



CVS commit: src/sys/arch/x86

2019-11-29 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Sat Nov 30 05:28:28 UTC 2019

Modified Files:
src/sys/arch/x86/include: genfb_machdep.h
src/sys/arch/x86/x86: genfb_machdep.c hyperv.c

Log Message:
Prevent panic when attaching genfb if using a serial console with Hyper-V Gen.2.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/include/genfb_machdep.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/x86/x86/genfb_machdep.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/x86/x86/hyperv.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/hyperv

2019-11-25 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Nov 26 01:46:32 UTC 2019

Modified Files:
src/sys/dev/hyperv: if_hvn.c

Log Message:
hvn(4): Fix incorrect ident when waiting for NVS command response.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/hyperv/if_hvn.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/hyperv/if_hvn.c
diff -u src/sys/dev/hyperv/if_hvn.c:1.10 src/sys/dev/hyperv/if_hvn.c:1.11
--- src/sys/dev/hyperv/if_hvn.c:1.10	Mon Nov 25 08:53:39 2019
+++ src/sys/dev/hyperv/if_hvn.c	Tue Nov 26 01:46:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_hvn.c,v 1.10 2019/11/25 08:53:39 nonaka Exp $	*/
+/*	$NetBSD: if_hvn.c,v 1.11 2019/11/26 01:46:31 nonaka Exp $	*/
 /*	$OpenBSD: if_hvn.c,v 1.39 2018/03/11 14:31:34 mikeb Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.10 2019/11/25 08:53:39 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.11 2019/11/26 01:46:31 nonaka Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1091,7 +1091,8 @@ hvn_nvs_cmd(struct hvn_softc *sc, void *
 			hvn_nvs_intr(sc);
 			splx(s);
 		} else
-			tsleep(sc, PRIBIO | PCATCH, "nvscmd", mstohz(1));
+			tsleep(sc->sc_nvsrsp, PRIBIO | PCATCH, "nvscmd",
+			mstohz(1));
 	} while (--timo > 0 && sc->sc_nvsdone != 1);
 
 	if (timo == 0 && sc->sc_nvsdone != 1) {



CVS commit: src/sys/dev/hyperv

2019-11-25 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Nov 26 01:46:32 UTC 2019

Modified Files:
src/sys/dev/hyperv: if_hvn.c

Log Message:
hvn(4): Fix incorrect ident when waiting for NVS command response.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/hyperv/if_hvn.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/hyperv

2019-11-25 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Nov 25 08:53:39 UTC 2019

Modified Files:
src/sys/dev/hyperv: hvs.c if_hvn.c

Log Message:
hvs(4), hvn(4): Set correct size for bus_dmamap_sync(9).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/hyperv/hvs.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/hyperv/if_hvn.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/hyperv

2019-11-25 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Nov 25 08:53:39 UTC 2019

Modified Files:
src/sys/dev/hyperv: hvs.c if_hvn.c

Log Message:
hvs(4), hvn(4): Set correct size for bus_dmamap_sync(9).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/hyperv/hvs.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/hyperv/if_hvn.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/hyperv/hvs.c
diff -u src/sys/dev/hyperv/hvs.c:1.2 src/sys/dev/hyperv/hvs.c:1.3
--- src/sys/dev/hyperv/hvs.c:1.2	Tue Oct  1 18:00:08 2019
+++ src/sys/dev/hyperv/hvs.c	Mon Nov 25 08:53:39 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hvs.c,v 1.2 2019/10/01 18:00:08 chs Exp $	*/
+/*	$NetBSD: hvs.c,v 1.3 2019/11/25 08:53:39 nonaka Exp $	*/
 /*	$OpenBSD: hvs.c,v 1.17 2017/08/10 17:22:48 mikeb Exp $	*/
 
 /*-
@@ -37,7 +37,7 @@
 /* #define HVS_DEBUG_IO */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hvs.c,v 1.2 2019/10/01 18:00:08 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hvs.c,v 1.3 2019/11/25 08:53:39 nonaka Exp $");
 
 #include 
 #include 
@@ -1084,7 +1084,8 @@ hvs_free_ccbs(struct hvs_softc *sc)
 		if (ccb->ccb_dmap == NULL)
 			continue;
 
-		bus_dmamap_sync(sc->sc_dmat, ccb->ccb_dmap, 0, 0,
+		bus_dmamap_sync(sc->sc_dmat, ccb->ccb_dmap,
+		0, ccb->ccb_dmap->dm_mapsize,
 		BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
 		bus_dmamap_unload(sc->sc_dmat, ccb->ccb_dmap);
 		bus_dmamap_destroy(sc->sc_dmat, ccb->ccb_dmap);

Index: src/sys/dev/hyperv/if_hvn.c
diff -u src/sys/dev/hyperv/if_hvn.c:1.9 src/sys/dev/hyperv/if_hvn.c:1.10
--- src/sys/dev/hyperv/if_hvn.c:1.9	Fri Nov 22 12:40:07 2019
+++ src/sys/dev/hyperv/if_hvn.c	Mon Nov 25 08:53:39 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_hvn.c,v 1.9 2019/11/22 12:40:07 nonaka Exp $	*/
+/*	$NetBSD: if_hvn.c,v 1.10 2019/11/25 08:53:39 nonaka Exp $	*/
 /*	$OpenBSD: if_hvn.c,v 1.39 2018/03/11 14:31:34 mikeb Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.9 2019/11/22 12:40:07 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.10 2019/11/25 08:53:39 nonaka Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -632,7 +632,8 @@ hvn_decap(struct hvn_softc *sc, struct h
 {
 	struct ifnet *ifp = SC2IFP(sc);
 
-	bus_dmamap_sync(sc->sc_dmat, txd->txd_dmap, 0, 0,
+	bus_dmamap_sync(sc->sc_dmat, txd->txd_dmap,
+	0, txd->txd_dmap->dm_mapsize,
 	BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
 	bus_dmamap_unload(sc->sc_dmat, txd->txd_dmap);
 	txd->txd_buf = NULL;
@@ -667,7 +668,8 @@ hvn_txeof(struct hvn_softc *sc, uint64_t
 	}
 	txd->txd_buf = NULL;
 
-	bus_dmamap_sync(sc->sc_dmat, txd->txd_dmap, 0, 0,
+	bus_dmamap_sync(sc->sc_dmat, txd->txd_dmap,
+	0, txd->txd_dmap->dm_mapsize,
 	BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
 	bus_dmamap_unload(sc->sc_dmat, txd->txd_dmap);
 	m_freem(m);
@@ -844,7 +846,8 @@ hvn_tx_ring_destroy(struct hvn_softc *sc
 		txd = >sc_tx_desc[i];
 		if (txd->txd_dmap == NULL)
 			continue;
-		bus_dmamap_sync(sc->sc_dmat, txd->txd_dmap, 0, 0,
+		bus_dmamap_sync(sc->sc_dmat, txd->txd_dmap,
+		0, txd->txd_dmap->dm_mapsize,
 		BUS_DMASYNC_POSTWRITE);
 		bus_dmamap_unload(sc->sc_dmat, txd->txd_dmap);
 		bus_dmamap_destroy(sc->sc_dmat, txd->txd_dmap);
@@ -855,7 +858,8 @@ hvn_tx_ring_destroy(struct hvn_softc *sc
 		txd->txd_buf = NULL;
 	}
 	if (sc->sc_tx_rmap) {
-		bus_dmamap_sync(sc->sc_dmat, sc->sc_tx_rmap, 0, 0,
+		bus_dmamap_sync(sc->sc_dmat, sc->sc_tx_rmap,
+		0, txd->txd_dmap->dm_mapsize,
 		BUS_DMASYNC_POSTWRITE);
 		bus_dmamap_unload(sc->sc_dmat, sc->sc_tx_rmap);
 		bus_dmamap_destroy(sc->sc_dmat, sc->sc_tx_rmap);



CVS commit: src/sys/dev/hyperv

2019-11-22 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Nov 22 12:40:08 UTC 2019

Modified Files:
src/sys/dev/hyperv: hvkbd.c if_hvn.c

Log Message:
hvn(4), hvkbd(4): Only need to poll when cold.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/hyperv/hvkbd.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/hyperv/if_hvn.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/hyperv

2019-11-22 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Nov 22 12:40:08 UTC 2019

Modified Files:
src/sys/dev/hyperv: hvkbd.c if_hvn.c

Log Message:
hvn(4), hvkbd(4): Only need to poll when cold.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/hyperv/hvkbd.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/hyperv/if_hvn.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/hyperv/hvkbd.c
diff -u src/sys/dev/hyperv/hvkbd.c:1.5 src/sys/dev/hyperv/hvkbd.c:1.6
--- src/sys/dev/hyperv/hvkbd.c:1.5	Fri Nov 22 12:30:32 2019
+++ src/sys/dev/hyperv/hvkbd.c	Fri Nov 22 12:40:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hvkbd.c,v 1.5 2019/11/22 12:30:32 nonaka Exp $	*/
+/*	$NetBSD: hvkbd.c,v 1.6 2019/11/22 12:40:07 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2017 Microsoft Corp.
@@ -36,7 +36,7 @@
 #endif /* _KERNEL_OPT */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.5 2019/11/22 12:30:32 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.6 2019/11/22 12:40:07 nonaka Exp $");
 
 #include 
 #include 
@@ -344,13 +344,13 @@ hvkbd_connect(struct hvkbd_softc *sc)
 	}
 
 	do {
-		if (cold)
+		if (cold) {
 			delay(1000);
-		else
+			s = spltty();
+			hvkbd_intr(sc);
+			splx(s);
+		} else
 			tsleep(sc, PRIBIO | PCATCH, "hvkbdcon", mstohz(1));
-		s = spltty();
-		hvkbd_intr(sc);
-		splx(s);
 	} while (--timo > 0 && sc->sc_connected == 0);
 
 	if (timo == 0 && sc->sc_connected == 0) {

Index: src/sys/dev/hyperv/if_hvn.c
diff -u src/sys/dev/hyperv/if_hvn.c:1.8 src/sys/dev/hyperv/if_hvn.c:1.9
--- src/sys/dev/hyperv/if_hvn.c:1.8	Fri Nov 22 12:30:32 2019
+++ src/sys/dev/hyperv/if_hvn.c	Fri Nov 22 12:40:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_hvn.c,v 1.8 2019/11/22 12:30:32 nonaka Exp $	*/
+/*	$NetBSD: if_hvn.c,v 1.9 2019/11/22 12:40:07 nonaka Exp $	*/
 /*	$OpenBSD: if_hvn.c,v 1.39 2018/03/11 14:31:34 mikeb Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.8 2019/11/22 12:30:32 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.9 2019/11/22 12:40:07 nonaka Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1081,13 +1081,13 @@ hvn_nvs_cmd(struct hvn_softc *sc, void *
 		return 0;
 
 	do {
-		if (cold)
+		if (cold) {
 			delay(1000);
-		else
+			s = splnet();
+			hvn_nvs_intr(sc);
+			splx(s);
+		} else
 			tsleep(sc, PRIBIO | PCATCH, "nvscmd", mstohz(1));
-		s = splnet();
-		hvn_nvs_intr(sc);
-		splx(s);
 	} while (--timo > 0 && sc->sc_nvsdone != 1);
 
 	if (timo == 0 && sc->sc_nvsdone != 1) {
@@ -1404,13 +1404,13 @@ hvn_rndis_cmd(struct hvn_softc *sc, stru
 	BUS_DMASYNC_POSTWRITE);
 
 	do {
-		if (cold)
+		if (cold) {
 			delay(1000);
-		else
+			s = splnet();
+			hvn_nvs_intr(sc);
+			splx(s);
+		} else
 			tsleep(rc, PRIBIO | PCATCH, "rndiscmd", mstohz(1));
-		s = splnet();
-		hvn_nvs_intr(sc);
-		splx(s);
 	} while (--timo > 0 && rc->rc_done != 1);
 
 	bus_dmamap_sync(sc->sc_dmat, rc->rc_dmap, 0, PAGE_SIZE,



CVS commit: src/sys/dev/hyperv

2019-11-22 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Nov 22 12:30:32 UTC 2019

Modified Files:
src/sys/dev/hyperv: hvkbd.c if_hvn.c vmbus.c

Log Message:
vmbus(4), hvn(4), hvkbd(4): Fixed wait time for tsleep(9).


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/hyperv/hvkbd.c \
src/sys/dev/hyperv/vmbus.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/hyperv/if_hvn.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/hyperv

2019-11-22 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Nov 22 12:30:32 UTC 2019

Modified Files:
src/sys/dev/hyperv: hvkbd.c if_hvn.c vmbus.c

Log Message:
vmbus(4), hvn(4), hvkbd(4): Fixed wait time for tsleep(9).


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/hyperv/hvkbd.c \
src/sys/dev/hyperv/vmbus.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/hyperv/if_hvn.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/hyperv/hvkbd.c
diff -u src/sys/dev/hyperv/hvkbd.c:1.4 src/sys/dev/hyperv/hvkbd.c:1.5
--- src/sys/dev/hyperv/hvkbd.c:1.4	Fri Nov 15 08:51:27 2019
+++ src/sys/dev/hyperv/hvkbd.c	Fri Nov 22 12:30:32 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hvkbd.c,v 1.4 2019/11/15 08:51:27 nonaka Exp $	*/
+/*	$NetBSD: hvkbd.c,v 1.5 2019/11/22 12:30:32 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2017 Microsoft Corp.
@@ -36,7 +36,7 @@
 #endif /* _KERNEL_OPT */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.4 2019/11/15 08:51:27 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.5 2019/11/22 12:30:32 nonaka Exp $");
 
 #include 
 #include 
@@ -347,7 +347,7 @@ hvkbd_connect(struct hvkbd_softc *sc)
 		if (cold)
 			delay(1000);
 		else
-			tsleep(sc, PRIBIO | PCATCH, "hvkbdcon", 1);
+			tsleep(sc, PRIBIO | PCATCH, "hvkbdcon", mstohz(1));
 		s = spltty();
 		hvkbd_intr(sc);
 		splx(s);
Index: src/sys/dev/hyperv/vmbus.c
diff -u src/sys/dev/hyperv/vmbus.c:1.4 src/sys/dev/hyperv/vmbus.c:1.5
--- src/sys/dev/hyperv/vmbus.c:1.4	Tue Jul  9 10:07:11 2019
+++ src/sys/dev/hyperv/vmbus.c	Fri Nov 22 12:30:32 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmbus.c,v 1.4 2019/07/09 10:07:11 nakayama Exp $	*/
+/*	$NetBSD: vmbus.c,v 1.5 2019/11/22 12:30:32 nonaka Exp $	*/
 /*	$OpenBSD: hyperv.c,v 1.43 2017/06/27 13:56:15 mikeb Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vmbus.c,v 1.4 2019/07/09 10:07:11 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vmbus.c,v 1.5 2019/11/22 12:30:32 nonaka Exp $");
 
 #include 
 #include 
@@ -604,7 +604,7 @@ vmbus_start(struct vmbus_softc *sc, stru
 			hyperv_intr();
 			splx(s);
 		} else
-			tsleep(wchan, PRIBIO, wchan, 1);
+			tsleep(wchan, PRIBIO, wchan, mstohz(delays[i]));
 	}
 	if (status != HYPERCALL_STATUS_SUCCESS) {
 		device_printf(sc->sc_dev,
@@ -666,7 +666,8 @@ vmbus_wait(struct vmbus_softc *sc,
 			hyperv_intr();
 			splx(s);
 		} else
-			tsleep(wchan, PRIBIO, wmsg ? wmsg : "hvwait", 1);
+			tsleep(wchan, PRIBIO, wmsg ? wmsg : "hvwait",
+			mstohz(1));
 	}
 }
 

Index: src/sys/dev/hyperv/if_hvn.c
diff -u src/sys/dev/hyperv/if_hvn.c:1.7 src/sys/dev/hyperv/if_hvn.c:1.8
--- src/sys/dev/hyperv/if_hvn.c:1.7	Mon Nov 18 04:38:48 2019
+++ src/sys/dev/hyperv/if_hvn.c	Fri Nov 22 12:30:32 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_hvn.c,v 1.7 2019/11/18 04:38:48 nonaka Exp $	*/
+/*	$NetBSD: if_hvn.c,v 1.8 2019/11/22 12:30:32 nonaka Exp $	*/
 /*	$OpenBSD: if_hvn.c,v 1.39 2018/03/11 14:31:34 mikeb Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.7 2019/11/18 04:38:48 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.8 2019/11/22 12:30:32 nonaka Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1063,7 +1063,7 @@ hvn_nvs_cmd(struct hvn_softc *sc, void *
 			if (cold)
 delay(1000);
 			else
-tsleep(cmd, PRIBIO, "nvsout", 1);
+tsleep(cmd, PRIBIO, "nvsout", mstohz(1));
 		} else if (rv) {
 			DPRINTF("%s: NVSP operation %u send error %d\n",
 			device_xname(sc->sc_dev), hdr->nvs_type, rv);
@@ -1084,7 +1084,7 @@ hvn_nvs_cmd(struct hvn_softc *sc, void *
 		if (cold)
 			delay(1000);
 		else
-			tsleep(sc, PRIBIO | PCATCH, "nvscmd", 1);
+			tsleep(sc, PRIBIO | PCATCH, "nvscmd", mstohz(1));
 		s = splnet();
 		hvn_nvs_intr(sc);
 		splx(s);
@@ -1385,7 +1385,7 @@ hvn_rndis_cmd(struct hvn_softc *sc, stru
 			if (cold)
 delay(1000);
 			else
-tsleep(rc, PRIBIO, "rndisout", 1);
+tsleep(rc, PRIBIO, "rndisout", mstohz(1));
 		} else if (rv) {
 			DPRINTF("%s: RNDIS operation %u send error %d\n",
 			device_xname(sc->sc_dev), hdr->rm_type, rv);
@@ -1407,7 +1407,7 @@ hvn_rndis_cmd(struct hvn_softc *sc, stru
 		if (cold)
 			delay(1000);
 		else
-			tsleep(rc, PRIBIO | PCATCH, "rndiscmd", 1);
+			tsleep(rc, PRIBIO | PCATCH, "rndiscmd", mstohz(1));
 		s = splnet();
 		hvn_nvs_intr(sc);
 		splx(s);



CVS commit: src/sys/dev/pci

2019-11-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Nov 18 04:40:05 UTC 2019

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

Log Message:
Fixed incorrect m_defrag return value check.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/if_mcx.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_mcx.c
diff -u src/sys/dev/pci/if_mcx.c:1.5 src/sys/dev/pci/if_mcx.c:1.6
--- src/sys/dev/pci/if_mcx.c:1.5	Thu Oct 17 15:57:56 2019
+++ src/sys/dev/pci/if_mcx.c	Mon Nov 18 04:40:05 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mcx.c,v 1.5 2019/10/17 15:57:56 msaitoh Exp $ */
+/*	$NetBSD: if_mcx.c,v 1.6 2019/11/18 04:40:05 nonaka Exp $ */
 /*	$OpenBSD: if_mcx.c,v 1.33 2019/09/12 04:23:59 jmatthew Exp $ */
 
 /*
@@ -6347,7 +6347,7 @@ mcx_load_mbuf(struct mcx_softc *sc, stru
 		break;
 
 	case EFBIG:
-		if (m_defrag(m, M_DONTWAIT) == 0 &&
+		if (m_defrag(m, M_DONTWAIT) != NULL &&
 		bus_dmamap_load_mbuf(sc->sc_dmat, ms->ms_map, m,
 		BUS_DMA_STREAMING | BUS_DMA_NOWAIT) == 0)
 			break;



CVS commit: src/sys/dev/pci

2019-11-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Nov 18 04:40:05 UTC 2019

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

Log Message:
Fixed incorrect m_defrag return value check.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/if_mcx.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/hyperv

2019-11-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Nov 18 04:38:48 UTC 2019

Modified Files:
src/sys/dev/hyperv: if_hvn.c

Log Message:
Fixed incorrect m_defrag return value check.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/hyperv/if_hvn.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/hyperv/if_hvn.c
diff -u src/sys/dev/hyperv/if_hvn.c:1.6 src/sys/dev/hyperv/if_hvn.c:1.7
--- src/sys/dev/hyperv/if_hvn.c:1.6	Fri Nov 15 08:51:27 2019
+++ src/sys/dev/hyperv/if_hvn.c	Mon Nov 18 04:38:48 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_hvn.c,v 1.6 2019/11/15 08:51:27 nonaka Exp $	*/
+/*	$NetBSD: if_hvn.c,v 1.7 2019/11/18 04:38:48 nonaka Exp $	*/
 /*	$OpenBSD: if_hvn.c,v 1.39 2018/03/11 14:31:34 mikeb Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.6 2019/11/15 08:51:27 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.7 2019/11/18 04:38:48 nonaka Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -565,7 +565,7 @@ hvn_encap(struct hvn_softc *sc, struct m
 	case 0:
 		break;
 	case EFBIG:
-		if (m_defrag(m, M_NOWAIT) == 0 &&
+		if (m_defrag(m, M_NOWAIT) != NULL &&
 		bus_dmamap_load_mbuf(sc->sc_dmat, txd->txd_dmap, m,
 		  BUS_DMA_READ | BUS_DMA_NOWAIT) == 0)
 			break;



CVS commit: src/sys/dev/hyperv

2019-11-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Nov 18 04:38:48 UTC 2019

Modified Files:
src/sys/dev/hyperv: if_hvn.c

Log Message:
Fixed incorrect m_defrag return value check.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/hyperv/if_hvn.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/hyperv

2019-11-15 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Nov 15 08:51:27 UTC 2019

Modified Files:
src/sys/dev/hyperv: hvkbd.c if_hvn.c

Log Message:
hvn(4), hvkbd(4): No need to call vmbus_channel_setdeferred().

These devices do not perform batch reading.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/hyperv/hvkbd.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/hyperv/if_hvn.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/hyperv/hvkbd.c
diff -u src/sys/dev/hyperv/hvkbd.c:1.3 src/sys/dev/hyperv/hvkbd.c:1.4
--- src/sys/dev/hyperv/hvkbd.c:1.3	Tue Oct  1 18:00:08 2019
+++ src/sys/dev/hyperv/hvkbd.c	Fri Nov 15 08:51:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hvkbd.c,v 1.3 2019/10/01 18:00:08 chs Exp $	*/
+/*	$NetBSD: hvkbd.c,v 1.4 2019/11/15 08:51:27 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2017 Microsoft Corp.
@@ -36,7 +36,7 @@
 #endif /* _KERNEL_OPT */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.3 2019/10/01 18:00:08 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hvkbd.c,v 1.4 2019/11/15 08:51:27 nonaka Exp $");
 
 #include 
 #include 
@@ -210,11 +210,6 @@ hvkbd_attach(device_t parent, device_t s
 	hvkbd_alloc_keybuf(sc);
 
 	sc->sc_buf = kmem_zalloc(HVKBD_BUFSIZE, KM_SLEEP);
-	if (vmbus_channel_setdeferred(sc->sc_chan, device_xname(self))) {
-		aprint_error_dev(self,
-		"failed to create the interrupt thread\n");
-		goto free_buf;
-	}
 
 	sc->sc_chan->ch_flags &= ~CHF_BATCHED;
 	if (vmbus_channel_open(sc->sc_chan,

Index: src/sys/dev/hyperv/if_hvn.c
diff -u src/sys/dev/hyperv/if_hvn.c:1.5 src/sys/dev/hyperv/if_hvn.c:1.6
--- src/sys/dev/hyperv/if_hvn.c:1.5	Tue Oct  1 18:00:08 2019
+++ src/sys/dev/hyperv/if_hvn.c	Fri Nov 15 08:51:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_hvn.c,v 1.5 2019/10/01 18:00:08 chs Exp $	*/
+/*	$NetBSD: if_hvn.c,v 1.6 2019/11/15 08:51:27 nonaka Exp $	*/
 /*	$OpenBSD: if_hvn.c,v 1.39 2018/03/11 14:31:34 mikeb Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.5 2019/10/01 18:00:08 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_hvn.c,v 1.6 2019/11/15 08:51:27 nonaka Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -922,12 +922,6 @@ hvn_nvs_attach(struct hvn_softc *sc)
 
 	sc->sc_chan->ch_flags &= ~CHF_BATCHED;
 
-	if (vmbus_channel_setdeferred(sc->sc_chan, device_xname(sc->sc_dev))) {
-		aprint_error_dev(sc->sc_dev,
-		"failed to create the interrupt thread\n");
-		return -1;
-	}
-
 	/* Associate our interrupt handler with the channel */
 	if (vmbus_channel_open(sc->sc_chan, ringsize, NULL, 0,
 	hvn_nvs_intr, sc)) {



CVS commit: src/sys/dev/hyperv

2019-11-15 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Nov 15 08:51:27 UTC 2019

Modified Files:
src/sys/dev/hyperv: hvkbd.c if_hvn.c

Log Message:
hvn(4), hvkbd(4): No need to call vmbus_channel_setdeferred().

These devices do not perform batch reading.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/hyperv/hvkbd.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/hyperv/if_hvn.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-11-10 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Nov 11 07:27:49 UTC 2019

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

Log Message:
nvme(4): Use the SET_FEATURES command to get the number of allocated queues.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/ic/nvme.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/nvme.c
diff -u src/sys/dev/ic/nvme.c:1.46 src/sys/dev/ic/nvme.c:1.47
--- src/sys/dev/ic/nvme.c:1.46	Thu Sep 26 11:50:32 2019
+++ src/sys/dev/ic/nvme.c	Mon Nov 11 07:27:48 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.46 2019/09/26 11:50:32 nonaka Exp $	*/
+/*	$NetBSD: nvme.c,v 1.47 2019/11/11 07:27:48 nonaka Exp $	*/
 /*	$OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.46 2019/09/26 11:50:32 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.47 2019/11/11 07:27:48 nonaka Exp $");
 
 #include 
 #include 
@@ -116,7 +116,8 @@ static void	nvme_pt_done(struct nvme_que
 static int	nvme_command_passthrough(struct nvme_softc *,
 		struct nvme_pt_command *, uint16_t, struct lwp *, bool);
 
-static int	nvme_get_number_of_queues(struct nvme_softc *, u_int *);
+static int	nvme_set_number_of_queues(struct nvme_softc *, u_int, u_int *,
+		u_int *);
 
 #define NVME_TIMO_QOP		5	/* queue create and delete timeout */
 #define NVME_TIMO_IDENT		10	/* probe identify timeout */
@@ -339,7 +340,7 @@ nvme_attach(struct nvme_softc *sc)
 	uint32_t reg;
 	u_int dstrd;
 	u_int mps = PAGE_SHIFT;
-	u_int ioq_allocated;
+	u_int ncq, nsq;
 	uint16_t adminq_entries = nvme_adminq_size;
 	uint16_t ioq_entries = nvme_ioq_size;
 	int i;
@@ -413,13 +414,15 @@ nvme_attach(struct nvme_softc *sc)
 
 	if (sc->sc_use_mq) {
 		/* Limit the number of queues to the number allocated in HW */
-		if (nvme_get_number_of_queues(sc, _allocated) != 0) {
+		if (nvme_set_number_of_queues(sc, sc->sc_nq, , ) != 0) {
 			aprint_error_dev(sc->sc_dev,
 			"unable to get number of queues\n");
 			goto disable;
 		}
-		if (sc->sc_nq > ioq_allocated)
-			sc->sc_nq = ioq_allocated;
+		if (sc->sc_nq > ncq)
+			sc->sc_nq = ncq;
+		if (sc->sc_nq > nsq)
+			sc->sc_nq = nsq;
 	}
 
 	sc->sc_q = kmem_zalloc(sizeof(*sc->sc_q) * sc->sc_nq, KM_SLEEP);
@@ -1579,20 +1582,21 @@ nvme_fill_identify(struct nvme_queue *q,
 }
 
 static int
-nvme_get_number_of_queues(struct nvme_softc *sc, u_int *nqap)
+nvme_set_number_of_queues(struct nvme_softc *sc, u_int nq, u_int *ncqa,
+u_int *nsqa)
 {
 	struct nvme_pt_state state;
 	struct nvme_pt_command pt;
 	struct nvme_ccb *ccb;
-	uint16_t ncqa, nsqa;
 	int rv;
 
 	ccb = nvme_ccb_get(sc->sc_admin_q, false);
 	KASSERT(ccb != NULL); /* it's a bug if we don't have spare ccb here */
 
 	memset(, 0, sizeof(pt));
-	pt.cmd.opcode = NVM_ADMIN_GET_FEATURES;
-	pt.cmd.cdw10 = NVM_FEATURE_NUMBER_OF_QUEUES;
+	pt.cmd.opcode = NVM_ADMIN_SET_FEATURES;
+	htolem32(, NVM_FEATURE_NUMBER_OF_QUEUES);
+	htolem32(, ((nq - 1) << 16) | (nq - 1));
 
 	memset(, 0, sizeof(state));
 	state.pt = 
@@ -1604,13 +1608,12 @@ nvme_get_number_of_queues(struct nvme_so
 	rv = nvme_poll(sc, sc->sc_admin_q, ccb, nvme_pt_fill, NVME_TIMO_QOP);
 
 	if (rv != 0) {
-		*nqap = 0;
+		*ncqa = *nsqa = 0;
 		return EIO;
 	}
 
-	ncqa = pt.cpl.cdw0 >> 16;
-	nsqa = pt.cpl.cdw0 & 0x;
-	*nqap = MIN(ncqa, nsqa) + 1;
+	*ncqa = (pt.cpl.cdw0 >> 16) + 1;
+	*nsqa = (pt.cpl.cdw0 & 0x) + 1;
 
 	return 0;
 }



CVS commit: src/sys/dev/ic

2019-11-10 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Nov 11 07:27:49 UTC 2019

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

Log Message:
nvme(4): Use the SET_FEATURES command to get the number of allocated queues.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/ic/nvme.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-09-26 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Thu Sep 26 12:21:03 UTC 2019

Modified Files:
src/sys/arch/i386/stand/efiboot: boot.c conf.c dev_net.c devopen.c
devopen.h

Log Message:
x86 efiboot: pass a filename to BOOTP and parse a DHCP server provided filename.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/i386/stand/efiboot/boot.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/efiboot/conf.c \
src/sys/arch/i386/stand/efiboot/dev_net.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/i386/stand/efiboot/devopen.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/i386/stand/efiboot/devopen.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/i386/stand/efiboot

2019-09-26 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Thu Sep 26 12:21:03 UTC 2019

Modified Files:
src/sys/arch/i386/stand/efiboot: boot.c conf.c dev_net.c devopen.c
devopen.h

Log Message:
x86 efiboot: pass a filename to BOOTP and parse a DHCP server provided filename.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/i386/stand/efiboot/boot.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/stand/efiboot/conf.c \
src/sys/arch/i386/stand/efiboot/dev_net.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/i386/stand/efiboot/devopen.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/i386/stand/efiboot/devopen.h

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

Modified files:

Index: src/sys/arch/i386/stand/efiboot/boot.c
diff -u src/sys/arch/i386/stand/efiboot/boot.c:1.16 src/sys/arch/i386/stand/efiboot/boot.c:1.17
--- src/sys/arch/i386/stand/efiboot/boot.c:1.16	Fri Sep 13 02:19:45 2019
+++ src/sys/arch/i386/stand/efiboot/boot.c	Thu Sep 26 12:21:03 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.16 2019/09/13 02:19:45 manu Exp $	*/
+/*	$NetBSD: boot.c,v 1.17 2019/09/26 12:21:03 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -111,6 +111,7 @@ const struct bootblk_command commands[] 
 	{ NULL,		NULL },
 };
 
+static char *default_fsname;
 static char *default_devname;
 static int default_unit, default_partition;
 static const char *default_filename;
@@ -125,8 +126,11 @@ parsebootfile(const char *fname, char **
 {
 	const char *col;
 	static char savedevname[MAXDEVNAME+1];
+#if defined(SUPPORT_NFS) || defined(SUPPORT_TFTP)
+	const struct netboot_fstab *nf;
+#endif
 
-	*fsname = "ufs";
+	*fsname = default_fsname;
 	if (default_part_name == NULL) {
 		*devname = default_devname;
 	} else {
@@ -152,6 +156,7 @@ parsebootfile(const char *fname, char **
 
 		if (strstr(fname, "NAME=") == fname) {
 			strlcpy(savedevname, fname, devlen + 1);
+			*fsname = "ufs";
 			*devname = savedevname;
 			*unit = -1;
 			*partition = -1;
@@ -188,6 +193,13 @@ parsebootfile(const char *fname, char **
 		if (i != devlen)
 			return ENXIO;
 
+#if defined(SUPPORT_NFS) || defined(SUPPORT_TFTP)
+		nf = netboot_fstab_find(savedevname);
+		if (nf != NULL)
+			*fsname = (char *)nf->name;
+		else
+#endif
+		*fsname = "ufs";
 		*devname = savedevname;
 		*unit = u;
 		*partition = p;
@@ -278,6 +290,9 @@ boot(void)
 {
 	int currname;
 	int c;
+#if defined(SUPPORT_NFS) || defined(SUPPORT_TFTP)
+	const struct netboot_fstab *nf;
+#endif
 
 	boot_modules_enabled = !(boot_params.bp_flags & X86_BP_FLAGS_NOMODULES);
 
@@ -288,6 +303,14 @@ boot(void)
 	/* if the user types "boot" without filename */
 	default_filename = DEFFILENAME;
 
+#if defined(SUPPORT_NFS) || defined(SUPPORT_TFTP)
+	nf = netboot_fstab_find(default_devname);
+	if (nf != NULL)
+		default_fsname = (char *)nf->name;
+	else
+#endif
+	default_fsname = "ufs";
+
 	if (!(boot_params.bp_flags & X86_BP_FLAGS_NOBOOTCONF)) {
 #ifdef EFIBOOTCFG_FILENAME
 		int rv = EINVAL;
@@ -456,7 +479,7 @@ command_dev(char *arg)
 {
 	static char savedevname[MAXDEVNAME + 1];
 	char buf[80];
-	char *fsname, *devname;
+	char *devname;
 	const char *file; /* dummy */
 
 	if (*arg == '\0') {
@@ -474,7 +497,7 @@ command_dev(char *arg)
 	}
 
 	if (strchr(arg, ':') == NULL ||
-	parsebootfile(arg, , , _unit,
+	parsebootfile(arg, _fsname, , _unit,
 	  _partition, )) {
 		command_help(NULL);
 		return;

Index: src/sys/arch/i386/stand/efiboot/conf.c
diff -u src/sys/arch/i386/stand/efiboot/conf.c:1.2 src/sys/arch/i386/stand/efiboot/conf.c:1.3
--- src/sys/arch/i386/stand/efiboot/conf.c:1.2	Wed Apr 11 10:32:09 2018
+++ src/sys/arch/i386/stand/efiboot/conf.c	Thu Sep 26 12:21:03 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: conf.c,v 1.2 2018/04/11 10:32:09 nonaka Exp $	 */
+/*	$NetBSD: conf.c,v 1.3 2019/09/26 12:21:03 nonaka Exp $	 */
 
 /*
  * Copyright (c) 1997
@@ -54,20 +54,23 @@
 #endif
 #endif
 #include 
+#include "devopen.h"
 #include "efinet.h"
 
 struct devsw devsw[] = {
 	{ "disk", biosdisk_strategy, biosdisk_open, biosdisk_close, biosdisk_ioctl },
+#if defined(SUPPORT_NFS) || defined(SUPPORT_TFTP)
 	{ "net", net_strategy, net_open, net_close, net_ioctl },
+#endif
 };
 int ndevs = __arraycount(devsw);
 
-#if defined(SUPPORT_NFS) || defined(SUPPORT_TFTP)
 struct netif_driver *netif_drivers[] = {
+#if defined(SUPPORT_NFS) || defined(SUPPORT_TFTP)
 	,
+#endif
 };
 int n_netif_drivers = __arraycount(netif_drivers);
-#endif
 
 struct fs_ops file_system[] = {
 #ifdef SUPPORT_CD9660
@@ -113,3 +116,15 @@ struct fs_ops file_system_nfs = FS_OPS(n
 #ifdef SUPPORT_TFTP
 struct fs_ops file_system_tftp = FS_OPS(tftp);
 #endif
+
+#if defined(SUPPORT_NFS) || defined(SUPPORT_TFTP)
+const struct netboot_fstab netboot_fstab[] = {
+#ifdef SUPPORT_NFS
+	{ "nfs", _system_nfs },
+#endif
+#ifdef SUPPORT_TFTP
+	{ "tftp", _system_tftp },
+#endif
+};
+const int nnetboot_fstab = __arraycount(netboot_fstab);
+#endif
Index: 

CVS commit: src/sys/dev/ic

2019-09-26 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Thu Sep 26 11:50:32 UTC 2019

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

Log Message:
nvme(4): Don't attach the device, if namespace not found.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/ic/nvme.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-09-26 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Thu Sep 26 11:50:32 UTC 2019

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

Log Message:
nvme(4): Don't attach the device, if namespace not found.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/ic/nvme.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/nvme.c
diff -u src/sys/dev/ic/nvme.c:1.45 src/sys/dev/ic/nvme.c:1.46
--- src/sys/dev/ic/nvme.c:1.45	Fri Sep 20 05:32:42 2019
+++ src/sys/dev/ic/nvme.c	Thu Sep 26 11:50:32 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.45 2019/09/20 05:32:42 nonaka Exp $	*/
+/*	$NetBSD: nvme.c,v 1.46 2019/09/26 11:50:32 nonaka Exp $	*/
 /*	$OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.45 2019/09/20 05:32:42 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.46 2019/09/26 11:50:32 nonaka Exp $");
 
 #include 
 #include 
@@ -399,6 +399,10 @@ nvme_attach(struct nvme_softc *sc)
 		aprint_error_dev(sc->sc_dev, "unable to identify controller\n");
 		goto disable;
 	}
+	if (sc->sc_nn == 0) {
+		aprint_error_dev(sc->sc_dev, "namespace not found\n");
+		goto disable;
+	}
 
 	/* we know how big things are now */
 	sc->sc_max_sgl = sc->sc_mdts / sc->sc_mps;



CVS commit: src/sys/dev/ic

2019-09-19 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Sep 20 05:32:42 UTC 2019

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

Log Message:
Don't set Phase Tag bit of Completion Queue entry at nvme_poll_done().

A new completion queue entry check incorrectly determined that there was
a Completion Queue entry for a command that was not submitted.

Fix PR kern/54275, PR kern/54503, PR kern/54532.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/ic/nvme.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/nvme.c
diff -u src/sys/dev/ic/nvme.c:1.44 src/sys/dev/ic/nvme.c:1.45
--- src/sys/dev/ic/nvme.c:1.44	Fri Jun 28 15:08:47 2019
+++ src/sys/dev/ic/nvme.c	Fri Sep 20 05:32:42 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.44 2019/06/28 15:08:47 jmcneill Exp $	*/
+/*	$NetBSD: nvme.c,v 1.45 2019/09/20 05:32:42 nonaka Exp $	*/
 /*	$OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.44 2019/06/28 15:08:47 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.45 2019/09/20 05:32:42 nonaka Exp $");
 
 #include 
 #include 
@@ -1302,8 +1302,8 @@ nvme_poll_done(struct nvme_queue *q, str
 {
 	struct nvme_poll_state *state = ccb->ccb_cookie;
 
-	SET(cqe->flags, htole16(NVME_CQE_PHASE));
 	state->c = *cqe;
+	SET(state->c.flags, htole16(NVME_CQE_PHASE));
 
 	ccb->ccb_cookie = state->cookie;
 	state->done(q, ccb, >c);



CVS commit: src/sys/dev/ic

2019-09-19 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Sep 20 05:32:42 UTC 2019

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

Log Message:
Don't set Phase Tag bit of Completion Queue entry at nvme_poll_done().

A new completion queue entry check incorrectly determined that there was
a Completion Queue entry for a command that was not submitted.

Fix PR kern/54275, PR kern/54503, PR kern/54532.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/ic/nvme.c

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



CVS commit: src/etc/rc.d

2019-09-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Wed Sep 18 05:16:15 UTC 2019

Modified Files:
src/etc/rc.d: Makefile

Log Message:
Moved zfs out of MKX11 block.

Fix build failure without X11.


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/etc/rc.d/Makefile

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



CVS commit: src/etc/rc.d

2019-09-17 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Wed Sep 18 05:16:15 UTC 2019

Modified Files:
src/etc/rc.d: Makefile

Log Message:
Moved zfs out of MKX11 block.

Fix build failure without X11.


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/etc/rc.d/Makefile

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

Modified files:

Index: src/etc/rc.d/Makefile
diff -u src/etc/rc.d/Makefile:1.105 src/etc/rc.d/Makefile:1.106
--- src/etc/rc.d/Makefile:1.105	Sun Sep 15 19:38:09 2019
+++ src/etc/rc.d/Makefile	Wed Sep 18 05:16:15 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.105 2019/09/15 19:38:09 brad Exp $
+# $NetBSD: Makefile,v 1.106 2019/09/18 05:16:15 nonaka Exp $
 
 .include 
 
@@ -54,14 +54,14 @@ FILESBUILD_xdm=	yes
 FILESBUILD_xfs=	yes
 FILESBUILD_fccache= yes
 
-.if ${MKZFS} != "no"
-CONFIGFILES+=	zfs
-.endif
-
 .SUFFIXES: .in
 .in:
 	${_MKTARGET_CREATE}
 	${TOOL_SED} -e 's,@X11ROOTDIR@,${X11ROOTDIR},g' < ${.IMPSRC} > ${.TARGET}
 .endif
 
+.if ${MKZFS} != "no"
+CONFIGFILES+=	zfs
+.endif
+
 .include 



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

2019-08-03 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Sat Aug  3 08:13:36 UTC 2019

Modified Files:
src/sys/arch/i386/stand/efiboot: version

Log Message:
x86 efiboot: version 1.1.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/efiboot/version

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-08-03 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Sat Aug  3 08:13:36 UTC 2019

Modified Files:
src/sys/arch/i386/stand/efiboot: version

Log Message:
x86 efiboot: version 1.1.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/efiboot/version

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/version
diff -u src/sys/arch/i386/stand/efiboot/version:1.1 src/sys/arch/i386/stand/efiboot/version:1.2
--- src/sys/arch/i386/stand/efiboot/version:1.1	Tue Jan 24 11:09:14 2017
+++ src/sys/arch/i386/stand/efiboot/version	Sat Aug  3 08:13:36 2019
@@ -1,7 +1,8 @@
-$NetBSD: version,v 1.1 2017/01/24 11:09:14 nonaka Exp $
+$NetBSD: version,v 1.2 2019/08/03 08:13:36 nonaka Exp $
 
 NOTE ANY CHANGES YOU MAKE TO THE EFI BOOTLOADER HERE.  The format of this
 file is important - make sure the entries are appended on end, last item
 is taken as the current.
 
 1.0:	Initial version.
+1.1:	Add CD/DVD-ROM, serial, PXE boot and UEFI memory map compaction support.



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/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, , );
@@ -371,24 +354,23 @@ efi_memory_show_map(bool sorted, bool co
 	if (compact)
 		efi_memory_compact_map(mdtop, , 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, , 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(, md, sizeof(*md));
-CopyMem(md, target, sizeof(*md));
-CopyMem(target, , sizeof(*md));
+CopyMem(tmp, md, *DescriptorSize);
+CopyMem(md, target, *DescriptorSize);
+CopyMem(target, tmp, 

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/i386/stand

2019-07-26 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Jul 26 12:09:48 UTC 2019

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

Log Message:
Pre-allocate memory for the kernel space at startup.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/i386/stand/efiboot/boot.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/i386/stand/efiboot/efimemory.c
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/i386/stand/lib/exec.c
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/i386/stand/lib/libi386.h

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

Modified files:

Index: src/sys/arch/i386/stand/efiboot/boot.c
diff -u src/sys/arch/i386/stand/efiboot/boot.c:1.11 src/sys/arch/i386/stand/efiboot/boot.c:1.12
--- src/sys/arch/i386/stand/efiboot/boot.c:1.11	Thu Jun 20 17:33:31 2019
+++ src/sys/arch/i386/stand/efiboot/boot.c	Fri Jul 26 12:09:48 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.11 2019/06/20 17:33:31 maxv Exp $	*/
+/*	$NetBSD: boot.c,v 1.12 2019/07/26 12:09:48 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -226,40 +226,16 @@ clearit(void)
 static void
 bootit(const char *filename, int howto)
 {
-	EFI_STATUS status;
-	EFI_PHYSICAL_ADDRESS bouncebuf;
-	UINTN npages;
-	u_long allocsz;
 
 	if (howto & AB_VERBOSE)
 		printf("booting %s (howto 0x%x)\n", sprint_bootsel(filename),
 		howto);
 
-	if (count_netbsd(filename, ) < 0) {
-		printf("boot: %s: %s\n", sprint_bootsel(filename),
-		   strerror(errno));
-		return;
-	}
-
-	bouncebuf = EFI_ALLOCATE_MAX_ADDRESS;
-	npages = EFI_SIZE_TO_PAGES(allocsz);
-	status = uefi_call_wrapper(BS->AllocatePages, 4, AllocateMaxAddress,
-	EfiLoaderData, npages, );
-	if (EFI_ERROR(status)) {
-		printf("boot: %s: %s\n", sprint_bootsel(filename),
-		   strerror(ENOMEM));
-		return;
-	}
-
-	efi_loadaddr = bouncebuf;
-	if (exec_netbsd(filename, bouncebuf, howto, 0, efi_cleanup) < 0)
+	if (exec_netbsd(filename, efi_loadaddr, howto, 0, efi_cleanup) < 0)
 		printf("boot: %s: %s\n", sprint_bootsel(filename),
 		   strerror(errno));
 	else
 		printf("boot returned\n");
-
-	(void) uefi_call_wrapper(BS->FreePages, 2, bouncebuf, npages);
-	efi_loadaddr = 0;
 }
 
 void

Index: src/sys/arch/i386/stand/efiboot/efimemory.c
diff -u src/sys/arch/i386/stand/efiboot/efimemory.c:1.5 src/sys/arch/i386/stand/efiboot/efimemory.c:1.6
--- src/sys/arch/i386/stand/efiboot/efimemory.c:1.5	Tue Mar 27 14:15:05 2018
+++ src/sys/arch/i386/stand/efiboot/efimemory.c	Fri Jul 26 12:09:48 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: efimemory.c,v 1.5 2018/03/27 14:15:05 nonaka Exp $	*/
+/*	$NetBSD: efimemory.c,v 1.6 2019/07/26 12:09:48 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -64,6 +64,10 @@ static const char *efimemtypes[] = {
 	"PersistentMemory",
 };
 
+#ifndef KERN_LOADSPACE_SIZE
+#define KERN_LOADSPACE_SIZE	(128 * 1024 * 1024)	/* 128MiB */
+#endif
+
 static int
 getmemtype(EFI_MEMORY_DESCRIPTOR *md)
 {
@@ -231,13 +235,21 @@ void
 efi_memory_probe(void)
 {
 	EFI_MEMORY_DESCRIPTOR *mdtop, *md, *next;
+	EFI_STATUS status;
+	EFI_PHYSICAL_ADDRESS bouncebuf;
 	UINTN i, n, NoEntries, MapKey, DescriptorSize, MappingSize;
 	UINT32 DescriptorVersion;
 	int memtype;
 
+	bouncebuf = EFI_ALLOCATE_MAX_ADDRESS;
+	status = uefi_call_wrapper(BS->AllocatePages, 4, AllocateMaxAddress,
+	EfiLoaderData, EFI_SIZE_TO_PAGES(KERN_LOADSPACE_SIZE), );
+	if (EFI_ERROR(status))
+		panic("couldn't allocate kernel space.");
+	efi_loadaddr = bouncebuf;
+
 	mdtop = efi_memory_get_map(, , ,
 	, false);
-
 	printf(" mem[");
 	for (i = 0, n = 0, md = mdtop; i < NoEntries; i++, md = next) {
 		next = NextMemoryDescriptor(md, DescriptorSize);

Index: src/sys/arch/i386/stand/lib/exec.c
diff -u src/sys/arch/i386/stand/lib/exec.c:1.72 src/sys/arch/i386/stand/lib/exec.c:1.73
--- src/sys/arch/i386/stand/lib/exec.c:1.72	Mon Jun 24 13:58:24 2019
+++ src/sys/arch/i386/stand/lib/exec.c	Fri Jul 26 12:09:48 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec.c,v 1.72 2019/06/24 13:58:24 pgoyette Exp $	 */
+/*	$NetBSD: exec.c,v 1.73 2019/07/26 12:09:48 nonaka Exp $	 */
 
 /*
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -573,64 +573,6 @@ out:
 	return -1;
 }
 
-int
-count_netbsd(const char *file, u_long *rsz)
-{
-	u_long marks[MARK_MAX];
-	char kdev[64];
-	char base_path[64] = "/";
-	struct stat st;
-	boot_module_t *bm;
-	u_long sz;
-	int err, fd;
-
-	if (has_prekern) {
-		/*
-		 * Hardcoded for now. Need to count both the prekern and the
-		 * kernel. 128MB is enough in all cases, so use that.
-		 */
-		*rsz = (128UL << 20);
-		return 0;
-	}
-
-	howto = AB_SILENT;
-
-	memset(marks, 0, sizeof(marks));
-	if ((fd = loadfile(file, marks, COUNT_KERNEL | LOAD_NOTE)) == -1)
-		return -1;
-	close(fd);
-	marks[MARK_END] = (((u_long) marks[MARK_END] + sizeof(int) - 1)) &
-	(-sizeof(int));
-	sz = marks[MARK_END];
-
-	/* The modules must be allocated after the 

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

2019-07-26 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Jul 26 12:09:48 UTC 2019

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

Log Message:
Pre-allocate memory for the kernel space at startup.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/i386/stand/efiboot/boot.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/i386/stand/efiboot/efimemory.c
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/i386/stand/lib/exec.c
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/i386/stand/lib/libi386.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/i386/stand/efiboot

2019-07-26 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Jul 26 11:30:31 UTC 2019

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

Log Message:
Added tftp support to x86 efiboot.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/i386/stand/efiboot/Makefile.efiboot
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/efiboot/dev_net.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/Makefile.efiboot
diff -u src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.14 src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.15
--- src/sys/arch/i386/stand/efiboot/Makefile.efiboot:1.14	Wed Jul 25 23:45:32 2018
+++ src/sys/arch/i386/stand/efiboot/Makefile.efiboot	Fri Jul 26 11:30:31 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.efiboot,v 1.14 2018/07/25 23:45:32 kamil Exp $
+# $NetBSD: Makefile.efiboot,v 1.15 2019/07/26 11:30:31 nonaka Exp $
 
 S=		${.CURDIR}/../../../../..
 
@@ -18,7 +18,9 @@ SOURCES+= efidisk.c efidisk_ll.c efigets
 SOURCES+= efinet.c efipxe.c
 LIBI386SRCS= biosdisk.c bootinfo.c bootinfo_biosgeom.c bootmenu.c
 LIBI386SRCS+= diskbuf.c exec.c menuutils.c parseutils.c pread.c
-SRCS= ${SOURCES} ${EXTRA_SOURCES} ${LIBI386SRCS}
+# use our own nfs implementation
+LIBSASRCS+= nfs.c
+SRCS= ${SOURCES} ${EXTRA_SOURCES} ${LIBI386SRCS} ${LIBSASRCS}
 
 .include 
 
@@ -35,6 +37,7 @@ BINMODE=444
 
 .PATH:	${.CURDIR} ${.CURDIR}/..
 .PATH:	${.CURDIR}/../../lib
+.PATH:	${.CURDIR}/../../libsa
 
 LDSCRIPT?= ${.CURDIR}/ldscript
 LDFLAGS+= -nostdlib -T${LDSCRIPT} -Bsymbolic -shared -nocombreloc
@@ -60,7 +63,7 @@ CPPFLAGS+= -DSUPPORT_EXT2FS
 CPPFLAGS+= -DSUPPORT_BOOTP
 CPPFLAGS+= -DSUPPORT_DHCP
 CPPFLAGS+= -DSUPPORT_NFS
-#CPPFLAGS+= -DSUPPORT_TFTP
+CPPFLAGS+= -DSUPPORT_TFTP
 CPPFLAGS+= -DPASS_BIOSGEOM
 CPPFLAGS+= -DBIOSDISK_DEFAULT_SECSIZE=2048	# for bootinfo_biosgeom.c
 CPPFLAGS+= -DLIBSA_ENABLE_LS_OP

Index: src/sys/arch/i386/stand/efiboot/dev_net.c
diff -u src/sys/arch/i386/stand/efiboot/dev_net.c:1.1 src/sys/arch/i386/stand/efiboot/dev_net.c:1.2
--- src/sys/arch/i386/stand/efiboot/dev_net.c:1.1	Wed Apr 11 10:32:09 2018
+++ src/sys/arch/i386/stand/efiboot/dev_net.c	Fri Jul 26 11:30:31 2019
@@ -1,3 +1,256 @@
-/*	$NetBSD: dev_net.c,v 1.1 2018/04/11 10:32:09 nonaka Exp $	*/
+/*	$NetBSD: dev_net.c,v 1.2 2019/07/26 11:30:31 nonaka Exp $	*/
 
-#include 
+/*-
+ * Copyright (c) 1997 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Gordon W. Ross.
+ *
+ * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * This module implements a "raw device" interface suitable for
+ * use by the stand-alone I/O library NFS code.  This interface
+ * does not support any "block" access, and exists only for the
+ * purpose of initializing the network interface, getting boot
+ * parameters, and performing the NFS mount.
+ *
+ * At open time, this does:
+ *
+ * find interface  - netif_open()
+ * RARP for IP address - rarp_getipaddress()
+ * RPC/bootparams  - callrpc(d, RPC_BOOTPARAMS, ...)
+ * RPC/mountd  - nfs_mount(sock, ip, path)
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include "stand.h"
+#include "net.h"
+#include "netif.h"
+#include "nfs.h"
+#include "bootparam.h"
+#include "dev_net.h"
+#ifdef SUPPORT_BOOTP
+#include "bootp.h"
+#endif
+
+static int netdev_sock = -1;
+static int netdev_opens;
+
+static int net_getparams(int);
+
+/*
+ * Called by devopen after it sets f->f_dev to our devsw entry.
+ * This opens the low-level device and sets f->f_devdata.
+ * This is 

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

2019-07-26 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Jul 26 11:30:31 UTC 2019

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

Log Message:
Added tftp support to x86 efiboot.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/i386/stand/efiboot/Makefile.efiboot
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/i386/stand/efiboot/dev_net.c

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



CVS commit: src/usr.bin/kdump

2019-07-22 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Jul 23 01:54:51 UTC 2019

Modified Files:
src/usr.bin/kdump: kdump.c

Log Message:
kdump(1): Symbolic printing for MALLOC_OPTIONS="U".


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/usr.bin/kdump/kdump.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.bin/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.131 src/usr.bin/kdump/kdump.c:1.132
--- src/usr.bin/kdump/kdump.c:1.131	Mon May  6 19:20:13 2019
+++ src/usr.bin/kdump/kdump.c	Tue Jul 23 01:54:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.131 2019/05/06 19:20:13 christos Exp $	*/
+/*	$NetBSD: kdump.c,v 1.132 2019/07/23 01:54:51 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)kdump.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kdump.c,v 1.131 2019/05/06 19:20:13 christos Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.132 2019/07/23 01:54:51 nonaka Exp $");
 #endif
 #endif /* not lint */
 
@@ -1143,6 +1143,27 @@ ktruser_control(const char *name, const 
 }
 
 static void
+ktruser_malloc(const char *name, const void *buf, size_t len)
+{
+	struct ut { void *p; size_t s; void *r; } m;
+
+	if (len != sizeof(m))
+		warnx("%.*s: len %zu != %zu", KTR_USER_MAXIDLEN, name, len,
+		sizeof(m));
+	memcpy(, buf, len < sizeof(m) ? len : sizeof(m));
+	if (m.p == NULL && m.s == 0 && m.r == NULL)
+		printf("%.*s: malloc_init()\n", KTR_USER_MAXIDLEN, name);
+	else if (m.p != NULL && m.s != 0)
+		printf("%.*s: %p = realloc(%p, %zu)\n", KTR_USER_MAXIDLEN, name,
+		m.r, m.p, m.s);
+	else if (m.s == 0)
+		printf("%.*s: free(%p)\n", KTR_USER_MAXIDLEN, name, m.p);
+	else
+		printf("%.*s: %p = malloc(%zu)\n", KTR_USER_MAXIDLEN, name,
+		m.r, m.s);
+}
+
+static void
 ktruser_misc(const char *name, const void *buf, size_t len)
 {
 	size_t i;
@@ -1161,6 +1182,7 @@ static struct {
 	{ "msghdr", ktruser_msghdr },
 	{ "mbsoname", ktruser_soname },
 	{ "mbcontrol", ktruser_control },
+	{ "malloc", ktruser_malloc },
 	{ NULL,	ktruser_misc },
 };
 



CVS commit: src/usr.bin/kdump

2019-07-22 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue Jul 23 01:54:51 UTC 2019

Modified Files:
src/usr.bin/kdump: kdump.c

Log Message:
kdump(1): Symbolic printing for MALLOC_OPTIONS="U".


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/usr.bin/kdump/kdump.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/include

2019-06-20 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Jun 21 02:08:55 UTC 2019

Modified Files:
src/sys/arch/x86/include: bootinfo.h

Log Message:
PR/54147: Increase BOOTINFO_MAXSIZE to 16Kib.

Some systems require a larger bootinfo size for memory descriptors.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/x86/include/bootinfo.h

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

Modified files:

Index: src/sys/arch/x86/include/bootinfo.h
diff -u src/sys/arch/x86/include/bootinfo.h:1.29 src/sys/arch/x86/include/bootinfo.h:1.30
--- src/sys/arch/x86/include/bootinfo.h:1.29	Fri Apr 13 11:24:34 2018
+++ src/sys/arch/x86/include/bootinfo.h	Fri Jun 21 02:08:55 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootinfo.h,v 1.29 2018/04/13 11:24:34 nonaka Exp $	*/
+/*	$NetBSD: bootinfo.h,v 1.30 2019/06/21 02:08:55 nonaka Exp $	*/
 
 /*
  * Copyright (c) 1997
@@ -251,7 +251,7 @@ struct btinfo_efimemmap {
 
 #ifdef _KERNEL
 
-#define BOOTINFO_MAXSIZE 8192
+#define BOOTINFO_MAXSIZE 16384
 
 #ifndef _LOCORE
 /*



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

2019-06-20 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri Jun 21 02:08:55 UTC 2019

Modified Files:
src/sys/arch/x86/include: bootinfo.h

Log Message:
PR/54147: Increase BOOTINFO_MAXSIZE to 16Kib.

Some systems require a larger bootinfo size for memory descriptors.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/x86/include/bootinfo.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/x86

2019-06-03 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Jun  3 09:51:04 UTC 2019

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

Log Message:
Use efi_probe().


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

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

Modified files:

Index: src/sys/arch/x86/x86/hyperv.c
diff -u src/sys/arch/x86/x86/hyperv.c:1.3 src/sys/arch/x86/x86/hyperv.c:1.4
--- src/sys/arch/x86/x86/hyperv.c:1.3	Thu May 30 11:15:29 2019
+++ src/sys/arch/x86/x86/hyperv.c	Mon Jun  3 09:51:04 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperv.c,v 1.3 2019/05/30 11:15:29 nonaka Exp $	*/
+/*	$NetBSD: hyperv.c,v 1.4 2019/06/03 09:51:04 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2009-2012,2016-2017 Microsoft Corp.
@@ -33,7 +33,7 @@
  */
 #include 
 #ifdef __KERNEL_RCSID
-__KERNEL_RCSID(0, "$NetBSD: hyperv.c,v 1.3 2019/05/30 11:15:29 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperv.c,v 1.4 2019/06/03 09:51:04 nonaka Exp $");
 #endif
 #ifdef __FBSDID
 __FBSDID("$FreeBSD: head/sys/dev/hyperv/vmbus/hyperv.c 331757 2018-03-30 02:25:12Z emaste $");
@@ -753,7 +753,7 @@ int
 hyperv_is_gen1(void)
 {
 
-	return !bootmethod_efi;
+	return !efi_probe();
 }
 
 void



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

2019-06-03 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Mon Jun  3 09:51:04 UTC 2019

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

Log Message:
Use efi_probe().


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/x86/hyperv.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/hyperv

2019-05-30 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri May 31 04:23:19 UTC 2019

Modified Files:
src/sys/dev/hyperv: hyperv_common.c

Log Message:
Avoid undefined reference to `hyperv_is_gen1' without hyperv(4).


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/hyperv/hyperv_common.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/hyperv/hyperv_common.c
diff -u src/sys/dev/hyperv/hyperv_common.c:1.1 src/sys/dev/hyperv/hyperv_common.c:1.2
--- src/sys/dev/hyperv/hyperv_common.c:1.1	Fri Feb 15 08:54:01 2019
+++ src/sys/dev/hyperv/hyperv_common.c	Fri May 31 04:23:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperv_common.c,v 1.1 2019/02/15 08:54:01 nonaka Exp $	*/
+/*	$NetBSD: hyperv_common.c,v 1.2 2019/05/31 04:23:19 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2009-2012,2016-2017 Microsoft Corp.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperv_common.c,v 1.1 2019/02/15 08:54:01 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperv_common.c,v 1.2 2019/05/31 04:23:19 nonaka Exp $");
 
 #include "hyperv.h"
 
@@ -51,6 +51,7 @@ uint64_t	hyperv_hypercall_error(uint64_t
 __weak_alias(hyperv_hypercall, hyperv_hypercall_error);
 __weak_alias(hyperv_hypercall_enabled, hyperv_nullop);
 __weak_alias(hyperv_synic_supported, hyperv_nullop);
+__weak_alias(hyperv_is_gen1, hyperv_nullop);
 __weak_alias(hyperv_set_event_proc, hyperv_voidop);
 __weak_alias(hyperv_set_message_proc, hyperv_voidop);
 __weak_alias(hyperv_send_eom, hyperv_voidop);



CVS commit: src/sys/dev/hyperv

2019-05-30 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri May 31 04:23:19 UTC 2019

Modified Files:
src/sys/dev/hyperv: hyperv_common.c

Log Message:
Avoid undefined reference to `hyperv_is_gen1' without hyperv(4).


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/hyperv/hyperv_common.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/x86

2019-05-30 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri May 31 03:10:31 UTC 2019

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

Log Message:
Back out r1.30 change.

> tuck in include inside ifdef, from Ryosuke Moro

It was caused by the reporter's local change.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/x86/x86/consinit.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/x86

2019-05-30 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri May 31 03:10:31 UTC 2019

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

Log Message:
Back out r1.30 change.

> tuck in include inside ifdef, from Ryosuke Moro

It was caused by the reporter's local change.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/x86/x86/consinit.c

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

Modified files:

Index: src/sys/arch/x86/x86/consinit.c
diff -u src/sys/arch/x86/x86/consinit.c:1.30 src/sys/arch/x86/x86/consinit.c:1.31
--- src/sys/arch/x86/x86/consinit.c:1.30	Sun May 26 00:30:35 2019
+++ src/sys/arch/x86/x86/consinit.c	Fri May 31 03:10:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: consinit.c,v 1.30 2019/05/26 00:30:35 christos Exp $	*/
+/*	$NetBSD: consinit.c,v 1.31 2019/05/31 03:10:31 nonaka Exp $	*/
 
 /*
  * Copyright (c) 1998
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.30 2019/05/26 00:30:35 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.31 2019/05/31 03:10:31 nonaka Exp $");
 
 #include "opt_kgdb.h"
 #include "opt_puc.h"
@@ -92,8 +92,8 @@ __KERNEL_RCSID(0, "$NetBSD: consinit.c,v
 #endif
 
 #ifndef XEN
-#if NHVKBD > 0
 #include "hvkbd.h"
+#if NHVKBD > 0
 #include 
 #endif
 #endif



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

2019-05-30 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Thu May 30 11:15:29 UTC 2019

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

Log Message:
Avoid undefined reference to `hyperv_guid_video' without vmbus(4).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x86/x86/hyperv.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/x86

2019-05-30 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Thu May 30 11:15:29 UTC 2019

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

Log Message:
Avoid undefined reference to `hyperv_guid_video' without vmbus(4).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x86/x86/hyperv.c

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

Modified files:

Index: src/sys/arch/x86/x86/hyperv.c
diff -u src/sys/arch/x86/x86/hyperv.c:1.2 src/sys/arch/x86/x86/hyperv.c:1.3
--- src/sys/arch/x86/x86/hyperv.c:1.2	Fri May 24 14:28:48 2019
+++ src/sys/arch/x86/x86/hyperv.c	Thu May 30 11:15:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperv.c,v 1.2 2019/05/24 14:28:48 nonaka Exp $	*/
+/*	$NetBSD: hyperv.c,v 1.3 2019/05/30 11:15:29 nonaka Exp $	*/
 
 /*-
  * Copyright (c) 2009-2012,2016-2017 Microsoft Corp.
@@ -33,7 +33,7 @@
  */
 #include 
 #ifdef __KERNEL_RCSID
-__KERNEL_RCSID(0, "$NetBSD: hyperv.c,v 1.2 2019/05/24 14:28:48 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperv.c,v 1.3 2019/05/30 11:15:29 nonaka Exp $");
 #endif
 #ifdef __FBSDID
 __FBSDID("$FreeBSD: head/sys/dev/hyperv/vmbus/hyperv.c 331757 2018-03-30 02:25:12Z emaste $");
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD: head/sys/dev/hyperv/
 #include "lapic.h"
 #include "genfb.h"
 #include "opt_ddb.h"
+#include "vmbus.h"
 #include "wsdisplay.h"
 #endif
 
@@ -988,6 +989,7 @@ hyperv_modcmd(modcmd_t cmd, void *aux)
 	return rv;
 }
 
+#if NVMBUS > 0
 /*
  * genfb at vmbus
  */
@@ -1086,10 +1088,12 @@ populate_fbinfo(device_t dev, prop_dicti
 	}
 #endif
 }
+#endif
 
 device_t
 device_hyperv_register(device_t dev, void *aux)
 {
+#if NVMBUS > 0
 	device_t parent = device_parent(dev);
 
 	if (parent && device_is_a(parent, "vmbus") && !x86_found_console) {
@@ -1128,5 +1132,6 @@ device_hyperv_register(device_t dev, voi
 			return NULL;
 		}
 	}
+#endif
 	return NULL;
 }



CVS commit: src/sys

2019-05-24 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri May 24 14:28:49 UTC 2019

Modified Files:
src/sys/arch/amd64/conf: GENERIC
src/sys/arch/i386/conf: GENERIC
src/sys/arch/x86/include: autoconf.h
src/sys/arch/x86/pci: pci_machdep.c
src/sys/arch/x86/x86: consinit.c hyperv.c identcpu.c x86_autoconf.c
src/sys/arch/xen/x86: autoconf.c
src/sys/dev/acpi: vmbus_acpi.c
src/sys/dev/hyperv: files.hyperv hypervvar.h vmbus.c vmbusvar.h
src/sys/dev/wscons: wsconsio.h
Added Files:
src/sys/arch/x86/x86: hypervvar.h
src/sys/dev/hyperv: genfb_vmbus.c genfb_vmbusvar.h hvkbd.c hvkbdvar.h

Log Message:
Added drivers for Hyper-V Synthetic Keyboard and Video device.


To generate a diff of this commit:
cvs rdiff -u -r1.527 -r1.528 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.1206 -r1.1207 src/sys/arch/i386/conf/GENERIC
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/x86/include/autoconf.h
cvs rdiff -u -r1.85 -r1.86 src/sys/arch/x86/pci/pci_machdep.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/x86/x86/consinit.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/x86/x86/hyperv.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/x86/x86/hypervvar.h
cvs rdiff -u -r1.90 -r1.91 src/sys/arch/x86/x86/identcpu.c
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/x86/x86/x86_autoconf.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/xen/x86/autoconf.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/acpi/vmbus_acpi.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/hyperv/files.hyperv \
src/sys/dev/hyperv/hypervvar.h src/sys/dev/hyperv/vmbusvar.h
cvs rdiff -u -r0 -r1.1 src/sys/dev/hyperv/genfb_vmbus.c \
src/sys/dev/hyperv/genfb_vmbusvar.h src/sys/dev/hyperv/hvkbd.c \
src/sys/dev/hyperv/hvkbdvar.h
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/hyperv/vmbus.c
cvs rdiff -u -r1.122 -r1.123 src/sys/dev/wscons/wsconsio.h

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



CVS commit: src/sys

2019-05-24 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Fri May 24 14:28:49 UTC 2019

Modified Files:
src/sys/arch/amd64/conf: GENERIC
src/sys/arch/i386/conf: GENERIC
src/sys/arch/x86/include: autoconf.h
src/sys/arch/x86/pci: pci_machdep.c
src/sys/arch/x86/x86: consinit.c hyperv.c identcpu.c x86_autoconf.c
src/sys/arch/xen/x86: autoconf.c
src/sys/dev/acpi: vmbus_acpi.c
src/sys/dev/hyperv: files.hyperv hypervvar.h vmbus.c vmbusvar.h
src/sys/dev/wscons: wsconsio.h
Added Files:
src/sys/arch/x86/x86: hypervvar.h
src/sys/dev/hyperv: genfb_vmbus.c genfb_vmbusvar.h hvkbd.c hvkbdvar.h

Log Message:
Added drivers for Hyper-V Synthetic Keyboard and Video device.


To generate a diff of this commit:
cvs rdiff -u -r1.527 -r1.528 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.1206 -r1.1207 src/sys/arch/i386/conf/GENERIC
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/x86/include/autoconf.h
cvs rdiff -u -r1.85 -r1.86 src/sys/arch/x86/pci/pci_machdep.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/x86/x86/consinit.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/x86/x86/hyperv.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/x86/x86/hypervvar.h
cvs rdiff -u -r1.90 -r1.91 src/sys/arch/x86/x86/identcpu.c
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/x86/x86/x86_autoconf.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/xen/x86/autoconf.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/acpi/vmbus_acpi.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/hyperv/files.hyperv \
src/sys/dev/hyperv/hypervvar.h src/sys/dev/hyperv/vmbusvar.h
cvs rdiff -u -r0 -r1.1 src/sys/dev/hyperv/genfb_vmbus.c \
src/sys/dev/hyperv/genfb_vmbusvar.h src/sys/dev/hyperv/hvkbd.c \
src/sys/dev/hyperv/hvkbdvar.h
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/hyperv/vmbus.c
cvs rdiff -u -r1.122 -r1.123 src/sys/dev/wscons/wsconsio.h

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

Modified files:

Index: src/sys/arch/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.527 src/sys/arch/amd64/conf/GENERIC:1.528
--- src/sys/arch/amd64/conf/GENERIC:1.527	Mon May  6 02:24:37 2019
+++ src/sys/arch/amd64/conf/GENERIC	Fri May 24 14:28:48 2019
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.527 2019/05/06 02:24:37 sevan Exp $
+# $NetBSD: GENERIC,v 1.528 2019/05/24 14:28:48 nonaka Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.527 $"
+#ident		"GENERIC-$Revision: 1.528 $"
 
 maxusers	64		# estimated number of users
 
@@ -1067,6 +1067,9 @@ vioscsi* at virtio?			# Virtio SCSI devi
 
 # Hyper-V devices
 vmbus*		at acpi?		# Hyper-V VMBus
+genfb*		at vmbus?		# Hyper-V Synthetic Video Framebuffer
+hvkbd*		at vmbus?		# Hyper-V Synthetic Keyboard
+wskbd*		at hvkbd? console ? mux 1
 hvn*		at vmbus?		# Hyper-V NetVSC
 hvs*		at vmbus?		# Hyper-V StorVSC
 hvheartbeat*	at vmbus?		# Hyper-V Heartbeat Service

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1206 src/sys/arch/i386/conf/GENERIC:1.1207
--- src/sys/arch/i386/conf/GENERIC:1.1206	Mon May  6 02:24:37 2019
+++ src/sys/arch/i386/conf/GENERIC	Fri May 24 14:28:48 2019
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1206 2019/05/06 02:24:37 sevan Exp $
+# $NetBSD: GENERIC,v 1.1207 2019/05/24 14:28:48 nonaka Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.1206 $"
+#ident		"GENERIC-$Revision: 1.1207 $"
 
 maxusers	64		# estimated number of users
 
@@ -1406,6 +1406,9 @@ vioscsi* at virtio?			# Virtio SCSI devi
 
 # Hyper-V devices
 vmbus*		at acpi?		# Hyper-V VMBus
+genfb*		at vmbus?		# Hyper-V Synthetic Video Framebuffer
+hvkbd*		at vmbus?		# Hyper-V Synthetic Keyboard
+wskbd*		at hvkbd? console ? mux 1
 hvn*		at vmbus?		# Hyper-V NetVSC
 hvs*		at vmbus?		# Hyper-V StorVSC
 hvheartbeat*	at vmbus?		# Hyper-V Heartbeat Service

Index: src/sys/arch/x86/include/autoconf.h
diff -u src/sys/arch/x86/include/autoconf.h:1.5 src/sys/arch/x86/include/autoconf.h:1.6
--- src/sys/arch/x86/include/autoconf.h:1.5	Sat Dec 22 07:45:58 2018
+++ src/sys/arch/x86/include/autoconf.h	Fri May 24 14:28:48 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.h,v 1.5 2018/12/22 07:45:58 cherry Exp $ */
+/* $NetBSD: autoconf.h,v 1.6 2019/05/24 14:28:48 nonaka Exp $ */
 #ifndef _X86_AUTOCONF_H_
 #define _X86_AUTOCONF_H_
 
@@ -20,6 +20,8 @@ struct mainbus_softc {
 #endif
 };
 
+extern int x86_found_console;
+
 void device_pci_props_register(device_t, void *);
 device_t device_pci_register(device_t, void *);
 device_t device_isa_register(device_t, void *);

Index: src/sys/arch/x86/pci/pci_machdep.c
diff -u src/sys/arch/x86/pci/pci_machdep.c:1.85 src/sys/arch/x86/pci/pci_machdep.c:1.86
--- src/sys/arch/x86/pci/pci_machdep.c:1.85	Fri May 17 18:34:33 2019

Re: CVS commit: src

2016-05-01 Thread NONAKA Kimihiro
2016-05-02 5:46 GMT+09:00 David Holland <dholland-sourcechan...@netbsd.org>:

> Am I right though in thinking that this driver is not yet MPSAFE?

I think so. I still have not tested properly.

Regards,
-- 
NONAKA Kimihiro


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

2015-11-06 Thread NONAKA Kimihiro
2015-11-07 7:11 GMT+09:00 matthew green <m...@eterna.com.au>:

> "NONAKA Kimihiro" writes:
>> Module Name:  src
>> Committed By: nonaka
>> Date: Fri Nov  6 14:22:17 UTC 2015
>>
>> Modified Files:
>>   src/sys/dev/pci: if_iwm.c if_iwmvar.h if_rtwn.c if_rtwnreg.h rtsx_pci.c
>>
>> Log Message:
>> Always use pci_intr_alloc(9)/pci_intr_release(9).
>
> doesn't this break platforms without __HAVE_PCI_MSI_MSIX?

knakahara@ provided pci_intr_alloc(9)/pci_intr_release(9) stub.

http://mail-index.netbsd.org/source-changes/2015/10/22/msg069597.html

Regards,
-- 
NONAKA Kimihiro


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

2015-02-23 Thread NONAKA Kimihiro
I have not seen it.
At the moment, I don't think the problem happen.

2015-02-23 22:21 GMT+09:00 Christos Zoulas chris...@astron.com:
 In article 20150223130937.ddec...@cvs.netbsd.org,
 NONAKA Kimihiro source-changes-d@NetBSD.org wrote:
-=-=-=-=-=-

Module Name:   src
Committed By:  nonaka
Date:  Mon Feb 23 13:09:37 UTC 2015

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

Log Message:
CID 1271021: Overrunning array in-in_ridx of 15 bytes at byte offset
15 using index i (which evaluates to 15).

http://mail-index.netbsd.org/coverity-updates/2015/02/21/msg000115.html

 Did you look at the full coverity report? I don't understand how this
 can happen?

 christos



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

2015-02-23 Thread NONAKA Kimihiro
2015-02-24 0:25 GMT+09:00 Christos Zoulas chris...@zoulas.com:

 Please revert the fix then, or check the coverity website for the
 explanation why it thinks that the index can be 15. It does not
 seem possible from my cursory examination and we don't sandbag the
 code against impossible errors. It is probably a coverity false
 positive.

I've revert this change.
I don't know how to look the full coverity report. Would you mind to teach me?

Regards,
-- 
NONAKA Kimihiro


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

2014-11-10 Thread NONAKA Kimihiro
Thanks.

Module Name:src
 Committed By:   riz
 Date:   Sun Nov  9 18:40:19 UTC 2014

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

 Log Message:
 Commit forgotten regenerated file.


 To generate a diff of this commit:
 cvs rdiff -u -r1.124 -r1.125 src/sys/dev/mii/miidevs.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/sys

2014-09-14 Thread NONAKA Kimihiro
Hi,

2014-09-15 3:07 GMT+09:00 Christos Zoulas chris...@astron.com:

 Perhaps it is better to memcpy the data to some aligned struct rather
 than referencing it directly and making it packed (which is not portable).

I wrote the following patch. ok?

Index: ./sys/sys/bootblock.h
===
RCS file: /cvsroot/src/sys/sys/bootblock.h,v
retrieving revision 1.57
diff -u -r1.57 bootblock.h
--- ./sys/sys/bootblock.h14 Sep 2014 17:39:06 -1.57
+++ ./sys/sys/bootblock.h15 Sep 2014 02:50:00 -
@@ -815,7 +815,7 @@
 uint32_tdescBlock;/* first block of driver */
 uint16_tdescSize;/* driver size in blocks */
 uint16_tdescType;/* system type */
-} __packed;
+};

 /*
  *system types; Apple reserves 0-15
@@ -834,6 +834,10 @@
 uint32_tsbData;/* (used internally by ROM) */
 uint16_tsbDrvrCount;/* number of driver descriptors */
 struct apple_drvr_descriptor sb_dd[APPLE_DRVR_MAP_MAX_DESCRIPTORS];
+/* XXX: Don't access directly.
+ * Data abort occurs by an access to
+ * unaligned address on arm.
+ */
 uint16_tpad[3];
 } __packed;

Index: ./sys/dev/dkwedge/dkwedge_apple.c
===
RCS file: /cvsroot/src/sys/dev/dkwedge/dkwedge_apple.c,v
retrieving revision 1.1
diff -u -r1.1 dkwedge_apple.c
--- ./sys/dev/dkwedge/dkwedge_apple.c7 Apr 2012 05:36:10 -1.1
+++ ./sys/dev/dkwedge/dkwedge_apple.c15 Sep 2014 02:50:00 -
@@ -82,8 +82,12 @@
 if (ap-sbDrvrCount = APPLE_DRVR_MAP_MAX_DESCRIPTORS)
 ap-sbDrvrCount = APPLE_DRVR_MAP_MAX_DESCRIPTORS;

-for (i = 0; i  ap-sbDrvrCount; i++)
-swap_apple_drvr_descriptor(ap-sb_dd[i]);
+for (i = 0; i  ap-sbDrvrCount; i++) {
+struct apple_drvr_descriptor sdd;
+memcpy(sdd, ap-sb_dd[i], sizeof(ap-sb_dd[0]));
+swap_apple_drvr_descriptor(sdd);
+memcpy(ap-sb_dd[i], sdd, sizeof(ap-sb_dd[0]));
+}
 }

 static void
Index: ./sbin/apmlabel/apmlabel.c
===
RCS file: /cvsroot/src/sbin/apmlabel/apmlabel.c,v
retrieving revision 1.3
diff -u -r1.3 apmlabel.c
--- ./sbin/apmlabel/apmlabel.c19 Oct 2013 01:09:58 -1.3
+++ ./sbin/apmlabel/apmlabel.c15 Sep 2014 02:50:00 -
@@ -249,9 +249,12 @@
 BE32TOH(drvr-sbData);
 BE16TOH(drvr-sbDrvrCount);
 for (i=0; iAPPLE_DRVR_MAP_MAX_DESCRIPTORS; i++) {
-BE32TOH(drvr-sb_dd[i].descBlock);
-BE16TOH(drvr-sb_dd[i].descSize);
-BE16TOH(drvr-sb_dd[i].descType);
+struct apple_drvr_descriptor sdd;
+memcpy(sdd, drvr-sb_dd[i], sizeof(drvr-sb_dd[0]));
+BE32TOH(sdd.descBlock);
+BE16TOH(sdd.descSize);
+BE16TOH(sdd.descType);
+memcpy(drvr-sb_dd[i], sdd, sizeof(drvr-sb_dd[0]));
 }

 return drvr;


Regards,
-- 
NONAKA Kimihiro


Re: CVS commit: src/sys/external/bsd/drm2/dist/drm/i915

2014-05-21 Thread NONAKA Kimihiro
Hi,

2014-05-21 23:03 GMT+09:00 Taylor R Campbell riastr...@netbsd.org:

 Module Name:src
 Committed By:   riastradh
 Date:   Wed May 21 14:03:42 UTC 2014

 Modified Files:
 src/sys/external/bsd/drm2/dist/drm/i915: intel_display.c

 Log Message:
 Unifdef the dmi hacks here, now that we have dmi_check_system.

intel_crt.c and intel_lvds.c too.

Regards,
-- 
NONAKA Kimihiro


Re: CVS commit: src/sys/external/bsd/drm2/i915drm

2014-04-07 Thread NONAKA Kimihiro
Hi,

2014-04-07 21:52 GMT+09:00 Taylor R Campbell riastr...@netbsd.org:

PR/48705 is useful for you?

 Thanks, I will take a look.

Please also check PR/48706 and PR/48708.

Regards,
-- 
NONAKA Kimihiro


Re: CVS commit: src/sys/external/bsd/drm2/i915drm

2014-04-06 Thread NONAKA Kimihiro
Hi,

PR/48705 is useful for you?

2014-04-07 1:42 GMT+09:00 Taylor R Campbell riastr...@netbsd.org:

 Module Name:src
 Committed By:   riastradh
 Date:   Sun Apr  6 16:42:00 UTC 2014

 Modified Files:
 src/sys/external/bsd/drm2/i915drm: i915_pci.c

 Log Message:
 Restore is_console=1 for i915, even if I keep it off for debugging.


 To generate a diff of this commit:
 cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/i915drm/i915_pci.c

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


-- 
NONAKA Kimihiro


Re: CVS commit: src/external/bsd/dhcp/dist/common

2014-03-06 Thread NONAKA Kimihiro
Hi,

2014-03-07 10:04 GMT+09:00 Christos Zoulas chris...@netbsd.org:

 Module Name:src
 Committed By:   christos
 Date:   Fri Mar  7 01:04:30 UTC 2014

 Modified Files:
 src/external/bsd/dhcp/dist/common: ns_name.c

 Log Message:
 fix incorrect overflow test: 
 https://android-review.googlesource.com/#/c/50570/

compile failed.

-
/usr/src/external/bsd/dhcp/lib/common/../../dist/common/ns_name.c: In function '
MRns_name_unpack':
/usr/src/external/bsd/dhcp/lib/common/../../dist/common/ns_name.c:348:27: error:
 expected expression before '/' token
if (n = eom - msg) {  / Out of range. */
   ^
*** [ns_name.o] Error code 1
-

Regards,
-- 
NONAKA Kimihiro


Re: CVS commit: src

2013-07-10 Thread NONAKA Kimihiro
Hi,

Please fix usr.sbin/postinstall/postinstall for _rtadvd user and group.

2013/7/9 Roy Marples r...@netbsd.org:
 Module Name:src
 Committed By:   roy
 Date:   Tue Jul  9 09:34:59 UTC 2013

 Modified Files:
 src/etc: group master.passwd
 src/etc/mtree: special
 src/etc/rc.d: rtadvd
 src/usr.sbin/rtadvd: dump.c rtadvd.c rtadvd.h

 Log Message:
 Add _rtadvd user and group.
 Add a chroot dir for the _rtadvd user.
 Drop privs to the user _rtadvd after acquiring our socket.
 When rc.d/rtadvd starts or reloads, the rtadvd config file is copied
 into the chroot before starting or reloading rtadvd itself.
 Create a symlink from /var/run/rtadvd.dump to the chroot

 Inital idea from OpenBSD patch rtadvd.c r1.36


 To generate a diff of this commit:
 cvs rdiff -u -r1.31 -r1.32 src/etc/group
 cvs rdiff -u -r1.46 -r1.47 src/etc/master.passwd
 cvs rdiff -u -r1.145 -r1.146 src/etc/mtree/special
 cvs rdiff -u -r1.7 -r1.8 src/etc/rc.d/rtadvd
 cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/rtadvd/dump.c
 cvs rdiff -u -r1.43 -r1.44 src/usr.sbin/rtadvd/rtadvd.c
 cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/rtadvd/rtadvd.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/net80211

2013-03-29 Thread NONAKA Kimihiro
Hi,

2013/3/30 Christos Zoulas chris...@netbsd.org:

 Module Name:src
 Committed By:   christos
 Date:   Sat Mar 30 01:05:49 UTC 2013

 Modified Files:
 src/sys/net80211: ieee80211.h ieee80211_proto.h

 Log Message:
 EDCA and QOS additions from OpenBSD

You have to add the following lines. It seems same as WME_AC_ *.

-
 /*
+ * EDCA Access Categories.
+ */
+enum ieee80211_edca_ac {
+ EDCA_AC_BK  = 1, /* Background */
+ EDCA_AC_BE  = 0, /* Best Effort */
+ EDCA_AC_VI  = 2, /* Video */
+ EDCA_AC_VO  = 3 /* Voice */
+};
+#define EDCA_NUM_AC 4
+
-

WME_AC_ *
- sys/net80211/ieee80211.h
#define WME_AC_BE 0 /* best effort */
#define WME_AC_BK 1 /* background */
#define WME_AC_VI 2 /* video */
#define WME_AC_VO 3 /* voice */
-

Regards,
--
NONAKA Kimihiro


Re: CVS commit: src/lib/libc/stdio

2012-02-17 Thread NONAKA Kimihiro
Hi,

2012/2/18 Christos Zoulas chris...@netbsd.org:

 Module Name:    src
 Committed By:   christos
 Date:           Fri Feb 17 19:57:53 UTC 2012

 Modified Files:
        src/lib/libc/stdio: vfwprintf.c

 Log Message:
 Fix: CVE-2012-0864 fprintf() positional argument abuse.
 Described in: http://www.phrack.org/issues.html?issue=67id=9#article
 Reported by Stefan Cornelius / Red Hat Security Response Team

 - convert internal positional arguments bookkeeping from int to size_t
 - provide overflow protection in positional argument spec
 - convert loops to memset
 - fix memory leaks
 - limit positional argument stack offset to the number of arguments required
  by the printf to avoid coredump from va_arg() exhaustion.

#   compile  libc/vfprintf.ln
CC=/usr/local/netbsd-tools/i386/bin/i686--netbsdelf-gcc
/usr/local/netbsd-tools/i386/bin/i686--netbsdelf-lint -chapbxzFS -w -X
272 -d /home/snapshot/20120217/root/i386/usr/include  -D_LIBC
-DLIBC_SCCS -DSYSLIBC_SCCS -D_REENTRANT -DHESIOD -DINET6 -DNLS -DYP
-I/usr/src/lib/libc/include -I/usr/src/lib/libc -I/usr/src/sys
-I/usr/src/lib/libc/compat/../locale -I/usr/src/lib/libc/compat/stdlib
-I/usr/src/lib/libc/compat/../stdlib
-I/usr/src/lib/libc/../../common/lib/libc/quad
-I/usr/src/lib/libc/../../common/lib/libc/string
-I/usr/src/lib/libc/../../common/lib/libc/arch/i386/string
-D__DBINTERFACE_PRIVATE -I/usr/src/libexec/ld.elf_so
-I/usr/src/lib/libc/dlfcn -I/usr/src/lib/libc/gdtoa -DNO_FENV_H
-I/usr/src/lib/libc/arch/i386/gdtoa -DWITH_RUNE -I/usr/src/lib/libc
-DPOSIX_MISTAKE -DCOMPAT__RES -DUSE_POLL -DPORTMAP -DWIDE_DOUBLE
-DALL_STATE -DUSG_COMPAT -D_FORTIFY_SOURCE=2-i
/usr/src/lib/libc/stdio/vfprintf.c
/usr/src/lib/libc/stdio/vfwprintf.c(1934): warning: n unused in
function __grow_type_table [192]

*** Failed target:  vfprintf.ln
*** Failed command:
CC=/usr/local/netbsd-tools/i386/bin/i686--netbsdelf-gcc
/usr/local/netbsd-tools/i386/bin/i686--netbsdelf-lint -chapbxzFS -w -X
272 -d /home/snapshot/20120217/root/i386/usr/include -D_LIBC
-DLIBC_SCCS -DSYSLIBC_SCCS -D_REENTRANT -DHESIOD -DINET6 -DNLS -DYP
-I/usr/src/lib/libc/include -I/usr/src/lib/libc -I/usr/src/sys
-I/usr/src/lib/libc/compat/../locale -I/usr/src/lib/libc/compat/stdlib
-I/usr/src/lib/libc/compat/../stdlib
-I/usr/src/lib/libc/../../common/lib/libc/quad
-I/usr/src/lib/libc/../../common/lib/libc/string
-I/usr/src/lib/libc/../../common/lib/libc/arch/i386/string
-D__DBINTERFACE_PRIVATE -I/usr/src/libexec/ld.elf_so
-I/usr/src/lib/libc/dlfcn -I/usr/src/lib/libc/gdtoa -DNO_FENV_H
-I/usr/src/lib/libc/arch/i386/gdtoa -DWITH_RUNE -I/usr/src/lib/libc
-DPOSIX_MISTAKE -DCOMPAT__RES -DUSE_POLL -DPORTMAP -DWIDE_DOUBLE
-DALL_STATE -DUSG_COMPAT -D_FORTIFY_SOURCE=2 -i
/usr/src/lib/libc/stdio/vfprintf.c
*** Error code 1

Stop.
nbmake: stopped in /usr/src/lib/libc


Regards,
-- 
NONAKA Kimihiro


Re: CVS commit: src/sys/dev

2012-02-02 Thread NONAKA Kimihiro
eHi,

2012/2/3 Matt Thomas m...@3am-software.com:

 I have some changed to get sdhc working with the FreeScale ESDHC.
 But they are somewhat invasive and are not quite working right.

 Do you have to have a machine with one?

Sorry, I do not have a ESDHC device.

 the diffs for sdhc.c are in www.netbsd.org/sdhc.txt

URL of diff file is not correct. ;-)

 Are you planning on supporting ADMA?

I have a plan to support ADMA.
However, I do not have a device that supports ADMA.

# Do you support ExpressCard anyone?

Regards,
-- 
NONAKA Kimihiro


Re: CVS commit: src/sys/kern

2011-12-05 Thread NONAKA Kimihiro
Hi,

2011/12/5 Christos Zoulas chris...@zoulas.com:

 | and good catch, I checked to see if the file had changed before
 | posting in current-users, and looked straight through it. :-/

 Thanks for fixing it. Now, I am more interested why the printf fired,
 and under what conditions I can get it to fire again.

nonaka@koharu:[-]$ mount
/dev/wd0a on / type ffs (log, NFS exported, local)
tmpfs on /tmp type tmpfs (local)
kernfs on /kern type kernfs (local)
procfs on /proc type procfs (local)
ptyfs on /dev/pts type ptyfs (local)
tmpfs on /usr/pkg/emul/linux/dev/shm type tmpfs (local)
/home/source/NetBSD/src on /usr/src type null (local)
/home/source/NetBSD/pkgsrc on /usr/pkgsrc type null (local)
/home/source/NetBSD/xsrc on /usr/xsrc type null (local)

# fired (e.g. mail/fetchmail)
nonaka@koharu:[-]$ cd /usr/pkgsrc/mail/fetchmail
nonaka@koharu:[-]$ make

# not fired
nonaka@koharu:[-]$ cd /home/source/NetBSD/pkgsrc/mail/fetchmail
nonaka@koharu:[-]$ make

-- 
NONAKA Kimihiro