Index: uspace/srv/devman/main.c
===================================================================
--- uspace/srv/devman/main.c	(revision 374ad3c3bf704b2f3c5a99e04d8f771d868a5269)
+++ uspace/srv/devman/main.c	(revision a79d88da204957831a1715d66a6d80828c09d5c1)
@@ -57,5 +57,5 @@
 #include "devman.h"
 
-#define DRIVER_DEFAULT_STORE  "/srv/drivers"
+#define DRIVER_DEFAULT_STORE  "/drv"
 
 static driver_list_t drivers_list;
Index: uspace/srv/drivers/isa/Makefile
===================================================================
--- uspace/srv/drivers/isa/Makefile	(revision 374ad3c3bf704b2f3c5a99e04d8f771d868a5269)
+++ 	(revision )
@@ -1,36 +1,0 @@
-# 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.
-#
-
-USPACE_PREFIX = ../../..
-LIBS = $(LIBDRV_PREFIX)/libdrv.a
-EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include
-BINARY = isa
-
-SOURCES = \
-	isa.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/drivers/isa/isa.c
===================================================================
--- uspace/srv/drivers/isa/isa.c	(revision 374ad3c3bf704b2f3c5a99e04d8f771d868a5269)
+++ 	(revision )
@@ -1,502 +1,0 @@
-/*
- * 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.
- */
-
-/**
- * @defgroup isa ISA bus driver.
- * @brief HelenOS ISA bus driver.
- * @{
- */
-
-/** @file
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <bool.h>
-#include <fibril_synch.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ctype.h>
-#include <macros.h>
-#include <malloc.h>
-#include <dirent.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-
-#include <driver.h>
-#include <resource.h>
-
-#include <devman.h>
-#include <ipc/devman.h>
-#include <device/hw_res.h>
-
-#define NAME "isa"
-#define CHILD_DEV_CONF_PATH "/srv/drivers/isa/isa.dev"
-
-#define ISA_MAX_HW_RES 4
-
-typedef struct isa_child_data {
-	hw_resource_list_t hw_resources;	
-} isa_child_data_t;
-
-static hw_resource_list_t * isa_get_child_resources(device_t *dev)
-{
-	isa_child_data_t *dev_data = (isa_child_data_t *)dev->driver_data;
-	if (NULL == dev_data) {
-		return NULL;
-	}
-	return &dev_data->hw_resources;
-}
-
-static bool isa_enable_child_interrupt(device_t *dev) 
-{
-	// TODO
-	
-	return false;
-}
-
-static resource_iface_t isa_child_res_iface = {
-	&isa_get_child_resources,
-	&isa_enable_child_interrupt	
-};
-
-static device_ops_t isa_child_dev_ops;
-
-static int isa_add_device(device_t *dev);
-
-/** The isa device driver's standard operations.
- */
-static driver_ops_t isa_ops = {
-	.add_device = &isa_add_device
-};
-
-/** The isa device driver structure. 
- */
-static driver_t isa_driver = {
-	.name = NAME,
-	.driver_ops = &isa_ops
-};
-
-
-static isa_child_data_t * create_isa_child_data() 
-{
-	 isa_child_data_t *data = (isa_child_data_t *) malloc(sizeof(isa_child_data_t));
-	 if (NULL != data) {
-		 memset(data, 0, sizeof(isa_child_data_t));
-	 }
-	 return data;	
-}
-
-static device_t * create_isa_child_dev()
-{
-	device_t *dev = create_device();
-	if (NULL == dev) {
-		return NULL;
-	}
-	isa_child_data_t *data = create_isa_child_data();
-	if (NULL == data) {
-		delete_device(dev);
-		return NULL;
-	}
-	
-	dev->driver_data = data;
-	return dev;
-}
-
-static char * read_dev_conf(const char *conf_path)
-{		
-	bool suc = false;	
-	char *buf = NULL;
-	bool opened = false;
-	int fd;		
-	size_t len = 0;
-	
-	fd = open(conf_path, O_RDONLY);
-	if (fd < 0) {
-		printf(NAME ": unable to open %s\n", conf_path);
-		goto cleanup;
-	} 
-	opened = true;	
-	
-	len = lseek(fd, 0, SEEK_END);
-	lseek(fd, 0, SEEK_SET);	
-	if (len == 0) {
-		printf(NAME ": read_dev_conf error: configuration file '%s' is empty.\n", conf_path);
-		goto cleanup;		
-	}
-	
-	buf = malloc(len + 1);
-	if (buf == NULL) {
-		printf(NAME ": read_dev_conf error: memory allocation failed.\n");
-		goto cleanup;
-	}	
-	
-	if (0 >= read(fd, buf, len)) {
-		printf(NAME ": read_dev_conf error: unable to read file '%s'.\n", conf_path);
-		goto cleanup;
-	}
-	buf[len] = 0;
-	
-	suc = true;
-	
-cleanup:
-	
-	if (!suc && NULL != buf) {
-		free(buf);	
-		buf = NULL;
-	}
-	
-	if(opened) {
-		close(fd);	
-	}
-	
-	return buf;	
-}
-
-static char * str_get_line(char *str, char **next) {	
-	char *line = str;
-	
-	if (NULL == str) {
-		*next = NULL;
-		return NULL;
-	}
-	
-	while (0 != *str && '\n' != *str) {
-		str++;
-	} 
-	
-	if (0 != *str) {
-		*next = str + 1;
-	} else {
-		*next = NULL;
-	}	
-	
-	*str = 0;
-	
-	return line;
-}
-
-
-static bool line_empty(const char *line)
-{
-	while (NULL != line && 0 != *line) {
-		if(!isspace(*line)) {
-			return false;
-		}		
-		line++;		
-	}	
-	return true;	
-}
-
-static char * get_device_name(char *line) {
-	// skip leading spaces
-	while (0 != *line && isspace(*line)) {
-		line++;
-	}
-	
-	// get the name part of the rest of the line
-	strtok(line, ":");	
-	
-	// alloc output buffer
-	size_t size = str_size(line) + 1;
-	char *name = malloc(size);
-	
-	if (NULL != name) {
-		// copy the result to the output buffer
-		str_cpy(name, size, line);
-	}
-
-	return name;
-}
-
-static inline char * skip_spaces(char *line) 
-{
-	// skip leading spaces
-	while (0 != *line && isspace(*line)) {
-		line++;
-	}
-	return line;	
-}
-
-
-static void isa_child_set_irq(device_t *dev, int irq)
-{
-	isa_child_data_t *data = (isa_child_data_t *)dev->driver_data;
-	
-	size_t count = data->hw_resources.count;
-	hw_resource_t *resources = data->hw_resources.resources;
-	
-	if (count < ISA_MAX_HW_RES) {
-		resources[count].type = INTERRUPT;
-		resources[count].res.interrupt.irq = irq;
-		
-		data->hw_resources.count++;
-		
-		printf(NAME ": added irq 0x%x to device %s\n", irq, dev->name);
-	}	
-}
-
-static void isa_child_set_io_range(device_t *dev, size_t addr, size_t len)
-{
-	isa_child_data_t *data = (isa_child_data_t *)dev->driver_data;
-	
-	size_t count = data->hw_resources.count;
-	hw_resource_t *resources = data->hw_resources.resources;
-	
-	if (count < ISA_MAX_HW_RES) {
-		resources[count].type = IO_RANGE;
-		resources[count].res.io_range.address = addr;
-		resources[count].res.io_range.size = len;
-		resources[count].res.io_range.endianness = LITTLE_ENDIAN;	
-		
-		data->hw_resources.count++;
-		
-		printf(NAME ": added io range (addr=0x%x, size=0x%x) to device %s\n", addr, len, dev->name);
-	}	
-}
-
-static void get_dev_irq(device_t *dev, char *val)
-{
-	int irq = 0;
-	char *end = NULL;
-	
-	val = skip_spaces(val);	
-	irq = (int)strtol(val, &end, 0x10);
-	
-	if (val != end) {
-		isa_child_set_irq(dev, irq);		
-	}
-}
-
-static void get_dev_io_range(device_t *dev, char *val)
-{
-	size_t addr, len;
-	char *end = NULL;
-	
-	val = skip_spaces(val);	
-	addr = strtol(val, &end, 0x10);
-	
-	if (val == end) {
-		return;
-	}
-	
-	val = skip_spaces(end);	
-	len = strtol(val, &end, 0x10);
-	
-	if (val == end) {
-		return;
-	}
-	
-	isa_child_set_io_range(dev, addr, len);
-}
-
-static void get_match_id(char **id, char *val)
-{
-	char *end = val;
-	
-	while (!isspace(*end)) {
-		end++;
-	}		
-	size_t size = end - val + 1;
-	*id = (char *)malloc(size);
-	str_cpy(*id, size, val);	
-}
-
-static void get_dev_match_id(device_t *dev, char *val)
-{	
-	char *id = NULL;
-	int score = 0;
-	char *end = NULL;
-	
-	val = skip_spaces(val);	
-	
-	score = (int)strtol(val, &end, 10);
-	if (val == end) {
-		printf(NAME " : error - could not read match score for device %s.\n", dev->name);
-		return;
-	}
-	
-	match_id_t *match_id = create_match_id();
-	if (NULL == match_id) {
-		printf(NAME " : failed to allocate match id for device %s.\n", dev->name);
-		return;
-	}
-	
-	val = skip_spaces(end);	
-	get_match_id(&id, val);
-	if (NULL == id) {
-		printf(NAME " : error - could not read match id for device %s.\n", dev->name);
-		delete_match_id(match_id);
-		return;
-	}
-	
-	match_id->id = id;
-	match_id->score = score;
-	
-	printf(NAME ": adding match id '%s' with score %d to device %s\n", id, score, dev->name);
-	add_match_id(&dev->match_ids, match_id);
-}
-
-static bool read_dev_prop(
-	device_t *dev, char *line, const char *prop, void (* read_fn)(device_t *, char *)) 
-{
-	size_t proplen = str_size(prop);
-	if (0 == str_lcmp(line, prop, proplen)) {
-		line += proplen;
-		line = skip_spaces(line);
-		(*read_fn)(dev, line);
-		return true;
-	}
-	return false;		
-}
-
-static void get_dev_prop(device_t *dev, char *line)
-{
-	// skip leading spaces
-	line = skip_spaces(line);
-	
-	if (!read_dev_prop(dev, line, "io_range", &get_dev_io_range) &&
-		!read_dev_prop(dev, line, "irq", &get_dev_irq) &&
-		!read_dev_prop(dev, line, "match", &get_dev_match_id)
-	) {		
-		printf(NAME " error undefined device property at line '%s'\n", line);
-	} 	
-}
-
-static void child_alloc_hw_res(device_t *dev) 
-{
-	isa_child_data_t *data = (isa_child_data_t *)dev->driver_data;
-	data->hw_resources.resources = 
-		(hw_resource_t *)malloc(sizeof(hw_resource_t) * ISA_MAX_HW_RES);
-	
-}
-
-static char * read_isa_dev_info(char *dev_conf, device_t *parent)
-{
-	char *line;
-	char *dev_name = NULL;
-	
-	// skip empty lines
-	while (true) {	
-		line = str_get_line(dev_conf, &dev_conf);
-		
-		if (NULL == line) {
-			// no more lines
-			return NULL;
-		}
-		
-		if (!line_empty(line)) {
-			break;
-		}
-	}
-	
-	// get device name
-	dev_name = get_device_name(line);
-	if (NULL == dev_name) {
-		return NULL;
-	}
-	
-	device_t *dev = create_isa_child_dev();
-	if (NULL == dev) {
-		free(dev_name);
-		return NULL;
-	}
-	dev->name = dev_name;
-	
-	// allocate buffer for the list of hardware resources of the device
-	child_alloc_hw_res(dev);
-	
-	// get properties of the device (match ids, irq and io range)
-	while (true) {		
-		line = str_get_line(dev_conf, &dev_conf);		
-		
-		if (line_empty(line)) {
-			// no more device properties
-			break;
-		}
-		
-		// get the device's property from the configuration line and store it in the device structure
-		get_dev_prop(dev, line);
-		
-		//printf(NAME ": next line ='%s'\n", dev_conf);
-		//printf(NAME ": current line ='%s'\n", line);		
-	}
-	
-	// set device operations to the device
-	dev->ops = &isa_child_dev_ops;
-	
-	printf(NAME ": child_device_register(dev, parent); device is %s.\n", dev->name);
-	child_device_register(dev, parent);	
-	
-	return dev_conf;	
-}
-
-static void parse_dev_conf(char *conf, device_t *parent)
-{
-	while (NULL != conf && 0 != *conf) {
-		conf = read_isa_dev_info(conf, parent);
-	}	
-}
-
-static void add_legacy_children(device_t *parent)
-{
-	char *dev_conf = read_dev_conf(CHILD_DEV_CONF_PATH); 
-	if (NULL != dev_conf) {
-		parse_dev_conf(dev_conf, parent);	
-		free(dev_conf);
-	}
-}
-
-static int isa_add_device(device_t *dev) 
-{
-	printf(NAME ": isa_add_device, device handle = %d\n", dev->handle);
-	
-	// add child devices	
-	add_legacy_children(dev);
-	printf(NAME ": finished the enumeration of legacy devices\n", dev->handle);
-	
-	return EOK;
-}
-
-static void isa_init() 
-{
-	isa_child_dev_ops.interfaces[HW_RES_DEV_IFACE] = &isa_child_res_iface;
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": HelenOS ISA bus driver\n");	
-	isa_init();
-	return driver_main(&isa_driver);
-}
-
-/**
- * @}
- */
- 
Index: uspace/srv/drivers/isa/isa.dev
===================================================================
--- uspace/srv/drivers/isa/isa.dev	(revision 374ad3c3bf704b2f3c5a99e04d8f771d868a5269)
+++ 	(revision )
@@ -1,15 +1,0 @@
-com1:
-	match 100 isa/ns8250
-	irq 4
-	io_range 3f8 8
-
-com2:
-	match 100 isa/ns8250
-	irq 3
-	io_range 2f8 8
-
-keyboard:
-	match 100 isa/keyboard
-	irq 1
-	io_range 060 10
-	
Index: uspace/srv/drivers/isa/isa.ma
===================================================================
--- uspace/srv/drivers/isa/isa.ma	(revision 374ad3c3bf704b2f3c5a99e04d8f771d868a5269)
+++ 	(revision )
@@ -1,1 +1,0 @@
-9 	pci/ven=8086&dev=7000
Index: uspace/srv/drivers/ns8250/Makefile
===================================================================
--- uspace/srv/drivers/ns8250/Makefile	(revision 374ad3c3bf704b2f3c5a99e04d8f771d868a5269)
+++ 	(revision )
@@ -1,36 +1,0 @@
-# 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.
-#
-
-USPACE_PREFIX = ../../..
-LIBS = $(LIBDRV_PREFIX)/libdrv.a
-EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include
-BINARY = ns8250
-
-SOURCES = \
-	ns8250.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/drivers/ns8250/cyclic_buffer.h
===================================================================
--- uspace/srv/drivers/ns8250/cyclic_buffer.h	(revision 374ad3c3bf704b2f3c5a99e04d8f771d868a5269)
+++ 	(revision )
@@ -1,84 +1,0 @@
-/*
- * 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 ns8250
- * @{
- */
-/** @file
- */
- 
-#ifndef CYCLIC_BUFFER_H
-#define CYCLIC_BUFFER_H
-
-#define BUF_LEN 256  // the length of the buffer
-
-typedef struct cyclic_buffer {
-	uint8_t buf[BUF_LEN];  // the buffer 
-	int start;
-	int cnt;
-}  cyclic_buffer_t; 
-
-// returns false if the buffer is full
-static inline bool buf_push_back(cyclic_buffer_t *buf, uint8_t item) 
-{
-	if (buf->cnt >= BUF_LEN) {
-		return false;
-	}
-	
-	int pos = (buf->start + buf->cnt) % BUF_LEN;
-	buf->buf[pos] = item;
-	buf->cnt++;
-	return true;
-}
-
-static inline bool buf_is_empty(cyclic_buffer_t *buf) 
-{
-	return buf->cnt == 0;
-}
-
-// call it on non empty buffer!
-static inline uint8_t buf_pop_front(cyclic_buffer_t *buf) 
-{
-	assert(!buf_is_empty(buf));
-	
-	uint8_t res = buf->buf[buf->start];
-	buf->start = (buf->start + 1) % BUF_LEN;	
-	buf->cnt--;
-	return res;
-}
-
-static inline void buf_clear(cyclic_buffer_t *buf) 
-{
-	buf->cnt = 0;
-}
-
-#endif
-
-/**
- * @}
- */
Index: uspace/srv/drivers/ns8250/ns8250.c
===================================================================
--- uspace/srv/drivers/ns8250/ns8250.c	(revision 374ad3c3bf704b2f3c5a99e04d8f771d868a5269)
+++ 	(revision )
@@ -1,924 +1,0 @@
-/*
- * 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.
- */
-
-/**
- * @defgroup ns8250 Serial port driver.
- * @brief HelenOS serial port driver.
- * @{
- */
-
-/** @file
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <bool.h>
-#include <fibril_synch.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ctype.h>
-#include <macros.h>
-#include <malloc.h>
-#include <dirent.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <ddi.h>
-#include <libarch/ddi.h>
-
-#include <driver.h>
-#include <char.h>
-#include <resource.h>
-
-#include <devman.h>
-#include <ipc/devman.h>
-#include <device/hw_res.h>
-#include <ipc/serial_ctl.h>
-
-#include "cyclic_buffer.h"
-
-#define NAME "ns8250"
-
-#define REG_COUNT 7
-#define MAX_BAUD_RATE 115200
-#define DLAB_MASK (1 << 7)
-
-/** The number of bits of one data unit send by the serial port.*/
-typedef enum {
-	WORD_LENGTH_5,
-	WORD_LENGTH_6,
-	WORD_LENGTH_7,
-	WORD_LENGTH_8	
-} word_length_t;
-
-/** The number of stop bits used by the serial port. */
-typedef enum {
-	/** Use one stop bit. */
-	ONE_STOP_BIT,
-	/** 1.5 stop bits for word length 5, 2 stop bits otherwise. */
-	TWO_STOP_BITS	
-} stop_bit_t;
-
-/** The driver data for the serial port devices.
- */
-typedef struct ns8250_dev_data {
-	/** Is there any client conntected to the device? */
-	bool client_connected;
-	/** The irq assigned to this device. */
-	int irq;
-	/** The base i/o address of the devices registers. */
-	uint32_t io_addr;
-	/** The i/o port used to access the serial ports registers. */
-	ioport8_t *port;
-	/** The buffer for incomming data.*/
-	cyclic_buffer_t input_buffer;
-	/** The fibril mutex for synchronizing the access to the device.*/
-	fibril_mutex_t mutex;		
-} ns8250_dev_data_t;
-
-/** Create driver data for a device.
- * 
- * @return the driver data. 
- */
-static ns8250_dev_data_t * create_ns8250_dev_data()
-{
-	ns8250_dev_data_t *data = (ns8250_dev_data_t *)malloc(sizeof(ns8250_dev_data_t));
-	if (NULL != data) {
-		memset(data, 0, sizeof(ns8250_dev_data_t));
-		fibril_mutex_initialize(&data->mutex);
-	}
-	return data;	
-}
-
-/** Delete driver data.
- * 
- * @param data the driver data structure.
- */
-static void delete_ns8250_dev_data(ns8250_dev_data_t *data) 
-{
-	if (NULL != data) {
-		free(data);
-	}
-}
-
-/** Find out if there is some incomming data available on the serial port.
- * 
- * @param port the base address of the serial port device's ports.
- * @return true if there are data waiting to be read, false otherwise. 
- */
-static bool ns8250_received(ioport8_t *port) 
-{
-   return (pio_read_8(port + 5) & 1) != 0;
-}
-
-/** Read one byte from the serial port.
- * 
- * @param port the base address of the serial port device's ports.
- * @return the data read. 
- */
-static uint8_t ns8250_read_8(ioport8_t *port) 
-{
-	return pio_read_8(port);
-}
-
-/** Find out wheter it is possible to send data.
- * 
- * @param port the base address of the serial port device's ports.
- */
-static bool is_transmit_empty(ioport8_t *port) 
-{
-   return (pio_read_8(port + 5) & 0x20) != 0;
-}
-
-/** Write one character on the serial port.
- * 
- * @param port the base address of the serial port device's ports.
- * @param c the character to be written to the serial port device.
- */
-static void ns8250_write_8(ioport8_t *port, uint8_t c) 
-{
-	while (!is_transmit_empty(port)) 
-		;
-	
-	pio_write_8(port, c);
-}
-
-/** Read data from the serial port device.
- * 
- * @param dev the serial port device.
- * @param buf the ouput buffer for read data.
- * @param count the number of bytes to be read.
- * 
- * @return the number of bytes actually read on success, negative error number otherwise.
- */
-static int ns8250_read(device_t *dev, char *buf, size_t count) 
-{
-	// printf(NAME ": ns8250_read %s\n", dev->name);
-	
-	int ret = EOK;
-	
-	ns8250_dev_data_t *data = (ns8250_dev_data_t *)dev->driver_data;
-	fibril_mutex_lock(&data->mutex);
-	
-	while (!buf_is_empty(&data->input_buffer) && (size_t)ret < count) {
-		buf[ret] = (char)buf_pop_front(&data->input_buffer);
-		ret++;
-	}
-	
-	fibril_mutex_unlock(&data->mutex);
-	
-	return ret;
-}
-
-/** Write a character to the serial port.
- * 
- * @param data the serial port device's driver data.
- * @param c the character to be written. 
- */
-static inline void ns8250_putchar(ns8250_dev_data_t *data, uint8_t c)
-{	
-	fibril_mutex_lock(&data->mutex);
-	ns8250_write_8(data->port, c);	
-	fibril_mutex_unlock(&data->mutex);
-}
-
-/** Write data to the serial port.
- * 
- * @param dev the serial port device.
- * @param buf the data to be written.
- * @param count the number of bytes to be written.
- * 
- * @return 0 on success.
- */
-static int ns8250_write(device_t *dev, char *buf, size_t count) 
-{
-	ns8250_dev_data_t *data = (ns8250_dev_data_t *)dev->driver_data;
-	
-	size_t idx;
-	for (idx = 0; idx < count; idx++) {
-		ns8250_putchar(data, (uint8_t)buf[idx]);
-	}
-	
-	return 0;
-}
-
-static device_ops_t ns8250_dev_ops;
-
-/** The character interface's callbacks. 
- */
-static char_iface_t ns8250_char_iface = {
-	.read = &ns8250_read,
-	.write = &ns8250_write
-};
-
-static int ns8250_add_device(device_t *dev);
-
-/** The serial port device driver's standard operations.
- */
-static driver_ops_t ns8250_ops = {
-	.add_device = &ns8250_add_device
-};
-
-/** The serial port device driver structure. 
- */
-static driver_t ns8250_driver = {
-	.name = NAME,
-	.driver_ops = &ns8250_ops
-};
-
-/** Clean up the serial port device structure.
- * 
- * @param dev the device structure.
- */
-static void ns8250_dev_cleanup(device_t *dev)
-{
-	if (NULL != dev->driver_data) {
-		delete_ns8250_dev_data((ns8250_dev_data_t*)dev->driver_data);	
-		dev->driver_data = NULL;
-	}
-	
-	if (dev->parent_phone > 0) {
-		ipc_hangup(dev->parent_phone);
-		dev->parent_phone = 0;
-	}	
-}
-
-/** Enable the i/o ports of the device.
- * 
- * @param the serial port device.
- * @return true on success, false otherwise.
- */
-static bool ns8250_pio_enable(device_t *dev)
-{
-	printf(NAME ": ns8250_pio_enable %s\n", dev->name);
-	
-	ns8250_dev_data_t *data = (ns8250_dev_data_t *)dev->driver_data;
-	
-	// Gain control over port's registers.
-	if (pio_enable((void *)data->io_addr, REG_COUNT, (void **)(&data->port))) {  
-		printf(NAME ": error - cannot gain the port %lx for device %s.\n", data->io_addr, dev->name);
-		return false;
-	}
-	
-	return true;
-}
-
-/** Probe the serial port device for its presence.
- * 
- * @param dev the serial port device.
- * @return true if the device is present, false otherwise.
- */
-static bool ns8250_dev_probe(device_t *dev)
-{
-	printf(NAME ": ns8250_dev_probe %s\n", dev->name);
-	
-	ns8250_dev_data_t *data = (ns8250_dev_data_t *)dev->driver_data;
-	ioport8_t *port_addr = data->port;	
-	bool res = true;
-	uint8_t olddata;
-	
-	olddata = pio_read_8(port_addr + 4);
-	
-	pio_write_8(port_addr + 4, 0x10);
-	if (pio_read_8(port_addr + 6) & 0xf0) {
-		res = false;
-	}
-	
-	pio_write_8(port_addr + 4, 0x1f);
-	if ((pio_read_8(port_addr + 6) & 0xf0) != 0xf0) {
-		res = false;
-	}
-	
-	pio_write_8(port_addr + 4, olddata);
-	
-	if (!res) {
-		printf(NAME ": device %s is not present.\n", dev->name);
-	}
-	
-	return res;	
-}
-
-/** Initialize serial port device.
- * 
- * @param dev the serial port device.
- * @return 0 on success, negative error number otherwise.
- */
-static int ns8250_dev_initialize(device_t *dev)
-{
-	printf(NAME ": ns8250_dev_initialize %s\n", dev->name);
-	
-	int ret = EOK;
-	hw_resource_list_t hw_resources;
-	memset(&hw_resources, 0, sizeof(hw_resource_list_t));
-	
-	// allocate driver data for the device
-	ns8250_dev_data_t *data = create_ns8250_dev_data();	
-	if (NULL == data) {
-		return ENOMEM;
-	}
-	dev->driver_data = data;
-	
-	// connect to the parent's driver
-	dev->parent_phone = devman_parent_device_connect(dev->handle,  IPC_FLAG_BLOCKING);
-	if (dev->parent_phone <= 0) {
-		printf(NAME ": failed to connect to the parent driver of the device %s.\n", dev->name);
-		ret = EPARTY;
-		goto failed;
-	}
-	
-	// get hw resources
-	
-	if (!get_hw_resources(dev->parent_phone, &hw_resources)) {
-		printf(NAME ": failed to get hw resources for the device %s.\n", dev->name);
-		ret = EPARTY;
-		goto failed;
-	}	
-	
-	size_t i;
-	hw_resource_t *res;
-	bool irq = false;
-	bool ioport = false;
-	
-	for (i = 0; i < hw_resources.count; i++) {
-		res = &hw_resources.resources[i];
-		switch (res->type) {
-		case INTERRUPT:
-			data->irq = res->res.interrupt.irq;
-			irq = true;
-			printf(NAME ": the %s device was asigned irq = 0x%x.\n", dev->name, data->irq);
-			break;
-		case IO_RANGE:
-			data->io_addr = res->res.io_range.address;
-			if (res->res.io_range.size < REG_COUNT) {
-				printf(NAME ": i/o range assigned to the device %s is too small.\n", dev->name);
-				ret = EPARTY;
-				goto failed;
-			}
-			ioport = true;
-			printf(NAME ": the %s device was asigned i/o address = 0x%x.\n", dev->name, data->io_addr);
-			break;	
-		default:
-			break;
-		}
-	}
-	
-	if (!irq || !ioport) {
-		printf(NAME ": missing hw resource(s) for the device %s.\n", dev->name);
-		ret = EPARTY;
-		goto failed;
-	}		
-	
-	clean_hw_resource_list(&hw_resources);
-	return ret;
-	
-failed:
-	ns8250_dev_cleanup(dev);	
-	clean_hw_resource_list(&hw_resources);	
-	return ret;	
-}
-
-/** Enable interrupts on the serial port device.
- * 
- * Interrupt when data is received.
- * 
- * @param port the base address of the serial port device's ports. 
- */
-static inline void ns8250_port_interrupts_enable(ioport8_t *port)
-{	
-	pio_write_8(port + 1 , 0x01);   // Interrupt when data received
-	pio_write_8(port + 4, 0x0B);	
-}
-
-/** Disable interrupts on the serial port device.
- * 
- * @param port the base address of the serial port device's ports. 
- */
-static inline void ns8250_port_interrupts_disable(ioport8_t *port)
-{
-	pio_write_8(port + 1, 0x00);    // Disable all interrupts
-}
-
-/** Enable interrupts for the serial port device.
- * 
- * @param dev the device.
- * @return 0 on success, negative error number otherwise.
- */
-static int ns8250_interrupt_enable(device_t *dev)
-{
-	ns8250_dev_data_t *data = (ns8250_dev_data_t *)dev->driver_data;
-	
-	int res;
-	// enable interrupt globally	
-	if (EOK != (res = interrupt_enable(data->irq))) {
-		return res;
-	}
-	
-	// enable interrupt on the serial port
-	ns8250_port_interrupts_enable(data->port);
-	
-	return EOK;
-}
-
-/** Set Divisor Latch Access Bit.
- * 
- * When the Divisor Latch Access Bit is set, 
- * it is possible to set baud rate of the serial port device.
- * 
- * @param port the base address of the serial port device's ports. 
- */
-static inline void enable_dlab(ioport8_t *port)
-{
-	uint8_t val = pio_read_8(port + 3);
-	pio_write_8(port + 3, val | DLAB_MASK);	
-}
-
-/** Clear Divisor Latch Access Bit.
- * 
- * @param port the base address of the serial port device's ports. 
- */
-static inline void clear_dlab(ioport8_t *port)
-{
-	uint8_t val = pio_read_8(port + 3);
-	pio_write_8(port + 3, val & (~DLAB_MASK));
-}
-
-/** Set baud rate of the serial communication on the serial device.
- * 
- * @param port the base address of the serial port device's ports. 
- * @param baud_rate the baud rate to be used by the device.
- * 
- * @return 0 on success, negative error number otherwise (EINVAL if the specified baud_rate is not valid). 
- */
-static int ns8250_port_set_baud_rate(ioport8_t *port, unsigned int baud_rate)
-{
-	uint16_t divisor;
-	uint8_t div_low, div_high;
-	
-	if (50 > baud_rate || 0 != MAX_BAUD_RATE % baud_rate) {
-		printf(NAME ": error - somebody tried to set invalid baud rate %d\n", baud_rate);
-		return EINVAL; 
-	}
-	
-	divisor = MAX_BAUD_RATE / baud_rate;
-	div_low = (uint8_t)divisor;
-	div_high = (uint8_t)(divisor >> 8);	
-	
-	// enable DLAB to be able to access baud rate divisor
-	enable_dlab(port);    
-	
-	// set divisor low byte
-	pio_write_8(port + 0, div_low); 
-	// set divisor high byte
-	pio_write_8(port + 1, div_high);    
-	
-	clear_dlab(port);	
-	
-	return EOK;		
-}
-
-/** Get baud rate used by the serial port device.
- * 
- * @param port the base address of the serial port device's ports.
- * @param baud_rate the ouput parameter to which the baud rate is stored.
- */
-static unsigned int ns8250_port_get_baud_rate(ioport8_t *port)
-{
-	uint16_t divisor;
-	uint8_t div_low, div_high;
-	
-	// enable DLAB to be able to access baud rate divisor
-	enable_dlab(port);
-	
-	// get divisor low byte
-	div_low = pio_read_8(port + 0);
-	// get divisor high byte
-	div_high = pio_read_8(port + 1);   
-	
-	clear_dlab(port);
-	
-	divisor = (div_high << 8) | div_low;
-	return MAX_BAUD_RATE / divisor;
-}
-
-/** Get the parameters of the serial communication set on the serial port device.
- * 
- * @param parity the parity used.
- * @param word_length the length of one data unit in bits.
- * @param stop_bits the number of stop bits used (one or two). 
- */
-static void ns8250_port_get_com_props(
-	ioport8_t *port, unsigned int *parity, unsigned int *word_length, unsigned int *stop_bits)
-{
-	uint8_t val;
-	
-	val = pio_read_8(port + 3);
-	
-	*parity = ((val >> 3) & 7);
-	
-	switch (val & 3) {
-		case WORD_LENGTH_5:
-			*word_length = 5;
-			break;
-		case WORD_LENGTH_6:
-			*word_length = 6;
-			break;
-		case WORD_LENGTH_7:
-			*word_length = 7;
-			break;
-		case WORD_LENGTH_8:
-			*word_length = 8;
-			break;
-	}
-	
-	if ((val >> 2) & 1) {
-		*stop_bits = 2;
-	} else {
-		*stop_bits = 1;
-	}	
-}
-
-/** Set the parameters of the serial communication on the serial port device.
- * 
- * @param parity the parity to be used.
- * @param word_length the length of one data unit in bits.
- * @param stop_bits the number of stop bits used (one or two). 
- * 
- * @return 0 on success, EINVAL if some of the specified values is invalid.
- */
-static int ns8250_port_set_com_props(
-	ioport8_t *port, unsigned int parity, unsigned int word_length, unsigned int stop_bits)
-{
-	uint8_t val;
-	
-	switch (word_length) {
-		case 5:
-			val = WORD_LENGTH_5;
-			break;
-		case 6:
-			val = WORD_LENGTH_6;
-			break;
-		case 7:
-			val = WORD_LENGTH_7;
-			break;
-		case 8:
-			val = WORD_LENGTH_8;
-			break;
-		default:
-			return EINVAL;
-	}
-	
-	switch (stop_bits) {
-		case 1:
-			val |= ONE_STOP_BIT << 2;
-			break;
-		case 2:
-			val |= TWO_STOP_BITS << 2;
-			break;
-		default:
-			return EINVAL;
-	}
-	
-	switch (parity) {
-		case SERIAL_NO_PARITY:
-		case SERIAL_ODD_PARITY:
-		case SERIAL_EVEN_PARITY:
-		case SERIAL_MARK_PARITY:
-		case SERIAL_SPACE_PARITY:	
-			val |= parity << 3;
-			break;
-		default:
-			return EINVAL;
-	}
-	
-	pio_write_8(port + 3, val);	
-	
-	return EOK;
-}
-
-/** Initialize the serial port device.
- * 
- * Set the default parameters of the serial communication.
- * 
- * @param dev the serial port device.
- */
-static void ns8250_initialize_port(device_t *dev)
-{
-	ns8250_dev_data_t *data = (ns8250_dev_data_t *)dev->driver_data;
-	ioport8_t *port = data->port;
-	
-	// disable interrupts
-	ns8250_port_interrupts_disable(port); 
-    // set baud rate
-	ns8250_port_set_baud_rate(port, 38400);
-	// 8 bits, no parity, two stop bits
-	ns8250_port_set_com_props(port, SERIAL_NO_PARITY, 8, 2);  
-	// Enable FIFO, clear them, with 14-byte threshold
-	pio_write_8(port + 2, 0xC7);  	
-	// RTS/DSR set (Request to Send and Data Terminal Ready lines enabled), 
-	// Aux Output2 set - needed for interrupts
-	pio_write_8(port + 4, 0x0B);    										
-}
-
-/** Read the data from the serial port device and store them to the input buffer.
- * 
- * @param dev the serial port device.
- */
-static void ns8250_read_from_device(device_t *dev)
-{
-	ns8250_dev_data_t *data = (ns8250_dev_data_t *)dev->driver_data;
-	ioport8_t *port = data->port;
-	bool cont = true;
-	
-	while (cont) {	
-		fibril_mutex_lock(&data->mutex);
-		
-		cont = ns8250_received(port);
-		if (cont) {
-			uint8_t val = ns8250_read_8(port);
-			// printf(NAME ": character %c read from %s.\n", val, dev->name);			
-			
-			if (data->client_connected) {
-				if (!buf_push_back(&(data->input_buffer), val)) {
-					printf(NAME ": buffer overflow on %s.\n", dev->name);
-				} else {
-					printf(NAME ": the character %c saved to the buffer of %s.\n", val, dev->name);
-				}
-			} else {
-				// printf(NAME ": no client is connected to %s, discarding the character which was read.\n", dev->name);
-			}			
-		}
-		
-		fibril_mutex_unlock(&data->mutex);	
-		
-		fibril_yield();		
-	}	
-}
-
-/** The interrupt handler.
- * 
- * The serial port is initialized to interrupt when some data come, 
- * so the interrupt is handled by reading the incomming data.
- * 
- * @param dev the serial port device. 
- */
-static inline void ns8250_interrupt_handler(device_t *dev, ipc_callid_t iid, ipc_call_t *icall)
-{
-	ns8250_read_from_device(dev);
-}
-
-/** Register the interrupt handler for the device.
- * 
- * @param dev the serial port device.
- */
-static inline int ns8250_register_interrupt_handler(device_t *dev)
-{
-	ns8250_dev_data_t *data = (ns8250_dev_data_t *)dev->driver_data;
-	
-	return register_interrupt_handler(dev, data->irq, ns8250_interrupt_handler, NULL);	
-}
-
-/** Unregister the interrupt handler for the device.
- * 
- * @param dev the serial port device.
- */
-static inline int ns8250_unregister_interrupt_handler(device_t *dev)
-{
-	ns8250_dev_data_t *data = (ns8250_dev_data_t *)dev->driver_data;
-	
-	return unregister_interrupt_handler(dev, data->irq);	
-}
-
-/** The add_device callback method of the serial port driver.
- * 
- * Probe and initialize the newly added device.
- * 
- * @param dev the serial port device. 
- */
-static int ns8250_add_device(device_t *dev) 
-{
-	printf(NAME ": ns8250_add_device %s (handle = %d)\n", dev->name, dev->handle);
-	
-	int res = ns8250_dev_initialize(dev);
-	if (EOK != res) {
-		return res;
-	}
-	
-	if (!ns8250_pio_enable(dev)) {
-		ns8250_dev_cleanup(dev);
-		return EADDRNOTAVAIL;
-	}	
-	
-	// find out whether the device is present
-	if (!ns8250_dev_probe(dev)) {
-		ns8250_dev_cleanup(dev);
-		return ENOENT;
-	}	
-	
-	// serial port initialization (baud rate etc.)
-	ns8250_initialize_port(dev);
-	
-	// register interrupt handler
-	if (EOK != ns8250_register_interrupt_handler(dev)) {
-		printf(NAME ": failed to register interrupt handler.\n");
-		ns8250_dev_cleanup(dev);
-		return res;
-	}
-	
-	// enable interrupt
-	if (EOK != (res = ns8250_interrupt_enable(dev))) {
-		printf(NAME ": failed to enable the interrupt. Error code = %d.\n", res);
-		ns8250_dev_cleanup(dev);
-		ns8250_unregister_interrupt_handler(dev);
-		return res;
-	}	
-	
-	// set device operations
-	dev->ops = &ns8250_dev_ops;
-	
-	add_device_to_class(dev, "serial");
-	
-	printf(NAME ": the %s device has been successfully initialized.\n", dev->name);
-	
-	return EOK;
-}
-
-/** Open the device.
- * 
- * This is a callback function called when a client tries to connect to the device.
- * 
- * @param dev the device.
- */
-static int ns8250_open(device_t *dev)
-{
-	ns8250_dev_data_t *data = (ns8250_dev_data_t *)dev->driver_data;
-	int res;
-	
-	fibril_mutex_lock(&data->mutex);	
-	
-	if (data->client_connected) {
-		res = ELIMIT;
-	} else {
-		res = EOK;
-		data->client_connected = true;
-	}
-	
-	fibril_mutex_unlock(&data->mutex);
-
-	return res;
-}
-
-/** Close the device.
- * 
- *  This is a callback function called when a client tries to disconnect from the device.
- * 
- * @param dev the device. 
- */
-static void ns8250_close(device_t *dev)
-{
-	ns8250_dev_data_t *data = (ns8250_dev_data_t *)dev->driver_data;
-	
-	fibril_mutex_lock(&data->mutex);
-	
-	assert(data->client_connected);	
-	
-	data->client_connected = false;
-	buf_clear(&data->input_buffer);
-	
-	fibril_mutex_unlock(&data->mutex);	 
-}
-
-/** Get parameters of the serial communication which are set to the specified device.
- * 
- * @param the serial port device.
- * @param baud_rate the baud rate used by the device.
- * @param the type of parity used by the device.
- * @param word_length the size of one data unit in bits.
- * @param stop_bits the number of stop bits used.
- */
-static void ns8250_get_props(device_t *dev, unsigned int *baud_rate, 
-	unsigned int *parity, unsigned int *word_length, unsigned int* stop_bits)
-{	
-	ns8250_dev_data_t *data = (ns8250_dev_data_t *)dev->driver_data;
-	ioport8_t *port = data->port;
-	
-	fibril_mutex_lock(&data->mutex);	
-	ns8250_port_interrupts_disable(port);    // Disable all interrupts
-	*baud_rate = ns8250_port_get_baud_rate(port);
-	ns8250_port_get_com_props(port, parity, word_length, stop_bits);	
-	ns8250_port_interrupts_enable(port);
-	fibril_mutex_unlock(&data->mutex);	
-	
-	printf(NAME ": ns8250_get_props: baud rate %d, parity 0x%x, word length %d, stop bits %d\n", 
-		*baud_rate, *parity, *word_length, * stop_bits);
-}
-
-/** Set parameters of the serial communication to the specified  serial port device.
- * 
- * @param the serial port device.
- * @param baud_rate the baud rate to be used by the device.
- * @param the type of parity to be used by the device.
- * @param word_length the size of one data unit in bits.
- * @param stop_bits the number of stop bits to be used.
- */
-static int ns8250_set_props(device_t *dev, unsigned int baud_rate, 
-	unsigned int parity, unsigned int word_length, unsigned int stop_bits)
-{
-	printf(NAME ": ns8250_set_props: baud rate %d, parity 0x%x, word length %d, stop bits %d\n", 
-		baud_rate, parity, word_length, stop_bits);
-	
-	ns8250_dev_data_t *data = (ns8250_dev_data_t *)dev->driver_data;
-	ioport8_t *port = data->port;
-	int ret;
-	
-	fibril_mutex_lock(&data->mutex);	
-	ns8250_port_interrupts_disable(port);    // Disable all interrupts
-	ret = ns8250_port_set_baud_rate(port, baud_rate);
-	if (EOK == ret) {
-		ret = ns8250_port_set_com_props(port, parity, word_length, stop_bits);
-	}
-	ns8250_port_interrupts_enable(port);
-	fibril_mutex_unlock(&data->mutex);	
-	
-	return ret;		
-}
-
-
-/** Default handler for client requests which are not handled by the standard interfaces.
- * 
- * Configure the parameters of the serial communication.
- */
-static void ns8250_default_handler(device_t *dev, ipc_callid_t callid, ipc_call_t *call)
-{
-	ipcarg_t method = IPC_GET_METHOD(*call);
-	int ret;
-	unsigned int baud_rate, parity, word_length, stop_bits;	
-	
-	switch(method) {
-		case SERIAL_GET_COM_PROPS:
-			ns8250_get_props(dev, &baud_rate, &parity, &word_length, &stop_bits);
-			ipc_answer_4(callid, EOK, baud_rate, parity, word_length, stop_bits);
-			break;
-		
-		case SERIAL_SET_COM_PROPS:
- 			baud_rate = IPC_GET_ARG1(*call);
-			parity = IPC_GET_ARG2(*call);
-			word_length = IPC_GET_ARG3(*call);
-			stop_bits = IPC_GET_ARG4(*call);
-			ret = ns8250_set_props(dev, baud_rate, parity, word_length, stop_bits);
-			ipc_answer_0(callid, ret);
-			break;
-			
-		default:
-			ipc_answer_0(callid, ENOTSUP);		
-	}	
-}
-
-/** Initialize the serial port driver.
- * 
- * Initialize device operations structures with callback methods for handling 
- * client requests to the serial port devices.
- */
-static void ns8250_init() 
-{
-	ns8250_dev_ops.open = &ns8250_open;
-	ns8250_dev_ops.close = &ns8250_close;	
-	
-	ns8250_dev_ops.interfaces[CHAR_DEV_IFACE] = &ns8250_char_iface;
-	ns8250_dev_ops.default_handler = &ns8250_default_handler;
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": HelenOS serial port driver\n");	
-	ns8250_init();
-	return driver_main(&ns8250_driver);
-}
-
-/**
- * @}
- */
Index: uspace/srv/drivers/ns8250/ns8250.ma
===================================================================
--- uspace/srv/drivers/ns8250/ns8250.ma	(revision 374ad3c3bf704b2f3c5a99e04d8f771d868a5269)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 isa/ns8250
Index: uspace/srv/drivers/pciintel/Makefile
===================================================================
--- uspace/srv/drivers/pciintel/Makefile	(revision 374ad3c3bf704b2f3c5a99e04d8f771d868a5269)
+++ 	(revision )
@@ -1,36 +1,0 @@
-# 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.
-#
-
-USPACE_PREFIX = ../../..
-LIBS = $(LIBDRV_PREFIX)/libdrv.a
-EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include
-BINARY = pciintel
-
-SOURCES = \
-	pci.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/drivers/pciintel/pci.c
===================================================================
--- uspace/srv/drivers/pciintel/pci.c	(revision 374ad3c3bf704b2f3c5a99e04d8f771d868a5269)
+++ 	(revision )
@@ -1,505 +1,0 @@
-/*
- * 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.
- */
-
-/**
- * @defgroup pciintel pci bus driver for intel method 1.
- * @brief HelenOS root pci bus driver for intel method 1.
- * @{
- */
-
-/** @file
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <bool.h>
-#include <fibril_synch.h>
-#include <str.h>
-#include <ctype.h>
-#include <macros.h>
-
-#include <driver.h>
-#include <devman.h>
-#include <ipc/devman.h>
-#include <ipc/dev_iface.h>
-#include <resource.h>
-#include <device/hw_res.h>
-#include <ddi.h>
-#include <libarch/ddi.h>
-
-#include "pci.h"
-
-#define NAME "pciintel"
-
-#define CONF_ADDR(bus, dev, fn, reg)   ((1 << 31) | (bus << 16) | (dev << 11) | (fn << 8) | (reg & ~3))
-
-
-static hw_resource_list_t * pciintel_get_child_resources(device_t *dev)
-{
-	pci_dev_data_t *dev_data = (pci_dev_data_t *)dev->driver_data;
-	if (NULL == dev_data) {
-		return NULL;
-	}
-	return &dev_data->hw_resources;
-}
-
-static bool pciintel_enable_child_interrupt(device_t *dev) 
-{
-	// TODO
-	
-	return false;
-}
-
-static resource_iface_t pciintel_child_res_iface = {
-	&pciintel_get_child_resources,
-	&pciintel_enable_child_interrupt	
-};
-
-static device_ops_t pci_child_ops;
-
-
-static int pci_add_device(device_t *dev);
-
-/** The pci bus driver's standard operations.
- */
-static driver_ops_t pci_ops = {
-	.add_device = &pci_add_device
-};
-
-/** The pci bus driver structure. 
- */
-static driver_t pci_driver = {
-	.name = NAME,
-	.driver_ops = &pci_ops
-};
-
-typedef struct pciintel_bus_data {
-	uint32_t conf_io_addr;
-	void *conf_data_port;
-	void *conf_addr_port;	
-	fibril_mutex_t conf_mutex;
-} pci_bus_data_t;
-
-static inline pci_bus_data_t *create_pci_bus_data() 
-{
-	pci_bus_data_t *bus_data = (pci_bus_data_t *)malloc(sizeof(pci_bus_data_t));
-	if(NULL != bus_data) {
-		memset(bus_data, 0, sizeof(pci_bus_data_t));
-		fibril_mutex_initialize(&bus_data->conf_mutex);
-	}
-	return bus_data;	
-}
-
-static inline void delete_pci_bus_data(pci_bus_data_t *bus_data) 
-{
-	free(bus_data);	
-}
-
-static void pci_conf_read(device_t *dev, int reg, uint8_t *buf, size_t len)
-{
-	assert(NULL != dev->parent);
-	
-	pci_dev_data_t *dev_data = (pci_dev_data_t *)dev->driver_data;
-	pci_bus_data_t *bus_data = (pci_bus_data_t *)dev->parent->driver_data;
-	
-	fibril_mutex_lock(&bus_data->conf_mutex);
-	
-	uint32_t conf_addr =  CONF_ADDR(dev_data->bus, dev_data->dev, dev_data->fn, reg);
-	void *addr = bus_data->conf_data_port + (reg & 3);
-	
-	pio_write_32(bus_data->conf_addr_port, conf_addr);
-	
-	switch (len) {
-		case 1:
-			buf[0] = pio_read_8(addr);
-			break;
-		case 2:
-			((uint16_t *)buf)[0] = pio_read_16(addr);
-			break;
-		case 4:
-			((uint32_t *)buf)[0] = pio_read_32(addr);
-			break;
-	}
-	
-	fibril_mutex_unlock(&bus_data->conf_mutex);	
-}
-
-static void pci_conf_write(device_t *dev, int reg, uint8_t *buf, size_t len)
-{
-	assert(NULL != dev->parent);
-	
-	pci_dev_data_t *dev_data = (pci_dev_data_t *)dev->driver_data;
-	pci_bus_data_t *bus_data = (pci_bus_data_t *)dev->parent->driver_data;
-	
-	fibril_mutex_lock(&bus_data->conf_mutex);
-	
-	uint32_t conf_addr =  CONF_ADDR(dev_data->bus, dev_data->dev, dev_data->fn, reg);
-	void *addr = bus_data->conf_data_port + (reg & 3);
-	
-	pio_write_32(bus_data->conf_addr_port, conf_addr);
-	
-	switch (len) {
-		case 1:
-			pio_write_8(addr, buf[0]);
-			break;
-		case 2:
-			pio_write_16(addr, ((uint16_t *)buf)[0]);
-			break;
-		case 4:
-			pio_write_32(addr, ((uint32_t *)buf)[0]);
-			break;
-	}
-	
-	fibril_mutex_unlock(&bus_data->conf_mutex);	
-}
-
-uint8_t pci_conf_read_8(device_t *dev, int reg)
-{
-	uint8_t res;
-	pci_conf_read(dev, reg, &res, 1);
-	return res;
-}
-
-uint16_t pci_conf_read_16(device_t *dev, int reg)
-{
-	uint16_t res;
-	pci_conf_read(dev, reg, (uint8_t *)&res, 2);
-	return res;
-}
-
-uint32_t pci_conf_read_32(device_t *dev, int reg)
-{
-	uint32_t res;
-	pci_conf_read(dev, reg, (uint8_t *)&res, 4);
-	return res;	
-}
-
-void pci_conf_write_8(device_t *dev, int reg, uint8_t val) 
-{
-	pci_conf_write(dev, reg, (uint8_t *)&val, 1);	
-}
-
-void pci_conf_write_16(device_t *dev, int reg, uint16_t val) 
-{
-	pci_conf_write(dev, reg, (uint8_t *)&val, 2);	
-}
-
-void pci_conf_write_32(device_t *dev, int reg, uint32_t val) 
-{
-	pci_conf_write(dev, reg, (uint8_t *)&val, 4);	
-}
-
-
-void create_pci_match_ids(device_t *dev)
-{
-	pci_dev_data_t *dev_data = (pci_dev_data_t *)dev->driver_data;
-	match_id_t *match_id = NULL;	
-	char *match_id_str;	
-	match_id = create_match_id();
-	if (NULL != match_id) {
-		asprintf(&match_id_str, "pci/ven=%04x&dev=%04x", dev_data->vendor_id, dev_data->device_id);
-		match_id->id = match_id_str;
-		match_id->score = 90;
-		add_match_id(&dev->match_ids, match_id);
-	}	
-	// TODO add more ids (with subsys ids, using class id etc.)
-}
-
-void pci_add_range(device_t *dev, uint64_t range_addr, size_t range_size, bool io)
-{
-	pci_dev_data_t *dev_data = (pci_dev_data_t *)dev->driver_data;
-	hw_resource_list_t *hw_res_list = &dev_data->hw_resources;
-	hw_resource_t *hw_resources =  hw_res_list->resources;
-	size_t count = hw_res_list->count;	
-	
-	assert(NULL != hw_resources);
-	assert(count < PCI_MAX_HW_RES);
-	
-	if (io) {
-		hw_resources[count].type = IO_RANGE;
-		hw_resources[count].res.io_range.address = range_addr;
-		hw_resources[count].res.io_range.size = range_size;	
-		hw_resources[count].res.io_range.endianness = LITTLE_ENDIAN;	
-	} else {
-		hw_resources[count].type = MEM_RANGE;
-		hw_resources[count].res.mem_range.address = range_addr;
-		hw_resources[count].res.mem_range.size = range_size;	
-		hw_resources[count].res.mem_range.endianness = LITTLE_ENDIAN;
-	}
-	
-	hw_res_list->count++;	
-}
-
-
-/** Read the base address register (BAR) of the device 
- *  and if it contains valid address add it to the devices hw resource list.
- * 
- * @param dev the pci device.
- * @param addr the address of the BAR in the PCI configuration address space of the device.
- * 
- * @return the addr the address of the BAR which should be read next.
- */
-int pci_read_bar(device_t *dev, int addr) 
-{	
-	// value of the BAR
-	uint32_t val, mask;
-	// IO space address
-	bool io;
-	// 64-bit wide address
-	bool w64;
-	
-	// size of the io or memory range specified by the BAR
-	size_t range_size;
-	// beginning of the io or memory range specified by the BAR
-	uint64_t range_addr;
-	
-	// get the value of the BAR
-	val = pci_conf_read_32(dev, addr);
-	
-	io = (bool)(val & 1);
-	if (io) {
-		w64 = false;
-	} else {
-		switch ((val >> 1) & 3) {
-		case 0:
-			w64 = false;
-			break;
-		case 2:
-			w64 = true;
-			break;
-		default:
-			// reserved, go to the next BAR
-			return addr + 4;							
-		}
-	}
-	
-	// get the address mask
-	pci_conf_write_32(dev, addr, 0xffffffff);
-	mask = pci_conf_read_32(dev, addr);	
-	
-	// restore the original value
-	pci_conf_write_32(dev, addr, val);
-	val = pci_conf_read_32(dev, addr);	
-	
-	range_size = pci_bar_mask_to_size(mask);
-	
-	if (w64) {
-		range_addr = ((uint64_t)pci_conf_read_32(dev, addr + 4) << 32) | (val & 0xfffffff0);	
-	} else {
-		range_addr = (val & 0xfffffff0);
-	}	
-	if (0 != range_addr) {
-		printf(NAME ": device %s : ", dev->name);
-		printf("address = %x", range_addr);		
-		printf(", size = %x\n", range_size);
-	}
-	
-	pci_add_range(dev, range_addr, range_size, io);
-	
-	if (w64) {
-		return addr + 8;
-	}
-	return addr + 4;	
-}
-
-void pci_add_interrupt(device_t *dev, int irq)
-{
-	pci_dev_data_t *dev_data = (pci_dev_data_t *)dev->driver_data;
-	hw_resource_list_t *hw_res_list = &dev_data->hw_resources;
-	hw_resource_t *hw_resources =  hw_res_list->resources;
-	size_t count = hw_res_list->count;	
-	
-	assert(NULL != hw_resources);
-	assert(count < PCI_MAX_HW_RES);
-	
-	hw_resources[count].type = INTERRUPT;
-	hw_resources[count].res.interrupt.irq = irq;
-	
-	hw_res_list->count++;		
-	
-	
-	printf(NAME ": device %s uses irq %x.\n", dev->name, irq);
-}
-
-void pci_read_interrupt(device_t *dev)
-{
-	uint8_t irq = pci_conf_read_8(dev, PCI_BRIDGE_INT_LINE);
-	if (0xff != irq) {
-		pci_add_interrupt(dev, irq);
-	}	
-}
-
-/** Enumerate (recursively) and register the devices connected to a pci bus.
- * 
- * @param parent the host-to-pci bridge device.
- * @param bus_num the bus number. 
- */
-void pci_bus_scan(device_t *parent, int bus_num) 
-{
-	device_t *dev = create_device();
-	pci_dev_data_t *dev_data = create_pci_dev_data();
-	dev->driver_data = dev_data;
-	dev->parent = parent;
-	
-	int child_bus = 0;
-	int dnum, fnum;
-	bool multi;
-	uint8_t header_type; 
-	
-	for (dnum = 0; dnum < 32; dnum++) {
-		multi = true;
-		for (fnum = 0; multi && fnum < 8; fnum++) {
-			init_pci_dev_data(dev_data, bus_num, dnum, fnum);
-			dev_data->vendor_id = pci_conf_read_16(dev, PCI_VENDOR_ID);
-			dev_data->device_id = pci_conf_read_16(dev, PCI_DEVICE_ID);
-			if (dev_data->vendor_id == 0xffff) { // device is not present, go on scanning the bus
-				if (fnum == 0) {
-					break;
-				} else {
-					continue;  
-				}
-			}
-			header_type = pci_conf_read_8(dev, PCI_HEADER_TYPE);
-			if (fnum == 0) {
-				 multi = header_type >> 7;  // is the device multifunction?
-			}
-			header_type = header_type & 0x7F; // clear the multifunction bit
-			
-			create_pci_dev_name(dev);
-			
-			pci_alloc_resource_list(dev);
-			pci_read_bars(dev);
-			pci_read_interrupt(dev);
-			
-			dev->ops = &pci_child_ops;			
-			
-			printf(NAME ": adding new child device %s.\n", dev->name);
-			
-			create_pci_match_ids(dev);
-			
-			if (EOK != child_device_register(dev, parent)) {				
-				pci_clean_resource_list(dev);				
-				clean_match_ids(&dev->match_ids);
-				free((char *)dev->name);
-				dev->name = NULL;
-				continue;
-			}
-			
-			//printf(NAME ": new device %s was successfully registered by device manager.\n", dev->name);
-			
-			if (header_type == PCI_HEADER_TYPE_BRIDGE || header_type == PCI_HEADER_TYPE_CARDBUS ) {
-				child_bus = pci_conf_read_8(dev, PCI_BRIDGE_SEC_BUS_NUM);
-				printf(NAME ": device is pci-to-pci bridge, secondary bus number = %d.\n", bus_num);
-				if(child_bus > bus_num) {			
-					pci_bus_scan(parent, child_bus);	
-				}					
-			}
-			
-			dev = create_device();  // alloc new aux. dev. structure
-			dev_data = create_pci_dev_data();
-			dev->driver_data = dev_data;
-			dev->parent = parent;
-		}
-	}
-	
-	if (dev_data->vendor_id == 0xffff) {
-		delete_device(dev);
-		delete_pci_dev_data(dev_data);  // free the auxiliary device structure
-	}		
-}
-
-static int pci_add_device(device_t *dev)
-{
-	printf(NAME ": pci_add_device\n");
-	
-	pci_bus_data_t *bus_data = create_pci_bus_data();
-	if (NULL == bus_data) {
-		printf(NAME ": pci_add_device allocation failed.\n");
-		return ENOMEM;
-	}	
-	
-	dev->parent_phone = devman_parent_device_connect(dev->handle,  IPC_FLAG_BLOCKING);
-	if (dev->parent_phone <= 0) {
-		printf(NAME ": pci_add_device failed to connect to the parent's driver.\n");
-		delete_pci_bus_data(bus_data);
-		return EPARTY;
-	}
-	
-	hw_resource_list_t hw_resources;
-	
-	if (!get_hw_resources(dev->parent_phone, &hw_resources)) {
-		printf(NAME ": pci_add_device failed to get hw resources for the device.\n");
-		delete_pci_bus_data(bus_data);
-		ipc_hangup(dev->parent_phone);
-		return EPARTY;		
-	}	
-	
-	printf(NAME ": conf_addr = %x.\n", hw_resources.resources[0].res.io_range.address);	
-	
-	assert(hw_resources.count > 0);
-	assert(hw_resources.resources[0].type == IO_RANGE);
-	assert(hw_resources.resources[0].res.io_range.size == 8);
-	
-	bus_data->conf_io_addr = (uint32_t)hw_resources.resources[0].res.io_range.address;
-	
-	if (pio_enable((void *)bus_data->conf_io_addr, 8, &bus_data->conf_addr_port)) {
-		printf(NAME ": failed to enable configuration ports.\n");
-		delete_pci_bus_data(bus_data);
-		ipc_hangup(dev->parent_phone);
-		clean_hw_resource_list(&hw_resources);
-		return EADDRNOTAVAIL;					
-	}
-	bus_data->conf_data_port = (char *)bus_data->conf_addr_port + 4;
-	
-	dev->driver_data = bus_data;
-	
-	// enumerate child devices
-	printf(NAME ": scanning the bus\n");
-	pci_bus_scan(dev, 0);
-	
-	clean_hw_resource_list(&hw_resources);
-	
-	return EOK;
-}
-
-static void pciintel_init() 
-{
-	pci_child_ops.interfaces[HW_RES_DEV_IFACE] = &pciintel_child_res_iface;
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": HelenOS pci bus driver (intel method 1).\n");
-	pciintel_init();
-	return driver_main(&pci_driver);
-}
-
-/**
- * @}
- */
Index: uspace/srv/drivers/pciintel/pci.h
===================================================================
--- uspace/srv/drivers/pciintel/pci.h	(revision 374ad3c3bf704b2f3c5a99e04d8f771d868a5269)
+++ 	(revision )
@@ -1,147 +1,0 @@
-/*
- * 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 pciintel
- * @{
- */
-/** @file
- */
- 
-#ifndef PCI_H
-#define PCI_H
-
-
-#include <stdlib.h>
-#include <driver.h>
-#include <malloc.h>
-
-#include "pci_regs.h"
-
-#define PCI_MAX_HW_RES 8
-
-typedef struct pci_dev_data {
-	int bus;
-	int dev;
-	int fn;
-	int vendor_id;
-	int device_id;
-	hw_resource_list_t hw_resources;
-} pci_dev_data_t;
-
-void create_pci_match_ids(device_t *dev);
-
-uint8_t pci_conf_read_8(device_t *dev, int reg);
-uint16_t pci_conf_read_16(device_t *dev, int reg);
-uint32_t pci_conf_read_32(device_t *dev, int reg);
-void pci_conf_write_8(device_t *dev, int reg, uint8_t val);
-void pci_conf_write_16(device_t *dev, int reg, uint16_t val);
-void pci_conf_write_32(device_t *dev, int reg, uint32_t val);
-
-void pci_add_range(device_t *dev, uint64_t range_addr, size_t range_size, bool io);
-int pci_read_bar(device_t *dev, int addr);
-void pci_read_interrupt(device_t *dev);
-void pci_add_interrupt(device_t *dev, int irq);
-
-void pci_bus_scan(device_t *parent, int bus_num);
-
-
-static inline pci_dev_data_t *create_pci_dev_data() 
-{
-	pci_dev_data_t *res = (pci_dev_data_t *)malloc(sizeof(pci_dev_data_t));
-	if (NULL != res) {
-		memset(res, 0, sizeof(pci_dev_data_t));
-	}
-	return res;	
-}
-
-static inline void init_pci_dev_data(pci_dev_data_t *d, int bus, int dev, int fn) 
-{
-	d->bus = bus;
-	d->dev = dev;
-	d->fn = fn;	
-}
-
-static inline void delete_pci_dev_data(pci_dev_data_t *d) 
-{
-	if (NULL != d) {
-		clean_hw_resource_list(&d->hw_resources);
-		free(d);	
-	}
-}
-
-static inline void create_pci_dev_name(device_t *dev)
-{
-	pci_dev_data_t *dev_data = (pci_dev_data_t *)dev->driver_data;
-	char *name = NULL;
-	asprintf(&name, "%02x:%02x.%01x", dev_data->bus, dev_data->dev, dev_data->fn);
-	dev->name = name;
-}
-
-static inline bool pci_alloc_resource_list(device_t *dev)
-{
-	pci_dev_data_t *dev_data = (pci_dev_data_t *)dev->driver_data;
-	dev_data->hw_resources.resources = (hw_resource_t *)malloc(PCI_MAX_HW_RES * sizeof(hw_resource_t));
-	return dev_data->hw_resources.resources != NULL;	
-}
-
-static inline void pci_clean_resource_list(device_t *dev)
-{
-	pci_dev_data_t *dev_data = (pci_dev_data_t *)dev->driver_data;
-	if (NULL != dev_data->hw_resources.resources) {
-		free(dev_data->hw_resources.resources);
-		dev_data->hw_resources.resources = NULL;
-	}
-}
-
-/** Read the base address registers (BARs) of the device 
- *  and adds the addresses to its hw resource list.
- * 
- * @param dev the pci device.
- */
-static inline  void pci_read_bars(device_t *dev)
-{
-	// position of the BAR in the PCI configuration address space of the device
-	int addr = PCI_BASE_ADDR_0;
-	
-	while (addr <= PCI_BASE_ADDR_5) {
-		addr = pci_read_bar(dev, addr);	
-	}	
-}
-
-static inline size_t pci_bar_mask_to_size(uint32_t mask)
-{
-	return ((mask & 0xfffffff0) ^ 0xffffffff) + 1;
-}
-
-
-#endif
-
-
-/**
- * @}
- */
Index: uspace/srv/drivers/pciintel/pci_regs.h
===================================================================
--- uspace/srv/drivers/pciintel/pci_regs.h	(revision 374ad3c3bf704b2f3c5a99e04d8f771d868a5269)
+++ 	(revision )
@@ -1,102 +1,0 @@
-/*
- * 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 pciintel
- * @{
- */
-/** @file
- */
- 
-#ifndef PCI_REGS_H
-#define PCI_REGS_H
-
-// Header types 
-#define PCI_HEADER_TYPE_DEV			0
-#define PCI_HEADER_TYPE_BRIDGE		1
-#define PCI_HEADER_TYPE_CARDBUS		2
-
-// Header type 0 and 1
-#define PCI_VENDOR_ID		 			0x00
-#define PCI_DEVICE_ID 					0x02
-#define PCI_COMMAND 					0x04
-#define PCI_STATUS 						0x06
-#define PCI_REVISION_ID 				0x08
-#define PCI_PROG_IF						0x09
-#define PCI_SUB_CLASS					0x0A
-#define PCI_BASE_CLASS					0x0B
-#define PCI_CACHE_LINE_SIZE				0x0C
-#define PCI_LATENCY_TIMER				0x0D
-#define PCI_HEADER_TYPE					0x0E
-#define PCI_BIST						0x0F
-
-#define PCI_BASE_ADDR_0 				0x10
-#define PCI_BASE_ADDR_1 				0x14
-
-// Header type 0
-#define PCI_BASE_ADDR_2 				0x18
-#define PCI_BASE_ADDR_3 				0x1B
-#define PCI_BASE_ADDR_4 				0x20
-#define PCI_BASE_ADDR_5 				0x24
-
-#define PCI_CARDBUS_CIS_PTR				0x28
-#define PCI_SUBSYSTEM_VENDOR_ID			0x2C
-#define PCI_SUBSYSTEM_ID				0x2E
-#define PCI_EXP_ROM_BASE				0x30
-#define PCI_CAP_PTR						0x34
-#define PCI_INT_LINE					0x3C
-#define PCI_INT_PIN						0x3D
-#define PCI_MIN_GNT						0x3E
-#define PCI_MAX_LAT						0x3F
-
-// Header type 1
-#define PCI_BRIDGE_PRIM_BUS_NUM 		0x18
-#define PCI_BRIDGE_SEC_BUS_NUM 			0x19
-#define PCI_BRIDGE_SUBORD_BUS_NUM 		0x1A
-#define PCI_BRIDGE_SEC_LATENCY_TIMER 	0x1B
-#define PCI_BRIDGE_IO_BASE 				0x1C
-#define PCI_BRIDGE_IO_LIMIT 			0x1D
-#define PCI_BRIDGE_SEC_STATUS 			0x1E
-#define PCI_BRIDGE_MEMORY_BASE			0x20
-#define PCI_BRIDGE_MEMORY_LIMIT			0x22
-#define PCI_BRIDGE_PREF_MEMORY_BASE		0x24
-#define PCI_BRIDGE_PREF_MEMORY_LIMIT	0x26
-#define PCI_BRIDGE_PREF_MEMORY_BASE_UP	0x28
-#define PCI_BRIDGE_PREF_MEMORY_LIMIT_UP	0x2C
-#define PCI_BRIDGE_IO_BASE_UP			0x30
-#define PCI_BRIDGE_IO_LIMIT_UP 			0x32
-#define PCI_BRIDGE_EXP_ROM_BASE			0x38
-#define PCI_BRIDGE_INT_LINE				0x3C
-#define PCI_BRIDGE_INT_PIN				0x3D
-#define PCI_BRIDGE_CTL					0x3E
-
-#endif
-
-
-/**
- * @}
- */
Index: uspace/srv/drivers/pciintel/pciintel.ma
===================================================================
--- uspace/srv/drivers/pciintel/pciintel.ma	(revision 374ad3c3bf704b2f3c5a99e04d8f771d868a5269)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 intel_pci
Index: uspace/srv/drivers/root/Makefile
===================================================================
--- uspace/srv/drivers/root/Makefile	(revision 374ad3c3bf704b2f3c5a99e04d8f771d868a5269)
+++ 	(revision )
@@ -1,36 +1,0 @@
-# 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.
-#
-
-USPACE_PREFIX = ../../..
-LIBS = $(LIBDRV_PREFIX)/libdrv.a
-EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include
-BINARY = root
-
-SOURCES = \
-	root.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/drivers/root/root.c
===================================================================
--- uspace/srv/drivers/root/root.c	(revision 374ad3c3bf704b2f3c5a99e04d8f771d868a5269)
+++ 	(revision )
@@ -1,147 +1,0 @@
-/*
- * 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.
- */
-
-/**
- * @defgroup root Root device driver.
- * @brief HelenOS root device driver.
- * @{
- */
-
-/** @file
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <bool.h>
-#include <fibril_synch.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ctype.h>
-#include <macros.h>
-
-#include <driver.h>
-#include <devman.h>
-#include <ipc/devman.h>
-
-#define NAME "root"
-
-static int root_add_device(device_t *dev);
-
-/** The root device driver's standard operations.
- */
-static driver_ops_t root_ops = {
-	.add_device = &root_add_device
-};
-
-/** The root device driver structure. 
- */
-static driver_t root_driver = {
-	.name = NAME,
-	.driver_ops = &root_ops
-};
-
-/** Create the device which represents the root of HW device tree.
- * 
- * @param parent parent of the newly created device.
- * @return 0 on success, negative error number otherwise.
- */
-static int add_platform_child(device_t *parent) {
-	printf(NAME ": adding new child for platform device.\n");
-	
-	int res = EOK;
-	device_t *platform = NULL;
-	match_id_t *match_id = NULL;	
-	
-	// create new device
-	if (NULL == (platform = create_device())) {
-		res = ENOMEM;
-		goto failure;
-	}	
-	
-	platform->name = "hw";
-	printf(NAME ": the new device's name is %s.\n", platform->name);
-	
-	// initialize match id list
-	if (NULL == (match_id = create_match_id())) {
-		res = ENOMEM;
-		goto failure;
-	}
-	
-	// TODO - replace this with some better solution (sysinfo ?)
-	match_id->id = STRING(UARCH);
-	match_id->score = 100;
-	add_match_id(&platform->match_ids, match_id);	
-	
-	// register child  device
-	res = child_device_register(platform, parent);
-	if (EOK != res) {
-		goto failure;
-	}
-	
-	return res;
-	
-failure:
-	if (NULL != match_id) {
-		match_id->id = NULL;
-	}
-	
-	if (NULL != platform) {
-		platform->name = NULL;
-		delete_device(platform);		
-	}
-	
-	return res;	
-}
-
-/** Get the root device.
- * @param dev the device which is root of the whole device tree (both of HW and pseudo devices).
- */
-static int root_add_device(device_t *dev) 
-{
-	printf(NAME ": root_add_device, device handle = %d\n", dev->handle);
-	
-	// register root device's children	
-	int res = add_platform_child(dev);	
-	if (EOK != res) {
-		printf(NAME ": failed to add child device for platform.\n");
-	}
-	
-	return res;
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": HelenOS root device driver\n");	
-	return driver_main(&root_driver);
-}
-
-/**
- * @}
- */
- 
Index: uspace/srv/drivers/root/root.ma
===================================================================
--- uspace/srv/drivers/root/root.ma	(revision 374ad3c3bf704b2f3c5a99e04d8f771d868a5269)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 root
Index: uspace/srv/drivers/rootia32/Makefile
===================================================================
--- uspace/srv/drivers/rootia32/Makefile	(revision 374ad3c3bf704b2f3c5a99e04d8f771d868a5269)
+++ 	(revision )
@@ -1,36 +1,0 @@
-# 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.
-#
-
-USPACE_PREFIX = ../../..
-LIBS = $(LIBDRV_PREFIX)/libdrv.a
-EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include
-BINARY = rootia32
-
-SOURCES = \
-	rootia32.c
-
-include $(USPACE_PREFIX)/Makefile.common
Index: uspace/srv/drivers/rootia32/rootia32.c
===================================================================
--- uspace/srv/drivers/rootia32/rootia32.c	(revision 374ad3c3bf704b2f3c5a99e04d8f771d868a5269)
+++ 	(revision )
@@ -1,203 +1,0 @@
-/*
- * 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.
- */
-
-/**
- * @defgroup root_ia32 Root HW device driver for ia32 platform.
- * @brief HelenOS root HW device driver for ia32 platform.
- * @{
- */
-
-/** @file
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <bool.h>
-#include <fibril_synch.h>
-#include <stdlib.h>
-#include <str.h>
-#include <ctype.h>
-#include <macros.h>
-
-#include <driver.h>
-#include <devman.h>
-#include <ipc/devman.h>
-#include <ipc/dev_iface.h>
-#include <resource.h>
-#include <device/hw_res.h>
-
-#define NAME "rootia32"
-
-typedef struct rootia32_child_dev_data {
-	hw_resource_list_t hw_resources;	
-} rootia32_child_dev_data_t;
-
-static int rootia32_add_device(device_t *dev);
-static void root_ia32_init(void);
-
-/** The root device driver's standard operations.
- */
-static driver_ops_t rootia32_ops = {
-	.add_device = &rootia32_add_device
-};
-
-/** The root device driver structure. 
- */
-static driver_t rootia32_driver = {
-	.name = NAME,
-	.driver_ops = &rootia32_ops
-};
-
-static hw_resource_t pci_conf_regs = {
-	.type = IO_RANGE,
-	.res.io_range = {
-		.address = 0xCF8,
-		.size = 8,
-		.endianness = LITTLE_ENDIAN	
-	}	
-};
-
-static rootia32_child_dev_data_t pci_data = {
-	.hw_resources = {
-		1, 
-		&pci_conf_regs
-	}
-};
-
-static hw_resource_list_t * rootia32_get_child_resources(device_t *dev)
-{
-	rootia32_child_dev_data_t *data = (rootia32_child_dev_data_t *)dev->driver_data;
-	if (NULL == data) {
-		return NULL;
-	}
-	return &data->hw_resources;
-}
-
-static bool rootia32_enable_child_interrupt(device_t *dev) 
-{
-	// TODO
-	
-	return false;
-}
-
-static resource_iface_t child_res_iface = {
-	&rootia32_get_child_resources,
-	&rootia32_enable_child_interrupt	
-};
-
-// initialized in root_ia32_init() function
-static device_ops_t rootia32_child_ops;
-
-static bool rootia32_add_child(
-	device_t *parent, const char *name, const char *str_match_id, 
-	rootia32_child_dev_data_t *drv_data) 
-{
-	printf(NAME ": adding new child device '%s'.\n", name);
-	
-	device_t *child = NULL;
-	match_id_t *match_id = NULL;	
-	
-	// create new device
-	if (NULL == (child = create_device())) {
-		goto failure;
-	}
-	
-	child->name = name;
-	child->driver_data = drv_data;
-	
-	// initialize match id list
-	if (NULL == (match_id = create_match_id())) {
-		goto failure;
-	}
-	match_id->id = str_match_id;
-	match_id->score = 100;
-	add_match_id(&child->match_ids, match_id);	
-	
-	// set provided operations to the device
-	child->ops = &rootia32_child_ops;
-	
-	// register child  device
-	if (EOK != child_device_register(child, parent)) {
-		goto failure;
-	}
-	
-	return true;
-	
-failure:
-	if (NULL != match_id) {
-		match_id->id = NULL;
-	}
-	
-	if (NULL != child) {
-		child->name = NULL;
-		delete_device(child);		
-	}
-	
-	printf(NAME ": failed to add child device '%s'.\n", name);
-	
-	return false;	
-}
-
-static bool rootia32_add_children(device_t *dev) 
-{
-	return rootia32_add_child(dev, "pci0", "intel_pci", &pci_data);
-}
-
-/** Get the root device.
- * 
- * @param dev the device which is root of the whole device tree (both of HW and pseudo devices).
- * @return 0 on success, negative error number otherwise.
- */
-static int rootia32_add_device(device_t *dev) 
-{
-	printf(NAME ": rootia32_add_device, device handle = %d\n", dev->handle);
-	
-	// register child devices	
-	if (!rootia32_add_children(dev)) {
-		printf(NAME ": failed to add child devices for platform ia32.\n");
-	}
-	
-	return EOK;
-}
-
-static void root_ia32_init() {
-	rootia32_child_ops.interfaces[HW_RES_DEV_IFACE] = &child_res_iface;
-}
-
-int main(int argc, char *argv[])
-{
-	printf(NAME ": HelenOS rootia32 device driver\n");	
-	root_ia32_init();
-	return driver_main(&rootia32_driver);
-}
-
-/**
- * @}
- */
- 
Index: uspace/srv/drivers/rootia32/rootia32.ma
===================================================================
--- uspace/srv/drivers/rootia32/rootia32.ma	(revision 374ad3c3bf704b2f3c5a99e04d8f771d868a5269)
+++ 	(revision )
@@ -1,1 +1,0 @@
-10 ia32
