3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 Private data for the Gop driver that is bound to the WinNt Thunk protocol
23 #ifndef _WIN_NT_GOP_H_
24 #define _WIN_NT_GOP_H_
30 #include <Guid/EventGroup.h>
31 #include <Protocol/WinNtIo.h>
32 #include <Protocol/ComponentName.h>
33 #include <Protocol/SimpleTextIn.h>
34 #include <Protocol/SimpleTextInEx.h>
35 #include <Protocol/DriverBinding.h>
36 #include <Protocol/GraphicsOutput.h>
37 #include <Protocol/SimpleTextInExNotify.h>
39 #include <Library/DebugLib.h>
40 #include <Library/BaseLib.h>
41 #include <Library/UefiDriverEntryPoint.h>
42 #include <Library/UefiLib.h>
43 #include <Library/BaseMemoryLib.h>
44 #include <Library/UefiBootServicesTableLib.h>
45 #include <Library/MemoryAllocationLib.h>
48 // WM_SYSKEYDOWN/WM_SYSKEYUP Notification
50 // bit 24: Specifies whether the key is an extended key,
51 // such as the right-hand ALT and CTRL keys that appear on
52 // an enhanced 101- or 102-key keyboard.
53 // The value is 1 if it is an extended key; otherwise, it is 0.
54 // bit 29:Specifies the context code.
55 // The value is 1 if the ALT key is down while the key is pressed/released;
56 // it is 0 if the WM_SYSKEYDOWN message is posted to the active window
57 // because no window has the keyboard focus.
58 #define GOP_EXTENDED_KEY (0x1 << 24)
59 #define GOP_ALT_KEY_PRESSED (0x1 << 29)
68 EFI_INPUT_KEY Q
[MAX_Q
];
71 #define WIN_NT_GOP_CLASS_NAME L"WinNtGopWindow"
73 #define GOP_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('S', 'g', 'o', 'N')
75 #define WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE SIGNATURE_32 ('W', 'g', 'S', 'n')
77 typedef struct _WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY
{
79 EFI_HANDLE NotifyHandle
;
81 EFI_KEY_NOTIFY_FUNCTION KeyNotificationFn
;
82 LIST_ENTRY NotifyEntry
;
83 } WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY
;
85 #define GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER 0xffff
88 UINT32 HorizontalResolution
;
89 UINT32 VerticalResolution
;
98 EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput
;
99 EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleTextIn
;
101 EFI_WIN_NT_THUNK_PROTOCOL
*WinNtThunk
;
103 EFI_UNICODE_STRING_TABLE
*ControllerNameTable
;
106 // GOP Private Data for QueryMode ()
108 GOP_MODE_DATA
*ModeData
;
111 // GOP Private Data knowing when to start hardware
113 BOOLEAN HardwareNeedsStarting
;
118 HANDLE ThreadInited
; // Semaphore
119 HANDLE ThreadHandle
; // Thread
123 WNDCLASSEX WindowsClass
;
126 // This screen is used to redraw the scree when windows events happen. It's
127 // updated in the main thread and displayed in the windows thread.
129 BITMAPV4HEADER
*VirtualScreenInfo
;
130 RGBQUAD
*VirtualScreen
;
132 EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*FillLine
;
135 // Keyboard Queue used by Simple Text In. WinProc thread adds, and main
138 CRITICAL_SECTION QCriticalSection
;
139 GOP_QUEUE_FIXED Queue
;
141 EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL SimpleTextInEx
;
142 EFI_KEY_STATE KeyState
;
143 LIST_ENTRY NotifyList
;
159 #define GOP_PRIVATE_DATA_FROM_THIS(a) \
160 CR(a, GOP_PRIVATE_DATA, GraphicsOutput, GOP_PRIVATE_DATA_SIGNATURE)
162 #define GOP_PRIVATE_DATA_FROM_TEXT_IN_THIS(a) \
163 CR(a, GOP_PRIVATE_DATA, SimpleTextIn, GOP_PRIVATE_DATA_SIGNATURE)
165 #define GOP_PRIVATE_DATA_FROM_TEXT_IN_EX_THIS(a) \
166 CR(a, GOP_PRIVATE_DATA, SimpleTextInEx, GOP_PRIVATE_DATA_SIGNATURE)
169 // Global Protocol Variables
171 extern EFI_DRIVER_BINDING_PROTOCOL gWinNtGopDriverBinding
;
172 extern EFI_COMPONENT_NAME_PROTOCOL gWinNtGopComponentName
;
173 extern EFI_COMPONENT_NAME2_PROTOCOL gWinNtGopComponentName2
;
177 // Gop Hardware abstraction internal worker functions
181 TODO: Add function description
183 @param WinNtIo TODO: add argument description
185 @return TODO: add return values
190 IN EFI_WIN_NT_IO_PROTOCOL
*WinNtIo
195 TODO: Add function description
197 @param Private TODO: add argument description
199 @return TODO: add return values
203 WinNtGopConstructor (
204 IN GOP_PRIVATE_DATA
*Private
209 TODO: Add function description
211 @param Private TODO: add argument description
213 @return TODO: add return values
218 IN GOP_PRIVATE_DATA
*Private
222 // UEFI 2.0 driver model prototypes for Win NT GOP
227 TODO: Add function description
229 @param ImageHandle TODO: add argument description
230 @param SystemTable TODO: add argument description
232 @return TODO: add return values
238 IN EFI_HANDLE ImageHandle
,
239 IN EFI_SYSTEM_TABLE
*SystemTable
244 TODO: Add function description
246 @param This TODO: add argument description
247 @param Handle TODO: add argument description
248 @param RemainingDevicePath TODO: add argument description
250 @return TODO: add return values
255 WinNtGopDriverBindingSupported (
256 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
257 IN EFI_HANDLE Handle
,
258 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
263 TODO: Add function description
265 @param This TODO: add argument description
266 @param Handle TODO: add argument description
267 @param RemainingDevicePath TODO: add argument description
269 @return TODO: add return values
274 WinNtGopDriverBindingStart (
275 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
276 IN EFI_HANDLE Handle
,
277 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
282 TODO: Add function description
284 @param This TODO: add argument description
285 @param Handle TODO: add argument description
286 @param NumberOfChildren TODO: add argument description
287 @param ChildHandleBuffer TODO: add argument description
289 @return TODO: add return values
294 WinNtGopDriverBindingStop (
295 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
296 IN EFI_HANDLE Handle
,
297 IN UINTN NumberOfChildren
,
298 IN EFI_HANDLE
*ChildHandleBuffer
303 TODO: Add function description
305 @param Private TODO: add argument description
306 @param Key TODO: add argument description
308 @return TODO: add return values
313 IN GOP_PRIVATE_DATA
*Private
,
319 TODO: Add function description
321 @param Private TODO: add argument description
323 @return TODO: add return values
327 WinNtGopInitializeSimpleTextInForWindow (
328 IN GOP_PRIVATE_DATA
*Private
333 TODO: Add function description
335 @param Private TODO: add argument description
337 @return TODO: add return values
341 WinNtGopDestroySimpleTextInForWindow (
342 IN GOP_PRIVATE_DATA
*Private