[syslinux] [PATCH] pci: Introduce slot and function information

Sebastian Herbszt herbszt at gmx.de
Mon Jul 14 12:43:52 PDT 2008


H. Peter Anvin wrote:
> Sebastian Herbszt wrote:
>> Introduce slot and function information to pci_device and fill them in pci_scan().
> 
> Hm.  I started digging into this, and it's pretty clear we have a 
> serious problem.
> 
> I was originally going to propose that if we're going to have the device 
> address in there, we should include either the bus number or a back 
> pointer to the bus.
> 
> However, the worse problem is that we use a fixed size for the 
> pci_device[] array of MAX_PCI_DEVICES, but then we populate the array 
> with *functions*, and there can be MAX_PCI_DEVICES*MAX_PCI_FUNC (256) of 
> those.

Oops, nice find.

> Given that, I'm thinking that we should do one of two things: either 
> retain the fixed-sized arrays, but size them appropriately, *and* just 
> make the array slot used strictly based on device address (i.e. dev:func 
> in this case) -- in that case, there is no need to store any of that -- 

The first part means change pci_device[MAX_PCI_DEVICES] to
pci_device[MAX_PCI_DEVICES*MAX_PCI_FUNC] in pci.h.
And the second part means assign pci_device[12*3] for device 12 function 3?

>   or use dynamically allocated linked lists.

I have given it a try and my current code is pretty broken now. Guess the first
approach would be easier.
How much do you care about a stable api?

- Sebastian




More information about the Syslinux mailing list