]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Common.c
SourceLevelDebugPkg: Clean up source files
[mirror_edk2.git] / SourceLevelDebugPkg / Library / DebugCommunicationLibUsb3 / DebugCommunicationLibUsb3Common.c
index 86ecc2f9dbc7862daadd4702235d0757c30ae09a..924dbfd9d59d7ca219f8f332c64490ddce279e22 100644 (file)
@@ -46,7 +46,7 @@ UINT16   mSerialNumberStrDesc[] = {
 **/\r
 VOID\r
 XhcSetR32Bit(\r
-  IN OUT  UINTN  Register, \r
+  IN OUT  UINTN  Register,\r
   IN      UINT32 BitMask\r
   )\r
 {\r
@@ -65,7 +65,7 @@ XhcSetR32Bit(
 **/\r
 VOID\r
 XhcClearR32Bit(\r
-  IN OUT  UINTN  Register, \r
+  IN OUT  UINTN  Register,\r
   IN      UINT32 BitMask\r
   )\r
 {\r
@@ -92,10 +92,10 @@ XhcWriteDebugReg (
   )\r
 {\r
   EFI_PHYSICAL_ADDRESS  DebugCapabilityBase;\r
-  \r
+\r
   DebugCapabilityBase = Handle->DebugCapabilityBase;\r
   MmioWrite32 ((UINTN)(DebugCapabilityBase + Offset), Data);\r
-  \r
+\r
   return;\r
 }\r
 \r
@@ -116,7 +116,7 @@ XhcReadDebugReg (
 {\r
   UINT32                  Data;\r
   EFI_PHYSICAL_ADDRESS    DebugCapabilityBase;\r
-  \r
+\r
   DebugCapabilityBase = Handle->DebugCapabilityBase;\r
   Data = MmioRead32 ((UINTN)(DebugCapabilityBase + Offset));\r
 \r
@@ -182,7 +182,7 @@ ProgramXhciBaseAddress (
   UINT32                      Low;\r
   UINT32                      High;\r
   EFI_PHYSICAL_ADDRESS        XhciMmioBase;\r
-  \r
+\r
   Low = PciRead32 (PcdGet32(PcdUsbXhciPciAddress) + PCI_BASE_ADDRESSREG_OFFSET);\r
   High = PciRead32 (PcdGet32(PcdUsbXhciPciAddress) + PCI_BASE_ADDRESSREG_OFFSET + 4);\r
   XhciMmioBase = (EFI_PHYSICAL_ADDRESS) (LShiftU64 ((UINT64) High, 32) | Low);\r
@@ -263,7 +263,7 @@ CalculateUsbDebugPortMmioBase (
 \r
   VendorId = PciRead16 (PcdGet32(PcdUsbXhciPciAddress) + PCI_VENDOR_ID_OFFSET);\r
   DeviceId = PciRead16 (PcdGet32(PcdUsbXhciPciAddress) + PCI_DEVICE_ID_OFFSET);\r
-  \r
+\r
   if ((VendorId == 0xFFFF) || (DeviceId == 0xFFFF)) {\r
     goto Done;\r
   }\r
@@ -271,7 +271,7 @@ CalculateUsbDebugPortMmioBase (
   ProgInterface = PciRead8 (PcdGet32(PcdUsbXhciPciAddress) + PCI_CLASSCODE_OFFSET);\r
   SubClassCode  = PciRead8 (PcdGet32(PcdUsbXhciPciAddress) + PCI_CLASSCODE_OFFSET + 1);\r
   BaseCode      = PciRead8 (PcdGet32(PcdUsbXhciPciAddress) + PCI_CLASSCODE_OFFSET + 2);\r
-  \r
+\r
   if ((ProgInterface != PCI_IF_XHCI) || (SubClassCode != PCI_CLASS_SERIAL_USB) || (BaseCode != PCI_CLASS_SERIAL)) {\r
     goto Done;\r
   }\r
@@ -282,7 +282,7 @@ CalculateUsbDebugPortMmioBase (
   // Get capability pointer from HCCPARAMS at offset 0x10\r
   //\r
   CapabilityPointer = Handle->XhciMmioBase + (MmioRead32 ((UINTN)(Handle->XhciMmioBase + XHC_HCCPARAMS_OFFSET)) >> 16) * 4;\r
\r
+\r
   //\r
   // Search XHCI debug capability\r
   //\r
@@ -377,7 +377,7 @@ CreateEventRing (
   EVENT_RING_SEG_TABLE_ENTRY  *ERSTBase;\r
 \r
   ASSERT (EventRing != NULL);\r
-  \r
+\r
   //\r
   // Allocate Event Ring\r
   //\r
@@ -390,7 +390,7 @@ CreateEventRing (
   EventRing->TrbNumber        = EVENT_RING_TRB_NUMBER;\r
   EventRing->EventRingDequeue = (EFI_PHYSICAL_ADDRESS)(UINTN) EventRing->EventRingSeg0;\r
   EventRing->EventRingEnqueue = (EFI_PHYSICAL_ADDRESS)(UINTN) EventRing->EventRingSeg0;\r
-  \r
+\r
   //\r
   // Software maintains an Event Ring Consumer Cycle State (CCS) bit, initializing it to '1'\r
   // and toggling it every time the Event Ring Dequeue Pointer wraps back to the beginning of the Event Ring.\r
@@ -473,7 +473,7 @@ CreateTransferRing (
 {\r
   VOID                  *Buf;\r
   LINK_TRB              *EndTrb;\r
\r
+\r
   Buf = AllocateAlignBuffer (sizeof (TRB_TEMPLATE) * TrbNum);\r
   ASSERT (Buf != NULL);\r
   ASSERT (((UINTN) Buf & 0xF) == 0);\r
@@ -523,7 +523,7 @@ CreateDebugCapabilityContext (
   UINT8                       *ManufacturerStrDesc;\r
   UINT8                       *ProductStrDesc;\r
   UINT8                       *SerialNumberStrDesc;\r
-  \r
+\r
   //\r
   // Allocate debug device context\r
   //\r
@@ -531,10 +531,10 @@ CreateDebugCapabilityContext (
   ASSERT (Buf != NULL);\r
   ASSERT (((UINTN) Buf & 0xF) == 0);\r
   ZeroMem (Buf, sizeof (XHC_DC_CONTEXT));\r
-  \r
+\r
   DebugCapabilityContext = (XHC_DC_CONTEXT *)(UINTN) Buf;\r
   Handle->DebugCapabilityContext = (EFI_PHYSICAL_ADDRESS)(UINTN) DebugCapabilityContext;\r
-  \r
+\r
   //\r
   // Initialize DbcInfoContext.\r
   //\r
@@ -550,7 +550,7 @@ CreateDebugCapabilityContext (
   DebugCapabilityContext->EpOutContext.EPType           = ED_BULK_OUT;\r
   DebugCapabilityContext->EpOutContext.MaxPacketSize    = XHCI_DEBUG_DEVICE_MAX_PACKET_SIZE;\r
   DebugCapabilityContext->EpOutContext.AverageTRBLength = 0x1000;\r
-  \r
+\r
   //\r
   // Initialize EpInContext.\r
   //\r
@@ -558,7 +558,7 @@ CreateDebugCapabilityContext (
   DebugCapabilityContext->EpInContext.EPType           = ED_BULK_IN;\r
   DebugCapabilityContext->EpInContext.MaxPacketSize    = XHCI_DEBUG_DEVICE_MAX_PACKET_SIZE;\r
   DebugCapabilityContext->EpInContext.AverageTRBLength = 0x1000;\r
-  \r
+\r
   //\r
   // Update string descriptor address\r
   //\r
@@ -567,19 +567,19 @@ CreateDebugCapabilityContext (
   ZeroMem (String0Desc, STRING0_DESC_LEN + MANU_DESC_LEN + PRODUCT_DESC_LEN + SERIAL_DESC_LEN);\r
   CopyMem (String0Desc, mString0Desc, STRING0_DESC_LEN);\r
   DebugCapabilityContext->DbcInfoContext.String0DescAddress = (UINT64)(UINTN)String0Desc;\r
-  \r
+\r
   ManufacturerStrDesc = String0Desc + STRING0_DESC_LEN;\r
   CopyMem (ManufacturerStrDesc, mManufacturerStrDesc, MANU_DESC_LEN);\r
   DebugCapabilityContext->DbcInfoContext.ManufacturerStrDescAddress = (UINT64)(UINTN)ManufacturerStrDesc;\r
-  \r
+\r
   ProductStrDesc = ManufacturerStrDesc + MANU_DESC_LEN;\r
   CopyMem (ProductStrDesc, mProductStrDesc, PRODUCT_DESC_LEN);\r
   DebugCapabilityContext->DbcInfoContext.ProductStrDescAddress = (UINT64)(UINTN)ProductStrDesc;\r
-  \r
+\r
   SerialNumberStrDesc = ProductStrDesc + PRODUCT_DESC_LEN;\r
   CopyMem (SerialNumberStrDesc, mSerialNumberStrDesc, SERIAL_DESC_LEN);\r
   DebugCapabilityContext->DbcInfoContext.SerialNumberStrDescAddress = (UINT64)(UINTN)SerialNumberStrDesc;\r
-  \r
+\r
   //\r
   // Allocate and initialize the Transfer Ring for the Input Endpoint Context.\r
   //\r
@@ -687,7 +687,7 @@ InitializeUsbDebugHardware (
       return EFI_DEVICE_ERROR;\r
     }\r
     //\r
-    // If XHCI supports debug capability, hardware resource has been allocated, \r
+    // If XHCI supports debug capability, hardware resource has been allocated,\r
     // but it has not been enabled, try to enable again.\r
     //\r
     goto Enable;\r
@@ -708,7 +708,7 @@ InitializeUsbDebugHardware (
 \r
   //\r
   // Reset port to get debug device discovered\r
-  //  \r
+  //\r
   for (Index = 0; Index < TotalUsb3Port; Index++) {\r
     XhcSetR32Bit ((UINTN)XhciOpRegister + XHC_PORTSC_OFFSET + Index * 0x10, BIT4);\r
     MicroSecondDelay (10 * 1000);\r
@@ -727,20 +727,20 @@ InitializeUsbDebugHardware (
   Handle->UrbIn.Data  = (EFI_PHYSICAL_ADDRESS)(UINTN) Buffer;\r
   Handle->Data        = (EFI_PHYSICAL_ADDRESS)(UINTN) Buffer + XHCI_DEBUG_DEVICE_MAX_PACKET_SIZE;\r
   Handle->UrbOut.Data = Handle->UrbIn.Data + XHCI_DEBUG_DEVICE_MAX_PACKET_SIZE * 2;\r
-   \r
+\r
   //\r
   // Initialize event ring\r
   //\r
   ZeroMem (&Handle->EventRing, sizeof (EVENT_RING));\r
   Status = CreateEventRing (Handle, &Handle->EventRing);\r
   ASSERT_EFI_ERROR (Status);\r
-  \r
+\r
   //\r
   // Init IN and OUT endpoint context\r
   //\r
   Status = CreateDebugCapabilityContext (Handle);\r
   ASSERT_EFI_ERROR (Status);\r
-  \r
+\r
   //\r
   // Init DCDDI1 and DCDDI2\r
   //\r
@@ -748,7 +748,7 @@ InitializeUsbDebugHardware (
    Handle,\r
    XHC_DC_DCDDI1,\r
    (UINT32)((XHCI_DEBUG_DEVICE_VENDOR_ID << 16) | XHCI_DEBUG_DEVICE_PROTOCOL)\r
-   ); \r
+   );\r
 \r
   XhcWriteDebugReg (\r
    Handle,\r
@@ -759,7 +759,7 @@ InitializeUsbDebugHardware (
 Enable:\r
   if ((Handle->Initialized == USB3DBG_NOT_ENABLED) && (!Handle->ChangePortPower)) {\r
     //\r
-    // If the first time detection is failed, turn port power off and on in order to \r
+    // If the first time detection is failed, turn port power off and on in order to\r
     // reset port status this time, then try to check if debug device is ready again.\r
     //\r
     for (Index = 0; Index < TotalUsb3Port; Index++) {\r
@@ -775,9 +775,9 @@ Enable:
   // Set DCE bit and LSE bit to "1" in DCCTRL in first initialization\r
   //\r
   XhcSetDebugRegBit (Handle, XHC_DC_DCCTRL, BIT1|BIT31);\r
-  \r
+\r
   XhcDetectDebugCapabilityReady (Handle);\r
-  \r
+\r
   Status = RETURN_SUCCESS;\r
   if (!Handle->Ready) {\r
     Handle->Initialized = USB3DBG_NOT_ENABLED;\r
@@ -823,7 +823,7 @@ DiscoverInitializeUsbDebugPort (
 \r
   @param[in] Instance           Debug port instance.\r
 \r
-**/  \r
+**/\r
 VOID\r
 SetUsb3DebugPortInstance (\r
   IN USB3_DEBUG_PORT_HANDLE     *Instance\r
@@ -839,7 +839,7 @@ SetUsb3DebugPortInstance (
 /**\r
   Return USB3 debug instance address.\r
 \r
-**/  \r
+**/\r
 USB3_DEBUG_PORT_HANDLE *\r
 GetUsb3DebugPortInstance (\r
   VOID\r
@@ -1010,7 +1010,7 @@ DebugPortWriteBuffer (
     XhcDataTransfer (UsbDebugPortHandle, EfiUsbDataOut, Buffer + Total, &Sent, DATA_TRANSFER_WRITE_TIMEOUT);\r
     Total += Sent;\r
   }\r
-  \r
+\r
   return Total;\r
 }\r
 \r
@@ -1123,7 +1123,7 @@ DebugPortInitialize (
   USB3_DEBUG_PORT_HANDLE    *UsbDebugPortHandle;\r
 \r
   //\r
-  // Validate the PCD PcdDebugPortHandleBufferSize value \r
+  // Validate the PCD PcdDebugPortHandleBufferSize value\r
   //\r
   ASSERT (PcdGet16 (PcdDebugPortHandleBufferSize) == sizeof (USB3_DEBUG_PORT_HANDLE));\r
 \r