[ros-diffs] [fireball] 23705: - Enable PIRQ when initializing UHCI, this solves the "no irq" problem on some UHC controllers (most popular type of such controller is the one emulated by VMWare) - Fix a mistake in the source code resulting in a bugcheck - Add _X86 to .rbuild (by Thomas)

fireball at svn.reactos.org fireball at svn.reactos.org
Fri Aug 25 15:20:14 CEST 2006


Author: fireball
Date: Fri Aug 25 17:20:13 2006
New Revision: 23705

URL: http://svn.reactos.org/svn/reactos?rev=23705&view=rev
Log:
- Enable PIRQ when initializing UHCI, this solves the "no irq" problem on some UHC controllers (most popular type of such controller is the one emulated by VMWare)
- Fix a mistake in the source code resulting in a bugcheck
- Add _X86 to .rbuild (by Thomas)

Modified:
    trunk/reactos/drivers/usb/nt4compat/usbdriver/gendrv.c
    trunk/reactos/drivers/usb/nt4compat/usbdriver/td.h
    trunk/reactos/drivers/usb/nt4compat/usbdriver/uhci.c
    trunk/reactos/drivers/usb/nt4compat/usbdriver/usbdriver.rbuild

Modified: trunk/reactos/drivers/usb/nt4compat/usbdriver/gendrv.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/nt4compat/usbdriver/gendrv.c?rev=23705&r1=23704&r2=23705&view=diff
==============================================================================
--- trunk/reactos/drivers/usb/nt4compat/usbdriver/gendrv.c (original)
+++ trunk/reactos/drivers/usb/nt4compat/usbdriver/gendrv.c Fri Aug 25 17:20:13 2006
@@ -405,7 +405,7 @@
     purb = NULL;
 
     // set the dev state
-    status = usb_query_and_lock_dev(dev_mgr, purb->endp_handle, &pdev);
+    status = usb_query_and_lock_dev(dev_mgr, dev_handle, &pdev);
     if (status != STATUS_SUCCESS)
     {
         usb_unlock_dev(pdev);

Modified: trunk/reactos/drivers/usb/nt4compat/usbdriver/td.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/nt4compat/usbdriver/td.h?rev=23705&r1=23704&r2=23705&view=diff
==============================================================================
--- trunk/reactos/drivers/usb/nt4compat/usbdriver/td.h (original)
+++ trunk/reactos/drivers/usb/nt4compat/usbdriver/td.h Fri Aug 25 17:20:13 2006
@@ -80,8 +80,11 @@
 #define   USBPORTSC_SUSP    0x1000  /* Suspend */
 
 /* Legacy support register */
-#define USBLEGSUP 			0xc0
-#define USBLEGSUP_DEFAULT   0x2000  /* only PIRQ enable set */
+#define   USBLEGSUP		0xc0
+#define   USBLEGSUP_DEFAULT	0x2000	/* only PIRQ enable set */
+#define   USBLEGSUP_RWC		0x8f00	/* the R/WC bits */
+#define   USBLEGSUP_RO		0x5040	/* R/O and reserved bits */
+
 
 #define UHCI_NULL_DATA_SIZE 0x7FF   /* for UHCI controller TD */
 

Modified: trunk/reactos/drivers/usb/nt4compat/usbdriver/uhci.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/nt4compat/usbdriver/uhci.c?rev=23705&r1=23704&r2=23705&view=diff
==============================================================================
--- trunk/reactos/drivers/usb/nt4compat/usbdriver/uhci.c (original)
+++ trunk/reactos/drivers/usb/nt4compat/usbdriver/uhci.c Fri Aug 25 17:20:13 2006
@@ -908,12 +908,14 @@
 }
 
 // send cmds to start the uhc
-// shamelessly copied from linux's uhci.c
+// shamelessly copied from linux's uhci.c (reset_hc(), configure_hc() routines)
 BOOLEAN
 uhci_start(PHCD hcd)
 {
     PUHCI_DEV uhci;
     PBYTE io_addr;
+    USHORT pirq;
+    PCI_SLOT_NUMBER SlotNum;
     int timeout = 10000;
 
     uhci = uhci_from_hcd(hcd);
@@ -946,6 +948,18 @@
     WRITE_PORT_USHORT((PUSHORT) (io_addr + USBCMD), USBCMD_RS | USBCMD_CF | USBCMD_MAXP);
 
     DbgPrint("uhci_start(): current uhci status=0x%x\n", uhci_status(uhci));
+
+    /* Enable PIRQ */
+    pirq = USBLEGSUP_DEFAULT;
+    SlotNum.u.AsULONG = 0;
+    SlotNum.u.bits.DeviceNumber = ((uhci->pdev_ext->pci_addr & 0xff) >> 3);
+    SlotNum.u.bits.FunctionNumber = (uhci->pdev_ext->pci_addr & 0x07);
+
+    DbgPrint("uhci_start(): set bus %d data at slot 0x%x\n", (uhci->pdev_ext->pci_addr >> 8),
+        SlotNum.u.AsULONG);
+
+    HalSetBusDataByOffset(PCIConfiguration, (uhci->pdev_ext->pci_addr >> 8), SlotNum.u.AsULONG,
+        &pirq, USBLEGSUP, sizeof(pirq));
 
     return TRUE;
 }

Modified: trunk/reactos/drivers/usb/nt4compat/usbdriver/usbdriver.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/nt4compat/usbdriver/usbdriver.rbuild?rev=23705&r1=23704&r2=23705&view=diff
==============================================================================
--- trunk/reactos/drivers/usb/nt4compat/usbdriver/usbdriver.rbuild (original)
+++ trunk/reactos/drivers/usb/nt4compat/usbdriver/usbdriver.rbuild Fri Aug 25 17:20:13 2006
@@ -1,5 +1,6 @@
 <module name="usbdriver" type="kernelmodedriver" installbase="system32/drivers" installname="usbdriver.sys">
 	<define name="INCLUDE_EHCI" />
+	<define name="_X86" />
 	<include base="usbdriver">.</include>
 	<library>ntoskrnl</library>
 	<library>hal</library>




More information about the Ros-diffs mailing list