40 #ifndef included_vlib_pci_h 41 #define included_vlib_pci_h 120 typedef struct _pci_device_registration
124 vlib_pci_dev_handle_t handle);
127 void (*interrupt_handler) (vlib_pci_dev_handle_t handle);
130 struct _pci_device_registration *next_registration;
145 #define PCI_REGISTER_DEVICE(x,...) \ 146 __VA_ARGS__ pci_device_registration_t x; \ 147 static void __vlib_add_pci_device_registration_##x (void) \ 148 __attribute__((__constructor__)) ; \ 149 static void __vlib_add_pci_device_registration_##x (void) \ 151 vlib_pci_main_t * pm = &pci_main; \ 152 x.next_registration = pm->pci_device_registrations; \ 153 pm->pci_device_registrations = &x; \ 155 __VA_ARGS__ pci_device_registration_t x 158 char *uio_driver_name);
164 void *data,
u32 n_bytes);
167 static inline clib_error_t * \ 168 vlib_pci_read_config_##t (vlib_pci_dev_handle_t h, \ 169 uword address, t * data) \ 171 return vlib_pci_read_write_config (h, VLIB_READ,address, data, \ 182 static inline clib_error_t * \ 183 vlib_pci_write_config_##t (vlib_pci_dev_handle_t h, uword address, \ 186 return vlib_pci_read_write_config (h, VLIB_WRITE, \ 187 address, data, sizeof (data[0])); \ 202 err = vlib_pci_read_config_u16 (h, 4, &command);
209 return vlib_pci_write_config_u16 (h, 4, &command);
218 err = vlib_pci_read_config_u16 (h, 4, &command);
225 return vlib_pci_write_config_u16 (h, 4, &command);
235 err = vlib_pci_read_config_u16 (h, 4, &command);
245 return vlib_pci_write_config_u16 (h, 4, &command);
252 u32 resource,
u8 * addr,
format_function_t format_vlib_pci_addr
pci_device_registration_t * pci_device_registrations
vlib_pci_addr_t * vlib_pci_get_all_dev_addrs()
unformat_function_t unformat_vlib_pci_addr
#define PCI_COMMAND_INTX_DISABLE
clib_error_t * vlib_pci_read_write_config(vlib_pci_dev_handle_t handle, vlib_read_or_write_t read_or_write, uword address, void *data, u32 n_bytes)
struct _pci_device_registration pci_device_registration_t
clib_error_t * vlib_pci_bind_to_uio(vlib_pci_addr_t *addr, char *uio_driver_name)
static clib_error_t * vlib_pci_intr_disable(vlib_pci_dev_handle_t h)
pci_config_type1_regs_t config1
u32 vlib_pci_dev_handle_t
static clib_error_t * vlib_pci_bus_master_enable(vlib_pci_dev_handle_t h)
vlib_pci_device_info_t * vlib_pci_get_device_info(vlib_pci_addr_t *addr, clib_error_t **error)
format_function_t format_vlib_pci_link_speed
#define vec_free(V)
Free vector's memory (no header).
uword vlib_pci_get_private_data(vlib_pci_dev_handle_t h)
pci_config_type0_regs_t config0
static void clib_mem_free(void *p)
typedef CLIB_PACKED(union{struct{u16 domain;u8 bus;u8 slot:5;u8 function:3;};u32 as_u32;}) vlib_pci_addr_t
clib_error_t * vlib_pci_map_resource_fixed(vlib_pci_dev_handle_t h, u32 resource, u8 *addr, void **result)
clib_error_t * vlib_pci_map_resource(vlib_pci_dev_handle_t h, u32 resource, void **result)
void vlib_pci_set_private_data(vlib_pci_dev_handle_t h, uword private_data)
static clib_error_t * vlib_pci_intr_enable(vlib_pci_dev_handle_t h)
vlib_pci_addr_t * vlib_pci_get_addr(vlib_pci_dev_handle_t h)
format_function_t format_vlib_pci_vpd
static void vlib_pci_free_device_info(vlib_pci_device_info_t *di)
struct vlib_pci_device_info vlib_pci_device_info_t
#define PCI_COMMAND_BUS_MASTER