]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkPkg/Include/Protocol/AcpiS3Save.h
IntelFrameworkPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / IntelFrameworkPkg / Include / Protocol / AcpiS3Save.h
CommitLineData
cf7e50f8 1/** @file\r
4a71b21a 2 This protocol is used to prepare all information that is needed for the S3 resume boot path. This\r
3 protocol is not required for all platforms.\r
1c2f052d
LG
4\r
5Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
22a69a5e 6SPDX-License-Identifier: BSD-2-Clause-Patent\r
8f23e4e6 7\r
534b8251 8 @par Revision Reference:\r
9 This Protocol is defined in Framework of S3 Resume Boot Path Spec.\r
10 Version 0.9.\r
1c2f052d 11\r
cf7e50f8 12**/\r
8f23e4e6 13\r
4ebb0d9e 14#ifndef _ACPI_S3_SAVE_PROTOCOL_H_\r
15#define _ACPI_S3_SAVE_PROTOCOL_H_\r
8f23e4e6 16\r
8f23e4e6 17//\r
18// Forward reference for pure ANSI compatability\r
19//\r
20typedef struct _EFI_ACPI_S3_SAVE_PROTOCOL EFI_ACPI_S3_SAVE_PROTOCOL;\r
21\r
22//\r
23// S3 Save Protocol GUID\r
24//\r
25#define EFI_ACPI_S3_SAVE_GUID \\r
26 { \\r
27 0x125f2de1, 0xfb85, 0x440c, {0xa5, 0x4c, 0x4d, 0x99, 0x35, 0x8a, 0x8d, 0x38 } \\r
28 }\r
29\r
30//\r
31// Protocol Data Structures\r
32//\r
534b8251 33\r
34/**\r
1c2f052d
LG
35 This function is used to:\r
36\r
534b8251 37 - Prepare all information that is needed in the S3 resume boot path. This information can include\r
38 the following:\r
39 -- Framework boot script table\r
40 -- RSDT pointer\r
41 -- Reserved memory for the S3 resume\r
1c2f052d 42\r
5259c97d 43 - Get the minimum legacy memory length (meaning below 1 MB) that is required for the S3 resume boot path.\r
534b8251 44 If LegacyMemoryAddress is NULL, the firmware will be unable to jump into a real-mode\r
45 waking vector. However, it might still be able to jump into a flat-mode waking vector as long as the\r
b4420c36 46 OS provides a flat-mode waking vector. It is the caller's responsibility to ensure the\r
534b8251 47 LegacyMemoryAddress is valid. If the LegacyMemoryAddress is higher than 1 MB,\r
48 EFI_INVALID_PARAMETER will be returned.\r
49\r
50 @param This A pointer to the EFI_ACPI_S3_SAVE_PROTOCOL instance.\r
51 @param LegacyMemoryAddress The base of legacy memory.\r
52\r
53 @retval EFI_SUCCESS All information was saved successfully.\r
54 @retval EFI_INVALID_PARAMETER The memory range is not located below 1 MB.\r
55 @retval EFI_OUT_OF_RESOURCES Resources were insufficient to save all the information.\r
1c2f052d 56 @retval EFI_NOT_FOUND Some necessary information cannot be found.\r
5259c97d 57\r
58**/\r
59typedef\r
60EFI_STATUS\r
61(EFIAPI *EFI_ACPI_S3_SAVE)(\r
62 IN EFI_ACPI_S3_SAVE_PROTOCOL * This,\r
63 IN VOID * LegacyMemoryAddress\r
64 );\r
65\r
66/**\r
67 This function returns the size of the legacy memory (meaning below 1 MB) that is required during an S3\r
68 resume. Before the Framework-based firmware transfers control to the OS, it has to transition from\r
69 flat mode into real mode in case the OS supplies only a real-mode waking vector. This transition\r
70 requires a certain amount of legacy memory. After getting the size of legacy memory\r
71 below, the caller is responsible for allocating the legacy memory below 1 MB according to\r
72 the size that is returned. The specific implementation of allocating the legacy memory is out of the\r
73 scope of this specification.\r
74\r
75 @param This A pointer to the EFI_ACPI_S3_SAVE_PROTOCOL instance.\r
1c2f052d 76 @param Size The returned size of legacy memory below 1MB.\r
5259c97d 77\r
f22f941e 78 @retval EFI_SUCCESS Size was successfully returned.\r
5259c97d 79 @retval EFI_INVALID_PARAMETER The pointer Size is NULL.\r
1c2f052d 80\r
534b8251 81**/\r
8f23e4e6 82typedef\r
83EFI_STATUS\r
69686d56 84(EFIAPI *EFI_ACPI_GET_LEGACY_MEMORY_SIZE)(\r
8f23e4e6 85 IN EFI_ACPI_S3_SAVE_PROTOCOL * This,\r
86 OUT UINTN * Size\r
87);\r
88\r
534b8251 89/**\r
534b8251 90 The EFI_ACPI_S3_SAVE_PROTOCOL is responsible for preparing all the information that the\r
b4420c36 91 Framework needs to restore the platform's preboot state during an S3 resume boot. This\r
534b8251 92 information can include the following:\r
f22f941e 93 - The Framework boot script table, containing all necessary operations to initialize the platform.\r
94 - ACPI table information, such as RSDT, through which the OS waking vector can be located.\r
95 - The range of reserved memory that can be used on the S3 resume boot path.\r
534b8251 96 This protocol can be used after the Framework makes sure that the boot process is complete and\r
1c2f052d 97 that no hardware has been left unconfigured. Where to call this protocol to save information is implementation-specific.\r
5259c97d 98 In the case of an EFI-aware OS, ExitBootServices() can be a choice to provide this hook.\r
534b8251 99 The currently executing EFI OS loader image calls ExitBootServices()to terminate all boot\r
100 services. After ExitBootServices() successfully completes, the loader becomes responsible\r
101 for the continued operation of the system.\r
102 On a normal boot, ExitBootServices() checks if the platform supports S3 by looking for\r
103 EFI_ACPI_S3_SAVE_PROTOCOL. If the protocol exists, ExitBootServices()will assume\r
104 that the target platform supports an S3 resume and then call EFI_ACPI_S3_SAVE_PROTOCOL\r
105 to save the S3 resume information. The entire Framework boot script table will then be generated,\r
106 assuming the platform currently is in the preboot state.\r
534b8251 107**/\r
8f23e4e6 108struct _EFI_ACPI_S3_SAVE_PROTOCOL {\r
2bbaeb0d 109 ///\r
110 /// Gets the size of legacy memory below 1 MB that is required for S3 resume.\r
111 ///\r
8f23e4e6 112 EFI_ACPI_GET_LEGACY_MEMORY_SIZE GetLegacyMemorySize;\r
1c2f052d 113\r
2bbaeb0d 114 ///\r
115 /// Prepare all information for an S3 resume.\r
116 ///\r
8f23e4e6 117 EFI_ACPI_S3_SAVE S3Save;\r
118};\r
119\r
120extern EFI_GUID gEfiAcpiS3SaveProtocolGuid;\r
121\r
122#endif\r