Module Name:    src
Committed By:   jdolecek
Date:           Sun Jul 12 19:05:32 UTC 2020

Modified Files:
        src/sys/dev/pci: if_bnx.c if_bnxvar.h

Log Message:
enable MSI/MSI-X if supported by adapter

tested MSI-X with Broadcom NetXtreme II BCM5709 1000Base-T


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/dev/pci/if_bnx.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/if_bnxvar.h

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

Modified files:

Index: src/sys/dev/pci/if_bnx.c
diff -u src/sys/dev/pci/if_bnx.c:1.95 src/sys/dev/pci/if_bnx.c:1.96
--- src/sys/dev/pci/if_bnx.c:1.95	Mon May 18 05:47:54 2020
+++ src/sys/dev/pci/if_bnx.c	Sun Jul 12 19:05:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bnx.c,v 1.95 2020/05/18 05:47:54 msaitoh Exp $	*/
+/*	$NetBSD: if_bnx.c,v 1.96 2020/07/12 19:05:32 jdolecek Exp $	*/
 /*	$OpenBSD: if_bnx.c,v 1.101 2013/03/28 17:21:44 brad Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
 #if 0
 __FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.3 2006/04/13 14:12:26 ru Exp $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.95 2020/05/18 05:47:54 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.96 2020/07/12 19:05:32 jdolecek Exp $");
 
 /*
  * The following controllers are supported by this driver:
@@ -577,7 +577,6 @@ bnx_attach(device_t parent, device_t sel
 	prop_dictionary_t	dict;
 	struct pci_attach_args	*pa = aux;
 	pci_chipset_tag_t	pc = pa->pa_pc;
-	pci_intr_handle_t	ih;
 	const char		*intrstr = NULL;
 	uint32_t		command;
 	struct ifnet		*ifp;
@@ -626,11 +625,11 @@ bnx_attach(device_t parent, device_t sel
 		return;
 	}
 
-	if (pci_intr_map(pa, &ih)) {
+	if (pci_intr_alloc(pa, &sc->bnx_ih, NULL, 0)) {
 		aprint_error_dev(sc->bnx_dev, "couldn't map interrupt\n");
 		goto bnx_attach_fail;
 	}
-	intrstr = pci_intr_string(pc, ih, intrbuf, sizeof(intrbuf));
+	intrstr = pci_intr_string(pc, sc->bnx_ih[0], intrbuf, sizeof(intrbuf));
 
 	/*
 	 * Configure byte swap and enable indirect register access.
@@ -915,8 +914,8 @@ bnx_attach(device_t parent, device_t sel
 	callout_setfunc(&sc->bnx_timeout, bnx_tick, sc);
 
 	/* Hookup IRQ last. */
-	sc->bnx_intrhand = pci_intr_establish_xname(pc, ih, IPL_NET, bnx_intr,
-	    sc, device_xname(self));
+	sc->bnx_intrhand = pci_intr_establish_xname(pc, sc->bnx_ih[0], IPL_NET,
+	    bnx_intr, sc, device_xname(self));
 	if (sc->bnx_intrhand == NULL) {
 		aprint_error_dev(self, "couldn't establish interrupt");
 		if (intrstr != NULL)
@@ -2713,6 +2712,9 @@ bnx_release_resources(struct bnx_softc *
 	if (sc->bnx_intrhand != NULL)
 		pci_intr_disestablish(pa->pa_pc, sc->bnx_intrhand);
 
+	if (sc->bnx_ih != NULL)
+		pci_intr_release(pa->pa_pc, sc->bnx_ih, 1);
+
 	if (sc->bnx_size)
 		bus_space_unmap(sc->bnx_btag, sc->bnx_bhandle, sc->bnx_size);
 

Index: src/sys/dev/pci/if_bnxvar.h
diff -u src/sys/dev/pci/if_bnxvar.h:1.12 src/sys/dev/pci/if_bnxvar.h:1.13
--- src/sys/dev/pci/if_bnxvar.h:1.12	Sat Feb  1 07:12:40 2020
+++ src/sys/dev/pci/if_bnxvar.h	Sun Jul 12 19:05:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bnxvar.h,v 1.12 2020/02/01 07:12:40 thorpej Exp $	*/
+/*	$NetBSD: if_bnxvar.h,v 1.13 2020/07/12 19:05:32 jdolecek Exp $	*/
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -124,6 +124,7 @@ struct bnx_softc
 	bus_space_handle_t	bnx_bhandle;		/* Device bus handle */
 	bus_size_t		bnx_size;
 
+	pci_intr_handle_t	*bnx_ih;
 	void			*bnx_intrhand;		/* Interrupt handler */
 
 	/* packet allocation workqueue */

Reply via email to