1 /** @file
2   The header file for Boot Script Executer module.
3 
4   This driver is dispatched by Dxe core and the driver will reload itself to ACPI reserved memory
5   in the entry point. The functionality is to interpret and restore the S3 boot script
6 
7 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
8 Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
9 
10 SPDX-License-Identifier: BSD-2-Clause-Patent
11 
12 **/
13 #ifndef _BOOT_SCRIPT_EXECUTOR_H_
14 #define _BOOT_SCRIPT_EXECUTOR_H_
15 
16 #include <PiDxe.h>
17 
18 #include <Library/BaseLib.h>
19 #include <Library/UefiDriverEntryPoint.h>
20 #include <Library/BaseMemoryLib.h>
21 #include <Library/DebugLib.h>
22 #include <Library/S3BootScriptLib.h>
23 #include <Library/PeCoffLib.h>
24 #include <Library/DxeServicesLib.h>
25 #include <Library/UefiBootServicesTableLib.h>
26 #include <Library/UefiRuntimeServicesTableLib.h>
27 #include <Library/PcdLib.h>
28 #include <Library/CacheMaintenanceLib.h>
29 #include <Library/TimerLib.h>
30 #include <Library/UefiLib.h>
31 #include <Library/DebugAgentLib.h>
32 #include <Library/LockBoxLib.h>
33 #include <Library/CpuExceptionHandlerLib.h>
34 #include <Library/DevicePathLib.h>
35 #include <Library/DxeServicesTableLib.h>
36 
37 #include <Guid/AcpiS3Context.h>
38 #include <Guid/BootScriptExecutorVariable.h>
39 #include <Guid/MemoryProfile.h>
40 
41 #include <Protocol/DxeSmmReadyToLock.h>
42 #include <IndustryStandard/Acpi.h>
43 
44 #define PAGING_1G_ADDRESS_MASK_64  0x000FFFFFC0000000ull
45 
46 /**
47   a ASM function to transfer control to OS.
48 
49   @param  S3WakingVector  The S3 waking up vector saved in ACPI Facs table
50   @param  AcpiLowMemoryBase a buffer under 1M which could be used during the transfer
51 **/
52 VOID
53 AsmTransferControl (
54   IN   UINT32           S3WakingVector,
55   IN   UINT32           AcpiLowMemoryBase
56   );
57 /**
58   a 32bit ASM function to transfer control to OS.
59 
60   @param  S3WakingVector  The S3 waking up vector saved in ACPI Facs table
61   @param  AcpiLowMemoryBase a buffer under 1M which could be used during the transfer
62 **/
63 VOID
64 AsmTransferControl32 (
65   IN   UINT32           S3WakingVector,
66   IN   UINT32           AcpiLowMemoryBase
67   );
68 /**
69   a 16bit ASM function to transfer control to OS.
70 **/
71 VOID
72 AsmTransferControl16 (
73   VOID
74   );
75 /**
76   Set a IDT entry for interrupt vector 3 for debug purpose.
77 
78   @param  AcpiS3Context  a pointer to a structure of ACPI_S3_CONTEXT
79 
80 **/
81 VOID
82 SetIdtEntry (
83   IN ACPI_S3_CONTEXT     *AcpiS3Context
84   );
85 
86 extern UINT32 AsmFixAddress16;
87 extern UINT32 AsmJmpAddr32;
88 extern BOOLEAN mPage1GSupport;
89 extern UINT64 mAddressEncMask;
90 
91 #endif //_BOOT_SCRIPT_EXECUTOR_H_
92