2003-07-03 19:05:08

by Aleksey Gorelov

[permalink] [raw]
Subject: VIA PCI IRQ router bug fix

Hi.

I found & fixed a problem with #PIRQD line setup for VIA PCI IRQ
router. Kernel was not able to receive any interrupts from network card,
which PCI slot IRQ pin A was routed to PIRQ line D of VIA PCI IRQ
router. According to VIA specs, PIRQ D routing is out of standard
'nibble' scheme.
I tested patch with 2.4.20 kernel, it can be applied to 2.4.22-pre2 as
well.
Thanks to my employer (Phoenix Technologies) who kindly allowed me to
make this patch public.

Aleks.


Attachments:
pci-irq-patch.txt (922.00 B)
pci-irq-patch.txt

2003-07-03 23:37:57

by Jeff Garzik

[permalink] [raw]
Subject: [PATCH] Re: VIA PCI IRQ router bug fix

===== arch/i386/pci/irq.c 1.25 vs edited =====
--- 1.25/arch/i386/pci/irq.c Thu Jun 19 17:58:11 2003
+++ edited/arch/i386/pci/irq.c Thu Jul 3 19:49:14 2003
@@ -196,15 +196,16 @@
/*
* The VIA pirq rules are nibble-based, like ALI,
* but without the ugly irq number munging.
+ * However, PIRQD is in the upper instead of lower 4 bits.
*/
static int pirq_via_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
{
- return read_config_nybble(router, 0x55, pirq);
+ return read_config_nybble(router, 0x55, pirq == 4 ? 5 : pirq);
}

static int pirq_via_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
{
- write_config_nybble(router, 0x55, pirq, irq);
+ write_config_nybble(router, 0x55, pirq == 4 ? 5 : pirq, irq);
return 1;
}


Attachments:
patch (767.00 B)

2003-07-03 23:59:17

by Aleksey Gorelov

[permalink] [raw]
Subject: RE: [PATCH] Re: VIA PCI IRQ router bug fix

> If you don't mind, I would prefer the attached patch, which is a
little
> bit less verbose.
Sure I don't :)

> I will make sure this fix is merged into 2.4 and 2.5, if noone beats
me
> to it.
Thanks.

Aleks.


2003-07-04 07:17:32

by Arjan van de Ven

[permalink] [raw]
Subject: Re: [PATCH] Re: VIA PCI IRQ router bug fix


>
> static int pirq_via_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
> {
> - write_config_nybble(router, 0x55, pirq, irq);
> + write_config_nybble(router, 0x55, pirq == 4 ? 5 : pirq, irq);
> return 1;
> }


you missed the
> + return (x >> 4);
in the original patch... so your code is NOT identical.


Attachments:
signature.asc (189.00 B)
This is a digitally signed message part

2003-07-04 13:29:53

by Jeff Garzik

[permalink] [raw]
Subject: Re: [PATCH] Re: VIA PCI IRQ router bug fix

Arjan van de Ven wrote:
>>
>> static int pirq_via_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
>> {
>>- write_config_nybble(router, 0x55, pirq, irq);
>>+ write_config_nybble(router, 0x55, pirq == 4 ? 5 : pirq, irq);
>> return 1;
>> }
>
>
>
> you missed the
>
>>+ return (x >> 4);
>
> in the original patch... so your code is NOT identical.

Look at read_config_nybble...

return (nr & 1) ? (x >> 4) : (x & 0xf);

Can you spell out which part is different? I don't see it.

Jeff


2003-07-04 15:06:09

by Davide Libenzi

[permalink] [raw]
Subject: Re: [PATCH] Re: VIA PCI IRQ router bug fix

On Fri, 4 Jul 2003, Arjan van de Ven wrote:

>
> >
> > static int pirq_via_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
> > {
> > - write_config_nybble(router, 0x55, pirq, irq);
> > + write_config_nybble(router, 0x55, pirq == 4 ? 5 : pirq, irq);
> > return 1;
> > }
>
>
> you missed the
> > + return (x >> 4);
> in the original patch... so your code is NOT identical.

It's ok :

nybble(0x57, 1) == nybble(0x55, 5)



- Davide