1 /* sconfig, coreboot device tree compiler */
2 /* SPDX-License-Identifier: GPL-2.0-only */
17 struct resource
*next
;
32 struct fw_config_option
;
33 struct fw_config_option
{
36 struct fw_config_option
*next
;
39 struct fw_config_field_bits
;
40 struct fw_config_field_bits
{
41 unsigned int start_bit
;
43 struct fw_config_field_bits
*next
;
46 struct fw_config_field
;
47 struct fw_config_field
{
49 struct fw_config_field_bits
*bits
;
50 struct fw_config_field
*next
;
51 struct fw_config_option
*options
;
53 struct fw_config_probe
;
54 struct fw_config_probe
{
57 struct fw_config_probe
*next
;
61 struct chip_instance
{
62 /* Monotonically increasing ID for each chip instance. */
65 /* Pointer to registers for this chip. */
68 /* Pointer to references for this chip. */
71 /* Pointer to chip of which this is instance. */
74 /* Pointer to next instance of the same chip. */
75 struct chip_instance
*next
;
78 * Pointer to corresponding chip instance in base devicetree.
79 * a) If the chip instance belongs to the base devicetree, then this pointer is set to
81 * b) If the chip instance belongs to override tree, then this pointer is set to its
82 * corresponding chip instance in base devicetree (if it exists), else to NULL.
84 * This is useful when generating chip instances and chip_ops for a device to determine
85 * if this is the instance to emit or if there is a base chip instance to use instead.
87 struct chip_instance
*base_chip_instance
;
91 /* Indicates if chip header exists for this chip. */
94 /* Name of current chip. */
97 /* Name of current chip normalized to _. */
98 char *name_underscore
;
100 /* Pointer to first instance of this chip. */
101 struct chip_instance
*instance
;
103 /* Pointer to next chip. */
109 /* Instance/ID of the bus under the device. */
112 /* Pointer to device to which this bus belongs. */
115 /* Pointer to list of children. */
116 struct device
*children
;
118 /* Pointer to next bus for the device. */
119 struct bus
*next_bus
;
123 /* Indicates device status (enabled / hidden or not). */
126 /* non-zero if the device should be included in all cases */
129 /* Subsystem IDs for the device. */
130 int subsystem_vendor
;
131 int subsystem_device
;
132 int inherit_subsystem
;
134 /* Name of this device. */
137 /* Alias of this device (for internal references) */
140 /* Path of this device. */
145 /* Type of bus that exists under this device. */
149 struct pci_irq_info pci_irq_info
[4];
151 /* Pointer to bus of parent on which this device resides. */
154 /* Pointer to next child under the same parent. */
155 struct device
*sibling
;
157 /* Pointer to resources for this device. */
158 struct resource
*res
;
160 /* Pointer to chip instance for this device. */
161 struct chip_instance
*chip_instance
;
163 /* Pointer to list of buses under this device. */
165 /* Pointer to last bus under this device. */
166 struct bus
*last_bus
;
168 /* SMBIOS slot type */
169 char *smbios_slot_type
;
171 /* SMBIOS slot data width */
172 char *smbios_slot_data_width
;
174 /* SMBIOS slot description for reference designation */
175 char *smbios_slot_designation
;
177 /* SMBIOS slot length */
178 char *smbios_slot_length
;
180 /* List of field+option to probe. */
181 struct fw_config_probe
*probe
;
184 extern struct bus
*root_parent
;
186 struct device
*new_device_raw(struct bus
*parent
,
187 struct chip_instance
*chip_instance
,
188 const int bustype
, const char *devnum
,
189 char *alias
, int status
);
191 struct device
*new_device_reference(struct bus
*parent
,
192 struct chip_instance
*chip_instance
,
193 const char *reference
, int status
);
195 void add_resource(struct bus
*bus
, int type
, int index
, int base
);
197 void add_pci_subsystem_ids(struct bus
*bus
, int vendor
, int device
,
200 void add_ioapic_info(struct bus
*bus
, int apicid
, const char *_srcpin
,
203 void add_slot_desc(struct bus
*bus
, char *type
, char *length
, char *designation
,
206 void yyrestart(FILE *input_file
);
208 /* Add chip data to tail of queue. */
209 void chip_enqueue_tail(void *data
);
211 /* Retrieve chip data from tail of queue. */
212 void *chip_dequeue_tail(void);
214 struct chip_instance
*new_chip_instance(char *path
);
215 void add_register(struct chip_instance
*chip
, char *name
, char *val
);
216 void add_reference(struct chip_instance
*chip
, char *name
, char *alias
);
218 struct fw_config_field
*get_fw_config_field(const char *name
);
220 void add_fw_config_field_bits(struct fw_config_field
*field
,
221 unsigned int start_bit
, unsigned int end_bit
);
223 struct fw_config_field
*new_fw_config_field(const char *name
, struct fw_config_field_bits
*bits
);
225 void add_fw_config_option(struct fw_config_field
*field
, const char *name
,
228 void add_fw_config_probe(struct bus
*bus
, const char *field
, const char *option
);
230 void append_fw_config_bits(struct fw_config_field_bits
**bits
,
231 unsigned int start_bit
, unsigned int end_bit
);