Index: uspace/lib/libc/include/ipc/dev_iface.h
===================================================================
--- uspace/lib/libc/include/ipc/dev_iface.h	(revision a1769ee69bfe08ce9226b2933a4d000a1218afd1)
+++ uspace/lib/libc/include/ipc/dev_iface.h	(revision 52b7b1bbd4f8f9ead4e0983202eb03440f1d7450)
@@ -35,6 +35,5 @@
 
 typedef enum {	
-	GENERIC_DEV_IFACE = DEV_IFACE_FIRST,
-	DIRECTLY_ADDRESSABLE_DEV_IFACE,	
+	HW_RES_DEV_IFACE = DEV_IFACE_FIRST,	
 	// TODO add more interfaces
 	DEV_IFACE_MAX
@@ -45,8 +44,44 @@
 
 
+// data types related to some interface - TODO move this to separate header files
 
 
+// HW resource provider interface
 
+typedef enum {
+	GET_RESOURCE_LIST = 0,
+	ENABLE_INTERRUPT	
+} hw_res_funcs_t;
 
+/** HW resource types. */
+typedef enum {
+	INTERRUPT,
+	REGISTER
+} hw_res_type_t;
+
+typedef enum {
+	LITTLE_ENDIAN = 0,
+	BIG_ENDIAN
+} endianness_t;
+
+/** HW resource (e.g. interrupt, memory register, i/o register etc.). */
+typedef struct hw_resource {
+	hw_res_type_t type;
+	union {
+		struct {
+			void *address;
+			endianness_t endianness;			
+			size_t size;			
+		} reg;
+		struct {
+			int irq;			
+		} intr;		
+	};	
+} hw_resource_t;
+
+typedef struct {
+	size_t count;
+	hw_resource_t *resources;	
+} hw_resource_list_t;
 
 #endif
Index: uspace/lib/libdrv/Makefile
===================================================================
--- uspace/lib/libdrv/Makefile	(revision a1769ee69bfe08ce9226b2933a4d000a1218afd1)
+++ uspace/lib/libdrv/Makefile	(revision 52b7b1bbd4f8f9ead4e0983202eb03440f1d7450)
@@ -35,5 +35,7 @@
 
 SOURCES = \
-	generic/driver.c
+	generic/driver.c \
+	generic/dev_iface.c \
+	generic/remote_res.h
 
 include ../Makefile.common
Index: uspace/lib/libdrv/generic/dev_iface.c
===================================================================
--- uspace/lib/libdrv/generic/dev_iface.c	(revision a1769ee69bfe08ce9226b2933a4d000a1218afd1)
+++ uspace/lib/libdrv/generic/dev_iface.c	(revision 52b7b1bbd4f8f9ead4e0983202eb03440f1d7450)
@@ -36,5 +36,28 @@
  */
  
- #include "driver.h"
+#include "dev_iface.h"
+#include "remote_res.h"
+ 
+static iface_dipatch_table_t remote_ifaces = {
+	.ifaces = {
+		&remote_res_iface
+	}
+};
+
+remote_iface_t* get_remote_iface(dev_inferface_id_t id)
+{
+	assert(is_valid_iface_id(id));
+	
+	int idx = get_iface_index(id);
+	return remote_ifaces.ifaces[idx];	
+}
+
+remote_iface_func_ptr_t get_remote_method(remote_iface_t *rem_iface, ipcarg_t iface_method_idx)
+{
+	if (iface_method_idx >= rem_iface->method_count) {
+		return NULL;
+	}
+	return rem_iface->methods[iface_method_idx];
+}
  
  
Index: uspace/lib/libdrv/generic/driver.c
===================================================================
--- uspace/lib/libdrv/generic/driver.c	(revision a1769ee69bfe08ce9226b2933a4d000a1218afd1)
+++ uspace/lib/libdrv/generic/driver.c	(revision 52b7b1bbd4f8f9ead4e0983202eb03440f1d7450)
@@ -35,5 +35,5 @@
 /** @file
  */
- 
+
 #include <assert.h>
 #include <ipc/services.h>
@@ -62,14 +62,14 @@
 	device_t *dev = (device_t *)malloc(sizeof(device_t));
 	if (NULL != dev) {
-		memset(dev, 0, sizeof(device_t));		
-	}	
-	return dev;	
-}
-
-static device_t * driver_get_device(link_t *devices, device_handle_t handle) 
-{	
+		memset(dev, 0, sizeof(device_t));
+	}
+	return dev;
+}
+
+static device_t * driver_get_device(link_t *devices, device_handle_t handle)
+{
 	device_t *dev = NULL;
 	link_t *link = devices->next;
-	
+
 	while (link != devices) {
 		dev = list_get_instance(link, device_t, link);
@@ -78,15 +78,15 @@
 		}
 	}
-	
+
 	return NULL;
 }
 
-static void driver_add_device(ipc_callid_t iid, ipc_call_t *icall) 
+static void driver_add_device(ipc_callid_t iid, ipc_call_t *icall)
 {
 	printf("%s: driver_add_device\n", driver->name);
-	
+
 	// result of the operation - device was added, device is not present etc.
-	ipcarg_t ret = 0;	
-	device_handle_t dev_handle =  IPC_GET_ARG1(*icall);	
+	ipcarg_t ret = 0;
+	device_handle_t dev_handle =  IPC_GET_ARG1(*icall);
 	device_t *dev = driver_create_device();
 	dev->handle = dev_handle;
@@ -96,5 +96,5 @@
 	}
 	printf("%s: new device with handle = %x was added.\n", driver->name, dev_handle);
-	
+
 	ipc_answer_1(iid, EOK, ret);
 }
@@ -103,13 +103,13 @@
 {
 	printf("%s: driver_connection_devman \n", driver->name);
-	
+
 	/* Accept connection */
 	ipc_answer_0(iid, EOK);
-	
+
 	bool cont = true;
 	while (cont) {
 		ipc_call_t call;
 		ipc_callid_t callid = async_get_call(&call);
-		
+
 		switch (IPC_GET_METHOD(call)) {
 		case IPC_M_PHONE_HUNGUP:
@@ -123,48 +123,74 @@
 				ipc_answer_0(callid, ENOENT);
 		}
-	}	
-}
-
-/** 
+	}
+}
+
+/**
  * Generic client connection handler both for applications and drivers.
- * 
- * @param driver true for driver client, false for other clients (applications, services etc.). 
- */
-static void driver_connection_gen(ipc_callid_t iid, ipc_call_t *icall, bool driver) {
-	/*
-	 * Answer the first IPC_M_CONNECT_ME_TO call and remember the handle of the device to which the client connected.
-	 */
-	device_handle_t handle = IPC_GET_ARG1(*icall); 
+ *
+ * @param driver true for driver client, false for other clients (applications, services etc.).
+ */
+static void driver_connection_gen(ipc_callid_t iid, ipc_call_t *icall, bool driver)
+{
+	// Answer the first IPC_M_CONNECT_ME_TO call and remember the handle of the device to which the client connected.
+	device_handle_t handle = IPC_GET_ARG1(*icall);
 	device_t *dev = driver_get_device(&devices, handle);
-	
+
 	if (dev == NULL) {
 		ipc_answer_0(iid, ENOENT);
 		return;
 	}
+
+	// TODO open the device (introduce some callbacks for opening and closing devices registered by the driver)
 	
-	// TODO introduce generic device interface for opening and closing devices
-	// and call its open callback here to find out wheter the device can be used by the connecting client
-		
-
 	ipc_answer_0(iid, EOK);
-	
+
 	while (1) {
 		ipc_callid_t callid;
 		ipc_call_t call;
-	
+
 		callid = async_get_call(&call);
 		ipcarg_t method = IPC_GET_METHOD(call);
 		switch  (method) {
 		case IPC_M_PHONE_HUNGUP:
-			// TODO close the device 
+		
+			// TODO close the device
+			
 			ipc_answer_0(callid, EOK);
 			return;
 		default:
-			if (DEV_IFACE_FIRST <= method && method < DEV_IFACE_MAX) {
-				// TODO - try to find interface, if supported
-				// otherwise return  ENOTSUP				
-			} else {
+
+			if (!is_valid_iface_id(method)) {
+				// this is not device's interface
 				ipc_answer_0(callid, ENOTSUP);
+				break;
 			}
+
+			// calling one of the device's interfaces
+			
+			// get the device interface structure
+			void *iface = device_get_iface(dev, method);
+			if (NULL == iface) {
+				ipc_answer_0(callid, ENOTSUP);
+				break;
+			}
+
+			// get the corresponding interface for remote request handling ("remote interface")
+			remote_iface_t* rem_iface = get_remote_iface(method);
+			assert(NULL != rem_iface);
+
+			// get the method of the remote interface
+			ipcarg_t iface_method_idx = IPC_GET_ARG1(call);
+			remote_iface_func_ptr_t iface_method_ptr = get_remote_method(rem_iface, iface_method_idx);
+			if (NULL == iface_method_ptr) {
+				// the interface has not such method
+				ipc_answer_0(callid, ENOTSUP);
+				break;
+			}
+			
+			// call the remote interface's method, which will receive parameters from the remote client
+			// and it will pass it to the corresponding local interface method associated with the device 
+			// by its driver
+			(*iface_method_ptr)(dev, iface, callid, &call);
 			break;
 		}
@@ -174,10 +200,10 @@
 static void driver_connection_driver(ipc_callid_t iid, ipc_call_t *icall)
 {
-	driver_connection_gen(iid, icall, true); 
+	driver_connection_gen(iid, icall, true);
 }
 
 static void driver_connection_client(ipc_callid_t iid, ipc_call_t *icall)
 {
-	driver_connection_gen(iid, icall, false); 
+	driver_connection_gen(iid, icall, false);
 }
 
@@ -199,10 +225,10 @@
 		break;
 	case DRIVER_CLIENT:
-		// handle requests from client applications 
+		// handle requests from client applications
 		driver_connection_client(iid, icall);
 		break;
 
 	default:
-		/* No such interface */ 
+		/* No such interface */
 		ipc_answer_0(iid, ENOENT);
 	}
@@ -212,7 +238,7 @@
 {
 	printf("%s: child_device_register\n", driver->name);
-	
+
 	assert(NULL != child->name);
-	
+
 	if (EOK == devman_child_device_register(child->name, &child->match_ids, parent->handle, &child->handle)) {
 		return true;
@@ -221,16 +247,16 @@
 }
 
-int driver_main(driver_t *drv) 
+int driver_main(driver_t *drv)
 {
 	// remember the driver structure - driver_ops will be called by generic handler for incoming connections
 	driver = drv;
-	
+
 	// register driver by device manager with generic handler for incoming connections
-	devman_driver_register(driver->name, driver_connection);		
+	devman_driver_register(driver->name, driver_connection);
 
 	async_manager();
 
 	// Never reached
-	return 0;	
+	return 0;
 }
 
Index: uspace/lib/libdrv/generic/remote_res.c
===================================================================
--- uspace/lib/libdrv/generic/remote_res.c	(revision 52b7b1bbd4f8f9ead4e0983202eb03440f1d7450)
+++ uspace/lib/libdrv/generic/remote_res.c	(revision 52b7b1bbd4f8f9ead4e0983202eb03440f1d7450)
@@ -0,0 +1,80 @@
+/*
+ * 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 libdrv
+ * @{
+ */
+/** @file
+ */
+
+#include <ipc/ipc.h>
+#include <errno.h>
+
+#include "driver.h"
+#include "resource.h"
+
+ 
+static void remote_res_get_resources(device_t *dev, void *iface, ipc_callid_t callid, ipc_call_t *call);
+static void remote_res_enable_interrupt(device_t *dev, void *iface, ipc_callid_t callid, ipc_call_t *call);
+
+static remote_iface_func_ptr_t remote_res_iface_ops [] = {
+	&remote_res_get_resources,
+	&remote_res_enable_interrupt	
+}; 
+ 
+remote_iface_t remote_res_iface = {
+	.method_count = sizeof(remote_res_iface_ops) / sizeof(remote_iface_func_ptr_t),
+	.methods = remote_res_iface_ops
+};
+
+static void remote_res_enable_interrupt(device_t *dev, void *iface, ipc_callid_t callid, ipc_call_t *call)
+{
+	resource_iface_t *ires = (resource_iface_t *)iface;
+	
+	if (NULL == ires->enable_interrupt) {
+		ipc_answer_0(callid, ENOENT);
+	} else if (ires->enable_interrupt(dev)) {
+		ipc_answer_0(callid, EOK);
+	} else {
+		ipc_answer_0(callid, EREFUSED);
+	}	
+}
+
+static void remote_res_get_resources(device_t *dev, void *iface, ipc_callid_t callid, ipc_call_t *call)
+{
+	resource_iface_t *ires = (resource_iface_t *)iface;
+	
+	// TODO
+	
+	ipc_answer_0(callid, EOK);
+}
+ 
+ 
+ /**
+ * @}
+ */
Index: uspace/lib/libdrv/include/driver.h
===================================================================
--- uspace/lib/libdrv/include/driver.h	(revision a1769ee69bfe08ce9226b2933a4d000a1218afd1)
+++ uspace/lib/libdrv/include/driver.h	(revision 52b7b1bbd4f8f9ead4e0983202eb03440f1d7450)
@@ -39,4 +39,5 @@
 #include <ipc/devman.h>
 #include <ipc/dev_iface.h>
+#include <assert.h>
 
 struct device;
@@ -50,5 +51,5 @@
 
 typedef struct {
-	int method_count;
+	size_t method_count;
 	remote_iface_func_ptr_t *methods;
 } remote_iface_t;
@@ -68,16 +69,25 @@
 }
 
+remote_iface_t* get_remote_iface(dev_inferface_id_t id);
+remote_iface_func_ptr_t get_remote_method(remote_iface_t *rem_iface, ipcarg_t iface_method_idx);
+
+
 // device
 
+/** The device. */
 struct device {
+	/** Globally unique device identifier (assigned to the device by the device manager). */
 	device_handle_t handle;
+	/** The phone to the parent device driver.*/
 	ipcarg_t parent_phone;
+	/** The device's name.*/
 	const char *name;
+	/** The list of device ids for device-to-driver matching.*/
 	match_id_list_t match_ids;
+	/** The device driver's data associated with this device.*/
 	void *driver_data;
+	/** The table of interfaces exported by this device. */
 	void *interfaces[DEV_IFACE_COUNT];
-
-	// TODO add more items
-
+	/** Pointer to the previous and next device in the list of devices handled by the driver */
 	link_t link;
 };
@@ -86,11 +96,16 @@
 // driver
 
+/** Generic device driver operations. */
 typedef struct driver_ops {
+	/** Callback method for passing a new device to the device driver.*/
 	bool (*add_device)(device_t *dev);
 	// TODO add other generic driver operations
 } driver_ops_t;
 
+/** The driver structure.*/
 typedef struct driver {
+	/** The name of the device driver. */
 	const char *name;
+	/** Generic device driver operations. */
 	driver_ops_t *driver_ops;
 } driver_t;
@@ -102,4 +117,8 @@
 int driver_main(driver_t *drv);
 
+/** Create new device structure. 
+ * 
+ * @return the device structure.
+ */
 static inline device_t * create_device()
 {
@@ -112,4 +131,8 @@
 }
 
+/** Delete device structure. 
+ * 
+ * @param dev the device structure.
+ */
 static inline void delete_device(device_t *dev)
 {
@@ -129,4 +152,12 @@
 }
 
+static inline void * device_get_iface(device_t *dev, dev_inferface_id_t id)
+{
+	assert(is_valid_iface_id(id));
+	
+	int idx = get_iface_index(id);
+	return dev->interfaces[idx];	
+}
+
 bool child_device_register(device_t *child, device_t *parent);
 
Index: uspace/lib/libdrv/include/remote_res.h
===================================================================
--- uspace/lib/libdrv/include/remote_res.h	(revision 52b7b1bbd4f8f9ead4e0983202eb03440f1d7450)
+++ uspace/lib/libdrv/include/remote_res.h	(revision 52b7b1bbd4f8f9ead4e0983202eb03440f1d7450)
@@ -0,0 +1,43 @@
+/*
+ * 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 libdrv
+ * @{
+ */
+/** @file
+ */
+#ifndef LIBDRV_REMOTE_RES_H_
+#define LIBDRV_REMOTE_RES_H_
+
+remote_iface_t remote_res_iface;
+
+#endif
+
+/**
+ * @}
+ */
Index: uspace/lib/libdrv/include/resource.h
===================================================================
--- uspace/lib/libdrv/include/resource.h	(revision 52b7b1bbd4f8f9ead4e0983202eb03440f1d7450)
+++ uspace/lib/libdrv/include/resource.h	(revision 52b7b1bbd4f8f9ead4e0983202eb03440f1d7450)
@@ -0,0 +1,49 @@
+/*
+ * 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 libdrv
+ * @{
+ */
+/** @file
+ */
+#ifndef LIBDRV_RESOURCE_H_
+#define LIBDRV_RESOURCE_H_
+
+#include "driver.h"
+
+typedef struct resource_iface {
+	 hw_resource_list_t * (*get_resources)(device_t *dev);
+	 bool (*enable_interrupt)(device_t *dev);	
+} resource_iface_t;
+
+
+#endif
+
+/**
+ * @}
+ */
Index: uspace/srv/drivers/root/root.c
===================================================================
--- uspace/srv/drivers/root/root.c	(revision a1769ee69bfe08ce9226b2933a4d000a1218afd1)
+++ uspace/srv/drivers/root/root.c	(revision 52b7b1bbd4f8f9ead4e0983202eb03440f1d7450)
@@ -53,5 +53,4 @@
 
 static bool root_add_device(device_t *dev);
-static bool root_init();
 
 /** The root device driver's standard operations.
