40 #ifndef included_vlib_pci_h 41 #define included_vlib_pci_h 63 #define VLIB_PCI_DEVICE_INFO_F_NOIOMMU (1 << 0); 100 vlib_pci_addr_t * addr,
104 vlib_pci_dev_handle_t h);
107 vlib_pci_dev_handle_t h);
131 vlib_pci_dev_handle_t handle);
133 vlib_pci_dev_handle_t handle,
136 typedef struct _pci_device_registration
140 vlib_pci_dev_handle_t handle);
146 struct _pci_device_registration *next_registration;
163 #define PCI_REGISTER_DEVICE(x,...) \ 164 __VA_ARGS__ pci_device_registration_t x; \ 165 static void __vlib_add_pci_device_registration_##x (void) \ 166 __attribute__((__constructor__)) ; \ 167 static void __vlib_add_pci_device_registration_##x (void) \ 169 vlib_pci_main_t * pm = &pci_main; \ 170 x.next_registration = pm->pci_device_registrations; \ 171 pm->pci_device_registrations = &x; \ 173 static void __vlib_rm_pci_device_registration_##x (void) \ 174 __attribute__((__destructor__)) ; \ 175 static void __vlib_rm_pci_device_registration_##x (void) \ 177 vlib_pci_main_t * pm = &pci_main; \ 178 VLIB_REMOVE_FROM_LINKED_LIST (pm->pci_device_registrations, \ 179 &x, next_registration); \ 181 __VA_ARGS__ pci_device_registration_t x 184 char *uio_driver_name);
188 vlib_pci_dev_handle_t handle,
195 vlib_pci_dev_handle_t handle,
201 static inline clib_error_t * \ 202 vlib_pci_read_##x##_##t (vlib_main_t *vm, vlib_pci_dev_handle_t h, \ 203 uword address, t * data) \ 205 return vlib_pci_read_write_##x (vm, h, VLIB_READ,address, data, \ 220 static inline clib_error_t * \ 221 vlib_pci_write_##x##_##t (vlib_main_t *vm, vlib_pci_dev_handle_t h, \ 222 uword address, t * data) \ 224 return vlib_pci_read_write_##x (vm, h, VLIB_WRITE, \ 225 address, data, sizeof (data[0])); \ 244 err = vlib_pci_read_config_u16 (vm, h, 4, &command);
251 return vlib_pci_write_config_u16 (vm, h, 4, &command);
260 err = vlib_pci_read_config_u16 (vm, h, 4, &command);
267 return vlib_pci_write_config_u16 (vm, h, 4, &command);
277 err = vlib_pci_read_config_u16 (vm, h, 4, &command);
287 return vlib_pci_write_config_u16 (vm, h, 4, &command);
292 vlib_pci_dev_handle_t * handle);
295 u32 resource,
void **result);
297 vlib_pci_dev_handle_t h,
298 u32 resource,
u8 * addr,
303 vlib_pci_dev_handle_t h,
307 vlib_pci_dev_handle_t h,
312 vlib_pci_dev_handle_t h,
u16 start,
315 vlib_pci_dev_handle_t h,
u16 start,
321 vlib_pci_dev_handle_t h);
static clib_error_t * vlib_pci_intr_enable(vlib_main_t *vm, vlib_pci_dev_handle_t h)
uword vlib_pci_get_private_data(vlib_main_t *vm, vlib_pci_dev_handle_t h)
static clib_error_t * vlib_pci_bus_master_enable(vlib_main_t *vm, vlib_pci_dev_handle_t h)
pci_device_registration_t * pci_device_registrations
clib_error_t * vlib_pci_device_open(vlib_main_t *vm, vlib_pci_addr_t *addr, pci_device_id_t ids[], vlib_pci_dev_handle_t *handle)
static clib_error_t * vlib_pci_intr_disable(vlib_main_t *vm, vlib_pci_dev_handle_t h)
clib_error_t * vlib_pci_register_msix_handler(vlib_main_t *vm, vlib_pci_dev_handle_t h, u32 start, u32 count, pci_msix_handler_function_t *msix_handler)
static void vlib_pci_free_device_info(vlib_pci_device_info_t *di)
void() pci_msix_handler_function_t(vlib_main_t *vm, vlib_pci_dev_handle_t handle, u16 line)
clib_error_t * vlib_pci_io_region(vlib_main_t *vm, vlib_pci_dev_handle_t h, u32 resource)
#define PCI_COMMAND_INTX_DISABLE
vlib_pci_addr_t * vlib_pci_get_all_dev_addrs()
typedef CLIB_PACKED(union { struct { u16 domain;u8 bus;u8 slot:5;u8 function:3;};u32 as_u32;}) vlib_pci_addr_t
pci_config_type1_regs_t config1
vlib_pci_device_info_t * vlib_pci_get_device_info(vlib_main_t *vm, vlib_pci_addr_t *addr, clib_error_t **error)
u32 vlib_pci_get_num_msix_interrupts(vlib_main_t *vm, vlib_pci_dev_handle_t h)
void vlib_pci_device_close(vlib_main_t *vm, vlib_pci_dev_handle_t h)
unformat_function_t unformat_vlib_pci_addr
clib_error_t * vlib_pci_map_region(vlib_main_t *vm, vlib_pci_dev_handle_t h, u32 resource, void **result)
u32 vlib_pci_dev_handle_t
format_function_t format_vlib_pci_vpd
#define vec_free(V)
Free vector's memory (no header).
clib_error_t * vlib_pci_disable_msix_irq(vlib_main_t *vm, vlib_pci_dev_handle_t h, u16 start, u16 count)
clib_error_t * vlib_pci_read_write_config(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)
clib_error_t * vlib_pci_enable_msix_irq(vlib_main_t *vm, vlib_pci_dev_handle_t h, u16 start, u16 count)
void() pci_intx_handler_function_t(vlib_main_t *vm, vlib_pci_dev_handle_t handle)
clib_error_t * vlib_pci_register_intx_handler(vlib_main_t *vm, vlib_pci_dev_handle_t h, pci_intx_handler_function_t *intx_handler)
manual_print typedef address
int vlib_pci_supports_virtual_addr_dma(vlib_main_t *vm, vlib_pci_dev_handle_t h)
pci_config_type0_regs_t config0
static void clib_mem_free(void *p)
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)
clib_error_t * vlib_pci_bind_to_uio(vlib_main_t *vm, vlib_pci_addr_t *addr, char *uio_driver_name)
clib_error_t * vlib_pci_map_region_fixed(vlib_main_t *vm, vlib_pci_dev_handle_t h, u32 resource, u8 *addr, void **result)
vlib_pci_addr_t * vlib_pci_get_addr(vlib_main_t *vm, vlib_pci_dev_handle_t h)
struct vlib_pci_device_info vlib_pci_device_info_t
struct _pci_device_registration pci_device_registration_t
u32 vlib_pci_get_numa_node(vlib_main_t *vm, vlib_pci_dev_handle_t h)
format_function_t format_vlib_pci_link_speed
void vlib_pci_set_private_data(vlib_main_t *vm, vlib_pci_dev_handle_t h, uword private_data)
vlib_log_class_t log_default
clib_error_t * vlib_pci_map_dma(vlib_main_t *vm, vlib_pci_dev_handle_t h, void *ptr)
format_function_t format_vlib_pci_addr
#define PCI_COMMAND_BUS_MASTER