From 607f793fc04ccf81d29b3029e37ed28952c262d8 Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Sat, 4 Jun 2005 21:35:07 +0000 Subject: [PATCH] Fix a few critical typos/mistakes (like interruptvector/interruptlevel), stdcall for thread's func, etc. Also added some "hacks" into hub's thread, but at least it leads to first steps to device enumeration. Driver (OHCI) bugchecks on my_pci_pool_allocation now (when trying to send URB). svn path=/trunk/; revision=15795 --- reactos/drivers/usb/cromwell/core/hub.c | 23 +++++++++++++++---- reactos/drivers/usb/cromwell/host/ohci_main.c | 7 +++--- .../usb/cromwell/linux/linux_wrapper.h | 2 +- .../drivers/usb/cromwell/sys/linuxwrapper.c | 2 ++ 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/reactos/drivers/usb/cromwell/core/hub.c b/reactos/drivers/usb/cromwell/core/hub.c index 1fa5853f01a..2e43951433d 100644 --- a/reactos/drivers/usb/cromwell/core/hub.c +++ b/reactos/drivers/usb/cromwell/core/hub.c @@ -1019,6 +1019,7 @@ static void hub_events(void) * safe since we delete the hub from the event list. * Not the most efficient, but avoids deadlocks. */ + DPRINT1("hub_events() called\n"); while (m<5) { m++; @@ -1138,7 +1139,8 @@ static void hub_events(void) spin_unlock_irqrestore(&hub_event_lock, flags); } -static int hub_thread(void *__hub) +// ReactOS: STDCALL is needed here +static int STDCALL hub_thread(void *__hub) { /* * This thread doesn't need any user-level access, @@ -1149,14 +1151,25 @@ static int hub_thread(void *__hub) allow_signal(SIGKILL); /* Send me a signal to get me die (for debugging) */ do { - + + /* The following is just for debug */ + inc_jiffies(1); + do_all_timers(); + handle_irqs(-1); + /* End of debug hack*/ + hub_events(); + /* The following is just for debug */ + handle_irqs(-1); + /* End of debug hack*/ + + //FIXME: Correct this //wait_event_interruptible(khubd_wait, !list_empty(&hub_event_list)); // interruptable_sleep_on analog - below - while (!list_empty(&hub_event_list)) { - interruptible_sleep_on(&khubd_wait); - } + //while (!list_empty(&hub_event_list)) { + // interruptible_sleep_on(&khubd_wait); + //} if (current->flags & PF_FREEZE) refrigerator(PF_IOTHREAD); diff --git a/reactos/drivers/usb/cromwell/host/ohci_main.c b/reactos/drivers/usb/cromwell/host/ohci_main.c index 66f8632f889..2f3aec3c129 100644 --- a/reactos/drivers/usb/cromwell/host/ohci_main.c +++ b/reactos/drivers/usb/cromwell/host/ohci_main.c @@ -125,7 +125,8 @@ VOID STDCALL DriverUnload(PDRIVER_OBJECT DriverObject) ohci_hcd_pci_cleanup(); } -NTSTATUS InitLinuxWrapper(PDEVICE_OBJECT DeviceObject) +NTSTATUS +InitLinuxWrapper(PDEVICE_OBJECT DeviceObject) { NTSTATUS Status; POHCI_DEVICE_EXTENSION DeviceExtension = (POHCI_DEVICE_EXTENSION)DeviceObject->DeviceExtension; @@ -134,7 +135,7 @@ NTSTATUS InitLinuxWrapper(PDEVICE_OBJECT DeviceObject) dev = ExAllocatePoolWithTag(PagedPool, sizeof(struct pci_dev), USB_OHCI_TAG); init_wrapper(dev); - dev->irq = DeviceExtension->InterruptLevel; + dev->irq = DeviceExtension->InterruptVector; dev->dev_ext = (PVOID)DeviceExtension; dev->slot_name = ExAllocatePoolWithTag(NonPagedPool, 128, USB_OHCI_TAG); // 128 max len for slot name @@ -151,7 +152,7 @@ NTSTATUS InitLinuxWrapper(PDEVICE_OBJECT DeviceObject) // Probe device with real id now ohci_pci_driver.probe(dev, pci_ids); - DPRINT("InitLinuxWrapper() done\n"); + DPRINT1("InitLinuxWrapper() done\n"); return STATUS_SUCCESS; } diff --git a/reactos/drivers/usb/cromwell/linux/linux_wrapper.h b/reactos/drivers/usb/cromwell/linux/linux_wrapper.h index acd892e8e7a..06fbe6df85c 100644 --- a/reactos/drivers/usb/cromwell/linux/linux_wrapper.h +++ b/reactos/drivers/usb/cromwell/linux/linux_wrapper.h @@ -517,7 +517,7 @@ void my_interruptible_sleep_on(PKEVENT evnt); #define flush_scheduled_work() do {} while(0) #define refrigerator(x) do {} while(0) -#define signal_pending(x) 1 // fall through threads +#define signal_pending(x) 0 // Don't fall through threads! ReactOS implements this correctly #define complete_and_exit(a,b) return 0 //#define kill_proc(a,b,c) 0 diff --git a/reactos/drivers/usb/cromwell/sys/linuxwrapper.c b/reactos/drivers/usb/cromwell/sys/linuxwrapper.c index 6b5af2adb3c..3e9b41e455f 100644 --- a/reactos/drivers/usb/cromwell/sys/linuxwrapper.c +++ b/reactos/drivers/usb/cromwell/sys/linuxwrapper.c @@ -126,6 +126,8 @@ int my_kernel_thread(int STDCALL (*handler)(void*), void* parm, int flags) (PKSTART_ROUTINE)handler, parm); + DPRINT1("usbcore: Created system thread %d\n", (int)hThread); + return (int)hThread; // FIXME: Correct? }