Subject: port-i386/22036: pci interrupt fixup routine bad
To: None <gnats-bugs@gnats.netbsd.org>
From: None <Anders.qt.Franzen@ericsson.com>
List: netbsd-bugs
Date: 07/02/2003 15:11:04
>Number:         22036
>Category:       port-i386
>Synopsis:       pci interrupt fixup routine bad
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    port-i386-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 02 15:12:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Anders Franzen
>Release:        1.6
>Organization:
Ericsson
>Environment:
The machine is not running.
>Description:
I have 2 ethernet boards that did not work on my PC.
I compiled the option PCIBIOS_INTR_FIXUP and it still did not work.

In this case there was 2 problems.

1. The VIA82C586 part of the fixup code seemed to get wrong irqs for the
 PIRQ# compared to linux.

The chip is actually a VIA82C686.

This is the original shift masks from the header file.
#define VP3_CFG_INTR_SHIFT_PIRQA        0x14
#define VP3_CFG_INTR_SHIFT_PIRQB        0x10
#define VP3_CFG_INTR_SHIFT_PIRQC        0x1c
#define VP3_CFG_INTR_SHIFT_PIRQD        0x0c

I changed it to this:
#define VP3_CFG_INTR_SHIFT_PIRQA        0x0c
#define VP3_CFG_INTR_SHIFT_PIRQB        0x10
#define VP3_CFG_INTR_SHIFT_PIRQC        0x14
#define VP3_CFG_INTR_SHIFT_PIRQD        0x18

+ OpenBSD sayes there can be 7 PIRQ's I dont know how to map those
cause they would go into the next 32 bits register (0x58).


2. The fixup code assumes that if it did not have to do any fix
with the routing, it was ok by BIOS and it does not change EDGE/LEVEL.

In my computer the IRQ was routed right but was EDGE. So I changed
the generic pci_intr_fixup.c:
....
line 540:
                        } else {
                                /* BIOS setting has no problem */
#ifdef PCIINTR_DEBUG
                                printf("pciintr_link_route: "
                                    "route of PIRQ 0x%02x -> "
                                    "IRQ %d preserved BIOS setting\n",
                                    l->clink, l->irq);
#endif
                                  
/* Add the following to get the shit to LEVEL trigg!! */ 
                           pciintr_icu_set_trigger(pciintr_icu_tag,
                                                     pciintr_icu_handle,
                                             l->irq, IST_LEVEL);
                           *pciirq |= (1 << l->irq);
                        }
                        continue; /* nothing to do. */


>How-To-Repeat:
Just boot it on my pc. :)
>Fix:
See above.
>Release-Note:
>Audit-Trail:
>Unformatted: