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