Path: blob/main/sys/contrib/edk2/Include/Protocol/SimpleTextOut.h
48383 views
/** @file1Simple Text Out protocol from the UEFI 2.0 specification.23Abstraction of a very simple text based output device like VGA text mode or4a serial terminal. The Simple Text Out protocol instance can represent5a single hardware device or a virtual device that is an aggregation6of multiple physical devices.78Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>9SPDX-License-Identifier: BSD-2-Clause-Patent1011**/1213#ifndef __SIMPLE_TEXT_OUT_H__14#define __SIMPLE_TEXT_OUT_H__1516#define EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID \17{ \180x387477c2, 0x69c7, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \19}2021///22/// Protocol GUID defined in EFI1.1.23///24#define SIMPLE_TEXT_OUTPUT_PROTOCOL EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID2526typedef struct _EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL;2728///29/// Backward-compatible with EFI1.1.30///31typedef EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL SIMPLE_TEXT_OUTPUT_INTERFACE;3233//34// Defines for required EFI Unicode Box Draw characters35//36#define BOXDRAW_HORIZONTAL 0x250037#define BOXDRAW_VERTICAL 0x250238#define BOXDRAW_DOWN_RIGHT 0x250c39#define BOXDRAW_DOWN_LEFT 0x251040#define BOXDRAW_UP_RIGHT 0x251441#define BOXDRAW_UP_LEFT 0x251842#define BOXDRAW_VERTICAL_RIGHT 0x251c43#define BOXDRAW_VERTICAL_LEFT 0x252444#define BOXDRAW_DOWN_HORIZONTAL 0x252c45#define BOXDRAW_UP_HORIZONTAL 0x253446#define BOXDRAW_VERTICAL_HORIZONTAL 0x253c47#define BOXDRAW_DOUBLE_HORIZONTAL 0x255048#define BOXDRAW_DOUBLE_VERTICAL 0x255149#define BOXDRAW_DOWN_RIGHT_DOUBLE 0x255250#define BOXDRAW_DOWN_DOUBLE_RIGHT 0x255351#define BOXDRAW_DOUBLE_DOWN_RIGHT 0x255452#define BOXDRAW_DOWN_LEFT_DOUBLE 0x255553#define BOXDRAW_DOWN_DOUBLE_LEFT 0x255654#define BOXDRAW_DOUBLE_DOWN_LEFT 0x255755#define BOXDRAW_UP_RIGHT_DOUBLE 0x255856#define BOXDRAW_UP_DOUBLE_RIGHT 0x255957#define BOXDRAW_DOUBLE_UP_RIGHT 0x255a58#define BOXDRAW_UP_LEFT_DOUBLE 0x255b59#define BOXDRAW_UP_DOUBLE_LEFT 0x255c60#define BOXDRAW_DOUBLE_UP_LEFT 0x255d61#define BOXDRAW_VERTICAL_RIGHT_DOUBLE 0x255e62#define BOXDRAW_VERTICAL_DOUBLE_RIGHT 0x255f63#define BOXDRAW_DOUBLE_VERTICAL_RIGHT 0x256064#define BOXDRAW_VERTICAL_LEFT_DOUBLE 0x256165#define BOXDRAW_VERTICAL_DOUBLE_LEFT 0x256266#define BOXDRAW_DOUBLE_VERTICAL_LEFT 0x256367#define BOXDRAW_DOWN_HORIZONTAL_DOUBLE 0x256468#define BOXDRAW_DOWN_DOUBLE_HORIZONTAL 0x256569#define BOXDRAW_DOUBLE_DOWN_HORIZONTAL 0x256670#define BOXDRAW_UP_HORIZONTAL_DOUBLE 0x256771#define BOXDRAW_UP_DOUBLE_HORIZONTAL 0x256872#define BOXDRAW_DOUBLE_UP_HORIZONTAL 0x256973#define BOXDRAW_VERTICAL_HORIZONTAL_DOUBLE 0x256a74#define BOXDRAW_VERTICAL_DOUBLE_HORIZONTAL 0x256b75#define BOXDRAW_DOUBLE_VERTICAL_HORIZONTAL 0x256c7677//78// EFI Required Block Elements Code Chart79//80#define BLOCKELEMENT_FULL_BLOCK 0x258881#define BLOCKELEMENT_LIGHT_SHADE 0x25918283//84// EFI Required Geometric Shapes Code Chart85//86#define GEOMETRICSHAPE_UP_TRIANGLE 0x25b287#define GEOMETRICSHAPE_RIGHT_TRIANGLE 0x25ba88#define GEOMETRICSHAPE_DOWN_TRIANGLE 0x25bc89#define GEOMETRICSHAPE_LEFT_TRIANGLE 0x25c49091//92// EFI Required Arrow shapes93//94#define ARROW_LEFT 0x219095#define ARROW_UP 0x219196#define ARROW_RIGHT 0x219297#define ARROW_DOWN 0x21939899//100// EFI Console Colours101//102#define EFI_BLACK 0x00103#define EFI_BLUE 0x01104#define EFI_GREEN 0x02105#define EFI_CYAN (EFI_BLUE | EFI_GREEN)106#define EFI_RED 0x04107#define EFI_MAGENTA (EFI_BLUE | EFI_RED)108#define EFI_BROWN (EFI_GREEN | EFI_RED)109#define EFI_LIGHTGRAY (EFI_BLUE | EFI_GREEN | EFI_RED)110#define EFI_BRIGHT 0x08111#define EFI_DARKGRAY (EFI_BLACK | EFI_BRIGHT)112#define EFI_LIGHTBLUE (EFI_BLUE | EFI_BRIGHT)113#define EFI_LIGHTGREEN (EFI_GREEN | EFI_BRIGHT)114#define EFI_LIGHTCYAN (EFI_CYAN | EFI_BRIGHT)115#define EFI_LIGHTRED (EFI_RED | EFI_BRIGHT)116#define EFI_LIGHTMAGENTA (EFI_MAGENTA | EFI_BRIGHT)117#define EFI_YELLOW (EFI_BROWN | EFI_BRIGHT)118#define EFI_WHITE (EFI_BLUE | EFI_GREEN | EFI_RED | EFI_BRIGHT)119120//121// Macro to accept color values in their raw form to create122// a value that represents both a foreground and background123// color in a single byte.124// For Foreground, and EFI_* value is valid from EFI_BLACK(0x00) to125// EFI_WHITE (0x0F).126// For Background, only EFI_BLACK, EFI_BLUE, EFI_GREEN, EFI_CYAN,127// EFI_RED, EFI_MAGENTA, EFI_BROWN, and EFI_LIGHTGRAY are acceptable128//129// Do not use EFI_BACKGROUND_xxx values with this macro.130//131#define EFI_TEXT_ATTR(Foreground, Background) ((Foreground) | ((Background) << 4))132133#define EFI_BACKGROUND_BLACK 0x00134#define EFI_BACKGROUND_BLUE 0x10135#define EFI_BACKGROUND_GREEN 0x20136#define EFI_BACKGROUND_CYAN (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN)137#define EFI_BACKGROUND_RED 0x40138#define EFI_BACKGROUND_MAGENTA (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_RED)139#define EFI_BACKGROUND_BROWN (EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED)140#define EFI_BACKGROUND_LIGHTGRAY (EFI_BACKGROUND_BLUE | EFI_BACKGROUND_GREEN | EFI_BACKGROUND_RED)141142//143// We currently define attributes from 0 - 7F for color manipulations144// To internally handle the local display characteristics for a particular character,145// Bit 7 signifies the local glyph representation for a character. If turned on, glyphs will be146// pulled from the wide glyph database and will display locally as a wide character (16 X 19 versus 8 X 19)147// If bit 7 is off, the narrow glyph database will be used. This does NOT affect information that is sent to148// non-local displays, such as serial or LAN consoles.149//150#define EFI_WIDE_ATTRIBUTE 0x80151152/**153Reset the text output device hardware and optionally run diagnostics154155@param This The protocol instance pointer.156@param ExtendedVerification Driver may perform more exhaustive verification157operation of the device during reset.158159@retval EFI_SUCCESS The text output device was reset.160@retval EFI_DEVICE_ERROR The text output device is not functioning correctly and161could not be reset.162163**/164typedef165EFI_STATUS166(EFIAPI *EFI_TEXT_RESET)(167IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,168IN BOOLEAN ExtendedVerification169);170171/**172Write a string to the output device.173174@param This The protocol instance pointer.175@param String The NULL-terminated string to be displayed on the output176device(s). All output devices must also support the Unicode177drawing character codes defined in this file.178179@retval EFI_SUCCESS The string was output to the device.180@retval EFI_DEVICE_ERROR The device reported an error while attempting to output181the text.182@retval EFI_UNSUPPORTED The output device's mode is not currently in a183defined text mode.184@retval EFI_WARN_UNKNOWN_GLYPH This warning code indicates that some of the185characters in the string could not be186rendered and were skipped.187188**/189typedef190EFI_STATUS191(EFIAPI *EFI_TEXT_STRING)(192IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,193IN CHAR16 *String194);195196/**197Verifies that all characters in a string can be output to the198target device.199200@param This The protocol instance pointer.201@param String The NULL-terminated string to be examined for the output202device(s).203204@retval EFI_SUCCESS The device(s) are capable of rendering the output string.205@retval EFI_UNSUPPORTED Some of the characters in the string cannot be206rendered by one or more of the output devices mapped207by the EFI handle.208209**/210typedef211EFI_STATUS212(EFIAPI *EFI_TEXT_TEST_STRING)(213IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,214IN CHAR16 *String215);216217/**218Returns information for an available text mode that the output device(s)219supports.220221@param This The protocol instance pointer.222@param ModeNumber The mode number to return information on.223@param Columns Returns the geometry of the text output device for the224requested ModeNumber.225@param Rows Returns the geometry of the text output device for the226requested ModeNumber.227228@retval EFI_SUCCESS The requested mode information was returned.229@retval EFI_DEVICE_ERROR The device had an error and could not complete the request.230@retval EFI_UNSUPPORTED The mode number was not valid.231232**/233typedef234EFI_STATUS235(EFIAPI *EFI_TEXT_QUERY_MODE)(236IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,237IN UINTN ModeNumber,238OUT UINTN *Columns,239OUT UINTN *Rows240);241242/**243Sets the output device(s) to a specified mode.244245@param This The protocol instance pointer.246@param ModeNumber The mode number to set.247248@retval EFI_SUCCESS The requested text mode was set.249@retval EFI_DEVICE_ERROR The device had an error and could not complete the request.250@retval EFI_UNSUPPORTED The mode number was not valid.251252**/253typedef254EFI_STATUS255(EFIAPI *EFI_TEXT_SET_MODE)(256IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,257IN UINTN ModeNumber258);259260/**261Sets the background and foreground colors for the OutputString () and262ClearScreen () functions.263264@param This The protocol instance pointer.265@param Attribute The attribute to set. Bits 0..3 are the foreground color, and266bits 4..6 are the background color. All other bits are undefined267and must be zero. The valid Attributes are defined in this file.268269@retval EFI_SUCCESS The attribute was set.270@retval EFI_DEVICE_ERROR The device had an error and could not complete the request.271@retval EFI_UNSUPPORTED The attribute requested is not defined.272273**/274typedef275EFI_STATUS276(EFIAPI *EFI_TEXT_SET_ATTRIBUTE)(277IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,278IN UINTN Attribute279);280281/**282Clears the output device(s) display to the currently selected background283color.284285@param This The protocol instance pointer.286287@retval EFI_SUCCESS The operation completed successfully.288@retval EFI_DEVICE_ERROR The device had an error and could not complete the request.289@retval EFI_UNSUPPORTED The output device is not in a valid text mode.290291**/292typedef293EFI_STATUS294(EFIAPI *EFI_TEXT_CLEAR_SCREEN)(295IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This296);297298/**299Sets the current coordinates of the cursor position300301@param This The protocol instance pointer.302@param Column The position to set the cursor to. Must be greater than or303equal to zero and less than the number of columns and rows304by QueryMode ().305@param Row The position to set the cursor to. Must be greater than or306equal to zero and less than the number of columns and rows307by QueryMode ().308309@retval EFI_SUCCESS The operation completed successfully.310@retval EFI_DEVICE_ERROR The device had an error and could not complete the request.311@retval EFI_UNSUPPORTED The output device is not in a valid text mode, or the312cursor position is invalid for the current mode.313314**/315typedef316EFI_STATUS317(EFIAPI *EFI_TEXT_SET_CURSOR_POSITION)(318IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,319IN UINTN Column,320IN UINTN Row321);322323/**324Makes the cursor visible or invisible325326@param This The protocol instance pointer.327@param Visible If TRUE, the cursor is set to be visible. If FALSE, the cursor is328set to be invisible.329330@retval EFI_SUCCESS The operation completed successfully.331@retval EFI_DEVICE_ERROR The device had an error and could not complete the332request, or the device does not support changing333the cursor mode.334@retval EFI_UNSUPPORTED The output device is not in a valid text mode.335336**/337typedef338EFI_STATUS339(EFIAPI *EFI_TEXT_ENABLE_CURSOR)(340IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,341IN BOOLEAN Visible342);343344/**345@par Data Structure Description:346Mode Structure pointed to by Simple Text Out protocol.347**/348typedef struct {349///350/// The number of modes supported by QueryMode () and SetMode ().351///352INT32 MaxMode;353354//355// current settings356//357358///359/// The text mode of the output device(s).360///361INT32 Mode;362///363/// The current character output attribute.364///365INT32 Attribute;366///367/// The cursor's column.368///369INT32 CursorColumn;370///371/// The cursor's row.372///373INT32 CursorRow;374///375/// The cursor is currently visible or not.376///377BOOLEAN CursorVisible;378} EFI_SIMPLE_TEXT_OUTPUT_MODE;379380///381/// The SIMPLE_TEXT_OUTPUT protocol is used to control text-based output devices.382/// It is the minimum required protocol for any handle supplied as the ConsoleOut383/// or StandardError device. In addition, the minimum supported text mode of such384/// devices is at least 80 x 25 characters.385///386struct _EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL {387EFI_TEXT_RESET Reset;388389EFI_TEXT_STRING OutputString;390EFI_TEXT_TEST_STRING TestString;391392EFI_TEXT_QUERY_MODE QueryMode;393EFI_TEXT_SET_MODE SetMode;394EFI_TEXT_SET_ATTRIBUTE SetAttribute;395396EFI_TEXT_CLEAR_SCREEN ClearScreen;397EFI_TEXT_SET_CURSOR_POSITION SetCursorPosition;398EFI_TEXT_ENABLE_CURSOR EnableCursor;399400///401/// Pointer to SIMPLE_TEXT_OUTPUT_MODE data.402///403EFI_SIMPLE_TEXT_OUTPUT_MODE *Mode;404};405406extern EFI_GUID gEfiSimpleTextOutProtocolGuid;407408#endif409410411