From 4f2f35914a63c683747c97f8716d99af50ec3fd7 Mon Sep 17 00:00:00 2001 From: kettenis Date: Sat, 19 Apr 2014 11:53:42 +0000 Subject: [PATCH] Don't panic if we're trying to disestablish an MSI but the hardware is gone. tested by & ok mlarkin@ --- sys/arch/amd64/pci/pci_machdep.c | 7 +++---- sys/arch/i386/pci/pci_machdep.c | 8 +++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/sys/arch/amd64/pci/pci_machdep.c b/sys/arch/amd64/pci/pci_machdep.c index 9fac42f5785..4098fa2bb13 100644 --- a/sys/arch/amd64/pci/pci_machdep.c +++ b/sys/arch/amd64/pci/pci_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.c,v 1.58 2013/11/06 10:40:36 mpi Exp $ */ +/* $OpenBSD: pci_machdep.c,v 1.59 2014/04/19 11:53:42 kettenis Exp $ */ /* $NetBSD: pci_machdep.c,v 1.3 2003/05/07 21:33:58 fvdl Exp $ */ /*- @@ -375,9 +375,8 @@ msi_delroute(struct pic *pic, struct cpu_info *ci, int pin, int vec, int type) pcireg_t reg; int off; - if (pci_get_capability(pc, tag, PCI_CAP_MSI, &off, ®) == 0) - panic("%s: no msi capability", __func__); - pci_conf_write(pc, tag, off, reg & ~PCI_MSI_MC_MSIE); + if (pci_get_capability(pc, tag, PCI_CAP_MSI, &off, ®)) + pci_conf_write(pc, tag, off, reg & ~PCI_MSI_MC_MSIE); } int diff --git a/sys/arch/i386/pci/pci_machdep.c b/sys/arch/i386/pci/pci_machdep.c index d7b394a81c5..cc3a24f1000 100644 --- a/sys/arch/i386/pci/pci_machdep.c +++ b/sys/arch/i386/pci/pci_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci_machdep.c,v 1.77 2013/11/06 10:40:36 mpi Exp $ */ +/* $OpenBSD: pci_machdep.c,v 1.78 2014/04/19 11:53:42 kettenis Exp $ */ /* $NetBSD: pci_machdep.c,v 1.28 1997/06/06 23:29:17 thorpej Exp $ */ /*- @@ -859,10 +859,8 @@ pci_intr_disestablish(pci_chipset_tag_t pc, void *cookie) pcireg_t reg; int off; - if (pci_get_capability(pc, tag, PCI_CAP_MSI, &off, ®) == 0) - panic("%s: no msi capability", __func__); - - pci_conf_write(pc, tag, off, reg &= ~PCI_MSI_MC_MSIE); + if (pci_get_capability(pc, tag, PCI_CAP_MSI, &off, ®)) + pci_conf_write(pc, tag, off, reg &= ~PCI_MSI_MC_MSIE); apic_maxlevel[ih->ih_vec] = 0; apic_intrhand[ih->ih_vec] = NULL; -- 2.20.1