@@ -599,21 +599,24 @@ int pci_add_device(u16 seg, u8 bus, u8 devfn,
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;
@@ -707,6 +710,9 @@ int pci_add_device(u16 seg, u8 bus, u8 devfn,
seg, bus, slot, func, ctrl);
}
+ /* VF's 'is_extfn' is used to indicate whether PF is an extended function */
+ if ( pdev->info.is_virtfn )
+ pdev->info.is_extfn = pf_is_extfn;
check_pdev(pdev);
ret = 0;
@@ -211,15 +211,15 @@ struct acpi_drhd_unit *acpi_find_matched_drhd_unit(const struct pci_dev *pdev)
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 ? 0 : pdev->info.physfn.devfn;
}
- 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
{
@@ -39,6 +39,7 @@
#define PCI_SBDF3(s,b,df) ((((s) & 0xffff) << 16) | PCI_BDF2(b, df))
struct pci_dev_info {
+ /* VF's 'is_extfn' is used to show whether its PF an extended function */
bool_t is_extfn;
bool_t is_virtfn;
struct {