Skip to content

Commit fdb16a4

Browse files
CopilotRbb666
andcommitted
Add comprehensive help for PIC and OFW driver Kconfig files
Co-authored-by: Rbb666 <64397326+Rbb666@users.noreply.github.com>
1 parent 560deec commit fdb16a4

File tree

2 files changed

+300
-1
lines changed

2 files changed

+300
-1
lines changed

components/drivers/ofw/Kconfig

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,154 @@ menuconfig RT_USING_OFW
66
select RT_USING_MEMBLOCK
77
depends on RT_USING_DM
88
default n
9+
help
10+
Enable Open Firmware (Device Tree) support.
11+
12+
OFW/Device Tree provides hardware description separate from code:
13+
- Flattened Device Tree (FDT/DTB) parsing
14+
- Hardware discovery and configuration
15+
- Platform-independent device drivers
16+
- Runtime hardware detection
17+
18+
Features:
19+
- Standard device tree bindings
20+
- Property parsing and access
21+
- Node traversal and searching
22+
- Phandle reference resolution
23+
- Address translation
24+
- Interrupt mapping
25+
26+
Benefits:
27+
- Single kernel binary for multiple boards
28+
- Easier board porting (just change DTB)
29+
- Better hardware abstraction
30+
- Industry-standard hardware description
31+
32+
Use cases:
33+
- ARM/RISC-V systems with complex hardware
34+
- Supporting multiple board variants
35+
- Dynamic hardware configuration
36+
- PCI, USB, network device enumeration
37+
38+
Requires:
39+
- RT_USING_DM (Device Model)
40+
- Memory block allocator
41+
- Abstract Data Types (ADT) support
42+
43+
Essential for modern ARM Cortex-A and RISC-V systems.
44+
Enable for device tree-based hardware discovery.
945

1046
config RT_USING_BUILTIN_FDT
1147
bool "Using builtin fdt in kernel"
1248
depends on RT_USING_OFW
1349
default n
50+
help
51+
Embed Flattened Device Tree (FDT) binary into kernel image.
52+
53+
When enabled:
54+
- DTB file linked into kernel binary
55+
- No need for bootloader to pass DTB
56+
- DTB always available at boot
57+
58+
Advantages:
59+
+ Simpler boot process
60+
+ No DTB location dependencies
61+
+ Guaranteed DTB availability
62+
63+
Disadvantages:
64+
- Larger kernel image
65+
- Must rebuild kernel to change DTB
66+
- Less flexible than bootloader-provided DTB
67+
68+
Typical use:
69+
- Systems without proper bootloader
70+
- Debugging and development
71+
- Single-board configurations
72+
73+
Alternative: Have bootloader pass DTB address to kernel.
74+
75+
Enable for embedded DTB in kernel image.
1476

1577
config RT_BUILTIN_FDT_PATH
1678
string "Builtin fdt path, will rebuild if have dts"
1779
depends on RT_USING_BUILTIN_FDT
1880
default "rtthread.dtb"
81+
help
82+
Path to the compiled Device Tree Blob (DTB) file to embed.
83+
84+
Default: "rtthread.dtb"
85+
86+
This file is included in the kernel binary during linking.
87+
88+
Workflow:
89+
1. Write device tree source (.dts file)
90+
2. Compile to DTB: dtc -I dts -O dtb -o rtthread.dtb rtthread.dts
91+
3. Set this path to the DTB location
92+
4. Rebuild kernel (DTB will be embedded)
93+
94+
Path can be:
95+
- Relative to build directory
96+
- Absolute path
97+
98+
Kernel will automatically rebuild if DTS changes (if build system configured).
1999

20100
config RT_FDT_EARLYCON_MSG_SIZE
21101
int "Earlycon message buffer size (KB)"
22102
depends on RT_USING_OFW
23103
default 128
104+
help
105+
Size of early console message buffer in kilobytes.
106+
107+
Default: 128 KB
108+
109+
Early console (earlycon) provides debug output before full console initialization:
110+
- Available during early boot
111+
- Before full UART driver loads
112+
- Critical for debugging boot failures
113+
114+
Buffer stores messages when:
115+
- Console not yet available
116+
- Output faster than transmission
117+
118+
Larger buffer:
119+
+ More boot messages captured
120+
+ Better for verbose debugging
121+
- More memory usage
122+
123+
Smaller buffer:
124+
+ Less memory overhead
125+
- May lose early messages
126+
127+
Increase for detailed boot debugging.
128+
Decrease to save memory if earlycon not critical.
24129

25130
config RT_USING_OFW_BUS_RANGES_NUMBER
26131
int "Max bus ranges number"
27132
depends on RT_USING_OFW
28133
default 8 if ARCH_CPU_64BIT
29134
default 4
135+
help
136+
Maximum number of bus address ranges for device tree translation.
137+
138+
Default:
139+
- 64-bit systems: 8 ranges
140+
- 32-bit systems: 4 ranges
141+
142+
Bus ranges define address space mappings:
143+
- CPU address to device bus address
144+
- PCI memory/IO spaces
145+
- Different bus protocols (AHB, APB, AXI)
146+
147+
Each range describes a memory window mapping.
148+
149+
Typical usage:
150+
- PCI: 2-3 ranges (prefetchable mem, non-prefetchable mem, I/O)
151+
- Complex SoCs: 4-8 ranges for different buses
152+
153+
Increase for:
154+
- Complex bus hierarchies
155+
- Multiple PCI buses
156+
- Systems with many address spaces
157+
158+
Each range uses ~32-48 bytes of memory.
159+
Set based on your SoC's bus complexity.

components/drivers/pic/Kconfig

Lines changed: 170 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,57 +4,226 @@ menuconfig RT_USING_PIC
44
select RT_USING_ADT_BITMAP
55
depends on RT_USING_DM
66
default n
7+
help
8+
Enable Platform Interrupt Controller (PIC) framework.
9+
10+
PIC provides unified interrupt controller abstraction for:
11+
- ARM GIC (Generic Interrupt Controller) v1/v2/v3
12+
- Platform-specific interrupt controllers
13+
- MSI/MSI-X (Message Signaled Interrupts)
14+
- Interrupt hierarchy and cascading
15+
16+
Features:
17+
- Device model integration
18+
- Device tree support (OFW)
19+
- Multiple interrupt controller support
20+
- Interrupt routing and affinity
21+
- Statistics and profiling
22+
23+
Use cases:
24+
- ARM Cortex-A systems with GIC
25+
- SMP systems requiring interrupt affinity
26+
- Systems using device tree
27+
- Complex interrupt hierarchies
28+
29+
Requires:
30+
- RT_USING_DM (Device Model)
31+
- Abstract Data Types (ADT) support
32+
33+
Enable for advanced interrupt management with GIC or complex IRQ routing.
734

835
config RT_USING_PIC_STATISTICS
936
bool "Enable ISR execution time statistics"
1037
depends on RT_USING_PIC
1138
depends on RT_USING_KTIME
1239
depends on RT_USING_INTERRUPT_INFO
1340
default n
41+
help
42+
Enable interrupt service routine (ISR) execution time tracking.
43+
44+
Provides statistics for each interrupt:
45+
- Total execution time
46+
- Minimum/maximum execution time
47+
- Average execution time
48+
- Interrupt count
49+
50+
Benefits:
51+
- Performance profiling
52+
- Identify slow interrupt handlers
53+
- Optimize ISR performance
54+
- Debug interrupt latency issues
55+
56+
Requirements:
57+
- KTIME for high-resolution timing
58+
- RT_USING_INTERRUPT_INFO for interrupt tracking
59+
60+
Overhead:
61+
- Minimal per-interrupt timing overhead
62+
- Memory for statistics (~40 bytes per IRQ)
63+
64+
Enable for interrupt performance analysis.
65+
Disable in production to save memory and overhead.
1466

1567
config MAX_HANDLERS
1668
int "IRQ max handlers"
1769
depends on RT_USING_PIC
1870
range 1 4294967294
1971
default 256
72+
help
73+
Maximum number of interrupt handlers supported by PIC.
74+
75+
Default: 256 handlers
76+
77+
This limits the total number of IRQ lines the system can handle.
78+
79+
Typical values:
80+
- Small systems: 64-128 IRQs
81+
- Medium systems: 256-512 IRQs
82+
- Large systems: 512-1024 IRQs
83+
84+
Memory usage: ~16-32 bytes per handler slot
85+
86+
Set based on your SoC's interrupt controller capabilities.
87+
Check GIC documentation for maximum SPIs (Shared Peripheral Interrupts).
2088

2189
config RT_PIC_ARM_GIC
2290
bool "ARM GICv2/v1"
2391
depends on RT_USING_PIC
2492
select RT_USING_OFW
2593
default n
94+
help
95+
Enable ARM Generic Interrupt Controller version 1/2 (GICv1/GICv2).
96+
97+
GICv2 features:
98+
- Up to 1020 interrupt sources
99+
- Support for SGIs (Software Generated Interrupts)
100+
- Support for PPIs (Private Peripheral Interrupts)
101+
- Support for SPIs (Shared Peripheral Interrupts)
102+
- CPU interfaces for each core
103+
- Distributor for routing interrupts
104+
105+
Used in:
106+
- ARM Cortex-A5/A7/A8/A9/A15/A17
107+
- Many ARM-based SoCs
108+
109+
Requires device tree (OFW) for configuration.
110+
111+
Enable for ARM Cortex-A systems with GICv2.
26112

27113
config RT_PIC_ARM_GIC_V2M
28114
bool "ARM GIC V2M" if RT_PIC_ARM_GIC && RT_PCI_MSI
29115
depends on RT_USING_OFW
30116
default n
117+
help
118+
Enable GICv2m MSI (Message Signaled Interrupts) support.
119+
120+
GICv2m provides:
121+
- MSI support for GICv2 (which lacks native MSI)
122+
- PCIe device interrupt handling
123+
- Doorbell-style interrupt delivery
124+
125+
Allows PCIe devices to use MSI with GICv2.
126+
127+
Requirements:
128+
- RT_PIC_ARM_GIC enabled
129+
- RT_PCI_MSI for PCI MSI support
130+
- Device tree configuration
131+
132+
Enable for PCIe systems with GICv2 requiring MSI support.
31133

32134
config RT_PIC_ARM_GIC_V3
33135
bool "ARM GICv3"
34136
depends on RT_USING_PIC
35137
select RT_USING_OFW
36138
default n
139+
help
140+
Enable ARM Generic Interrupt Controller version 3 (GICv3).
141+
142+
GICv3 enhancements over GICv2:
143+
- Better scalability (supports more cores)
144+
- System register access (no memory-mapped CPU interface)
145+
- Affinity routing for flexible interrupt routing
146+
- Locality-specific peripheral interrupts (LPI)
147+
- ITS (Interrupt Translation Service) for MSI
148+
- Support for GICv4 virtualization extensions
149+
150+
Used in:
151+
- ARM Cortex-A53/A55/A57/A72/A73/A76
152+
- ARMv8 and ARMv9 systems
153+
- Modern ARM SoCs
154+
155+
Requires device tree (OFW) for configuration.
156+
157+
Enable for ARM Cortex-A systems with GICv3.
37158

38159
config RT_PIC_ARM_GIC_V3_ITS
39160
bool "ARM GICv3 ITS (Interrupt Translation Service)" if RT_PIC_ARM_GIC_V3 && RT_PCI_MSI
40161
depends on RT_USING_OFW
41162
select RT_USING_ADT_REF
42163
default n
164+
help
165+
Enable GICv3 ITS for MSI/MSI-X support.
166+
167+
ITS (Interrupt Translation Service) provides:
168+
- Native MSI support for PCIe and other devices
169+
- LPI (Locality-specific Peripheral Interrupts) management
170+
- Efficient interrupt routing for thousands of devices
171+
- Scalable to large systems
172+
173+
Features:
174+
- Translates MSI writes to LPIs
175+
- Device and interrupt ID management
176+
- Interrupt collection for CPU targeting
177+
178+
Required for:
179+
- PCIe MSI/MSI-X on GICv3
180+
- Large-scale systems with many devices
181+
- Modern ARM servers and complex SoCs
182+
183+
Memory overhead:
184+
- ITS tables for device/interrupt mapping
185+
- LPI configuration tables
186+
187+
Enable for GICv3 systems with PCIe requiring MSI support.
43188

44189
config RT_PIC_ARM_GIC_V3_ITS_IRQ_MAX
45190
int "IRQ maximum used"
46191
depends on RT_PIC_ARM_GIC_V3_ITS
47192
default 127 if ARCH_CPU_64BIT
48193
default 63
49194
help
50-
Recommended to be based on the bit length (full bits) of maximum usage.
195+
Maximum number of ITS-managed LPIs (Locality-specific Peripheral Interrupts).
196+
197+
Recommended to be based on the bit length (full bits) of maximum usage.
198+
199+
Default values:
200+
- 64-bit systems: 127 (uses 7 bits)
201+
- 32-bit systems: 63 (uses 6 bits)
202+
203+
LPI IDs typically start from 8192 and can go very high.
204+
This setting affects ITS table allocation.
205+
206+
Increase for:
207+
- Systems with many PCIe devices
208+
- MSI-X devices using multiple vectors
209+
210+
Each LPI uses memory in ITS configuration tables.
211+
Set based on actual device count to balance memory usage.
51212

52213
config RT_PIC_ARM_GIC_MAX_NR
53214
int
54215
depends on RT_USING_PIC
55216
depends on RT_PIC_ARM_GIC
56217
default 2 if SOC_REALVIEW
57218
default 1
219+
help
220+
Maximum number of GIC instances in the system.
221+
222+
Most systems have 1 GIC.
223+
Some systems may have cascaded GICs or multiple interrupt controllers.
224+
225+
Automatically configured based on SoC type.
226+
Users typically don't need to modify this.
58227

59228
if RT_USING_PIC
60229
osource "$(SOC_DM_PIC_DIR)/Kconfig"

0 commit comments

Comments
 (0)