]>
Commit | Line | Data |
---|---|---|
64d14edf | 1 | /** @file\r |
3a03e95e | 2 | Support for S3 boot script lib. This file defined some internal macro and internal\r |
64d14edf | 3 | data structure\r |
3a03e95e | 4 | \r |
3d20524a | 5 | Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r |
64d14edf | 6 | \r |
9d510e61 | 7 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
64d14edf | 8 | \r |
9 | **/\r | |
10 | #ifndef __INTERNAL_BOOT_SCRIPT_LIB__\r | |
11 | #define __INTERNAL_BOOT_SCRIPT_LIB__\r | |
12 | \r | |
13 | #include <PiDxe.h>\r | |
14 | \r | |
15 | #include <Guid/EventGroup.h>\r | |
16 | #include <Protocol/SmmBase2.h>\r | |
17 | #include <Protocol/DxeSmmReadyToLock.h>\r | |
18 | #include <Protocol/SmmReadyToLock.h>\r | |
960f2d53 SZ |
19 | #include <Protocol/SmmExitBootServices.h>\r |
20 | #include <Protocol/SmmLegacyBoot.h>\r | |
64d14edf | 21 | \r |
22 | #include <Library/S3BootScriptLib.h>\r | |
23 | \r | |
24 | #include <Library/UefiBootServicesTableLib.h>\r | |
25 | #include <Library/BaseLib.h>\r | |
26 | #include <Library/PcdLib.h>\r | |
27 | #include <Library/SmbusLib.h>\r | |
28 | #include <Library/IoLib.h>\r | |
3d20524a | 29 | #include <Library/PciSegmentLib.h>\r |
64d14edf | 30 | #include <Library/DebugLib.h>\r |
31 | #include <Library/BaseMemoryLib.h>\r | |
32 | #include <Library/TimerLib.h>\r | |
33 | #include <Library/UefiLib.h>\r | |
34 | #include <Library/LockBoxLib.h>\r | |
35 | \r | |
36 | #include "BootScriptInternalFormat.h"\r | |
37 | \r | |
38 | #define MAX_IO_ADDRESS 0xFFFF\r | |
39 | \r | |
e0e7f80c | 40 | //\r |
3d20524a | 41 | // Macro to convert a UEFI PCI address + segment to a PCI Segment Library PCI address\r |
e0e7f80c | 42 | //\r |
3d20524a SZ |
43 | #define PCI_ADDRESS_ENCODE(S, A) PCI_SEGMENT_LIB_ADDRESS( \\r |
44 | S, \\r | |
45 | ((((UINTN)(A)) & 0xff000000) >> 24), \\r | |
46 | ((((UINTN)(A)) & 0x00ff0000) >> 16), \\r | |
47 | ((((UINTN)(A)) & 0xff00) >> 8), \\r | |
48 | ((RShiftU64 ((A), 32) & 0xfff) | ((A) & 0xff)) \\r | |
49 | )\r | |
64d14edf | 50 | \r |
51 | typedef union {\r | |
52 | UINT8 volatile *Buf;\r | |
53 | UINT8 volatile *Uint8;\r | |
54 | UINT16 volatile *Uint16;\r | |
55 | UINT32 volatile *Uint32;\r | |
56 | UINT64 volatile *Uint64;\r | |
57 | UINTN volatile Uint;\r | |
58 | } PTR;\r | |
59 | \r | |
60 | \r | |
61 | // Minimum and maximum length for SMBus bus block protocols defined in SMBus spec 2.0.\r | |
62 | //\r | |
63 | #define MIN_SMBUS_BLOCK_LEN 1\r | |
64 | #define MAX_SMBUS_BLOCK_LEN 32\r | |
65 | \r | |
66 | //\r | |
67 | // The boot script private data.\r | |
68 | //\r | |
69 | typedef struct {\r | |
960f2d53 | 70 | UINT8 *TableBase;\r |
3a03e95e SZ |
71 | UINT32 TableLength; // Record the actual memory length\r |
72 | UINT16 TableMemoryPageNumber; // Record the page number Allocated for the table\r | |
960f2d53 SZ |
73 | BOOLEAN InSmm; // Record if this library is in SMM.\r |
74 | BOOLEAN AtRuntime; // Record if current state is after SmmExitBootServices or SmmLegacyBoot.\r | |
75 | UINT32 BootTimeScriptLength; // Maintain boot time script length in LockBox after SmmReadyToLock in SMM.\r | |
76 | BOOLEAN SmmLocked; // Record if current state is after SmmReadyToLock\r | |
77 | BOOLEAN BackFromS3; // Indicate that the system is back from S3.\r | |
64d14edf | 78 | } SCRIPT_TABLE_PRIVATE_DATA;\r |
79 | \r | |
80 | typedef\r | |
81 | EFI_STATUS\r | |
82 | (EFIAPI *DISPATCH_ENTRYPOINT_FUNC) (\r | |
83 | IN EFI_HANDLE ImageHandle,\r | |
84 | IN VOID *Context\r | |
85 | );\r | |
86 | \r | |
87 | extern SCRIPT_TABLE_PRIVATE_DATA *mS3BootScriptTablePtr;\r | |
88 | \r | |
89 | //\r | |
90 | // Define Opcode for Label which is implementation specific and no standard spec define.\r | |
91 | //\r | |
92 | #define S3_BOOT_SCRIPT_LIB_LABEL_OPCODE 0xFE\r | |
93 | \r | |
94 | ///\r | |
95 | /// The opcode indicate the start of the boot script table.\r | |
96 | ///\r | |
97 | #define S3_BOOT_SCRIPT_LIB_TABLE_OPCODE 0xAA\r | |
98 | ///\r | |
99 | /// The opcode indicate the end of the boot script table.\r | |
100 | ///\r | |
101 | #define S3_BOOT_SCRIPT_LIB_TERMINATE_OPCODE 0xFF\r | |
102 | \r | |
103 | \r | |
104 | #endif //__INTERNAL_BOOT_SCRIPT_LIB__\r | |
105 | \r |