Lines Matching refs:devfn

48         u8 devfn;  member
253 u8 dev = PCI_SLOT(pdev->devfn); in check_pdev()
254 u8 func = PCI_FUNC(pdev->devfn); in check_pdev()
300 static struct pci_dev *alloc_pdev(struct pci_seg *pseg, u8 bus, u8 devfn) in alloc_pdev() argument
305 if ( pdev->bus == bus && pdev->devfn == devfn ) in alloc_pdev()
314 *((u8*) &pdev->devfn) = devfn; in alloc_pdev()
318 if ( pci_find_cap_offset(pseg->nr, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), in alloc_pdev()
335 switch ( pdev->type = pdev_type(pseg->nr, bus, devfn) ) in alloc_pdev()
343 sec_bus = pci_conf_read8(pseg->nr, bus, PCI_SLOT(devfn), in alloc_pdev()
344 PCI_FUNC(devfn), PCI_SECONDARY_BUS); in alloc_pdev()
345 sub_bus = pci_conf_read8(pseg->nr, bus, PCI_SLOT(devfn), in alloc_pdev()
346 PCI_FUNC(devfn), PCI_SUBORDINATE_BUS); in alloc_pdev()
353 pseg->bus2bridge[sec_bus].devfn = devfn; in alloc_pdev()
359 pos = pci_find_cap_offset(pseg->nr, bus, PCI_SLOT(devfn), in alloc_pdev()
360 PCI_FUNC(devfn), PCI_CAP_ID_EXP); in alloc_pdev()
362 cap = pci_conf_read16(pseg->nr, bus, PCI_SLOT(devfn), in alloc_pdev()
363 PCI_FUNC(devfn), pos + PCI_EXP_DEVCAP); in alloc_pdev()
368 if ( PCI_FUNC(devfn) >= pdev->phantom_stride ) in alloc_pdev()
378 phantom_devs[i].slot == PCI_SLOT(devfn) && in alloc_pdev()
379 phantom_devs[i].stride > PCI_FUNC(devfn) ) in alloc_pdev()
394 pseg->nr, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), pdev->type); in alloc_pdev()
412 dev = PCI_SLOT(pdev->devfn); in free_pdev()
413 func = PCI_FUNC(pdev->devfn); in free_pdev()
442 int __init pci_hide_device(int bus, int devfn) in pci_hide_device() argument
448 pdev = alloc_pdev(get_pseg(0), bus, devfn); in pci_hide_device()
459 int __init pci_ro_device(int seg, int bus, int devfn) in pci_ro_device() argument
466 pdev = alloc_pdev(pseg, bus, devfn); in pci_ro_device()
480 __set_bit(PCI_BDF2(bus, devfn), pseg->ro_map); in pci_ro_device()
486 struct pci_dev *pci_get_pdev(int seg, int bus, int devfn) in pci_get_pdev() argument
493 ASSERT(bus != -1 || devfn == -1); in pci_get_pdev()
506 (pdev->devfn == devfn || devfn == -1) ) in pci_get_pdev()
514 struct pci_dev *pci_get_real_pdev(int seg, int bus, int devfn) in pci_get_real_pdev() argument
519 if ( seg < 0 || bus < 0 || devfn < 0 ) in pci_get_real_pdev()
522 for ( pdev = pci_get_pdev(seg, bus, devfn), stride = 4; in pci_get_real_pdev()
525 if ( !(devfn & (8 - stride)) ) in pci_get_real_pdev()
527 pdev = pci_get_pdev(seg, bus, devfn & ~(8 - stride)); in pci_get_real_pdev()
536 int bus, int devfn) in pci_get_pdev_by_domain() argument
542 ASSERT(bus != -1 || devfn == -1); in pci_get_pdev_by_domain()
555 (pdev->devfn == devfn || devfn == -1) && in pci_get_pdev_by_domain()
573 u8 dev = PCI_SLOT(pdev->devfn); in pci_enable_acs()
574 u8 func = PCI_FUNC(pdev->devfn); in pci_enable_acs()
579 pos = pci_find_ext_capability(seg, bus, pdev->devfn, PCI_EXT_CAP_ID_ACS); in pci_enable_acs()
605 int pci_add_device(u16 seg, u8 bus, u8 devfn, in pci_add_device() argument
610 unsigned int slot = PCI_SLOT(devfn), func = PCI_FUNC(devfn); in pci_add_device()
620 pdev = pci_get_pdev(seg, info->physfn.bus, info->physfn.devfn); in pci_add_device()
625 pci_add_device(seg, info->physfn.bus, info->physfn.devfn, in pci_add_device()
637 ret = xsm_resource_plug_pci(XSM_PRIV, (seg << 16) | (bus << 8) | devfn); in pci_add_device()
647 pdev = alloc_pdev(pseg, bus, devfn); in pci_add_device()
665 unsigned int pos = pci_find_ext_capability(seg, bus, devfn, in pci_add_device()
770 int pci_remove_device(u16 seg, u8 bus, u8 devfn) in pci_remove_device() argument
776 ret = xsm_resource_unplug_pci(XSM_PRIV, (seg << 16) | (bus << 8) | devfn); in pci_remove_device()
787 if ( pdev->bus == bus && pdev->devfn == devfn ) in pci_remove_device()
795 seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); in pci_remove_device()
854 u8 bus, devfn; in pci_release_devices() local
867 devfn = pdev->devfn; in pci_release_devices()
868 if ( deassign_device(d, pdev->seg, bus, devfn) ) in pci_release_devices()
871 PCI_SLOT(devfn), PCI_FUNC(devfn)); in pci_release_devices()
881 enum pdev_type pdev_type(u16 seg, u8 bus, u8 devfn) in pdev_type() argument
884 u8 d = PCI_SLOT(devfn), f = PCI_FUNC(devfn); in pdev_type()
918 int find_upstream_bridge(u16 seg, u8 *bus, u8 *devfn, u8 *secbus) in find_upstream_bridge() argument
938 *devfn = pseg->bus2bridge[*bus].devfn; in find_upstream_bridge()
964 void pci_check_disable_device(u16 seg, u8 bus, u8 devfn) in pci_check_disable_device() argument
971 pdev = pci_get_real_pdev(seg, bus, devfn); in pci_check_disable_device()
988 devfn = pdev->devfn; in pci_check_disable_device()
989 cword = pci_conf_read16(seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), in pci_check_disable_device()
991 pci_conf_write16(seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), in pci_check_disable_device()
1048 int (*handler)(u8 devfn, struct pci_dev *);
1054 u8 devfn = pdev->devfn; in setup_one_hwdom_device() local
1057 int err = ctxt->handler(devfn, pdev); in setup_one_hwdom_device()
1062 pdev->seg, pdev->bus, PCI_SLOT(devfn), PCI_FUNC(devfn), in setup_one_hwdom_device()
1064 if ( devfn == pdev->devfn ) in setup_one_hwdom_device()
1067 devfn += pdev->phantom_stride; in setup_one_hwdom_device()
1068 } while ( devfn != pdev->devfn && in setup_one_hwdom_device()
1069 PCI_SLOT(devfn) == PCI_SLOT(pdev->devfn) ); in setup_one_hwdom_device()
1075 int bus, devfn; in _setup_hwdom_pci_devices() local
1079 for ( devfn = 0; devfn < 256; devfn++ ) in _setup_hwdom_pci_devices()
1081 struct pci_dev *pdev = pci_get_pdev(pseg->nr, bus, devfn); in _setup_hwdom_pci_devices()
1101 PCI_SLOT(devfn), PCI_FUNC(devfn)); in _setup_hwdom_pci_devices()
1123 struct domain *d, int (*handler)(u8 devfn, struct pci_dev *)) in setup_hwdom_pci_devices() argument
1141 p->device == PCI_SLOT(pdev->devfn) && in hest_match_pci()
1142 p->function == PCI_FUNC(pdev->devfn); in hest_match_pci()
1149 PCI_SLOT(pdev->devfn), in hest_match_type()
1150 PCI_FUNC(pdev->devfn), in hest_match_type()
1153 PCI_SLOT(pdev->devfn), in hest_match_type()
1154 PCI_FUNC(pdev->devfn), in hest_match_type()
1165 return pci_conf_read16(pdev->seg, pdev->bus, PCI_SLOT(pdev->devfn), in hest_match_type()
1166 PCI_FUNC(pdev->devfn), PCI_CLASS_DEVICE) == in hest_match_type()
1225 return pci_find_cap_offset(pdev->seg, pdev->bus, PCI_SLOT(pdev->devfn), in pcie_aer_get_firmware_first()
1226 PCI_FUNC(pdev->devfn), PCI_CAP_ID_EXP) && in pcie_aer_get_firmware_first()
1243 PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), in _dump_pci_devices()
1287 u8 devfn; in iommu_add_device() local
1298 rc = hd->platform_ops->add_device(pdev->devfn, pci_to_dev(pdev)); in iommu_add_device()
1302 for ( devfn = pdev->devfn ; ; ) in iommu_add_device()
1304 devfn += pdev->phantom_stride; in iommu_add_device()
1305 if ( PCI_SLOT(devfn) != PCI_SLOT(pdev->devfn) ) in iommu_add_device()
1307 rc = hd->platform_ops->add_device(devfn, pci_to_dev(pdev)); in iommu_add_device()
1310 pdev->seg, pdev->bus, PCI_SLOT(devfn), PCI_FUNC(devfn), rc); in iommu_add_device()
1334 u8 devfn; in iommu_remove_device() local
1343 for ( devfn = pdev->devfn ; pdev->phantom_stride; ) in iommu_remove_device()
1347 devfn += pdev->phantom_stride; in iommu_remove_device()
1348 if ( PCI_SLOT(devfn) != PCI_SLOT(pdev->devfn) ) in iommu_remove_device()
1350 rc = hd->platform_ops->remove_device(devfn, pci_to_dev(pdev)); in iommu_remove_device()
1355 pdev->seg, pdev->bus, PCI_SLOT(devfn), PCI_FUNC(devfn), rc); in iommu_remove_device()
1359 return hd->platform_ops->remove_device(pdev->devfn, pci_to_dev(pdev)); in iommu_remove_device()
1366 static int device_assigned(u16 seg, u8 bus, u8 devfn) in device_assigned() argument
1371 pdev = pci_get_pdev_by_domain(hardware_domain, seg, bus, devfn); in device_assigned()
1377 static int assign_device(struct domain *d, u16 seg, u8 bus, u8 devfn, u32 flag) in assign_device() argument
1404 pdev = pci_get_pdev_by_domain(hardware_domain, seg, bus, devfn); in assign_device()
1407 rc = pci_get_pdev(seg, bus, devfn) ? -EBUSY : -ENODEV; in assign_device()
1416 if ( (rc = hd->platform_ops->assign_device(d, devfn, pci_to_dev(pdev), flag)) ) in assign_device()
1421 devfn += pdev->phantom_stride; in assign_device()
1422 if ( PCI_SLOT(devfn) != PCI_SLOT(pdev->devfn) ) in assign_device()
1424 rc = hd->platform_ops->assign_device(d, devfn, pci_to_dev(pdev), flag); in assign_device()
1427 d->domain_id, seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), in assign_device()
1440 int deassign_device(struct domain *d, u16 seg, u8 bus, u8 devfn) in deassign_device() argument
1450 pdev = pci_get_pdev_by_domain(d, seg, bus, devfn); in deassign_device()
1456 devfn += pdev->phantom_stride; in deassign_device()
1457 if ( PCI_SLOT(devfn) != PCI_SLOT(pdev->devfn) ) in deassign_device()
1459 ret = hd->platform_ops->reassign_device(d, hardware_domain, devfn, in deassign_device()
1465 d->domain_id, seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), ret); in deassign_device()
1469 devfn = pdev->devfn; in deassign_device()
1470 ret = hd->platform_ops->reassign_device(d, hardware_domain, devfn, in deassign_device()
1476 d->domain_id, seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); in deassign_device()
1489 struct domain *d, u16 seg, u8 bus, u8 devfn, in iommu_get_device_group() argument
1502 group_id = ops->get_device_group_id(seg, bus, devfn); in iommu_get_device_group()
1508 ((pdev->bus == bus) && (pdev->devfn == devfn)) ) in iommu_get_device_group()
1511 if ( xsm_get_device_group(XSM_HOOK, (seg << 16) | (pdev->bus << 8) | pdev->devfn) ) in iommu_get_device_group()
1514 sdev_id = ops->get_device_group_id(seg, pdev->bus, pdev->devfn); in iommu_get_device_group()
1519 bdf |= (pdev->devfn & 0xff) << 8; in iommu_get_device_group()
1555 d->domain_id, pdev->seg, pdev->bus, PCI_SLOT(pdev->devfn), in iommu_dev_iotlb_flush_timeout()
1556 PCI_FUNC(pdev->devfn)); in iommu_dev_iotlb_flush_timeout()
1568 u8 bus, devfn; in iommu_do_pci_domctl() local
1587 devfn = PCI_DEVFN2(domctl->u.get_device_group.machine_sbdf); in iommu_do_pci_domctl()
1591 ret = iommu_get_device_group(d, seg, bus, devfn, sdevs, max_sdevs); in iommu_do_pci_domctl()
1638 devfn = PCI_DEVFN2(machine_sbdf); in iommu_do_pci_domctl()
1640 ret = device_assigned(seg, bus, devfn); in iommu_do_pci_domctl()
1647 seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); in iommu_do_pci_domctl()
1653 ret = assign_device(d, seg, bus, devfn, flags); in iommu_do_pci_domctl()
1660 seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), in iommu_do_pci_domctl()
1689 devfn = PCI_DEVFN2(machine_sbdf); in iommu_do_pci_domctl()
1692 ret = deassign_device(d, seg, bus, devfn); in iommu_do_pci_domctl()
1697 seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), in iommu_do_pci_domctl()