1 /* sconfig, coreboot device tree compiler */
2 /* SPDX-License-Identifier: GPL-2.0-only */
18 struct resource
*next
;
28 struct fw_config_option
;
29 struct fw_config_option
{
32 struct fw_config_option
*next
;
35 struct fw_config_field_bits
;
36 struct fw_config_field_bits
{
37 unsigned int start_bit
;
39 struct fw_config_field_bits
*next
;
42 struct fw_config_field
;
43 struct fw_config_field
{
45 struct fw_config_field_bits
*bits
;
46 struct fw_config_field
*next
;
47 struct fw_config_option
*options
;
49 struct fw_config_probe
;
50 struct fw_config_probe
{
53 struct fw_config_probe
*next
;
58 struct identifier
*next
;
62 struct chip_instance
{
63 /* Monotonically increasing ID for each chip instance. */
66 /* Pointer to registers for this chip. */
69 /* Pointer to references for this chip. */
72 /* Pointer to chip of which this is instance. */
75 /* Pointer to next instance of the same chip. */
76 struct chip_instance
*next
;
79 * Pointer to corresponding chip instance in base devicetree.
80 * a) If the chip instance belongs to the base devicetree, then this pointer is set to
82 * b) If the chip instance belongs to override tree, then this pointer is set to its
83 * corresponding chip instance in base devicetree (if it exists), else to NULL.
85 * This is useful when generating chip instances and chip_ops for a device to determine
86 * if this is the instance to emit or if there is a base chip instance to use instead.
88 struct chip_instance
*base_chip_instance
;
92 /* Indicates if chip header exists for this chip. */
95 /* Name of current chip. */
98 /* Name of current chip normalized to _. */
99 char *name_underscore
;
101 /* Pointer to first instance of this chip. */
102 struct chip_instance
*instance
;
104 /* Pointer to next chip. */
110 /* Pointer to device to which this bus belongs. */
113 /* Pointer to list of children. */
114 struct device
*children
;
118 /* Indicates device status (enabled / hidden or not). */
121 /* non-zero if the device should be included in all cases */
124 /* Subsystem IDs for the device. */
125 int subsystem_vendor
;
126 int subsystem_device
;
127 int inherit_subsystem
;
129 /* Name of this device. */
132 /* Alias of this device (for internal references) */
135 /* Path of this device. */
140 /* Type of bus that exists under this device. */
143 /* Pointer to bus of parent on which this device resides. */
146 /* Pointer to next child under the same parent. */
147 struct device
*sibling
;
149 /* Pointer to resources for this device. */
150 struct resource
*res
;
152 /* Pointer to chip instance for this device. */
153 struct chip_instance
*chip_instance
;
155 /* Pointer to the bus under this device. */
158 /* Global identifier of the ops for this device. */
161 /* SMBIOS slot type */
162 char *smbios_slot_type
;
164 /* SMBIOS slot data width */
165 char *smbios_slot_data_width
;
167 /* SMBIOS slot description for reference designation */
168 char *smbios_slot_designation
;
170 /* SMBIOS slot length */
171 char *smbios_slot_length
;
173 /* SMBIOS type41 fields */
174 int smbios_instance_id_valid
;
175 unsigned int smbios_instance_id
;
176 const char *smbios_refdes
;
178 /* List of field+option to probe. */
179 struct fw_config_probe
*probe
;
180 bool enable_on_unprovisioned_fw_config
;
183 extern struct bus
*root_parent
;
185 struct device
*new_device_raw(struct bus
*parent
,
186 struct chip_instance
*chip_instance
,
187 const int bustype
, const char *devnum
,
188 char *alias
, int status
);
190 struct device
*new_device_reference(struct bus
*parent
,
191 struct chip_instance
*chip_instance
,
192 const char *reference
, int status
);
194 void add_resource(struct bus
*bus
, int type
, int index
, int base
);
196 void add_pci_subsystem_ids(struct bus
*bus
, int vendor
, int device
,
199 void add_slot_desc(struct bus
*bus
, char *type
, char *length
, char *designation
,
202 void add_smbios_dev_info(struct bus
*bus
, long instance_id
, const char *refdes
);
204 void yyrestart(FILE *input_file
);
206 /* Add chip data to tail of queue. */
207 void chip_enqueue_tail(void *data
);
209 /* Retrieve chip data from tail of queue. */
210 void *chip_dequeue_tail(void);
212 struct chip_instance
*new_chip_instance(char *path
);
213 void add_register(struct chip_instance
*chip
, char *name
, char *val
);
214 void add_reference(struct chip_instance
*chip
, char *name
, char *alias
);
216 struct fw_config_field
*get_fw_config_field(const char *name
);
218 void add_fw_config_field_bits(struct fw_config_field
*field
,
219 unsigned int start_bit
, unsigned int end_bit
);
221 struct fw_config_field
*new_fw_config_field(const char *name
, struct fw_config_field_bits
*bits
);
223 void add_fw_config_option(struct fw_config_field
*field
, const char *name
,
226 void add_fw_config_probe(struct bus
*bus
, const char *field
, const char *option
);
228 void append_fw_config_bits(struct fw_config_field_bits
**bits
,
229 unsigned int start_bit
, unsigned int end_bit
);
231 void probe_unprovisioned_fw_config(struct bus
*bus
);
233 void add_device_ops(struct bus
*, char *ops_id
);