]> git.proxmox.com Git - mirror_edk2.git/blame - EmulatorPkg/EmuGopDxe/Gop.h
IntelFsp2WrapperPkg: Support UPD allocation outside FspWrapper
[mirror_edk2.git] / EmulatorPkg / EmuGopDxe / Gop.h
CommitLineData
949f388f 1/*++ @file
2
3Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
4Portions copyright (c) 2010,Apple Inc. All rights reserved.<BR>
d18d8a1d 5This program and the accompanying materials
6are licensed and made available under the terms and conditions of the BSD License
7which accompanies this distribution. The full text of the license may be found at
8http://opensource.org/licenses/bsd-license.php
9
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
949f388f 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
41typedef 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')
49typedef 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;
d18d8a1d 57
949f388f 58#define GRAPHICS_OUTPUT_INVALIDE_MODE_NUMBER 0xffff
59
60typedef struct {
61 UINT32 HorizontalResolution;
62 UINT32 VerticalResolution;
63 UINT32 ColorDepth;
64 UINT32 RefreshRate;
65} GOP_MODE_DATA;
66
67
68
69extern EFI_DRIVER_BINDING_PROTOCOL gEmuGopDriverBinding;
70extern 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')
75typedef 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;
d18d8a1d 106 LIST_ENTRY NotifyList;
949f388f 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//
126extern EFI_DRIVER_BINDING_PROTOCOL gEmuGopDriverBinding;
127extern EFI_COMPONENT_NAME_PROTOCOL gEmuGopComponentName;
128extern EFI_COMPONENT_NAME2_PROTOCOL gEmuGopComponentName2;
129
130//
131// Gop Hardware abstraction internal worker functions
132//
133EFI_STATUS
134EmuGopSupported (
135 IN EMU_IO_THUNK_PROTOCOL *EmuIoThunk
136 );
137
138EFI_STATUS
139EmuGopConstructor (
140 IN GOP_PRIVATE_DATA *Private
141 );
142
143EFI_STATUS
144EmuGopDestructor (
145 IN GOP_PRIVATE_DATA *Private
146 );
147
148
149EFI_STATUS
150GopPrivateAddQ (
151 IN GOP_PRIVATE_DATA *Private,
152 IN EFI_INPUT_KEY Key
153 );
154
155EFI_STATUS
156EmuGopInitializeSimpleTextInForWindow (
157 IN GOP_PRIVATE_DATA *Private
158 );
159
160EFI_STATUS
161EmuGopInitializeSimplePointerForWindow (
162 IN GOP_PRIVATE_DATA *Private
163 );
164
165EFI_STATUS
166EmuGopStartWindow (
167 IN GOP_PRIVATE_DATA *Private,
168 IN UINT32 HorizontalResolution,
169 IN UINT32 VerticalResolution,
170 IN UINT32 ColorDepth,
171 IN UINT32 RefreshRate
172 );
173
174VOID
175EFIAPI
176ShutdownGopEvent (
177 IN EFI_EVENT Event,
178 IN VOID *Context
179 );
180
181VOID
182EFIAPI
183GopPrivateMakeCallbackFunction (
184 IN VOID *Context,
185 IN EFI_KEY_DATA *KeyData
186 );
187
188VOID
189EFIAPI
190GopPrivateBreakCallbackFunction (
191 IN VOID *Context,
192 IN EFI_KEY_DATA *KeyData
193 );
194
195#endif