Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 6f9e7fea in mainline


Ignore:
Timestamp:
2010-11-30T00:24:42Z (11 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master
Children:
178673c
Parents:
0ca16307
Message:

Add root virtual device driver

The driver is meant as a simple way to add virtual devices to the
system (it only passes list of virtual devices to devman which then
decides what drivers to launch).

Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • boot/Makefile.common

    r0ca16307 r6f9e7fea  
    109109       
    110110RD_DRVS = \
    111         root
     111        root \
     112        rootvirt
    112113
    113114RD_DRV_CFG =
  • uspace/Makefile

    r0ca16307 r6f9e7fea  
    8686        srv/net/tl/tcp \
    8787        srv/net/net \
    88         drv/root
     88        drv/root \
     89        drv/rootvirt
    8990
    9091## Networking
  • uspace/drv/root/root.c

    r0ca16307 r6f9e7fea  
    5757#define PLATFORM_DEVICE_MATCH_SCORE 100
    5858
     59#define VIRTUAL_DEVICE_NAME "virt"
     60#define VIRTUAL_DEVICE_MATCH_ID "rootvirt"
     61#define VIRTUAL_DEVICE_MATCH_SCORE 100
     62
    5963static int root_add_device(device_t *dev);
    6064
     
    6973        .driver_ops = &root_ops
    7074};
     75
     76/** Create the device which represents the root of virtual device tree.
     77 *
     78 * @param parent Parent of the newly created device.
     79 * @return Error code.
     80 */
     81static int add_virtual_root_child(device_t *parent)
     82{
     83        printf(NAME ": adding new child for virtual devices.\n");
     84        printf(NAME ":   device node is `%s' (%d %s)\n", VIRTUAL_DEVICE_NAME,
     85            VIRTUAL_DEVICE_MATCH_SCORE, VIRTUAL_DEVICE_MATCH_ID);
     86
     87        int res = child_device_register_wrapper(parent, VIRTUAL_DEVICE_NAME,
     88            VIRTUAL_DEVICE_MATCH_ID, VIRTUAL_DEVICE_MATCH_SCORE);
     89
     90        return res;
     91}
    7192
    7293/** Create the device which represents the root of HW device tree.
     
    96117        printf(NAME ": root_add_device, device handle = %d\n", dev->handle);
    97118       
     119        /*
     120         * Register virtual devices root.
     121         * We ignore error occurrence because virtual devices shall not be
     122         * vital for the system.
     123         */
     124        add_virtual_root_child(dev);
     125
    98126        /* Register root device's children. */
    99127        int res = add_platform_child(dev);
Note: See TracChangeset for help on using the changeset viewer.