Module Name:    src
Committed By:   snj
Date:           Thu Sep 29 14:38:24 UTC 2022

Modified Files:
        src/sys/dev/pci [netbsd-8]: mpii.c

Log Message:
Apply patch (requested by bouyer in ticket #1767):
Convert from pci_intr_map() to pci_intr_alloc(); makes the driver use
MSI/MSI-x when available.


To generate a diff of this commit:
cvs rdiff -u -r1.8.10.6 -r1.8.10.7 src/sys/dev/pci/mpii.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/mpii.c
diff -u src/sys/dev/pci/mpii.c:1.8.10.6 src/sys/dev/pci/mpii.c:1.8.10.7
--- src/sys/dev/pci/mpii.c:1.8.10.6	Sun Aug  9 14:17:48 2020
+++ src/sys/dev/pci/mpii.c	Thu Sep 29 14:38:24 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: mpii.c,v 1.8.10.6 2020/08/09 14:17:48 martin Exp $ */
+/* $NetBSD: mpii.c,v 1.8.10.7 2022/09/29 14:38:24 snj Exp $ */
 /*	OpenBSD: mpii.c,v 1.115 2012/04/11 13:29:14 naddy Exp 	*/
 /*
  * Copyright (c) 2010 Mike Belopuhov <m...@crypt.org.ru>
@@ -20,7 +20,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.8.10.6 2020/08/09 14:17:48 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.8.10.7 2022/09/29 14:38:24 snj Exp $");
 
 #include "bio.h"
 
@@ -168,6 +168,7 @@ struct mpii_softc {
 	pcitag_t		sc_tag;
 
 	void			*sc_ih;
+	pci_intr_handle_t	*sc_pihp;
 
 	struct scsipi_adapter	sc_adapt;
 	struct scsipi_channel	sc_chan;
@@ -459,7 +460,6 @@ mpii_attach(device_t parent, device_t se
 	struct pci_attach_args		*pa = aux;
 	pcireg_t			memtype;
 	int				r;
-	pci_intr_handle_t		ih;
 	struct mpii_ccb			*ccb;
 	struct scsipi_adapter *adapt = &sc->sc_adapt;
 	struct scsipi_channel *chan = &sc->sc_chan;
@@ -506,13 +506,14 @@ mpii_attach(device_t parent, device_t se
 	    MPII_INTR_MASK_DOORBELL);
 
 	/* hook up the interrupt */
-	if (pci_intr_map(pa, &ih) != 0) {
+	if (pci_intr_alloc(pa, &sc->sc_pihp, NULL, 0)) {
 		aprint_error_dev(self, "unable to map interrupt\n");
 		goto unmap;
 	}
-	intrstr = pci_intr_string(pa->pa_pc, ih, intrbuf, sizeof(intrbuf));
-	pci_intr_setattr(pa->pa_pc, &ih, PCI_INTR_MPSAFE, true);
-	sc->sc_ih = pci_intr_establish_xname(pa->pa_pc, ih, IPL_BIO,
+	intrstr = pci_intr_string(pa->pa_pc, sc->sc_pihp[0],
+	    intrbuf, sizeof(intrbuf));
+	pci_intr_setattr(pa->pa_pc, &sc->sc_pihp[0], PCI_INTR_MPSAFE, true);
+	sc->sc_ih = pci_intr_establish_xname(pa->pa_pc, sc->sc_pihp[0], IPL_BIO,
 	    mpii_intr, sc, device_xname(self));
 	if (sc->sc_ih == NULL) {
 		aprint_error_dev(self, "couldn't establish interrupt");

Reply via email to