]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.h
fix doxygen function comments.
[mirror_edk2.git] / MdeModulePkg / Universal / Console / GraphicsConsoleDxe / GraphicsConsole.h
CommitLineData
fb0b259e 1/** @file\r
2 Header file for GraphicsConsole driver.\r
95276127 3\r
6dcf9abc 4Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
8541adab 5All rights reserved. This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
95276127 12\r
fb0b259e 13**/\r
95276127 14\r
6dcf9abc 15#ifndef _GRAPHICS_CONSOLE_H_\r
16#define _GRAPHICS_CONSOLE_H_\r
95276127 17\r
97a079ed 18#include <PiDxe.h>\r
97a079ed
A
19#include <Protocol/SimpleTextOut.h>\r
20#include <Protocol/GraphicsOutput.h>\r
21#include <Protocol/UgaDraw.h>\r
22#include <Protocol/DevicePath.h>\r
23#include <Library/DebugLib.h>\r
24#include <Library/UefiDriverEntryPoint.h>\r
25#include <Library/UefiLib.h>\r
97a079ed
A
26#include <Library/BaseMemoryLib.h>\r
27#include <Library/MemoryAllocationLib.h>\r
28#include <Library/UefiBootServicesTableLib.h>\r
93e3992d 29#include <Library/HiiLib.h>\r
30#include <Library/BaseLib.h>\r
8541adab 31#include <Library/PcdLib.h>\r
93e3992d 32\r
33#include <MdeModuleHii.h>\r
34\r
35#include <Protocol/HiiFont.h>\r
36#include <Protocol/HiiDatabase.h>\r
97a079ed
A
37\r
38\r
5bca971e 39extern EFI_COMPONENT_NAME_PROTOCOL gGraphicsConsoleComponentName;\r
40extern EFI_COMPONENT_NAME2_PROTOCOL gGraphicsConsoleComponentName2;\r
95276127 41\r
42//\r
97a079ed 43// EFI Component Name Functions\r
95276127 44//\r
5bca971e 45/**\r
46 Retrieves a Unicode string that is the user readable name of the driver.\r
47\r
48 This function retrieves the user readable name of a driver in the form of a\r
49 Unicode string. If the driver specified by This has a user readable name in\r
50 the language specified by Language, then a pointer to the driver name is\r
51 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
52 by This does not support the language specified by Language,\r
53 then EFI_UNSUPPORTED is returned.\r
54\r
55 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
56 EFI_COMPONENT_NAME_PROTOCOL instance.\r
57\r
58 @param Language[in] A pointer to a Null-terminated ASCII string\r
59 array indicating the language. This is the\r
60 language of the driver name that the caller is\r
61 requesting, and it must match one of the\r
62 languages specified in SupportedLanguages. The\r
63 number of languages supported by a driver is up\r
64 to the driver writer. Language is specified\r
65 in RFC 3066 or ISO 639-2 language code format.\r
66\r
67 @param DriverName[out] A pointer to the Unicode string to return.\r
68 This Unicode string is the name of the\r
69 driver specified by This in the language\r
70 specified by Language.\r
71\r
72 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
73 This and the language specified by Language was\r
74 returned in DriverName.\r
75\r
76 @retval EFI_INVALID_PARAMETER Language is NULL.\r
77\r
78 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
79\r
80 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
81 the language specified by Language.\r
82\r
83**/\r
97a079ed
A
84EFI_STATUS\r
85EFIAPI\r
86GraphicsConsoleComponentNameGetDriverName (\r
87 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
88 IN CHAR8 *Language,\r
89 OUT CHAR16 **DriverName\r
90 );\r
91\r
5bca971e 92\r
93/**\r
94 Retrieves a Unicode string that is the user readable name of the controller\r
95 that is being managed by a driver.\r
96\r
97 This function retrieves the user readable name of the controller specified by\r
98 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
99 driver specified by This has a user readable name in the language specified by\r
100 Language, then a pointer to the controller name is returned in ControllerName,\r
101 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
102 managing the controller specified by ControllerHandle and ChildHandle,\r
103 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
104 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
105\r
106 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
107 EFI_COMPONENT_NAME_PROTOCOL instance.\r
108\r
109 @param ControllerHandle[in] The handle of a controller that the driver\r
110 specified by This is managing. This handle\r
111 specifies the controller whose name is to be\r
112 returned.\r
113\r
114 @param ChildHandle[in] The handle of the child controller to retrieve\r
115 the name of. This is an optional parameter that\r
116 may be NULL. It will be NULL for device\r
117 drivers. It will also be NULL for a bus drivers\r
118 that wish to retrieve the name of the bus\r
119 controller. It will not be NULL for a bus\r
120 driver that wishes to retrieve the name of a\r
121 child controller.\r
122\r
123 @param Language[in] A pointer to a Null-terminated ASCII string\r
124 array indicating the language. This is the\r
125 language of the driver name that the caller is\r
126 requesting, and it must match one of the\r
127 languages specified in SupportedLanguages. The\r
128 number of languages supported by a driver is up\r
129 to the driver writer. Language is specified in\r
130 RFC 3066 or ISO 639-2 language code format.\r
131\r
132 @param ControllerName[out] A pointer to the Unicode string to return.\r
133 This Unicode string is the name of the\r
134 controller specified by ControllerHandle and\r
135 ChildHandle in the language specified by\r
136 Language from the point of view of the driver\r
137 specified by This.\r
138\r
139 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
140 the language specified by Language for the\r
141 driver specified by This was returned in\r
142 DriverName.\r
143\r
144 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
145\r
146 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
147 EFI_HANDLE.\r
148\r
149 @retval EFI_INVALID_PARAMETER Language is NULL.\r
150\r
151 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
152\r
153 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
154 managing the controller specified by\r
155 ControllerHandle and ChildHandle.\r
156\r
157 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
158 the language specified by Language.\r
159\r
160**/\r
97a079ed
A
161EFI_STATUS\r
162EFIAPI\r
163GraphicsConsoleComponentNameGetControllerName (\r
164 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
165 IN EFI_HANDLE ControllerHandle,\r
166 IN EFI_HANDLE ChildHandle OPTIONAL,\r
167 IN CHAR8 *Language,\r
168 OUT CHAR16 **ControllerName\r
169 );\r
95276127 170\r
5bca971e 171\r
3012ce5c 172//\r
173// User can define valid graphic resolution here\r
174// e.g. 640x480, 800x600, 1024x768...\r
175//\r
176#define CURRENT_HORIZONTAL_RESOLUTION 800\r
177#define CURRENT_VERTICAL_RESOLUTION 600\r
178\r
95276127 179typedef union {\r
180 EFI_NARROW_GLYPH NarrowGlyph;\r
181 EFI_WIDE_GLYPH WideGlyph;\r
182} GLYPH_UNION;\r
183\r
5bca971e 184extern EFI_NARROW_GLYPH UsStdNarrowGlyphData[];\r
185extern EFI_WIDE_GLYPH UsStdWideGlyphData[];\r
95276127 186\r
187//\r
188// Device Structure\r
189//\r
190#define GRAPHICS_CONSOLE_DEV_SIGNATURE EFI_SIGNATURE_32 ('g', 's', 't', 'o')\r
191\r
192typedef struct {\r
193 UINTN Columns;\r
194 UINTN Rows;\r
195 INTN DeltaX;\r
196 INTN DeltaY;\r
197 UINT32 GopWidth;\r
198 UINT32 GopHeight;\r
199 UINT32 GopModeNumber;\r
200} GRAPHICS_CONSOLE_MODE_DATA;\r
201\r
3012ce5c 202#define GRAPHICS_MAX_MODE 4\r
95276127 203\r
204typedef struct {\r
205 UINTN Signature;\r
206 EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;\r
207 EFI_UGA_DRAW_PROTOCOL *UgaDraw;\r
208 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SimpleTextOutput;\r
209 EFI_SIMPLE_TEXT_OUTPUT_MODE SimpleTextOutputMode;\r
210 GRAPHICS_CONSOLE_MODE_DATA ModeData[GRAPHICS_MAX_MODE];\r
211 EFI_GRAPHICS_OUTPUT_BLT_PIXEL *LineBuffer;\r
212 EFI_HII_HANDLE HiiHandle;\r
213} GRAPHICS_CONSOLE_DEV;\r
214\r
215#define GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS(a) \\r
216 CR (a, GRAPHICS_CONSOLE_DEV, SimpleTextOutput, GRAPHICS_CONSOLE_DEV_SIGNATURE)\r
217\r
218//\r
219// Global Variables\r
220//\r
5bca971e 221extern EFI_DRIVER_BINDING_PROTOCOL gGraphicsConsoleDriverBinding;\r
95276127 222\r
24248368 223\r
224/**\r
225 Returns available Unicode glyphs narrow fonts(8*19 pixels) size.\r
226\r
227 @return Narrow foun size.\r
228\r
229**/\r
95276127 230UINTN\r
231ReturnNarrowFontSize (\r
232 VOID\r
233 );\r
234\r
6dcf9abc 235/**\r
236 Implements SIMPLE_TEXT_OUTPUT.Reset().\r
237 If ExtendeVerification is TRUE, then perform dependent Graphics Console\r
238 device reset, and set display mode to mode 0.\r
239 If ExtendedVerification is FALSE, only set display mode to mode 0.\r
240\r
241 @param This Indicates the calling context.\r
242 @param ExtendedVerification Indicates that the driver may perform a more\r
243 exhaustive verification operation of the device\r
244 during reset.\r
245\r
246 @return EFI_SUCCESS\r
247 @return The reset operation succeeds.\r
248 @return EFI_DEVICE_ERROR\r
249 @return The Graphics Console is not functioning correctly\r
95276127 250\r
6dcf9abc 251**/\r
95276127 252EFI_STATUS\r
253EFIAPI\r
254GraphicsConsoleConOutReset (\r
255 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
256 IN BOOLEAN ExtendedVerification\r
257 );\r
258\r
6dcf9abc 259/**\r
24248368 260 Write a Unicode string to the output device.\r
261\r
262 Implements SIMPLE_TEXT_OUTPUT.OutputString(). \r
6dcf9abc 263 The Unicode string will be converted to Glyphs and will be\r
264 sent to the Graphics Console.\r
265\r
24248368 266 @param This Protocol instance pointer.\r
267 @param WString The NULL-terminated Unicode string to be displayed\r
268 on the output device(s). All output devices must\r
269 also support the Unicode drawing defined in this file.\r
6dcf9abc 270\r
24248368 271 @retval EFI_SUCCESS The string was output to the device.\r
272 @retval EFI_DEVICE_ERROR The device reported an error while attempting to output\r
273 the text.\r
274 @retval EFI_UNSUPPORTED The output device's mode is not currently in a\r
275 defined text mode.\r
276 @retval EFI_WARN_UNKNOWN_GLYPH This warning code indicates that some of the\r
277 characters in the Unicode string could not be\r
278 rendered and were skipped.\r
6dcf9abc 279\r
280**/\r
95276127 281EFI_STATUS\r
282EFIAPI\r
283GraphicsConsoleConOutOutputString (\r
284 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
285 IN CHAR16 *WString\r
286 );\r
287\r
6dcf9abc 288/**\r
289 Implements SIMPLE_TEXT_OUTPUT.TestString().\r
290 If one of the characters in the *Wstring is\r
291 neither valid valid Unicode drawing characters,\r
292 not ASCII code, then this function will return\r
293 EFI_UNSUPPORTED.\r
294\r
295 @param This Indicates the calling context.\r
296 @param WString The Null-terminated Unicode string to be tested.\r
297\r
298 @return EFI_SUCCESS\r
299 @return The Graphics Console is capable of rendering the output string.\r
300 @return EFI_UNSUPPORTED\r
301 @return Some of the characters in the Unicode string cannot be rendered.\r
302\r
303**/\r
95276127 304EFI_STATUS\r
305EFIAPI\r
306GraphicsConsoleConOutTestString (\r
307 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
308 IN CHAR16 *WString\r
309 );\r
310\r
6dcf9abc 311/**\r
24248368 312 Returns information for an available text mode that the output device(s)\r
313 supports\r
314\r
6dcf9abc 315 Implements SIMPLE_TEXT_OUTPUT.QueryMode().\r
24248368 316 It returnes information for an available text mode that the Graphics Console supports.\r
317 In this driver,we only support text mode 80x25, which is defined as mode 0.\r
6dcf9abc 318\r
24248368 319 @param This Protocol instance pointer.\r
6dcf9abc 320 @param ModeNumber The mode number to return information on.\r
321 @param Columns The returned columns of the requested mode.\r
322 @param Rows The returned rows of the requested mode.\r
323\r
24248368 324 @retval EFI_SUCCESS The requested mode information is returned.\r
325 @retval EFI_UNSUPPORTED The mode number is not valid.\r
6dcf9abc 326\r
327**/\r
95276127 328EFI_STATUS\r
329EFIAPI\r
330GraphicsConsoleConOutQueryMode (\r
331 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
332 IN UINTN ModeNumber,\r
333 OUT UINTN *Columns,\r
334 OUT UINTN *Rows\r
335 );\r
336\r
24248368 337\r
6dcf9abc 338/**\r
24248368 339 Sets the output device(s) to a specified mode.\r
340 \r
6dcf9abc 341 Implements SIMPLE_TEXT_OUTPUT.SetMode().\r
24248368 342 Set the Graphics Console to a specified mode. In this driver, we only support mode 0.\r
6dcf9abc 343\r
24248368 344 @param This Protocol instance pointer.\r
6dcf9abc 345 @param ModeNumber The text mode to set.\r
346\r
24248368 347 @retval EFI_SUCCESS The requested text mode is set.\r
348 @retval EFI_DEVICE_ERROR The requested text mode cannot be set because of \r
349 Graphics Console device error.\r
350 @retval EFI_UNSUPPORTED The text mode number is not valid.\r
6dcf9abc 351\r
352**/\r
95276127 353EFI_STATUS\r
354EFIAPI\r
355GraphicsConsoleConOutSetMode (\r
356 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
357 IN UINTN ModeNumber\r
358 );\r
359\r
6dcf9abc 360/**\r
361 Implements SIMPLE_TEXT_OUTPUT.SetAttribute().\r
362\r
363 @param This Indicates the calling context.\r
364 @param Attribute The attribute to set. Only bit0..6 are valid, all\r
365 other bits are undefined and must be zero.\r
366\r
367 @return EFI_SUCCESS The requested attribute is set.\r
368 @return EFI_DEVICE_ERROR The requested attribute cannot be set due to Graphics Console port error.\r
369 @return EFI_UNSUPPORTED The attribute requested is not defined by EFI spec.\r
370\r
371**/\r
95276127 372EFI_STATUS\r
373EFIAPI\r
374GraphicsConsoleConOutSetAttribute (\r
375 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
376 IN UINTN Attribute\r
377 );\r
378\r
6dcf9abc 379/**\r
24248368 380 Clears the output device(s) display to the currently selected background \r
381 color.\r
382\r
6dcf9abc 383 Implements SIMPLE_TEXT_OUTPUT.ClearScreen().\r
6dcf9abc 384\r
24248368 385 @param This Protocol instance pointer.\r
6dcf9abc 386\r
24248368 387 @retval EFI_SUCCESS The operation completed successfully.\r
388 @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.\r
389 @retval EFI_UNSUPPORTED The output device is not in a valid text mode.\r
6dcf9abc 390\r
391**/\r
95276127 392EFI_STATUS\r
393EFIAPI\r
394GraphicsConsoleConOutClearScreen (\r
395 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This\r
396 );\r
397\r
6dcf9abc 398/**\r
399 Implements SIMPLE_TEXT_OUTPUT.SetCursorPosition().\r
400\r
401 @param This Indicates the calling context.\r
402 @param Column The row to set cursor to.\r
403 @param Row The column to set cursor to.\r
404\r
405 @return EFI_SUCCESS\r
406 @return The operation completed successfully.\r
407 @return EFI_DEVICE_ERROR\r
408 @return The request fails due to Graphics Console device error.\r
409 @return EFI_UNSUPPORTED\r
410 @return The Graphics Console is not in a valid text mode, or the cursor position\r
411 @return is invalid for current mode.\r
412\r
413**/\r
95276127 414EFI_STATUS\r
415EFIAPI\r
416GraphicsConsoleConOutSetCursorPosition (\r
417 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
418 IN UINTN Column,\r
419 IN UINTN Row\r
420 );\r
421\r
24248368 422\r
6dcf9abc 423/**\r
24248368 424 Makes the cursor visible or invisible.\r
425\r
6dcf9abc 426 Implements SIMPLE_TEXT_OUTPUT.EnableCursor().\r
6dcf9abc 427\r
24248368 428 @param This Protocol instance pointer.\r
6dcf9abc 429 @param Visible If TRUE, the cursor is set to be visible, If FALSE,\r
430 the cursor is set to be invisible.\r
431\r
24248368 432 @retval EFI_SUCCESS The operation completed successfully.\r
6dcf9abc 433\r
434**/\r
95276127 435EFI_STATUS\r
436EFIAPI\r
437GraphicsConsoleConOutEnableCursor (\r
438 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
439 IN BOOLEAN Visible\r
440 );\r
441\r
24248368 442/**\r
443 Test to see if Graphics Console could be supported on the ControllerHandle.\r
444\r
445 Graphics Console could be supported if Graphics Output Protocol or UGA Draw\r
446 Protocol exists on the ControllerHandle. (UGA Draw Protocol could be shipped\r
447 if PcdUgaConsumeSupport is set to FALSE.)\r
448\r
449 @param This Protocol instance pointer.\r
450 @param ControllerHandle Handle of device to test.\r
451 @param RemainingDevicePath Optional parameter use to pick a specific child\r
452 device to start.\r
453\r
454 @retval EFI_SUCCESS This driver supports this device\r
455 @retval other This driver does not support this device\r
456\r
457**/\r
95276127 458EFI_STATUS\r
459EFIAPI\r
460GraphicsConsoleControllerDriverSupported (\r
461 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
462 IN EFI_HANDLE Controller,\r
463 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
464 );\r
465\r
24248368 466/**\r
467 Start this driver on ControllerHandle by opening Graphics Output protocol or \r
468 UGA Draw protocol, and installing Simple Text Out protocol on ControllerHandle.\r
469 (UGA Draw protocol could be shkipped if PcdUgaConsumeSupport is set to FALSE.)\r
470 \r
471 @param This Protocol instance pointer.\r
472 @param ControllerHandle Handle of device to bind driver to\r
473 @param RemainingDevicePath Optional parameter use to pick a specific child\r
474 device to start.\r
475\r
476 @retval EFI_SUCCESS This driver is added to ControllerHandle\r
477 @retval other This driver does not support this device\r
478\r
479**/\r
95276127 480EFI_STATUS\r
481EFIAPI\r
482GraphicsConsoleControllerDriverStart (\r
483 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
484 IN EFI_HANDLE Controller,\r
485 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
486 );\r
487\r
24248368 488/**\r
489 Stop this driver on ControllerHandle by removing Simple Text Out protocol \r
490 and closing the Graphics Output Protocol or UGA Draw protocol on ControllerHandle.\r
491 (UGA Draw protocol could be shkipped if PcdUgaConsumeSupport is set to FALSE.)\r
492 \r
493\r
494 @param This Protocol instance pointer.\r
495 @param ControllerHandle Handle of device to stop driver on\r
496 @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of\r
497 children is zero stop the entire bus driver.\r
498 @param ChildHandleBuffer List of Child Handles to Stop.\r
499\r
500 @retval EFI_SUCCESS This driver is removed ControllerHandle.\r
501 @retval EFI_NOT_STARTED Simple Text Out protocol could not be found the \r
502 ControllerHandle.\r
503 @retval other This driver was not removed from this device.\r
504\r
505**/\r
95276127 506EFI_STATUS\r
507EFIAPI\r
508GraphicsConsoleControllerDriverStop (\r
509 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
510 IN EFI_HANDLE Controller,\r
511 IN UINTN NumberOfChildren,\r
512 IN EFI_HANDLE *ChildHandleBuffer\r
513 );\r
514\r
6dcf9abc 515\r
24248368 516/**\r
517 Locate HII Database protocol and HII Font protocol.\r
518\r
519 @retval EFI_SUCCESS HII Database protocol and HII Font protocol \r
520 are located successfully.\r
521 @return other Failed to locate HII Database protocol or \r
522 HII Font protocol.\r
523\r
524**/\r
93e3992d 525EFI_STATUS\r
526EfiLocateHiiProtocol (\r
527 VOID\r
528 )\r
529;\r
530\r
531\r
95276127 532#endif\r