Changes in / [40dc422:bbc74af7] in mainline


Ignore:
Location:
uspace
Files:
4 deleted
12 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/tester/Makefile

    r40dc422 rbbc74af7  
    5151        loop/loop1.c \
    5252        mm/malloc1.c \
    53         hw/misc/virtchar1.c \
    5453        hw/serial/serial1.c
    5554
  • uspace/app/tester/tester.c

    r40dc422 rbbc74af7  
    6565#include "mm/malloc1.def"
    6666#include "hw/serial/serial1.def"
    67 #include "hw/misc/virtchar1.def"
    6867        {NULL, NULL, NULL, false}
    6968};
  • uspace/app/tester/tester.h

    r40dc422 rbbc74af7  
    8282extern const char *test_malloc1(void);
    8383extern const char *test_serial1(void);
    84 extern const char *test_virtchar1(void);
    8584
    8685extern test_t tests[];
  • uspace/drv/rootvirt/devices.def

    r40dc422 rbbc74af7  
    1717        .match_id = "virtual&test2"
    1818},
    19 {
    20         .name = "null",
    21         .match_id = "virtual&test1"
    22 },
    2319#endif
  • uspace/drv/test1/Makefile

    r40dc422 rbbc74af7  
    3333
    3434SOURCES = \
    35         char.c \
    3635        test1.c
    3736
  • uspace/drv/test1/test1.c

    r40dc422 rbbc74af7  
    3434#include <errno.h>
    3535#include <str_error.h>
    36 #include "test1.h"
     36#include <driver.h>
     37
     38#define NAME "test1"
    3739
    3840static int add_device(device_t *dev);
     
    9698        add_device_to_class(dev, "virtual");
    9799
    98         if (str_cmp(dev->name, "null") == 0) {
    99                 dev->ops = &char_device_ops;
    100                 add_device_to_class(dev, "virt-null");
    101         } else if (dev->parent == NULL) {
     100        if (dev->parent == NULL) {
    102101                register_child_verbose(dev, "cloning myself ;-)", "clone",
    103102                    "virtual&test1", 10);
     
    118117}
    119118
     119
  • uspace/lib/c/generic/devmap.c

    r40dc422 rbbc74af7  
    127127/** Register new device.
    128128 *
    129  * The @p interface is used when forwarding connection to the driver.
    130  * If not 0, the first argument is the interface and the second argument
    131  * is the devmap handle of the device.
    132  * When the interface is zero (default), the first argument is directly
    133  * the handle (to ensure backward compatibility).
    134  *
    135  * @param fqdn Fully qualified device name.
    136  * @param[out] handle Handle to the created instance of device.
    137  * @param interface Interface when forwarding.
    138  *
    139  */
    140 int devmap_device_register_with_iface(const char *fqdn,
    141     devmap_handle_t *handle, sysarg_t interface)
    142 {
    143         int phone = devmap_get_phone(DEVMAP_DRIVER, IPC_FLAG_BLOCKING);
    144        
    145         if (phone < 0)
    146                 return phone;
    147        
    148         async_serialize_start();
    149        
    150         ipc_call_t answer;
    151         aid_t req = async_send_2(phone, DEVMAP_DEVICE_REGISTER, interface, 0,
    152             &answer);
    153        
    154         sysarg_t retval = async_data_write_start(phone, fqdn, str_size(fqdn));
    155         if (retval != EOK) {
    156                 async_wait_for(req, NULL);
    157                 async_serialize_end();
    158                 return retval;
    159         }
    160        
    161         async_wait_for(req, &retval);
    162        
    163         async_serialize_end();
    164        
    165         if (retval != EOK) {
    166                 if (handle != NULL)
    167                         *handle = -1;
    168                 return retval;
    169         }
    170        
    171         if (handle != NULL)
    172                 *handle = (devmap_handle_t) IPC_GET_ARG1(answer);
    173        
    174         return retval;
    175 }
    176 
    177 /** Register new device.
    178  *
     129 * @param namespace Namespace name.
    179130 * @param fqdn      Fully qualified device name.
    180131 * @param handle    Output: Handle to the created instance of device.
     
    183134int devmap_device_register(const char *fqdn, devmap_handle_t *handle)
    184135{
    185         return devmap_device_register_with_iface(fqdn, handle, 0);
    186 }
    187 
     136        int phone = devmap_get_phone(DEVMAP_DRIVER, IPC_FLAG_BLOCKING);
     137       
     138        if (phone < 0)
     139                return phone;
     140       
     141        async_serialize_start();
     142       
     143        ipc_call_t answer;
     144        aid_t req = async_send_2(phone, DEVMAP_DEVICE_REGISTER, 0, 0,
     145            &answer);
     146       
     147        sysarg_t retval = async_data_write_start(phone, fqdn, str_size(fqdn));
     148        if (retval != EOK) {
     149                async_wait_for(req, NULL);
     150                async_serialize_end();
     151                return retval;
     152        }
     153       
     154        async_wait_for(req, &retval);
     155       
     156        async_serialize_end();
     157       
     158        if (retval != EOK) {
     159                if (handle != NULL)
     160                        *handle = -1;
     161                return retval;
     162        }
     163       
     164        if (handle != NULL)
     165                *handle = (devmap_handle_t) IPC_GET_ARG1(answer);
     166       
     167        return retval;
     168}
    188169
    189170int devmap_device_get_handle(const char *fqdn, devmap_handle_t *handle, unsigned int flags)
  • uspace/lib/c/include/devmap.h

    r40dc422 rbbc74af7  
    4545extern int devmap_driver_register(const char *, async_client_conn_t);
    4646extern int devmap_device_register(const char *, devmap_handle_t *);
    47 extern int devmap_device_register_with_iface(const char *, devmap_handle_t *, sysarg_t);
    4847
    4948extern int devmap_device_get_handle(const char *, devmap_handle_t *, unsigned int);
  • uspace/lib/c/include/ipc/devman.h

    r40dc422 rbbc74af7  
    123123        DEVMAN_CLIENT,
    124124        DEVMAN_CONNECT_TO_DEVICE,
    125         DEVMAN_CONNECT_FROM_DEVMAP,
    126125        DEVMAN_CONNECT_TO_PARENTS_DEVICE
    127126} devman_interface_t;
  • uspace/srv/devman/devman.c

    r40dc422 rbbc74af7  
    6262}
    6363
    64 static int devmap_devices_class_compare(unsigned long key[], hash_count_t keys,
    65     link_t *item)
    66 {
    67         dev_class_info_t *class_info
    68             = hash_table_get_instance(item, dev_class_info_t, devmap_link);
    69         assert(class_info != NULL);
    70 
    71         return (class_info->devmap_handle == (devmap_handle_t) key[0]);
    72 }
    73 
    7464static void devices_remove_callback(link_t *item)
    7565{
     
    8575        .hash = devices_hash,
    8676        .compare = devmap_devices_compare,
    87         .remove_callback = devices_remove_callback
    88 };
    89 
    90 static hash_table_operations_t devmap_devices_class_ops = {
    91         .hash = devices_hash,
    92         .compare = devmap_devices_class_compare,
    9377        .remove_callback = devices_remove_callback
    9478};
     
    686670        }
    687671       
    688         devmap_device_register_with_iface(devmap_pathname,
    689             &node->devmap_handle, DEVMAN_CONNECT_FROM_DEVMAP);
     672        devmap_device_register(devmap_pathname, &node->devmap_handle);
    690673       
    691674        tree_add_devmap_device(tree, node);
     
    10591042       
    10601043        info = (dev_class_info_t *) malloc(sizeof(dev_class_info_t));
    1061         if (info != NULL) {
     1044        if (info != NULL)
    10621045                memset(info, 0, sizeof(dev_class_info_t));
    1063                 list_initialize(&info->dev_classes);
    1064                 list_initialize(&info->devmap_link);
    1065                 list_initialize(&info->link);
    1066         }
    10671046       
    10681047        return info;
     
    11881167        fibril_rwlock_initialize(&class_list->rwlock);
    11891168        hash_table_create(&class_list->devmap_devices, DEVICE_BUCKETS, 1,
    1190             &devmap_devices_class_ops);
     1169            &devmap_devices_ops);
    11911170}
    11921171
     
    12361215        hash_table_insert(&class_list->devmap_devices, &key, &cli->devmap_link);
    12371216        fibril_rwlock_write_unlock(&class_list->rwlock);
    1238 
    1239         assert(find_devmap_class_device(class_list, cli->devmap_handle) != NULL);
    12401217}
    12411218
  • uspace/srv/devman/main.c

    r40dc422 rbbc74af7  
    281281         * handle.
    282282         */
    283         devmap_device_register_with_iface(devmap_pathname,
    284             &cli->devmap_handle, DEVMAN_CONNECT_FROM_DEVMAP);
     283        devmap_device_register(devmap_pathname, &cli->devmap_handle);
    285284       
    286285        /*
     
    487486static void devman_connection_devmapper(ipc_callid_t iid, ipc_call_t *icall)
    488487{
    489         devmap_handle_t devmap_handle = IPC_GET_ARG2(*icall);
     488        devmap_handle_t devmap_handle = IPC_GET_IMETHOD(*icall);
    490489        node_t *dev;
    491490
     
    504503        }
    505504       
     505        printf(NAME ": devman_connection_devmapper: forward connection to "
     506            "device %s to driver %s.\n", dev->pathname, dev->drv->name);
    506507        ipc_forward_fast(iid, dev->drv->phone, DRIVER_CLIENT, dev->handle, 0,
    507508            IPC_FF_NONE);
    508         printf(NAME ": devman_connection_devmapper: forwarded connection to "
    509             "device %s to driver %s.\n", dev->pathname, dev->drv->name);
    510509}
    511510
     
    513512static void devman_connection(ipc_callid_t iid, ipc_call_t *icall)
    514513{
     514        /*
     515         * Silly hack to enable the device manager to register as a driver by
     516         * the device mapper. If the ipc method is not IPC_M_CONNECT_ME_TO, this
     517         * is not the forwarded connection from naming service, so it must be a
     518         * connection from the devmapper which thinks this is a devmapper-style
     519         * driver. So pretend this is a devmapper-style driver. (This does not
     520         * work for device with handle == IPC_M_CONNECT_ME_TO, because devmapper
     521         * passes device handle to the driver as an ipc method.)
     522         */
     523        if (IPC_GET_IMETHOD(*icall) != IPC_M_CONNECT_ME_TO)
     524                devman_connection_devmapper(iid, icall);
     525
     526        /*
     527         * ipc method is IPC_M_CONNECT_ME_TO, so this is forwarded connection
     528         * from naming service by which we registered as device manager, so be
     529         * device manager.
     530         */
     531       
    515532        /* Select interface. */
    516533        switch ((sysarg_t) (IPC_GET_ARG1(*icall))) {
     
    525542                devman_forward(iid, icall, false);
    526543                break;
    527         case DEVMAN_CONNECT_FROM_DEVMAP:
    528                 /* Someone connected through devmap node. */
    529                 devman_connection_devmapper(iid, icall);
    530                 break;
    531544        case DEVMAN_CONNECT_TO_PARENTS_DEVICE:
    532545                /* Connect client to selected device. */
  • uspace/srv/devmap/devmap.c

    r40dc422 rbbc74af7  
    9999        /** Device driver handling this device */
    100100        devmap_driver_t *driver;
    101         /** Use this interface when forwarding to driver. */
    102         sysarg_t forward_interface;
    103101} devmap_device_t;
    104102
     
    519517        }
    520518       
    521         /* Set the interface, if any. */
    522         device->forward_interface = IPC_GET_ARG1(*icall);
    523 
    524519        /* Get fqdn */
    525520        char *fqdn;
     
    571566        /* Get unique device handle */
    572567        device->handle = devmap_create_handle();
    573 
     568       
    574569        devmap_namespace_addref(namespace, device);
    575570        device->driver = driver;
     
    622617        }
    623618       
    624         if (dev->forward_interface == 0) {
    625                 ipc_forward_fast(callid, dev->driver->phone,
    626                     dev->handle, 0, 0,
    627                     IPC_FF_NONE);
    628         } else {
    629                 ipc_forward_fast(callid, dev->driver->phone,
    630                     dev->forward_interface, dev->handle, 0,
    631                     IPC_FF_NONE);
    632         }
     619        ipc_forward_fast(callid, dev->driver->phone, dev->handle,
     620            IPC_GET_ARG3(*call), 0, IPC_FF_NONE);
    633621       
    634622        fibril_mutex_unlock(&devices_list_mutex);
Note: See TracChangeset for help on using the changeset viewer.