Subject: Re: Changing the BAR of a PCI device at driver load time
To: Nathan J. Williams <nathanw@wasabisystems.com>
From: None <10.50@free.fr>
List: tech-kern
Date: 09/07/2003 20:38:35
Selon "Nathan J. Williams" <nathanw@wasabisystems.com>:

> Vincent <10.50@free.fr> writes:
> 
> > since I have updated the Bios on my Compaq Presario laptop, the EHCI
> > driver has quit to work. The registers won't read anything else than FF
> > in MEM space, while the conf space accesses works fine.
> Do you have the same failure with the OHCI or UHCI drivers? The EHCI
> stuff is still a bit bleeding-edge, as I understand it, so it may not
> be worth the trouble.

The NEC chip provides three controlers in one physical chip : two ohci, one 
ehci. The two Ohci work fine, only the ehci fails.
It worked fine before I reprogramed the Bios. Talk about Bios updates :)

> 
> > I tinkered around in the ehci_pci.c code, and found nothing. At last, I
> > suspected a BIOS bug in the programming of the PCI bridge. To check it
> > out, in the driver, I reprogrammed the BAR to close up to another chip
> > which works, and, indeed, I could read normally at least one of the
> > registers whose access was impossible before.
> 
> What value is originally in the BAR, and what are you setting it to?

The ohci2 BAR is at 80280000. The ehci BAR is at 80300000. I switched 80300000 
to 802A0000, and could read at least one register.

There is something else : 80300000 is EHCI at pci bus 2, while 80380000 is VGA 
(Radeon chip) on PCI bus 1. I saw somewhere in the code roundings at a 1 MHz 
granularity. Can it be some kind of confusion between the two buses ?

> > Yet, if I could read the capability register, a write access
> > generated a page fault, and I was thrown into ddb with a uvm_page_fault
> > (even after a pci_mapreg_map with the updated BAR value).
> 
> And there's no mapping of the old address before you change it?

Before I change the bar, every read at the BAR mem space ends up as a 
0xffffffff, whatever the offset is.

Thanks for the help !
Vincent