mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-23 17:58:30 +00:00
hv: pci: replace fucntion like macro with inline func
Replace fucntion like macro with inline function. Tracked-on: #1747 Signed-off-by: Binbin Wu <binbin.wu@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -49,10 +49,6 @@
|
||||
#define PCI_BAR_COUNT 0x6U
|
||||
#define PCI_REGMAX 0xFFU
|
||||
|
||||
#define PCI_BUS(bdf) (((bdf) >> 8U) & 0xFFU)
|
||||
#define PCI_SLOT(bdf) (((bdf) & 0xFFU) >> 3U)
|
||||
#define PCI_FUNC(bdf) ((bdf) & 0x7U)
|
||||
|
||||
/* I/O ports */
|
||||
#define PCI_CONFIG_ADDR 0xCF8U
|
||||
#define PCI_CONFIG_DATA 0xCFCU
|
||||
@@ -159,6 +155,21 @@ static inline bool pci_bar_access(uint32_t offset)
|
||||
}
|
||||
}
|
||||
|
||||
static inline uint8_t pci_bus(uint16_t bdf)
|
||||
{
|
||||
return (uint8_t)((bdf >> 8U) & 0xFFU);
|
||||
}
|
||||
|
||||
static inline uint8_t pci_slot(uint16_t bdf)
|
||||
{
|
||||
return (uint8_t)((bdf >> 3U) & 0x1FU);
|
||||
}
|
||||
|
||||
static inline uint8_t pci_func(uint16_t bdf)
|
||||
{
|
||||
return (uint8_t)(bdf & 0x7U);
|
||||
}
|
||||
|
||||
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