80 if (WritePointerCount == 0) {
81 return EFI_INVALID_PARAMETER;
85 if (Context ==
NULL) {
86 return EFI_OUT_OF_RESOURCES;
91 sizeof *Context->WritePointers
93 if (Context->WritePointers ==
NULL) {
94 Status = EFI_OUT_OF_RESOURCES;
98 Context->Allocated = WritePointerCount;
118 FreePool (S3Context->WritePointers);
157 IN UINT16 PointerItem,
158 IN UINT8 PointerSize,
159 IN UINT32 PointerOffset,
160 IN UINT64 PointerValue
165 if (S3Context->Used == S3Context->Allocated) {
166 return EFI_OUT_OF_RESOURCES;
169 Condensed = S3Context->WritePointers + S3Context->Used;
170 Condensed->PointerItem = PointerItem;
171 Condensed->PointerSize = PointerSize;
172 Condensed->PointerOffset = PointerOffset;
173 Condensed->PointerValue = PointerValue;
176 "%a: 0x%04x/[0x%08x+%d] := 0x%Lx (%Lu)\n",
182 (UINT64)S3Context->Used
195 IN OUT VOID *Context OPTIONAL,
196 IN OUT VOID *ExternalScratchBuffer
204 ScratchBuffer = ExternalScratchBuffer;
206 for (Index = 0; Index < S3Context->Used; ++Index) {
208 RETURN_STATUS Status;
210 Condensed = &S3Context->WritePointers[Index];
213 Condensed->PointerItem,
214 Condensed->PointerOffset
220 ScratchBuffer->PointerValue = Condensed->PointerValue;
227 DEBUG ((DEBUG_VERBOSE,
"%a: boot script fragment saved\n", __func__));
262 RETURN_STATUS Status;
264 if (S3Context->Used == 0) {
VOID EFIAPI CpuDeadLoop(VOID)
EFI_STATUS SaveCondensedWritePointerToS3Context(IN OUT S3_CONTEXT *S3Context, IN UINT16 PointerItem, IN UINT8 PointerSize, IN UINT32 PointerOffset, IN UINT64 PointerValue)
EFI_STATUS AllocateS3Context(OUT S3_CONTEXT **S3Context, IN UINTN WritePointerCount)
EFI_STATUS TransferS3ContextToBootScript(IN S3_CONTEXT *S3Context)
STATIC VOID EFIAPI AppendFwCfgBootScript(IN OUT VOID *Context OPTIONAL, IN OUT VOID *ExternalScratchBuffer)
VOID ReleaseS3Context(IN S3_CONTEXT *S3Context)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define RETURN_ERROR(StatusCode)
#define DEBUG(Expression)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
RETURN_STATUS EFIAPI QemuFwCfgS3ScriptWriteBytes(IN INT32 FirmwareConfigItem, IN UINTN NumberOfBytes)
RETURN_STATUS EFIAPI QemuFwCfgS3CallWhenBootScriptReady(IN FW_CFG_BOOT_SCRIPT_CALLBACK_FUNCTION *Callback, IN OUT VOID *Context OPTIONAL, IN UINTN ScratchBufferSize)
RETURN_STATUS EFIAPI QemuFwCfgS3ScriptSkipBytes(IN INT32 FirmwareConfigItem, IN UINTN NumberOfBytes)