diff options
author | Elvin Li <elvin.li@intel.com> | 2013-08-21 03:46:01 +0000 |
---|---|---|
committer | li-elvin <li-elvin@6f19259b-4bc3-4df7-8a09-765794883524> | 2013-08-21 03:46:01 +0000 |
commit | 260fbf5340dc330ddd84c1358ed2b6bff74f61c0 (patch) | |
tree | cebdb78c2ef059cc2cb2faed1ea45cb312ca23f8 | |
parent | c0a3c3da98cef6286a509eb685a4ff5375f8347b (diff) | |
download | edk2-platforms-260fbf5340dc330ddd84c1358ed2b6bff74f61c0.tar.xz |
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
-rw-r--r-- | MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 15 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 94 |
2 files changed, 67 insertions, 42 deletions
diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c index 239fa96a66..3e578975ad 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c @@ -900,7 +900,9 @@ XhcControlTransfer ( Status = EFI_SUCCESS; } else if (*TransferResult == EFI_USB_ERR_STALL) { RecoveryStatus = XhcRecoverHaltedEndpoint(Xhc, Urb); - ASSERT_EFI_ERROR (RecoveryStatus); + if (EFI_ERROR (RecoveryStatus)) { + DEBUG ((EFI_D_ERROR, "XhcControlTransfer: XhcRecoverHaltedEndpoint failed\n")); + } Status = EFI_DEVICE_ERROR; goto FREE_URB; } else { @@ -947,7 +949,6 @@ XhcControlTransfer ( } else { Status = XhcEvaluateContext64 (Xhc, SlotId, MaxPacket0); } - ASSERT_EFI_ERROR (Status); } else if (DescriptorType == USB_DESC_TYPE_CONFIG) { ASSERT (Data != NULL); if (*DataLength == ((UINT16 *)Data)[1]) { @@ -983,7 +984,6 @@ XhcControlTransfer ( } else { Status = XhcConfigHubContext64 (Xhc, SlotId, HubDesc->NumPorts, TTT, MTT); } - ASSERT_EFI_ERROR (Status); } } else if ((Request->Request == USB_REQ_SET_CONFIG) && (Request->RequestType == USB_REQUEST_TYPE (EfiUsbNoData, USB_REQ_TYPE_STANDARD, USB_TARGET_DEVICE))) { @@ -997,7 +997,6 @@ XhcControlTransfer ( } else { Status = XhcSetConfigCmd64 (Xhc, SlotId, DeviceSpeed, Xhc->UsbDevContext[SlotId].ConfDesc[Index]); } - ASSERT_EFI_ERROR (Status); break; } } @@ -1192,7 +1191,9 @@ XhcBulkTransfer ( Status = EFI_SUCCESS; } else if (*TransferResult == EFI_USB_ERR_STALL) { RecoveryStatus = XhcRecoverHaltedEndpoint(Xhc, Urb); - ASSERT_EFI_ERROR (RecoveryStatus); + if (EFI_ERROR (RecoveryStatus)) { + DEBUG ((EFI_D_ERROR, "XhcBulkTransfer: XhcRecoverHaltedEndpoint failed\n")); + } Status = EFI_DEVICE_ERROR; } @@ -1491,7 +1492,9 @@ XhcSyncInterruptTransfer ( Status = EFI_SUCCESS; } else if (*TransferResult == EFI_USB_ERR_STALL) { RecoveryStatus = XhcRecoverHaltedEndpoint(Xhc, Urb); - ASSERT_EFI_ERROR (RecoveryStatus); + if (EFI_ERROR (RecoveryStatus)) { + DEBUG ((EFI_D_ERROR, "XhcSyncInterruptTransfer: XhcRecoverHaltedEndpoint failed\n")); + } Status = EFI_DEVICE_ERROR; } diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c index 404d8247f8..dea5b1af18 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c @@ -176,6 +176,11 @@ XhcCreateUrb ( Status = XhcCreateTransferTrb (Xhc, Urb);
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;
}
@@ -669,7 +674,10 @@ XhcRecoverHaltedEndpoint ( XHC_GENERIC_TIMEOUT,
(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
@@ -688,13 +696,17 @@ XhcRecoverHaltedEndpoint ( XHC_GENERIC_TIMEOUT,
(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
//
XhcRingDoorBell (Xhc, SlotId, Dci);
+Done:
return Status;
}
@@ -1560,7 +1572,6 @@ XhcPollPortStatusChange ( } else {
Status = XhcInitializeDeviceSlot64 (Xhc, ParentRouteChart, Port, RouteChart, Speed);
}
- ASSERT_EFI_ERROR (Status);
}
} else if ((PortState->PortStatus & USB_PORT_STAT_CONNECTION) == 0) {
//
@@ -1573,7 +1584,6 @@ XhcPollPortStatusChange ( } else {
Status = XhcDisableSlotCmd64 (Xhc, SlotId);
}
- ASSERT_EFI_ERROR (Status);
}
}
return Status;
@@ -1921,7 +1931,10 @@ XhcInitializeDeviceSlot ( XHC_GENERIC_TIMEOUT,
(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);
DEBUG ((EFI_D_INFO, "Enable Slot Successfully, The Slot ID = 0x%x\n", EvtTrb->SlotId));
SlotId = (UINT8)EvtTrb->SlotId;
@@ -2070,12 +2083,11 @@ XhcInitializeDeviceSlot ( XHC_GENERIC_TIMEOUT,
(TRB_TEMPLATE **) (UINTN) &EvtTrb
);
- ASSERT (!EFI_ERROR(Status));
-
- DeviceAddress = (UINT8) ((DEVICE_CONTEXT *) OutputContext)->Slot.DeviceAddress;
- DEBUG ((EFI_D_INFO, " Address %d assigned successfully\n", DeviceAddress));
-
- Xhc->UsbDevContext[SlotId].XhciDevAddr = DeviceAddress;
+ if (!EFI_ERROR (Status)) {
+ DeviceAddress = (UINT8) ((DEVICE_CONTEXT *) OutputContext)->Slot.DeviceAddress;
+ DEBUG ((EFI_D_INFO, " Address %d assigned successfully\n", DeviceAddress));
+ Xhc->UsbDevContext[SlotId].XhciDevAddr = DeviceAddress;
+ }
return Status;
}
@@ -2125,7 +2137,10 @@ XhcInitializeDeviceSlot64 ( XHC_GENERIC_TIMEOUT,
(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);
DEBUG ((EFI_D_INFO, "Enable Slot Successfully, The Slot ID = 0x%x\n", EvtTrb->SlotId));
SlotId = (UINT8)EvtTrb->SlotId;
@@ -2274,13 +2289,11 @@ XhcInitializeDeviceSlot64 ( XHC_GENERIC_TIMEOUT,
(TRB_TEMPLATE **) (UINTN) &EvtTrb
);
- ASSERT (!EFI_ERROR(Status));
-
- DeviceAddress = (UINT8) ((DEVICE_CONTEXT_64 *) OutputContext)->Slot.DeviceAddress;
- DEBUG ((EFI_D_INFO, " Address %d assigned successfully\n", DeviceAddress));
-
- Xhc->UsbDevContext[SlotId].XhciDevAddr = DeviceAddress;
-
+ if (!EFI_ERROR (Status)) {
+ DeviceAddress = (UINT8) ((DEVICE_CONTEXT_64 *) OutputContext)->Slot.DeviceAddress;
+ DEBUG ((EFI_D_INFO, " Address %d assigned successfully\n", DeviceAddress));
+ Xhc->UsbDevContext[SlotId].XhciDevAddr = DeviceAddress;
+ }
return Status;
}
@@ -2341,7 +2354,10 @@ XhcDisableSlotCmd ( XHC_GENERIC_TIMEOUT,
(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
//
@@ -2441,7 +2457,10 @@ XhcDisableSlotCmd64 ( XHC_GENERIC_TIMEOUT,
(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
//
@@ -2507,7 +2526,6 @@ XhcSetConfigCmd ( )
{
EFI_STATUS Status;
-
USB_INTERFACE_DESCRIPTOR *IfDesc;
USB_ENDPOINT_DESCRIPTOR *EpDesc;
UINT8 Index;
@@ -2678,8 +2696,9 @@ XhcSetConfigCmd ( XHC_GENERIC_TIMEOUT,
(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;
}
@@ -2704,7 +2723,6 @@ XhcSetConfigCmd64 ( )
{
EFI_STATUS Status;
-
USB_INTERFACE_DESCRIPTOR *IfDesc;
USB_ENDPOINT_DESCRIPTOR *EpDesc;
UINT8 Index;
@@ -2877,7 +2895,9 @@ XhcSetConfigCmd64 ( XHC_GENERIC_TIMEOUT,
(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;
}
@@ -2932,8 +2952,9 @@ XhcEvaluateContext ( XHC_GENERIC_TIMEOUT,
(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;
}
@@ -2986,8 +3007,9 @@ XhcEvaluateContext64 ( XHC_GENERIC_TIMEOUT,
(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;
}
@@ -3014,7 +3036,6 @@ XhcConfigHubContext ( )
{
EFI_STATUS Status;
-
EVT_TRB_COMMAND_COMPLETION *EvtTrb;
INPUT_CONTEXT *InputContext;
DEVICE_CONTEXT *OutputContext;
@@ -3055,8 +3076,9 @@ XhcConfigHubContext ( XHC_GENERIC_TIMEOUT,
(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;
}
@@ -3082,7 +3104,6 @@ XhcConfigHubContext64 ( )
{
EFI_STATUS Status;
-
EVT_TRB_COMMAND_COMPLETION *EvtTrb;
INPUT_CONTEXT_64 *InputContext;
DEVICE_CONTEXT_64 *OutputContext;
@@ -3123,8 +3144,9 @@ XhcConfigHubContext64 ( XHC_GENERIC_TIMEOUT,
(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;
}
|