From ea3f508362f9a4c46874690b4609b0567e581962 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Wed, 14 Feb 2007 22:32:55 +0000 Subject: - Fix an off by one error in pci_remap_msix_method() that effectively broke the method as all the MSI-X table indices were off by one in the backend MD code. - Fix a cosmetic nit in the bootverbose printf in pci_alloc_msix_method(). --- sys/dev/pci/pci.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'sys') diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index a2b9396fa32e..494a9b5cd9e1 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -1142,7 +1142,7 @@ pci_alloc_msix_method(device_t dev, device_t child, int *count) /* Unfinished range? */ if (run) - printf("%d", irq); + printf("-%d", irq); printf(" for MSI-X\n"); } } @@ -1221,8 +1221,16 @@ pci_remap_msix_method(device_t dev, device_t child, u_int *indices) for (i = 0; i < cfg->msix.msix_alloc; i++) { resource_list_add(&dinfo->resources, SYS_RES_IRQ, indices[i], irqs[i], irqs[i], 1); + + /* + * The indices in the backend code (PCIB_* methods and the + * MI helper routines for MD code such as pci_enable_msix()) + * are all zero-based. However, the indices passed to this + * function are 1-based so that the correspond 1:1 with the + * SYS_RES_IRQ resource IDs. + */ error = PCIB_REMAP_MSIX(device_get_parent(dev), child, - indices[i], irqs[i]); + indices[i] - 1, irqs[i]); KASSERT(error == 0, ("Failed to remap MSI-X message")); } if (bootverbose) { -- cgit v1.3