]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg: add support for ORICO PEUS3-2P card
authorerictian <erictian@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 7 Mar 2012 08:39:35 +0000 (08:39 +0000)
committererictian <erictian@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 7 Mar 2012 08:39:35 +0000 (08:39 +0000)
1) Fix a bug on missing hub context evaluation operation.
2) If the usb keyboard device configuration has been set successfully, then don’t set configuration again.

Signed-off-by: erictian
Reviewed-by: li-elvin
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13087 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
MdeModulePkg/Bus/Usb/UsbBusDxe/UsbEnumer.c
MdeModulePkg/Bus/Usb/UsbKbDxe/KeyBoard.c
MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c

index 8cbb7bab0740175804a3055ede951e8647eb7c9e..0c08301e9ba4b92b3ad8a9ac1fbfafecdd37c3e5 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The XHCI controller driver.\r
 \r
-Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -873,10 +873,12 @@ XhcControlTransfer (
 \r
   if (*TransferResult == EFI_USB_NOERROR) {\r
     Status = EFI_SUCCESS;\r
-  } else if ((*TransferResult == EFI_USB_ERR_STALL) ||\r
-             (*TransferResult == EFI_USB_ERR_TIMEOUT)) {\r
+  } else if (*TransferResult == EFI_USB_ERR_STALL) {\r
     RecoveryStatus = XhcRecoverHaltedEndpoint(Xhc, Urb);\r
     ASSERT_EFI_ERROR (RecoveryStatus);\r
+    Status = EFI_DEVICE_ERROR;\r
+    goto FREE_URB;\r
+  } else {\r
     goto FREE_URB;\r
   }\r
 \r
@@ -886,7 +888,8 @@ XhcControlTransfer (
   // Hook Set_Config request from UsbBus as we need configure device endpoint.\r
   //\r
   if ((Request->Request     == USB_REQ_GET_DESCRIPTOR) &&\r
-      (Request->RequestType == USB_REQUEST_TYPE (EfiUsbDataIn, USB_REQ_TYPE_STANDARD, USB_TARGET_DEVICE))) {\r
+      ((Request->RequestType == USB_REQUEST_TYPE (EfiUsbDataIn, USB_REQ_TYPE_STANDARD, USB_TARGET_DEVICE)) || \r
+      ((Request->RequestType == USB_REQUEST_TYPE (EfiUsbDataIn, USB_REQ_TYPE_CLASS, USB_TARGET_DEVICE))))) {\r
     DescriptorType = (UINT8)(Request->Value >> 8);\r
     if ((DescriptorType == USB_DESC_TYPE_DEVICE) && (*DataLength == sizeof (EFI_USB_DEVICE_DESCRIPTOR))) {\r
         ASSERT (Data != NULL);\r
@@ -920,10 +923,11 @@ XhcControlTransfer (
         Xhc->UsbDevContext[SlotId].ConfDesc[Index] = AllocateZeroPool(*DataLength);\r
         CopyMem (Xhc->UsbDevContext[SlotId].ConfDesc[Index], Data, *DataLength);\r
       }\r
-    } else if ((DescriptorType == USB_DESC_TYPE_HUB) ||\r
-               (DescriptorType == USB_DESC_TYPE_HUB_SUPER_SPEED)) {\r
+    } else if (((DescriptorType == USB_DESC_TYPE_HUB) ||\r
+               (DescriptorType == USB_DESC_TYPE_HUB_SUPER_SPEED)) && (*DataLength > 2)) {\r
       ASSERT (Data != NULL);\r
       HubDesc = (EFI_USB_HUB_DESCRIPTOR *)Data;\r
+      ASSERT (HubDesc->NumPorts <= 15);\r
       //\r
       // The bit 5,6 of HubCharacter field of Hub Descriptor is TTT.\r
       //\r
@@ -932,8 +936,8 @@ XhcControlTransfer (
         //\r
         // Don't support multi-TT feature for super speed hub now.\r
         //\r
-        MTT = 1;\r
-        ASSERT (FALSE);\r
+        MTT = 0;\r
+        DEBUG ((EFI_D_ERROR, "XHCI: Don't support multi-TT feature for Hub now. (force to disable MTT)\n"));\r
       } else {\r
         MTT = 0;\r
       }\r
@@ -1152,10 +1156,10 @@ XhcBulkTransfer (
 \r
   if (*TransferResult == EFI_USB_NOERROR) {\r
     Status = EFI_SUCCESS;\r
-  } else if ((*TransferResult == EFI_USB_ERR_STALL) ||\r
-             (*TransferResult == EFI_USB_ERR_TIMEOUT)) {\r
+  } else if (*TransferResult == EFI_USB_ERR_STALL) {\r
     RecoveryStatus = XhcRecoverHaltedEndpoint(Xhc, Urb);\r
     ASSERT_EFI_ERROR (RecoveryStatus);\r
+    Status = EFI_DEVICE_ERROR;\r
   }\r
 \r
   FreePool (Urb);\r
@@ -1451,10 +1455,10 @@ XhcSyncInterruptTransfer (
 \r
   if (*TransferResult == EFI_USB_NOERROR) {\r
     Status = EFI_SUCCESS;\r
-  } else if ((*TransferResult == EFI_USB_ERR_STALL) ||\r
-             (*TransferResult == EFI_USB_ERR_TIMEOUT)) {\r
+  } else if (*TransferResult == EFI_USB_ERR_STALL) {\r
     RecoveryStatus = XhcRecoverHaltedEndpoint(Xhc, Urb);\r
     ASSERT_EFI_ERROR (RecoveryStatus);\r
+    Status = EFI_DEVICE_ERROR;\r
   }\r
 \r
   FreePool (Urb);\r
index 6d4044a09b198eb04fd01c61bffdde14fc414c17..372702d3f08239f11432dbf549595530db420e27 100644 (file)
@@ -2,7 +2,7 @@
 \r
   XHCI transfer scheduling routines.\r
 \r
-Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -1489,8 +1489,8 @@ XhcSyncEventRing (
     // Some 3rd party XHCI external cards don't support single 64-bytes width register access,\r
     // So divide it to two 32-bytes width register access.\r
     //\r
-    XhcWriteRuntimeReg (Xhc, XHC_ERDP_OFFSET, Low | BIT3);\r
-    XhcWriteRuntimeReg (Xhc, XHC_ERDP_OFFSET + 4, High);\r
+    XhcWriteRuntimeReg (Xhc, XHC_ERDP_OFFSET, XHC_LOW_32BIT (EvtRing->EventRingDequeue) | BIT3);\r
+    XhcWriteRuntimeReg (Xhc, XHC_ERDP_OFFSET + 4, XHC_HIGH_32BIT (EvtRing->EventRingDequeue));\r
   }\r
 \r
   return EFI_SUCCESS;\r
index b7141a0ab334a55663c95806a918cdf378c463bd..8d031b90457efa05fb2b068a7cb47806029696fb 100644 (file)
@@ -2,7 +2,7 @@
 \r
     Usb bus enumeration support.\r
 \r
-Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -698,26 +698,23 @@ UsbEnumerateNewDev (
 \r
   DEBUG (( EFI_D_INFO, "UsbEnumerateNewDev: device is of %d speed\n", Child->Speed));\r
 \r
-  if (Child->Speed != EFI_USB_SPEED_HIGH) {\r
+  if (((Child->Speed == EFI_USB_SPEED_LOW) || (Child->Speed == EFI_USB_SPEED_FULL)) &&\r
+      (Parent->Speed == EFI_USB_SPEED_HIGH)) {\r
     //\r
-    // If the child isn't a high speed device, it is necessary to\r
+    // If the child is a low or full speed device, it is necessary to\r
     // set the transaction translator. Port TT is 1-based.\r
     // This is quite simple:\r
     //  1. if parent is of high speed, then parent is our translator\r
     //  2. otherwise use parent's translator.\r
     //\r
-    if (Parent->Speed == EFI_USB_SPEED_HIGH) {\r
-      Child->Translator.TranslatorHubAddress  = Parent->Address;\r
-      Child->Translator.TranslatorPortNumber  = (UINT8) (Port + 1);\r
-\r
-    } else {\r
-      Child->Translator = Parent->Translator;\r
-    }\r
-\r
-    DEBUG (( EFI_D_INFO, "UsbEnumerateNewDev: device uses translator (%d, %d)\n",\r
-                Child->Translator.TranslatorHubAddress,\r
-                Child->Translator.TranslatorPortNumber));\r
+    Child->Translator.TranslatorHubAddress  = Parent->Address;\r
+    Child->Translator.TranslatorPortNumber  = (UINT8) (Port + 1);\r
+  } else {\r
+    Child->Translator = Parent->Translator;\r
   }\r
+  DEBUG (( EFI_D_INFO, "UsbEnumerateNewDev: device uses translator (%d, %d)\n",\r
+           Child->Translator.TranslatorHubAddress,\r
+           Child->Translator.TranslatorPortNumber));\r
 \r
   //\r
   // After port is reset, hub establishes a signal path between\r
index 09f1b04c814298557d42bef4406a8234003189ee..ee774ff35fb699149634490f9ed8b2d21f7c5d12 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Helper functions for USB Keyboard Driver.\r
 \r
-Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -833,29 +833,28 @@ InitUSBKeyboard (
              );\r
   if (EFI_ERROR (Status)) {\r
     ConfigValue = 0x01;\r
-  }\r
-\r
-  //\r
-  // Uses default configuration to configure the USB Keyboard device.\r
-  //\r
-  Status = UsbSetConfiguration (\r
-             UsbKeyboardDevice->UsbIo,\r
-             ConfigValue,\r
-             &TransferResult\r
-             );\r
-  if (EFI_ERROR (Status)) {\r
     //\r
-    // If configuration could not be set here, it means\r
-    // the keyboard interface has some errors and could\r
-    // not be initialized\r
+    // Uses default configuration to configure the USB Keyboard device.\r
     //\r
-    REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
-      EFI_ERROR_CODE | EFI_ERROR_MINOR,\r
-      (EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_INTERFACE_ERROR),\r
-      UsbKeyboardDevice->DevicePath\r
-      );\r
+    Status = UsbSetConfiguration (\r
+               UsbKeyboardDevice->UsbIo,\r
+               ConfigValue,\r
+               &TransferResult\r
+               );\r
+    if (EFI_ERROR (Status)) {\r
+      //\r
+      // If configuration could not be set here, it means\r
+      // the keyboard interface has some errors and could\r
+      // not be initialized\r
+      //\r
+      REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
+        EFI_ERROR_CODE | EFI_ERROR_MINOR,\r
+        (EFI_PERIPHERAL_KEYBOARD | EFI_P_EC_INTERFACE_ERROR),\r
+        UsbKeyboardDevice->DevicePath\r
+        );\r
 \r
-    return EFI_DEVICE_ERROR;\r
+      return EFI_DEVICE_ERROR;\r
+    }\r
   }\r
 \r
   UsbGetProtocolRequest (\r
index e3ff281643f02cbd306c85874e971b6ec49d93bf..46330153e22bd2f42bc18542017e4d0d1840b7dc 100644 (file)
@@ -2,7 +2,7 @@
   Implementation of the command set of USB Mass Storage Specification\r
   for Bootability, Revision 1.0.\r
 \r
-Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -451,9 +451,6 @@ UsbBootReadCapacity (
     Media->BlockSize = BlockSize;\r
   }\r
 \r
-  DEBUG ((EFI_D_INFO, "UsbBootReadCapacity Success LBA=%ld BlockSize=%d\n",\r
-          Media->LastBlock, Media->BlockSize));\r
-\r
   return Status;\r
 }\r
 \r
@@ -734,7 +731,7 @@ UsbBootReadBlocks (
     if (EFI_ERROR (Status)) {\r
       return Status;\r
     }\r
-\r
+    DEBUG ((EFI_D_BLKIO, "UsbBootReadBlocks: LBA (0x%x), Blk (0x%x)\n", Lba, TotalBlock));\r
     Lba        += Count;\r
     Buffer     += Count * BlockSize;\r
     TotalBlock -= Count;\r
@@ -810,7 +807,7 @@ UsbBootWriteBlocks (
     if (EFI_ERROR (Status)) {\r
       return Status;\r
     }\r
-\r
+    DEBUG ((EFI_D_BLKIO, "UsbBootWriteBlocks: LBA (0x%x), Blk (0x%x)\n", Lba, TotalBlock));\r
     Lba        += Count;\r
     Buffer     += Count * BlockSize;\r
     TotalBlock -= Count;\r