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 <sys/cdefs.h>
-__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 <ma...@peereboom.us>
@@ -125,11 +125,12 @@
 #define MFI_STATE_TB_FAULT		0x40000000
 
 /* command reset register */
-#define MFI_INIT_ABORT			0x00000000
+#define MFI_INIT_ABORT			0x00000001
 #define MFI_INIT_READY			0x00000002
 #define MFI_INIT_MFIMODE		0x00000004
 #define MFI_INIT_CLEAR_HANDSHAKE	0x00000008
-#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		0x00000010
 
 /* 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 <ma...@peereboom.us>
@@ -17,7 +17,7 @@
  */
 
 #include <sys/cdefs.h>
-__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 <sys/param.h>
 #include <sys/systm.h>
@@ -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,		"" }
 };
 

Reply via email to