diff options
author | John Levon <john.levon@nutanix.com> | 2021-01-20 10:44:49 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-20 10:44:49 +0000 |
commit | 53cc29bc8ca5083b9b6075f151824d65557af6f0 (patch) | |
tree | e7ae6ef44eb87c81f74f1740d0da69614606d247 /lib/pci.h | |
parent | fa5104150bca4182f8a38d39fa50f7e61982568e (diff) | |
download | libvfio-user-53cc29bc8ca5083b9b6075f151824d65557af6f0.zip libvfio-user-53cc29bc8ca5083b9b6075f151824d65557af6f0.tar.gz libvfio-user-53cc29bc8ca5083b9b6075f151824d65557af6f0.tar.bz2 |
support extended capabilities (#226)
Provide initial support for extended capabilities, and implement handlers for
the Device Serial Number and Vendor-Specific capabilities.
Signed-off-by: John Levon <john.levon@nutanix.com>
Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
Diffstat (limited to 'lib/pci.h')
-rw-r--r-- | lib/pci.h | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -45,11 +45,17 @@ pci_config_space_access(vfu_ctx_t *vfu_ctx, char *buf, size_t count, loff_t pos, bool is_write); +static inline size_t +pci_config_space_size(vfu_ctx_t *vfu_ctx) +{ + return vfu_ctx->reg_info[VFU_PCI_DEV_CFG_REGION_IDX].size; +} + static inline uint8_t * pci_config_space_ptr(vfu_ctx_t *vfu_ctx, loff_t offset) { - assert(offset < vfu_ctx->reg_info[VFU_PCI_DEV_CFG_REGION_IDX].size); - return &vfu_ctx->pci.config_space->raw[offset]; + assert((size_t)offset < pci_config_space_size(vfu_ctx)); + return (uint8_t *)vfu_ctx->pci.config_space + offset; } #endif /* LIB_VFIO_USER_PCI_H */ |