AcpiS3Save.h 5.0 KB

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