40 #ifndef included_vlib_pci_h 41 #define included_vlib_pci_h 50 u16 domain;
u8 bus;
u8 slot: 5;
u8 function:3;};
51 u32 as_u32;}) vlib_pci_addr_t;
97 typedef struct _pci_device_registration
106 struct _pci_device_registration *next_registration;
123 #define PCI_REGISTER_DEVICE(x,...) \ 124 __VA_ARGS__ pci_device_registration_t x; \ 125 static void __vlib_add_pci_device_registration_##x (void) \ 126 __attribute__((__constructor__)) ; \ 127 static void __vlib_add_pci_device_registration_##x (void) \ 129 vlib_pci_main_t * pm = &pci_main; \ 130 x.next_registration = pm->pci_device_registrations; \ 131 pm->pci_device_registrations = &x; \ 133 __VA_ARGS__ pci_device_registration_t x 136 char *uio_driver_name);
142 void *data,
u32 n_bytes);
145 static inline clib_error_t * \ 146 vlib_pci_read_config_##t (vlib_pci_device_t * dev, \ 147 uword address, t * data) \ 149 return vlib_pci_read_write_config (dev, VLIB_READ,address, data, \ 160 static inline clib_error_t * \ 161 vlib_pci_write_config_##t (vlib_pci_device_t * dev, uword address, \ 164 return vlib_pci_read_write_config (dev, VLIB_WRITE, \ 165 address, data, sizeof (data[0])); \ 180 err = vlib_pci_read_config_u16 (dev, 4, &command);
187 return vlib_pci_write_config_u16 (dev, 4, &command);
196 err = vlib_pci_read_config_u16 (dev, 4, &command);
203 return vlib_pci_write_config_u16 (dev, 4, &command);
213 err = vlib_pci_read_config_u16 (dev, 4, &command);
223 return vlib_pci_write_config_u16 (dev, 4, &command);
230 u32 resource,
u8 * addr,
format_function_t format_vlib_pci_addr
pci_config_type1_regs_t config1
pci_device_registration_t * pci_device_registrations
unformat_function_t unformat_vlib_pci_addr
vlib_pci_addr_t bus_address
#define PCI_COMMAND_INTX_DISABLE
uword * pci_dev_index_by_pci_addr
struct _pci_device_registration pci_device_registration_t
clib_error_t * vlib_pci_map_resource(vlib_pci_device_t *dev, u32 resource, void **result)
vlib_pci_device_t * pci_devs
void(* interrupt_handler)(struct vlib_pci_device *dev)
static clib_error_t * vlib_pci_intr_enable(vlib_pci_device_t *dev)
format_function_t format_vlib_pci_handle
format_function_t format_vlib_pci_link_speed
pci_config_type0_regs_t config0
clib_error_t * vlib_pci_map_resource_fixed(vlib_pci_device_t *dev, u32 resource, u8 *addr, void **result)
vlib_pci_device_t * vlib_get_pci_device(vlib_pci_addr_t *addr)
void vlib_pci_free_device(vlib_pci_device_t *dev)
typedef CLIB_PACKED(union{struct{u16 domain;u8 bus;u8 slot:5;u8 function:3;};u32 as_u32;}) vlib_pci_addr_t
static clib_error_t * vlib_pci_bus_master_enable(vlib_pci_device_t *dev)
struct vlib_pci_device vlib_pci_device_t
clib_error_t * vlib_pci_bind_to_uio(vlib_pci_device_t *d, char *uio_driver_name)
format_function_t format_vlib_pci_vpd
static clib_error_t * vlib_pci_intr_disable(vlib_pci_device_t *dev)
clib_error_t * vlib_pci_read_write_config(vlib_pci_device_t *dev, vlib_read_or_write_t read_or_write, uword address, void *data, u32 n_bytes)
#define PCI_COMMAND_BUS_MASTER