]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Nt32Pkg/WinNtGopDxe/WinNtGopDriver.c
UefiCpuPkg: Remove double \r
[mirror_edk2.git] / Nt32Pkg / WinNtGopDxe / WinNtGopDriver.c
index 5f41e29e19a518cf1e1b18ed640209e29931bb2f..a2138d0ee9d45fd0a90aaa05b06057f696dfd385 100644 (file)
@@ -1,13 +1,7 @@
 /** @file\r
 \r
-Copyright (c) 2006 - 2007, Intel Corporation\r
-All rights reserved. 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
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 Module Name:\r
 \r
@@ -21,33 +15,45 @@ Abstract:
 \r
 \r
 **/\r
+#include "WinNtGop.h"\r
+\r
+EFI_STATUS\r
+FreeNotifyList (\r
+  IN OUT LIST_ENTRY           *ListHead\r
+  )\r
+/*++\r
 \r
-//\r
-// The package level header files this module uses\r
-//\r
-#include <Uefi.h>\r
-#include <WinNtDxe.h>\r
-//\r
-// The protocols, PPI and GUID defintions for this module\r
-//\r
-#include <Guid/EventGroup.h>\r
-#include <Protocol/WinNtIo.h>\r
-#include <Protocol/ComponentName.h>\r
-#include <Protocol/SimpleTextIn.h>\r
-#include <Protocol/DriverBinding.h>\r
-#include <Protocol/GraphicsOutput.h>\r
-//\r
-// The Library classes this module consumes\r
-//\r
-#include <Library/DebugLib.h>\r
-#include <Library/BaseLib.h>\r
-#include <Library/UefiDriverEntryPoint.h>\r
-#include <Library/UefiLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/UefiBootServicesTableLib.h>\r
-#include <Library/MemoryAllocationLib.h>\r
+Routine Description:\r
 \r
-#include "WinNtGop.h"\r
+Arguments:\r
+\r
+  ListHead   - The list head\r
+\r
+Returns:\r
+\r
+  EFI_SUCCESS           - Free the notify list successfully\r
+  EFI_INVALID_PARAMETER - ListHead is invalid.\r
+\r
+--*/\r
+{\r
+  WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY *NotifyNode;\r
+\r
+  if (ListHead == NULL) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+  while (!IsListEmpty (ListHead)) {\r
+    NotifyNode = CR (\r
+                   ListHead->ForwardLink, \r
+                   WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY, \r
+                   NotifyEntry, \r
+                   WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE\r
+                   );\r
+    RemoveEntryList (ListHead->ForwardLink);\r
+    gBS->FreePool (NotifyNode);\r
+  }\r
+  \r
+  return EFI_SUCCESS;\r
+}\r
 \r
 EFI_DRIVER_BINDING_PROTOCOL gWinNtGopDriverBinding = {\r
   WinNtGopDriverBindingSupported,\r
@@ -80,14 +86,13 @@ InitializeWinNtGop(
   //\r
   // Install driver model protocol(s).\r
   //\r
-  Status = EfiLibInstallAllDriverProtocols (\r
+  Status = EfiLibInstallDriverBindingComponentName2 (\r
              ImageHandle,\r
              SystemTable,\r
              &gWinNtGopDriverBinding,\r
              ImageHandle,\r
              &gWinNtGopComponentName,\r
-             NULL,\r
-             NULL\r
+             &gWinNtGopComponentName2\r
              );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
@@ -121,7 +126,7 @@ WinNtGopDriverBindingSupported (
   Status = gBS->OpenProtocol (\r
                   Handle,\r
                   &gEfiWinNtIoProtocolGuid,\r
-                  &WinNtIo,\r
+                  (VOID **) &WinNtIo,\r
                   This->DriverBindingHandle,\r
                   Handle,\r
                   EFI_OPEN_PROTOCOL_BY_DRIVER\r
@@ -174,7 +179,7 @@ WinNtGopDriverBindingStart (
   Status = gBS->OpenProtocol (\r
                   Handle,\r
                   &gEfiWinNtIoProtocolGuid,\r
-                  &WinNtIo,\r
+                  (VOID **) &WinNtIo,\r
                   This->DriverBindingHandle,\r
                   Handle,\r
                   EFI_OPEN_PROTOCOL_BY_DRIVER\r
@@ -189,6 +194,7 @@ WinNtGopDriverBindingStart (
   Private = NULL;\r
   Private = AllocatePool (sizeof (GOP_PRIVATE_DATA));\r
   if (Private == NULL) {\r
+    Status = EFI_OUT_OF_RESOURCES;\r
     goto Done;\r
   }\r
   //\r
@@ -200,12 +206,21 @@ WinNtGopDriverBindingStart (
 \r
   Private->ControllerNameTable  = NULL;\r
 \r
-  AddUnicodeString (\r
+  AddUnicodeString2 (\r
     "eng",\r
     gWinNtGopComponentName.SupportedLanguages,\r
     &Private->ControllerNameTable,\r
-    WinNtIo->EnvString\r
+    WinNtIo->EnvString,\r
+    TRUE\r
     );\r
+  AddUnicodeString2 (\r
+    "en",\r
+    gWinNtGopComponentName2.SupportedLanguages,\r
+    &Private->ControllerNameTable,\r
+    WinNtIo->EnvString,\r
+    FALSE\r
+    );\r
+\r
 \r
   Private->WindowName = WinNtIo->EnvString;\r
 \r
@@ -222,6 +237,8 @@ WinNtGopDriverBindingStart (
                   &Private->GraphicsOutput,\r
                   &gEfiSimpleTextInProtocolGuid,\r
                   &Private->SimpleTextIn,\r
+                  &gEfiSimpleTextInputExProtocolGuid,\r
+                  &Private->SimpleTextInEx,\r
                   NULL\r
                   );\r
 \r
@@ -243,6 +260,13 @@ Done:
         FreeUnicodeStringTable (Private->ControllerNameTable);\r
       }\r
 \r
+      if (Private->SimpleTextIn.WaitForKey != NULL) {\r
+        gBS->CloseEvent (Private->SimpleTextIn.WaitForKey);\r
+      }\r
+      if (Private->SimpleTextInEx.WaitForKeyEx != NULL) {\r
+        gBS->CloseEvent (Private->SimpleTextInEx.WaitForKeyEx);\r
+      }\r
+      FreeNotifyList (&Private->NotifyList);\r
       FreePool (Private);\r
     }\r
   }\r
@@ -279,7 +303,7 @@ WinNtGopDriverBindingStop (
   Status = gBS->OpenProtocol (\r
                   Handle,\r
                   &gEfiGraphicsOutputProtocolGuid,\r
-                  &GraphicsOutput,\r
+                  (VOID **) &GraphicsOutput,\r
                   This->DriverBindingHandle,\r
                   Handle,\r
                   EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
@@ -305,6 +329,8 @@ WinNtGopDriverBindingStop (
                   &Private->GraphicsOutput,\r
                   &gEfiSimpleTextInProtocolGuid,\r
                   &Private->SimpleTextIn,\r
+                  &gEfiSimpleTextInputExProtocolGuid,\r
+                  &Private->SimpleTextInEx,\r
                   NULL\r
                   );\r
   if (!EFI_ERROR (Status)) {\r
@@ -327,8 +353,13 @@ WinNtGopDriverBindingStop (
     // Free our instance data\r
     //\r
     FreeUnicodeStringTable (Private->ControllerNameTable);\r
+    Status = gBS->CloseEvent (Private->SimpleTextIn.WaitForKey);\r
+    ASSERT_EFI_ERROR (Status);\r
+    Status = gBS->CloseEvent (Private->SimpleTextInEx.WaitForKeyEx);\r
+    ASSERT_EFI_ERROR (Status);\r
+    FreeNotifyList (&Private->NotifyList);\r
 \r
-    FreePool (Private);\r
+    gBS->FreePool (Private);\r
 \r
   }\r
 \r