TianoCore EDK2 master
Loading...
Searching...
No Matches
InternalBootScriptLib.h
Go to the documentation of this file.
1
11#ifndef __INTERNAL_BOOT_SCRIPT_LIB__
12#define __INTERNAL_BOOT_SCRIPT_LIB__
13
14#include <PiDxe.h>
15
16#include <Guid/EventGroup.h>
17#include <Protocol/SmmBase2.h>
22
24
26#include <Library/BaseLib.h>
27#include <Library/PcdLib.h>
28#include <Library/SmbusLib.h>
29#include <Library/IoLib.h>
31#include <Library/DebugLib.h>
33#include <Library/TimerLib.h>
34#include <Library/UefiLib.h>
35#include <Library/LockBoxLib.h>
36
38
39#define MAX_IO_ADDRESS 0xFFFF
40
41//
42// Macro to convert a UEFI PCI address + segment to a PCI Segment Library PCI address
43//
44#define PCI_ADDRESS_ENCODE(S, A) PCI_SEGMENT_LIB_ADDRESS(\
45 S, \
46 ((((UINTN)(A)) & 0xff000000) >> 24), \
47 ((((UINTN)(A)) & 0x00ff0000) >> 16), \
48 ((((UINTN)(A)) & 0xff00) >> 8), \
49 ((RShiftU64 ((A), 32) & 0xfff) | ((A) & 0xff)) \
50 )
51
52typedef union {
53 UINT8 volatile *Buf;
54 UINT8 volatile *Uint8;
55 UINT16 volatile *Uint16;
56 UINT32 volatile *Uint32;
57 UINT64 volatile *Uint64;
58 UINTN volatile Uint;
59} PTR;
60
61// Minimum and maximum length for SMBus bus block protocols defined in SMBus spec 2.0.
62//
63#define MIN_SMBUS_BLOCK_LEN 1
64#define MAX_SMBUS_BLOCK_LEN 32
65
66//
67// The boot script private data.
68//
69typedef struct {
70 UINT8 *TableBase;
71 UINT32 TableLength; // Record the actual memory length
72 UINT16 TableMemoryPageNumber; // Record the page number Allocated for the table
73 BOOLEAN InSmm; // Record if this library is in SMM.
74 BOOLEAN AtRuntime; // Record if current state is after SmmExitBootServices or SmmLegacyBoot.
75 UINT32 BootTimeScriptLength; // Maintain boot time script length in LockBox after SmmReadyToLock in SMM.
76 BOOLEAN SmmLocked; // Record if current state is after SmmReadyToLock
77 BOOLEAN BackFromS3; // Indicate that the system is back from S3.
79
80typedef
82(EFIAPI *DISPATCH_ENTRYPOINT_FUNC)(
83 IN EFI_HANDLE ImageHandle,
84 IN VOID *Context
85 );
86
88
89//
90// Define Opcode for Label which is implementation specific and no standard spec define.
91//
92#define S3_BOOT_SCRIPT_LIB_LABEL_OPCODE 0xFE
93
97#define S3_BOOT_SCRIPT_LIB_TABLE_OPCODE 0xAA
101#define S3_BOOT_SCRIPT_LIB_TERMINATE_OPCODE 0xFF
102
103#endif //__INTERNAL_BOOT_SCRIPT_LIB__
UINT64 UINTN
SCRIPT_TABLE_PRIVATE_DATA * mS3BootScriptTablePtr
BOOLEAN AtRuntime(VOID)
Definition: VariableDxe.c:63
#define IN
Definition: Base.h:279
BOOLEAN EFIAPI InSmm(VOID)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33