3 Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
4 SPDX-License-Identifier: BSD-2-Clause-Patent
12 Private data for the Gop driver that is bound to the WinNt Thunk protocol
17 #ifndef _WIN_NT_GOP_H_
18 #define _WIN_NT_GOP_H_
24 #include <Guid/EventGroup.h>
25 #include <Protocol/WinNtIo.h>
26 #include <Protocol/ComponentName.h>
27 #include <Protocol/SimpleTextIn.h>
28 #include <Protocol/SimpleTextInEx.h>
29 #include <Protocol/DriverBinding.h>
30 #include <Protocol/GraphicsOutput.h>
32 #include <Library/DebugLib.h>
33 #include <Library/BaseLib.h>
34 #include <Library/UefiDriverEntryPoint.h>
35 #include <Library/UefiLib.h>
36 #include <Library/BaseMemoryLib.h>
37 #include <Library/UefiBootServicesTableLib.h>
38 #include <Library/MemoryAllocationLib.h>
41 // WM_SYSKEYDOWN/WM_SYSKEYUP Notification
43 // bit 24: Specifies whether the key is an extended key,
44 // such as the right-hand ALT and CTRL keys that appear on
45 // an enhanced 101- or 102-key keyboard.
46 // The value is 1 if it is an extended key; otherwise, it is 0.
47 // bit 29:Specifies the context code.
48 // The value is 1 if the ALT key is down while the key is pressed/released;
49 // it is 0 if the WM_SYSKEYDOWN message is posted to the active window
50 // because no window has the keyboard focus.
51 #define GOP_EXTENDED_KEY (0x1 << 24)
52 #define GOP_ALT_KEY_PRESSED (0x1 << 29)
54 #define KEYBOARD_TIMER_INTERVAL 200000 // 0.02s
61 EFI_KEY_DATA Q
[MAX_Q
];
65 #define WIN_NT_GOP_CLASS_NAME L"WinNtGopWindow"
67 #define GOP_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('S', 'g', 'o', 'N')
69 #define WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE SIGNATURE_32 ('W', 'g', 'S', 'n')
71 typedef struct _WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY
{
74 EFI_KEY_NOTIFY_FUNCTION KeyNotificationFn
;
75 LIST_ENTRY NotifyEntry
;
76 } WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY
;
78 #define GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER 0xffff
81 UINT32 HorizontalResolution
;
82 UINT32 VerticalResolution
;
91 EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput
;
92 EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleTextIn
;
94 EFI_WIN_NT_THUNK_PROTOCOL
*WinNtThunk
;
96 EFI_UNICODE_STRING_TABLE
*ControllerNameTable
;
99 // GOP Private Data for QueryMode ()
101 GOP_MODE_DATA
*ModeData
;
104 // GOP Private Data knowing when to start hardware
106 BOOLEAN HardwareNeedsStarting
;
111 HANDLE ThreadInited
; // Semaphore
112 HANDLE ThreadHandle
; // Thread
116 WNDCLASSEX WindowsClass
;
119 // This screen is used to redraw the scree when windows events happen. It's
120 // updated in the main thread and displayed in the windows thread.
122 BITMAPV4HEADER
*VirtualScreenInfo
;
123 RGBQUAD
*VirtualScreen
;
125 EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*FillLine
;
128 // Keyboard Queue used by Simple Text In.
129 // QueueForRead: WinProc thread adds, and main thread removes.
130 // QueueForNotify: WinProc thread adds, and timer thread removes.
132 GOP_QUEUE_FIXED QueueForRead
;
133 GOP_QUEUE_FIXED QueueForNotify
;
135 EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL SimpleTextInEx
;
136 EFI_KEY_STATE KeyState
;
137 LIST_ENTRY NotifyList
;
151 BOOLEAN IsPartialKeySupport
;
152 EFI_EVENT TimerEvent
;
155 #define GOP_PRIVATE_DATA_FROM_THIS(a) \
156 CR(a, GOP_PRIVATE_DATA, GraphicsOutput, GOP_PRIVATE_DATA_SIGNATURE)
158 #define GOP_PRIVATE_DATA_FROM_TEXT_IN_THIS(a) \
159 CR(a, GOP_PRIVATE_DATA, SimpleTextIn, GOP_PRIVATE_DATA_SIGNATURE)
161 #define GOP_PRIVATE_DATA_FROM_TEXT_IN_EX_THIS(a) \
162 CR(a, GOP_PRIVATE_DATA, SimpleTextInEx, GOP_PRIVATE_DATA_SIGNATURE)
165 // Global Protocol Variables
167 extern EFI_DRIVER_BINDING_PROTOCOL gWinNtGopDriverBinding
;
168 extern EFI_COMPONENT_NAME_PROTOCOL gWinNtGopComponentName
;
169 extern EFI_COMPONENT_NAME2_PROTOCOL gWinNtGopComponentName2
;
173 // Gop Hardware abstraction internal worker functions
177 TODO: Add function description
179 @param WinNtIo TODO: add argument description
181 @return TODO: add return values
186 IN EFI_WIN_NT_IO_PROTOCOL
*WinNtIo
191 TODO: Add function description
193 @param Private TODO: add argument description
195 @return TODO: add return values
199 WinNtGopConstructor (
200 IN GOP_PRIVATE_DATA
*Private
205 TODO: Add function description
207 @param Private TODO: add argument description
209 @return TODO: add return values
214 IN GOP_PRIVATE_DATA
*Private
218 // UEFI 2.0 driver model prototypes for Win NT GOP
223 TODO: Add function description
225 @param ImageHandle TODO: add argument description
226 @param SystemTable TODO: add argument description
228 @return TODO: add return values
234 IN EFI_HANDLE ImageHandle
,
235 IN EFI_SYSTEM_TABLE
*SystemTable
240 TODO: Add function description
242 @param This TODO: add argument description
243 @param Handle TODO: add argument description
244 @param RemainingDevicePath TODO: add argument description
246 @return TODO: add return values
251 WinNtGopDriverBindingSupported (
252 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
253 IN EFI_HANDLE Handle
,
254 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
259 TODO: Add function description
261 @param This TODO: add argument description
262 @param Handle TODO: add argument description
263 @param RemainingDevicePath TODO: add argument description
265 @return TODO: add return values
270 WinNtGopDriverBindingStart (
271 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
272 IN EFI_HANDLE Handle
,
273 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
278 TODO: Add function description
280 @param This TODO: add argument description
281 @param Handle TODO: add argument description
282 @param NumberOfChildren TODO: add argument description
283 @param ChildHandleBuffer TODO: add argument description
285 @return TODO: add return values
290 WinNtGopDriverBindingStop (
291 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
292 IN EFI_HANDLE Handle
,
293 IN UINTN NumberOfChildren
,
294 IN EFI_HANDLE
*ChildHandleBuffer
299 TODO: Add function description
301 @param Private TODO: add argument description
302 @param Key TODO: add argument description
304 @return TODO: add return values
309 IN GOP_PRIVATE_DATA
*Private
,
315 TODO: Add function description
317 @param Private TODO: add argument description
319 @return TODO: add return values
323 WinNtGopInitializeSimpleTextInForWindow (
324 IN GOP_PRIVATE_DATA
*Private
329 TODO: Add function description
331 @param Private TODO: add argument description
333 @return TODO: add return values
337 WinNtGopDestroySimpleTextInForWindow (
338 IN GOP_PRIVATE_DATA
*Private