2 * sconfig, coreboot device tree compiler
4 * Copyright (C) 2010 coresystems GmbH
5 * written by Patrick Georgi <patrick@georgi-clan.de>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
20 #include <sys/types.h>
29 struct resource
*next
;
45 struct chip_instance
{
47 * Monotonically increasing ID for each newly allocated
52 /* Pointer to registers for this chip. */
55 /* Pointer to chip of which this is instance. */
58 /* Pointer to next instance of the same chip. */
59 struct chip_instance
*next
;
62 * Reference count - Indicates how many devices hold pointer to this
69 /* Indicates if chip header exists for this chip. */
72 /* Name of current chip. */
75 /* Name of current chip normalized to _. */
76 char *name_underscore
;
78 /* Pointer to first instance of this chip. */
79 struct chip_instance
*instance
;
81 /* Pointer to next chip. */
87 /* Instance/ID of the bus under the device. */
90 /* Pointer to device to which this bus belongs. */
93 /* Pointer to list of children. */
94 struct device
*children
;
96 /* Pointer to next bus for the device. */
101 /* Monotonically increasing ID for the device. */
104 /* Indicates device status (enabled / hidden or not). */
107 /* non-zero if the device should be included in all cases */
110 /* Subsystem IDs for the device. */
111 int subsystem_vendor
;
112 int subsystem_device
;
113 int inherit_subsystem
;
115 /* Name of this device. */
118 /* Path of this device. */
123 /* Type of bus that exists under this device. */
127 struct pci_irq_info pci_irq_info
[4];
129 /* Pointer to bus of parent on which this device resides. */
132 /* Pointer to next child under the same parent. */
133 struct device
*sibling
;
135 /* Pointer to resources for this device. */
136 struct resource
*res
;
138 /* Pointer to chip instance for this device. */
139 struct chip_instance
*chip_instance
;
141 /* Pointer to list of buses under this device. */
143 /* Pointer to last bus under this device. */
144 struct bus
*last_bus
;
146 /* SMBIOS slot type */
147 char *smbios_slot_type
;
149 /* SMBIOS slot data width */
150 char *smbios_slot_data_width
;
152 /* SMBIOS slot description for reference designation */
153 char *smbios_slot_designation
;
155 /* SMBIOS slot length */
156 char *smbios_slot_length
;
159 extern struct bus
*root_parent
;
161 struct device
*new_device(struct bus
*parent
,
162 struct chip_instance
*chip_instance
,
163 const int bustype
, const char *devnum
,
166 void add_resource(struct bus
*bus
, int type
, int index
, int base
);
168 void add_pci_subsystem_ids(struct bus
*bus
, int vendor
, int device
,
171 void add_ioapic_info(struct bus
*bus
, int apicid
, const char *_srcpin
,
174 void add_slot_desc(struct bus
*bus
, char *type
, char *length
, char *designation
,
177 void yyrestart(FILE *input_file
);
179 /* Add chip data to tail of queue. */
180 void chip_enqueue_tail(void *data
);
182 /* Retrieve chip data from tail of queue. */
183 void *chip_dequeue_tail(void);
185 struct chip_instance
*new_chip_instance(char *path
);
186 void add_register(struct chip_instance
*chip
, char *name
, char *val
);