InternalBootScriptSave.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /** @file
  2. //
  3. //
  4. Internal header file for S3 Boot Script Saver driver.
  5. Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
  6. SPDX-License-Identifier: BSD-2-Clause-Patent
  7. **/
  8. #ifndef _INTERNAL_BOOT_SCRIPT_SAVE_H_
  9. #define _INTERNAL_BOOT_SCRIPT_SAVE_H_
  10. #include <FrameworkDxe.h>
  11. #include <Protocol/BootScriptSave.h>
  12. #include <Protocol/FirmwareVolume.h>
  13. #include <Library/BaseLib.h>
  14. #include <Library/DebugLib.h>
  15. #include <Library/UefiDriverEntryPoint.h>
  16. #include <Library/UefiBootServicesTableLib.h>
  17. #include <Library/UefiRuntimeServicesTableLib.h>
  18. #include <Library/S3BootScriptLib.h>
  19. #include <Library/PcdLib.h>
  20. #include <Library/SmbusLib.h>
  21. #include <IndustryStandard/SmBus.h>
  22. /**
  23. Adds a record into a specified Framework boot script table.
  24. This function is used to store a boot script record into a given boot
  25. script table. If the table specified by TableName is nonexistent in the
  26. system, a new table will automatically be created and then the script record
  27. will be added into the new table. A boot script table can add new script records
  28. until EFI_BOOT_SCRIPT_SAVE_PROTOCOL.CloseTable() is called. Currently, the only
  29. meaningful table name is EFI_ACPI_S3_RESUME_SCRIPT_TABLE. This function is
  30. responsible for allocating necessary memory for the script.
  31. This function has a variable parameter list. The exact parameter list depends on
  32. the OpCode that is passed into the function. If an unsupported OpCode or illegal
  33. parameter list is passed in, this function returns EFI_INVALID_PARAMETER.
  34. If there are not enough resources available for storing more scripts, this function returns
  35. EFI_OUT_OF_RESOURCES.
  36. @param[in] This A pointer to the EFI_BOOT_SCRIPT_SAVE_PROTOCOL instance.
  37. @param[in] TableName Name of the script table. Currently, the only meaningful value is
  38. EFI_ACPI_S3_RESUME_SCRIPT_TABLE.
  39. @param[in] OpCode The operation code (opcode) number.
  40. @param[in] ... Argument list that is specific to each opcode.
  41. @retval EFI_SUCCESS The operation succeeded. A record was added into the
  42. specified script table.
  43. @retval EFI_INVALID_PARAMETER The parameter is illegal or the given boot script is not supported.
  44. If the opcode is unknow or not supported because of the PCD
  45. Feature Flags.
  46. @retval EFI_OUT_OF_RESOURCES There is insufficient memory to store the boot script.
  47. **/
  48. EFI_STATUS
  49. EFIAPI
  50. BootScriptWrite (
  51. IN EFI_BOOT_SCRIPT_SAVE_PROTOCOL *This,
  52. IN UINT16 TableName,
  53. IN UINT16 OpCode,
  54. ...
  55. );
  56. /**
  57. Closes the specified script table.
  58. This function closes the specified boot script table and returns the base address
  59. of the table. It allocates a new pool to duplicate all the boot scripts in the specified
  60. table. Once this function is called, the specified table will be destroyed after it is
  61. copied into the allocated pool. As a result, any attempts to add a script record into a
  62. closed table will cause a new table to be created. The base address of the allocated pool
  63. will be returned in Address. After using the boot script table, the caller is responsible
  64. for freeing the pool that is allocated by this function. If the boot script table,
  65. such as EFI_ACPI_S3_RESUME_SCRIPT_TABLE, is required to be stored in a nonperturbed
  66. memory region, the caller should copy the table into the nonperturbed memory region by itself.
  67. @param[in] This A pointer to the EFI_BOOT_SCRIPT_SAVE_PROTOCOL instance.
  68. @param[in] TableName Name of the script table. Currently, the only meaningful value is
  69. EFI_ACPI_S3_RESUME_SCRIPT_TABLE.
  70. @param[in] Address A pointer to the physical address where the table begins.
  71. @retval EFI_SUCCESS The table was successfully returned.
  72. @retval EFI_NOT_FOUND The specified table was not created previously.
  73. @retval EFI_OUT_OF_RESOURCE Memory is insufficient to hold the reorganized boot script table.
  74. @retval EFI_UNSUPPORTED The table type is not EFI_ACPI_S3_RESUME_SCRIPT_TABLE.
  75. **/
  76. EFI_STATUS
  77. EFIAPI
  78. BootScriptCloseTable (
  79. IN EFI_BOOT_SCRIPT_SAVE_PROTOCOL *This,
  80. IN UINT16 TableName,
  81. OUT EFI_PHYSICAL_ADDRESS *Address
  82. );
  83. #endif //_INTERNAL_BOOT_SCRIPT_SAVE_H_