Help: Porting PCI driver from Linux/Intel -> PPC

Paul Mackerras paulus at cs.anu.edu.au
Fri Jun 25 12:11:11 EST 1999


Albrecht =?iso-8859-1?Q?Dre=DF?= <ad at MPIfR-Bonn.MPG.de> wrote:

> 	I wrote a driver for a pci dsp card, which works fine on several Intel/
> Linux boxes both with 2.0.x and 2.2.x.  This encouraged to make a test with my
> PMac 7300/166, running R5 with the stock 2.2.6 kernel.  I compiled and inserted
> the driver --- and got a kernel panic :-(

A machine check?  That will happen if you try to access an I/O port
which doesn't respond.

> Maybe I missed some setup which is needed with LinuxPPC but not with Intel?  Or

PCI cards don't automatically their memory and I/O accesses enabled on
powermacs.  Arguably the generic PCI stuff in the kernel should turn
on memory and I/O accesses, and it should probably also check that the
addresses assigned by Open Firmware are sane.

> Now I try to insmod my driver, which reads the configuration space (using calls
> to pci_read_config_dword) and dumps it, reads irq and board revision, reads the
> base adresses of the five io regions, and reads one io address via inl().  The

Ideally you should use pci_find_device and then use the base_address
and irq fields from the pci_dev structure it returns.  And for
powermacs, you will need to set the bit in the config-space control
register to enable I/O accesses.

> * lspci reports irq #25, but the value in the config space is 1

Use pci_dev->irq instead, it should be correct.

> * the regions 0 to 3 are 256 bytes each, so they would overlap if the values
>   reported would be correct.

Possibly OF's fault.  I assume that if you write 0xffffffff into those
base address registers, you get back 0xffffff01, indicating 256 bytes
of I/O space?

Paul.

[[ This message was sent via the linuxppc-dev mailing list.  Replies are ]]
[[ not  forced  back  to the list, so be sure to Cc linuxppc-dev if your ]]
[[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting.   ]]





More information about the Linuxppc-dev mailing list