Changeset 77a69ea in mainline for uspace/lib


Ignore:
Timestamp:
2012-01-21T15:06:51Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ce7676c
Parents:
e86b8f0
Message:

Allow multiple tasks to register for loc category change events.
Open NIC devices via location service, discover using category change events.
Eliminate device_added driver entry point.
loc_service_get_name() should return fully qualified service name.

Location:
uspace/lib
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/ipc/devman.h

    re86b8f0 r77a69ea  
    146146typedef enum {
    147147        DRIVER_DEV_ADD = IPC_FIRST_USER_METHOD,
    148         DRIVER_DEV_ADDED,
    149148        DRIVER_DEV_REMOVE,
    150149        DRIVER_DEV_GONE,
  • uspace/lib/c/include/ipc/net.h

    re86b8f0 r77a69ea  
    305305 *
    306306 */
    307 #define IPC_GET_DEVICE_HANDLE(call)  ((devman_handle_t) IPC_GET_ARG2(call))
     307#define IPC_GET_DEVICE_HANDLE(call)  ((service_id_t) IPC_GET_ARG2(call))
    308308
    309309/** Return the device driver service message argument.
  • uspace/lib/c/include/ipc/net_net.h

    re86b8f0 r77a69ea  
    5454        NET_NET_GET_DEVICES_COUNT,
    5555        /** Return names and device IDs of all devices */
    56         NET_NET_GET_DEVICES,
    57         /** Notify the networking service about a ready device */
    58         NET_NET_DRIVER_READY
     56        NET_NET_GET_DEVICES
    5957} net_messages;
    6058
  • uspace/lib/drv/generic/driver.c

    re86b8f0 r77a69ea  
    303303}
    304304
    305 static void driver_dev_added(ipc_callid_t iid, ipc_call_t *icall)
    306 {
    307         fibril_mutex_lock(&devices_mutex);
    308         ddf_dev_t *dev = driver_get_device(IPC_GET_ARG1(*icall));
    309         fibril_mutex_unlock(&devices_mutex);
    310        
    311         if (dev != NULL && driver->driver_ops->device_added != NULL)
    312                 driver->driver_ops->device_added(dev);
    313 }
    314 
    315305static void driver_dev_remove(ipc_callid_t iid, ipc_call_t *icall)
    316306{
     
    460450                case DRIVER_DEV_ADD:
    461451                        driver_dev_add(callid, &call);
    462                         break;
    463                 case DRIVER_DEV_ADDED:
    464                         async_answer_0(callid, EOK);
    465                         driver_dev_added(callid, &call);
    466452                        break;
    467453                case DRIVER_DEV_REMOVE:
  • uspace/lib/drv/include/ddf/driver.h

    re86b8f0 r77a69ea  
    145145        /** Ask driver to offline a specific function */
    146146        int (*fun_offline)(ddf_fun_t *);
    147 
    148         /**
    149          * Notification that the device was succesfully added.
    150          * The driver can do any blocking operation without
    151          * blocking the device manager.
    152          *
    153          * XXX REMOVE THIS
    154          */
    155         void (*device_added)(ddf_dev_t *dev);
    156147} driver_ops_t;
    157148
  • uspace/lib/net/generic/net_remote.c

    re86b8f0 r77a69ea  
    167167}
    168168
    169 int net_driver_ready(async_sess_t *sess, devman_handle_t handle)
    170 {
    171         async_exch_t *exch = async_exchange_begin(sess);
    172         int rc = async_req_1_0(exch, NET_NET_DRIVER_READY, handle);
    173         async_exchange_end(exch);
    174        
    175         return rc;
    176 }
    177 
    178169/** @}
    179170 */
  • uspace/lib/net/include/net_interface.h

    re86b8f0 r77a69ea  
    5252extern int net_get_devices_req(async_sess_t *, measured_string_t **, size_t *,
    5353    uint8_t **);
    54 extern int net_driver_ready(async_sess_t *, devman_handle_t);
    5554extern async_sess_t *net_connect_module(void);
    5655
  • uspace/lib/net/include/nil_remote.h

    re86b8f0 r77a69ea  
    3434#define __NET_NIL_REMOTE_H__
    3535
     36#include <ipc/loc.h>
    3637#include <net/device.h>
    3738#include <net/packet.h>
  • uspace/lib/net/nil/nil_remote.c

    re86b8f0 r77a69ea  
    3636 */
    3737
     38#include <ipc/loc.h>
    3839#include <nil_remote.h>
    3940#include <generic.h>
     
    123124
    124125int nil_device_req(async_sess_t *sess, nic_device_id_t device_id,
    125     devman_handle_t handle, size_t mtu)
     126    service_id_t sid, size_t mtu)
    126127{
    127128        async_exch_t *exch = async_exchange_begin(sess);
    128129        int rc = async_req_3_0(exch, NET_NIL_DEVICE, (sysarg_t) device_id,
    129             (sysarg_t) handle, (sysarg_t) mtu);
     130            (sysarg_t) sid, (sysarg_t) mtu);
    130131        async_exchange_end(exch);
    131132        return rc;
  • uspace/lib/nic/include/nic.h

    re86b8f0 r77a69ea  
    219219extern void nic_set_poll_handlers(nic_t *,
    220220        poll_mode_change_handler, poll_request_handler);
    221 
    222 /* Functions called in device_added */
    223 extern int nic_ready(nic_t *);
    224221
    225222/* General driver functions */
  • uspace/lib/nic/src/nic_driver.c

    re86b8f0 r77a69ea  
    8989    nic_iface_t *iface)
    9090{
    91         if (driver_ops) {
    92                 if (!driver_ops->device_added)
    93                         driver_ops->device_added = nic_device_added_impl;
    94         }
    95 
    9691        if (dev_ops) {
    9792                if (!dev_ops->open)
     
    464459}
    465460
    466 /** Notify the NET service that the device is ready
    467  *
    468  * @param nic NICF structure
    469  *
    470  * @return EOK on success
    471  *
    472  */
    473 int nic_ready(nic_t *nic)
    474 {
    475         fibril_rwlock_read_lock(&nic->main_lock);
    476        
    477         async_sess_t *session = nic->net_session;
    478         devman_handle_t handle = nic->dev->handle;
    479        
    480         fibril_rwlock_read_unlock(&nic->main_lock);
    481        
    482         if (session == NULL)
    483                 return EINVAL;
    484        
    485         return net_driver_ready(session, handle);
    486 }
    487 
    488461/** Inform the NICF about poll mode
    489462 *
  • uspace/lib/nic/src/nic_impl.c

    re86b8f0 r77a69ea  
    805805}
    806806
    807 /** Default implementation of the device_added method
    808  *
    809  * Just calls nic_ready.
    810  *
    811  * @param dev
    812  *
    813  */
    814 void nic_device_added_impl(ddf_dev_t *dev)
    815 {
    816         nic_ready((nic_t *) dev->driver_data);
    817 }
    818 
    819807/**
    820808 * Default handler for unknown methods (outside of the NIC interface).
Note: See TracChangeset for help on using the changeset viewer.