]>
Commit | Line | Data |
---|---|---|
3eb9473e | 1 | /*++\r |
2 | \r | |
3 | Copyright (c) 2004, Intel Corporation \r | |
4 | All rights reserved. This program and the accompanying materials \r | |
5 | are licensed and made available under the terms and conditions of the BSD License \r | |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | \r | |
12 | Module Name:\r | |
13 | \r | |
14 | EfiScriptLib.h\r | |
15 | \r | |
16 | Abstract:\r | |
17 | \r | |
18 | \r | |
19 | --*/\r | |
20 | \r | |
21 | #ifndef _EFI_SCRIPT_LIB_H_\r | |
22 | #define _EFI_SCRIPT_LIB_H_\r | |
23 | \r | |
24 | #include "Tiano.h"\r | |
25 | #include "EfiCommonLib.h"\r | |
26 | #include "EfiBootScript.h"\r | |
27 | #include EFI_PROTOCOL_DEFINITION (BootScriptSave)\r | |
28 | \r | |
29 | \r | |
30 | EFI_STATUS\r | |
31 | BootScriptSaveInitialize (\r | |
32 | IN EFI_HANDLE ImageHandle,\r | |
33 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
34 | )\r | |
35 | /*++\r | |
36 | \r | |
37 | Routine Description:\r | |
38 | \r | |
39 | Intialize Boot Script Lib if it has not yet been initialized. \r | |
40 | \r | |
41 | Arguments:\r | |
42 | \r | |
43 | ImageHandle - The firmware allocated handle for the EFI image.\r | |
44 | \r | |
45 | SystemTable - A pointer to the EFI System Table.\r | |
46 | \r | |
47 | Returns: \r | |
48 | \r | |
49 | EFI_STATUS always returns EFI_SUCCESS\r | |
50 | \r | |
51 | --*/\r | |
52 | ;\r | |
53 | \r | |
54 | EFI_STATUS\r | |
55 | BootScriptSaveIoWrite (\r | |
56 | IN UINT16 TableName,\r | |
57 | IN EFI_BOOT_SCRIPT_WIDTH Width,\r | |
58 | IN UINT64 Address,\r | |
59 | IN UINTN Count,\r | |
60 | IN VOID *Buffer\r | |
61 | )\r | |
62 | /*++\r | |
63 | \r | |
64 | Routine Description:\r | |
65 | \r | |
66 | Save I/O write to boot script with opcode EFI_BOOT_SCRIPT_IO_WRITE_OPCODE\r | |
67 | \r | |
68 | Arguments:\r | |
69 | \r | |
70 | TableName - Desired boot script table\r | |
71 | \r | |
72 | Width - The width of the I/O operations.\r | |
73 | \r | |
74 | Address - The base address of the I/O operations.\r | |
75 | \r | |
76 | Count - The number of I/O operations to perform.\r | |
77 | \r | |
78 | Buffer - The source buffer from which to write data. \r | |
79 | \r | |
80 | Returns: \r | |
81 | \r | |
82 | EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r | |
83 | \r | |
84 | EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r | |
85 | \r | |
86 | --*/\r | |
87 | ;\r | |
88 | \r | |
89 | EFI_STATUS\r | |
90 | BootScriptSaveIoReadWrite (\r | |
91 | IN UINT16 TableName,\r | |
92 | IN EFI_BOOT_SCRIPT_WIDTH Width,\r | |
93 | IN UINT64 Address,\r | |
94 | IN VOID *Data,\r | |
95 | IN VOID *DataMask\r | |
96 | )\r | |
97 | /*++\r | |
98 | \r | |
99 | Routine Description:\r | |
100 | \r | |
101 | Save I/O modify to boot script with opcode EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE\r | |
102 | \r | |
103 | Arguments:\r | |
104 | \r | |
105 | TableName - Desired boot script table\r | |
106 | \r | |
107 | Width - The width of the I/O operations.\r | |
108 | \r | |
109 | Address - The base address of the I/O operations.\r | |
110 | \r | |
111 | Data - A pointer to the data to be OR-ed.\r | |
112 | \r | |
113 | DataMask - A pointer to the data mask to be AND-ed with the data read from the register.\r | |
114 | \r | |
115 | Returns: \r | |
116 | \r | |
117 | EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r | |
118 | \r | |
119 | EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r | |
120 | \r | |
121 | --*/\r | |
122 | ;\r | |
123 | \r | |
124 | EFI_STATUS\r | |
125 | BootScriptSaveMemWrite (\r | |
126 | IN UINT16 TableName,\r | |
127 | IN EFI_BOOT_SCRIPT_WIDTH Width,\r | |
128 | IN UINT64 Address,\r | |
129 | IN UINTN Count,\r | |
130 | IN VOID *Buffer\r | |
131 | )\r | |
132 | /*++\r | |
133 | \r | |
134 | Routine Description:\r | |
135 | \r | |
136 | Save memory write to boot script with opcode EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE\r | |
137 | \r | |
138 | Arguments:\r | |
139 | \r | |
140 | TableName - Desired boot script table\r | |
141 | \r | |
142 | Width - The width of the memory operations.\r | |
143 | \r | |
144 | Address - The base address of the memory operations.\r | |
145 | \r | |
146 | Count - The number of memory operations to perform.\r | |
147 | \r | |
148 | Buffer - The source buffer from which to write the data. \r | |
149 | \r | |
150 | Returns: \r | |
151 | \r | |
152 | EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r | |
153 | \r | |
154 | EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r | |
155 | \r | |
156 | --*/\r | |
157 | ;\r | |
158 | \r | |
159 | EFI_STATUS\r | |
160 | BootScriptSaveMemReadWrite (\r | |
161 | IN UINT16 TableName,\r | |
162 | IN EFI_BOOT_SCRIPT_WIDTH Width,\r | |
163 | IN UINT64 Address,\r | |
164 | IN VOID *Data,\r | |
165 | IN VOID *DataMask\r | |
166 | )\r | |
167 | /*++\r | |
168 | \r | |
169 | Routine Description:\r | |
170 | \r | |
171 | Save memory modify to boot script with opcode EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE\r | |
172 | \r | |
173 | Arguments:\r | |
174 | \r | |
175 | TableName - Desired boot script table\r | |
176 | \r | |
177 | Width - The width of the memory operations.\r | |
178 | \r | |
179 | Address - The base address of the memory operations.\r | |
180 | \r | |
181 | Data - A pointer to the data to be OR-ed.\r | |
182 | \r | |
183 | DataMask - A pointer to the data mask to be AND-ed with the data read from the register.\r | |
184 | \r | |
185 | Returns: \r | |
186 | \r | |
187 | EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r | |
188 | \r | |
189 | EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r | |
190 | \r | |
191 | --*/\r | |
192 | ;\r | |
193 | \r | |
194 | EFI_STATUS\r | |
195 | BootScriptSavePciCfgWrite (\r | |
196 | IN UINT16 TableName,\r | |
197 | IN EFI_BOOT_SCRIPT_WIDTH Width,\r | |
198 | IN UINT64 Address,\r | |
199 | IN UINTN Count,\r | |
200 | IN VOID *Buffer\r | |
201 | )\r | |
202 | /*++\r | |
203 | \r | |
204 | Routine Description:\r | |
205 | \r | |
206 | Save PCI configuration space write operation to boot script with opcode \r | |
207 | EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE\r | |
208 | \r | |
209 | Arguments:\r | |
210 | \r | |
211 | TableName - Desired boot script table\r | |
212 | \r | |
213 | Width - The width of the PCI operations\r | |
214 | \r | |
215 | Address - The address within the PCI configuration space.\r | |
216 | \r | |
217 | Count - The number of PCI operations to perform.\r | |
218 | \r | |
219 | Buffer - The source buffer from which to write the data.\r | |
220 | \r | |
221 | Returns: \r | |
222 | \r | |
223 | EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r | |
224 | \r | |
225 | EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r | |
226 | \r | |
227 | --*/\r | |
228 | ;\r | |
229 | \r | |
230 | EFI_STATUS\r | |
231 | BootScriptSavePciCfgReadWrite (\r | |
232 | IN UINT16 TableName,\r | |
233 | IN EFI_BOOT_SCRIPT_WIDTH Width,\r | |
234 | IN UINT64 Address,\r | |
235 | IN VOID *Data,\r | |
236 | IN VOID *DataMask\r | |
237 | )\r | |
238 | /*++\r | |
239 | \r | |
240 | Routine Description:\r | |
241 | \r | |
242 | Save PCI configuration space modify operation to boot script with opcode \r | |
243 | EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE\r | |
244 | \r | |
245 | Arguments:\r | |
246 | \r | |
247 | TableName - Desired boot script table\r | |
248 | \r | |
249 | Width - The width of the PCI operations\r | |
250 | \r | |
251 | Address - The address within the PCI configuration space.\r | |
252 | \r | |
253 | Data - A pointer to the data to be OR-ed.\r | |
254 | \r | |
255 | DataMask - A pointer to the data mask to be AND-ed with the data read from the register.\r | |
256 | \r | |
257 | Returns: \r | |
258 | \r | |
259 | EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r | |
260 | \r | |
261 | EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r | |
262 | \r | |
263 | --*/\r | |
264 | ;\r | |
265 | ;\r | |
266 | \r | |
267 | EFI_STATUS\r | |
268 | BootScriptSaveSmbusExecute (\r | |
269 | IN UINT16 TableName,\r | |
270 | IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r | |
271 | IN EFI_SMBUS_DEVICE_COMMAND Command,\r | |
272 | IN EFI_SMBUS_OPERATION Operation,\r | |
273 | IN BOOLEAN PecCheck,\r | |
274 | IN UINTN *Length,\r | |
275 | IN VOID *Buffer\r | |
276 | )\r | |
277 | /*++\r | |
278 | \r | |
279 | Routine Description:\r | |
280 | \r | |
281 | Save SMBus command execution to boot script with opcode \r | |
282 | EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE\r | |
283 | \r | |
284 | Arguments:\r | |
285 | \r | |
286 | TableName - Desired boot script table\r | |
287 | SlaveAddress - The SMBus address for the slave device that the operation is targeting.\r | |
288 | Command - The command that is transmitted by the SMBus host controller to the \r | |
289 | SMBus slave device.\r | |
290 | Operation - Indicates which particular SMBus protocol it will use to execute the \r | |
291 | SMBus transactions.\r | |
292 | PecCheck - Defines if Packet Error Code (PEC) checking is required for this operation.\r | |
293 | Length - A pointer to signify the number of bytes that this operation will do.\r | |
294 | Buffer - Contains the value of data to execute to the SMBUS slave device.\r | |
295 | \r | |
296 | Returns:\r | |
297 | \r | |
298 | EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r | |
299 | \r | |
300 | EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r | |
301 | \r | |
302 | --*/\r | |
303 | ;\r | |
304 | \r | |
305 | EFI_STATUS\r | |
306 | BootScriptSaveStall (\r | |
307 | IN UINT16 TableName,\r | |
308 | IN UINTN Duration\r | |
309 | )\r | |
310 | /*++\r | |
311 | \r | |
312 | Routine Description:\r | |
313 | \r | |
314 | Save execution stall on the processor to boot script with opcode \r | |
315 | EFI_BOOT_SCRIPT_STALL_OPCODE\r | |
316 | \r | |
317 | Arguments:\r | |
318 | \r | |
319 | TableName - Desired boot script table\r | |
320 | \r | |
321 | Duration - Duration in microseconds of the stall.\r | |
322 | \r | |
323 | Returns:\r | |
324 | \r | |
325 | EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r | |
326 | \r | |
327 | EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r | |
328 | \r | |
329 | --*/\r | |
330 | ;\r | |
331 | \r | |
332 | EFI_STATUS\r | |
333 | BootScriptSaveDispatch (\r | |
334 | IN UINT16 TableName,\r | |
335 | IN EFI_PHYSICAL_ADDRESS EntryPoint\r | |
336 | )\r | |
337 | /*++\r | |
338 | \r | |
339 | Routine Description:\r | |
340 | \r | |
341 | Save dispatching specified arbitrary code to boot script with opcode \r | |
342 | EFI_BOOT_SCRIPT_DISPATCH_OPCODE\r | |
343 | \r | |
344 | Arguments:\r | |
345 | \r | |
346 | TableName - Desired boot script table\r | |
347 | \r | |
348 | EntryPoint - Entry point of the code to be dispatched.\r | |
349 | \r | |
350 | Returns:\r | |
351 | \r | |
352 | EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r | |
353 | \r | |
354 | EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r | |
355 | \r | |
356 | --*/\r | |
357 | ;\r | |
358 | \r | |
359 | EFI_STATUS\r | |
360 | EFIAPI\r | |
361 | BootScriptSaveInformation (\r | |
362 | IN UINT16 TableName,\r | |
363 | IN UINT32 Length, \r | |
364 | IN EFI_PHYSICAL_ADDRESS Buffer\r | |
365 | )\r | |
366 | /*++\r | |
367 | \r | |
368 | Routine Description:\r | |
369 | \r | |
370 | Save a Information Opcode record in table specified with TableName\r | |
371 | \r | |
372 | Arguments:\r | |
373 | \r | |
374 | TableName - Desired boot script table\r | |
375 | Length - Length of information in bytes\r | |
376 | Buffer - Content of information that will be saved in script table\r | |
377 | \r | |
378 | Returns:\r | |
379 | \r | |
380 | EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r | |
381 | \r | |
382 | EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r | |
383 | \r | |
384 | --*/\r | |
385 | ;\r | |
386 | \r | |
387 | EFI_STATUS\r | |
388 | EFIAPI\r | |
389 | BootScriptSaveInformationUnicodeString (\r | |
390 | IN UINT16 TableName,\r | |
391 | IN CHAR16 *String\r | |
392 | )\r | |
393 | /*++\r | |
394 | \r | |
395 | Routine Description:\r | |
396 | \r | |
397 | Save a Information Opcode record in table specified with TableName, the information\r | |
398 | is a unicode string.\r | |
399 | \r | |
400 | Arguments:\r | |
401 | \r | |
402 | TableName - Desired boot script table\r | |
403 | String - The string that will be saved in script table\r | |
404 | \r | |
405 | Returns:\r | |
406 | \r | |
407 | EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r | |
408 | \r | |
409 | EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r | |
410 | \r | |
411 | --*/\r | |
412 | ;\r | |
413 | \r | |
414 | EFI_STATUS\r | |
415 | EFIAPI\r | |
416 | BootScriptSaveInformationAsciiString (\r | |
417 | IN UINT16 TableName,\r | |
418 | IN CHAR8 *String\r | |
419 | )\r | |
420 | /*++\r | |
421 | \r | |
422 | Routine Description:\r | |
423 | \r | |
424 | Save a Information Opcode record in table specified with TableName, the information\r | |
425 | is a ascii string.\r | |
426 | \r | |
427 | Arguments:\r | |
428 | \r | |
429 | TableName - Desired boot script table\r | |
430 | String - The string that will be saved in script table\r | |
431 | \r | |
432 | Returns:\r | |
433 | \r | |
434 | EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r | |
435 | \r | |
436 | EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r | |
437 | \r | |
438 | --*/\r | |
439 | ;\r | |
440 | \r | |
441 | #ifdef EFI_S3_RESUME\r | |
442 | \r | |
443 | #define INITIALIZE_SCRIPT(ImageHandle, SystemTable) \\r | |
444 | BootScriptSaveInitialize(ImageHandle, SystemTable)\r | |
445 | \r | |
446 | #define SCRIPT_IO_WRITE(TableName, Width, Address, Count, Buffer) \\r | |
447 | BootScriptSaveIoWrite(TableName, Width, Address, Count, Buffer)\r | |
448 | \r | |
449 | #define SCRIPT_IO_READ_WRITE(TableName, Width, Address, Data, DataMask) \\r | |
450 | BootScriptSaveIoReadWrite(TableName, Width, Address, Data, DataMask)\r | |
451 | \r | |
452 | #define SCRIPT_MEM_WRITE(TableName, Width, Address, Count, Buffer) \\r | |
453 | BootScriptSaveMemWrite(TableName, Width, Address, Count, Buffer)\r | |
454 | \r | |
455 | #define SCRIPT_MEM_WRITE_THIS(TableName, Width, Address, Count) \\r | |
456 | BootScriptSaveMemWrite(TableName, Width, Address, Count, (VOID*)(UINTN)Address)\r | |
457 | \r | |
458 | #define SCRIPT_MEM_READ_WRITE(TableName, Width, Address, Data, DataMask) \\r | |
459 | BootScriptSaveMemReadWrite(TableName, Width, Address, Data, DataMask)\r | |
460 | \r | |
461 | #define SCRIPT_PCI_CFG_WRITE(TableName, Width, Address, Count, Buffer) \\r | |
462 | BootScriptSavePciCfgWrite(TableName, Width, Address, Count, Buffer)\r | |
463 | \r | |
464 | #define SCRIPT_PCI_CFG_READ_WRITE(TableName, Width, Address, Data, DataMask) \\r | |
465 | BootScriptSavePciCfgReadWrite(TableName, Width, Address, Data, DataMask)\r | |
466 | \r | |
467 | #define SCRIPT_SMBUS_EXECUTE(TableName, SlaveAddress, Command, Operation, PecCheck, Length, Buffer) \\r | |
468 | BootScriptSaveSmbusExecute(TableName, SlaveAddress, Command, Operation, PecCheck, Length, Buffer)\r | |
469 | \r | |
470 | #define SCRIPT_STALL(TableName, Duration) \\r | |
471 | BootScriptSaveStall(TableName, Duration)\r | |
472 | \r | |
473 | #define SCRIPT_DISPATCH(TableName, EntryPoint) \\r | |
474 | BootScriptSaveDispatch(TableName, EntryPoint)\r | |
475 | \r | |
476 | #define SCRIPT_INOFRMATION(TableName, Length, Buffer) \\r | |
477 | BootScriptSaveInformation(TableName, Length, Buffer)\r | |
478 | \r | |
479 | #define SCRIPT_INOFRMATION_UNICODE_STRING(TableName, String) \\r | |
480 | BootScriptSaveInformationUnicodeString(TableName, String)\r | |
481 | \r | |
482 | #define SCRIPT_INOFRMATION_ASCII_STRING(TableName, String) \\r | |
483 | BootScriptSaveInformationAsciiString(TableName, String)\r | |
484 | \r | |
485 | #else\r | |
486 | \r | |
487 | #define INITIALIZE_SCRIPT(ImageHandle, SystemTable) \r | |
488 | \r | |
489 | #define SCRIPT_IO_WRITE(TableName, Width, Address, Count, Buffer) \r | |
490 | \r | |
491 | #define SCRIPT_IO_READ_WRITE(TableName, Width, Address, Data, DataMask) \r | |
492 | \r | |
493 | #define SCRIPT_MEM_WRITE(TableName, Width, Address, Count, Buffer) \r | |
494 | \r | |
495 | #define SCRIPT_MEM_WRITE_THIS(TableName, Width, Address, Count)\r | |
496 | \r | |
497 | #define SCRIPT_MEM_READ_WRITE(TableName, Width, Address, Data, DataMask) \r | |
498 | \r | |
499 | #define SCRIPT_PCI_CFG_WRITE(TableName, Width, Address, Count, Buffer) \r | |
500 | \r | |
501 | #define SCRIPT_PCI_CFG_READ_WRITE(TableName, Width, Address, Data, DataMask) \r | |
502 | \r | |
503 | #define SCRIPT_SMBUS_EXECUTE(TableName, SlaveAddress, Command, Operation, PecCheck, Length, Buffer) \r | |
504 | \r | |
505 | #define SCRIPT_STALL(TableName, Duration) \r | |
506 | \r | |
507 | #define SCRIPT_DISPATCH(TableName, EntryPoint) \r | |
508 | \r | |
509 | #define SCRIPT_INOFRMATION(TableName, Length, Buffer)\r | |
510 | \r | |
511 | #define SCRIPT_INOFRMATION_UNICODE_STRING(TableName, String)\r | |
512 | \r | |
513 | #define SCRIPT_INOFRMATION_ASCII_STRING(TableName, String)\r | |
514 | \r | |
515 | #endif\r | |
516 | \r | |
517 | #endif\r |