Add MSI-X support

This commit is contained in:
jmcneill 2018-10-31 15:42:36 +00:00
parent 1ddc0ea041
commit 8537f7783f
2 changed files with 11 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: acpi_pci_machdep.c,v 1.4 2018/10/21 11:56:26 jmcneill Exp $ */
/* $NetBSD: acpi_pci_machdep.c,v 1.5 2018/10/31 15:42:36 jmcneill Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: acpi_pci_machdep.c,v 1.4 2018/10/21 11:56:26 jmcneill Exp $");
__KERNEL_RCSID(0, "$NetBSD: acpi_pci_machdep.c,v 1.5 2018/10/31 15:42:36 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@ -331,9 +331,12 @@ static const char *
acpi_pci_md_intr_string(void *v, pci_intr_handle_t ih, char *buf, size_t len)
{
const int irq = __SHIFTOUT(ih, ARM_PCI_INTR_IRQ);
const int vec = __SHIFTOUT(ih, ARM_PCI_INTR_MSI_VEC);
if (ih & ARM_PCI_INTR_MSI)
snprintf(buf, len, "irq %d (MSI)", irq);
if (ih & ARM_PCI_INTR_MSIX)
snprintf(buf, len, "irq %d (MSI-X vec %d)", irq, vec);
else if (ih & ARM_PCI_INTR_MSI)
snprintf(buf, len, "irq %d (MSI vec %d)", irq, vec);
else
snprintf(buf, len, "irq %d", irq);
@ -367,7 +370,7 @@ acpi_pci_md_intr_establish(void *v, pci_intr_handle_t ih, int ipl,
{
struct acpi_pci_context * const ap = v;
if (ih & ARM_PCI_INTR_MSI)
if ((ih & (ARM_PCI_INTR_MSI | ARM_PCI_INTR_MSIX)) != 0)
return arm_pci_msi_intr_establish(&ap->ap_pc, ih, ipl, callback, arg);
const int irq = (int)__SHIFTOUT(ih, ARM_PCI_INTR_IRQ);

View File

@ -1,4 +1,4 @@
/* $NetBSD: acpi_fdt.c,v 1.7 2018/10/28 10:21:42 jmcneill Exp $ */
/* $NetBSD: acpi_fdt.c,v 1.8 2018/10/31 15:42:54 jmcneill Exp $ */
/*-
* Copyright (c) 2015-2017 Jared McNeill <jmcneill@invisible.ca>
@ -29,7 +29,7 @@
#include "opt_efi.h"
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: acpi_fdt.c,v 1.7 2018/10/28 10:21:42 jmcneill Exp $");
__KERNEL_RCSID(0, "$NetBSD: acpi_fdt.c,v 1.8 2018/10/31 15:42:54 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@ -127,7 +127,7 @@ acpi_fdt_attach(device_t parent, device_t self, void *aux)
PCI_FLAGS_MRL_OKAY | PCI_FLAGS_MRM_OKAY |
PCI_FLAGS_MWI_OKAY;
#ifdef __HAVE_PCI_MSI_MSIX
aa.aa_pciflags |= PCI_FLAGS_MSI_OKAY;
aa.aa_pciflags |= PCI_FLAGS_MSI_OKAY | PCI_FLAGS_MSIX_OKAY;
#endif
aa.aa_ic = 0;
aa.aa_dmat = faa->faa_dmat;