Changeset 9a66bc2e in mainline for uspace/srv


Ignore:
Timestamp:
2010-04-04T21:52:26Z (15 years ago)
Author:
Lenka Trochtova <trochtova.lenka@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8c06905
Parents:
5cd136ab
Message:

several bugs fixed

Location:
uspace/srv
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/devman/main.c

    r5cd136ab r9a66bc2e  
    258258}
    259259
    260 static void devman_forward(ipc_callid_t iid, ipc_call_t *icall, bool drv_to_parent) {
    261         device_handle_t handle;
     260static void devman_forward(ipc_callid_t iid, ipc_call_t *icall, bool drv_to_parent) {   
     261       
     262        device_handle_t handle = IPC_GET_ARG2(*icall);
     263        printf(NAME ": devman_forward - trying to forward connection to device with handle %x.\n", handle);
     264       
    262265        node_t *dev = find_dev_node(&device_tree, handle);
    263266        if (NULL == dev) {
     267                printf(NAME ": devman_forward error - no device with handle %x was found.\n", handle);
    264268                ipc_answer_0(iid, ENOENT);
    265269                return;
     
    269273       
    270274        if (drv_to_parent) {
    271                 driver = dev->parent->drv;
     275                if (NULL != dev->parent) {
     276                        driver = dev->parent->drv;             
     277                }
    272278        } else {
    273279                driver = dev->drv;             
    274280        }
    275281       
    276         if (NULL == driver) {           
     282        if (NULL == driver) {   
     283                printf(NAME ": devman_forward error - no driver to connect to.\n", handle);
    277284                ipc_answer_0(iid, ENOENT);
    278285                return;
     
    286293        }
    287294       
     295        if (driver->phone <= 0) {
     296                printf(NAME ": devman_forward: cound not forward to driver %s (the driver's phone is %x).\n", driver->name, driver->phone);
     297                return;
     298        }
     299        printf(NAME ": devman_forward: forward to driver %s with phone %d.\n", driver->name, driver->phone);
    288300        ipc_forward_fast(iid, driver->phone, method, dev->handle, 0, IPC_FF_NONE);     
    289301}
  • uspace/srv/drivers/rootia32/rootia32.c

    r5cd136ab r9a66bc2e  
    5050#include <ipc/devman.h>
    5151#include <ipc/dev_iface.h>
     52#include <resource.h>
    5253
    5354#define NAME "rootia32"
    5455
    55 typedef struct rootia32_dev_data {
     56typedef struct rootia32_child_dev_data {
    5657        hw_resource_list_t hw_resources;       
    57 } rootia32_dev_data_t;
     58} rootia32_child_dev_data_t;
    5859
    5960static bool rootia32_add_device(device_t *dev);
     
    8283};
    8384
    84 static rootia32_dev_data_t pci_data = {
     85static rootia32_child_dev_data_t pci_data = {
    8586        .hw_resources = {
    8687                1,
     
    8990};
    9091
     92static hw_resource_list_t * rootia32_get_child_resources(device_t *dev)
     93{
     94        rootia32_child_dev_data_t *data = (rootia32_child_dev_data_t *)dev->driver_data;
     95        if (NULL == data) {
     96                return NULL;
     97        }
     98        return &data->hw_resources;
     99}
     100
     101static bool rootia32_enable_child_interrupt(device_t *dev)
     102{
     103        // TODO
     104       
     105        return false;
     106}
     107
     108static resource_iface_t child_res_iface = {
     109        &rootia32_get_child_resources,
     110        &rootia32_enable_child_interrupt       
     111};
     112
    91113static bool rootia32_add_child(
    92114        device_t *parent, const char *name, const char *str_match_id,
    93         rootia32_dev_data_t *drv_data)
     115        rootia32_child_dev_data_t *drv_data)
    94116{
    95117        printf(NAME ": adding new child device '%s'.\n", name);
     
    113135        match_id->score = 100;
    114136        add_match_id(&child->match_ids, match_id);     
     137       
     138        // add an interface to the device
     139        device_set_iface(child, HW_RES_DEV_IFACE, &child_res_iface);
    115140       
    116141        // register child  device
     
    151176        if (!rootia32_add_children(dev)) {
    152177                printf(NAME ": failed to add child devices for platform ia32.\n");
    153                 return false;
    154178        }
    155179       
Note: See TracChangeset for help on using the changeset viewer.