]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/SimpleTextOut.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdePkg / Include / Protocol / SimpleTextOut.h
CommitLineData
d1f95000 1/** @file\r
8a7d75b0 2 Simple Text Out protocol from the UEFI 2.0 specification.\r
d1f95000 3\r
4 Abstraction of a very simple text based output device like VGA text mode or\r
5 a serial terminal. The Simple Text Out protocol instance can represent\r
630b4187 6 a single hardware device or a virtual device that is an aggregation\r
d1f95000 7 of multiple physical devices.\r
8\r
9095d37b 9Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
9344f092 10SPDX-License-Identifier: BSD-2-Clause-Patent\r
d1f95000 11\r
d1f95000 12**/\r
13\r
14#ifndef __SIMPLE_TEXT_OUT_H__\r
15#define __SIMPLE_TEXT_OUT_H__\r
16\r
a6508c05 17#define EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID \\r
d1f95000 18 { \\r
19 0x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \\r
20 }\r
21\r
99e8ed21 22///\r
23/// Protocol GUID defined in EFI1.1.\r
9095d37b 24///\r
2f88bd3a 25#define SIMPLE_TEXT_OUTPUT_PROTOCOL EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID\r
a6508c05 26\r
27typedef struct _EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL;\r
d1f95000 28\r
99e8ed21 29///\r
30/// Backward-compatible with EFI1.1.\r
9095d37b 31///\r
2f88bd3a 32typedef EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SIMPLE_TEXT_OUTPUT_INTERFACE;\r
d1f95000 33\r
34//\r
e61088c8 35// Defines for required EFI Unicode Box Draw characters\r
d1f95000 36//\r
37#define BOXDRAW_HORIZONTAL 0x2500\r
38#define BOXDRAW_VERTICAL 0x2502\r
39#define BOXDRAW_DOWN_RIGHT 0x250c\r
40#define BOXDRAW_DOWN_LEFT 0x2510\r
41#define BOXDRAW_UP_RIGHT 0x2514\r
42#define BOXDRAW_UP_LEFT 0x2518\r
43#define BOXDRAW_VERTICAL_RIGHT 0x251c\r
44#define BOXDRAW_VERTICAL_LEFT 0x2524\r
45#define BOXDRAW_DOWN_HORIZONTAL 0x252c\r
46#define BOXDRAW_UP_HORIZONTAL 0x2534\r
47#define BOXDRAW_VERTICAL_HORIZONTAL 0x253c\r
48#define BOXDRAW_DOUBLE_HORIZONTAL 0x2550\r
49#define BOXDRAW_DOUBLE_VERTICAL 0x2551\r
50#define BOXDRAW_DOWN_RIGHT_DOUBLE 0x2552\r
51#define BOXDRAW_DOWN_DOUBLE_RIGHT 0x2553\r
52#define BOXDRAW_DOUBLE_DOWN_RIGHT 0x2554\r
53#define BOXDRAW_DOWN_LEFT_DOUBLE 0x2555\r
54#define BOXDRAW_DOWN_DOUBLE_LEFT 0x2556\r
55#define BOXDRAW_DOUBLE_DOWN_LEFT 0x2557\r
56#define BOXDRAW_UP_RIGHT_DOUBLE 0x2558\r
57#define BOXDRAW_UP_DOUBLE_RIGHT 0x2559\r
58#define BOXDRAW_DOUBLE_UP_RIGHT 0x255a\r
59#define BOXDRAW_UP_LEFT_DOUBLE 0x255b\r
60#define BOXDRAW_UP_DOUBLE_LEFT 0x255c\r
61#define BOXDRAW_DOUBLE_UP_LEFT 0x255d\r
62#define BOXDRAW_VERTICAL_RIGHT_DOUBLE 0x255e\r
63#define BOXDRAW_VERTICAL_DOUBLE_RIGHT 0x255f\r
64#define BOXDRAW_DOUBLE_VERTICAL_RIGHT 0x2560\r
65#define BOXDRAW_VERTICAL_LEFT_DOUBLE 0x2561\r
66#define BOXDRAW_VERTICAL_DOUBLE_LEFT 0x2562\r
67#define BOXDRAW_DOUBLE_VERTICAL_LEFT 0x2563\r
68#define BOXDRAW_DOWN_HORIZONTAL_DOUBLE 0x2564\r
69#define BOXDRAW_DOWN_DOUBLE_HORIZONTAL 0x2565\r
70#define BOXDRAW_DOUBLE_DOWN_HORIZONTAL 0x2566\r
71#define BOXDRAW_UP_HORIZONTAL_DOUBLE 0x2567\r
72#define BOXDRAW_UP_DOUBLE_HORIZONTAL 0x2568\r
73#define BOXDRAW_DOUBLE_UP_HORIZONTAL 0x2569\r
74#define BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE 0x256a\r
75#define BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL 0x256b\r
76#define BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL 0x256c\r
77\r
78//\r
79// EFI Required Block Elements Code Chart\r
80//\r
81#define BLOCKELEMENT_FULL_BLOCK 0x2588\r
82#define BLOCKELEMENT_LIGHT_SHADE 0x2591\r
83\r
84//\r
85// EFI Required Geometric Shapes Code Chart\r
86//\r
2f88bd3a
MK
87#define GEOMETRICSHAPE_UP_TRIANGLE 0x25b2\r
88#define GEOMETRICSHAPE_RIGHT_TRIANGLE 0x25ba\r
89#define GEOMETRICSHAPE_DOWN_TRIANGLE 0x25bc\r
90#define GEOMETRICSHAPE_LEFT_TRIANGLE 0x25c4\r
d1f95000 91\r
92//\r
93// EFI Required Arrow shapes\r
94//\r
2f88bd3a
MK
95#define ARROW_LEFT 0x2190\r
96#define ARROW_UP 0x2191\r
97#define ARROW_RIGHT 0x2192\r
98#define ARROW_DOWN 0x2193\r
d1f95000 99\r
100//\r
101// EFI Console Colours\r
102//\r
2f88bd3a
MK
103#define EFI_BLACK 0x00\r
104#define EFI_BLUE 0x01\r
105#define EFI_GREEN 0x02\r
106#define EFI_CYAN (EFI_BLUE | EFI_GREEN)\r
107#define EFI_RED 0x04\r
108#define EFI_MAGENTA (EFI_BLUE | EFI_RED)\r
109#define EFI_BROWN (EFI_GREEN | EFI_RED)\r
110#define EFI_LIGHTGRAY (EFI_BLUE | EFI_GREEN | EFI_RED)\r
111#define EFI_BRIGHT 0x08\r
112#define EFI_DARKGRAY (EFI_BLACK | EFI_BRIGHT)\r
113#define EFI_LIGHTBLUE (EFI_BLUE | EFI_BRIGHT)\r
114#define EFI_LIGHTGREEN (EFI_GREEN | EFI_BRIGHT)\r
115#define EFI_LIGHTCYAN (EFI_CYAN | EFI_BRIGHT)\r
116#define EFI_LIGHTRED (EFI_RED | EFI_BRIGHT)\r
117#define EFI_LIGHTMAGENTA (EFI_MAGENTA | EFI_BRIGHT)\r
118#define EFI_YELLOW (EFI_BROWN | EFI_BRIGHT)\r
119#define EFI_WHITE (EFI_BLUE | EFI_GREEN | EFI_RED | EFI_BRIGHT)\r
d1f95000 120\r
0cccafea 121//\r
9095d37b
LG
122// Macro to accept color values in their raw form to create\r
123// a value that represents both a foreground and background\r
0cccafea
RN
124// color in a single byte.\r
125// For Foreground, and EFI_* value is valid from EFI_BLACK(0x00) to\r
126// EFI_WHITE (0x0F).\r
127// For Background, only EFI_BLACK, EFI_BLUE, EFI_GREEN, EFI_CYAN,\r
128// EFI_RED, EFI_MAGENTA, EFI_BROWN, and EFI_LIGHTGRAY are acceptable\r
129//\r
130// Do not use EFI_BACKGROUND_xxx values with this macro.\r
131//\r
2f88bd3a 132#define EFI_TEXT_ATTR(Foreground, Background) ((Foreground) | ((Background) << 4))\r
d1f95000 133\r
134#define EFI_BACKGROUND_BLACK 0x00\r
135#define EFI_BACKGROUND_BLUE 0x10\r
136#define EFI_BACKGROUND_GREEN 0x20\r
137#define EFI_BACKGROUND_CYAN (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN)\r
138#define EFI_BACKGROUND_RED 0x40\r
139#define EFI_BACKGROUND_MAGENTA (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_RED)\r
140#define EFI_BACKGROUND_BROWN (EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED)\r
141#define EFI_BACKGROUND_LIGHTGRAY (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED)\r
142\r
143//\r
144// We currently define attributes from 0 - 7F for color manipulations\r
9095d37b 145// To internally handle the local display characteristics for a particular character,\r
630b4187 146// Bit 7 signifies the local glyph representation for a character. If turned on, glyphs will be\r
d1f95000 147// pulled from the wide glyph database and will display locally as a wide character (16 X 19 versus 8 X 19)\r
148// If bit 7 is off, the narrow glyph database will be used. This does NOT affect information that is sent to\r
630b4187 149// non-local displays, such as serial or LAN consoles.\r
d1f95000 150//\r
151#define EFI_WIDE_ATTRIBUTE 0x80\r
152\r
153/**\r
e61088c8 154 Reset the text output device hardware and optionally run diagnostics\r
d1f95000 155\r
af2dc6a7 156 @param This The protocol instance pointer.\r
00b7cc0f 157 @param ExtendedVerification Driver may perform more exhaustive verification\r
d1f95000 158 operation of the device during reset.\r
159\r
160 @retval EFI_SUCCESS The text output device was reset.\r
161 @retval EFI_DEVICE_ERROR The text output device is not functioning correctly and\r
162 could not be reset.\r
163\r
164**/\r
165typedef\r
166EFI_STATUS\r
8b13229b 167(EFIAPI *EFI_TEXT_RESET)(\r
4ca9b6c4 168 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
d1f95000 169 IN BOOLEAN ExtendedVerification\r
ed66e1bc 170 );\r
d1f95000 171\r
172/**\r
fbf926ad 173 Write a string to the output device.\r
d1f95000 174\r
af2dc6a7 175 @param This The protocol instance pointer.\r
fbf926ad 176 @param String The NULL-terminated string to be displayed on the output\r
d1f95000 177 device(s). All output devices must also support the Unicode\r
fbf926ad 178 drawing character codes defined in this file.\r
d1f95000 179\r
180 @retval EFI_SUCCESS The string was output to the device.\r
181 @retval EFI_DEVICE_ERROR The device reported an error while attempting to output\r
182 the text.\r
183 @retval EFI_UNSUPPORTED The output device's mode is not currently in a\r
184 defined text mode.\r
185 @retval EFI_WARN_UNKNOWN_GLYPH This warning code indicates that some of the\r
fbf926ad 186 characters in the string could not be\r
d1f95000 187 rendered and were skipped.\r
188\r
189**/\r
190typedef\r
191EFI_STATUS\r
8b13229b 192(EFIAPI *EFI_TEXT_STRING)(\r
a6508c05 193 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
d1f95000 194 IN CHAR16 *String\r
ed66e1bc 195 );\r
d1f95000 196\r
197/**\r
9095d37b 198 Verifies that all characters in a string can be output to the\r
d1f95000 199 target device.\r
200\r
af2dc6a7 201 @param This The protocol instance pointer.\r
fbf926ad 202 @param String The NULL-terminated string to be examined for the output\r
d1f95000 203 device(s).\r
204\r
205 @retval EFI_SUCCESS The device(s) are capable of rendering the output string.\r
fbf926ad 206 @retval EFI_UNSUPPORTED Some of the characters in the string cannot be\r
d1f95000 207 rendered by one or more of the output devices mapped\r
208 by the EFI handle.\r
209\r
210**/\r
211typedef\r
212EFI_STATUS\r
8b13229b 213(EFIAPI *EFI_TEXT_TEST_STRING)(\r
a6508c05 214 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
d1f95000 215 IN CHAR16 *String\r
ed66e1bc 216 );\r
d1f95000 217\r
218/**\r
219 Returns information for an available text mode that the output device(s)\r
220 supports.\r
221\r
af2dc6a7 222 @param This The protocol instance pointer.\r
d1f95000 223 @param ModeNumber The mode number to return information on.\r
224 @param Columns Returns the geometry of the text output device for the\r
225 requested ModeNumber.\r
226 @param Rows Returns the geometry of the text output device for the\r
227 requested ModeNumber.\r
9095d37b 228\r
d1f95000 229 @retval EFI_SUCCESS The requested mode information was returned.\r
230 @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.\r
231 @retval EFI_UNSUPPORTED The mode number was not valid.\r
232\r
233**/\r
234typedef\r
235EFI_STATUS\r
8b13229b 236(EFIAPI *EFI_TEXT_QUERY_MODE)(\r
a6508c05 237 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
d1f95000 238 IN UINTN ModeNumber,\r
239 OUT UINTN *Columns,\r
240 OUT UINTN *Rows\r
ed66e1bc 241 );\r
d1f95000 242\r
243/**\r
244 Sets the output device(s) to a specified mode.\r
245\r
af2dc6a7 246 @param This The protocol instance pointer.\r
d1f95000 247 @param ModeNumber The mode number to set.\r
248\r
249 @retval EFI_SUCCESS The requested text mode was set.\r
250 @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.\r
251 @retval EFI_UNSUPPORTED The mode number was not valid.\r
252\r
253**/\r
254typedef\r
255EFI_STATUS\r
8b13229b 256(EFIAPI *EFI_TEXT_SET_MODE)(\r
a6508c05 257 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
d1f95000 258 IN UINTN ModeNumber\r
ed66e1bc 259 );\r
d1f95000 260\r
261/**\r
262 Sets the background and foreground colors for the OutputString () and\r
263 ClearScreen () functions.\r
264\r
af2dc6a7 265 @param This The protocol instance pointer.\r
d1f95000 266 @param Attribute The attribute to set. Bits 0..3 are the foreground color, and\r
267 bits 4..6 are the background color. All other bits are undefined\r
268 and must be zero. The valid Attributes are defined in this file.\r
269\r
f754f721 270 @retval EFI_SUCCESS The attribute was set.\r
630b4187 271 @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.\r
f754f721 272 @retval EFI_UNSUPPORTED The attribute requested is not defined.\r
d1f95000 273\r
274**/\r
275typedef\r
276EFI_STATUS\r
8b13229b 277(EFIAPI *EFI_TEXT_SET_ATTRIBUTE)(\r
a6508c05 278 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
d1f95000 279 IN UINTN Attribute\r
ed66e1bc 280 );\r
d1f95000 281\r
282/**\r
9095d37b 283 Clears the output device(s) display to the currently selected background\r
d1f95000 284 color.\r
285\r
af2dc6a7 286 @param This The protocol instance pointer.\r
9095d37b 287\r
d1f95000 288 @retval EFI_SUCCESS The operation completed successfully.\r
289 @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.\r
290 @retval EFI_UNSUPPORTED The output device is not in a valid text mode.\r
291\r
292**/\r
293typedef\r
294EFI_STATUS\r
8b13229b 295(EFIAPI *EFI_TEXT_CLEAR_SCREEN)(\r
a6508c05 296 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This\r
ed66e1bc 297 );\r
d1f95000 298\r
299/**\r
300 Sets the current coordinates of the cursor position\r
301\r
af2dc6a7 302 @param This The protocol instance pointer.\r
d1f95000 303 @param Column The position to set the cursor to. Must be greater than or\r
304 equal to zero and less than the number of columns and rows\r
305 by QueryMode ().\r
306 @param Row The position to set the cursor to. Must be greater than or\r
307 equal to zero and less than the number of columns and rows\r
308 by QueryMode ().\r
309\r
310 @retval EFI_SUCCESS The operation completed successfully.\r
311 @retval EFI_DEVICE_ERROR The device had an error and could not complete the request.\r
312 @retval EFI_UNSUPPORTED The output device is not in a valid text mode, or the\r
313 cursor position is invalid for the current mode.\r
314\r
315**/\r
316typedef\r
317EFI_STATUS\r
8b13229b 318(EFIAPI *EFI_TEXT_SET_CURSOR_POSITION)(\r
a6508c05 319 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
d1f95000 320 IN UINTN Column,\r
321 IN UINTN Row\r
ed66e1bc 322 );\r
d1f95000 323\r
324/**\r
325 Makes the cursor visible or invisible\r
326\r
af2dc6a7 327 @param This The protocol instance pointer.\r
d1f95000 328 @param Visible If TRUE, the cursor is set to be visible. If FALSE, the cursor is\r
329 set to be invisible.\r
330\r
331 @retval EFI_SUCCESS The operation completed successfully.\r
332 @retval EFI_DEVICE_ERROR The device had an error and could not complete the\r
333 request, or the device does not support changing\r
334 the cursor mode.\r
335 @retval EFI_UNSUPPORTED The output device is not in a valid text mode.\r
336\r
337**/\r
338typedef\r
339EFI_STATUS\r
8b13229b 340(EFIAPI *EFI_TEXT_ENABLE_CURSOR)(\r
a6508c05 341 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r
d1f95000 342 IN BOOLEAN Visible\r
ed66e1bc 343 );\r
d1f95000 344\r
345/**\r
4ca9b6c4 346 @par Data Structure Description:\r
d1f95000 347 Mode Structure pointed to by Simple Text Out protocol.\r
d1f95000 348**/\r
349typedef struct {\r
f754f721 350 ///\r
351 /// The number of modes supported by QueryMode () and SetMode ().\r
352 ///\r
2f88bd3a 353 INT32 MaxMode;\r
d1f95000 354\r
355 //\r
356 // current settings\r
357 //\r
41f2ff0b 358\r
f754f721 359 ///\r
360 /// The text mode of the output device(s).\r
361 ///\r
2f88bd3a 362 INT32 Mode;\r
f754f721 363 ///\r
af2dc6a7 364 /// The current character output attribute.\r
f754f721 365 ///\r
2f88bd3a 366 INT32 Attribute;\r
f754f721 367 ///\r
368 /// The cursor's column.\r
369 ///\r
2f88bd3a 370 INT32 CursorColumn;\r
f754f721 371 ///\r
372 /// The cursor's row.\r
373 ///\r
2f88bd3a 374 INT32 CursorRow;\r
f754f721 375 ///\r
e61088c8 376 /// The cursor is currently visible or not.\r
f754f721 377 ///\r
2f88bd3a 378 BOOLEAN CursorVisible;\r
d1f95000 379} EFI_SIMPLE_TEXT_OUTPUT_MODE;\r
380\r
44717a39 381///\r
9095d37b
LG
382/// The SIMPLE_TEXT_OUTPUT protocol is used to control text-based output devices.\r
383/// It is the minimum required protocol for any handle supplied as the ConsoleOut\r
384/// or StandardError device. In addition, the minimum supported text mode of such\r
44717a39 385/// devices is at least 80 x 25 characters.\r
386///\r
a6508c05 387struct _EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL {\r
2f88bd3a 388 EFI_TEXT_RESET Reset;\r
d1f95000 389\r
2f88bd3a
MK
390 EFI_TEXT_STRING OutputString;\r
391 EFI_TEXT_TEST_STRING TestString;\r
d1f95000 392\r
2f88bd3a
MK
393 EFI_TEXT_QUERY_MODE QueryMode;\r
394 EFI_TEXT_SET_MODE SetMode;\r
395 EFI_TEXT_SET_ATTRIBUTE SetAttribute;\r
d1f95000 396\r
2f88bd3a
MK
397 EFI_TEXT_CLEAR_SCREEN ClearScreen;\r
398 EFI_TEXT_SET_CURSOR_POSITION SetCursorPosition;\r
399 EFI_TEXT_ENABLE_CURSOR EnableCursor;\r
d1f95000 400\r
44717a39 401 ///\r
402 /// Pointer to SIMPLE_TEXT_OUTPUT_MODE data.\r
403 ///\r
2f88bd3a 404 EFI_SIMPLE_TEXT_OUTPUT_MODE *Mode;\r
d1f95000 405};\r
406\r
2f88bd3a 407extern EFI_GUID gEfiSimpleTextOutProtocolGuid;\r
d1f95000 408\r
409#endif\r