Index: uspace/lib/libc/Makefile
===================================================================
--- uspace/lib/libc/Makefile	(revision 57937dd6bf7466b5c022cfaf61001daece9e0a5a)
+++ uspace/lib/libc/Makefile	(revision 5cd136abc29be1860cb1f40730725d7f1d76a017)
@@ -54,4 +54,5 @@
 	generic/devmap.c \
 	generic/devman.c \
+	generic/device/hw_res.c \
 	generic/event.c \
 	generic/errno.c \
Index: uspace/lib/libc/generic/device/hw_res.c
===================================================================
--- uspace/lib/libc/generic/device/hw_res.c	(revision 5cd136abc29be1860cb1f40730725d7f1d76a017)
+++ uspace/lib/libc/generic/device/hw_res.c	(revision 5cd136abc29be1860cb1f40730725d7f1d76a017)
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2010 Lenka Trochtova
+ * 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 libc
+ * @{
+ */
+/** @file
+ */
+ 
+#include <device/hw_res.h>
+#include <errno.h>
+#include <async.h>
+#include <malloc.h>
+ 
+
+bool get_hw_resources(int dev_phone, hw_resource_list_t *hw_resources)
+{
+	bool ret = true;
+	ipcarg_t count = 0;
+	int rc = async_req_1_1(dev_phone, HW_RES_DEV_IFACE, GET_RESOURCE_LIST, &count);
+	hw_resources->count = count;
+	if (EOK != rc) {
+		return false;
+	}
+	
+	size_t size = count * sizeof(hw_resource_t);
+	hw_resources->resources = (hw_resource_t *)malloc(size);
+	if (NULL == hw_resources->resources) {
+		size = 0;
+		ret = false;
+	}
+	
+	rc = async_data_read_start(dev_phone, hw_resources->resources, size);
+	if (EOK != rc) {
+		free(hw_resources->resources);
+		hw_resources->resources = NULL;
+		ret = false;
+	}
+	 	 
+	return ret;	 
+}
+
+bool enable_interrupt(int dev_phone)
+{
+	int rc = async_req_1_0(dev_phone, HW_RES_DEV_IFACE, ENABLE_INTERRUPT);
+	return rc == EOK;
+}
+ 
+ 
+ 
+ /** @}
+ */
Index: uspace/lib/libc/generic/devman.c
===================================================================
--- uspace/lib/libc/generic/devman.c	(revision 57937dd6bf7466b5c022cfaf61001daece9e0a5a)
+++ uspace/lib/libc/generic/devman.c	(revision 5cd136abc29be1860cb1f40730725d7f1d76a017)
@@ -28,4 +28,10 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+ 
+ /** @addtogroup libc
+ * @{
+ */
+/** @file
+ */
 
 #include <string.h>
@@ -193,2 +199,35 @@
 	}
 }
+
+int devman_device_connect(device_handle_t handle, unsigned int flags)
+{
+	int phone;
+	
+	if (flags & IPC_FLAG_BLOCKING) {
+		phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_DEVMAN,
+		    DEVMAN_CONNECT_TO_DEVICE, handle);
+	} else {
+		phone = ipc_connect_me_to(PHONE_NS, SERVICE_DEVMAN,
+		    DEVMAN_CONNECT_TO_DEVICE, handle);
+	}
+	
+	return phone;
+}
+
+int devman_parent_device_connect(device_handle_t handle, unsigned int flags)
+{
+	int phone;
+	
+	if (flags & IPC_FLAG_BLOCKING) {
+		phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_DEVMAN,
+		    DEVMAN_CONNECT_TO_PARENTS_DEVICE, handle);
+	} else {
+		phone = ipc_connect_me_to(PHONE_NS, SERVICE_DEVMAN,
+		    DEVMAN_CONNECT_TO_PARENTS_DEVICE, handle);
+	}
+	
+	return phone;
+}
+
+/** @}
+ */
Index: uspace/lib/libc/include/device/hw_res.h
===================================================================
--- uspace/lib/libc/include/device/hw_res.h	(revision 5cd136abc29be1860cb1f40730725d7f1d76a017)
+++ uspace/lib/libc/include/device/hw_res.h	(revision 5cd136abc29be1860cb1f40730725d7f1d76a017)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2010 Lenka Trochtova
+ * 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 libc
+ * @{
+ */
+/** @file
+ */
+ 
+#ifndef LIBC_DEVICE_HW_RES_H_
+#define LIBC_DEVICE_HW_RES_H_
+
+#include <ipc/dev_iface.h>
+#include <bool.h>
+
+
+bool get_hw_resources(int dev_phone, hw_resource_list_t *hw_resources);
+
+bool enable_interrupt(int dev_phone);
+
+
+#endif
+
+/** @}
+ */
Index: uspace/lib/libc/include/devman.h
===================================================================
--- uspace/lib/libc/include/devman.h	(revision 57937dd6bf7466b5c022cfaf61001daece9e0a5a)
+++ uspace/lib/libc/include/devman.h	(revision 5cd136abc29be1860cb1f40730725d7f1d76a017)
@@ -48,4 +48,7 @@
 int devman_child_device_register(const char *, match_id_list_t *, device_handle_t, device_handle_t *);
 
+int devman_device_connect(device_handle_t handle, unsigned int flags);
+int devman_parent_device_connect(device_handle_t handle, unsigned int flags);
+
 
 #endif
Index: uspace/lib/libc/include/ipc/dev_iface.h
===================================================================
--- uspace/lib/libc/include/ipc/dev_iface.h	(revision 57937dd6bf7466b5c022cfaf61001daece9e0a5a)
+++ uspace/lib/libc/include/ipc/dev_iface.h	(revision 5cd136abc29be1860cb1f40730725d7f1d76a017)
@@ -77,8 +77,8 @@
 			int irq;			
 		} intr;		
-	};	
+	} res;	
 } hw_resource_t;
 
-typedef struct {
+typedef struct hw_resource_list {
 	size_t count;
 	hw_resource_t *resources;	
Index: uspace/lib/libc/include/ipc/devman.h
===================================================================
--- uspace/lib/libc/include/ipc/devman.h	(revision 57937dd6bf7466b5c022cfaf61001daece9e0a5a)
+++ uspace/lib/libc/include/ipc/devman.h	(revision 5cd136abc29be1860cb1f40730725d7f1d76a017)
@@ -116,5 +116,6 @@
 	DEVMAN_DRIVER = 1,
 	DEVMAN_CLIENT,
-	DEVMAN_CONNECT_TO_DEVICE
+	DEVMAN_CONNECT_TO_DEVICE,
+	DEVMAN_CONNECT_TO_PARENTS_DEVICE
 } devman_interface_t;
 
Index: uspace/lib/libdrv/generic/driver.c
===================================================================
--- uspace/lib/libdrv/generic/driver.c	(revision 57937dd6bf7466b5c022cfaf61001daece9e0a5a)
+++ uspace/lib/libdrv/generic/driver.c	(revision 5cd136abc29be1860cb1f40730725d7f1d76a017)
@@ -141,4 +141,7 @@
 		return;
 	}
+	
+	
+	// TODO - if the client is not a driver, check whether it is allowed to use the device
 
 	// TODO open the device (introduce some callbacks for opening and closing devices registered by the driver)
Index: uspace/srv/devman/devman.c
===================================================================
--- uspace/srv/devman/devman.c	(revision 57937dd6bf7466b5c022cfaf61001daece9e0a5a)
+++ uspace/srv/devman/devman.c	(revision 5cd136abc29be1860cb1f40730725d7f1d76a017)
@@ -506,10 +506,10 @@
 	if (rc != EOK) {
 		// TODO handle error
-		return false;
+		return;
 	}
 	
 	// TODO inspect return value (ret) to find out whether the device was successfully probed and added
 	
-	return true;
+	return;
 }
 
@@ -618,5 +618,5 @@
  * @return true on success, false otherwise (insufficient resources etc.).
  */
-bool insert_dev_node(dev_tree_t *tree, node_t *node, const char *dev_name, node_t *parent)
+bool insert_dev_node(dev_tree_t *tree, node_t *node, char *dev_name, node_t *parent)
 {
 	printf(NAME ": insert_dev_node\n");
@@ -650,4 +650,69 @@
 }
 
+/** 
+ * Find device node with a specified path in the device tree.
+ * 
+ * @param path the path of the device node in the device tree.
+ * @param tree the device tree.
+ * 
+ * @return the device node if it is present in the tree, NULL otherwise.
+ */
+node_t * find_dev_node_by_path(dev_tree_t *tree, char *path)
+{
+	node_t *dev = tree->root_node;
+	char *rel_path = path;
+	char *next_path_elem = NULL;
+	size_t elem_size = 0;
+	bool cont = '/' == rel_path[0];
+	
+	while (cont && NULL != dev) {		
+		next_path_elem  = get_path_elem_end(rel_path+1);		
+		if ('/' == next_path_elem[0]) {
+			cont = true;
+			next_path_elem[0] = 0;
+		} else {
+			cont = false;
+		}
+		
+		dev = find_node_child(dev, rel_path);		
+		
+		if (cont) {
+			next_path_elem[0] = '/';
+		}
+		rel_path = next_path_elem;		
+	}
+	
+	return dev;
+}
+
+/**
+ * Find child device node with a specified name.
+ * 
+ * @param parent the parent device node.
+ * @param name the name of the child device node.
+ * 
+ * @return the child device node.
+ */
+node_t *find_node_child(node_t *parent, const char *name)
+{
+	node_t *dev;
+	link_t *link;
+	
+	fibril_mutex_lock(&parent->children_mutex);		
+	link = parent->children.next;
+	
+	while (link != &parent->children) {
+		dev = list_get_instance(link, node_t, sibling);
+		
+		if (0 == str_cmp(name, dev->name)) {
+			fibril_mutex_unlock(&parent->children_mutex);
+			return dev;			
+		}
+	}	
+	
+	fibril_mutex_unlock(&parent->children_mutex);	
+	return NULL;
+}
+
 /** @}
  */
Index: uspace/srv/devman/devman.h
===================================================================
--- uspace/srv/devman/devman.h	(revision 57937dd6bf7466b5c022cfaf61001daece9e0a5a)
+++ uspace/srv/devman/devman.h	(revision 5cd136abc29be1860cb1f40730725d7f1d76a017)
@@ -238,4 +238,10 @@
 }
 
+/**
+ * Delete a device node.
+ * 
+ * @param node a device node structure.
+ * 
+ */
 static inline void delete_dev_node(node_t *node)
 {
@@ -263,9 +269,12 @@
 }
 
+node_t * find_dev_node_by_path(dev_tree_t *tree, char *path);
+node_t *find_node_child(node_t *parent, const char *name);
+
 // Device tree
 
 bool init_device_tree(dev_tree_t *tree, driver_list_t *drivers_list);
 bool create_root_node(dev_tree_t *tree);
-bool insert_dev_node(dev_tree_t *tree, node_t *node, const char *dev_name, node_t *parent);
+bool insert_dev_node(dev_tree_t *tree, node_t *node, char *dev_name, node_t *parent);
 
 #endif
Index: uspace/srv/devman/main.c
===================================================================
--- uspace/srv/devman/main.c	(revision 57937dd6bf7466b5c022cfaf61001daece9e0a5a)
+++ uspace/srv/devman/main.c	(revision 5cd136abc29be1860cb1f40730725d7f1d76a017)
@@ -51,4 +51,5 @@
 #include <ctype.h>
 #include <ipc/devman.h>
+#include <ipc/driver.h>
 #include <thread.h>
 
@@ -158,5 +159,5 @@
 {
 	int ret = EOK;
-	int i;
+	size_t i;
 	for (i = 0; i < match_count; i++) {
 		if (EOK != (ret = devman_receive_match_id(match_ids))) {
@@ -257,4 +258,35 @@
 }
 
+static void devman_forward(ipc_callid_t iid, ipc_call_t *icall, bool drv_to_parent) {
+	device_handle_t handle;
+	node_t *dev = find_dev_node(&device_tree, handle);
+	if (NULL == dev) {
+		ipc_answer_0(iid, ENOENT);
+		return;
+	}
+	
+	driver_t *driver = NULL;
+	
+	if (drv_to_parent) {
+		driver = dev->parent->drv;
+	} else {
+		driver = dev->drv;		
+	}
+	
+	if (NULL == driver) {		
+		ipc_answer_0(iid, ENOENT);
+		return;	
+	}
+	
+	int method;	
+	if (drv_to_parent) {
+		method = DRIVER_DRIVER;
+	} else {
+		method = DRIVER_CLIENT;
+	}
+	
+	ipc_forward_fast(iid, driver->phone, method, dev->handle, 0, IPC_FF_NONE);	
+}
+
 /** Function for handling connections to device manager.
  *
@@ -269,9 +301,13 @@
 	/*case DEVMAN_CLIENT:
 		devmap_connection_client(iid, icall);
-		break;
+		break;*/
 	case DEVMAN_CONNECT_TO_DEVICE:
 		// Connect client to selected device
-		devmap_forward(iid, icall);
-		break;*/
+		devman_forward(iid, icall, false);
+		break;
+	case DEVMAN_CONNECT_TO_PARENTS_DEVICE:
+		// Connect client to selected device
+		devman_forward(iid, icall, true);
+		break;		
 	default:
 		/* No such interface */
Index: uspace/srv/devman/util.c
===================================================================
--- uspace/srv/devman/util.c	(revision 57937dd6bf7466b5c022cfaf61001daece9e0a5a)
+++ uspace/srv/devman/util.c	(revision 5cd136abc29be1860cb1f40730725d7f1d76a017)
@@ -61,2 +61,10 @@
 	return res;
 }
+
+const char * get_path_elem_end(const char *path)
+{
+	while (0 != *path && '/' != *path) {
+		path++;
+	}
+	return path;
+}
Index: uspace/srv/devman/util.h
===================================================================
--- uspace/srv/devman/util.h	(revision 57937dd6bf7466b5c022cfaf61001daece9e0a5a)
+++ uspace/srv/devman/util.h	(revision 5cd136abc29be1860cb1f40730725d7f1d76a017)
@@ -38,4 +38,5 @@
 
 char * get_abs_path(const char *base_path, const char *name, const char *ext);
+const char * get_path_elem_end(const char *path);
 
 static inline bool skip_spaces(const char **buf) 
Index: uspace/srv/drivers/rootia32/rootia32.c
===================================================================
--- uspace/srv/drivers/rootia32/rootia32.c	(revision 57937dd6bf7466b5c022cfaf61001daece9e0a5a)
+++ uspace/srv/drivers/rootia32/rootia32.c	(revision 5cd136abc29be1860cb1f40730725d7f1d76a017)
@@ -49,6 +49,11 @@
 #include <devman.h>
 #include <ipc/devman.h>
+#include <ipc/dev_iface.h>
 
 #define NAME "rootia32"
+
+typedef struct rootia32_dev_data {
+	hw_resource_list_t hw_resources;	
+} rootia32_dev_data_t;
 
 static bool rootia32_add_device(device_t *dev);
@@ -68,6 +73,24 @@
 };
 
-// TODO HW resources
-static bool rootia32_add_child(device_t *parent, const char *name, const char *str_match_id) {
+static hw_resource_t pci_conf_regs = {
+	.type = REGISTER,
+	.res.reg = {
+		.address = (void *)0xCF8,
+		.size = 8,
+		.endianness = LITTLE_ENDIAN	
+	}	
+};
+
+static rootia32_dev_data_t pci_data = {
+	.hw_resources = {
+		1, 
+		&pci_conf_regs
+	}
+};
+
+static bool rootia32_add_child(
+	device_t *parent, const char *name, const char *str_match_id, 
+	rootia32_dev_data_t *drv_data) 
+{
 	printf(NAME ": adding new child device '%s'.\n", name);
 	
@@ -81,4 +104,5 @@
 	
 	child->name = name;
+	child->driver_data = drv_data;
 	
 	// initialize match id list
@@ -112,7 +136,7 @@
 }
 
-static bool rootia32_add_children(dev) 
+static bool rootia32_add_children(device_t *dev) 
 {
-	return rootia32_add_child(dev, "pci0", "intel_pci");
+	return rootia32_add_child(dev, "pci0", "intel_pci", &pci_data);
 }
 
