mirror of https://github.com/acidanthera/audk.git
Remove several ASSERT in XhciDxe to allow error status happen then do error handling.
Signed-off-by: Elvin Li <elvin.li@intel.com> Reviewed-by: Feng Tian <feng.tian@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14574 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
c0a3c3da98
commit
260fbf5340
|
@ -900,7 +900,9 @@ XhcControlTransfer (
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
} else if (*TransferResult == EFI_USB_ERR_STALL) {
|
} else if (*TransferResult == EFI_USB_ERR_STALL) {
|
||||||
RecoveryStatus = XhcRecoverHaltedEndpoint(Xhc, Urb);
|
RecoveryStatus = XhcRecoverHaltedEndpoint(Xhc, Urb);
|
||||||
ASSERT_EFI_ERROR (RecoveryStatus);
|
if (EFI_ERROR (RecoveryStatus)) {
|
||||||
|
DEBUG ((EFI_D_ERROR, "XhcControlTransfer: XhcRecoverHaltedEndpoint failed\n"));
|
||||||
|
}
|
||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
goto FREE_URB;
|
goto FREE_URB;
|
||||||
} else {
|
} else {
|
||||||
|
@ -947,7 +949,6 @@ XhcControlTransfer (
|
||||||
} else {
|
} else {
|
||||||
Status = XhcEvaluateContext64 (Xhc, SlotId, MaxPacket0);
|
Status = XhcEvaluateContext64 (Xhc, SlotId, MaxPacket0);
|
||||||
}
|
}
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
} else if (DescriptorType == USB_DESC_TYPE_CONFIG) {
|
} else if (DescriptorType == USB_DESC_TYPE_CONFIG) {
|
||||||
ASSERT (Data != NULL);
|
ASSERT (Data != NULL);
|
||||||
if (*DataLength == ((UINT16 *)Data)[1]) {
|
if (*DataLength == ((UINT16 *)Data)[1]) {
|
||||||
|
@ -983,7 +984,6 @@ XhcControlTransfer (
|
||||||
} else {
|
} else {
|
||||||
Status = XhcConfigHubContext64 (Xhc, SlotId, HubDesc->NumPorts, TTT, MTT);
|
Status = XhcConfigHubContext64 (Xhc, SlotId, HubDesc->NumPorts, TTT, MTT);
|
||||||
}
|
}
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
}
|
}
|
||||||
} else if ((Request->Request == USB_REQ_SET_CONFIG) &&
|
} else if ((Request->Request == USB_REQ_SET_CONFIG) &&
|
||||||
(Request->RequestType == USB_REQUEST_TYPE (EfiUsbNoData, USB_REQ_TYPE_STANDARD, USB_TARGET_DEVICE))) {
|
(Request->RequestType == USB_REQUEST_TYPE (EfiUsbNoData, USB_REQ_TYPE_STANDARD, USB_TARGET_DEVICE))) {
|
||||||
|
@ -997,7 +997,6 @@ XhcControlTransfer (
|
||||||
} else {
|
} else {
|
||||||
Status = XhcSetConfigCmd64 (Xhc, SlotId, DeviceSpeed, Xhc->UsbDevContext[SlotId].ConfDesc[Index]);
|
Status = XhcSetConfigCmd64 (Xhc, SlotId, DeviceSpeed, Xhc->UsbDevContext[SlotId].ConfDesc[Index]);
|
||||||
}
|
}
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1192,7 +1191,9 @@ XhcBulkTransfer (
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
} else if (*TransferResult == EFI_USB_ERR_STALL) {
|
} else if (*TransferResult == EFI_USB_ERR_STALL) {
|
||||||
RecoveryStatus = XhcRecoverHaltedEndpoint(Xhc, Urb);
|
RecoveryStatus = XhcRecoverHaltedEndpoint(Xhc, Urb);
|
||||||
ASSERT_EFI_ERROR (RecoveryStatus);
|
if (EFI_ERROR (RecoveryStatus)) {
|
||||||
|
DEBUG ((EFI_D_ERROR, "XhcBulkTransfer: XhcRecoverHaltedEndpoint failed\n"));
|
||||||
|
}
|
||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1491,7 +1492,9 @@ XhcSyncInterruptTransfer (
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
} else if (*TransferResult == EFI_USB_ERR_STALL) {
|
} else if (*TransferResult == EFI_USB_ERR_STALL) {
|
||||||
RecoveryStatus = XhcRecoverHaltedEndpoint(Xhc, Urb);
|
RecoveryStatus = XhcRecoverHaltedEndpoint(Xhc, Urb);
|
||||||
ASSERT_EFI_ERROR (RecoveryStatus);
|
if (EFI_ERROR (RecoveryStatus)) {
|
||||||
|
DEBUG ((EFI_D_ERROR, "XhcSyncInterruptTransfer: XhcRecoverHaltedEndpoint failed\n"));
|
||||||
|
}
|
||||||
Status = EFI_DEVICE_ERROR;
|
Status = EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -176,6 +176,11 @@ XhcCreateUrb (
|
||||||
|
|
||||||
Status = XhcCreateTransferTrb (Xhc, Urb);
|
Status = XhcCreateTransferTrb (Xhc, Urb);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
DEBUG ((EFI_D_ERROR, "XhcCreateUrb: XhcCreateTransferTrb Failed, Status = %r\n", Status));
|
||||||
|
FreePool (Urb);
|
||||||
|
Urb = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return Urb;
|
return Urb;
|
||||||
}
|
}
|
||||||
|
@ -669,7 +674,10 @@ XhcRecoverHaltedEndpoint (
|
||||||
XHC_GENERIC_TIMEOUT,
|
XHC_GENERIC_TIMEOUT,
|
||||||
(TRB_TEMPLATE **) (UINTN) &EvtTrb
|
(TRB_TEMPLATE **) (UINTN) &EvtTrb
|
||||||
);
|
);
|
||||||
ASSERT (!EFI_ERROR(Status));
|
if (EFI_ERROR(Status)) {
|
||||||
|
DEBUG ((EFI_D_ERROR, "XhcRecoverHaltedEndpoint: Reset Endpoint Failed, Status = %r\n", Status));
|
||||||
|
goto Done;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// 2)Set dequeue pointer
|
// 2)Set dequeue pointer
|
||||||
|
@ -688,13 +696,17 @@ XhcRecoverHaltedEndpoint (
|
||||||
XHC_GENERIC_TIMEOUT,
|
XHC_GENERIC_TIMEOUT,
|
||||||
(TRB_TEMPLATE **) (UINTN) &EvtTrb
|
(TRB_TEMPLATE **) (UINTN) &EvtTrb
|
||||||
);
|
);
|
||||||
ASSERT (!EFI_ERROR(Status));
|
if (EFI_ERROR(Status)) {
|
||||||
|
DEBUG ((EFI_D_ERROR, "XhcRecoverHaltedEndpoint: Set Dequeue Pointer Failed, Status = %r\n", Status));
|
||||||
|
goto Done;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// 3)Ring the doorbell to transit from stop to active
|
// 3)Ring the doorbell to transit from stop to active
|
||||||
//
|
//
|
||||||
XhcRingDoorBell (Xhc, SlotId, Dci);
|
XhcRingDoorBell (Xhc, SlotId, Dci);
|
||||||
|
|
||||||
|
Done:
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1560,7 +1572,6 @@ XhcPollPortStatusChange (
|
||||||
} else {
|
} else {
|
||||||
Status = XhcInitializeDeviceSlot64 (Xhc, ParentRouteChart, Port, RouteChart, Speed);
|
Status = XhcInitializeDeviceSlot64 (Xhc, ParentRouteChart, Port, RouteChart, Speed);
|
||||||
}
|
}
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
}
|
}
|
||||||
} else if ((PortState->PortStatus & USB_PORT_STAT_CONNECTION) == 0) {
|
} else if ((PortState->PortStatus & USB_PORT_STAT_CONNECTION) == 0) {
|
||||||
//
|
//
|
||||||
|
@ -1573,7 +1584,6 @@ XhcPollPortStatusChange (
|
||||||
} else {
|
} else {
|
||||||
Status = XhcDisableSlotCmd64 (Xhc, SlotId);
|
Status = XhcDisableSlotCmd64 (Xhc, SlotId);
|
||||||
}
|
}
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -1921,7 +1931,10 @@ XhcInitializeDeviceSlot (
|
||||||
XHC_GENERIC_TIMEOUT,
|
XHC_GENERIC_TIMEOUT,
|
||||||
(TRB_TEMPLATE **) (UINTN) &EvtTrb
|
(TRB_TEMPLATE **) (UINTN) &EvtTrb
|
||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
if (EFI_ERROR (Status)) {
|
||||||
|
DEBUG ((EFI_D_ERROR, "XhcInitializeDeviceSlot: Enable Slot Failed, Status = %r\n", Status));
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
ASSERT (EvtTrb->SlotId <= Xhc->MaxSlotsEn);
|
ASSERT (EvtTrb->SlotId <= Xhc->MaxSlotsEn);
|
||||||
DEBUG ((EFI_D_INFO, "Enable Slot Successfully, The Slot ID = 0x%x\n", EvtTrb->SlotId));
|
DEBUG ((EFI_D_INFO, "Enable Slot Successfully, The Slot ID = 0x%x\n", EvtTrb->SlotId));
|
||||||
SlotId = (UINT8)EvtTrb->SlotId;
|
SlotId = (UINT8)EvtTrb->SlotId;
|
||||||
|
@ -2070,12 +2083,11 @@ XhcInitializeDeviceSlot (
|
||||||
XHC_GENERIC_TIMEOUT,
|
XHC_GENERIC_TIMEOUT,
|
||||||
(TRB_TEMPLATE **) (UINTN) &EvtTrb
|
(TRB_TEMPLATE **) (UINTN) &EvtTrb
|
||||||
);
|
);
|
||||||
ASSERT (!EFI_ERROR(Status));
|
if (!EFI_ERROR (Status)) {
|
||||||
|
DeviceAddress = (UINT8) ((DEVICE_CONTEXT *) OutputContext)->Slot.DeviceAddress;
|
||||||
DeviceAddress = (UINT8) ((DEVICE_CONTEXT *) OutputContext)->Slot.DeviceAddress;
|
DEBUG ((EFI_D_INFO, " Address %d assigned successfully\n", DeviceAddress));
|
||||||
DEBUG ((EFI_D_INFO, " Address %d assigned successfully\n", DeviceAddress));
|
Xhc->UsbDevContext[SlotId].XhciDevAddr = DeviceAddress;
|
||||||
|
}
|
||||||
Xhc->UsbDevContext[SlotId].XhciDevAddr = DeviceAddress;
|
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -2125,7 +2137,10 @@ XhcInitializeDeviceSlot64 (
|
||||||
XHC_GENERIC_TIMEOUT,
|
XHC_GENERIC_TIMEOUT,
|
||||||
(TRB_TEMPLATE **) (UINTN) &EvtTrb
|
(TRB_TEMPLATE **) (UINTN) &EvtTrb
|
||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
if (EFI_ERROR (Status)) {
|
||||||
|
DEBUG ((EFI_D_ERROR, "XhcInitializeDeviceSlot64: Enable Slot Failed, Status = %r\n", Status));
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
ASSERT (EvtTrb->SlotId <= Xhc->MaxSlotsEn);
|
ASSERT (EvtTrb->SlotId <= Xhc->MaxSlotsEn);
|
||||||
DEBUG ((EFI_D_INFO, "Enable Slot Successfully, The Slot ID = 0x%x\n", EvtTrb->SlotId));
|
DEBUG ((EFI_D_INFO, "Enable Slot Successfully, The Slot ID = 0x%x\n", EvtTrb->SlotId));
|
||||||
SlotId = (UINT8)EvtTrb->SlotId;
|
SlotId = (UINT8)EvtTrb->SlotId;
|
||||||
|
@ -2274,13 +2289,11 @@ XhcInitializeDeviceSlot64 (
|
||||||
XHC_GENERIC_TIMEOUT,
|
XHC_GENERIC_TIMEOUT,
|
||||||
(TRB_TEMPLATE **) (UINTN) &EvtTrb
|
(TRB_TEMPLATE **) (UINTN) &EvtTrb
|
||||||
);
|
);
|
||||||
ASSERT (!EFI_ERROR(Status));
|
if (!EFI_ERROR (Status)) {
|
||||||
|
DeviceAddress = (UINT8) ((DEVICE_CONTEXT_64 *) OutputContext)->Slot.DeviceAddress;
|
||||||
DeviceAddress = (UINT8) ((DEVICE_CONTEXT_64 *) OutputContext)->Slot.DeviceAddress;
|
DEBUG ((EFI_D_INFO, " Address %d assigned successfully\n", DeviceAddress));
|
||||||
DEBUG ((EFI_D_INFO, " Address %d assigned successfully\n", DeviceAddress));
|
Xhc->UsbDevContext[SlotId].XhciDevAddr = DeviceAddress;
|
||||||
|
}
|
||||||
Xhc->UsbDevContext[SlotId].XhciDevAddr = DeviceAddress;
|
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2341,7 +2354,10 @@ XhcDisableSlotCmd (
|
||||||
XHC_GENERIC_TIMEOUT,
|
XHC_GENERIC_TIMEOUT,
|
||||||
(TRB_TEMPLATE **) (UINTN) &EvtTrb
|
(TRB_TEMPLATE **) (UINTN) &EvtTrb
|
||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR(Status);
|
if (EFI_ERROR (Status)) {
|
||||||
|
DEBUG ((EFI_D_ERROR, "XhcDisableSlotCmd: Disable Slot Command Failed, Status = %r\n", Status));
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
//
|
//
|
||||||
// Free the slot's device context entry
|
// Free the slot's device context entry
|
||||||
//
|
//
|
||||||
|
@ -2441,7 +2457,10 @@ XhcDisableSlotCmd64 (
|
||||||
XHC_GENERIC_TIMEOUT,
|
XHC_GENERIC_TIMEOUT,
|
||||||
(TRB_TEMPLATE **) (UINTN) &EvtTrb
|
(TRB_TEMPLATE **) (UINTN) &EvtTrb
|
||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR(Status);
|
if (EFI_ERROR (Status)) {
|
||||||
|
DEBUG ((EFI_D_ERROR, "XhcDisableSlotCmd: Disable Slot Command Failed, Status = %r\n", Status));
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
//
|
//
|
||||||
// Free the slot's device context entry
|
// Free the slot's device context entry
|
||||||
//
|
//
|
||||||
|
@ -2507,7 +2526,6 @@ XhcSetConfigCmd (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
USB_INTERFACE_DESCRIPTOR *IfDesc;
|
USB_INTERFACE_DESCRIPTOR *IfDesc;
|
||||||
USB_ENDPOINT_DESCRIPTOR *EpDesc;
|
USB_ENDPOINT_DESCRIPTOR *EpDesc;
|
||||||
UINT8 Index;
|
UINT8 Index;
|
||||||
|
@ -2678,8 +2696,9 @@ XhcSetConfigCmd (
|
||||||
XHC_GENERIC_TIMEOUT,
|
XHC_GENERIC_TIMEOUT,
|
||||||
(TRB_TEMPLATE **) (UINTN) &EvtTrb
|
(TRB_TEMPLATE **) (UINTN) &EvtTrb
|
||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR(Status);
|
if (EFI_ERROR (Status)) {
|
||||||
|
DEBUG ((EFI_D_ERROR, "XhcSetConfigCmd: Config Endpoint Failed, Status = %r\n", Status));
|
||||||
|
}
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2704,7 +2723,6 @@ XhcSetConfigCmd64 (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
USB_INTERFACE_DESCRIPTOR *IfDesc;
|
USB_INTERFACE_DESCRIPTOR *IfDesc;
|
||||||
USB_ENDPOINT_DESCRIPTOR *EpDesc;
|
USB_ENDPOINT_DESCRIPTOR *EpDesc;
|
||||||
UINT8 Index;
|
UINT8 Index;
|
||||||
|
@ -2877,7 +2895,9 @@ XhcSetConfigCmd64 (
|
||||||
XHC_GENERIC_TIMEOUT,
|
XHC_GENERIC_TIMEOUT,
|
||||||
(TRB_TEMPLATE **) (UINTN) &EvtTrb
|
(TRB_TEMPLATE **) (UINTN) &EvtTrb
|
||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR(Status);
|
if (EFI_ERROR (Status)) {
|
||||||
|
DEBUG ((EFI_D_ERROR, "XhcSetConfigCmd64: Config Endpoint Failed, Status = %r\n", Status));
|
||||||
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -2932,8 +2952,9 @@ XhcEvaluateContext (
|
||||||
XHC_GENERIC_TIMEOUT,
|
XHC_GENERIC_TIMEOUT,
|
||||||
(TRB_TEMPLATE **) (UINTN) &EvtTrb
|
(TRB_TEMPLATE **) (UINTN) &EvtTrb
|
||||||
);
|
);
|
||||||
ASSERT (!EFI_ERROR(Status));
|
if (EFI_ERROR (Status)) {
|
||||||
|
DEBUG ((EFI_D_ERROR, "XhcEvaluateContext: Evaluate Context Failed, Status = %r\n", Status));
|
||||||
|
}
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2986,8 +3007,9 @@ XhcEvaluateContext64 (
|
||||||
XHC_GENERIC_TIMEOUT,
|
XHC_GENERIC_TIMEOUT,
|
||||||
(TRB_TEMPLATE **) (UINTN) &EvtTrb
|
(TRB_TEMPLATE **) (UINTN) &EvtTrb
|
||||||
);
|
);
|
||||||
ASSERT (!EFI_ERROR(Status));
|
if (EFI_ERROR (Status)) {
|
||||||
|
DEBUG ((EFI_D_ERROR, "XhcEvaluateContext64: Evaluate Context Failed, Status = %r\n", Status));
|
||||||
|
}
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3014,7 +3036,6 @@ XhcConfigHubContext (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
EVT_TRB_COMMAND_COMPLETION *EvtTrb;
|
EVT_TRB_COMMAND_COMPLETION *EvtTrb;
|
||||||
INPUT_CONTEXT *InputContext;
|
INPUT_CONTEXT *InputContext;
|
||||||
DEVICE_CONTEXT *OutputContext;
|
DEVICE_CONTEXT *OutputContext;
|
||||||
|
@ -3055,8 +3076,9 @@ XhcConfigHubContext (
|
||||||
XHC_GENERIC_TIMEOUT,
|
XHC_GENERIC_TIMEOUT,
|
||||||
(TRB_TEMPLATE **) (UINTN) &EvtTrb
|
(TRB_TEMPLATE **) (UINTN) &EvtTrb
|
||||||
);
|
);
|
||||||
ASSERT (!EFI_ERROR(Status));
|
if (EFI_ERROR (Status)) {
|
||||||
|
DEBUG ((EFI_D_ERROR, "XhcConfigHubContext: Config Endpoint Failed, Status = %r\n", Status));
|
||||||
|
}
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3082,7 +3104,6 @@ XhcConfigHubContext64 (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
EVT_TRB_COMMAND_COMPLETION *EvtTrb;
|
EVT_TRB_COMMAND_COMPLETION *EvtTrb;
|
||||||
INPUT_CONTEXT_64 *InputContext;
|
INPUT_CONTEXT_64 *InputContext;
|
||||||
DEVICE_CONTEXT_64 *OutputContext;
|
DEVICE_CONTEXT_64 *OutputContext;
|
||||||
|
@ -3123,8 +3144,9 @@ XhcConfigHubContext64 (
|
||||||
XHC_GENERIC_TIMEOUT,
|
XHC_GENERIC_TIMEOUT,
|
||||||
(TRB_TEMPLATE **) (UINTN) &EvtTrb
|
(TRB_TEMPLATE **) (UINTN) &EvtTrb
|
||||||
);
|
);
|
||||||
ASSERT (!EFI_ERROR(Status));
|
if (EFI_ERROR (Status)) {
|
||||||
|
DEBUG ((EFI_D_ERROR, "XhcConfigHubContext64: Config Endpoint Failed, Status = %r\n", Status));
|
||||||
|
}
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue