[041b026] | 1 | /*
|
---|
[b25970f] | 2 | * Copyright (c) 2018 Jiri Svoboda
|
---|
[041b026] | 3 | * Copyright (c) 2010 Lenka Trochtova
|
---|
| 4 | * All rights reserved.
|
---|
| 5 | *
|
---|
| 6 | * Redistribution and use in source and binary forms, with or without
|
---|
| 7 | * modification, are permitted provided that the following conditions
|
---|
| 8 | * are met:
|
---|
| 9 | *
|
---|
| 10 | * - Redistributions of source code must retain the above copyright
|
---|
| 11 | * notice, this list of conditions and the following disclaimer.
|
---|
| 12 | * - Redistributions in binary form must reproduce the above copyright
|
---|
| 13 | * notice, this list of conditions and the following disclaimer in the
|
---|
| 14 | * documentation and/or other materials provided with the distribution.
|
---|
| 15 | * - The name of the author may not be used to endorse or promote products
|
---|
| 16 | * derived from this software without specific prior written permission.
|
---|
| 17 | *
|
---|
| 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
| 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
| 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
| 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
| 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 28 | */
|
---|
| 29 |
|
---|
| 30 | /** @addtogroup devman
|
---|
| 31 | * @{
|
---|
| 32 | */
|
---|
| 33 |
|
---|
[d1bafbf] | 34 | #include <dirent.h>
|
---|
[041b026] | 35 | #include <errno.h>
|
---|
[e55741e] | 36 | #include <fcntl.h>
|
---|
[041b026] | 37 | #include <io/log.h>
|
---|
[23a0368] | 38 | #include <vfs/vfs.h>
|
---|
[041b026] | 39 | #include <loc.h>
|
---|
| 40 | #include <stdio.h>
|
---|
[e55741e] | 41 | #include <str_error.h>
|
---|
| 42 | #include <sys/stat.h>
|
---|
| 43 | #include <sysman/ctl.h>
|
---|
[1c635d6] | 44 | #include <task.h>
|
---|
[041b026] | 45 |
|
---|
[d1bafbf] | 46 | #include "dev.h"
|
---|
[041b026] | 47 | #include "devman.h"
|
---|
| 48 | #include "driver.h"
|
---|
[b25970f] | 49 | #include "fun.h"
|
---|
[a60e90b] | 50 | #include "match.h"
|
---|
[b25970f] | 51 | #include "main.h"
|
---|
| 52 |
|
---|
| 53 | static errno_t driver_reassign_fibril(void *);
|
---|
[041b026] | 54 |
|
---|
| 55 | /**
|
---|
| 56 | * Initialize the list of device driver's.
|
---|
| 57 | *
|
---|
| 58 | * @param drv_list the list of device driver's.
|
---|
| 59 | *
|
---|
| 60 | */
|
---|
| 61 | void init_driver_list(driver_list_t *drv_list)
|
---|
| 62 | {
|
---|
| 63 | assert(drv_list != NULL);
|
---|
[a35b458] | 64 |
|
---|
[041b026] | 65 | list_initialize(&drv_list->drivers);
|
---|
| 66 | fibril_mutex_initialize(&drv_list->drivers_mutex);
|
---|
[0511549] | 67 | drv_list->next_handle = 1;
|
---|
[041b026] | 68 | }
|
---|
| 69 |
|
---|
| 70 | /** Allocate and initialize a new driver structure.
|
---|
| 71 | *
|
---|
| 72 | * @return Driver structure.
|
---|
| 73 | */
|
---|
| 74 | driver_t *create_driver(void)
|
---|
| 75 | {
|
---|
| 76 | driver_t *res = malloc(sizeof(driver_t));
|
---|
| 77 | if (res != NULL)
|
---|
| 78 | init_driver(res);
|
---|
| 79 | return res;
|
---|
| 80 | }
|
---|
| 81 |
|
---|
| 82 | /** Add a driver to the list of drivers.
|
---|
| 83 | *
|
---|
| 84 | * @param drivers_list List of drivers.
|
---|
| 85 | * @param drv Driver structure.
|
---|
| 86 | */
|
---|
| 87 | void add_driver(driver_list_t *drivers_list, driver_t *drv)
|
---|
| 88 | {
|
---|
| 89 | fibril_mutex_lock(&drivers_list->drivers_mutex);
|
---|
[e5556e4a] | 90 | list_append(&drv->drivers, &drivers_list->drivers);
|
---|
[0511549] | 91 | drv->handle = drivers_list->next_handle++;
|
---|
[041b026] | 92 | fibril_mutex_unlock(&drivers_list->drivers_mutex);
|
---|
| 93 |
|
---|
[de3d15b4] | 94 | log_msg(LOG_DEFAULT, LVL_DEBUG, "Driver `%s' was added to the list of available "
|
---|
[041b026] | 95 | "drivers.", drv->name);
|
---|
| 96 | }
|
---|
| 97 |
|
---|
| 98 | /**
|
---|
| 99 | * Get information about a driver.
|
---|
| 100 | *
|
---|
| 101 | * Each driver has its own directory in the base directory.
|
---|
| 102 | * The name of the driver's directory is the same as the name of the driver.
|
---|
| 103 | * The driver's directory contains driver's binary (named as the driver without
|
---|
| 104 | * extension) and the configuration file with match ids for device-to-driver
|
---|
| 105 | * matching (named as the driver with a special extension).
|
---|
| 106 | *
|
---|
| 107 | * This function searches for the driver's directory and containing
|
---|
| 108 | * configuration files. If all the files needed are found, they are parsed and
|
---|
| 109 | * the information about the driver is stored in the driver's structure.
|
---|
| 110 | *
|
---|
| 111 | * @param base_path The base directory, in which we look for driver's
|
---|
| 112 | * subdirectory.
|
---|
| 113 | * @param name The name of the driver.
|
---|
| 114 | * @param drv The driver structure to fill information in.
|
---|
| 115 | *
|
---|
| 116 | * @return True on success, false otherwise.
|
---|
| 117 | */
|
---|
| 118 | bool get_driver_info(const char *base_path, const char *name, driver_t *drv)
|
---|
| 119 | {
|
---|
| 120 | log_msg(LOG_DEFAULT, LVL_DEBUG, "get_driver_info(base_path=\"%s\", name=\"%s\")",
|
---|
| 121 | base_path, name);
|
---|
[a35b458] | 122 |
|
---|
[041b026] | 123 | assert(base_path != NULL && name != NULL && drv != NULL);
|
---|
[a35b458] | 124 |
|
---|
[041b026] | 125 | bool suc = false;
|
---|
| 126 | char *match_path = NULL;
|
---|
| 127 | size_t name_size = 0;
|
---|
[a35b458] | 128 |
|
---|
[041b026] | 129 | /* Read the list of match ids from the driver's configuration file. */
|
---|
| 130 | match_path = get_abs_path(base_path, name, MATCH_EXT);
|
---|
| 131 | if (match_path == NULL)
|
---|
| 132 | goto cleanup;
|
---|
[a35b458] | 133 |
|
---|
[041b026] | 134 | if (!read_match_ids(match_path, &drv->match_ids))
|
---|
| 135 | goto cleanup;
|
---|
[a35b458] | 136 |
|
---|
[041b026] | 137 | /* Allocate and fill driver's name. */
|
---|
| 138 | name_size = str_size(name) + 1;
|
---|
| 139 | drv->name = malloc(name_size);
|
---|
| 140 | if (drv->name == NULL)
|
---|
| 141 | goto cleanup;
|
---|
| 142 | str_cpy(drv->name, name_size, name);
|
---|
[a35b458] | 143 |
|
---|
[041b026] | 144 | suc = true;
|
---|
[a35b458] | 145 |
|
---|
[041b026] | 146 | cleanup:
|
---|
| 147 | if (!suc) {
|
---|
| 148 | free(drv->name);
|
---|
| 149 | /* Set the driver structure to the default state. */
|
---|
| 150 | init_driver(drv);
|
---|
| 151 | }
|
---|
[a35b458] | 152 |
|
---|
[041b026] | 153 | free(match_path);
|
---|
[a35b458] | 154 |
|
---|
[041b026] | 155 | return suc;
|
---|
| 156 | }
|
---|
| 157 |
|
---|
| 158 | /** Lookup drivers in the directory.
|
---|
| 159 | *
|
---|
| 160 | * @param drivers_list The list of available drivers.
|
---|
| 161 | * @param dir_path The path to the directory where we search for drivers.
|
---|
| 162 | * @return Number of drivers which were found.
|
---|
| 163 | */
|
---|
| 164 | int lookup_available_drivers(driver_list_t *drivers_list, const char *dir_path)
|
---|
| 165 | {
|
---|
| 166 | log_msg(LOG_DEFAULT, LVL_DEBUG, "lookup_available_drivers(dir=\"%s\")", dir_path);
|
---|
[a35b458] | 167 |
|
---|
[041b026] | 168 | int drv_cnt = 0;
|
---|
| 169 | DIR *dir = NULL;
|
---|
| 170 | struct dirent *diren;
|
---|
| 171 |
|
---|
| 172 | dir = opendir(dir_path);
|
---|
[a35b458] | 173 |
|
---|
[041b026] | 174 | if (dir != NULL) {
|
---|
| 175 | driver_t *drv = create_driver();
|
---|
| 176 | while ((diren = readdir(dir))) {
|
---|
| 177 | if (get_driver_info(dir_path, diren->d_name, drv)) {
|
---|
| 178 | add_driver(drivers_list, drv);
|
---|
| 179 | drv_cnt++;
|
---|
| 180 | drv = create_driver();
|
---|
| 181 | }
|
---|
| 182 | }
|
---|
| 183 | delete_driver(drv);
|
---|
| 184 | closedir(dir);
|
---|
| 185 | }
|
---|
[a35b458] | 186 |
|
---|
[041b026] | 187 | return drv_cnt;
|
---|
| 188 | }
|
---|
| 189 |
|
---|
[63a3276] | 190 | /** Get name of unit that represents the driver
|
---|
| 191 | *
|
---|
| 192 | * @param[in] drv
|
---|
| 193 | * @param[out] unit_name_ptr should be free'd after use, not touched on fail
|
---|
| 194 | *
|
---|
| 195 | * @return EOK on success
|
---|
| 196 | * @return ENOMEM
|
---|
| 197 | */
|
---|
| 198 | errno_t driver_unit_name(driver_t *drv, char **unit_name_ptr)
|
---|
| 199 | {
|
---|
| 200 | char *unit_name = NULL;
|
---|
| 201 | asprintf(&unit_name, "%s%c%s", drv->name, UNIT_NAME_SEPARATOR,
|
---|
| 202 | UNIT_SVC_TYPE_NAME);
|
---|
| 203 |
|
---|
| 204 | if (unit_name == NULL) {
|
---|
| 205 | return ENOMEM;
|
---|
| 206 | } else {
|
---|
| 207 | *unit_name_ptr = unit_name;
|
---|
| 208 | return EOK;
|
---|
| 209 | }
|
---|
| 210 | }
|
---|
| 211 |
|
---|
[b25970f] | 212 | /** Lookup the next best matching driver for a device.
|
---|
[041b026] | 213 | *
|
---|
| 214 | * A match between a device and a driver is found if one of the driver's match
|
---|
| 215 | * ids match one of the device's match ids. The score of the match is the
|
---|
| 216 | * product of the driver's and device's score associated with the matching id.
|
---|
| 217 | * The best matching driver for a device is the driver with the highest score
|
---|
| 218 | * of the match between the device and the driver.
|
---|
| 219 | *
|
---|
[b25970f] | 220 | * If a driver is already assigned to the device (node->drv != NULL),
|
---|
| 221 | * we look for the next best driver. That is either the next driver with the
|
---|
| 222 | * same score in the list of drivers, or a driver with the next best score
|
---|
| 223 | * (greater than zero).
|
---|
| 224 | *
|
---|
[041b026] | 225 | * @param drivers_list The list of drivers, where we look for the driver
|
---|
| 226 | * suitable for handling the device.
|
---|
| 227 | * @param node The device node structure of the device.
|
---|
| 228 | * @return The best matching driver or NULL if no matching driver
|
---|
| 229 | * is found.
|
---|
| 230 | */
|
---|
| 231 | driver_t *find_best_match_driver(driver_list_t *drivers_list, dev_node_t *node)
|
---|
| 232 | {
|
---|
[08bc23d] | 233 | driver_t *best_drv = NULL;
|
---|
[041b026] | 234 | int best_score = 0, score = 0;
|
---|
[b25970f] | 235 | int cur_score;
|
---|
| 236 | link_t *link;
|
---|
[a35b458] | 237 |
|
---|
[041b026] | 238 | fibril_mutex_lock(&drivers_list->drivers_mutex);
|
---|
[a35b458] | 239 |
|
---|
[b25970f] | 240 | if (node->drv != NULL) {
|
---|
| 241 | cur_score = get_match_score(node->drv, node);
|
---|
| 242 |
|
---|
[64f85f5] | 243 | link = list_next(&node->drv->drivers, &drivers_list->drivers);
|
---|
[b25970f] | 244 |
|
---|
| 245 | /*
|
---|
| 246 | * Find next driver with score equal to the current.
|
---|
| 247 | */
|
---|
| 248 | while (link != NULL) {
|
---|
[64f85f5] | 249 | driver_t *drv = list_get_instance(link, driver_t,
|
---|
| 250 | drivers);
|
---|
[b25970f] | 251 | score = get_match_score(drv, node);
|
---|
| 252 | if (score == cur_score) {
|
---|
| 253 | /* Found it */
|
---|
| 254 | fibril_mutex_unlock(&drivers_list->drivers_mutex);
|
---|
| 255 | return drv;
|
---|
| 256 | }
|
---|
| 257 |
|
---|
| 258 | link = list_next(link, &drivers_list->drivers);
|
---|
| 259 | }
|
---|
| 260 |
|
---|
| 261 | /* There is no driver with the same score */
|
---|
| 262 | } else {
|
---|
| 263 | cur_score = INT_MAX;
|
---|
| 264 | }
|
---|
| 265 |
|
---|
| 266 | /*
|
---|
| 267 | * Find driver with the next best score
|
---|
| 268 | */
|
---|
[08bc23d] | 269 | list_foreach(drivers_list->drivers, drivers, driver_t, drv) {
|
---|
[041b026] | 270 | score = get_match_score(drv, node);
|
---|
[b25970f] | 271 | if (score > best_score && score < cur_score) {
|
---|
[041b026] | 272 | best_score = score;
|
---|
| 273 | best_drv = drv;
|
---|
| 274 | }
|
---|
| 275 | }
|
---|
[a35b458] | 276 |
|
---|
[041b026] | 277 | fibril_mutex_unlock(&drivers_list->drivers_mutex);
|
---|
| 278 | return best_drv;
|
---|
| 279 | }
|
---|
| 280 |
|
---|
| 281 | /** Assign a driver to a device.
|
---|
| 282 | *
|
---|
| 283 | * @param tree Device tree
|
---|
[e55741e] | 284 | * @param dev The device's node in the device tree.
|
---|
[041b026] | 285 | * @param drv The driver.
|
---|
| 286 | */
|
---|
| 287 | void attach_driver(dev_tree_t *tree, dev_node_t *dev, driver_t *drv)
|
---|
| 288 | {
|
---|
| 289 | log_msg(LOG_DEFAULT, LVL_DEBUG, "attach_driver(dev=\"%s\",drv=\"%s\")",
|
---|
| 290 | dev->pfun->pathname, drv->name);
|
---|
[a35b458] | 291 |
|
---|
[041b026] | 292 | fibril_mutex_lock(&drv->driver_mutex);
|
---|
| 293 | fibril_rwlock_write_lock(&tree->rwlock);
|
---|
[a35b458] | 294 |
|
---|
[041b026] | 295 | dev->drv = drv;
|
---|
[b25970f] | 296 | dev->passed_to_driver = false;
|
---|
| 297 | dev->state = DEVICE_NOT_INITIALIZED;
|
---|
[041b026] | 298 | list_append(&dev->driver_devices, &drv->devices);
|
---|
[a35b458] | 299 |
|
---|
[041b026] | 300 | fibril_rwlock_write_unlock(&tree->rwlock);
|
---|
| 301 | fibril_mutex_unlock(&drv->driver_mutex);
|
---|
| 302 | }
|
---|
| 303 |
|
---|
| 304 | /** Detach driver from device.
|
---|
| 305 | *
|
---|
| 306 | * @param tree Device tree
|
---|
| 307 | * @param node The device's node in the device tree.
|
---|
| 308 | * @param drv The driver.
|
---|
| 309 | */
|
---|
| 310 | void detach_driver(dev_tree_t *tree, dev_node_t *dev)
|
---|
| 311 | {
|
---|
| 312 | driver_t *drv = dev->drv;
|
---|
[a35b458] | 313 |
|
---|
[041b026] | 314 | assert(drv != NULL);
|
---|
[a35b458] | 315 |
|
---|
[041b026] | 316 | log_msg(LOG_DEFAULT, LVL_DEBUG, "detach_driver(dev=\"%s\",drv=\"%s\")",
|
---|
| 317 | dev->pfun->pathname, drv->name);
|
---|
[a35b458] | 318 |
|
---|
[041b026] | 319 | fibril_mutex_lock(&drv->driver_mutex);
|
---|
| 320 | fibril_rwlock_write_lock(&tree->rwlock);
|
---|
[a35b458] | 321 |
|
---|
[041b026] | 322 | dev->drv = NULL;
|
---|
| 323 | list_remove(&dev->driver_devices);
|
---|
[a35b458] | 324 |
|
---|
[041b026] | 325 | fibril_rwlock_write_unlock(&tree->rwlock);
|
---|
| 326 | fibril_mutex_unlock(&drv->driver_mutex);
|
---|
| 327 | }
|
---|
| 328 |
|
---|
| 329 | /** Start a driver
|
---|
| 330 | *
|
---|
| 331 | * @param drv The driver's structure.
|
---|
| 332 | * @return True if the driver's task is successfully spawned, false
|
---|
| 333 | * otherwise.
|
---|
| 334 | */
|
---|
| 335 | bool start_driver(driver_t *drv)
|
---|
| 336 | {
|
---|
[b7fd2a0] | 337 | errno_t rc;
|
---|
[041b026] | 338 |
|
---|
| 339 | assert(fibril_mutex_is_locked(&drv->driver_mutex));
|
---|
[a35b458] | 340 |
|
---|
[041b026] | 341 | log_msg(LOG_DEFAULT, LVL_DEBUG, "start_driver(drv=\"%s\")", drv->name);
|
---|
[a35b458] | 342 |
|
---|
[e55741e] | 343 | char *unit_name = NULL;
|
---|
[63a3276] | 344 | if (driver_unit_name(drv, &unit_name) != EOK) {
|
---|
[e55741e] | 345 | return false;
|
---|
| 346 | }
|
---|
| 347 |
|
---|
| 348 | /*
|
---|
| 349 | * Non-blocking asynchronous request to start a driver
|
---|
| 350 | * FIXME See note about sysman_unit_start non-blocking (asynchronous)
|
---|
| 351 | * API
|
---|
| 352 | */
|
---|
| 353 | int flags = 0;
|
---|
| 354 | rc = sysman_unit_start(unit_name, flags);
|
---|
[63a3276] | 355 | free(unit_name);
|
---|
[e55741e] | 356 |
|
---|
[041b026] | 357 | if (rc != EOK) {
|
---|
[e55741e] | 358 | log_msg(LOG_DEFAULT, LVL_ERROR,
|
---|
| 359 | "Request to start driver `%s' failed: %s.",
|
---|
| 360 | drv->name, str_error(rc));
|
---|
[041b026] | 361 | return false;
|
---|
| 362 | }
|
---|
[a35b458] | 363 |
|
---|
[041b026] | 364 | drv->state = DRIVER_STARTING;
|
---|
| 365 | return true;
|
---|
| 366 | }
|
---|
| 367 |
|
---|
[81685dd9] | 368 | /** Stop a driver
|
---|
| 369 | *
|
---|
| 370 | * @param drv The driver's structure.
|
---|
| 371 | * @return True if the driver's task is successfully spawned, false
|
---|
| 372 | * otherwise.
|
---|
| 373 | */
|
---|
[b7fd2a0] | 374 | errno_t stop_driver(driver_t *drv)
|
---|
[81685dd9] | 375 | {
|
---|
| 376 | async_exch_t *exch;
|
---|
[b7fd2a0] | 377 | errno_t retval;
|
---|
[a35b458] | 378 |
|
---|
[81685dd9] | 379 | log_msg(LOG_DEFAULT, LVL_DEBUG, "stop_driver(drv=\"%s\")", drv->name);
|
---|
| 380 |
|
---|
| 381 | exch = async_exchange_begin(drv->sess);
|
---|
| 382 | retval = async_req_0_0(exch, DRIVER_STOP);
|
---|
| 383 | loc_exchange_end(exch);
|
---|
[a35b458] | 384 |
|
---|
[81685dd9] | 385 | if (retval != EOK)
|
---|
| 386 | return retval;
|
---|
[a35b458] | 387 |
|
---|
[81685dd9] | 388 | drv->state = DRIVER_NOT_STARTED;
|
---|
| 389 | async_hangup(drv->sess);
|
---|
| 390 | drv->sess = NULL;
|
---|
| 391 | return EOK;
|
---|
| 392 | }
|
---|
| 393 |
|
---|
[0511549] | 394 | /** Find device driver by handle.
|
---|
| 395 | *
|
---|
| 396 | * @param drv_list The list of device drivers
|
---|
| 397 | * @param handle Driver handle
|
---|
| 398 | * @return The device driver, if it is in the list,
|
---|
| 399 | * NULL otherwise.
|
---|
| 400 | */
|
---|
| 401 | driver_t *driver_find(driver_list_t *drv_list, devman_handle_t handle)
|
---|
| 402 | {
|
---|
| 403 | driver_t *res = NULL;
|
---|
[a35b458] | 404 |
|
---|
[0511549] | 405 | fibril_mutex_lock(&drv_list->drivers_mutex);
|
---|
[a35b458] | 406 |
|
---|
[0511549] | 407 | list_foreach(drv_list->drivers, drivers, driver_t, drv) {
|
---|
| 408 | if (drv->handle == handle) {
|
---|
| 409 | res = drv;
|
---|
| 410 | break;
|
---|
| 411 | }
|
---|
| 412 | }
|
---|
[a35b458] | 413 |
|
---|
[0511549] | 414 | fibril_mutex_unlock(&drv_list->drivers_mutex);
|
---|
[a35b458] | 415 |
|
---|
[0511549] | 416 | return res;
|
---|
| 417 | }
|
---|
| 418 |
|
---|
| 419 | /** Find device driver by name.
|
---|
[041b026] | 420 | *
|
---|
| 421 | * @param drv_list The list of device drivers.
|
---|
| 422 | * @param drv_name The name of the device driver which is searched.
|
---|
| 423 | * @return The device driver of the specified name, if it is in the
|
---|
| 424 | * list, NULL otherwise.
|
---|
| 425 | */
|
---|
[0511549] | 426 | driver_t *driver_find_by_name(driver_list_t *drv_list, const char *drv_name)
|
---|
[041b026] | 427 | {
|
---|
| 428 | driver_t *res = NULL;
|
---|
[a35b458] | 429 |
|
---|
[041b026] | 430 | fibril_mutex_lock(&drv_list->drivers_mutex);
|
---|
[a35b458] | 431 |
|
---|
[08bc23d] | 432 | list_foreach(drv_list->drivers, drivers, driver_t, drv) {
|
---|
[041b026] | 433 | if (str_cmp(drv->name, drv_name) == 0) {
|
---|
| 434 | res = drv;
|
---|
| 435 | break;
|
---|
| 436 | }
|
---|
| 437 | }
|
---|
[a35b458] | 438 |
|
---|
[041b026] | 439 | fibril_mutex_unlock(&drv_list->drivers_mutex);
|
---|
[a35b458] | 440 |
|
---|
[041b026] | 441 | return res;
|
---|
| 442 | }
|
---|
| 443 |
|
---|
| 444 | /** Notify driver about the devices to which it was assigned.
|
---|
| 445 | *
|
---|
| 446 | * @param driver The driver to which the devices are passed.
|
---|
| 447 | */
|
---|
| 448 | static void pass_devices_to_driver(driver_t *driver, dev_tree_t *tree)
|
---|
| 449 | {
|
---|
| 450 | dev_node_t *dev;
|
---|
| 451 | link_t *link;
|
---|
| 452 |
|
---|
| 453 | log_msg(LOG_DEFAULT, LVL_DEBUG, "pass_devices_to_driver(driver=\"%s\")",
|
---|
| 454 | driver->name);
|
---|
| 455 |
|
---|
| 456 | fibril_mutex_lock(&driver->driver_mutex);
|
---|
| 457 |
|
---|
| 458 | /*
|
---|
| 459 | * Go through devices list as long as there is some device
|
---|
| 460 | * that has not been passed to the driver.
|
---|
| 461 | */
|
---|
| 462 | link = driver->devices.head.next;
|
---|
| 463 | while (link != &driver->devices.head) {
|
---|
| 464 | dev = list_get_instance(link, dev_node_t, driver_devices);
|
---|
| 465 | fibril_rwlock_write_lock(&tree->rwlock);
|
---|
[a35b458] | 466 |
|
---|
[041b026] | 467 | if (dev->passed_to_driver) {
|
---|
| 468 | fibril_rwlock_write_unlock(&tree->rwlock);
|
---|
| 469 | link = link->next;
|
---|
| 470 | continue;
|
---|
| 471 | }
|
---|
| 472 |
|
---|
| 473 | dev_add_ref(dev);
|
---|
| 474 |
|
---|
| 475 | /*
|
---|
| 476 | * Unlock to avoid deadlock when adding device
|
---|
| 477 | * handled by itself.
|
---|
| 478 | */
|
---|
| 479 | fibril_mutex_unlock(&driver->driver_mutex);
|
---|
| 480 | fibril_rwlock_write_unlock(&tree->rwlock);
|
---|
| 481 |
|
---|
| 482 | add_device(driver, dev, tree);
|
---|
| 483 |
|
---|
[b25970f] | 484 | /* Device probe failed, need to try next best driver */
|
---|
| 485 | if (dev->state == DEVICE_NOT_PRESENT) {
|
---|
| 486 | fibril_mutex_lock(&driver->driver_mutex);
|
---|
| 487 | list_remove(&dev->driver_devices);
|
---|
| 488 | fibril_mutex_unlock(&driver->driver_mutex);
|
---|
[5aa06ad] | 489 | /* Give an extra reference to driver_reassign_fibril */
|
---|
| 490 | dev_add_ref(dev);
|
---|
[b25970f] | 491 | fid_t fid = fibril_create(driver_reassign_fibril, dev);
|
---|
| 492 | if (fid == 0) {
|
---|
| 493 | log_msg(LOG_DEFAULT, LVL_ERROR,
|
---|
| 494 | "Error creating fibril to assign driver.");
|
---|
[5aa06ad] | 495 | dev_del_ref(dev);
|
---|
[b25970f] | 496 | }
|
---|
| 497 | fibril_add_ready(fid);
|
---|
| 498 | }
|
---|
| 499 |
|
---|
[041b026] | 500 | dev_del_ref(dev);
|
---|
| 501 |
|
---|
| 502 | /*
|
---|
| 503 | * Lock again as we will work with driver's
|
---|
| 504 | * structure.
|
---|
| 505 | */
|
---|
| 506 | fibril_mutex_lock(&driver->driver_mutex);
|
---|
| 507 |
|
---|
| 508 | /*
|
---|
| 509 | * Restart the cycle to go through all devices again.
|
---|
| 510 | */
|
---|
| 511 | link = driver->devices.head.next;
|
---|
| 512 | }
|
---|
| 513 |
|
---|
| 514 | /*
|
---|
| 515 | * Once we passed all devices to the driver, we need to mark the
|
---|
| 516 | * driver as running.
|
---|
| 517 | * It is vital to do it here and inside critical section.
|
---|
| 518 | *
|
---|
| 519 | * If we would change the state earlier, other devices added to
|
---|
| 520 | * the driver would be added to the device list and started
|
---|
| 521 | * immediately and possibly started here as well.
|
---|
| 522 | */
|
---|
| 523 | log_msg(LOG_DEFAULT, LVL_DEBUG, "Driver `%s' enters running state.", driver->name);
|
---|
| 524 | driver->state = DRIVER_RUNNING;
|
---|
| 525 |
|
---|
| 526 | fibril_mutex_unlock(&driver->driver_mutex);
|
---|
| 527 | }
|
---|
| 528 |
|
---|
| 529 | /** Finish the initialization of a driver after it has succesfully started
|
---|
| 530 | * and after it has registered itself by the device manager.
|
---|
| 531 | *
|
---|
| 532 | * Pass devices formerly matched to the driver to the driver and remember the
|
---|
| 533 | * driver is running and fully functional now.
|
---|
| 534 | *
|
---|
| 535 | * @param driver The driver which registered itself as running by the
|
---|
| 536 | * device manager.
|
---|
| 537 | */
|
---|
| 538 | void initialize_running_driver(driver_t *driver, dev_tree_t *tree)
|
---|
| 539 | {
|
---|
| 540 | log_msg(LOG_DEFAULT, LVL_DEBUG, "initialize_running_driver(driver=\"%s\")",
|
---|
| 541 | driver->name);
|
---|
[a35b458] | 542 |
|
---|
[041b026] | 543 | /*
|
---|
| 544 | * Pass devices which have been already assigned to the driver to the
|
---|
| 545 | * driver.
|
---|
| 546 | */
|
---|
| 547 | pass_devices_to_driver(driver, tree);
|
---|
| 548 | }
|
---|
| 549 |
|
---|
| 550 | /** Initialize device driver structure.
|
---|
| 551 | *
|
---|
| 552 | * @param drv The device driver structure.
|
---|
| 553 | */
|
---|
| 554 | void init_driver(driver_t *drv)
|
---|
| 555 | {
|
---|
| 556 | assert(drv != NULL);
|
---|
| 557 |
|
---|
| 558 | memset(drv, 0, sizeof(driver_t));
|
---|
| 559 | list_initialize(&drv->match_ids.ids);
|
---|
| 560 | list_initialize(&drv->devices);
|
---|
| 561 | fibril_mutex_initialize(&drv->driver_mutex);
|
---|
| 562 | drv->sess = NULL;
|
---|
| 563 | }
|
---|
| 564 |
|
---|
| 565 | /** Device driver structure clean-up.
|
---|
| 566 | *
|
---|
| 567 | * @param drv The device driver structure.
|
---|
| 568 | */
|
---|
| 569 | void clean_driver(driver_t *drv)
|
---|
| 570 | {
|
---|
| 571 | assert(drv != NULL);
|
---|
| 572 |
|
---|
| 573 | free(drv->name);
|
---|
| 574 |
|
---|
| 575 | clean_match_ids(&drv->match_ids);
|
---|
| 576 |
|
---|
| 577 | init_driver(drv);
|
---|
| 578 | }
|
---|
| 579 |
|
---|
| 580 | /** Delete device driver structure.
|
---|
| 581 | *
|
---|
| 582 | * @param drv The device driver structure.
|
---|
| 583 | */
|
---|
| 584 | void delete_driver(driver_t *drv)
|
---|
| 585 | {
|
---|
| 586 | assert(drv != NULL);
|
---|
[a35b458] | 587 |
|
---|
[041b026] | 588 | clean_driver(drv);
|
---|
| 589 | free(drv);
|
---|
| 590 | }
|
---|
| 591 |
|
---|
| 592 | /** Find suitable driver for a device and assign the driver to it.
|
---|
| 593 | *
|
---|
[e55741e] | 594 | * @param dev The device node of the device in the device tree.
|
---|
[041b026] | 595 | * @param drivers_list The list of available drivers.
|
---|
| 596 | * @return True if the suitable driver is found and
|
---|
| 597 | * successfully assigned to the device, false otherwise.
|
---|
| 598 | */
|
---|
| 599 | bool assign_driver(dev_node_t *dev, driver_list_t *drivers_list,
|
---|
| 600 | dev_tree_t *tree)
|
---|
| 601 | {
|
---|
[b25970f] | 602 | driver_t *drv;
|
---|
| 603 |
|
---|
[041b026] | 604 | assert(dev != NULL);
|
---|
| 605 | assert(drivers_list != NULL);
|
---|
| 606 | assert(tree != NULL);
|
---|
[a35b458] | 607 |
|
---|
[041b026] | 608 | /*
|
---|
[b25970f] | 609 | * Find the next best driver for this device.
|
---|
[041b026] | 610 | */
|
---|
[b25970f] | 611 | again:
|
---|
| 612 | drv = find_best_match_driver(drivers_list, dev);
|
---|
[041b026] | 613 | if (drv == NULL) {
|
---|
| 614 | log_msg(LOG_DEFAULT, LVL_ERROR, "No driver found for device `%s'.",
|
---|
| 615 | dev->pfun->pathname);
|
---|
| 616 | return false;
|
---|
| 617 | }
|
---|
[a35b458] | 618 |
|
---|
[041b026] | 619 | /* Attach the driver to the device. */
|
---|
| 620 | attach_driver(tree, dev, drv);
|
---|
[a35b458] | 621 |
|
---|
[041b026] | 622 | fibril_mutex_lock(&drv->driver_mutex);
|
---|
| 623 | if (drv->state == DRIVER_NOT_STARTED) {
|
---|
| 624 | /* Start the driver. */
|
---|
| 625 | start_driver(drv);
|
---|
| 626 | }
|
---|
| 627 | bool is_running = drv->state == DRIVER_RUNNING;
|
---|
| 628 | fibril_mutex_unlock(&drv->driver_mutex);
|
---|
| 629 |
|
---|
| 630 | /* Notify the driver about the new device. */
|
---|
[b25970f] | 631 | if (is_running) {
|
---|
[041b026] | 632 | add_device(drv, dev, tree);
|
---|
[a35b458] | 633 |
|
---|
[b25970f] | 634 | /* If the device probe failed, need to try next available driver */
|
---|
| 635 | if (dev->state == DEVICE_NOT_PRESENT)
|
---|
| 636 | goto again;
|
---|
| 637 | }
|
---|
| 638 |
|
---|
[041b026] | 639 | fibril_mutex_lock(&drv->driver_mutex);
|
---|
| 640 | fibril_mutex_unlock(&drv->driver_mutex);
|
---|
| 641 |
|
---|
| 642 | fibril_rwlock_write_lock(&tree->rwlock);
|
---|
| 643 | if (dev->pfun != NULL) {
|
---|
| 644 | dev->pfun->state = FUN_ON_LINE;
|
---|
| 645 | }
|
---|
| 646 | fibril_rwlock_write_unlock(&tree->rwlock);
|
---|
| 647 | return true;
|
---|
| 648 | }
|
---|
| 649 |
|
---|
[a60e90b] | 650 | /** Pass a device to running driver.
|
---|
| 651 | *
|
---|
| 652 | * @param drv The driver's structure.
|
---|
[e55741e] | 653 | * @param dev The device's node in the device tree.
|
---|
[a60e90b] | 654 | */
|
---|
| 655 | void add_device(driver_t *drv, dev_node_t *dev, dev_tree_t *tree)
|
---|
| 656 | {
|
---|
| 657 | /*
|
---|
| 658 | * We do not expect to have driver's mutex locked as we do not
|
---|
| 659 | * access any structures that would affect driver_t.
|
---|
| 660 | */
|
---|
| 661 | log_msg(LOG_DEFAULT, LVL_DEBUG, "add_device(drv=\"%s\", dev=\"%s\")",
|
---|
| 662 | drv->name, dev->pfun->name);
|
---|
[a35b458] | 663 |
|
---|
[a60e90b] | 664 | /* Send the device to the driver. */
|
---|
| 665 | devman_handle_t parent_handle;
|
---|
| 666 | if (dev->pfun) {
|
---|
| 667 | parent_handle = dev->pfun->handle;
|
---|
| 668 | } else {
|
---|
| 669 | parent_handle = 0;
|
---|
| 670 | }
|
---|
[a35b458] | 671 |
|
---|
[a60e90b] | 672 | async_exch_t *exch = async_exchange_begin(drv->sess);
|
---|
[a35b458] | 673 |
|
---|
[a60e90b] | 674 | ipc_call_t answer;
|
---|
| 675 | aid_t req = async_send_2(exch, DRIVER_DEV_ADD, dev->handle,
|
---|
| 676 | parent_handle, &answer);
|
---|
[a35b458] | 677 |
|
---|
[a60e90b] | 678 | /* Send the device name to the driver. */
|
---|
[b7fd2a0] | 679 | errno_t rc = async_data_write_start(exch, dev->pfun->name,
|
---|
[a60e90b] | 680 | str_size(dev->pfun->name) + 1);
|
---|
[a35b458] | 681 |
|
---|
[a60e90b] | 682 | async_exchange_end(exch);
|
---|
[a35b458] | 683 |
|
---|
[a60e90b] | 684 | if (rc != EOK) {
|
---|
[f9b2cb4c] | 685 | async_forget(req);
|
---|
| 686 | } else {
|
---|
| 687 | /* Wait for answer from the driver. */
|
---|
| 688 | async_wait_for(req, &rc);
|
---|
[a60e90b] | 689 | }
|
---|
| 690 |
|
---|
[f9b2cb4c] | 691 | switch (rc) {
|
---|
[a60e90b] | 692 | case EOK:
|
---|
| 693 | dev->state = DEVICE_USABLE;
|
---|
| 694 | break;
|
---|
| 695 | case ENOENT:
|
---|
| 696 | dev->state = DEVICE_NOT_PRESENT;
|
---|
| 697 | break;
|
---|
| 698 | default:
|
---|
| 699 | dev->state = DEVICE_INVALID;
|
---|
| 700 | break;
|
---|
| 701 | }
|
---|
[a35b458] | 702 |
|
---|
[a60e90b] | 703 | dev->passed_to_driver = true;
|
---|
| 704 | }
|
---|
| 705 |
|
---|
[b7fd2a0] | 706 | errno_t driver_dev_remove(dev_tree_t *tree, dev_node_t *dev)
|
---|
[041b026] | 707 | {
|
---|
| 708 | async_exch_t *exch;
|
---|
[b7fd2a0] | 709 | errno_t retval;
|
---|
[041b026] | 710 | driver_t *drv;
|
---|
| 711 | devman_handle_t handle;
|
---|
[a35b458] | 712 |
|
---|
[041b026] | 713 | assert(dev != NULL);
|
---|
[a35b458] | 714 |
|
---|
[041b026] | 715 | log_msg(LOG_DEFAULT, LVL_DEBUG, "driver_dev_remove(%p)", dev);
|
---|
[a35b458] | 716 |
|
---|
[041b026] | 717 | fibril_rwlock_read_lock(&tree->rwlock);
|
---|
| 718 | drv = dev->drv;
|
---|
| 719 | handle = dev->handle;
|
---|
| 720 | fibril_rwlock_read_unlock(&tree->rwlock);
|
---|
[a35b458] | 721 |
|
---|
[041b026] | 722 | exch = async_exchange_begin(drv->sess);
|
---|
| 723 | retval = async_req_1_0(exch, DRIVER_DEV_REMOVE, handle);
|
---|
| 724 | async_exchange_end(exch);
|
---|
[a35b458] | 725 |
|
---|
[041b026] | 726 | return retval;
|
---|
| 727 | }
|
---|
| 728 |
|
---|
[b7fd2a0] | 729 | errno_t driver_dev_gone(dev_tree_t *tree, dev_node_t *dev)
|
---|
[041b026] | 730 | {
|
---|
| 731 | async_exch_t *exch;
|
---|
[b7fd2a0] | 732 | errno_t retval;
|
---|
[041b026] | 733 | driver_t *drv;
|
---|
| 734 | devman_handle_t handle;
|
---|
[a35b458] | 735 |
|
---|
[041b026] | 736 | assert(dev != NULL);
|
---|
[a35b458] | 737 |
|
---|
[041b026] | 738 | log_msg(LOG_DEFAULT, LVL_DEBUG, "driver_dev_gone(%p)", dev);
|
---|
[a35b458] | 739 |
|
---|
[041b026] | 740 | fibril_rwlock_read_lock(&tree->rwlock);
|
---|
| 741 | drv = dev->drv;
|
---|
| 742 | handle = dev->handle;
|
---|
| 743 | fibril_rwlock_read_unlock(&tree->rwlock);
|
---|
[a35b458] | 744 |
|
---|
[041b026] | 745 | exch = async_exchange_begin(drv->sess);
|
---|
| 746 | retval = async_req_1_0(exch, DRIVER_DEV_GONE, handle);
|
---|
| 747 | async_exchange_end(exch);
|
---|
[a35b458] | 748 |
|
---|
[041b026] | 749 | return retval;
|
---|
| 750 | }
|
---|
| 751 |
|
---|
[b7fd2a0] | 752 | errno_t driver_fun_online(dev_tree_t *tree, fun_node_t *fun)
|
---|
[041b026] | 753 | {
|
---|
| 754 | async_exch_t *exch;
|
---|
[b7fd2a0] | 755 | errno_t retval;
|
---|
[041b026] | 756 | driver_t *drv;
|
---|
| 757 | devman_handle_t handle;
|
---|
[a35b458] | 758 |
|
---|
[041b026] | 759 | log_msg(LOG_DEFAULT, LVL_DEBUG, "driver_fun_online(%p)", fun);
|
---|
| 760 |
|
---|
| 761 | fibril_rwlock_read_lock(&tree->rwlock);
|
---|
[a35b458] | 762 |
|
---|
[041b026] | 763 | if (fun->dev == NULL) {
|
---|
| 764 | /* XXX root function? */
|
---|
| 765 | fibril_rwlock_read_unlock(&tree->rwlock);
|
---|
| 766 | return EINVAL;
|
---|
| 767 | }
|
---|
[a35b458] | 768 |
|
---|
[041b026] | 769 | drv = fun->dev->drv;
|
---|
| 770 | handle = fun->handle;
|
---|
| 771 | fibril_rwlock_read_unlock(&tree->rwlock);
|
---|
[a35b458] | 772 |
|
---|
[041b026] | 773 | exch = async_exchange_begin(drv->sess);
|
---|
| 774 | retval = async_req_1_0(exch, DRIVER_FUN_ONLINE, handle);
|
---|
| 775 | loc_exchange_end(exch);
|
---|
[a35b458] | 776 |
|
---|
[041b026] | 777 | return retval;
|
---|
| 778 | }
|
---|
| 779 |
|
---|
[b7fd2a0] | 780 | errno_t driver_fun_offline(dev_tree_t *tree, fun_node_t *fun)
|
---|
[041b026] | 781 | {
|
---|
| 782 | async_exch_t *exch;
|
---|
[b7fd2a0] | 783 | errno_t retval;
|
---|
[041b026] | 784 | driver_t *drv;
|
---|
| 785 | devman_handle_t handle;
|
---|
[a35b458] | 786 |
|
---|
[041b026] | 787 | log_msg(LOG_DEFAULT, LVL_DEBUG, "driver_fun_offline(%p)", fun);
|
---|
| 788 |
|
---|
| 789 | fibril_rwlock_read_lock(&tree->rwlock);
|
---|
| 790 | if (fun->dev == NULL) {
|
---|
| 791 | /* XXX root function? */
|
---|
| 792 | fibril_rwlock_read_unlock(&tree->rwlock);
|
---|
| 793 | return EINVAL;
|
---|
| 794 | }
|
---|
[a35b458] | 795 |
|
---|
[041b026] | 796 | drv = fun->dev->drv;
|
---|
| 797 | handle = fun->handle;
|
---|
| 798 | fibril_rwlock_read_unlock(&tree->rwlock);
|
---|
[a35b458] | 799 |
|
---|
[041b026] | 800 | exch = async_exchange_begin(drv->sess);
|
---|
| 801 | retval = async_req_1_0(exch, DRIVER_FUN_OFFLINE, handle);
|
---|
| 802 | loc_exchange_end(exch);
|
---|
[a35b458] | 803 |
|
---|
[041b026] | 804 | return retval;
|
---|
| 805 |
|
---|
| 806 | }
|
---|
| 807 |
|
---|
[0511549] | 808 | /** Get list of registered drivers. */
|
---|
[b7fd2a0] | 809 | errno_t driver_get_list(driver_list_t *driver_list, devman_handle_t *hdl_buf,
|
---|
[0511549] | 810 | size_t buf_size, size_t *act_size)
|
---|
| 811 | {
|
---|
| 812 | size_t act_cnt;
|
---|
| 813 | size_t buf_cnt;
|
---|
| 814 |
|
---|
| 815 | fibril_mutex_lock(&driver_list->drivers_mutex);
|
---|
| 816 |
|
---|
| 817 | buf_cnt = buf_size / sizeof(devman_handle_t);
|
---|
| 818 |
|
---|
| 819 | act_cnt = list_count(&driver_list->drivers);
|
---|
| 820 | *act_size = act_cnt * sizeof(devman_handle_t);
|
---|
| 821 |
|
---|
| 822 | if (buf_size % sizeof(devman_handle_t) != 0) {
|
---|
| 823 | fibril_mutex_unlock(&driver_list->drivers_mutex);
|
---|
| 824 | return EINVAL;
|
---|
| 825 | }
|
---|
| 826 |
|
---|
| 827 | size_t pos = 0;
|
---|
| 828 | list_foreach(driver_list->drivers, drivers, driver_t, drv) {
|
---|
| 829 | if (pos < buf_cnt) {
|
---|
| 830 | hdl_buf[pos] = drv->handle;
|
---|
| 831 | }
|
---|
| 832 |
|
---|
| 833 | pos++;
|
---|
| 834 | }
|
---|
| 835 |
|
---|
| 836 | fibril_mutex_unlock(&driver_list->drivers_mutex);
|
---|
| 837 | return EOK;
|
---|
| 838 | }
|
---|
| 839 |
|
---|
[1db5669] | 840 | /** Get list of device functions. */
|
---|
[b7fd2a0] | 841 | errno_t driver_get_devices(driver_t *driver, devman_handle_t *hdl_buf,
|
---|
[1db5669] | 842 | size_t buf_size, size_t *act_size)
|
---|
| 843 | {
|
---|
| 844 | size_t act_cnt;
|
---|
| 845 | size_t buf_cnt;
|
---|
| 846 |
|
---|
| 847 | fibril_mutex_lock(&driver->driver_mutex);
|
---|
| 848 |
|
---|
| 849 | buf_cnt = buf_size / sizeof(devman_handle_t);
|
---|
| 850 |
|
---|
| 851 | act_cnt = list_count(&driver->devices);
|
---|
| 852 | *act_size = act_cnt * sizeof(devman_handle_t);
|
---|
| 853 |
|
---|
| 854 | if (buf_size % sizeof(devman_handle_t) != 0) {
|
---|
| 855 | fibril_mutex_unlock(&driver->driver_mutex);
|
---|
| 856 | return EINVAL;
|
---|
| 857 | }
|
---|
| 858 |
|
---|
| 859 | size_t pos = 0;
|
---|
| 860 | list_foreach(driver->devices, driver_devices, dev_node_t, dev) {
|
---|
| 861 | if (pos < buf_cnt) {
|
---|
| 862 | hdl_buf[pos] = dev->handle;
|
---|
| 863 | }
|
---|
| 864 |
|
---|
| 865 | pos++;
|
---|
| 866 | }
|
---|
| 867 |
|
---|
| 868 | fibril_mutex_unlock(&driver->driver_mutex);
|
---|
| 869 | return EOK;
|
---|
| 870 | }
|
---|
| 871 |
|
---|
[b25970f] | 872 | /** Try to find next available driver in a separate fibril.
|
---|
| 873 | *
|
---|
| 874 | * @param arg Device node (dev_node_t)
|
---|
| 875 | */
|
---|
| 876 | static errno_t driver_reassign_fibril(void *arg)
|
---|
| 877 | {
|
---|
| 878 | dev_node_t *dev_node = (dev_node_t *) arg;
|
---|
| 879 | assign_driver(dev_node, &drivers_list, &device_tree);
|
---|
| 880 |
|
---|
| 881 | /* Delete one reference we got from the caller. */
|
---|
| 882 | dev_del_ref(dev_node);
|
---|
| 883 | return EOK;
|
---|
| 884 | }
|
---|
| 885 |
|
---|
[041b026] | 886 | /** @}
|
---|
| 887 | */
|
---|