Index: uspace/lib/libc/generic/device/hw_res.c
===================================================================
--- uspace/lib/libc/generic/device/hw_res.c	(revision 9a66bc2ed74a9425386a5a8717ee6155578308a0)
+++ uspace/lib/libc/generic/device/hw_res.c	(revision 8c069051b9bc1cdcb7cbc1b01fce79aacc0d72ef)
@@ -41,5 +41,4 @@
 bool get_hw_resources(int dev_phone, hw_resource_list_t *hw_resources)
 {
-	bool ret = true;
 	ipcarg_t count = 0;
 	int rc = async_req_1_1(dev_phone, HW_RES_DEV_IFACE, GET_RESOURCE_LIST, &count);
Index: uspace/lib/libc/include/ipc/dev_iface.h
===================================================================
--- uspace/lib/libc/include/ipc/dev_iface.h	(revision 9a66bc2ed74a9425386a5a8717ee6155578308a0)
+++ uspace/lib/libc/include/ipc/dev_iface.h	(revision 8c069051b9bc1cdcb7cbc1b01fce79aacc0d72ef)
@@ -31,4 +31,5 @@
 
 #include <ipc/ipc.h>
+#include <malloc.h>
 
 #define DEV_IFACE_FIRST IPC_FIRST_USER_METHOD
@@ -85,3 +86,10 @@
 } hw_resource_list_t;
 
+static inline void clean_hw_resource_list(hw_resource_list_t *hw_res)
+{
+	free(hw_res->resources);
+	hw_res->resources = 0;
+	hw_res->count = 0;	
+}
+
 #endif
Index: uspace/srv/drivers/pciintel/Makefile
===================================================================
--- uspace/srv/drivers/pciintel/Makefile	(revision 8c069051b9bc1cdcb7cbc1b01fce79aacc0d72ef)
+++ uspace/srv/drivers/pciintel/Makefile	(revision 8c069051b9bc1cdcb7cbc1b01fce79aacc0d72ef)
@@ -0,0 +1,38 @@
+# 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 $(LIBC_PREFIX)/libc.a
+
+OUTPUT = pciintel
+
+SOURCES = \
+	pci.c
+
+include ../../Makefile.common
+
+EXTRA_CFLAGS = -I$(LIBDRV_PREFIX)/include
Index: uspace/srv/drivers/pciintel/pci.c
===================================================================
--- uspace/srv/drivers/pciintel/pci.c	(revision 8c069051b9bc1cdcb7cbc1b01fce79aacc0d72ef)
+++ uspace/srv/drivers/pciintel/pci.c	(revision 8c069051b9bc1cdcb7cbc1b01fce79aacc0d72ef)
@@ -0,0 +1,141 @@
+/*
+ * 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 <stdlib.h>
+#include <string.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>
+
+#define NAME "pciintel"
+
+static bool 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 {
+	void *conf_io_addr;
+	void *conf_data_port;
+	void *conf_addr_port;	
+} pci_bus_data_t;
+
+
+static bool pci_add_device(device_t *dev)
+{
+	printf(NAME ": pci_add_device\n");
+	
+	pci_bus_data_t *bus_data = (pci_bus_data_t *)malloc(sizeof(pci_bus_data_t));
+	if (NULL == bus_data) {
+		printf(NAME ": pci_add_device allocation failed.\n");
+		return false;
+	}	
+	
+	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");
+		free(bus_data);
+		return false;
+	}
+	
+	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");
+		free(bus_data);
+		ipc_hangup(dev->parent_phone);
+		return false;		
+	}
+	
+	
+	printf(NAME ": conf_addr = %x.\n", hw_resources.resources[0].res.reg.address);	
+	
+	assert(hw_resources.count > 0);
+	assert(hw_resources.resources[0].type == REGISTER);
+	assert(hw_resources.resources[0].res.reg.size == 8);
+	
+	bus_data->conf_io_addr = hw_resources.resources[0].res.reg.address;
+	
+	if (pio_enable(bus_data->conf_io_addr, 8, &bus_data->conf_addr_port)) {
+		printf(NAME ": failed to enable configuration ports.\n");
+		free(bus_data);
+		ipc_hangup(dev->parent_phone);
+		clean_hw_resource_list(&hw_resources);
+		return false;					
+	}
+	bus_data->conf_data_port = (char *)bus_data->conf_addr_port + 4;
+	
+	dev->driver_data = bus_data;
+	
+	// TODO scan the bus	
+	
+	clean_hw_resource_list(&hw_resources);
+	
+	return true;
+}
+
+int main(int argc, char *argv[])
+{
+	printf(NAME ": HelenOS pci bus driver (intel method 1).\n");	
+	return driver_main(&pci_driver);
+}
+
+/**
+ * @}
+ */
Index: uspace/srv/drivers/pciintel/pci.h
===================================================================
--- uspace/srv/drivers/pciintel/pci.h	(revision 8c069051b9bc1cdcb7cbc1b01fce79aacc0d72ef)
+++ uspace/srv/drivers/pciintel/pci.h	(revision 8c069051b9bc1cdcb7cbc1b01fce79aacc0d72ef)
@@ -0,0 +1,54 @@
+/*
+ * 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 <driver.h>
+
+typedef struct pci_dev_data {
+	int bus;
+	int dev;
+	int fn;
+	hw_resource_list hw_resources;
+} pci_dev_data_t;
+
+
+
+#endif
+
+
+/**
+ * @}
+ */
Index: uspace/srv/drivers/pciintel/pci_regs.h
===================================================================
--- uspace/srv/drivers/pciintel/pci_regs.h	(revision 8c069051b9bc1cdcb7cbc1b01fce79aacc0d72ef)
+++ uspace/srv/drivers/pciintel/pci_regs.h	(revision 8c069051b9bc1cdcb7cbc1b01fce79aacc0d72ef)
@@ -0,0 +1,102 @@
+/*
+ * 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 8c069051b9bc1cdcb7cbc1b01fce79aacc0d72ef)
+++ uspace/srv/drivers/pciintel/pciintel.ma	(revision 8c069051b9bc1cdcb7cbc1b01fce79aacc0d72ef)
@@ -0,0 +1,1 @@
+10 intel_pci
