summaryrefslogtreecommitdiffstats
path: root/src/vlib/pci
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2018-09-28 11:45:01 +0200
committerDamjan Marion <dmarion@me.com>2018-10-23 18:51:43 +0000
commit95276ca5ca0a97ea7e0b5828f434743b6a745274 (patch)
treeb60d2bd6ea12dab0300ecd261eb3be48bd795799 /src/vlib/pci
parent901d16cced85b2ff7353009ca325de310654eb6c (diff)
vlib: Add support for pci io read/write
Change-Id: I9d96e7782a12c2e19eacbb75edb1fb450cf33bed Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vlib/pci')
-rw-r--r--src/vlib/pci/pci.h41
1 files changed, 29 insertions, 12 deletions
diff --git a/src/vlib/pci/pci.h b/src/vlib/pci/pci.h
index e0eacf42948..1c70cc7bb80 100644
--- a/src/vlib/pci/pci.h
+++ b/src/vlib/pci/pci.h
@@ -186,33 +186,48 @@ clib_error_t *vlib_pci_read_write_config (vlib_main_t * vm,
uword address, void *data,
u32 n_bytes);
-#define _(t) \
+/* io space read/write. */
+clib_error_t *vlib_pci_read_write_io (vlib_main_t * vm,
+ vlib_pci_dev_handle_t handle,
+ vlib_read_or_write_t read_or_write,
+ uword address, void *data, u32 n_bytes);
+
+
+#define _(t, x) \
static inline clib_error_t * \
-vlib_pci_read_config_##t (vlib_main_t *vm, vlib_pci_dev_handle_t h, \
+vlib_pci_read_##x##_##t (vlib_main_t *vm, vlib_pci_dev_handle_t h, \
uword address, t * data) \
{ \
- return vlib_pci_read_write_config (vm, h, VLIB_READ,address, data, \
+ return vlib_pci_read_write_##x (vm, h, VLIB_READ,address, data, \
sizeof (data[0])); \
}
-_(u32);
-_(u16);
-_(u8);
+_(u32, config);
+_(u16, config);
+_(u8, config);
+
+_(u32, io);
+_(u16, io);
+_(u8, io);
#undef _
-#define _(t) \
+#define _(t, x) \
static inline clib_error_t * \
-vlib_pci_write_config_##t (vlib_main_t *vm, vlib_pci_dev_handle_t h, \
+vlib_pci_write_##x##_##t (vlib_main_t *vm, vlib_pci_dev_handle_t h, \
uword address, t * data) \
{ \
- return vlib_pci_read_write_config (vm, h, VLIB_WRITE, \
+ return vlib_pci_read_write_##x (vm, h, VLIB_WRITE, \
address, data, sizeof (data[0])); \
}
-_(u32);
-_(u16);
-_(u8);
+_(u32, config);
+_(u16, config);
+_(u8, config);
+
+_(u32, io);
+_(u16, io);
+_(u8, io);
#undef _
@@ -278,6 +293,8 @@ clib_error_t *vlib_pci_map_region_fixed (vlib_main_t * vm,
vlib_pci_dev_handle_t h,
u32 resource, u8 * addr,
void **result);
+clib_error_t *vlib_pci_io_region (vlib_main_t * vm, vlib_pci_dev_handle_t h,
+ u32 resource);
clib_error_t *vlib_pci_register_intx_handler (vlib_main_t * vm,
vlib_pci_dev_handle_t h,
pci_intx_handler_function_t *