Changeset 8300c72 in mainline for uspace/srv/devman/client_conn.c


Ignore:
Timestamp:
2025-03-03T22:58:05Z (13 hours ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
77a0119
Parents:
f35749e
Message:

Quiesce devices before proceeding with shutdown.

Only implemented for e1k, uhci and xhci.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/devman/client_conn.c

    rf35749e r8300c72  
    11/*
     2 * Copyright (c) 2025 Jiri Svoboda
    23 * Copyright (c) 2010 Lenka Trochtova
    3  * Copyright (c) 2013 Jiri Svoboda
    44 * All rights reserved.
    55 *
     
    479479}
    480480
     481/** Quiesce function.
     482 *
     483 * Send a request to quiesce a function to the responsible driver.
     484 */
     485static void devman_fun_quiesce(ipc_call_t *icall)
     486{
     487        fun_node_t *fun;
     488        dev_node_t *child;
     489        errno_t rc;
     490
     491        fun = find_fun_node(&device_tree, ipc_get_arg1(icall));
     492        if (fun == NULL) {
     493                async_answer_0(icall, ENOENT);
     494                return;
     495        }
     496
     497        fibril_rwlock_read_lock(&device_tree.rwlock);
     498
     499        /* Check function state */
     500        if (fun->state == FUN_REMOVED) {
     501                fibril_rwlock_read_unlock(&device_tree.rwlock);
     502                async_answer_0(icall, ENOENT);
     503                return;
     504        }
     505
     506        child = fun->child;
     507        dev_add_ref(child);
     508        fibril_rwlock_read_unlock(&device_tree.rwlock);
     509
     510        rc = driver_dev_quiesce(&device_tree, child);
     511        fun_del_ref(fun);
     512
     513        async_answer_0(icall, rc);
     514}
     515
    481516/** Find handle for the function instance identified by its service ID. */
    482517static void devman_fun_sid_to_handle(ipc_call_t *icall)
     
    790825                        devman_fun_offline(&call);
    791826                        break;
     827                case DEVMAN_FUN_QUIESCE:
     828                        devman_fun_quiesce(&call);
     829                        break;
    792830                case DEVMAN_FUN_SID_TO_HANDLE:
    793831                        devman_fun_sid_to_handle(&call);
Note: See TracChangeset for help on using the changeset viewer.