Index: uspace/lib/libc/generic/devman.c
===================================================================
--- uspace/lib/libc/generic/devman.c	(revision 7707954c8462caa1ddf08a7f529ad43f26141e2c)
+++ uspace/lib/libc/generic/devman.c	(revision bda60d956a93a1fe2c05dbb02aabd00c3d081874)
@@ -106,5 +106,6 @@
 }
 
-int devman_child_device_register(const char *name, long parent_handle, long *handle)
+int devman_child_device_register(
+	const char *name, match_id_list_t *match_ids, device_handle_t parent_handle, device_handle_t *handle)
 {	
 	int phone = devman_get_phone(DEVMAN_DRIVER, IPC_FLAG_BLOCKING);
@@ -124,4 +125,6 @@
 		return retval;
 	}
+	
+	// TODO match ids
 	
 	async_wait_for(req, &retval);
Index: uspace/lib/libc/include/devman.h
===================================================================
--- uspace/lib/libc/include/devman.h	(revision 7707954c8462caa1ddf08a7f529ad43f26141e2c)
+++ uspace/lib/libc/include/devman.h	(revision bda60d956a93a1fe2c05dbb02aabd00c3d081874)
@@ -46,5 +46,5 @@
 
 int devman_driver_register(const char *, async_client_conn_t);
-int devman_child_device_register(const char *name, long parent_handle, long *handle);
+int devman_child_device_register(const char *, match_id_list_t *, device_handle_t, device_handle_t *);
 
 
Index: uspace/lib/libc/include/ipc/devman.h
===================================================================
--- uspace/lib/libc/include/ipc/devman.h	(revision 7707954c8462caa1ddf08a7f529ad43f26141e2c)
+++ uspace/lib/libc/include/ipc/devman.h	(revision bda60d956a93a1fe2c05dbb02aabd00c3d081874)
@@ -34,7 +34,82 @@
 #define LIBC_IPC_DEVMAN_H_
 
+#include <adt/list.h>
 #include <ipc/ipc.h>
+#include <stdlib.h>
+#include <string.h>
 
 #define DEVMAN_NAME_MAXLEN 256
+
+typedef ipcarg_t device_handle_t;
+
+/** Ids of device models used for device-to-driver matching.
+ */
+typedef struct match_id {
+	/** Pointers to next and previous ids.
+	 */
+	link_t link;
+	/** Id of device model.
+	 */
+	const char *id;
+	/** Relevancy of device-to-driver match.
+	 * The higher is the product of scores specified for the device by the bus driver and by the leaf driver,
+	 * the more suitable is the leaf driver for handling the device.
+	 */
+	unsigned int score;
+} match_id_t;
+
+/** List of ids for matching devices to drivers sorted
+ * according to match scores in descending order.
+ */
+typedef struct match_id_list {
+	link_t ids;
+} match_id_list_t;
+
+
+static inline match_id_t * create_match_id()
+{
+	match_id_t *id = malloc(sizeof(match_id_t));
+	memset(id, 0, sizeof(match_id_t));
+	return id;
+}
+
+static inline void delete_match_id(match_id_t *id)
+{
+	if (id) {
+		if (NULL != id->id) {
+			free(id->id);
+		}
+		free(id);
+	}
+}
+
+static inline void add_match_id(match_id_list_t *ids, match_id_t *id) 
+{
+	match_id_t *mid = NULL;
+	link_t *link = ids->ids.next;	
+	
+	while (link != &ids->ids) {
+		mid = list_get_instance(link, match_id_t,link);
+		if (mid->score < id->score) {
+			break;
+		}	
+		link = link->next;
+	}
+	
+	list_insert_before(&id->link, link);	
+}
+
+static inline void clean_match_ids(match_id_list_t *ids)
+{
+	link_t *link = NULL;
+	match_id_t *id;
+	
+	while(!list_empty(&ids->ids)) {
+		link = ids->ids.next;
+		list_remove(link);		
+		id = list_get_instance(link, match_id_t, link);
+		delete_match_id(id);		
+	}	
+}
 
 typedef enum {
Index: uspace/lib/libdrv/generic/driver.c
===================================================================
--- uspace/lib/libdrv/generic/driver.c	(revision 7707954c8462caa1ddf08a7f529ad43f26141e2c)
+++ uspace/lib/libdrv/generic/driver.c	(revision bda60d956a93a1fe2c05dbb02aabd00c3d081874)
@@ -72,5 +72,5 @@
 	// result of the operation - device was added, device is not present etc.
 	ipcarg_t ret = 0;	
-	ipcarg_t dev_handle =  IPC_GET_ARG1(*icall);
+	device_handle_t dev_handle =  IPC_GET_ARG1(*icall);
 	
 	printf("%s: adding device with handle = %x \n", driver->name, dev_handle);
@@ -109,6 +109,5 @@
 				ipc_answer_0(callid, ENOENT);
 		}
-	}
-	
+	}	
 }
 
@@ -150,7 +149,11 @@
 }
 
-bool child_device_register(device_t *child, const char *child_name, device_t *parent)
+bool child_device_register(device_t *child, device_t *parent)
 {
-	if (devman_child_device_register(child_name, parent->handle, &child->handle)) {
+	printf("%s: child_device_register\n", driver->name);
+	
+	assert(NULL != child->name);
+	
+	if (devman_child_device_register(child->name, &child->match_ids, parent->handle, &child->handle)) {
 		// TODO initialize child device
 		return true;
Index: uspace/lib/libdrv/include/driver.h
===================================================================
--- uspace/lib/libdrv/include/driver.h	(revision 7707954c8462caa1ddf08a7f529ad43f26141e2c)
+++ uspace/lib/libdrv/include/driver.h	(revision bda60d956a93a1fe2c05dbb02aabd00c3d081874)
@@ -37,8 +37,11 @@
 
 #include <adt/list.h>
+#include <ipc/devman.h>
 
 typedef struct device {
-	long handle;
+	device_handle_t handle;
 	ipcarg_t parent_phone;	
+	const char *name;
+	match_id_list_t match_ids;
 	
 	// TODO add more items - parent bus type etc.
@@ -64,11 +67,18 @@
 	if (NULL != dev) {
 		memset(dev, 0, sizeof(device_t));
-	}
-	
+	}	
+	list_initialize(&dev->match_ids.ids);
 	return dev;
 }
 
-bool child_device_register(device_t *child, const char *child_name, device_t *parent);
+static inline delete_device(device_t *dev) {
+	clean_match_ids(&dev->match_ids);
+	if (NULL != dev->name) {
+		free(dev->name);
+	}
+	free(dev);
+}
 
+bool child_device_register(device_t *child, device_t *parent);
 
 
