unsigned int slot = PCI_SLOT(devfn), func = PCI_FUNC(devfn);
const char *pdev_type;
int ret;
+ bool pf_is_extfn = false;
- if (!info)
+ if ( !info )
pdev_type = "device";
- else if (info->is_extfn)
- pdev_type = "extended function";
- else if (info->is_virtfn)
+ else if ( info->is_virtfn )
{
pcidevs_lock();
pdev = pci_get_pdev(seg, info->physfn.bus, info->physfn.devfn);
+ if ( pdev )
+ pf_is_extfn = pdev->info.is_extfn;
pcidevs_unlock();
if ( !pdev )
pci_add_device(seg, info->physfn.bus, info->physfn.devfn,
NULL, node);
pdev_type = "virtual function";
}
+ else if ( info->is_extfn )
+ pdev_type = "extended function";
else
{
info = NULL;
pdev->node = node;
if ( info )
+ {
pdev->info = *info;
+ /*
+ * VF's 'is_extfn' field is used to indicate whether its PF is an
+ * extended function.
+ */
+ if ( pdev->info.is_virtfn )
+ pdev->info.is_extfn = pf_is_extfn;
+ }
else if ( !pdev->vf_rlen[0] )
{
unsigned int pos = pci_find_ext_capability(seg, bus, devfn,
if ( pdev == NULL )
return NULL;
- if ( pdev->info.is_extfn )
+ if ( pdev->info.is_virtfn )
{
- bus = pdev->bus;
- devfn = 0;
+ bus = pdev->info.physfn.bus;
+ devfn = !pdev->info.is_extfn ? pdev->info.physfn.devfn : 0;
}
- else if ( pdev->info.is_virtfn )
+ else if ( pdev->info.is_extfn )
{
- bus = pdev->info.physfn.bus;
- devfn = PCI_SLOT(pdev->info.physfn.devfn) ? 0 : pdev->info.physfn.devfn;
+ bus = pdev->bus;
+ devfn = 0;
}
else
{
#define PCI_SBDF3(s,b,df) ((((s) & 0xffff) << 16) | PCI_BDF2(b, df))
struct pci_dev_info {
+ /*
+ * VF's 'is_extfn' field is used to indicate whether its PF is an extended
+ * function.
+ */
bool_t is_extfn;
bool_t is_virtfn;
struct {