Changeset eb1a2f4 in mainline for uspace/drv/uhci-hcd/uhci.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/uhci.c

    rdbe25f1 reb1a2f4  
    3333 */
    3434#include <errno.h>
     35#include <str_error.h>
    3536#include <adt/list.h>
     37#include <libarch/ddi.h>
    3638
    3739#include <usb/debug.h>
    3840#include <usb/usb.h>
     41#include <usb/ddfiface.h>
     42#include <usb_iface.h>
    3943
    4044#include "uhci.h"
     45#include "iface.h"
     46
    4147static irq_cmd_t uhci_cmds[] = {
    4248        {
     
    5561};
    5662
     63static int usb_iface_get_address(ddf_fun_t *fun, devman_handle_t handle,
     64    usb_address_t *address)
     65{
     66        assert(fun);
     67        uhci_t *hc = fun_to_uhci(fun);
     68        assert(hc);
     69
     70        usb_address_t addr = usb_address_keeping_find(&hc->address_manager,
     71            handle);
     72        if (addr < 0) {
     73                return addr;
     74        }
     75
     76        if (address != NULL) {
     77                *address = addr;
     78        }
     79
     80        return EOK;
     81}
     82
     83
     84static usb_iface_t hc_usb_iface = {
     85        .get_hc_handle = usb_iface_get_hc_handle_hc_impl,
     86        .get_address = usb_iface_get_address
     87};
     88/*----------------------------------------------------------------------------*/
     89static ddf_dev_ops_t uhci_ops = {
     90        .interfaces[USB_DEV_IFACE] = &hc_usb_iface,
     91        .interfaces[USBHC_DEV_IFACE] = &uhci_iface
     92};
     93
    5794static int uhci_init_transfer_lists(uhci_t *instance);
    5895static int uhci_init_mem_structures(uhci_t *instance);
     
    71108        } else (void) 0
    72109
    73 int uhci_init(uhci_t *instance, void *regs, size_t reg_size)
     110int uhci_init(uhci_t *instance, ddf_dev_t *dev, void *regs, size_t reg_size)
    74111{
    75112        assert(reg_size >= sizeof(regs_t));
     113        int ret;
     114
     115        /*
     116         * Create UHCI function.
     117         */
     118        instance->ddf_instance = ddf_fun_create(dev, fun_exposed, "uhci");
     119        if (instance->ddf_instance == NULL) {
     120                usb_log_error("Failed to create UHCI device function.\n");
     121                return ENOMEM;
     122        }
     123        instance->ddf_instance->ops = &uhci_ops;
     124        instance->ddf_instance->driver_data = instance;
     125
     126        ret = ddf_fun_bind(instance->ddf_instance);
     127        CHECK_RET_RETURN(ret, "Failed to bind UHCI device function: %s.\n",
     128            str_error(ret));
    76129
    77130        /* allow access to hc control registers */
    78131        regs_t *io;
    79         int ret = pio_enable(regs, reg_size, (void**)&io);
     132        ret = pio_enable(regs, reg_size, (void**)&io);
    80133        CHECK_RET_RETURN(ret, "Failed to gain access to registers at %p.\n", io);
    81134        instance->registers = io;
Note: See TracChangeset for help on using the changeset viewer.