40 #ifndef included_vlib_pci_h 41 #define included_vlib_pci_h 74 typedef struct _pci_device_registration {
78 char const *kernel_driver;
79 u8 kernel_driver_running;
82 struct _pci_device_registration * next_registration;
88 #define PCI_REGISTER_DEVICE(x,...) \ 89 __VA_ARGS__ pci_device_registration_t x; \ 90 static void __vlib_add_pci_device_registration_##x (void) \ 91 __attribute__((__constructor__)) ; \ 92 static void __vlib_add_pci_device_registration_##x (void) \ 94 linux_pci_main_t * lpm = vlib_unix_get_main(); \ 95 x.next_registration = lpm->pci_device_registrations; \ 96 lpm->pci_device_registrations = &x; \ 98 __VA_ARGS__ pci_device_registration_t x 110 static inline clib_error_t * \ 111 os_read_pci_config_##t (uword os_handle, uword address, t * data) \ 113 return os_read_write_pci_config (os_handle, VLIB_READ, \ 114 address, data, sizeof (data[0])); \ 124 static inline clib_error_t * \ 125 os_write_pci_config_##t (uword os_handle, uword address, t * data) \ 127 return os_read_write_pci_config (os_handle, VLIB_WRITE, \ 128 address, data, sizeof (data[0])); \ 154 vlib_pci_addr_t *
addr = va_arg (* args, vlib_pci_addr_t *);
157 if (!
unformat (input,
"%x:%x:%x.%x", &x[0], &x[1], &x[2], &x[3]))
163 addr->function = x[3];
171 vlib_pci_addr_t *
addr = va_arg (* va, vlib_pci_addr_t *);
172 return format (s,
"%04x:%02x:%02x.%x", addr->domain, addr->bus,
173 addr->slot, addr->function);
format_function_t format_os_pci_handle
void os_add_pci_disable_interrupts_reg(uword os_handle, u32 resource, u32 reg_offset, u32 reg_value)
static u8 * format_vlib_pci_addr(u8 *s, va_list *va)
clib_error_t * os_map_pci_resource_fixed(uword os_handle, u32 resource, u8 *addr, void **result)
vlib_pci_addr_t bus_address
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 * os_read_write_pci_config(uword os_handle, vlib_read_or_write_t read_or_write, uword address, void *data, u32 n_bytes)
void os_free_pci_device(uword os_handle)
pci_config_type1_regs_t config1
static uword unformat_vlib_pci_addr(unformat_input_t *input, va_list *args)
pci_config_type0_regs_t config0
struct _pci_device_registration pci_device_registration_t
clib_error_t * os_map_pci_resource(uword os_handle, u32 resource, void **result)