![]() |
RT-Thread RTOS
An open source embedded real-time operating system
|
Implementation: **components/drivers/pci/ofw.c**. Requires **RT_USING_OFW**.
Host controllers probe as platform devices; this file connects enumerated **rt_pci_device** instances to DT **ranges** and INTx routing.
Resolves legacy PCI INTx:
interrupts** → **rt_ofw_parse_irq_cells**INTPIN** from config; **pin == 0** → **-RT_ENOSYS**interrupt-map** if presentrt_ofw_parse_irq_map** with key:Missing **interrupt-map** on root → **-RT_EEMPTY** (logged).
Calls **pci_ofw_irq_parse**, then **rt_ofw_map_irq**. Sets **pdev->intx_pic** from **rt_ofw_data(irq_args.data)**.
Host bridge may wire **host_bridge->irq_map** to this helper during init.
**pci_ofw_parse_ranges** / **rt_pci_ofw_parse_ranges**:
space_code** (config / I/O / 32-bit mem / 64-bit mem)host_bridge->bus_regions**: CPU phys, PCI bus addr, size, prefetch flagsrt_pci_region_setup****rt_pci_ofw_host_bridge_init**, **rt_pci_ofw_bus_init**, **rt_pci_ofw_device_init** — per-node OFW hooks during probe.
| Property | Use |
|---|---|
Host **compatible** | Select host driver (PCI host controllers) |
**reg** | ECAM MMIO |
**ranges / dma-ranges** | MEM/IO windows |
**interrupt-map / interrupt-map-mask** | INTx → PIC |
Endpoint **reg** (optional) | Direct **interrupts** on slot |
BAR values still come from config space after enumeration.
MSI message address/data from PIC (**pdev->msi_pic**), not **interrupts** cells. Ensure PIC/MSI parent in DT matches host setup (PCI MSI and MSI-X).
| Issue | Mitigation |
|---|---|
Missing root **interrupt-map** | Use MSI or fix DTS |
| Wrong swizzling | Use **rt_pci_irq_intx** for map key |
Empty **ranges** | BAR assignment fails |
components/drivers/pci/ofw.c