Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Deal with broken BIOSes that leave PCI interrupt...



details:   https://anonhg.NetBSD.org/src/rev/43e968c24f09
branches:  trunk
changeset: 354335:43e968c24f09
user:      sborrill <sborrill%NetBSD.org@localhost>
date:      Mon Jun 12 10:59:47 2017 +0000

description:
Deal with broken BIOSes that leave PCI interrupts disabled.

Thanks to nick@

diffstat:

 sys/dev/pci/ehci_pci.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (35 lines):

diff -r 85019451e7e4 -r 43e968c24f09 sys/dev/pci/ehci_pci.c
--- a/sys/dev/pci/ehci_pci.c    Mon Jun 12 09:23:39 2017 +0000
+++ b/sys/dev/pci/ehci_pci.c    Mon Jun 12 10:59:47 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ehci_pci.c,v 1.64 2016/10/13 20:05:06 jdolecek Exp $   */
+/*     $NetBSD: ehci_pci.c,v 1.65 2017/06/12 10:59:47 sborrill Exp $   */
 
 /*
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.64 2016/10/13 20:05:06 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.65 2017/06/12 10:59:47 sborrill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -161,10 +161,14 @@
                break;
        }
 
+       pcireg_t intr = pci_conf_read(pc, tag, PCI_INTERRUPT_REG);
+       int pin = PCI_INTERRUPT_PIN(intr);
+
        /* Enable the device. */
        csr = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG);
-       pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG,
-                      csr | PCI_COMMAND_MASTER_ENABLE);
+       csr |= PCI_COMMAND_MASTER_ENABLE;
+       csr &= ~(pin ? PCI_COMMAND_INTERRUPT_DISABLE : 0);
+       pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, csr);
 
        /* Map and establish the interrupt. */
        if (pci_intr_map(pa, &ih)) {



Home | Main Index | Thread Index | Old Index