Index: .bzrignore
===================================================================
--- .bzrignore	(revision 72e19f5092b40f5bf5640a8288771e2f8675b49e)
+++ .bzrignore	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
@@ -84,5 +84,5 @@
 ./uspace/drv/test1/test1
 ./uspace/drv/test2/test2
-./uspace/drv/uhci/uhci
+./uspace/drv/uhci-hcd/uhci-hcd
 ./uspace/drv/usbhub/usbhub
 ./uspace/drv/usbhid/usbhid
Index: boot/arch/amd64/Makefile.inc
===================================================================
--- boot/arch/amd64/Makefile.inc	(revision 72e19f5092b40f5bf5640a8288771e2f8675b49e)
+++ boot/arch/amd64/Makefile.inc	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
@@ -43,5 +43,5 @@
 	isa \
 	ns8250 \
-	uhci \
+	uhci-hcd \
 	usbhub \
 	usbhid \
Index: uspace/Makefile
===================================================================
--- uspace/Makefile	(revision 72e19f5092b40f5bf5640a8288771e2f8675b49e)
+++ uspace/Makefile	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
@@ -117,5 +117,5 @@
 		srv/hw/irc/apic \
 		srv/hw/irc/i8259 \
-		drv/uhci \
+		drv/uhci-hcd \
 		drv/usbhid \
 		drv/usbhub \
@@ -131,5 +131,5 @@
 		srv/hw/irc/apic \
 		srv/hw/irc/i8259 \
-		drv/uhci \
+		drv/uhci-hcd \
 		drv/usbhid \
 		drv/usbhub \
Index: uspace/drv/uhci-hcd/Makefile
===================================================================
--- uspace/drv/uhci-hcd/Makefile	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
+++ uspace/drv/uhci-hcd/Makefile	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
@@ -0,0 +1,46 @@
+#
+# Copyright (c) 2010 Vojtech Horky
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# - Redistributions of source code must retain the above copyright
+#   notice, this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright
+#   notice, this list of conditions and the following disclaimer in the
+#   documentation and/or other materials provided with the distribution.
+# - The name of the author may not be used to endorse or promote products
+#   derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+USPACE_PREFIX = ../..
+LIBS = $(LIBDRV_PREFIX)/libdrv.a $(LIBUSB_PREFIX)/libusb.a
+EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include -I$(LIBUSB_PREFIX)/include -I.
+BINARY = uhci-hcd
+
+SOURCES = \
+	callback.c \
+	iface.c \
+	main.c \
+	root_hub/port.c \
+	root_hub/port_status.c \
+	root_hub/root_hub.c \
+	transfer_list.c \
+	uhci.c \
+	uhci_struct/transfer_descriptor.c \
+	pci.c
+
+include $(USPACE_PREFIX)/Makefile.common
Index: uspace/drv/uhci-hcd/callback.c
===================================================================
--- uspace/drv/uhci-hcd/callback.c	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
+++ uspace/drv/uhci-hcd/callback.c	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
@@ -0,0 +1,60 @@
+#include <errno.h>
+#include <mem.h>
+
+#include "callback.h"
+int callback_init(callback_t *instance, device_t *dev,
+  void *buffer, size_t size, usbhc_iface_transfer_in_callback_t func_in,
+  usbhc_iface_transfer_out_callback_t func_out, void *arg)
+{
+	assert(instance);
+	assert(func_in == NULL || func_out == NULL);
+	if (size > 0) {
+		instance->new_buffer = malloc32(size);
+		if (!instance->new_buffer) {
+			uhci_print_error("Failed to allocate device acessible buffer.\n");
+			return ENOMEM;
+		}
+		if (func_out)
+			memcpy(instance->new_buffer, buffer, size);
+	} else {
+		instance->new_buffer = NULL;
+	}
+
+
+	instance->callback_out = func_out;
+	instance->callback_in = func_in;
+	instance->old_buffer = buffer;
+	instance->buffer_size = size;
+	instance->dev = dev;
+	instance->arg = arg;
+	return EOK;
+}
+/*----------------------------------------------------------------------------*/
+void callback_run(
+callback_t *instance, usb_transaction_outcome_t outcome, size_t act_size)
+{
+	assert(instance);
+
+	/* update the old buffer */
+	if (instance->new_buffer &&
+	  (instance->new_buffer != instance->old_buffer)) {
+		memcpy(instance->old_buffer, instance->new_buffer, instance->buffer_size);
+		free32(instance->new_buffer);
+		instance->new_buffer = NULL;
+	}
+
+	if (instance->callback_in) {
+		assert(instance->callback_out == NULL);
+		uhci_print_verbose("Callback in: %p %x %d.\n",
+		  instance->callback_in, outcome, act_size);
+		instance->callback_in(
+		  instance->dev, outcome, act_size, instance->arg);
+	} else {
+		assert(instance->callback_out);
+		assert(instance->callback_in == NULL);
+		uhci_print_verbose("Callback out: %p %p %x %p .\n",
+		 instance->callback_out, instance->dev, outcome, instance->arg);
+		instance->callback_out(
+		  instance->dev, outcome, instance->arg);
+	}
+}
Index: uspace/drv/uhci-hcd/callback.h
===================================================================
--- uspace/drv/uhci-hcd/callback.h	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
+++ uspace/drv/uhci-hcd/callback.h	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2010 Jan Vesely
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/** @addtogroup usb
+ * @{
+ */
+/** @file
+ * @brief UHCI driver
+ */
+#ifndef DRV_UHCI_CALLBACK_H
+#define DRV_UHCI_CALLBACK_H
+
+#include <usbhc_iface.h>
+#include <usb/usb.h>
+
+#include "debug.h"
+#include "utils/malloc32.h"
+
+typedef struct callback
+{
+	usbhc_iface_transfer_in_callback_t callback_in;
+	usbhc_iface_transfer_out_callback_t callback_out;
+	void *old_buffer;
+	void *new_buffer;
+	void *arg;
+	size_t buffer_size;
+	size_t actual_size;
+	device_t *dev;
+} callback_t;
+
+
+int callback_init(callback_t *instance, device_t *dev,
+  void *buffer, size_t size, usbhc_iface_transfer_in_callback_t func_in,
+  usbhc_iface_transfer_out_callback_t func_out, void *arg);
+
+#define callback_in_init(instance, dev, buffer, size, func, arg) \
+	callback_init(instance, dev, buffer, size, func, NULL, arg)
+
+#define callback_out_init(instance, dev, buffer, size, func, arg) \
+	callback_init(instance, dev, buffer, size, func, NULL, arg)
+
+static inline callback_t *callback_get(device_t *dev,
+  void *buffer, size_t size, usbhc_iface_transfer_in_callback_t func_in,
+  usbhc_iface_transfer_out_callback_t func_out, void *arg)
+{
+	callback_t *instance = malloc(sizeof(callback_t));
+	if (callback_init(instance, dev, buffer, size, func_in, func_out, arg)) {
+		free(instance);
+		instance = NULL;
+	}
+	return instance;
+}
+
+static inline void callback_fini(callback_t *instance)
+{
+	assert(instance);
+	if (instance->new_buffer)
+		free32(instance->new_buffer);
+}
+
+static inline void callback_dispose(callback_t *instance)
+{
+	callback_fini(instance);
+	free(instance);
+}
+
+void callback_run(
+  callback_t *instance, usb_transaction_outcome_t outcome, size_t act_size);
+#endif
+/**
+ * @}
+ */
Index: uspace/drv/uhci-hcd/debug.h
===================================================================
--- uspace/drv/uhci-hcd/debug.h	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
+++ uspace/drv/uhci-hcd/debug.h	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2010 Jan Vesely
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/** @addtogroup usb
+ * @{
+ */
+/** @file
+ * @brief UHCI driver
+ */
+#ifndef DRV_UHCI_DEBUG_H
+#define DRV_UHCI_DEBUG_H
+
+#include <stdio.h>
+#include <usb/debug.h>
+
+#include "name.h"
+
+enum debug_levels {
+	DEBUG_LEVEL_FATAL_ERROR = 1,
+	DEBUG_LEVEL_ERROR = 2,
+	DEBUG_LEVEL_WARNING = 3,
+	DEBUG_LEVEL_INFO = 4,
+	DEBUG_LEVEL_VERBOSE = 5,
+	DEBUG_LEVEL_MAX = DEBUG_LEVEL_VERBOSE
+};
+
+#define uhci_printf( level, fmt, args...) \
+	usb_dprintf(NAME, level, fmt, ##args)
+
+#define uhci_print_fatal( fmt, args... ) \
+	fprintf(stderr, "[" NAME ":FATAL ERROR]: " fmt, ##args)
+
+#define uhci_print_error( fmt, args... ) \
+	fprintf(stderr, "[" NAME ":ERROR]: " fmt, ##args)
+
+#define uhci_print_warning( fmt, args... ) \
+	usb_dprintf( NAME, DEBUG_LEVEL_WARNING, fmt, ##args )
+
+#define uhci_print_info( fmt, args... ) \
+	usb_dprintf( NAME, DEBUG_LEVEL_INFO, fmt, ##args )
+
+#define uhci_print_verbose( fmt, args... ) \
+	usb_dprintf( NAME, DEBUG_LEVEL_VERBOSE, fmt, ##args )
+
+#endif
+/**
+ * @}
+ */
Index: uspace/drv/uhci-hcd/iface.c
===================================================================
--- uspace/drv/uhci-hcd/iface.c	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
+++ uspace/drv/uhci-hcd/iface.c	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 2010 Vojtech Horky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <driver.h>
+#include <remote_usbhc.h>
+#include <errno.h>
+
+#include "iface.h"
+#include "uhci.h"
+
+static int get_address(device_t *dev, devman_handle_t handle,
+    usb_address_t *address)
+{
+	assert(dev);
+	uhci_t *hc = (uhci_t *)dev->driver_data;
+	assert(hc);
+	*address = usb_address_keeping_find(&hc->address_manager, handle);
+	if (*address <= 0)
+	  return *address;
+	return EOK;
+}
+/*----------------------------------------------------------------------------*/
+static int reserve_default_address(device_t *dev)
+{
+	assert(dev);
+	uhci_t *hc = (uhci_t *)dev->driver_data;
+	assert(hc);
+	usb_address_keeping_reserve_default(&hc->address_manager);
+	return EOK;
+}
+/*----------------------------------------------------------------------------*/
+static int release_default_address(device_t *dev)
+{
+	assert(dev);
+	uhci_t *hc = (uhci_t *)dev->driver_data;
+	assert(hc);
+	usb_address_keeping_release_default(&hc->address_manager);
+	return EOK;
+}
+/*----------------------------------------------------------------------------*/
+static int request_address(device_t *dev, usb_address_t *address)
+{
+	assert(dev);
+	uhci_t *hc = (uhci_t *)dev->driver_data;
+	assert(hc);
+	*address = usb_address_keeping_request(&hc->address_manager);
+	if (*address <= 0)
+	  return *address;
+	return EOK;
+}
+/*----------------------------------------------------------------------------*/
+static int bind_address(
+  device_t *dev, usb_address_t address, devman_handle_t handle)
+{
+	assert(dev);
+	uhci_t *hc = (uhci_t *)dev->driver_data;
+	assert(hc);
+	usb_address_keeping_devman_bind(&hc->address_manager, address, handle);
+	return EOK;
+}
+/*----------------------------------------------------------------------------*/
+static int release_address(device_t *dev, usb_address_t address)
+{
+	assert(dev);
+	uhci_t *hc = (uhci_t *)dev->driver_data;
+	assert(hc);
+	usb_address_keeping_release_default(&hc->address_manager);
+	return EOK;
+}
+/*----------------------------------------------------------------------------*/
+static int interrupt_out(device_t *dev, usb_target_t target,
+    void *data, size_t size,
+    usbhc_iface_transfer_out_callback_t callback, void *arg)
+{
+	return uhci_transfer(dev, target, USB_TRANSFER_INTERRUPT, 0, USB_PID_OUT,
+		data, size, callback, NULL, arg);
+}
+/*----------------------------------------------------------------------------*/
+static int interrupt_in(device_t *dev, usb_target_t target,
+    void *data, size_t size,
+    usbhc_iface_transfer_in_callback_t callback, void *arg)
+{
+	return uhci_transfer(dev, target, USB_TRANSFER_INTERRUPT, 0, USB_PID_IN,
+		data, size, NULL, callback, arg);
+}
+/*----------------------------------------------------------------------------*/
+static int control_write_setup(device_t *dev, usb_target_t target,
+    void *data, size_t size,
+    usbhc_iface_transfer_out_callback_t callback, void *arg)
+{
+	return uhci_transfer(dev, target, USB_TRANSFER_CONTROL, 0, USB_PID_SETUP,
+		data, size, callback, NULL, arg);
+}
+/*----------------------------------------------------------------------------*/
+static int control_write_data(device_t *dev, usb_target_t target,
+    void *data, size_t size,
+    usbhc_iface_transfer_out_callback_t callback, void *arg)
+{
+	return uhci_transfer(dev, target, USB_TRANSFER_CONTROL, 1, USB_PID_OUT,
+		data, size, callback, NULL, arg);
+}
+/*----------------------------------------------------------------------------*/
+static int control_write_status(device_t *dev, usb_target_t target,
+    usbhc_iface_transfer_in_callback_t callback, void *arg)
+{
+	return uhci_transfer(dev, target, USB_TRANSFER_CONTROL, 0, USB_PID_IN,
+		NULL, 0, NULL, callback, arg);
+}
+/*----------------------------------------------------------------------------*/
+static int control_read_setup(device_t *dev, usb_target_t target,
+    void *data, size_t size,
+    usbhc_iface_transfer_out_callback_t callback, void *arg)
+{
+	return uhci_transfer(dev, target, USB_TRANSFER_CONTROL, 0, USB_PID_SETUP,
+		data, size, callback, NULL, arg);
+}
+/*----------------------------------------------------------------------------*/
+static int control_read_data(device_t *dev, usb_target_t target,
+    void *data, size_t size,
+    usbhc_iface_transfer_in_callback_t callback, void *arg)
+{
+	return uhci_transfer(dev, target, USB_TRANSFER_CONTROL, 1, USB_PID_IN,
+		data, size, NULL, callback, arg);
+}
+/*----------------------------------------------------------------------------*/
+static int control_read_status(device_t *dev, usb_target_t target,
+    usbhc_iface_transfer_out_callback_t callback, void *arg)
+{
+	return uhci_transfer(dev, target, USB_TRANSFER_CONTROL, 0, USB_PID_OUT,
+		NULL, 0, callback, NULL, arg);
+}
+
+
+usbhc_iface_t uhci_iface = {
+	.tell_address = get_address,
+
+	.reserve_default_address = reserve_default_address,
+	.release_default_address = release_default_address,
+	.request_address = request_address,
+	.bind_address = bind_address,
+	.release_address = release_address,
+
+	.interrupt_out = interrupt_out,
+	.interrupt_in = interrupt_in,
+
+	.control_write_setup = control_write_setup,
+	.control_write_data = control_write_data,
+	.control_write_status = control_write_status,
+
+	.control_read_setup = control_read_setup,
+	.control_read_data = control_read_data,
+	.control_read_status = control_read_status
+};
Index: uspace/drv/uhci-hcd/iface.h
===================================================================
--- uspace/drv/uhci-hcd/iface.h	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
+++ uspace/drv/uhci-hcd/iface.h	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2010 Vojtech Horky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup usb
+ * @{
+ */
+/** @file
+ * @brief UHCI driver
+ */
+#ifndef DRV_UHCI_IFACE_H
+#define DRV_UHCI_IFACE_H
+
+#include <usbhc_iface.h>
+
+usbhc_iface_t uhci_iface;
+
+#endif
+/**
+ * @}
+ */
Index: uspace/drv/uhci-hcd/main.c
===================================================================
--- uspace/drv/uhci-hcd/main.c	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
+++ uspace/drv/uhci-hcd/main.c	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2010 Vojtech Horky, Jan Vesely
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <driver.h>
+#include <errno.h>
+#include <str_error.h>
+#include <usb_iface.h>
+
+#include "debug.h"
+#include "iface.h"
+#include "name.h"
+#include "uhci.h"
+
+static int usb_iface_get_hc_handle(device_t *dev, devman_handle_t *handle)
+{
+	/* This shall be called only for the UHCI itself. */
+	assert(dev->parent == NULL);
+
+	*handle = dev->handle;
+	return EOK;
+}
+
+static usb_iface_t hc_usb_iface = {
+	.get_hc_handle = usb_iface_get_hc_handle
+};
+
+static device_ops_t uhci_ops = {
+	.interfaces[USB_DEV_IFACE] = &hc_usb_iface,
+	.interfaces[USBHC_DEV_IFACE] = &uhci_iface
+};
+
+static int uhci_add_device(device_t *device)
+{
+	uhci_print_info( "uhci_add_device() called\n" );
+	device->ops = &uhci_ops;
+
+	uintptr_t io_reg_base;
+	size_t io_reg_size;
+	int irq;
+
+	int rc = pci_get_my_registers(device,
+	    &io_reg_base, &io_reg_size, &irq);
+
+	if (rc != EOK) {
+		uhci_print_fatal("failed to get I/O registers addresses: %s.\n",
+		    str_error(rc));
+		return rc;
+	}
+
+	uhci_print_info("I/O regs at 0x%X (size %zu), IRQ %d.\n",
+	    io_reg_base, io_reg_size, irq);
+
+	return uhci_init(device, (void*)io_reg_base, io_reg_size);
+}
+
+static driver_ops_t uhci_driver_ops = {
+	.add_device = uhci_add_device,
+};
+
+static driver_t uhci_driver = {
+	.name = NAME,
+	.driver_ops = &uhci_driver_ops
+};
+
+int main(int argc, char *argv[])
+{
+	/*
+	 * Do some global initializations.
+	 */
+	sleep(5);
+	usb_dprintf_enable(NAME, DEBUG_LEVEL_INFO);
+
+	return driver_main(&uhci_driver);
+}
Index: uspace/drv/uhci-hcd/name.h
===================================================================
--- uspace/drv/uhci-hcd/name.h	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
+++ uspace/drv/uhci-hcd/name.h	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2010 Jan Vesely
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/** @addtogroup usb
+ * @{
+ */
+/** @file
+ * @brief UHCI driver
+ */
+#ifndef DRV_UHCI_TD_NAME_H
+#define DRV_UHCI_TD_NAME_H
+
+#define NAME "uhci-hcd"
+
+#endif
+/**
+ * @}
+ */
Index: uspace/drv/uhci-hcd/pci.c
===================================================================
--- uspace/drv/uhci-hcd/pci.c	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
+++ uspace/drv/uhci-hcd/pci.c	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2011 Vojtech Horky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/**
+ * @addtogroup drvusbuhci
+ * @{
+ */
+/**
+ * @file
+ * PCI related functions needed by the UHCI driver.
+ */
+#include "uhci.h"
+#include <errno.h>
+#include <assert.h>
+#include <devman.h>
+#include <device/hw_res.h>
+
+/** Get address of registers and IRQ for given device.
+ *
+ * @param[in] dev Device asking for the addresses.
+ * @param[out] io_reg_address Base address of the I/O range.
+ * @param[out] io_reg_size Size of the I/O range.
+ * @param[out] irq_no IRQ assigned to the device.
+ * @return Error code.
+ */
+int pci_get_my_registers(device_t *dev,
+    uintptr_t *io_reg_address, size_t *io_reg_size,
+    int *irq_no)
+{
+	assert(dev != NULL);
+
+	int parent_phone = devman_parent_device_connect(dev->handle,
+	    IPC_FLAG_BLOCKING);
+	if (parent_phone < 0) {
+		return parent_phone;
+	}
+
+	int rc;
+
+	hw_resource_list_t hw_resources;
+	rc = hw_res_get_resource_list(parent_phone, &hw_resources);
+	if (rc != EOK) {
+		goto leave;
+	}
+
+	uintptr_t io_address = 0;
+	size_t io_size = 0;
+	bool io_found = false;
+
+	int irq = 0;
+	bool irq_found = false;
+
+	size_t i;
+	for (i = 0; i < hw_resources.count; i++) {
+		hw_resource_t *res = &hw_resources.resources[i];
+		switch (res->type) {
+			case INTERRUPT:
+				irq = res->res.interrupt.irq;
+				irq_found = true;
+				break;
+			case IO_RANGE:
+				io_address = (uintptr_t)
+				    res->res.io_range.address;
+				io_size = res->res.io_range.size;
+				io_found = true;
+				break;
+			default:
+				break;
+		}
+	}
+
+	if (!io_found) {
+		rc = ENOENT;
+		goto leave;
+	}
+
+	if (!irq_found) {
+		rc = ENOENT;
+		goto leave;
+	}
+
+	if (io_reg_address != NULL) {
+		*io_reg_address = io_address;
+	}
+	if (io_reg_size != NULL) {
+		*io_reg_size = io_size;
+	}
+	if (irq_no != NULL) {
+		*irq_no = irq;
+	}
+
+	rc = EOK;
+leave:
+	ipc_hangup(parent_phone);
+
+	return rc;
+}
+
+/**
+ * @}
+ */
+
Index: uspace/drv/uhci-hcd/root_hub/debug.h
===================================================================
--- uspace/drv/uhci-hcd/root_hub/debug.h	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
+++ uspace/drv/uhci-hcd/root_hub/debug.h	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2010 Jan Vesely
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/** @addtogroup usb
+ * @{
+ */
+/** @file
+ * @brief UHCI driver
+ */
+#ifndef DRV_UHCI_ROOT_HUB_DEBUG_H
+#define DRV_UHCI_ROOT_HUB_DEBUG_H
+
+#include <stdio.h>
+#include <usb/debug.h>
+
+#define NAME "uhci_root_hubd"
+
+enum debug_levels {
+	DEBUG_LEVEL_FATAL_ERROR = 1,
+	DEBUG_LEVEL_ERROR = 2,
+	DEBUG_LEVEL_WARNING = 3,
+	DEBUG_LEVEL_INFO = 4,
+	DEBUG_LEVEL_VERBOSE = 5,
+	DEBUG_LEVEL_MAX = DEBUG_LEVEL_VERBOSE
+};
+
+#define uhci_printf( level, fmt, args...) \
+	usb_dprintf(NAME, level, fmt, ##args)
+
+#define uhci_print_fatal( fmt, args... ) \
+	fprintf(stderr, "[" NAME ":FATAL ERROR]: " fmt, ##args)
+
+#define uhci_print_error( fmt, args... ) \
+	fprintf(stderr, "[" NAME ":ERROR]: " fmt, ##args)
+
+#define uhci_print_warning( fmt, args... ) \
+	usb_dprintf( NAME, DEBUG_LEVEL_WARNING, fmt, ##args )
+
+#define uhci_print_info( fmt, args... ) \
+	usb_dprintf( NAME, DEBUG_LEVEL_INFO, fmt, ##args )
+
+#define uhci_print_verbose( fmt, args... ) \
+	usb_dprintf( NAME, DEBUG_LEVEL_VERBOSE, fmt, ##args )
+
+#endif
+/**
+ * @}
+ */
Index: uspace/drv/uhci-hcd/root_hub/port.c
===================================================================
--- uspace/drv/uhci-hcd/root_hub/port.c	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
+++ uspace/drv/uhci-hcd/root_hub/port.c	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
@@ -0,0 +1,165 @@
+
+#include <errno.h>
+#include <usb/usb.h>    /* usb_address_t */
+#include <usb/usbdrv.h> /* usb_drv_*     */
+
+#include "debug.h"
+#include "port.h"
+#include "port_status.h"
+
+static int uhci_port_new_device(uhci_port_t *port);
+static int uhci_port_remove_device(uhci_port_t *port);
+static int uhci_port_set_enabled(uhci_port_t *port, bool enabled);
+
+/*----------------------------------------------------------------------------*/
+int uhci_port_check(void *port)
+{
+	async_usleep( 1000000 );
+	uhci_port_t *port_instance = port;
+	assert(port_instance);
+	port_instance->hc_phone = devman_device_connect(port_instance->hc->handle, 0);
+	if (port_instance->hc_phone < 0) {
+		uhci_print_fatal("Failed(%d) to connect to the hc(handle=%x.\n",
+			port_instance->hc_phone, (unsigned)port_instance->hc->handle);
+		return port_instance->hc_phone;
+	}
+
+	while (1) {
+		uhci_print_verbose("Port(%d) status address %p:\n",
+		  port_instance->number, port_instance->address);
+
+		/* read register value */
+		port_status_t port_status =
+			port_status_read(port_instance->address);
+
+		/* debug print */
+		uhci_print_info("Port(%d) status %#.4x\n",
+		  port_instance->number, port_status);
+		print_port_status(port_status);
+
+		if (port_status & STATUS_CONNECTED_CHANGED) {
+			if (port_status & STATUS_CONNECTED) {
+				/* new device */
+				uhci_port_new_device(port_instance);
+			} else {
+				uhci_port_remove_device(port_instance);
+			}
+		}
+		async_usleep(port_instance->wait_period_usec);
+	}
+	return EOK;
+}
+/*----------------------------------------------------------------------------*/
+static int uhci_port_new_device(uhci_port_t *port)
+{
+	assert(port);
+	assert(port->hc_phone);
+
+	uhci_print_info("Adding new device on port %d.\n", port->number);
+
+
+	/* get default address */
+	int ret = usb_drv_reserve_default_address(port->hc_phone);
+	if (ret != EOK) {
+		uhci_print_error("Failed to reserve default address.\n");
+		return ret;
+	}
+
+	const usb_address_t usb_address = usb_drv_request_address(port->hc_phone);
+
+	if (usb_address <= 0) {
+		uhci_print_error("Recieved invalid address(%d).\n", usb_address);
+		return usb_address;
+	}
+	/*
+	 * the host then waits for at least 100 ms to allow completion of
+	 * an insertion process and for power at the device to become stable.
+	 */
+	async_usleep(100000);
+
+	/* enable port */
+	uhci_port_set_enabled(port, true);
+
+	/* The hub maintains the reset signal to that port for 10 ms
+	 * (See Section 11.5.1.5)
+	 */
+	port_status_t port_status =
+		port_status_read(port->address);
+	port_status |= STATUS_IN_RESET;
+	port_status_write(port->address, port_status);
+	async_usleep(10000);
+	port_status =
+		port_status_read(port->address);
+	port_status &= ~STATUS_IN_RESET;
+	port_status_write(port->address, port_status);
+
+	/* assign address to device */
+	ret = usb_drv_req_set_address(port->hc_phone, 0, usb_address);
+
+
+	if (ret != EOK) { /* address assigning went wrong */
+		uhci_print_error("Failed(%d) to assign address to the device.\n", ret);
+		uhci_port_set_enabled(port, false);
+		int release = usb_drv_release_default_address(port->hc_phone);
+		if (release != EOK) {
+			uhci_print_fatal("Failed to release default address.\n");
+			return release;
+		}
+		return ret;
+	}
+
+	/* release default address */
+	ret = usb_drv_release_default_address(port->hc_phone);
+	if (ret != EOK) {
+		uhci_print_fatal("Failed to release default address.\n");
+		return ret;
+	}
+
+	/* communicate and possibly report to devman */
+	assert(port->attached_device == 0);
+
+	ret = usb_drv_register_child_in_devman(port->hc_phone, port->hc, usb_address,
+		&port->attached_device);
+
+	if (ret != EOK) { /* something went wrong */
+		uhci_print_error("Failed(%d) in usb_drv_register_child.\n", ret);
+		uhci_port_set_enabled(port, false);
+		return ENOMEM;
+	}
+	uhci_print_info("Sucessfully added device on port(%d) address(%d).\n",
+		port->number, usb_address);
+
+	/* TODO: bind the address here */
+
+	return EOK;
+}
+/*----------------------------------------------------------------------------*/
+static int uhci_port_remove_device(uhci_port_t *port)
+{
+	uhci_print_error("Don't know how to remove device %#x.\n",
+		(unsigned int)port->attached_device);
+	uhci_port_set_enabled(port, false);
+	return EOK;
+}
+/*----------------------------------------------------------------------------*/
+static int uhci_port_set_enabled(uhci_port_t *port, bool enabled)
+{
+	assert(port);
+
+	/* read register value */
+	port_status_t port_status
+		= port_status_read(port->address);
+
+	/* enable port: register write */
+	if (enabled) {
+		port_status |= STATUS_ENABLED;
+	} else {
+		port_status &= ~STATUS_ENABLED;
+	}
+	port_status_write(port->address, port_status);
+
+	uhci_print_info("%s port %d.\n",
+	  enabled ? "Enabled" : "Disabled", port->number);
+	return EOK;
+}
+/*----------------------------------------------------------------------------*/
Index: uspace/drv/uhci-hcd/root_hub/port.h
===================================================================
--- uspace/drv/uhci-hcd/root_hub/port.h	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
+++ uspace/drv/uhci-hcd/root_hub/port.h	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2010 Jan Vesely
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/** @addtogroup usb
+ * @{
+ */
+/** @file
+ * @brief UHCI port driver
+ */
+#ifndef DRV_UHCI_PORT_H
+#define DRV_UHCI_PORT_H
+
+#include <assert.h>
+#include <driver.h> /* device_t */
+#include <stdint.h>
+
+#include "port_status.h"
+
+typedef struct uhci_port
+{
+	port_status_t *address;
+	device_t *hc;
+	unsigned number;
+	unsigned wait_period_usec;
+	int hc_phone;
+	devman_handle_t attached_device;
+} uhci_port_t;
+
+static inline void uhci_port_init(
+  uhci_port_t *port, port_status_t *address, device_t *hc, unsigned number,
+  unsigned usec)
+{
+	assert(port);
+	port->address = address;
+	port->hc = hc;
+	port->number = number;
+	port->hc_phone = -1;
+	port->wait_period_usec = usec;
+	port->attached_device = 0;
+}
+
+int uhci_port_check(void *port);
+#endif
+/**
+ * @}
+ */
Index: uspace/drv/uhci-hcd/root_hub/port_status.c
===================================================================
--- uspace/drv/uhci-hcd/root_hub/port_status.c	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
+++ uspace/drv/uhci-hcd/root_hub/port_status.c	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
@@ -0,0 +1,35 @@
+#include <assert.h>
+#include <stdio.h>
+
+#include "debug.h"
+#include "port_status.h"
+
+struct flag_name
+{
+	unsigned flag;
+	const char *name;
+};
+
+static const struct flag_name flags[] =
+{
+	{ STATUS_SUSPEND, "suspended" },
+	{ STATUS_IN_RESET, "in reset" },
+	{ STATUS_LOW_SPEED, "low speed device" },
+	{ STATUS_ALWAYS_ONE, "always 1 bit" },
+	{ STATUS_RESUME, "resume" },
+	{ STATUS_LINE_D_MINUS, "line D- value" },
+	{ STATUS_LINE_D_PLUS, "line D+ value" },
+	{ STATUS_ENABLED_CHANGED, "enabled changed" },
+	{ STATUS_ENABLED, "enabled" },
+	{ STATUS_CONNECTED_CHANGED, "connected changed" },
+	{ STATUS_CONNECTED, "connected" }
+};
+
+void print_port_status(port_status_t value)
+{
+	unsigned i = 0;
+	for (;i < sizeof(flags)/sizeof(struct flag_name); ++i) {
+		uhci_print_verbose("\t%s status: %s.\n", flags[i].name,
+		  value & flags[i].flag ? "YES" : "NO");
+	}
+}
Index: uspace/drv/uhci-hcd/root_hub/port_status.h
===================================================================
--- uspace/drv/uhci-hcd/root_hub/port_status.h	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
+++ uspace/drv/uhci-hcd/root_hub/port_status.h	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2010 Jan Vesely
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/** @addtogroup usb
+ * @{
+ */
+/** @file
+ * @brief UHCI driver
+ */
+#ifndef DRV_UHCI_TD_PORT_STATUS_H
+#define DRV_UHCI_TD_PORT_STATUS_H
+
+#include <libarch/ddi.h>
+#include <stdint.h>
+
+typedef uint16_t port_status_t;
+
+enum {
+	STATUS_CONNECTED         = 1 << 0,
+	STATUS_CONNECTED_CHANGED = 1 << 1,
+	STATUS_ENABLED           = 1 << 2,
+	STATUS_ENABLED_CHANGED   = 1 << 3,
+	STATUS_LINE_D_PLUS       = 1 << 4,
+	STATUS_LINE_D_MINUS      = 1 << 5,
+	STATUS_RESUME            = 1 << 6,
+	STATUS_ALWAYS_ONE        = 1 << 7,
+
+	STATUS_LOW_SPEED = 1 <<  8,
+	STATUS_IN_RESET  = 1 <<  9,
+	STATUS_SUSPEND   = 1 << 12,
+};
+
+static inline port_status_t port_status_read(port_status_t * address)
+	{ return pio_read_16(address); }
+
+static inline void port_status_write(
+  port_status_t * address, port_status_t value)
+	{ pio_write_16(address, value); }
+
+void print_port_status(const port_status_t status);
+#endif
+/**
+ * @}
+ */
Index: uspace/drv/uhci-hcd/root_hub/root_hub.c
===================================================================
--- uspace/drv/uhci-hcd/root_hub/root_hub.c	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
+++ uspace/drv/uhci-hcd/root_hub/root_hub.c	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
@@ -0,0 +1,53 @@
+#include <async.h>
+#include <ddi.h>
+#include <errno.h>
+#include <stdint.h>
+#include <stdio.h>
+
+#include "debug.h"
+#include "root_hub.h"
+
+
+int uhci_root_hub_init( uhci_root_hub_t *hub, device_t *hc, void *addr )
+{
+	assert(hub);
+	usb_dprintf_enable(NAME, DEBUG_LEVEL_INFO);
+
+	/* allow access to root hub registers */
+	port_status_t *regs;
+	const int ret = pio_enable(
+	  addr, sizeof(port_status_t) * UHCI_ROOT_HUB_PORT_COUNT, (void**)&regs);
+
+	if (ret < 0) {
+		uhci_print_error(": Failed to gain access to port registers at %p\n", regs);
+		return ret;
+	}
+
+	/* add fibrils for periodic port checks */
+	unsigned i = 0;
+	for (; i < UHCI_ROOT_HUB_PORT_COUNT; ++i) {
+		/* mind pointer arithmetics */
+		uhci_port_init(
+		  &hub->ports[i], regs + i, hc, i, ROOT_HUB_WAIT_USEC);
+
+		hub->checker[i] = fibril_create(uhci_port_check, &hub->ports[i]);
+		if (hub->checker[i] == 0) {
+			uhci_print_error(": failed to launch root hub fibril.");
+			return ENOMEM;
+		}
+		fibril_add_ready(hub->checker[i]);
+		uhci_print_verbose(" added fibril for port %d: %p.\n", i, hub->checker[i]);
+	}
+
+	return EOK;
+}
+/*----------------------------------------------------------------------------*/
+int uhci_root_hub_fini( uhci_root_hub_t* instance )
+{
+	assert( instance );
+	// TODO:
+	//destroy fibril here
+	//disable access to registers
+	return EOK;
+}
+/*----------------------------------------------------------------------------*/
Index: uspace/drv/uhci-hcd/root_hub/root_hub.h
===================================================================
--- uspace/drv/uhci-hcd/root_hub/root_hub.h	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
+++ uspace/drv/uhci-hcd/root_hub/root_hub.h	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2010 Jan Vesely
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/** @addtogroup usb
+ * @{
+ */
+/** @file
+ * @brief UHCI driver
+ */
+#ifndef DRV_UHCI_ROOT_HUB_H
+#define DRV_UHCI_ROOT_HUB_H
+
+#include <fibril.h>
+#include <driver.h> /* for device_t */
+
+#include "port.h"
+
+#define UHCI_ROOT_HUB_PORT_COUNT 2
+#define UHCI_ROOT_HUB_PORT_REGISTERS_OFFSET 0x10
+#define ROOT_HUB_WAIT_USEC 10000000 /* 10 seconds */
+
+typedef struct root_hub {
+	uhci_port_t ports[UHCI_ROOT_HUB_PORT_COUNT];
+	fid_t checker[UHCI_ROOT_HUB_PORT_COUNT];
+} uhci_root_hub_t;
+
+int uhci_root_hub_init(
+  uhci_root_hub_t *instance, device_t *device, void *addr);
+
+int uhci_root_hub_fini(uhci_root_hub_t* instance);
+#endif
+/**
+ * @}
+ */
Index: uspace/drv/uhci-hcd/transfer_list.c
===================================================================
--- uspace/drv/uhci-hcd/transfer_list.c	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
+++ uspace/drv/uhci-hcd/transfer_list.c	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
@@ -0,0 +1,51 @@
+#include <errno.h>
+
+#include "transfer_list.h"
+
+int transfer_list_init(transfer_list_t *instance, transfer_list_t *next)
+{
+	assert(instance);
+	instance->first = NULL;
+	instance->last = NULL;
+	instance->queue_head = malloc32(sizeof(queue_head_t));
+	if (!instance->queue_head) {
+		uhci_print_error("Failed to allocate queue head.\n");
+		return ENOMEM;
+	}
+	instance->queue_head_pa = (uintptr_t)addr_to_phys(instance->queue_head);
+
+	uint32_t next_pa = next ? next->queue_head_pa : 0;
+	queue_head_init(instance->queue_head, next_pa);
+	return EOK;
+}
+/*----------------------------------------------------------------------------*/
+int transfer_list_append(
+  transfer_list_t *instance, transfer_descriptor_t *transfer)
+{
+	assert(instance);
+	assert(transfer);
+
+	uint32_t pa = (uintptr_t)addr_to_phys(transfer);
+	assert((pa & LINK_POINTER_ADDRESS_MASK) == pa);
+
+	/* empty list */
+	if (instance->first == NULL) {
+		assert(instance->last == NULL);
+		instance->first = instance->last = transfer;
+	} else {
+		assert(instance->last);
+		instance->last->next_va = transfer;
+
+		assert(instance->last->next & LINK_POINTER_TERMINATE_FLAG);
+		instance->last->next = (pa & LINK_POINTER_ADDRESS_MASK);
+		instance->last = transfer;
+	}
+
+	assert(instance->queue_head);
+	if (instance->queue_head->element & LINK_POINTER_TERMINATE_FLAG) {
+		instance->queue_head->element = (pa & LINK_POINTER_ADDRESS_MASK);
+	}
+	uhci_print_verbose("Successfully added transfer to the hc queue %p.\n",
+	  instance);
+	return EOK;
+}
Index: uspace/drv/uhci-hcd/transfer_list.h
===================================================================
--- uspace/drv/uhci-hcd/transfer_list.h	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
+++ uspace/drv/uhci-hcd/transfer_list.h	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2010 Jan Vesely
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/** @addtogroup usb
+ * @{
+ */
+/** @file
+ * @brief UHCI driver
+ */
+#ifndef DRV_UHCI_TRANSFER_LIST_H
+#define DRV_UHCI_TRANSFER_LIST_H
+
+#include "debug.h"
+#include "uhci_struct/queue_head.h"
+#include "uhci_struct/transfer_descriptor.h"
+#include "utils/malloc32.h"
+
+typedef struct transfer_list
+{
+	transfer_descriptor_t *first;
+	transfer_descriptor_t *last;
+	queue_head_t *queue_head;
+	uint32_t queue_head_pa;
+} transfer_list_t;
+
+int transfer_list_init(transfer_list_t *instance, transfer_list_t *next);
+
+static inline void transfer_list_fini(transfer_list_t *instance)
+{
+	assert(instance);
+	if (instance->queue_head)
+		free32(instance->queue_head);
+}
+
+int transfer_list_append(
+  transfer_list_t *instance, transfer_descriptor_t *transfer);
+
+#endif
+/**
+ * @}
+ */
Index: uspace/drv/uhci-hcd/uhci-hcd.ma
===================================================================
--- uspace/drv/uhci-hcd/uhci-hcd.ma	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
+++ uspace/drv/uhci-hcd/uhci-hcd.ma	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
@@ -0,0 +1,2 @@
+10 pci/ven=8086&dev=7020
+
Index: uspace/drv/uhci-hcd/uhci.c
===================================================================
--- uspace/drv/uhci-hcd/uhci.c	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
+++ uspace/drv/uhci-hcd/uhci.c	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
@@ -0,0 +1,256 @@
+#include <errno.h>
+#include <usb/debug.h>
+#include <usb/usb.h>
+
+#include "utils/malloc32.h"
+
+#include "debug.h"
+#include "name.h"
+#include "uhci.h"
+
+static int uhci_init_transfer_lists(transfer_list_t list[]);
+static int uhci_clean_finished(void *arg);
+static int uhci_debug_checker(void *arg);
+
+int uhci_init(device_t *device, void *regs, size_t reg_size)
+{
+	assert(device);
+	uhci_print_info("Initializing device at address %p.\n", device);
+
+#define CHECK_RET_FREE_INSTANCE(message...) \
+	if (ret != EOK) { \
+		uhci_print_error(message); \
+		if (instance) { \
+			free(instance); \
+		} \
+		return ret; \
+	} else (void) 0
+
+	/* create instance */
+	uhci_t *instance = malloc(sizeof(uhci_t));
+	int ret = instance ? EOK : ENOMEM;
+	CHECK_RET_FREE_INSTANCE("Failed to allocate uhci driver instance.\n");
+
+	bzero(instance, sizeof(uhci_t));
+
+	/* init address keeper(libusb) */
+	usb_address_keeping_init(&instance->address_manager, USB11_ADDRESS_MAX);
+	uhci_print_verbose("Initialized address manager.\n");
+
+	/* allow access to hc control registers */
+	regs_t *io;
+	assert(reg_size >= sizeof(regs_t));
+	ret = pio_enable(regs, reg_size, (void**)&io);
+	CHECK_RET_FREE_INSTANCE("Failed to gain access to registers at %p.\n", io);
+	instance->registers = io;
+	uhci_print_verbose("Device registers accessible.\n");
+
+	/* init transfer lists */
+	ret = uhci_init_transfer_lists(instance->transfers);
+	CHECK_RET_FREE_INSTANCE("Failed to initialize transfer lists.\n");
+	uhci_print_verbose("Transfer lists initialized.\n");
+
+	/* init root hub */
+	ret = uhci_root_hub_init(&instance->root_hub, device,
+	  (char*)regs + UHCI_ROOT_HUB_PORT_REGISTERS_OFFSET);
+	CHECK_RET_FREE_INSTANCE("Failed to initialize root hub driver.\n");
+
+	uhci_print_verbose("Initializing frame list.\n");
+	instance->frame_list = get_page();
+//	  memalign32(sizeof(link_pointer_t) * UHCI_FRAME_LIST_COUNT, 4096);
+	if (instance->frame_list == NULL) {
+		uhci_print_error("Failed to allocate frame list pointer.\n");
+		uhci_root_hub_fini(&instance->root_hub);
+		free(instance);
+		return ENOMEM;
+	}
+
+	/* initialize all frames to point to the first queue head */
+	unsigned i = 0;
+	const uint32_t queue =
+	  instance->transfers[USB_TRANSFER_INTERRUPT].queue_head_pa
+	  | LINK_POINTER_QUEUE_HEAD_FLAG;
+	for(; i < UHCI_FRAME_LIST_COUNT; ++i) {
+		instance->frame_list[i] = queue;
+	}
+
+	const uintptr_t pa = (uintptr_t)addr_to_phys(instance->frame_list);
+
+	pio_write_32(&instance->registers->flbaseadd, (uint32_t)pa);
+
+	instance->cleaner = fibril_create(uhci_clean_finished, instance);
+	fibril_add_ready(instance->cleaner);
+
+	instance->debug_checker = fibril_create(uhci_debug_checker, instance);
+	fibril_add_ready(instance->debug_checker);
+
+	uhci_print_verbose("Starting UHCI HC.\n");
+	pio_write_16(&instance->registers->usbcmd, UHCI_CMD_RUN_STOP);
+/*
+	uint16_t cmd = pio_read_16(&instance->registers->usbcmd);
+	cmd |= UHCI_CMD_DEBUG;
+	pio_write_16(&instance->registers->usbcmd, cmd);
+*/
+	device->driver_data = instance;
+	return EOK;
+}
+/*----------------------------------------------------------------------------*/
+int uhci_init_transfer_lists(transfer_list_t transfers[])
+{
+	//TODO:refactor
+	transfers[USB_TRANSFER_ISOCHRONOUS].first = NULL;
+	transfers[USB_TRANSFER_ISOCHRONOUS].last = NULL;
+
+	int ret;
+	ret = transfer_list_init(&transfers[USB_TRANSFER_BULK], NULL);
+	if (ret != EOK) {
+		uhci_print_error("Failed to initialize bulk queue.\n");
+		return ret;
+	}
+
+	ret = transfer_list_init(
+	  &transfers[USB_TRANSFER_CONTROL], &transfers[USB_TRANSFER_BULK]);
+	if (ret != EOK) {
+		uhci_print_error("Failed to initialize control queue.\n");
+		transfer_list_fini(&transfers[USB_TRANSFER_BULK]);
+		return ret;
+	}
+
+	ret = transfer_list_init(
+	  &transfers[USB_TRANSFER_INTERRUPT], &transfers[USB_TRANSFER_CONTROL]);
+	if (ret != EOK) {
+		uhci_print_error("Failed to initialize interrupt queue.\n");
+		transfer_list_fini(&transfers[USB_TRANSFER_CONTROL]);
+		transfer_list_fini(&transfers[USB_TRANSFER_BULK]);
+		return ret;
+	}
+
+	return EOK;
+}
+/*----------------------------------------------------------------------------*/
+int uhci_transfer(
+  device_t *dev,
+  usb_target_t target,
+  usb_transfer_type_t transfer_type,
+	bool toggle,
+  usb_packet_id pid,
+  void *buffer, size_t size,
+  usbhc_iface_transfer_out_callback_t callback_out,
+  usbhc_iface_transfer_in_callback_t callback_in,
+  void *arg )
+{
+	// TODO: Add support for isochronous transfers
+	if (transfer_type == USB_TRANSFER_ISOCHRONOUS)
+		return ENOTSUP;
+
+	if (size >= 1024)
+		return ENOTSUP;
+
+	transfer_descriptor_t *td = NULL;
+	callback_t *job = NULL;
+	int ret = EOK;
+
+#define CHECK_RET_TRANS_FREE_JOB_TD(message) \
+	if (ret != EOK) { \
+		uhci_print_error(message); \
+		if (job) { \
+			callback_dispose(job); \
+		} \
+		if (td) { free32(td); } \
+		return ret; \
+	} else (void) 0
+
+
+	job = callback_get(dev, buffer, size, callback_in, callback_out, arg);
+	ret = job ? EOK : ENOMEM;
+	CHECK_RET_TRANS_FREE_JOB_TD("Failed to allocate callback structure.\n");
+
+	td = transfer_descriptor_get(3, size, false, target, pid, job->new_buffer);
+	ret = td ? EOK : ENOMEM;
+	CHECK_RET_TRANS_FREE_JOB_TD("Failed to setup transfer descriptor.\n");
+
+	td->callback = job;
+
+	assert(dev);
+	uhci_t *instance = (uhci_t*)dev->driver_data;
+	assert(instance);
+
+	uhci_print_verbose("Appending a new transfer to queue.\n");
+	ret = transfer_list_append(&instance->transfers[transfer_type], td);
+	CHECK_RET_TRANS_FREE_JOB_TD("Failed to append transfer descriptor.\n");
+
+	return EOK;
+}
+/*---------------------------------------------------------------------------*/
+int uhci_clean_finished(void* arg)
+{
+	uhci_print_verbose("Started cleaning fibril.\n");
+	uhci_t *instance = (uhci_t*)arg;
+	assert(instance);
+
+	while(1) {
+		uhci_print_verbose("Running cleaning fibril on: %p.\n", instance);
+		/* iterate all transfer queues */
+		int i = 0;
+		for (; i < TRANSFER_QUEUES; ++i) {
+			/* Remove inactive transfers from the top of the queue
+			 * TODO: should I reach queue head or is this enough? */
+			volatile transfer_descriptor_t * it =
+				instance->transfers[i].first;
+			uhci_print_verbose("Running cleaning fibril on queue: %p (%s).\n",
+				&instance->transfers[i], it ? "SOMETHING" : "EMPTY");
+
+		if (it)
+			uhci_print_verbose("First in queue: %p (%x).\n",
+				it, it->status);
+
+			while (instance->transfers[i].first &&
+			 !(instance->transfers[i].first->status & TD_STATUS_ERROR_ACTIVE)) {
+				transfer_descriptor_t *transfer = instance->transfers[i].first;
+				uhci_print_info("Inactive transfer calling callback with status %x.\n",
+				  transfer->status);
+				instance->transfers[i].first = transfer->next_va;
+				transfer_descriptor_dispose(transfer);
+			}
+			if (!instance->transfers[i].first)
+				instance->transfers[i].last = instance->transfers[i].first;
+		}
+		async_usleep(UHCI_CLEANER_TIMEOUT);
+	}
+	return EOK;
+}
+/*---------------------------------------------------------------------------*/
+int uhci_debug_checker(void *arg)
+{
+	uhci_t *instance = (uhci_t*)arg;
+	assert(instance);
+	while (1) {
+		uint16_t cmd = pio_read_16(&instance->registers->usbcmd);
+		uint16_t sts = pio_read_16(&instance->registers->usbsts);
+		uhci_print_verbose("Command register: %X Status register: %X\n", cmd, sts);
+/*
+		uintptr_t frame_list = pio_read_32(&instance->registers->flbaseadd);
+		uhci_print_verbose("Framelist address: %p vs. %p.\n",
+			frame_list, addr_to_phys(instance->frame_list));
+		int frnum = pio_read_16(&instance->registers->frnum) & 0x3ff;
+		uhci_print_verbose("Framelist item: %d \n", frnum );
+
+		queue_head_t* qh = instance->transfers[USB_TRANSFER_INTERRUPT].queue_head;
+		uhci_print_verbose("Interrupt QH: %p vs. %p.\n",
+			instance->frame_list[frnum], addr_to_phys(qh));
+
+		uhci_print_verbose("Control QH: %p vs. %p.\n", qh->next_queue,
+			addr_to_phys(instance->transfers[USB_TRANSFER_CONTROL].queue_head));
+		qh = instance->transfers[USB_TRANSFER_CONTROL].queue_head;
+
+		uhci_print_verbose("Bulk QH: %p vs. %p.\n", qh->next_queue,
+			addr_to_phys(instance->transfers[USB_TRANSFER_BULK].queue_head));
+	uint16_t cmd = pio_read_16(&instance->registers->usbcmd);
+	cmd |= UHCI_CMD_RUN_STOP;
+	pio_write_16(&instance->registers->usbcmd, cmd);
+*/
+
+		async_usleep(UHCI_DEBUGER_TIMEOUT);
+	}
+	return 0;
+}
Index: uspace/drv/uhci-hcd/uhci.h
===================================================================
--- uspace/drv/uhci-hcd/uhci.h	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
+++ uspace/drv/uhci-hcd/uhci.h	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2010 Jan Vesely
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup drvusbuhci
+ * @{
+ */
+/** @file
+ * @brief UHCI driver
+ */
+#ifndef DRV_UHCI_UHCI_H
+#define DRV_UHCI_UHCI_H
+
+#include <fibril.h>
+
+#include <usb/addrkeep.h>
+#include <usbhc_iface.h>
+
+#include "root_hub/root_hub.h"
+#include "transfer_list.h"
+
+typedef struct uhci_regs {
+	uint16_t usbcmd;
+#define UHCI_CMD_MAX_PACKET (1 << 7)
+#define UHCI_CMD_CONFIGURE  (1 << 6)
+#define UHCI_CMD_DEBUG  (1 << 5)
+#define UHCI_CMD_FORCE_GLOBAL_RESUME  (1 << 4)
+#define UHCI_CMD_FORCE_GLOBAL_SUSPEND  (1 << 3)
+#define UHCI_CMD_GLOBAL_RESET  (1 << 2)
+#define UHCI_CMD_HCRESET  (1 << 1)
+#define UHCI_CMD_RUN_STOP  (1 << 0)
+
+	uint16_t usbsts;
+#define UHCI_STATUS_HALTED (1 << 5)
+#define UHCI_STATUS_PROCESS_ERROR (1 << 4)
+#define UHCI_STATUS_SYSTEM_ERROR (1 << 3)
+#define UHCI_STATUS_RESUME (1 << 2)
+#define UHCI_STATUS_ERROR_INTERRUPT (1 << 1)
+#define UHCI_STATUS_INTERRUPT (1 << 0)
+
+	uint16_t usbintr;
+	uint16_t frnum;
+	uint32_t flbaseadd;
+	uint8_t sofmod;
+} regs_t;
+
+#define TRANSFER_QUEUES 4
+#define UHCI_FRAME_LIST_COUNT 1024
+#define UHCI_CLEANER_TIMEOUT 1000000
+#define UHCI_DEBUGER_TIMEOUT 500000
+
+typedef struct uhci {
+	usb_address_keeping_t address_manager;
+	uhci_root_hub_t root_hub;
+	volatile regs_t *registers;
+
+	link_pointer_t *frame_list;
+
+	transfer_list_t transfers[TRANSFER_QUEUES];
+	fid_t cleaner;
+	fid_t debug_checker;
+} uhci_t;
+
+/* init uhci specifics in device.driver_data */
+int uhci_init( device_t *device, void *regs, size_t reg_size );
+
+int uhci_destroy( device_t *device );
+
+int uhci_transfer(
+  device_t *dev,
+  usb_target_t target,
+  usb_transfer_type_t transfer_type,
+	bool toggle,
+  usb_packet_id pid,
+  void *buffer, size_t size,
+  usbhc_iface_transfer_out_callback_t callback_out,
+  usbhc_iface_transfer_in_callback_t callback_in,
+  void *arg );
+
+int pci_get_my_registers(device_t *, uintptr_t *, size_t *, int *);
+
+#endif
+/**
+ * @}
+ */
Index: uspace/drv/uhci-hcd/uhci_struct/link_pointer.h
===================================================================
--- uspace/drv/uhci-hcd/uhci_struct/link_pointer.h	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
+++ uspace/drv/uhci-hcd/uhci_struct/link_pointer.h	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2010 Jan Vesely
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/** @addtogroup usb
+ * @{
+ */
+/** @file
+ * @brief UHCI driver
+ */
+#ifndef DRV_UHCI_LINK_POINTER_H
+#define DRV_UHCI_LINK_POINTER_H
+
+/* UHCI link pointer, used by many data structures */
+typedef uint32_t link_pointer_t;
+
+#define LINK_POINTER_TERMINATE_FLAG (1 << 0)
+#define LINK_POINTER_QUEUE_HEAD_FLAG (1 << 1)
+#define LINK_POINTER_ZERO_BIT_FLAG (1 << 2)
+#define LINK_POINTER_VERTICAL_FLAG (1 << 2)
+#define LINK_POINTER_RESERVED_FLAG (1 << 3)
+
+#define LINK_POINTER_ADDRESS_MASK 0xfffffff0 /* upper 28 bits */
+
+#endif
+/**
+ * @}
+ */
+
Index: uspace/drv/uhci-hcd/uhci_struct/queue_head.h
===================================================================
--- uspace/drv/uhci-hcd/uhci_struct/queue_head.h	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
+++ uspace/drv/uhci-hcd/uhci_struct/queue_head.h	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
@@ -0,0 +1,64 @@
+
+/*
+ * Copyright (c) 2010 Jan Vesely
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/** @addtogroup usb
+ * @{
+ */
+/** @file
+ * @brief UHCI driver
+ */
+#ifndef DRV_UHCI_QH_H
+#define DRV_UHCI_QH_H
+
+#include <assert.h>
+
+#include "link_pointer.h"
+
+typedef struct queue_head {
+	link_pointer_t next_queue;
+	link_pointer_t element;
+} __attribute__((packed)) queue_head_t;
+
+static inline void queue_head_init(queue_head_t *instance, uint32_t next_queue_pa)
+{
+	assert(instance);
+	assert((next_queue_pa & LINK_POINTER_ADDRESS_MASK) == next_queue_pa);
+
+	instance->element = 0 | LINK_POINTER_TERMINATE_FLAG;
+	if (next_queue_pa) {
+		instance->next_queue = (next_queue_pa & LINK_POINTER_ADDRESS_MASK)
+		  | LINK_POINTER_QUEUE_HEAD_FLAG;
+	} else {
+		instance->next_queue = 0 | LINK_POINTER_TERMINATE_FLAG;
+	}
+}
+
+#endif
+/**
+ * @}
+ */
Index: uspace/drv/uhci-hcd/uhci_struct/transfer_descriptor.c
===================================================================
--- uspace/drv/uhci-hcd/uhci_struct/transfer_descriptor.c	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
+++ uspace/drv/uhci-hcd/uhci_struct/transfer_descriptor.c	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
@@ -0,0 +1,85 @@
+#include "transfer_descriptor.h"
+
+void transfer_descriptor_init(transfer_descriptor_t *instance,
+  int error_count, size_t size, bool isochronous, usb_target_t target,
+	int pid, void *buffer)
+{
+	assert(instance);
+
+	instance->next =
+	  0 | LINK_POINTER_TERMINATE_FLAG;
+
+
+	assert(size < 1024);
+	instance->status = 0
+	  | ((error_count & TD_STATUS_ERROR_COUNT_MASK) << TD_STATUS_ERROR_COUNT_POS)
+	  | TD_STATUS_ERROR_ACTIVE;
+
+	instance->device = 0
+		| (((size - 1) & TD_DEVICE_MAXLEN_MASK) << TD_DEVICE_MAXLEN_POS)
+		| ((target.address & TD_DEVICE_ADDRESS_MASK) << TD_DEVICE_ADDRESS_POS)
+		| ((target.endpoint & TD_DEVICE_ENDPOINT_MASK) << TD_DEVICE_ENDPOINT_POS)
+		| ((pid & TD_DEVICE_PID_MASK) << TD_DEVICE_PID_POS);
+
+	instance->buffer_ptr = 0;
+
+	instance->next_va = NULL;
+	instance->callback = NULL;
+
+	if (size) {
+		instance->buffer_ptr = (uintptr_t)addr_to_phys(buffer);
+	}
+
+	uhci_print_info("Created TD: %X:%X:%X:%X(%p).\n",
+		instance->next, instance->status, instance->device,
+	  instance->buffer_ptr, buffer);
+#if 0
+	if (size) {
+		unsigned char * buff = buffer;
+		uhci_print_verbose("TD Buffer dump(%p-%dB): ", buffer, size);
+		unsigned i = 0;
+		/* TODO: Verbose? */
+		for (; i < size; ++i) {
+			printf((i & 1) ? "%x " : "%x", buff[i]);
+		}
+		printf("\n");
+	}
+#endif
+}
+
+static inline usb_transaction_outcome_t convert_outcome(uint32_t status)
+{
+	/*TODO: refactor into something sane */
+	/*TODO: add additional usb_errors to usb_outcome_t */
+
+	if (status & TD_STATUS_ERROR_STALLED)
+		return USB_OUTCOME_CRCERROR;
+
+	if (status & TD_STATUS_ERROR_BUFFER)
+		return USB_OUTCOME_CRCERROR;
+
+	if (status & TD_STATUS_ERROR_BABBLE)
+		return USB_OUTCOME_BABBLE;
+
+	if (status & TD_STATUS_ERROR_NAK)
+		return USB_OUTCOME_CRCERROR;
+
+  if (status & TD_STATUS_ERROR_CRC)
+		return USB_OUTCOME_CRCERROR;
+
+	if (status & TD_STATUS_ERROR_BIT_STUFF)
+		return USB_OUTCOME_CRCERROR;
+
+	assert((((status >> TD_STATUS_ERROR_POS) & TD_STATUS_ERROR_MASK)
+	| TD_STATUS_ERROR_RESERVED) == TD_STATUS_ERROR_RESERVED);
+	return USB_OUTCOME_OK;
+}
+
+void transfer_descriptor_fini(transfer_descriptor_t *instance)
+{
+	assert(instance);
+	callback_run(instance->callback,
+		convert_outcome(instance->status),
+		((instance->status >> TD_STATUS_ACTLEN_POS) + 1) & TD_STATUS_ACTLEN_MASK
+	);
+}
Index: uspace/drv/uhci-hcd/uhci_struct/transfer_descriptor.h
===================================================================
--- uspace/drv/uhci-hcd/uhci_struct/transfer_descriptor.h	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
+++ uspace/drv/uhci-hcd/uhci_struct/transfer_descriptor.h	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2010 Jan Vesely
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/** @addtogroup usb
+ * @{
+ */
+/** @file
+ * @brief UHCI driver
+ */
+#ifndef DRV_UHCI_TRANSFER_DESCRIPTOR_H
+#define DRV_UHCI_TRANSFER_DESCRIPTOR_H
+
+#include <mem.h>
+#include <usb/usb.h>
+
+#include "utils/malloc32.h"
+#include "callback.h"
+#include "link_pointer.h"
+
+/** UHCI Transfer Descriptor */
+typedef struct transfer_descriptor {
+	link_pointer_t next;
+
+	volatile uint32_t status;
+
+#define TD_STATUS_RESERVED_MASK 0xc000f800
+#define TD_STATUS_SPD_FLAG ( 1 << 29 )
+#define TD_STATUS_ERROR_COUNT_POS ( 27 )
+#define TD_STATUS_ERROR_COUNT_MASK ( 0x3 )
+#define TD_STATUS_ERROR_COUNT_DEFAULT 3
+#define TD_STATUS_LOW_SPEED_FLAG ( 1 << 26 )
+#define TD_STATUS_ISOCHRONOUS_FLAG ( 1 << 25 )
+#define TD_STATUS_COMPLETE_INTERRUPT_FLAG ( 1 << 24 )
+
+#define TD_STATUS_ERROR_ACTIVE ( 1 << 23 )
+#define TD_STATUS_ERROR_STALLED ( 1 << 22 )
+#define TD_STATUS_ERROR_BUFFER ( 1 << 21 )
+#define TD_STATUS_ERROR_BABBLE ( 1 << 20 )
+#define TD_STATUS_ERROR_NAK ( 1 << 19 )
+#define TD_STATUS_ERROR_CRC ( 1 << 18 )
+#define TD_STATUS_ERROR_BIT_STUFF ( 1 << 17 )
+#define TD_STATUS_ERROR_RESERVED ( 1 << 16 )
+#define TD_STATUS_ERROR_POS 16
+#define TD_STATUS_ERROR_MASK ( 0xff )
+
+#define TD_STATUS_ACTLEN_POS 0
+#define TD_STATUS_ACTLEN_MASK 0x7ff
+
+	volatile uint32_t device;
+
+#define TD_DEVICE_MAXLEN_POS 21
+#define TD_DEVICE_MAXLEN_MASK ( 0x7ff )
+#define TD_DEVICE_RESERVED_FLAG ( 1 << 20 )
+#define TD_DEVICE_DATA_TOGGLE_ONE_FLAG ( 1 << 19 )
+#define TD_DEVICE_ENDPOINT_POS 15
+#define TD_DEVICE_ENDPOINT_MASK ( 0xf )
+#define TD_DEVICE_ADDRESS_POS 8
+#define TD_DEVICE_ADDRESS_MASK ( 0x7f )
+#define TD_DEVICE_PID_POS 0
+#define TD_DEVICE_PID_MASK ( 0xff )
+
+	volatile uint32_t buffer_ptr;
+
+	/* there is 16 bytes of data available here
+	 * those are used to store callback pointer
+	 * and next pointer. Thus, there is some free space
+	 * on 32bits systems.
+	 */
+	struct transfer_descriptor *next_va;
+	callback_t *callback;
+} __attribute__((packed)) transfer_descriptor_t;
+
+
+void transfer_descriptor_init(transfer_descriptor_t *instance,
+  int error_count, size_t size, bool isochronous, usb_target_t target,
+	int pid, void *buffer);
+
+static inline transfer_descriptor_t * transfer_descriptor_get(
+  int error_count, size_t size, bool isochronous, usb_target_t target,
+  int pid, void *buffer)
+{
+	transfer_descriptor_t * instance =
+	  malloc32(sizeof(transfer_descriptor_t));
+
+	if (instance)
+		transfer_descriptor_init(
+		  instance, error_count, size, isochronous, target, pid, buffer);
+	return instance;
+}
+
+void transfer_descriptor_fini(transfer_descriptor_t *instance);
+
+static inline void transfer_descriptor_dispose(transfer_descriptor_t *instance)
+{
+	assert(instance);
+	transfer_descriptor_fini(instance);
+	free32(instance);
+}
+
+static inline void transfer_descriptor_append(
+  transfer_descriptor_t *instance, transfer_descriptor_t *item)
+{
+	assert(instance);
+	instance->next_va = item;
+	instance->next = (uintptr_t)addr_to_phys( item ) & LINK_POINTER_ADDRESS_MASK;
+}
+#endif
+/**
+ * @}
+ */
Index: uspace/drv/uhci-hcd/utils/malloc32.h
===================================================================
--- uspace/drv/uhci-hcd/utils/malloc32.h	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
+++ uspace/drv/uhci-hcd/utils/malloc32.h	(revision 37ac7bb09e864d980b717c10059697d50baf89df)
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2010 Jan Vesely
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+/** @addtogroup usb
+ * @{
+ */
+/** @file
+ * @brief UHCI driver
+ */
+#ifndef DRV_UHCI_TRANSLATOR_H
+#define DRV_UHCI_TRANSLATOR_H
+
+#include <usb/usbmem.h>
+
+#include <assert.h>
+#include <malloc.h>
+#include <mem.h>
+#include <as.h>
+
+#define UHCI_STRCUTURES_ALIGNMENT 16
+#define UHCI_REQUIRED_PAGE_SIZE 4096
+
+static inline void * addr_to_phys(void *addr)
+{
+	uintptr_t result;
+	int ret = as_get_physical_mapping(addr, &result);
+
+	assert(ret == 0);
+	return (void*)(result | ((uintptr_t)addr & 0xfff));
+}
+
+static inline void * malloc32(size_t size)
+	{ return memalign(UHCI_STRCUTURES_ALIGNMENT, size); }
+
+static inline void * get_page()
+{
+	void * free_address = as_get_mappable_page(UHCI_REQUIRED_PAGE_SIZE);
+	assert(free_address);
+	if (free_address == 0)
+		return 0;
+	void* ret =
+	  as_area_create(free_address, UHCI_REQUIRED_PAGE_SIZE,
+		  AS_AREA_READ | AS_AREA_WRITE);
+	if (ret != free_address)
+		return 0;
+	return ret;
+}
+
+static inline void * memalign32(size_t size, size_t alignment)
+	{ return memalign(alignment, size); }
+
+static inline void free32(void * addr)
+	{ free(addr); }
+
+#endif
+/**
+ * @}
+ */
Index: pace/drv/uhci/Makefile
===================================================================
--- uspace/drv/uhci/Makefile	(revision 72e19f5092b40f5bf5640a8288771e2f8675b49e)
+++ 	(revision )
@@ -1,46 +1,0 @@
-#
-# Copyright (c) 2010 Vojtech Horky
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# - Redistributions of source code must retain the above copyright
-#   notice, this list of conditions and the following disclaimer.
-# - Redistributions in binary form must reproduce the above copyright
-#   notice, this list of conditions and the following disclaimer in the
-#   documentation and/or other materials provided with the distribution.
-# - The name of the author may not be used to endorse or promote products
-#   derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
-# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-
-USPACE_PREFIX = ../..
-LIBS = $(LIBDRV_PREFIX)/libdrv.a $(LIBUSB_PREFIX)/libusb.a
-EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include -I$(LIBUSB_PREFIX)/include -I.
-BINARY = uhci
-
-SOURCES = \
-	callback.c \
-	iface.c \
-	main.c \
-	root_hub/port.c \
-	root_hub/port_status.c \
-	root_hub/root_hub.c \
-	transfer_list.c \
-	uhci.c \
-	uhci_struct/transfer_descriptor.c \
-	pci.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: pace/drv/uhci/callback.c
===================================================================
--- uspace/drv/uhci/callback.c	(revision 72e19f5092b40f5bf5640a8288771e2f8675b49e)
+++ 	(revision )
@@ -1,60 +1,0 @@
-#include <errno.h>
-#include <mem.h>
-
-#include "callback.h"
-int callback_init(callback_t *instance, device_t *dev,
-  void *buffer, size_t size, usbhc_iface_transfer_in_callback_t func_in,
-  usbhc_iface_transfer_out_callback_t func_out, void *arg)
-{
-	assert(instance);
-	assert(func_in == NULL || func_out == NULL);
-	if (size > 0) {
-		instance->new_buffer = malloc32(size);
-		if (!instance->new_buffer) {
-			uhci_print_error("Failed to allocate device acessible buffer.\n");
-			return ENOMEM;
-		}
-		if (func_out)
-			memcpy(instance->new_buffer, buffer, size);
-	} else {
-		instance->new_buffer = NULL;
-	}
-
-
-	instance->callback_out = func_out;
-	instance->callback_in = func_in;
-	instance->old_buffer = buffer;
-	instance->buffer_size = size;
-	instance->dev = dev;
-	instance->arg = arg;
-	return EOK;
-}
-/*----------------------------------------------------------------------------*/
-void callback_run(
-callback_t *instance, usb_transaction_outcome_t outcome, size_t act_size)
-{
-	assert(instance);
-
-	/* update the old buffer */
-	if (instance->new_buffer &&
-	  (instance->new_buffer != instance->old_buffer)) {
-		memcpy(instance->old_buffer, instance->new_buffer, instance->buffer_size);
-		free32(instance->new_buffer);
-		instance->new_buffer = NULL;
-	}
-
-	if (instance->callback_in) {
-		assert(instance->callback_out == NULL);
-		uhci_print_verbose("Callback in: %p %x %d.\n",
-		  instance->callback_in, outcome, act_size);
-		instance->callback_in(
-		  instance->dev, outcome, act_size, instance->arg);
-	} else {
-		assert(instance->callback_out);
-		assert(instance->callback_in == NULL);
-		uhci_print_verbose("Callback out: %p %p %x %p .\n",
-		 instance->callback_out, instance->dev, outcome, instance->arg);
-		instance->callback_out(
-		  instance->dev, outcome, instance->arg);
-	}
-}
Index: pace/drv/uhci/callback.h
===================================================================
--- uspace/drv/uhci/callback.h	(revision 72e19f5092b40f5bf5640a8288771e2f8675b49e)
+++ 	(revision )
@@ -1,96 +1,0 @@
-/*
- * Copyright (c) 2010 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup usb
- * @{
- */
-/** @file
- * @brief UHCI driver
- */
-#ifndef DRV_UHCI_CALLBACK_H
-#define DRV_UHCI_CALLBACK_H
-
-#include <usbhc_iface.h>
-#include <usb/usb.h>
-
-#include "debug.h"
-#include "utils/malloc32.h"
-
-typedef struct callback
-{
-	usbhc_iface_transfer_in_callback_t callback_in;
-	usbhc_iface_transfer_out_callback_t callback_out;
-	void *old_buffer;
-	void *new_buffer;
-	void *arg;
-	size_t buffer_size;
-	size_t actual_size;
-	device_t *dev;
-} callback_t;
-
-
-int callback_init(callback_t *instance, device_t *dev,
-  void *buffer, size_t size, usbhc_iface_transfer_in_callback_t func_in,
-  usbhc_iface_transfer_out_callback_t func_out, void *arg);
-
-#define callback_in_init(instance, dev, buffer, size, func, arg) \
-	callback_init(instance, dev, buffer, size, func, NULL, arg)
-
-#define callback_out_init(instance, dev, buffer, size, func, arg) \
-	callback_init(instance, dev, buffer, size, func, NULL, arg)
-
-static inline callback_t *callback_get(device_t *dev,
-  void *buffer, size_t size, usbhc_iface_transfer_in_callback_t func_in,
-  usbhc_iface_transfer_out_callback_t func_out, void *arg)
-{
-	callback_t *instance = malloc(sizeof(callback_t));
-	if (callback_init(instance, dev, buffer, size, func_in, func_out, arg)) {
-		free(instance);
-		instance = NULL;
-	}
-	return instance;
-}
-
-static inline void callback_fini(callback_t *instance)
-{
-	assert(instance);
-	if (instance->new_buffer)
-		free32(instance->new_buffer);
-}
-
-static inline void callback_dispose(callback_t *instance)
-{
-	callback_fini(instance);
-	free(instance);
-}
-
-void callback_run(
-  callback_t *instance, usb_transaction_outcome_t outcome, size_t act_size);
-#endif
-/**
- * @}
- */
Index: pace/drv/uhci/debug.h
===================================================================
--- uspace/drv/uhci/debug.h	(revision 72e19f5092b40f5bf5640a8288771e2f8675b49e)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/*
- * Copyright (c) 2010 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup usb
- * @{
- */
-/** @file
- * @brief UHCI driver
- */
-#ifndef DRV_UHCI_DEBUG_H
-#define DRV_UHCI_DEBUG_H
-
-#include <stdio.h>
-#include <usb/debug.h>
-
-#include "name.h"
-
-enum debug_levels {
-	DEBUG_LEVEL_FATAL_ERROR = 1,
-	DEBUG_LEVEL_ERROR = 2,
-	DEBUG_LEVEL_WARNING = 3,
-	DEBUG_LEVEL_INFO = 4,
-	DEBUG_LEVEL_VERBOSE = 5,
-	DEBUG_LEVEL_MAX = DEBUG_LEVEL_VERBOSE
-};
-
-#define uhci_printf( level, fmt, args...) \
-	usb_dprintf(NAME, level, fmt, ##args)
-
-#define uhci_print_fatal( fmt, args... ) \
-	fprintf(stderr, "[" NAME ":FATAL ERROR]: " fmt, ##args)
-
-#define uhci_print_error( fmt, args... ) \
-	fprintf(stderr, "[" NAME ":ERROR]: " fmt, ##args)
-
-#define uhci_print_warning( fmt, args... ) \
-	usb_dprintf( NAME, DEBUG_LEVEL_WARNING, fmt, ##args )
-
-#define uhci_print_info( fmt, args... ) \
-	usb_dprintf( NAME, DEBUG_LEVEL_INFO, fmt, ##args )
-
-#define uhci_print_verbose( fmt, args... ) \
-	usb_dprintf( NAME, DEBUG_LEVEL_VERBOSE, fmt, ##args )
-
-#endif
-/**
- * @}
- */
Index: pace/drv/uhci/iface.c
===================================================================
--- uspace/drv/uhci/iface.c	(revision 72e19f5092b40f5bf5640a8288771e2f8675b49e)
+++ 	(revision )
@@ -1,177 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include <driver.h>
-#include <remote_usbhc.h>
-#include <errno.h>
-
-#include "iface.h"
-#include "uhci.h"
-
-static int get_address(device_t *dev, devman_handle_t handle,
-    usb_address_t *address)
-{
-	assert(dev);
-	uhci_t *hc = (uhci_t *)dev->driver_data;
-	assert(hc);
-	*address = usb_address_keeping_find(&hc->address_manager, handle);
-	if (*address <= 0)
-	  return *address;
-	return EOK;
-}
-/*----------------------------------------------------------------------------*/
-static int reserve_default_address(device_t *dev)
-{
-	assert(dev);
-	uhci_t *hc = (uhci_t *)dev->driver_data;
-	assert(hc);
-	usb_address_keeping_reserve_default(&hc->address_manager);
-	return EOK;
-}
-/*----------------------------------------------------------------------------*/
-static int release_default_address(device_t *dev)
-{
-	assert(dev);
-	uhci_t *hc = (uhci_t *)dev->driver_data;
-	assert(hc);
-	usb_address_keeping_release_default(&hc->address_manager);
-	return EOK;
-}
-/*----------------------------------------------------------------------------*/
-static int request_address(device_t *dev, usb_address_t *address)
-{
-	assert(dev);
-	uhci_t *hc = (uhci_t *)dev->driver_data;
-	assert(hc);
-	*address = usb_address_keeping_request(&hc->address_manager);
-	if (*address <= 0)
-	  return *address;
-	return EOK;
-}
-/*----------------------------------------------------------------------------*/
-static int bind_address(
-  device_t *dev, usb_address_t address, devman_handle_t handle)
-{
-	assert(dev);
-	uhci_t *hc = (uhci_t *)dev->driver_data;
-	assert(hc);
-	usb_address_keeping_devman_bind(&hc->address_manager, address, handle);
-	return EOK;
-}
-/*----------------------------------------------------------------------------*/
-static int release_address(device_t *dev, usb_address_t address)
-{
-	assert(dev);
-	uhci_t *hc = (uhci_t *)dev->driver_data;
-	assert(hc);
-	usb_address_keeping_release_default(&hc->address_manager);
-	return EOK;
-}
-/*----------------------------------------------------------------------------*/
-static int interrupt_out(device_t *dev, usb_target_t target,
-    void *data, size_t size,
-    usbhc_iface_transfer_out_callback_t callback, void *arg)
-{
-	return uhci_transfer(dev, target, USB_TRANSFER_INTERRUPT, 0, USB_PID_OUT,
-		data, size, callback, NULL, arg);
-}
-/*----------------------------------------------------------------------------*/
-static int interrupt_in(device_t *dev, usb_target_t target,
-    void *data, size_t size,
-    usbhc_iface_transfer_in_callback_t callback, void *arg)
-{
-	return uhci_transfer(dev, target, USB_TRANSFER_INTERRUPT, 0, USB_PID_IN,
-		data, size, NULL, callback, arg);
-}
-/*----------------------------------------------------------------------------*/
-static int control_write_setup(device_t *dev, usb_target_t target,
-    void *data, size_t size,
-    usbhc_iface_transfer_out_callback_t callback, void *arg)
-{
-	return uhci_transfer(dev, target, USB_TRANSFER_CONTROL, 0, USB_PID_SETUP,
-		data, size, callback, NULL, arg);
-}
-/*----------------------------------------------------------------------------*/
-static int control_write_data(device_t *dev, usb_target_t target,
-    void *data, size_t size,
-    usbhc_iface_transfer_out_callback_t callback, void *arg)
-{
-	return uhci_transfer(dev, target, USB_TRANSFER_CONTROL, 1, USB_PID_OUT,
-		data, size, callback, NULL, arg);
-}
-/*----------------------------------------------------------------------------*/
-static int control_write_status(device_t *dev, usb_target_t target,
-    usbhc_iface_transfer_in_callback_t callback, void *arg)
-{
-	return uhci_transfer(dev, target, USB_TRANSFER_CONTROL, 0, USB_PID_IN,
-		NULL, 0, NULL, callback, arg);
-}
-/*----------------------------------------------------------------------------*/
-static int control_read_setup(device_t *dev, usb_target_t target,
-    void *data, size_t size,
-    usbhc_iface_transfer_out_callback_t callback, void *arg)
-{
-	return uhci_transfer(dev, target, USB_TRANSFER_CONTROL, 0, USB_PID_SETUP,
-		data, size, callback, NULL, arg);
-}
-/*----------------------------------------------------------------------------*/
-static int control_read_data(device_t *dev, usb_target_t target,
-    void *data, size_t size,
-    usbhc_iface_transfer_in_callback_t callback, void *arg)
-{
-	return uhci_transfer(dev, target, USB_TRANSFER_CONTROL, 1, USB_PID_IN,
-		data, size, NULL, callback, arg);
-}
-/*----------------------------------------------------------------------------*/
-static int control_read_status(device_t *dev, usb_target_t target,
-    usbhc_iface_transfer_out_callback_t callback, void *arg)
-{
-	return uhci_transfer(dev, target, USB_TRANSFER_CONTROL, 0, USB_PID_OUT,
-		NULL, 0, callback, NULL, arg);
-}
-
-
-usbhc_iface_t uhci_iface = {
-	.tell_address = get_address,
-
-	.reserve_default_address = reserve_default_address,
-	.release_default_address = release_default_address,
-	.request_address = request_address,
-	.bind_address = bind_address,
-	.release_address = release_address,
-
-	.interrupt_out = interrupt_out,
-	.interrupt_in = interrupt_in,
-
-	.control_write_setup = control_write_setup,
-	.control_write_data = control_write_data,
-	.control_write_status = control_write_status,
-
-	.control_read_setup = control_read_setup,
-	.control_read_data = control_read_data,
-	.control_read_status = control_read_status
-};
Index: pace/drv/uhci/iface.h
===================================================================
--- uspace/drv/uhci/iface.h	(revision 72e19f5092b40f5bf5640a8288771e2f8675b49e)
+++ 	(revision )
@@ -1,45 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup usb
- * @{
- */
-/** @file
- * @brief UHCI driver
- */
-#ifndef DRV_UHCI_IFACE_H
-#define DRV_UHCI_IFACE_H
-
-#include <usbhc_iface.h>
-
-usbhc_iface_t uhci_iface;
-
-#endif
-/**
- * @}
- */
Index: pace/drv/uhci/main.c
===================================================================
--- uspace/drv/uhci/main.c	(revision 72e19f5092b40f5bf5640a8288771e2f8675b49e)
+++ 	(revision )
@@ -1,98 +1,0 @@
-/*
- * Copyright (c) 2010 Vojtech Horky, Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include <driver.h>
-#include <errno.h>
-#include <str_error.h>
-#include <usb_iface.h>
-
-#include "debug.h"
-#include "iface.h"
-#include "name.h"
-#include "uhci.h"
-
-static int usb_iface_get_hc_handle(device_t *dev, devman_handle_t *handle)
-{
-	/* This shall be called only for the UHCI itself. */
-	assert(dev->parent == NULL);
-
-	*handle = dev->handle;
-	return EOK;
-}
-
-static usb_iface_t hc_usb_iface = {
-	.get_hc_handle = usb_iface_get_hc_handle
-};
-
-static device_ops_t uhci_ops = {
-	.interfaces[USB_DEV_IFACE] = &hc_usb_iface,
-	.interfaces[USBHC_DEV_IFACE] = &uhci_iface
-};
-
-static int uhci_add_device(device_t *device)
-{
-	uhci_print_info( "uhci_add_device() called\n" );
-	device->ops = &uhci_ops;
-
-	uintptr_t io_reg_base;
-	size_t io_reg_size;
-	int irq;
-
-	int rc = pci_get_my_registers(device,
-	    &io_reg_base, &io_reg_size, &irq);
-
-	if (rc != EOK) {
-		uhci_print_fatal("failed to get I/O registers addresses: %s.\n",
-		    str_error(rc));
-		return rc;
-	}
-
-	uhci_print_info("I/O regs at 0x%X (size %zu), IRQ %d.\n",
-	    io_reg_base, io_reg_size, irq);
-
-	return uhci_init(device, (void*)io_reg_base, io_reg_size);
-}
-
-static driver_ops_t uhci_driver_ops = {
-	.add_device = uhci_add_device,
-};
-
-static driver_t uhci_driver = {
-	.name = NAME,
-	.driver_ops = &uhci_driver_ops
-};
-
-int main(int argc, char *argv[])
-{
-	/*
-	 * Do some global initializations.
-	 */
-	sleep(5);
-	usb_dprintf_enable(NAME, DEBUG_LEVEL_INFO);
-
-	return driver_main(&uhci_driver);
-}
Index: pace/drv/uhci/name.h
===================================================================
--- uspace/drv/uhci/name.h	(revision 72e19f5092b40f5bf5640a8288771e2f8675b49e)
+++ 	(revision )
@@ -1,42 +1,0 @@
-/*
- * Copyright (c) 2010 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup usb
- * @{
- */
-/** @file
- * @brief UHCI driver
- */
-#ifndef DRV_UHCI_TD_NAME_H
-#define DRV_UHCI_TD_NAME_H
-
-#define NAME "uhci"
-
-#endif
-/**
- * @}
- */
Index: pace/drv/uhci/pci.c
===================================================================
--- uspace/drv/uhci/pci.c	(revision 72e19f5092b40f5bf5640a8288771e2f8675b49e)
+++ 	(revision )
@@ -1,126 +1,0 @@
-/*
- * Copyright (c) 2011 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/**
- * @addtogroup drvusbuhci
- * @{
- */
-/**
- * @file
- * PCI related functions needed by the UHCI driver.
- */
-#include "uhci.h"
-#include <errno.h>
-#include <assert.h>
-#include <devman.h>
-#include <device/hw_res.h>
-
-/** Get address of registers and IRQ for given device.
- *
- * @param[in] dev Device asking for the addresses.
- * @param[out] io_reg_address Base address of the I/O range.
- * @param[out] io_reg_size Size of the I/O range.
- * @param[out] irq_no IRQ assigned to the device.
- * @return Error code.
- */
-int pci_get_my_registers(device_t *dev,
-    uintptr_t *io_reg_address, size_t *io_reg_size,
-    int *irq_no)
-{
-	assert(dev != NULL);
-
-	int parent_phone = devman_parent_device_connect(dev->handle,
-	    IPC_FLAG_BLOCKING);
-	if (parent_phone < 0) {
-		return parent_phone;
-	}
-
-	int rc;
-
-	hw_resource_list_t hw_resources;
-	rc = hw_res_get_resource_list(parent_phone, &hw_resources);
-	if (rc != EOK) {
-		goto leave;
-	}
-
-	uintptr_t io_address = 0;
-	size_t io_size = 0;
-	bool io_found = false;
-
-	int irq = 0;
-	bool irq_found = false;
-
-	size_t i;
-	for (i = 0; i < hw_resources.count; i++) {
-		hw_resource_t *res = &hw_resources.resources[i];
-		switch (res->type) {
-			case INTERRUPT:
-				irq = res->res.interrupt.irq;
-				irq_found = true;
-				break;
-			case IO_RANGE:
-				io_address = (uintptr_t)
-				    res->res.io_range.address;
-				io_size = res->res.io_range.size;
-				io_found = true;
-				break;
-			default:
-				break;
-		}
-	}
-
-	if (!io_found) {
-		rc = ENOENT;
-		goto leave;
-	}
-
-	if (!irq_found) {
-		rc = ENOENT;
-		goto leave;
-	}
-
-	if (io_reg_address != NULL) {
-		*io_reg_address = io_address;
-	}
-	if (io_reg_size != NULL) {
-		*io_reg_size = io_size;
-	}
-	if (irq_no != NULL) {
-		*irq_no = irq;
-	}
-
-	rc = EOK;
-leave:
-	ipc_hangup(parent_phone);
-
-	return rc;
-}
-
-/**
- * @}
- */
-
Index: pace/drv/uhci/root_hub/debug.h
===================================================================
--- uspace/drv/uhci/root_hub/debug.h	(revision 72e19f5092b40f5bf5640a8288771e2f8675b49e)
+++ 	(revision )
@@ -1,72 +1,0 @@
-/*
- * Copyright (c) 2010 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup usb
- * @{
- */
-/** @file
- * @brief UHCI driver
- */
-#ifndef DRV_UHCI_ROOT_HUB_DEBUG_H
-#define DRV_UHCI_ROOT_HUB_DEBUG_H
-
-#include <stdio.h>
-#include <usb/debug.h>
-
-#define NAME "uhci_root_hubd"
-
-enum debug_levels {
-	DEBUG_LEVEL_FATAL_ERROR = 1,
-	DEBUG_LEVEL_ERROR = 2,
-	DEBUG_LEVEL_WARNING = 3,
-	DEBUG_LEVEL_INFO = 4,
-	DEBUG_LEVEL_VERBOSE = 5,
-	DEBUG_LEVEL_MAX = DEBUG_LEVEL_VERBOSE
-};
-
-#define uhci_printf( level, fmt, args...) \
-	usb_dprintf(NAME, level, fmt, ##args)
-
-#define uhci_print_fatal( fmt, args... ) \
-	fprintf(stderr, "[" NAME ":FATAL ERROR]: " fmt, ##args)
-
-#define uhci_print_error( fmt, args... ) \
-	fprintf(stderr, "[" NAME ":ERROR]: " fmt, ##args)
-
-#define uhci_print_warning( fmt, args... ) \
-	usb_dprintf( NAME, DEBUG_LEVEL_WARNING, fmt, ##args )
-
-#define uhci_print_info( fmt, args... ) \
-	usb_dprintf( NAME, DEBUG_LEVEL_INFO, fmt, ##args )
-
-#define uhci_print_verbose( fmt, args... ) \
-	usb_dprintf( NAME, DEBUG_LEVEL_VERBOSE, fmt, ##args )
-
-#endif
-/**
- * @}
- */
Index: pace/drv/uhci/root_hub/port.c
===================================================================
--- uspace/drv/uhci/root_hub/port.c	(revision 72e19f5092b40f5bf5640a8288771e2f8675b49e)
+++ 	(revision )
@@ -1,165 +1,0 @@
-
-#include <errno.h>
-#include <usb/usb.h>    /* usb_address_t */
-#include <usb/usbdrv.h> /* usb_drv_*     */
-
-#include "debug.h"
-#include "port.h"
-#include "port_status.h"
-
-static int uhci_port_new_device(uhci_port_t *port);
-static int uhci_port_remove_device(uhci_port_t *port);
-static int uhci_port_set_enabled(uhci_port_t *port, bool enabled);
-
-/*----------------------------------------------------------------------------*/
-int uhci_port_check(void *port)
-{
-	async_usleep( 1000000 );
-	uhci_port_t *port_instance = port;
-	assert(port_instance);
-	port_instance->hc_phone = devman_device_connect(port_instance->hc->handle, 0);
-	if (port_instance->hc_phone < 0) {
-		uhci_print_fatal("Failed(%d) to connect to the hc(handle=%x.\n",
-			port_instance->hc_phone, (unsigned)port_instance->hc->handle);
-		return port_instance->hc_phone;
-	}
-
-	while (1) {
-		uhci_print_verbose("Port(%d) status address %p:\n",
-		  port_instance->number, port_instance->address);
-
-		/* read register value */
-		port_status_t port_status =
-			port_status_read(port_instance->address);
-
-		/* debug print */
-		uhci_print_info("Port(%d) status %#.4x\n",
-		  port_instance->number, port_status);
-		print_port_status(port_status);
-
-		if (port_status & STATUS_CONNECTED_CHANGED) {
-			if (port_status & STATUS_CONNECTED) {
-				/* new device */
-				uhci_port_new_device(port_instance);
-			} else {
-				uhci_port_remove_device(port_instance);
-			}
-		}
-		async_usleep(port_instance->wait_period_usec);
-	}
-	return EOK;
-}
-/*----------------------------------------------------------------------------*/
-static int uhci_port_new_device(uhci_port_t *port)
-{
-	assert(port);
-	assert(port->hc_phone);
-
-	uhci_print_info("Adding new device on port %d.\n", port->number);
-
-
-	/* get default address */
-	int ret = usb_drv_reserve_default_address(port->hc_phone);
-	if (ret != EOK) {
-		uhci_print_error("Failed to reserve default address.\n");
-		return ret;
-	}
-
-	const usb_address_t usb_address = usb_drv_request_address(port->hc_phone);
-
-	if (usb_address <= 0) {
-		uhci_print_error("Recieved invalid address(%d).\n", usb_address);
-		return usb_address;
-	}
-	/*
-	 * the host then waits for at least 100 ms to allow completion of
-	 * an insertion process and for power at the device to become stable.
-	 */
-	async_usleep(100000);
-
-	/* enable port */
-	uhci_port_set_enabled(port, true);
-
-	/* The hub maintains the reset signal to that port for 10 ms
-	 * (See Section 11.5.1.5)
-	 */
-	port_status_t port_status =
-		port_status_read(port->address);
-	port_status |= STATUS_IN_RESET;
-	port_status_write(port->address, port_status);
-	async_usleep(10000);
-	port_status =
-		port_status_read(port->address);
-	port_status &= ~STATUS_IN_RESET;
-	port_status_write(port->address, port_status);
-
-	/* assign address to device */
-	ret = usb_drv_req_set_address(port->hc_phone, 0, usb_address);
-
-
-	if (ret != EOK) { /* address assigning went wrong */
-		uhci_print_error("Failed(%d) to assign address to the device.\n", ret);
-		uhci_port_set_enabled(port, false);
-		int release = usb_drv_release_default_address(port->hc_phone);
-		if (release != EOK) {
-			uhci_print_fatal("Failed to release default address.\n");
-			return release;
-		}
-		return ret;
-	}
-
-	/* release default address */
-	ret = usb_drv_release_default_address(port->hc_phone);
-	if (ret != EOK) {
-		uhci_print_fatal("Failed to release default address.\n");
-		return ret;
-	}
-
-	/* communicate and possibly report to devman */
-	assert(port->attached_device == 0);
-
-	ret = usb_drv_register_child_in_devman(port->hc_phone, port->hc, usb_address,
-		&port->attached_device);
-
-	if (ret != EOK) { /* something went wrong */
-		uhci_print_error("Failed(%d) in usb_drv_register_child.\n", ret);
-		uhci_port_set_enabled(port, false);
-		return ENOMEM;
-	}
-	uhci_print_info("Sucessfully added device on port(%d) address(%d).\n",
-		port->number, usb_address);
-
-	/* TODO: bind the address here */
-
-	return EOK;
-}
-/*----------------------------------------------------------------------------*/
-static int uhci_port_remove_device(uhci_port_t *port)
-{
-	uhci_print_error("Don't know how to remove device %#x.\n",
-		(unsigned int)port->attached_device);
-	uhci_port_set_enabled(port, false);
-	return EOK;
-}
-/*----------------------------------------------------------------------------*/
-static int uhci_port_set_enabled(uhci_port_t *port, bool enabled)
-{
-	assert(port);
-
-	/* read register value */
-	port_status_t port_status
-		= port_status_read(port->address);
-
-	/* enable port: register write */
-	if (enabled) {
-		port_status |= STATUS_ENABLED;
-	} else {
-		port_status &= ~STATUS_ENABLED;
-	}
-	port_status_write(port->address, port_status);
-
-	uhci_print_info("%s port %d.\n",
-	  enabled ? "Enabled" : "Disabled", port->number);
-	return EOK;
-}
-/*----------------------------------------------------------------------------*/
Index: pace/drv/uhci/root_hub/port.h
===================================================================
--- uspace/drv/uhci/root_hub/port.h	(revision 72e19f5092b40f5bf5640a8288771e2f8675b49e)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * Copyright (c) 2010 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup usb
- * @{
- */
-/** @file
- * @brief UHCI port driver
- */
-#ifndef DRV_UHCI_PORT_H
-#define DRV_UHCI_PORT_H
-
-#include <assert.h>
-#include <driver.h> /* device_t */
-#include <stdint.h>
-
-#include "port_status.h"
-
-typedef struct uhci_port
-{
-	port_status_t *address;
-	device_t *hc;
-	unsigned number;
-	unsigned wait_period_usec;
-	int hc_phone;
-	devman_handle_t attached_device;
-} uhci_port_t;
-
-static inline void uhci_port_init(
-  uhci_port_t *port, port_status_t *address, device_t *hc, unsigned number,
-  unsigned usec)
-{
-	assert(port);
-	port->address = address;
-	port->hc = hc;
-	port->number = number;
-	port->hc_phone = -1;
-	port->wait_period_usec = usec;
-	port->attached_device = 0;
-}
-
-int uhci_port_check(void *port);
-#endif
-/**
- * @}
- */
Index: pace/drv/uhci/root_hub/port_status.c
===================================================================
--- uspace/drv/uhci/root_hub/port_status.c	(revision 72e19f5092b40f5bf5640a8288771e2f8675b49e)
+++ 	(revision )
@@ -1,35 +1,0 @@
-#include <assert.h>
-#include <stdio.h>
-
-#include "debug.h"
-#include "port_status.h"
-
-struct flag_name
-{
-	unsigned flag;
-	const char *name;
-};
-
-static const struct flag_name flags[] =
-{
-	{ STATUS_SUSPEND, "suspended" },
-	{ STATUS_IN_RESET, "in reset" },
-	{ STATUS_LOW_SPEED, "low speed device" },
-	{ STATUS_ALWAYS_ONE, "always 1 bit" },
-	{ STATUS_RESUME, "resume" },
-	{ STATUS_LINE_D_MINUS, "line D- value" },
-	{ STATUS_LINE_D_PLUS, "line D+ value" },
-	{ STATUS_ENABLED_CHANGED, "enabled changed" },
-	{ STATUS_ENABLED, "enabled" },
-	{ STATUS_CONNECTED_CHANGED, "connected changed" },
-	{ STATUS_CONNECTED, "connected" }
-};
-
-void print_port_status(port_status_t value)
-{
-	unsigned i = 0;
-	for (;i < sizeof(flags)/sizeof(struct flag_name); ++i) {
-		uhci_print_verbose("\t%s status: %s.\n", flags[i].name,
-		  value & flags[i].flag ? "YES" : "NO");
-	}
-}
Index: pace/drv/uhci/root_hub/port_status.h
===================================================================
--- uspace/drv/uhci/root_hub/port_status.h	(revision 72e19f5092b40f5bf5640a8288771e2f8675b49e)
+++ 	(revision )
@@ -1,68 +1,0 @@
-/*
- * Copyright (c) 2010 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup usb
- * @{
- */
-/** @file
- * @brief UHCI driver
- */
-#ifndef DRV_UHCI_TD_PORT_STATUS_H
-#define DRV_UHCI_TD_PORT_STATUS_H
-
-#include <libarch/ddi.h>
-#include <stdint.h>
-
-typedef uint16_t port_status_t;
-
-enum {
-	STATUS_CONNECTED         = 1 << 0,
-	STATUS_CONNECTED_CHANGED = 1 << 1,
-	STATUS_ENABLED           = 1 << 2,
-	STATUS_ENABLED_CHANGED   = 1 << 3,
-	STATUS_LINE_D_PLUS       = 1 << 4,
-	STATUS_LINE_D_MINUS      = 1 << 5,
-	STATUS_RESUME            = 1 << 6,
-	STATUS_ALWAYS_ONE        = 1 << 7,
-
-	STATUS_LOW_SPEED = 1 <<  8,
-	STATUS_IN_RESET  = 1 <<  9,
-	STATUS_SUSPEND   = 1 << 12,
-};
-
-static inline port_status_t port_status_read(port_status_t * address)
-	{ return pio_read_16(address); }
-
-static inline void port_status_write(
-  port_status_t * address, port_status_t value)
-	{ pio_write_16(address, value); }
-
-void print_port_status(const port_status_t status);
-#endif
-/**
- * @}
- */
Index: pace/drv/uhci/root_hub/root_hub.c
===================================================================
--- uspace/drv/uhci/root_hub/root_hub.c	(revision 72e19f5092b40f5bf5640a8288771e2f8675b49e)
+++ 	(revision )
@@ -1,53 +1,0 @@
-#include <async.h>
-#include <ddi.h>
-#include <errno.h>
-#include <stdint.h>
-#include <stdio.h>
-
-#include "debug.h"
-#include "root_hub.h"
-
-
-int uhci_root_hub_init( uhci_root_hub_t *hub, device_t *hc, void *addr )
-{
-	assert(hub);
-	usb_dprintf_enable(NAME, DEBUG_LEVEL_INFO);
-
-	/* allow access to root hub registers */
-	port_status_t *regs;
-	const int ret = pio_enable(
-	  addr, sizeof(port_status_t) * UHCI_ROOT_HUB_PORT_COUNT, (void**)&regs);
-
-	if (ret < 0) {
-		uhci_print_error(": Failed to gain access to port registers at %p\n", regs);
-		return ret;
-	}
-
-	/* add fibrils for periodic port checks */
-	unsigned i = 0;
-	for (; i < UHCI_ROOT_HUB_PORT_COUNT; ++i) {
-		/* mind pointer arithmetics */
-		uhci_port_init(
-		  &hub->ports[i], regs + i, hc, i, ROOT_HUB_WAIT_USEC);
-
-		hub->checker[i] = fibril_create(uhci_port_check, &hub->ports[i]);
-		if (hub->checker[i] == 0) {
-			uhci_print_error(": failed to launch root hub fibril.");
-			return ENOMEM;
-		}
-		fibril_add_ready(hub->checker[i]);
-		uhci_print_verbose(" added fibril for port %d: %p.\n", i, hub->checker[i]);
-	}
-
-	return EOK;
-}
-/*----------------------------------------------------------------------------*/
-int uhci_root_hub_fini( uhci_root_hub_t* instance )
-{
-	assert( instance );
-	// TODO:
-	//destroy fibril here
-	//disable access to registers
-	return EOK;
-}
-/*----------------------------------------------------------------------------*/
Index: pace/drv/uhci/root_hub/root_hub.h
===================================================================
--- uspace/drv/uhci/root_hub/root_hub.h	(revision 72e19f5092b40f5bf5640a8288771e2f8675b49e)
+++ 	(revision )
@@ -1,58 +1,0 @@
-/*
- * Copyright (c) 2010 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup usb
- * @{
- */
-/** @file
- * @brief UHCI driver
- */
-#ifndef DRV_UHCI_ROOT_HUB_H
-#define DRV_UHCI_ROOT_HUB_H
-
-#include <fibril.h>
-#include <driver.h> /* for device_t */
-
-#include "port.h"
-
-#define UHCI_ROOT_HUB_PORT_COUNT 2
-#define UHCI_ROOT_HUB_PORT_REGISTERS_OFFSET 0x10
-#define ROOT_HUB_WAIT_USEC 10000000 /* 10 seconds */
-
-typedef struct root_hub {
-	uhci_port_t ports[UHCI_ROOT_HUB_PORT_COUNT];
-	fid_t checker[UHCI_ROOT_HUB_PORT_COUNT];
-} uhci_root_hub_t;
-
-int uhci_root_hub_init(
-  uhci_root_hub_t *instance, device_t *device, void *addr);
-
-int uhci_root_hub_fini(uhci_root_hub_t* instance);
-#endif
-/**
- * @}
- */
Index: pace/drv/uhci/transfer_list.c
===================================================================
--- uspace/drv/uhci/transfer_list.c	(revision 72e19f5092b40f5bf5640a8288771e2f8675b49e)
+++ 	(revision )
@@ -1,51 +1,0 @@
-#include <errno.h>
-
-#include "transfer_list.h"
-
-int transfer_list_init(transfer_list_t *instance, transfer_list_t *next)
-{
-	assert(instance);
-	instance->first = NULL;
-	instance->last = NULL;
-	instance->queue_head = malloc32(sizeof(queue_head_t));
-	if (!instance->queue_head) {
-		uhci_print_error("Failed to allocate queue head.\n");
-		return ENOMEM;
-	}
-	instance->queue_head_pa = (uintptr_t)addr_to_phys(instance->queue_head);
-
-	uint32_t next_pa = next ? next->queue_head_pa : 0;
-	queue_head_init(instance->queue_head, next_pa);
-	return EOK;
-}
-/*----------------------------------------------------------------------------*/
-int transfer_list_append(
-  transfer_list_t *instance, transfer_descriptor_t *transfer)
-{
-	assert(instance);
-	assert(transfer);
-
-	uint32_t pa = (uintptr_t)addr_to_phys(transfer);
-	assert((pa & LINK_POINTER_ADDRESS_MASK) == pa);
-
-	/* empty list */
-	if (instance->first == NULL) {
-		assert(instance->last == NULL);
-		instance->first = instance->last = transfer;
-	} else {
-		assert(instance->last);
-		instance->last->next_va = transfer;
-
-		assert(instance->last->next & LINK_POINTER_TERMINATE_FLAG);
-		instance->last->next = (pa & LINK_POINTER_ADDRESS_MASK);
-		instance->last = transfer;
-	}
-
-	assert(instance->queue_head);
-	if (instance->queue_head->element & LINK_POINTER_TERMINATE_FLAG) {
-		instance->queue_head->element = (pa & LINK_POINTER_ADDRESS_MASK);
-	}
-	uhci_print_verbose("Successfully added transfer to the hc queue %p.\n",
-	  instance);
-	return EOK;
-}
Index: pace/drv/uhci/transfer_list.h
===================================================================
--- uspace/drv/uhci/transfer_list.h	(revision 72e19f5092b40f5bf5640a8288771e2f8675b49e)
+++ 	(revision )
@@ -1,65 +1,0 @@
-/*
- * Copyright (c) 2010 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup usb
- * @{
- */
-/** @file
- * @brief UHCI driver
- */
-#ifndef DRV_UHCI_TRANSFER_LIST_H
-#define DRV_UHCI_TRANSFER_LIST_H
-
-#include "debug.h"
-#include "uhci_struct/queue_head.h"
-#include "uhci_struct/transfer_descriptor.h"
-#include "utils/malloc32.h"
-
-typedef struct transfer_list
-{
-	transfer_descriptor_t *first;
-	transfer_descriptor_t *last;
-	queue_head_t *queue_head;
-	uint32_t queue_head_pa;
-} transfer_list_t;
-
-int transfer_list_init(transfer_list_t *instance, transfer_list_t *next);
-
-static inline void transfer_list_fini(transfer_list_t *instance)
-{
-	assert(instance);
-	if (instance->queue_head)
-		free32(instance->queue_head);
-}
-
-int transfer_list_append(
-  transfer_list_t *instance, transfer_descriptor_t *transfer);
-
-#endif
-/**
- * @}
- */
Index: pace/drv/uhci/uhci.c
===================================================================
--- uspace/drv/uhci/uhci.c	(revision 72e19f5092b40f5bf5640a8288771e2f8675b49e)
+++ 	(revision )
@@ -1,256 +1,0 @@
-#include <errno.h>
-#include <usb/debug.h>
-#include <usb/usb.h>
-
-#include "utils/malloc32.h"
-
-#include "debug.h"
-#include "name.h"
-#include "uhci.h"
-
-static int uhci_init_transfer_lists(transfer_list_t list[]);
-static int uhci_clean_finished(void *arg);
-static int uhci_debug_checker(void *arg);
-
-int uhci_init(device_t *device, void *regs, size_t reg_size)
-{
-	assert(device);
-	uhci_print_info("Initializing device at address %p.\n", device);
-
-#define CHECK_RET_FREE_INSTANCE(message...) \
-	if (ret != EOK) { \
-		uhci_print_error(message); \
-		if (instance) { \
-			free(instance); \
-		} \
-		return ret; \
-	} else (void) 0
-
-	/* create instance */
-	uhci_t *instance = malloc(sizeof(uhci_t));
-	int ret = instance ? EOK : ENOMEM;
-	CHECK_RET_FREE_INSTANCE("Failed to allocate uhci driver instance.\n");
-
-	bzero(instance, sizeof(uhci_t));
-
-	/* init address keeper(libusb) */
-	usb_address_keeping_init(&instance->address_manager, USB11_ADDRESS_MAX);
-	uhci_print_verbose("Initialized address manager.\n");
-
-	/* allow access to hc control registers */
-	regs_t *io;
-	assert(reg_size >= sizeof(regs_t));
-	ret = pio_enable(regs, reg_size, (void**)&io);
-	CHECK_RET_FREE_INSTANCE("Failed to gain access to registers at %p.\n", io);
-	instance->registers = io;
-	uhci_print_verbose("Device registers accessible.\n");
-
-	/* init transfer lists */
-	ret = uhci_init_transfer_lists(instance->transfers);
-	CHECK_RET_FREE_INSTANCE("Failed to initialize transfer lists.\n");
-	uhci_print_verbose("Transfer lists initialized.\n");
-
-	/* init root hub */
-	ret = uhci_root_hub_init(&instance->root_hub, device,
-	  (char*)regs + UHCI_ROOT_HUB_PORT_REGISTERS_OFFSET);
-	CHECK_RET_FREE_INSTANCE("Failed to initialize root hub driver.\n");
-
-	uhci_print_verbose("Initializing frame list.\n");
-	instance->frame_list = get_page();
-//	  memalign32(sizeof(link_pointer_t) * UHCI_FRAME_LIST_COUNT, 4096);
-	if (instance->frame_list == NULL) {
-		uhci_print_error("Failed to allocate frame list pointer.\n");
-		uhci_root_hub_fini(&instance->root_hub);
-		free(instance);
-		return ENOMEM;
-	}
-
-	/* initialize all frames to point to the first queue head */
-	unsigned i = 0;
-	const uint32_t queue =
-	  instance->transfers[USB_TRANSFER_INTERRUPT].queue_head_pa
-	  | LINK_POINTER_QUEUE_HEAD_FLAG;
-	for(; i < UHCI_FRAME_LIST_COUNT; ++i) {
-		instance->frame_list[i] = queue;
-	}
-
-	const uintptr_t pa = (uintptr_t)addr_to_phys(instance->frame_list);
-
-	pio_write_32(&instance->registers->flbaseadd, (uint32_t)pa);
-
-	instance->cleaner = fibril_create(uhci_clean_finished, instance);
-	fibril_add_ready(instance->cleaner);
-
-	instance->debug_checker = fibril_create(uhci_debug_checker, instance);
-	fibril_add_ready(instance->debug_checker);
-
-	uhci_print_verbose("Starting UHCI HC.\n");
-	pio_write_16(&instance->registers->usbcmd, UHCI_CMD_RUN_STOP);
-/*
-	uint16_t cmd = pio_read_16(&instance->registers->usbcmd);
-	cmd |= UHCI_CMD_DEBUG;
-	pio_write_16(&instance->registers->usbcmd, cmd);
-*/
-	device->driver_data = instance;
-	return EOK;
-}
-/*----------------------------------------------------------------------------*/
-int uhci_init_transfer_lists(transfer_list_t transfers[])
-{
-	//TODO:refactor
-	transfers[USB_TRANSFER_ISOCHRONOUS].first = NULL;
-	transfers[USB_TRANSFER_ISOCHRONOUS].last = NULL;
-
-	int ret;
-	ret = transfer_list_init(&transfers[USB_TRANSFER_BULK], NULL);
-	if (ret != EOK) {
-		uhci_print_error("Failed to initialize bulk queue.\n");
-		return ret;
-	}
-
-	ret = transfer_list_init(
-	  &transfers[USB_TRANSFER_CONTROL], &transfers[USB_TRANSFER_BULK]);
-	if (ret != EOK) {
-		uhci_print_error("Failed to initialize control queue.\n");
-		transfer_list_fini(&transfers[USB_TRANSFER_BULK]);
-		return ret;
-	}
-
-	ret = transfer_list_init(
-	  &transfers[USB_TRANSFER_INTERRUPT], &transfers[USB_TRANSFER_CONTROL]);
-	if (ret != EOK) {
-		uhci_print_error("Failed to initialize interrupt queue.\n");
-		transfer_list_fini(&transfers[USB_TRANSFER_CONTROL]);
-		transfer_list_fini(&transfers[USB_TRANSFER_BULK]);
-		return ret;
-	}
-
-	return EOK;
-}
-/*----------------------------------------------------------------------------*/
-int uhci_transfer(
-  device_t *dev,
-  usb_target_t target,
-  usb_transfer_type_t transfer_type,
-	bool toggle,
-  usb_packet_id pid,
-  void *buffer, size_t size,
-  usbhc_iface_transfer_out_callback_t callback_out,
-  usbhc_iface_transfer_in_callback_t callback_in,
-  void *arg )
-{
-	// TODO: Add support for isochronous transfers
-	if (transfer_type == USB_TRANSFER_ISOCHRONOUS)
-		return ENOTSUP;
-
-	if (size >= 1024)
-		return ENOTSUP;
-
-	transfer_descriptor_t *td = NULL;
-	callback_t *job = NULL;
-	int ret = EOK;
-
-#define CHECK_RET_TRANS_FREE_JOB_TD(message) \
-	if (ret != EOK) { \
-		uhci_print_error(message); \
-		if (job) { \
-			callback_dispose(job); \
-		} \
-		if (td) { free32(td); } \
-		return ret; \
-	} else (void) 0
-
-
-	job = callback_get(dev, buffer, size, callback_in, callback_out, arg);
-	ret = job ? EOK : ENOMEM;
-	CHECK_RET_TRANS_FREE_JOB_TD("Failed to allocate callback structure.\n");
-
-	td = transfer_descriptor_get(3, size, false, target, pid, job->new_buffer);
-	ret = td ? EOK : ENOMEM;
-	CHECK_RET_TRANS_FREE_JOB_TD("Failed to setup transfer descriptor.\n");
-
-	td->callback = job;
-
-	assert(dev);
-	uhci_t *instance = (uhci_t*)dev->driver_data;
-	assert(instance);
-
-	uhci_print_verbose("Appending a new transfer to queue.\n");
-	ret = transfer_list_append(&instance->transfers[transfer_type], td);
-	CHECK_RET_TRANS_FREE_JOB_TD("Failed to append transfer descriptor.\n");
-
-	return EOK;
-}
-/*---------------------------------------------------------------------------*/
-int uhci_clean_finished(void* arg)
-{
-	uhci_print_verbose("Started cleaning fibril.\n");
-	uhci_t *instance = (uhci_t*)arg;
-	assert(instance);
-
-	while(1) {
-		uhci_print_verbose("Running cleaning fibril on: %p.\n", instance);
-		/* iterate all transfer queues */
-		int i = 0;
-		for (; i < TRANSFER_QUEUES; ++i) {
-			/* Remove inactive transfers from the top of the queue
-			 * TODO: should I reach queue head or is this enough? */
-			volatile transfer_descriptor_t * it =
-				instance->transfers[i].first;
-			uhci_print_verbose("Running cleaning fibril on queue: %p (%s).\n",
-				&instance->transfers[i], it ? "SOMETHING" : "EMPTY");
-
-		if (it)
-			uhci_print_verbose("First in queue: %p (%x).\n",
-				it, it->status);
-
-			while (instance->transfers[i].first &&
-			 !(instance->transfers[i].first->status & TD_STATUS_ERROR_ACTIVE)) {
-				transfer_descriptor_t *transfer = instance->transfers[i].first;
-				uhci_print_info("Inactive transfer calling callback with status %x.\n",
-				  transfer->status);
-				instance->transfers[i].first = transfer->next_va;
-				transfer_descriptor_dispose(transfer);
-			}
-			if (!instance->transfers[i].first)
-				instance->transfers[i].last = instance->transfers[i].first;
-		}
-		async_usleep(UHCI_CLEANER_TIMEOUT);
-	}
-	return EOK;
-}
-/*---------------------------------------------------------------------------*/
-int uhci_debug_checker(void *arg)
-{
-	uhci_t *instance = (uhci_t*)arg;
-	assert(instance);
-	while (1) {
-		uint16_t cmd = pio_read_16(&instance->registers->usbcmd);
-		uint16_t sts = pio_read_16(&instance->registers->usbsts);
-		uhci_print_verbose("Command register: %X Status register: %X\n", cmd, sts);
-/*
-		uintptr_t frame_list = pio_read_32(&instance->registers->flbaseadd);
-		uhci_print_verbose("Framelist address: %p vs. %p.\n",
-			frame_list, addr_to_phys(instance->frame_list));
-		int frnum = pio_read_16(&instance->registers->frnum) & 0x3ff;
-		uhci_print_verbose("Framelist item: %d \n", frnum );
-
-		queue_head_t* qh = instance->transfers[USB_TRANSFER_INTERRUPT].queue_head;
-		uhci_print_verbose("Interrupt QH: %p vs. %p.\n",
-			instance->frame_list[frnum], addr_to_phys(qh));
-
-		uhci_print_verbose("Control QH: %p vs. %p.\n", qh->next_queue,
-			addr_to_phys(instance->transfers[USB_TRANSFER_CONTROL].queue_head));
-		qh = instance->transfers[USB_TRANSFER_CONTROL].queue_head;
-
-		uhci_print_verbose("Bulk QH: %p vs. %p.\n", qh->next_queue,
-			addr_to_phys(instance->transfers[USB_TRANSFER_BULK].queue_head));
-	uint16_t cmd = pio_read_16(&instance->registers->usbcmd);
-	cmd |= UHCI_CMD_RUN_STOP;
-	pio_write_16(&instance->registers->usbcmd, cmd);
-*/
-
-		async_usleep(UHCI_DEBUGER_TIMEOUT);
-	}
-	return 0;
-}
Index: pace/drv/uhci/uhci.h
===================================================================
--- uspace/drv/uhci/uhci.h	(revision 72e19f5092b40f5bf5640a8288771e2f8675b49e)
+++ 	(revision )
@@ -1,109 +1,0 @@
-/*
- * Copyright (c) 2010 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup drvusbuhci
- * @{
- */
-/** @file
- * @brief UHCI driver
- */
-#ifndef DRV_UHCI_UHCI_H
-#define DRV_UHCI_UHCI_H
-
-#include <fibril.h>
-
-#include <usb/addrkeep.h>
-#include <usbhc_iface.h>
-
-#include "root_hub/root_hub.h"
-#include "transfer_list.h"
-
-typedef struct uhci_regs {
-	uint16_t usbcmd;
-#define UHCI_CMD_MAX_PACKET (1 << 7)
-#define UHCI_CMD_CONFIGURE  (1 << 6)
-#define UHCI_CMD_DEBUG  (1 << 5)
-#define UHCI_CMD_FORCE_GLOBAL_RESUME  (1 << 4)
-#define UHCI_CMD_FORCE_GLOBAL_SUSPEND  (1 << 3)
-#define UHCI_CMD_GLOBAL_RESET  (1 << 2)
-#define UHCI_CMD_HCRESET  (1 << 1)
-#define UHCI_CMD_RUN_STOP  (1 << 0)
-
-	uint16_t usbsts;
-#define UHCI_STATUS_HALTED (1 << 5)
-#define UHCI_STATUS_PROCESS_ERROR (1 << 4)
-#define UHCI_STATUS_SYSTEM_ERROR (1 << 3)
-#define UHCI_STATUS_RESUME (1 << 2)
-#define UHCI_STATUS_ERROR_INTERRUPT (1 << 1)
-#define UHCI_STATUS_INTERRUPT (1 << 0)
-
-	uint16_t usbintr;
-	uint16_t frnum;
-	uint32_t flbaseadd;
-	uint8_t sofmod;
-} regs_t;
-
-#define TRANSFER_QUEUES 4
-#define UHCI_FRAME_LIST_COUNT 1024
-#define UHCI_CLEANER_TIMEOUT 1000000
-#define UHCI_DEBUGER_TIMEOUT 500000
-
-typedef struct uhci {
-	usb_address_keeping_t address_manager;
-	uhci_root_hub_t root_hub;
-	volatile regs_t *registers;
-
-	link_pointer_t *frame_list;
-
-	transfer_list_t transfers[TRANSFER_QUEUES];
-	fid_t cleaner;
-	fid_t debug_checker;
-} uhci_t;
-
-/* init uhci specifics in device.driver_data */
-int uhci_init( device_t *device, void *regs, size_t reg_size );
-
-int uhci_destroy( device_t *device );
-
-int uhci_transfer(
-  device_t *dev,
-  usb_target_t target,
-  usb_transfer_type_t transfer_type,
-	bool toggle,
-  usb_packet_id pid,
-  void *buffer, size_t size,
-  usbhc_iface_transfer_out_callback_t callback_out,
-  usbhc_iface_transfer_in_callback_t callback_in,
-  void *arg );
-
-int pci_get_my_registers(device_t *, uintptr_t *, size_t *, int *);
-
-#endif
-/**
- * @}
- */
Index: pace/drv/uhci/uhci.ma
===================================================================
--- uspace/drv/uhci/uhci.ma	(revision 72e19f5092b40f5bf5640a8288771e2f8675b49e)
+++ 	(revision )
@@ -1,2 +1,0 @@
-10 pci/ven=8086&dev=7020
-
Index: pace/drv/uhci/uhci_struct/link_pointer.h
===================================================================
--- uspace/drv/uhci/uhci_struct/link_pointer.h	(revision 72e19f5092b40f5bf5640a8288771e2f8675b49e)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/*
- * Copyright (c) 2010 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup usb
- * @{
- */
-/** @file
- * @brief UHCI driver
- */
-#ifndef DRV_UHCI_LINK_POINTER_H
-#define DRV_UHCI_LINK_POINTER_H
-
-/* UHCI link pointer, used by many data structures */
-typedef uint32_t link_pointer_t;
-
-#define LINK_POINTER_TERMINATE_FLAG (1 << 0)
-#define LINK_POINTER_QUEUE_HEAD_FLAG (1 << 1)
-#define LINK_POINTER_ZERO_BIT_FLAG (1 << 2)
-#define LINK_POINTER_VERTICAL_FLAG (1 << 2)
-#define LINK_POINTER_RESERVED_FLAG (1 << 3)
-
-#define LINK_POINTER_ADDRESS_MASK 0xfffffff0 /* upper 28 bits */
-
-#endif
-/**
- * @}
- */
-
Index: pace/drv/uhci/uhci_struct/queue_head.h
===================================================================
--- uspace/drv/uhci/uhci_struct/queue_head.h	(revision 72e19f5092b40f5bf5640a8288771e2f8675b49e)
+++ 	(revision )
@@ -1,64 +1,0 @@
-
-/*
- * Copyright (c) 2010 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup usb
- * @{
- */
-/** @file
- * @brief UHCI driver
- */
-#ifndef DRV_UHCI_QH_H
-#define DRV_UHCI_QH_H
-
-#include <assert.h>
-
-#include "link_pointer.h"
-
-typedef struct queue_head {
-	link_pointer_t next_queue;
-	link_pointer_t element;
-} __attribute__((packed)) queue_head_t;
-
-static inline void queue_head_init(queue_head_t *instance, uint32_t next_queue_pa)
-{
-	assert(instance);
-	assert((next_queue_pa & LINK_POINTER_ADDRESS_MASK) == next_queue_pa);
-
-	instance->element = 0 | LINK_POINTER_TERMINATE_FLAG;
-	if (next_queue_pa) {
-		instance->next_queue = (next_queue_pa & LINK_POINTER_ADDRESS_MASK)
-		  | LINK_POINTER_QUEUE_HEAD_FLAG;
-	} else {
-		instance->next_queue = 0 | LINK_POINTER_TERMINATE_FLAG;
-	}
-}
-
-#endif
-/**
- * @}
- */
Index: pace/drv/uhci/uhci_struct/transfer_descriptor.c
===================================================================
--- uspace/drv/uhci/uhci_struct/transfer_descriptor.c	(revision 72e19f5092b40f5bf5640a8288771e2f8675b49e)
+++ 	(revision )
@@ -1,85 +1,0 @@
-#include "transfer_descriptor.h"
-
-void transfer_descriptor_init(transfer_descriptor_t *instance,
-  int error_count, size_t size, bool isochronous, usb_target_t target,
-	int pid, void *buffer)
-{
-	assert(instance);
-
-	instance->next =
-	  0 | LINK_POINTER_TERMINATE_FLAG;
-
-
-	assert(size < 1024);
-	instance->status = 0
-	  | ((error_count & TD_STATUS_ERROR_COUNT_MASK) << TD_STATUS_ERROR_COUNT_POS)
-	  | TD_STATUS_ERROR_ACTIVE;
-
-	instance->device = 0
-		| (((size - 1) & TD_DEVICE_MAXLEN_MASK) << TD_DEVICE_MAXLEN_POS)
-		| ((target.address & TD_DEVICE_ADDRESS_MASK) << TD_DEVICE_ADDRESS_POS)
-		| ((target.endpoint & TD_DEVICE_ENDPOINT_MASK) << TD_DEVICE_ENDPOINT_POS)
-		| ((pid & TD_DEVICE_PID_MASK) << TD_DEVICE_PID_POS);
-
-	instance->buffer_ptr = 0;
-
-	instance->next_va = NULL;
-	instance->callback = NULL;
-
-	if (size) {
-		instance->buffer_ptr = (uintptr_t)addr_to_phys(buffer);
-	}
-
-	uhci_print_info("Created TD: %X:%X:%X:%X(%p).\n",
-		instance->next, instance->status, instance->device,
-	  instance->buffer_ptr, buffer);
-#if 0
-	if (size) {
-		unsigned char * buff = buffer;
-		uhci_print_verbose("TD Buffer dump(%p-%dB): ", buffer, size);
-		unsigned i = 0;
-		/* TODO: Verbose? */
-		for (; i < size; ++i) {
-			printf((i & 1) ? "%x " : "%x", buff[i]);
-		}
-		printf("\n");
-	}
-#endif
-}
-
-static inline usb_transaction_outcome_t convert_outcome(uint32_t status)
-{
-	/*TODO: refactor into something sane */
-	/*TODO: add additional usb_errors to usb_outcome_t */
-
-	if (status & TD_STATUS_ERROR_STALLED)
-		return USB_OUTCOME_CRCERROR;
-
-	if (status & TD_STATUS_ERROR_BUFFER)
-		return USB_OUTCOME_CRCERROR;
-
-	if (status & TD_STATUS_ERROR_BABBLE)
-		return USB_OUTCOME_BABBLE;
-
-	if (status & TD_STATUS_ERROR_NAK)
-		return USB_OUTCOME_CRCERROR;
-
-  if (status & TD_STATUS_ERROR_CRC)
-		return USB_OUTCOME_CRCERROR;
-
-	if (status & TD_STATUS_ERROR_BIT_STUFF)
-		return USB_OUTCOME_CRCERROR;
-
-	assert((((status >> TD_STATUS_ERROR_POS) & TD_STATUS_ERROR_MASK)
-	| TD_STATUS_ERROR_RESERVED) == TD_STATUS_ERROR_RESERVED);
-	return USB_OUTCOME_OK;
-}
-
-void transfer_descriptor_fini(transfer_descriptor_t *instance)
-{
-	assert(instance);
-	callback_run(instance->callback,
-		convert_outcome(instance->status),
-		((instance->status >> TD_STATUS_ACTLEN_POS) + 1) & TD_STATUS_ACTLEN_MASK
-	);
-}
Index: pace/drv/uhci/uhci_struct/transfer_descriptor.h
===================================================================
--- uspace/drv/uhci/uhci_struct/transfer_descriptor.h	(revision 72e19f5092b40f5bf5640a8288771e2f8675b49e)
+++ 	(revision )
@@ -1,134 +1,0 @@
-/*
- * Copyright (c) 2010 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup usb
- * @{
- */
-/** @file
- * @brief UHCI driver
- */
-#ifndef DRV_UHCI_TRANSFER_DESCRIPTOR_H
-#define DRV_UHCI_TRANSFER_DESCRIPTOR_H
-
-#include <mem.h>
-#include <usb/usb.h>
-
-#include "utils/malloc32.h"
-#include "callback.h"
-#include "link_pointer.h"
-
-/** UHCI Transfer Descriptor */
-typedef struct transfer_descriptor {
-	link_pointer_t next;
-
-	volatile uint32_t status;
-
-#define TD_STATUS_RESERVED_MASK 0xc000f800
-#define TD_STATUS_SPD_FLAG ( 1 << 29 )
-#define TD_STATUS_ERROR_COUNT_POS ( 27 )
-#define TD_STATUS_ERROR_COUNT_MASK ( 0x3 )
-#define TD_STATUS_ERROR_COUNT_DEFAULT 3
-#define TD_STATUS_LOW_SPEED_FLAG ( 1 << 26 )
-#define TD_STATUS_ISOCHRONOUS_FLAG ( 1 << 25 )
-#define TD_STATUS_COMPLETE_INTERRUPT_FLAG ( 1 << 24 )
-
-#define TD_STATUS_ERROR_ACTIVE ( 1 << 23 )
-#define TD_STATUS_ERROR_STALLED ( 1 << 22 )
-#define TD_STATUS_ERROR_BUFFER ( 1 << 21 )
-#define TD_STATUS_ERROR_BABBLE ( 1 << 20 )
-#define TD_STATUS_ERROR_NAK ( 1 << 19 )
-#define TD_STATUS_ERROR_CRC ( 1 << 18 )
-#define TD_STATUS_ERROR_BIT_STUFF ( 1 << 17 )
-#define TD_STATUS_ERROR_RESERVED ( 1 << 16 )
-#define TD_STATUS_ERROR_POS 16
-#define TD_STATUS_ERROR_MASK ( 0xff )
-
-#define TD_STATUS_ACTLEN_POS 0
-#define TD_STATUS_ACTLEN_MASK 0x7ff
-
-	volatile uint32_t device;
-
-#define TD_DEVICE_MAXLEN_POS 21
-#define TD_DEVICE_MAXLEN_MASK ( 0x7ff )
-#define TD_DEVICE_RESERVED_FLAG ( 1 << 20 )
-#define TD_DEVICE_DATA_TOGGLE_ONE_FLAG ( 1 << 19 )
-#define TD_DEVICE_ENDPOINT_POS 15
-#define TD_DEVICE_ENDPOINT_MASK ( 0xf )
-#define TD_DEVICE_ADDRESS_POS 8
-#define TD_DEVICE_ADDRESS_MASK ( 0x7f )
-#define TD_DEVICE_PID_POS 0
-#define TD_DEVICE_PID_MASK ( 0xff )
-
-	volatile uint32_t buffer_ptr;
-
-	/* there is 16 bytes of data available here
-	 * those are used to store callback pointer
-	 * and next pointer. Thus, there is some free space
-	 * on 32bits systems.
-	 */
-	struct transfer_descriptor *next_va;
-	callback_t *callback;
-} __attribute__((packed)) transfer_descriptor_t;
-
-
-void transfer_descriptor_init(transfer_descriptor_t *instance,
-  int error_count, size_t size, bool isochronous, usb_target_t target,
-	int pid, void *buffer);
-
-static inline transfer_descriptor_t * transfer_descriptor_get(
-  int error_count, size_t size, bool isochronous, usb_target_t target,
-  int pid, void *buffer)
-{
-	transfer_descriptor_t * instance =
-	  malloc32(sizeof(transfer_descriptor_t));
-
-	if (instance)
-		transfer_descriptor_init(
-		  instance, error_count, size, isochronous, target, pid, buffer);
-	return instance;
-}
-
-void transfer_descriptor_fini(transfer_descriptor_t *instance);
-
-static inline void transfer_descriptor_dispose(transfer_descriptor_t *instance)
-{
-	assert(instance);
-	transfer_descriptor_fini(instance);
-	free32(instance);
-}
-
-static inline void transfer_descriptor_append(
-  transfer_descriptor_t *instance, transfer_descriptor_t *item)
-{
-	assert(instance);
-	instance->next_va = item;
-	instance->next = (uintptr_t)addr_to_phys( item ) & LINK_POINTER_ADDRESS_MASK;
-}
-#endif
-/**
- * @}
- */
Index: pace/drv/uhci/utils/malloc32.h
===================================================================
--- uspace/drv/uhci/utils/malloc32.h	(revision 72e19f5092b40f5bf5640a8288771e2f8675b49e)
+++ 	(revision )
@@ -1,82 +1,0 @@
-/*
- * Copyright (c) 2010 Jan Vesely
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/** @addtogroup usb
- * @{
- */
-/** @file
- * @brief UHCI driver
- */
-#ifndef DRV_UHCI_TRANSLATOR_H
-#define DRV_UHCI_TRANSLATOR_H
-
-#include <usb/usbmem.h>
-
-#include <assert.h>
-#include <malloc.h>
-#include <mem.h>
-#include <as.h>
-
-#define UHCI_STRCUTURES_ALIGNMENT 16
-#define UHCI_REQUIRED_PAGE_SIZE 4096
-
-static inline void * addr_to_phys(void *addr)
-{
-	uintptr_t result;
-	int ret = as_get_physical_mapping(addr, &result);
-
-	assert(ret == 0);
-	return (void*)(result | ((uintptr_t)addr & 0xfff));
-}
-
-static inline void * malloc32(size_t size)
-	{ return memalign(UHCI_STRCUTURES_ALIGNMENT, size); }
-
-static inline void * get_page()
-{
-	void * free_address = as_get_mappable_page(UHCI_REQUIRED_PAGE_SIZE);
-	assert(free_address);
-	if (free_address == 0)
-		return 0;
-	void* ret =
-	  as_area_create(free_address, UHCI_REQUIRED_PAGE_SIZE,
-		  AS_AREA_READ | AS_AREA_WRITE);
-	if (ret != free_address)
-		return 0;
-	return ret;
-}
-
-static inline void * memalign32(size_t size, size_t alignment)
-	{ return memalign(alignment, size); }
-
-static inline void free32(void * addr)
-	{ free(addr); }
-
-#endif
-/**
- * @}
- */
