Sebastian Herbszt
2008-Jul-13 16:44 UTC
[syslinux] [PATCH] pci: Introduce slot and function information
Introduce slot and function information to pci_device and fill them in pci_scan(). - Sebastian Index: syslinux-3.71-pre5-3-g852d962/com32/include/sys/pci.h ==================================================================--- syslinux-3.71-pre5-3-g852d962.orig/com32/include/sys/pci.h 2008-07-09 22:20:36.000000000 +0200 +++ syslinux-3.71-pre5-3-g852d962/com32/include/sys/pci.h 2008-07-09 22:21:06.000000000 +0200 @@ -19,6 +19,8 @@ /* a struct to represent a pci device */ struct pci_device { + uint8_t slot; + uint8_t func; uint16_t vendor; uint16_t product; uint16_t sub_vendor; Index: syslinux-3.71-pre5-3-g852d962/com32/lib/pci/scan.c ==================================================================--- syslinux-3.71-pre5-3-g852d962.orig/com32/lib/pci/scan.c 2008-07-09 22:20:36.000000000 +0200 +++ syslinux-3.71-pre5-3-g852d962/com32/lib/pci/scan.c 2008-07-09 22:21:06.000000000 +0200 @@ -381,6 +381,8 @@ struct pci_device *pci_device &pci_device_list-> pci_device[pci_device_list->count]; + pci_device->slot = dev; + pci_device->func = func; pci_device->product = did >> 16; pci_device->sub_product = sid >> 16; pci_device->vendor = (did << 16) >> 16;
Sebastian Herbszt
2008-Jul-13 16:44 UTC
[syslinux] [PATCH] pcitest: Display bus, slot and function
Change the output format to display bus, slot and function. - Sebastian Index: syslinux-3.71-pre5-3-g852d962/com32/modules/pcitest.c ==================================================================--- syslinux-3.71-pre5-3-g852d962.orig/com32/modules/pcitest.c 2008-07-09 22:20:36.000000000 +0200 +++ syslinux-3.71-pre5-3-g852d962/com32/modules/pcitest.c 2008-07-09 22:21:08.000000000 +0200 @@ -82,7 +82,8 @@ int pci_dev; for (pci_dev=0; pci_dev < pci_bus.pci_device_count; pci_dev++) { struct pci_device pci_device=*(pci_bus.pci_device[pci_dev]); - printf("%s :%04x:%04x[%04x:%04x]) %s:%s\n", + printf("%02x:%02x.%01x %s :%04x:%04x[%04x:%04x]) %s:%s\n", + pci_bus.id, pci_device.slot, pci_device.func, pci_device.pci_dev_info->linux_kernel_module, pci_device.vendor, pci_device.product, pci_device.sub_vendor, pci_device.sub_product,
H. Peter Anvin
2008-Jul-14 00:59 UTC
[syslinux] [PATCH] pci: Introduce slot and function information
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. 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 -- or use dynamically allocated linked lists. What do you think? -hpa
Sebastian Herbszt
2008-Aug-01 19:25 UTC
[syslinux] [PATCH] pci: Introduce slot and function information
Peter, will you consider those two patches for 3.72? - Sebastian
Keith Schincke
2008-Aug-01 23:44 UTC
[syslinux] [PATCH] pci: Introduce slot and function information
Not a problem. I saw it come through after my posting. I will continue to watch the magic develop. Keith On Fri, Aug 1, 2008 at 4:35 PM, H. Peter Anvin <hpa at zytor.com> wrote:> Keith Schincke wrote: > > What would be your idea of the hierarchy? > > > > Would it be something like? > > > > struct bus { > > struct bus* next ; > > struct device* first ; > > }; > > > > struct device { > > struct device* next ; > > struct bus* parent ; > > void * func1 ; > > void * func 2 ; > > .... > > } ; > > > > ( My C is rusty from too much Perl.) > > See the patch I just posted. > > -hpa > > _______________________________________________ > SYSLINUX mailing list > Submissions to SYSLINUX at zytor.com > Unsubscribe or set options at: > http://www.zytor.com/mailman/listinfo/syslinux > Please do not send private replies to mailing list traffic. > >