Re: PCI Express support for 2.4 kernel

Arjan van de Ven
2003-12-16T17:50:10Z

[-- Attachment #1: Type: text/plain, Size: 889 bytes --]

On Tue, 2003-12-16 at 18:10, Jeff Garzik wrote:

> > + spin_lock_irqsave(&pci_config_lock, flags);
> > + pci_exp_set_dev_base(bus, dev, fn);
> > + switch (len) {
> > + case 1:
> > + writeb(value, addr);
> > + break;
> > + case 2:
> > + writew(value, addr);
> > + break;
> > + case 4:
> > + writel(value, addr);
> > + break;
> > + }
> > + /* dummy read to flush PCI write */
> > + readb(addr);
>
> This is going to choke some hardware, I guarantee.
>
> You always want to make sure your flush is of the same size at the
> write. Reading a byte from an address that the hardware defines as
> "32-bit writes only" can get ugly real quick ;-)

also reading back addr might not be the best choice in case some
registers have side effects on reading, it's probably better to read
back an address that is known to be ok to read (like the vendor ID
field)

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]