]>
Commit | Line | Data |
---|---|---|
d42aab6e HT |
1 | /** @file\r |
2 | Provides interface to shell console logger.\r | |
3 | \r | |
4 | Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r | |
5 | This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | **/\r | |
13 | \r | |
14 | #ifndef _CONSOLE_LOGGER_HEADER_\r | |
15 | #define _CONSOLE_LOGGER_HEADER_\r | |
16 | \r | |
17 | #include "Shell.h"\r | |
18 | \r | |
19 | #define CONSOLE_LOGGER_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('c', 'o', 'P', 'D')\r | |
20 | \r | |
21 | typedef struct _CONSOLE_LOGGER_PRIVATE_DATA{\r | |
22 | UINTN Signature;\r | |
23 | EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL OurConOut; ///< the protocol we installed onto the system table\r | |
24 | EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *OldConOut; ///< old protocol to reinstall upon exiting\r | |
25 | EFI_HANDLE OldConHandle; ///< old protocol handle\r | |
26 | UINTN ScreenCount; ///< How many screens worth of data to save\r | |
27 | CHAR16 *Buffer; ///< Buffer to save data\r | |
28 | UINTN BufferSize; ///< size of buffer in bytes\r | |
29 | \r | |
30 | // start row is the top of the screen\r | |
31 | UINTN OriginalStartRow; ///< What the originally visible start row was\r | |
32 | UINTN CurrentStartRow; ///< what the currently visible start row is\r | |
33 | \r | |
34 | UINTN RowsPerScreen; ///< how many rows the screen can display\r | |
35 | UINTN ColsPerScreen; ///< how many columns the screen can display\r | |
36 | \r | |
37 | INT32 *Attributes; ///< Buffer for Attribute to be saved for each character\r | |
38 | UINTN AttribSize; ///< Size of Attributes in bytes\r | |
39 | \r | |
40 | EFI_SIMPLE_TEXT_OUTPUT_MODE HistoryMode; ///< mode of the history log\r | |
41 | BOOLEAN Enabled; ///< Set to FALSE when a break is requested.\r | |
42 | UINTN RowCounter; ///< Initial row of each print job.\r | |
43 | } CONSOLE_LOGGER_PRIVATE_DATA;\r | |
44 | \r | |
45 | #define CONSOLE_LOGGER_PRIVATE_DATA_FROM_THIS(a) CR (a, CONSOLE_LOGGER_PRIVATE_DATA, OurConOut, CONSOLE_LOGGER_PRIVATE_DATA_SIGNATURE)\r | |
46 | \r | |
47 | /**\r | |
48 | Install our intermediate ConOut into the system table to\r | |
49 | keep a log of all the info that is displayed to the user.\r | |
50 | \r | |
51 | @param[in] ScreensToSave Sets how many screen-worths of data to save.\r | |
52 | @param[out] ConsoleInfo The object to pass into later functions.\r | |
53 | \r | |
54 | @retval EFI_SUCCESS The operation was successful.\r | |
55 | @return other The operation failed.\r | |
56 | \r | |
57 | @sa ConsoleLoggerResetBuffers\r | |
58 | @sa InstallProtocolInterface\r | |
59 | **/\r | |
60 | EFI_STATUS\r | |
61 | EFIAPI\r | |
62 | ConsoleLoggerInstall(\r | |
63 | IN CONST UINTN ScreensToSave,\r | |
64 | OUT CONSOLE_LOGGER_PRIVATE_DATA **ConsoleInfo\r | |
65 | );\r | |
66 | \r | |
67 | /**\r | |
68 | Return the system to the state it was before InstallConsoleLogger\r | |
69 | was installed.\r | |
70 | \r | |
71 | @param[in, out] ConsoleInfo The object from the install function.\r | |
72 | \r | |
73 | @retval EFI_SUCCESS The operation was successful\r | |
74 | @return other The operation failed. This was from UninstallProtocolInterface.\r | |
75 | **/\r | |
76 | EFI_STATUS\r | |
77 | EFIAPI\r | |
78 | ConsoleLoggerUninstall(\r | |
79 | IN OUT CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo\r | |
80 | );\r | |
81 | \r | |
82 | /**\r | |
83 | Displays previously logged output back to the screen.\r | |
84 | \r | |
85 | This will scroll the screen forwards and backwards through the log of previous\r | |
86 | output. If Rows is 0 then the size of 1/2 the screen will be scrolled. If Rows\r | |
87 | is (UINTN)(-1) then the size of the screen will be scrolled.\r | |
88 | \r | |
89 | @param[in] Forward If TRUE then the log will be displayed forwards (scroll to newer).\r | |
90 | If FALSE then the log will be displayed backwards (scroll to older).\r | |
91 | @param[in] Rows Determines how many rows the log should scroll.\r | |
92 | @param[in] ConsoleInfo The pointer to the instance of the console logger information.\r | |
93 | **/\r | |
94 | EFI_STATUS\r | |
95 | EFIAPI\r | |
96 | ConsoleLoggerDisplayHistory(\r | |
97 | IN CONST BOOLEAN Forward,\r | |
98 | IN CONST UINTN Rows,\r | |
99 | IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo\r | |
100 | );\r | |
101 | \r | |
102 | /**\r | |
103 | Function to return to normal output whent he scrolling is complete.\r | |
104 | @param[in] ConsoleInfo The pointer to the instance of the console logger information.\r | |
105 | \r | |
106 | @retval EFI_SUCCESS The operation was successful.\r | |
107 | @return other The operation failed. See UpdateDisplayFromHistory.\r | |
108 | \r | |
109 | @sa UpdateDisplayFromHistory\r | |
110 | **/\r | |
111 | EFI_STATUS\r | |
112 | EFIAPI\r | |
113 | ConsoleLoggerStopHistory(\r | |
114 | IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo\r | |
115 | );\r | |
116 | \r | |
117 | /**\r | |
118 | Updates the hidden ConOut to be displaying the correct stuff.\r | |
119 | @param[in] ConsoleInfo The pointer to the instance of the console logger information.\r | |
120 | \r | |
121 | @retval EFI_SUCCESS The operation was successful.\r | |
122 | @return other The operation failed.\r | |
123 | **/\r | |
124 | EFI_STATUS\r | |
125 | EFIAPI\r | |
126 | UpdateDisplayFromHistory(\r | |
127 | IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo\r | |
128 | );\r | |
129 | \r | |
130 | /**\r | |
131 | Reset the text output device hardware and optionaly run diagnostics\r | |
132 | \r | |
133 | @param This Pointer to EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL\r | |
134 | @param ExtendedVerification Indicates that a more extensive test may be performed\r | |
135 | \r | |
136 | @retval EFI_SUCCESS The text output device was reset.\r | |
137 | @retval EFI_DEVICE_ERROR The text output device is not functioning correctly and\r | |
138 | could not be reset.\r | |
139 | **/\r | |
140 | EFI_STATUS\r | |
141 | EFIAPI\r | |
142 | ConsoleLoggerReset (\r | |
143 | IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r | |
144 | IN BOOLEAN ExtendedVerification\r | |
145 | );\r | |
146 | \r | |
147 | /**\r | |
148 | Write a Unicode string to the output device.\r | |
149 | \r | |
150 | @param[in] This Protocol instance pointer.\r | |
151 | @param[in] WString The NULL-terminated Unicode string to be displayed on the output\r | |
152 | device(s). All output devices must also support the Unicode\r | |
153 | drawing defined in this file.\r | |
154 | @retval EFI_SUCCESS The string was output to the device.\r | |
155 | @retval EFI_DEVICE_ERROR The device reported an error while attempting to output\r | |
156 | the text.\r | |
157 | @retval EFI_UNSUPPORTED The output device's mode is not currently in a\r | |
158 | defined text mode.\r | |
159 | @retval EFI_WARN_UNKNOWN_GLYPH This warning code indicates that some of the\r | |
160 | characters in the Unicode string could not be\r | |
161 | rendered and were skipped.\r | |
162 | **/\r | |
163 | EFI_STATUS\r | |
164 | EFIAPI\r | |
165 | ConsoleLoggerOutputString(\r | |
166 | IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r | |
167 | IN CHAR16 *WString\r | |
168 | );\r | |
169 | \r | |
170 | /**\r | |
171 | Verifies that all characters in a Unicode string can be output to the\r | |
172 | target device.\r | |
173 | \r | |
174 | @param[in] This Protocol instance pointer.\r | |
175 | @param[in] WString The NULL-terminated Unicode string to be examined for the output\r | |
176 | device(s).\r | |
177 | \r | |
178 | @retval EFI_SUCCESS The device(s) are capable of rendering the output string.\r | |
179 | @retval EFI_UNSUPPORTED Some of the characters in the Unicode string cannot be\r | |
180 | rendered by one or more of the output devices mapped\r | |
181 | by the EFI handle.\r | |
182 | \r | |
183 | **/\r | |
184 | EFI_STATUS\r | |
185 | EFIAPI\r | |
186 | ConsoleLoggerTestString (\r | |
187 | IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r | |
188 | IN CHAR16 *WString\r | |
189 | );\r | |
190 | \r | |
191 | /**\r | |
192 | Returns information for an available text mode that the output device(s)\r | |
193 | supports.\r | |
194 | \r | |
195 | @param[in] This Protocol instance pointer.\r | |
196 | @param[in] ModeNumber The mode number to return information on.\r | |
197 | @param[out] Columns Upon return, the number of columns in the selected geometry\r | |
198 | @param[out] Rows Upon return, the number of rows in the selected geometry\r | |
199 | \r | |
200 | @retval EFI_SUCCESS The requested mode information was returned.\r | |
201 | @retval EFI_DEVICE_ERROR The device had an error and could not\r | |
202 | complete the request.\r | |
203 | @retval EFI_UNSUPPORTED The mode number was not valid.\r | |
204 | **/\r | |
205 | EFI_STATUS\r | |
206 | EFIAPI\r | |
207 | ConsoleLoggerQueryMode (\r | |
208 | IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r | |
209 | IN UINTN ModeNumber,\r | |
210 | OUT UINTN *Columns,\r | |
211 | OUT UINTN *Rows\r | |
212 | );\r | |
213 | \r | |
214 | /**\r | |
215 | Sets the output device(s) to a specified mode.\r | |
216 | \r | |
217 | @param[in] This Protocol instance pointer.\r | |
218 | @param[in] ModeNumber The mode number to set.\r | |
219 | \r | |
220 | \r | |
221 | @retval EFI_SUCCESS The requested text mode was set.\r | |
222 | @retval EFI_DEVICE_ERROR The device had an error and\r | |
223 | could not complete the request.\r | |
224 | @retval EFI_UNSUPPORTED The mode number was not valid.\r | |
225 | **/\r | |
226 | EFI_STATUS\r | |
227 | EFIAPI\r | |
228 | ConsoleLoggerSetMode (\r | |
229 | IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r | |
230 | IN UINTN ModeNumber\r | |
231 | );\r | |
232 | \r | |
233 | /**\r | |
234 | Sets the background and foreground colors for the OutputString () and\r | |
235 | ClearScreen () functions.\r | |
236 | \r | |
237 | @param[in] This Protocol instance pointer.\r | |
238 | @param[in] Attribute The attribute to set. Bits 0..3 are the foreground color, and\r | |
239 | bits 4..6 are the background color. All other bits are undefined\r | |
240 | and must be zero. The valid Attributes are defined in this file.\r | |
241 | \r | |
242 | @retval EFI_SUCCESS The attribute was set.\r | |
243 | @retval EFI_DEVICE_ERROR The device had an error and\r | |
244 | could not complete the request.\r | |
245 | @retval EFI_UNSUPPORTED The attribute requested is not defined.\r | |
246 | \r | |
247 | **/\r | |
248 | EFI_STATUS\r | |
249 | EFIAPI\r | |
250 | ConsoleLoggerSetAttribute (\r | |
251 | IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r | |
252 | IN UINTN Attribute\r | |
253 | );\r | |
254 | \r | |
255 | /**\r | |
256 | Clears the output device(s) display to the currently selected background\r | |
257 | color.\r | |
258 | \r | |
259 | @param[in] This Protocol instance pointer.\r | |
260 | \r | |
261 | @retval EFI_SUCCESS The operation completed successfully.\r | |
262 | @retval EFI_DEVICE_ERROR The device had an error and\r | |
263 | could not complete the request.\r | |
264 | @retval EFI_UNSUPPORTED The output device is not in a valid text mode.\r | |
265 | **/\r | |
266 | EFI_STATUS\r | |
267 | EFIAPI\r | |
268 | ConsoleLoggerClearScreen (\r | |
269 | IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This\r | |
270 | );\r | |
271 | \r | |
272 | /**\r | |
273 | Sets the current coordinates of the cursor position.\r | |
274 | \r | |
275 | @param[in] This Protocol instance pointer.\r | |
276 | @param[in] Column Column to put the cursor in. Must be between zero and Column returned from QueryMode\r | |
277 | @param[in] Row Row to put the cursor in. Must be between zero and Row returned from QueryMode\r | |
278 | \r | |
279 | @retval EFI_SUCCESS The operation completed successfully.\r | |
280 | @retval EFI_DEVICE_ERROR The device had an error and\r | |
281 | could not complete the request.\r | |
282 | @retval EFI_UNSUPPORTED The output device is not in a valid text mode, or the\r | |
283 | cursor position is invalid for the current mode.\r | |
284 | **/\r | |
285 | EFI_STATUS\r | |
286 | EFIAPI\r | |
287 | ConsoleLoggerSetCursorPosition (\r | |
288 | IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r | |
289 | IN UINTN Column,\r | |
290 | IN UINTN Row\r | |
291 | );\r | |
292 | \r | |
293 | /**\r | |
294 | Makes the cursor visible or invisible\r | |
295 | \r | |
296 | @param[in] This Protocol instance pointer.\r | |
297 | @param[in] Visible If TRUE, the cursor is set to be visible. If FALSE, the cursor is\r | |
298 | set to be invisible.\r | |
299 | \r | |
300 | @retval EFI_SUCCESS The operation completed successfully.\r | |
301 | @retval EFI_DEVICE_ERROR The device had an error and could not complete the\r | |
302 | request, or the device does not support changing\r | |
303 | the cursor mode.\r | |
304 | @retval EFI_UNSUPPORTED The output device is not in a valid text mode.\r | |
305 | \r | |
306 | **/\r | |
307 | EFI_STATUS\r | |
308 | EFIAPI\r | |
309 | ConsoleLoggerEnableCursor (\r | |
310 | IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This,\r | |
311 | IN BOOLEAN Visible\r | |
312 | );\r | |
313 | \r | |
314 | /**\r | |
315 | Function to update and verify that the current buffers are correct.\r | |
316 | \r | |
317 | @param[in] ConsoleInfo The pointer to the instance of the console logger information.\r | |
318 | \r | |
319 | This will be used when a mode has changed or a reset ocurred to verify all\r | |
320 | history buffers.\r | |
321 | **/\r | |
322 | EFI_STATUS\r | |
323 | EFIAPI\r | |
324 | ConsoleLoggerResetBuffers(\r | |
325 | IN CONSOLE_LOGGER_PRIVATE_DATA *ConsoleInfo\r | |
326 | );\r | |
327 | \r | |
328 | #endif //_CONSOLE_LOGGER_HEADER_\r | |
329 | \r |