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>
30 struct resource
*next
;
46 struct chip_instance
{
48 * Monotonically increasing ID for each newly allocated
53 /* Pointer to registers for this chip. */
56 /* Pointer to chip of which this is instance. */
59 /* Pointer to next instance of the same chip. */
60 struct chip_instance
*next
;
63 * Reference count - Indicates how many devices hold pointer to this
70 /* Indicates if chip header exists for this chip. */
73 /* Name of current chip. */
76 /* Name of current chip normalized to _. */
77 char *name_underscore
;
79 /* Pointer to first instance of this chip. */
80 struct chip_instance
*instance
;
82 /* Pointer to next chip. */
88 /* Instance/ID of the bus under the device. */
91 /* Pointer to device to which this bus belongs. */
94 /* Pointer to list of children. */
95 struct device
*children
;
97 /* Pointer to next bus for the device. */
102 /* Monotonically increasing ID for the device. */
105 /* Indicates device status (enabled / hidden or not). */
109 /* Subsystem IDs for the device. */
110 int subsystem_vendor
;
111 int subsystem_device
;
112 int inherit_subsystem
;
114 /* Name of this device. */
117 /* Path of this device. */
122 /* Type of bus that exists under this device. */
126 struct pci_irq_info pci_irq_info
[4];
128 /* Pointer to bus of parent on which this device resides. */
131 /* Pointer to next child under the same parent. */
132 struct device
*sibling
;
134 /* Pointer to resources for this device. */
135 struct resource
*res
;
137 /* Pointer to chip instance for this device. */
138 struct chip_instance
*chip_instance
;
140 /* Pointer to list of buses under this device. */
142 /* Pointer to last bus under this device. */
143 struct bus
*last_bus
;
146 extern struct bus
*root_parent
;
148 struct device
*new_device(struct bus
*parent
,
149 struct chip_instance
*chip_instance
,
150 const int bustype
, const char *devnum
,
153 void add_resource(struct bus
*bus
, int type
, int index
, int base
);
155 void add_pci_subsystem_ids(struct bus
*bus
, int vendor
, int device
,
158 void add_ioapic_info(struct bus
*bus
, int apicid
, const char *_srcpin
,
161 void yyrestart(FILE *input_file
);
163 /* Add chip data to tail of queue. */
164 void chip_enqueue_tail(void *data
);
166 /* Retrieve chip data from tail of queue. */
167 void *chip_dequeue_tail(void);
169 struct chip_instance
*new_chip_instance(char *path
);
170 void add_register(struct chip_instance
*chip
, char *name
, char *val
);