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 #include <Protocol/SimpleTextOut.h>
20 #include <Protocol/EfiShell.h>
21 #include <Protocol/EfiShellParameters.h>
23 #include <Library/DebugLib.h>
24 #include <Library/BaseLib.h>
25 #include <Library/BaseMemoryLib.h>
26 #include <Library/MemoryAllocationLib.h>
27 #include <Library/UefiBootServicesTableLib.h>
28 #include <Library/HiiLib.h>
29 #include <Library/ShellLib.h>
31 #define CONSOLE_LOGGER_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('c', 'o', 'P', 'D')
33 typedef struct _CONSOLE_LOGGER_PRIVATE_DATA
{
35 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL OurConOut
; ///< the protocol we installed onto the system table
36 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*OldConOut
; ///< old protocol to reinstall upon exiting
37 EFI_HANDLE OldConHandle
; ///< old protocol handle
38 UINTN ScreenCount
; ///< How many screens worth of data to save
39 CHAR16
*Buffer
; ///< Buffer to save data
40 UINTN BufferSize
; ///< size of buffer in bytes
42 // start row is the top of the screen
43 UINTN OriginalStartRow
; ///< What the originally visible start row was
44 UINTN CurrentStartRow
; ///< what the currently visible start row is
46 UINTN RowsPerScreen
; ///< how many rows the screen can display
47 UINTN ColsPerScreen
; ///< how many columns the screen can display
49 INT32
*Attributes
; ///< Buffer for Attribute to be saved for each character
50 UINTN AttribSize
; ///< Size of Attributes in bytes
52 EFI_SIMPLE_TEXT_OUTPUT_MODE HistoryMode
; ///< mode of the history log
53 BOOLEAN Enabled
; ///< Set to FALSE when a break is requested.
54 UINTN RowCounter
; ///< Initial row of each print job.
55 } CONSOLE_LOGGER_PRIVATE_DATA
;
57 #define CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(a) CR (a, CONSOLE_LOGGER_PRIVATE_DATA, OurConOut, CONSOLE_LOGGER_PRIVATE_DATA_SIGNATURE)
60 Install our intermediate ConOut into the system table to
61 keep a log of all the info that is displayed to the user.
63 @param[in] ScreensToSave Sets how many screen-worths of data to save.
64 @param[out] ConsoleInfo The object to pass into later functions.
66 @retval EFI_SUCCESS The operation was successful.
67 @return other The operation failed.
69 @sa ConsoleLoggerResetBuffers
70 @sa InstallProtocolInterface
75 IN CONST UINTN ScreensToSave
,
76 OUT CONSOLE_LOGGER_PRIVATE_DATA
**ConsoleInfo
80 Return the system to the state it was before InstallConsoleLogger
83 @param[in,out] ConsoleInfo The object from the install function.
85 @retval EFI_SUCCESS The operation was successful
86 @return other The operation failed. This was from UninstallProtocolInterface.
90 ConsoleLoggerUninstall(
91 IN OUT CONSOLE_LOGGER_PRIVATE_DATA
*ConsoleInfo
95 Displays previously logged output back to the screen.
97 This will scroll the screen forwards and backwards through the log of previous
98 output. If Rows is 0 then the size of 1/2 the screen will be scrolled. If Rows
99 is (UINTN)(-1) then the size of the screen will be scrolled.
101 @param[in] Forward If TRUE then the log will be displayed forwards (scroll to newer).
102 If FALSE then the log will be displayed backwards (scroll to older).
103 @param[in] Rows Determines how many rows the log should scroll.
104 @param[in] ConsoleInfo The pointer to the instance of the console logger information.
108 ConsoleLoggerDisplayHistory(
109 IN CONST BOOLEAN Forward
,
111 IN CONSOLE_LOGGER_PRIVATE_DATA
*ConsoleInfo
115 Function to return to normal output whent he scrolling is complete.
116 @param[in] ConsoleInfo The pointer to the instance of the console logger information.
118 @retval EFI_SUCCESS The operation was successful.
119 @return other The operation failed. See UpdateDisplayFromHistory.
121 @sa UpdateDisplayFromHistory
125 ConsoleLoggerStopHistory(
126 IN CONSOLE_LOGGER_PRIVATE_DATA
*ConsoleInfo
130 Updates the hidden ConOut to be displaying the correct stuff.
131 @param[in] ConsoleInfo The pointer to the instance of the console logger information.
133 @retval EFI_SUCCESS The operation was successful.
134 @return other The operation failed.
138 UpdateDisplayFromHistory(
139 IN CONSOLE_LOGGER_PRIVATE_DATA
*ConsoleInfo
143 Reset the text output device hardware and optionaly run diagnostics
145 @param This Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
146 @param ExtendedVerification Indicates that a more extensive test may be performed
148 @retval EFI_SUCCESS The text output device was reset.
149 @retval EFI_DEVICE_ERROR The text output device is not functioning correctly and
155 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
156 IN BOOLEAN ExtendedVerification
160 Write a Unicode string to the output device.
162 @param[in] This Protocol instance pointer.
163 @param[in] WString The NULL-terminated Unicode string to be displayed on the output
164 device(s). All output devices must also support the Unicode
165 drawing defined in this file.
166 @retval EFI_SUCCESS The string was output to the device.
167 @retval EFI_DEVICE_ERROR The device reported an error while attempting to output
169 @retval EFI_UNSUPPORTED The output device's mode is not currently in a
171 @retval EFI_WARN_UNKNOWN_GLYPH This warning code indicates that some of the
172 characters in the Unicode string could not be
173 rendered and were skipped.
177 ConsoleLoggerOutputString(
178 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
183 Verifies that all characters in a Unicode string can be output to the
186 @param[in] This Protocol instance pointer.
187 @param[in] WString The NULL-terminated Unicode string to be examined for the output
190 @retval EFI_SUCCESS The device(s) are capable of rendering the output string.
191 @retval EFI_UNSUPPORTED Some of the characters in the Unicode string cannot be
192 rendered by one or more of the output devices mapped
198 ConsoleLoggerTestString (
199 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
204 Returns information for an available text mode that the output device(s)
207 @param[in] This Protocol instance pointer.
208 @param[in] ModeNumber The mode number to return information on.
209 @param[out] Columns Upon return, the number of columns in the selected geometry
210 @param[out] Rows Upon return, the number of rows in the selected geometry
212 @retval EFI_SUCCESS The requested mode information was returned.
213 @retval EFI_DEVICE_ERROR The device had an error and could not
214 complete the request.
215 @retval EFI_UNSUPPORTED The mode number was not valid.
219 ConsoleLoggerQueryMode (
220 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
227 Sets the output device(s) to a specified mode.
229 @param[in] This Protocol instance pointer.
230 @param[in] ModeNumber The mode number to set.
233 @retval EFI_SUCCESS The requested text mode was set.
234 @retval EFI_DEVICE_ERROR The device had an error and
235 could not complete the request.
236 @retval EFI_UNSUPPORTED The mode number was not valid.
240 ConsoleLoggerSetMode (
241 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
246 Sets the background and foreground colors for the OutputString () and
247 ClearScreen () functions.
249 @param[in] This Protocol instance pointer.
250 @param[in] Attribute The attribute to set. Bits 0..3 are the foreground color, and
251 bits 4..6 are the background color. All other bits are undefined
252 and must be zero. The valid Attributes are defined in this file.
254 @retval EFI_SUCCESS The attribute was set.
255 @retval EFI_DEVICE_ERROR The device had an error and
256 could not complete the request.
257 @retval EFI_UNSUPPORTED The attribute requested is not defined.
262 ConsoleLoggerSetAttribute (
263 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
268 Clears the output device(s) display to the currently selected background
271 @param[in] This Protocol instance pointer.
273 @retval EFI_SUCCESS The operation completed successfully.
274 @retval EFI_DEVICE_ERROR The device had an error and
275 could not complete the request.
276 @retval EFI_UNSUPPORTED The output device is not in a valid text mode.
280 ConsoleLoggerClearScreen (
281 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
285 Sets the current coordinates of the cursor position.
287 @param[in] This Protocol instance pointer.
288 @param[in] Column Column to put the cursor in. Must be between zero and Column returned from QueryMode
289 @param[in] Row Row to put the cursor in. Must be between zero and Row returned from QueryMode
291 @retval EFI_SUCCESS The operation completed successfully.
292 @retval EFI_DEVICE_ERROR The device had an error and
293 could not complete the request.
294 @retval EFI_UNSUPPORTED The output device is not in a valid text mode, or the
295 cursor position is invalid for the current mode.
299 ConsoleLoggerSetCursorPosition (
300 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
306 Makes the cursor visible or invisible
308 @param[in] This Protocol instance pointer.
309 @param[in] Visible If TRUE, the cursor is set to be visible. If FALSE, the cursor is
312 @retval EFI_SUCCESS The operation completed successfully.
313 @retval EFI_DEVICE_ERROR The device had an error and could not complete the
314 request, or the device does not support changing
316 @retval EFI_UNSUPPORTED The output device is not in a valid text mode.
321 ConsoleLoggerEnableCursor (
322 IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
*This
,
327 Function to update and verify that the current buffers are correct.
329 @param[in] ConsoleInfo The pointer to the instance of the console logger information.
331 This will be used when a mode has changed or a reset ocurred to verify all
336 ConsoleLoggerResetBuffers(
337 IN CONSOLE_LOGGER_PRIVATE_DATA
*ConsoleInfo
340 #endif //_CONSOLE_LOGGER_HEADER_