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