]> git.proxmox.com Git - mirror_edk2.git/blob - UnixPkg/UnixGopDxe/UnixGop.h
Adding Simple Pointer, GOP, SimpleTextInEx, and Networking protocols to the emulator...
[mirror_edk2.git] / UnixPkg / UnixGopDxe / UnixGop.h
1 /*++
2
3 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
4 Portions copyright (c) 2010, Apple, Inc. All rights reserved.
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 Module Name:
14
15 UnixGop.h
16
17 Abstract:
18
19 Private data for the Gop driver that is bound to the Unix Thunk protocol
20
21 --*/
22
23 #ifndef _UNIX_UGA_H_
24 #define _UNIX_UGA_H_
25
26 #include <PiDxe.h>
27 #include "UnixDxe.h"
28 #include <Library/DebugLib.h>
29 #include <Library/BaseLib.h>
30 #include <Library/UefiDriverEntryPoint.h>
31 #include <Library/UefiLib.h>
32 #include <Library/BaseMemoryLib.h>
33 #include <Library/MemoryAllocationLib.h>
34 #include <Library/UefiBootServicesTableLib.h>
35
36 #include <Protocol/GraphicsOutput.h>
37 #include <Protocol/SimpleTextIn.h>
38 #include <Protocol/SimpleTextInEx.h>
39 #include <Protocol/SimplePointer.h>
40 #include "Protocol/UnixUgaIo.h"
41
42 #include <Guid/EventGroup.h>
43
44
45
46 #define MAX_Q 256
47
48 typedef struct {
49 UINTN Front;
50 UINTN Rear;
51 UINTN Count;
52 EFI_INPUT_KEY Q[MAX_Q];
53 } GOP_QUEUE_FIXED;
54
55 #define UNIX_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE SIGNATURE_32 ('U', 'g', 'S', 'n')
56 typedef struct _UNIX_GOP_SIMPLE_TEXTIN_EX_NOTIFY {
57 UINTN Signature;
58 EFI_HANDLE NotifyHandle;
59 EFI_KEY_DATA KeyData;
60 EFI_KEY_NOTIFY_FUNCTION KeyNotificationFn;
61 EFI_EVENT Event;
62 LIST_ENTRY NotifyEntry;
63 } UNIX_GOP_SIMPLE_TEXTIN_EX_NOTIFY;
64
65 #define GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER 0xffff
66
67 typedef struct {
68 UINT32 HorizontalResolution;
69 UINT32 VerticalResolution;
70 UINT32 ColorDepth;
71 UINT32 RefreshRate;
72 } GOP_MODE_DATA;
73
74
75
76 extern EFI_DRIVER_BINDING_PROTOCOL gUnixGopDriverBinding;
77 extern EFI_COMPONENT_NAME_PROTOCOL gUnixGopComponentName;
78
79 #define UNIX_UGA_CLASS_NAME L"UnixGopWindow"
80
81 #define GOP_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('G', 'o', 'p', 'N')
82 typedef struct {
83 UINT64 Signature;
84
85 EFI_HANDLE Handle;
86 EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput;
87 EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleTextIn;
88 EFI_SIMPLE_POINTER_PROTOCOL SimplePointer;
89
90 EFI_UNIX_THUNK_PROTOCOL *UnixThunk;
91 EFI_UNIX_UGA_IO_PROTOCOL *UgaIo;
92
93 EFI_UNICODE_STRING_TABLE *ControllerNameTable;
94
95 EFI_SIMPLE_POINTER_MODE PointerMode;
96 //
97 // GOP Private Data for QueryMode ()
98 //
99 GOP_MODE_DATA *ModeData;
100
101
102 //
103 // UGA Private Data knowing when to start hardware
104 //
105 BOOLEAN HardwareNeedsStarting;
106
107 CHAR16 *WindowName;
108
109 GOP_QUEUE_FIXED Queue;
110
111 EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL SimpleTextInEx;
112 EFI_KEY_STATE KeyState;
113 LIST_ENTRY NotifyList;
114
115
116 } GOP_PRIVATE_DATA;
117
118
119 #define GOP_PRIVATE_DATA_FROM_THIS(a) \
120 CR(a, GOP_PRIVATE_DATA, GraphicsOutput, GOP_PRIVATE_DATA_SIGNATURE)
121
122 #define GOP_PRIVATE_DATA_FROM_TEXT_IN_THIS(a) \
123 CR(a, GOP_PRIVATE_DATA, SimpleTextIn, GOP_PRIVATE_DATA_SIGNATURE)
124
125 #define GOP_PRIVATE_DATA_FROM_TEXT_IN_EX_THIS(a) \
126 CR(a, GOP_PRIVATE_DATA, SimpleTextInEx, GOP_PRIVATE_DATA_SIGNATURE)
127
128 #define GOP_PRIVATE_DATA_FROM_POINTER_MODE_THIS(a) \
129 CR(a, GOP_PRIVATE_DATA, SimplePointer, GOP_PRIVATE_DATA_SIGNATURE)
130
131
132 //
133 // Global Protocol Variables
134 //
135 extern EFI_DRIVER_BINDING_PROTOCOL gUnixGopDriverBinding;
136 extern EFI_COMPONENT_NAME_PROTOCOL gUnixGopComponentName;
137 extern EFI_COMPONENT_NAME2_PROTOCOL gUnixGopComponentName2;
138
139 //
140 // Gop Hardware abstraction internal worker functions
141 //
142 EFI_STATUS
143 UnixGopSupported (
144 IN EFI_UNIX_IO_PROTOCOL *UnixIo
145 )
146 /*++
147
148 Routine Description:
149
150 TODO: Add function description
151
152 Arguments:
153
154 UnixIo - TODO: add argument description
155
156 Returns:
157
158 TODO: add return values
159
160 --*/
161 ;
162
163 EFI_STATUS
164 UnixGopConstructor (
165 IN GOP_PRIVATE_DATA *Private
166 )
167 /*++
168
169 Routine Description:
170
171 TODO: Add function description
172
173 Arguments:
174
175 Private - TODO: add argument description
176
177 Returns:
178
179 TODO: add return values
180
181 --*/
182 ;
183
184 EFI_STATUS
185 UnixGopDestructor (
186 IN GOP_PRIVATE_DATA *Private
187 )
188 /*++
189
190 Routine Description:
191
192 TODO: Add function description
193
194 Arguments:
195
196 Private - TODO: add argument description
197
198 Returns:
199
200 TODO: add return values
201
202 --*/
203 ;
204
205 //
206 // EFI 1.1 driver model prototypes for Win UNIX UGA
207 //
208
209 EFI_STATUS
210 EFIAPI
211 UnixGopInitialize (
212 IN EFI_HANDLE ImageHandle,
213 IN EFI_SYSTEM_TABLE *SystemTable
214 )
215 /*++
216
217 Routine Description:
218
219 TODO: Add function description
220
221 Arguments:
222
223 ImageHandle - TODO: add argument description
224 SystemTable - TODO: add argument description
225
226 Returns:
227
228 TODO: add return values
229
230 --*/
231 ;
232
233 EFI_STATUS
234 EFIAPI
235 UnixGopDriverBindingSupported (
236 IN EFI_DRIVER_BINDING_PROTOCOL *This,
237 IN EFI_HANDLE Handle,
238 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
239 )
240 /*++
241
242 Routine Description:
243
244 TODO: Add function description
245
246 Arguments:
247
248 This - TODO: add argument description
249 Handle - TODO: add argument description
250 RemainingDevicePath - TODO: add argument description
251
252 Returns:
253
254 TODO: add return values
255
256 --*/
257 ;
258
259 EFI_STATUS
260 EFIAPI
261 UnixGopDriverBindingStart (
262 IN EFI_DRIVER_BINDING_PROTOCOL *This,
263 IN EFI_HANDLE Handle,
264 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
265 )
266 /*++
267
268 Routine Description:
269
270 TODO: Add function description
271
272 Arguments:
273
274 This - TODO: add argument description
275 Handle - TODO: add argument description
276 RemainingDevicePath - TODO: add argument description
277
278 Returns:
279
280 TODO: add return values
281
282 --*/
283 ;
284
285 EFI_STATUS
286 EFIAPI
287 UnixGopDriverBindingStop (
288 IN EFI_DRIVER_BINDING_PROTOCOL *This,
289 IN EFI_HANDLE Handle,
290 IN UINTN NumberOfChildren,
291 IN EFI_HANDLE *ChildHandleBuffer
292 )
293 /*++
294
295 Routine Description:
296
297 TODO: Add function description
298
299 Arguments:
300
301 This - TODO: add argument description
302 Handle - TODO: add argument description
303 NumberOfChildren - TODO: add argument description
304 ChildHandleBuffer - TODO: add argument description
305
306 Returns:
307
308 TODO: add return values
309
310 --*/
311 ;
312
313 EFI_STATUS
314 GopPrivateAddQ (
315 IN GOP_PRIVATE_DATA *Private,
316 IN EFI_INPUT_KEY Key
317 )
318 /*++
319
320 Routine Description:
321
322 TODO: Add function description
323
324 Arguments:
325
326 Private - TODO: add argument description
327 Key - TODO: add argument description
328
329 Returns:
330
331 TODO: add return values
332
333 --*/
334 ;
335
336 EFI_STATUS
337 UnixGopInitializeSimpleTextInForWindow (
338 IN GOP_PRIVATE_DATA *Private
339 )
340 /*++
341
342 Routine Description:
343
344 TODO: Add function description
345
346 Arguments:
347
348 Private - TODO: add argument description
349
350 Returns:
351
352 TODO: add return values
353
354 --*/
355 ;
356
357 EFI_STATUS
358 UnixGopInitializeSimplePointerForWindow (
359 IN GOP_PRIVATE_DATA *Private
360 )
361 /*++
362
363 Routine Description:
364
365 TODO: Add function description
366
367 Arguments:
368
369 Private - TODO: add argument description
370
371 Returns:
372
373 TODO: add return values
374
375 --*/
376 ;
377 #endif