Modify some pci_hal funcs, fix obvious errors in code
Modified: trunk/reactos/drivers/usb/cromwell/core/hcd-pci.c
Modified: trunk/reactos/drivers/usb/cromwell/host/ohci_main.h
Modified: trunk/reactos/drivers/usb/cromwell/linux/linux_wrapper.h
Modified: trunk/reactos/drivers/usb/cromwell/linux/pci_hal.c
Modified: trunk/reactos/drivers/usb/cromwell/uhci/uhci-hcd.c
Modified: trunk/reactos/drivers/usb/cromwell/uhci/uhci_main.c

Modified: trunk/reactos/drivers/usb/cromwell/core/hcd-pci.c
--- trunk/reactos/drivers/usb/cromwell/core/hcd-pci.c	2005-05-20 21:33:49 UTC (rev 15438)
+++ trunk/reactos/drivers/usb/cromwell/core/hcd-pci.c	2005-05-20 21:43:57 UTC (rev 15439)
@@ -122,7 +122,7 @@
 			dbg ("no i/o regions available");
 			return -EBUSY;
 		}
-		base = NULL; //(void *) resource; // this isn't possible
+		base = (void *) (ULONG_PTR)resource.u.LowPart;
 	}
 
 	// driver->start(), later on, will transfer device from

Modified: trunk/reactos/drivers/usb/cromwell/host/ohci_main.h
--- trunk/reactos/drivers/usb/cromwell/host/ohci_main.h	2005-05-20 21:33:49 UTC (rev 15438)
+++ trunk/reactos/drivers/usb/cromwell/host/ohci_main.h	2005-05-20 21:43:57 UTC (rev 15439)
@@ -31,6 +31,7 @@
    ULONG InterruptLevel;
    PHYSICAL_ADDRESS BaseAddress;
    ULONG BaseAddrLength;
+   ULONG Flags;
    ULONG AdapterInterfaceType;
    ULONG SystemIoBusNumber;
    ULONG SystemIoSlotNumber;

Modified: trunk/reactos/drivers/usb/cromwell/linux/linux_wrapper.h
--- trunk/reactos/drivers/usb/cromwell/linux/linux_wrapper.h	2005-05-20 21:33:49 UTC (rev 15438)
+++ trunk/reactos/drivers/usb/cromwell/linux/linux_wrapper.h	2005-05-20 21:43:57 UTC (rev 15439)
@@ -266,7 +266,7 @@
 #define KERN_WARNING "WRN: "
 #define KERN_INFO "INF: "
 #define GFP_KERNEL 0
-#define GFP_ATOMIC 0
+#define GFP_ATOMIC 0x20
 #define GFP_NOIO 0
 #define SLAB_ATOMIC 0
 #define PCI_ANY_ID (~0)
@@ -406,7 +406,7 @@
 
 #define pci_pool_alloc(a,b,c)  my_pci_pool_alloc(a,b,c) 
 
-static void  __inline__ *my_pci_pool_alloc(void* pool, size_t size,
+static void __inline__ *my_pci_pool_alloc(void* pool, size_t size,
 						dma_addr_t *dma_handle)
 {
 	void* a;
@@ -479,8 +479,8 @@
 #define PCI_DMA_FROMDEVICE
 #define PCI_DMA_TODEVICE
 
-#define PCI_ROM_RESOURCE 0
-#define IORESOURCE_IO 1
+#define PCI_ROM_RESOURCE 1
+#define IORESOURCE_IO CM_RESOURCE_PORT_IO
 
 #define DECLARE_WAITQUEUE(a,b) KEVENT a=0
 #define init_waitqueue_head(a) my_init_waitqueue_head(a)

Modified: trunk/reactos/drivers/usb/cromwell/linux/pci_hal.c
--- trunk/reactos/drivers/usb/cromwell/linux/pci_hal.c	2005-05-20 21:33:49 UTC (rev 15438)
+++ trunk/reactos/drivers/usb/cromwell/linux/pci_hal.c	2005-05-20 21:43:57 UTC (rev 15439)
@@ -39,8 +39,12 @@
 // ???
 static int __inline__ pci_resource_flags(struct pci_dev *dev, int x)
 {
-	DPRINT1("pci_resource_flags() called, x=0x%x\n");
-	return dev->flags[x];
+	POHCI_DEVICE_EXTENSION ext = (POHCI_DEVICE_EXTENSION)dev->dev_ext;
+	
+	DPRINT1("pci_resource_flags() called, x=0x%x\n", x);
+	
+		//FIXME: Take x into account
+    return ext->Flags;
 }
 
 /*
@@ -79,8 +83,8 @@
 */
 static int __inline__ request_region(PHYSICAL_ADDRESS addr, unsigned long len, const char * d)
 {
-	DPRINT1("request_region(): addr=0x%x, len=0x%x\n", addr, len);
-	return 0;
+	DPRINT1("request_region(): addr=0x%lx, len=0x%lx\n", addr.u.LowPart, len);
+	return ~0;
 }
 
 /*
@@ -108,7 +112,7 @@
 */
 static int __inline__ release_region(PHYSICAL_ADDRESS addr, unsigned long len)
 {
-	DPRINT1("release_region(): addr=0x%x, len=0x%x\n", addr, len);
+	DPRINT1("release_region(): addr=0x%lx, len=0x%lx\n", addr.u.LowPart, len);
 	return 0;
 }
 

Modified: trunk/reactos/drivers/usb/cromwell/uhci/uhci-hcd.c
--- trunk/reactos/drivers/usb/cromwell/uhci/uhci-hcd.c	2005-05-20 21:33:49 UTC (rev 15438)
+++ trunk/reactos/drivers/usb/cromwell/uhci/uhci-hcd.c	2005-05-20 21:43:57 UTC (rev 15439)
@@ -81,7 +81,7 @@
 #ifdef DEBUG
 static int debug = 1;
 #else
-static int debug = 0;
+static int debug = 2;
 #endif
 MODULE_PARM(debug, "i");
 MODULE_PARM_DESC(debug, "Debug level");

Modified: trunk/reactos/drivers/usb/cromwell/uhci/uhci_main.c
--- trunk/reactos/drivers/usb/cromwell/uhci/uhci_main.c	2005-05-20 21:33:49 UTC (rev 15438)
+++ trunk/reactos/drivers/usb/cromwell/uhci/uhci_main.c	2005-05-20 21:43:57 UTC (rev 15439)
@@ -133,7 +133,7 @@
 	dev = ExAllocatePoolWithTag(PagedPool, sizeof(struct pci_dev), USB_UHCI_TAG);
 	
 	init_wrapper(dev);
-	dev->irq = DeviceExtension->InterruptLevel;
+	dev->irq = DeviceExtension->InterruptVector;
 	dev->dev_ext = (PVOID)DeviceExtension;
 	dev->slot_name = ExAllocatePoolWithTag(NonPagedPool, 128, USB_UHCI_TAG); // 128 max len for slot name
 
@@ -226,8 +226,9 @@
 				}
 				else if (Descriptor->Type == CmResourceTypePort)
 				{
-					DeviceExtension->BaseAddress	= Descriptor->u.Memory.Start;
-					DeviceExtension->BaseAddrLength = Descriptor->u.Memory.Length;
+					DeviceExtension->BaseAddress	= Descriptor->u.Port.Start;
+					DeviceExtension->BaseAddrLength = Descriptor->u.Port.Length;
+					DeviceExtension->Flags          = Descriptor->Flags;
 					
      				DPRINT1("I/O resource: start=0x%x, length=0x%x\n",
                                  DeviceExtension->BaseAddress.u.LowPart, DeviceExtension->BaseAddrLength);