12#ifndef ZEPHYR_INCLUDE_DRIVERS_PCIE_CONTROLLERS_H_
13#define ZEPHYR_INCLUDE_DRIVERS_PCIE_CONTROLLERS_H_
80 bool mem,
bool mem64,
size_t bar_size,
99 bool mem,
bool mem64,
size_t align,
122 bool mem,
bool mem64,
uintptr_t bar_bus_addr,
125#ifdef CONFIG_PCIE_MSI
126typedef uint8_t (*pcie_ctrl_msi_device_setup_t)(
const struct device *dev,
unsigned int priority,
181#ifdef CONFIG_PCIE_MSI
182 pcie_ctrl_msi_device_setup_t msi_device_setup;
238 bool mem,
bool mem64,
size_t bar_size,
241 return DEVICE_API_GET(pcie_ctrl, dev)->region_allocate(dev, bdf, mem, mem64, bar_size,
261 bool mem,
bool mem64,
size_t align,
264 return DEVICE_API_GET(pcie_ctrl, dev)->region_get_allocate_base(dev, bdf, mem, mem64, align,
287 bool mem,
bool mem64,
uintptr_t bar_bus_addr,
293 *bar_addr = bar_bus_addr;
300#ifdef CONFIG_PCIE_MSI
301static inline uint8_t pcie_ctrl_msi_device_setup(
const struct device *dev,
unsigned int priority,
304 return DEVICE_API_GET(pcie_ctrl, dev)->msi_device_setup(dev, priority, vectors, n_vector);
311#ifdef CONFIG_PCIE_MSI
312 const struct device *msi_parent;
336#define PCIE_RANGE_FORMAT(node_id, idx) \
338 .flags = DT_RANGES_CHILD_BUS_FLAGS_BY_IDX(node_id, idx), \
339 .pcie_bus_addr = DT_RANGES_CHILD_BUS_ADDRESS_BY_IDX(node_id, idx), \
340 .host_map_addr = DT_RANGES_PARENT_BUS_ADDRESS_BY_IDX(node_id, idx), \
341 .map_length = DT_RANGES_LENGTH_BY_IDX(node_id, idx), \
#define DEVICE_API_GET(_class, _dev)
Expands to the pointer of a device's API for a given class.
Definition device.h:1375
static uint32_t pcie_ctrl_conf_read(const struct device *dev, pcie_bdf_t bdf, unsigned int reg)
Read a 32-bit word from an endpoint's configuration space.
Definition controller.h:197
static bool pcie_ctrl_region_allocate(const struct device *dev, pcie_bdf_t bdf, bool mem, bool mem64, size_t bar_size, uintptr_t *bar_bus_addr)
Allocate a memory region subset for an endpoint Base Address Register.
Definition controller.h:237
void(* pcie_ctrl_conf_write_t)(const struct device *dev, pcie_bdf_t bdf, unsigned int reg, uint32_t data)
Function called to write a 32-bit word to an endpoint's configuration space.
Definition controller.h:59
static void pcie_ctrl_conf_write(const struct device *dev, pcie_bdf_t bdf, unsigned int reg, uint32_t data)
Write a 32-bit word to an endpoint's configuration space.
Definition controller.h:214
bool(* pcie_ctrl_region_allocate_t)(const struct device *dev, pcie_bdf_t bdf, bool mem, bool mem64, size_t bar_size, uintptr_t *bar_bus_addr)
Function called to allocate a memory region subset for an endpoint Base Address Register.
Definition controller.h:79
void pcie_generic_ctrl_conf_write(mm_reg_t cfg_addr, pcie_bdf_t bdf, unsigned int reg, uint32_t data)
Write a 32-bit word to a Memory-Mapped endpoint's configuration space.
void pcie_generic_ctrl_enumerate(const struct device *dev, pcie_bdf_t bdf_start)
Start PCIe Endpoints enumeration.
uint32_t pcie_generic_ctrl_conf_read(mm_reg_t cfg_addr, pcie_bdf_t bdf, unsigned int reg)
Read a 32-bit word from a Memory-Mapped endpoint's configuration space.
bool(* pcie_ctrl_region_get_allocate_base_t)(const struct device *dev, pcie_bdf_t bdf, bool mem, bool mem64, size_t align, uintptr_t *bar_base_addr)
Function called to get the current allocation base of a memory region subset for an endpoint Base Add...
Definition controller.h:98
bool(* pcie_ctrl_region_translate_t)(const struct device *dev, pcie_bdf_t bdf, bool mem, bool mem64, uintptr_t bar_bus_addr, uintptr_t *bar_addr)
Function called to translate an endpoint Base Address Register bus-centric address into Physical addr...
Definition controller.h:121
uint32_t(* pcie_ctrl_conf_read_t)(const struct device *dev, pcie_bdf_t bdf, unsigned int reg)
Function called to read a 32-bit word from an endpoint's configuration space.
Definition controller.h:45
static bool pcie_ctrl_region_translate(const struct device *dev, pcie_bdf_t bdf, bool mem, bool mem64, uintptr_t bar_bus_addr, uintptr_t *bar_addr)
Translate an endpoint Base Address Register bus-centric address into Physical address.
Definition controller.h:286
static bool pcie_ctrl_region_get_allocate_base(const struct device *dev, pcie_bdf_t bdf, bool mem, bool mem64, size_t align, uintptr_t *bar_base_addr)
Function called to get the current allocation base of a memory region subset for an endpoint Base Add...
Definition controller.h:260
uint32_t pcie_bdf_t
A unique PCI(e) endpoint (bus, device, function).
Definition pcie.h:43
struct msi_vector msi_vector_t
Definition msi.h:60
#define bool
Definition stdbool.h:13
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINTPTR_TYPE__ uintptr_t
Definition stdint.h:105
Runtime device structure (in ROM) per driver instance.
Definition device.h:513
void * data
Address of the device instance private data.
Definition device.h:523
Structure describing a device that supports the PCI Express Controller API.
Definition controller.h:310
struct pcie_ctrl_config::@233346376111331064333012004165050322010071233050 ranges[]
uintptr_t cfg_addr
Definition controller.h:315
uintptr_t pcie_bus_addr
Definition controller.h:325
size_t ranges_count
Definition controller.h:319
uint32_t flags
Definition controller.h:323
uintptr_t host_map_addr
Definition controller.h:327
size_t cfg_size
Definition controller.h:317
size_t map_length
Definition controller.h:329
Structure providing callbacks to be implemented for devices that supports the PCI Express Controller ...
Definition controller.h:175
pcie_ctrl_conf_read_t conf_read
Definition controller.h:176
pcie_ctrl_region_allocate_t region_allocate
Definition controller.h:178
pcie_ctrl_conf_write_t conf_write
Definition controller.h:177
pcie_ctrl_region_get_allocate_base_t region_get_allocate_base
Definition controller.h:179
pcie_ctrl_region_translate_t region_translate
Definition controller.h:180
uintptr_t mm_reg_t
Definition sys_io.h:20