Architecture dependant stuff in PCI drivers

Hans Eric =?ISO-8859-1?Q?Sandstr=F6m (hes@xinit.se)
Tue, 25 Aug 1998 10:16:56 +0200


On Mon, 24 Aug 1998, Gerard Roudier wrote:
>There is lots of architecture dependant stuff in the ncr driver.
>Most of this stuff has been added to support the ppc and sparc.
>This seems to demonstrate that we donnot have enough abstraction to
>deal cleanly with PCI in Linux.
>Looking into the current PCI code status does not require good memory,
>half an eye should be enough. :-)

This triggered something in my memory. While I was setting up a file
server using an old Fujitsu Ergo Pro x (Pentium 75 PC) I had to enable
one of these supposedly arcitecture dependant features(bugs) on my
Pentium.

It's was this piece of code:
#ifdef __powerpc__
/*
* Several fix-up for power/pc.
* Should not be performed by the driver.
*/
if (!(command & PCI_COMMAND_MASTER)) {
printk("ncr53c8xx: attempting to force
PCI_COMMAND_MASTER...");
command |= PCI_COMMAND_MASTER;
pcibios_write_config_word(bus, device_fn, PCI_COMMAND,
command);
pcibios_read_config_word(bus, device_fn, PCI_COMMAND,
&command);
if (!(command & PCI_COMMAND_MASTER)) {
printk("failed!\n");
} else {
printk("succeeded.\n");
}
}

--

The master bit was not enabled by my (probably buggy) bios. So removing the #ifdef __powerpc__ solved the problem on my i386 machine.

The above picece of code should probably not be surrounded by #ifdef __powerpc__ since it seems to fix some bug/feature/odd behaviour of the bios in the ncr810 card I used.

A quick look around revelals the same fix in several drivers. In the am53c974.c drive the following comment can be found: /* PCI Spec 2.1 states that it is either the driver's or the PCI card's responsibility to set the PCI Master Enable Bit if needed. (from Mark Stockton <marks@schooner.sys.hou.compaq.com>) */

Is there somebody out there who knows PCI specs that can explain this and then probably remove some unnessesarly #ifdef __<meta>__ arcitecture dependant stuff from the drivers. This issue seems to go across all drivers/pci cards that requre bus mastering so a generic fix for all drivers would be nice.

Sincerely

Hans Eric Sandstrom (hes@xinit.se)

ps. Please CC me.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html