TianoCore EDK2 master
Loading...
Searching...
No Matches
AcpiPlatformLib.h File Reference
#include <Protocol/AcpiTable.h>
#include <Protocol/PciIo.h>

Go to the source code of this file.

Data Structures

struct  ORIGINAL_ATTRIBUTES
 

Typedefs

typedef struct S3_CONTEXT S3_CONTEXT
 

Functions

EFI_STATUS EFIAPI GetAcpiRsdpFromMemory (IN UINTN StartAddress, IN UINTN EndAddress, OUT EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER **RsdpPtr)
 
EFI_STATUS EFIAPI InstallAcpiTablesFromRsdp (IN EFI_ACPI_TABLE_PROTOCOL *AcpiProtocol, IN EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp)
 
EFI_STATUS EFIAPI InstallQemuFwCfgTables (IN EFI_ACPI_TABLE_PROTOCOL *AcpiProtocol)
 
VOID EnablePciDecoding (OUT ORIGINAL_ATTRIBUTES **OriginalAttributes, OUT UINTN *Count)
 
VOID RestorePciDecoding (IN ORIGINAL_ATTRIBUTES *OriginalAttributes, IN UINTN Count)
 
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)
 
EFI_STATUS TransferS3ContextToBootScript (IN S3_CONTEXT *S3Context)
 

Detailed Description

Copyright (c) 2023, Corvin Köhne corvi.nosp@m.nk@F.nosp@m.reeBS.nosp@m.D.or.nosp@m.g

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

Definition in file AcpiPlatformLib.h.

Typedef Documentation

◆ S3_CONTEXT

typedef struct S3_CONTEXT S3_CONTEXT

Definition at line 18 of file AcpiPlatformLib.h.

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.

◆ EnablePciDecoding()

VOID EnablePciDecoding ( OUT ORIGINAL_ATTRIBUTES **  OriginalAttributes,
OUT UINTN Count 
)

Collect all PciIo protocol instances in the system. Save their original attributes, and enable IO and MMIO decoding for each.

This is a best effort function; it doesn't return status codes. Its caller is supposed to proceed even if this function fails.

Parameters
[out]OriginalAttributesOn output, a dynamically allocated array of ORIGINAL_ATTRIBUTES elements. The array lists the PciIo protocol instances found in the system at the time of the call, plus the original PCI attributes for each.

Before returning, the function enables IO and MMIO decoding for each PciIo instance it finds.

On error, or when no such instances are found, OriginalAttributes is set to NULL.

Parameters
[out]CountOn output, the number of elements in OriginalAttributes. On error it is set to zero.

Definition at line 40 of file PciDecoding.c.

◆ GetAcpiRsdpFromMemory()

EFI_STATUS EFIAPI GetAcpiRsdpFromMemory ( IN UINTN  StartAddress,
IN UINTN  EndAddress,
OUT EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER **  RsdpPtr 
)

Searches and returns the address of the ACPI Root System Description Pointer (RSDP) in system memory.

Parameters
StartAddressStart address of search range.
EndAddressEnd address of search range.
RsdpPtrReturn pointer to RSDP.
Return values
EFI_SUCCESSRSDP successfully found.
EFI_NOT_FOUNDCouldn't find RSDP.
EFI_ABORTEDInvalid RSDP found.

Definition at line 18 of file DxeAcpiPlatformLib.c.

◆ InstallAcpiTablesFromRsdp()

EFI_STATUS EFIAPI InstallAcpiTablesFromRsdp ( IN EFI_ACPI_TABLE_PROTOCOL AcpiProtocol,
IN EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER Rsdp 
)

Get Acpi tables from the RSDP structure. And installs ACPI tables into the RSDT/XSDT using InstallAcpiTable. Some signature of the installed ACPI tables are: FACP, APIC, HPET, WAET, SSDT, FACS, DSDT.

Parameters
AcpiProtocolProtocol instance pointer.
Returns
EFI_SUCCESS The table was successfully inserted.
EFI_INVALID_PARAMETER Either AcpiTableBuffer is NULL, TableHandle is NULL, or AcpiTableBufferSize and the size field embedded in the ACPI table pointed to by AcpiTableBuffer are not in sync.
EFI_OUT_OF_RESOURCES Insufficient resources exist to complete the request.

Definition at line 71 of file DxeAcpiPlatformLib.c.

◆ InstallQemuFwCfgTables()

EFI_STATUS EFIAPI InstallQemuFwCfgTables ( IN EFI_ACPI_TABLE_PROTOCOL AcpiProtocol)

Download, process, and install ACPI table data from the QEMU loader interface.

Parameters
[in]AcpiProtocolThe ACPI table protocol used to install tables.
Return values
EFI_UNSUPPORTEDFirmware configuration is unavailable, or QEMU loader command with unsupported parameters has been found.
EFI_NOT_FOUNDThe host doesn't export the required fw_cfg files.
EFI_OUT_OF_RESOURCESMemory allocation failed, or more than INSTALLED_TABLES_MAX tables found.
EFI_PROTOCOL_ERRORFound invalid fw_cfg contents.
Returns
Status codes returned by AcpiProtocol->InstallAcpiTable().

Definition at line 1099 of file QemuFwCfgAcpi.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.

◆ RestorePciDecoding()

VOID RestorePciDecoding ( IN ORIGINAL_ATTRIBUTES OriginalAttributes,
IN UINTN  Count 
)

Restore the original PCI attributes saved with EnablePciDecoding().

Parameters
[in]OriginalAttributesThe array allocated and populated by EnablePciDecoding(). This parameter may be NULL. If OriginalAttributes is NULL, then the function is a no-op; otherwise the PciIo attributes will be restored, and the OriginalAttributes array will be freed.
[in]CountThe Count value stored by EnablePciDecoding(), the number of elements in OriginalAttributes. Count may be zero if and only if OriginalAttributes is NULL.

Definition at line 211 of file PciDecoding.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.