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