]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Migrate GOP driver from R8.6 for NT32. Add a new PCD "PcdWinNtGop". Setting NT32...
authorwuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 26 Dec 2006 02:26:02 +0000 (02:26 +0000)
committerwuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 26 Dec 2006 02:26:02 +0000 (02:26 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2137 6f19259b-4bc3-4df7-8a09-765794883524

15 files changed:
EdkNt32Pkg/Dxe/PlatformBds/BdsPlatform.h
EdkNt32Pkg/Dxe/PlatformBds/PlatformData.c
EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/ComponentName.c [new file with mode: 0644]
EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGop.h [new file with mode: 0644]
EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGop.msa [new file with mode: 0644]
EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopDriver.c [new file with mode: 0644]
EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopInput.c [new file with mode: 0644]
EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopScreen.c [new file with mode: 0644]
EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.c
EdkNt32Pkg/Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.msa
EdkNt32Pkg/EdkNt32Pkg.spd
EdkNt32Pkg/Include/Protocol/WinNtIo.h
EdkNt32Pkg/Library/EdkGenericBdsLib/BdsBoot.c
EdkNt32Pkg/Library/EdkGenericBdsLib/DevicePath.c
EdkNt32Pkg/Nt32.fpd

index 9f5d3fa47ec5007d48ef984583d32f9c41242bcb..81c61edd9f2c52e6107e20720fbc274faf194900 100644 (file)
@@ -58,6 +58,12 @@ typedef struct {
   EFI_DEVICE_PATH_PROTOCOL        End;\r
 } NT_PLATFORM_UGA_DEVICE_PATH;\r
 \r
+typedef struct {\r
+  VENDOR_DEVICE_PATH              NtBus;\r
+  WIN_NT_VENDOR_DEVICE_PATH_NODE  NtGopDevice;\r
+  EFI_DEVICE_PATH_PROTOCOL        End;\r
+} NT_PLATFORM_GOP_DEVICE_PATH;\r
+\r
 //\r
 // Platform BDS Functions\r
 //\r
index e9885b795709410b709f96a3ea1bed4b3ad377d0..2a36420e4794b2724c3a6754e3400430c5a29530 100644 (file)
@@ -68,6 +68,45 @@ NT_PLATFORM_UGA_DEVICE_PATH gUgaDevicePath1 = {
   },\r
   gEndEntire\r
 };\r
+#if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
+NT_PLATFORM_GOP_DEVICE_PATH gGopDevicePath0 = {\r
+  {\r
+    HARDWARE_DEVICE_PATH,\r
+    HW_VENDOR_DP,\r
+    (UINT8) (sizeof (VENDOR_DEVICE_PATH)),\r
+    (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),\r
+    EFI_WIN_NT_THUNK_PROTOCOL_GUID\r
+  },\r
+  {\r
+    HARDWARE_DEVICE_PATH,\r
+    HW_VENDOR_DP,\r
+    (UINT8) (sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)),\r
+    (UINT8) ((sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)) >> 8),\r
+    EFI_WIN_NT_GOP_GUID,\r
+    0\r
+  },\r
+  gEndEntire\r
+};\r
+\r
+NT_PLATFORM_GOP_DEVICE_PATH gGopDevicePath1 = {\r
+  {\r
+    HARDWARE_DEVICE_PATH,\r
+    HW_VENDOR_DP,\r
+    (UINT8) (sizeof (VENDOR_DEVICE_PATH)),\r
+    (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8),\r
+    EFI_WIN_NT_THUNK_PROTOCOL_GUID\r
+  },\r
+  {\r
+    HARDWARE_DEVICE_PATH,\r
+    HW_VENDOR_DP,\r
+    (UINT8) (sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)),\r
+    (UINT8) ((sizeof (WIN_NT_VENDOR_DEVICE_PATH_NODE)) >> 8),\r
+    EFI_WIN_NT_GOP_GUID,\r
+    1\r
+  },\r
+  gEndEntire\r
+};\r
+#endif\r
 \r
 //\r
 // Platform specific serial device path\r
@@ -165,6 +204,16 @@ BDS_CONSOLE_CONNECT_ENTRY   gPlatformConsole[] = {
     (EFI_DEVICE_PATH_PROTOCOL *) &gUgaDevicePath1,\r
     (CONSOLE_OUT | CONSOLE_IN)\r
   },\r
+#if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
+  {\r
+    (EFI_DEVICE_PATH_PROTOCOL *) &gGopDevicePath0,\r
+    (CONSOLE_OUT | CONSOLE_IN)\r
+  },\r
+  {\r
+    (EFI_DEVICE_PATH_PROTOCOL *) &gGopDevicePath1,\r
+    (CONSOLE_OUT | CONSOLE_IN)\r
+  },\r
+#endif\r
   {\r
     NULL,\r
     0\r
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/ComponentName.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/ComponentName.c
new file mode 100644 (file)
index 0000000..9263b3d
--- /dev/null
@@ -0,0 +1,189 @@
+/** @file
+
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution.  The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+  ComponentName.c
+
+Abstract:
+
+
+**/
+
+#include "WinNtGop.h"
+
+//
+// EFI Component Name Functions
+//
+EFI_STATUS
+EFIAPI
+WinNtGopComponentNameGetDriverName (
+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
+  IN  CHAR8                        *Language,
+  OUT CHAR16                       **DriverName
+  );
+
+EFI_STATUS
+EFIAPI
+WinNtGopComponentNameGetControllerName (
+  IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,
+  IN  EFI_HANDLE                                      ControllerHandle,
+  IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,
+  IN  CHAR8                                           *Language,
+  OUT CHAR16                                          **ControllerName
+  );
+
+//
+// EFI Component Name Protocol
+//
+EFI_COMPONENT_NAME_PROTOCOL     gWinNtGopComponentName = {
+  WinNtGopComponentNameGetDriverName,
+  WinNtGopComponentNameGetControllerName,
+  "eng"
+};
+
+static EFI_UNICODE_STRING_TABLE mWinNtGopDriverNameTable[] = {
+  { "eng", L"Windows GOP Driver" },
+  { NULL , NULL }
+};
+
+
+/**
+  Retrieves a Unicode string that is the user readable name of the EFI Driver.
+
+  @param  This                   A pointer to the EFI_COMPONENT_NAME_PROTOCOL
+                                 instance.
+  @param  Language               A pointer to a three character ISO 639-2 language
+                                 identifier. This is the language of the driver
+                                 name that that the caller  is requesting, and it
+                                 must match one of the languages specified in
+                                 SupportedLanguages.  The number of languages
+                                 supported by a  driver is up to the driver writer.
+  @param  DriverName             A pointer to the Unicode string to return.  This
+                                 Unicode string is the name of the driver specified
+                                 by This in the language  specified by Language.
+
+  @retval EFI_SUCCESS            The Unicode string for the Driver specified by
+                                 This and the language specified by Language was
+                                 returned  in DriverName.
+  @retval EFI_INVALID_PARAMETER  Language is NULL.
+  @retval EFI_INVALID_PARAMETER  DriverName is NULL.
+  @retval EFI_UNSUPPORTED        The driver specified by This does not support the
+                                 language specified by Language.
+
+**/
+EFI_STATUS
+EFIAPI
+WinNtGopComponentNameGetDriverName (
+  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
+  IN  CHAR8                        *Language,
+  OUT CHAR16                       **DriverName
+  )
+{
+  return LookupUnicodeString (
+          Language,
+          gWinNtGopComponentName.SupportedLanguages,
+          mWinNtGopDriverNameTable,
+          DriverName
+          );
+}
+
+
+/**
+  Retrieves a Unicode string that is the user readable name of the controller
+  that is being managed by an EFI Driver.
+
+  @param  This                   A pointer to the EFI_COMPONENT_NAME_PROTOCOL
+                                 instance.
+  @param  ControllerHandle       The handle of a controller that the driver
+                                 specified by  This is managing.  This handle
+                                 specifies the controller  whose name is to be
+                                 returned.
+  @param  ChildHandle            The handle of the child controller to retrieve the
+                                 name  of.  This is an optional parameter that may
+                                 be NULL.  It  will be NULL for device drivers.  It
+                                 will also be NULL  for a bus drivers that wish to
+                                 retrieve the name of the  bus controller.  It will
+                                 not be NULL for a bus driver  that wishes to
+                                 retrieve the name of a child controller.
+  @param  Language               A pointer to a three character ISO 639-2 language
+                                 identifier.  This is the language of the
+                                 controller name  that that the caller is
+                                 requesting, and it must match one of the languages
+                                 specified in SupportedLanguages.  The  number of
+                                 languages supported by a driver is up to the
+                                 driver writer.
+  @param  ControllerName         A pointer to the Unicode string to return.  This
+                                 Unicode string is the name of the controller
+                                 specified by  ControllerHandle and ChildHandle in
+                                 the language specified by Language from the point
+                                 of view of the driver specified by This.
+
+  @retval EFI_SUCCESS            The Unicode string for the user readable name in
+                                 the  language specified by Language for the driver
+                                  specified by This was returned in DriverName.
+  @retval EFI_INVALID_PARAMETER  ControllerHandle is not a valid EFI_HANDLE.
+  @retval EFI_INVALID_PARAMETER  ChildHandle is not NULL and it is not a valid
+                                 EFI_HANDLE.
+  @retval EFI_INVALID_PARAMETER  Language is NULL.
+  @retval EFI_INVALID_PARAMETER  ControllerName is NULL.
+  @retval EFI_UNSUPPORTED        The driver specified by This is not currently
+                                 managing  the controller specified by
+                                 ControllerHandle and  ChildHandle.
+  @retval EFI_UNSUPPORTED        The driver specified by This does not support the
+                                 language specified by Language.
+
+**/
+EFI_STATUS
+EFIAPI
+WinNtGopComponentNameGetControllerName (
+  IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,
+  IN  EFI_HANDLE                                      ControllerHandle,
+  IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,
+  IN  CHAR8                                           *Language,
+  OUT CHAR16                                          **ControllerName
+  )
+{
+  EFI_STATUS                   Status;
+  EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
+  GOP_PRIVATE_DATA             *Private;
+
+  //
+  // This is a device driver, so ChildHandle must be NULL.
+  //
+  if (ChildHandle != NULL) {
+    return EFI_UNSUPPORTED;
+  }
+
+  //
+  // Get our context back
+  //
+  Status = gBS->OpenProtocol (
+                  ControllerHandle,
+                  &gEfiGraphicsOutputProtocolGuid,
+                  &GraphicsOutput,
+                  gWinNtGopDriverBinding.DriverBindingHandle,
+                  ControllerHandle,
+                  EFI_OPEN_PROTOCOL_GET_PROTOCOL
+                  );
+  if (EFI_ERROR (Status)) {
+    return EFI_UNSUPPORTED;
+  }
+
+  Private = GOP_PRIVATE_DATA_FROM_THIS (GraphicsOutput);
+
+  return LookupUnicodeString (
+          Language,
+          gWinNtGopComponentName.SupportedLanguages,
+          Private->ControllerNameTable,
+          ControllerName
+          );
+}
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGop.h b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGop.h
new file mode 100644 (file)
index 0000000..b1341cb
--- /dev/null
@@ -0,0 +1,321 @@
+/** @file
+
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution.  The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+  WinNtGop.h
+
+Abstract:
+
+  Private data for the Gop driver that is bound to the WinNt Thunk protocol
+
+
+**/
+
+#ifndef _WIN_NT_GOP_H_
+#define _WIN_NT_GOP_H_
+
+//@MT:#include "EfiWinNT.h"
+//@MT:#include "Tiano.h"
+//@MT:#include "EfiDriverLib.h"
+
+//
+// Driver Consumed Protocols
+//
+//@MT:#include EFI_PROTOCOL_DEFINITION (DevicePath)
+//@MT:#include EFI_PROTOCOL_DEFINITION (WinNtIo)
+
+//
+// Driver Produced Protocols
+//
+//@MT:#include EFI_PROTOCOL_DEFINITION (DriverBinding)
+//@MT:#include EFI_PROTOCOL_DEFINITION (ComponentName)
+//@MT:#include EFI_PROTOCOL_DEFINITION (GraphicsOutput)
+//@MT:#include "LinkedList.h"
+
+#define MAX_Q 256
+
+typedef struct {
+  UINTN         Front;
+  UINTN         Rear;
+  UINTN         Count;
+  EFI_INPUT_KEY Q[MAX_Q];
+} GOP_QUEUE_FIXED;
+
+#define WIN_NT_GOP_CLASS_NAME       L"WinNtGopWindow"
+
+#define GOP_PRIVATE_DATA_SIGNATURE  EFI_SIGNATURE_32 ('S', 'g', 'o', 'N')
+
+#define GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER 0xffff
+
+typedef struct {
+  UINT32                     HorizontalResolution;
+  UINT32                     VerticalResolution;
+  UINT32                     ColorDepth;
+  UINT32                     RefreshRate;
+} GOP_MODE_DATA;
+
+typedef struct {
+  UINT64                        Signature;
+
+  EFI_HANDLE                    Handle;
+  EFI_GRAPHICS_OUTPUT_PROTOCOL  GraphicsOutput;
+  EFI_SIMPLE_TEXT_IN_PROTOCOL   SimpleTextIn;
+
+  EFI_WIN_NT_THUNK_PROTOCOL     *WinNtThunk;
+
+  EFI_UNICODE_STRING_TABLE      *ControllerNameTable;
+
+  //
+  // GOP Private Data for QueryMode ()
+  //
+  GOP_MODE_DATA                 *ModeData;
+
+  //
+  // GOP Private Data knowing when to start hardware
+  //
+  BOOLEAN                       HardwareNeedsStarting;
+
+  CHAR16                        *WindowName;
+  CHAR16                        Buffer[160];
+
+  HANDLE                        ThreadInited; // Semaphore
+  HANDLE                        ThreadHandle; // Thread
+  DWORD                         ThreadId;
+
+  HWND                          WindowHandle;
+  WNDCLASSEX                    WindowsClass;
+
+  //
+  // This screen is used to redraw the scree when windows events happen. It's
+  // updated in the main thread and displayed in the windows thread.
+  //
+  BITMAPV4HEADER                *VirtualScreenInfo;
+  RGBQUAD                       *VirtualScreen;
+
+  EFI_GRAPHICS_OUTPUT_BLT_PIXEL *FillLine;
+
+  //
+  // Keyboard Queue used by Simple Text In. WinProc thread adds, and main
+  // thread removes.
+  //
+  CRITICAL_SECTION              QCriticalSection;
+  GOP_QUEUE_FIXED               Queue;
+
+} GOP_PRIVATE_DATA;
+
+#define GOP_PRIVATE_DATA_FROM_THIS(a)  \
+         CR(a, GOP_PRIVATE_DATA, GraphicsOutput, GOP_PRIVATE_DATA_SIGNATURE)
+
+#define GOP_PRIVATE_DATA_FROM_TEXT_IN_THIS(a)  \
+         CR(a, GOP_PRIVATE_DATA, SimpleTextIn, GOP_PRIVATE_DATA_SIGNATURE)
+
+//
+// Global Protocol Variables
+//
+extern EFI_DRIVER_BINDING_PROTOCOL  gWinNtGopDriverBinding;
+extern EFI_COMPONENT_NAME_PROTOCOL  gWinNtGopComponentName;
+
+//
+// Gop Hardware abstraction internal worker functions
+//
+
+/**
+  TODO: Add function description
+
+  @param  WinNtIo              TODO: add argument description
+
+  @return TODO: add return values
+
+**/
+EFI_STATUS
+WinNtGopSupported (
+  IN  EFI_WIN_NT_IO_PROTOCOL  *WinNtIo
+  )
+;
+
+
+/**
+  TODO: Add function description
+
+  @param  Private              TODO: add argument description
+
+  @return TODO: add return values
+
+**/
+EFI_STATUS
+WinNtGopConstructor (
+  IN  GOP_PRIVATE_DATA    *Private
+  )
+;
+
+
+/**
+  TODO: Add function description
+
+  @param  Private              TODO: add argument description
+
+  @return TODO: add return values
+
+**/
+EFI_STATUS
+WinNtGopDestructor (
+  IN  GOP_PRIVATE_DATA    *Private
+  )
+;
+
+//
+// EFI 1.1 driver model prototypes for Win NT GOP
+//
+
+
+/**
+  TODO: Add function description
+
+  @param  ImageHandle          TODO: add argument description
+  @param  SystemTable          TODO: add argument description
+
+  @return TODO: add return values
+
+**/
+EFI_STATUS
+EFIAPI
+WinNtGopInitialize (
+  IN EFI_HANDLE            ImageHandle,
+  IN EFI_SYSTEM_TABLE      *SystemTable
+  )
+;
+
+
+/**
+  TODO: Add function description
+
+  @param  This                 TODO: add argument description
+  @param  Handle               TODO: add argument description
+  @param  RemainingDevicePath  TODO: add argument description
+
+  @return TODO: add return values
+
+**/
+EFI_STATUS
+EFIAPI
+WinNtGopDriverBindingSupported (
+  IN  EFI_DRIVER_BINDING_PROTOCOL     *This,
+  IN  EFI_HANDLE                      Handle,
+  IN  EFI_DEVICE_PATH_PROTOCOL        *RemainingDevicePath
+  )
+;
+
+
+/**
+  TODO: Add function description
+
+  @param  This                 TODO: add argument description
+  @param  Handle               TODO: add argument description
+  @param  RemainingDevicePath  TODO: add argument description
+
+  @return TODO: add return values
+
+**/
+EFI_STATUS
+EFIAPI
+WinNtGopDriverBindingStart (
+  IN  EFI_DRIVER_BINDING_PROTOCOL     *This,
+  IN  EFI_HANDLE                      Handle,
+  IN  EFI_DEVICE_PATH_PROTOCOL        *RemainingDevicePath
+  )
+;
+
+
+/**
+  TODO: Add function description
+
+  @param  This                 TODO: add argument description
+  @param  Handle               TODO: add argument description
+  @param  NumberOfChildren     TODO: add argument description
+  @param  ChildHandleBuffer    TODO: add argument description
+
+  @return TODO: add return values
+
+**/
+EFI_STATUS
+EFIAPI
+WinNtGopDriverBindingStop (
+  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,
+  IN  EFI_HANDLE                   Handle,
+  IN  UINTN                        NumberOfChildren,
+  IN  EFI_HANDLE                   *ChildHandleBuffer
+  )
+;
+
+
+/**
+  TODO: Add function description
+
+  @param  Private              TODO: add argument description
+  @param  Key                  TODO: add argument description
+
+  @return TODO: add return values
+
+**/
+EFI_STATUS
+GopPrivateAddQ (
+  IN  GOP_PRIVATE_DATA    *Private,
+  IN  EFI_INPUT_KEY       Key
+  )
+;
+
+
+/**
+  TODO: Add function description
+
+  @param  Private              TODO: add argument description
+
+  @return TODO: add return values
+
+**/
+EFI_STATUS
+WinNtGopInitializeSimpleTextInForWindow (
+  IN  GOP_PRIVATE_DATA    *Private
+  )
+;
+
+
+/**
+  TODO: Add function description
+
+  @param  Private              TODO: add argument description
+
+  @return TODO: add return values
+
+**/
+EFI_STATUS
+WinNtGopDestroySimpleTextInForWindow (
+  IN  GOP_PRIVATE_DATA    *Private
+  )
+;
+
+
+/**
+  TODO: Add function description
+
+  @param  String               TODO: add argument description
+
+  @return TODO: add return values
+
+**/
+UINTN
+Atoi (
+  IN  CHAR16  *String
+  )
+;
+
+#endif
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGop.msa b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGop.msa
new file mode 100644 (file)
index 0000000..a373ff8
--- /dev/null
@@ -0,0 +1,97 @@
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\r
+  <MsaHeader>\r
+    <ModuleName>WinNtGop</ModuleName>\r
+    <ModuleType>UEFI_DRIVER</ModuleType>\r
+    <GuidValue>29b3c4c6-e5aa-49e4-8ce0-2772f782ddc2</GuidValue>\r
+    <Version>1.0</Version>\r
+    <Abstract>Gop Driver</Abstract>\r
+    <Description>\r
+      GOP is short hand for UEFI Graphics Output protocol.\r
+      This file is a verision of GopIo the uses WinNtThunk system calls as an IO\r
+      abstraction. For a PCI device WinNtIo would be replaced with\r
+      a PCI IO abstraction that abstracted a specific PCI device.\r
+    </Description>\r
+    <Copyright>Copyright (c) 2006, Intel Corporation</Copyright>\r
+    <License>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
+      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.</License>\r
+    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>\r
+  </MsaHeader>\r
+  <ModuleDefinitions>\r
+    <SupportedArchitectures>IA32</SupportedArchitectures>\r
+    <BinaryModule>false</BinaryModule>\r
+    <OutputFileBasename>WinNtGop</OutputFileBasename>\r
+  </ModuleDefinitions>\r
+  <LibraryClassDefinitions>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>DebugLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>BaseLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>UefiDriverModelLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>UefiDriverEntryPoint</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>UefiLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>BaseMemoryLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>MemoryAllocationLib</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>UefiBootServicesTableLib</Keyword>\r
+    </LibraryClass>\r
+  </LibraryClassDefinitions>\r
+  <SourceFiles>\r
+    <Filename>WinNtGopScreen.c</Filename>\r
+    <Filename>WinNtGopInput.c</Filename>\r
+    <Filename>WinNtGop.h</Filename>\r
+    <Filename>ComponentName.c</Filename>\r
+    <Filename>WinNtGopDriver.c</Filename>\r
+  </SourceFiles>\r
+  <PackageDependencies>\r
+    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+    <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>\r
+    <Package PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3"/>\r
+  </PackageDependencies>\r
+  <Protocols>\r
+    <Protocol Usage="TO_START">\r
+      <ProtocolCName>gEfiWinNtIoProtocolGuid</ProtocolCName>\r
+    </Protocol>\r
+    <Protocol Usage="BY_START">\r
+      <ProtocolCName>gEfiSimpleTextInProtocolGuid</ProtocolCName>\r
+    </Protocol>\r
+    <Protocol Usage="BY_START">\r
+      <ProtocolCName>gEfiGraphicsOutputProtocolGuid</ProtocolCName>\r
+    </Protocol>\r
+  </Protocols>\r
+  <Events>\r
+    <CreateEvents>\r
+      <EventTypes EventGuidCName="gEfiEventExitBootServicesGuid" Usage="SOMETIMES_CONSUMED">\r
+        <EventType>EVENT_GROUP_GUID</EventType>\r
+      </EventTypes>\r
+    </CreateEvents>\r
+  </Events>\r
+  <Guids>\r
+    <GuidCNames Usage="ALWAYS_CONSUMED">\r
+      <GuidCName>gEfiWinNtGopGuid</GuidCName>\r
+    </GuidCNames>\r
+  </Guids>\r
+  <Externs>\r
+    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+    <Extern>\r
+      <DriverBinding>gWinNtGopDriverBinding</DriverBinding>\r
+      <ComponentName>gWinNtGopComponentName</ComponentName>\r
+    </Extern>\r
+  </Externs>\r
+</ModuleSurfaceArea>
\ No newline at end of file
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopDriver.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopDriver.c
new file mode 100644 (file)
index 0000000..067033b
--- /dev/null
@@ -0,0 +1,320 @@
+/** @file
+
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution.  The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+  WinNtGopDriver.c
+
+Abstract:
+
+  This file implements the UEFI Device Driver model requirements for GOP
+
+  GOP is short hand for Graphics Output Protocol.
+
+
+**/
+
+#include "WinNtGop.h"
+
+EFI_DRIVER_BINDING_PROTOCOL gWinNtGopDriverBinding = {
+  WinNtGopDriverBindingSupported,
+  WinNtGopDriverBindingStart,
+  WinNtGopDriverBindingStop,
+  0x10,
+  NULL,
+  NULL
+};
+
+/**
+
+
+  @return None
+
+**/
+// TODO:    This - add argument and description to function comment
+// TODO:    Handle - add argument and description to function comment
+// TODO:    RemainingDevicePath - add argument and description to function comment
+EFI_STATUS
+EFIAPI
+WinNtGopDriverBindingSupported (
+  IN  EFI_DRIVER_BINDING_PROTOCOL     *This,
+  IN  EFI_HANDLE                      Handle,
+  IN  EFI_DEVICE_PATH_PROTOCOL        *RemainingDevicePath
+  )
+{
+  EFI_STATUS              Status;
+  EFI_WIN_NT_IO_PROTOCOL  *WinNtIo;
+
+  //
+  // Open the IO Abstraction(s) needed to perform the supported test
+  //
+  Status = gBS->OpenProtocol (
+                  Handle,
+                  &gEfiWinNtIoProtocolGuid,
+                  &WinNtIo,
+                  This->DriverBindingHandle,
+                  Handle,
+                  EFI_OPEN_PROTOCOL_BY_DRIVER
+                  );
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
+
+  Status = WinNtGopSupported (WinNtIo);
+
+  //
+  // Close the I/O Abstraction(s) used to perform the supported test
+  //
+  gBS->CloseProtocol (
+        Handle,
+        &gEfiWinNtIoProtocolGuid,
+        This->DriverBindingHandle,
+        Handle
+        );
+
+  return Status;
+}
+
+
+/**
+
+
+  @return None
+
+**/
+// TODO:    This - add argument and description to function comment
+// TODO:    Handle - add argument and description to function comment
+// TODO:    RemainingDevicePath - add argument and description to function comment
+// TODO:    EFI_UNSUPPORTED - add return value to function comment
+EFI_STATUS
+EFIAPI
+WinNtGopDriverBindingStart (
+  IN  EFI_DRIVER_BINDING_PROTOCOL     *This,
+  IN  EFI_HANDLE                      Handle,
+  IN  EFI_DEVICE_PATH_PROTOCOL        *RemainingDevicePath
+  )
+{
+  EFI_WIN_NT_IO_PROTOCOL  *WinNtIo;
+  EFI_STATUS              Status;
+  GOP_PRIVATE_DATA        *Private;
+
+  //
+  // Grab the protocols we need
+  //
+  Status = gBS->OpenProtocol (
+                  Handle,
+                  &gEfiWinNtIoProtocolGuid,
+                  &WinNtIo,
+                  This->DriverBindingHandle,
+                  Handle,
+                  EFI_OPEN_PROTOCOL_BY_DRIVER
+                  );
+  if (EFI_ERROR (Status)) {
+    return EFI_UNSUPPORTED;
+  }
+
+  //
+  // Allocate Private context data for SGO inteface.
+  //
+  Private = NULL;
+  Status = gBS->AllocatePool (
+                  EfiBootServicesData,
+                  sizeof (GOP_PRIVATE_DATA),
+                  &Private
+                  );
+  if (EFI_ERROR (Status)) {
+    goto Done;
+  }
+  //
+  // Set up context record
+  //
+  Private->Signature            = GOP_PRIVATE_DATA_SIGNATURE;
+  Private->Handle               = Handle;
+  Private->WinNtThunk           = WinNtIo->WinNtThunk;
+
+  Private->ControllerNameTable  = NULL;
+
+  AddUnicodeString (
+    "eng",
+    gWinNtGopComponentName.SupportedLanguages,
+    &Private->ControllerNameTable,
+    WinNtIo->EnvString
+    );
+
+  Private->WindowName = WinNtIo->EnvString;
+
+  Status              = WinNtGopConstructor (Private);
+  if (EFI_ERROR (Status)) {
+    goto Done;
+  }
+  //
+  // Publish the Gop interface to the world
+  //
+  Status = gBS->InstallMultipleProtocolInterfaces (
+                  &Private->Handle,
+                  &gEfiGraphicsOutputProtocolGuid,
+                  &Private->GraphicsOutput,
+                  &gEfiSimpleTextInProtocolGuid,
+                  &Private->SimpleTextIn,
+                  NULL
+                  );
+
+Done:
+  if (EFI_ERROR (Status)) {
+
+    gBS->CloseProtocol (
+          Handle,
+          &gEfiWinNtIoProtocolGuid,
+          This->DriverBindingHandle,
+          Handle
+          );
+
+    if (Private != NULL) {
+      //
+      // On Error Free back private data
+      //
+      if (Private->ControllerNameTable != NULL) {
+        FreeUnicodeStringTable (Private->ControllerNameTable);
+      }
+
+      gBS->FreePool (Private);
+    }
+  }
+
+  return Status;
+}
+
+
+/**
+
+
+  @return None
+
+**/
+// TODO:    This - add argument and description to function comment
+// TODO:    Handle - add argument and description to function comment
+// TODO:    NumberOfChildren - add argument and description to function comment
+// TODO:    ChildHandleBuffer - add argument and description to function comment
+// TODO:    EFI_NOT_STARTED - add return value to function comment
+// TODO:    EFI_DEVICE_ERROR - add return value to function comment
+EFI_STATUS
+EFIAPI
+WinNtGopDriverBindingStop (
+  IN  EFI_DRIVER_BINDING_PROTOCOL  *This,
+  IN  EFI_HANDLE                   Handle,
+  IN  UINTN                        NumberOfChildren,
+  IN  EFI_HANDLE                   *ChildHandleBuffer
+  )
+{
+  EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
+  EFI_STATUS                   Status;
+  GOP_PRIVATE_DATA             *Private;
+
+  Status = gBS->OpenProtocol (
+                  Handle,
+                  &gEfiGraphicsOutputProtocolGuid,
+                  &GraphicsOutput,
+                  This->DriverBindingHandle,
+                  Handle,
+                  EFI_OPEN_PROTOCOL_GET_PROTOCOL
+                  );
+  if (EFI_ERROR (Status)) {
+    //
+    // If the GOP interface does not exist the driver is not started
+    //
+    return EFI_NOT_STARTED;
+  }
+
+  //
+  // Get our private context information
+  //
+  Private = GOP_PRIVATE_DATA_FROM_THIS (GraphicsOutput);
+
+  //
+  // Remove the SGO interface from the system
+  //
+  Status = gBS->UninstallMultipleProtocolInterfaces (
+                  Private->Handle,
+                  &gEfiGraphicsOutputProtocolGuid,
+                  &Private->GraphicsOutput,
+                  &gEfiSimpleTextInProtocolGuid,
+                  &Private->SimpleTextIn,
+                  NULL
+                  );
+  if (!EFI_ERROR (Status)) {
+    //
+    // Shutdown the hardware
+    //
+    Status = WinNtGopDestructor (Private);
+    if (EFI_ERROR (Status)) {
+      return EFI_DEVICE_ERROR;
+    }
+
+    gBS->CloseProtocol (
+          Handle,
+          &gEfiWinNtIoProtocolGuid,
+          This->DriverBindingHandle,
+          Handle
+          );
+
+    //
+    // Free our instance data
+    //
+    FreeUnicodeStringTable (Private->ControllerNameTable);
+
+    gBS->FreePool (Private);
+
+  }
+
+  return Status;
+}
+
+
+/**
+  Convert a unicode string to a UINTN
+
+  @param  String  Unicode string.
+
+  @return UINTN of the number represented by String.
+
+**/
+UINTN
+Atoi (
+  CHAR16  *String
+  )
+{
+  UINTN   Number;
+  CHAR16  *Str;
+
+  //
+  // skip preceeding white space
+  //
+  Str = String;
+  while ((*Str) && (*Str == ' ' || *Str == '"')) {
+    Str++;
+  }
+
+  //
+  // Convert ot a Number
+  //
+  Number = 0;
+  while (*Str != '\0') {
+    if ((*Str >= '0') && (*Str <= '9')) {
+      Number = (Number * 10) +*Str - '0';
+    } else {
+      break;
+    }
+
+    Str++;
+  }
+
+  return Number;
+}
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopInput.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopInput.c
new file mode 100644 (file)
index 0000000..77006af
--- /dev/null
@@ -0,0 +1,352 @@
+/** @file
+
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution.  The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+  WinNtGopInput.c
+
+Abstract:
+
+  This file produces the Simple Text In for an Gop window.
+
+  This stuff is linked at the hip to the Window, since the window
+  processing is done in a thread kicked off in WinNtGopImplementation.c
+
+  Since the window information is processed in an other thread we need
+  a keyboard Queue to pass data about. The Simple Text In code just
+  takes data off the Queue. The WinProc message loop takes keyboard input
+  and places it in the Queue.
+
+
+**/
+
+#include "WinNtGop.h"
+
+
+/**
+  TODO: Add function description
+
+  @param  Private               TODO: add argument description
+
+  @retval EFI_SUCCESS           TODO: Add description for return value
+
+**/
+EFI_STATUS
+GopPrivateCreateQ (
+  IN  GOP_PRIVATE_DATA    *Private
+  )
+{
+  Private->WinNtThunk->InitializeCriticalSection (&Private->QCriticalSection);
+
+  Private->Queue.Front  = 0;
+  Private->Queue.Rear   = MAX_Q - 1;
+  Private->Queue.Count  = 0;
+  return EFI_SUCCESS;
+}
+
+
+/**
+  TODO: Add function description
+
+  @param  Private               TODO: add argument description
+
+  @retval EFI_SUCCESS           TODO: Add description for return value
+
+**/
+EFI_STATUS
+GopPrivateDestroyQ (
+  IN  GOP_PRIVATE_DATA    *Private
+  )
+{
+  Private->Queue.Count = 0;
+  Private->WinNtThunk->DeleteCriticalSection (&Private->QCriticalSection);
+  return EFI_SUCCESS;
+}
+
+
+/**
+  TODO: Add function description
+
+  @param  Private               TODO: add argument description
+  @param  Key                   TODO: add argument description
+
+  @retval EFI_NOT_READY         TODO: Add description for return value
+  @retval EFI_SUCCESS           TODO: Add description for return value
+
+**/
+EFI_STATUS
+GopPrivateAddQ (
+  IN  GOP_PRIVATE_DATA    *Private,
+  IN  EFI_INPUT_KEY       Key
+  )
+{
+  Private->WinNtThunk->EnterCriticalSection (&Private->QCriticalSection);
+
+  if (Private->Queue.Count == MAX_Q) {
+    Private->WinNtThunk->LeaveCriticalSection (&Private->QCriticalSection);
+    return EFI_NOT_READY;
+  }
+
+  Private->Queue.Rear                   = (Private->Queue.Rear + 1) % MAX_Q;
+  Private->Queue.Q[Private->Queue.Rear] = Key;
+  Private->Queue.Count++;
+
+  Private->WinNtThunk->LeaveCriticalSection (&Private->QCriticalSection);
+  return EFI_SUCCESS;
+}
+
+
+/**
+  TODO: Add function description
+
+  @param  Private               TODO: add argument description
+  @param  Key                   TODO: add argument description
+
+  @retval EFI_NOT_READY         TODO: Add description for return value
+  @retval EFI_SUCCESS           TODO: Add description for return value
+
+**/
+EFI_STATUS
+GopPrivateDeleteQ (
+  IN  GOP_PRIVATE_DATA    *Private,
+  OUT EFI_INPUT_KEY       *Key
+  )
+{
+  Private->WinNtThunk->EnterCriticalSection (&Private->QCriticalSection);
+
+  if (Private->Queue.Count == 0) {
+    Private->WinNtThunk->LeaveCriticalSection (&Private->QCriticalSection);
+    return EFI_NOT_READY;
+  }
+
+  *Key                  = Private->Queue.Q[Private->Queue.Front];
+  Private->Queue.Front  = (Private->Queue.Front + 1) % MAX_Q;
+  Private->Queue.Count--;
+
+  Private->WinNtThunk->LeaveCriticalSection (&Private->QCriticalSection);
+  return EFI_SUCCESS;
+}
+
+
+/**
+  TODO: Add function description
+
+  @param  Private               TODO: add argument description
+
+  @retval EFI_NOT_READY         TODO: Add description for return value
+  @retval EFI_SUCCESS           TODO: Add description for return value
+
+**/
+EFI_STATUS
+GopPrivateCheckQ (
+  IN  GOP_PRIVATE_DATA    *Private
+  )
+{
+  if (Private->Queue.Count == 0) {
+    return EFI_NOT_READY;
+  }
+
+  return EFI_SUCCESS;
+}
+
+//
+// Simple Text In implementation.
+//
+
+
+/**
+  TODO: Add function description
+
+  @param  This                  TODO: add argument description
+  @param  ExtendedVerification  TODO: add argument description
+
+  @retval EFI_SUCCESS           TODO: Add description for return value
+
+**/
+EFI_STATUS
+EFIAPI
+WinNtGopSimpleTextInReset (
+  IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL          *This,
+  IN BOOLEAN                              ExtendedVerification
+  )
+{
+  GOP_PRIVATE_DATA  *Private;
+  EFI_INPUT_KEY     Key;
+  EFI_TPL           OldTpl;
+
+  Private = GOP_PRIVATE_DATA_FROM_TEXT_IN_THIS (This);
+
+  //
+  // Enter critical section
+  //
+  OldTpl = gBS->RaiseTPL (TPL_NOTIFY);
+
+  //
+  // A reset is draining the Queue
+  //
+  while (GopPrivateDeleteQ (Private, &Key) == EFI_SUCCESS)
+    ;
+
+  //
+  // Leave critical section and return
+  //
+  gBS->RestoreTPL (OldTpl);
+  return EFI_SUCCESS;
+}
+
+
+/**
+  TODO: Add function description
+
+  @param  This                  TODO: add argument description
+  @param  Key                   TODO: add argument description
+
+  @return TODO: add return values
+
+**/
+STATIC
+EFI_STATUS
+EFIAPI
+WinNtGopSimpleTextInReadKeyStroke (
+  IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL          *This,
+  OUT EFI_INPUT_KEY                       *Key
+  )
+{
+  GOP_PRIVATE_DATA  *Private;
+  EFI_STATUS        Status;
+  EFI_TPL           OldTpl;
+
+  Private = GOP_PRIVATE_DATA_FROM_TEXT_IN_THIS (This);
+
+  //
+  // Enter critical section
+  //
+  OldTpl  = gBS->RaiseTPL (TPL_NOTIFY);
+
+  Status  = GopPrivateCheckQ (Private);
+  if (!EFI_ERROR (Status)) {
+    //
+    // If a Key press exists try and read it.
+    //
+    Status = GopPrivateDeleteQ (Private, Key);
+  }
+
+  //
+  // Leave critical section and return
+  //
+  gBS->RestoreTPL (OldTpl);
+
+  return Status;
+}
+
+
+/**
+  TODO: Add function description
+
+  @param  Event                 TODO: add argument description
+  @param  Context               TODO: add argument description
+
+  @return TODO: add return values
+
+**/
+STATIC
+VOID
+EFIAPI
+WinNtGopSimpleTextInWaitForKey (
+  IN EFI_EVENT          Event,
+  IN VOID               *Context
+  )
+{
+  GOP_PRIVATE_DATA  *Private;
+  EFI_STATUS        Status;
+  EFI_TPL           OldTpl;
+
+  Private = (GOP_PRIVATE_DATA *) Context;
+
+  //
+  // Enter critical section
+  //
+  OldTpl  = gBS->RaiseTPL (TPL_NOTIFY);
+
+  Status  = GopPrivateCheckQ (Private);
+  if (!EFI_ERROR (Status)) {
+    //
+    // If a there is a key in the queue signal our event.
+    //
+    gBS->SignalEvent (Event);
+  } else {
+    //
+    // We need to sleep or NT will schedule this thread with such high
+    // priority that WinProc thread will never run and we will not see
+    // keyboard input. This Sleep makes the syste run 10x faster, so don't
+    // remove it.
+    //
+    Private->WinNtThunk->Sleep (1);
+  }
+
+  //
+  // Leave critical section and return
+  //
+  gBS->RestoreTPL (OldTpl);
+}
+
+
+/**
+  TODO: Add function description
+
+  @param  Private               TODO: add argument description
+
+  @return TODO: add return values
+
+**/
+EFI_STATUS
+WinNtGopInitializeSimpleTextInForWindow (
+  IN  GOP_PRIVATE_DATA    *Private
+  )
+{
+  EFI_STATUS  Status;
+
+  GopPrivateCreateQ (Private);
+
+  //
+  // Initialize Simple Text In protoocol
+  //
+  Private->SimpleTextIn.Reset         = WinNtGopSimpleTextInReset;
+  Private->SimpleTextIn.ReadKeyStroke = WinNtGopSimpleTextInReadKeyStroke;
+
+  Status = gBS->CreateEvent (
+                  EVENT_NOTIFY_WAIT,
+                  TPL_NOTIFY,
+                  WinNtGopSimpleTextInWaitForKey,
+                  Private,
+                  &Private->SimpleTextIn.WaitForKey
+                  );
+
+  return Status;
+}
+
+
+/**
+  TODO: Add function description
+
+  @param  Private               TODO: add argument description
+
+  @retval EFI_SUCCESS           TODO: Add description for return value
+
+**/
+EFI_STATUS
+WinNtGopDestroySimpleTextInForWindow (
+  IN  GOP_PRIVATE_DATA    *Private
+  )
+{
+  GopPrivateDestroyQ (Private);
+  return EFI_SUCCESS;
+}
diff --git a/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopScreen.c b/EdkNt32Pkg/Dxe/WinNtThunk/Bus/Gop/WinNtGopScreen.c
new file mode 100644 (file)
index 0000000..7654511
--- /dev/null
@@ -0,0 +1,1012 @@
+/** @file
+
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution.  The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+Module Name:
+
+    WinNtGopScreen.c
+
+Abstract:
+
+  This file produces the graphics abstration of GOP. It is called by
+  WinNtGopDriver.c file which deals with the EFI 1.1 driver model.
+  This file just does graphics.
+
+
+**/
+
+#include "WinNtGop.h"
+
+EFI_WIN_NT_THUNK_PROTOCOL *mWinNt;
+DWORD                     mTlsIndex         = TLS_OUT_OF_INDEXES;
+DWORD                     mTlsIndexUseCount = 0;  // lets us know when we can free mTlsIndex.
+static EFI_EVENT          mGopScreenExitBootServicesEvent;
+GOP_MODE_DATA mGopModeData[] = {
+    {800, 600, 0, 0},
+    {640, 480, 0, 0},
+    {720, 400, 0, 0},
+    {1024, 768, 0, 0},
+    {1280, 1024, 0, 0}
+    };
+
+EFI_STATUS
+WinNtGopStartWindow (
+  IN  GOP_PRIVATE_DATA    *Private,
+  IN  UINT32              HorizontalResolution,
+  IN  UINT32              VerticalResolution,
+  IN  UINT32              ColorDepth,
+  IN  UINT32              RefreshRate
+  );
+
+STATIC
+VOID
+EFIAPI
+KillNtGopThread (
+  IN EFI_EVENT  Event,
+  IN VOID       *Context
+  );
+
+//
+// GOP Protocol Member Functions
+//
+
+
+/**
+  Graphics Output protocol interface to get video mode
+
+  @param  This                   Protocol instance pointer.
+  @param  ModeNumber             The mode number to return information on.
+  @param  Info                   Caller allocated buffer that returns information
+                                 about ModeNumber.
+  @param  SizeOfInfo             A pointer to the size, in bytes, of the Info
+                                 buffer.
+
+  @retval EFI_SUCCESS            Mode information returned.
+  @retval EFI_BUFFER_TOO_SMALL   The Info buffer was too small.
+  @retval EFI_DEVICE_ERROR       A hardware error occurred trying to retrieve the
+                                 video mode.
+  @retval EFI_NOT_STARTED        Video display is not initialized. Call SetMode ()
+  @retval EFI_INVALID_PARAMETER  One of the input args was NULL.
+
+**/
+EFI_STATUS
+EFIAPI
+WinNtGopQuerytMode (
+  IN  EFI_GRAPHICS_OUTPUT_PROTOCOL          *This,
+  IN  UINT32                                ModeNumber,
+  OUT UINTN                                 *SizeOfInfo,
+  OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION  **Info
+  )
+{
+  EFI_STATUS        Status;
+  GOP_PRIVATE_DATA  *Private;
+
+  Private = GOP_PRIVATE_DATA_FROM_THIS (This);
+
+  if (Info == NULL || SizeOfInfo == NULL || (UINTN) ModeNumber >= This->Mode->MaxMode) {
+    return EFI_INVALID_PARAMETER;
+  }
+
+  Status = gBS->AllocatePool (
+                  EfiBootServicesData,
+                  sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION),
+                  Info
+                  );
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
+
+  *SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
+
+  (*Info)->Version = 0;
+  (*Info)->HorizontalResolution = Private->ModeData[ModeNumber].HorizontalResolution;
+  (*Info)->VerticalResolution   = Private->ModeData[ModeNumber].VerticalResolution;
+  (*Info)->PixelFormat = PixelBlueGreenRedReserved8BitPerColor;
+  (*Info)->PixelsPerScanLine = (*Info)->HorizontalResolution;
+
+  return EFI_SUCCESS;
+}
+
+
+/**
+  Graphics Output protocol interface to set video mode
+
+  @param  This                   Protocol instance pointer.
+  @param  ModeNumber             The mode number to be set.
+
+  @retval EFI_SUCCESS            Graphics mode was changed.
+  @retval EFI_DEVICE_ERROR       The device had an error and could not complete the
+                                 request.
+  @retval EFI_UNSUPPORTED        ModeNumber is not supported by this device.
+
+**/
+EFI_STATUS
+EFIAPI
+WinNtGopSetMode (
+  IN  EFI_GRAPHICS_OUTPUT_PROTOCOL * This,
+  IN  UINT32                       ModeNumber
+  )
+{
+  EFI_STATUS                    Status;
+  GOP_PRIVATE_DATA              *Private;
+  GOP_MODE_DATA *ModeData;
+  EFI_GRAPHICS_OUTPUT_BLT_PIXEL Fill;
+  EFI_GRAPHICS_OUTPUT_BLT_PIXEL *NewFillLine;
+  RECT                          Rect;
+  UINTN                         Size;
+  UINTN                         Width;
+  UINTN                         Height;
+
+  Private = GOP_PRIVATE_DATA_FROM_THIS (This);
+
+  if (ModeNumber >= This->Mode->MaxMode) {
+    return EFI_UNSUPPORTED;
+  }
+
+  if (ModeNumber == This->Mode->Mode) {
+    return EFI_SUCCESS;
+  }
+
+  ModeData = &Private->ModeData[ModeNumber];
+  This->Mode->Mode = ModeNumber;
+  Private->GraphicsOutput.Mode->Info->HorizontalResolution = ModeData->HorizontalResolution;
+  Private->GraphicsOutput.Mode->Info->VerticalResolution = ModeData->VerticalResolution;
+  Private->GraphicsOutput.Mode->Info->PixelsPerScanLine = ModeData->HorizontalResolution;
+
+  if (Private->HardwareNeedsStarting) {
+    Status = WinNtGopStartWindow (
+              Private,
+              ModeData->HorizontalResolution,
+              ModeData->VerticalResolution,
+              ModeData->ColorDepth,
+              ModeData->RefreshRate
+              );
+    if (EFI_ERROR (Status)) {
+      return EFI_DEVICE_ERROR;
+    }
+
+    Private->HardwareNeedsStarting = FALSE;
+  } else {
+    //
+    // Change the resolution and resize of the window
+    //
+
+    //
+    // Free the old buffer. We do not save the content of the old buffer since the
+    // screen is to be cleared anyway. Clearing the screen is required by the EFI spec.
+    // See UEFI spec -EFI_GRAPHICS_OUTPUT_PROTOCOL.SetMode()
+    //
+    Private->WinNtThunk->HeapFree (Private->WinNtThunk->GetProcessHeap (), 0, Private->VirtualScreenInfo);
+
+    //
+    // Allocate DIB frame buffer directly from NT for performance enhancement
+    // This buffer is the virtual screen/frame buffer. This buffer is not the
+    // same a a frame buffer. The first row of this buffer will be the bottom
+    // line of the image. This is an artifact of the way we draw to the screen.
+    //
+    Size = ModeData->HorizontalResolution * ModeData->VerticalResolution * sizeof (RGBQUAD) + sizeof (BITMAPV4HEADER);
+    Private->VirtualScreenInfo = Private->WinNtThunk->HeapAlloc (
+                                                        Private->WinNtThunk->GetProcessHeap (),
+                                                        HEAP_ZERO_MEMORY,
+                                                        Size
+                                                        );
+
+    //
+    // Update the virtual screen info data structure
+    //
+    Private->VirtualScreenInfo->bV4Size           = sizeof (BITMAPV4HEADER);
+    Private->VirtualScreenInfo->bV4Width          = ModeData->HorizontalResolution;
+    Private->VirtualScreenInfo->bV4Height         = ModeData->VerticalResolution;
+    Private->VirtualScreenInfo->bV4Planes         = 1;
+    Private->VirtualScreenInfo->bV4BitCount       = 32;
+    //
+    // uncompressed
+    //
+    Private->VirtualScreenInfo->bV4V4Compression  = BI_RGB;
+
+    //
+    // The rest of the allocated memory block is the virtual screen buffer
+    //
+    Private->VirtualScreen = (RGBQUAD *) (Private->VirtualScreenInfo + 1);
+
+    //
+    // Use the AdjuctWindowRect fuction to calculate the real width and height
+    // of the new window including the border and caption
+    //
+    Rect.left   = 0;
+    Rect.top    = 0;
+    Rect.right  = ModeData->HorizontalResolution;
+    Rect.bottom = ModeData->VerticalResolution;
+
+    Private->WinNtThunk->AdjustWindowRect (&Rect, WS_OVERLAPPEDWINDOW, 0);
+
+    Width   = Rect.right - Rect.left;
+    Height  = Rect.bottom - Rect.top;
+
+    //
+    // Retrieve the original window position information
+    //
+    Private->WinNtThunk->GetWindowRect (Private->WindowHandle, &Rect);
+
+    //
+    // Adjust the window size
+    //
+    Private->WinNtThunk->MoveWindow (Private->WindowHandle, Rect.left, Rect.top, Width, Height, TRUE);
+
+  }
+
+  Status = gBS->AllocatePool (
+                  EfiBootServicesData,
+                  sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * ModeData->HorizontalResolution,
+                  &NewFillLine
+                  );
+  if (EFI_ERROR (Status)) {
+    return EFI_DEVICE_ERROR;
+  }
+
+  if (Private->FillLine != NULL) {
+    gBS->FreePool (Private->FillLine);
+  }
+
+  Private->FillLine             = NewFillLine;
+
+  Fill.Red                      = 0x00;
+  Fill.Green                    = 0x00;
+  Fill.Blue                     = 0x00;
+  This->Blt (
+          This,
+          &Fill,
+          EfiBltVideoFill,
+          0,
+          0,
+          0,
+          0,
+          ModeData->HorizontalResolution,
+          ModeData->VerticalResolution,
+          ModeData->HorizontalResolution * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
+          );
+  return EFI_SUCCESS;
+}
+
+
+/**
+  Blt pixels from the rectangle (Width X Height) formed by the BltBuffer
+  onto the graphics screen starting a location (X, Y). (0, 0) is defined as
+  the upper left hand side of the screen. (X, Y) can be outside of the
+  current screen geometry and the BltBuffer will be cliped when it is
+  displayed. X and Y can be negative or positive. If Width or Height is
+  bigger than the current video screen the image will be clipped.
+
+  @param  This                   Protocol instance pointer.
+  @param  X                      X location on graphics screen.
+  @param  Y                      Y location on the graphics screen.
+  @param  Width                  Width of BltBuffer.
+  @param  Height                 Hight of BltBuffer
+  @param  BltOperation           Operation to perform on BltBuffer and video memory
+  @param  BltBuffer              Buffer containing data to blt into video buffer.
+                                 This  buffer has a size of
+                                 Width*Height*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
+  @param  SourceX                If the BltOperation is a EfiCopyBlt this is the
+                                 source of the copy. For other BLT operations this
+                                 argument is not used.
+  @param  SourceX                If the BltOperation is a EfiCopyBlt this is the
+                                 source of the copy. For other BLT operations this
+                                 argument is not used.
+
+  @retval EFI_SUCCESS            The palette is updated with PaletteArray.
+  @retval EFI_INVALID_PARAMETER  BltOperation is not valid.
+  @retval EFI_DEVICE_ERROR       A hardware error occured writting to the video
+                                 buffer.
+
+**/
+// TODO:    SourceY - add argument and description to function comment
+// TODO:    DestinationX - add argument and description to function comment
+// TODO:    DestinationY - add argument and description to function comment
+// TODO:    Delta - add argument and description to function comment
+EFI_STATUS
+EFIAPI
+WinNtGopBlt (
+  IN  EFI_GRAPHICS_OUTPUT_PROTOCOL                   *This,
+  IN  EFI_GRAPHICS_OUTPUT_BLT_PIXEL                           *BltBuffer, OPTIONAL
+  IN  EFI_GRAPHICS_OUTPUT_BLT_OPERATION                   BltOperation,
+  IN  UINTN                                   SourceX,
+  IN  UINTN                                   SourceY,
+  IN  UINTN                                   DestinationX,
+  IN  UINTN                                   DestinationY,
+  IN  UINTN                                   Width,
+  IN  UINTN                                   Height,
+  IN  UINTN                                   Delta         OPTIONAL
+  )
+{
+  GOP_PRIVATE_DATA              *Private;
+  EFI_TPL                       OriginalTPL;
+  UINTN                         DstY;
+  UINTN                         SrcY;
+  RGBQUAD                       *VScreen;
+  RGBQUAD                       *VScreenSrc;
+  EFI_GRAPHICS_OUTPUT_BLT_PIXEL *Blt;
+  UINTN                         Index;
+  RECT                          Rect;
+  EFI_GRAPHICS_OUTPUT_BLT_PIXEL *FillPixel;
+  UINT32                        VerticalResolution;
+  UINT32                        HorizontalResolution;
+
+  Private = GOP_PRIVATE_DATA_FROM_THIS (This);
+
+  if ((BltOperation < 0) || (BltOperation >= EfiGraphicsOutputBltOperationMax)) {
+    return EFI_INVALID_PARAMETER;
+  }
+
+  if (Width == 0 || Height == 0) {
+    return EFI_INVALID_PARAMETER;
+  }
+  //
+  // If Delta is zero, then the entire BltBuffer is being used, so Delta
+  // is the number of bytes in each row of BltBuffer.  Since BltBuffer is Width pixels size,
+  // the number of bytes in each row can be computed.
+  //
+  if (Delta == 0) {
+    Delta = Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL);
+  }
+
+  //
+  // We need to fill the Virtual Screen buffer with the blt data.
+  // The virtual screen is upside down, as the first row is the bootom row of
+  // the image.
+  //
+  VerticalResolution = This->Mode->Info->VerticalResolution;
+  HorizontalResolution = This->Mode->Info->HorizontalResolution;
+  if (BltOperation == EfiBltVideoToBltBuffer) {
+
+    //
+    // Video to BltBuffer: Source is Video, destination is BltBuffer
+    //
+    if (SourceY + Height > VerticalResolution) {
+      return EFI_INVALID_PARAMETER;
+    }
+
+    if (SourceX + Width > HorizontalResolution) {
+      return EFI_INVALID_PARAMETER;
+    }
+    //
+    // We have to raise to TPL Notify, so we make an atomic write the frame buffer.
+    // We would not want a timer based event (Cursor, ...) to come in while we are
+    // doing this operation.
+    //
+    OriginalTPL = gBS->RaiseTPL (TPL_NOTIFY);
+
+    for (SrcY = SourceY, DstY = DestinationY; DstY < (Height + DestinationY); SrcY++, DstY++) {
+      Blt = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) ((UINT8 *) BltBuffer + (DstY * Delta) + DestinationX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
+      VScreen = &Private->VirtualScreen[(VerticalResolution - SrcY - 1) * HorizontalResolution + SourceX];
+      CopyMem (Blt, VScreen, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * Width);
+    }
+  } else {
+    //
+    // BltBuffer to Video: Source is BltBuffer, destination is Video
+    //
+    if (DestinationY + Height > VerticalResolution) {
+      return EFI_INVALID_PARAMETER;
+    }
+
+    if (DestinationX + Width > HorizontalResolution) {
+      return EFI_INVALID_PARAMETER;
+    }
+
+    //
+    // We have to raise to TPL Notify, so we make an atomic write the frame buffer.
+    // We would not want a timer based event (Cursor, ...) to come in while we are
+    // doing this operation.
+    //
+    OriginalTPL = gBS->RaiseTPL (TPL_NOTIFY);
+
+    if (BltOperation == EfiBltVideoFill) {
+      FillPixel = BltBuffer;
+      for (Index = 0; Index < Width; Index++) {
+        Private->FillLine[Index] = *FillPixel;
+      }
+    }
+
+    for (Index = 0; Index < Height; Index++) {
+      if (DestinationY <= SourceY) {
+        SrcY  = SourceY + Index;
+        DstY  = DestinationY + Index;
+      } else {
+        SrcY  = SourceY + Height - Index - 1;
+        DstY  = DestinationY + Height - Index - 1;
+      }
+
+      VScreen = &Private->VirtualScreen[(VerticalResolution - DstY - 1) * HorizontalResolution + DestinationX];
+      switch (BltOperation) {
+      case EfiBltBufferToVideo:
+        Blt = (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *) ((UINT8 *) BltBuffer + (SrcY * Delta) + SourceX * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
+        CopyMem (VScreen, Blt, Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
+        break;
+
+      case EfiBltVideoToVideo:
+        VScreenSrc = &Private->VirtualScreen[(VerticalResolution - SrcY - 1) * HorizontalResolution + SourceX];
+        CopyMem (VScreen, VScreenSrc, Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
+        break;
+
+      case EfiBltVideoFill:
+        CopyMem (VScreen, Private->FillLine, Width * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
+        break;
+      }
+    }
+  }
+
+  if (BltOperation != EfiBltVideoToBltBuffer) {
+    //
+    // Mark the area we just blted as Invalid so WM_PAINT will update.
+    //
+    Rect.left   = DestinationX;
+    Rect.top    = DestinationY;
+    Rect.right  = DestinationX + Width;
+    Rect.bottom = DestinationY + Height;
+    Private->WinNtThunk->InvalidateRect (Private->WindowHandle, &Rect, FALSE);
+
+    //
+    // Send the WM_PAINT message to the thread that is drawing the window. We
+    // are in the main thread and the window drawing is in a child thread.
+    // There is a child thread per window. We have no CriticalSection or Mutex
+    // since we write the data and the other thread displays the data. While
+    // we may miss some data for a short period of time this is no different than
+    // a write combining on writes to a frame buffer.
+    //
+
+    Private->WinNtThunk->UpdateWindow (Private->WindowHandle);
+  }
+
+  gBS->RestoreTPL (OriginalTPL);
+
+  return EFI_SUCCESS;
+}
+
+//
+// Construction and Destruction functions
+//
+
+
+/**
+
+
+  @return None
+
+**/
+// TODO:    WinNtIo - add argument and description to function comment
+// TODO:    EFI_UNSUPPORTED - add return value to function comment
+// TODO:    EFI_SUCCESS - add return value to function comment
+EFI_STATUS
+WinNtGopSupported (
+  IN  EFI_WIN_NT_IO_PROTOCOL  *WinNtIo
+  )
+{
+  //
+  // Check to see if the IO abstraction represents a device type we support.
+  //
+  // This would be replaced a check of PCI subsystem ID, etc.
+  //
+  if (!CompareGuid (WinNtIo->TypeGuid, &gEfiWinNtGopGuid)) {
+    return EFI_UNSUPPORTED;
+  }
+
+  return EFI_SUCCESS;
+}
+
+
+/**
+  Win32 Windows event handler.
+
+  See Win32 Book
+
+  @return See Win32 Book
+
+**/
+// TODO:    hwnd - add argument and description to function comment
+// TODO:    iMsg - add argument and description to function comment
+// TODO:    wParam - add argument and description to function comment
+// TODO:    lParam - add argument and description to function comment
+LRESULT
+CALLBACK
+WinNtGopThreadWindowProc (
+  IN  HWND    hwnd,
+  IN  UINT    iMsg,
+  IN  WPARAM  wParam,
+  IN  LPARAM  lParam
+  )
+{
+  GOP_PRIVATE_DATA  *Private;
+  UINTN             Size;
+  HDC               Handle;
+  PAINTSTRUCT       PaintStruct;
+  LPARAM            Index;
+  EFI_INPUT_KEY     Key;
+
+  //
+  // BugBug - if there are two instances of this DLL in memory (such as is
+  // the case for ERM), the correct instance of this function may not be called.
+  // This also means that the address of the mTlsIndex value will be wrong, and
+  // the value may be wrong too.
+  //
+
+
+  //
+  // Use mTlsIndex global to get a Thread Local Storage version of Private.
+  // This works since each Gop protocol has a unique Private data instance and
+  // a unique thread.
+  //
+  Private = mWinNt->TlsGetValue (mTlsIndex);
+  ASSERT (NULL != Private);
+
+  switch (iMsg) {
+  case WM_CREATE:
+    Size = Private->GraphicsOutput.Mode->Info->HorizontalResolution * Private->GraphicsOutput.Mode->Info->VerticalResolution * sizeof (RGBQUAD);
+
+    //
+    // Allocate DIB frame buffer directly from NT for performance enhancement
+    // This buffer is the virtual screen/frame buffer. This buffer is not the
+    // same a a frame buffer. The first fow of this buffer will be the bottom
+    // line of the image. This is an artifact of the way we draw to the screen.
+    //
+    Private->VirtualScreenInfo = Private->WinNtThunk->HeapAlloc (
+                                                        Private->WinNtThunk->GetProcessHeap (),
+                                                        HEAP_ZERO_MEMORY,
+                                                        Size
+                                                        );
+
+    Private->VirtualScreenInfo->bV4Size           = sizeof (BITMAPV4HEADER);
+    Private->VirtualScreenInfo->bV4Width          = Private->GraphicsOutput.Mode->Info->HorizontalResolution;
+    Private->VirtualScreenInfo->bV4Height         = Private->GraphicsOutput.Mode->Info->VerticalResolution;
+    Private->VirtualScreenInfo->bV4Planes         = 1;
+    Private->VirtualScreenInfo->bV4BitCount       = 32;
+    //
+    // uncompressed
+    //
+    Private->VirtualScreenInfo->bV4V4Compression  = BI_RGB;
+    Private->VirtualScreen = (RGBQUAD *) (Private->VirtualScreenInfo + 1);
+    return 0;
+
+  case WM_PAINT:
+    //
+    // I have not found a way to convert hwnd into a Private context. So for
+    // now we use this API to convert hwnd to Private data.
+    //
+
+    Handle = mWinNt->BeginPaint (hwnd, &PaintStruct);
+
+    mWinNt->SetDIBitsToDevice (
+              Handle,                                     // Destination Device Context
+              0,                                          // Destination X - 0
+              0,                                          // Destination Y - 0
+              Private->GraphicsOutput.Mode->Info->HorizontalResolution,              // Width
+              Private->GraphicsOutput.Mode->Info->VerticalResolution,                // Height
+              0,                                          // Source X
+              0,                                          // Source Y
+              0,                                          // DIB Start Scan Line
+              Private->GraphicsOutput.Mode->Info->VerticalResolution,                // Number of scan lines
+              Private->VirtualScreen,                     // Address of array of DIB bits
+              (BITMAPINFO *) Private->VirtualScreenInfo,  // Address of structure with bitmap info
+              DIB_RGB_COLORS                              // RGB or palette indexes
+              );
+
+    mWinNt->EndPaint (hwnd, &PaintStruct);
+    return 0;
+
+  //
+  // F10 and the ALT key do not create a WM_KEYDOWN message, thus this special case
+  //
+  case WM_SYSKEYDOWN:
+    Key.ScanCode = 0;
+    switch (wParam) {
+    case VK_F10:
+      Key.ScanCode    = SCAN_F10;
+      Key.UnicodeChar = 0;
+      GopPrivateAddQ (Private, Key);
+      return 0;
+    }
+    break;
+
+  case WM_KEYDOWN:
+    Key.ScanCode = 0;
+    switch (wParam) {
+    case VK_HOME:       Key.ScanCode = SCAN_HOME;       break;
+    case VK_END:        Key.ScanCode = SCAN_END;        break;
+    case VK_LEFT:       Key.ScanCode = SCAN_LEFT;       break;
+    case VK_RIGHT:      Key.ScanCode = SCAN_RIGHT;      break;
+    case VK_UP:         Key.ScanCode = SCAN_UP;         break;
+    case VK_DOWN:       Key.ScanCode = SCAN_DOWN;       break;
+    case VK_DELETE:     Key.ScanCode = SCAN_DELETE;     break;
+    case VK_INSERT:     Key.ScanCode = SCAN_INSERT;     break;
+    case VK_PRIOR:      Key.ScanCode = SCAN_PAGE_UP;    break;
+    case VK_NEXT:       Key.ScanCode = SCAN_PAGE_DOWN;  break;
+    case VK_ESCAPE:     Key.ScanCode = SCAN_ESC;        break;
+
+    case VK_F1:   Key.ScanCode = SCAN_F1;   break;
+    case VK_F2:   Key.ScanCode = SCAN_F2;   break;
+    case VK_F3:   Key.ScanCode = SCAN_F3;   break;
+    case VK_F4:   Key.ScanCode = SCAN_F4;   break;
+    case VK_F5:   Key.ScanCode = SCAN_F5;   break;
+    case VK_F6:   Key.ScanCode = SCAN_F6;   break;
+    case VK_F7:   Key.ScanCode = SCAN_F7;   break;
+    case VK_F8:   Key.ScanCode = SCAN_F8;   break;
+    case VK_F9:   Key.ScanCode = SCAN_F9;   break;
+    }
+
+    if (Key.ScanCode != 0) {
+      Key.UnicodeChar = 0;
+      GopPrivateAddQ (Private, Key);
+    }
+
+    return 0;
+
+  case WM_CHAR:
+    //
+    // The ESC key also generate WM_CHAR.
+    //
+    if (wParam == 0x1B) {
+      return 0;
+    }
+
+    for (Index = 0; Index < (lParam & 0xffff); Index++) {
+      if (wParam != 0) {
+        Key.UnicodeChar = (CHAR16) wParam;
+        Key.ScanCode    = 0;
+        GopPrivateAddQ (Private, Key);
+      }
+    }
+
+    return 0;
+
+  case WM_CLOSE:
+    //
+    // This close message is issued by user, core is not aware of this,
+    // so don't release the window display resource, just hide the window.
+    //
+    Private->WinNtThunk->ShowWindow (Private->WindowHandle, SW_HIDE);
+    return 0;
+
+  case WM_DESTROY:
+    mWinNt->DestroyWindow (hwnd);
+    mWinNt->PostQuitMessage (0);
+
+    mWinNt->HeapFree (Private->WinNtThunk->GetProcessHeap (), 0, Private->VirtualScreenInfo);
+
+    mWinNt->ExitThread (0);
+    return 0;
+
+  default:
+    break;
+  };
+
+  return mWinNt->DefWindowProc (hwnd, iMsg, wParam, lParam);
+}
+
+
+/**
+  This thread simulates the end of WinMain () aplication. Each Winow nededs
+  to process it's events. The messages are dispatched to
+  WinNtGopThreadWindowProc ().
+  Be very careful sine WinNtGopThreadWinMain () and WinNtGopThreadWindowProc ()
+  are running in a seperate thread. We have to do this to process the events.
+
+  @param  lpParameter            Handle of window to manage.
+
+  @return if a WM_QUIT message is returned exit.
+
+**/
+DWORD
+WINAPI
+WinNtGopThreadWinMain (
+  LPVOID    lpParameter
+  )
+{
+  MSG               Message;
+  GOP_PRIVATE_DATA  *Private;
+  ATOM              Atom;
+  RECT              Rect;
+
+  Private = (GOP_PRIVATE_DATA *) lpParameter;
+  ASSERT (NULL != Private);
+
+  //
+  // Since each thread has unique private data, save the private data in Thread
+  // Local Storage slot. Then the shared global mTlsIndex can be used to get
+  // thread specific context.
+  //
+  Private->WinNtThunk->TlsSetValue (mTlsIndex, Private);
+
+  Private->ThreadId                   = Private->WinNtThunk->GetCurrentThreadId ();
+
+  Private->WindowsClass.cbSize        = sizeof (WNDCLASSEX);
+  Private->WindowsClass.style         = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
+  Private->WindowsClass.lpfnWndProc   = WinNtGopThreadWindowProc;
+  Private->WindowsClass.cbClsExtra    = 0;
+  Private->WindowsClass.cbWndExtra    = 0;
+  Private->WindowsClass.hInstance     = NULL;
+  Private->WindowsClass.hIcon         = Private->WinNtThunk->LoadIcon (NULL, IDI_APPLICATION);
+  Private->WindowsClass.hCursor       = Private->WinNtThunk->LoadCursor (NULL, IDC_ARROW);
+  Private->WindowsClass.hbrBackground = (HBRUSH) COLOR_WINDOW;
+  Private->WindowsClass.lpszMenuName  = NULL;
+  Private->WindowsClass.lpszClassName = WIN_NT_GOP_CLASS_NAME;
+  Private->WindowsClass.hIconSm       = Private->WinNtThunk->LoadIcon (NULL, IDI_APPLICATION);
+
+  //
+  // This call will fail after the first time, but thats O.K. since we only need
+  // WIN_NT_GOP_CLASS_NAME to exist to create the window.
+  //
+  // Note: Multiple instances of this DLL will use the same instance of this
+  // Class, including the callback function, unless the Class is unregistered and
+  // successfully registered again.
+  //
+  Atom = Private->WinNtThunk->RegisterClassEx (&Private->WindowsClass);
+
+  //
+  // Setting Rect values to allow for the AdjustWindowRect to provide
+  // us the correct sizes for the client area when doing the CreateWindowEx
+  //
+  Rect.top    = 0;
+  Rect.bottom = Private->GraphicsOutput.Mode->Info->VerticalResolution;
+  Rect.left   = 0;
+  Rect.right  = Private->GraphicsOutput.Mode->Info->HorizontalResolution;
+
+  Private->WinNtThunk->AdjustWindowRect (&Rect, WS_OVERLAPPEDWINDOW, 0);
+
+  Private->WindowHandle = Private->WinNtThunk->CreateWindowEx (
+                                                0,
+                                                WIN_NT_GOP_CLASS_NAME,
+                                                Private->WindowName,
+                                                WS_OVERLAPPEDWINDOW,
+                                                CW_USEDEFAULT,
+                                                CW_USEDEFAULT,
+                                                Rect.right - Rect.left,
+                                                Rect.bottom - Rect.top,
+                                                NULL,
+                                                NULL,
+                                                NULL,
+                                                &Private
+                                                );
+
+  //
+  // The reset of this thread is the standard winows program. We need a sperate
+  // thread since we must process the message loop to make windows act like
+  // windows.
+  //
+
+  Private->WinNtThunk->ShowWindow (Private->WindowHandle, SW_SHOW);
+  Private->WinNtThunk->UpdateWindow (Private->WindowHandle);
+
+  //
+  // Let the main thread get some work done
+  //
+  Private->WinNtThunk->ReleaseSemaphore (Private->ThreadInited, 1, NULL);
+
+  //
+  // This is the message loop that all Windows programs need.
+  //
+  while (Private->WinNtThunk->GetMessage (&Message, Private->WindowHandle, 0, 0)) {
+    Private->WinNtThunk->TranslateMessage (&Message);
+    Private->WinNtThunk->DispatchMessage (&Message);
+  }
+
+  return Message.wParam;
+}
+
+
+/**
+  TODO: Add function description
+
+  @param  Private                TODO: add argument description
+  @param  HorizontalResolution   TODO: add argument description
+  @param  VerticalResolution     TODO: add argument description
+  @param  ColorDepth             TODO: add argument description
+  @param  RefreshRate            TODO: add argument description
+
+  @return TODO: add return values
+
+**/
+EFI_STATUS
+WinNtGopStartWindow (
+  IN  GOP_PRIVATE_DATA    *Private,
+  IN  UINT32              HorizontalResolution,
+  IN  UINT32              VerticalResolution,
+  IN  UINT32              ColorDepth,
+  IN  UINT32              RefreshRate
+  )
+{
+  EFI_STATUS          Status;
+  DWORD               NewThreadId;
+
+  mWinNt  = Private->WinNtThunk;
+
+  //
+  // Initialize a Thread Local Storge variable slot. We use TLS to get the
+  // correct Private data instance into the windows thread.
+  //
+  if (mTlsIndex == TLS_OUT_OF_INDEXES) {
+    ASSERT (0 == mTlsIndexUseCount);
+    mTlsIndex = Private->WinNtThunk->TlsAlloc ();
+  }
+
+  //
+  // always increase the use count!
+  //
+  mTlsIndexUseCount++;
+
+  //
+  // Register to be notified on exit boot services so we can destroy the window.
+  //
+  Status = gBS->CreateEvent (
+                  EVENT_SIGNAL_EXIT_BOOT_SERVICES,
+                  TPL_CALLBACK,
+                  KillNtGopThread,
+                  Private,
+                  &mGopScreenExitBootServicesEvent
+                  );
+
+  Private->ThreadInited = Private->WinNtThunk->CreateSemaphore (NULL, 0, 1, NULL);
+  Private->ThreadHandle = Private->WinNtThunk->CreateThread (
+                                                NULL,
+                                                0,
+                                                WinNtGopThreadWinMain,
+                                                (VOID *) Private,
+                                                0,
+                                                &NewThreadId
+                                                );
+
+  //
+  // The other thread has entered the windows message loop so we can
+  // continue our initialization.
+  //
+  Private->WinNtThunk->WaitForSingleObject (Private->ThreadInited, INFINITE);
+  Private->WinNtThunk->CloseHandle (Private->ThreadInited);
+
+  return Status;
+}
+
+
+/**
+
+
+  @return None
+
+**/
+// TODO:    Private - add argument and description to function comment
+// TODO:    EFI_SUCCESS - add return value to function comment
+EFI_STATUS
+WinNtGopConstructor (
+  GOP_PRIVATE_DATA    *Private
+  )
+{
+  EFI_STATUS                             Status;
+
+  Private->ModeData = mGopModeData;
+
+  Private->GraphicsOutput.QueryMode = WinNtGopQuerytMode;
+  Private->GraphicsOutput.SetMode = WinNtGopSetMode;
+  Private->GraphicsOutput.Blt            = WinNtGopBlt;
+
+  //
+  // Allocate buffer for Graphics Output Protocol mode information
+  //
+  Status = gBS->AllocatePool (
+                EfiBootServicesData,
+                sizeof (EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE),
+                (VOID **) &Private->GraphicsOutput.Mode
+                );
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
+  Status = gBS->AllocatePool (
+                EfiBootServicesData,
+                sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION),
+                (VOID **) &Private->GraphicsOutput.Mode->Info
+                );
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
+  Private->GraphicsOutput.Mode->MaxMode = sizeof(mGopModeData) / sizeof(GOP_MODE_DATA);
+  //
+  // Till now, we have no idea about the window size.
+  //
+  Private->GraphicsOutput.Mode->Mode = GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER;
+  Private->GraphicsOutput.Mode->Info->Version = 0;
+  Private->GraphicsOutput.Mode->Info->HorizontalResolution = 0;
+  Private->GraphicsOutput.Mode->Info->VerticalResolution = 0;
+  Private->GraphicsOutput.Mode->Info->PixelFormat = PixelBlueGreenRedReserved8BitPerColor;
+  Private->GraphicsOutput.Mode->SizeOfInfo = sizeof (EFI_GRAPHICS_OUTPUT_MODE_INFORMATION);
+  Private->GraphicsOutput.Mode->FrameBufferBase = (EFI_PHYSICAL_ADDRESS) NULL;
+  Private->GraphicsOutput.Mode->FrameBufferSize = 0;
+
+  Private->HardwareNeedsStarting  = TRUE;
+  Private->FillLine               = NULL;
+
+  WinNtGopInitializeSimpleTextInForWindow (Private);
+
+  return EFI_SUCCESS;
+}
+
+
+/**
+
+
+  @return None
+
+**/
+// TODO:    Private - add argument and description to function comment
+// TODO:    EFI_SUCCESS - add return value to function comment
+EFI_STATUS
+WinNtGopDestructor (
+  GOP_PRIVATE_DATA     *Private
+  )
+{
+  UINT32  UnregisterReturn;
+
+  if (!Private->HardwareNeedsStarting) {
+    //
+    // BugBug: Shutdown GOP Hardware and any child devices.
+    //
+    Private->WinNtThunk->SendMessage (Private->WindowHandle, WM_DESTROY, 0, 0);
+    Private->WinNtThunk->CloseHandle (Private->ThreadHandle);
+
+    mTlsIndexUseCount--;
+
+    //
+    // The callback function for another window could still be called,
+    // so we need to make sure there are no more users of mTlsIndex.
+    //
+    if (0 == mTlsIndexUseCount) {
+      ASSERT (TLS_OUT_OF_INDEXES != mTlsIndex);
+
+      Private->WinNtThunk->TlsFree (mTlsIndex);
+      mTlsIndex = TLS_OUT_OF_INDEXES;
+
+      UnregisterReturn = Private->WinNtThunk->UnregisterClass (
+                                                Private->WindowsClass.lpszClassName,
+                                                Private->WindowsClass.hInstance
+                                                );
+    }
+
+    WinNtGopDestroySimpleTextInForWindow (Private);
+  }
+
+  //
+  // Free graphics output protocol occupied resource
+  //
+  if (Private->GraphicsOutput.Mode != NULL) {
+    if (Private->GraphicsOutput.Mode->Info != NULL) {
+        gBS->FreePool (Private->GraphicsOutput.Mode->Info);
+    }
+    gBS->FreePool (Private->GraphicsOutput.Mode);
+  }
+
+  return EFI_SUCCESS;
+}
+
+
+/**
+  This is the GOP screen's callback notification function for exit-boot-services.
+  All we do here is call WinNtGopDestructor().
+
+  @param  Event                  not used
+  @param  Context                pointer to the Private structure.
+
+  @return None.
+
+**/
+STATIC
+VOID
+EFIAPI
+KillNtGopThread (
+  IN EFI_EVENT  Event,
+  IN VOID       *Context
+  )
+{
+  EFI_STATUS  Status;
+  Status = WinNtGopDestructor (Context);
+}
index d591151c141a3cafeff58b63fa10b1d0b6a2f611..4ce5286c7f8018322295f1ab29093ac8d1117bb6 100644 (file)
@@ -128,6 +128,9 @@ EFI_DRIVER_BINDING_PROTOCOL           gWinNtBusDriverBinding = {
 static NT_PCD_ENTRY  mPcdEnvironment[] = {\r
   PcdToken(PcdWinNtConsole),       &gEfiWinNtConsoleGuid,\r
   PcdToken(PcdWinNtUga),           &gEfiWinNtUgaGuid,\r
+#if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
+  PcdToken(PcdWinNtGop),           &gEfiWinNtGopGuid,\r
+#endif\r
   PcdToken(PcdWinNtSerialPort),    &gEfiWinNtSerialPortGuid,\r
   PcdToken(PcdWinNtFileSystem),    &gEfiWinNtFileSystemGuid,\r
   PcdToken(PcdWinNtVirtualDisk),   &gEfiWinNtVirtualDisksGuid,\r
index bcb63a1b1f5875660809aefe072018b360c6e282..fb5615dda253b72e337df49cc60135a9197db2c4 100644 (file)
@@ -97,6 +97,9 @@
     <GuidCNames Usage="ALWAYS_CONSUMED">\r
       <GuidCName>gEfiWinNtUgaGuid</GuidCName>\r
     </GuidCNames>\r
+    <GuidCNames Usage="ALWAYS_CONSUMED">\r
+      <GuidCName>gEfiWinNtGopGuid</GuidCName>\r
+    </GuidCNames>\r
     <GuidCNames Usage="ALWAYS_CONSUMED">\r
       <GuidCName>gEfiWinNtConsoleGuid</GuidCName>\r
     </GuidCNames>\r
       <HelpText>This PCD declares the resolutions for the UGA windows.\r
         The item type of this PCD can only be "DYNAMIC".</HelpText>\r
     </PcdEntry>\r
+    <PcdEntry PcdItemType="DYNAMIC">\r
+      <C_Name>PcdWinNtGop</C_Name>\r
+      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+      <HelpText>This PCD declares the resolutions for the GOP windows.\r
+        The item type of this PCD can only be "DYNAMIC".</HelpText>\r
+    </PcdEntry>\r
     <PcdEntry PcdItemType="DYNAMIC">\r
       <C_Name>PcdWinNtSerialPort</C_Name>\r
       <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>\r
index 140352663ac18d48765a8b0f0a05766eaf2619da..70927a5abc0d643aa47e6ccf4bce6720af434364 100644 (file)
@@ -97,6 +97,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     <Filename>Dxe/WinNtThunk/Bus/SerialIo/WinNtSerialIo.msa</Filename>\r
     <Filename>Dxe/WinNtThunk/Bus/SimpleFileSystem/WinNtSimpleFileSystem.msa</Filename>\r
     <Filename>Dxe/WinNtThunk/Bus/Uga/WinNtUga.msa</Filename>\r
+    <Filename>Dxe/WinNtThunk/Bus/Gop/WinNtGop.msa</Filename>\r
     <Filename>Dxe/WinNtThunk/Bus/WinNtBusDriver/WinNtBusDriver.msa</Filename>\r
     <Filename>Dxe/WinNtThunk/Chipset/Metronome/Metronome.msa</Filename>\r
     <Filename>Dxe/WinNtThunk/Chipset/RealTimeClock/RealTimeClock.msa</Filename>\r
@@ -155,6 +156,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
       <GuidValue>0C95A93D-A006-11D4-BCFA-0080C73C8881</GuidValue>\r
       <HelpText/>\r
     </Entry>\r
+    <Entry Name="WinNtGop">\r
+      <C_Name>gEfiWinNtGopGuid</C_Name>\r
+      <GuidValue>4e11e955-ccca-11d4-bd0d-0080c73c8881</GuidValue>\r
+      <HelpText/>\r
+    </Entry>\r
     <Entry Name="WinNtUga">\r
       <C_Name>gEfiWinNtUgaGuid</C_Name>\r
       <GuidValue>AB248E99-ABE1-11D4-BD0D-0080C73C8881</GuidValue>\r
@@ -368,5 +374,15 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
       <HelpText>This PCD defines the memory size of simulated machine. Simulator will allocate\r
         the size of PcdWinNtMemorySizeForSecMain in windows platform.</HelpText>\r
     </PcdEntry>\r
+    <PcdEntry>\r
+      <C_Name>PcdWinNtGop</C_Name>\r
+      <Token>0x0000100d</Token>\r
+      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+      <DatumType>VOID*</DatumType>\r
+      <ValidUsage>DYNAMIC</ValidUsage>\r
+      <DefaultValue>L"UGA Window 1!UGA Window 2"</DefaultValue>\r
+      <HelpText>This PCD declares the resolutions for the GOP windows.\r
+        The item type of this PCD can only be "DYNAMIC".</HelpText>\r
+    </PcdEntry>\r
   </PcdDeclarations>\r
 </PackageSurfaceArea>
index f019ce1e3424cba709ef3d68e3a2643ae250efb6..1f2aaa51adfdda8589f36b1d250cbe5b0a4e413d 100644 (file)
@@ -23,6 +23,8 @@ Abstract:
 #define EFI_WIN_NT_IO_PROTOCOL_GUID \\r
   { 0x96eb4ad6, 0xa32a, 0x11d4, { 0xbc, 0xfd, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } }\r
 \r
+extern EFI_GUID gEfiWinNtIoProtocolGuid;\r
+\r
 typedef struct {\r
   EFI_WIN_NT_THUNK_PROTOCOL *WinNtThunk;\r
   EFI_GUID                  *TypeGuid;\r
@@ -30,9 +32,6 @@ typedef struct {
   UINT16                    InstanceNumber;\r
 } EFI_WIN_NT_IO_PROTOCOL;\r
 \r
-\r
-extern EFI_GUID gEfiWinNtIoProtocolGuid;\r
-\r
 //\r
 // The following GUIDs are used in EFI_WIN_NT_IO_PROTOCOL_GUID\r
 // Device paths. They map 1:1 with NT envirnment variables. The variables\r
@@ -63,10 +62,10 @@ extern EFI_GUID gEfiWinNtPhysicalDisksGuid;
 //\r
 #define EFI_WIN_NT_GOP_GUID \\r
   { \\r
-    0x9042a9de, 0x23dc, 0x4a38, {0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a } \\r
+    0x4e11e955, 0xccca, 0x11d4, {0xbd, 0x0d, 0x00, 0x80, 0xc7, 0x3c, 0x88, 0x81} \\r
   }\r
 \r
-extern EFI_GUID gEfiWinNtFileSystemGuid;\r
+extern EFI_GUID gEfiWinNtGopGuid;\r
 \r
 //\r
 // EFI_WIN_NT_FILE_SYSTEM\r
@@ -76,7 +75,7 @@ extern EFI_GUID gEfiWinNtFileSystemGuid;
     0xc95a935, 0xa006, 0x11d4, {0xbc, 0xfa, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \\r
   }\r
 \r
-extern EFI_GUID mEfiWinNtGopGuid;\r
+extern EFI_GUID gEfiWinNtFileSystemGuid;\r
 \r
 //\r
 // EFI_WIN_NT_SERIAL_PORT\r
index 05e1b2634893c4380a0a8a2fc9c1299cb08a874b..3963dbcd548a808660ae166e70aa9a30b7d0389a 100644 (file)
@@ -158,9 +158,11 @@ Returns:
     //\r
     return EFI_SUCCESS;\r
   }\r
-\r
+  //\r
+  // Signal the EFI_EVENT_SIGNAL_READY_TO_BOOT event\r
+  //\r
   EfiSignalEventReadyToBoot ();\r
-\r
+  \r
   //\r
   // Set Boot Current\r
   //\r
index de854103cb9fb3a9bab83a46986f003c89b4001f..094140f14d6a620b009d1705b323ecb9706aeae1 100644 (file)
@@ -27,6 +27,7 @@ EFI_GUID  UnknownDeviceGuid           = UNKNOWN_DEVICE_GUID;
 \r
 EFI_GUID  mEfiWinNtThunkProtocolGuid  = EFI_WIN_NT_THUNK_PROTOCOL_GUID;\r
 EFI_GUID  mEfiWinNtUgaGuid            = EFI_WIN_NT_UGA_GUID;\r
+EFI_GUID  mEfiWinNtGopGuid            = EFI_WIN_NT_GOP_GUID;\r
 EFI_GUID  mEfiWinNtSerialPortGuid     = EFI_WIN_NT_SERIAL_PORT_GUID;\r
 EFI_GUID  mEfiMsgPcAnsiGuid           = DEVICE_PATH_MESSAGING_PC_ANSI;\r
 EFI_GUID  mEfiMsgVt100Guid            = DEVICE_PATH_MESSAGING_VT_100;\r
@@ -313,6 +314,9 @@ Returns:
     } else if (CompareGuid (&Vendor->Guid, &mEfiWinNtUgaGuid)) {\r
       CatPrint (Str, L"%s", L"UGA");\r
       return ;\r
+    } else if (CompareGuid (&Vendor->Guid, &mEfiWinNtGopGuid)) {\r
+      CatPrint (Str, L"%s", L"GOP");\r
+      return ;\r
     } else if (CompareGuid (&Vendor->Guid, &mEfiWinNtSerialPortGuid)) {\r
       CatPrint (Str, L"%s", L"Serial");\r
       return ;\r
@@ -370,6 +374,139 @@ DevPathAcpi (
   }\r
 }\r
 \r
+VOID\r
+DevPathExtendedAcpi (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  ACPI_EXTENDED_HID_DEVICE_PATH   *ExtendedAcpi;\r
+  //\r
+  // Index for HID, UID and CID strings, 0 for non-exist\r
+  //\r
+  UINT16                          HIDSTRIdx;\r
+  UINT16                          UIDSTRIdx;\r
+  UINT16                          CIDSTRIdx;\r
+  UINT16                          Index;\r
+  UINT16                          Length;\r
+  UINT16                          Anchor;\r
+  CHAR8                           *AsChar8Array;\r
+\r
+  ASSERT (Str != NULL);\r
+  ASSERT (DevPath != NULL);\r
+\r
+  HIDSTRIdx    = 0;\r
+  UIDSTRIdx    = 0;\r
+  CIDSTRIdx    = 0;\r
+  ExtendedAcpi = DevPath;\r
+  Length       = DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) ExtendedAcpi);\r
+\r
+  ASSERT (Length >= 19);\r
+  AsChar8Array = (CHAR8 *) ExtendedAcpi;\r
+\r
+  //\r
+  // find HIDSTR\r
+  //\r
+  Anchor = 16;\r
+  for (Index = Anchor; Index < Length && AsChar8Array[Index]; Index++) {\r
+    ;\r
+  }\r
+  if (Index > Anchor) {\r
+    HIDSTRIdx = Anchor;\r
+  }\r
+  //\r
+  // find UIDSTR\r
+  //\r
+  Anchor = Index + 1;\r
+  for (Index = Anchor; Index < Length && AsChar8Array[Index]; Index++) {\r
+    ;\r
+  }\r
+  if (Index > Anchor) {\r
+    UIDSTRIdx = Anchor;\r
+  }\r
+  //\r
+  // find CIDSTR\r
+  //\r
+  Anchor = Index + 1;\r
+  for (Index = Anchor; Index < Length && AsChar8Array[Index]; Index++) {\r
+    ;\r
+  }\r
+  if (Index > Anchor) {\r
+    CIDSTRIdx = Anchor;\r
+  }\r
+  \r
+  if (HIDSTRIdx == 0 && CIDSTRIdx == 0 && ExtendedAcpi->UID == 0) {\r
+    CatPrint (Str, L"AcpiExp(");\r
+    if ((ExtendedAcpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {\r
+      CatPrint (Str, L"PNP%04x,", EISA_ID_TO_NUM (ExtendedAcpi->HID));\r
+    } else {\r
+      CatPrint (Str, L"%08x,", ExtendedAcpi->HID);\r
+    }\r
+    if ((ExtendedAcpi->CID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {\r
+      CatPrint (Str, L"PNP%04x,", EISA_ID_TO_NUM (ExtendedAcpi->CID));\r
+    } else {\r
+      CatPrint (Str, L"%08x,", ExtendedAcpi->CID);\r
+    }\r
+    if (UIDSTRIdx != 0) {\r
+      CatPrint (Str, L"%a)", AsChar8Array + UIDSTRIdx);\r
+    } else {\r
+      CatPrint (Str, L"\"\")");\r
+    }\r
+  } else {\r
+    CatPrint (Str, L"AcpiEx(");\r
+    if ((ExtendedAcpi->HID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {\r
+      CatPrint (Str, L"PNP%04x,", EISA_ID_TO_NUM (ExtendedAcpi->HID));\r
+    } else {\r
+      CatPrint (Str, L"%08x,", ExtendedAcpi->HID);\r
+    }\r
+    if ((ExtendedAcpi->CID & PNP_EISA_ID_MASK) == PNP_EISA_ID_CONST) {\r
+      CatPrint (Str, L"PNP%04x,", EISA_ID_TO_NUM (ExtendedAcpi->CID));\r
+    } else {\r
+      CatPrint (Str, L"%08x,", ExtendedAcpi->CID);\r
+    }\r
+    CatPrint (Str, L"%x,", ExtendedAcpi->UID);\r
+\r
+    if (HIDSTRIdx != 0) {\r
+      CatPrint (Str, L"%a,", AsChar8Array + HIDSTRIdx);\r
+    } else {\r
+      CatPrint (Str, L"\"\",");\r
+    }\r
+    if (CIDSTRIdx != 0) {\r
+      CatPrint (Str, L"%a,", AsChar8Array + CIDSTRIdx);\r
+    } else {\r
+      CatPrint (Str, L"\"\",");\r
+    }\r
+    if (UIDSTRIdx != 0) {\r
+      CatPrint (Str, L"%a)", AsChar8Array + UIDSTRIdx);\r
+    } else {\r
+      CatPrint (Str, L"\"\")");\r
+    }\r
+  }\r
+\r
+}\r
+\r
+VOID\r
+DevPathAdrAcpi (\r
+  IN OUT POOL_PRINT       *Str,\r
+  IN VOID                 *DevPath\r
+  )\r
+{\r
+  ACPI_ADR_DEVICE_PATH    *AcpiAdr;\r
+  UINT16                  Index;\r
+  UINT16                  Length;\r
+  UINT16                  AdditionalAdrCount;\r
+\r
+  AcpiAdr            = DevPath;\r
+  Length             = DevicePathNodeLength ((EFI_DEVICE_PATH_PROTOCOL *) AcpiAdr);\r
+  AdditionalAdrCount = (Length - 8) / 4;\r
+\r
+  CatPrint (Str, L"AcpiAdr(%x", AcpiAdr->ADR);\r
+  for (Index = 0; Index < AdditionalAdrCount; Index++) {\r
+    CatPrint (Str, L",%x", *(UINT32 *) ((UINT8 *) AcpiAdr + 8 + Index * 4));\r
+  }\r
+  CatPrint (Str, L")");\r
+}\r
+\r
 VOID\r
 DevPathAtapi (\r
   IN OUT POOL_PRINT       *Str,\r
@@ -783,6 +920,12 @@ DEVICE_PATH_STRING_TABLE  DevPathTable[] = {
   ACPI_DEVICE_PATH,\r
   ACPI_DP,\r
   DevPathAcpi,\r
+  ACPI_DEVICE_PATH,\r
+  ACPI_EXTENDED_DP,\r
+  DevPathExtendedAcpi,\r
+  ACPI_DEVICE_PATH,\r
+  ACPI_ADR_DP,\r
+  DevPathAdrAcpi,\r
   MESSAGING_DEVICE_PATH,\r
   MSG_ATAPI_DP,\r
   DevPathAtapi,\r
index f038ccaa229d6181a99f4c566ed960ac8b7d1579..f4a656319198dc3fb2903f760fc1d2d6103551ce 100644 (file)
           <MaxDatumSize>50</MaxDatumSize>\r
           <Value>L"UGA Window 1!UGA Window 2"</Value>\r
         </PcdData>\r
+        <PcdData ItemType="DYNAMIC">\r
+          <C_Name>PcdWinNtGop</C_Name>\r
+          <Token>0x0000100d</Token>\r
+          <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+          <DatumType>VOID*</DatumType>\r
+          <MaxDatumSize>50</MaxDatumSize>\r
+          <Value>L"GOP Window 1!GOP Window 2"</Value>\r
+        </PcdData>\r
         <PcdData ItemType="DYNAMIC">\r
           <C_Name>PcdWinNtSerialPort</C_Name>\r
           <Token>0x00001002</Token>\r
         <FfsFormatKey>BS_DRIVER</FfsFormatKey>\r
       </ModuleSaBuildOptions>\r
     </ModuleSA>\r
-    <ModuleSA SupArchList="IA32" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" ModuleGuid="AB248E8D-ABE1-11d4-BD0D-0080C73C8881">\r
+    <ModuleSA SupArchList="IA32" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" ModuleGuid="4A9B9DB8-EC62-4A92-818F-8AA0246D246E">\r
       <Libraries>\r
         <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+        <Instance ModuleGuid="1e2c4c2e-67e6-4e57-b3ae-cf5a5af72c2c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
-        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
-        <Instance ModuleGuid="b57a1df6-ffdb-4247-a3df-3a562176751a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
-        <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+        <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
       </Libraries>\r
       <PcdBuildDefinition>\r
         <PcdData ItemType="FIXED_AT_BUILD">\r
           <MaxDatumSize>4</MaxDatumSize>\r
           <Value>10000000</Value>\r
         </PcdData>\r
+        <PcdData ItemType="FIXED_AT_BUILD">\r
+          <C_Name>PcdReportStatusCodePropertyMask</C_Name>\r
+          <Token>0x00000007</Token>\r
+          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+          <DatumType>UINT8</DatumType>\r
+          <MaxDatumSize>1</MaxDatumSize>\r
+          <Value>0x06</Value>\r
+        </PcdData>\r
         <PcdData ItemType="FIXED_AT_BUILD">\r
           <C_Name>PcdDebugPropertyMask</C_Name>\r
           <Token>0x00000005</Token>\r
           <MaxDatumSize>4</MaxDatumSize>\r
           <Value>0x80000000</Value>\r
         </PcdData>\r
-        <PcdData ItemType="FEATURE_FLAG">\r
-          <C_Name>PcdComponentNameDisable</C_Name>\r
-          <Token>0x0000000d</Token>\r
-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
-          <DatumType>BOOLEAN</DatumType>\r
-          <MaxDatumSize>1</MaxDatumSize>\r
-          <Value>FALSE</Value>\r
-        </PcdData>\r
-        <PcdData ItemType="FEATURE_FLAG">\r
-          <C_Name>PcdDriverDiagnosticsDisable</C_Name>\r
-          <Token>0x0000000e</Token>\r
-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
-          <DatumType>BOOLEAN</DatumType>\r
-          <MaxDatumSize>1</MaxDatumSize>\r
-          <Value>FALSE</Value>\r
-        </PcdData>\r
       </PcdBuildDefinition>\r
       <ModuleSaBuildOptions>\r
         <FvBinding>FV_RECOVERY</FvBinding>\r
         <FfsFormatKey>BS_DRIVER</FfsFormatKey>\r
       </ModuleSaBuildOptions>\r
     </ModuleSA>\r
-    <ModuleSA SupArchList="IA32" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" ModuleGuid="4A9B9DB8-EC62-4A92-818F-8AA0246D246E">\r
+    <ModuleSA SupArchList="IA32" PackageGuid="d4266a1b-1d38-4116-93ae-60dc3e2012a6" ModuleGuid="c57ad6b7-0515-40a8-9d21-551652854e37">\r
+      <ModuleSaBuildOptions>\r
+        <FvBinding>FV_RECOVERY</FvBinding>\r
+        <FfsFormatKey>APPLICATION</FfsFormatKey>\r
+      </ModuleSaBuildOptions>\r
+    </ModuleSA>\r
+    <ModuleSA SupArchList="IA32" PackageGuid="0fd7197b-9bde-44fe-a7e4-d2177a9922e5" ModuleGuid="961578FE-B6B7-44c3-AF35-6BC705CD2B1F">\r
+      <ModuleSaBuildOptions>\r
+        <FvBinding>FV_RECOVERY</FvBinding>\r
+        <FfsFormatKey>BS_DRIVER</FfsFormatKey>\r
+      </ModuleSaBuildOptions>\r
+    </ModuleSA>\r
+    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="6987936E-ED34-44db-AE97-1FA5E4ED2116">\r
       <Libraries>\r
         <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
-        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
-        <Instance ModuleGuid="1e2c4c2e-67e6-4e57-b3ae-cf5a5af72c2c" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
-        <Instance ModuleGuid="3ddc3b12-99ea-4364-b315-6310a2050be5" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
-        <Instance ModuleGuid="bda39d3a-451b-4350-8266-81ab10fa0523" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
-        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
-        <Instance ModuleGuid="91c1677a-e57f-4191-8b8e-eb7711a716e0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+        <Instance ModuleGuid="b57a1df6-ffdb-4247-a3df-3a562176751a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+        <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+        <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
       </Libraries>\r
       <PcdBuildDefinition>\r
         <PcdData ItemType="FIXED_AT_BUILD">\r
           <MaxDatumSize>4</MaxDatumSize>\r
           <Value>10000000</Value>\r
         </PcdData>\r
-        <PcdData ItemType="FIXED_AT_BUILD">\r
-          <C_Name>PcdReportStatusCodePropertyMask</C_Name>\r
-          <Token>0x00000007</Token>\r
-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
-          <DatumType>UINT8</DatumType>\r
-          <MaxDatumSize>1</MaxDatumSize>\r
-          <Value>0x06</Value>\r
-        </PcdData>\r
         <PcdData ItemType="FIXED_AT_BUILD">\r
           <C_Name>PcdDebugPropertyMask</C_Name>\r
           <Token>0x00000005</Token>\r
           <Value>0x80000000</Value>\r
         </PcdData>\r
       </PcdBuildDefinition>\r
-      <ModuleSaBuildOptions>\r
-        <FvBinding>FV_RECOVERY</FvBinding>\r
-        <FfsFormatKey>BS_DRIVER</FfsFormatKey>\r
-      </ModuleSaBuildOptions>\r
-    </ModuleSA>\r
-    <ModuleSA SupArchList="IA32" PackageGuid="d4266a1b-1d38-4116-93ae-60dc3e2012a6" ModuleGuid="c57ad6b7-0515-40a8-9d21-551652854e37">\r
       <ModuleSaBuildOptions>\r
         <FvBinding>FV_RECOVERY</FvBinding>\r
         <FfsFormatKey>APPLICATION</FfsFormatKey>\r
       </ModuleSaBuildOptions>\r
     </ModuleSA>\r
-    <ModuleSA SupArchList="IA32" PackageGuid="0fd7197b-9bde-44fe-a7e4-d2177a9922e5" ModuleGuid="961578FE-B6B7-44c3-AF35-6BC705CD2B1F">\r
+    <!--Mod: WinNtGop Type: DXE_DRIVER Path: EdkNt32Pkg\Dxe\WinNtThunk\Bus\Gop\WinNtGop.msa-->\r
+    <ModuleSA ModuleGuid="29b3c4c6-e5aa-49e4-8ce0-2772f782ddc2" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" SupArchList="IA32">\r
+      <Libraries>\r
+        <!--Pkg: MdePkg Mod: UefiLib Path: MdePkg\Library\UefiLib\UefiLib.msa-->\r
+        <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>\r
+        <!--Pkg: MdePkg Mod: BaseLib Path: MdePkg\Library\BaseLib\BaseLib.msa-->\r
+        <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>\r
+        <!--Pkg: MdePkg Mod: DxeMemoryAllocationLib Path: MdePkg\Library\DxeMemoryAllocationLib\DxeMemoryAllocationLib.msa-->\r
+        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>\r
+        <!--Pkg: MdePkg Mod: BaseDebugLibNull Path: MdePkg\Library\BaseDebugLibNull\BaseDebugLibNull.msa-->\r
+        <Instance ModuleGuid="9ba1d976-0624-41a3-8650-28165e8d9ae8" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>\r
+        <!--Pkg: MdePkg Mod: UefiBootServicesTableLib Path: MdePkg\Library\UefiBootServicesTableLib\UefiBootServicesTableLib.msa-->\r
+        <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>\r
+        <!--Pkg: MdePkg Mod: BaseMemoryLib Path: MdePkg\Library\BaseMemoryLib\BaseMemoryLib.msa-->\r
+        <Instance ModuleGuid="fd44e603-002a-4b29-9f5f-529e815b6165" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>\r
+        <!--Pkg: MdePkg Mod: BasePcdLibNull Path: MdePkg\Library\BasePcdLibNull\BasePcdLibNull.msa-->\r
+        <Instance ModuleGuid="40096a3a-5c2a-4fbc-aef7-5475dd7ab334" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>\r
+        <!--Pkg: EdkNt32Pkg Mod: Nt32TimerLib Path: EdkNt32Pkg\Library\Nt32TimerLibNull\Nt32TimerLib.msa-->\r
+        <Instance ModuleGuid="3813bb9b-808b-4dcb-b9a3-ea47bd9324c0" ModuleVersion="1.0" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" PackageVersion="0.3"/>\r
+        <!--Pkg: MdePkg Mod: BasePrintLib Path: MdePkg\Library\BasePrintLib\BasePrintLib.msa-->\r
+        <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>\r
+        <!--Pkg: MdePkg Mod: UefiDriverEntryPoint Path: MdePkg\Library\UefiDriverEntryPoint\UefiDriverEntryPoint.msa-->\r
+        <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>\r
+        <!--Pkg: MdePkg Mod: UefiDriverModelLib Path: MdePkg\Library\UefiDriverModelLib\UefiDriverModelLib.msa-->\r
+        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>\r
+        <!--Pkg: MdePkg Mod: UefiRuntimeServicesTableLib Path: MdePkg\Library\UefiRuntimeServicesTableLib\UefiRuntimeServicesTableLib.msa-->\r
+        <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3"/>\r
+      </Libraries>\r
+      <PcdBuildDefinition>\r
+        <PcdData ItemType="FIXED_AT_BUILD">\r
+          <C_Name>PcdMaximumUnicodeStringLength</C_Name>\r
+          <Token>0x00000001</Token>\r
+          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+          <DatumType>UINT32</DatumType>\r
+          <MaxDatumSize>4</MaxDatumSize>\r
+          <Value>1000000</Value>\r
+        </PcdData>\r
+        <PcdData ItemType="FIXED_AT_BUILD">\r
+          <C_Name>PcdMaximumAsciiStringLength</C_Name>\r
+          <Token>0x00000002</Token>\r
+          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+          <DatumType>UINT32</DatumType>\r
+          <MaxDatumSize>4</MaxDatumSize>\r
+          <Value>1000000</Value>\r
+        </PcdData>\r
+        <PcdData ItemType="FIXED_AT_BUILD">\r
+          <C_Name>PcdMaximumLinkedListLength</C_Name>\r
+          <Token>0x00000003</Token>\r
+          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+          <DatumType>UINT32</DatumType>\r
+          <MaxDatumSize>4</MaxDatumSize>\r
+          <Value>1000000</Value>\r
+        </PcdData>\r
+        <PcdData ItemType="FIXED_AT_BUILD">\r
+          <C_Name>PcdSpinLockTimeout</C_Name>\r
+          <Token>0x00000004</Token>\r
+          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+          <DatumType>UINT32</DatumType>\r
+          <MaxDatumSize>4</MaxDatumSize>\r
+          <Value>10000000</Value>\r
+        </PcdData>\r
+        <PcdData ItemType="FIXED_AT_BUILD">\r
+          <C_Name>PcdDebugPropertyMask</C_Name>\r
+          <Token>0x00000005</Token>\r
+          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+          <DatumType>UINT8</DatumType>\r
+          <MaxDatumSize>1</MaxDatumSize>\r
+          <Value>0x0f</Value>\r
+        </PcdData>\r
+        <PcdData ItemType="FIXED_AT_BUILD">\r
+          <C_Name>PcdDebugClearMemoryValue</C_Name>\r
+          <Token>0x00000008</Token>\r
+          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+          <DatumType>UINT8</DatumType>\r
+          <MaxDatumSize>1</MaxDatumSize>\r
+          <Value>0xAF</Value>\r
+        </PcdData>\r
+        <PcdData ItemType="FIXED_AT_BUILD">\r
+          <C_Name>PcdDebugPrintErrorLevel</C_Name>\r
+          <Token>0x00000006</Token>\r
+          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+          <DatumType>UINT32</DatumType>\r
+          <MaxDatumSize>4</MaxDatumSize>\r
+          <Value>0x80000000</Value>\r
+        </PcdData>\r
+        <PcdData ItemType="FEATURE_FLAG">\r
+          <C_Name>PcdComponentNameDisable</C_Name>\r
+          <Token>0x0000000d</Token>\r
+          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+          <DatumType>BOOLEAN</DatumType>\r
+          <MaxDatumSize>1</MaxDatumSize>\r
+          <Value>FALSE</Value>\r
+        </PcdData>\r
+        <PcdData ItemType="FEATURE_FLAG">\r
+          <C_Name>PcdDriverDiagnosticsDisable</C_Name>\r
+          <Token>0x0000000e</Token>\r
+          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+          <DatumType>BOOLEAN</DatumType>\r
+          <MaxDatumSize>1</MaxDatumSize>\r
+          <Value>FALSE</Value>\r
+        </PcdData>\r
+      </PcdBuildDefinition>\r
       <ModuleSaBuildOptions>\r
         <FvBinding>FV_RECOVERY</FvBinding>\r
         <FfsFormatKey>BS_DRIVER</FfsFormatKey>\r
       </ModuleSaBuildOptions>\r
     </ModuleSA>\r
-    <ModuleSA SupArchList="IA32" PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d" ModuleGuid="6987936E-ED34-44db-AE97-1FA5E4ED2116">\r
+    <ModuleSA SupArchList="IA32" PackageGuid="0fb2aa2d-10d5-40a5-a9dc-060c12a4a3f3" ModuleGuid="AB248E8D-ABE1-11d4-BD0D-0080C73C8881">\r
       <Libraries>\r
         <Instance ModuleGuid="ff5c7a2c-ab7a-4366-8616-11c6e53247b6" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="27d67720-ea68-48ae-93da-a3a074c90e30" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
-        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="3a004ba5-efe0-4a61-9f1a-267a46ae5ba9" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+        <Instance ModuleGuid="f1bbe03d-2f28-4dee-bec7-d98d7a30c36a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="331deb15-454b-48d8-9b74-70d01f3f3556" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+        <Instance ModuleGuid="52af22ae-9901-4484-8cdc-622dd5838b09" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="b57a1df6-ffdb-4247-a3df-3a562176751a" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
         <Instance ModuleGuid="a86fbfca-0183-4eeb-aa8a-762e3b7da1f3" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
-        <Instance ModuleGuid="19cbbb97-ff61-45ff-8c3f-dfa66dd118c8" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+        <Instance ModuleGuid="4674739d-3195-4fb2-8094-ac1d22d00194" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
       </Libraries>\r
       <PcdBuildDefinition>\r
         <PcdData ItemType="FIXED_AT_BUILD">\r
           <MaxDatumSize>4</MaxDatumSize>\r
           <Value>0x80000000</Value>\r
         </PcdData>\r
+        <PcdData ItemType="FEATURE_FLAG">\r
+          <C_Name>PcdComponentNameDisable</C_Name>\r
+          <Token>0x0000000d</Token>\r
+          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+          <DatumType>BOOLEAN</DatumType>\r
+          <MaxDatumSize>1</MaxDatumSize>\r
+          <Value>FALSE</Value>\r
+        </PcdData>\r
+        <PcdData ItemType="FEATURE_FLAG">\r
+          <C_Name>PcdDriverDiagnosticsDisable</C_Name>\r
+          <Token>0x0000000e</Token>\r
+          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+          <DatumType>BOOLEAN</DatumType>\r
+          <MaxDatumSize>1</MaxDatumSize>\r
+          <Value>FALSE</Value>\r
+        </PcdData>\r
       </PcdBuildDefinition>\r
       <ModuleSaBuildOptions>\r
-        <FvBinding>FV_RECOVERY</FvBinding>\r
-        <FfsFormatKey>APPLICATION</FfsFormatKey>\r
+        <FvBinding>NULL</FvBinding>\r
+        <FfsFormatKey>BS_DRIVER</FfsFormatKey>\r
       </ModuleSaBuildOptions>\r
     </ModuleSA>\r
   </FrameworkModules>\r
         <Value>L"UGA Window 1!UGA Window 2"</Value>\r
       </SkuInfo>\r
     </PcdBuildData>\r
+    <PcdBuildData ItemType="DYNAMIC">\r
+      <C_Name>PcdWinNtGop</C_Name>\r
+      <Token>0x0000100d</Token>\r
+      <TokenSpaceGuidCName>gEfiEdkNt32PkgTokenSpaceGuid</TokenSpaceGuidCName>\r
+      <DatumType>VOID*</DatumType>\r
+      <MaxDatumSize>50</MaxDatumSize>\r
+      <SkuInfo>\r
+        <SkuId>0</SkuId>\r
+        <Value>L"GOP Window 1!GOP Window 2"</Value>\r
+      </SkuInfo>\r
+    </PcdBuildData>\r
     <PcdBuildData ItemType="DYNAMIC">\r
       <C_Name>PcdWinNtSerialPort</C_Name>\r
       <Token>0x00001002</Token>\r