mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-20 16:28:10 +00:00
HV: remove all CONFIG_PARTITION_MODE from dm/vpci code
Instead of using CONFIG_PARTITION_MODE at compile time to compile in and call the partition mode/sharing mode specific functions, always compile in all sharing mode and partition code, then calling the corresponding functions dynamically based on vm type (PRE_LAUNCHED_VM and SOS_VM) at runtime. Some misra c fix: Add @pre for functions Add const to function parameters Add ASSERT in pci_cfgdata_io_read and pci_cfgdata_io_write Tracked-On: #2534 Signed-off-by: dongshen <dongsheng.x.zhang@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
committed by
ACRN System Integration
parent
691468a361
commit
c6a60dd29c
@@ -42,6 +42,10 @@ static inline uint32_t pci_bar_base(uint32_t bar)
|
||||
return bar & PCIM_BAR_MEM_BASE;
|
||||
}
|
||||
|
||||
#if defined(HV_DEBUG)
|
||||
/**
|
||||
* @pre vdev != NULL
|
||||
*/
|
||||
static int32_t validate(const struct pci_vdev *vdev)
|
||||
{
|
||||
uint32_t idx;
|
||||
@@ -59,7 +63,13 @@ static int32_t validate(const struct pci_vdev *vdev)
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @pre vdev != NULL
|
||||
* @pre vdev->vpci != NULL
|
||||
* @pre vdev->vpci->vm != NULL
|
||||
*/
|
||||
void vdev_pt_init(struct pci_vdev *vdev)
|
||||
{
|
||||
int32_t ret;
|
||||
@@ -90,6 +100,11 @@ void vdev_pt_init(struct pci_vdev *vdev)
|
||||
pci_pdev_write_cfg(vdev->pdev->bdf, PCIR_COMMAND, 2U, pci_command);
|
||||
}
|
||||
|
||||
/**
|
||||
* @pre vdev != NULL
|
||||
* @pre vdev->vpci != NULL
|
||||
* @pre vdev->vpci->vm != NULL
|
||||
*/
|
||||
void vdev_pt_deinit(const struct pci_vdev *vdev)
|
||||
{
|
||||
int32_t ret;
|
||||
@@ -102,6 +117,9 @@ void vdev_pt_deinit(const struct pci_vdev *vdev)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @pre vdev != NULL
|
||||
*/
|
||||
int32_t vdev_pt_cfgread(const struct pci_vdev *vdev, uint32_t offset,
|
||||
uint32_t bytes, uint32_t *val)
|
||||
{
|
||||
@@ -116,7 +134,12 @@ int32_t vdev_pt_cfgread(const struct pci_vdev *vdev, uint32_t offset,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void vdev_pt_remap_bar(struct pci_vdev *vdev, uint32_t idx,
|
||||
/**
|
||||
* @pre vdev != NULL
|
||||
* @pre vdev->vpci != NULL
|
||||
* @pre vdev->vpci->vm != NULL
|
||||
*/
|
||||
static void vdev_pt_remap_bar(const struct pci_vdev *vdev, uint32_t idx,
|
||||
uint32_t new_base)
|
||||
{
|
||||
struct acrn_vm *vm = vdev->vpci->vm;
|
||||
@@ -137,6 +160,9 @@ static void vdev_pt_remap_bar(struct pci_vdev *vdev, uint32_t idx,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @pre vdev != NULL
|
||||
*/
|
||||
static void vdev_pt_cfgwrite_bar(struct pci_vdev *vdev, uint32_t offset,
|
||||
uint32_t bytes, uint32_t new_bar_uos)
|
||||
{
|
||||
@@ -176,6 +202,9 @@ static void vdev_pt_cfgwrite_bar(struct pci_vdev *vdev, uint32_t offset,
|
||||
pci_vdev_write_cfg_u32(vdev, offset, new_bar);
|
||||
}
|
||||
|
||||
/**
|
||||
* @pre vdev != NULL
|
||||
*/
|
||||
int32_t vdev_pt_cfgwrite(struct pci_vdev *vdev, uint32_t offset,
|
||||
uint32_t bytes, uint32_t val)
|
||||
{
|
||||
|
Reference in New Issue
Block a user