Changeset eb1a2f4 in mainline for uspace/drv/uhci-hcd/root_hub.c


Ignore:
Timestamp:
2011-02-22T23:30:56Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3b5d1535, a9c674e0
Parents:
dbe25f1 (diff), 664af708 (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 (DDF refactoring)

This merge includes DDF refactoring that brought multifunctional devices
(i.e. ddf_dev_t and ddf_fun_t). Please, see ticket #295 at HelenOS
upstream Trac.

The conflicts themselves were easy to solve (merely several renamings).

Changes to USB subsystem:

  • drivers uses ddf_dev_t and ddf_fun_t
  • different signatures of many library functions
  • several hacks around communication with parent device (now the communication is clearer and somehow what we have now is hack about other hacks)
    • will repair and clean later
  • maybe added some extra debugging messages (the diff has about 240K, and I admit I have no energy to double check that)

WARNING:

  • the diff is VERY long, recommended is viewing partial diffs of the merge (i.e. merges in mainline branch that lead to the parent one)
  • merging with your branches might involve huge renamings, sorry, no other way is possible

BUGS:

  • hub driver will not work (no function created)

GOOD NEWS:

  • QEMU keyboard seems to work with QEMU 0.13 and 0.14
  • we are up-to-date with mainline again
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci-hcd/root_hub.c

    rdbe25f1 reb1a2f4  
    3939
    4040#include "root_hub.h"
     41#include "uhci.h"
    4142
    42 extern device_ops_t child_ops;
     43static int usb_iface_get_hc_handle_rh_impl(ddf_fun_t *root_hub_fun,
     44    devman_handle_t *handle)
     45{
     46        ddf_fun_t *hc_fun = root_hub_fun->driver_data;
     47        assert(hc_fun != NULL);
     48
     49        *handle = hc_fun->handle;
     50
     51        return EOK;
     52}
     53
     54static int usb_iface_get_address_rh_impl(ddf_fun_t *fun, devman_handle_t handle,
     55    usb_address_t *address)
     56{
     57        assert(fun);
     58        ddf_fun_t *hc_fun = fun->driver_data;
     59        assert(hc_fun);
     60        uhci_t *hc = fun_to_uhci(hc_fun);
     61        assert(hc);
     62
     63        usb_address_t addr = usb_address_keeping_find(&hc->address_manager,
     64            handle);
     65        if (addr < 0) {
     66                return addr;
     67        }
     68
     69        if (address != NULL) {
     70                *address = addr;
     71        }
     72
     73        return EOK;
     74}
     75
     76usb_iface_t usb_iface_root_hub_fun_impl = {
     77        .get_hc_handle = usb_iface_get_hc_handle_rh_impl,
     78        .get_address = usb_iface_get_address_rh_impl
     79};
     80
     81static ddf_dev_ops_t root_hub_ops = {
     82        .interfaces[USB_DEV_IFACE] = &usb_iface_root_hub_fun_impl
     83};
     84
    4385/*----------------------------------------------------------------------------*/
    44 int setup_root_hub(device_t **device, device_t *hc)
     86int setup_root_hub(ddf_fun_t **fun, ddf_dev_t *hc)
    4587{
    46         assert(device);
    47         device_t *hub = create_device();
     88        assert(fun);
     89        int ret;
     90
     91        ddf_fun_t *hub = ddf_fun_create(hc, fun_inner, "root-hub");
    4892        if (!hub) {
    4993                usb_log_error("Failed to create root hub device structure.\n");
    50                 return ENOMEM;
    51         }
    52         char *name;
    53         int ret = asprintf(&name, "UHCI Root Hub");
    54         if (ret < 0) {
    55                 usb_log_error("Failed to create root hub name.\n");
    56                 free(hub);
    5794                return ENOMEM;
    5895        }
     
    6299        if (ret < 0) {
    63100                usb_log_error("Failed to create root hub match string.\n");
    64                 free(hub);
    65                 free(name);
     101                ddf_fun_destroy(hub);
    66102                return ENOMEM;
    67103        }
    68104
    69         match_id_t *match_id = create_match_id();
    70         if (!match_id) {
    71                 usb_log_error("Failed to create root hub match id.\n");
    72                 free(hub);
    73                 free(match_str);
     105        ret = ddf_fun_add_match_id(hub, match_str, 100);
     106        if (ret != EOK) {
     107                usb_log_error("Failed to add root hub match id.\n");
     108                ddf_fun_destroy(hub);
    74109                return ENOMEM;
    75110        }
    76         match_id->id = match_str;
    77         match_id->score = 90;
    78111
    79         add_match_id(&hub->match_ids, match_id);
    80         hub->name = name;
    81         hub->parent = hc;
    82         hub->ops = &child_ops;
     112        hub->ops = &root_hub_ops;
    83113
    84         *device = hub;
     114        *fun = hub;
    85115        return EOK;
    86116}
Note: See TracChangeset for help on using the changeset viewer.