]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.h
clean up the un-suitable ';' location when declaring the functions.
[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
60c93673 18#include <Uefi.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
8595bdaf 184extern EFI_NARROW_GLYPH gUsStdNarrowGlyphData[];\r
95276127 185\r
186//\r
187// Device Structure\r
188//\r
189#define GRAPHICS_CONSOLE_DEV_SIGNATURE EFI_SIGNATURE_32 ('g', 's', 't', 'o')\r
190\r
191typedef struct {\r
192 UINTN Columns;\r
193 UINTN Rows;\r
194 INTN DeltaX;\r
195 INTN DeltaY;\r
196 UINT32 GopWidth;\r
197 UINT32 GopHeight;\r
198 UINT32 GopModeNumber;\r
199} GRAPHICS_CONSOLE_MODE_DATA;\r
200\r
3012ce5c 201#define GRAPHICS_MAX_MODE 4\r
95276127 202\r
203typedef struct {\r
204 UINTN Signature;\r
205 EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;\r
206 EFI_UGA_DRAW_PROTOCOL *UgaDraw;\r
207 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SimpleTextOutput;\r
208 EFI_SIMPLE_TEXT_OUTPUT_MODE SimpleTextOutputMode;\r
209 GRAPHICS_CONSOLE_MODE_DATA ModeData[GRAPHICS_MAX_MODE];\r
210 EFI_GRAPHICS_OUTPUT_BLT_PIXEL *LineBuffer;\r
211 EFI_HII_HANDLE HiiHandle;\r
212} GRAPHICS_CONSOLE_DEV;\r
213\r
214#define GRAPHICS_CONSOLE_CON_OUT_DEV_FROM_THIS(a) \\r
215 CR (a, GRAPHICS_CONSOLE_DEV, SimpleTextOutput, GRAPHICS_CONSOLE_DEV_SIGNATURE)\r
216\r
217//\r
218// Global Variables\r
219//\r
5bca971e 220extern EFI_DRIVER_BINDING_PROTOCOL gGraphicsConsoleDriverBinding;\r
95276127 221\r
24248368 222\r
223/**\r
224 Returns available Unicode glyphs narrow fonts(8*19 pixels) size.\r
225\r
226 @return Narrow foun size.\r
227\r
228**/\r
95276127 229UINTN\r
230ReturnNarrowFontSize (\r
231 VOID\r
232 );\r
233\r
6dcf9abc 234/**\r
235 Implements SIMPLE_TEXT_OUTPUT.Reset().\r
236 If ExtendeVerification is TRUE, then perform dependent Graphics Console\r
237 device reset, and set display mode to mode 0.\r
238 If ExtendedVerification is FALSE, only set display mode to mode 0.\r
239\r
240 @param This Indicates the calling context.\r
241 @param ExtendedVerification Indicates that the driver may perform a more\r
242 exhaustive verification operation of the device\r
243 during reset.\r
244\r
245 @return EFI_SUCCESS\r
246 @return The reset operation succeeds.\r
247 @return EFI_DEVICE_ERROR\r
248 @return The Graphics Console is not functioning correctly\r
95276127 249\r
6dcf9abc 250**/\r
95276127 251EFI_STATUS\r
252EFIAPI\r
253GraphicsConsoleConOutReset (\r
254 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
255 IN BOOLEAN ExtendedVerification\r
256 );\r
257\r
6dcf9abc 258/**\r
24248368 259 Write a Unicode string to the output device.\r
260\r
261 Implements SIMPLE_TEXT_OUTPUT.OutputString(). \r
6dcf9abc 262 The Unicode string will be converted to Glyphs and will be\r
263 sent to the Graphics Console.\r
264\r
24248368 265 @param This Protocol instance pointer.\r
266 @param WString The NULL-terminated Unicode string to be displayed\r
267 on the output device(s). All output devices must\r
268 also support the Unicode drawing defined in this file.\r
6dcf9abc 269\r
24248368 270 @retval EFI_SUCCESS The string was output to the device.\r
271 @retval EFI_DEVICE_ERROR The device reported an error while attempting to output\r
272 the text.\r
273 @retval EFI_UNSUPPORTED The output device's mode is not currently in a\r
274 defined text mode.\r
275 @retval EFI_WARN_UNKNOWN_GLYPH This warning code indicates that some of the\r
276 characters in the Unicode string could not be\r
277 rendered and were skipped.\r
6dcf9abc 278\r
279**/\r
95276127 280EFI_STATUS\r
281EFIAPI\r
282GraphicsConsoleConOutOutputString (\r
283 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
284 IN CHAR16 *WString\r
285 );\r
286\r
6dcf9abc 287/**\r
288 Implements SIMPLE_TEXT_OUTPUT.TestString().\r
289 If one of the characters in the *Wstring is\r
290 neither valid valid Unicode drawing characters,\r
291 not ASCII code, then this function will return\r
292 EFI_UNSUPPORTED.\r
293\r
294 @param This Indicates the calling context.\r
295 @param WString The Null-terminated Unicode string to be tested.\r
296\r
297 @return EFI_SUCCESS\r
298 @return The Graphics Console is capable of rendering the output string.\r
299 @return EFI_UNSUPPORTED\r
300 @return Some of the characters in the Unicode string cannot be rendered.\r
301\r
302**/\r
95276127 303EFI_STATUS\r
304EFIAPI\r
305GraphicsConsoleConOutTestString (\r
306 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
307 IN CHAR16 *WString\r
308 );\r
309\r
6dcf9abc 310/**\r
24248368 311 Returns information for an available text mode that the output device(s)\r
312 supports\r
313\r
6dcf9abc 314 Implements SIMPLE_TEXT_OUTPUT.QueryMode().\r
24248368 315 It returnes information for an available text mode that the Graphics Console supports.\r
316 In this driver,we only support text mode 80x25, which is defined as mode 0.\r
6dcf9abc 317\r
24248368 318 @param This Protocol instance pointer.\r
6dcf9abc 319 @param ModeNumber The mode number to return information on.\r
320 @param Columns The returned columns of the requested mode.\r
321 @param Rows The returned rows of the requested mode.\r
322\r
24248368 323 @retval EFI_SUCCESS The requested mode information is returned.\r
324 @retval EFI_UNSUPPORTED The mode number is not valid.\r
6dcf9abc 325\r
326**/\r
95276127 327EFI_STATUS\r
328EFIAPI\r
329GraphicsConsoleConOutQueryMode (\r
330 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
331 IN UINTN ModeNumber,\r
332 OUT UINTN *Columns,\r
333 OUT UINTN *Rows\r
334 );\r
335\r
24248368 336\r
6dcf9abc 337/**\r
24248368 338 Sets the output device(s) to a specified mode.\r
339 \r
6dcf9abc 340 Implements SIMPLE_TEXT_OUTPUT.SetMode().\r
24248368 341 Set the Graphics Console to a specified mode. In this driver, we only support mode 0.\r
6dcf9abc 342\r
24248368 343 @param This Protocol instance pointer.\r
6dcf9abc 344 @param ModeNumber The text mode to set.\r
345\r
24248368 346 @retval EFI_SUCCESS The requested text mode is set.\r
347 @retval EFI_DEVICE_ERROR The requested text mode cannot be set because of \r
348 Graphics Console device error.\r
349 @retval EFI_UNSUPPORTED The text mode number is not valid.\r
6dcf9abc 350\r
351**/\r
95276127 352EFI_STATUS\r
353EFIAPI\r
354GraphicsConsoleConOutSetMode (\r
355 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
356 IN UINTN ModeNumber\r
357 );\r
358\r
6dcf9abc 359/**\r
360 Implements SIMPLE_TEXT_OUTPUT.SetAttribute().\r
361\r
362 @param This Indicates the calling context.\r
363 @param Attribute The attribute to set. Only bit0..6 are valid, all\r
364 other bits are undefined and must be zero.\r
365\r
366 @return EFI_SUCCESS The requested attribute is set.\r
367 @return EFI_DEVICE_ERROR The requested attribute cannot be set due to Graphics Console port error.\r
368 @return EFI_UNSUPPORTED The attribute requested is not defined by EFI spec.\r
369\r
370**/\r
95276127 371EFI_STATUS\r
372EFIAPI\r
373GraphicsConsoleConOutSetAttribute (\r
374 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
375 IN UINTN Attribute\r
376 );\r
377\r
6dcf9abc 378/**\r
24248368 379 Clears the output device(s) display to the currently selected background \r
380 color.\r
381\r
6dcf9abc 382 Implements SIMPLE_TEXT_OUTPUT.ClearScreen().\r
6dcf9abc 383\r
24248368 384 @param This Protocol instance pointer.\r
6dcf9abc 385\r
24248368 386 @retval EFI_SUCCESS The operation completed successfully.\r
387 @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.\r
388 @retval EFI_UNSUPPORTED The output device is not in a valid text mode.\r
6dcf9abc 389\r
390**/\r
95276127 391EFI_STATUS\r
392EFIAPI\r
393GraphicsConsoleConOutClearScreen (\r
394 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This\r
395 );\r
396\r
6dcf9abc 397/**\r
398 Implements SIMPLE_TEXT_OUTPUT.SetCursorPosition().\r
399\r
400 @param This Indicates the calling context.\r
401 @param Column The row to set cursor to.\r
402 @param Row The column to set cursor to.\r
403\r
404 @return EFI_SUCCESS\r
405 @return The operation completed successfully.\r
406 @return EFI_DEVICE_ERROR\r
407 @return The request fails due to Graphics Console device error.\r
408 @return EFI_UNSUPPORTED\r
409 @return The Graphics Console is not in a valid text mode, or the cursor position\r
410 @return is invalid for current mode.\r
411\r
412**/\r
95276127 413EFI_STATUS\r
414EFIAPI\r
415GraphicsConsoleConOutSetCursorPosition (\r
416 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
417 IN UINTN Column,\r
418 IN UINTN Row\r
419 );\r
420\r
24248368 421\r
6dcf9abc 422/**\r
24248368 423 Makes the cursor visible or invisible.\r
424\r
6dcf9abc 425 Implements SIMPLE_TEXT_OUTPUT.EnableCursor().\r
6dcf9abc 426\r
24248368 427 @param This Protocol instance pointer.\r
6dcf9abc 428 @param Visible If TRUE, the cursor is set to be visible, If FALSE,\r
429 the cursor is set to be invisible.\r
430\r
24248368 431 @retval EFI_SUCCESS The operation completed successfully.\r
6dcf9abc 432\r
433**/\r
95276127 434EFI_STATUS\r
435EFIAPI\r
436GraphicsConsoleConOutEnableCursor (\r
437 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
438 IN BOOLEAN Visible\r
439 );\r
440\r
24248368 441/**\r
8595bdaf 442 Test to see if Graphics Console could be supported on the Controller.\r
24248368 443\r
444 Graphics Console could be supported if Graphics Output Protocol or UGA Draw\r
8595bdaf 445 Protocol exists on the Controller. (UGA Draw Protocol could be skipped\r
24248368 446 if PcdUgaConsumeSupport is set to FALSE.)\r
447\r
448 @param This Protocol instance pointer.\r
8595bdaf 449 @param Controller Handle of device to test.\r
24248368 450 @param RemainingDevicePath Optional parameter use to pick a specific child\r
451 device to start.\r
452\r
8595bdaf 453 @retval EFI_SUCCESS This driver supports this device.\r
454 @retval other This driver does not support this device.\r
24248368 455\r
456**/\r
95276127 457EFI_STATUS\r
458EFIAPI\r
459GraphicsConsoleControllerDriverSupported (\r
460 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
461 IN EFI_HANDLE Controller,\r
462 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
463 );\r
464\r
8595bdaf 465\r
24248368 466/**\r
8595bdaf 467 Start this driver on Controller by opening Graphics Output protocol or \r
468 UGA Draw protocol, and installing Simple Text Out protocol on Controller.\r
24248368 469 (UGA Draw protocol could be shkipped if PcdUgaConsumeSupport is set to FALSE.)\r
470 \r
471 @param This Protocol instance pointer.\r
8595bdaf 472 @param Controller Handle of device to bind driver to\r
24248368 473 @param RemainingDevicePath Optional parameter use to pick a specific child\r
474 device to start.\r
475\r
8595bdaf 476 @retval EFI_SUCCESS This driver is added to Controller.\r
477 @retval other This driver does not support this device.\r
24248368 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
8595bdaf 489 Stop this driver on Controller by removing Simple Text Out protocol \r
490 and closing the Graphics Output Protocol or UGA Draw protocol on Controller.\r
24248368 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
8595bdaf 495 @param Controller Handle of device to stop driver on\r
24248368 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
8595bdaf 500 @retval EFI_SUCCESS This driver is removed Controller.\r
24248368 501 @retval EFI_NOT_STARTED Simple Text Out protocol could not be found the \r
8595bdaf 502 Controller.\r
24248368 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
ed66e1bc 528 );\r
93e3992d 529\r
530\r
95276127 531#endif\r