Module Name: src
Committed By: jmcneill
Date: Sat Aug 3 12:55:46 UTC 2019
Modified Files:
src/sys/arch/arm/pci: pci_msi_machdep.c
Log Message:
Properly honour max_type arg to pci_intr_alloc
To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/pci/pci_msi_machdep.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/arm/pci/pci_msi_machdep.c
diff -u src/sys/arch/arm/pci/pci_msi_machdep.c:1.6 src/sys/arch/arm/pci/pci_msi_machdep.c:1.7
--- src/sys/arch/arm/pci/pci_msi_machdep.c:1.6 Thu Jul 25 00:42:43 2019
+++ src/sys/arch/arm/pci/pci_msi_machdep.c Sat Aug 3 12:55:46 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_msi_machdep.c,v 1.6 2019/07/25 00:42:43 jmcneill Exp $ */
+/* $NetBSD: pci_msi_machdep.c,v 1.7 2019/08/03 12:55:46 jmcneill Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_msi_machdep.c,v 1.6 2019/07/25 00:42:43 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_msi_machdep.c,v 1.7 2019/08/03 12:55:46 jmcneill Exp $");
#include <sys/kernel.h>
#include <sys/kmem.h>
@@ -186,11 +186,10 @@ pci_intr_alloc(const struct pci_attach_a
int intx_count, msi_count, msix_count, error;
error = EINVAL;
- intx_count = 1;
- msi_count = 1;
- msix_count = 1;
if (counts != NULL) {
+ intx_count = msi_count = msix_count = 0;
+
switch (max_type) {
case PCI_INTR_TYPE_MSIX:
msix_count = counts[PCI_INTR_TYPE_MSIX];
@@ -207,6 +206,8 @@ pci_intr_alloc(const struct pci_attach_a
return EINVAL;
}
memset(counts, 0, sizeof(*counts) * PCI_INTR_TYPE_SIZE);
+ } else {
+ intx_count = msi_count = msix_count = 1;
}
if (msix_count == -1)