CVS commit: src/sys/dev/pci

2022-05-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue May 24 02:22:47 UTC 2022

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

Log Message:
Reduce diff among vmxnet3_{legacy_intr,txrxq_intr,handle_que}(). NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/if_vmx.c

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

Modified files:

Index: src/sys/dev/pci/if_vmx.c
diff -u src/sys/dev/pci/if_vmx.c:1.7 src/sys/dev/pci/if_vmx.c:1.8
--- src/sys/dev/pci/if_vmx.c:1.7	Wed Mar 30 02:45:14 2022
+++ src/sys/dev/pci/if_vmx.c	Tue May 24 02:22:47 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vmx.c,v 1.7 2022/03/30 02:45:14 knakahara Exp $	*/
+/*	$NetBSD: if_vmx.c,v 1.8 2022/05/24 02:22:47 msaitoh Exp $	*/
 /*	$OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $	*/
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.7 2022/03/30 02:45:14 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.8 2022/05/24 02:22:47 msaitoh Exp $");
 
 #include 
 #include 
@@ -2499,14 +2499,16 @@ static int
 vmxnet3_legacy_intr(void *xsc)
 {
 	struct vmxnet3_softc *sc;
-	struct vmxnet3_rxqueue *rxq;
+	struct vmxnet3_queue *vmxq;
 	struct vmxnet3_txqueue *txq;
+	struct vmxnet3_rxqueue *rxq;
 	u_int txlimit, rxlimit;
 	bool txmore, rxmore;
 
 	sc = xsc;
-	rxq = >vmx_queue[0].vxq_rxqueue;
-	txq = >vmx_queue[0].vxq_txqueue;
+	vmxq = >vmx_queue[0];
+	txq = >vxq_txqueue;
+	rxq = >vxq_rxqueue;
 	txlimit = sc->vmx_tx_intr_process_limit;
 	rxlimit = sc->vmx_rx_intr_process_limit;
 
@@ -2528,12 +2530,13 @@ vmxnet3_legacy_intr(void *xsc)
 	txmore = vmxnet3_txq_eof(txq, txlimit);
 	VMXNET3_TXQ_UNLOCK(txq);
 
-	if (txmore || rxmore) {
-		vmxnet3_sched_handle_queue(sc, >vmx_queue[0]);
-	} else {
+	if (txmore || rxmore)
+		vmxnet3_sched_handle_queue(sc, vmxq);
+	else {
 		if_schedule_deferred_start(>vmx_ethercom.ec_if);
 		vmxnet3_enable_all_intrs(sc);
 	}
+
 	return (1);
 }
 
@@ -2568,9 +2571,9 @@ vmxnet3_txrxq_intr(void *xvmxq)
 	rxmore = vmxnet3_rxq_eof(rxq, rxlimit);
 	VMXNET3_RXQ_UNLOCK(rxq);
 
-	if (txmore || rxmore) {
+	if (txmore || rxmore)
 		vmxnet3_sched_handle_queue(sc, vmxq);
-	} else {
+	else {
 		/* for ALTQ */
 		if (vmxq->vxq_id == 0)
 			if_schedule_deferred_start(>vmx_ethercom.ec_if);



CVS commit: src/sys/dev/pci

2022-05-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue May 24 02:22:47 UTC 2022

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

Log Message:
Reduce diff among vmxnet3_{legacy_intr,txrxq_intr,handle_que}(). NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/if_vmx.c

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



CVS commit: src/sys/dev/pci

2022-05-18 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 19 02:23:59 UTC 2022

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

Log Message:
Don't set the more flag when there is no packet to process.

 Move the location of the loop limit check next to the DD bit test. This
change prevent from scheduling the next txrx_work that does nothing.


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

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.732 src/sys/dev/pci/if_wm.c:1.733
--- src/sys/dev/pci/if_wm.c:1.732	Thu May 19 02:22:59 2022
+++ src/sys/dev/pci/if_wm.c	Thu May 19 02:23:59 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.732 2022/05/19 02:22:59 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.733 2022/05/19 02:23:59 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.732 2022/05/19 02:22:59 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.733 2022/05/19 02:23:59 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -8968,14 +8968,6 @@ wm_txeof(struct wm_txqueue *txq, u_int l
 	 */
 	for (i = txq->txq_sdirty; txq->txq_sfree != WM_TXQUEUELEN(txq);
 	 i = WM_NEXTTXS(txq, i), txq->txq_sfree++) {
-		if (limit-- == 0) {
-			more = true;
-			DPRINTF(sc, WM_DEBUG_TX,
-			("%s: TX: loop limited, job %d is not processed\n",
-device_xname(sc->sc_dev), i));
-			break;
-		}
-
 		txs = >txq_soft[i];
 
 		DPRINTF(sc, WM_DEBUG_TX, ("%s: TX: checking job %d\n",
@@ -8992,6 +8984,14 @@ wm_txeof(struct wm_txqueue *txq, u_int l
 			break;
 		}
 
+		if (limit-- == 0) {
+			more = true;
+			DPRINTF(sc, WM_DEBUG_TX,
+			("%s: TX: loop limited, job %d is not processed\n",
+device_xname(sc->sc_dev), i));
+			break;
+		}
+
 		count++;
 		DPRINTF(sc, WM_DEBUG_TX,
 		("%s: TX: job %d done: descs %d..%d\n",
@@ -9297,14 +9297,6 @@ wm_rxeof(struct wm_rxqueue *rxq, u_int l
 	KASSERT(mutex_owned(rxq->rxq_lock));
 
 	for (i = rxq->rxq_ptr;; i = WM_NEXTRX(i)) {
-		if (limit-- == 0) {
-			more = true;
-			DPRINTF(sc, WM_DEBUG_RX,
-			("%s: RX: loop limited, descriptor %d is not processed\n",
-device_xname(sc->sc_dev), i));
-			break;
-		}
-
 		rxs = >rxq_soft[i];
 
 		DPRINTF(sc, WM_DEBUG_RX,
@@ -9326,6 +9318,14 @@ wm_rxeof(struct wm_rxqueue *rxq, u_int l
 			break;
 		}
 
+		if (limit-- == 0) {
+			more = true;
+			DPRINTF(sc, WM_DEBUG_RX,
+			("%s: RX: loop limited, descriptor %d is not processed\n",
+device_xname(sc->sc_dev), i));
+			break;
+		}
+
 		count++;
 		if (__predict_false(rxq->rxq_discard)) {
 			DPRINTF(sc, WM_DEBUG_RX,



CVS commit: src/sys/dev/pci

2022-05-18 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 19 02:23:59 UTC 2022

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

Log Message:
Don't set the more flag when there is no packet to process.

 Move the location of the loop limit check next to the DD bit test. This
change prevent from scheduling the next txrx_work that does nothing.


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

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



CVS commit: src/sys/dev/pci

2022-05-18 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 19 02:22:59 UTC 2022

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

Log Message:
Call wm_xxeof() only when limit > 0.

 It's not required to call wm_xxeof() when limit == 0. It means that
all xxeof processing will be done by softint or workqueue. Currently,
wm_xxeof() returns quickly before checking the descriptor head when
limit == 0 and return with ture to set the more flag.


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

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



CVS commit: src/sys/dev/pci

2022-05-18 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 19 02:22:59 UTC 2022

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

Log Message:
Call wm_xxeof() only when limit > 0.

 It's not required to call wm_xxeof() when limit == 0. It means that
all xxeof processing will be done by softint or workqueue. Currently,
wm_xxeof() returns quickly before checking the descriptor head when
limit == 0 and return with ture to set the more flag.


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

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.731 src/sys/dev/pci/if_wm.c:1.732
--- src/sys/dev/pci/if_wm.c:1.731	Tue May 17 00:02:57 2022
+++ src/sys/dev/pci/if_wm.c	Thu May 19 02:22:59 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.731 2022/05/17 00:02:57 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.732 2022/05/19 02:22:59 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.731 2022/05/17 00:02:57 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.732 2022/05/19 02:22:59 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -9958,14 +9958,18 @@ wm_intr_legacy(void *arg)
 		WM_Q_EVCNT_INCR(rxq, intr);
 	}
 #endif
-	/*
-	 * wm_rxeof() does *not* call upper layer functions directly,
-	 * as if_percpuq_enqueue() just call softint_schedule().
-	 * So, we can call wm_rxeof() in interrupt context.
-	 */
-	more = wm_rxeof(rxq, rxlimit);
+	if (rxlimit > 0) {
+		/*
+		 * wm_rxeof() does *not* call upper layer functions directly,
+		 * as if_percpuq_enqueue() just call softint_schedule().
+		 * So, we can call wm_rxeof() in interrupt context.
+		 */
+		more = wm_rxeof(rxq, rxlimit);
+	} else
+		more = true;
 
 	mutex_exit(rxq->rxq_lock);
+
 	mutex_enter(txq->txq_lock);
 
 	if (txq->txq_stopping) {
@@ -9981,10 +9985,12 @@ wm_intr_legacy(void *arg)
 		WM_Q_EVCNT_INCR(txq, txdw);
 	}
 #endif
-	more |= wm_txeof(txq, txlimit);
-	if (!IF_IS_EMPTY(>if_snd))
+	if (txlimit > 0) {
+		more |= wm_txeof(txq, txlimit);
+		if (!IF_IS_EMPTY(>if_snd))
+			more = true;
+	} else
 		more = true;
-
 	mutex_exit(txq->txq_lock);
 	WM_CORE_LOCK(sc);
 
@@ -10096,8 +10102,11 @@ wm_txrxintr_msix(void *arg)
 	}
 
 	WM_Q_EVCNT_INCR(txq, txdw);
-	txmore = wm_txeof(txq, txlimit);
-	/* wm_deferred start() is done in wm_handle_queue(). */
+	if (txlimit > 0) {
+		txmore = wm_txeof(txq, txlimit);
+		/* wm_deferred start() is done in wm_handle_queue(). */
+	} else
+		txmore = true;
 	mutex_exit(txq->txq_lock);
 
 	DPRINTF(sc, WM_DEBUG_RX,
@@ -10110,7 +10119,10 @@ wm_txrxintr_msix(void *arg)
 	}
 
 	WM_Q_EVCNT_INCR(rxq, intr);
-	rxmore = wm_rxeof(rxq, rxlimit);
+	if (rxlimit > 0) {
+		rxmore = wm_rxeof(rxq, rxlimit);
+	} else
+		rxmore = true;
 	mutex_exit(rxq->rxq_lock);
 
 	wm_itrs_writereg(sc, wmq);



CVS commit: src/sys/dev/pci

2022-05-16 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue May 17 00:02:57 UTC 2022

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

Log Message:
Call m_freem(m) only if m0 == NULL.


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

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



CVS commit: src/sys/dev/pci

2022-05-16 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue May 17 00:02:57 UTC 2022

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

Log Message:
Call m_freem(m) only if m0 == NULL.


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

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.730 src/sys/dev/pci/if_wm.c:1.731
--- src/sys/dev/pci/if_wm.c:1.730	Tue May  3 00:23:33 2022
+++ src/sys/dev/pci/if_wm.c	Tue May 17 00:02:57 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.730 2022/05/03 00:23:33 gutteridge Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.731 2022/05/17 00:02:57 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.730 2022/05/03 00:23:33 gutteridge Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.731 2022/05/17 00:02:57 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -8016,9 +8016,10 @@ wm_send_common_locked(struct ifnet *ifp,
 			 * increment successed packet counter as in the case
 			 * which the packet is discarded by link down PHY.
 			 */
-			if (m0 != NULL)
+			if (m0 != NULL) {
 if_statinc(ifp, if_opackets);
-			m_freem(m0);
+m_freem(m0);
+			}
 		} while (m0 != NULL);
 		return;
 	}
@@ -8633,9 +8634,10 @@ wm_nq_send_common_locked(struct ifnet *i
 			 * increment successed packet counter as in the case
 			 * which the packet is discarded by link down PHY.
 			 */
-			if (m0 != NULL)
+			if (m0 != NULL) {
 if_statinc(ifp, if_opackets);
-			m_freem(m0);
+m_freem(m0);
+			}
 		} while (m0 != NULL);
 		return;
 	}



CVS commit: src/sys/arch

2022-05-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 13 10:45:24 UTC 2022

Modified Files:
src/sys/arch/amd64/conf: ALL
src/sys/arch/i386/conf: ALL

Log Message:
Add MFI_DEBUG and MFII_DEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.170 -r1.171 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.500 -r1.501 src/sys/arch/i386/conf/ALL

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/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.170 src/sys/arch/amd64/conf/ALL:1.171
--- src/sys/arch/amd64/conf/ALL:1.170	Sat May  7 04:32:29 2022
+++ src/sys/arch/amd64/conf/ALL	Fri May 13 10:45:24 2022
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.170 2022/05/07 04:32:29 rin Exp $
+# $NetBSD: ALL,v 1.171 2022/05/13 10:45:24 msaitoh Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.170 $"
+#ident		"ALL-$Revision: 1.171 $"
 
 maxusers	64		# estimated number of users
 
@@ -2026,6 +2026,8 @@ options MEC_DEBUG
 options MEDIABAY_DEBUG
 options MEMORY_MAP_DEBUG
 options MESH_DEBUG
+options MFI_DEBUG
+options MFII_DEBUG
 options MIDI_DEBUG
 options MLYDEBUG
 options MMEYEPCMCIADEBUG

Index: src/sys/arch/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.500 src/sys/arch/i386/conf/ALL:1.501
--- src/sys/arch/i386/conf/ALL:1.500	Thu Dec 23 17:13:13 2021
+++ src/sys/arch/i386/conf/ALL	Fri May 13 10:45:24 2022
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.500 2021/12/23 17:13:13 hannken Exp $
+# $NetBSD: ALL,v 1.501 2022/05/13 10:45:24 msaitoh Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.500 $"
+#ident		"ALL-$Revision: 1.501 $"
 
 maxusers	64		# estimated number of users
 
@@ -2133,6 +2133,8 @@ options MEC_DEBUG
 options MEDIABAY_DEBUG
 options MEMORY_MAP_DEBUG
 options MESH_DEBUG
+options MFI_DEBUG
+options MFII_DEBUG
 options MIDI_DEBUG
 options MLYDEBUG
 options MMEYEPCMCIADEBUG



CVS commit: src/sys/arch

2022-05-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 13 10:45:24 UTC 2022

Modified Files:
src/sys/arch/amd64/conf: ALL
src/sys/arch/i386/conf: ALL

Log Message:
Add MFI_DEBUG and MFII_DEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.170 -r1.171 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.500 -r1.501 src/sys/arch/i386/conf/ALL

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



CVS commit: src/sys/dev/pci

2022-05-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 13 10:44:39 UTC 2022

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

Log Message:
Fix compile error when MFII_DEBUG is set. Whitespace fix.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/pci/mfii.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/mfii.c
diff -u src/sys/dev/pci/mfii.c:1.14 src/sys/dev/pci/mfii.c:1.15
--- src/sys/dev/pci/mfii.c:1.14	Thu May 12 12:04:09 2022
+++ src/sys/dev/pci/mfii.c	Fri May 13 10:44:38 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: mfii.c,v 1.14 2022/05/12 12:04:09 msaitoh Exp $ */
+/* $NetBSD: mfii.c,v 1.15 2022/05/13 10:44:38 msaitoh Exp $ */
 /* $OpenBSD: mfii.c,v 1.58 2018/08/14 05:22:21 jmatthew Exp $ */
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.14 2022/05/12 12:04:09 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.15 2022/05/13 10:44:38 msaitoh Exp $");
 
 #include "bio.h"
 
@@ -339,8 +339,8 @@ struct mfii_softc {
 	int			sc_target_lds[MFI_MAX_LD];
 
 	/* bio */
-	struct mfi_conf	 *sc_cfg;
-	struct mfi_ctrl_infosc_info;
+	struct mfi_conf		*sc_cfg;
+	struct mfi_ctrl_info	sc_info;
 	struct mfi_ld_list	sc_ld_list;
 	struct mfi_ld_details	*sc_ld_details; /* array to all logical disks */
 	int			sc_no_pd; /* used physical disks */
@@ -1033,7 +1033,7 @@ mfii_shutdown(device_t dev, int how)
 	memset(, 0, sizeof(mbox));
 
 	mutex_enter(>sc_lock);
-	DNPRINTF(MFI_D_MISC, "%s: mfii_shutdown\n", DEVNAME(sc));
+	DNPRINTF(MFII_D_MISC, "%s: mfii_shutdown\n", DEVNAME(sc));
 	ccb = mfii_get_ccb(sc);
 	if (ccb == NULL)
 		return false;



CVS commit: src/sys/dev/pci

2022-05-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 13 10:44:39 UTC 2022

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

Log Message:
Fix compile error when MFII_DEBUG is set. Whitespace fix.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/pci/mfii.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

2022-05-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 13 10:41:42 UTC 2022

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

Log Message:
Improve DNPRINTF. No functional change.


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

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

Modified files:

Index: src/sys/dev/ic/mfi.c
diff -u src/sys/dev/ic/mfi.c:1.76 src/sys/dev/ic/mfi.c:1.77
--- src/sys/dev/ic/mfi.c:1.76	Thu May 12 11:56:29 2022
+++ src/sys/dev/ic/mfi.c	Fri May 13 10:41:42 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: mfi.c,v 1.76 2022/05/12 11:56:29 msaitoh Exp $ */
+/* $NetBSD: mfi.c,v 1.77 2022/05/13 10:41:42 msaitoh Exp $ */
 /* $OpenBSD: mfi.c,v 1.66 2006/11/28 23:59:45 dlg Exp $ */
 
 /*
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.76 2022/05/12 11:56:29 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.77 2022/05/13 10:41:42 msaitoh Exp $");
 
 #include "bio.h"
 
@@ -441,11 +441,11 @@ mfi_init_ccb(struct mfi_softc *sc)
 		}
 
 		DNPRINTF(MFI_D_CCB,
-		"ccb(%d): %p frame: %#lx (%#lx) sense: %#lx (%#lx) map: %#lx\n",
+		"ccb(%d): %p frame: %p (%#lx) sense: %p (%#lx) map: %p\n",
 		ccb->ccb_frame->mfr_header.mfh_context, ccb,
-		(u_long)ccb->ccb_frame, (u_long)ccb->ccb_pframe,
-		(u_long)ccb->ccb_sense, (u_long)ccb->ccb_psense,
-		(u_long)ccb->ccb_dmamap);
+		ccb->ccb_frame, (u_long)ccb->ccb_pframe,
+		ccb->ccb_sense, (u_long)ccb->ccb_psense,
+		ccb->ccb_dmamap);
 
 		/* add ccb to queue */
 		mfi_put_ccb(ccb);
@@ -474,14 +474,14 @@ mfi_read(struct mfi_softc *sc, bus_size_
 	BUS_SPACE_BARRIER_READ);
 	rv = bus_space_read_4(sc->sc_iot, sc->sc_ioh, r);
 
-	DNPRINTF(MFI_D_RW, "%s: mr 0x%lx 0x08%x ", DEVNAME(sc), (u_long)r, rv);
+	DNPRINTF(MFI_D_RW, "%s: mr %#zx 0x08%x ", DEVNAME(sc), r, rv);
 	return rv;
 }
 
 static void
 mfi_write(struct mfi_softc *sc, bus_size_t r, uint32_t v)
 {
-	DNPRINTF(MFI_D_RW, "%s: mw 0x%lx 0x%08x", DEVNAME(sc), (u_long)r, v);
+	DNPRINTF(MFI_D_RW, "%s: mw %#zx 0x%08x", DEVNAME(sc), r, v);
 
 	bus_space_write_4(sc->sc_iot, sc->sc_ioh, r, v);
 	bus_space_barrier(sc->sc_iot, sc->sc_ioh, r, 4,
@@ -494,8 +494,8 @@ mfi_allocmem(struct mfi_softc *sc, size_
 	struct mfi_mem		*mm;
 	int			nsegs;
 
-	DNPRINTF(MFI_D_MEM, "%s: mfi_allocmem: %ld\n", DEVNAME(sc),
-	(long)size);
+	DNPRINTF(MFI_D_MEM, "%s: mfi_allocmem: %zu\n", DEVNAME(sc),
+	size);
 
 	mm = malloc(sizeof(struct mfi_mem), M_DEVBUF, M_WAITOK|M_ZERO);
 	mm->am_size = size;
@@ -1373,8 +1373,7 @@ mfi_intr(void *arg)
 
 	pcq = MFIMEM_KVA(sc->sc_pcq);
 
-	DNPRINTF(MFI_D_INTR, "%s: mfi_intr %#lx %#lx\n", DEVNAME(sc),
-	(u_long)sc, (u_long)pcq);
+	DNPRINTF(MFI_D_INTR, "%s: mfi_intr %p %p\n", DEVNAME(sc), sc, pcq);
 
 	bus_dmamap_sync(sc->sc_dmat, MFIMEM_MAP(sc->sc_pcq), 0,
 	sizeof(uint32_t) * sc->sc_max_cmds + sizeof(struct mfi_prod_cons),
@@ -1478,8 +1477,8 @@ mfi_scsi_xs_done(struct mfi_ccb *ccb, in
 	struct scsipi_xfer	*xs = ccb->ccb_xs;
 	struct mfi_softc	*sc = ccb->ccb_sc;
 
-	DNPRINTF(MFI_D_INTR, "%s: mfi_scsi_xs_done %#lx %#lx\n",
-	DEVNAME(sc), (u_long)ccb, (u_long)ccb->ccb_frame);
+	DNPRINTF(MFI_D_INTR, "%s: mfi_scsi_xs_done %p %p\n",
+	DEVNAME(sc), ccb, ccb->ccb_frame);
 
 	if (xs->data != NULL) {
 		DNPRINTF(MFI_D_INTR, "%s: mfi_scsi_xs_done sync\n",
@@ -1502,9 +1501,9 @@ mfi_scsi_xs_done(struct mfi_ccb *ccb, in
 			ccb->ccb_psense - MFIMEM_DVA(sc->sc_sense),
 			MFI_SENSE_SIZE, BUS_DMASYNC_POSTREAD);
 			DNPRINTF(MFI_D_INTR,
-			"%s: mfi_scsi_xs_done sense %#x %lx %lx\n",
+			"%s: mfi_scsi_xs_done sense %#x %p %p\n",
 			DEVNAME(sc), scsi_status,
-			(u_long)>sense, (u_long)ccb->ccb_sense);
+			>sense, ccb->ccb_sense);
 			memset(>sense, 0, sizeof(xs->sense));
 			memcpy(>sense, ccb->ccb_sense,
 			sizeof(struct scsi_sense_data));
@@ -1761,8 +1760,8 @@ mfi_create_sgl(struct mfi_ccb *ccb, int 
 	union mfi_sgl		*sgl;
 	int			error, i;
 
-	DNPRINTF(MFI_D_DMA, "%s: mfi_create_sgl %#lx\n", DEVNAME(sc),
-	(u_long)ccb->ccb_data);
+	DNPRINTF(MFI_D_DMA, "%s: mfi_create_sgl %p\n", DEVNAME(sc),
+	ccb->ccb_data);
 
 	if (!ccb->ccb_data)
 		return 1;
@@ -3292,8 +3291,8 @@ mfi_tbolt_create_sgl(struct mfi_ccb *ccb
 		/* One element to store the chain info */
 		sge_idx = MEGASAS_THUNDERBOLT_MAX_SGE_IN_MAINMSG - 1;
 		DNPRINTF(MFI_D_DMA,
-		"mfi sge_idx %d sge_count %d io_req paddr 0x%" PRIx64 "\n",
-		sge_idx, sge_count, ccb->ccb_tb_pio_request);
+		"mfi sge_idx %d sge_count %d io_req paddr %jx\n",
+		sge_idx, sge_count, (uintmax_t)ccb->ccb_tb_pio_request);
 	} else {
 		sge_idx = sge_count;
 	}



CVS commit: src/sys/dev/ic

2022-05-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri May 13 10:41:42 UTC 2022

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

Log Message:
Improve DNPRINTF. No functional change.


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

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



CVS commit: src/sys/dev/ic

2022-05-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 12 12:05:04 UTC 2022

Modified Files:
src/sys/dev/ic: mfireg.h

Log Message:
I think MFI_BBU_STATE_LEARN_CYC_REQ is not an error.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/ic/mfireg.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/ic/mfireg.h
diff -u src/sys/dev/ic/mfireg.h:1.20 src/sys/dev/ic/mfireg.h:1.21
--- src/sys/dev/ic/mfireg.h:1.20	Thu May 12 12:00:58 2022
+++ src/sys/dev/ic/mfireg.h	Thu May 12 12:05:04 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: mfireg.h,v 1.20 2022/05/12 12:00:58 msaitoh Exp $ */
+/* $NetBSD: mfireg.h,v 1.21 2022/05/12 12:05:04 msaitoh Exp $ */
 /* $OpenBSD: mfireg.h,v 1.24 2006/06/19 19:05:45 marco Exp $ */
 /*
  * Copyright (c) 2006 Marco Peereboom 
@@ -1289,7 +1289,6 @@ struct mfi_bbu_status {
 MFI_BBU_STATE_PACK_MISSING |	\
 MFI_BBU_STATE_VOLTAGE_LOW |		\
 MFI_BBU_STATE_DISCHARGE_ACTIVE |	\
-MFI_BBU_STATE_LEARN_CYC_REQ |	\
 MFI_BBU_STATE_LEARN_CYC_ACTIVE |	\
 MFI_BBU_STATE_REPLACE_PACK |	\
 MFI_BBU_STATE_CAPACITY_LOW)



CVS commit: src/sys/dev/ic

2022-05-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 12 12:05:04 UTC 2022

Modified Files:
src/sys/dev/ic: mfireg.h

Log Message:
I think MFI_BBU_STATE_LEARN_CYC_REQ is not an error.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/ic/mfireg.h

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



CVS commit: src/sys/dev/pci

2022-05-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 12 12:04:09 UTC 2022

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

Log Message:
Use IBBU's data structure for iBBU-09.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/pci/mfii.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/mfii.c
diff -u src/sys/dev/pci/mfii.c:1.13 src/sys/dev/pci/mfii.c:1.14
--- src/sys/dev/pci/mfii.c:1.13	Wed May 11 15:30:33 2022
+++ src/sys/dev/pci/mfii.c	Thu May 12 12:04:09 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: mfii.c,v 1.13 2022/05/11 15:30:33 msaitoh Exp $ */
+/* $NetBSD: mfii.c,v 1.14 2022/05/12 12:04:09 msaitoh Exp $ */
 /* $OpenBSD: mfii.c,v 1.58 2018/08/14 05:22:21 jmatthew Exp $ */
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.13 2022/05/11 15:30:33 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.14 2022/05/12 12:04:09 msaitoh Exp $");
 
 #include "bio.h"
 
@@ -3708,11 +3708,11 @@ mfii_bbu(struct mfii_softc *sc, envsys_d
 
 	switch (bbu.battery_type) {
 	case MFI_BBU_TYPE_IBBU:
+	case MFI_BBU_TYPE_IBBU09:
 		mask = MFI_BBU_STATE_BAD_IBBU;
 		soh_bad = 0;
 		break;
 	case MFI_BBU_TYPE_BBU:
-	case MFI_BBU_TYPE_IBBU09:
 		mask = MFI_BBU_STATE_BAD_BBU;
 		soh_bad = (bbu.detail.bbu.is_SOH_good == 0);
 		break;



CVS commit: src/sys/dev/pci

2022-05-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 12 12:04:09 UTC 2022

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

Log Message:
Use IBBU's data structure for iBBU-09.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/pci/mfii.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

2022-05-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 12 12:00:58 UTC 2022

Modified Files:
src/sys/dev/ic: mfireg.h

Log Message:
No functional change.

 - Reduce diff against OpenBSD
   - Whitespace fix.
   - Sort some defines and structures.
   - Add comment.
 - KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/ic/mfireg.h

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



CVS commit: src/sys/dev/ic

2022-05-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 12 12:00:58 UTC 2022

Modified Files:
src/sys/dev/ic: mfireg.h

Log Message:
No functional change.

 - Reduce diff against OpenBSD
   - Whitespace fix.
   - Sort some defines and structures.
   - Add comment.
 - KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/ic/mfireg.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/ic/mfireg.h
diff -u src/sys/dev/ic/mfireg.h:1.19 src/sys/dev/ic/mfireg.h:1.20
--- src/sys/dev/ic/mfireg.h:1.19	Thu May 12 11:56:29 2022
+++ src/sys/dev/ic/mfireg.h	Thu May 12 12:00:58 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: mfireg.h,v 1.19 2022/05/12 11:56:29 msaitoh Exp $ */
+/* $NetBSD: mfireg.h,v 1.20 2022/05/12 12:00:58 msaitoh Exp $ */
 /* $OpenBSD: mfireg.h,v 1.24 2006/06/19 19:05:45 marco Exp $ */
 /*
  * Copyright (c) 2006 Marco Peereboom 
@@ -414,6 +414,7 @@ typedef enum {
 #define MFI_MAX_LD64
 #define MFI_MAX_SPAN8
 #define MFI_MAX_ARRAY_DEDICATED			16
+#define MFI_MAX_PD256
 
 /* sense buffer */
 struct mfi_sense {
@@ -1077,7 +1078,6 @@ struct mfi_pd_address {
 	uint64_t		mpa_sas_address[2];
 } __packed;
 
-#define MFI_MAX_PD 256
 struct mfi_pd_list {
 	uint32_t		mpl_size;
 	uint32_t		mpl_no_pd;
@@ -1170,6 +1170,39 @@ struct mfi_array {
 	} pd[MFI_MAX_PD_ARRAY];
 } __packed;
 
+struct mfi_hotspare {
+	struct mfi_pd	mhs_pd;
+	uint8_t		mhs_type;
+#define MFI_PD_HS_DEDICATED	0x01
+#define MFI_PD_HS_REVERTIBLE	0x02
+#define MFI_PD_HS_ENC_AFFINITY	0x04
+	uint8_t		mhs_res[2];
+	uint8_t		mhs_array_max;
+	uint16_t	mhs_array_ref[MFI_MAX_ARRAY_DEDICATED];
+} __packed;
+
+struct mfi_conf {
+	uint32_t		mfc_size;
+	uint16_t		mfc_no_array;
+	uint16_t		mfc_array_size;
+	uint16_t		mfc_no_ld;
+	uint16_t		mfc_ld_size;
+	uint16_t		mfc_no_hs;
+	uint16_t		mfc_hs_size;
+	uint8_t			mfc_res[16];
+	/*
+	 * XXX this is a ridiculous hack and does not reflect reality
+	 * Structures are actually indexed and therefore need pointer
+	 * math to reach.  We need the size of this structure first so
+	 * call it with the size of this structure and then use the returned
+	 * values to allocate memory and do the transfer of the whole structure
+	 * then calculate pointers to each of these structures.
+	 */
+	struct mfi_array	mfc_array[1];
+	struct mfi_ld_cfg	mfc_ld[1];
+	struct mfi_hotspare	mfc_hs[1];
+} __packed;
+
 /* informations from MR_DCMD_BBU_GET_CAPACITY_INFO */
 struct mfi_bbu_capacity_info {
 	uint16_t		relative_charge;
@@ -1235,9 +1268,9 @@ struct mfi_bbu_status {
 #define MFI_BBU_TYPE_BBU	2
 #define MFI_BBU_TYPE_IBBU09	5
 	uint8_t			reserved;
-	uint16_t		voltage;
-	int16_t			current;
-	uint16_t		temperature;
+	uint16_t		voltage; /* mV */
+	int16_t			current; /* mA */
+	uint16_t		temperature; /* degC */
 	uint32_t		fw_status;
 #define MFI_BBU_STATE_PACK_MISSING	(1 << 0)
 #define MFI_BBU_STATE_VOLTAGE_LOW	(1 << 1)
@@ -1247,11 +1280,11 @@ struct mfi_bbu_status {
 #define MFI_BBU_STATE_LEARN_CYC_REQ	(1 << 5)
 #define MFI_BBU_STATE_LEARN_CYC_ACTIVE	(1 << 6)
 #define MFI_BBU_STATE_LEARN_CYC_FAIL	(1 << 7)
-#define MFI_BBU_STATE_LEARN_CYC_TIMEOUT (1 << 8)
+#define MFI_BBU_STATE_LEARN_CYC_TIMEOUT	(1 << 8)
 #define MFI_BBU_STATE_I2C_ERR_DETECT	(1 << 9)
-#define MFI_BBU_STATE_REPLACE_PACK  (1 << 10)
-#define MFI_BBU_STATE_CAPACITY_LOW  (1 << 11)
-#define MFI_BBU_STATE_LEARN_REQUIRED(1 << 12)
+#define MFI_BBU_STATE_REPLACE_PACK	(1 << 10)
+#define MFI_BBU_STATE_CAPACITY_LOW	(1 << 11)
+#define MFI_BBU_STATE_LEARN_REQUIRED	(1 << 12)
 #define MFI_BBU_STATE_BAD_IBBU	(	\
 MFI_BBU_STATE_PACK_MISSING |	\
 MFI_BBU_STATE_VOLTAGE_LOW |		\
@@ -1268,39 +1301,6 @@ struct mfi_bbu_status {
 	union mfi_bbu_status_detail detail;
 } __packed;
 
-struct mfi_hotspare {
-	struct mfi_pd	mhs_pd;
-	uint8_t		mhs_type;
-#define MFI_PD_HS_DEDICATED	0x01
-#define MFI_PD_HS_REVERTIBLE	0x02
-#define MFI_PD_HS_ENC_AFFINITY	0x04
-	uint8_t		mhs_res[2];
-	uint8_t		mhs_array_max;
-	uint16_t	mhs_array_ref[MFI_MAX_ARRAY_DEDICATED];
-} __packed;
-
-struct mfi_conf {
-	uint32_t		mfc_size;
-	uint16_t		mfc_no_array;
-	uint16_t		mfc_array_size;
-	uint16_t		mfc_no_ld;
-	uint16_t		mfc_ld_size;
-	uint16_t		mfc_no_hs;
-	uint16_t		mfc_hs_size;
-	uint8_t			mfc_res[16];
-	/*
-	 * XXX this is a ridiculous hack and does not reflect reality
-	 * Structures are actually indexed and therefore need pointer
-	 * math to reach.  We need the size of this structure first so
-	 * call it with the size of this structure and then use the returned
-	 * values to allocate memory and do the transfer of the whole structure
-	 * then calculate pointers to each of these structures.
-	 */
-	struct mfi_array	mfc_array[1];
-	struct mfi_ld_cfg	mfc_ld[1];
-	struct mfi_hotspare	mfc_hs[1];
-} __packed;
-
 /* ThunderBolt support */
 
 /*



CVS commit: src/sys/dev/ic

2022-05-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 12 11:56:30 UTC 2022

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

Log Message:
Don't use MFI_PD_LIST_SIZE. Same as OpenBSD. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/dev/ic/mfi.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/ic/mfireg.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/ic/mfi.c
diff -u src/sys/dev/ic/mfi.c:1.75 src/sys/dev/ic/mfi.c:1.76
--- src/sys/dev/ic/mfi.c:1.75	Tue May 10 14:13:37 2022
+++ src/sys/dev/ic/mfi.c	Thu May 12 11:56:29 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: mfi.c,v 1.75 2022/05/10 14:13:37 msaitoh Exp $ */
+/* $NetBSD: mfi.c,v 1.76 2022/05/12 11:56:29 msaitoh Exp $ */
 /* $OpenBSD: mfi.c,v 1.66 2006/11/28 23:59:45 dlg Exp $ */
 
 /*
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.75 2022/05/10 14:13:37 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.76 2022/05/12 11:56:29 msaitoh Exp $");
 
 #include "bio.h"
 
@@ -2316,10 +2316,10 @@ mfi_ioctl_blink(struct mfi_softc *sc, st
 	if (bb->bb_channel == 0)
 		return EINVAL;
 
-	pd = malloc(MFI_PD_LIST_SIZE, M_DEVBUF, M_WAITOK);
+	pd = malloc(sizeof(*pd), M_DEVBUF, M_WAITOK);
 
 	if (mfi_mgmt_internal(sc, MR_DCMD_PD_GET_LIST, MFI_DATA_IN,
-	MFI_PD_LIST_SIZE, pd, NULL, false))
+	sizeof(*pd), pd, NULL, false))
 		goto done;
 
 	for (i = 0, found = 0; i < pd->mpl_no_pd; i++)
@@ -2371,10 +2371,10 @@ mfi_ioctl_setstate(struct mfi_softc *sc,
 	DNPRINTF(MFI_D_IOCTL, "%s: mfi_ioctl_setstate %x\n", DEVNAME(sc),
 	bs->bs_status);
 
-	pd = malloc(MFI_PD_LIST_SIZE, M_DEVBUF, M_WAITOK);
+	pd = malloc(sizeof(*pd), M_DEVBUF, M_WAITOK);
 
 	if (mfi_mgmt_internal(sc, MR_DCMD_PD_GET_LIST, MFI_DATA_IN,
-	MFI_PD_LIST_SIZE, pd, NULL, false))
+	sizeof(*pd), pd, NULL, false))
 		goto done;
 
 	for (i = 0, found = 0; i < pd->mpl_no_pd; i++)

Index: src/sys/dev/ic/mfireg.h
diff -u src/sys/dev/ic/mfireg.h:1.18 src/sys/dev/ic/mfireg.h:1.19
--- src/sys/dev/ic/mfireg.h:1.18	Wed May 11 15:30:33 2022
+++ src/sys/dev/ic/mfireg.h	Thu May 12 11:56:29 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: mfireg.h,v 1.18 2022/05/11 15:30:33 msaitoh Exp $ */
+/* $NetBSD: mfireg.h,v 1.19 2022/05/12 11:56:29 msaitoh Exp $ */
 /* $OpenBSD: mfireg.h,v 1.24 2006/06/19 19:05:45 marco Exp $ */
 /*
  * Copyright (c) 2006 Marco Peereboom 
@@ -1083,7 +1083,6 @@ struct mfi_pd_list {
 	uint32_t		mpl_no_pd;
 	struct mfi_pd_address	mpl_address[MFI_MAX_PD];
 } __packed;
-#define MFI_PD_LIST_SIZE	(sizeof(struct mfi_pd_list))
 
 struct mfi_pd {
 	uint16_t		mfp_id;



CVS commit: src/sys/dev/ic

2022-05-12 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May 12 11:56:30 UTC 2022

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

Log Message:
Don't use MFI_PD_LIST_SIZE. Same as OpenBSD. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/dev/ic/mfi.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/ic/mfireg.h

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



CVS commit: src/sys/dev

2022-05-11 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed May 11 15:30:34 UTC 2022

Modified Files:
src/sys/dev/ic: mfireg.h
src/sys/dev/pci: mfii.c

Log Message:
Add support for iBBU-09 to show BBU voltage, current and temp correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/ic/mfireg.h
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/mfii.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/mfireg.h
diff -u src/sys/dev/ic/mfireg.h:1.17 src/sys/dev/ic/mfireg.h:1.18
--- src/sys/dev/ic/mfireg.h:1.17	Wed May 11 15:20:54 2022
+++ src/sys/dev/ic/mfireg.h	Wed May 11 15:30:33 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: mfireg.h,v 1.17 2022/05/11 15:20:54 msaitoh Exp $ */
+/* $NetBSD: mfireg.h,v 1.18 2022/05/11 15:30:33 msaitoh Exp $ */
 /* $OpenBSD: mfireg.h,v 1.24 2006/06/19 19:05:45 marco Exp $ */
 /*
  * Copyright (c) 2006 Marco Peereboom 
@@ -1234,6 +1234,7 @@ struct mfi_bbu_status {
 #define MFI_BBU_TYPE_NONE	0
 #define MFI_BBU_TYPE_IBBU	1
 #define MFI_BBU_TYPE_BBU	2
+#define MFI_BBU_TYPE_IBBU09	5
 	uint8_t			reserved;
 	uint16_t		voltage;
 	int16_t			current;

Index: src/sys/dev/pci/mfii.c
diff -u src/sys/dev/pci/mfii.c:1.12 src/sys/dev/pci/mfii.c:1.13
--- src/sys/dev/pci/mfii.c:1.12	Wed May 11 15:24:45 2022
+++ src/sys/dev/pci/mfii.c	Wed May 11 15:30:33 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: mfii.c,v 1.12 2022/05/11 15:24:45 msaitoh Exp $ */
+/* $NetBSD: mfii.c,v 1.13 2022/05/11 15:30:33 msaitoh Exp $ */
 /* $OpenBSD: mfii.c,v 1.58 2018/08/14 05:22:21 jmatthew Exp $ */
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.12 2022/05/11 15:24:45 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.13 2022/05/11 15:30:33 msaitoh Exp $");
 
 #include "bio.h"
 
@@ -3712,6 +3712,7 @@ mfii_bbu(struct mfii_softc *sc, envsys_d
 		soh_bad = 0;
 		break;
 	case MFI_BBU_TYPE_BBU:
+	case MFI_BBU_TYPE_IBBU09:
 		mask = MFI_BBU_STATE_BAD_BBU;
 		soh_bad = (bbu.detail.bbu.is_SOH_good == 0);
 		break;



CVS commit: src/sys/dev

2022-05-11 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed May 11 15:30:34 UTC 2022

Modified Files:
src/sys/dev/ic: mfireg.h
src/sys/dev/pci: mfii.c

Log Message:
Add support for iBBU-09 to show BBU voltage, current and temp correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/ic/mfireg.h
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/mfii.c

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



CVS commit: src/sys/dev/pci

2022-05-11 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed May 11 15:24:45 UTC 2022

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

Log Message:
mfii(4): Set stripe size correctly for BIOCVOL. Same as mfi.c rev. 1.75.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/mfii.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/mfii.c
diff -u src/sys/dev/pci/mfii.c:1.11 src/sys/dev/pci/mfii.c:1.12
--- src/sys/dev/pci/mfii.c:1.11	Sat May  7 14:18:25 2022
+++ src/sys/dev/pci/mfii.c	Wed May 11 15:24:45 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: mfii.c,v 1.11 2022/05/07 14:18:25 msaitoh Exp $ */
+/* $NetBSD: mfii.c,v 1.12 2022/05/11 15:24:45 msaitoh Exp $ */
 /* $OpenBSD: mfii.c,v 1.58 2018/08/14 05:22:21 jmatthew Exp $ */
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.11 2022/05/07 14:18:25 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.12 2022/05/11 15:24:45 msaitoh Exp $");
 
 #include "bio.h"
 
@@ -2974,6 +2974,9 @@ mfii_ioctl_vol(struct mfii_softc *sc, st
 	sc->sc_ld_details[i].mld_cfg.mlc_parm.mpa_span_depth;
 
 	bv->bv_size = sc->sc_ld_details[i].mld_size * 512; /* bytes per block */
+	bv->bv_stripe_size =
+	(512 << sc->sc_ld_details[i].mld_cfg.mlc_parm.mpa_stripe_size)
+	/ 1024; /* in KB */
 
 	rv = 0;
 done:



CVS commit: src/sys/dev/pci

2022-05-11 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed May 11 15:24:45 UTC 2022

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

Log Message:
mfii(4): Set stripe size correctly for BIOCVOL. Same as mfi.c rev. 1.75.


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

2022-05-11 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed May 11 15:20:54 UTC 2022

Modified Files:
src/sys/dev/ic: mfireg.h

Log Message:
KNF. s/u_quad_t/uint64_t/. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ic/mfireg.h

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



CVS commit: src/sys/dev/ic

2022-05-11 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed May 11 15:20:54 UTC 2022

Modified Files:
src/sys/dev/ic: mfireg.h

Log Message:
KNF. s/u_quad_t/uint64_t/. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ic/mfireg.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/ic/mfireg.h
diff -u src/sys/dev/ic/mfireg.h:1.16 src/sys/dev/ic/mfireg.h:1.17
--- src/sys/dev/ic/mfireg.h:1.16	Sat May  7 04:47:25 2022
+++ src/sys/dev/ic/mfireg.h	Wed May 11 15:20:54 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: mfireg.h,v 1.16 2022/05/07 04:47:25 msaitoh Exp $ */
+/* $NetBSD: mfireg.h,v 1.17 2022/05/11 15:20:54 msaitoh Exp $ */
 /* $OpenBSD: mfireg.h,v 1.24 2006/06/19 19:05:45 marco Exp $ */
 /*
  * Copyright (c) 2006 Marco Peereboom 
@@ -75,7 +75,7 @@
 #define MFI_IQP0x40 /* inbound queue port */
 #define MFI_OQP0x44 /* outbound queue port */
 #define MFI_ODC0xa0 /* outbound doorbell clr */
-#define MFI_OSP 			0xb0 /* outbound scratch pad */
+#define MFI_OSP0xb0 /* outbound scratch pad */
 
 /* ThunderBolt specific Register */
 #define MFI_RPI0x6c /* reply_post_host_index */
@@ -357,27 +357,27 @@ typedef enum {
 } mfi_evt_locale_t;
 
 typedef enum {
-MR_EVT_ARGS_NONE =			0x00,
-MR_EVT_ARGS_CDB_SENSE,
-MR_EVT_ARGS_LD,
-MR_EVT_ARGS_LD_COUNT,
-MR_EVT_ARGS_LD_LBA,
-MR_EVT_ARGS_LD_OWNER,
-MR_EVT_ARGS_LD_LBA_PD_LBA,
-MR_EVT_ARGS_LD_PROG,
-MR_EVT_ARGS_LD_STATE,
-MR_EVT_ARGS_LD_STRIP,
-MR_EVT_ARGS_PD,
-MR_EVT_ARGS_PD_ERR,
-MR_EVT_ARGS_PD_LBA,
-MR_EVT_ARGS_PD_LBA_LD,
-MR_EVT_ARGS_PD_PROG,
-MR_EVT_ARGS_PD_STATE,
-MR_EVT_ARGS_PCI,
-MR_EVT_ARGS_RATE,
-MR_EVT_ARGS_STR,
-MR_EVT_ARGS_TIME,
-MR_EVT_ARGS_ECC
+	MR_EVT_ARGS_NONE =			0x00,
+	MR_EVT_ARGS_CDB_SENSE,
+	MR_EVT_ARGS_LD,
+	MR_EVT_ARGS_LD_COUNT,
+	MR_EVT_ARGS_LD_LBA,
+	MR_EVT_ARGS_LD_OWNER,
+	MR_EVT_ARGS_LD_LBA_PD_LBA,
+	MR_EVT_ARGS_LD_PROG,
+	MR_EVT_ARGS_LD_STATE,
+	MR_EVT_ARGS_LD_STRIP,
+	MR_EVT_ARGS_PD,
+	MR_EVT_ARGS_PD_ERR,
+	MR_EVT_ARGS_PD_LBA,
+	MR_EVT_ARGS_PD_LBA_LD,
+	MR_EVT_ARGS_PD_PROG,
+	MR_EVT_ARGS_PD_STATE,
+	MR_EVT_ARGS_PCI,
+	MR_EVT_ARGS_RATE,
+	MR_EVT_ARGS_STR,
+	MR_EVT_ARGS_TIME,
+	MR_EVT_ARGS_ECC
 } mfi_evt_args;
 
 /* XXX should be in mfi_evt_args ? */
@@ -543,7 +543,7 @@ struct mfi_stp_frame {
 	union {
 		struct mfi_sg32 sg32[2];
 		struct mfi_sg64 sg64[2];
-	} 			msf_sgl;
+	}			msf_sgl;
 } __packed;
 
 union mfi_frame {
@@ -561,9 +561,9 @@ union mfi_frame {
 union mfi_evt_class_locale {
 	struct {
 		uint16_t	locale;
-		uint8_t 	reserved;
+		uint8_t		reserved;
 		int8_t		class;
-	} 			mec_members;
+	}			mec_members;
 	uint32_t		mec_word;
 };
 
@@ -613,12 +613,12 @@ struct mfi_evtarg_pd_address {
 		}			encl_address;
 	}			address;
 
-uint8_t			scsi_dev_type;
+	uint8_t			scsi_dev_type;
 
 	union {
 		uint8_t			port_bitmap;
 		uint8_t			port_numbers;
-	} 			connected;
+	}			connected;
 
 	uint64_t		sas_addr[2];
 };
@@ -641,7 +641,7 @@ struct mfi_evt_detail {
 			uint8_t			sense[64];
 		} __packed			cdb_sense;
 
-		struct mfi_evtarg_ld 		ld;
+		struct mfi_evtarg_ld		ld;
 
 		struct {
 			struct mfi_evtarg_ld	ld;
@@ -762,12 +762,12 @@ struct mfi_ctrl_props {
 	uint16_t		mcp_ecc_bucket_leak_rate;
 	uint8_t			mcp_restore_hotspare_on_insertion;
 	uint8_t			mcp_expose_encl_devices;
-	uint8_t	 		maintainPdFailHistory;
-	uint8_t	 		disallowHostRequestReordering;
+	uint8_t			maintainPdFailHistory;
+	uint8_t			disallowHostRequestReordering;
 	/* set TRUE to abort CC on detecting an inconsistency */
-	uint8_t	 		abortCCOnError;
+	uint8_t			abortCCOnError;
 	/* load balance mode (MR_LOAD_BALANCE_MODE) */
-	uint8_t	 		loadBalanceMode;
+	uint8_t			loadBalanceMode;
 	/*
 	 * 0 - use auto detect logic of backplanes like SGPIO, i2c SEP using
 	 * h/w mechanism like GPIO pins
@@ -775,12 +775,12 @@ struct mfi_ctrl_props {
 	 * 2 - disable i2c SEP auto detect
 	 * 3 - disable both auto detect
 	 */
-	uint8_t	 		disableAutoDetectBackplane;
+	uint8_t			disableAutoDetectBackplane;
 	/*
 	 * % of source LD to be reserved for a VDs snapshot in snapshot
 	 * repository, for metadata and user data: 1=5%, 2=10%, 3=15% and so on
 	 */
-	uint8_t	 		snapVDSpace;
+	uint8_t			snapVDSpace;
 
 	/*
 	 * Add properties that can be controlled by a bit in the following
@@ -789,24 +789,25 @@ struct mfi_ctrl_props {
 	struct {
 		/* set TRUE to disable copyBack (0=copback enabled) */
 		uint32_t	copyBackDisabled		:1;
-		uint32_t	SMARTerEnabled		  	:1;
-		uint32_t	prCorrectUnconfiguredAreas  :1;
-		uint32_t	useFdeOnly		  	:1;
-		uint32_t	disableNCQ		  	:1;
-		uint32_t	SSDSMARTerEnabled	   	:1;
-		uint32_t	SSDPatrolReadEnabled		:1;
-		uint32_t	enableSpinDownUnconfigured  :1;
-		uint32_t	autoEnhancedImport	  	:1;
-		uint32_t	

CVS commit: src/sbin/bioctl

2022-05-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue May 10 14:16:25 UTC 2022

Modified Files:
src/sbin/bioctl: bioctl.c

Log Message:
bioctl(8): Don't print garbage bv_seconds.

This bug was added in bioctl.c rev. 1.7.

Before:
Volume Status   Size Device/LabelLevel Stripe
=
bv_level=5, bv_stripe_size=0
 0 Online   5.5T mfi0   RAID 564K  65535 seconds

After:
Volume Status   Size Device/LabelLevel Stripe
=
 0 Online   5.5T mfi0   RAID 564K


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sbin/bioctl/bioctl.c

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



CVS commit: src/sbin/bioctl

2022-05-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue May 10 14:16:25 UTC 2022

Modified Files:
src/sbin/bioctl: bioctl.c

Log Message:
bioctl(8): Don't print garbage bv_seconds.

This bug was added in bioctl.c rev. 1.7.

Before:
Volume Status   Size Device/LabelLevel Stripe
=
bv_level=5, bv_stripe_size=0
 0 Online   5.5T mfi0   RAID 564K  65535 seconds

After:
Volume Status   Size Device/LabelLevel Stripe
=
 0 Online   5.5T mfi0   RAID 564K


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sbin/bioctl/bioctl.c

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

Modified files:

Index: src/sbin/bioctl/bioctl.c
diff -u src/sbin/bioctl/bioctl.c:1.18 src/sbin/bioctl/bioctl.c:1.19
--- src/sbin/bioctl/bioctl.c:1.18	Mon Feb  4 04:36:41 2019
+++ src/sbin/bioctl/bioctl.c	Tue May 10 14:16:25 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: bioctl.c,v 1.18 2019/02/04 04:36:41 mrg Exp $ */
+/* $NetBSD: bioctl.c,v 1.19 2022/05/10 14:16:25 msaitoh Exp $ */
 /* $OpenBSD: bioctl.c,v 1.52 2007/03/20 15:26:06 jmc Exp $ */
 
 /*
@@ -31,7 +31,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: bioctl.c,v 1.18 2019/02/04 04:36:41 mrg Exp $");
+__RCSID("$NetBSD: bioctl.c,v 1.19 2022/05/10 14:16:25 msaitoh Exp $");
 #endif
 
 #include 
@@ -245,7 +245,7 @@ bio_show_volumes(struct biotmp *bt)
 	bv.bv_cookie = bl.bl_cookie;
 	bv.bv_volid = bt->volid;
 	bv.bv_percent = -1;
-	bv.bv_seconds = -1;
+	bv.bv_seconds = 0;
 
 	if (ioctl(bt->fd, BIOCVOL, ) == -1)
 		err(EXIT_FAILURE, "BIOCVOL");



CVS commit: src/sys/dev/ic

2022-05-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue May 10 14:13:37 UTC 2022

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

Log Message:
mfi(4): Set stripe size correctly for BIOCVOL.

Before:
Volume Status   Size Device/LabelLevel Stripe
=
 0 Online   5.5T mfi0   RAID 5N/A  65535 seconds

After:
Volume Status   Size Device/LabelLevel Stripe
=
 0 Online   5.5T mfi0   RAID 564K  65535 seconds


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

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



CVS commit: src/sys/dev/ic

2022-05-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue May 10 14:13:37 UTC 2022

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

Log Message:
mfi(4): Set stripe size correctly for BIOCVOL.

Before:
Volume Status   Size Device/LabelLevel Stripe
=
 0 Online   5.5T mfi0   RAID 5N/A  65535 seconds

After:
Volume Status   Size Device/LabelLevel Stripe
=
 0 Online   5.5T mfi0   RAID 564K  65535 seconds


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

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

Modified files:

Index: src/sys/dev/ic/mfi.c
diff -u src/sys/dev/ic/mfi.c:1.74 src/sys/dev/ic/mfi.c:1.75
--- src/sys/dev/ic/mfi.c:1.74	Mon May  9 17:13:30 2022
+++ src/sys/dev/ic/mfi.c	Tue May 10 14:13:37 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: mfi.c,v 1.74 2022/05/09 17:13:30 msaitoh Exp $ */
+/* $NetBSD: mfi.c,v 1.75 2022/05/10 14:13:37 msaitoh Exp $ */
 /* $OpenBSD: mfi.c,v 1.66 2006/11/28 23:59:45 dlg Exp $ */
 
 /*
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.74 2022/05/09 17:13:30 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.75 2022/05/10 14:13:37 msaitoh Exp $");
 
 #include "bio.h"
 
@@ -2124,6 +2124,9 @@ mfi_ioctl_vol(struct mfi_softc *sc, stru
 	sc->sc_ld_details.mld_cfg.mlc_parm.mpa_span_depth;
 
 	bv->bv_size = sc->sc_ld_details.mld_size * 512; /* bytes per block */
+	bv->bv_stripe_size =
+	(512 << sc->sc_ld_details.mld_cfg.mlc_parm.mpa_stripe_size)
+	/ 1024; /* in KB */
 
 	rv = 0;
 done:



CVS commit: src/sys/dev

2022-05-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue May 10 14:13:09 UTC 2022

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

Log Message:
Add comment. bv_stripe_size is used in KB.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/biovar.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/biovar.h
diff -u src/sys/dev/biovar.h:1.10 src/sys/dev/biovar.h:1.11
--- src/sys/dev/biovar.h:1.10	Sun Sep  6 06:00:59 2015
+++ src/sys/dev/biovar.h	Tue May 10 14:13:09 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: biovar.h,v 1.10 2015/09/06 06:00:59 dholland Exp $ */
+/*	$NetBSD: biovar.h,v 1.11 2022/05/10 14:13:09 msaitoh Exp $ */
 /*	$OpenBSD: biovar.h,v 1.26 2007/03/19 03:02:08 marco Exp $	*/
 
 /*
@@ -171,7 +171,7 @@ struct bioc_vol {
 	char		bv_dev[16];	/* device */
 	char		bv_vendor[32];	/* scsi string */
 
-	uint16_t	bv_stripe_size;	/* stripe size */
+	uint16_t	bv_stripe_size;	/* stripe size in KB */
 };
 
 /* COMPATIBILITY */



CVS commit: src/sys/dev

2022-05-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue May 10 14:13:09 UTC 2022

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

Log Message:
Add comment. bv_stripe_size is used in KB.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/biovar.h

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



CVS commit: src/sys/dev/ic

2022-05-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon May  9 17:13:30 UTC 2022

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

Log Message:
Use union mbox instead of unit8_t[] to avoid unaligned access.

 - Same as other OSes.
 - mfii.c already use this.
 - Found by kUBSan.


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

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

Modified files:

Index: src/sys/dev/ic/mfi.c
diff -u src/sys/dev/ic/mfi.c:1.73 src/sys/dev/ic/mfi.c:1.74
--- src/sys/dev/ic/mfi.c:1.73	Mon May  9 15:56:36 2022
+++ src/sys/dev/ic/mfi.c	Mon May  9 17:13:30 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: mfi.c,v 1.73 2022/05/09 15:56:36 msaitoh Exp $ */
+/* $NetBSD: mfi.c,v 1.74 2022/05/09 17:13:30 msaitoh Exp $ */
 /* $OpenBSD: mfi.c,v 1.66 2006/11/28 23:59:45 dlg Exp $ */
 
 /*
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.73 2022/05/09 15:56:36 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.74 2022/05/09 17:13:30 msaitoh Exp $");
 
 #include "bio.h"
 
@@ -156,9 +156,11 @@ static int		mfi_scsi_ld_io(struct mfi_cc
 static void		mfi_scsi_ld_done(struct mfi_ccb *);
 static void		mfi_scsi_xs_done(struct mfi_ccb *, int, int);
 static int		mfi_mgmt_internal(struct mfi_softc *, uint32_t,
-			uint32_t, uint32_t, void *, uint8_t *, bool);
+			uint32_t, uint32_t, void *, const union mfi_mbox *,
+			bool);
 static int		mfi_mgmt(struct mfi_ccb *,struct scsipi_xfer *,
-			uint32_t, uint32_t, uint32_t, void *, uint8_t *);
+			uint32_t, uint32_t, uint32_t, void *,
+			const union mfi_mbox *);
 static void		mfi_mgmt_done(struct mfi_ccb *);
 
 #if NBIO > 0
@@ -967,22 +969,22 @@ static bool
 mfi_shutdown(device_t dev, int how)
 {
 	struct mfi_softc	*sc = device_private(dev);
-	uint8_t			mbox[MFI_MBOX_SIZE];
+	union mfi_mbox		mbox;
 	int s = splbio();
 
 	DNPRINTF(MFI_D_MISC, "%s: mfi_shutdown\n", DEVNAME(sc));
 	if (sc->sc_running) {
-		memset(mbox, 0, sizeof(mbox));
-		mbox[0] = MR_FLUSH_CTRL_CACHE | MR_FLUSH_DISK_CACHE;
+		memset(, 0, sizeof(mbox));
+		mbox.b[0] = MR_FLUSH_CTRL_CACHE | MR_FLUSH_DISK_CACHE;
 		if (mfi_mgmt_internal(sc, MR_DCMD_CTRL_CACHE_FLUSH,
-		MFI_DATA_NONE, 0, NULL, mbox, true)) {
+		MFI_DATA_NONE, 0, NULL, , true)) {
 			aprint_error_dev(dev, "shutdown: cache flush failed\n");
 			goto fail;
 		}
 
-		mbox[0] = 0;
+		mbox.b[0] = 0;
 		if (mfi_mgmt_internal(sc, MR_DCMD_CTRL_SHUTDOWN,
-		MFI_DATA_NONE, 0, NULL, mbox, true)) {
+		MFI_DATA_NONE, 0, NULL, , true)) {
 			aprint_error_dev(dev, "shutdown: "
 			"firmware shutdown failed\n");
 			goto fail;
@@ -1579,10 +1581,10 @@ mfi_scsipi_request(struct scsipi_channel
 	struct scsipi_rw_10	*rwb;
 	struct scsipi_rw_12	*rw12;
 	struct scsipi_rw_16	*rw16;
+	union mfi_mbox		mbox;
 	uint64_t		blockno;
 	uint32_t		blockcnt;
 	uint8_t			target;
-	uint8_t			mbox[MFI_MBOX_SIZE];
 	int			s;
 
 	switch (req) {
@@ -1684,10 +1686,10 @@ mfi_scsipi_request(struct scsipi_channel
 
 	case SCSI_SYNCHRONIZE_CACHE_10:
 	case SCSI_SYNCHRONIZE_CACHE_16:
-		memset(mbox, 0, sizeof(mbox));
-		mbox[0] = MR_FLUSH_CTRL_CACHE | MR_FLUSH_DISK_CACHE;
+		memset(, 0, sizeof(mbox));
+		mbox.b[0] = MR_FLUSH_CTRL_CACHE | MR_FLUSH_DISK_CACHE;
 		if (mfi_mgmt(ccb, xs,
-		MR_DCMD_CTRL_CACHE_FLUSH, MFI_DATA_NONE, 0, NULL, mbox)) {
+		MR_DCMD_CTRL_CACHE_FLUSH, MFI_DATA_NONE, 0, NULL, )) {
 			goto stuffup;
 		}
 		break;
@@ -1839,7 +1841,7 @@ mfi_create_sgl(struct mfi_ccb *ccb, int 
 
 static int
 mfi_mgmt_internal(struct mfi_softc *sc, uint32_t opc, uint32_t dir,
-uint32_t len, void *buf, uint8_t *mbox, bool poll)
+uint32_t len, void *buf, const union mfi_mbox *mbox, bool poll)
 {
 	struct mfi_ccb		*ccb;
 	int			rv = 1;
@@ -1873,8 +1875,8 @@ done:
 }
 
 static int
-mfi_mgmt(struct mfi_ccb *ccb, struct scsipi_xfer *xs,
-uint32_t opc, uint32_t dir, uint32_t len, void *buf, uint8_t *mbox)
+mfi_mgmt(struct mfi_ccb *ccb, struct scsipi_xfer *xs, uint32_t opc,
+uint32_t dir, uint32_t len, void *buf, const union mfi_mbox *mbox)
 {
 	struct mfi_dcmd_frame	*dcmd;
 
@@ -2037,7 +2039,7 @@ static int
 mfi_ioctl_vol(struct mfi_softc *sc, struct bioc_vol *bv)
 {
 	int			i, per, rv = EINVAL;
-	uint8_t			mbox[MFI_MBOX_SIZE];
+	union mfi_mbox		mbox;
 
 	DNPRINTF(MFI_D_IOCTL, "%s: mfi_ioctl_vol %#x\n",
 	DEVNAME(sc), bv->bv_volid);
@@ -2047,13 +2049,13 @@ mfi_ioctl_vol(struct mfi_softc *sc, stru
 		goto done;
 
 	i = bv->bv_volid;
-	memset(mbox, 0, sizeof(mbox));
-	mbox[0] = sc->sc_ld_list.mll_list[i].mll_ld.mld_target;
+	memset(, 0, sizeof(mbox));
+	mbox.b[0] = sc->sc_ld_list.mll_list[i].mll_ld.mld_target;
 	DNPRINTF(MFI_D_IOCTL, "%s: mfi_ioctl_vol target %#x\n",
-	DEVNAME(sc), mbox[0]);
+	DEVNAME(sc), mbox.b[0]);
 
 	if (mfi_mgmt_internal(sc, MR_DCMD_LD_GET_INFO, MFI_DATA_IN,
-	sizeof(sc->sc_ld_details), >sc_ld_details, mbox, false))
+	sizeof(sc->sc_ld_details), >sc_ld_details, 

CVS commit: src/sys/dev/ic

2022-05-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon May  9 17:13:30 UTC 2022

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

Log Message:
Use union mbox instead of unit8_t[] to avoid unaligned access.

 - Same as other OSes.
 - mfii.c already use this.
 - Found by kUBSan.


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

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



CVS commit: src/sys/dev/ic

2022-05-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon May  9 15:56:36 UTC 2022

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

Log Message:
KNF. Whitespace. No functional change.


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

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

Modified files:

Index: src/sys/dev/ic/mfi.c
diff -u src/sys/dev/ic/mfi.c:1.72 src/sys/dev/ic/mfi.c:1.73
--- src/sys/dev/ic/mfi.c:1.72	Sat May  7 14:25:12 2022
+++ src/sys/dev/ic/mfi.c	Mon May  9 15:56:36 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: mfi.c,v 1.72 2022/05/07 14:25:12 msaitoh Exp $ */
+/* $NetBSD: mfi.c,v 1.73 2022/05/09 15:56:36 msaitoh Exp $ */
 /* $OpenBSD: mfi.c,v 1.66 2006/11/28 23:59:45 dlg Exp $ */
 
 /*
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.72 2022/05/07 14:25:12 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.73 2022/05/09 15:56:36 msaitoh Exp $");
 
 #include "bio.h"
 
@@ -112,7 +112,7 @@ __KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.72
 
 #ifdef MFI_DEBUG
 uint32_t	mfi_debug = 0
-/*		| MFI_D_CMD  */
+/*		| MFI_D_CMD */
 /*		| MFI_D_INTR */
 /*		| MFI_D_MISC */
 /*		| MFI_D_DMA */
@@ -201,10 +201,10 @@ const struct cdevsw mfi_cdevsw = {
 };
 
 static uint32_t 	mfi_xscale_fw_state(struct mfi_softc *sc);
-static void 		mfi_xscale_intr_ena(struct mfi_softc *sc);
-static void 		mfi_xscale_intr_dis(struct mfi_softc *sc);
-static int 		mfi_xscale_intr(struct mfi_softc *sc);
-static void 		mfi_xscale_post(struct mfi_softc *sc, struct mfi_ccb *ccb);
+static void		mfi_xscale_intr_ena(struct mfi_softc *sc);
+static void		mfi_xscale_intr_dis(struct mfi_softc *sc);
+static int		mfi_xscale_intr(struct mfi_softc *sc);
+static void		mfi_xscale_post(struct mfi_softc *sc, struct mfi_ccb *ccb);
 
 static const struct mfi_iop_ops mfi_iop_xscale = {
 	mfi_xscale_fw_state,
@@ -216,10 +216,10 @@ static const struct mfi_iop_ops mfi_iop_
 };
 
 static uint32_t 	mfi_ppc_fw_state(struct mfi_softc *sc);
-static void 		mfi_ppc_intr_ena(struct mfi_softc *sc);
-static void 		mfi_ppc_intr_dis(struct mfi_softc *sc);
-static int 		mfi_ppc_intr(struct mfi_softc *sc);
-static void 		mfi_ppc_post(struct mfi_softc *sc, struct mfi_ccb *ccb);
+static void		mfi_ppc_intr_ena(struct mfi_softc *sc);
+static void		mfi_ppc_intr_dis(struct mfi_softc *sc);
+static int		mfi_ppc_intr(struct mfi_softc *sc);
+static void		mfi_ppc_post(struct mfi_softc *sc, struct mfi_ccb *ccb);
 
 static const struct mfi_iop_ops mfi_iop_ppc = {
 	mfi_ppc_fw_state,
@@ -285,11 +285,11 @@ static const struct mfi_iop_ops mfi_iop_
 	mfi_tbolt_scsi_ld_io,
 };
 
-#define mfi_fw_state(_s) 	((_s)->sc_iop->mio_fw_state(_s))
-#define mfi_intr_enable(_s) 	((_s)->sc_iop->mio_intr_ena(_s))
-#define mfi_intr_disable(_s) 	((_s)->sc_iop->mio_intr_dis(_s))
-#define mfi_my_intr(_s) 	((_s)->sc_iop->mio_intr(_s))
-#define mfi_post(_s, _c) 	((_s)->sc_iop->mio_post((_s), (_c)))
+#define mfi_fw_state(_s)	((_s)->sc_iop->mio_fw_state(_s))
+#define mfi_intr_enable(_s)	((_s)->sc_iop->mio_intr_ena(_s))
+#define mfi_intr_disable(_s)	((_s)->sc_iop->mio_intr_dis(_s))
+#define mfi_my_intr(_s)		((_s)->sc_iop->mio_intr(_s))
+#define mfi_post(_s, _c)	((_s)->sc_iop->mio_post((_s), (_c)))
 
 static struct mfi_ccb *
 mfi_get_ccb(struct mfi_softc *sc)
@@ -684,7 +684,6 @@ mfi_get_info(struct mfi_softc *sc)
 		return 1;
 
 #ifdef MFI_DEBUG
-
 	for (i = 0; i < sc->sc_info.mci_image_component_count; i++) {
 		printf("%s: active FW %s Version %s date %s time %s\n",
 		DEVNAME(sc),
@@ -845,7 +844,7 @@ mfi_get_bbu(struct mfi_softc *sc, struct
 	"status 0x%x\n", stat->battery_type, stat->voltage, stat->current,
 	stat->temperature, stat->fw_status);
 	printf("details: ");
-	switch(stat->battery_type) {
+	switch (stat->battery_type) {
 	case MFI_BBU_TYPE_IBBU:
 		printf("guage %d relative charge %d charger state %d "
 		"charger ctrl %d\n", stat->detail.ibbu.gas_guage_status,
@@ -871,9 +870,9 @@ mfi_get_bbu(struct mfi_softc *sc, struct
 		printf("\n");
 	}
 #endif
-	switch(stat->battery_type) {
+	switch (stat->battery_type) {
 	case MFI_BBU_TYPE_BBU:
-		return (stat->detail.bbu.is_SOH_good ? 
+		return (stat->detail.bbu.is_SOH_good ?
 		MFI_BBU_GOOD : MFI_BBU_BAD);
 	case MFI_BBU_TYPE_NONE:
 		return MFI_BBU_UNKNOWN;
@@ -1040,7 +1039,7 @@ mfi_attach(struct mfi_softc *sc, enum mf
 		sc->sc_iop = _iop_tbolt;
 		break;
 	default:
-		 panic("%s: unknown iop %d", DEVNAME(sc), iop);
+		panic("%s: unknown iop %d", DEVNAME(sc), iop);
 	}
 
 	if (mfi_transition_firmware(sc))
@@ -1205,7 +1204,7 @@ mfi_attach(struct mfi_softc *sc, enum mf
 			aprint_normal("unknown type %d", bbu_stat.battery_type);
 		}
 		aprint_normal(", status ");
-		switch(mfi_bbu_status) {
+		switch (mfi_bbu_status) {
 		case MFI_BBU_GOOD:
 			aprint_normal("good\n");
 			sc->sc_bbuok = true;
@@ -2065,7 +2064,7 @@ mfi_ioctl_vol(struct mfi_softc *sc, stru
 
 	strlcpy(bv->bv_dev, 

CVS commit: src/sys/dev/ic

2022-05-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon May  9 15:56:36 UTC 2022

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

Log Message:
KNF. Whitespace. No functional change.


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

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



CVS commit: src/sys/dev/ic

2022-05-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sat May  7 14:25:12 UTC 2022

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

Log Message:
Clear mailbox to not to pass garbage data.


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

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

Modified files:

Index: src/sys/dev/ic/mfi.c
diff -u src/sys/dev/ic/mfi.c:1.71 src/sys/dev/ic/mfi.c:1.72
--- src/sys/dev/ic/mfi.c:1.71	Sat May  7 14:14:34 2022
+++ src/sys/dev/ic/mfi.c	Sat May  7 14:25:12 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: mfi.c,v 1.71 2022/05/07 14:14:34 msaitoh Exp $ */
+/* $NetBSD: mfi.c,v 1.72 2022/05/07 14:25:12 msaitoh Exp $ */
 /* $OpenBSD: mfi.c,v 1.66 2006/11/28 23:59:45 dlg Exp $ */
 
 /*
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.71 2022/05/07 14:14:34 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.72 2022/05/07 14:25:12 msaitoh Exp $");
 
 #include "bio.h"
 
@@ -970,8 +970,10 @@ mfi_shutdown(device_t dev, int how)
 	struct mfi_softc	*sc = device_private(dev);
 	uint8_t			mbox[MFI_MBOX_SIZE];
 	int s = splbio();
+
 	DNPRINTF(MFI_D_MISC, "%s: mfi_shutdown\n", DEVNAME(sc));
 	if (sc->sc_running) {
+		memset(mbox, 0, sizeof(mbox));
 		mbox[0] = MR_FLUSH_CTRL_CACHE | MR_FLUSH_DISK_CACHE;
 		if (mfi_mgmt_internal(sc, MR_DCMD_CTRL_CACHE_FLUSH,
 		MFI_DATA_NONE, 0, NULL, mbox, true)) {
@@ -1683,6 +1685,7 @@ mfi_scsipi_request(struct scsipi_channel
 
 	case SCSI_SYNCHRONIZE_CACHE_10:
 	case SCSI_SYNCHRONIZE_CACHE_16:
+		memset(mbox, 0, sizeof(mbox));
 		mbox[0] = MR_FLUSH_CTRL_CACHE | MR_FLUSH_DISK_CACHE;
 		if (mfi_mgmt(ccb, xs,
 		MR_DCMD_CTRL_CACHE_FLUSH, MFI_DATA_NONE, 0, NULL, mbox)) {
@@ -2045,6 +2048,7 @@ mfi_ioctl_vol(struct mfi_softc *sc, stru
 		goto done;
 
 	i = bv->bv_volid;
+	memset(mbox, 0, sizeof(mbox));
 	mbox[0] = sc->sc_ld_list.mll_list[i].mll_ld.mld_target;
 	DNPRINTF(MFI_D_IOCTL, "%s: mfi_ioctl_vol target %#x\n",
 	DEVNAME(sc), mbox[0]);
@@ -2220,6 +2224,7 @@ mfi_ioctl_disk(struct mfi_softc *sc, str
 	}
 
 	/* get the remaining fields */
+	memset(mbox, 0, sizeof(mbox));
 	*((uint16_t *)) = ar[arr].pd[disk].mar_pd.mfp_id;
 	memset(pd, 0, sizeof(*pd));
 	if (mfi_mgmt_internal(sc, MR_DCMD_PD_GET_INFO, MFI_DATA_IN,



CVS commit: src/sys/dev/ic

2022-05-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sat May  7 14:25:12 UTC 2022

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

Log Message:
Clear mailbox to not to pass garbage data.


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

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



CVS commit: src/sys/dev/pci

2022-05-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sat May  7 14:18:25 UTC 2022

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

Log Message:
Use mlp_bgi for MFI_LD_PROG_BGI. Same as OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/mfii.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/mfii.c
diff -u src/sys/dev/pci/mfii.c:1.10 src/sys/dev/pci/mfii.c:1.11
--- src/sys/dev/pci/mfii.c:1.10	Thu May  5 09:14:17 2022
+++ src/sys/dev/pci/mfii.c	Sat May  7 14:18:25 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: mfii.c,v 1.10 2022/05/05 09:14:17 msaitoh Exp $ */
+/* $NetBSD: mfii.c,v 1.11 2022/05/07 14:18:25 msaitoh Exp $ */
 /* $OpenBSD: mfii.c,v 1.58 2018/08/14 05:22:21 jmatthew Exp $ */
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.10 2022/05/05 09:14:17 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.11 2022/05/07 14:18:25 msaitoh Exp $");
 
 #include "bio.h"
 
@@ -2934,7 +2934,6 @@ mfii_ioctl_vol(struct mfii_softc *sc, st
 	/* additional status can modify MFI status */
 	switch (sc->sc_ld_details[i].mld_progress.mlp_in_prog) {
 	case MFI_LD_PROG_CC:
-	case MFI_LD_PROG_BGI:
 		bv->bv_status = BIOC_SVSCRUB;
 		per = (int)sc->sc_ld_details[i].mld_progress.mlp_cc.mp_progress;
 		bv->bv_percent = (per * 100) / 0x;
@@ -2942,6 +2941,14 @@ mfii_ioctl_vol(struct mfii_softc *sc, st
 		sc->sc_ld_details[i].mld_progress.mlp_cc.mp_elapsed_seconds;
 		break;
 
+	case MFI_LD_PROG_BGI:
+		bv->bv_status = BIOC_SVSCRUB;
+		per = (int)sc->sc_ld_details[i].mld_progress.mlp_bgi.mp_progress;
+		bv->bv_percent = (per * 100) / 0x;
+		bv->bv_seconds =
+		sc->sc_ld_details[i].mld_progress.mlp_bgi.mp_elapsed_seconds;
+		break;
+
 	case MFI_LD_PROG_FGI:
 	case MFI_LD_PROG_RECONSTRUCT:
 		/* nothing yet */



CVS commit: src/sys/dev/pci

2022-05-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sat May  7 14:18:25 UTC 2022

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

Log Message:
Use mlp_bgi for MFI_LD_PROG_BGI. Same as OpenBSD.


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

2022-05-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sat May  7 14:14:34 UTC 2022

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

Log Message:
Use mlp_bgi for MFI_LD_PROG_BGI. Same as OpenBSD.


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

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

Modified files:

Index: src/sys/dev/ic/mfi.c
diff -u src/sys/dev/ic/mfi.c:1.70 src/sys/dev/ic/mfi.c:1.71
--- src/sys/dev/ic/mfi.c:1.70	Sat May  7 04:40:02 2022
+++ src/sys/dev/ic/mfi.c	Sat May  7 14:14:34 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: mfi.c,v 1.70 2022/05/07 04:40:02 msaitoh Exp $ */
+/* $NetBSD: mfi.c,v 1.71 2022/05/07 14:14:34 msaitoh Exp $ */
 /* $OpenBSD: mfi.c,v 1.66 2006/11/28 23:59:45 dlg Exp $ */
 
 /*
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.70 2022/05/07 04:40:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.71 2022/05/07 14:14:34 msaitoh Exp $");
 
 #include "bio.h"
 
@@ -2085,7 +2085,6 @@ mfi_ioctl_vol(struct mfi_softc *sc, stru
 	/* additional status can modify MFI status */
 	switch (sc->sc_ld_details.mld_progress.mlp_in_prog) {
 	case MFI_LD_PROG_CC:
-	case MFI_LD_PROG_BGI:
 		bv->bv_status = BIOC_SVSCRUB;
 		per = (int)sc->sc_ld_details.mld_progress.mlp_cc.mp_progress;
 		bv->bv_percent = (per * 100) / 0x;
@@ -2093,6 +2092,14 @@ mfi_ioctl_vol(struct mfi_softc *sc, stru
 		sc->sc_ld_details.mld_progress.mlp_cc.mp_elapsed_seconds;
 		break;
 
+	case MFI_LD_PROG_BGI:
+		bv->bv_status = BIOC_SVSCRUB;
+		per = (int)sc->sc_ld_details.mld_progress.mlp_bgi.mp_progress;
+		bv->bv_percent = (per * 100) / 0x;
+		bv->bv_seconds =
+		sc->sc_ld_details.mld_progress.mlp_bgi.mp_elapsed_seconds;
+		break;
+
 	case MFI_LD_PROG_FGI:
 	case MFI_LD_PROG_RECONSTRUCT:
 		/* nothing yet */



CVS commit: src/sys/dev/ic

2022-05-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sat May  7 14:14:34 UTC 2022

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

Log Message:
Use mlp_bgi for MFI_LD_PROG_BGI. Same as OpenBSD.


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

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



CVS commit: src/sys/dev/ic

2022-05-06 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sat May  7 04:47:25 UTC 2022

Modified Files:
src/sys/dev/ic: mfireg.h

Log Message:
Fix typos.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/ic/mfireg.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/ic/mfireg.h
diff -u src/sys/dev/ic/mfireg.h:1.15 src/sys/dev/ic/mfireg.h:1.16
--- src/sys/dev/ic/mfireg.h:1.15	Thu May  5 07:18:02 2022
+++ src/sys/dev/ic/mfireg.h	Sat May  7 04:47:25 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: mfireg.h,v 1.15 2022/05/05 07:18:02 msaitoh Exp $ */
+/* $NetBSD: mfireg.h,v 1.16 2022/05/07 04:47:25 msaitoh Exp $ */
 /* $OpenBSD: mfireg.h,v 1.24 2006/06/19 19:05:45 marco Exp $ */
 /*
  * Copyright (c) 2006 Marco Peereboom 
@@ -828,7 +828,7 @@ struct mfi_info_pci {
 	uint8_t			mip_reserved[24];
 } __packed;
 
-/* host interface infor */
+/* host interface info */
 struct mfi_info_host {
 	uint8_t			mih_type;
 #define MFI_INFO_HOST_PCIX	0x01
@@ -840,7 +840,7 @@ struct mfi_info_host {
 	uint64_t		mih_port_addr[8];
 } __packed;
 
-/* device  interface info */
+/* device interface info */
 struct mfi_info_device {
 	uint8_t			mid_type;
 #define MFI_INFO_DEV_SPI	0x01
@@ -1105,7 +1105,7 @@ struct mfi_pd_details {
 	uint8_t			mpd_inq_data[96];
 	uint8_t			mpd_inq_page83[64];
 	uint8_t			mpd_no_support;
-	uint8_t			mpd_scsy_type;
+	uint8_t			mpd_scsi_type;
 	uint8_t			mpd_port;
 	uint8_t			mpd_speed;
 	uint32_t		mpd_mediaerr_cnt;
@@ -1145,7 +1145,7 @@ struct mfi_pd_details {
 	uint8_t			mpd_res[218]; /* size is 512 */
 } __packed;
 
-/* array configuration from MD_DCMD_CONF_GET */
+/* array configuration from MR_DCMD_CONF_GET */
 struct mfi_array {
 	u_quad_t		mar_smallest_pd;
 	uint8_t			mar_no_disk;



CVS commit: src/sys/dev/ic

2022-05-06 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sat May  7 04:47:25 UTC 2022

Modified Files:
src/sys/dev/ic: mfireg.h

Log Message:
Fix typos.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/ic/mfireg.h

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



CVS commit: src/sys

2022-05-06 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sat May  7 04:40:02 UTC 2022

Modified Files:
src/sys/arch/amiga/conf: files.amiga
src/sys/arch/amigappc/conf: files.amigappc
src/sys/dev/ic: mfi.c

Log Message:
s/contrller/controller/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.183 -r1.184 src/sys/arch/amiga/conf/files.amiga
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/amigappc/conf/files.amigappc
cvs rdiff -u -r1.69 -r1.70 src/sys/dev/ic/mfi.c

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

Modified files:

Index: src/sys/arch/amiga/conf/files.amiga
diff -u src/sys/arch/amiga/conf/files.amiga:1.183 src/sys/arch/amiga/conf/files.amiga:1.184
--- src/sys/arch/amiga/conf/files.amiga:1.183	Sat Mar  7 20:27:54 2020
+++ src/sys/arch/amiga/conf/files.amiga	Sat May  7 04:40:01 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: files.amiga,v 1.183 2020/03/07 20:27:54 is Exp $
+#	$NetBSD: files.amiga,v 1.184 2022/05/07 04:40:01 msaitoh Exp $
 
 # maxpartitions must be first item in files.${ARCH}.newconf
 maxpartitions 16			# NOTE THAT AMIGA IS SPECIAL!
@@ -324,7 +324,7 @@ file	arch/amiga/dev/lpt_supio.c	lpt_supi
 
 include	"dev/scsipi/files.scsipi"
 
-# wd 33c93 contrllers
+# wd 33c93 controllers
 define	sbic
 file	arch/amiga/dev/sbic.c		sbic
 

Index: src/sys/arch/amigappc/conf/files.amigappc
diff -u src/sys/arch/amigappc/conf/files.amigappc:1.31 src/sys/arch/amigappc/conf/files.amigappc:1.32
--- src/sys/arch/amigappc/conf/files.amigappc:1.31	Wed May  8 13:40:14 2019
+++ src/sys/arch/amigappc/conf/files.amigappc	Sat May  7 04:40:02 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: files.amigappc,v 1.31 2019/05/08 13:40:14 isaki Exp $
+#	$NetBSD: files.amigappc,v 1.32 2022/05/07 04:40:02 msaitoh Exp $
 
 # maxpartitions must be first item in files.${ARCH}.newconf
 maxpartitions 16			# NOTE THAT AMIGA IS SPECIAL!
@@ -294,7 +294,7 @@ file	arch/amiga/dev/lpt_supio.c	lpt_supi
 
 include "dev/scsipi/files.scsipi"
 
-# wd 33c93 contrllers
+# wd 33c93 controllers
 define	sbic
 file	arch/amiga/dev/sbic.c		sbic
 

Index: src/sys/dev/ic/mfi.c
diff -u src/sys/dev/ic/mfi.c:1.69 src/sys/dev/ic/mfi.c:1.70
--- src/sys/dev/ic/mfi.c:1.69	Thu May  5 07:18:02 2022
+++ src/sys/dev/ic/mfi.c	Sat May  7 04:40:02 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: mfi.c,v 1.69 2022/05/05 07:18:02 msaitoh Exp $ */
+/* $NetBSD: mfi.c,v 1.70 2022/05/07 04:40:02 msaitoh Exp $ */
 /* $OpenBSD: mfi.c,v 1.66 2006/11/28 23:59:45 dlg Exp $ */
 
 /*
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.69 2022/05/05 07:18:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.70 2022/05/07 04:40:02 msaitoh Exp $");
 
 #include "bio.h"
 
@@ -2101,7 +2101,7 @@ mfi_ioctl_vol(struct mfi_softc *sc, stru
 
 	/*
 	 * The RAID levels are determined per the SNIA DDF spec, this is only
-	 * a subset that is valid for the MFI contrller.
+	 * a subset that is valid for the MFI controller.
 	 */
 	bv->bv_level = sc->sc_ld_details.mld_cfg.mlc_parm.mpa_pri_raid;
 	if (sc->sc_ld_details.mld_cfg.mlc_parm.mpa_sec_raid ==



CVS commit: src/sys

2022-05-06 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sat May  7 04:40:02 UTC 2022

Modified Files:
src/sys/arch/amiga/conf: files.amiga
src/sys/arch/amigappc/conf: files.amigappc
src/sys/dev/ic: mfi.c

Log Message:
s/contrller/controller/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.183 -r1.184 src/sys/arch/amiga/conf/files.amiga
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/amigappc/conf/files.amigappc
cvs rdiff -u -r1.69 -r1.70 src/sys/dev/ic/mfi.c

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



CVS commit: src/sys/dev/pci

2022-05-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May  5 09:14:17 UTC 2022

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

Log Message:
Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/mfii.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/mfii.c
diff -u src/sys/dev/pci/mfii.c:1.9 src/sys/dev/pci/mfii.c:1.10
--- src/sys/dev/pci/mfii.c:1.9	Sat Aug  7 16:19:14 2021
+++ src/sys/dev/pci/mfii.c	Thu May  5 09:14:17 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: mfii.c,v 1.9 2021/08/07 16:19:14 thorpej Exp $ */
+/* $NetBSD: mfii.c,v 1.10 2022/05/05 09:14:17 msaitoh Exp $ */
 /* $OpenBSD: mfii.c,v 1.58 2018/08/14 05:22:21 jmatthew Exp $ */
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.9 2021/08/07 16:19:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.10 2022/05/05 09:14:17 msaitoh Exp $");
 
 #include "bio.h"
 
@@ -198,8 +198,8 @@ struct mfii_task_mgmt {
 
 /* We currently don't know the full details of the following struct */
 struct mfii_foreign_scan_cfg {
-char data[24];
-} __packed; 
+	char data[24];
+} __packed;
 
 struct mfii_foreign_scan_info {
 	uint32_t count; /* Number of foreign configs found */
@@ -373,7 +373,7 @@ struct mfii_softc {
 uint32_t	mfii_debug = 0
 /*		| MFII_D_CMD */
 /*		| MFII_D_INTR */
-		| MFII_D_MISC
+		| MFII_D_MISC
 /*		| MFII_D_DMA */
 /*		| MFII_D_IOCTL */
 /*		| MFII_D_RW */
@@ -1008,7 +1008,7 @@ mfii_childdetached(device_t self, device
 		sc->sc_child = NULL;
 }
 
-static bool 
+static bool
 mfii_suspend(device_t dev, const pmf_qual_t *q)
 {
 	/* XXX to be implemented */
@@ -1017,11 +1017,11 @@ mfii_suspend(device_t dev, const pmf_qua
 
 static bool
 mfii_resume(device_t dev, const pmf_qual_t *q)
-{   
+{
 	/* XXX to be implemented */
 	return false;
 }
- 
+
 static bool
 mfii_shutdown(device_t dev, int how)
 {
@@ -1058,7 +1058,7 @@ mfii_shutdown(device_t dev, int how)
 		NULL, 0, MFII_DATA_NONE, true)) {
 			aprint_error_dev(dev, "shutdown: "
 			"firmware shutdown failed\n");
-			rv = false;
+			rv = false;
 			goto fail;
 		}
 	} else {
@@ -1268,13 +1268,13 @@ mfii_aen(struct work *wk, void *arg)
 	case MR_EVT_PD_INSERTED_EXT:
 		if (med->med_arg_type != MR_EVT_ARGS_PD_ADDRESS)
 			break;
-		
+
 		mfii_aen_pd_insert(sc, >args.pd_address);
 		break;
- 	case MR_EVT_PD_REMOVED_EXT:
+	case MR_EVT_PD_REMOVED_EXT:
 		if (med->med_arg_type != MR_EVT_ARGS_PD_ADDRESS)
 			break;
-		
+
 		mfii_aen_pd_remove(sc, >args.pd_address);
 		break;
 
@@ -1348,7 +1348,7 @@ mfii_aen_ld_update(struct mfii_softc *sc
 	for (i = 0; i < MFI_MAX_LD; i++) {
 		old = sc->sc_target_lds[i];
 		nld = newlds[i];
-		
+
 		if (old == -1 && nld != -1) {
 			printf("%s: logical drive %d added (target %d)\n",
 			DEVNAME(sc), i, nld);
@@ -1932,9 +1932,9 @@ mfii_initialise_firmware(struct mfii_sof
 	iiq->reply_descriptor_post_queue_address_hi =
 	htole32(MFII_DMA_DVA(sc->sc_reply_postq) >> 32);
 
-	iiq->system_request_frame_base_address_lo = 
+	iiq->system_request_frame_base_address_lo =
 	htole32(MFII_DMA_DVA(sc->sc_requests));
-	iiq->system_request_frame_base_address_hi = 
+	iiq->system_request_frame_base_address_hi =
 	htole32(MFII_DMA_DVA(sc->sc_requests) >> 32);
 
 	iiq->timestamp = htole64(time_uptime);
@@ -2016,7 +2016,7 @@ mfii_postq(struct mfii_softc *sc)
 
 	for (;;) {
 		rdp = [sc->sc_reply_postq_index];
-		DNPRINTF(MFII_D_INTR, "%s: mfii_postq index %d flags 0x%x data 0x%x\n", 
+		DNPRINTF(MFII_D_INTR, "%s: mfii_postq index %d flags 0x%x data 0x%x\n",
 		DEVNAME(sc), sc->sc_reply_postq_index, rdp->reply_flags,
 			rdp->data == 0x);
 		if ((rdp->reply_flags & MPII_REPLY_DESCR_TYPE_MASK) ==
@@ -2056,7 +2056,7 @@ mfii_postq(struct mfii_softc *sc)
 
 static void
 mfii_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req,
-void *arg)		
+void *arg)
 {
 	struct scsipi_periph*periph;
 	struct scsipi_xfer	*xs;
@@ -2066,7 +2066,7 @@ mfii_scsipi_request(struct scsipi_channe
 	int timeout;
 	int target;
 
-	switch(req) {
+	switch (req) {
 		case ADAPTER_REQ_GROW_RESOURCES:
 		/* Not supported. */
 		return;
@@ -2910,7 +2910,7 @@ mfii_ioctl_vol(struct mfii_softc *sc, st
 	strlcpy(bv->bv_dev, sc->sc_ld_details[i].mld_cfg.mlc_prop.mlp_name,
 	sizeof(bv->bv_dev));
 
-	switch(sc->sc_ld_list.mll_list[i].mll_state) {
+	switch (sc->sc_ld_list.mll_list[i].mll_state) {
 	case MFI_LD_OFFLINE:
 		bv->bv_status = BIOC_SVOFFLINE;
 		break;
@@ -3135,7 +3135,7 @@ mfii_ioctl_alarm(struct mfii_softc *sc, 
 	int8_t			ret;
 	mfii_direction_t dir = MFII_DATA_NONE;
 
-	switch(ba->ba_opcode) {
+	switch (ba->ba_opcode) {
 	case BIOC_SADISABLE:
 		opc = MR_DCMD_SPEAKER_DISABLE;
 		break;
@@ -3714,7 +3714,7 @@ mfii_bbu(struct mfii_softc *sc, envsys_d
 	}
 
 	status = le32toh(bbu.fw_status) & mask;
-	

CVS commit: src/sys/dev/pci

2022-05-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May  5 09:14:17 UTC 2022

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

Log Message:
Whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/mfii.c

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



CVS commit: src/share/man/man4

2022-05-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May  5 08:07:03 UTC 2022

Modified Files:
src/share/man/man4: mfi.4

Log Message:
Add some supported devices.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/share/man/man4/mfi.4

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



CVS commit: src/share/man/man4

2022-05-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May  5 08:07:03 UTC 2022

Modified Files:
src/share/man/man4: mfi.4

Log Message:
Add some supported devices.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/share/man/man4/mfi.4

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

Modified files:

Index: src/share/man/man4/mfi.4
diff -u src/share/man/man4/mfi.4:1.12 src/share/man/man4/mfi.4:1.13
--- src/share/man/man4/mfi.4:1.12	Mon Jul  3 21:30:58 2017
+++ src/share/man/man4/mfi.4	Thu May  5 08:07:03 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mfi.4,v 1.12 2017/07/03 21:30:58 wiz Exp $
+.\"	$NetBSD: mfi.4,v 1.13 2022/05/05 08:07:03 msaitoh Exp $
 .\"	$OpenBSD: mfi.4,v 1.7 2006/09/01 09:58:09 jmc Exp $
 .\"
 .\" Written by Marco Peereboom 
@@ -24,7 +24,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd March 22, 2012
+.Dd May 5, 2022
 .Dt MFI 4
 .Os
 .Sh NAME
@@ -43,7 +43,10 @@ including:
 Dell PERC 5/e,
 PERC 5/i,
 PERC 6/e,
-PERC 6/i
+PERC 6/i,
+PERC H310,
+PERC H700,
+PERC H800
 .It
 Intel RAID Controller SRCSAS18E,
 SRCSAS144E
@@ -56,9 +59,11 @@ MegaRAID SAS 8344ELP,
 MegaRAID SAS 8408E,
 MegaRAID SAS 8480E,
 MegaRAID SAS 8708ELP,
-MegaRAID SAS ELP,
 MegaRAID SAS 8880EM2,
-MegaRAID SAS 9260-8i
+MegaRAID SAS ELP,
+MegaRAID SAS 9260-8i,
+MegaRAID SAS 9261-8i,
+MegaRAID SAS 9265-8i
 .It
 IBM ServeRAID M1015,
 ServeRAID M5014



CVS commit: src/sys/dev

2022-05-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May  5 07:18:03 UTC 2022

Modified Files:
src/sys/dev/ic: mfi.c mfireg.h
src/sys/dev/pci: mfi_pci.c

Log Message:
Add some code for the SKINNY variant to make Dell PERC H310 work.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/ic/mfi.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/ic/mfireg.h
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/pci/mfi_pci.c

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

Modified files:

Index: src/sys/dev/ic/mfi.c
diff -u src/sys/dev/ic/mfi.c:1.68 src/sys/dev/ic/mfi.c:1.69
--- src/sys/dev/ic/mfi.c:1.68	Sat Apr 16 18:15:21 2022
+++ src/sys/dev/ic/mfi.c	Thu May  5 07:18:02 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: mfi.c,v 1.68 2022/04/16 18:15:21 andvar Exp $ */
+/* $NetBSD: mfi.c,v 1.69 2022/05/05 07:18:02 msaitoh Exp $ */
 /* $OpenBSD: mfi.c,v 1.66 2006/11/28 23:59:45 dlg Exp $ */
 
 /*
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.68 2022/04/16 18:15:21 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.69 2022/05/05 07:18:02 msaitoh Exp $");
 
 #include "bio.h"
 
@@ -582,7 +582,7 @@ mfi_transition_firmware(struct mfi_softc
 		case MFI_STATE_OPERATIONAL:
 			if (sc->sc_ioptype == MFI_IOP_SKINNY ||
 			sc->sc_ioptype == MFI_IOP_TBOLT)
-mfi_write(sc, MFI_SKINNY_IDB, MFI_INIT_READY);
+mfi_write(sc, MFI_SKINNY_IDB, MFI_RESET_FLAGS);
 			else
 mfi_write(sc, MFI_IDB, MFI_INIT_READY);
 			max_wait = 10;
@@ -1059,6 +1059,8 @@ mfi_attach(struct mfi_softc *sc, enum mf
 		sc->sc_max_sgl = max_sgl;
 		sc->sc_sgl_size = sizeof(struct mfi_sg32);
 	}
+	if (sc->sc_ioptype == MFI_IOP_SKINNY)
+		sc->sc_sgl_size = sizeof(struct mfi_sg_ieee);
 	DNPRINTF(MFI_D_MISC, "%s: max commands: %u, max sgl: %u\n",
 	DEVNAME(sc), sc->sc_max_cmds, sc->sc_max_sgl);
 
@@ -1779,7 +1781,8 @@ mfi_create_sgl(struct mfi_ccb *ccb, int 
 	sgl = ccb->ccb_sgl;
 	sgd = ccb->ccb_dmamap->dm_segs;
 	for (i = 0; i < ccb->ccb_dmamap->dm_nsegs; i++) {
-		if (sc->sc_ioptype == MFI_IOP_TBOLT &&
+		if (((sc->sc_ioptype == MFI_IOP_SKINNY) ||
+			(sc->sc_ioptype == MFI_IOP_TBOLT)) &&
 		(hdr->mfh_cmd == MFI_CMD_PD_SCSI_IO ||
 		 hdr->mfh_cmd == MFI_CMD_LD_READ ||
 		 hdr->mfh_cmd == MFI_CMD_LD_WRITE)) {

Index: src/sys/dev/ic/mfireg.h
diff -u src/sys/dev/ic/mfireg.h:1.14 src/sys/dev/ic/mfireg.h:1.15
--- src/sys/dev/ic/mfireg.h:1.14	Wed Mar 23 11:08:27 2022
+++ src/sys/dev/ic/mfireg.h	Thu May  5 07:18:02 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: mfireg.h,v 1.14 2022/03/23 11:08:27 andvar Exp $ */
+/* $NetBSD: mfireg.h,v 1.15 2022/05/05 07:18:02 msaitoh Exp $ */
 /* $OpenBSD: mfireg.h,v 1.24 2006/06/19 19:05:45 marco Exp $ */
 /*
  * Copyright (c) 2006 Marco Peereboom 
@@ -125,11 +125,12 @@
 #define MFI_STATE_TB_FAULT		0x4000
 
 /* command reset register */
-#define MFI_INIT_ABORT			0x
+#define MFI_INIT_ABORT			0x0001
 #define MFI_INIT_READY			0x0002
 #define MFI_INIT_MFIMODE		0x0004
 #define MFI_INIT_CLEAR_HANDSHAKE	0x0008
-#define MFI_RESET_FLAGS			MFI_INIT_READY|MFI_INIT_MFIMODE
+#define MFI_RESET_FLAGS			MFI_INIT_READY | MFI_INIT_MFIMODE | \
+	MFI_INIT_ABORT
 #define MFI_INIT_HOTPLUG		0x0010
 
 /* ADP reset flags */

Index: src/sys/dev/pci/mfi_pci.c
diff -u src/sys/dev/pci/mfi_pci.c:1.20 src/sys/dev/pci/mfi_pci.c:1.21
--- src/sys/dev/pci/mfi_pci.c:1.20	Sun Dec  9 11:14:02 2018
+++ src/sys/dev/pci/mfi_pci.c	Thu May  5 07:18:03 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: mfi_pci.c,v 1.20 2018/12/09 11:14:02 jdolecek Exp $ */
+/* $NetBSD: mfi_pci.c,v 1.21 2022/05/05 07:18:03 msaitoh Exp $ */
 /* $OpenBSD: mfi_pci.c,v 1.11 2006/08/06 04:40:08 brad Exp $ */
 /*
  * Copyright (c) 2006 Marco Peereboom 
@@ -17,7 +17,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mfi_pci.c,v 1.20 2018/12/09 11:14:02 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfi_pci.c,v 1.21 2022/05/05 07:18:03 msaitoh Exp $");
 
 #include 
 #include 
@@ -99,6 +99,7 @@ static const struct mfi_pci_subtype mfi_
 
 static const struct mfi_pci_subtype mfi_skinny_subtypes[] = {
 	{ PCI_VENDOR_IBM,	0x03b1,		"IBM ServeRAID M1015 SAS/SATA" },
+	{ PCI_VENDOR_DELL,	0x1f78,		"Dell PERC H310" },
 	{ 0x0,			0,		"" }
 };
 



CVS commit: src/sys/dev

2022-05-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu May  5 07:18:03 UTC 2022

Modified Files:
src/sys/dev/ic: mfi.c mfireg.h
src/sys/dev/pci: mfi_pci.c

Log Message:
Add some code for the SKINNY variant to make Dell PERC H310 work.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/ic/mfi.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/ic/mfireg.h
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/pci/mfi_pci.c

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



CVS commit: src/share/man/man4

2022-04-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Apr 28 07:17:52 UTC 2022

Modified Files:
src/share/man/man4: ddb.4

Log Message:
Add missing "show vmem[s]".


To generate a diff of this commit:
cvs rdiff -u -r1.201 -r1.202 src/share/man/man4/ddb.4

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

Modified files:

Index: src/share/man/man4/ddb.4
diff -u src/share/man/man4/ddb.4:1.201 src/share/man/man4/ddb.4:1.202
--- src/share/man/man4/ddb.4:1.201	Tue Jun 29 10:25:33 2021
+++ src/share/man/man4/ddb.4	Thu Apr 28 07:17:52 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ddb.4,v 1.201 2021/06/29 10:25:33 wiz Exp $
+.\"	$NetBSD: ddb.4,v 1.202 2022/04/28 07:17:52 msaitoh Exp $
 .\"
 .\" Copyright (c) 1997 - 2019 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -56,7 +56,7 @@
 .\" any improvements or extensions that they make and grant Carnegie Mellon
 .\" the rights to redistribute these changes.
 .\"
-.Dd June 20, 2021
+.Dd April 28, 2022
 .Dt DDB 4
 .Os
 .Sh NAME
@@ -816,6 +816,11 @@ of the kernel history options
 .Cd BIOHIST ,
 or
 .Cd UVMHIST .
+.It Ic show vmem Ar address
+Print the vmem at
+.Ar address .
+.It Ic show vmems
+Display all vmems.
 .It Ic show vnode Ns Oo Cm /f Oc Ar address
 Print the vnode at
 .Ar address .



CVS commit: src/share/man/man4

2022-04-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Apr 28 07:17:52 UTC 2022

Modified Files:
src/share/man/man4: ddb.4

Log Message:
Add missing "show vmem[s]".


To generate a diff of this commit:
cvs rdiff -u -r1.201 -r1.202 src/share/man/man4/ddb.4

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



CVS commit: src/sys/ddb

2022-04-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Apr 28 07:08:39 UTC 2022

Modified Files:
src/sys/ddb: db_command.c

Log Message:
Remove 'a' modifier from "show vmem". It was removed in sbur_vmem.c rev. 1.55.


To generate a diff of this commit:
cvs rdiff -u -r1.180 -r1.181 src/sys/ddb/db_command.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/ddb/db_command.c
diff -u src/sys/ddb/db_command.c:1.180 src/sys/ddb/db_command.c:1.181
--- src/sys/ddb/db_command.c:1.180	Wed Apr 20 19:06:35 2022
+++ src/sys/ddb/db_command.c	Thu Apr 28 07:08:38 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_command.c,v 1.180 2022/04/20 19:06:35 uwe Exp $	*/
+/*	$NetBSD: db_command.c,v 1.181 2022/04/28 07:08:38 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2009, 2019
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.180 2022/04/20 19:06:35 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.181 2022/04/28 07:08:38 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_aio.h"
@@ -320,7 +320,7 @@ static const struct db_command db_show_c
 	"Print a selection of UVM counters and statistics.",
 	NULL,NULL) },
 	{ DDB_ADD_CMD("vmem", db_vmem_print_cmd,	0,
-	"Print the vmem usage.", "[/a] address", NULL) },
+	"Print the vmem usage.", "address", NULL) },
 	{ DDB_ADD_CMD("vmems", db_show_all_vmems,	0,
 	"Show all vmems.", NULL, NULL) },
 	{ DDB_ADD_CMD("vnode",	db_vnode_print_cmd,	0,



CVS commit: src/sys/ddb

2022-04-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Apr 28 07:08:39 UTC 2022

Modified Files:
src/sys/ddb: db_command.c

Log Message:
Remove 'a' modifier from "show vmem". It was removed in sbur_vmem.c rev. 1.55.


To generate a diff of this commit:
cvs rdiff -u -r1.180 -r1.181 src/sys/ddb/db_command.c

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



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

2022-04-27 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Apr 27 06:59:26 UTC 2022

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

Log Message:
Rename for AMD F15/6X device. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/x86/pci/amdsmn.c

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

Modified files:

Index: src/sys/arch/x86/pci/amdsmn.c
diff -u src/sys/arch/x86/pci/amdsmn.c:1.12 src/sys/arch/x86/pci/amdsmn.c:1.13
--- src/sys/arch/x86/pci/amdsmn.c:1.12	Sat Aug  7 16:19:07 2021
+++ src/sys/arch/x86/pci/amdsmn.c	Wed Apr 27 06:59:25 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdsmn.c,v 1.12 2021/08/07 16:19:07 thorpej Exp $	*/
+/*	$NetBSD: amdsmn.c,v 1.13 2022/04/27 06:59:25 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2017, 2019 Conrad Meyer 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.12 2021/08/07 16:19:07 thorpej Exp $ ");
+__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.13 2022/04/27 06:59:25 msaitoh Exp $ ");
 
 /*
  * Driver for the AMD Family 15h (model 60+) and 17h CPU
@@ -73,7 +73,7 @@ static const struct pciid {
 	uint8_t		amdsmn_data_reg;
 } amdsmn_ids[] = {
 	{
-		.amdsmn_deviceid = PCI_PRODUCT_AMD_F15_60_RC,
+		.amdsmn_deviceid = PCI_PRODUCT_AMD_F15_6X_RC,
 		.amdsmn_addr_reg = F15H_SMN_ADDR_REG,
 		.amdsmn_data_reg = F15H_SMN_DATA_REG,
 	},



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

2022-04-27 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Apr 27 06:59:26 UTC 2022

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

Log Message:
Rename for AMD F15/6X device. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/x86/pci/amdsmn.c

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



CVS commit: src/sys/dev/pci

2022-04-27 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Apr 27 06:58:17 UTC 2022

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.1436 -r1.1437 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1435 -r1.1436 src/sys/dev/pci/pcidevs_data.h

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

diffs are larger than 1MB and have been omitted


CVS commit: src/sys/dev/pci

2022-04-27 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Apr 27 06:58:17 UTC 2022

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.1436 -r1.1437 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1435 -r1.1436 src/sys/dev/pci/pcidevs_data.h

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



CVS commit: src/sys/dev/pci

2022-04-27 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Apr 27 06:57:48 UTC 2022

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Update some AMD devices:

 - Rename AMD 15h/6xh devices.
 - Add some devices.
 - Use OHCI for OHCI device.
 - Use EHCI for EHCI device.
 - and some minor changes.


To generate a diff of this commit:
cvs rdiff -u -r1.1453 -r1.1454 src/sys/dev/pci/pcidevs

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/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1453 src/sys/dev/pci/pcidevs:1.1454
--- src/sys/dev/pci/pcidevs:1.1453	Fri Apr 22 07:34:55 2022
+++ src/sys/dev/pci/pcidevs	Wed Apr 27 06:57:48 2022
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1453 2022/04/22 07:34:55 skrll Exp $
+$NetBSD: pcidevs,v 1.1454 2022/04/27 06:57:48 msaitoh Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -1071,18 +1071,19 @@ product AMD F16_HB		0x1538	Family16h Hos
 product AMD F16_30_RC		0x1566	Family16h Root Complex
 product AMD F16_30_IOMMU	0x1567	Family16h IOMMU
 product AMD F16_30_HB		0x156b	Family16h Host Bridge
-product AMD F15_60_PF_0		0x1570	Family15h Processor Function 0
-product AMD F15_60_PF_1		0x1571	Family15h Processor Function 1
-product AMD F15_60_PF_2		0x1572	Family15h Processor Function 2
-product AMD F15_60_PF_3		0x1573	Family15h Processor Function 3
-product AMD F15_60_PF_4		0x1574	Family15h Processor Function 4
-product AMD F15_60_PF_5		0x1575	Family15h Processor Function 5
-product AMD F15_60_RC		0x1576	Family15h Root Complex
-product AMD F15_60_IOMMU	0x1577	Family15h IOMMU
-product AMD F15_60_PSP		0x1578	Family15h PSP
-product AMD F15_60_AC		0x157a	Family15h Audio Controller
-product AMD F15_60_HB		0x157b	Family15h Host Bridge
-product AMD F15_60_RP		0x157c	Family15h Root Port
+product AMD F15_6X_PF_0		0x1570	15h/6xh Processor Function 0
+product AMD F15_6X_PF_1		0x1571	15h/6xh Processor Function 1
+product AMD F15_6X_PF_2		0x1572	15h/6xh Processor Function 2
+product AMD F15_6X_PF_3		0x1573	15h/6xh Processor Function 3
+product AMD F15_6X_PF_4		0x1574	15h/6xh Processor Function 4
+product AMD F15_6X_PF_5		0x1575	15h/6xh Processor Function 5
+product AMD F15_6X_RC		0x1576	15h/6xh Root Complex
+product AMD F15_6X_IOMMU	0x1577	15h/6xh IOMMU
+product AMD F15_6X_PSP		0x1578	15h/6xh PSP
+product AMD F15_6X_HDA		0x157a	15h/6xh Audio Controller
+product AMD F15_6X_HB		0x157b	15h/6xh Host Bridge
+product AMD F15_6X_RP		0x157c	15h/6xh Root Port
+product AMD F15_6X_HB_2		0x157d	15h/6xh Host Bridge
 product AMD F16_30_HT		0x1580	Family16h HyperTransport Configuration
 product AMD F16_30_ADDR		0x1581	Family16h Address Map Configuration
 product AMD F16_30_DRAM		0x1582	Family16h DRAM Configuration
@@ -1101,9 +1102,10 @@ product AMD F17_1X_PCIE_1	0x15d3	Family1
 product AMD F17_1X_PCIE_2	0x15db	Family17h/1xh PCIe
 product AMD F17_1X_PCIE_3	0x15dc	Family17h/1xh PCIe
 product AMD F17_1X_PSP		0x15df	Family17h/1xh Platform Security Processor
-product AMD F17_1X_XHCI_1	0x15e0	Family17h/1xh xHCI
-product AMD F17_1X_XHCI_2	0x15e1	Family17h/1xh xHCI
-product AMD F17_1X_HDAUDIO	0x15e3	Family17h/1xh HD Audio Controller
+product AMD F17_1X_XHCI_1	0x15e0	Family17h/1xh USB 3.1 xHCI
+product AMD F17_1X_XHCI_2	0x15e1	Family17h/1xh USB 3.1 xHCI
+product AMD F17_1X_ACP		0x15e2	17h/1xh I2S Audio
+product AMD F17_1X_HDA		0x15e3	Family17h/1xh HD Audio Controller
 product AMD F17_1X_DF_0		0x15e8	Family17h/1xh Data Fabric
 product AMD F17_1X_DF_1		0x15e9	Family17h/1xh Data Fabric
 product AMD F17_1X_DF_2		0x15ea	Family17h/1xh Data Fabric
@@ -1207,7 +1209,7 @@ product AMD PBC756_USB		0x740c	AMD756 US
 product AMD PBC766_ISA		0x7410	AMD766 South Bridge
 product AMD PBC766_IDE		0x7411	AMD766 IDE Controller
 product AMD PBC766_PMC		0x7413	AMD766 Power Management Controller
-product AMD PBC766_USB		0x7414	AMD766 USB Host Controller
+product AMD PBC766_OHCI		0x7414	AMD766 USB OHCI
 product AMD PBC768_ISA		0x7440	AMD768 PCI-ISA/LPC Bridge
 product AMD PBC768_IDE		0x7441	AMD768 EIDE Controller
 product AMD PBC768_PMC		0x7443	AMD768 Power Management Controller
@@ -1252,15 +1254,17 @@ product AMD HUDSON_XHCI		0x7812	Hudson U
 product AMD FCH_SDHC		0x7813	FCH SD Flash Controller
 product AMD FCH_XHCI		0x7814	FCH USB xHCI Controller
 product AMD KERNCZ_SATA_1	0x7900	FCH SATA
-product AMD KERNCZ_AHCI_1	0x7901	FCH AHCI
+product AMD KERNCZ_AHCI_1	0x7901	FCH SATA AHCI
 product AMD KERNCZ_RAID_1	0x7902	FCH RAID
 product AMD KERNCZ_RAID_2	0x7903	FCH RAID
-product AMD KERNCZ_AHCI_2	0x7904	FCH AHCI
+product AMD KERNCZ_AHCI_2	0x7904	FCH SATA AHCI
 product AMD KERNCZ_SD		0x7906	FCH SD
-product AMD KERNCZ_EHCI		0x7908	FCH USB2
+product AMD KERNCZ_EHCI		0x7908	FCH EHCI
 product AMD KERNCZ_SMB		0x790b	X370/X399 SMBus Controller
 product AMD KERNCZ_LPC		0x790e	FCH LPC
 product AMD KERNCZ_XHCI		0x7914	FCH xHCI
+product AMD KERNCZ_AHCI_RAID_1	0x7916	FCH SATA AHCI RAID
+product AMD KERNCZ_AHCI_RAID_2	0x7917	FCH 

CVS commit: src/sys/dev/pci

2022-04-27 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Apr 27 06:57:48 UTC 2022

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Update some AMD devices:

 - Rename AMD 15h/6xh devices.
 - Add some devices.
 - Use OHCI for OHCI device.
 - Use EHCI for EHCI device.
 - and some minor changes.


To generate a diff of this commit:
cvs rdiff -u -r1.1453 -r1.1454 src/sys/dev/pci/pcidevs

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

2022-04-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Apr 26 05:29:15 UTC 2022

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

Log Message:
Fix typo. No funcitonal change.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/arch/x86/x86/lapic.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/lapic.c
diff -u src/sys/arch/x86/x86/lapic.c:1.86 src/sys/arch/x86/x86/lapic.c:1.87
--- src/sys/arch/x86/x86/lapic.c:1.86	Thu Oct  7 12:52:27 2021
+++ src/sys/arch/x86/x86/lapic.c	Tue Apr 26 05:29:15 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: lapic.c,v 1.86 2021/10/07 12:52:27 msaitoh Exp $	*/
+/*	$NetBSD: lapic.c,v 1.87 2022/04/26 05:29:15 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2008, 2020 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lapic.c,v 1.86 2021/10/07 12:52:27 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lapic.c,v 1.87 2022/04/26 05:29:15 msaitoh Exp $");
 
 #include "acpica.h"
 #include "ioapic.h"
@@ -1007,7 +1007,7 @@ lapic_dump(void)
 	APIC_LVT_PRINT(ci, "lint", 1, LAPIC_LVT_LINT1);
 	APIC_LVT_PRINT(ci, "err", 0, LAPIC_LVT_ERR);
 
-#undef APIC_LVT_PRIINT
+#undef APIC_LVT_PRINT
 }
 #else /* XENPV */
 void



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

2022-04-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Apr 26 05:29:15 UTC 2022

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

Log Message:
Fix typo. No funcitonal change.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/arch/x86/x86/lapic.c

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



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

2022-04-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Apr 25 07:57:23 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe: ixv.c

Log Message:
Add missing num_{tx,rx}_desc sysctl to sync with ixgbe.c.


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/sys/dev/pci/ixgbe/ixv.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/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.179 src/sys/dev/pci/ixgbe/ixv.c:1.180
--- src/sys/dev/pci/ixgbe/ixv.c:1.179	Mon Apr 25 07:54:42 2022
+++ src/sys/dev/pci/ixgbe/ixv.c	Mon Apr 25 07:57:23 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixv.c,v 1.179 2022/04/25 07:54:42 msaitoh Exp $ */
+/* $NetBSD: ixv.c,v 1.180 2022/04/25 07:57:23 msaitoh Exp $ */
 
 /**
 
@@ -35,7 +35,7 @@
 /*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 331224 2018-03-19 20:55:05Z erj $*/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.179 2022/04/25 07:54:42 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.180 2022/04/25 07:57:23 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2563,6 +2563,18 @@ ixv_add_device_sysctls(struct adapter *a
 		aprint_error_dev(dev, "could not create sysctl\n");
 
 	if (sysctl_createv(log, 0, , ,
+	CTLFLAG_READONLY, CTLTYPE_INT,
+	"num_tx_desc", SYSCTL_DESCR("Number of TX descriptors"),
+	NULL, 0, >num_tx_desc, 0, CTL_CREATE, CTL_EOL) != 0)
+		aprint_error_dev(dev, "could not create sysctl\n");
+
+	if (sysctl_createv(log, 0, , ,
+	CTLFLAG_READONLY, CTLTYPE_INT,
+	"num_rx_desc", SYSCTL_DESCR("Number of RX descriptors"),
+	NULL, 0, >num_rx_desc, 0, CTL_CREATE, CTL_EOL) != 0)
+		aprint_error_dev(dev, "could not create sysctl\n");
+
+	if (sysctl_createv(log, 0, , ,
 	CTLFLAG_READWRITE, CTLTYPE_INT, "rx_process_limit",
 	SYSCTL_DESCR("max number of RX packets to process"),
 	ixv_sysctl_rx_process_limit, 0, (void *)adapter, 0, CTL_CREATE,



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

2022-04-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Apr 25 07:57:23 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe: ixv.c

Log Message:
Add missing num_{tx,rx}_desc sysctl to sync with ixgbe.c.


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/sys/dev/pci/ixgbe/ixv.c

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



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

2022-04-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Apr 25 07:56:47 UTC 2022

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

Log Message:
Add missing num_tx_desc sysctl.


To generate a diff of this commit:
cvs rdiff -u -r1.313 -r1.314 src/sys/dev/pci/ixgbe/ixgbe.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/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.313 src/sys/dev/pci/ixgbe/ixgbe.c:1.314
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.313	Mon Apr 25 07:54:42 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Mon Apr 25 07:56:47 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.313 2022/04/25 07:54:42 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.314 2022/04/25 07:56:47 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.313 2022/04/25 07:54:42 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.314 2022/04/25 07:56:47 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -3430,7 +3430,13 @@ ixgbe_add_device_sysctls(struct adapter 
 
 	if (sysctl_createv(log, 0, , ,
 	CTLFLAG_READONLY, CTLTYPE_INT,
-	"num_rx_desc", SYSCTL_DESCR("Number of rx descriptors"),
+	"num_tx_desc", SYSCTL_DESCR("Number of TX descriptors"),
+	NULL, 0, >num_tx_desc, 0, CTL_CREATE, CTL_EOL) != 0)
+		aprint_error_dev(dev, "could not create sysctl\n");
+
+	if (sysctl_createv(log, 0, , ,
+	CTLFLAG_READONLY, CTLTYPE_INT,
+	"num_rx_desc", SYSCTL_DESCR("Number of RX descriptors"),
 	NULL, 0, >num_rx_desc, 0, CTL_CREATE, CTL_EOL) != 0)
 		aprint_error_dev(dev, "could not create sysctl\n");
 



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

2022-04-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Apr 25 07:56:47 UTC 2022

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

Log Message:
Add missing num_tx_desc sysctl.


To generate a diff of this commit:
cvs rdiff -u -r1.313 -r1.314 src/sys/dev/pci/ixgbe/ixgbe.c

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



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

2022-04-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Apr 25 07:54:43 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c ixv.c

Log Message:
Limit {tx,rx}_process_limit sysctl values from 1 to num_{tx,rx}_desc.


To generate a diff of this commit:
cvs rdiff -u -r1.312 -r1.313 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.178 -r1.179 src/sys/dev/pci/ixgbe/ixv.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/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.312 src/sys/dev/pci/ixgbe/ixgbe.c:1.313
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.312	Thu Mar 10 04:14:34 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Mon Apr 25 07:54:42 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.312 2022/03/10 04:14:34 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.313 2022/04/25 07:54:42 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.312 2022/03/10 04:14:34 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.313 2022/04/25 07:54:42 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -238,8 +238,6 @@ static int	ixgbe_set_advertise(struct ad
 static int	ixgbe_get_default_advertise(struct adapter *);
 
 /* Sysctl handlers */
-static void	ixgbe_set_sysctl_value(struct adapter *, const char *,
-		 const char *, int *, int);
 static int	ixgbe_sysctl_flowcntl(SYSCTLFN_PROTO);
 static int	ixgbe_sysctl_advertise(SYSCTLFN_PROTO);
 static int	ixgbe_sysctl_interrupt_rate_handler(SYSCTLFN_PROTO);
@@ -259,6 +257,8 @@ static int	ixgbe_sysctl_tdh_handler(SYSC
 static int	ixgbe_sysctl_eee_state(SYSCTLFN_PROTO);
 static int	ixgbe_sysctl_debug(SYSCTLFN_PROTO);
 static int	ixgbe_sysctl_rx_copy_len(SYSCTLFN_PROTO);
+static int	ixgbe_sysctl_tx_process_limit(SYSCTLFN_PROTO);
+static int	ixgbe_sysctl_rx_process_limit(SYSCTLFN_PROTO);
 static int	ixgbe_sysctl_wol_enable(SYSCTLFN_PROTO);
 static int	ixgbe_sysctl_wufc(SYSCTLFN_PROTO);
 
@@ -963,15 +963,6 @@ ixgbe_attach(device_t parent, device_t d
 	/* Set an initial default flow control value */
 	hw->fc.requested_mode = ixgbe_flow_control;
 
-	/* Sysctls for limiting the amount of work done in the taskqueues */
-	ixgbe_set_sysctl_value(adapter, "rx_processing_limit",
-	"max number of rx packets to process",
-	>rx_process_limit, ixgbe_rx_process_limit);
-
-	ixgbe_set_sysctl_value(adapter, "tx_processing_limit",
-	"max number of tx packets to process",
-	>tx_process_limit, ixgbe_tx_process_limit);
-
 	/* Do descriptor calc and sanity checks */
 	if (((ixgbe_txd * sizeof(union ixgbe_adv_tx_desc)) % DBA_ALIGN) != 0 ||
 	ixgbe_txd < MIN_TXD || ixgbe_txd > MAX_TXD) {
@@ -987,6 +978,14 @@ ixgbe_attach(device_t parent, device_t d
 	} else
 		adapter->num_rx_desc = ixgbe_rxd;
 
+	/* Sysctls for limiting the amount of work done in the taskqueues */
+	adapter->rx_process_limit
+	= (ixgbe_rx_process_limit <= adapter->num_rx_desc)
+	? ixgbe_rx_process_limit : adapter->num_rx_desc;
+	adapter->tx_process_limit
+	= (ixgbe_tx_process_limit <= adapter->num_tx_desc)
+	? ixgbe_tx_process_limit : adapter->num_tx_desc;
+
 	/* Set default high limit of copying mbuf in rxeof */
 	adapter->rx_copy_len = IXGBE_RX_COPY_LEN_MAX;
 
@@ -3436,6 +3435,20 @@ ixgbe_add_device_sysctls(struct adapter 
 		aprint_error_dev(dev, "could not create sysctl\n");
 
 	if (sysctl_createv(log, 0, , ,
+	CTLFLAG_READWRITE, CTLTYPE_INT, "rx_process_limit",
+	SYSCTL_DESCR("max number of RX packets to process"),
+	ixgbe_sysctl_rx_process_limit, 0, (void *)adapter, 0, CTL_CREATE,
+	CTL_EOL) != 0)
+		aprint_error_dev(dev, "could not create sysctl\n");
+
+	if (sysctl_createv(log, 0, , ,
+	CTLFLAG_READWRITE, CTLTYPE_INT, "tx_process_limit",
+	SYSCTL_DESCR("max number of TX packets to process"),
+	ixgbe_sysctl_tx_process_limit, 0, (void *)adapter, 0, CTL_CREATE,
+	CTL_EOL) != 0)
+		aprint_error_dev(dev, "could not create sysctl\n");
+
+	if (sysctl_createv(log, 0, , ,
 	CTLFLAG_READONLY, CTLTYPE_INT,
 	"num_queues", SYSCTL_DESCR("Number of queues"),
 	NULL, 0, >num_queues, 0, CTL_CREATE, CTL_EOL) != 0)
@@ -5381,35 +5394,6 @@ ixgbe_free_pci_resources(struct adapter 
 } /* ixgbe_free_pci_resources */
 
 /
- * ixgbe_set_sysctl_value
- /
-static void
-ixgbe_set_sysctl_value(struct adapter *adapter, const char *name,
-const char *description, int *limit, int value)
-{
-	device_t dev =	adapter->dev;
-	struct sysctllog **log;
-	const struct sysctlnode *rnode, *cnode;
-
-	/*
-	 * It's not required to check recovery mode because this function never
-	 * touches hardware.
-	 */
-
-	log = >sysctllog;
-	if ((rnode = ixgbe_sysctl_instance(adapter)) == NULL) {
-		aprint_error_dev(dev, 

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

2022-04-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Apr 25 07:54:43 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c ixv.c

Log Message:
Limit {tx,rx}_process_limit sysctl values from 1 to num_{tx,rx}_desc.


To generate a diff of this commit:
cvs rdiff -u -r1.312 -r1.313 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.178 -r1.179 src/sys/dev/pci/ixgbe/ixv.c

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



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

2022-04-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Apr 25 07:51:12 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c

Log Message:
Use cached rx_copy_len in ixgbe_rxeof().


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/dev/pci/ixgbe/ix_txrx.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/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.96 src/sys/dev/pci/ixgbe/ix_txrx.c:1.97
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.96	Mon Apr 25 07:48:53 2022
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Mon Apr 25 07:51:12 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.96 2022/04/25 07:48:53 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.97 2022/04/25 07:51:12 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.96 2022/04/25 07:48:53 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.97 2022/04/25 07:51:12 msaitoh Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -1806,6 +1806,7 @@ ixgbe_rxeof(struct ix_queue *que)
 	u32			staterr = 0;
 	u32			loopcount = 0, numdesc;
 	u32			limit = adapter->rx_process_limit;
+	u32			rx_copy_len = adapter->rx_copy_len;
 	bool			discard_multidesc = rxr->discard_multidesc;
 	bool			wraparound = false;
 	unsigned int		syncremain;
@@ -1916,7 +1917,7 @@ ixgbe_rxeof(struct ix_queue *que)
 			/* Pre-alloc new mbuf. */
 
 			if ((rbuf->fmp == NULL) &&
-			eop && (len <= adapter->rx_copy_len)) {
+			eop && (len <= rx_copy_len)) {
 /* For short packet. See below. */
 sendmp = m_gethdr(M_NOWAIT, MT_DATA);
 if (__predict_false(sendmp == NULL)) {
@@ -2022,7 +2023,7 @@ ixgbe_rxeof(struct ix_queue *que)
 			 * packet.
 			 */
 
-			if (eop && (len <= adapter->rx_copy_len)) {
+			if (eop && (len <= rx_copy_len)) {
 /*
  * Optimize.  This might be a small packet, may
  * be just a TCP ACK. Copy into a new mbuf, and



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

2022-04-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Apr 25 07:51:12 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c

Log Message:
Use cached rx_copy_len in ixgbe_rxeof().


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/dev/pci/ixgbe/ix_txrx.c

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



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

2022-04-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Apr 25 07:48:53 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c

Log Message:
Modify comment for consistency. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/dev/pci/ixgbe/ix_txrx.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/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.95 src/sys/dev/pci/ixgbe/ix_txrx.c:1.96
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.95	Tue Jan 25 01:56:22 2022
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Mon Apr 25 07:48:53 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.95 2022/01/25 01:56:22 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.96 2022/04/25 07:48:53 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.95 2022/01/25 01:56:22 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.96 2022/04/25 07:48:53 msaitoh Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -2034,7 +2034,7 @@ ixgbe_rxeof(struct ix_queue *que)
 IXGBE_EVC_ADD(>rx_copies, 1);
 rbuf->flags |= IXGBE_RX_COPY;
 			} else {
-/* Non short packet */
+/* For long packet */
 
 /* Update new (used in future) mbuf */
 newmp->m_pkthdr.len = newmp->m_len



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

2022-04-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Apr 25 07:48:53 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c

Log Message:
Modify comment for consistency. No functional change.


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

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



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

2022-03-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Mar 10 04:14:34 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c ixgbe.h

Log Message:
Print ECC, PHY and temp error log using with ratecheck().

 - The ratecheck() is for just in case. All of the interrupts might occur
   only once, but I don't know whether it's true or not. For the fan failure,
   it seems it occurs only once.
 - All of the interval is 60s.


To generate a diff of this commit:
cvs rdiff -u -r1.311 -r1.312 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.84 -r1.85 src/sys/dev/pci/ixgbe/ixgbe.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/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.311 src/sys/dev/pci/ixgbe/ixgbe.c:1.312
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.311	Thu Mar 10 04:00:32 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Mar 10 04:14:34 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.311 2022/03/10 04:00:32 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.312 2022/03/10 04:14:34 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.311 2022/03/10 04:00:32 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.312 2022/03/10 04:14:34 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -424,6 +424,9 @@ static int (*ixgbe_ring_empty)(struct if
 #endif
 #define IXGBE_WORKQUEUE_PRI PRI_SOFTNET
 
+/* Interval between reports of errors */
+static const struct timeval ixgbe_errlog_intrvl = { 60, 0 };	/* 60s */
+
 /
  * ixgbe_initialize_rss_mapping
  /
@@ -3230,10 +3233,10 @@ ixgbe_intr_admin_common(struct adapter *
 #endif
 
 		if (eicr & IXGBE_EICR_ECC) {
-			device_printf(adapter->dev,
-			"CRITICAL: ECC ERROR!! Please Reboot!!\n");
-			/* Disable interrupt to prevent log spam */
-			*eims_disable |= IXGBE_EICR_ECC;
+			if (ratecheck(>lasterr_time,
+			_errlog_intrvl))
+device_printf(adapter->dev,
+"CRITICAL: ECC ERROR!! Please Reboot!!\n");
 		}
 
 		/* Check for over temp condition */
@@ -3242,32 +3245,32 @@ ixgbe_intr_admin_common(struct adapter *
 			case ixgbe_mac_X550EM_a:
 if (!(eicr & IXGBE_EICR_GPI_SDP0_X550EM_a))
 	break;
-/* Disable interrupt to prevent log spam */
-*eims_disable |= IXGBE_EICR_GPI_SDP0_X550EM_a;
-
 retval = hw->phy.ops.check_overtemp(hw);
 if (retval != IXGBE_ERR_OVERTEMP)
 	break;
-device_printf(adapter->dev,
-"CRITICAL: OVER TEMP!! "
-"PHY IS SHUT DOWN!!\n");
-device_printf(adapter->dev,
-"System shutdown required!\n");
+if (ratecheck(>lasterr_time,
+_errlog_intrvl)) {
+	device_printf(adapter->dev,
+	"CRITICAL: OVER TEMP!! "
+	"PHY IS SHUT DOWN!!\n");
+	device_printf(adapter->dev,
+	"System shutdown required!\n");
+}
 break;
 			default:
 if (!(eicr & IXGBE_EICR_TS))
 	break;
-/* Disable interrupt to prevent log spam */
-*eims_disable |= IXGBE_EIMS_TS;
-
 retval = hw->phy.ops.check_overtemp(hw);
 if (retval != IXGBE_ERR_OVERTEMP)
 	break;
-device_printf(adapter->dev,
-"CRITICAL: OVER TEMP!! "
-"PHY IS SHUT DOWN!!\n");
-device_printf(adapter->dev,
-"System shutdown required!\n");
+if (ratecheck(>lasterr_time,
+_errlog_intrvl)) {
+	device_printf(adapter->dev,
+	"CRITICAL: OVER TEMP!! "
+	"PHY IS SHUT DOWN!!\n");
+	device_printf(adapter->dev,
+	"System shutdown required!\n");
+}
 break;
 			}
 		}
@@ -3281,13 +3284,8 @@ ixgbe_intr_admin_common(struct adapter *
 	}
 
 	/* Check for fan failure */
-	if (adapter->feat_en & IXGBE_FEATURE_FAN_FAIL) {
-		retval = ixgbe_check_fan_failure(adapter, eicr, true);
-		if (retval == IXGBE_ERR_FAN_FAILURE) {
-			/* Disable interrupt to prevent log spam */
-			*eims_disable |= IXGBE_EIMS_GPI_SDP1_BY_MAC(hw);
-		}
-	}
+	if (adapter->feat_en & IXGBE_FEATURE_FAN_FAIL)
+		ixgbe_check_fan_failure(adapter, eicr, true);
 
 	/* External PHY interrupt */
 	if ((hw->phy.type == ixgbe_phy_x550em_ext_t) &&
@@ -6609,13 +6607,20 @@ ixgbe_check_fan_failure(struct adapter *
 	mask = (in_interrupt) ? IXGBE_EICR_GPI_SDP1_BY_MAC(>hw) :
 	IXGBE_ESDP_SDP1;
 
-	if (reg & mask) {
+	if ((reg & mask) == 0)
+		return IXGBE_SUCCESS;
+
+	/*
+	 * Use ratecheck() just in case interrupt occur frequently.
+	 * When EXPX9501AT's fan stopped, interrupt occurred only once,
+	 * an red LED on the board turned on and link never up until
+	 * power off.
+	 */
+	if (ratecheck(>lasterr_time, _errlog_intrvl))
 		device_printf(adapter->dev,
 		"\nCRITICAL: FAN FAILURE!! REPLACE IMMEDIATELY!!\n");
-		return IXGBE_ERR_FAN_FAILURE;
-	}
 
-	return IXGBE_SUCCESS;
+	

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

2022-03-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Mar 10 04:14:34 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c ixgbe.h

Log Message:
Print ECC, PHY and temp error log using with ratecheck().

 - The ratecheck() is for just in case. All of the interrupts might occur
   only once, but I don't know whether it's true or not. For the fan failure,
   it seems it occurs only once.
 - All of the interval is 60s.


To generate a diff of this commit:
cvs rdiff -u -r1.311 -r1.312 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.84 -r1.85 src/sys/dev/pci/ixgbe/ixgbe.h

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



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

2022-03-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Mar 10 04:00:32 UTC 2022

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

Log Message:
 Enclose flow director stuff in ixgbe_intr_admin_common() with IXGBE_FIR.


To generate a diff of this commit:
cvs rdiff -u -r1.310 -r1.311 src/sys/dev/pci/ixgbe/ixgbe.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/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.310 src/sys/dev/pci/ixgbe/ixgbe.c:1.311
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.310	Thu Mar 10 03:58:52 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Mar 10 04:00:32 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.310 2022/03/10 03:58:52 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.311 2022/03/10 04:00:32 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.310 2022/03/10 03:58:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.311 2022/03/10 04:00:32 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -3218,6 +3218,7 @@ ixgbe_intr_admin_common(struct adapter *
 	}
 
 	if (adapter->hw.mac.type != ixgbe_mac_82598EB) {
+#ifdef IXGBE_FDIR
 		if ((adapter->feat_en & IXGBE_FEATURE_FDIR) &&
 		(eicr & IXGBE_EICR_FLOW_DIR)) {
 			if (!atomic_cas_uint(>fdir_reinit, 0, 1)) {
@@ -3226,6 +3227,7 @@ ixgbe_intr_admin_common(struct adapter *
 *eims_disable |= IXGBE_EIMS_FLOW_DIR;
 			}
 		}
+#endif
 
 		if (eicr & IXGBE_EICR_ECC) {
 			device_printf(adapter->dev,



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

2022-03-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Mar 10 04:00:32 UTC 2022

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

Log Message:
 Enclose flow director stuff in ixgbe_intr_admin_common() with IXGBE_FIR.


To generate a diff of this commit:
cvs rdiff -u -r1.310 -r1.311 src/sys/dev/pci/ixgbe/ixgbe.c

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



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

2022-03-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Mar 10 03:58:52 UTC 2022

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

Log Message:
 Move the definition of eicr_mask variable. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.309 -r1.310 src/sys/dev/pci/ixgbe/ixgbe.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/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.309 src/sys/dev/pci/ixgbe/ixgbe.c:1.310
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.309	Thu Mar 10 03:57:33 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Mar 10 03:58:52 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.309 2022/03/10 03:57:33 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.310 2022/03/10 03:58:52 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.309 2022/03/10 03:57:33 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.310 2022/03/10 03:58:52 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -3179,7 +3179,6 @@ static void
 ixgbe_intr_admin_common(struct adapter *adapter, u32 eicr, u32 *eims_disable)
 {
 	struct ixgbe_hw *hw = >hw;
-	u32		eicr_mask;
 	u32		task_requests = 0;
 	s32		retval;
 
@@ -3190,6 +3189,8 @@ ixgbe_intr_admin_common(struct adapter *
 	}
 
 	if (ixgbe_is_sfp(hw)) {
+		u32 eicr_mask;
+
 		/* Pluggable optics-related interrupt */
 		if (hw->mac.type >= ixgbe_mac_X540)
 			eicr_mask = IXGBE_EICR_GPI_SDP0_X540;



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

2022-03-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Mar 10 03:58:52 UTC 2022

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

Log Message:
 Move the definition of eicr_mask variable. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.309 -r1.310 src/sys/dev/pci/ixgbe/ixgbe.c

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



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

2022-03-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Mar 10 03:57:33 UTC 2022

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

Log Message:
 Modify comment to clarify EIAC setting.


To generate a diff of this commit:
cvs rdiff -u -r1.308 -r1.309 src/sys/dev/pci/ixgbe/ixgbe.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/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.308 src/sys/dev/pci/ixgbe/ixgbe.c:1.309
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.308	Thu Mar 10 03:53:46 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Mar 10 03:57:33 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.308 2022/03/10 03:53:46 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.309 2022/03/10 03:57:33 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.308 2022/03/10 03:53:46 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.309 2022/03/10 03:57:33 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -5194,8 +5194,9 @@ ixgbe_enable_intr(struct adapter *adapte
 	/* With MSI-X we use auto clear */
 	if (adapter->msix_mem) {
 		/*
-		 * It's not required to set TCP_TIMER because we don't use
-		 * it.
+		 * We use auto clear for RTX_QUEUE only. Don't use other
+		 * interrupts (e.g. link interrupt). BTW, we don't use
+		 *  TCP_TIMER interrupt itself.
 		 */
 		IXGBE_WRITE_REG(hw, IXGBE_EIAC, IXGBE_EIMS_RTX_QUEUE);
 	}



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

2022-03-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Mar 10 03:57:33 UTC 2022

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

Log Message:
 Modify comment to clarify EIAC setting.


To generate a diff of this commit:
cvs rdiff -u -r1.308 -r1.309 src/sys/dev/pci/ixgbe/ixgbe.c

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



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

2022-03-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Mar 10 03:53:46 UTC 2022

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

Log Message:
Add IFF_RUNNING check in ixgbe_legacy_irq() again.

 - This change might fix small race between ifconfig down and an interrupt.
   If the race really exists, txeof() is called and it's not so dangerous.
   The rxeof is blocked in the beginning of ixgbe_handle_que().
 - This change makes consistent with ixgbe_handle_que().
 - Found and OK'd by knakahara.


To generate a diff of this commit:
cvs rdiff -u -r1.307 -r1.308 src/sys/dev/pci/ixgbe/ixgbe.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/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.307 src/sys/dev/pci/ixgbe/ixgbe.c:1.308
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.307	Wed Feb 16 10:29:13 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Mar 10 03:53:46 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.307 2022/02/16 10:29:13 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.308 2022/03/10 03:53:46 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.307 2022/02/16 10:29:13 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.308 2022/03/10 03:53:46 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -5262,6 +5262,7 @@ ixgbe_legacy_irq(void *arg)
 	struct ix_queue *que = arg;
 	struct adapter	*adapter = que->adapter;
 	struct ixgbe_hw	*hw = >hw;
+	struct ifnet	*ifp = adapter->ifp;
 	struct		tx_ring *txr = adapter->tx_rings;
 	u32		eicr;
 	u32		eims_orig;
@@ -5286,7 +5287,8 @@ ixgbe_legacy_irq(void *arg)
 	IXGBE_EVC_ADD(>stats.pf.legint, 1);
 
 	/* Queue (0) intr */
-	if ((eicr & IXGBE_EIMC_RTX_QUEUE) != 0) {
+	if (((ifp->if_flags & IFF_RUNNING) != 0) &&
+	(eicr & IXGBE_EIMC_RTX_QUEUE) != 0) {
 		IXGBE_EVC_ADD(>irqs, 1);
 
 		/*



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

2022-03-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Mar 10 03:53:46 UTC 2022

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

Log Message:
Add IFF_RUNNING check in ixgbe_legacy_irq() again.

 - This change might fix small race between ifconfig down and an interrupt.
   If the race really exists, txeof() is called and it's not so dangerous.
   The rxeof is blocked in the beginning of ixgbe_handle_que().
 - This change makes consistent with ixgbe_handle_que().
 - Found and OK'd by knakahara.


To generate a diff of this commit:
cvs rdiff -u -r1.307 -r1.308 src/sys/dev/pci/ixgbe/ixgbe.c

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



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

2022-02-16 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 16 10:29:13 UTC 2022

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

Log Message:
Print Printed Board Assembly (PBA) number.


To generate a diff of this commit:
cvs rdiff -u -r1.306 -r1.307 src/sys/dev/pci/ixgbe/ixgbe.c

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



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

2022-02-16 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 16 10:29:13 UTC 2022

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

Log Message:
Print Printed Board Assembly (PBA) number.


To generate a diff of this commit:
cvs rdiff -u -r1.306 -r1.307 src/sys/dev/pci/ixgbe/ixgbe.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/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.306 src/sys/dev/pci/ixgbe/ixgbe.c:1.307
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.306	Tue Feb  1 04:59:16 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Wed Feb 16 10:29:13 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.306 2022/02/01 04:59:16 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.307 2022/02/16 10:29:13 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.306 2022/02/01 04:59:16 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.307 2022/02/16 10:29:13 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1118,6 +1118,10 @@ ixgbe_attach(device_t parent, device_t d
 	hw->eeprom.ops.read(hw, IXGBE_ETRACKID_L, );
 	aprint_normal(" ETrackID %08x\n", ((uint32_t)high << 16) | low);
 
+	/* Printed Board Assembly number */
+	error = ixgbe_read_pba_string(hw, buf, IXGBE_PBANUM_LENGTH);
+	aprint_normal_dev(dev, "PBA number %s\n", error ? "unknown" : buf);
+
 	if (adapter->feat_en & IXGBE_FEATURE_MSIX) {
 		error = ixgbe_allocate_msix(adapter, pa);
 		if (error) {
@@ -1137,6 +1141,7 @@ ixgbe_attach(device_t parent, device_t d
 			}
 		}
 	}
+
 	/* Recovery mode */
 	switch (adapter->hw.mac.type) {
 	case ixgbe_mac_X550:



CVS commit: src/sys/dev/pci

2022-02-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 16 03:15:27 UTC 2022

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

Log Message:
Remove duplicated break. No functional change.


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

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



CVS commit: src/sys/dev/pci

2022-02-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb 16 03:15:27 UTC 2022

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

Log Message:
Remove duplicated break. No functional change.


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

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.726 src/sys/dev/pci/if_wm.c:1.727
--- src/sys/dev/pci/if_wm.c:1.726	Fri Dec 31 14:25:23 2021
+++ src/sys/dev/pci/if_wm.c	Wed Feb 16 03:15:27 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.726 2021/12/31 14:25:23 riastradh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.727 2022/02/16 03:15:27 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.726 2021/12/31 14:25:23 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.727 2022/02/16 03:15:27 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -10572,7 +10572,6 @@ wm_gmii_setup_phytype(struct wm_softc *s
 			case MII_MODEL_INTEL_I350:
 new_phytype = WMPHY_I350;
 break;
-break;
 			default:
 break;
 			}



CVS commit: src/sys/dev/pci

2022-02-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Feb 15 12:01:55 UTC 2022

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.1432 -r1.1433 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1431 -r1.1432 src/sys/dev/pci/pcidevs_data.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/pcidevs.h
diff -u src/sys/dev/pci/pcidevs.h:1.1432 src/sys/dev/pci/pcidevs.h:1.1433
--- src/sys/dev/pci/pcidevs.h:1.1432	Wed Feb  2 15:18:53 2022
+++ src/sys/dev/pci/pcidevs.h	Tue Feb 15 12:01:54 2022
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs.h,v 1.1432 2022/02/02 15:18:53 msaitoh Exp $	*/
+/*	$NetBSD: pcidevs.h,v 1.1433 2022/02/15 12:01:54 msaitoh Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1448 2022/02/02 15:18:21 msaitoh Exp
+ *	NetBSD: pcidevs,v 1.1449 2022/02/15 12:01:28 msaitoh Exp
  */
 
 /*
@@ -9554,6 +9554,8 @@
 #define	PCI_PRODUCT_VMWARE_VMPCIE	0x07a0		/* Virtual PCI Express Root Port */
 #define	PCI_PRODUCT_VMWARE_VMXNET3	0x07b0		/* Virtual Network 3 */
 #define	PCI_PRODUCT_VMWARE_PVSCSI	0x07c0		/* PVSCSI */
+#define	PCI_PRODUCT_VMWARE_AHCI	0x07e0		/* AHCI */
+#define	PCI_PRODUCT_VMWARE_NVME	0x07f0		/* NVMe */
 #define	PCI_PRODUCT_VMWARE_VMI3	0x0801		/* VMI option ROM */
 
 /* Weitek products */

Index: src/sys/dev/pci/pcidevs_data.h
diff -u src/sys/dev/pci/pcidevs_data.h:1.1431 src/sys/dev/pci/pcidevs_data.h:1.1432
--- src/sys/dev/pci/pcidevs_data.h:1.1431	Wed Feb  2 15:18:52 2022
+++ src/sys/dev/pci/pcidevs_data.h	Tue Feb 15 12:01:54 2022
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs_data.h,v 1.1431 2022/02/02 15:18:52 msaitoh Exp $	*/
+/*	$NetBSD: pcidevs_data.h,v 1.1432 2022/02/15 12:01:54 msaitoh Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1448 2022/02/02 15:18:21 msaitoh Exp
+ *	NetBSD: pcidevs,v 1.1449 2022/02/15 12:01:28 msaitoh Exp
  */
 
 /*
@@ -17191,6 +17191,10 @@ static const uint32_t pci_products[] = {
 	19246, 3879, 6380, 0,
 	PCI_VENDOR_VMWARE, PCI_PRODUCT_VMWARE_PVSCSI, 
 	42330, 0,
+	PCI_VENDOR_VMWARE, PCI_PRODUCT_VMWARE_AHCI, 
+	8517, 0,
+	PCI_VENDOR_VMWARE, PCI_PRODUCT_VMWARE_NVME, 
+	7937, 0,
 	PCI_VENDOR_VMWARE, PCI_PRODUCT_VMWARE_VMI3, 
 	42337, 42341, 42348, 0,
 	PCI_VENDOR_WEITEK, PCI_PRODUCT_WEITEK_P9000, 
@@ -18348,7 +18352,7 @@ static const char pci_words[] = { "." 
 	"AC1003\0" /* 1 refs @ 7908 */
 	"16650-compatible\0" /* 1 refs @ 7915 */
 	"UART\0" /* 92 refs @ 7932 */
-	"NVMe\0" /* 14 refs @ 7937 */
+	"NVMe\0" /* 15 refs @ 7937 */
 	"SSD\0" /* 19 refs @ 7942 */
 	"Elastic\0" /* 1 refs @ 7946 */
 	"K8\0" /* 4 refs @ 7954 */
@@ -18430,7 +18434,7 @@ static const char pci_words[] = { "." 
 	"300\0" /* 114 refs @ 8504 */
 	"SATA\0" /* 260 refs @ 8508 */
 	"400\0" /* 125 refs @ 8513 */
-	"AHCI\0" /* 88 refs @ 8517 */
+	"AHCI\0" /* 89 refs @ 8517 */
 	"500\0" /* 122 refs @ 8522 */
 	"AMD751\0" /* 2 refs @ 8526 */
 	"PCI-PCI\0" /* 80 refs @ 8533 */



CVS commit: src/sys/dev/pci

2022-02-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Feb 15 12:01:55 UTC 2022

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.1432 -r1.1433 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1431 -r1.1432 src/sys/dev/pci/pcidevs_data.h

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



CVS commit: src/sys/dev/pci

2022-02-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Feb 15 12:01:28 UTC 2022

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add VMware AHCI and NVMe.


To generate a diff of this commit:
cvs rdiff -u -r1.1448 -r1.1449 src/sys/dev/pci/pcidevs

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/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1448 src/sys/dev/pci/pcidevs:1.1449
--- src/sys/dev/pci/pcidevs:1.1448	Wed Feb  2 15:18:21 2022
+++ src/sys/dev/pci/pcidevs	Tue Feb 15 12:01:28 2022
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1448 2022/02/02 15:18:21 msaitoh Exp $
+$NetBSD: pcidevs,v 1.1449 2022/02/15 12:01:28 msaitoh Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -9547,6 +9547,8 @@ product VMWARE VMPCIB	0x0790	Virtual PCI
 product VMWARE VMPCIE	0x07a0	Virtual PCI Express Root Port
 product VMWARE VMXNET3	0x07b0	Virtual Network 3
 product VMWARE PVSCSI	0x07c0	PVSCSI
+product VMWARE AHCI	0x07e0	AHCI
+product VMWARE NVME	0x07f0	NVMe
 product VMWARE VMI3	0x0801	VMI option ROM
 
 /* Weitek products */



CVS commit: src/sys/dev/pci

2022-02-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Feb 15 12:01:28 UTC 2022

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add VMware AHCI and NVMe.


To generate a diff of this commit:
cvs rdiff -u -r1.1448 -r1.1449 src/sys/dev/pci/pcidevs

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



CVS commit: [netbsd-9] src/doc

2022-02-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Feb 14 06:47:40 UTC 2022

Modified Files:
src/doc [netbsd-9]: CHANGES-9.3

Log Message:
Ticket #1427.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.75 -r1.1.2.76 src/doc/CHANGES-9.3

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

Modified files:

Index: src/doc/CHANGES-9.3
diff -u src/doc/CHANGES-9.3:1.1.2.75 src/doc/CHANGES-9.3:1.1.2.76
--- src/doc/CHANGES-9.3:1.1.2.75	Tue Feb  8 14:45:57 2022
+++ src/doc/CHANGES-9.3	Mon Feb 14 06:47:40 2022
@@ -1,4 +1,4 @@
-29~# $NetBSD: CHANGES-9.3,v 1.1.2.75 2022/02/08 14:45:57 martin Exp $
+29~# $NetBSD: CHANGES-9.3,v 1.1.2.76 2022/02/14 06:47:40 msaitoh Exp $
 
 A complete list of changes from the NetBSD 9.2 release to the NetBSD 9.3
 release:
@@ -1479,3 +1479,10 @@ sys/dev/ata/ata_subr.c1.9
 	requeued anyway.
 	[jdolecek, ticket #1426]
 
+usr.sbin/sysinst/arch/i386/md.c			1.35
+usr.sbin/sysinst/defs.h1.80
+usr.sbin/sysinst/target.c			1.18
+
+	sysinst: on x86 fix the copying of UEFI bootloaders which got
+	broken by the fixes in ticket #1422.
+	[martin, ticket #1427]



CVS commit: [netbsd-9] src/doc

2022-02-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Feb 14 06:47:40 UTC 2022

Modified Files:
src/doc [netbsd-9]: CHANGES-9.3

Log Message:
Ticket #1427.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.75 -r1.1.2.76 src/doc/CHANGES-9.3

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



CVS commit: [netbsd-9] src/usr.sbin/sysinst

2022-02-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Feb 14 06:45:34 UTC 2022

Modified Files:
src/usr.sbin/sysinst [netbsd-9]: defs.h target.c
src/usr.sbin/sysinst/arch/i386 [netbsd-9]: md.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #1427):
usr.sbin/sysinst/defs.h: revision 1.80
usr.sbin/sysinst/target.c: revision 1.18
usr.sbin/sysinst/arch/i386/md.c: revision 1.35
x86: fix previous: in the UEFI case copy the bootloaders from install
media during initial installation, but use the (by then: updated)
files from the target disk for system upgrades.


To generate a diff of this commit:
cvs rdiff -u -r1.42.2.10 -r1.42.2.11 src/usr.sbin/sysinst/defs.h
cvs rdiff -u -r1.8.2.6 -r1.8.2.7 src/usr.sbin/sysinst/target.c
cvs rdiff -u -r1.20.2.9 -r1.20.2.10 src/usr.sbin/sysinst/arch/i386/md.c

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

Modified files:

Index: src/usr.sbin/sysinst/defs.h
diff -u src/usr.sbin/sysinst/defs.h:1.42.2.10 src/usr.sbin/sysinst/defs.h:1.42.2.11
--- src/usr.sbin/sysinst/defs.h:1.42.2.10	Wed Feb  2 04:25:36 2022
+++ src/usr.sbin/sysinst/defs.h	Mon Feb 14 06:45:34 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.42.2.10 2022/02/02 04:25:36 msaitoh Exp $	*/
+/*	$NetBSD: defs.h,v 1.42.2.11 2022/02/14 06:45:34 msaitoh Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -899,6 +899,7 @@ void	dup_file_into_target(const char *);
 void	mv_within_target_or_die(const char *, const char *);
 int	cp_within_target(const char *, const char *, int);
 int	target_mount(const char *, const char *, const char *);
+int	target_unmount(const char *);
 int	target_mount_do(const char *, const char *, const char *);
 int	target_test(unsigned int, const char *);
 int	target_dir_exists_p(const char *);

Index: src/usr.sbin/sysinst/target.c
diff -u src/usr.sbin/sysinst/target.c:1.8.2.6 src/usr.sbin/sysinst/target.c:1.8.2.7
--- src/usr.sbin/sysinst/target.c:1.8.2.6	Wed Feb  2 04:25:36 2022
+++ src/usr.sbin/sysinst/target.c	Mon Feb 14 06:45:34 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: target.c,v 1.8.2.6 2022/02/02 04:25:36 msaitoh Exp $	*/
+/*	$NetBSD: target.c,v 1.8.2.7 2022/02/14 06:45:34 msaitoh Exp $	*/
 
 /*
  * Copyright 1997 Jonathan Stone
@@ -71,7 +71,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: target.c,v 1.8.2.6 2022/02/02 04:25:36 msaitoh Exp $");
+__RCSID("$NetBSD: target.c,v 1.8.2.7 2022/02/14 06:45:34 msaitoh Exp $");
 #endif
 
 /*
@@ -527,6 +527,33 @@ target_mount(const char *opts, const cha
 	return target_mount_do(opts, from, on);
 }
 
+int
+target_unmount(const char *mount_point)
+{
+	struct unwind_mount *m, *prev = NULL;
+	int error;
+
+	for (m = unwind_mountlist; m != NULL; prev = m, m = m->um_prev)
+		if (strcmp(m->um_mountpoint, mount_point) == 0)
+			break;
+
+	if (m == NULL)
+		return ENOTDIR;
+
+	error = run_program(0, "/sbin/umount %s%s",
+		target_prefix(), m->um_mountpoint);
+	if (error)
+		return error;
+
+	if (m == unwind_mountlist)
+		unwind_mountlist = m->um_prev;
+	else
+		prev->um_prev = m->um_prev;
+	free(m);
+
+	return 0;
+}
+
 static bool
 delete_wedge(const char *disk, const char *wedge)
 {

Index: src/usr.sbin/sysinst/arch/i386/md.c
diff -u src/usr.sbin/sysinst/arch/i386/md.c:1.20.2.9 src/usr.sbin/sysinst/arch/i386/md.c:1.20.2.10
--- src/usr.sbin/sysinst/arch/i386/md.c:1.20.2.9	Wed Feb  2 04:25:37 2022
+++ src/usr.sbin/sysinst/arch/i386/md.c	Mon Feb 14 06:45:34 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: md.c,v 1.20.2.9 2022/02/02 04:25:37 msaitoh Exp $ */
+/*	$NetBSD: md.c,v 1.20.2.10 2022/02/14 06:45:34 msaitoh Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -334,9 +334,10 @@ md_post_newfs_bios(struct install_partit
  * boot partition (or update them).
  */
 static int
-copy_uefi_boot(const struct part_usage_info *boot)
+copy_uefi_boot(const struct part_usage_info *boot, bool target_is_populated)
 {
 	char dev[MAXPATHLEN], path[MAXPATHLEN], src[MAXPATHLEN];
+	const char *s;
 	size_t i;
 	int err;
 
@@ -364,13 +365,18 @@ copy_uefi_boot(const struct part_usage_i
 	make_target_dir(path);
 
 	for (i = 0; i < __arraycount(uefi_bootloaders); i++) {
-		strcpy(src, target_expand(uefi_bootloaders[i]));
+		s = uefi_bootloaders[i];
+		strcpy(src, target_is_populated ? target_expand(s) : s);
 		if (access(src, R_OK) != 0)
 			continue;
-		err = cp_within_target(uefi_bootloaders[i], path, 0);
+		err = target_is_populated ?
+		cp_within_target(s, path, 0) :
+		cp_to_target(s, path);
 		if (err)
 			return err;
 	}
+	if (boot->mount[0] == 0)
+		target_unmount("/mnt");
 
 	return 0;
 }
@@ -379,7 +385,8 @@ copy_uefi_boot(const struct part_usage_i
  * Find (U)EFI boot partition and install/update bootloaders
  */
 static int
-update_uefi_boot_code(struct install_partition_desc *install)
+update_uefi_boot_code(struct install_partition_desc *install,
+bool target_is_populated)
 {
 	

CVS commit: [netbsd-9] src/usr.sbin/sysinst

2022-02-13 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Feb 14 06:45:34 UTC 2022

Modified Files:
src/usr.sbin/sysinst [netbsd-9]: defs.h target.c
src/usr.sbin/sysinst/arch/i386 [netbsd-9]: md.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #1427):
usr.sbin/sysinst/defs.h: revision 1.80
usr.sbin/sysinst/target.c: revision 1.18
usr.sbin/sysinst/arch/i386/md.c: revision 1.35
x86: fix previous: in the UEFI case copy the bootloaders from install
media during initial installation, but use the (by then: updated)
files from the target disk for system upgrades.


To generate a diff of this commit:
cvs rdiff -u -r1.42.2.10 -r1.42.2.11 src/usr.sbin/sysinst/defs.h
cvs rdiff -u -r1.8.2.6 -r1.8.2.7 src/usr.sbin/sysinst/target.c
cvs rdiff -u -r1.20.2.9 -r1.20.2.10 src/usr.sbin/sysinst/arch/i386/md.c

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



CVS commit: src/sys/dev/pci

2022-02-02 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb  2 15:18:53 UTC 2022

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.1431 -r1.1432 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1430 -r1.1431 src/sys/dev/pci/pcidevs_data.h

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

diffs are larger than 1MB and have been omitted


CVS commit: src/sys/dev/pci

2022-02-02 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Feb  2 15:18:53 UTC 2022

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.1431 -r1.1432 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1430 -r1.1431 src/sys/dev/pci/pcidevs_data.h

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



  1   2   3   4   5   6   7   8   9   10   >