]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.h
add PCD PcdUgaConsumeSupport to switch on/off EFI UGA Draw Protocol's consuming,...
[mirror_edk2.git] / MdeModulePkg / Universal / Console / GraphicsConsoleDxe / GraphicsConsole.h
1 /*++
2
3 Copyright (c) 2006 - 2008, 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 GraphicsConsole.h
15
16 Abstract:
17
18
19 Revision History
20
21 --*/
22
23 #ifndef _GRAPHICS_CONSOLE_H
24 #define _GRAPHICS_CONSOLE_H
25
26 #include <PiDxe.h>
27 #include <Protocol/SimpleTextOut.h>
28 #include <Protocol/GraphicsOutput.h>
29 #include <Protocol/UgaDraw.h>
30 #include <Protocol/DevicePath.h>
31 #include <Library/DebugLib.h>
32 #include <Library/UefiDriverEntryPoint.h>
33 #include <Library/UefiLib.h>
34 #include <Library/BaseMemoryLib.h>
35 #include <Library/MemoryAllocationLib.h>
36 #include <Library/UefiBootServicesTableLib.h>
37 #include <Library/HiiLib.h>
38 #include <Library/BaseLib.h>
39 #include <Library/PcdLib.h>
40
41 #include <MdeModuleHii.h>
42
43 #include <Protocol/HiiFont.h>
44 #include <Protocol/HiiDatabase.h>
45
46
47 extern EFI_COMPONENT_NAME_PROTOCOL gGraphicsConsoleComponentName;
48 extern EFI_COMPONENT_NAME2_PROTOCOL gGraphicsConsoleComponentName2;
49
50 //
51 // EFI Component Name Functions
52 //
53 /**
54 Retrieves a Unicode string that is the user readable name of the driver.
55
56 This function retrieves the user readable name of a driver in the form of a
57 Unicode string. If the driver specified by This has a user readable name in
58 the language specified by Language, then a pointer to the driver name is
59 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
60 by This does not support the language specified by Language,
61 then EFI_UNSUPPORTED is returned.
62
63 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
64 EFI_COMPONENT_NAME_PROTOCOL instance.
65
66 @param Language[in] A pointer to a Null-terminated ASCII string
67 array indicating the language. This is the
68 language of the driver name that the caller is
69 requesting, and it must match one of the
70 languages specified in SupportedLanguages. The
71 number of languages supported by a driver is up
72 to the driver writer. Language is specified
73 in RFC 3066 or ISO 639-2 language code format.
74
75 @param DriverName[out] A pointer to the Unicode string to return.
76 This Unicode string is the name of the
77 driver specified by This in the language
78 specified by Language.
79
80 @retval EFI_SUCCESS The Unicode string for the Driver specified by
81 This and the language specified by Language was
82 returned in DriverName.
83
84 @retval EFI_INVALID_PARAMETER Language is NULL.
85
86 @retval EFI_INVALID_PARAMETER DriverName is NULL.
87
88 @retval EFI_UNSUPPORTED The driver specified by This does not support
89 the language specified by Language.
90
91 **/
92 EFI_STATUS
93 EFIAPI
94 GraphicsConsoleComponentNameGetDriverName (
95 IN EFI_COMPONENT_NAME_PROTOCOL *This,
96 IN CHAR8 *Language,
97 OUT CHAR16 **DriverName
98 );
99
100
101 /**
102 Retrieves a Unicode string that is the user readable name of the controller
103 that is being managed by a driver.
104
105 This function retrieves the user readable name of the controller specified by
106 ControllerHandle and ChildHandle in the form of a Unicode string. If the
107 driver specified by This has a user readable name in the language specified by
108 Language, then a pointer to the controller name is returned in ControllerName,
109 and EFI_SUCCESS is returned. If the driver specified by This is not currently
110 managing the controller specified by ControllerHandle and ChildHandle,
111 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
112 support the language specified by Language, then EFI_UNSUPPORTED is returned.
113
114 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
115 EFI_COMPONENT_NAME_PROTOCOL instance.
116
117 @param ControllerHandle[in] The handle of a controller that the driver
118 specified by This is managing. This handle
119 specifies the controller whose name is to be
120 returned.
121
122 @param ChildHandle[in] The handle of the child controller to retrieve
123 the name of. This is an optional parameter that
124 may be NULL. It will be NULL for device
125 drivers. It will also be NULL for a bus drivers
126 that wish to retrieve the name of the bus
127 controller. It will not be NULL for a bus
128 driver that wishes to retrieve the name of a
129 child controller.
130
131 @param Language[in] A pointer to a Null-terminated ASCII string
132 array indicating the language. This is the
133 language of the driver name that the caller is
134 requesting, and it must match one of the
135 languages specified in SupportedLanguages. The
136 number of languages supported by a driver is up
137 to the driver writer. Language is specified in
138 RFC 3066 or ISO 639-2 language code format.
139
140 @param ControllerName[out] A pointer to the Unicode string to return.
141 This Unicode string is the name of the
142 controller specified by ControllerHandle and
143 ChildHandle in the language specified by
144 Language from the point of view of the driver
145 specified by This.
146
147 @retval EFI_SUCCESS The Unicode string for the user readable name in
148 the language specified by Language for the
149 driver specified by This was returned in
150 DriverName.
151
152 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
153
154 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
155 EFI_HANDLE.
156
157 @retval EFI_INVALID_PARAMETER Language is NULL.
158
159 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
160
161 @retval EFI_UNSUPPORTED The driver specified by This is not currently
162 managing the controller specified by
163 ControllerHandle and ChildHandle.
164
165 @retval EFI_UNSUPPORTED The driver specified by This does not support
166 the language specified by Language.
167
168 **/
169 EFI_STATUS
170 EFIAPI
171 GraphicsConsoleComponentNameGetControllerName (
172 IN EFI_COMPONENT_NAME_PROTOCOL *This,
173 IN EFI_HANDLE ControllerHandle,
174 IN EFI_HANDLE ChildHandle OPTIONAL,
175 IN CHAR8 *Language,
176 OUT CHAR16 **ControllerName
177 );
178
179
180 //
181 // Glyph database
182 //
183 //#define GLYPH_WIDTH 8
184 //#define GLYPH_HEIGHT 19
185
186 //
187 // User can define valid graphic resolution here
188 // e.g. 640x480, 800x600, 1024x768...
189 //
190 #define CURRENT_HORIZONTAL_RESOLUTION 800
191 #define CURRENT_VERTICAL_RESOLUTION 600
192
193 typedef union {
194 EFI_NARROW_GLYPH NarrowGlyph;
195 EFI_WIDE_GLYPH WideGlyph;
196 } GLYPH_UNION;
197
198 extern EFI_NARROW_GLYPH UsStdNarrowGlyphData[];
199 extern EFI_WIDE_GLYPH UsStdWideGlyphData[];
200
201 //
202 // Device Structure
203 //
204 #define GRAPHICS_CONSOLE_DEV_SIGNATURE EFI_SIGNATURE_32 ('g', 's', 't', 'o')
205
206 typedef struct {
207 UINTN Columns;
208 UINTN Rows;
209 INTN DeltaX;
210 INTN DeltaY;
211 UINT32 GopWidth;
212 UINT32 GopHeight;
213 UINT32 GopModeNumber;
214 } GRAPHICS_CONSOLE_MODE_DATA;
215
216 #define GRAPHICS_MAX_MODE 4
217
218 typedef struct {
219 UINTN Signature;
220 EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
221 EFI_UGA_DRAW_PROTOCOL *UgaDraw;
222 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SimpleTextOutput;
223 EFI_SIMPLE_TEXT_OUTPUT_MODE SimpleTextOutputMode;
224 GRAPHICS_CONSOLE_MODE_DATA ModeData[GRAPHICS_MAX_MODE];
225 EFI_GRAPHICS_OUTPUT_BLT_PIXEL *LineBuffer;
226 EFI_HII_HANDLE HiiHandle;
227 } GRAPHICS_CONSOLE_DEV;
228
229 #define GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS(a) \
230 CR (a, GRAPHICS_CONSOLE_DEV, SimpleTextOutput, GRAPHICS_CONSOLE_DEV_SIGNATURE)
231
232 //
233 // Global Variables
234 //
235 extern EFI_DRIVER_BINDING_PROTOCOL gGraphicsConsoleDriverBinding;
236
237 //
238 // Prototypes
239 //
240 UINTN
241 ReturnNarrowFontSize (
242 VOID
243 );
244
245 UINTN
246 ReturnWideFontSize (
247 VOID
248 );
249
250 EFI_STATUS
251 EFIAPI
252 GraphicsConsoleConOutReset (
253 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
254 IN BOOLEAN ExtendedVerification
255 );
256
257 EFI_STATUS
258 EFIAPI
259 GraphicsConsoleConOutOutputString (
260 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
261 IN CHAR16 *WString
262 );
263
264 EFI_STATUS
265 EFIAPI
266 GraphicsConsoleConOutTestString (
267 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
268 IN CHAR16 *WString
269 );
270
271 EFI_STATUS
272 EFIAPI
273 GraphicsConsoleConOutQueryMode (
274 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
275 IN UINTN ModeNumber,
276 OUT UINTN *Columns,
277 OUT UINTN *Rows
278 );
279
280 EFI_STATUS
281 EFIAPI
282 GraphicsConsoleConOutSetMode (
283 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
284 IN UINTN ModeNumber
285 );
286
287 EFI_STATUS
288 EFIAPI
289 GraphicsConsoleConOutSetAttribute (
290 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
291 IN UINTN Attribute
292 );
293
294 EFI_STATUS
295 EFIAPI
296 GraphicsConsoleConOutClearScreen (
297 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This
298 );
299
300 EFI_STATUS
301 EFIAPI
302 GraphicsConsoleConOutSetCursorPosition (
303 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
304 IN UINTN Column,
305 IN UINTN Row
306 );
307
308 EFI_STATUS
309 EFIAPI
310 GraphicsConsoleConOutEnableCursor (
311 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,
312 IN BOOLEAN Visible
313 );
314
315 EFI_STATUS
316 EFIAPI
317 GraphicsConsoleControllerDriverSupported (
318 IN EFI_DRIVER_BINDING_PROTOCOL *This,
319 IN EFI_HANDLE Controller,
320 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
321 );
322
323 EFI_STATUS
324 EFIAPI
325 GraphicsConsoleControllerDriverStart (
326 IN EFI_DRIVER_BINDING_PROTOCOL *This,
327 IN EFI_HANDLE Controller,
328 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
329 );
330
331 EFI_STATUS
332 EFIAPI
333 GraphicsConsoleControllerDriverStop (
334 IN EFI_DRIVER_BINDING_PROTOCOL *This,
335 IN EFI_HANDLE Controller,
336 IN UINTN NumberOfChildren,
337 IN EFI_HANDLE *ChildHandleBuffer
338 );
339
340 EFI_STATUS
341 EfiLocateHiiProtocol (
342 VOID
343 )
344 ;
345
346
347 #endif