Subject: Re: Calling PCI Autoconfig again

From: David Hawkins <[email-masked]>
Date: Mon, 06 Mar 2006 20:32:39 -0800

Wyse, Chris wrote:
> Hi,
>  
> I'm working on a board (PPC440GX CPU) that has an FPGA on it.  The FPGA 
> software has a PCI interface.  If I load the FPGA, then boot the Linux 
> kernel, the FPGA is recognized as a device on the PCI bus.  However, I'd 
> like to load the FPGA after the kernel has booted, then run autoconfig 
> again to detect the device.  What's the best way to do this? 
>  
> Please send responses directly to me (in addition to the list), since I 
> am not subscribed to the list.

Hi Chris,

I haven't had to do this, but I've thought about how I might do it.

In compact PCI, you can hot-swap a PCI device, and the Linux host
is supposed to go and re-enumerate the PCI bus. There is a
pci (host-side) hotplug skeleton in the source;

linux-2.6/drivers/pci/hotplug/pcihp_skeleton.c

I believe you can do the following;

   - consider the 440GX is a hotplug controller
     (and write a hotplug driver appropriately)
   - when Linux loads the FPGA, the FPGA generates a hotplug
     event, i.e., it just got plugged in
     (I'm not sure what signal is generated, perhaps a
      power-management interrupt PME#?)
   - the 440GX hotplug controller re-enumerates the PCI bus
     and finds the device

I'm sure you can get an idea from the hotplug skeleton what
re-enumeration entails.

Cheers
Dave