diff options
author | Thanos Makatos <thanos.makatos@nutanix.com> | 2019-08-27 10:44:20 -0400 |
---|---|---|
committer | Felipe Franciosi <felipe@nutanix.com> | 2019-09-05 16:45:35 +0100 |
commit | a73227984d65ce8a1b2502af1e6303865447eae3 (patch) | |
tree | f057164d862cd19806afd7748137fc5746bfeb71 /lib/pci.h | |
parent | 60a31a430a5b68521c5ff4caed263d9933a5a826 (diff) | |
download | libvfio-user-a73227984d65ce8a1b2502af1e6303865447eae3.zip libvfio-user-a73227984d65ce8a1b2502af1e6303865447eae3.tar.gz libvfio-user-a73227984d65ce8a1b2502af1e6303865447eae3.tar.bz2 |
move stuff unrelated to pure PCI
Having half of the LM_XXX stuff in pci.h makes it harder to understand the
data structures and functions in the muser header file.
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'lib/pci.h')
-rw-r--r-- | lib/pci.h | 93 |
1 files changed, 0 insertions, 93 deletions
@@ -38,27 +38,6 @@ #include <linux/pci_regs.h> -struct lm_ctx; -typedef struct lm_ctx lm_ctx_t; - -typedef uint64_t dma_addr_t; - -typedef struct { - int region; - int length; - uint64_t offset; -} dma_scattergather_t; - -typedef struct lm_ctx lm_ctx_t; -typedef struct lm_reg_info lm_reg_info_t; -typedef struct lm_pci_config_space lm_pci_config_space_t; - -typedef enum { - LM_ERR, - LM_INF, - LM_DBG -} lm_log_lvl_t; - /* * These are already defined in include/uapi/linux/pci_regs.h, however that * file doesn't seem to installed. @@ -66,19 +45,6 @@ typedef enum { #define PCI_CFG_SPACE_SIZE 256 #define PCI_CFG_SPACE_EXP_SIZE 4096 -enum { - LM_DEV_BAR0_REG_IDX, - LM_DEV_BAR1_REG_IDX, - LM_DEV_BAR2_REG_IDX, - LM_DEV_BAR3_REG_IDX, - LM_DEV_BAR4_REG_IDX, - LM_DEV_BAR5_REG_IDX, - LM_DEV_ROM_REG_IDX, - LM_DEV_CFG_REG_IDX, - LM_DEV_VGA_REG_IDX, - LM_DEV_NUM_REGS = 9 -}; - /* * TODO lots of the sizes of each member are defined in pci_regs.h, use those * instead? @@ -234,65 +200,6 @@ struct lm_pci_config_space { _Static_assert(sizeof(struct lm_pci_config_space) == 0x100, "bad PCI configuration space size"); -// Region flags. -#define LM_REG_FLAG_READ (1 << 0) -#define LM_REG_FLAG_WRITE (1 << 1) -#define LM_REG_FLAG_MMAP (1 << 2) // TODO: how this relates to IO bar? -#define LM_REG_FLAG_RW (LM_REG_FLAG_READ | LM_REG_FLAG_WRITE) -#define LM_REG_FLAG_MEM (1 << 3) // if unset, bar is IO - -struct lm_mmap_area { - uint64_t start; - uint64_t size; -}; - -struct lm_sparse_mmap_areas { - int nr_mmap_areas; - struct lm_mmap_area areas[]; -}; - -typedef ssize_t (lm_region_access_t) (void *pvt, char * const buf, size_t count, - loff_t offset, const bool is_write); - -typedef unsigned long (lm_map_region_t) (void *pvt, unsigned long pgoff, - unsigned long len); -struct lm_reg_info { - uint32_t flags; - uint32_t size; - uint64_t offset; - lm_region_access_t *fn; - lm_map_region_t *map; - struct lm_sparse_mmap_areas *mmap_areas; /* sparse mmap areas */ -}; - -enum { - LM_DEV_INTX_IRQ_IDX, - LM_DEV_MSI_IRQ_IDX, - LM_DEV_MSIX_IRQ_IDX, - LM_DEV_ERR_IRQ_IDX, - LM_DEV_REQ_IRQ_IDX, - LM_DEV_NUM_IRQS = 5 -}; - -/* - * Returns a pointer to the non-standard part of the PCI configuration space. - */ -lm_pci_config_space_t *lm_get_pci_config_space(lm_ctx_t * const lm_ctx); - -lm_reg_info_t *lm_get_region_info(lm_ctx_t * const lm_ctx); - -/* - * TODO the rest of these functions don't need to be public, put them in a - * private header file so libmuser.c can use them. - * TODO replace the "muser" prefix - */ -int -muser_pci_hdr_access(lm_ctx_t * const lm_ctx, size_t * const count, - loff_t * const pos, const bool write, - unsigned char *const buf); - - - #endif /* LIBMUSER_PCI_H */ /* ex: set tabstop=4 shiftwidth=4 softtabstop=4 expandtab: */ |