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

    rdbe25f1 reb1a2f4  
    3232 * @brief UHCI driver
    3333 */
    34 #include <driver.h>
     34#include <ddf/driver.h>
     35#include <ddf/interrupt.h>
    3536#include <usb_iface.h>
    3637#include <usb/ddfiface.h>
     
    4849#define NAME "uhci-hcd"
    4950
    50 static int uhci_add_device(device_t *device);
     51static int uhci_add_device(ddf_dev_t *device);
    5152
    52 static int usb_iface_get_address(device_t *dev, devman_handle_t handle,
    53     usb_address_t *address)
    54 {
    55         assert(dev);
    56         uhci_t *hc = dev_to_uhci(dev);
    57         assert(hc);
    58 
    59         usb_address_t addr = usb_address_keeping_find(&hc->address_manager,
    60             handle);
    61         if (addr < 0) {
    62                 return addr;
    63         }
    64 
    65         if (address != NULL) {
    66                 *address = addr;
    67         }
    68 
    69         return EOK;
    70 }
    71 
    72 
    73 static usb_iface_t hc_usb_iface = {
    74         .get_hc_handle = usb_iface_get_hc_handle_hc_impl,
    75         .get_address = usb_iface_get_address
    76 };
    77 /*----------------------------------------------------------------------------*/
    78 static device_ops_t uhci_ops = {
    79         .interfaces[USB_DEV_IFACE] = &hc_usb_iface,
    80         .interfaces[USBHC_DEV_IFACE] = &uhci_iface
    81 };
    8253/*----------------------------------------------------------------------------*/
    8354static driver_ops_t uhci_driver_ops = {
     
    9061};
    9162/*----------------------------------------------------------------------------*/
    92 static void irq_handler(device_t *device, ipc_callid_t iid, ipc_call_t *call)
     63static void irq_handler(ddf_dev_t *dev, ipc_callid_t iid, ipc_call_t *call)
    9364{
    94         assert(device);
    95         uhci_t *hc = dev_to_uhci(device);
     65        assert(dev);
     66        uhci_t *hc = dev_to_uhci(dev);
    9667        uint16_t status = IPC_GET_ARG1(*call);
    9768        assert(hc);
     
    10576}
    10677
    107 static int uhci_add_device(device_t *device)
     78static int uhci_add_device(ddf_dev_t *device)
    10879{
    10980        assert(device);
    11081
    11182        usb_log_info("uhci_add_device() called\n");
    112         device->ops = &uhci_ops;
     83
    11384
    11485        uintptr_t io_reg_base;
     
    131102        CHECK_RET_RETURN(ret, "Failed to allocate memory for uhci hcd driver.\n");
    132103
    133         ret = uhci_init(uhci_hc, (void*)io_reg_base, io_reg_size);
     104        ret = uhci_init(uhci_hc, device, (void*)io_reg_base, io_reg_size);
    134105        if (ret != EOK) {
    135106                usb_log_error("Failed to init uhci-hcd.\n");
     
    137108                return ret;
    138109        }
     110
     111        /*
     112         * We might free uhci_hc, but that does not matter since no one
     113         * else would access driver_data anyway.
     114         */
     115        device->driver_data = uhci_hc;
    139116
    140117        ret = register_interrupt_handler(device, irq, irq_handler,
     
    147124        }
    148125
    149         device_t *rh;
     126        ddf_fun_t *rh;
    150127        ret = setup_root_hub(&rh, device);
    151128        if (ret != EOK) {
     
    155132                return ret;
    156133        }
     134        rh->driver_data = uhci_hc->ddf_instance;
    157135
    158         ret = child_device_register(rh, device);
     136        ret = ddf_fun_bind(rh);
    159137        if (ret != EOK) {
    160138                usb_log_error("Failed to register root hub.\n");
     
    165143        }
    166144
    167         device->driver_data = uhci_hc;
    168145        return EOK;
    169146}
     
    172149{
    173150        sleep(3);
    174         usb_log_enable(USB_LOG_LEVEL_DEBUG, NAME);
     151        usb_log_enable(USB_LOG_LEVEL_INFO, NAME);
    175152
    176         return driver_main(&uhci_driver);
     153        return ddf_driver_main(&uhci_driver);
    177154}
    178155/**
Note: See TracChangeset for help on using the changeset viewer.