Module Name:    src
Committed By:   dbj
Date:           Sun Feb  7 04:58:17 UTC 2021

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

Log Message:
xhci_pci.c: reimplement XHCI_DISABLE_MSI and XHCI_DISABLE_MSIX


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/pci/xhci_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/pci/xhci_pci.c
diff -u src/sys/dev/pci/xhci_pci.c:1.26 src/sys/dev/pci/xhci_pci.c:1.27
--- src/sys/dev/pci/xhci_pci.c:1.26	Wed Dec  9 14:21:09 2020
+++ src/sys/dev/pci/xhci_pci.c	Sun Feb  7 04:58:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci_pci.c,v 1.26 2020/12/09 14:21:09 jakllsch Exp $	*/
+/*	$NetBSD: xhci_pci.c,v 1.27 2021/02/07 04:58:17 dbj Exp $	*/
 /*	OpenBSD: xhci_pci.c,v 1.4 2014/07/12 17:38:51 yuo Exp	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.26 2020/12/09 14:21:09 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.27 2021/02/07 04:58:17 dbj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_xhci_pci.h"
@@ -126,6 +126,7 @@ xhci_pci_attach(device_t parent, device_
 	char const *intrstr;
 	pcireg_t csr, memtype, usbrev;
 	uint32_t hccparams;
+	int counts[PCI_INTR_TYPE_SIZE];
 	char intrbuf[PCI_INTRSTR_LEN];
 	bus_addr_t memaddr;
 	int flags, msixoff;
@@ -211,8 +212,18 @@ xhci_pci_attach(device_t parent, device_
 	pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG,
 		       csr | PCI_COMMAND_MASTER_ENABLE);
 
+	for (int i = 0; i < PCI_INTR_TYPE_SIZE; i++) {
+		counts[i] = 1;
+	}
+#ifdef XHCI_DISABLE_MSI
+	counts[PCI_INTR_TYPE_MSI] = 0;
+#endif
+#ifdef XHCI_DISABLE_MSIX
+	counts[PCI_INTR_TYPE_MSIX] = 0;
+#endif
+
 	/* Allocate and establish the interrupt. */
-	if (pci_intr_alloc(pa, &psc->sc_pihp, NULL, 0)) {
+	if (pci_intr_alloc(pa, &psc->sc_pihp, counts, 0)) {
 		aprint_error_dev(self, "can't allocate handler\n");
 		goto fail;
 	}

Reply via email to