3 Copyright (c) 2004, 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)
31 BootScriptSaveInitialize (
32 IN EFI_HANDLE ImageHandle
,
33 IN EFI_SYSTEM_TABLE
*SystemTable
39 Intialize Boot Script Lib if it has not yet been initialized.
43 ImageHandle - The firmware allocated handle for the EFI image.
45 SystemTable - A pointer to the EFI System Table.
49 EFI_STATUS always returns EFI_SUCCESS
55 BootScriptSaveIoWrite (
57 IN EFI_BOOT_SCRIPT_WIDTH Width
,
66 Save I/O write to boot script with opcode EFI_BOOT_SCRIPT_IO_WRITE_OPCODE
70 TableName - Desired boot script table
72 Width - The width of the I/O operations.
74 Address - The base address of the I/O operations.
76 Count - The number of I/O operations to perform.
78 Buffer - The source buffer from which to write data.
82 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
84 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
90 BootScriptSaveIoReadWrite (
92 IN EFI_BOOT_SCRIPT_WIDTH Width
,
101 Save I/O modify to boot script with opcode EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE
105 TableName - Desired boot script table
107 Width - The width of the I/O operations.
109 Address - The base address of the I/O operations.
111 Data - A pointer to the data to be OR-ed.
113 DataMask - A pointer to the data mask to be AND-ed with the data read from the register.
117 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
119 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
125 BootScriptSaveMemWrite (
127 IN EFI_BOOT_SCRIPT_WIDTH Width
,
136 Save memory write to boot script with opcode EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE
140 TableName - Desired boot script table
142 Width - The width of the memory operations.
144 Address - The base address of the memory operations.
146 Count - The number of memory operations to perform.
148 Buffer - The source buffer from which to write the data.
152 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
154 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
160 BootScriptSaveMemReadWrite (
162 IN EFI_BOOT_SCRIPT_WIDTH Width
,
171 Save memory modify to boot script with opcode EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE
175 TableName - Desired boot script table
177 Width - The width of the memory operations.
179 Address - The base address of the memory operations.
181 Data - A pointer to the data to be OR-ed.
183 DataMask - A pointer to the data mask to be AND-ed with the data read from the register.
187 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
189 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
195 BootScriptSavePciCfgWrite (
197 IN EFI_BOOT_SCRIPT_WIDTH Width
,
206 Save PCI configuration space write operation to boot script with opcode
207 EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE
211 TableName - Desired boot script table
213 Width - The width of the PCI operations
215 Address - The address within the PCI configuration space.
217 Count - The number of PCI operations to perform.
219 Buffer - The source buffer from which to write the data.
223 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
225 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
231 BootScriptSavePciCfgReadWrite (
233 IN EFI_BOOT_SCRIPT_WIDTH Width
,
242 Save PCI configuration space modify operation to boot script with opcode
243 EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE
247 TableName - Desired boot script table
249 Width - The width of the PCI operations
251 Address - The address within the PCI configuration space.
253 Data - A pointer to the data to be OR-ed.
255 DataMask - A pointer to the data mask to be AND-ed with the data read from the register.
259 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
261 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
268 BootScriptSaveSmbusExecute (
270 IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress
,
271 IN EFI_SMBUS_DEVICE_COMMAND Command
,
272 IN EFI_SMBUS_OPERATION Operation
,
281 Save SMBus command execution to boot script with opcode
282 EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE
286 TableName - Desired boot script table
287 SlaveAddress - The SMBus address for the slave device that the operation is targeting.
288 Command - The command that is transmitted by the SMBus host controller to the
290 Operation - Indicates which particular SMBus protocol it will use to execute the
292 PecCheck - Defines if Packet Error Code (PEC) checking is required for this operation.
293 Length - A pointer to signify the number of bytes that this operation will do.
294 Buffer - Contains the value of data to execute to the SMBUS slave device.
298 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
300 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
306 BootScriptSaveStall (
314 Save execution stall on the processor to boot script with opcode
315 EFI_BOOT_SCRIPT_STALL_OPCODE
319 TableName - Desired boot script table
321 Duration - Duration in microseconds of the stall.
325 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
327 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
333 BootScriptSaveDispatch (
335 IN EFI_PHYSICAL_ADDRESS EntryPoint
341 Save dispatching specified arbitrary code to boot script with opcode
342 EFI_BOOT_SCRIPT_DISPATCH_OPCODE
346 TableName - Desired boot script table
348 EntryPoint - Entry point of the code to be dispatched.
352 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
354 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
361 BootScriptSaveInformation (
364 IN EFI_PHYSICAL_ADDRESS Buffer
370 Save a Information Opcode record in table specified with TableName
374 TableName - Desired boot script table
375 Length - Length of information in bytes
376 Buffer - Content of information that will be saved in script table
380 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
382 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
389 BootScriptSaveInformationUnicodeString (
397 Save a Information Opcode record in table specified with TableName, the information
402 TableName - Desired boot script table
403 String - The string that will be saved in script table
407 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
409 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
416 BootScriptSaveInformationAsciiString (
424 Save a Information Opcode record in table specified with TableName, the information
429 TableName - Desired boot script table
430 String - The string that will be saved in script table
434 EFI_NOT_FOUND - BootScriptSave Protocol not exist.
436 EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS
443 #define INITIALIZE_SCRIPT(ImageHandle, SystemTable) \
444 BootScriptSaveInitialize(ImageHandle, SystemTable)
446 #define SCRIPT_IO_WRITE(TableName, Width, Address, Count, Buffer) \
447 BootScriptSaveIoWrite(TableName, Width, Address, Count, Buffer)
449 #define SCRIPT_IO_READ_WRITE(TableName, Width, Address, Data, DataMask) \
450 BootScriptSaveIoReadWrite(TableName, Width, Address, Data, DataMask)
452 #define SCRIPT_MEM_WRITE(TableName, Width, Address, Count, Buffer) \
453 BootScriptSaveMemWrite(TableName, Width, Address, Count, Buffer)
455 #define SCRIPT_MEM_WRITE_THIS(TableName, Width, Address, Count) \
456 BootScriptSaveMemWrite(TableName, Width, Address, Count, (VOID*)(UINTN)Address)
458 #define SCRIPT_MEM_READ_WRITE(TableName, Width, Address, Data, DataMask) \
459 BootScriptSaveMemReadWrite(TableName, Width, Address, Data, DataMask)
461 #define SCRIPT_PCI_CFG_WRITE(TableName, Width, Address, Count, Buffer) \
462 BootScriptSavePciCfgWrite(TableName, Width, Address, Count, Buffer)
464 #define SCRIPT_PCI_CFG_READ_WRITE(TableName, Width, Address, Data, DataMask) \
465 BootScriptSavePciCfgReadWrite(TableName, Width, Address, Data, DataMask)
467 #define SCRIPT_SMBUS_EXECUTE(TableName, SlaveAddress, Command, Operation, PecCheck, Length, Buffer) \
468 BootScriptSaveSmbusExecute(TableName, SlaveAddress, Command, Operation, PecCheck, Length, Buffer)
470 #define SCRIPT_STALL(TableName, Duration) \
471 BootScriptSaveStall(TableName, Duration)
473 #define SCRIPT_DISPATCH(TableName, EntryPoint) \
474 BootScriptSaveDispatch(TableName, EntryPoint)
476 #define SCRIPT_INOFRMATION(TableName, Length, Buffer) \
477 BootScriptSaveInformation(TableName, Length, Buffer)
479 #define SCRIPT_INOFRMATION_UNICODE_STRING(TableName, String) \
480 BootScriptSaveInformationUnicodeString(TableName, String)
482 #define SCRIPT_INOFRMATION_ASCII_STRING(TableName, String) \
483 BootScriptSaveInformationAsciiString(TableName, String)
487 #define INITIALIZE_SCRIPT(ImageHandle, SystemTable)
489 #define SCRIPT_IO_WRITE(TableName, Width, Address, Count, Buffer)
491 #define SCRIPT_IO_READ_WRITE(TableName, Width, Address, Data, DataMask)
493 #define SCRIPT_MEM_WRITE(TableName, Width, Address, Count, Buffer)
495 #define SCRIPT_MEM_WRITE_THIS(TableName, Width, Address, Count)
497 #define SCRIPT_MEM_READ_WRITE(TableName, Width, Address, Data, DataMask)
499 #define SCRIPT_PCI_CFG_WRITE(TableName, Width, Address, Count, Buffer)
501 #define SCRIPT_PCI_CFG_READ_WRITE(TableName, Width, Address, Data, DataMask)
503 #define SCRIPT_SMBUS_EXECUTE(TableName, SlaveAddress, Command, Operation, PecCheck, Length, Buffer)
505 #define SCRIPT_STALL(TableName, Duration)
507 #define SCRIPT_DISPATCH(TableName, EntryPoint)
509 #define SCRIPT_INOFRMATION(TableName, Length, Buffer)
511 #define SCRIPT_INOFRMATION_UNICODE_STRING(TableName, String)
513 #define SCRIPT_INOFRMATION_ASCII_STRING(TableName, String)