3 * \brief Header file for the PCI driver
7 * Copyright (c) 2007, 2008, 2009, 2011, 2014, ETH Zurich.
10 * This file is distributed under the terms in the attached LICENSE file.
11 * If you do not find this file, copies can be found by writing to:
12 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
20 #include <pci/confspace/mackerelpci.h>
21 #include <pci/confspace/pci_confspace.h>
22 #include <dev/pci_hdr0_dev.h>
23 #include <dev/pci_hdr1_dev.h>
25 /// BIOS area is 1MB in size
30 struct pci_device_info {
31 struct pci_address addr;
35 pci_hdr0_class_code_t classcode;
38 struct device_mem *bar_info;
39 int nr_allocated_bars;
42 void *lowlevel_representation; /**< representation of the hardware
43 access to the upper part
44 of the per core instance of the driver.
45 not used by applications (or libraries) */
46 void *logical_representation; /**< representation of the device to
47 libraries/applications (such as
48 representing "eth0") */
53 errval_t pci_setup_root_complex(void);
54 void pci_add_root(struct pci_address addr, uint8_t maxchild, char* handle);
55 void pci_program_bridges(void);
57 void pci_init_datastructures(void);
59 errval_t device_init(uint32_t class_code,
68 int *nr_allocated_bars);
69 errval_t device_reregister_interrupt(uint8_t coreid, int vector,
70 uint32_t class_code, uint32_t sub_class, uint32_t prog_if,
71 uint32_t vendor_id, uint32_t device_id, uint32_t *bus,
72 uint32_t *dev,uint32_t *fun);
73 int pci_bar_to_caps_index(uint8_t bus, uint8_t dev, uint8_t fun, uint8_t BAR);
74 int pci_get_bar_nr_for_index(uint8_t bus, uint8_t dev, uint8_t fun, uint8_t idx);
75 int pci_get_nr_caps_for_bar(uint8_t bus, uint8_t dev, uint8_t fun, uint8_t index);
76 struct capref pci_get_bar_cap_for_device(uint8_t bus, uint8_t dev, uint8_t fun,
77 uint8_t index, int cap_nr);
78 uint8_t pci_get_bar_cap_type_for_device(uint8_t bus, uint8_t dev, uint8_t fun,
80 void pci_enable_interrupt_for_device(uint32_t bus, uint32_t dev, uint32_t fun,
82 errval_t pcie_setup_confspace(void);
84 errval_t pci_msix_enable(struct pci_address *addr, uint16_t *count);
85 errval_t pci_msix_vector_init(struct pci_address *addr, uint16_t idx,
86 uint8_t destination, uint8_t vector);
88 extern const char *skb_bridge_program;
89 extern uint16_t max_numvfs;