Zephyr Project API 4.0.0
A Scalable Open Source RTOS
|
PCIe Host Interface. More...
Modules | |
PCIe Capabilities | |
PCIe Host MSI Interface | |
PCIe Host MSI Interface. | |
PCIe Host PTM Interface | |
PCIe Host PTM Interface. | |
PCIe Virtual Channel Host Interface | |
PCIe Virtual Channel Host Interface. | |
Data Structures | |
struct | pcie_dev |
struct | pcie_bar |
struct | pcie_scan_opt |
Options for performing a scan for PCI devices. More... | |
Macros | |
#define | PCIE_ID_IS_VALID(id) |
#define | PCIE_DT_ID(node_id) |
Get the PCIe Vendor and Device ID for a node. | |
#define | PCIE_DT_INST_ID(inst) PCIE_DT_ID(DT_DRV_INST(inst)) |
Get the PCIe Vendor and Device ID for a node. | |
#define | DEVICE_PCIE_DECLARE(node_id) |
Declare a PCIe context variable for a DTS node. | |
#define | DEVICE_PCIE_INST_DECLARE(inst) DEVICE_PCIE_DECLARE(DT_DRV_INST(inst)) |
Declare a PCIe context variable for a DTS node. | |
#define | DEVICE_PCIE_INIT(node_id, name) .name = &Z_DEVICE_PCIE_NAME(node_id) |
Initialize a named struct member to point at a PCIe context. | |
#define | DEVICE_PCIE_INST_INIT(inst, name) DEVICE_PCIE_INIT(DT_DRV_INST(inst), name) |
Initialize a named struct member to point at a PCIe context. | |
#define | PCIE_HOST_CONTROLLER(n) PCIE_BDF(0, 0, n) |
Get the BDF for a given PCI host controller. | |
#define | PCIE_CONF_CAPPTR 13U /* capabilities pointer */ |
#define | PCIE_CONF_CAPPTR_FIRST(w) (((w) >> 2) & 0x3FU) |
#define | PCIE_CONF_CAP_ID(w) ((w) & 0xFFU) |
#define | PCIE_CONF_CAP_NEXT(w) (((w) >> 10) & 0x3FU) |
#define | PCIE_CONF_EXT_CAPPTR 64U |
#define | PCIE_CONF_EXT_CAP_ID(w) ((w) & 0xFFFFU) |
#define | PCIE_CONF_EXT_CAP_VER(w) (((w) >> 16) & 0xFU) |
#define | PCIE_CONF_EXT_CAP_NEXT(w) (((w) >> 20) & 0xFFFU) |
#define | PCIE_CONF_ID 0U |
#define | PCIE_CONF_CMDSTAT 1U /* command/status register */ |
#define | PCIE_CONF_CMDSTAT_IO 0x00000001U /* I/O access enable */ |
#define | PCIE_CONF_CMDSTAT_MEM 0x00000002U /* mem access enable */ |
#define | PCIE_CONF_CMDSTAT_MASTER 0x00000004U /* bus master enable */ |
#define | PCIE_CONF_CMDSTAT_INTERRUPT 0x00080000U /* interrupt status */ |
#define | PCIE_CONF_CMDSTAT_CAPS 0x00100000U /* capabilities list */ |
#define | PCIE_CONF_CLASSREV 2U /* class/revision register */ |
#define | PCIE_CONF_CLASSREV_CLASS(w) (((w) >> 24) & 0xFFU) |
#define | PCIE_CONF_CLASSREV_SUBCLASS(w) (((w) >> 16) & 0xFFU) |
#define | PCIE_CONF_CLASSREV_PROGIF(w) (((w) >> 8) & 0xFFU) |
#define | PCIE_CONF_CLASSREV_REV(w) ((w) & 0xFFU) |
#define | PCIE_CONF_TYPE 3U |
#define | PCIE_CONF_MULTIFUNCTION(w) (((w) & 0x00800000U) != 0U) |
#define | PCIE_CONF_TYPE_BRIDGE(w) (((w) & 0x007F0000U) != 0U) |
#define | PCIE_CONF_TYPE_GET(w) (((w) >> 16) & 0x7F) |
#define | PCIE_CONF_TYPE_STANDARD 0x0U |
#define | PCIE_CONF_TYPE_PCI_BRIDGE 0x1U |
#define | PCIE_CONF_TYPE_CARDBUS_BRIDGE 0x2U |
#define | PCIE_CONF_BAR0 4U |
#define | PCIE_CONF_BAR1 5U |
#define | PCIE_CONF_BAR2 6U |
#define | PCIE_CONF_BAR3 7U |
#define | PCIE_CONF_BAR4 8U |
#define | PCIE_CONF_BAR5 9U |
#define | PCIE_CONF_BAR_IO(w) (((w) & 0x00000001U) == 0x00000001U) |
#define | PCIE_CONF_BAR_MEM(w) (((w) & 0x00000001U) != 0x00000001U) |
#define | PCIE_CONF_BAR_64(w) (((w) & 0x00000006U) == 0x00000004U) |
#define | PCIE_CONF_BAR_ADDR(w) ((w) & ~0xfUL) |
#define | PCIE_CONF_BAR_IO_ADDR(w) ((w) & ~0x3UL) |
#define | PCIE_CONF_BAR_FLAGS(w) ((w) & 0xfUL) |
#define | PCIE_CONF_BAR_NONE 0U |
#define | PCIE_CONF_BAR_INVAL 0xFFFFFFF0U |
#define | PCIE_CONF_BAR_INVAL64 0xFFFFFFFFFFFFFFF0UL |
#define | PCIE_CONF_BAR_INVAL_FLAGS(w) |
#define | PCIE_BUS_NUMBER 6U |
#define | PCIE_BUS_PRIMARY_NUMBER(w) ((w) & 0xffUL) |
#define | PCIE_BUS_SECONDARY_NUMBER(w) (((w) >> 8) & 0xffUL) |
#define | PCIE_BUS_SUBORDINATE_NUMBER(w) (((w) >> 16) & 0xffUL) |
#define | PCIE_SECONDARY_LATENCY_TIMER(w) (((w) >> 24) & 0xffUL) |
#define | PCIE_BUS_NUMBER_VAL(prim, sec, sub, lat) |
#define | PCIE_IO_SEC_STATUS 7U |
#define | PCIE_IO_BASE(w) ((w) & 0xffUL) |
#define | PCIE_IO_LIMIT(w) (((w) >> 8) & 0xffUL) |
#define | PCIE_SEC_STATUS(w) (((w) >> 16) & 0xffffUL) |
#define | PCIE_IO_SEC_STATUS_VAL(iob, iol, sec_status) |
#define | PCIE_MEM_BASE_LIMIT 8U |
#define | PCIE_MEM_BASE(w) ((w) & 0xffffUL) |
#define | PCIE_MEM_LIMIT(w) (((w) >> 16) & 0xffffUL) |
#define | PCIE_MEM_BASE_LIMIT_VAL(memb, meml) |
#define | PCIE_PREFETCH_BASE_LIMIT 9U |
#define | PCIE_PREFETCH_BASE(w) ((w) & 0xffffUL) |
#define | PCIE_PREFETCH_LIMIT(w) (((w) >> 16) & 0xffffUL) |
#define | PCIE_PREFETCH_BASE_LIMIT_VAL(pmemb, pmeml) |
#define | PCIE_PREFETCH_BASE_UPPER 10U |
#define | PCIE_PREFETCH_LIMIT_UPPER 11U |
#define | PCIE_IO_BASE_LIMIT_UPPER 12U |
#define | PCIE_IO_BASE_UPPER(w) ((w) & 0xffffUL) |
#define | PCIE_IO_LIMIT_UPPER(w) (((w) >> 16) & 0xffffUL) |
#define | PCIE_IO_BASE_LIMIT_UPPER_VAL(iobu, iolu) |
#define | PCIE_CONF_INTR 15U |
#define | PCIE_CONF_INTR_IRQ(w) ((w) & 0xFFU) |
#define | PCIE_CONF_INTR_IRQ_NONE 0xFFU /* no interrupt routed */ |
#define | PCIE_MAX_BUS (0xFFFFFFFFU & PCIE_BDF_BUS_MASK) |
#define | PCIE_MAX_DEV (0xFFFFFFFFU & PCIE_BDF_DEV_MASK) |
#define | PCIE_MAX_FUNC (0xFFFFFFFFU & PCIE_BDF_FUNC_MASK) |
#define | PCIE_IRQ_CONNECT(bdf_p, irq_p, priority_p, isr_p, isr_param_p, flags_p) |
Initialize an interrupt handler for a PCIe endpoint IRQ. | |
Typedefs | |
typedef uint32_t | pcie_bdf_t |
A unique PCI(e) endpoint (bus, device, function). | |
typedef uint32_t | pcie_id_t |
A unique PCI(e) identifier (vendor ID, device ID). | |
typedef bool(* | pcie_scan_cb_t) (pcie_bdf_t bdf, pcie_id_t id, void *cb_data) |
Callback type used for scanning for PCI endpoints. | |
Enumerations | |
enum | { PCIE_SCAN_RECURSIVE = BIT(0) , PCIE_SCAN_CB_ALL = BIT(1) } |
Functions | |
uint32_t | pcie_conf_read (pcie_bdf_t bdf, unsigned int reg) |
Read a 32-bit word from an endpoint's configuration space. | |
void | pcie_conf_write (pcie_bdf_t bdf, unsigned int reg, uint32_t data) |
Write a 32-bit word to an endpoint's configuration space. | |
int | pcie_scan (const struct pcie_scan_opt *opt) |
Scan for PCIe devices. | |
bool | pcie_get_mbar (pcie_bdf_t bdf, unsigned int bar_index, struct pcie_bar *mbar) |
Get the MBAR at a specific BAR index. | |
bool | pcie_probe_mbar (pcie_bdf_t bdf, unsigned int index, struct pcie_bar *mbar) |
Probe the nth MMIO address assigned to an endpoint. | |
bool | pcie_get_iobar (pcie_bdf_t bdf, unsigned int bar_index, struct pcie_bar *iobar) |
Get the I/O BAR at a specific BAR index. | |
bool | pcie_probe_iobar (pcie_bdf_t bdf, unsigned int index, struct pcie_bar *iobar) |
Probe the nth I/O BAR address assigned to an endpoint. | |
void | pcie_set_cmd (pcie_bdf_t bdf, uint32_t bits, bool on) |
Set or reset bits in the endpoint command/status register. | |
unsigned int | pcie_alloc_irq (pcie_bdf_t bdf) |
Allocate an IRQ for an endpoint. | |
unsigned int | pcie_get_irq (pcie_bdf_t bdf) |
Return the IRQ assigned by the firmware/board to an endpoint. | |
void | pcie_irq_enable (pcie_bdf_t bdf, unsigned int irq) |
Enable the PCI(e) endpoint to generate the specified IRQ. | |
uint32_t | pcie_get_cap (pcie_bdf_t bdf, uint32_t cap_id) |
Find a PCI(e) capability in an endpoint's configuration space. | |
uint32_t | pcie_get_ext_cap (pcie_bdf_t bdf, uint32_t cap_id) |
Find an Extended PCI(e) capability in an endpoint's configuration space. | |
bool | pcie_connect_dynamic_irq (pcie_bdf_t bdf, unsigned int irq, unsigned int priority, void(*routine)(const void *parameter), const void *parameter, uint32_t flags) |
Dynamically connect a PCIe endpoint IRQ to an ISR handler. | |
PCIe Host Interface.
#define DEVICE_PCIE_DECLARE | ( | node_id | ) |
#include <include/zephyr/drivers/pcie/pcie.h>
Declare a PCIe context variable for a DTS node.
Declares a PCIe context for a DTS node. This must be done before using the DEVICE_PCIE_INIT() macro for the same node.
node_id | DTS node identifier |
#define DEVICE_PCIE_INIT | ( | node_id, | |
name | |||
) | .name = &Z_DEVICE_PCIE_NAME(node_id) |
#include <include/zephyr/drivers/pcie/pcie.h>
Initialize a named struct member to point at a PCIe context.
Initialize PCIe-related information within a specific instance of a device config struct, using information from DTS. Using the macro requires having first created PCIe context struct using the DEVICE_PCIE_DECLARE() macro.
Example for an instance of a driver belonging to the "foo" subsystem
struct foo_config { struct pcie_dev *pcie; ... };
DEVICE_PCIE_ID_DECLARE(DT_DRV_INST(...)); struct foo_config my_config = { DEVICE_PCIE_INIT(pcie, DT_DRV_INST(...)), ... };
node_id | DTS node identifier |
name | Member name within config for the MMIO region |
#define DEVICE_PCIE_INST_DECLARE | ( | inst | ) | DEVICE_PCIE_DECLARE(DT_DRV_INST(inst)) |
#include <include/zephyr/drivers/pcie/pcie.h>
Declare a PCIe context variable for a DTS node.
This is equivalent to DEVICE_PCIE_DECLARE(DT_DRV_INST(inst))
inst | Devicetree instance number |
#define DEVICE_PCIE_INST_INIT | ( | inst, | |
name | |||
) | DEVICE_PCIE_INIT(DT_DRV_INST(inst), name) |
#include <include/zephyr/drivers/pcie/pcie.h>
Initialize a named struct member to point at a PCIe context.
This is equivalent to DEVICE_PCIE_INIT(DT_DRV_INST(inst), name)
inst | Devicetree instance number |
name | Name of the struct member (of type struct pcie_dev *) |
#define PCIE_BUS_NUMBER 6U |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_BUS_NUMBER_VAL | ( | prim, | |
sec, | |||
sub, | |||
lat | |||
) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_BUS_PRIMARY_NUMBER | ( | w | ) | ((w) & 0xffUL) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_BUS_SECONDARY_NUMBER | ( | w | ) | (((w) >> 8) & 0xffUL) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_BUS_SUBORDINATE_NUMBER | ( | w | ) | (((w) >> 16) & 0xffUL) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_BAR0 4U |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_BAR1 5U |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_BAR2 6U |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_BAR3 7U |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_BAR4 8U |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_BAR5 9U |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_BAR_64 | ( | w | ) | (((w) & 0x00000006U) == 0x00000004U) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_BAR_ADDR | ( | w | ) | ((w) & ~0xfUL) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_BAR_FLAGS | ( | w | ) | ((w) & 0xfUL) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_BAR_INVAL 0xFFFFFFF0U |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_BAR_INVAL64 0xFFFFFFFFFFFFFFF0UL |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_BAR_INVAL_FLAGS | ( | w | ) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_BAR_IO | ( | w | ) | (((w) & 0x00000001U) == 0x00000001U) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_BAR_IO_ADDR | ( | w | ) | ((w) & ~0x3UL) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_BAR_MEM | ( | w | ) | (((w) & 0x00000001U) != 0x00000001U) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_BAR_NONE 0U |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_CAP_ID | ( | w | ) | ((w) & 0xFFU) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_CAP_NEXT | ( | w | ) | (((w) >> 10) & 0x3FU) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_CAPPTR 13U /* capabilities pointer */ |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_CAPPTR_FIRST | ( | w | ) | (((w) >> 2) & 0x3FU) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_CLASSREV 2U /* class/revision register */ |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_CLASSREV_CLASS | ( | w | ) | (((w) >> 24) & 0xFFU) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_CLASSREV_PROGIF | ( | w | ) | (((w) >> 8) & 0xFFU) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_CLASSREV_REV | ( | w | ) | ((w) & 0xFFU) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_CLASSREV_SUBCLASS | ( | w | ) | (((w) >> 16) & 0xFFU) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_CMDSTAT 1U /* command/status register */ |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_CMDSTAT_CAPS 0x00100000U /* capabilities list */ |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_CMDSTAT_INTERRUPT 0x00080000U /* interrupt status */ |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_CMDSTAT_IO 0x00000001U /* I/O access enable */ |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_CMDSTAT_MASTER 0x00000004U /* bus master enable */ |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_CMDSTAT_MEM 0x00000002U /* mem access enable */ |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_EXT_CAP_ID | ( | w | ) | ((w) & 0xFFFFU) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_EXT_CAP_NEXT | ( | w | ) | (((w) >> 20) & 0xFFFU) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_EXT_CAP_VER | ( | w | ) | (((w) >> 16) & 0xFU) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_EXT_CAPPTR 64U |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_ID 0U |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_INTR 15U |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_INTR_IRQ | ( | w | ) | ((w) & 0xFFU) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_INTR_IRQ_NONE 0xFFU /* no interrupt routed */ |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_MULTIFUNCTION | ( | w | ) | (((w) & 0x00800000U) != 0U) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_TYPE 3U |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_TYPE_BRIDGE | ( | w | ) | (((w) & 0x007F0000U) != 0U) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_TYPE_CARDBUS_BRIDGE 0x2U |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_TYPE_GET | ( | w | ) | (((w) >> 16) & 0x7F) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_TYPE_PCI_BRIDGE 0x1U |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_CONF_TYPE_STANDARD 0x0U |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_DT_ID | ( | node_id | ) |
#include <include/zephyr/drivers/pcie/pcie.h>
Get the PCIe Vendor and Device ID for a node.
node_id | DTS node identifier |
#define PCIE_DT_INST_ID | ( | inst | ) | PCIE_DT_ID(DT_DRV_INST(inst)) |
#include <include/zephyr/drivers/pcie/pcie.h>
Get the PCIe Vendor and Device ID for a node.
This is equivalent to PCIE_DT_ID(DT_DRV_INST(inst))
inst | Devicetree instance number |
#define PCIE_HOST_CONTROLLER | ( | n | ) | PCIE_BDF(0, 0, n) |
#include <include/zephyr/drivers/pcie/pcie.h>
Get the BDF for a given PCI host controller.
This macro is useful when the PCI host controller behind PCIE_BDF(0, 0, 0) indicates a multifunction device. In such a case each function of this endpoint is a potential host controller itself.
n | Bus number |
#define PCIE_ID_IS_VALID | ( | id | ) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_IO_BASE | ( | w | ) | ((w) & 0xffUL) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_IO_BASE_LIMIT_UPPER 12U |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_IO_BASE_LIMIT_UPPER_VAL | ( | iobu, | |
iolu | |||
) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_IO_BASE_UPPER | ( | w | ) | ((w) & 0xffffUL) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_IO_LIMIT | ( | w | ) | (((w) >> 8) & 0xffUL) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_IO_LIMIT_UPPER | ( | w | ) | (((w) >> 16) & 0xffffUL) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_IO_SEC_STATUS 7U |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_IO_SEC_STATUS_VAL | ( | iob, | |
iol, | |||
sec_status | |||
) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_IRQ_CONNECT | ( | bdf_p, | |
irq_p, | |||
priority_p, | |||
isr_p, | |||
isr_param_p, | |||
flags_p | |||
) |
#include <include/zephyr/drivers/pcie/pcie.h>
Initialize an interrupt handler for a PCIe endpoint IRQ.
This routine is only meant to be used by drivers using PCIe bus and having fixed or MSI based IRQ (so no runtime detection of the IRQ). In case of runtime detection see pcie_connect_dynamic_irq()
bdf_p | PCIe endpoint BDF |
irq_p | IRQ line number. |
priority_p | Interrupt priority. |
isr_p | Address of interrupt service routine. |
isr_param_p | Parameter passed to interrupt service routine. |
flags_p | Architecture-specific IRQ configuration flags.. |
#define PCIE_MAX_BUS (0xFFFFFFFFU & PCIE_BDF_BUS_MASK) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_MAX_DEV (0xFFFFFFFFU & PCIE_BDF_DEV_MASK) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_MAX_FUNC (0xFFFFFFFFU & PCIE_BDF_FUNC_MASK) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_MEM_BASE | ( | w | ) | ((w) & 0xffffUL) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_MEM_BASE_LIMIT 8U |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_MEM_BASE_LIMIT_VAL | ( | memb, | |
meml | |||
) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_MEM_LIMIT | ( | w | ) | (((w) >> 16) & 0xffffUL) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_PREFETCH_BASE | ( | w | ) | ((w) & 0xffffUL) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_PREFETCH_BASE_LIMIT 9U |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_PREFETCH_BASE_LIMIT_VAL | ( | pmemb, | |
pmeml | |||
) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_PREFETCH_BASE_UPPER 10U |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_PREFETCH_LIMIT | ( | w | ) | (((w) >> 16) & 0xffffUL) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_PREFETCH_LIMIT_UPPER 11U |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_SEC_STATUS | ( | w | ) | (((w) >> 16) & 0xffffUL) |
#include <include/zephyr/drivers/pcie/pcie.h>
#define PCIE_SECONDARY_LATENCY_TIMER | ( | w | ) | (((w) >> 24) & 0xffUL) |
#include <include/zephyr/drivers/pcie/pcie.h>
#include <include/zephyr/drivers/pcie/pcie.h>
A unique PCI(e) endpoint (bus, device, function).
A PCI(e) endpoint is uniquely identified topologically using a (bus, device, function) tuple. The internal structure is documented in include/dt-bindings/pcie/pcie.h: see PCIE_BDF() and friends, since these tuples are referenced from devicetree.
#include <include/zephyr/drivers/pcie/pcie.h>
A unique PCI(e) identifier (vendor ID, device ID).
The PCIE_CONF_ID register for each endpoint is a (vendor ID, device ID) pair, which is meant to tell the system what the PCI(e) endpoint is. Again, look to PCIE_ID_* macros in include/dt-bindings/pcie/pcie.h for more.
typedef bool(* pcie_scan_cb_t) (pcie_bdf_t bdf, pcie_id_t id, void *cb_data) |
#include <include/zephyr/drivers/pcie/pcie.h>
Callback type used for scanning for PCI endpoints.
bdf | BDF value for a found endpoint. |
id | Vendor & Device ID for the found endpoint. |
cb_data | Custom, use case specific data. |
anonymous enum |
#include <include/zephyr/drivers/pcie/pcie.h>
Enumerator | |
---|---|
PCIE_SCAN_RECURSIVE | Scan all available PCI host controllers and sub-busses. |
PCIE_SCAN_CB_ALL | Do the callback for all endpoint types, including bridges. |
|
extern |
#include <include/zephyr/drivers/pcie/pcie.h>
Allocate an IRQ for an endpoint.
This function first checks the IRQ register and if it contains a valid value this is returned. If the register does not contain a valid value allocation of a new one is attempted. Such function is only exposed if CONFIG_PCIE_CONTROLLER is unset. It is thus available where architecture tied dynamic IRQ allocation for PCIe device makes sense.
bdf | the PCI(e) endpoint |
|
extern |
#include <include/zephyr/drivers/pcie/pcie.h>
Read a 32-bit word from an endpoint's configuration space.
This function is exported by the arch/SoC/board code.
bdf | PCI(e) endpoint |
reg | the configuration word index (not address) |
|
extern |
#include <include/zephyr/drivers/pcie/pcie.h>
Write a 32-bit word to an endpoint's configuration space.
This function is exported by the arch/SoC/board code.
bdf | PCI(e) endpoint |
reg | the configuration word index (not address) |
data | the value to write |
|
extern |
#include <include/zephyr/drivers/pcie/pcie.h>
Dynamically connect a PCIe endpoint IRQ to an ISR handler.
bdf | the PCI endpoint to examine |
irq | the IRQ to connect (see pcie_alloc_irq()) |
priority | priority of the IRQ |
routine | the ISR handler to connect to the IRQ |
parameter | the parameter to provide to the handler |
flags | IRQ connection flags |
|
extern |
#include <include/zephyr/drivers/pcie/pcie.h>
Find a PCI(e) capability in an endpoint's configuration space.
bdf | the PCI endpoint to examine |
cap_id | the capability ID of interest |
|
extern |
#include <include/zephyr/drivers/pcie/pcie.h>
Find an Extended PCI(e) capability in an endpoint's configuration space.
bdf | the PCI endpoint to examine |
cap_id | the capability ID of interest |
|
extern |
#include <include/zephyr/drivers/pcie/pcie.h>
Get the I/O BAR at a specific BAR index.
bdf | the PCI(e) endpoint |
bar_index | 0-based BAR index |
iobar | Pointer to struct pcie_bar |
|
extern |
#include <include/zephyr/drivers/pcie/pcie.h>
Return the IRQ assigned by the firmware/board to an endpoint.
bdf | the PCI(e) endpoint |
|
extern |
#include <include/zephyr/drivers/pcie/pcie.h>
Get the MBAR at a specific BAR index.
bdf | the PCI(e) endpoint |
bar_index | 0-based BAR index |
mbar | Pointer to struct pcie_bar |
|
extern |
#include <include/zephyr/drivers/pcie/pcie.h>
Enable the PCI(e) endpoint to generate the specified IRQ.
bdf | the PCI(e) endpoint |
irq | the IRQ to generate |
If MSI is enabled and the endpoint supports it, the endpoint will be configured to generate the specified IRQ via MSI. Otherwise, it is assumed that the IRQ has been routed by the boot firmware to the specified IRQ, and the IRQ is enabled (at the I/O APIC, or wherever appropriate).
|
extern |
#include <include/zephyr/drivers/pcie/pcie.h>
Probe the nth I/O BAR address assigned to an endpoint.
bdf | the PCI(e) endpoint |
index | (0-based) index |
iobar | Pointer to struct pcie_bar |
A PCI(e) endpoint has 0 or more I/O regions. This function allows the caller to enumerate them by calling with index=0..n. Value of n has to be below 6, as there is a maximum of 6 BARs. The indices are order-preserving with respect to the endpoint BARs: e.g., index 0 will return the lowest-numbered I/O BAR on the endpoint.
|
extern |
#include <include/zephyr/drivers/pcie/pcie.h>
Probe the nth MMIO address assigned to an endpoint.
bdf | the PCI(e) endpoint |
index | (0-based) index |
mbar | Pointer to struct pcie_bar |
A PCI(e) endpoint has 0 or more memory-mapped regions. This function allows the caller to enumerate them by calling with index=0..n. Value of n has to be below 6, as there is a maximum of 6 BARs. The indices are order-preserving with respect to the endpoint BARs: e.g., index 0 will return the lowest-numbered memory BAR on the endpoint.
int pcie_scan | ( | const struct pcie_scan_opt * | opt | ) |
#include <include/zephyr/drivers/pcie/pcie.h>
Scan for PCIe devices.
Scan the PCI bus (or buses) for available endpoints.
opt | Options determining how to perform the scan. |
|
extern |
#include <include/zephyr/drivers/pcie/pcie.h>
Set or reset bits in the endpoint command/status register.
bdf | the PCI(e) endpoint |
bits | the powerset of bits of interest |
on | use true to set bits, false to reset them |