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 whether this device is enabled. */
108 /* Subsystem IDs for the device. */
109 int subsystem_vendor
;
110 int subsystem_device
;
111 int inherit_subsystem
;
113 /* Name of this device. */
116 /* Path of this device. */
121 /* Type of bus that exists under this device. */
125 struct pci_irq_info pci_irq_info
[4];
127 /* Pointer to bus of parent on which this device resides. */
130 /* Pointer to next child under the same parent. */
131 struct device
*sibling
;
133 /* Pointer to resources for this device. */
134 struct resource
*res
;
136 /* Pointer to chip instance for this device. */
137 struct chip_instance
*chip_instance
;
139 /* Pointer to list of buses under this device. */
141 /* Pointer to last bus under this device. */
142 struct bus
*last_bus
;
145 extern struct bus
*root_parent
;
147 struct device
*new_device(struct bus
*parent
,
148 struct chip_instance
*chip_instance
,
149 const int bustype
, const char *devnum
,
152 void add_resource(struct bus
*bus
, int type
, int index
, int base
);
154 void add_pci_subsystem_ids(struct bus
*bus
, int vendor
, int device
,
157 void add_ioapic_info(struct bus
*bus
, int apicid
, const char *_srcpin
,
160 void yyrestart(FILE *input_file
);
162 /* Add chip data to tail of queue. */
163 void chip_enqueue_tail(void *data
);
165 /* Retrieve chip data from tail of queue. */
166 void *chip_dequeue_tail(void);
168 struct chip_instance
*new_chip_instance(char *path
);
169 void add_register(struct chip_instance
*chip
, char *name
, char *val
);