/** @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
\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
// 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
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
//\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
\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
\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
\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
// 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
\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
\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
/** @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
);\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
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
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
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
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