]>
Commit | Line | Data |
---|---|---|
fb0b259e | 1 | /** @file\r |
2 | Header file for GraphicsConsole driver.\r | |
95276127 | 3 | \r |
6dcf9abc | 4 | Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r |
8541adab | 5 | All rights reserved. This program and the accompanying materials\r |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT 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 | 39 | extern EFI_COMPONENT_NAME_PROTOCOL gGraphicsConsoleComponentName;\r |
40 | extern 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 |
84 | EFI_STATUS\r |
85 | EFIAPI\r | |
86 | GraphicsConsoleComponentNameGetDriverName (\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 |
161 | EFI_STATUS\r |
162 | EFIAPI\r | |
163 | GraphicsConsoleComponentNameGetControllerName (\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 | 179 | typedef union {\r |
180 | EFI_NARROW_GLYPH NarrowGlyph;\r | |
181 | EFI_WIDE_GLYPH WideGlyph;\r | |
182 | } GLYPH_UNION;\r | |
183 | \r | |
5bca971e | 184 | extern EFI_NARROW_GLYPH UsStdNarrowGlyphData[];\r |
185 | extern 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 | |
192 | typedef 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 |
204 | typedef 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 | 221 | extern EFI_DRIVER_BINDING_PROTOCOL gGraphicsConsoleDriverBinding;\r |
95276127 | 222 | \r |
223 | //\r | |
224 | // Prototypes\r | |
225 | //\r | |
226 | UINTN\r | |
227 | ReturnNarrowFontSize (\r | |
228 | VOID\r | |
229 | );\r | |
230 | \r | |
6dcf9abc | 231 | /**\r |
232 | Implements SIMPLE_TEXT_OUTPUT.Reset().\r | |
233 | If ExtendeVerification is TRUE, then perform dependent Graphics Console\r | |
234 | device reset, and set display mode to mode 0.\r | |
235 | If ExtendedVerification is FALSE, only set display mode to mode 0.\r | |
236 | \r | |
237 | @param This Indicates the calling context.\r | |
238 | @param ExtendedVerification Indicates that the driver may perform a more\r | |
239 | exhaustive verification operation of the device\r | |
240 | during reset.\r | |
241 | \r | |
242 | @return EFI_SUCCESS\r | |
243 | @return The reset operation succeeds.\r | |
244 | @return EFI_DEVICE_ERROR\r | |
245 | @return The Graphics Console is not functioning correctly\r | |
95276127 | 246 | \r |
6dcf9abc | 247 | **/\r |
95276127 | 248 | EFI_STATUS\r |
249 | EFIAPI\r | |
250 | GraphicsConsoleConOutReset (\r | |
251 | IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r | |
252 | IN BOOLEAN ExtendedVerification\r | |
253 | );\r | |
254 | \r | |
6dcf9abc | 255 | /**\r |
256 | Implements SIMPLE_TEXT_OUTPUT.OutputString().\r | |
257 | The Unicode string will be converted to Glyphs and will be\r | |
258 | sent to the Graphics Console.\r | |
259 | \r | |
260 | @param This Indicates the calling context.\r | |
261 | @param WString The Null-terminated Unicode string to be displayed\r | |
262 | on the Graphics Console.\r | |
263 | \r | |
264 | @return EFI_SUCCESS\r | |
265 | @return The string is output successfully.\r | |
266 | @return EFI_DEVICE_ERROR\r | |
267 | @return The Graphics Console failed to send the string out.\r | |
268 | @return EFI_WARN_UNKNOWN_GLYPH\r | |
269 | @return Indicates that some of the characters in the Unicode string could not\r | |
270 | @return be rendered and are skipped.\r | |
271 | \r | |
272 | **/\r | |
95276127 | 273 | EFI_STATUS\r |
274 | EFIAPI\r | |
275 | GraphicsConsoleConOutOutputString (\r | |
276 | IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r | |
277 | IN CHAR16 *WString\r | |
278 | );\r | |
279 | \r | |
6dcf9abc | 280 | /**\r |
281 | Implements SIMPLE_TEXT_OUTPUT.TestString().\r | |
282 | If one of the characters in the *Wstring is\r | |
283 | neither valid valid Unicode drawing characters,\r | |
284 | not ASCII code, then this function will return\r | |
285 | EFI_UNSUPPORTED.\r | |
286 | \r | |
287 | @param This Indicates the calling context.\r | |
288 | @param WString The Null-terminated Unicode string to be tested.\r | |
289 | \r | |
290 | @return EFI_SUCCESS\r | |
291 | @return The Graphics Console is capable of rendering the output string.\r | |
292 | @return EFI_UNSUPPORTED\r | |
293 | @return Some of the characters in the Unicode string cannot be rendered.\r | |
294 | \r | |
295 | **/\r | |
95276127 | 296 | EFI_STATUS\r |
297 | EFIAPI\r | |
298 | GraphicsConsoleConOutTestString (\r | |
299 | IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r | |
300 | IN CHAR16 *WString\r | |
301 | );\r | |
302 | \r | |
6dcf9abc | 303 | /**\r |
304 | Implements SIMPLE_TEXT_OUTPUT.QueryMode().\r | |
305 | It returnes information for an available text mode\r | |
306 | that the Graphics Console supports.\r | |
307 | In this driver,we only support text mode 80x25, which is\r | |
308 | defined as mode 0.\r | |
309 | \r | |
310 | @param This Indicates the calling context.\r | |
311 | @param ModeNumber The mode number to return information on.\r | |
312 | @param Columns The returned columns of the requested mode.\r | |
313 | @param Rows The returned rows of the requested mode.\r | |
314 | \r | |
315 | @return EFI_SUCCESS\r | |
316 | @return The requested mode information is returned.\r | |
317 | @return EFI_UNSUPPORTED\r | |
318 | @return The mode number is not valid.\r | |
319 | \r | |
320 | **/\r | |
95276127 | 321 | EFI_STATUS\r |
322 | EFIAPI\r | |
323 | GraphicsConsoleConOutQueryMode (\r | |
324 | IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r | |
325 | IN UINTN ModeNumber,\r | |
326 | OUT UINTN *Columns,\r | |
327 | OUT UINTN *Rows\r | |
328 | );\r | |
329 | \r | |
6dcf9abc | 330 | /**\r |
331 | Implements SIMPLE_TEXT_OUTPUT.SetMode().\r | |
332 | Set the Graphics Console to a specified mode.\r | |
333 | In this driver, we only support mode 0.\r | |
334 | \r | |
335 | @param This Indicates the calling context.\r | |
336 | @param ModeNumber The text mode to set.\r | |
337 | \r | |
338 | @return EFI_SUCCESS\r | |
339 | @return The requested text mode is set.\r | |
340 | @return EFI_DEVICE_ERROR\r | |
341 | @return The requested text mode cannot be set because of Graphics Console device error.\r | |
342 | @return EFI_UNSUPPORTED\r | |
343 | @return The text mode number is not valid.\r | |
344 | \r | |
345 | **/\r | |
95276127 | 346 | EFI_STATUS\r |
347 | EFIAPI\r | |
348 | GraphicsConsoleConOutSetMode (\r | |
349 | IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r | |
350 | IN UINTN ModeNumber\r | |
351 | );\r | |
352 | \r | |
6dcf9abc | 353 | /**\r |
354 | Implements SIMPLE_TEXT_OUTPUT.SetAttribute().\r | |
355 | \r | |
356 | @param This Indicates the calling context.\r | |
357 | @param Attribute The attribute to set. Only bit0..6 are valid, all\r | |
358 | other bits are undefined and must be zero.\r | |
359 | \r | |
360 | @return EFI_SUCCESS The requested attribute is set.\r | |
361 | @return EFI_DEVICE_ERROR The requested attribute cannot be set due to Graphics Console port error.\r | |
362 | @return EFI_UNSUPPORTED The attribute requested is not defined by EFI spec.\r | |
363 | \r | |
364 | **/\r | |
95276127 | 365 | EFI_STATUS\r |
366 | EFIAPI\r | |
367 | GraphicsConsoleConOutSetAttribute (\r | |
368 | IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r | |
369 | IN UINTN Attribute\r | |
370 | );\r | |
371 | \r | |
6dcf9abc | 372 | /**\r |
373 | Implements SIMPLE_TEXT_OUTPUT.ClearScreen().\r | |
374 | It clears the Graphics Console's display to the\r | |
375 | currently selected background color.\r | |
376 | \r | |
377 | @param This Indicates the calling context.\r | |
378 | \r | |
379 | @return EFI_SUCCESS\r | |
380 | @return The operation completed successfully.\r | |
381 | @return EFI_DEVICE_ERROR\r | |
382 | @return The Graphics Console cannot be cleared due to Graphics Console device error.\r | |
383 | @return EFI_UNSUPPORTED\r | |
384 | @return The Graphics Console is not in a valid text mode.\r | |
385 | \r | |
386 | **/\r | |
95276127 | 387 | EFI_STATUS\r |
388 | EFIAPI\r | |
389 | GraphicsConsoleConOutClearScreen (\r | |
390 | IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This\r | |
391 | );\r | |
392 | \r | |
6dcf9abc | 393 | /**\r |
394 | Implements SIMPLE_TEXT_OUTPUT.SetCursorPosition().\r | |
395 | \r | |
396 | @param This Indicates the calling context.\r | |
397 | @param Column The row to set cursor to.\r | |
398 | @param Row The column to set cursor to.\r | |
399 | \r | |
400 | @return EFI_SUCCESS\r | |
401 | @return The operation completed successfully.\r | |
402 | @return EFI_DEVICE_ERROR\r | |
403 | @return The request fails due to Graphics Console device error.\r | |
404 | @return EFI_UNSUPPORTED\r | |
405 | @return The Graphics Console is not in a valid text mode, or the cursor position\r | |
406 | @return is invalid for current mode.\r | |
407 | \r | |
408 | **/\r | |
95276127 | 409 | EFI_STATUS\r |
410 | EFIAPI\r | |
411 | GraphicsConsoleConOutSetCursorPosition (\r | |
412 | IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r | |
413 | IN UINTN Column,\r | |
414 | IN UINTN Row\r | |
415 | );\r | |
416 | \r | |
6dcf9abc | 417 | /**\r |
418 | Implements SIMPLE_TEXT_OUTPUT.EnableCursor().\r | |
419 | In this driver, the cursor cannot be hidden.\r | |
420 | \r | |
421 | @param This Indicates the calling context.\r | |
422 | @param Visible If TRUE, the cursor is set to be visible, If FALSE,\r | |
423 | the cursor is set to be invisible.\r | |
424 | \r | |
425 | @return EFI_SUCCESS\r | |
426 | @return The request is valid.\r | |
427 | @return EFI_UNSUPPORTED\r | |
428 | @return The Graphics Console does not support a hidden cursor.\r | |
429 | \r | |
430 | **/\r | |
95276127 | 431 | EFI_STATUS\r |
432 | EFIAPI\r | |
433 | GraphicsConsoleConOutEnableCursor (\r | |
434 | IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r | |
435 | IN BOOLEAN Visible\r | |
436 | );\r | |
437 | \r | |
95276127 | 438 | EFI_STATUS\r |
439 | EFIAPI\r | |
440 | GraphicsConsoleControllerDriverSupported (\r | |
441 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
442 | IN EFI_HANDLE Controller,\r | |
443 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
444 | );\r | |
445 | \r | |
446 | EFI_STATUS\r | |
447 | EFIAPI\r | |
448 | GraphicsConsoleControllerDriverStart (\r | |
449 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
450 | IN EFI_HANDLE Controller,\r | |
451 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
452 | );\r | |
453 | \r | |
454 | EFI_STATUS\r | |
455 | EFIAPI\r | |
456 | GraphicsConsoleControllerDriverStop (\r | |
457 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
458 | IN EFI_HANDLE Controller,\r | |
459 | IN UINTN NumberOfChildren,\r | |
460 | IN EFI_HANDLE *ChildHandleBuffer\r | |
461 | );\r | |
462 | \r | |
6dcf9abc | 463 | \r |
93e3992d | 464 | EFI_STATUS\r |
465 | EfiLocateHiiProtocol (\r | |
466 | VOID\r | |
467 | )\r | |
468 | ;\r | |
469 | \r | |
470 | \r | |
95276127 | 471 | #endif\r |