pci_vdev: add pci_vdev_ops to pci_vdev

It will be used to define pci vdev own ops. And high level API
will call this ops intead of invoking device specific functions
directly.

Tracked-On: #3241
Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Yin Fengwei 2019-07-11 16:08:25 +08:00 committed by ACRN System Integration
parent 7a3ea2ad89
commit c2d25aafb8

View File

@ -64,6 +64,14 @@ union pci_cfgdata {
uint32_t data_32[(PCI_REGMAX + 1U) >> 4U]; uint32_t data_32[(PCI_REGMAX + 1U) >> 4U];
}; };
struct pci_vdev;
struct pci_vdev_ops {
void (*init_vdev)(struct pci_vdev *vdev);
void (*deinit_vdev)(struct pci_vdev *vdev);
int32_t (*write_vdev_cfg)(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t val);
int32_t (*read_vdev_cfg)(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t *val);
};
struct pci_vdev { struct pci_vdev {
const struct acrn_vpci *vpci; const struct acrn_vpci *vpci;
/* The bus/device/function triple of the virtual PCI device. */ /* The bus/device/function triple of the virtual PCI device. */
@ -85,6 +93,9 @@ struct pci_vdev {
/* Pointer to corresponding PCI PT device's vm_config */ /* Pointer to corresponding PCI PT device's vm_config */
struct acrn_vm_pci_ptdev_config *ptdev_config; struct acrn_vm_pci_ptdev_config *ptdev_config;
/* Pointer to corressponding operations */
struct pci_vdev_ops *vdev_ops;
}; };
struct pci_addr_info { struct pci_addr_info {