Changeset 8e7c9fe in mainline for uspace/drv/root/virt/virt.c


Ignore:
Timestamp:
2014-09-12T03:45:25Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c53b58e
Parents:
3eb0c85 (diff), 105d8d6 (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 mainline changes

most usb changes were reverted. blink and usbmass were fixed
known problems:
ehci won't initialize
usbmast asserts on unmount (happens on mainline too)

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/drv/root/virt/virt.c

    r3eb0c85 r8e7c9fe  
    2828
    2929/**
    30  * @defgroup rootvirt Root device driver for virtual devices.
     30 * @defgroup virt Root device driver for virtual devices.
    3131 * @{
    3232 */
     
    4242#include <ddf/log.h>
    4343
    44 #define NAME "rootvirt"
     44#define NAME "virt"
    4545
    4646/** Virtual function entry */
     
    6262};
    6363
    64 static int rootvirt_dev_add(ddf_dev_t *dev);
    65 static int rootvirt_dev_remove(ddf_dev_t *dev);
    66 static int rootvirt_fun_online(ddf_fun_t *fun);
    67 static int rootvirt_fun_offline(ddf_fun_t *fun);
    68 
    69 static driver_ops_t rootvirt_ops = {
    70         .dev_add = &rootvirt_dev_add,
    71         .dev_remove = &rootvirt_dev_remove,
    72         .fun_online = &rootvirt_fun_online,
    73         .fun_offline = &rootvirt_fun_offline
     64static int virt_dev_add(ddf_dev_t *dev);
     65static int virt_dev_remove(ddf_dev_t *dev);
     66static int virt_fun_online(ddf_fun_t *fun);
     67static int virt_fun_offline(ddf_fun_t *fun);
     68
     69static driver_ops_t virt_ops = {
     70        .dev_add = &virt_dev_add,
     71        .dev_remove = &virt_dev_remove,
     72        .fun_online = &virt_fun_online,
     73        .fun_offline = &virt_fun_offline
    7474};
    7575
    76 static driver_t rootvirt_driver = {
     76static driver_t virt_driver = {
    7777        .name = NAME,
    78         .driver_ops = &rootvirt_ops
     78        .driver_ops = &virt_ops
    7979};
    8080
     
    8383        ddf_dev_t *dev;
    8484        list_t functions;
    85 } rootvirt_t;
     85} virt_t;
    8686
    8787/* Function soft state */
     
    8989        ddf_fun_t *fun;
    9090        link_t dev_link;
    91 } rootvirt_fun_t;
     91} virt_fun_t;
    9292
    9393static int instances = 0;
     
    100100 * @return              EOK on success or negative error code.
    101101 */
    102 static int rootvirt_add_fun(rootvirt_t *rootvirt, virtual_function_t *vfun)
    103 {
    104         ddf_dev_t *vdev = rootvirt->dev;
     102static int virt_add_fun(virt_t *virt, virtual_function_t *vfun)
     103{
     104        ddf_dev_t *vdev = virt->dev;
    105105        ddf_fun_t *fun;
    106         rootvirt_fun_t *rvfun;
     106        virt_fun_t *rvfun;
    107107        int rc;
    108108
     
    116116        }
    117117
    118         rvfun = ddf_fun_data_alloc(fun, sizeof(rootvirt_fun_t));
     118        rvfun = ddf_fun_data_alloc(fun, sizeof(virt_fun_t));
    119119        if (rvfun == NULL) {
    120120                ddf_msg(LVL_ERROR, "Failed allocating soft state for %s.",
     
    142142        }
    143143
    144         list_append(&rvfun->dev_link, &rootvirt->functions);
     144        list_append(&rvfun->dev_link, &virt->functions);
    145145
    146146        ddf_msg(LVL_NOTE, "Registered child device `%s'", vfun->name);
     
    148148}
    149149
    150 static int rootvirt_fun_remove(rootvirt_fun_t *rvfun)
     150static int virt_fun_remove(virt_fun_t *rvfun)
    151151{
    152152        int rc;
    153153        const char *name = ddf_fun_get_name(rvfun->fun);
    154154
    155         ddf_msg(LVL_DEBUG, "rootvirt_fun_remove('%s')", name);
     155        ddf_msg(LVL_DEBUG, "virt_fun_remove('%s')", name);
    156156        rc = ddf_fun_offline(rvfun->fun);
    157157        if (rc != EOK) {
     
    172172
    173173
    174 static int rootvirt_dev_add(ddf_dev_t *dev)
    175 {
    176         rootvirt_t *rootvirt;
     174static int virt_dev_add(ddf_dev_t *dev)
     175{
     176        virt_t *virt;
    177177
    178178        /*
     
    185185        ddf_msg(LVL_DEBUG, "dev_add(handle=%d)", (int)ddf_dev_get_handle(dev));
    186186
    187         rootvirt = ddf_dev_data_alloc(dev, sizeof(rootvirt_t));
    188         if (rootvirt == NULL)
     187        virt = ddf_dev_data_alloc(dev, sizeof(virt_t));
     188        if (virt == NULL)
    189189                return ENOMEM;
    190190
    191         rootvirt->dev = dev;
    192         list_initialize(&rootvirt->functions);
     191        virt->dev = dev;
     192        list_initialize(&virt->functions);
    193193
    194194        /*
     
    198198        virtual_function_t *vfun = virtual_functions;
    199199        while (vfun->name != NULL) {
    200                 (void) rootvirt_add_fun(rootvirt, vfun);
     200                (void) virt_add_fun(virt, vfun);
    201201                vfun++;
    202202        }
     
    205205}
    206206
    207 static int rootvirt_dev_remove(ddf_dev_t *dev)
    208 {
    209         rootvirt_t *rootvirt = (rootvirt_t *)ddf_dev_data_get(dev);
     207static int virt_dev_remove(ddf_dev_t *dev)
     208{
     209        virt_t *virt = (virt_t *)ddf_dev_data_get(dev);
    210210        int rc;
    211211
    212         while (!list_empty(&rootvirt->functions)) {
    213                 rootvirt_fun_t *rvfun = list_get_instance(
    214                     list_first(&rootvirt->functions), rootvirt_fun_t,
     212        while (!list_empty(&virt->functions)) {
     213                virt_fun_t *rvfun = list_get_instance(
     214                    list_first(&virt->functions), virt_fun_t,
    215215                        dev_link);
    216216
    217                 rc = rootvirt_fun_remove(rvfun);
     217                rc = virt_fun_remove(rvfun);
    218218                if (rc != EOK)
    219219                        return rc;
     
    224224}
    225225
    226 static int rootvirt_fun_online(ddf_fun_t *fun)
    227 {
    228         ddf_msg(LVL_DEBUG, "rootvirt_fun_online()");
     226static int virt_fun_online(ddf_fun_t *fun)
     227{
     228        ddf_msg(LVL_DEBUG, "virt_fun_online()");
    229229        return ddf_fun_online(fun);
    230230}
    231231
    232 static int rootvirt_fun_offline(ddf_fun_t *fun)
    233 {
    234         ddf_msg(LVL_DEBUG, "rootvirt_fun_offline()");
     232static int virt_fun_offline(ddf_fun_t *fun)
     233{
     234        ddf_msg(LVL_DEBUG, "virt_fun_offline()");
    235235        return ddf_fun_offline(fun);
    236236}
     
    241241
    242242        ddf_log_init(NAME);
    243         return ddf_driver_main(&rootvirt_driver);
     243        return ddf_driver_main(&virt_driver);
    244244}
    245245
Note: See TracChangeset for help on using the changeset viewer.