diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2019-06-17 11:07:40 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2019-06-17 11:07:40 +0000 |
commit | f62ad4e2e8b79844bfb36647c4be996dc1078af6 (patch) | |
tree | 6039b25e94c3239804e0692ddc4ac2be02f0affc /sys/arch | |
parent | 9495f743108d9876b7ba71e49e71fdf5859f4183 (diff) |
Make pci_intr_map_msix(9) assign an address to the BAR used by the MSI-X
tables if no address has been assigned yet to prevent a panic in
pci_intr_establish(9) later.
ok patrick@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/arm64/dev/pci_machdep.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/arch/arm64/dev/pci_machdep.c b/sys/arch/arm64/dev/pci_machdep.c index 2bdea330300..29ca6663075 100644 --- a/sys/arch/arm64/dev/pci_machdep.c +++ b/sys/arch/arm64/dev/pci_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.c,v 1.2 2019/06/02 18:40:58 kettenis Exp $ */ +/* $OpenBSD: pci_machdep.c,v 1.3 2019/06/17 11:07:39 kettenis Exp $ */ /* * Copyright (c) 2019 Mark Kettenis <kettenis@openbsd.org> @@ -107,15 +107,22 @@ _pci_intr_map_msix(struct pci_attach_args *pa, int vec, { pci_chipset_tag_t pc = pa->pa_pc; pcitag_t tag = pa->pa_tag; - pcireg_t reg; + pcireg_t reg, table, type; + int bir, off; if ((pa->pa_flags & PCI_FLAGS_MSI_ENABLED) == 0 || - pci_get_capability(pc, tag, PCI_CAP_MSIX, NULL, ®) == 0) + pci_get_capability(pc, tag, PCI_CAP_MSIX, &off, ®) == 0) return -1; if (vec > PCI_MSIX_MC_TBLSZ(reg)) return -1; + table = pci_conf_read(pc, tag, off + PCI_MSIX_TABLE); + bir = PCI_MAPREG_START + (table & PCI_MSIX_TABLE_BIR) * 4; + type = pci_mapreg_type(pc, tag, bir); + if (pci_mapreg_assign(pa, bir, type, NULL, NULL)) + return -1; + ihp->ih_pc = pa->pa_pc; ihp->ih_tag = pa->pa_tag; ihp->ih_intrpin = vec; |