]> git.proxmox.com Git - mirror_edk2.git/blob - Nt32Pkg/WinNtGopDxe/WinNtGop.h
UefiCpuPkg: Remove double \r
[mirror_edk2.git] / Nt32Pkg / WinNtGopDxe / WinNtGop.h
1 /** @file
2
3 Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
4 SPDX-License-Identifier: BSD-2-Clause-Patent
5
6 Module Name:
7
8 WinNtGop.h
9
10 Abstract:
11
12 Private data for the Gop driver that is bound to the WinNt Thunk protocol
13
14
15 **/
16
17 #ifndef _WIN_NT_GOP_H_
18 #define _WIN_NT_GOP_H_
19
20
21 #include <Uefi.h>
22 #include <WinNtDxe.h>
23
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>
31
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>
39
40 //
41 // WM_SYSKEYDOWN/WM_SYSKEYUP Notification
42 // lParam
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)
53
54 #define KEYBOARD_TIMER_INTERVAL 200000 // 0.02s
55
56 #define MAX_Q 256
57
58 typedef struct {
59 UINTN Front;
60 UINTN Rear;
61 EFI_KEY_DATA Q[MAX_Q];
62 CRITICAL_SECTION Cs;
63 } GOP_QUEUE_FIXED;
64
65 #define WIN_NT_GOP_CLASS_NAME L"WinNtGopWindow"
66
67 #define GOP_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('S', 'g', 'o', 'N')
68
69 #define WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE SIGNATURE_32 ('W', 'g', 'S', 'n')
70
71 typedef struct _WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY {
72 UINTN Signature;
73 EFI_KEY_DATA KeyData;
74 EFI_KEY_NOTIFY_FUNCTION KeyNotificationFn;
75 LIST_ENTRY NotifyEntry;
76 } WIN_NT_GOP_SIMPLE_TEXTIN_EX_NOTIFY;
77
78 #define GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER 0xffff
79
80 typedef struct {
81 UINT32 HorizontalResolution;
82 UINT32 VerticalResolution;
83 UINT32 ColorDepth;
84 UINT32 RefreshRate;
85 } GOP_MODE_DATA;
86
87 typedef struct {
88 UINT64 Signature;
89
90 EFI_HANDLE Handle;
91 EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput;
92 EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleTextIn;
93
94 EFI_WIN_NT_THUNK_PROTOCOL *WinNtThunk;
95
96 EFI_UNICODE_STRING_TABLE *ControllerNameTable;
97
98 //
99 // GOP Private Data for QueryMode ()
100 //
101 GOP_MODE_DATA *ModeData;
102
103 //
104 // GOP Private Data knowing when to start hardware
105 //
106 BOOLEAN HardwareNeedsStarting;
107
108 CHAR16 *WindowName;
109 CHAR16 Buffer[160];
110
111 HANDLE ThreadInited; // Semaphore
112 HANDLE ThreadHandle; // Thread
113 DWORD ThreadId;
114
115 HWND WindowHandle;
116 WNDCLASSEX WindowsClass;
117
118 //
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.
121 //
122 BITMAPV4HEADER *VirtualScreenInfo;
123 RGBQUAD *VirtualScreen;
124
125 EFI_GRAPHICS_OUTPUT_BLT_PIXEL *FillLine;
126
127 //
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.
131 //
132 GOP_QUEUE_FIXED QueueForRead;
133 GOP_QUEUE_FIXED QueueForNotify;
134
135 EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL SimpleTextInEx;
136 EFI_KEY_STATE KeyState;
137 LIST_ENTRY NotifyList;
138 BOOLEAN LeftShift;
139 BOOLEAN RightShift;
140 BOOLEAN LeftAlt;
141 BOOLEAN RightAlt;
142 BOOLEAN LeftCtrl;
143 BOOLEAN RightCtrl;
144 BOOLEAN LeftLogo;
145 BOOLEAN RightLogo;
146 BOOLEAN Menu;
147 BOOLEAN SysReq;
148 BOOLEAN NumLock;
149 BOOLEAN ScrollLock;
150 BOOLEAN CapsLock;
151 BOOLEAN IsPartialKeySupport;
152 EFI_EVENT TimerEvent;
153 } GOP_PRIVATE_DATA;
154
155 #define GOP_PRIVATE_DATA_FROM_THIS(a) \
156 CR(a, GOP_PRIVATE_DATA, GraphicsOutput, GOP_PRIVATE_DATA_SIGNATURE)
157
158 #define GOP_PRIVATE_DATA_FROM_TEXT_IN_THIS(a) \
159 CR(a, GOP_PRIVATE_DATA, SimpleTextIn, GOP_PRIVATE_DATA_SIGNATURE)
160
161 #define GOP_PRIVATE_DATA_FROM_TEXT_IN_EX_THIS(a) \
162 CR(a, GOP_PRIVATE_DATA, SimpleTextInEx, GOP_PRIVATE_DATA_SIGNATURE)
163
164 //
165 // Global Protocol Variables
166 //
167 extern EFI_DRIVER_BINDING_PROTOCOL gWinNtGopDriverBinding;
168 extern EFI_COMPONENT_NAME_PROTOCOL gWinNtGopComponentName;
169 extern EFI_COMPONENT_NAME2_PROTOCOL gWinNtGopComponentName2;
170
171
172 //
173 // Gop Hardware abstraction internal worker functions
174 //
175
176 /**
177 TODO: Add function description
178
179 @param WinNtIo TODO: add argument description
180
181 @return TODO: add return values
182
183 **/
184 EFI_STATUS
185 WinNtGopSupported (
186 IN EFI_WIN_NT_IO_PROTOCOL *WinNtIo
187 );
188
189
190 /**
191 TODO: Add function description
192
193 @param Private TODO: add argument description
194
195 @return TODO: add return values
196
197 **/
198 EFI_STATUS
199 WinNtGopConstructor (
200 IN GOP_PRIVATE_DATA *Private
201 );
202
203
204 /**
205 TODO: Add function description
206
207 @param Private TODO: add argument description
208
209 @return TODO: add return values
210
211 **/
212 EFI_STATUS
213 WinNtGopDestructor (
214 IN GOP_PRIVATE_DATA *Private
215 );
216
217 //
218 // UEFI 2.0 driver model prototypes for Win NT GOP
219 //
220
221
222 /**
223 TODO: Add function description
224
225 @param ImageHandle TODO: add argument description
226 @param SystemTable TODO: add argument description
227
228 @return TODO: add return values
229
230 **/
231 EFI_STATUS
232 EFIAPI
233 WinNtGopInitialize (
234 IN EFI_HANDLE ImageHandle,
235 IN EFI_SYSTEM_TABLE *SystemTable
236 );
237
238
239 /**
240 TODO: Add function description
241
242 @param This TODO: add argument description
243 @param Handle TODO: add argument description
244 @param RemainingDevicePath TODO: add argument description
245
246 @return TODO: add return values
247
248 **/
249 EFI_STATUS
250 EFIAPI
251 WinNtGopDriverBindingSupported (
252 IN EFI_DRIVER_BINDING_PROTOCOL *This,
253 IN EFI_HANDLE Handle,
254 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
255 );
256
257
258 /**
259 TODO: Add function description
260
261 @param This TODO: add argument description
262 @param Handle TODO: add argument description
263 @param RemainingDevicePath TODO: add argument description
264
265 @return TODO: add return values
266
267 **/
268 EFI_STATUS
269 EFIAPI
270 WinNtGopDriverBindingStart (
271 IN EFI_DRIVER_BINDING_PROTOCOL *This,
272 IN EFI_HANDLE Handle,
273 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
274 );
275
276
277 /**
278 TODO: Add function description
279
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
284
285 @return TODO: add return values
286
287 **/
288 EFI_STATUS
289 EFIAPI
290 WinNtGopDriverBindingStop (
291 IN EFI_DRIVER_BINDING_PROTOCOL *This,
292 IN EFI_HANDLE Handle,
293 IN UINTN NumberOfChildren,
294 IN EFI_HANDLE *ChildHandleBuffer
295 );
296
297
298 /**
299 TODO: Add function description
300
301 @param Private TODO: add argument description
302 @param Key TODO: add argument description
303
304 @return TODO: add return values
305
306 **/
307 EFI_STATUS
308 GopPrivateAddKey (
309 IN GOP_PRIVATE_DATA *Private,
310 IN EFI_INPUT_KEY Key
311 );
312
313
314 /**
315 TODO: Add function description
316
317 @param Private TODO: add argument description
318
319 @return TODO: add return values
320
321 **/
322 EFI_STATUS
323 WinNtGopInitializeSimpleTextInForWindow (
324 IN GOP_PRIVATE_DATA *Private
325 );
326
327
328 /**
329 TODO: Add function description
330
331 @param Private TODO: add argument description
332
333 @return TODO: add return values
334
335 **/
336 EFI_STATUS
337 WinNtGopDestroySimpleTextInForWindow (
338 IN GOP_PRIVATE_DATA *Private
339 );
340
341
342
343 #endif