]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Universal/Debugger/Debugport/Dxe/DebugPort.c
Partially make EdkModulePkg pass intel IPF compiler with /W4 /WX switched on.
[mirror_edk2.git] / EdkModulePkg / Universal / Debugger / Debugport / Dxe / DebugPort.c
index 2152f75cf43e2aca63525b50811b5142b3e13d81..88d19d4ad0106ec5f720ccbfd9de1503dd5f1a57 100644 (file)
@@ -29,19 +29,91 @@ Revision History
 #include "DebugPort.h"\r
 \r
 //\r
-// Misc. functions local to this module\r
+// Misc. functions local to this module..\r
 //\r
 STATIC\r
 VOID\r
 GetDebugPortVariable (\r
-  DEBUGPORT_DEVICE  *DebugPortDevice\r
-  );\r
+  DEBUGPORT_DEVICE            *DebugPortDevice\r
+  )\r
+/*++\r
 \r
-EFI_STATUS\r
-EFIAPI\r
-ImageUnloadHandler (\r
-  EFI_HANDLE ImageHandle\r
-  );\r
+Routine Description:\r
+  Local worker function to obtain device path information from DebugPort variable.\r
+  Records requested settings in DebugPort device structure.\r
+  \r
+Arguments:\r
+  DEBUGPORT_DEVICE  *DebugPortDevice,\r
+\r
+Returns:\r
+\r
+  Nothing\r
+\r
+--*/\r
+{\r
+  UINTN                     DataSize;\r
+  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
+  EFI_STATUS                Status;\r
+\r
+  DataSize = 0;\r
+\r
+  Status = gRT->GetVariable (\r
+                  (CHAR16 *) EFI_DEBUGPORT_VARIABLE_NAME,\r
+                  &gEfiDebugPortVariableGuid,\r
+                  NULL,\r
+                  &DataSize,\r
+                  DebugPortDevice->DebugPortVariable\r
+                  );\r
+\r
+  if (Status == EFI_BUFFER_TOO_SMALL) {\r
+    if (gDebugPortDevice->DebugPortVariable != NULL) {\r
+      gBS->FreePool (gDebugPortDevice->DebugPortVariable);\r
+    }\r
+\r
+    DebugPortDevice->DebugPortVariable = AllocatePool (DataSize);\r
+    if (DebugPortDevice->DebugPortVariable != NULL) {\r
+      gRT->GetVariable (\r
+            (CHAR16 *) EFI_DEBUGPORT_VARIABLE_NAME,\r
+            &gEfiDebugPortVariableGuid,\r
+            NULL,\r
+            &DataSize,\r
+            DebugPortDevice->DebugPortVariable\r
+            );\r
+      DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) DebugPortDevice->DebugPortVariable;\r
+      while (!EfiIsDevicePathEnd (DevicePath) && !EfiIsUartDevicePath (DevicePath)) {\r
+        DevicePath = EfiNextDevicePathNode (DevicePath);\r
+      }\r
+\r
+      if (EfiIsDevicePathEnd (DevicePath)) {\r
+        gBS->FreePool (gDebugPortDevice->DebugPortVariable);\r
+        DebugPortDevice->DebugPortVariable = NULL;\r
+      } else {\r
+        gBS->CopyMem (\r
+              &DebugPortDevice->BaudRate,\r
+              &((UART_DEVICE_PATH *) DevicePath)->BaudRate,\r
+              sizeof (((UART_DEVICE_PATH *) DevicePath)->BaudRate)\r
+              );\r
+        DebugPortDevice->ReceiveFifoDepth = DEBUGPORT_UART_DEFAULT_FIFO_DEPTH;\r
+        DebugPortDevice->Timeout          = DEBUGPORT_UART_DEFAULT_TIMEOUT;\r
+        gBS->CopyMem (\r
+              &DebugPortDevice->Parity,\r
+              &((UART_DEVICE_PATH *) DevicePath)->Parity,\r
+              sizeof (((UART_DEVICE_PATH *) DevicePath)->Parity)\r
+              );\r
+        gBS->CopyMem (\r
+              &DebugPortDevice->DataBits,\r
+              &((UART_DEVICE_PATH *) DevicePath)->DataBits,\r
+              sizeof (((UART_DEVICE_PATH *) DevicePath)->DataBits)\r
+              );\r
+        gBS->CopyMem (\r
+              &DebugPortDevice->StopBits,\r
+              &((UART_DEVICE_PATH *) DevicePath)->StopBits,\r
+              sizeof (((UART_DEVICE_PATH *) DevicePath)->StopBits)\r
+              );\r
+      }\r
+    }\r
+  }\r
+}\r
 \r
 //\r
 // Globals\r
@@ -57,8 +129,6 @@ EFI_DRIVER_BINDING_PROTOCOL gDebugPortDriverBinding = {
 };\r
 \r
 DEBUGPORT_DEVICE  *gDebugPortDevice;\r
-static UINT32     mHid16550;\r
-static UINT32     mHidStdPcComPort;\r
 \r
 //\r
 // implementation code\r
@@ -90,9 +160,6 @@ Returns:
 \r
 --*/\r
 {\r
-  mHid16550         = EFI_ACPI_16550UART_HID;\r
-  mHidStdPcComPort  = EFI_ACPI_PC_COMPORT_HID;\r
-\r
   //\r
   // Allocate and Initialize dev structure\r
   //\r
@@ -113,9 +180,9 @@ Returns:
   gDebugPortDevice->BaudRate = DEBUGPORT_UART_DEFAULT_BAUDRATE;\r
   gDebugPortDevice->ReceiveFifoDepth = DEBUGPORT_UART_DEFAULT_FIFO_DEPTH;\r
   gDebugPortDevice->Timeout = DEBUGPORT_UART_DEFAULT_TIMEOUT;\r
-  gDebugPortDevice->Parity = DEBUGPORT_UART_DEFAULT_PARITY;\r
+  gDebugPortDevice->Parity = (EFI_PARITY_TYPE) DEBUGPORT_UART_DEFAULT_PARITY;\r
   gDebugPortDevice->DataBits = DEBUGPORT_UART_DEFAULT_DATA_BITS;\r
-  gDebugPortDevice->StopBits = DEBUGPORT_UART_DEFAULT_STOP_BITS;\r
+  gDebugPortDevice->StopBits = (EFI_STOP_BITS_TYPE) DEBUGPORT_UART_DEFAULT_STOP_BITS;\r
 \r
   return EFI_SUCCESS;\r
 }\r
@@ -521,11 +588,9 @@ Returns:
 \r
 --*/\r
 {\r
-  DEBUGPORT_DEVICE  *DebugPortDevice;\r
   UINTN             BufferSize;\r
   UINTN             BitBucket;\r
 \r
-  DebugPortDevice = DEBUGPORT_DEVICE_FROM_THIS (This);\r
   while (This->Poll (This) == EFI_SUCCESS) {\r
     BufferSize = 1;\r
     This->Read (This, 0, &BufferSize, &BitBucket);\r
@@ -694,92 +759,6 @@ Returns:
 \r
   return Status;\r
 }\r
-//\r
-// Misc. functions local to this module..\r
-//\r
-STATIC\r
-VOID\r
-GetDebugPortVariable (\r
-  DEBUGPORT_DEVICE            *DebugPortDevice\r
-  )\r
-/*++\r
-\r
-Routine Description:\r
-  Local worker function to obtain device path information from DebugPort variable.\r
-  Records requested settings in DebugPort device structure.\r
-  \r
-Arguments:\r
-  DEBUGPORT_DEVICE  *DebugPortDevice,\r
-\r
-Returns:\r
-\r
-  Nothing\r
-\r
---*/\r
-{\r
-  UINTN                     DataSize;\r
-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
-  EFI_STATUS                Status;\r
-\r
-  DataSize = 0;\r
-\r
-  Status = gRT->GetVariable (\r
-                  (CHAR16 *) EFI_DEBUGPORT_VARIABLE_NAME,\r
-                  &gEfiDebugPortVariableGuid,\r
-                  NULL,\r
-                  &DataSize,\r
-                  DebugPortDevice->DebugPortVariable\r
-                  );\r
-\r
-  if (Status == EFI_BUFFER_TOO_SMALL) {\r
-    if (gDebugPortDevice->DebugPortVariable != NULL) {\r
-      gBS->FreePool (gDebugPortDevice->DebugPortVariable);\r
-    }\r
-\r
-    DebugPortDevice->DebugPortVariable = AllocatePool (DataSize);\r
-    if (DebugPortDevice->DebugPortVariable != NULL) {\r
-      gRT->GetVariable (\r
-            (CHAR16 *) EFI_DEBUGPORT_VARIABLE_NAME,\r
-            &gEfiDebugPortVariableGuid,\r
-            NULL,\r
-            &DataSize,\r
-            DebugPortDevice->DebugPortVariable\r
-            );\r
-      DevicePath = (EFI_DEVICE_PATH_PROTOCOL *) DebugPortDevice->DebugPortVariable;\r
-      while (!EfiIsDevicePathEnd (DevicePath) && !EfiIsUartDevicePath (DevicePath)) {\r
-        DevicePath = EfiNextDevicePathNode (DevicePath);\r
-      }\r
-\r
-      if (EfiIsDevicePathEnd (DevicePath)) {\r
-        gBS->FreePool (gDebugPortDevice->DebugPortVariable);\r
-        DebugPortDevice->DebugPortVariable = NULL;\r
-      } else {\r
-        gBS->CopyMem (\r
-              &DebugPortDevice->BaudRate,\r
-              &((UART_DEVICE_PATH *) DevicePath)->BaudRate,\r
-              sizeof (((UART_DEVICE_PATH *) DevicePath)->BaudRate)\r
-              );\r
-        DebugPortDevice->ReceiveFifoDepth = DEBUGPORT_UART_DEFAULT_FIFO_DEPTH;\r
-        DebugPortDevice->Timeout          = DEBUGPORT_UART_DEFAULT_TIMEOUT;\r
-        gBS->CopyMem (\r
-              &DebugPortDevice->Parity,\r
-              &((UART_DEVICE_PATH *) DevicePath)->Parity,\r
-              sizeof (((UART_DEVICE_PATH *) DevicePath)->Parity)\r
-              );\r
-        gBS->CopyMem (\r
-              &DebugPortDevice->DataBits,\r
-              &((UART_DEVICE_PATH *) DevicePath)->DataBits,\r
-              sizeof (((UART_DEVICE_PATH *) DevicePath)->DataBits)\r
-              );\r
-        gBS->CopyMem (\r
-              &DebugPortDevice->StopBits,\r
-              &((UART_DEVICE_PATH *) DevicePath)->StopBits,\r
-              sizeof (((UART_DEVICE_PATH *) DevicePath)->StopBits)\r
-              );\r
-      }\r
-    }\r
-  }\r
-}\r
 \r
 EFI_STATUS\r
 EFIAPI\r