/* Adds a record for dispatching specified arbitrary code into a specified boot script table. */
RETURN_STATUS EFIAPI S3BootScriptSaveDispatch(IN VOID *EntryPoint)
/* Adds a record for dispatching specified arbitrary code into a specified boot script table. */
RETURN_STATUS EFIAPI S3BootScriptSaveDispatch(IN VOID *EntryPoint)
{
  UINT8                     Length;
  UINT8                     *Script;
  EFI_BOOT_SCRIPT_DISPATCH  ScriptDispatch;
  if (!mS3BootScriptAcpiS3Enable) {
    return RETURN_SUCCESS;
  }
  Length = (UINT8)(sizeof (EFI_BOOT_SCRIPT_DISPATCH));
  Script = S3BootScriptGetEntryAddAddress (Length);
  if (Script == NULL) {
    return RETURN_OUT_OF_RESOURCES;
  }
  ScriptDispatch.OpCode     = EFI_BOOT_SCRIPT_DISPATCH_OPCODE;
  ScriptDispatch.Length     = Length;
  ScriptDispatch.EntryPoint = (EFI_PHYSICAL_ADDRESS)(UINTN)EntryPoint;
  CopyMem ((VOID *)Script, (VOID *)&ScriptDispatch, sizeof (EFI_BOOT_SCRIPT_DISPATCH));
  SyncBootScript (Script);
  return RETURN_SUCCESS;
}