]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - IntelFrameworkModulePkg/Universal/Console/VgaClassDxe/VgaClass.h
IntelFrameworkModulePkg: Fix typos in comments
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / Console / VgaClassDxe / VgaClass.h
... / ...
CommitLineData
1/** @file\r
2 Internal include file of the VGA Class Driver.\r
3\r
4Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
5This 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
12\r
13**/\r
14\r
15\r
16#ifndef _VGA_CLASS_H__\r
17#define _VGA_CLASS_H__\r
18\r
19#include <FrameworkDxe.h>\r
20\r
21#include <Protocol/SimpleTextOut.h>\r
22#include <Protocol/PciIo.h>\r
23#include <Protocol/VgaMiniPort.h>\r
24#include <Protocol/DevicePath.h>\r
25\r
26#include <Library/DebugLib.h>\r
27#include <Library/UefiDriverEntryPoint.h>\r
28#include <Library/UefiLib.h>\r
29#include <Library/MemoryAllocationLib.h>\r
30#include <Library/UefiBootServicesTableLib.h>\r
31#include <Library/ReportStatusCodeLib.h>\r
32\r
33#include <IndustryStandard/Pci.h>\r
34\r
35//\r
36// Global Variables\r
37//\r
38extern EFI_DRIVER_BINDING_PROTOCOL gVgaClassDriverBinding;\r
39extern EFI_COMPONENT_NAME_PROTOCOL gVgaClassComponentName;\r
40extern EFI_COMPONENT_NAME2_PROTOCOL gVgaClassComponentName2;\r
41\r
42\r
43//\r
44// Structure for tuple containing mapping among uniocde, PC Ansi and ASCII code.\r
45//\r
46typedef struct {\r
47 CHAR16 Unicode;\r
48 CHAR8 PcAnsi;\r
49 CHAR8 Ascii;\r
50} UNICODE_TO_CHAR;\r
51\r
52//\r
53// VGA specific registers\r
54//\r
55#define CRTC_CURSOR_START 0xA\r
56#define CRTC_CURSOR_END 0xB\r
57\r
58#define CRTC_CURSOR_LOCATION_HIGH 0xE\r
59#define CRTC_CURSOR_LOCATION_LOW 0xF\r
60\r
61#define EFI_MAX_ATTRIBUTE 0x7f\r
62\r
63//\r
64// VGA Class Device Structure\r
65//\r
66#define VGA_CLASS_DEV_SIGNATURE SIGNATURE_32 ('V', 'G', 'A', 'C')\r
67\r
68typedef struct {\r
69 UINTN Signature;\r
70 EFI_HANDLE Handle;\r
71 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SimpleTextOut;\r
72 EFI_SIMPLE_TEXT_OUTPUT_MODE SimpleTextOutputMode;\r
73 EFI_VGA_MINI_PORT_PROTOCOL *VgaMiniPort;\r
74 EFI_PCI_IO_PROTOCOL *PciIo;\r
75 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
76} VGA_CLASS_DEV;\r
77\r
78#define VGA_CLASS_DEV_FROM_THIS(a) CR (a, VGA_CLASS_DEV, SimpleTextOut, VGA_CLASS_DEV_SIGNATURE)\r
79\r
80//\r
81// Driver Binding Protocol functions\r
82//\r
83\r
84/**\r
85 Tests to see if this driver supports a given controller.\r
86\r
87 This function implments EFI_DRIVER_BINDING_PROTOCOL.Supported().\r
88 It Checks if this driver supports the controller specified. Any Controller\r
89 with VgaMiniPort Protocol and Pci I/O protocol can be supported.\r
90\r
91 @param This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
92 @param ControllerHandle Handle of device to test\r
93 @param RemainingDevicePath Optional parameter use to pick a specific child\r
94 device to start.\r
95\r
96 @retval EFI_SUCCESS This driver supports this device.\r
97 @retval EFI_ALREADY_STARTED This driver is already running on this device.\r
98 @retval EFI_UNSUPPORTED This driver does not support this device.\r
99\r
100**/\r
101EFI_STATUS\r
102EFIAPI\r
103VgaClassDriverBindingSupported (\r
104 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
105 IN EFI_HANDLE Controller,\r
106 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
107 );\r
108\r
109/**\r
110 Starts the device controller.\r
111\r
112 This function implments EFI_DRIVER_BINDING_PROTOCOL.Start().\r
113 It starts the device specified by Controller with the driver based on PCI I/O Protocol\r
114 and VgaMiniPort Protocol. It creates context for device instance and install EFI_SIMPLE_TEXT_OUT_PROTOCOL.\r
115\r
116 @param This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
117 @param ControllerHandle Handle of device to bind driver to\r
118 @param RemainingDevicePath Optional parameter use to pick a specific child\r
119 device to start.\r
120\r
121 @retval EFI_SUCCESS The device was started.\r
122 @retval other Fail to start the device.\r
123\r
124**/\r
125EFI_STATUS\r
126EFIAPI\r
127VgaClassDriverBindingStart (\r
128 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
129 IN EFI_HANDLE Controller,\r
130 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL\r
131 );\r
132\r
133/**\r
134 Starts the device controller.\r
135 \r
136 This function implments EFI_DRIVER_BINDING_PROTOCOL.Stop().\r
137 It stops this driver on Controller. Support stopping any child handles\r
138 created by this driver.\r
139\r
140 @param This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
141 @param ControllerHandle A handle to the device being stopped.\r
142 @param NumberOfChildren The number of child device handles in ChildHandleBuffer.\r
143 @param ChildHandleBuffer An array of child handles to be freed.\r
144\r
145 @retval EFI_SUCCESS This driver is removed ControllerHandle\r
146 @retval other This driver was not removed from this device\r
147\r
148**/\r
149EFI_STATUS\r
150EFIAPI\r
151VgaClassDriverBindingStop (\r
152 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
153 IN EFI_HANDLE Controller,\r
154 IN UINTN NumberOfChildren,\r
155 IN EFI_HANDLE *ChildHandleBuffer OPTIONAL\r
156 );\r
157\r
158//\r
159// EFI Component Name Functions\r
160//\r
161\r
162/**\r
163 Retrieves a Unicode string that is the user readable name of the driver.\r
164\r
165 This function retrieves the user readable name of a driver in the form of a\r
166 Unicode string. If the driver specified by This has a user readable name in\r
167 the language specified by Language, then a pointer to the driver name is\r
168 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
169 by This does not support the language specified by Language,\r
170 then EFI_UNSUPPORTED is returned.\r
171\r
172 @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
173 EFI_COMPONENT_NAME_PROTOCOL instance.\r
174 @param Language A pointer to a Null-terminated ASCII string\r
175 array indicating the language. This is the\r
176 language of the driver name that the caller is\r
177 requesting, and it must match one of the\r
178 languages specified in SupportedLanguages. The\r
179 number of languages supported by a driver is up\r
180 to the driver writer. Language is specified\r
181 in RFC 4646 or ISO 639-2 language code format.\r
182 @param DriverName A pointer to the Unicode string to return.\r
183 This Unicode string is the name of the\r
184 driver specified by This in the language\r
185 specified by Language.\r
186\r
187 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
188 This and the language specified by Language was\r
189 returned in DriverName.\r
190 @retval EFI_INVALID_PARAMETER Language is NULL.\r
191 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
192 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
193 the language specified by Language.\r
194\r
195**/\r
196EFI_STATUS\r
197EFIAPI\r
198VgaClassComponentNameGetDriverName (\r
199 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
200 IN CHAR8 *Language,\r
201 OUT CHAR16 **DriverName\r
202 );\r
203\r
204/**\r
205 Retrieves a Unicode string that is the user readable name of the controller\r
206 that is being managed by a driver.\r
207\r
208 This function retrieves the user readable name of the controller specified by\r
209 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
210 driver specified by This has a user readable name in the language specified by\r
211 Language, then a pointer to the controller name is returned in ControllerName,\r
212 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
213 managing the controller specified by ControllerHandle and ChildHandle,\r
214 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
215 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
216\r
217 @param This A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
218 EFI_COMPONENT_NAME_PROTOCOL instance.\r
219 @param ControllerHandle The handle of a controller that the driver\r
220 specified by This is managing. This handle\r
221 specifies the controller whose name is to be\r
222 returned.\r
223 @param ChildHandle The handle of the child controller to retrieve\r
224 the name of. This is an optional parameter that\r
225 may be NULL. It will be NULL for device\r
226 drivers. It will also be NULL for a bus drivers\r
227 that wish to retrieve the name of the bus\r
228 controller. It will not be NULL for a bus\r
229 driver that wishes to retrieve the name of a\r
230 child controller.\r
231 @param Language A pointer to a Null-terminated ASCII string\r
232 array indicating the language. This is the\r
233 language of the driver name that the caller is\r
234 requesting, and it must match one of the\r
235 languages specified in SupportedLanguages. The\r
236 number of languages supported by a driver is up\r
237 to the driver writer. Language is specified in\r
238 RFC 4646 or ISO 639-2 language code format.\r
239 @param ControllerName A pointer to the Unicode string to return.\r
240 This Unicode string is the name of the\r
241 controller specified by ControllerHandle and\r
242 ChildHandle in the language specified by\r
243 Language from the point of view of the driver\r
244 specified by This.\r
245\r
246 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
247 the language specified by Language for the\r
248 driver specified by This was returned in\r
249 DriverName.\r
250 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
251 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
252 EFI_HANDLE.\r
253 @retval EFI_INVALID_PARAMETER Language is NULL.\r
254 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
255 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
256 managing the controller specified by\r
257 ControllerHandle and ChildHandle.\r
258 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
259 the language specified by Language.\r
260\r
261**/\r
262EFI_STATUS\r
263EFIAPI\r
264VgaClassComponentNameGetControllerName (\r
265 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
266 IN EFI_HANDLE ControllerHandle,\r
267 IN EFI_HANDLE ChildHandle OPTIONAL,\r
268 IN CHAR8 *Language,\r
269 OUT CHAR16 **ControllerName\r
270 );\r
271\r
272//\r
273// Simple Text Output Protocol functions\r
274//\r
275/**\r
276 Resets the text output device hardware.\r
277\r
278 This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.Reset().\r
279 It resets the text output device hardware. The cursor position is set to (0, 0),\r
280 and the screen is cleared to the default background color for the output device.\r
281 \r
282 @param This Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
283 @param ExtendedVerification Indicates that the driver may perform a more exhaustive\r
284 verification operation of the device during reset.\r
285\r
286 @retval EFI_SUCCESS The text output device was reset.\r
287 @retval EFI_DEVICE_ERROR The text output device is not functioning correctly and could not be reset.\r
288\r
289**/\r
290EFI_STATUS\r
291EFIAPI\r
292VgaClassReset (\r
293 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
294 IN BOOLEAN ExtendedVerification\r
295 );\r
296\r
297/**\r
298 Writes a Unicode string to the output device.\r
299 \r
300 This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString().\r
301 It writes a Unicode string to the output device. This is the most basic output mechanism\r
302 on an output device.\r
303\r
304 @param This Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
305 @param String The Null-terminated Unicode string to be displayed on the output device(s).\r
306\r
307 @retval EFI_SUCCESS The string was output to the device.\r
308 @retval EFI_DEVICE_ERROR The device reported an error while attempting to output the text.\r
309 @retval EFI_UNSUPPORTED The output device's mode is not currently in a defined text mode.\r
310 @retval EFI_WARN_UNKNOWN_GLYPH This warning code indicates that some of the characters in\r
311 the Unicode string could not be rendered and were skipped.\r
312**/\r
313EFI_STATUS\r
314EFIAPI\r
315VgaClassOutputString (\r
316 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
317 IN CHAR16 *String\r
318 );\r
319\r
320/**\r
321 Verifies that all characters in a Unicode string can be output to the target device.\r
322 \r
323 This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.TestString().\r
324 It verifies that all characters in a Unicode string can be output to the target device.\r
325\r
326 @param This Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
327 @param String The Null-terminated Unicode string to be examined for the output device(s).\r
328\r
329 @retval EFI_SUCCESS The device(s) are capable of rendering the output string.\r
330 @retval EFI_UNSUPPORTED Some of the characters in the Unicode string cannot be rendered by\r
331 one or more of the output devices mapped by the EFI handle.\r
332\r
333**/\r
334EFI_STATUS\r
335EFIAPI\r
336VgaClassTestString (\r
337 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
338 IN CHAR16 *String\r
339 );\r
340\r
341/**\r
342 Clears the output device(s) display to the currently selected background color.\r
343 \r
344 This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.ClearScreen().\r
345 The ClearScreen() function clears the output device(s) display to the currently\r
346 selected background color. The cursor position is set to (0, 0).\r
347\r
348 @param This Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
349 \r
350 @retval EFI_SUCESS The operation completed successfully.\r
351 @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.\r
352 @retval EFI_UNSUPPORTED The output device is not in a valid text mode.\r
353\r
354**/\r
355EFI_STATUS\r
356EFIAPI\r
357VgaClassClearScreen (\r
358 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This\r
359 );\r
360\r
361/**\r
362 Sets the background and foreground colors for theOutputString() and ClearScreen() functions.\r
363 \r
364 This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.SetAttribute().\r
365 It sets the background and foreground colors for the OutputString() and ClearScreen() functions.\r
366 The color mask can be set even when the device is in an invalid text mode.\r
367 Devices supporting a different number of text colors are required to emulate the above colors\r
368 to the best of the device's capabilities.\r
369\r
370 @param This Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
371 @param Attribute The attribute to set.\r
372 Bits 0..3 are the foreground color,\r
373 and bits 4..6 are the background color.\r
374 \r
375 @retval EFI_SUCCESS The requested attributes were set.\r
376 @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.\r
377\r
378**/\r
379EFI_STATUS\r
380EFIAPI\r
381VgaClassSetAttribute (\r
382 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
383 IN UINTN Attribute\r
384 );\r
385\r
386/**\r
387 Sets the current coordinates of the cursor position.\r
388 \r
389 This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.SetCursorPosition().\r
390 It sets the current coordinates of the cursor position.\r
391 The upper left corner of the screen is defined as coordinate (0, 0).\r
392 \r
393 @param This Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
394 @param Column Column of position to set the cursor to.\r
395 @param Row Row of position to set the cursor to.\r
396 \r
397 @retval EFI_SUCCESS The operation completed successfully.\r
398 @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.\r
399 @retval EFI_UNSUPPORTED The output device is not in a valid text mode, or the cursor\r
400 position is invalid for the current mode.\r
401\r
402**/\r
403EFI_STATUS\r
404EFIAPI\r
405VgaClassSetCursorPosition (\r
406 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
407 IN UINTN Column,\r
408 IN UINTN Row\r
409 );\r
410\r
411/**\r
412 Makes the cursor visible or invisible.\r
413 \r
414 This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.EnableCursor().\r
415 It makes the cursor visible or invisible.\r
416\r
417 @param This Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
418 @param Visible If TRUE, the cursor is set to be visible.\r
419 If FALSE, the cursor is set to be invisible.\r
420 \r
421 @retval EFI_SUCESS The operation completed successfully.\r
422 @retval EFI_DEVICE_ERROR The device had an error and could not complete the request or the\r
423 device does not support changing the cursor mode.\r
424 @retval EFI_UNSUPPORTED The output device does not support visibility control of the cursor.\r
425\r
426**/\r
427EFI_STATUS\r
428EFIAPI\r
429VgaClassEnableCursor (\r
430 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
431 IN BOOLEAN Visible\r
432 );\r
433\r
434/**\r
435 Returns information for an available text mode that the output device(s) supports.\r
436\r
437 This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.QueryMode().\r
438 It returns information for an available text mode that the output device(s) supports.\r
439 It is required that all output devices support at least 80x25 text mode. This mode is defined to be mode 0.\r
440 If the output devices support 80x50, that is defined to be mode 1.\r
441\r
442 @param This Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
443 @param ModeNumber The mode number to return information on.\r
444 @param Columns Columen in current mode number\r
445 @param Rows Row in current mode number.\r
446 \r
447 @retval EFI_SUCCESS The requested mode information was returned.\r
448 @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.\r
449 @retval EFI_UNSUPPORTED The mode number was not valid.\r
450\r
451**/\r
452EFI_STATUS\r
453EFIAPI\r
454VgaClassQueryMode (\r
455 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
456 IN UINTN ModeNumber,\r
457 OUT UINTN *Columns,\r
458 OUT UINTN *Rows\r
459 );\r
460\r
461/**\r
462 Sets the output device(s) to a specified mode.\r
463 \r
464 This function implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.QueryMode().\r
465 It sets the output device(s) to the requested mode.\r
466 On success the device is in the geometry for the requested mode,\r
467 and the device has been cleared to the current background color with the cursor at (0,0).\r
468\r
469 @param This Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL instance.\r
470 @param ModeNumber The text mode to set.\r
471 \r
472 @retval EFI_SUCCESS The requested text mode was set.\r
473 @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.\r
474 @retval EFI_UNSUPPORTED The mode number was not valid.\r
475\r
476**/\r
477EFI_STATUS\r
478EFIAPI\r
479VgaClassSetMode (\r
480 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
481 IN UINTN ModeNumber\r
482 );\r
483\r
484#endif\r