1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
/*++ @file
Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
Portions copyright (c) 2010,Apple Inc. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef __UGA_H_
#define __UGA_H_
#include <PiDxe.h>
#include <Protocol/GraphicsOutput.h>
#include <Protocol/SimpleTextIn.h>
#include <Protocol/SimpleTextInEx.h>
#include <Protocol/SimplePointer.h>
#include <Protocol/EmuIoThunk.h>
#include <Protocol/EmuGraphicsWindow.h>
#include <Guid/EventGroup.h>
#include <Library/DebugLib.h>
#include <Library/BaseLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/KeyMapLib.h>
#define MAX_Q 256
typedef struct {
UINTN Front;
UINTN Rear;
UINTN Count;
EFI_INPUT_KEY Q[MAX_Q];
} GOP_QUEUE_FIXED;
#define EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY_SIGNATURE SIGNATURE_32 ('U', 'g', 'S', 'n')
typedef struct _EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY {
UINTN Signature;
EFI_HANDLE NotifyHandle;
EFI_KEY_DATA KeyData;
EFI_KEY_NOTIFY_FUNCTION KeyNotificationFn;
EFI_EVENT Event;
LIST_ENTRY NotifyEntry;
} EMU_GOP_SIMPLE_TEXTIN_EX_NOTIFY;
#define GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER 0xffff
typedef struct {
UINT32 HorizontalResolution;
UINT32 VerticalResolution;
UINT32 ColorDepth;
UINT32 RefreshRate;
} GOP_MODE_DATA;
extern EFI_DRIVER_BINDING_PROTOCOL gEmuGopDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gEmuGopComponentName;
#define EMU_UGA_CLASS_NAME L"EmuGopWindow"
#define GOP_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('G', 'o', 'p', 'N')
typedef struct {
UINT64 Signature;
EFI_HANDLE Handle;
EFI_GRAPHICS_OUTPUT_PROTOCOL GraphicsOutput;
EFI_SIMPLE_TEXT_INPUT_PROTOCOL SimpleTextIn;
EFI_SIMPLE_POINTER_PROTOCOL SimplePointer;
EMU_IO_THUNK_PROTOCOL *EmuIoThunk;
EMU_GRAPHICS_WINDOW_PROTOCOL *EmuGraphicsWindow;
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
EFI_SIMPLE_POINTER_MODE PointerMode;
//
// GOP Private Data for QueryMode ()
//
GOP_MODE_DATA *ModeData;
//
// UGA Private Data knowing when to start hardware
//
BOOLEAN HardwareNeedsStarting;
CHAR16 *WindowName;
GOP_QUEUE_FIXED Queue;
EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL SimpleTextInEx;
EFI_KEY_STATE KeyState;
LIST_ENTRY NotifyList;
} GOP_PRIVATE_DATA;
#define GOP_PRIVATE_DATA_FROM_THIS(a) \
CR(a, GOP_PRIVATE_DATA, GraphicsOutput, GOP_PRIVATE_DATA_SIGNATURE)
#define GOP_PRIVATE_DATA_FROM_TEXT_IN_THIS(a) \
CR(a, GOP_PRIVATE_DATA, SimpleTextIn, GOP_PRIVATE_DATA_SIGNATURE)
#define GOP_PRIVATE_DATA_FROM_TEXT_IN_EX_THIS(a) \
CR(a, GOP_PRIVATE_DATA, SimpleTextInEx, GOP_PRIVATE_DATA_SIGNATURE)
#define GOP_PRIVATE_DATA_FROM_POINTER_MODE_THIS(a) \
CR(a, GOP_PRIVATE_DATA, SimplePointer, GOP_PRIVATE_DATA_SIGNATURE)
//
// Global Protocol Variables
//
extern EFI_DRIVER_BINDING_PROTOCOL gEmuGopDriverBinding;
extern EFI_COMPONENT_NAME_PROTOCOL gEmuGopComponentName;
extern EFI_COMPONENT_NAME2_PROTOCOL gEmuGopComponentName2;
//
// Gop Hardware abstraction internal worker functions
//
EFI_STATUS
EmuGopSupported (
IN EMU_IO_THUNK_PROTOCOL *EmuIoThunk
);
EFI_STATUS
EmuGopConstructor (
IN GOP_PRIVATE_DATA *Private
);
EFI_STATUS
EmuGopDestructor (
IN GOP_PRIVATE_DATA *Private
);
EFI_STATUS
GopPrivateAddQ (
IN GOP_PRIVATE_DATA *Private,
IN EFI_INPUT_KEY Key
);
EFI_STATUS
EmuGopInitializeSimpleTextInForWindow (
IN GOP_PRIVATE_DATA *Private
);
EFI_STATUS
EmuGopInitializeSimplePointerForWindow (
IN GOP_PRIVATE_DATA *Private
);
EFI_STATUS
EmuGopStartWindow (
IN GOP_PRIVATE_DATA *Private,
IN UINT32 HorizontalResolution,
IN UINT32 VerticalResolution,
IN UINT32 ColorDepth,
IN UINT32 RefreshRate
);
VOID
EFIAPI
ShutdownGopEvent (
IN EFI_EVENT Event,
IN VOID *Context
);
VOID
EFIAPI
GopPrivateMakeCallbackFunction (
IN VOID *Context,
IN EFI_KEY_DATA *KeyData
);
VOID
EFIAPI
GopPrivateBreakCallbackFunction (
IN VOID *Context,
IN EFI_KEY_DATA *KeyData
);
#endif
|