TianoCore EDK2 master
Loading...
Searching...
No Matches
BootScript.c File Reference

Go to the source code of this file.

Data Structures

struct  CONDENSED_WRITE_POINTER
 
struct  S3_CONTEXT
 
union  SCRATCH_BUFFER
 

Functions

EFI_STATUS AllocateS3Context (OUT S3_CONTEXT **S3Context, IN UINTN WritePointerCount)
 
VOID ReleaseS3Context (IN S3_CONTEXT *S3Context)
 
EFI_STATUS SaveCondensedWritePointerToS3Context (IN OUT S3_CONTEXT *S3Context, IN UINT16 PointerItem, IN UINT8 PointerSize, IN UINT32 PointerOffset, IN UINT64 PointerValue)
 
STATIC VOID EFIAPI AppendFwCfgBootScript (IN OUT VOID *Context OPTIONAL, IN OUT VOID *ExternalScratchBuffer)
 
EFI_STATUS TransferS3ContextToBootScript (IN S3_CONTEXT *S3Context)
 

Detailed Description

Append an ACPI S3 Boot Script fragment from the QEMU_LOADER_WRITE_POINTER commands of QEMU's fully processed table linker/loader script.

Copyright (C) 2017, Red Hat, Inc.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file BootScript.c.

Function Documentation

◆ AllocateS3Context()

EFI_STATUS AllocateS3Context ( OUT S3_CONTEXT **  S3Context,
IN UINTN  WritePointerCount 
)

Allocate an S3_CONTEXT object.

Parameters
[out]S3ContextThe allocated S3_CONTEXT object is returned through this parameter.
[in]WritePointerCountNumber of CONDENSED_WRITE_POINTER elements to allocate room for. WritePointerCount must be positive.
Return values
EFI_SUCCESSAllocation successful.
EFI_OUT_OF_RESOURCESOut of memory.
EFI_INVALID_PARAMETERWritePointerCount is zero.

Definition at line 72 of file BootScript.c.

◆ AppendFwCfgBootScript()

STATIC VOID EFIAPI AppendFwCfgBootScript ( IN OUT VOID *Context  OPTIONAL,
IN OUT VOID *  ExternalScratchBuffer 
)

FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION provided to QemuFwCfgS3Lib.

Definition at line 194 of file BootScript.c.

◆ ReleaseS3Context()

VOID ReleaseS3Context ( IN S3_CONTEXT S3Context)

Release an S3_CONTEXT object.

Parameters
[in]S3ContextThe object to release.

Definition at line 114 of file BootScript.c.

◆ SaveCondensedWritePointerToS3Context()

EFI_STATUS SaveCondensedWritePointerToS3Context ( IN OUT S3_CONTEXT S3Context,
IN UINT16  PointerItem,
IN UINT8  PointerSize,
IN UINT32  PointerOffset,
IN UINT64  PointerValue 
)

Save the information necessary to replicate a QEMU_LOADER_WRITE_POINTER command during S3 resume, in condensed format.

This function is to be called from ProcessCmdWritePointer(), after all the sanity checks have passed, and before the fw_cfg operations are performed.

Parameters
[in,out]S3ContextThe S3_CONTEXT object into which the caller wants to save the information that was derived from QEMU_LOADER_WRITE_POINTER.
[in]PointerItemThe FIRMWARE_CONFIG_ITEM that QEMU_LOADER_WRITE_POINTER.PointerFile was resolved to, expressed as a UINT16 value.
[in]PointerSizeCopied directly from QEMU_LOADER_WRITE_POINTER.PointerSize.
[in]PointerOffsetCopied directly from QEMU_LOADER_WRITE_POINTER.PointerOffset.
[in]PointerValueThe base address of the allocated / downloaded fw_cfg blob that is identified by QEMU_LOADER_WRITE_POINTER.PointeeFile, plus QEMU_LOADER_WRITE_POINTER.PointeeOffset.
Return values
EFI_SUCCESSThe information derived from QEMU_LOADER_WRITE_POINTER has been successfully absorbed into S3Context.
EFI_OUT_OF_RESOURCESNo room available in S3Context.

Definition at line 155 of file BootScript.c.

◆ TransferS3ContextToBootScript()

EFI_STATUS TransferS3ContextToBootScript ( IN S3_CONTEXT S3Context)

Translate and append the information from an S3_CONTEXT object to the ACPI S3 Boot Script.

The effects of a successful call to this function cannot be undone.

Parameters
[in]S3ContextThe S3_CONTEXT object to translate to ACPI S3 Boot Script opcodes. If the function returns successfully, the caller must set the S3Context pointer – originally returned by AllocateS3Context() – immediately to NULL, because the ownership of S3Context has been transferred.
Return values
EFI_SUCCESSThe translation of S3Context to ACPI S3 Boot Script opcodes has been successfully executed or queued. (This includes the case when S3Context was empty on input and no ACPI S3 Boot Script opcodes have been necessary to produce.)
Returns
Error codes from underlying functions.

Definition at line 258 of file BootScript.c.