Migrate GOP driver from R8.6 for NT32. Add a new PCD "PcdWinNtGop". Setting NT32...
[mirror_edk2.git] / EdkNt32Pkg / Dxe / WinNtThunk / Bus / Gop / WinNtGop.h
1 /** @file
2
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
8
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.
11
12 Module Name:
13
14 WinNtGop.h
15
16 Abstract:
17
18 Private data for the Gop driver that is bound to the WinNt Thunk protocol
19
20
21 **/
22
23 #ifndef _WIN_NT_GOP_H_
24 #define _WIN_NT_GOP_H_
25
26 //@MT:#include "EfiWinNT.h"
27 //@MT:#include "Tiano.h"
28 //@MT:#include "EfiDriverLib.h"
29
30 //
31 // Driver Consumed Protocols
32 //
33 //@MT:#include EFI_PROTOCOL_DEFINITION (DevicePath)
34 //@MT:#include EFI_PROTOCOL_DEFINITION (WinNtIo)
35
36 //
37 // Driver Produced Protocols
38 //
39 //@MT:#include EFI_PROTOCOL_DEFINITION (DriverBinding)
40 //@MT:#include EFI_PROTOCOL_DEFINITION (ComponentName)
41 //@MT:#include EFI_PROTOCOL_DEFINITION (GraphicsOutput)
42 //@MT:#include "LinkedList.h"
43
44 #define MAX_Q 256
45
46 typedef struct {
47 UINTN Front;
48 UINTN Rear;
49 UINTN Count;
50 EFI_INPUT_KEY Q[MAX_Q];
51 } GOP_QUEUE_FIXED;
52
53 #define WIN_NT_GOP_CLASS_NAME L"WinNtGopWindow"
54
55 #define GOP_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('S', 'g', 'o', 'N')
56
57 #define GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER 0xffff
58
59 typedef struct {
60 UINT32 HorizontalResolution;
61 UINT32 VerticalResolution;
62 UINT32 ColorDepth;
63 UINT32 RefreshRate;
64 } GOP_MODE_DATA;
65
66 typedef struct {
67 UINT64 Signature;
68
69 EFI_HANDLE Handle;
70 EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput;
71 EFI_SIMPLE_TEXT_IN_PROTOCOL SimpleTextIn;
72
73 EFI_WIN_NT_THUNK_PROTOCOL *WinNtThunk;
74
75 EFI_UNICODE_STRING_TABLE *ControllerNameTable;
76
77 //
78 // GOP Private Data for QueryMode ()
79 //
80 GOP_MODE_DATA *ModeData;
81
82 //
83 // GOP Private Data knowing when to start hardware
84 //
85 BOOLEAN HardwareNeedsStarting;
86
87 CHAR16 *WindowName;
88 CHAR16 Buffer[160];
89
90 HANDLE ThreadInited; // Semaphore
91 HANDLE ThreadHandle; // Thread
92 DWORD ThreadId;
93
94 HWND WindowHandle;
95 WNDCLASSEX WindowsClass;
96
97 //
98 // This screen is used to redraw the scree when windows events happen. It's
99 // updated in the main thread and displayed in the windows thread.
100 //
101 BITMAPV4HEADER *VirtualScreenInfo;
102 RGBQUAD *VirtualScreen;
103
104 EFI_GRAPHICS_OUTPUT_BLT_PIXEL *FillLine;
105
106 //
107 // Keyboard Queue used by Simple Text In. WinProc thread adds, and main
108 // thread removes.
109 //
110 CRITICAL_SECTION QCriticalSection;
111 GOP_QUEUE_FIXED Queue;
112
113 } GOP_PRIVATE_DATA;
114
115 #define GOP_PRIVATE_DATA_FROM_THIS(a) \
116 CR(a, GOP_PRIVATE_DATA, GraphicsOutput, GOP_PRIVATE_DATA_SIGNATURE)
117
118 #define GOP_PRIVATE_DATA_FROM_TEXT_IN_THIS(a) \
119 CR(a, GOP_PRIVATE_DATA, SimpleTextIn, GOP_PRIVATE_DATA_SIGNATURE)
120
121 //
122 // Global Protocol Variables
123 //
124 extern EFI_DRIVER_BINDING_PROTOCOL gWinNtGopDriverBinding;
125 extern EFI_COMPONENT_NAME_PROTOCOL gWinNtGopComponentName;
126
127 //
128 // Gop Hardware abstraction internal worker functions
129 //
130
131 /**
132 TODO: Add function description
133
134 @param WinNtIo TODO: add argument description
135
136 @return TODO: add return values
137
138 **/
139 EFI_STATUS
140 WinNtGopSupported (
141 IN EFI_WIN_NT_IO_PROTOCOL *WinNtIo
142 )
143 ;
144
145
146 /**
147 TODO: Add function description
148
149 @param Private TODO: add argument description
150
151 @return TODO: add return values
152
153 **/
154 EFI_STATUS
155 WinNtGopConstructor (
156 IN GOP_PRIVATE_DATA *Private
157 )
158 ;
159
160
161 /**
162 TODO: Add function description
163
164 @param Private TODO: add argument description
165
166 @return TODO: add return values
167
168 **/
169 EFI_STATUS
170 WinNtGopDestructor (
171 IN GOP_PRIVATE_DATA *Private
172 )
173 ;
174
175 //
176 // EFI 1.1 driver model prototypes for Win NT GOP
177 //
178
179
180 /**
181 TODO: Add function description
182
183 @param ImageHandle TODO: add argument description
184 @param SystemTable TODO: add argument description
185
186 @return TODO: add return values
187
188 **/
189 EFI_STATUS
190 EFIAPI
191 WinNtGopInitialize (
192 IN EFI_HANDLE ImageHandle,
193 IN EFI_SYSTEM_TABLE *SystemTable
194 )
195 ;
196
197
198 /**
199 TODO: Add function description
200
201 @param This TODO: add argument description
202 @param Handle TODO: add argument description
203 @param RemainingDevicePath TODO: add argument description
204
205 @return TODO: add return values
206
207 **/
208 EFI_STATUS
209 EFIAPI
210 WinNtGopDriverBindingSupported (
211 IN EFI_DRIVER_BINDING_PROTOCOL *This,
212 IN EFI_HANDLE Handle,
213 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
214 )
215 ;
216
217
218 /**
219 TODO: Add function description
220
221 @param This TODO: add argument description
222 @param Handle TODO: add argument description
223 @param RemainingDevicePath TODO: add argument description
224
225 @return TODO: add return values
226
227 **/
228 EFI_STATUS
229 EFIAPI
230 WinNtGopDriverBindingStart (
231 IN EFI_DRIVER_BINDING_PROTOCOL *This,
232 IN EFI_HANDLE Handle,
233 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
234 )
235 ;
236
237
238 /**
239 TODO: Add function description
240
241 @param This TODO: add argument description
242 @param Handle TODO: add argument description
243 @param NumberOfChildren TODO: add argument description
244 @param ChildHandleBuffer TODO: add argument description
245
246 @return TODO: add return values
247
248 **/
249 EFI_STATUS
250 EFIAPI
251 WinNtGopDriverBindingStop (
252 IN EFI_DRIVER_BINDING_PROTOCOL *This,
253 IN EFI_HANDLE Handle,
254 IN UINTN NumberOfChildren,
255 IN EFI_HANDLE *ChildHandleBuffer
256 )
257 ;
258
259
260 /**
261 TODO: Add function description
262
263 @param Private TODO: add argument description
264 @param Key TODO: add argument description
265
266 @return TODO: add return values
267
268 **/
269 EFI_STATUS
270 GopPrivateAddQ (
271 IN GOP_PRIVATE_DATA *Private,
272 IN EFI_INPUT_KEY Key
273 )
274 ;
275
276
277 /**
278 TODO: Add function description
279
280 @param Private TODO: add argument description
281
282 @return TODO: add return values
283
284 **/
285 EFI_STATUS
286 WinNtGopInitializeSimpleTextInForWindow (
287 IN GOP_PRIVATE_DATA *Private
288 )
289 ;
290
291
292 /**
293 TODO: Add function description
294
295 @param Private TODO: add argument description
296
297 @return TODO: add return values
298
299 **/
300 EFI_STATUS
301 WinNtGopDestroySimpleTextInForWindow (
302 IN GOP_PRIVATE_DATA *Private
303 )
304 ;
305
306
307 /**
308 TODO: Add function description
309
310 @param String TODO: add argument description
311
312 @return TODO: add return values
313
314 **/
315 UINTN
316 Atoi (
317 IN CHAR16 *String
318 )
319 ;
320
321 #endif