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