| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#include <stdint.h> |
| 5 |
#include <stdio.h> |
| 6 |
#include <stdlib.h> |
| 7 |
#include <string.h> |
| 8 |
#include <sys/types.h> |
| 9 |
#include <unistd.h> |
| 10 |
#include <errno.h> |
| 11 |
#include <stdbool.h> |
| 12 |
|
| 13 |
struct resource; |
| 14 |
struct resource { |
| 15 |
int type; |
| 16 |
int index; |
| 17 |
int base; |
| 18 |
struct resource *next; |
| 19 |
}; |
| 20 |
|
| 21 |
struct reg; |
| 22 |
struct reg { |
| 23 |
char *key; |
| 24 |
char *value; |
| 25 |
struct reg *next; |
| 26 |
}; |
| 27 |
|
| 28 |
struct fw_config_option; |
| 29 |
struct fw_config_option { |
| 30 |
const char *name; |
| 31 |
uint64_t value; |
| 32 |
struct fw_config_option *next; |
| 33 |
}; |
| 34 |
|
| 35 |
struct fw_config_field_bits; |
| 36 |
struct fw_config_field_bits { |
| 37 |
unsigned int start_bit; |
| 38 |
unsigned int end_bit; |
| 39 |
struct fw_config_field_bits *next; |
| 40 |
}; |
| 41 |
|
| 42 |
struct fw_config_field; |
| 43 |
struct fw_config_field { |
| 44 |
const char *name; |
| 45 |
struct fw_config_field_bits *bits; |
| 46 |
struct fw_config_field *next; |
| 47 |
struct fw_config_option *options; |
| 48 |
}; |
| 49 |
struct fw_config_probe; |
| 50 |
struct fw_config_probe { |
| 51 |
const char *field; |
| 52 |
const char *option; |
| 53 |
struct fw_config_probe *next; |
| 54 |
}; |
| 55 |
|
| 56 |
struct identifier { |
| 57 |
const char *id; |
| 58 |
struct identifier *next; |
| 59 |
}; |
| 60 |
|
| 61 |
struct chip; |
| 62 |
struct chip_instance { |
| 63 |
|
| 64 |
int id; |
| 65 |
|
| 66 |
|
| 67 |
struct reg *reg; |
| 68 |
|
| 69 |
|
| 70 |
struct reg *ref; |
| 71 |
|
| 72 |
|
| 73 |
struct chip *chip; |
| 74 |
|
| 75 |
|
| 76 |
struct chip_instance *next; |
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
struct chip_instance *base_chip_instance; |
| 89 |
}; |
| 90 |
|
| 91 |
struct chip { |
| 92 |
|
| 93 |
int chiph_exists; |
| 94 |
|
| 95 |
|
| 96 |
char *name; |
| 97 |
|
| 98 |
|
| 99 |
char *name_underscore; |
| 100 |
|
| 101 |
|
| 102 |
struct chip_instance *instance; |
| 103 |
|
| 104 |
|
| 105 |
struct chip *next; |
| 106 |
}; |
| 107 |
|
| 108 |
struct device; |
| 109 |
struct bus { |
| 110 |
|
| 111 |
struct device *dev; |
| 112 |
|
| 113 |
|
| 114 |
struct device *children; |
| 115 |
}; |
| 116 |
|
| 117 |
struct device { |
| 118 |
|
| 119 |
int enabled; |
| 120 |
int hidden; |
| 121 |
|
| 122 |
int mandatory; |
| 123 |
|
| 124 |
|
| 125 |
int subsystem_vendor; |
| 126 |
int subsystem_device; |
| 127 |
int inherit_subsystem; |
| 128 |
|
| 129 |
|
| 130 |
char *name; |
| 131 |
|
| 132 |
|
| 133 |
char *alias; |
| 134 |
|
| 135 |
|
| 136 |
char *path; |
| 137 |
int path_a; |
| 138 |
int path_b; |
| 139 |
|
| 140 |
|
| 141 |
int bustype; |
| 142 |
|
| 143 |
|
| 144 |
struct bus *parent; |
| 145 |
|
| 146 |
|
| 147 |
struct device *sibling; |
| 148 |
|
| 149 |
|
| 150 |
struct resource *res; |
| 151 |
|
| 152 |
|
| 153 |
struct chip_instance *chip_instance; |
| 154 |
|
| 155 |
|
| 156 |
struct bus *bus; |
| 157 |
|
| 158 |
|
| 159 |
char *ops_id; |
| 160 |
|
| 161 |
|
| 162 |
char *smbios_slot_type; |
| 163 |
|
| 164 |
|
| 165 |
char *smbios_slot_data_width; |
| 166 |
|
| 167 |
|
| 168 |
char *smbios_slot_designation; |
| 169 |
|
| 170 |
|
| 171 |
char *smbios_slot_length; |
| 172 |
|
| 173 |
|
| 174 |
int smbios_instance_id_valid; |
| 175 |
unsigned int smbios_instance_id; |
| 176 |
const char *smbios_refdes; |
| 177 |
|
| 178 |
|
| 179 |
struct fw_config_probe *probe; |
| 180 |
bool enable_on_unprovisioned_fw_config; |
| 181 |
}; |
| 182 |
|
| 183 |
extern struct bus *root_parent; |
| 184 |
|
| 185 |
struct device *new_device_raw(struct bus *parent, |
| 186 |
struct chip_instance *chip_instance, |
| 187 |
const int bustype, const char *devnum, |
| 188 |
char *alias, int status); |
| 189 |
|
| 190 |
struct device *new_device_reference(struct bus *parent, |
| 191 |
struct chip_instance *chip_instance, |
| 192 |
const char *reference, int status); |
| 193 |
|
| 194 |
void add_resource(struct bus *bus, int type, int index, int base); |
| 195 |
|
| 196 |
void add_pci_subsystem_ids(struct bus *bus, int vendor, int device, |
| 197 |
int inherit); |
| 198 |
|
| 199 |
void add_slot_desc(struct bus *bus, char *type, char *length, char *designation, |
| 200 |
char *data_width); |
| 201 |
|
| 202 |
void add_smbios_dev_info(struct bus *bus, long instance_id, const char *refdes); |
| 203 |
|
| 204 |
void yyrestart(FILE *input_file); |
| 205 |
|
| 206 |
|
| 207 |
void chip_enqueue_tail(void *data); |
| 208 |
|
| 209 |
|
| 210 |
void *chip_dequeue_tail(void); |
| 211 |
|
| 212 |
struct chip_instance *new_chip_instance(char *path); |
| 213 |
void add_register(struct chip_instance *chip, char *name, char *val); |
| 214 |
void add_reference(struct chip_instance *chip, char *name, char *alias); |
| 215 |
|
| 216 |
struct fw_config_field *get_fw_config_field(const char *name); |
| 217 |
|
| 218 |
void add_fw_config_field_bits(struct fw_config_field *field, |
| 219 |
unsigned int start_bit, unsigned int end_bit); |
| 220 |
|
| 221 |
struct fw_config_field *new_fw_config_field(const char *name, struct fw_config_field_bits *bits); |
| 222 |
|
| 223 |
void add_fw_config_option(struct fw_config_field *field, const char *name, |
| 224 |
uint64_t value); |
| 225 |
|
| 226 |
void add_fw_config_probe(struct bus *bus, const char *field, const char *option); |
| 227 |
|
| 228 |
void append_fw_config_bits(struct fw_config_field_bits **bits, |
| 229 |
unsigned int start_bit, unsigned int end_bit); |
| 230 |
|
| 231 |
void probe_unprovisioned_fw_config(struct bus *bus); |
| 232 |
|
| 233 |
void add_device_ops(struct bus *, char *ops_id); |