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