aboutsummaryrefslogtreecommitdiff
path: root/lib/pci.h
diff options
context:
space:
mode:
authorJohn Levon <john.levon@nutanix.com>2021-01-20 10:44:49 +0000
committerGitHub <noreply@github.com>2021-01-20 10:44:49 +0000
commit53cc29bc8ca5083b9b6075f151824d65557af6f0 (patch)
treee7ae6ef44eb87c81f74f1740d0da69614606d247 /lib/pci.h
parentfa5104150bca4182f8a38d39fa50f7e61982568e (diff)
downloadlibvfio-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.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/pci.h b/lib/pci.h
index faea75c..4b9f056 100644
--- a/lib/pci.h
+++ b/lib/pci.h
@@ -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 */