Modify some pci_hal funcs, fix obvious errors in code
authorHervé Poussineau <hpoussin@reactos.org>
Fri, 20 May 2005 21:43:57 +0000 (21:43 +0000)
committerHervé Poussineau <hpoussin@reactos.org>
Fri, 20 May 2005 21:43:57 +0000 (21:43 +0000)
svn path=/trunk/; revision=15439

reactos/drivers/usb/cromwell/core/hcd-pci.c
reactos/drivers/usb/cromwell/host/ohci_main.h
reactos/drivers/usb/cromwell/linux/linux_wrapper.h
reactos/drivers/usb/cromwell/linux/pci_hal.c
reactos/drivers/usb/cromwell/uhci/uhci-hcd.c
reactos/drivers/usb/cromwell/uhci/uhci_main.c

index e65c436..148cf85 100644 (file)
@@ -122,7 +122,7 @@ clean_1:
                        dbg ("no i/o regions available");\r
                        return -EBUSY;\r
                }\r
-               base = NULL; //(void *) resource; // this isn't possible\r
+               base = (void *) (ULONG_PTR)resource.u.LowPart;\r
        }\r
 \r
        // driver->start(), later on, will transfer device from\r
index 1324d1b..0ee0992 100644 (file)
@@ -31,6 +31,7 @@ typedef struct _OHCI_DEVICE_EXTENSTION
    ULONG InterruptLevel;\r
    PHYSICAL_ADDRESS BaseAddress;\r
    ULONG BaseAddrLength;\r
+   ULONG Flags;\r
    ULONG AdapterInterfaceType;\r
    ULONG SystemIoBusNumber;\r
    ULONG SystemIoSlotNumber;\r
index 382f186..0c759ef 100644 (file)
@@ -266,7 +266,7 @@ struct usbdevfs_hub_portinfo
 #define KERN_WARNING "WRN: "\r
 #define KERN_INFO "INF: "\r
 #define GFP_KERNEL 0\r
-#define GFP_ATOMIC 0\r
+#define GFP_ATOMIC 0x20\r
 #define GFP_NOIO 0\r
 #define SLAB_ATOMIC 0\r
 #define PCI_ANY_ID (~0)\r
@@ -406,7 +406,7 @@ struct usbdevfs_hub_portinfo
 \r
 #define pci_pool_alloc(a,b,c)  my_pci_pool_alloc(a,b,c) \r
 \r
-static void  __inline__ *my_pci_pool_alloc(void* pool, size_t size,\r
+static void __inline__ *my_pci_pool_alloc(void* pool, size_t size,\r
                                                dma_addr_t *dma_handle)\r
 {\r
        void* a;\r
@@ -479,8 +479,8 @@ int my_pci_module_init(struct pci_driver *x);
 #define PCI_DMA_FROMDEVICE\r
 #define PCI_DMA_TODEVICE\r
 \r
-#define PCI_ROM_RESOURCE 0\r
-#define IORESOURCE_IO 1\r
+#define PCI_ROM_RESOURCE 1\r
+#define IORESOURCE_IO CM_RESOURCE_PORT_IO\r
 \r
 #define DECLARE_WAITQUEUE(a,b) KEVENT a=0\r
 #define init_waitqueue_head(a) my_init_waitqueue_head(a)\r
index 1fed7dd..f3d538f 100644 (file)
@@ -39,8 +39,12 @@ static unsigned long __inline__ pci_resource_len (struct pci_dev *dev, int x)
 // ???\r
 static int __inline__ pci_resource_flags(struct pci_dev *dev, int x)\r
 {\r
-       DPRINT1("pci_resource_flags() called, x=0x%x\n");\r
-       return dev->flags[x];\r
+       POHCI_DEVICE_EXTENSION ext = (POHCI_DEVICE_EXTENSION)dev->dev_ext;\r
+       \r
+       DPRINT1("pci_resource_flags() called, x=0x%x\n", x);\r
+       \r
+               //FIXME: Take x into account\r
+    return ext->Flags;\r
 }\r
 \r
 /*\r
@@ -79,8 +83,8 @@ name   name of requester
 */\r
 static int __inline__ request_region(PHYSICAL_ADDRESS addr, unsigned long len, const char * d)\r
 {\r
-       DPRINT1("request_region(): addr=0x%x, len=0x%x\n", addr, len);\r
-       return 0;\r
+       DPRINT1("request_region(): addr=0x%lx, len=0x%lx\n", addr.u.LowPart, len);\r
+       return ~0;\r
 }\r
 \r
 /*\r
@@ -108,7 +112,7 @@ n  length of region
 */\r
 static int __inline__ release_region(PHYSICAL_ADDRESS addr, unsigned long len)\r
 {\r
-       DPRINT1("release_region(): addr=0x%x, len=0x%x\n", addr, len);\r
+       DPRINT1("release_region(): addr=0x%lx, len=0x%lx\n", addr.u.LowPart, len);\r
        return 0;\r
 }\r
 \r
index 5960d58..73871ac 100644 (file)
@@ -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");
index 641de5c..b5cc952 100644 (file)
@@ -133,7 +133,7 @@ NTSTATUS InitLinuxWrapper(PDEVICE_OBJECT DeviceObject)
        dev = ExAllocatePoolWithTag(PagedPool, sizeof(struct pci_dev), USB_UHCI_TAG);\r
        \r
        init_wrapper(dev);\r
-       dev->irq = DeviceExtension->InterruptLevel;\r
+       dev->irq = DeviceExtension->InterruptVector;\r
        dev->dev_ext = (PVOID)DeviceExtension;\r
        dev->slot_name = ExAllocatePoolWithTag(NonPagedPool, 128, USB_UHCI_TAG); // 128 max len for slot name\r
 \r
@@ -226,8 +226,9 @@ OHCD_PnPStartDevice(IN PDEVICE_OBJECT DeviceObject,
                                }\r
                                else if (Descriptor->Type == CmResourceTypePort)\r
                                {\r
-                                       DeviceExtension->BaseAddress    = Descriptor->u.Memory.Start;\r
-                                       DeviceExtension->BaseAddrLength = Descriptor->u.Memory.Length;\r
+                                       DeviceExtension->BaseAddress    = Descriptor->u.Port.Start;\r
+                                       DeviceExtension->BaseAddrLength = Descriptor->u.Port.Length;\r
+                                       DeviceExtension->Flags          = Descriptor->Flags;\r
                                        \r
                                DPRINT1("I/O resource: start=0x%x, length=0x%x\n",\r
                                  DeviceExtension->BaseAddress.u.LowPart, DeviceExtension->BaseAddrLength);\r