Changeset eaa0c3f in mainline for uspace/lib


Ignore:
Timestamp:
2012-01-21T23:55:03Z (14 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c38e417
Parents:
86c71de (diff), e98fe28c (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.
Message:

Merge with mainline

Location:
uspace/lib
Files:
13 edited

Legend:

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

    r86c71de reaa0c3f  
    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

    r86c71de reaa0c3f  
    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

    r86c71de reaa0c3f  
    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

    r86c71de reaa0c3f  
    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

    r86c71de reaa0c3f  
    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

    r86c71de reaa0c3f  
    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

    r86c71de reaa0c3f  
    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

    r86c71de reaa0c3f  
    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

    r86c71de reaa0c3f  
    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

    r86c71de reaa0c3f  
    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/include/nic_driver.h

    r86c71de reaa0c3f  
    8080        /** Device's default MAC address (assigned the first time, used in STOP) */
    8181        nic_address_t default_mac;
    82         /** Session to SERVICE_NETWORKING */
    83         async_sess_t *net_session;
    8482        /** Session to SERVICE_ETHERNET or SERVICE_NILDUMMY */
    8583        async_sess_t *nil_session;
  • uspace/lib/nic/src/nic_driver.c

    r86c71de reaa0c3f  
    4949#include <devman.h>
    5050#include <ddf/interrupt.h>
    51 #include <net_interface.h>
    5251#include <ops/nic.h>
    5352#include <errno.h>
     
    8988    nic_iface_t *iface)
    9089{
    91         if (driver_ops) {
    92                 if (!driver_ops->device_added)
    93                         driver_ops->device_added = nic_device_added_impl;
    94         }
    95 
    9690        if (dev_ops) {
    9791                if (!dev_ops->open)
     
    429423
    430424/**
    431  * Connect to the NET and IRQ services. This function should be called only from
     425 * Connect to IRC service. This function should be called only from
    432426 * the add_device handler, thus no locking is required.
    433427 *
     
    436430 * @return EOK          If connection was successful.
    437431 * @return EINVAL       If the IRC service cannot be determined.
    438  * @return EREFUSED     If NET or IRC service cannot be connected.
     432 * @return EREFUSED     If IRC service cannot be connected.
    439433 */
    440434int nic_connect_to_services(nic_t *nic_data)
    441435{
    442         /* NET service */
    443         nic_data->net_session = service_connect_blocking(EXCHANGE_SERIALIZE,
    444                 SERVICE_NETWORKING, 0, 0);
    445         if (nic_data->net_session == NULL)
    446                 return errno;
    447        
    448436        /* IRC service */
    449437        sysarg_t apic;
     
    462450       
    463451        return EOK;
    464 }
    465 
    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);
    486452}
    487453
     
    726692        nic_data->device_id = NIC_DEVICE_INVALID_ID;
    727693        nic_data->state = NIC_STATE_STOPPED;
    728         nic_data->net_session = NULL;
    729694        nic_data->nil_session = NULL;
    730695        nic_data->irc_session = NULL;
     
    781746 */
    782747static void nic_destroy(nic_t *nic_data) {
    783         if (nic_data->net_session != NULL) {
    784                 async_hangup(nic_data->net_session);
    785         }
    786 
    787748        if (nic_data->nil_session != NULL) {
    788749                async_hangup(nic_data->nil_session);
  • uspace/lib/nic/src/nic_impl.c

    r86c71de reaa0c3f  
    8585        }
    8686        if (state == NIC_STATE_ACTIVE) {
    87                 if (nic_data->nil_session == NULL || nic_data->net_session == NULL
    88                     || nic_data->device_id < 0) {
     87                if (nic_data->nil_session == NULL || nic_data->device_id < 0) {
    8988                        fibril_rwlock_write_unlock(&nic_data->main_lock);
    9089                        return EINVAL;
     
    805804}
    806805
    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 
    819806/**
    820807 * Default handler for unknown methods (outside of the NIC interface).
Note: See TracChangeset for help on using the changeset viewer.