Changes in uspace/srv/devman/devman.h [83a2f43:ffa2c8ef] in mainline
- File:
-
- 1 edited
-
uspace/srv/devman/devman.h (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/devman.h
r83a2f43 rffa2c8ef 56 56 #define DEVMAP_SEPARATOR '\\' 57 57 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; 58 struct node; 59 typedef struct node node_t; 63 60 64 61 typedef enum { … … 120 117 } device_state_t; 121 118 122 /** Devicenode in the device tree. */123 struct dev_node {119 /** Representation of a node in the device tree. */ 120 struct node { 124 121 /** The global unique identifier of the device. */ 125 122 devman_handle_t handle; 126 127 /** (Parent) function the device is attached to. */ 128 fun_node_t *pfun; 129 130 /** List of device functions. */ 131 link_t functions; 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; 132 145 /** Driver of this device. */ 133 146 driver_t *drv; 134 147 /** The state of the device. */ 135 148 device_state_t state; 136 /** Link to list of devices owned by driver (driver_t.devices) */ 149 /** 150 * Pointer to the previous and next device in the list of devices 151 * owned by one driver. 152 */ 137 153 link_t driver_devices; 138 154 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 139 160 /** 140 161 * Used by the hash table of devices indexed by devman device handles. 141 162 */ 142 link_t devman_dev; 143 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 144 170 /** 145 171 * Whether this device was already passed to the driver. … … 147 173 bool passed_to_driver; 148 174 }; 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 187 175 188 176 /** Represents device tree. */ 189 177 typedef struct dev_tree { 190 178 /** Root device node. */ 191 fun_node_t *root_node;179 node_t *root_node; 192 180 193 181 /** … … 203 191 hash_table_t devman_devices; 204 192 205 /** Hash table of all devices indexed by devman handles. */206 hash_table_t devman_functions;207 208 193 /** 209 194 * Hash table of devices registered by devmapper, indexed by devmap 210 195 * handles. 211 196 */ 212 hash_table_t devmap_ functions;197 hash_table_t devmap_devices; 213 198 } dev_tree_t; 214 199 … … 242 227 243 228 /** 244 * Provides n-to-m mapping between function nodes and classes - each function245 * can register in an arbitrary number of classes and each class cancontain246 * an arbitrary number of device functions.229 * Provides n-to-m mapping between device nodes and classes - each device may 230 * be register to the arbitrary number of classes and each class may contain 231 * the arbitrary number of devices. 247 232 */ 248 233 typedef struct dev_class_info { … … 250 235 dev_class_t *dev_class; 251 236 /** The device. */ 252 fun_node_t *fun;237 node_t *dev; 253 238 254 239 /** … … 264 249 link_t dev_classes; 265 250 266 /** The name of the device functionwithin the class. */251 /** The name of the device within the class. */ 267 252 char *dev_name; 268 253 /** The handle of the device by device mapper in the class namespace. */ … … 285 270 * indexed by devmap handles. 286 271 */ 287 hash_table_t devmap_ functions;272 hash_table_t devmap_devices; 288 273 289 274 /** Fibril mutex for list of classes. */ … … 293 278 /* Match ids and scores */ 294 279 295 extern int get_match_score(driver_t *, dev_node_t *);280 extern int get_match_score(driver_t *, node_t *); 296 281 297 282 extern bool parse_match_ids(char *, match_id_list_t *); … … 307 292 extern int lookup_available_drivers(driver_list_t *, const char *); 308 293 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 *);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 *); 311 296 312 297 extern void add_driver(driver_list_t *, driver_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 *);298 extern void attach_driver(node_t *, driver_t *); 299 extern void add_device(int, driver_t *, node_t *, dev_tree_t *); 315 300 extern bool start_driver(driver_t *); 316 301 … … 325 310 /* Device nodes */ 326 311 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,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, 330 315 devman_handle_t handle); 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 *); 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 *); 340 319 341 320 /* Device tree */ 342 321 343 322 extern bool init_device_tree(dev_tree_t *, driver_list_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 *); 323 extern bool create_root_node(dev_tree_t *); 324 extern bool insert_dev_node(dev_tree_t *, node_t *, char *, node_t *); 347 325 348 326 /* Device classes */ … … 352 330 extern size_t get_new_class_dev_idx(dev_class_t *); 353 331 extern char *create_dev_name_for_class(dev_class_t *, const char *); 354 extern dev_class_info_t *add_ function_to_class(fun_node_t *, dev_class_t *,332 extern dev_class_info_t *add_device_to_class(node_t *, dev_class_t *, 355 333 const char *); 356 334 … … 363 341 /* Devmap devices */ 364 342 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 *); 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 *); 372 348 373 349 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
