remove trailing whitespace
[coreboot.git] / util / sconfig / sconfig.h
1 /*
2  * sconfig, coreboot device tree compiler
3  *
4  * Copyright (C) 2010 coresystems GmbH
5  *                 written by Patrick Georgi <patrick.georgi@coresystems.de>
6  *
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.
10  *
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.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
19  */
20
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <string.h>
24 #include <sys/types.h>
25 #include <sys/stat.h>
26 #include <unistd.h>
27 #include <errno.h>
28
29 enum devtype { chip, device };
30
31 struct resource;
32 struct resource {
33         int type;
34         int index;
35         int base;
36         struct resource *next;
37 };
38
39 struct reg;
40 struct reg {
41         char *key;
42         char *value;
43         struct reg *next;
44 };
45
46 struct device;
47 struct device {
48         int id;
49         int enabled;
50         int used;
51         int multidev;
52         int link;
53         int rescnt;
54         int chiph_exists;
55         int subsystem_vendor;
56         int subsystem_device;
57         int inherit_subsystem;
58         char *ops;
59         char *name;
60         char *name_underscore;
61         char *path;
62         int path_a;
63         int path_b;
64         int bustype;
65         enum devtype type;
66         struct device *parent;
67         struct device *bus;
68         struct device *next;
69         struct device *nextdev;
70         struct device *children;
71         struct device *latestchild;
72         struct device *next_sibling;
73         struct device *sibling;
74         struct device *chip;
75         struct resource *res;
76         struct reg *reg;
77 };
78
79 struct device *head;
80
81 struct header;
82 struct header {
83         char *name;
84         struct header *next;
85 };
86
87 void fold_in(struct device *parent);
88
89 void postprocess_devtree(void);
90 struct device *new_chip(struct device *parent, struct device *bus, char *path);
91 void add_header(struct device *dev);
92 struct device *new_device(struct device *parent, struct device *busdev, const int bus, const char *devnum, int enabled);
93 void alias_siblings(struct device *d);
94 void add_resource(struct device *dev, int type, int index, int base);
95 void add_register(struct device *dev, char *name, char *val);
96 void add_pci_subsystem_ids(struct device *dev, int vendor, int device, int inherit);