mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-10 21:29:20 +00:00
HV: define function bdf_is_equal() to compare bdf
Use a function to compare bdf instead and some related code cleanup Tracked-On: #2534 Signed-off-by: dongshen <dongsheng.x.zhang@intel.com> Reviewed-by: Eddie Dong <eddie.dong@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -34,17 +34,18 @@
|
||||
|
||||
static struct pci_vdev *partition_mode_find_vdev(struct acrn_vpci *vpci, union pci_bdf vbdf)
|
||||
{
|
||||
struct pci_vdev *vdev = NULL;
|
||||
struct pci_vdev *vdev, *tmp;
|
||||
struct acrn_vm_config *vm_config = get_vm_config(vpci->vm->vm_id);
|
||||
int32_t i;
|
||||
|
||||
vdev = NULL;
|
||||
for (i = 0; i < vm_config->pci_ptdev_num; i++) {
|
||||
vdev = &vpci->vm->pci_vdevs[i];
|
||||
tmp = &vpci->vm->pci_vdevs[i];
|
||||
|
||||
if (vdev->vbdf.value == vbdf.value) {
|
||||
if (bdf_is_equal(&(tmp->vbdf), &vbdf)) {
|
||||
vdev = tmp;
|
||||
break;
|
||||
}
|
||||
vdev = NULL;
|
||||
}
|
||||
|
||||
return vdev;
|
||||
|
@@ -35,13 +35,16 @@ static struct pci_vdev sharing_mode_vdev_array[CONFIG_MAX_PCI_DEV_NUM];
|
||||
|
||||
struct pci_vdev *sharing_mode_find_vdev(union pci_bdf pbdf)
|
||||
{
|
||||
struct pci_vdev *vdev = NULL;
|
||||
struct pci_vdev *vdev, *tmp;
|
||||
uint32_t i;
|
||||
|
||||
vdev = NULL;
|
||||
/* SOS_VM uses phys BDF */
|
||||
for (i = 0U; i < num_pci_vdev; i++) {
|
||||
if (sharing_mode_vdev_array[i].pdev->bdf.value == pbdf.value) {
|
||||
vdev = &sharing_mode_vdev_array[i];
|
||||
tmp = &sharing_mode_vdev_array[i];
|
||||
if ((tmp->pdev != NULL) && bdf_is_equal((union pci_bdf*)&(tmp->pdev->bdf), &pbdf)) {
|
||||
vdev = tmp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user