Changeset eb1a2f4 in mainline for uspace/srv/devman/devman.h
- Timestamp:
- 2011-02-22T23:30:56Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3b5d1535, a9c674e0
- Parents:
- dbe25f1 (diff), 664af708 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/devman.h
rdbe25f1 reb1a2f4 56 56 #define DEVMAP_SEPARATOR '\\' 57 57 58 struct node; 59 typedef struct node node_t; 58 struct dev_node; 59 typedef struct dev_node dev_node_t; 60 61 struct fun_node; 62 typedef struct fun_node fun_node_t; 60 63 61 64 typedef enum { … … 117 120 } device_state_t; 118 121 119 /** Representation of anode in the device tree. */120 struct node {122 /** Device node in the device tree. */ 123 struct dev_node { 121 124 /** The global unique identifier of the device. */ 122 125 devman_handle_t handle; 123 /** The name of the device specified by its parent. */ 124 char *name; 125 126 /** 127 * Full path and name of the device in device hierarchi (i. e. in full 128 * path in device tree). 129 */ 130 char *pathname; 131 132 /** The node of the parent device. */ 133 node_t *parent; 134 135 /** 136 * Pointers to previous and next child devices in the linked list of 137 * parent device's node. 138 */ 139 link_t sibling; 140 141 /** List of child device nodes. */ 142 link_t children; 143 /** List of device ids for device-to-driver matching. */ 144 match_id_list_t match_ids; 126 127 /** (Parent) function the device is attached to. */ 128 fun_node_t *pfun; 129 130 /** List of device functions. */ 131 link_t functions; 145 132 /** Driver of this device. */ 146 133 driver_t *drv; 147 134 /** The state of the device. */ 148 135 device_state_t state; 149 /** 150 * Pointer to the previous and next device in the list of devices 151 * owned by one driver. 152 */ 136 /** Link to list of devices owned by driver (driver_t.devices) */ 153 137 link_t driver_devices; 154 138 155 /** The list of device classes to which this device belongs. */156 link_t classes;157 /** Devmap handle if the device is registered by devmapper. */158 devmap_handle_t devmap_handle;159 160 139 /** 161 140 * Used by the hash table of devices indexed by devman device handles. 162 141 */ 163 link_t devman_link; 164 165 /** 166 * Used by the hash table of devices indexed by devmap device handles. 167 */ 168 link_t devmap_link; 169 142 link_t devman_dev; 143 170 144 /** 171 145 * Whether this device was already passed to the driver. … … 173 147 bool passed_to_driver; 174 148 }; 149 150 /** Function node in the device tree. */ 151 struct fun_node { 152 /** The global unique identifier of the function */ 153 devman_handle_t handle; 154 /** Name of the function, assigned by the device driver */ 155 char *name; 156 157 /** Full path and name of the device in device hierarchy */ 158 char *pathname; 159 160 /** Device which this function belongs to */ 161 dev_node_t *dev; 162 163 /** Link to list of functions in the device (ddf_dev_t.functions) */ 164 link_t dev_functions; 165 166 /** Child device node (if any attached). */ 167 dev_node_t *child; 168 /** List of device ids for device-to-driver matching. */ 169 match_id_list_t match_ids; 170 171 /** The list of device classes to which this device function belongs. */ 172 link_t classes; 173 /** Devmap handle if the device function is registered by devmap. */ 174 devmap_handle_t devmap_handle; 175 176 /** 177 * Used by the hash table of functions indexed by devman device handles. 178 */ 179 link_t devman_fun; 180 181 /** 182 * Used by the hash table of functions indexed by devmap device handles. 183 */ 184 link_t devmap_fun; 185 }; 186 175 187 176 188 /** Represents device tree. */ 177 189 typedef struct dev_tree { 178 190 /** Root device node. */ 179 node_t *root_node;191 fun_node_t *root_node; 180 192 181 193 /** … … 191 203 hash_table_t devman_devices; 192 204 205 /** Hash table of all devices indexed by devman handles. */ 206 hash_table_t devman_functions; 207 193 208 /** 194 209 * Hash table of devices registered by devmapper, indexed by devmap 195 210 * handles. 196 211 */ 197 hash_table_t devmap_ devices;212 hash_table_t devmap_functions; 198 213 } dev_tree_t; 199 214 … … 227 242 228 243 /** 229 * Provides n-to-m mapping between device nodes and classes - each device may230 * be register to the arbitrary number of classes and each class maycontain231 * the arbitrary number of devices.244 * Provides n-to-m mapping between function nodes and classes - each function 245 * can register in an arbitrary number of classes and each class can contain 246 * an arbitrary number of device functions. 232 247 */ 233 248 typedef struct dev_class_info { … … 235 250 dev_class_t *dev_class; 236 251 /** The device. */ 237 node_t *dev;252 fun_node_t *fun; 238 253 239 254 /** … … 249 264 link_t dev_classes; 250 265 251 /** The name of the device within the class. */266 /** The name of the device function within the class. */ 252 267 char *dev_name; 253 268 /** The handle of the device by device mapper in the class namespace. */ … … 270 285 * indexed by devmap handles. 271 286 */ 272 hash_table_t devmap_ devices;287 hash_table_t devmap_functions; 273 288 274 289 /** Fibril mutex for list of classes. */ … … 278 293 /* Match ids and scores */ 279 294 280 extern int get_match_score(driver_t *, node_t *);295 extern int get_match_score(driver_t *, dev_node_t *); 281 296 282 297 extern bool parse_match_ids(char *, match_id_list_t *); … … 292 307 extern int lookup_available_drivers(driver_list_t *, const char *); 293 308 294 extern driver_t *find_best_match_driver(driver_list_t *, node_t *);295 extern bool assign_driver( node_t *, driver_list_t *, dev_tree_t *);309 extern driver_t *find_best_match_driver(driver_list_t *, dev_node_t *); 310 extern bool assign_driver(dev_node_t *, driver_list_t *, dev_tree_t *); 296 311 297 312 extern void add_driver(driver_list_t *, driver_t *); 298 extern void attach_driver( node_t *, driver_t *);299 extern void add_device(int, driver_t *, node_t *, dev_tree_t *);313 extern void attach_driver(dev_node_t *, driver_t *); 314 extern void add_device(int, driver_t *, dev_node_t *, dev_tree_t *); 300 315 extern bool start_driver(driver_t *); 301 316 … … 310 325 /* Device nodes */ 311 326 312 extern node_t *create_dev_node(void);313 extern void delete_dev_node( node_t *node);314 extern node_t *find_dev_node_no_lock(dev_tree_t *tree,327 extern dev_node_t *create_dev_node(void); 328 extern void delete_dev_node(dev_node_t *node); 329 extern dev_node_t *find_dev_node_no_lock(dev_tree_t *tree, 315 330 devman_handle_t handle); 316 extern node_t *find_dev_node(dev_tree_t *tree, devman_handle_t handle); 317 extern node_t *find_dev_node_by_path(dev_tree_t *, char *); 318 extern node_t *find_node_child(node_t *, const char *); 331 extern dev_node_t *find_dev_node(dev_tree_t *tree, devman_handle_t handle); 332 extern dev_node_t *find_dev_function(dev_node_t *, const char *); 333 334 extern fun_node_t *create_fun_node(void); 335 extern void delete_fun_node(fun_node_t *); 336 extern fun_node_t *find_fun_node_no_lock(dev_tree_t *tree, 337 devman_handle_t handle); 338 extern fun_node_t *find_fun_node(dev_tree_t *tree, devman_handle_t handle); 339 extern fun_node_t *find_fun_node_by_path(dev_tree_t *, char *); 319 340 320 341 /* Device tree */ 321 342 322 343 extern bool init_device_tree(dev_tree_t *, driver_list_t *); 323 extern bool create_root_node(dev_tree_t *); 324 extern bool insert_dev_node(dev_tree_t *, node_t *, char *, node_t *); 344 extern bool create_root_nodes(dev_tree_t *); 345 extern bool insert_dev_node(dev_tree_t *, dev_node_t *, fun_node_t *); 346 extern bool insert_fun_node(dev_tree_t *, fun_node_t *, char *, dev_node_t *); 325 347 326 348 /* Device classes */ … … 330 352 extern size_t get_new_class_dev_idx(dev_class_t *); 331 353 extern char *create_dev_name_for_class(dev_class_t *, const char *); 332 extern dev_class_info_t *add_ device_to_class(node_t *, dev_class_t *,354 extern dev_class_info_t *add_function_to_class(fun_node_t *, dev_class_t *, 333 355 const char *); 334 356 … … 341 363 /* Devmap devices */ 342 364 343 extern node_t *find_devmap_tree_device(dev_tree_t *, devmap_handle_t); 344 extern node_t *find_devmap_class_device(class_list_t *, devmap_handle_t); 345 346 extern void class_add_devmap_device(class_list_t *, dev_class_info_t *); 347 extern void tree_add_devmap_device(dev_tree_t *, node_t *); 365 extern void devmap_register_tree_function(fun_node_t *, dev_tree_t *); 366 367 extern fun_node_t *find_devmap_tree_function(dev_tree_t *, devmap_handle_t); 368 extern fun_node_t *find_devmap_class_function(class_list_t *, devmap_handle_t); 369 370 extern void class_add_devmap_function(class_list_t *, dev_class_info_t *); 371 extern void tree_add_devmap_function(dev_tree_t *, fun_node_t *); 348 372 349 373 #endif
Note:
See TracChangeset
for help on using the changeset viewer.