3 Copyright (c) 2004 - 2007, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
21 #ifndef _EFI_SCRIPT_LIB_H_
22 #define _EFI_SCRIPT_LIB_H_
25 #include "EfiCommonLib.h"
26 #include "EfiBootScript.h"
27 #include EFI_PROTOCOL_DEFINITION (BootScriptSave)
32 BootScriptSaveInitialize (
33 IN EFI_HANDLE ImageHandle
,
34 IN EFI_SYSTEM_TABLE
*SystemTable
40 Intialize Boot Script Lib if it has not yet been initialized.
44 ImageHandle - The firmware allocated handle for the EFI image.
46 SystemTable - A pointer to the EFI System Table.
50 EFI_STATUS always returns EFI_SUCCESS
57 BootScriptSaveIoWrite (
59 IN EFI_BOOT_SCRIPT_WIDTH Width
,
68 Save I/O write to boot script with opcode EFI_BOOT_SCRIPT_IO_WRITE_OPCODE
72 TableName - Desired boot script table
74 Width - The width of the I/O operations.
76 Address - The base address of the I/O operations.
78 Count - The number of I/O operations to perform.
80 Buffer - The source buffer from which to write data.
84 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
86 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
93 BootScriptSaveIoReadWrite (
95 IN EFI_BOOT_SCRIPT_WIDTH Width
,
104 Save I/O modify to boot script with opcode EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE
108 TableName - Desired boot script table
110 Width - The width of the I/O operations.
112 Address - The base address of the I/O operations.
114 Data - A pointer to the data to be OR-ed.
116 DataMask - A pointer to the data mask to be AND-ed with the data read from the register.
120 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
122 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
129 BootScriptSaveMemWrite (
131 IN EFI_BOOT_SCRIPT_WIDTH Width
,
140 Save memory write to boot script with opcode EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE
144 TableName - Desired boot script table
146 Width - The width of the memory operations.
148 Address - The base address of the memory operations.
150 Count - The number of memory operations to perform.
152 Buffer - The source buffer from which to write the data.
156 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
158 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
165 BootScriptSaveMemReadWrite (
167 IN EFI_BOOT_SCRIPT_WIDTH Width
,
176 Save memory modify to boot script with opcode EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE
180 TableName - Desired boot script table
182 Width - The width of the memory operations.
184 Address - The base address of the memory operations.
186 Data - A pointer to the data to be OR-ed.
188 DataMask - A pointer to the data mask to be AND-ed with the data read from the register.
192 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
194 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
201 BootScriptSavePciCfgWrite (
203 IN EFI_BOOT_SCRIPT_WIDTH Width
,
212 Save PCI configuration space write operation to boot script with opcode
213 EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE
217 TableName - Desired boot script table
219 Width - The width of the PCI operations
221 Address - The address within the PCI configuration space.
223 Count - The number of PCI operations to perform.
225 Buffer - The source buffer from which to write the data.
229 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
231 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
238 BootScriptSavePciCfgReadWrite (
240 IN EFI_BOOT_SCRIPT_WIDTH Width
,
249 Save PCI configuration space modify operation to boot script with opcode
250 EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE
254 TableName - Desired boot script table
256 Width - The width of the PCI operations
258 Address - The address within the PCI configuration space.
260 Data - A pointer to the data to be OR-ed.
262 DataMask - A pointer to the data mask to be AND-ed with the data read from the register.
266 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
268 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
276 BootScriptSaveSmbusExecute (
278 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress
,
279 IN EFI_SMBUS_DEVICE_COMMAND Command
,
280 IN EFI_SMBUS_OPERATION Operation
,
289 Save SMBus command execution to boot script with opcode
290 EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE
294 TableName - Desired boot script table
295 SlaveAddress - The SMBus address for the slave device that the operation is targeting.
296 Command - The command that is transmitted by the SMBus host controller to the
298 Operation - Indicates which particular SMBus protocol it will use to execute the
300 PecCheck - Defines if Packet Error Code (PEC) checking is required for this operation.
301 Length - A pointer to signify the number of bytes that this operation will do.
302 Buffer - Contains the value of data to execute to the SMBUS slave device.
306 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
308 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
315 BootScriptSaveStall (
323 Save execution stall on the processor to boot script with opcode
324 EFI_BOOT_SCRIPT_STALL_OPCODE
328 TableName - Desired boot script table
330 Duration - Duration in microseconds of the stall.
334 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
336 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
343 BootScriptSaveDispatch (
345 IN EFI_PHYSICAL_ADDRESS EntryPoint
351 Save dispatching specified arbitrary code to boot script with opcode
352 EFI_BOOT_SCRIPT_DISPATCH_OPCODE
356 TableName - Desired boot script table
358 EntryPoint - Entry point of the code to be dispatched.
362 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
364 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
373 IN EFI_BOOT_SCRIPT_WIDTH Width
,
383 Polling one memory mapping register
386 TableName - Desired boot script table
388 Width - The width of the memory operations.
390 Address - The base address of the memory operations.
392 BitMask - A pointer to the bit mask to be AND-ed with the data read from the register.
394 BitValue - A pointer to the data value after to be Masked.
396 Duration - Duration in microseconds of the stall.
398 LoopTimes - The times of the register polling.
402 EFI_SUCCESS - The operation was executed successfully
409 BootScriptSaveInformation (
412 IN EFI_PHYSICAL_ADDRESS Buffer
418 Save a Information Opcode record in table specified with TableName
422 TableName - Desired boot script table
423 Length - Length of information in bytes
424 Buffer - Content of information that will be saved in script table
428 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
430 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
437 BootScriptSaveInformationUnicodeString (
445 Save a Information Opcode record in table specified with TableName, the information
450 TableName - Desired boot script table
451 String - The string that will be saved in script table
455 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
457 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
464 BootScriptSaveInformationAsciiString (
472 Save a Information Opcode record in table specified with TableName, the information
477 TableName - Desired boot script table
478 String - The string that will be saved in script table
482 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
484 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
491 #define INITIALIZE_SCRIPT(ImageHandle, SystemTable) \
492 BootScriptSaveInitialize(ImageHandle, SystemTable)
494 #define SCRIPT_IO_WRITE(TableName, Width, Address, Count, Buffer) \
495 BootScriptSaveIoWrite(TableName, Width, Address, Count, Buffer)
497 #define SCRIPT_IO_READ_WRITE(TableName, Width, Address, Data, DataMask) \
498 BootScriptSaveIoReadWrite(TableName, Width, Address, Data, DataMask)
500 #define SCRIPT_MEM_WRITE(TableName, Width, Address, Count, Buffer) \
501 BootScriptSaveMemWrite(TableName, Width, Address, Count, Buffer)
503 #define SCRIPT_MEM_WRITE_THIS(TableName, Width, Address, Count) \
504 BootScriptSaveMemWrite(TableName, Width, Address, Count, (VOID*)(UINTN)Address)
506 #define SCRIPT_MEM_READ_WRITE(TableName, Width, Address, Data, DataMask) \
507 BootScriptSaveMemReadWrite(TableName, Width, Address, Data, DataMask)
509 #define SCRIPT_PCI_CFG_WRITE(TableName, Width, Address, Count, Buffer) \
510 BootScriptSavePciCfgWrite(TableName, Width, Address, Count, Buffer)
512 #define SCRIPT_PCI_CFG_READ_WRITE(TableName, Width, Address, Data, DataMask) \
513 BootScriptSavePciCfgReadWrite(TableName, Width, Address, Data, DataMask)
515 #define SCRIPT_SMBUS_EXECUTE(TableName, SlaveAddress, Command, Operation, PecCheck, Length, Buffer) \
516 BootScriptSaveSmbusExecute(TableName, SlaveAddress, Command, Operation, PecCheck, Length, Buffer)
518 #define SCRIPT_STALL(TableName, Duration) \
519 BootScriptSaveStall(TableName, Duration)
521 #define SCRIPT_DISPATCH(TableName, EntryPoint) \
522 BootScriptSaveDispatch(TableName, EntryPoint)
524 #define SCRIPT_MEM_POLL(TableName, Width, Address, BitMask, BitValue, Duration, LoopTimes) \
525 BootScriptMemPoll(TableName, Width, Address, BitMask, BitValue, Duration, LoopTimes)
527 #define SCRIPT_INFORMATION(TableName, Length, Buffer) \
528 BootScriptSaveInformation(TableName, Length, Buffer)
530 #define SCRIPT_INFORMATION_UNICODE_STRING(TableName, String) \
531 BootScriptSaveInformationUnicodeString(TableName, String)
533 #define SCRIPT_INFORMATION_ASCII_STRING(TableName, String) \
534 BootScriptSaveInformationAsciiString(TableName, String)
537 // For backward compatibility
539 #define SCRIPT_INOFRMATION(TableName, Length, Buffer) \
540 BootScriptSaveInformation(TableName, Length, Buffer)
542 #define SCRIPT_INOFRMATION_UNICODE_STRING(TableName, String) \
543 BootScriptSaveInformationUnicodeString(TableName, String)
545 #define SCRIPT_INOFRMATION_ASCII_STRING(TableName, String) \
546 BootScriptSaveInformationAsciiString(TableName, String)
550 #define INITIALIZE_SCRIPT(ImageHandle, SystemTable)
552 #define SCRIPT_IO_WRITE(TableName, Width, Address, Count, Buffer)
554 #define SCRIPT_IO_READ_WRITE(TableName, Width, Address, Data, DataMask)
556 #define SCRIPT_MEM_WRITE(TableName, Width, Address, Count, Buffer)
558 #define SCRIPT_MEM_WRITE_THIS(TableName, Width, Address, Count)
560 #define SCRIPT_MEM_READ_WRITE(TableName, Width, Address, Data, DataMask)
562 #define SCRIPT_PCI_CFG_WRITE(TableName, Width, Address, Count, Buffer)
564 #define SCRIPT_PCI_CFG_READ_WRITE(TableName, Width, Address, Data, DataMask)
566 #define SCRIPT_SMBUS_EXECUTE(TableName, SlaveAddress, Command, Operation, PecCheck, Length, Buffer)
568 #define SCRIPT_STALL(TableName, Duration)
570 #define SCRIPT_DISPATCH(TableName, EntryPoint)
572 #define SCRIPT_MEM_POLL(TableName, Width, Address, BitMask, BitValue, Duration, LoopTimes)
574 #define SCRIPT_INFORMATION(TableName, Length, Buffer)
576 #define SCRIPT_INFORMATION_UNICODE_STRING(TableName, String)
578 #define SCRIPT_INFORMATION_ASCII_STRING(TableName, String)
581 // For backward compatibility
583 #define SCRIPT_INOFRMATION(TableName, Length, Buffer)
585 #define SCRIPT_INOFRMATION_UNICODE_STRING(TableName, String)
587 #define SCRIPT_INOFRMATION_ASCII_STRING(TableName, String)