1 /* sconfig, coreboot device tree compiler */
2 /* SPDX-License-Identifier: GPL-2.0-only */
17 struct resource
*next
;
27 struct fw_config_option
;
28 struct fw_config_option
{
31 struct fw_config_option
*next
;
34 struct fw_config_field_bits
;
35 struct fw_config_field_bits
{
36 unsigned int start_bit
;
38 struct fw_config_field_bits
*next
;
41 struct fw_config_field
;
42 struct fw_config_field
{
44 struct fw_config_field_bits
*bits
;
45 struct fw_config_field
*next
;
46 struct fw_config_option
*options
;
48 struct fw_config_probe
;
49 struct fw_config_probe
{
52 struct fw_config_probe
*next
;
57 struct identifier
*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 /* Pointer to device to which this bus belongs. */
112 /* Pointer to list of children. */
113 struct device
*children
;
117 /* Indicates device status (enabled / hidden or not). */
120 /* non-zero if the device should be included in all cases */
123 /* Subsystem IDs for the device. */
124 int subsystem_vendor
;
125 int subsystem_device
;
126 int inherit_subsystem
;
128 /* Name of this device. */
131 /* Alias of this device (for internal references) */
134 /* Path of this device. */
139 /* Type of bus that exists under this device. */
142 /* Pointer to bus of parent on which this device resides. */
145 /* Pointer to next child under the same parent. */
146 struct device
*sibling
;
148 /* Pointer to resources for this device. */
149 struct resource
*res
;
151 /* Pointer to chip instance for this device. */
152 struct chip_instance
*chip_instance
;
154 /* Pointer to the bus under this device. */
157 /* Global identifier of the ops for this device. */
160 /* SMBIOS slot type */
161 char *smbios_slot_type
;
163 /* SMBIOS slot data width */
164 char *smbios_slot_data_width
;
166 /* SMBIOS slot description for reference designation */
167 char *smbios_slot_designation
;
169 /* SMBIOS slot length */
170 char *smbios_slot_length
;
172 /* SMBIOS type41 fields */
173 int smbios_instance_id_valid
;
174 unsigned int smbios_instance_id
;
175 const char *smbios_refdes
;
177 /* List of field+option to probe. */
178 struct fw_config_probe
*probe
;
181 extern struct bus
*root_parent
;
183 struct device
*new_device_raw(struct bus
*parent
,
184 struct chip_instance
*chip_instance
,
185 const int bustype
, const char *devnum
,
186 char *alias
, int status
);
188 struct device
*new_device_reference(struct bus
*parent
,
189 struct chip_instance
*chip_instance
,
190 const char *reference
, int status
);
192 void add_resource(struct bus
*bus
, int type
, int index
, int base
);
194 void add_pci_subsystem_ids(struct bus
*bus
, int vendor
, int device
,
197 void add_slot_desc(struct bus
*bus
, char *type
, char *length
, char *designation
,
200 void add_smbios_dev_info(struct bus
*bus
, long instance_id
, const char *refdes
);
202 void yyrestart(FILE *input_file
);
204 /* Add chip data to tail of queue. */
205 void chip_enqueue_tail(void *data
);
207 /* Retrieve chip data from tail of queue. */
208 void *chip_dequeue_tail(void);
210 struct chip_instance
*new_chip_instance(char *path
);
211 void add_register(struct chip_instance
*chip
, char *name
, char *val
);
212 void add_reference(struct chip_instance
*chip
, char *name
, char *alias
);
214 struct fw_config_field
*get_fw_config_field(const char *name
);
216 void add_fw_config_field_bits(struct fw_config_field
*field
,
217 unsigned int start_bit
, unsigned int end_bit
);
219 struct fw_config_field
*new_fw_config_field(const char *name
, struct fw_config_field_bits
*bits
);
221 void add_fw_config_option(struct fw_config_field
*field
, const char *name
,
224 void add_fw_config_probe(struct bus
*bus
, const char *field
, const char *option
);
226 void append_fw_config_bits(struct fw_config_field_bits
**bits
,
227 unsigned int start_bit
, unsigned int end_bit
);
229 void add_device_ops(struct bus
*, char *ops_id
);