]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SourceLevelDebugPkg/Library/DebugCommunicationLibUsb/DebugCommunicationLibUsb.c
SourceLevelDebugPkg: Refine casting expression result to bigger size
[mirror_edk2.git] / SourceLevelDebugPkg / Library / DebugCommunicationLibUsb / DebugCommunicationLibUsb.c
index d7829c211077e16d1a4e37d8f09bbe23810a92a2..d996f80f59e31ed087c982bc2cf674b7e9136924 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Debug Port Library implementation based on usb debug port.\r
 \r
-  Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -559,7 +559,7 @@ NeedReinitializeHardware(
   //\r
   // If the owner and in_use bit is not set, it means system is doing cold/warm boot or EHCI host controller is reset by system software.\r
   //\r
-  UsbDebugPortRegister = (USB_DEBUG_PORT_REGISTER *)(UINTN)(Handle->UsbDebugPortMemoryBase + Handle->DebugPortOffset);\r
+  UsbDebugPortRegister = (USB_DEBUG_PORT_REGISTER *)((UINTN)Handle->UsbDebugPortMemoryBase + Handle->DebugPortOffset);\r
   if ((MmioRead32((UINTN)&UsbDebugPortRegister->ControlStatus) & (USB_DEBUG_PORT_OWNER | USB_DEBUG_PORT_ENABLE | USB_DEBUG_PORT_IN_USE))\r
        != (USB_DEBUG_PORT_OWNER | USB_DEBUG_PORT_ENABLE | USB_DEBUG_PORT_IN_USE)) {\r
     Status = TRUE;\r
@@ -604,10 +604,10 @@ InitializeUsbDebugHardware (
   UINT8                     DebugPortNumber;\r
   UINT8                     Length;\r
 \r
-  UsbDebugPortRegister = (USB_DEBUG_PORT_REGISTER *)(UINTN)(Handle->UsbDebugPortMemoryBase + Handle->DebugPortOffset);\r
-  UsbHCSParam = (UINT32 *)(UINTN)(Handle->EhciMemoryBase + 0x04);\r
-  UsbCmd      = (UINT32 *)(UINTN)(Handle->EhciMemoryBase + 0x20);\r
-  UsbStatus   = (UINT32 *)(UINTN)(Handle->EhciMemoryBase + 0x24);\r
+  UsbDebugPortRegister = (USB_DEBUG_PORT_REGISTER *)((UINTN)Handle->UsbDebugPortMemoryBase + Handle->DebugPortOffset);\r
+  UsbHCSParam = (UINT32 *)((UINTN)Handle->EhciMemoryBase + 0x04);\r
+  UsbCmd      = (UINT32 *)((UINTN)Handle->EhciMemoryBase + 0x20);\r
+  UsbStatus   = (UINT32 *)((UINTN)Handle->EhciMemoryBase + 0x24);\r
 \r
   //\r
   // Check if the debug port is enabled and owned by myself.\r
@@ -652,7 +652,7 @@ InitializeUsbDebugHardware (
   //\r
   // Should find a device is connected at debug port\r
   //\r
-  PortStatus = (UINT32 *)(UINTN)(Handle->EhciMemoryBase + 0x64 + (DebugPortNumber - 1) * 4);\r
+  PortStatus = (UINT32 *)((UINTN)Handle->EhciMemoryBase + 0x64 + (DebugPortNumber - 1) * 4);\r
   if (!(MmioRead32((UINTN)PortStatus) & BIT0)) {\r
     Handle->Initialized = USBDBG_NO_DEV;\r
     return RETURN_NOT_FOUND;\r
@@ -870,7 +870,7 @@ DebugPortWriteBuffer (
     }\r
   }\r
 \r
-  UsbDebugPortRegister = (USB_DEBUG_PORT_REGISTER *)(UINTN)(UsbDebugPortHandle->UsbDebugPortMemoryBase + UsbDebugPortHandle->DebugPortOffset);\r
+  UsbDebugPortRegister = (USB_DEBUG_PORT_REGISTER *)((UINTN)UsbDebugPortHandle->UsbDebugPortMemoryBase + UsbDebugPortHandle->DebugPortOffset);\r
 \r
   while ((Total < NumberOfBytes)) {\r
     if (NumberOfBytes - Total > USB_DEBUG_PORT_MAX_PACKET_SIZE) {\r
@@ -950,7 +950,7 @@ DebugPortPollBuffer (
     return TRUE;\r
   }\r
 \r
-  UsbDebugPortRegister = (USB_DEBUG_PORT_REGISTER *)(UINTN)(UsbDebugPortHandle->UsbDebugPortMemoryBase + UsbDebugPortHandle->DebugPortOffset);\r
+  UsbDebugPortRegister = (USB_DEBUG_PORT_REGISTER *)((UINTN)UsbDebugPortHandle->UsbDebugPortMemoryBase + UsbDebugPortHandle->DebugPortOffset);\r
 \r
   UsbDebugPortRegister->TokenPid = INPUT_PID;\r
   if (UsbDebugPortHandle->BulkInToggle == 0) {\r