Support GCC IA32/X64 build. Cc: Ard Biesheuvel <ard.biesheu...@arm.com> Cc: Leif Lindholm <l...@nuviainc.com> Signed-off-by: Vin Xue <vin...@outlook.com> --- Silicon/Synopsys/DesignWare/DesignWare.dec | 9 +++- Silicon/Synopsys/DesignWare/DesignWare.dsc | 17 ++++--- .../Drivers/UsbDeviceDxe/UsbDeviceDxe.inf | 1 + .../Drivers/UsbDeviceDxe/UsbFuncIo.c | 48 +------------------ .../DesignWare/Drivers/UsbDeviceDxe/XdciDWC.c | 4 +- .../Drivers/UsbDeviceDxe/XdciTable.c | 4 +- .../Drivers/UsbDeviceDxe/XdciUtility.c | 3 -- 7 files changed, 26 insertions(+), 60 deletions(-)
diff --git a/Silicon/Synopsys/DesignWare/DesignWare.dec b/Silicon/Synopsys/DesignWare/DesignWare.dec index f7ec792754..6063f64664 100755 --- a/Silicon/Synopsys/DesignWare/DesignWare.dec +++ b/Silicon/Synopsys/DesignWare/DesignWare.dec @@ -7,6 +7,9 @@ PACKAGE_GUID = 3b5936d8-c72d-412d-b4d9-3bf0dea73598 PACKAGE_VERSION = 0.1 +[Includes] + Include + ################################################################################ # # Include Section - list of Include Paths that are provided by this package. @@ -18,9 +21,13 @@ ################################################################################ [Guids.common] - gDesignWareTokenSpaceGuid = { 0x89cb1241, 0xd283, 0x4543, { 0x88, 0x9c, 0x6b, 0x62, 0x36, 0x1a, 0x95, 0x7a } } + gDesignWareTokenSpaceGuid = { 0x89cb1241, 0xd283, 0x4543, { 0x88, 0x9c, 0x6b, 0x62, 0x36, 0x1a, 0x95, 0x7a } } gDwEmacNetNonDiscoverableDeviceGuid = { 0x401950CD, 0xF9CD, 0x4A65, { 0xAD, 0x8E, 0x84, 0x9F, 0x3B, 0xAF, 0x23, 0x04 } } +[Protocols] + gEfiUsbFnIoProtocolGuid = { 0x32d2963a, 0xfe5d, 0x4f30, { 0xb6, 0x33, 0x6e, 0x5d, 0xc5, 0x58, 0x03, 0xcc } } + gEfiUsbDeviceModeProtocolGuid = { 0xC9923F7E, 0x1746, 0x4802, { 0x86, 0x2e, 0x01, 0x1c, 0x2c, 0x2d, 0x9d, 0x86 } } + [PcdsFixedAtBuild.common] # # Permit the use of obsolete drivers in this package diff --git a/Silicon/Synopsys/DesignWare/DesignWare.dsc b/Silicon/Synopsys/DesignWare/DesignWare.dsc index 098bba3f7d..37f13a1562 100755 --- a/Silicon/Synopsys/DesignWare/DesignWare.dsc +++ b/Silicon/Synopsys/DesignWare/DesignWare.dsc @@ -11,13 +11,11 @@ PLATFORM_GUID = 09b27b59-7195-4220-b81c-c1871c74d006 PLATFORM_VERSION = 0.1 OUTPUT_DIRECTORY = Build/Synopsys - SUPPORTED_ARCHITECTURES = AARCH64|ARM + SUPPORTED_ARCHITECTURES = IA32|X64|ARM|AARCH64 BUILD_TARGETS = DEBUG|RELEASE|NOOPT SKUID_IDENTIFIER = DEFAULT [LibraryClasses] - ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf - ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf BaseLib|MdePkg/Library/BaseLib/BaseLib.inf BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf @@ -28,16 +26,23 @@ IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf NetLib|NetworkPkg/Library/DxeNetLib/DxeNetLib.inf - NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf - TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf UefiLib|MdePkg/Library/UefiLib/UefiLib.inf UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf -[Components] +[LibraryClasses.ARM, LibraryClasses.AARCH64] + ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf + ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf + NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf + TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf + +[Components.ARM, Components.AARCH64] Silicon/Synopsys/DesignWare/Drivers/DwEmacSnpDxe/DwEmacSnpDxe.inf Silicon/Synopsys/DesignWare/Drivers/DwEmmcDxe/DwEmmcDxe.inf + +[Components.IA32, Components.X64] + Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbDeviceDxe.inf diff --git a/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbDeviceDxe.inf b/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbDeviceDxe.inf index a5fbe2336a..fc064b85c1 100644 --- a/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbDeviceDxe.inf +++ b/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbDeviceDxe.inf @@ -33,6 +33,7 @@ [Packages] MdePkg/MdePkg.dec + Silicon/Synopsys/DesignWare/DesignWare.dec [LibraryClasses] BaseMemoryLib diff --git a/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbFuncIo.c b/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbFuncIo.c index d4eea39e6d..94cdc028dc 100644 --- a/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbFuncIo.c +++ b/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/UsbFuncIo.c @@ -24,7 +24,7 @@ static CHAR16 mUsbFnDxeSerialNumber[] = L"INT123456"; // replaced with device-specific unique values. // static GUID mSmBiosUniqueGuid = { - 0x5e24fe9c, 0xc8d0, 0x45bd, 0xa7, 0x9f, 0x54, 0xea, 0x5f, 0xbd, 0x3d, 0x97 + 0x5e24fe9c, 0xc8d0, 0x45bd, { 0xa7, 0x9f, 0x54, 0xea, 0x5f, 0xbd, 0x3d, 0x97} }; EFI_USBFN_IO_PROTOCOL mUsbFunIoProtocol = { @@ -136,14 +136,11 @@ AllocateTransferBuffer ( ) { EFI_STATUS Status; - USB_XDCI_DEV_CONTEXT *UsbFuncIoDevPtr; VOID *AllocateBufferPtr; USB_MEM_NODE *NodePtr; DEBUG ((USB_FUIO_DEBUG_INFO, "AllocateTransferBuffer - Entry\n")); - UsbFuncIoDevPtr = USBFUIO_CONTEXT_FROM_PROTOCOL (This); - if (Size == 0) { Status = EFI_INVALID_PARAMETER; goto ErrorExit; @@ -200,9 +197,7 @@ FreeTransferBuffer ( ) { EFI_STATUS Status; - USB_XDCI_DEV_CONTEXT *UsbFuncIoDevPtr; - UsbFuncIoDevPtr = USBFUIO_CONTEXT_FROM_PROTOCOL (This); DEBUG ((USB_FUIO_DEBUG_LOAD, "FreeTransferBuffer - Entry\n")); Status = RemoveNode (This, Buffer); @@ -327,13 +322,7 @@ GetEndpointMaxPacketSize ( ) { EFI_STATUS Status; - USB_XDCI_DEV_CONTEXT *UsbFuncIoDevPtr; - USB_DEV_CORE *DevCorePtr; - XDCI_CORE_HANDLE *XdciCorePtr; - UsbFuncIoDevPtr = USBFUIO_CONTEXT_FROM_PROTOCOL (This); - DevCorePtr = UsbFuncIoDevPtr->DrvCore; - XdciCorePtr = DevCorePtr->ControllerHandle; Status = EFI_SUCCESS; DEBUG ((USB_FUIO_DEBUG_LOAD, "GetEndpointMaxPacketSize - Entry\n")); @@ -413,7 +402,6 @@ GetMaxTransferSize ( @retval EFI_BUFFER_TOO_SMALL A parameter is invalid. **/ -STATIC EFI_STATUS EFIAPI GetDeviceSerialNumber ( @@ -611,15 +599,11 @@ AbortTransfer ( ) { USB_XDCI_DEV_CONTEXT *UsbFuncIoDevPtr; - XDCI_CORE_HANDLE *XdciCorePtr; - USB_DEV_CORE *UsbDeviceCorePtr; USB_EP_INFO EpInfo; EFI_STATUS Status; DEBUG ((USB_FUIO_DEBUG_LOAD, "FU:AbortTransfer - Entry\n")); UsbFuncIoDevPtr = USBFUIO_CONTEXT_FROM_PROTOCOL (This); - UsbDeviceCorePtr = UsbFuncIoDevPtr->DrvCore; - XdciCorePtr = UsbDeviceCorePtr->ControllerHandle; Status = EFI_SUCCESS; if (UsbFuncIoDevPtr->DevResetFlag == TRUE) { @@ -691,7 +675,6 @@ UsbSetAddress ( { EFI_STATUS Status; USB_XDCI_DEV_CONTEXT *UsbFuncIoDevPtr; - XDCI_CORE_HANDLE *XdciCorePtr; USB_DEV_CORE *UsbDeviceCorePtr; DEBUG ((USB_FUIO_DEBUG_LOAD, "UsbSetAddress - 0x%04x Entry\n", Address)); @@ -699,7 +682,6 @@ UsbSetAddress ( UsbFuncIoDevPtr = USBFUIO_CONTEXT_FROM_PROTOCOL (This); UsbDeviceCorePtr = UsbFuncIoDevPtr->DrvCore; - XdciCorePtr = UsbDeviceCorePtr->ControllerHandle; Status = EFI_SUCCESS; Status = UsbDeviceSetAddress (UsbDeviceCorePtr, (UINT32)Address); @@ -732,7 +714,6 @@ UsbSetconfigure ( { EFI_STATUS Status; USB_XDCI_DEV_CONTEXT *UsbFuncIoDevPtr; - XDCI_CORE_HANDLE *XdciCorePtr; USB_DEV_CORE *UsbDeviceCorePtr; UINT32 InterfaceNum; UINT32 EndPointNum; @@ -745,7 +726,6 @@ UsbSetconfigure ( UsbFuncIoDevPtr = USBFUIO_CONTEXT_FROM_PROTOCOL (This); UsbDeviceCorePtr = UsbFuncIoDevPtr->DrvCore; - XdciCorePtr = UsbDeviceCorePtr->ControllerHandle; Status = EFI_SUCCESS; InterfaceNum = UsbFuncIoDevPtr->IndexPtrConfig.ConfigDescriptor->NumInterfaces; @@ -1155,7 +1135,6 @@ NoneEp0XferDone( USB_XDCI_DEV_CONTEXT *UsbFuncIoDevPtr; DWC_XDCI_ENDPOINT *EpHandle; DWC_XDCI_TRB *Trb; - UINT32 TrbCtrl; UINT32 TrbSts; UsbFuncIoDevPtr = USBFUIO_CONTEXT_FROM_PROTOCOL (This); @@ -1182,7 +1161,6 @@ NoneEp0XferDone( EpHandle->CurrentXferRscIdx = 0; *Message = EfiUsbMsgNone; - TrbCtrl = (Trb->TrbCtrl & DWC_XDCI_TRB_CTRL_TYPE_MASK) >> DWC_XDCI_TRB_CTRL_TYPE_BIT_POS; TrbSts = (Trb->LenXferParams & DWC_XDCI_TRB_STATUS_MASK) >> DWC_XDCI_TRB_STATUS_BIT_POS; Payload->utr.BytesTransferred = UsbFuncIoDevPtr->EndPointXferRec[EndPointNum].XferLength; @@ -1228,14 +1206,6 @@ Ep0XferNotReady( IN UINT32 EpStatus ) { - USB_DEV_CORE *UsbDeviceCorePtr; - XDCI_CORE_HANDLE *XdciCorePtr; - USB_XDCI_DEV_CONTEXT *UsbFuncIoDevPtr; - - UsbFuncIoDevPtr = USBFUIO_CONTEXT_FROM_PROTOCOL(This); - UsbDeviceCorePtr = UsbFuncIoDevPtr->DrvCore; - XdciCorePtr = UsbDeviceCorePtr->ControllerHandle; - *Message = EfiUsbMsgNone; return EFI_SUCCESS; @@ -1253,21 +1223,16 @@ EpEventCheck( OUT BOOLEAN *EventFlag ) { - USB_DEV_CORE *UsbDeviceCorePtr; - XDCI_CORE_HANDLE *XdciCorePtr; USB_XDCI_DEV_CONTEXT *UsbFuncIoDevPtr; UINT32 EventReg; UINT32 EpEvent; UINT32 EndPointNumber; UINT32 EventStatus; - USB_EP_STATE Ep_State; UINTN TmpBufferSize; DEBUG ((USB_FUIO_DEBUG_EVENT_I, "FUEV::EndPoint Event....\n")); UsbFuncIoDevPtr = USBFUIO_CONTEXT_FROM_PROTOCOL(This); - UsbDeviceCorePtr = UsbFuncIoDevPtr->DrvCore; - XdciCorePtr = UsbDeviceCorePtr->ControllerHandle; EventReg = EventIndex->Event; *ProcessSize = DWC_XDCI_DEV_EVENT_DEFAULT_SIZE_IN_BYTES; *EventFlag = TRUE; @@ -1324,10 +1289,7 @@ EpEventCheck( // // Is it data stage or status stage // - // Data Statge - // - Ep_State = USB_EP_STATE_DATA; - // + // Control transfer // DEBUG ((USB_FUIO_DEBUG_EVENT_D, "USBFU_EP Control transfer not ready\n")); @@ -1476,7 +1438,6 @@ EventHandler( UINT32 EventCount; UINT32 PeventCount; USB_XDCI_DEV_CONTEXT *UsbFuncIoDevPtr; - UINT32 MaxIntNum; UINT32 IntIndex; USB_DEV_CORE *UsbDeviceCorePtr; XDCI_CORE_HANDLE *XdciCorePtr; @@ -1492,9 +1453,6 @@ EventHandler( } OriginalTpl = gBS->RaiseTPL (TPL_HIGH_LEVEL); *Message = EfiUsbMsgNone; - MaxIntNum = (UsbRegRead ((UINT32)UsbFuncIoDevPtr->XdciMmioBarAddr, DWC_XDCI_GHWPARAMS1_REG) & - DWC_XDCI_GHWPARAMS1_NUM_INT_MASK) >> - DWC_XDCI_GHWPARAMS1_NUM_INT_BIT_POS; UsbDeviceCorePtr = UsbFuncIoDevPtr->DrvCore; XdciCorePtr = UsbDeviceCorePtr->ControllerHandle; @@ -1698,7 +1656,6 @@ Transfer ( { USB_XDCI_DEV_CONTEXT *UsbFuncIoDevPtr; USB_DEV_CORE *UsbDeviceCorePtr; - XDCI_CORE_HANDLE *XdciCorePtr; EFI_STATUS Status; USB_XFER_REQUEST XferReq; UINT32 EndPoint; @@ -1710,7 +1667,6 @@ Transfer ( UsbFuncIoDevPtr = USBFUIO_CONTEXT_FROM_PROTOCOL (This); UsbDeviceCorePtr = UsbFuncIoDevPtr->DrvCore; - XdciCorePtr = UsbDeviceCorePtr->ControllerHandle; EndPoint = UsbGetPhysicalEpNum (EndpointIndex, Direction ? UsbEpDirIn : UsbEpDirOut); Status = SetFnIoReqInfo ( diff --git a/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/XdciDWC.c b/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/XdciDWC.c index 03791b039d..85b67d35c2 100644 --- a/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/XdciDWC.c +++ b/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/XdciDWC.c @@ -387,7 +387,7 @@ DwcXdciCoreFlushEpTxFifo ( { UINT32 BaseAddr; UINT32 MaxDelayIter = DWC_XDCI_MAX_DELAY_ITERATIONS; - UINT32 fifoNum; + // UINT32 fifoNum; if (CoreHandle == NULL) { DEBUG ((DEBUG_INFO, "ERROR: DwcXdciCoreFlushEpTxFifo: INVALID handle\n")); @@ -400,7 +400,7 @@ DwcXdciCoreFlushEpTxFifo ( // Translate to FIFOnum // NOTE: Assuming this is a Tx EP // - fifoNum = (EpNum >> 1); + // fifoNum = (EpNum >> 1); // // TODO: Currently we are only using TxFIFO 0. Later map these diff --git a/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/XdciTable.c b/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/XdciTable.c index 0d72d783ba..580291df2e 100644 --- a/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/XdciTable.c +++ b/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/XdciTable.c @@ -12,7 +12,7 @@ #include "XdciDWC.h" #include "UsbDeviceMode.h" -static const struct UsbDeviceCoreDriver CoreDriverTbl[USB_CORE_ID_MAX] = { +static const struct UsbDeviceCoreDriver CoreDriverTbl[USB_CORE_ID_MAX] = { { DwcXdciCoreInit, DwcXdciCoreDeinit, DwcXdciCoreRegisterCallback, @@ -36,7 +36,7 @@ static const struct UsbDeviceCoreDriver CoreDriverTbl[USB_CORE_ID_MAX] = { DwcXdciEp0SendStatusPkt, DwcXdciEpTxData, DwcXdciEpRxData, - DwcXdciEpCancelTransfer + DwcXdciEpCancelTransfer } }; const struct UsbDeviceCoreDriver *UsbDeviceGetCoreDriver(USB_CONTROLLER_ID id) diff --git a/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/XdciUtility.c b/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/XdciUtility.c index 20cf49eea7..98c2e25a63 100644 --- a/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/XdciUtility.c +++ b/Silicon/Synopsys/DesignWare/Drivers/UsbDeviceDxe/XdciUtility.c @@ -99,10 +99,7 @@ PrintStringDescriptor ( IN USB_STRING_DESCRIPTOR *StrDesc ) { - UINT16 StrLen = 0; - if (StrDesc->Length > 2) { - StrLen = ((StrDesc->Length - 2) >> 1); DEBUG ((DEBUG_INFO, "--- String Descriptor ---\n")); DEBUG ((DEBUG_INFO, "Length : 0x%x\n", StrDesc->Length)); DEBUG ((DEBUG_INFO, "DescriptorType : 0x%x\n", StrDesc->DescriptorType)); -- 2.27.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#63780): https://edk2.groups.io/g/devel/message/63780 Mute This Topic: https://groups.io/mt/76025230/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-