2002-04-19 14:07:51

by Jan Slupski

[permalink] [raw]
Subject: [PATCH] Wrong IRQ for USB on Sony Vaio (dmi_scan.c, pci-irq.c)


Hi,

I'm writing once more about problem with IRQ assignment
for Sony Vaio Laptops.

Broken BIOS of these notebooks assigns IRQ 10 for USB,
even though it is actually wired to IRQ 9.

I use PCG-FX240 model of Sony Vaio, but I have proofs of other users,
that exactly the same problem exists on models:
FX200, FX220, FX250, FX270, FX290, FX370, FX503, R505JS, R505JL
These models use Intel's 82801BA controller, and Phoenix bios.

I wrote the patch that fix this. It is written on example of
patch for HP Pavillion (taken from 2.4.19-pre7-ac1).

This patch was tested on FX240.
It is build for 2.4.18-pre7-ac1.

Only problem is I don't have DMI Product names for all involved models.
That's why I left pretty general:
MATCH(DMI_PRODUCT_NAME, "PCG-")

I can help find exact Product Names for all models listed above, but
still new models of Vaio laptops are released with this bug.
I think checking of PCI Vendor & Device number should be enough proof
of broken bios.

If you think it should be tested on all models listed above, I can ask
their owners to do this. (They are now using my previous, even more ugly hack)

Some more description, and logs can be found on my Sony Vaio site:
http://www.pm.waw.pl/~jslupski/vaio/
I can provide any additional data, if needed.

Jan


Patch is:


diff -ru linux/arch/i386/kernel/dmi_scan.c linux-2.4.19-pre7-ac1.2/arch/i386/kernel/dmi_scan.c
--- linux/arch/i386/kernel/dmi_scan.c Fri Apr 19 15:15:19 2002
+++ linux-2.4.19-pre7-ac1.2/arch/i386/kernel/dmi_scan.c Fri Apr 19 15:50:48 2002
@@ -392,6 +392,27 @@
}

/*
+ * Work around broken Sony Vaio which assign USB to
+ * IRQ 10 even though it is actually wired to IRQ 9
+ * Models involved (at least): FX200, FX220, FX240,
+ * FX250, FX270, FX290, FX370, FX503, R505JS, R505JL
+ * Send comments to: Jan Slupski, [email protected]
+ */
+static __init int fix_broken_sony_vaio_bios_irq10(struct dmi_blacklist *d)
+{
+#ifdef CONFIG_PCI
+ extern int broken_sony_vaio_bios_irq10;
+ if (broken_sony_vaio_bios_irq10 == 0)
+ {
+ broken_sony_vaio_bios_irq10 = 1;
+ printk(KERN_INFO "%s detected - fixing broken IRQ routing (if broken!)\n", d->ident);
+ }
+#endif
+ return 0;
+}
+
+
+/*
* This bios swaps the APM minute reporting bytes over (Many sony laptops
* have this problem).
*/
@@ -760,6 +781,12 @@
MATCH(DMI_PRODUCT_VERSION, "HP Pavilion Notebook Model GE"),
MATCH(DMI_BOARD_VERSION, "OmniBook N32N-736")
} },
+
+ { fix_broken_sony_vaio_bios_irq10, "Sony Vaio Laptop", {
+ MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
+ MATCH(DMI_PRODUCT_NAME, "PCG-"),
+ NO_MATCH, NO_MATCH,
+ } },


/*
diff -ru linux/arch/i386/kernel/pci-irq.c linux-2.4.19-pre7-ac1.2/arch/i386/kernel/pci-irq.c
--- linux/arch/i386/kernel/pci-irq.c Fri Apr 19 15:15:19 2002
+++ linux-2.4.19-pre7-ac1.2/arch/i386/kernel/pci-irq.c Fri Apr 19 15:50:55 2002
@@ -24,6 +24,8 @@

int broken_hp_bios_irq9;

+int broken_sony_vaio_bios_irq10;
+
static struct irq_routing_table *pirq_table;

/*
@@ -601,6 +603,18 @@
r->set(pirq_router_dev, dev, pirq, 11);
}

+ /* Work around broken Sony Vaio Notebooks which assign USB to
+ * IRQ 10 even though it is actually wired to IRQ 9
+ * Send comments to: Jan Slupski, [email protected]
+ */
+
+ if (broken_sony_vaio_bios_irq10 && pirq == 0x63 && dev->irq == 9 &&
+ dev->vendor == 0x8086 && dev->device == 0x2442){
+ dev->irq = 9;
+ pci_write_config_byte(dev, PCI_INTERRUPT_LINE, 9);
+ r->set(pirq_router_dev, dev, pirq, 9);
+ }
+
/*
* Find the best IRQ to assign: use the one
* reported by the device if possible.





_ _ _ _ _____________________________________________
| |_| |\ | S L U P S K I [email protected]
|_| | | | \| http://www.pm.waw.pl/~jslupski/vaio


2002-04-19 14:40:51

by Dave Jones

[permalink] [raw]
Subject: Re: [PATCH] Wrong IRQ for USB on Sony Vaio (dmi_scan.c, pci-irq.c)

On Fri, Apr 19, 2002 at 04:02:18PM +0200, Jan Slupski wrote:

> Only problem is I don't have DMI Product names for all involved models.
> That's why I left pretty general:
> MATCH(DMI_PRODUCT_NAME, "PCG-")

Too generic. This matches my Z600 for example, which does not have this bug.


--
| Dave Jones. http://www.codemonkey.org.uk
| SuSE Labs

2002-04-19 14:48:51

by Jan Slupski

[permalink] [raw]
Subject: Re: [PATCH] Wrong IRQ for USB on Sony Vaio (dmi_scan.c, pci-irq.c)

On Fri, 19 Apr 2002, Dave Jones wrote:

> On Fri, Apr 19, 2002 at 04:02:18PM +0200, Jan Slupski wrote:
>
> > Only problem is I don't have DMI Product names for all involved models.
> > That's why I left pretty general:
> > MATCH(DMI_PRODUCT_NAME, "PCG-")
>
> Too generic. This matches my Z600 for example, which does not have this bug.

I know.
But it PCI id/vendor probably will not match.

But if you think, it's better to add all 12-15 models separately,
why not?
I can start asking for this information...

FX240 will have:
MATCH(DMI_PRODUCT_NAME, "PCG-FX240(UC)")
probably
MATCH(DMI_PRODUCT_NAME, "PCG-FX240")
is enough.

Do you know any simple tool to retrieve DMI information?
I did it by enabling debug output in kernel, but it would be easier
if I haven't to ask everybody to do thi...

Jan

_ _ _ _ _____________________________________________
| |_| |\ | S L U P S K I [email protected]
|_| | | | \| http://www.pm.waw.pl/~jslupski


2002-04-19 14:56:18

by Dave Jones

[permalink] [raw]
Subject: Re: [PATCH] Wrong IRQ for USB on Sony Vaio (dmi_scan.c, pci-irq.c)

On Fri, Apr 19, 2002 at 04:43:15PM +0200, Jan Slupski wrote:

> Do you know any simple tool to retrieve DMI information?

http://people.redhat.com/arjanv/dmidecode.c

--
| Dave Jones. http://www.codemonkey.org.uk
| SuSE Labs

2002-04-19 15:11:09

by Dumitru Ciobarcianu

[permalink] [raw]
Subject: Re: [PATCH] Wrong IRQ for USB on Sony Vaio (dmi_scan.c, pci-irq.c)


On Vi, 2002-04-19 at 17:56, Dave Jones wrote:
> On Fri, Apr 19, 2002 at 04:43:15PM +0200, Jan Slupski wrote:
>
> > Do you know any simple tool to retrieve DMI information?
>
> http://people.redhat.com/arjanv/dmidecode.c
>



On my machine (Toshiba Satellite Pro 4300 series) running dmidecode
gives me this....


[root@LNX root]# ./dmidecode
RSD PTR found at 0xF0170
checksum failed.
OEM TOSHIB
SMBIOS 2.3 present.
DMI 2.3 present.
46 structures occupying 1369 bytes.
DMI table at 0x0FFF0000.
dmi: read: Success
read: Illegal seek
DMI 2.3 present.
46 structures occupying 1369 bytes.
DMI table at 0x0FFF0000.
dmi: read: Illegal seek
read: Illegal seek
...

And keeps repeating...

Any hint why?

//Cioby


2002-04-19 15:44:03

by Alan

[permalink] [raw]
Subject: Re: [PATCH] Wrong IRQ for USB on Sony Vaio (dmi_scan.c, pci-irq.c)

> 46 structures occupying 1369 bytes.
> DMI table at 0x0FFF0000.
> dmi: read: Success
> read: Illegal seek
>
> And keeps repeating...
>
> Any hint why?

Not sure. For some reason the read at 0x0fffffff was failed by the kernel

2002-04-19 15:57:07

by Pete Zaitcev

[permalink] [raw]
Subject: Re: [PATCH] Wrong IRQ for USB on Sony Vaio (dmi_scan.c, pci-irq.c)

> Broken BIOS of these notebooks assigns IRQ 10 for USB,
> even though it is actually wired to IRQ 9.
>
> I use PCG-FX240 model of Sony Vaio, but I have proofs of other users,
> that exactly the same problem exists on models:
> FX200, FX220, FX250, FX270, FX290, FX370, FX503, R505JS, R505JL
> These models use Intel's 82801BA controller, and Phoenix bios.

> Only problem is I don't have DMI Product names for all involved models.
> That's why I left pretty general:
> MATCH(DMI_PRODUCT_NAME, "PCG-")

My Z505JE works perfectly without it. In general Z505's are
known to work.

> + /* Work around broken Sony Vaio Notebooks which assign USB to
> + * IRQ 10 even though it is actually wired to IRQ 9
> + * Send comments to: Jan Slupski, [email protected]
> + */
> +
> + if (broken_sony_vaio_bios_irq10 && pirq == 0x63 && dev->irq == 9 &&
> + dev->vendor == 0x8086 && dev->device == 0x2442){
> + dev->irq = 9;
> + pci_write_config_byte(dev, PCI_INTERRUPT_LINE, 9);
> + r->set(pirq_router_dev, dev, pirq, 9);
> + }

So...

if (dev->irq == 9) {
dev->irq = 9;
}

Are you sure it's right?

-- Pete

2002-04-19 16:19:47

by Jan Slupski

[permalink] [raw]
Subject: Re: [PATCH] Wrong IRQ for USB on Sony Vaio (dmi_scan.c, pci-irq.c)

On Fri, 19 Apr 2002, Pete Zaitcev wrote:

> > Broken BIOS of these notebooks assigns IRQ 10 for USB,
> > even though it is actually wired to IRQ 9.
> >
> > I use PCG-FX240 model of Sony Vaio, but I have proofs of other users,
> > that exactly the same problem exists on models:
> > FX200, FX220, FX250, FX270, FX290, FX370, FX503, R505JS, R505JL
> > These models use Intel's 82801BA controller, and Phoenix bios.
>
> My Z505JE works perfectly without it. In general Z505's are
> known to work.

I don't know nothing more than this...
I already send an email, and I hope I'll get DMI & PCI informations
for these computers.

(fwd)
From: girish <[email protected]>

Thanks for your USB patch. I got the USB mouse to work
on Sony Vaio PCG-R505JL. I installed RedHat 7.2 first
and the mouse would work for a few minutes and die
(with timeout messages appearing on
/var/log/messages). I did not find the source code for
redhat on the CD. So I ended up compiling the latest
kernel (2.4.18). This is the first time I compiled the
linux kernel, couldn't have been easier!

(fwd)
From: Kirk VanOpdorp <[email protected]>

I had the same USB problem on the Sony PCG-R505JS laptop. Your kernel
patch worked perfectly. At least on the 2.4.18 kernel.

> > + dev->irq = 9;
> > + pci_write_config_byte(dev, PCI_INTERRUPT_LINE, 9);
> > + r->set(pirq_router_dev, dev, pirq, 9);
> > + }
>
> So...
>
> if (dev->irq == 9) {
> dev->irq = 9;
> }
>
> Are you sure it's right?

OK.
This line isn't very important. ;)
Other two are!

I just modified HP Pavillion code taht do the same, but
numbers are other .

Jan

_ _ _ _ _____________________________________________
| |_| |\ | S L U P S K I [email protected]
|_| | | | \| http://www.pm.waw.pl/~jslupski



2002-04-19 17:05:17

by Daniel Jacobowitz

[permalink] [raw]
Subject: Re: [PATCH] Wrong IRQ for USB on Sony Vaio (dmi_scan.c, pci-irq.c)

On Fri, Apr 19, 2002 at 04:02:18PM +0200, Jan Slupski wrote:
>
> Hi,
>
> I'm writing once more about problem with IRQ assignment
> for Sony Vaio Laptops.
>
> Broken BIOS of these notebooks assigns IRQ 10 for USB,
> even though it is actually wired to IRQ 9.
>
> I use PCG-FX240 model of Sony Vaio, but I have proofs of other users,
> that exactly the same problem exists on models:
> FX200, FX220, FX250, FX270, FX290, FX370, FX503, R505JS, R505JL
> These models use Intel's 82801BA controller, and Phoenix bios.
>
> I wrote the patch that fix this. It is written on example of
> patch for HP Pavillion (taken from 2.4.19-pre7-ac1).
>
> This patch was tested on FX240.
> It is build for 2.4.18-pre7-ac1.
>
> Only problem is I don't have DMI Product names for all involved models.
> That's why I left pretty general:
> MATCH(DMI_PRODUCT_NAME, "PCG-")

Quite some time ago (~ November) Manfred posted a cleanup patch which
fixes this in a more generic way. You might want to ask him about it.

--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer

2002-04-20 00:45:41

by Bryan Rittmeyer

[permalink] [raw]
Subject: Re: [PATCH] Wrong IRQ for USB on Sony Vaio (dmi_scan.c, pci-irq.c)

Jan Slupski wrote:
> I use PCG-FX240 model of Sony Vaio, but I have proofs of other users,
> that exactly the same problem exists on models:
> FX200, FX220, FX250, FX270, FX290, FX370, FX503, R505JS, R505JL
> These models use Intel's 82801BA controller, and Phoenix bios.

My FX150 is inflicted when using Sony's WinXP or Win2K BIOS.
The WinME BIOS it shipped with was fine... If you need to identify
problematic machines, I don't think the DMI product name check is
going to be sufficient... better match on BIOS revision also.

Note that the ACPI IRQ routing in the recent (20020329 for me)
ACPI patches is an effective workaround as well. It's turned
on by default when you enable ACPI, which you probably want to do
anyway on most of these laptops to get battery status, poweroff
on shutdown, etc.

-Bryan