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>
38 #include <Library/DebugLib.h>
39 #include <Library/BaseLib.h>
40 #include <Library/UefiDriverEntryPoint.h>
41 #include <Library/UefiLib.h>
42 #include <Library/BaseMemoryLib.h>
43 #include <Library/UefiBootServicesTableLib.h>
44 #include <Library/MemoryAllocationLib.h>
47 // WM_SYSKEYDOWN/WM_SYSKEYUP Notification
49 // bit 24: Specifies whether the key is an extended key,
50 // such as the right-hand ALT and CTRL keys that appear on
51 // an enhanced 101- or 102-key keyboard.
52 // The value is 1 if it is an extended key; otherwise, it is 0.
53 // bit 29:Specifies the context code.
54 // The value is 1 if the ALT key is down while the key is pressed/released;
55 // it is 0 if the WM_SYSKEYDOWN message is posted to the active window
56 // because no window has the keyboard focus.
57 #define GOP_EXTENDED_KEY (0x1 << 24)
58 #define GOP_ALT_KEY_PRESSED (0x1 << 29)
67 EFI_INPUT_KEY Q
[MAX_Q
];
70 #define WIN_NT_GOP_CLASS_NAME L"WinNtGopWindow"
72 #define GOP_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('S', 'g', 'o', 'N')
74 #define WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE EFI_SIGNATURE_32 ('W', 'g', 'S', 'n')
76 typedef struct _WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY
{
78 EFI_HANDLE NotifyHandle
;
80 EFI_KEY_NOTIFY_FUNCTION KeyNotificationFn
;
81 LIST_ENTRY NotifyEntry
;
82 } WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY
;
84 #define GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER 0xffff
87 UINT32 HorizontalResolution
;
88 UINT32 VerticalResolution
;
97 EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput
;
98 EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleTextIn
;
100 EFI_WIN_NT_THUNK_PROTOCOL
*WinNtThunk
;
102 EFI_UNICODE_STRING_TABLE
*ControllerNameTable
;
105 // GOP Private Data for QueryMode ()
107 GOP_MODE_DATA
*ModeData
;
110 // GOP Private Data knowing when to start hardware
112 BOOLEAN HardwareNeedsStarting
;
117 HANDLE ThreadInited
; // Semaphore
118 HANDLE ThreadHandle
; // Thread
122 WNDCLASSEX WindowsClass
;
125 // This screen is used to redraw the scree when windows events happen. It's
126 // updated in the main thread and displayed in the windows thread.
128 BITMAPV4HEADER
*VirtualScreenInfo
;
129 RGBQUAD
*VirtualScreen
;
131 EFI_GRAPHICS_OUTPUT_BLT_PIXEL
*FillLine
;
134 // Keyboard Queue used by Simple Text In. WinProc thread adds, and main
137 CRITICAL_SECTION QCriticalSection
;
138 GOP_QUEUE_FIXED Queue
;
140 EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL SimpleTextInEx
;
141 EFI_KEY_STATE KeyState
;
142 LIST_ENTRY NotifyList
;
158 #define GOP_PRIVATE_DATA_FROM_THIS(a) \
159 CR(a, GOP_PRIVATE_DATA, GraphicsOutput, GOP_PRIVATE_DATA_SIGNATURE)
161 #define GOP_PRIVATE_DATA_FROM_TEXT_IN_THIS(a) \
162 CR(a, GOP_PRIVATE_DATA, SimpleTextIn, GOP_PRIVATE_DATA_SIGNATURE)
164 #define GOP_PRIVATE_DATA_FROM_TEXT_IN_EX_THIS(a) \
165 CR(a, GOP_PRIVATE_DATA, SimpleTextInEx, GOP_PRIVATE_DATA_SIGNATURE)
168 // Global Protocol Variables
170 extern EFI_DRIVER_BINDING_PROTOCOL gWinNtGopDriverBinding
;
171 extern EFI_COMPONENT_NAME_PROTOCOL gWinNtGopComponentName
;
172 extern EFI_COMPONENT_NAME2_PROTOCOL gWinNtGopComponentName2
;
174 extern EFI_GUID gSimpleTextInExNotifyGuid
;
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
196 TODO: Add function description
198 @param Private TODO: add argument description
200 @return TODO: add return values
204 WinNtGopConstructor (
205 IN GOP_PRIVATE_DATA
*Private
211 TODO: Add function description
213 @param Private TODO: add argument description
215 @return TODO: add return values
220 IN GOP_PRIVATE_DATA
*Private
225 // UEFI 2.0 driver model prototypes for Win NT GOP
230 TODO: Add function description
232 @param ImageHandle TODO: add argument description
233 @param SystemTable TODO: add argument description
235 @return TODO: add return values
241 IN EFI_HANDLE ImageHandle
,
242 IN EFI_SYSTEM_TABLE
*SystemTable
248 TODO: Add function description
250 @param This TODO: add argument description
251 @param Handle TODO: add argument description
252 @param RemainingDevicePath TODO: add argument description
254 @return TODO: add return values
259 WinNtGopDriverBindingSupported (
260 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
261 IN EFI_HANDLE Handle
,
262 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
268 TODO: Add function description
270 @param This TODO: add argument description
271 @param Handle TODO: add argument description
272 @param RemainingDevicePath TODO: add argument description
274 @return TODO: add return values
279 WinNtGopDriverBindingStart (
280 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
281 IN EFI_HANDLE Handle
,
282 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
288 TODO: Add function description
290 @param This TODO: add argument description
291 @param Handle TODO: add argument description
292 @param NumberOfChildren TODO: add argument description
293 @param ChildHandleBuffer TODO: add argument description
295 @return TODO: add return values
300 WinNtGopDriverBindingStop (
301 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
302 IN EFI_HANDLE Handle
,
303 IN UINTN NumberOfChildren
,
304 IN EFI_HANDLE
*ChildHandleBuffer
310 TODO: Add function description
312 @param Private TODO: add argument description
313 @param Key TODO: add argument description
315 @return TODO: add return values
320 IN GOP_PRIVATE_DATA
*Private
,
327 TODO: Add function description
329 @param Private TODO: add argument description
331 @return TODO: add return values
335 WinNtGopInitializeSimpleTextInForWindow (
336 IN GOP_PRIVATE_DATA
*Private
342 TODO: Add function description
344 @param Private TODO: add argument description
346 @return TODO: add return values
350 WinNtGopDestroySimpleTextInForWindow (
351 IN GOP_PRIVATE_DATA
*Private