Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci/main.c

    r67a1b78 rea991e84  
    11/*
    2  * Copyright (c) 2010 Vojtech Horky, Jan Vesely
     2 * Copyright (c) 2010 Vojtech Horky
    33 * All rights reserved.
    44 *
     
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
     28#include <usb/hcdhubd.h>
    2829#include <usb_iface.h>
     30#include <usb/debug.h>
    2931#include <errno.h>
    30 
    31 #include "debug.h"
    32 #include "iface.h"
    33 #include "name.h"
     32#include <str_error.h>
     33#include <driver.h>
    3434#include "uhci.h"
    3535
     
    5454static int uhci_add_device(device_t *device)
    5555{
    56         uhci_print_info( "uhci_add_device() called\n" );
     56        usb_dprintf(NAME, 1, "uhci_add_device() called\n");
    5757        device->ops = &uhci_ops;
    5858
    59         // TODO: get this value out of pci driver
    60         return uhci_init(device, (void*)0xc020);
     59        uintptr_t io_reg_base;
     60        size_t io_reg_size;
     61        int irq;
     62
     63        int rc = pci_get_my_registers(device,
     64            &io_reg_base, &io_reg_size, &irq);
     65
     66        if (rc != EOK) {
     67                fprintf(stderr,
     68                    NAME ": failed to get I/O registers addresses: %s.\n",
     69                    str_error(rc));
     70                return rc;
     71        }
     72
     73        usb_dprintf(NAME, 2, "I/O regs at 0x%X (size %zu), IRQ %d.\n",
     74            io_reg_base, io_reg_size, irq);
     75
     76        /*
     77         * We need to announce the presence of our root hub.
     78         */
     79        usb_dprintf(NAME, 2, "adding root hub\n");
     80        usb_hcd_add_root_hub(device);
     81
     82        return EOK;
    6183}
    6284
     
    7698         */
    7799        sleep(5);
    78         usb_dprintf_enable(NAME, DEBUG_LEVEL_INFO);
     100        usb_dprintf_enable(NAME, 5);
    79101
    80102        return driver_main(&uhci_driver);
Note: See TracChangeset for help on using the changeset viewer.