mb/google/poppy/variants/nocturne: remove dup'ed dptf_enable
[coreboot.git] / util / sconfig / sconfig.h
blob78c44d64daa19638bdf7fb38ad207d127e4e27cd
1 /*
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.
17 #include <stdio.h>
18 #include <stdlib.h>
19 #include <string.h>
20 #include <sys/types.h>
21 #include <sys/stat.h>
22 #include <unistd.h>
23 #include <errno.h>
25 struct resource;
26 struct resource {
27 int type;
28 int index;
29 int base;
30 struct resource *next;
33 struct reg;
34 struct reg {
35 char *key;
36 char *value;
37 struct reg *next;
40 struct pci_irq_info {
41 int ioapic_irq_pin;
42 int ioapic_dst_id;
45 struct chip;
46 struct chip_instance {
48 * Monotonically increasing ID for each newly allocated
49 * node(chip/device).
51 int id;
53 /* Pointer to registers for this chip. */
54 struct reg *reg;
56 /* Pointer to chip of which this is instance. */
57 struct chip *chip;
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
64 * chip instance.
66 int ref_count;
69 struct chip {
70 /* Indicates if chip header exists for this chip. */
71 int chiph_exists;
73 /* Name of current chip. */
74 char *name;
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. */
83 struct chip *next;
86 struct device;
87 struct bus {
88 /* Instance/ID of the bus under the device. */
89 int id;
91 /* Pointer to device to which this bus belongs. */
92 struct device *dev;
94 /* Pointer to list of children. */
95 struct device *children;
97 /* Pointer to next bus for the device. */
98 struct bus *next_bus;
101 struct device {
102 /* Monotonically increasing ID for the device. */
103 int id;
105 /* Indicates whether this device is enabled. */
106 int enabled;
108 /* Subsystem IDs for the device. */
109 int subsystem_vendor;
110 int subsystem_device;
111 int inherit_subsystem;
113 /* Name of this device. */
114 char *name;
116 /* Path of this device. */
117 char *path;
118 int path_a;
119 int path_b;
121 /* Type of bus that exists under this device. */
122 int bustype;
124 /* PCI IRQ info. */
125 struct pci_irq_info pci_irq_info[4];
127 /* Pointer to bus of parent on which this device resides. */
128 struct bus *parent;
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. */
140 struct bus *bus;
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,
150 int enabled);
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,
155 int inherit);
157 void add_ioapic_info(struct bus *bus, int apicid, const char *_srcpin,
158 int irqpin);
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);