2006-11-24 10:44:12

by Juergen Beisert

[permalink] [raw]
Subject: [PATCH 001/001] i386/pci: fix nibble permutation and add Cyrix 5530 IRQ router

From: Juergen Beisert <[email protected]>

This patch adds CYRIX_5530_LEGACY to the list of known PCI interrupt router,
to setup chipset's routing register with valid data. It seems never be a
problem if the BIOS sets up these registers. But in the presence of LinuxBios
it fails for Cyrix 5530, due to LinuxBios does not setup these registers
(it leave it at their reset values).

I have no Cyrix 5520 to check, but as the comment in the source states the
Cyrix 5520 and Cyrix 5530 do interrupt routing in the same way. But the
(pirq-1)^1 expression to set a route always sets the wrong nibble, so
INTA/INTB and INTC/INTD are permuted and do not work as expected.

Signed-off-by: Juergen Beisert <[email protected]>

Index: arch/i386/pci/irq.c
===================================================================
--- arch/i386/pci/irq.c
+++ arch/i386/pci/irq.c
@@ -306,12 +306,12 @@ static int pirq_opti_set(struct pci_dev
*/
static int pirq_cyrix_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
{
- return read_config_nybble(router, 0x5C, (pirq-1)^1);
+ return read_config_nybble(router, 0x5C, pirq-1);
}

static int pirq_cyrix_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
{
- write_config_nybble(router, 0x5C, (pirq-1)^1, irq);
+ write_config_nybble(router, 0x5C, pirq-1, irq);
return 1;
}

@@ -642,6 +642,7 @@ static __init int cyrix_router_probe(str
{
switch(device)
{
+ case PCI_DEVICE_ID_CYRIX_5530_LEGACY:
case PCI_DEVICE_ID_CYRIX_5520:
r->name = "NatSemi";
r->get = pirq_cyrix_get;


2006-11-24 11:35:42

by Alan

[permalink] [raw]
Subject: Re: [PATCH 001/001] i386/pci: fix nibble permutation and add Cyrix 5530 IRQ router

On Fri, 24 Nov 2006 11:44:05 +0100
> Cyrix 5520 and Cyrix 5530 do interrupt routing in the same way. But the
> (pirq-1)^1 expression to set a route always sets the wrong nibble, so
> INTA/INTB and INTC/INTD are permuted and do not work as expected.
>
> Signed-off-by: Juergen Beisert <[email protected]>

NAK

This will then break other boards. As far as I can tell there is no
"correct" answer here for 5530 based hardware. The existing setup makes
most random CS5520/30 based PC systems like the Palmax laptops work if the
irq router is used, your change will break them

Given the choice between LinuxBIOS and the rest of the world then the
rest of the world needs to win. The 5530 is absent from the IRQ routing
table because it varied by system what the right answer was.

Alan

2006-11-24 13:09:34

by Juergen Beisert

[permalink] [raw]
Subject: Re: [PATCH 001/001] i386/pci: fix nibble permutation and add Cyrix 5530 IRQ router

Hi Alan,

On Friday 24 November 2006 12:41, Alan wrote:
> On Fri, 24 Nov 2006 11:44:05 +0100
>
> > Cyrix 5520 and Cyrix 5530 do interrupt routing in the same way. But the
> > (pirq-1)^1 expression to set a route always sets the wrong nibble, so
> > INTA/INTB and INTC/INTD are permuted and do not work as expected.
> >
> > Signed-off-by: Juergen Beisert <[email protected]>
>
> NAK
>
> This will then break other boards. As far as I can tell there is no
> "correct" answer here for 5530 based hardware. The existing setup makes
> most random CS5520/30 based PC systems like the Palmax laptops work if the
> irq router is used, your change will break them

Hmmmm, as I understand the source, it let the routing register entries
unchanged if the BIOS did it before. This is why it (IMHO) works. But if this
routine tries to set a new route it fails due to it writes the wrong register
nibble. But maybe I'm wrong, I will read the source again (and try to get a
CS5520 datasheet).

> Given the choice between LinuxBIOS and the rest of the world then the
> rest of the world needs to win.

ACK. :-)

Juergen

2006-11-24 13:29:25

by Alan

[permalink] [raw]
Subject: Re: [PATCH 001/001] i386/pci: fix nibble permutation and add Cyrix 5530 IRQ router

> Hmmmm, as I understand the source, it let the routing register entries
> unchanged if the BIOS did it before. This is why it (IMHO) works. But if this

The 5530 isn't matched by the PCI router code so we fall back to the PCI
BIOS32 services which do know what they are doing.

> routine tries to set a new route it fails due to it writes the wrong register
> nibble. But maybe I'm wrong, I will read the source again (and try to get a
> CS5520 datasheet).

I have the 5520 data sheet. For IRQ routing the 5520 and 5530 are
identical according to the docs and code according to the docs doens't
generally work ..

If you need to set these for LinuxBIOS then perhaps matching and setting
it up only if LinuxBIOS is present would be the better choice ?

Alan

2006-11-24 13:46:48

by Juergen Beisert

[permalink] [raw]
Subject: Re: [PATCH 001/001] i386/pci: fix nibble permutation and add Cyrix 5530 IRQ router

Hi Alan,

On Friday 24 November 2006 14:35, Alan wrote:
> I have the 5520 data sheet. For IRQ routing the 5520 and 5530 are
> identical according to the docs and code according to the docs doens't
> generally work ..

Yes.

> If you need to set these for LinuxBIOS then perhaps matching and setting
> it up only if LinuxBIOS is present would be the better choice ?

I thought this could improve things, but its ok when I use this patch only for
my kernel to make it work on my old hardware.

Thanks for your comments.

Juergen