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