From: kettenis Date: Sat, 28 Jul 2018 13:59:08 +0000 (+0000) Subject: Make use of PCI_FLAGS_MSI_ENABLED such that drivers for hardware with broken X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=0045467ffa1d394483c2d8b3a719fb97b71c21f8;p=openbsd Make use of PCI_FLAGS_MSI_ENABLED such that drivers for hardware with broken MSI support can selectively disable the use of MSI. --- diff --git a/sys/arch/arm64/dev/acpipci.c b/sys/arch/arm64/dev/acpipci.c index 7ed534c478d..b0877656bb6 100644 --- a/sys/arch/arm64/dev/acpipci.c +++ b/sys/arch/arm64/dev/acpipci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpipci.c,v 1.2 2018/07/10 17:11:42 kettenis Exp $ */ +/* $OpenBSD: acpipci.c,v 1.3 2018/07/28 13:59:08 kettenis Exp $ */ /* * Copyright (c) 2018 Mark Kettenis * @@ -200,6 +200,7 @@ acpipci_attach(struct device *parent, struct device *self, void *aux) pba.pba_memex = sc->sc_memex; pba.pba_domain = pci_ndomains++; pba.pba_bus = sc->sc_bus; + pba.pba_flags |= PCI_FLAGS_MSI_ENABLED; config_found(self, &pba, NULL); } @@ -397,7 +398,8 @@ acpipci_intr_map_msi(struct pci_attach_args *pa, pci_intr_handle_t *ihp) pcitag_t tag = pa->pa_tag; struct acpipci_intr_handle *ih; - if (pci_get_capability(pc, tag, PCI_CAP_MSI, NULL, NULL) == 0) + if ((pa->pa_flags & PCI_FLAGS_MSI_ENABLED) == 0 || + pci_get_capability(pc, tag, PCI_CAP_MSI, NULL, NULL) == 0) return -1; ih = malloc(sizeof(struct acpipci_intr_handle), M_DEVBUF, M_WAITOK); diff --git a/sys/arch/arm64/dev/pciecam.c b/sys/arch/arm64/dev/pciecam.c index 3d68b9d33a6..65eaacfc9ea 100644 --- a/sys/arch/arm64/dev/pciecam.c +++ b/sys/arch/arm64/dev/pciecam.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pciecam.c,v 1.3 2018/04/09 18:35:13 kettenis Exp $ */ +/* $OpenBSD: pciecam.c,v 1.4 2018/07/28 13:59:08 kettenis Exp $ */ /* * Copyright (c) 2013,2017 Patrick Wildt * @@ -241,6 +241,7 @@ pciecam_attach(struct device *parent, struct device *self, void *aux) pba.pba_pc = &sc->sc_pc; pba.pba_domain = pci_ndomains++; pba.pba_bus = 0; + pba.pba_flags |= PCI_FLAGS_MSI_ENABLED; config_found(self, &pba, NULL); } @@ -334,7 +335,8 @@ pciecam_intr_map_msi(struct pci_attach_args *pa, pcitag_t tag = pa->pa_tag; struct pciecam_intr_handle *ih; - if (pci_get_capability(pc, tag, PCI_CAP_MSI, NULL, NULL) == 0) + if ((pa->pa_flags & PCI_FLAGS_MSI_ENABLED) == 0 || + pci_get_capability(pc, tag, PCI_CAP_MSI, NULL, NULL) == 0) return 1; ih = malloc(sizeof(struct pciecam_intr_handle), M_DEVBUF, M_WAITOK); diff --git a/sys/dev/fdt/dwpcie.c b/sys/dev/fdt/dwpcie.c index 6720dc75bea..f56857ca208 100644 --- a/sys/dev/fdt/dwpcie.c +++ b/sys/dev/fdt/dwpcie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dwpcie.c,v 1.6 2018/07/01 18:58:06 kettenis Exp $ */ +/* $OpenBSD: dwpcie.c,v 1.7 2018/07/28 13:59:08 kettenis Exp $ */ /* * Copyright (c) 2018 Mark Kettenis * @@ -324,6 +324,7 @@ dwpcie_attach(struct device *parent, struct device *self, void *aux) pba.pba_ioex = sc->sc_ioex; pba.pba_domain = pci_ndomains++; pba.pba_bus = sc->sc_bus; + pba.pba_flags |= PCI_FLAGS_MSI_ENABLED; config_found(self, &pba, NULL); } @@ -534,7 +535,8 @@ dwpcie_intr_map_msi(struct pci_attach_args *pa, pci_intr_handle_t *ihp) pcitag_t tag = pa->pa_tag; struct dwpcie_intr_handle *ih; - if (pci_get_capability(pc, tag, PCI_CAP_MSI, NULL, NULL) == 0) + if ((pa->pa_flags & PCI_FLAGS_MSI_ENABLED) == 0 || + pci_get_capability(pc, tag, PCI_CAP_MSI, NULL, NULL) == 0) return -1; ih = malloc(sizeof(struct dwpcie_intr_handle), M_DEVBUF, M_WAITOK);