Debian Codegraph @

Documentation/internals/devicetree.md

raw symbols SCIP
1 # Devicetree
2
3 ## Introduction to the coreboot devicetree
4
5 The first thing that may come to mind when one hears "DeviceTree" is a
6 different sort of description file that is generally passed to the Linux
7 kernel to describe a system's components. Both that devicetree and
8 coreboot's devicetree serve fundamentally the same purpose, but are
9 otherwise unrelated and have completely different syntax. The term
10 devicetree was used long before either version was created, and was
11 initially used in coreboot as a generic term.
12
13 coreboot's devicetree's main use is to define and describe the runtime
14 configuration and settings of the hardware on a board, chip or device
15 level. It defines which of the functions of the chips on the board are
16 enabled, and how they're configured.
17
18 The devicetree file is parsed during the build process by a utility
19 named `sconfig`, which translates the devicetree into a tree of C
20 structures containing the included devices. This code is placed in the
21 file `static.c` and a couple of header files, all under the `build`
22 directory. This file is then built into the binaries for the various
23 coreboot stages and is referred to during the coreboot boot process.
24
25 For the early stages of the coreboot boot process, the data that is
26 generated by `sconfig` is a useful resource, but this structure is the
27 critical architectural glue of ramstage. This structure gets filled in
28 with pointers to every chip's initialization code, allowing ramstage to
29 find and initialize those devices through the `chip_operations`
30 structures.
31
32
33 ### History of coreboot's devicetree
34
35 The initial devicetree in coreboot was introduced in 2003 by Ron Minnich
36 as a part of the linuxbios config file, 'config.lb'. At this point both
37 the devicetree and config options were in the same file. In 2009,
38 when Kconfig was added into the coreboot build, devicetree was split
39 out into its own file for each mainboard in a commit with this message:
40
41 ```text
42 devicetree.cb
43
44 The devicetree that formerly resided in src/mainboard/*/*/Config.lb.
45
46 Just without the build system crap
47 ```
48
49 The devicetree structure was initially mainly used only in ramstage for
50 PCI device enumeration, configuration and resource allocation. It has
51 since expanded for use in the pre-ram stages as a read-only structure.
52
53 The language used in the devicetree has been expanded greatly since it
54 was first introduced as well, adding new features every year or so.
55
56
57 ### Devicetree Registers
58
59 In coreboot, the devicetree register setting is one of the two main
60 methods used to configure a board's properties. In this way, devicetree
61 is similar in function to Kconfig. It's more flexible in many ways as
62 it can specify not only single values, but also arrays or structures.
63 It's also even more static than Kconfig because there's no update
64 mechanism for it other than editing the devicetree files.
65
66 Chip-specific configuration values are often set using `register`
67 definitions within a `chip` block, corresponding to a `struct` defined
68 in the chip's `chip.h` file.
69
70 For example, in a `chip drivers/gpio/acpi` block, you might set a GPE:
71
72 ```text
73 register "gpe0_sts" = "0x42"
74 ```
75
76
77 ### Adding new static configuration options: Devicetree or Kconfig
78
79 When adding options for a new board or chip, there is frequently a
80 decision that needs to be made about how the option should be added.
81 Using the devicetree or Kconfig are the two typical methods of
82 build-time configuration. Below are some general guidelines on when to
83 use each.
84
85 Kconfig should be used if the option configures the build in a Makefile,
86 or if the option is something that should be user selectable. Kconfig
87 is also preferred if the configuration is a global option and not limited
88 to a single chip. Another thing Kconfig excels at is handling decisions
89 based on other configuration options, which devicetree cannot do.
90
91 Devicetree should obviously be used to define the hardware hierarchy.
92 It's also preferred if the option is only used in C code and is static
93 for a mainboard, or if the option is chip-specific. As mentioned
94 earlier, devicetree registers can also define structures or arrays,
95 which Kconfig cannot.
96
97 Both Kconfig and devicetree can be used in C code for runtime
98 configuration, but there's a significant difference in how they are
99 handled. Because Kconfig generates a `#define` for the choice, the
100 compiler can eliminate code paths not used by the option. Devicetree
101 options, however, are actual runtime selections, and the code for all
102 choices remains in the final build.
103
104
105 ## Basic Devicetree Syntax
106
107 The coreboot devicetree uses a custom language parsed by the `sconfig`
108 utility. Here's a brief overview of the main keywords and concepts:
109
110 * **`chip <directory>`**: Defines a collection of devices associated
111 with the code in the specified directory. `sconfig` may also parse a
112 `chip.h` file within this directory for register definitions.
113 * **`device <type> <id> [on|off] [alias <name>] ... end`**: Defines a
114 specific hardware device.
115 * `<type>`: Specifies the device type (e.g., `pci`, `cpu_cluster`,
116 `i2c`).
117 * `<id>`: A unique identifier for the device within its type/bus
118 (e.g., PCI BDF `17.0`, I2C address `0x50`).
119 * `on`/`off`: Enables or disables the device definition.
120 * `alias <name>`: Assigns a human-readable alias for referencing
121 this device elsewhere (often used in `chipset.cb`).
122 * `end`: Marks the end of the device definition block. Registers
123 and other properties are defined between `device` and `end`.
124 * **`register "<name>" = <value>`**: Sets the value of a configuration
125 register defined in the corresponding `chip.h` structure. The value
126 can be a number, string, or complex structure initialization.
127 * **`probe <field> <option>`**: Used for firmware configuration
128 (`fw_config`), indicating a setting should be probed at runtime.
129 * **`ops "<identifier>"`**: Associates a `chip_operations` structure
130 with the device, used primarily in ramstage for device initialization.
131 * **`fw_config field <name> size <bits> ... end`**: Defines a firmware
132 configuration field, often used for passing board-specific data to
133 payloads. Options within the field are defined using `option`.
134 * **`ref <alias>`**: Used within `device` definitions in `devicetree.cb`
135 or `overridetree.cb` to refer to a device defined (usually via an
136 `alias`) in a lower-level file like `chipset.cb`.
137 * **`# <comment text>`**: Single-line comments.
138
139 Device definitions can be nested within `chip` blocks. `end` keywords
140 close the current block (`device` or `chip`).
141
142
143 ## Three levels of devicetree files
144
145 There are currently three different levels of devicetrees used to build
146 up the structure of components and register values in coreboot. From
147 the lowest, most general level to the highest and most specific, they
148 are `chipset.cb`, `devicetree.cb`, and `overridetree.cb`.
149
150 Unless there's a specific reason to name them something other than these
151 names, they should be used.
152
153 For newer SoCs and chipsets, there will generally be a `chipset.cb` file.
154 Every mainboard requires a `devicetree.cb` file, although it can be empty
155 if everything is inherited from the `chipset.cb`. An `overridetree.cb`
156 file is only required if variants have differences from the primary
157 mainboard's `devicetree.cb`.
158
159
160 ### SoC / chipset level, `chipset.cb`
161
162 The `chipset.cb` file was added in October 2020, allowing a single
163 chipset or SoC to provide a "base level" devicetree, reducing
164 duplication between mainboards.
165
166 The `chipset.cb` file also typically defines human-readable "aliases"
167 for particular devices so that mainboards can use those instead of PCI
168 device/function numbers or other hardware identifiers.
169
170 The use of the `chipset.cb` file is specified in Kconfig by the
171 `CHIPSET_DEVICETREE` symbol, which provides the path to the file.
172
173 In a `chipset.cb` file, you might see lines like this:
174
175 ```text
176 # Chip definition for the SoC/chipset itself
177 chip soc/intel/common/block
178
179 # Define PCI device 17.0, alias it to "sata", and default it off
180 device pci 17.0 alias sata off end
181
182 # Define PCI device 1e.0, alias it to "uart0", and default it off
183 device pci 1e.0 alias uart0 off end
184
185 end # chip soc/intel/common/block
186 ```
187
188 This defines the devices, assigns aliases, and sets their default state.
189
190
191 ### Primary mainboard level, `devicetree.cb`
192
193 Each mainboard must have a `devicetree.cb` file. The filename and path are
194 typically set by the `DEVICETREE` Kconfig symbol, defaulting to
195 `src/mainboard/<VENDOR>/<BOARD>/devicetree.cb`.
196
197 If a mainboard using the above `chipset.cb` wanted both devices enabled,
198 its `devicetree.cb` might contain:
199
200 ```text
201 # Reference the SATA device by its alias and enable it
202 device ref sata on end
203
204 # Reference the UART0 device by its alias and enable it
205 device ref uart0 on end
206 ```
207
208 The `ref` keyword looks up the device (usually by alias) defined in a
209 lower-level file (`chipset.cb` in this case) and modifies its properties.
210
211
212 ### Mainboard variant level, `overridetree.cb`
213
214 Introduced in 2018 to reduce duplication and maintenance for board
215 variants, the `overridetree.cb` file is the most specific level.
216
217 This allows a base `devicetree.cb` at the top mainboard level shared by
218 all variants. Each variant then only needs an `overridetree.cb` to
219 specify its differences.
220
221 The override tree filename is set in Kconfig with the
222 `OVERRIDE_DEVICETREE` symbol and is typically named `overridetree.cb`.
223
224 Finally, if one variant of the mainboard lacked a SATA connector, it
225 could disable the SATA device again using the following in its specific
226 `overridetree.cb`:
227
228 ```text
229 # Reference the SATA device by alias and disable it for this variant
230 device ref sata off end
231 ```
232
233
234 ## Additional files
235
236
237 ### `chip.h` files
238
239 coreboot looks at a "chip" as a collection of devices. This collection
240 can be a single logical device or multiple different ones. The `chip`
241 keyword starts this collection. Following the `chip` keyword is a
242 directory path (relative to `src/`) containing the code for that chip
243 or logical block of hardware.
244
245 There may optionally be a `chip.h` file in that directory. If present,
246 `sconfig` parses this file to define a C structure containing the
247 "register definitions" for the chip. The values for this structure's
248 members are set using the `register` keyword in one of the devicetree
249 files (`chipset.cb`, `devicetree.cb`, `overridetree.cb`). If not
250 explicitly set, members typically default to 0 or follow standard C
251 initialization rules. The `chip.h` file frequently also contains C
252 macros, enums, and sub-structures used for setting the members of the
253 main register structure.
254
255 The C structure for the chip's register definition is named after the
256 directory containing the `chip.h` file, with slashes (`/`) changed to
257 underscores (`_`), and `_config` appended. The leading `src/` is omitted.
258
259 This means that a line in a devicetree file like:
260 `chip drivers/i2c/hid`
261 would cause `sconfig` to look for `src/drivers/i2c/hid/chip.h`. If found,
262 the register definition structure it contains would be named
263 `drivers_i2c_hid_config`.
264
265 Here is the content of `src/drivers/i2c/hid/chip.h`:
266
267 ```c
268 /* SPDX-License-Identifier: GPL-2.0-only */
269
270 #ifndef __DRIVERS_I2C_HID_CHIP_H__
271 #define __DRIVERS_I2C_HID_CHIP_H__
272 #include <drivers/i2c/generic/chip.h>
273 #define I2C_HID_CID "PNP0C50"
274
275 struct drivers_i2c_hid_config {
276 struct drivers_i2c_generic_config generic;
277 uint8_t hid_desc_reg_offset;
278 };
279
280 #endif /* __I2C_HID_CHIP_H__ */
281 ```
282
283 In a devicetree, you could set `hid_desc_reg_offset` like this:
284
285 ```text
286 chip drivers/i2c/hid
287 device i2c 0x2c on
288 # Set the HID descriptor register offset
289 register "hid_desc_reg_offset" = "0x01"
290 end
291 end
292 ```
293
294
295 ## The `sconfig` utility and generated files
296
297
298 ### `util/sconfig`
299
300 `sconfig` is the tool that parses the coreboot devicetrees and turns
301 them into a collection of C structures. This is a coreboot-specific
302 tool, built using flex & bison to define and parse the domain-specific
303 language used by coreboot's devicetree.
304
305 `sconfig` is called by the makefiles during the build process and doesn't
306 generally need to be run directly. If run manually (e.g.,
307 `build/util/sconfig/sconfig --help`), it shows its command-line options.
308 The exact options might vary slightly, but typically include:
309
310 ```text
311 usage: sconfig <options>
312
313 -c | --output_c : Path to output static.c file (required)
314 -r | --output_h : Path to header static.h file (required)
315 -d | --output_d : Path to header static_devices.h file (required)
316 -f | --output_f : Path to header static_fw_config.h file (required)
317 -m | --mainboard_devtree : Path to mainboard devicetree file (required)
318 -o | --override_devtree : Path to override devicetree file (optional)
319 -p | --chipset_devtree : Path to chipset/SOC devicetree file (optional)
320 ```
321
322
323 ### `sconfig` inputs
324
325 The `sconfig` input files `chip.h`, `chipset.cb`, `devicetree.cb`, and
326 `overridetree.cb` were discussed previously. As the usage above shows,
327 the only required input file is the mainboard devicetree (`-m`). The
328 additional devicetree files, `chipset.cb` (`-p`) and `overridetree.cb`
329 (`-o`), are optional. The `chip.h` files do not need to be specified on
330 the command line; their locations are determined by the `chip` directory
331 paths within the `.cb` files.
332
333 Constructing the devicetree input files will be discussed later.
334
335
336 ### `sconfig` outputs
337
338 #### `static.c`
339
340 This is the primary C file generated by `sconfig`. It contains the static
341 definitions of the device tree structures, including device nodes, bus
342 links, and register configuration data.
343
344 For historic reasons, `static.c` is generated in the
345 `build/mainboard/<VENDOR>/<BOARD>` directory.
346
347
348 #### `static.h`
349
350 The `static.h` file is the main header file included by most coreboot C
351 files that need access to the devicetree data. It is included by
352 `src/include/device/device.h`, which provides the primary API
353 (definitions, structures, function prototypes) for interacting with the
354 devicetree-generated output.
355
356 `static.h` used to contain all generated declarations directly. As of
357 October 2020, it simply includes the other two generated header files
358 (`static_devices.h` and `static_fw_config.h`). This separation allows
359 the firmware config options (`fw_config`) to be used independently, for
360 example, by a payload.
361
362
363 #### `static_devices.h`
364
365 The file `static_devices.h` contains `extern` declarations for all the
366 device structures (`struct device`) defined in `static.c`. This allows
367 other C files to reference the generated device tree nodes.
368
369
370 #### `static_fw_config.h`
371
372 `static_fw_config.h` contains only the `FW_CONFIG_FIELD_*` macro results,
373 derived from `fw_config` entries in the devicetree. This makes it easily
374 consumable by payloads or other components needing platform `FW_CONFIG`
375 data without pulling in the full device tree structure.
376
377
378 ## Devicetree Example
379
380
381 ### A very simple devicetree
382
383 This is the `devicetree.cb` file from
384 `src/mainboard/sifive/hifive-unleashed`, with line numbers added for
385 reference. Non-x86 devicetree files are often simpler than their x86
386 counterparts.
387
388 ```text
389 1 # SPDX-License-Identifier: GPL-2.0-only
390 2 chip soc/sifive/fu540
391 3 device cpu_cluster 0 on end
392 4 end
393 ```
394
395 This can be broken down as follows:
396
397 Line 1: Comments start with `#`. This line is the SPDX license
398 identifier for the file.
399
400 Line 2: `chip soc/sifive/fu540` starts a block for the SiFive FU540 SoC.
401 `sconfig` will look for code and potentially a `chip.h` in
402 `src/soc/sifive/fu540/`.
403
404 Line 3: `device cpu_cluster 0 on end` defines a device of type
405 `cpu_cluster` with ID `0`. It's marked as enabled (`on`). Since there are
406 no registers or other properties defined between `device` and `end`, this
407 is a simple enablement entry.
408
409 Line 4: `end` closes the block started by the `chip` keyword on line 2.
410
411
412 ### Generated files
413
414 Continuing with the simple `sifive/hifive-unleashed` mainboard example,
415 these are the files generated by `sconfig` from the devicetree above (as
416 of mid-2022; exact output can change). Because the input devicetree is
417 minimal, the generated files are also quite sparse.
418
419
420 #### `build/static.h`
421
422 ```c
423 #ifndef __STATIC_DEVICE_TREE_H
424 #define __STATIC_DEVICE_TREE_H
425
426 #include <static_fw_config.h>
427 #include <static_devices.h>
428
429 #endif /* __STATIC_DEVICE_TREE_H */
430 ```
431 (Includes the other generated headers.)
432
433
434 #### `build/static_devices.h`
435
436 ```c
437 #ifndef __STATIC_DEVICES_H
438 #define __STATIC_DEVICES_H
439 #include <device/device.h>
440 /* expose_device_names */
441 #endif /* __STATIC_DEVICE_NAMES_H */
442 ```
443 (Includes `device/device.h` but contains no actual device externs beyond
444 the implicit root device, as the simple example didn't define complex
445 devices requiring separate structs.)
446
447
448 #### `build/static_fw_config.h`
449
450 ```c
451 #ifndef __STATIC_FW_CONFIG_H
452 #define __STATIC_FW_CONFIG_H
453 #endif /* __STATIC_FW_CONFIG_H */
454 ```
455 (Empty because the example `devicetree.cb` did not use `fw_config`.)
456
457
458 #### `build/mainboard/sifive/hifive-unleashed/static.c`
459
460 ##### Includes
461
462 ```text
463 1 #include <boot/coreboot_tables.h>
464 2 #include <device/device.h>
465 3 #include <device/pci.h>
466 4 #include <fw_config.h>
467 5 #include <static.h>
468 ```
469
470 Lines 1-5: Includes header files required for the following structure
471 definitions and macros.
472
473
474 ##### Declarations for chip-ops
475
476 ```text
477 6
478 7 #if !DEVTREE_EARLY
479 8 __attribute__((weak)) struct chip_operations mainboard_ops = {};
480 9 extern struct chip_operations soc_sifive_fu540_ops;
481 10 #endif
482 ```
483
484 Lines 7 & 10: The `ops` structures inside this `#if !DEVTREE_EARLY` block
485 are only relevant and linked in ramstage.
486
487 Lines 8-9: Declarations for `chip_operations` structures. This section
488 expands as more chips are added to the devicetree.
489 * Line 8: `mainboard_ops` is always present. It's defined as `weak`
490 because the mainboard C code may or may not provide this structure.
491 * Line 9: This `extern` is generated by the `chip soc/sifive/fu540`
492 declaration in the `devicetree.cb`. There will be a similar line for
493 every `chip` declared.
494
495 ##### `STORAGE` definition
496
497 ```text
498 11
499 12 #define STORAGE static __unused DEVTREE_CONST
500 ```
501
502 Line 12: This macro conditionally adds `const` based on the build stage.
503 It resolves to `static __unused const` in early stages (pre-RAM) and
504 `static __unused` in ramstage, where the structures might be modified.
505
506 ##### Structure definitions
507
508 ```text
509 13
510 14
511 15 /* pass 0 */
512 16 STORAGE struct bus dev_root_links[];
513 17 STORAGE struct device _dev_0;
514 18 DEVTREE_CONST struct device * DEVTREE_CONST last_dev = &_dev_0;
515 ```
516
517 Lines 16-18: Forward declarations of the static structures generated by
518 `sconfig` based on the devicetree input. `_dev_0` corresponds to the
519 `cpu_cluster 0` device.
520
521 ##### Register Structures
522
523 ```text
524 19
525 20 /* chip configs */
526 ```
527
528 Line 20: This section is empty for this mainboard because the
529 `soc/sifive/fu540/chip.h` file (if it exists) does not define a register
530 structure, or the devicetree did not instantiate it using `register`.
531 Otherwise, this section would contain the static initialization of chip
532 configuration structures based on `register` entries.
533
534 ##### `dev_root` structure
535
536 Lines 21-44: `dev_root`. This structure represents the root of the
537 coreboot device tree. It is always generated, regardless of the content
538 of the `devicetree.cb` file. It serves as the entry point for traversing
539 the tree.
540
541 ```text
542 21
543 22 /* pass 1 */
544 23 DEVTREE_CONST struct device dev_root = {
545 24 #if !DEVTREE_EARLY
546 25 .ops = &default_dev_ops_root,
547 26 #endif
548 27 .bus = &dev_root_links[0],
549 28 .path = { .type = DEVICE_PATH_ROOT },
550 29 .enabled = 1,
551 30 .hidden = 0,
552 31 .mandatory = 0,
553 32 .on_mainboard = 1,
554 33 .link_list = &dev_root_links[0],
555 34 .sibling = NULL,
556 35 #if !DEVTREE_EARLY
557 36 .chip_ops = &mainboard_ops,
558 37 .name = mainboard_name,
559 38 #endif
560 39 .next=&_dev_0,
561 40 #if !DEVTREE_EARLY
562 41 #if CONFIG(GENERATE_SMBIOS_TABLES)
563 42 #endif
564 43 #endif
565 44 };
566 ```
567
568 * Lines 24-26: Points to a default ramstage `device_operation`
569 structure (`default_dev_ops_root`) found in
570 `src/device/root_device.c`. This structure typically does little by
571 default but can be overridden or utilized by mainboard code via the
572 `chip_operations->enable_dev()` hook for tasks like ACPI table
573 generation.
574 * Line 27: `.bus`: Pointer to the bus structure associated with this
575 device. For the root device, this points to its own bus structure.
576 * Line 28: `.path`: The unique path identifier for this device. The type
577 is `DEVICE_PATH_ROOT`.
578 * Lines 29-32: Device status flags.
579 * `enabled`: Set based on `on`/`off` in the devicetree (always on
580 for `dev_root`). Can be modified later (e.g., during enumeration
581 in ramstage).
582 * `hidden`, `mandatory`: Set only by corresponding keywords in the
583 devicetree (not used here).
584 * `on_mainboard`: Indicates the device was defined in the static
585 devicetree, as opposed to being discovered dynamically (e.g., via
586 PCI enumeration). Always true for `dev_root`.
587 * Line 33: `.link_list`: Pointer to the list of child buses attached to
588 this device.
589 * Line 34: `.sibling`: Pointer to the next device at the same level in
590 the tree. Should always be `NULL` for `dev_root`.
591 * Line 36: `.chip_ops`: Pointer to the mainboard's `chip_operations`
592 structure (the `weak` `mainboard_ops`). Although not a physical
593 chip, the mainboard gets this to hook into the boot process like
594 other chips.
595 * Line 37: `.name`: A string identifier, typically the mainboard name,
596 set at build time (from `src/device/root_device.c`).
597 * Line 39: `.next`: Pointer used internally by `sconfig` during tree
598 construction. Points to the next device structure processed (`_dev_0`).
599
600 ##### `dev_root_links`
601
602 Lines 45-52: The `dev_root` bus structure array.
603
604 This array (`struct bus`) holds pointers defining the bus topology. Each
605 element represents a link on a bus. `dev_root` acts as the bridge for the
606 top-level bus.
607
608 A new bus structure array is typically created for each distinct bus type
609 or domain originating from a bridge device in the devicetree (e.g., PCI
610 domain 0, LPC bus).
611
612 ```text
613 45 STORAGE struct bus dev_root_links[] = {
614 46 [0] = {
615 47 .link_num = 0,
616 48 .dev = &dev_root,
617 49 .children = &_dev_0,
618 50 .next = NULL,
619 51 },
620 52 };
621 ```
622
623 * Line 47: `.link_num`: Index of this link within the bus array.
624 * Line 48: `.dev`: Pointer back to the bridge device structure for this
625 bus (`dev_root`).
626 * Line 49: `.children`: Pointer to the first child device structure on
627 this bus (`_dev_0`).
628 * Line 50: `.next`: Pointer to the next bridge device on the *parent*
629 bus. Since `dev_root` has no parent bus, this is `NULL`.
630
631 ##### `_dev_0`
632
633 Lines 53-72: The `cpu_cluster` device structure (`_dev_0`).
634
635 This structure corresponds directly to the
636 `device cpu_cluster 0 on end` line in the `devicetree.cb`.
637
638 ```text
639 53 STORAGE struct device _dev_0 = {
640 54 #if !DEVTREE_EARLY
641 55 .ops = NULL,
642 56 #endif
643 57 .bus = &dev_root_links[0],
644 58 .path = {.type=DEVICE_PATH_CPU_CLUSTER,{.cpu_cluster={ .cluster = 0x0 }}},
645 59 .enabled = 1,
646 60 .hidden = 0,
647 61 .mandatory = 0,
648 62 .on_mainboard = 1,
649 63 .link_list = NULL,
650 64 .sibling = NULL,
651 65 #if !DEVTREE_EARLY
652 66 .chip_ops = &soc_sifive_fu540_ops,
653 67 #endif
654 68 #if !DEVTREE_EARLY
655 69 #if CONFIG(GENERATE_SMBIOS_TABLES)
656 70 #endif
657 71 #endif
658 72 };
659 ```
660
661 * Lines 54-56: `.ops`: Pointer to a `device_operations` structure. This
662 is `NULL` because this entry represents the `chip` itself, not a
663 specific functional sub-device requiring device-level operations. The
664 chip-level operations are handled by `chip_ops`.
665 * Line 57: `.bus`: Pointer to the bus structure this device resides on.
666 Since it's directly under `dev_root`, it points to `dev_root_links[0]`.
667 * Line 58: `.path`: The unique device path structure (defined in
668 `src/include/device/path.h`). Type is `DEVICE_PATH_CPU_CLUSTER`,
669 and the cluster ID is `0`, matching the devicetree entry. This path
670 is used when searching the tree (e.g., with `dev_find_path()`).
671 * Lines 59-62: Enumeration Status. Similar to `dev_root`. `enabled = 1`
672 comes from the `on` keyword.
673 * Line 63: `.link_list`: Pointer to child buses. `NULL` because this
674 `cpu_cluster` device doesn't bridge to any further buses in this
675 simple example.
676 * Line 64: `.sibling`: Pointer to the next device at the same level
677 (i.e., another device directly under `dev_root`). `NULL` as it's the
678 only child.
679 * Lines 65-67: `.chip_ops`: Pointer to the processor's `chip_operations`
680 structure (`soc_sifive_fu540_ops`), used in ramstage for SoC/CPU
681 initialization steps. This link comes from the `chip soc/sifive/fu540`
682 declaration.
683 * Lines 68-71: Placeholder for SMBIOS information, enabled by Kconfig.
684 Not used in this example.