mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-07 03:40:27 +00:00
HV: move bar emulation initialization code to pci_pt.c
Create the init_vdev_pt() function to host bar emulation initialization code Add design philosophy for bar emulation Move common functions to pci.h as they are generic and can be used by other files. Rename is_valid_bar to is_bar_supported and keep it as a private local function in pci_pt.c Tracked-On: #3056 Signed-off-by: dongshen <dongsheng.x.zhang@intel.com> Reviewed-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
committed by
ACRN System Integration
parent
67b2e2b82b
commit
32d1a9da02
@@ -220,14 +220,31 @@ static inline uint8_t pci_devfn(uint16_t bdf)
|
||||
return (uint8_t)(bdf & 0xFFU);
|
||||
}
|
||||
|
||||
/*
|
||||
* @pre a != NULL && b != NULL
|
||||
/**
|
||||
* @pre a != NULL
|
||||
* @pre b != NULL
|
||||
*/
|
||||
static inline bool bdf_is_equal(const union pci_bdf *a, const union pci_bdf *b)
|
||||
{
|
||||
return (a->value == b->value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @pre bar != NULL
|
||||
*/
|
||||
static inline bool is_mmio_bar(const struct pci_bar *bar)
|
||||
{
|
||||
return (bar->type == PCIBAR_MEM32) || (bar->type == PCIBAR_MEM64);
|
||||
}
|
||||
|
||||
/**
|
||||
* @pre bar != NULL
|
||||
*/
|
||||
static inline bool is_valid_bar_size(const struct pci_bar *bar)
|
||||
{
|
||||
return (bar->size > 0UL) && (bar->size <= 0xffffffffU);
|
||||
}
|
||||
|
||||
uint32_t pci_pdev_read_cfg(union pci_bdf bdf, uint32_t offset, uint32_t bytes);
|
||||
void pci_pdev_write_cfg(union pci_bdf bdf, uint32_t offset, uint32_t bytes, uint32_t val);
|
||||
void enable_disable_pci_intx(union pci_bdf bdf, bool enable);
|
||||
|
Reference in New Issue
Block a user