2 Provides interface to shell console logger.
4 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 #ifndef _CONSOLE_LOGGER_HEADER_
15 #define _CONSOLE_LOGGER_HEADER_
19 #define CONSOLE_LOGGER_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('c', 'o', 'P', 'D')
21 typedef struct _CONSOLE_LOGGER_PRIVATE_DATA
{
23 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL OurConOut
; ///< the protocol we installed onto the system table
24 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*OldConOut
; ///< old protocol to reinstall upon exiting
25 EFI_HANDLE OldConHandle
; ///< old protocol handle
26 UINTN ScreenCount
; ///< How many screens worth of data to save
27 CHAR16
*Buffer
; ///< Buffer to save data
28 UINTN BufferSize
; ///< size of buffer in bytes
30 // start row is the top of the screen
31 UINTN OriginalStartRow
; ///< What the originally visible start row was
32 UINTN CurrentStartRow
; ///< what the currently visible start row is
34 UINTN RowsPerScreen
; ///< how many rows the screen can display
35 UINTN ColsPerScreen
; ///< how many columns the screen can display
37 INT32
*Attributes
; ///< Buffer for Attribute to be saved for each character
38 UINTN AttribSize
; ///< Size of Attributes in bytes
40 EFI_SIMPLE_TEXT_OUTPUT_MODE HistoryMode
; ///< mode of the history log
41 BOOLEAN Enabled
; ///< Set to FALSE when a break is requested.
42 UINTN RowCounter
; ///< Initial row of each print job.
43 } CONSOLE_LOGGER_PRIVATE_DATA
;
45 #define CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(a) CR (a, CONSOLE_LOGGER_PRIVATE_DATA, OurConOut, CONSOLE_LOGGER_PRIVATE_DATA_SIGNATURE)
48 Install our intermediate ConOut into the system table to
49 keep a log of all the info that is displayed to the user.
51 @param[in] ScreensToSave Sets how many screen-worths of data to save.
52 @param[out] ConsoleInfo The object to pass into later functions.
54 @retval EFI_SUCCESS The operation was successful.
55 @return other The operation failed.
57 @sa ConsoleLoggerResetBuffers
58 @sa InstallProtocolInterface
63 IN CONST UINTN ScreensToSave
,
64 OUT CONSOLE_LOGGER_PRIVATE_DATA
**ConsoleInfo
68 Return the system to the state it was before InstallConsoleLogger
71 @param[in, out] ConsoleInfo The object from the install function.
73 @retval EFI_SUCCESS The operation was successful
74 @return other The operation failed. This was from UninstallProtocolInterface.
78 ConsoleLoggerUninstall(
79 IN OUT CONSOLE_LOGGER_PRIVATE_DATA
*ConsoleInfo
83 Displays previously logged output back to the screen.
85 This will scroll the screen forwards and backwards through the log of previous
86 output. If Rows is 0 then the size of 1/2 the screen will be scrolled. If Rows
87 is (UINTN)(-1) then the size of the screen will be scrolled.
89 @param[in] Forward If TRUE then the log will be displayed forwards (scroll to newer).
90 If FALSE then the log will be displayed backwards (scroll to older).
91 @param[in] Rows Determines how many rows the log should scroll.
92 @param[in] ConsoleInfo The pointer to the instance of the console logger information.
96 ConsoleLoggerDisplayHistory(
97 IN CONST BOOLEAN Forward
,
99 IN CONSOLE_LOGGER_PRIVATE_DATA
*ConsoleInfo
103 Function to return to normal output whent he scrolling is complete.
104 @param[in] ConsoleInfo The pointer to the instance of the console logger information.
106 @retval EFI_SUCCESS The operation was successful.
107 @return other The operation failed. See UpdateDisplayFromHistory.
109 @sa UpdateDisplayFromHistory
113 ConsoleLoggerStopHistory(
114 IN CONSOLE_LOGGER_PRIVATE_DATA
*ConsoleInfo
118 Updates the hidden ConOut to be displaying the correct stuff.
119 @param[in] ConsoleInfo The pointer to the instance of the console logger information.
121 @retval EFI_SUCCESS The operation was successful.
122 @return other The operation failed.
126 UpdateDisplayFromHistory(
127 IN CONSOLE_LOGGER_PRIVATE_DATA
*ConsoleInfo
131 Reset the text output device hardware and optionaly run diagnostics
133 @param This Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
134 @param ExtendedVerification Indicates that a more extensive test may be performed
136 @retval EFI_SUCCESS The text output device was reset.
137 @retval EFI_DEVICE_ERROR The text output device is not functioning correctly and
143 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
144 IN BOOLEAN ExtendedVerification
148 Write a Unicode string to the output device.
150 @param[in] This Protocol instance pointer.
151 @param[in] WString The NULL-terminated Unicode string to be displayed on the output
152 device(s). All output devices must also support the Unicode
153 drawing defined in this file.
154 @retval EFI_SUCCESS The string was output to the device.
155 @retval EFI_DEVICE_ERROR The device reported an error while attempting to output
157 @retval EFI_UNSUPPORTED The output device's mode is not currently in a
159 @retval EFI_WARN_UNKNOWN_GLYPH This warning code indicates that some of the
160 characters in the Unicode string could not be
161 rendered and were skipped.
165 ConsoleLoggerOutputString(
166 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
171 Verifies that all characters in a Unicode string can be output to the
174 @param[in] This Protocol instance pointer.
175 @param[in] WString The NULL-terminated Unicode string to be examined for the output
178 @retval EFI_SUCCESS The device(s) are capable of rendering the output string.
179 @retval EFI_UNSUPPORTED Some of the characters in the Unicode string cannot be
180 rendered by one or more of the output devices mapped
186 ConsoleLoggerTestString (
187 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
192 Returns information for an available text mode that the output device(s)
195 @param[in] This Protocol instance pointer.
196 @param[in] ModeNumber The mode number to return information on.
197 @param[out] Columns Upon return, the number of columns in the selected geometry
198 @param[out] Rows Upon return, the number of rows in the selected geometry
200 @retval EFI_SUCCESS The requested mode information was returned.
201 @retval EFI_DEVICE_ERROR The device had an error and could not
202 complete the request.
203 @retval EFI_UNSUPPORTED The mode number was not valid.
207 ConsoleLoggerQueryMode (
208 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
215 Sets the output device(s) to a specified mode.
217 @param[in] This Protocol instance pointer.
218 @param[in] ModeNumber The mode number to set.
221 @retval EFI_SUCCESS The requested text mode was set.
222 @retval EFI_DEVICE_ERROR The device had an error and
223 could not complete the request.
224 @retval EFI_UNSUPPORTED The mode number was not valid.
228 ConsoleLoggerSetMode (
229 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
234 Sets the background and foreground colors for the OutputString () and
235 ClearScreen () functions.
237 @param[in] This Protocol instance pointer.
238 @param[in] Attribute The attribute to set. Bits 0..3 are the foreground color, and
239 bits 4..6 are the background color. All other bits are undefined
240 and must be zero. The valid Attributes are defined in this file.
242 @retval EFI_SUCCESS The attribute was set.
243 @retval EFI_DEVICE_ERROR The device had an error and
244 could not complete the request.
245 @retval EFI_UNSUPPORTED The attribute requested is not defined.
250 ConsoleLoggerSetAttribute (
251 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
256 Clears the output device(s) display to the currently selected background
259 @param[in] This Protocol instance pointer.
261 @retval EFI_SUCCESS The operation completed successfully.
262 @retval EFI_DEVICE_ERROR The device had an error and
263 could not complete the request.
264 @retval EFI_UNSUPPORTED The output device is not in a valid text mode.
268 ConsoleLoggerClearScreen (
269 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
273 Sets the current coordinates of the cursor position.
275 @param[in] This Protocol instance pointer.
276 @param[in] Column Column to put the cursor in. Must be between zero and Column returned from QueryMode
277 @param[in] Row Row to put the cursor in. Must be between zero and Row returned from QueryMode
279 @retval EFI_SUCCESS The operation completed successfully.
280 @retval EFI_DEVICE_ERROR The device had an error and
281 could not complete the request.
282 @retval EFI_UNSUPPORTED The output device is not in a valid text mode, or the
283 cursor position is invalid for the current mode.
287 ConsoleLoggerSetCursorPosition (
288 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
294 Makes the cursor visible or invisible
296 @param[in] This Protocol instance pointer.
297 @param[in] Visible If TRUE, the cursor is set to be visible. If FALSE, the cursor is
300 @retval EFI_SUCCESS The operation completed successfully.
301 @retval EFI_DEVICE_ERROR The device had an error and could not complete the
302 request, or the device does not support changing
304 @retval EFI_UNSUPPORTED The output device is not in a valid text mode.
309 ConsoleLoggerEnableCursor (
310 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
315 Function to update and verify that the current buffers are correct.
317 @param[in] ConsoleInfo The pointer to the instance of the console logger information.
319 This will be used when a mode has changed or a reset ocurred to verify all
324 ConsoleLoggerResetBuffers(
325 IN CONSOLE_LOGGER_PRIVATE_DATA
*ConsoleInfo
328 #endif //_CONSOLE_LOGGER_HEADER_