From acedecdd5ec4f45c9b7d456d01017c43e9fd2fb2 Mon Sep 17 00:00:00 2001 From: Elvin Li Date: Fri, 22 Aug 2014 01:13:48 +0000 Subject: [PATCH] Do not access transfer ring when endpoint is isochronous type and control type. And when one Endpoint is a unknown type, do not ASSERT(0) and process next endpoint. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Elvin Li Signed-off-by: Feng Tian git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15876 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 32 +++++++++++++++++++----- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c index e29e727e3c..657020f0da 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c @@ -2606,7 +2606,12 @@ XhcInitializeEndpointContext ( InputContext->EP[Dci-1].CErr = 0; InputContext->EP[Dci-1].EPType = ED_ISOCH_OUT; } - break; + // + // Do not support isochronous transfer now. + // + DEBUG ((EFI_D_INFO, "XhcInitializeEndpointContext: Unsupport ISO EP found, Transfer ring is not allocated.\n")); + EpDesc = (USB_ENDPOINT_DESCRIPTOR *)((UINTN)EpDesc + EpDesc->Length); + continue; case USB_ENDPOINT_INTERRUPT: if (Direction == EfiUsbDataIn) { InputContext->EP[Dci-1].CErr = 3; @@ -2648,9 +2653,14 @@ XhcInitializeEndpointContext ( break; case USB_ENDPOINT_CONTROL: + // + // Do not support control transfer now. + // + DEBUG ((EFI_D_INFO, "XhcInitializeEndpointContext: Unsupport Control EP found, Transfer ring is not allocated.\n")); default: - ASSERT (0); - break; + DEBUG ((EFI_D_INFO, "XhcInitializeEndpointContext: Unknown EP found, Transfer ring is not allocated.\n")); + EpDesc = (USB_ENDPOINT_DESCRIPTOR *)((UINTN)EpDesc + EpDesc->Length); + continue; } PhyAddr = UsbHcGetPciAddrForHostAddr ( @@ -2759,7 +2769,12 @@ XhcInitializeEndpointContext64 ( InputContext->EP[Dci-1].CErr = 0; InputContext->EP[Dci-1].EPType = ED_ISOCH_OUT; } - break; + // + // Do not support isochronous transfer now. + // + DEBUG ((EFI_D_INFO, "XhcInitializeEndpointContext64: Unsupport ISO EP found, Transfer ring is not allocated.\n")); + EpDesc = (USB_ENDPOINT_DESCRIPTOR *)((UINTN)EpDesc + EpDesc->Length); + continue; case USB_ENDPOINT_INTERRUPT: if (Direction == EfiUsbDataIn) { InputContext->EP[Dci-1].CErr = 3; @@ -2801,9 +2816,14 @@ XhcInitializeEndpointContext64 ( break; case USB_ENDPOINT_CONTROL: + // + // Do not support control transfer now. + // + DEBUG ((EFI_D_INFO, "XhcInitializeEndpointContext64: Unsupport Control EP found, Transfer ring is not allocated.\n")); default: - ASSERT (0); - break; + DEBUG ((EFI_D_INFO, "XhcInitializeEndpointContext64: Unknown EP found, Transfer ring is not allocated.\n")); + EpDesc = (USB_ENDPOINT_DESCRIPTOR *)((UINTN)EpDesc + EpDesc->Length); + continue; } PhyAddr = UsbHcGetPciAddrForHostAddr ( -- 2.39.2