[syslinux] [PATCH] pci: resize pci_device arrays

H. Peter Anvin hpa at zytor.com
Thu Jul 17 16:18:28 PDT 2008


Sebastian Herbszt wrote:
>  
>  struct pci_bus {
>  	uint16_t id;
> -	struct pci_device *pci_device[MAX_PCI_DEVICES];
> +	struct pci_device *pci_device[MAX_PCI_DEVICES * MAX_PCI_FUNC];
>  	uint8_t pci_device_count;
>  };
>  

I'm still thinking this should be 
pci_device[MAX_PCI_DEVICES][MAX_PCI_FUNC] to indicate that we're 
explicitly talking about slots here.

Also, uint8_t for "count" is unsafe since we can have up to 256 devices. 
  On the other hand, if we use a geographical (uncompacted) 
representation, perhaps the count is unnecessary.

>  struct pci_device_list {
> -	struct pci_device pci_device[MAX_PCI_DEVICES];
> +	struct pci_device pci_device[MAX_PCI_BUSES * MAX_PCI_DEVICES * MAX_PCI_FUNC];
>  	uint8_t count;
>  };

Using uint8_t for "count" here is even more wrong since we can have up 
to 65536 devices.

Also, each structure like this is over a megabyte in size.  How many of 
them will we *ever* have at the same time?

	-hpa




More information about the Syslinux mailing list