]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Nt32Pkg/WinNtGopDxe/WinNtGopDriver.c
MdePkg/BasePeCoffLib: remove PE/COFF header workaround for ELILO on IPF
[mirror_edk2.git] / Nt32Pkg / WinNtGopDxe / WinNtGopDriver.c
index 5f41e29e19a518cf1e1b18ed640209e29931bb2f..b2c1386181ae71531c402bbc0342e5acf4662af2 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 \r
-Copyright (c) 2006 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
+Copyright (c) 2006 - 2007, 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
 http://opensource.org/licenses/bsd-license.php\r
@@ -21,33 +21,45 @@ Abstract:
 \r
 \r
 **/\r
+#include "WinNtGop.h"\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
+EFI_STATUS\r
+FreeNotifyList (\r
+  IN OUT LIST_ENTRY           *ListHead\r
+  )\r
+/*++\r
 \r
-#include "WinNtGop.h"\r
+Routine Description:\r
+\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 +92,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 +132,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 +185,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 +200,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 +212,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 +243,8 @@ WinNtGopDriverBindingStart (
                   &Private->GraphicsOutput,\r
                   &gEfiSimpleTextInProtocolGuid,\r
                   &Private->SimpleTextIn,\r
+                  &gEfiSimpleTextInputExProtocolGuid,\r
+                  &Private->SimpleTextInEx,\r
                   NULL\r
                   );\r
 \r
@@ -243,6 +266,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 +309,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 +335,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 +359,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