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

Go to the source code of this file.

Functions

STATIC EFI_STATUS EFIAPI LinkRdNode (IN AML_DATA_NODE *RdNode, IN AML_OBJECT_NODE *ParentNode, OUT AML_DATA_NODE **NewRdNode)
 
STATIC UINT8 EFIAPI RdIoRangeSpecificFlags (IN UINT8 IsaRanges, IN BOOLEAN IsDenseTranslation, IN BOOLEAN IsTypeStatic)
 
STATIC UINT8 EFIAPI MemoryRangeSpecificFlags (IN UINT8 Cacheable, IN BOOLEAN IsReadWrite, IN UINT8 MemoryRangeType, IN BOOLEAN IsTypeStatic)
 
STATIC UINT8 EFIAPI AddressSpaceGeneralFlags (IN BOOLEAN IsPosDecode, IN BOOLEAN IsMinFixed, IN BOOLEAN IsMaxFixed)
 
STATIC EFI_STATUS EFIAPI CheckAddressSpaceFields (IN BOOLEAN IsMinFixed, IN BOOLEAN IsMaxFixed, IN UINT64 AddressGranularity, IN UINT64 AddressMinimum, IN UINT64 AddressMaximum, IN UINT64 AddressTranslation, IN UINT64 RangeLength)
 
STATIC EFI_STATUS EFIAPI AmlCodeGenRdDWordSpace (IN UINT8 ResourceType, IN BOOLEAN IsResourceConsumer, IN BOOLEAN IsPosDecode, IN BOOLEAN IsMinFixed, IN BOOLEAN IsMaxFixed, IN UINT8 TypeSpecificFlags, IN UINT32 AddressGranularity, IN UINT32 AddressMinimum, IN UINT32 AddressMaximum, IN UINT32 AddressTranslation, IN UINT32 RangeLength, IN UINT8 ResourceSourceIndex, IN CONST CHAR8 *ResourceSource, IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL)
 
EFI_STATUS EFIAPI AmlCodeGenRdDWordIo (IN BOOLEAN IsResourceConsumer, IN BOOLEAN IsMinFixed, IN BOOLEAN IsMaxFixed, IN BOOLEAN IsPosDecode, IN UINT8 IsaRanges, IN UINT32 AddressGranularity, IN UINT32 AddressMinimum, IN UINT32 AddressMaximum, IN UINT32 AddressTranslation, IN UINT32 RangeLength, IN UINT8 ResourceSourceIndex, IN CONST CHAR8 *ResourceSource, IN BOOLEAN IsDenseTranslation, IN BOOLEAN IsTypeStatic, IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL)
 
EFI_STATUS EFIAPI AmlCodeGenRdDWordMemory (IN BOOLEAN IsResourceConsumer, IN BOOLEAN IsPosDecode, IN BOOLEAN IsMinFixed, IN BOOLEAN IsMaxFixed, IN AML_MEMORY_ATTRIBUTES_MEM Cacheable, IN BOOLEAN IsReadWrite, IN UINT32 AddressGranularity, IN UINT32 AddressMinimum, IN UINT32 AddressMaximum, IN UINT32 AddressTranslation, IN UINT32 RangeLength, IN UINT8 ResourceSourceIndex, IN CONST CHAR8 *ResourceSource, IN AML_MEMORY_ATTRIBUTES_MTP MemoryRangeType, IN BOOLEAN IsTypeStatic, IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL)
 
EFI_STATUS EFIAPI AmlCodeGenRdMemory32Fixed (BOOLEAN IsReadWrite, UINT32 Address, UINT32 RangeLength, AML_OBJECT_NODE_HANDLE NameOpNode, AML_DATA_NODE_HANDLE *NewMemNode)
 
STATIC EFI_STATUS EFIAPI AmlCodeGenRdWordSpace (IN UINT8 ResourceType, IN BOOLEAN IsResourceConsumer, IN BOOLEAN IsPosDecode, IN BOOLEAN IsMinFixed, IN BOOLEAN IsMaxFixed, IN UINT8 TypeSpecificFlags, IN UINT16 AddressGranularity, IN UINT16 AddressMinimum, IN UINT16 AddressMaximum, IN UINT16 AddressTranslation, IN UINT16 RangeLength, IN UINT8 ResourceSourceIndex, IN CONST CHAR8 *ResourceSource, IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL)
 
EFI_STATUS EFIAPI AmlCodeGenRdWordBusNumber (IN BOOLEAN IsResourceConsumer, IN BOOLEAN IsMinFixed, IN BOOLEAN IsMaxFixed, IN BOOLEAN IsPosDecode, IN UINT16 AddressGranularity, IN UINT16 AddressMinimum, IN UINT16 AddressMaximum, IN UINT16 AddressTranslation, IN UINT16 RangeLength, IN UINT8 ResourceSourceIndex, IN CONST CHAR8 *ResourceSource, IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL)
 
EFI_STATUS EFIAPI AmlCodeGenRdWordIo (IN BOOLEAN IsResourceConsumer, IN BOOLEAN IsMinFixed, IN BOOLEAN IsMaxFixed, IN BOOLEAN IsPosDecode, IN UINT8 IsaRanges, IN UINT16 AddressGranularity, IN UINT16 AddressMinimum, IN UINT16 AddressMaximum, IN UINT16 AddressTranslation, IN UINT16 RangeLength, IN UINT8 ResourceSourceIndex, IN CONST CHAR8 *ResourceSource, IN BOOLEAN IsDenseTranslation, IN BOOLEAN IsTypeStatic, IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL)
 
STATIC EFI_STATUS EFIAPI AmlCodeGenRdQWordSpace (IN UINT8 ResourceType, IN BOOLEAN IsResourceConsumer, IN BOOLEAN IsPosDecode, IN BOOLEAN IsMinFixed, IN BOOLEAN IsMaxFixed, IN UINT8 TypeSpecificFlags, IN UINT64 AddressGranularity, IN UINT64 AddressMinimum, IN UINT64 AddressMaximum, IN UINT64 AddressTranslation, IN UINT64 RangeLength, IN UINT8 ResourceSourceIndex, IN CONST CHAR8 *ResourceSource, IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL)
 
EFI_STATUS EFIAPI AmlCodeGenRdQWordIo (IN BOOLEAN IsResourceConsumer, IN BOOLEAN IsMinFixed, IN BOOLEAN IsMaxFixed, IN BOOLEAN IsPosDecode, IN UINT8 IsaRanges, IN UINT64 AddressGranularity, IN UINT64 AddressMinimum, IN UINT64 AddressMaximum, IN UINT64 AddressTranslation, IN UINT64 RangeLength, IN UINT8 ResourceSourceIndex, IN CONST CHAR8 *ResourceSource, IN BOOLEAN IsDenseTranslation, IN BOOLEAN IsTypeStatic, IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL)
 
EFI_STATUS EFIAPI AmlCodeGenRdQWordMemory (IN BOOLEAN IsResourceConsumer, IN BOOLEAN IsPosDecode, IN BOOLEAN IsMinFixed, IN BOOLEAN IsMaxFixed, IN AML_MEMORY_ATTRIBUTES_MEM Cacheable, IN BOOLEAN IsReadWrite, IN UINT64 AddressGranularity, IN UINT64 AddressMinimum, IN UINT64 AddressMaximum, IN UINT64 AddressTranslation, IN UINT64 RangeLength, IN UINT8 ResourceSourceIndex, IN CONST CHAR8 *ResourceSource, IN AML_MEMORY_ATTRIBUTES_MTP MemoryRangeType, IN BOOLEAN IsTypeStatic, IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL)
 
EFI_STATUS EFIAPI AmlCodeGenRdInterrupt (IN BOOLEAN ResourceConsumer, IN BOOLEAN EdgeTriggered, IN BOOLEAN ActiveLow, IN BOOLEAN Shared, IN UINT32 *IrqList, IN UINT8 IrqCount, IN AML_OBJECT_NODE_HANDLE NameOpNode OPTIONAL, OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL)
 
EFI_STATUS EFIAPI AmlCodeGenRdRegister (IN UINT8 AddressSpace, IN UINT8 BitWidth, IN UINT8 BitOffset, IN UINT64 Address, IN UINT8 AccessSize, IN AML_OBJECT_NODE_HANDLE NameOpNode OPTIONAL, OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL)
 
EFI_STATUS EFIAPI AmlCodeGenRdIo (IN BOOLEAN IsDecoder16, IN UINT16 AddressMinimum, IN UINT16 AddressMaximum, IN UINT8 Alignment, IN UINT8 RangeLength, IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL)
 
EFI_STATUS EFIAPI AmlCodeGenEndTag (IN UINT8 CheckSum OPTIONAL, IN AML_OBJECT_NODE *ParentNode OPTIONAL, OUT AML_DATA_NODE **NewRdNode OPTIONAL)
 

Detailed Description

AML Resource Data Code Generation.

Copyright (c) 2020 - 2021, Arm Limited. All rights reserved.
Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.

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

Glossary:
  • Rd or RD - Resource Data
  • Rds or RDS - Resource Data Small
  • Rdl or RDL - Resource Data Large

Definition in file AmlResourceDataCodeGen.c.

Function Documentation

◆ AddressSpaceGeneralFlags()

STATIC UINT8 EFIAPI AddressSpaceGeneralFlags ( IN BOOLEAN  IsPosDecode,
IN BOOLEAN  IsMinFixed,
IN BOOLEAN  IsMaxFixed 
)

Construct the GeneralFlags field of any Address Space Resource Descriptors.

E.g.: ACPI 6.4 specification, s6.4.3.5.1 "QWord Address Space Descriptor" for QWord

See ACPI 6.4 spec, s19.6.36 for more.

Parameters
[in]IsPosDecodeDecode parameter
[in]IsMinFixedMinimum address is fixed.
[in]IsMaxFixedMaximum address is fixed.
Returns
A type specific flags value.

Definition at line 208 of file AmlResourceDataCodeGen.c.

◆ AmlCodeGenEndTag()

EFI_STATUS EFIAPI AmlCodeGenEndTag ( IN UINT8 CheckSum  OPTIONAL,
IN AML_OBJECT_NODE *ParentNode  OPTIONAL,
OUT AML_DATA_NODE **NewRdNode  OPTIONAL 
)

Code generation for the EndTag resource data.

The EndTag resource data is automatically generated by the ASL compiler at the end of a list of resource data elements. Thus, it doesn't have a corresponding ASL function.

This function allocates memory to create a data node. It is the caller's responsibility to either:

  • attach this node to an AML tree;
  • delete this node.

ACPI 6.4, s6.4.2.9 "End Tag": "This checksum is generated such that adding it to the sum of all the data bytes will produce a zero sum." "If the checksum field is zero, the resource data is treated as if the checksum operation succeeded. Configuration proceeds normally."

To avoid re-computing checksums, if a new resource data elements is added/removed/modified in a list of resource data elements, the AmlLib resets the checksum to 0.

Parameters
[in]CheckSumCheckSum to store in the EndTag. To ignore/avoid computing the checksum, give 0.
[in]ParentNodeIf not NULL, add the generated node to the end of the variable list of argument of the ParentNode. The ParentNode must not initially contain an EndTag resource data element.
[out]NewRdNodeIf success, contains the generated node.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_OUT_OF_RESOURCESCould not allocate memory.

Definition at line 1596 of file AmlResourceDataCodeGen.c.

◆ AmlCodeGenRdDWordIo()

EFI_STATUS EFIAPI AmlCodeGenRdDWordIo ( IN BOOLEAN  IsResourceConsumer,
IN BOOLEAN  IsMinFixed,
IN BOOLEAN  IsMaxFixed,
IN BOOLEAN  IsPosDecode,
IN UINT8  IsaRanges,
IN UINT32  AddressGranularity,
IN UINT32  AddressMinimum,
IN UINT32  AddressMaximum,
IN UINT32  AddressTranslation,
IN UINT32  RangeLength,
IN UINT8  ResourceSourceIndex,
IN CONST CHAR8 *  ResourceSource,
IN BOOLEAN  IsDenseTranslation,
IN BOOLEAN  IsTypeStatic,
IN AML_OBJECT_NODE_HANDLE  NameOpNode,
OPTIONAL OUT AML_DATA_NODE_HANDLE *NewRdNode  OPTIONAL 
)

Code generation for the "DWordIO ()" ASL function.

The Resource Data effectively created is a DWord Address Space Resource Data. Cf ACPI 6.4:

  • s6.4.3.5.2 "DWord Address Space Descriptor".
  • s19.6.34 "DWordIO".

The created resource data node can be:

  • appended to the list of resource data elements of the NameOpNode. In such case NameOpNode must be defined by a the "Name ()" ASL statement and initially contain a "ResourceTemplate ()".
  • returned through the NewRdNode parameter.

See ACPI 6.4 spec, s19.6.34 for more.

Parameters
[in]IsResourceConsumerResourceUsage parameter.
[in]IsMinFixedMinimum address is fixed.
[in]IsMaxFixedMaximum address is fixed.
[in]IsPosDecodeDecode parameter
[in]IsaRangesPossible values are: 0-Reserved 1-NonISAOnly 2-ISAOnly 3-EntireRange
[in]AddressGranularityAddress granularity.
[in]AddressMinimumMinimum address.
[in]AddressMaximumMaximum address.
[in]AddressTranslationAddress translation.
[in]RangeLengthRange length.
[in]ResourceSourceIndexResource Source index. Unused. Must be 0.
[in]ResourceSourceResource Source. Unused. Must be NULL.
[in]IsDenseTranslationTranslationDensity parameter.
[in]IsTypeStaticTranslationType parameter.
[in]NameOpNodeNameOp object node defining a named object. If provided, append the new resource data node to the list of resource data elements of this node.
[out]NewRdNodeIf provided and success, contain the created node.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_OUT_OF_RESOURCESCould not allocate memory.

Definition at line 473 of file AmlResourceDataCodeGen.c.

◆ AmlCodeGenRdDWordMemory()

EFI_STATUS EFIAPI AmlCodeGenRdDWordMemory ( IN BOOLEAN  IsResourceConsumer,
IN BOOLEAN  IsPosDecode,
IN BOOLEAN  IsMinFixed,
IN BOOLEAN  IsMaxFixed,
IN AML_MEMORY_ATTRIBUTES_MEM  Cacheable,
IN BOOLEAN  IsReadWrite,
IN UINT32  AddressGranularity,
IN UINT32  AddressMinimum,
IN UINT32  AddressMaximum,
IN UINT32  AddressTranslation,
IN UINT32  RangeLength,
IN UINT8  ResourceSourceIndex,
IN CONST CHAR8 *  ResourceSource,
IN AML_MEMORY_ATTRIBUTES_MTP  MemoryRangeType,
IN BOOLEAN  IsTypeStatic,
IN AML_OBJECT_NODE_HANDLE  NameOpNode,
OPTIONAL OUT AML_DATA_NODE_HANDLE *NewRdNode  OPTIONAL 
)

Code generation for the "DWordMemory ()" ASL function.

The Resource Data effectively created is a DWord Address Space Resource Data. Cf ACPI 6.4:

  • s6.4.3.5.2 "DWord Address Space Descriptor".
  • s19.6.35 "DWordMemory".

The created resource data node can be:

  • appended to the list of resource data elements of the NameOpNode. In such case NameOpNode must be defined by a the "Name ()" ASL statement and initially contain a "ResourceTemplate ()".
  • returned through the NewRdNode parameter.

See ACPI 6.4 spec, s19.6.35 for more.

Parameters
[in]IsResourceConsumerResourceUsage parameter.
[in]IsPosDecodeDecode parameter
[in]IsMinFixedMinimum address is fixed.
[in]IsMaxFixedMaximum address is fixed.
[in]CacheablePossible values are: 0-The memory is non-cacheable 1-The memory is cacheable 2-The memory is cacheable and supports write combining 3-The memory is cacheable and prefetchable
[in]IsReadWriteReadAndWrite parameter.
[in]AddressGranularityAddress granularity.
[in]AddressMinimumMinimum address.
[in]AddressMaximumMaximum address.
[in]AddressTranslationAddress translation.
[in]RangeLengthRange length.
[in]ResourceSourceIndexResource Source index. Unused. Must be 0.
[in]ResourceSourceResource Source. Unused. Must be NULL.
[in]MemoryRangeTypePossible values are: 0-AddressRangeMemory 1-AddressRangeReserved 2-AddressRangeACPI 3-AddressRangeNVS
[in]IsTypeStaticTranslationType parameter.
[in]NameOpNodeNameOp object node defining a named object. If provided, append the new resource data node to the list of resource data elements of this node.
[out]NewRdNodeIf provided and success, contain the created node.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_OUT_OF_RESOURCESCould not allocate memory.

Definition at line 569 of file AmlResourceDataCodeGen.c.

◆ AmlCodeGenRdDWordSpace()

STATIC EFI_STATUS EFIAPI AmlCodeGenRdDWordSpace ( IN UINT8  ResourceType,
IN BOOLEAN  IsResourceConsumer,
IN BOOLEAN  IsPosDecode,
IN BOOLEAN  IsMinFixed,
IN BOOLEAN  IsMaxFixed,
IN UINT8  TypeSpecificFlags,
IN UINT32  AddressGranularity,
IN UINT32  AddressMinimum,
IN UINT32  AddressMaximum,
IN UINT32  AddressTranslation,
IN UINT32  RangeLength,
IN UINT8  ResourceSourceIndex,
IN CONST CHAR8 *  ResourceSource,
IN AML_OBJECT_NODE_HANDLE  NameOpNode,
OPTIONAL OUT AML_DATA_NODE_HANDLE *NewRdNode  OPTIONAL 
)

Code generation for the "DWordSpace ()" ASL function.

The Resource Data effectively created is a DWord Address Space Resource Data. Cf ACPI 6.4:

  • s6.4.3.5.2 "DWord Address Space Descriptor".
  • s19.6.36 "DWordSpace".

The created resource data node can be:

  • appended to the list of resource data elements of the NameOpNode. In such case NameOpNode must be defined by a the "Name ()" ASL statement and initially contain a "ResourceTemplate ()".
  • returned through the NewRdNode parameter.

See ACPI 6.4 spec, s19.6.36 for more.

Parameters
[in]ResourceTypeResource type. Possible values are: 0: Memory range 1: I/O range 2: Bus number range 3-191: Reserved 192-255: Hardware Vendor Defined See ACPI 6.4 spec, s6.4.3.5.2 for more.
[in]IsResourceConsumerResourceUsage parameter.
[in]IsPosDecodeDecode parameter
[in]IsMinFixedMinimum address is fixed.
[in]IsMaxFixedMaximum address is fixed.
[in]TypeSpecificFlagsType specific flags. See ACPI 6.4 spec, s6.4.3.5.5 "Resource Type Specific Flags".
[in]AddressGranularityAddress granularity.
[in]AddressMinimumMinimum address.
[in]AddressMaximumMaximum address.
[in]AddressTranslationAddress translation.
[in]RangeLengthRange length.
[in]ResourceSourceIndexResource Source index. Unused. Must be 0.
[in]ResourceSourceResource Source. Unused. Must be NULL.
[in]NameOpNodeNameOp object node defining a named object. If provided, append the new resource data node to the list of resource data elements of this node.
[out]NewRdNodeIf provided and success, contain the created node.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_OUT_OF_RESOURCESCould not allocate memory.

Definition at line 344 of file AmlResourceDataCodeGen.c.

◆ AmlCodeGenRdInterrupt()

EFI_STATUS EFIAPI AmlCodeGenRdInterrupt ( IN BOOLEAN  ResourceConsumer,
IN BOOLEAN  EdgeTriggered,
IN BOOLEAN  ActiveLow,
IN BOOLEAN  Shared,
IN UINT32 *  IrqList,
IN UINT8  IrqCount,
IN AML_OBJECT_NODE_HANDLE NameOpNode  OPTIONAL,
OUT AML_DATA_NODE_HANDLE *NewRdNode  OPTIONAL 
)

Code generation for the "Interrupt ()" ASL function.

The Resource Data effectively created is an Extended Interrupt Resource Data. Cf ACPI 6.4:

  • s6.4.3.6 "Extended Interrupt Descriptor"
  • s19.6.64 "Interrupt (Interrupt Resource Descriptor Macro)"

The created resource data node can be:

  • appended to the list of resource data elements of the NameOpNode. In such case NameOpNode must be defined by a the "Name ()" ASL statement and initially contain a "ResourceTemplate ()".
  • returned through the NewRdNode parameter.
Parameters
[in]ResourceConsumerThe device consumes the specified interrupt or produces it for use by a child device.
[in]EdgeTriggeredThe interrupt is edge triggered or level triggered.
[in]ActiveLowThe interrupt is active-high or active-low.
[in]SharedThe interrupt can be shared with other devices or not (Exclusive).
[in]IrqListInterrupt list. Must be non-NULL.
[in]IrqCountInterrupt count. Must be non-zero.
[in]NameOpNodeNameOp object node defining a named object. If provided, append the new resource data node to the list of resource data elements of this node.
[out]NewRdNodeIf provided and success, contain the created node.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_OUT_OF_RESOURCESCould not allocate memory.

Definition at line 1326 of file AmlResourceDataCodeGen.c.

◆ AmlCodeGenRdIo()

EFI_STATUS EFIAPI AmlCodeGenRdIo ( IN BOOLEAN  IsDecoder16,
IN UINT16  AddressMinimum,
IN UINT16  AddressMaximum,
IN UINT8  Alignment,
IN UINT8  RangeLength,
IN AML_OBJECT_NODE_HANDLE  NameOpNode,
OPTIONAL OUT AML_DATA_NODE_HANDLE *NewRdNode  OPTIONAL 
)

Code generation for the "IO ()" ASL function.

The Resource Data effectively created is a IO Resource Data. Cf ACPI 6.5:

  • s19.6.65 IO (IO Resource Descriptor Macro)
  • s6.4.2.5 I/O Port Descriptor

The created resource data node can be:

  • appended to the list of resource data elements of the NameOpNode. In such case NameOpNode must be defined by a the "Name ()" ASL statement and initially contain a "ResourceTemplate ()".
  • returned through the NewRdNode parameter.
Parameters
[in]IsDecoder16Decoder parameter. TRUE if 16-bit decoder. FALSE if 10-bit decoder.
[in]AddressMinimumMinimum address.
[in]AddressMaximumMaximum address.
[in]AlignmentAlignment.
[in]RangeLengthRange length.
[in]NameOpNodeNameOp object node defining a named object. If provided, append the new resource data node to the list of resource data elements of this node.
[out]NewRdNodeIf provided and success, contain the created node.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.

check the alignment

Definition at line 1508 of file AmlResourceDataCodeGen.c.

◆ AmlCodeGenRdMemory32Fixed()

EFI_STATUS EFIAPI AmlCodeGenRdMemory32Fixed ( BOOLEAN  IsReadWrite,
UINT32  Address,
UINT32  RangeLength,
AML_OBJECT_NODE_HANDLE  NameOpNode,
AML_DATA_NODE_HANDLE NewMemNode 
)

Code generation for the "Memory32Fixed ()" ASL macro.

The Resource Data effectively created is a 32-bit Memory Resource Data. Cf ACPI 6.4:

  • s19.6.83 "Memory Resource Descriptor Macro".
  • s19.2.8 "Memory32FixedTerm".

See ACPI 6.4 spec, s19.2.8 for more.

Parameters
[in]IsReadWriteReadAndWrite parameter.
[in]AddressAddressBase parameter.
[in]RangeLengthRange length.
[in]NameOpNodeNameOp object node defining a named object. If provided, append the new resource data node to the list of resource data elements of this node.
[out]NewMemNodeIf provided and success, contain the created node.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_OUT_OF_RESOURCESCould not allocate memory.

Definition at line 638 of file AmlResourceDataCodeGen.c.

◆ AmlCodeGenRdQWordIo()

EFI_STATUS EFIAPI AmlCodeGenRdQWordIo ( IN BOOLEAN  IsResourceConsumer,
IN BOOLEAN  IsMinFixed,
IN BOOLEAN  IsMaxFixed,
IN BOOLEAN  IsPosDecode,
IN UINT8  IsaRanges,
IN UINT64  AddressGranularity,
IN UINT64  AddressMinimum,
IN UINT64  AddressMaximum,
IN UINT64  AddressTranslation,
IN UINT64  RangeLength,
IN UINT8  ResourceSourceIndex,
IN CONST CHAR8 *  ResourceSource,
IN BOOLEAN  IsDenseTranslation,
IN BOOLEAN  IsTypeStatic,
IN AML_OBJECT_NODE_HANDLE  NameOpNode,
OPTIONAL OUT AML_DATA_NODE_HANDLE *NewRdNode  OPTIONAL 
)

Code generation for the "QWordIO ()" ASL function.

The Resource Data effectively created is a QWord Address Space Resource Data. Cf ACPI 6.4:

  • s6.4.3.5.1 "QWord Address Space Descriptor".
  • s19.6.109 "QWordIO".

The created resource data node can be:

  • appended to the list of resource data elements of the NameOpNode. In such case NameOpNode must be defined by a the "Name ()" ASL statement and initially contain a "ResourceTemplate ()".
  • returned through the NewRdNode parameter.

See ACPI 6.4 spec, s19.6.109 for more.

Parameters
[in]IsResourceConsumerResourceUsage parameter.
[in]IsMinFixedMinimum address is fixed.
[in]IsMaxFixedMaximum address is fixed.
[in]IsPosDecodeDecode parameter
[in]IsaRangesPossible values are: 0-Reserved 1-NonISAOnly 2-ISAOnly 3-EntireRange
[in]AddressGranularityAddress granularity.
[in]AddressMinimumMinimum address.
[in]AddressMaximumMaximum address.
[in]AddressTranslationAddress translation.
[in]RangeLengthRange length.
[in]ResourceSourceIndexResource Source index. Unused. Must be 0.
[in]ResourceSourceResource Source. Unused. Must be NULL.
[in]IsDenseTranslationTranslationDensity parameter.
[in]IsTypeStaticTranslationType parameter.
[in]NameOpNodeNameOp object node defining a named object. If provided, append the new resource data node to the list of resource data elements of this node.
[out]NewRdNodeIf provided and success, contain the created node.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_OUT_OF_RESOURCESCould not allocate memory.

Definition at line 1151 of file AmlResourceDataCodeGen.c.

◆ AmlCodeGenRdQWordMemory()

EFI_STATUS EFIAPI AmlCodeGenRdQWordMemory ( IN BOOLEAN  IsResourceConsumer,
IN BOOLEAN  IsPosDecode,
IN BOOLEAN  IsMinFixed,
IN BOOLEAN  IsMaxFixed,
IN AML_MEMORY_ATTRIBUTES_MEM  Cacheable,
IN BOOLEAN  IsReadWrite,
IN UINT64  AddressGranularity,
IN UINT64  AddressMinimum,
IN UINT64  AddressMaximum,
IN UINT64  AddressTranslation,
IN UINT64  RangeLength,
IN UINT8  ResourceSourceIndex,
IN CONST CHAR8 *  ResourceSource,
IN AML_MEMORY_ATTRIBUTES_MTP  MemoryRangeType,
IN BOOLEAN  IsTypeStatic,
IN AML_OBJECT_NODE_HANDLE  NameOpNode,
OPTIONAL OUT AML_DATA_NODE_HANDLE *NewRdNode  OPTIONAL 
)

Code generation for the "QWordMemory ()" ASL function.

The Resource Data effectively created is a QWord Address Space Resource Data. Cf ACPI 6.4:

  • s6.4.3.5.1 "QWord Address Space Descriptor".
  • s19.6.110 "QWordMemory".

The created resource data node can be:

  • appended to the list of resource data elements of the NameOpNode. In such case NameOpNode must be defined by a the "Name ()" ASL statement and initially contain a "ResourceTemplate ()".
  • returned through the NewRdNode parameter.

See ACPI 6.4 spec, s19.6.110 for more.

Parameters
[in]IsResourceConsumerResourceUsage parameter.
[in]IsPosDecodeDecode parameter.
[in]IsMinFixedMinimum address is fixed.
[in]IsMaxFixedMaximum address is fixed.
[in]CacheablePossible values are: 0-The memory is non-cacheable 1-The memory is cacheable 2-The memory is cacheable and supports write combining 3-The memory is cacheable and prefetchable
[in]IsReadWriteReadAndWrite parameter.
[in]AddressGranularityAddress granularity.
[in]AddressMinimumMinimum address.
[in]AddressMaximumMaximum address.
[in]AddressTranslationAddress translation.
[in]RangeLengthRange length.
[in]ResourceSourceIndexResource Source index. Unused. Must be 0.
[in]ResourceSourceResource Source. Unused. Must be NULL.
[in]MemoryRangeTypePossible values are: 0-AddressRangeMemory 1-AddressRangeReserved 2-AddressRangeACPI 3-AddressRangeNVS
[in]IsTypeStaticTranslationType parameter.
[in]NameOpNodeNameOp object node defining a named object. If provided, append the new resource data node to the list of resource data elements of this node.
[out]NewRdNodeIf provided and success, contain the created node.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_OUT_OF_RESOURCESCould not allocate memory.

Definition at line 1247 of file AmlResourceDataCodeGen.c.

◆ AmlCodeGenRdQWordSpace()

STATIC EFI_STATUS EFIAPI AmlCodeGenRdQWordSpace ( IN UINT8  ResourceType,
IN BOOLEAN  IsResourceConsumer,
IN BOOLEAN  IsPosDecode,
IN BOOLEAN  IsMinFixed,
IN BOOLEAN  IsMaxFixed,
IN UINT8  TypeSpecificFlags,
IN UINT64  AddressGranularity,
IN UINT64  AddressMinimum,
IN UINT64  AddressMaximum,
IN UINT64  AddressTranslation,
IN UINT64  RangeLength,
IN UINT8  ResourceSourceIndex,
IN CONST CHAR8 *  ResourceSource,
IN AML_OBJECT_NODE_HANDLE  NameOpNode,
OPTIONAL OUT AML_DATA_NODE_HANDLE *NewRdNode  OPTIONAL 
)

Code generation for the "QWordSpace ()" ASL function.

The Resource Data effectively created is a QWord Address Space Resource Data. Cf ACPI 6.4:

  • s6.4.3.5.1 "QWord Address Space Descriptor".
  • s19.6.111 "QWordSpace".

The created resource data node can be:

  • appended to the list of resource data elements of the NameOpNode. In such case NameOpNode must be defined by a the "Name ()" ASL statement and initially contain a "ResourceTemplate ()".
  • returned through the NewRdNode parameter.

See ACPI 6.4 spec, s19.6.111 for more.

Parameters
[in]ResourceTypeResource type. Possible values are: 0: Memory range 1: I/O range 2: Bus number range 3-191: Reserved 192-255: Hardware Vendor Defined See ACPI 6.4 spec, s6.4.3.5.1 for more.
[in]IsResourceConsumerResourceUsage parameter.
[in]IsPosDecodeDecode parameter
[in]IsMinFixedMinimum address is fixed.
[in]IsMaxFixedMaximum address is fixed.
[in]TypeSpecificFlagsType specific flags. See ACPI 6.4 spec, s6.4.3.5.5 "Resource Type Specific Flags".
[in]AddressGranularityAddress granularity.
[in]AddressMinimumMinimum address.
[in]AddressMaximumMaximum address.
[in]AddressTranslationAddress translation.
[in]RangeLengthRange length.
[in]ResourceSourceIndexResource Source index. Unused. Must be 0.
[in]ResourceSourceResource Source. Unused. Must be NULL.
[in]NameOpNodeNameOp object node defining a named object. If provided, append the new resource data node to the list of resource data elements of this node.
[out]NewRdNodeIf provided and success, contain the created node.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_OUT_OF_RESOURCESCould not allocate memory.

Definition at line 1022 of file AmlResourceDataCodeGen.c.

◆ AmlCodeGenRdRegister()

EFI_STATUS EFIAPI AmlCodeGenRdRegister ( IN UINT8  AddressSpace,
IN UINT8  BitWidth,
IN UINT8  BitOffset,
IN UINT64  Address,
IN UINT8  AccessSize,
IN AML_OBJECT_NODE_HANDLE NameOpNode  OPTIONAL,
OUT AML_DATA_NODE_HANDLE *NewRdNode  OPTIONAL 
)

Code generation for the "Register ()" ASL function.

The Resource Data effectively created is a Generic Register Descriptor. Data. Cf ACPI 6.4:

  • s6.4.3.7 "Generic Register Descriptor".
  • s19.6.114 "Register".

The created resource data node can be:

  • appended to the list of resource data elements of the NameOpNode. In such case NameOpNode must be defined by a the "Name ()" ASL statement and initially contain a "ResourceTemplate ()".
  • returned through the NewRdNode parameter.
Parameters
[in]AddressSpaceAddress space where the register exists. Can be one of I/O space, System Memory, etc.
[in]BitWidthNumber of bits in the register.
[in]BitOffsetOffset in bits from the start of the register indicated by the Address.
[in]AddressRegister address.
[in]AccessSizeSize of data values used when accessing the address space. Can be one of: 0 - Undefined, legacy (EFI_ACPI_6_4_UNDEFINED) 1 - Byte access (EFI_ACPI_6_4_BYTE) 2 - Word access (EFI_ACPI_6_4_WORD) 3 - DWord access (EFI_ACPI_6_4_DWORD) 4 - QWord access (EFI_ACPI_6_4_QWORD)
[in]NameOpNodeNameOp object node defining a named object. If provided, append the new resource data node to the list of resource data elements of this node.
[out]NewRdNodeIf provided and success, contain the created node.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_OUT_OF_RESOURCESCould not allocate memory.

Definition at line 1424 of file AmlResourceDataCodeGen.c.

◆ AmlCodeGenRdWordBusNumber()

EFI_STATUS EFIAPI AmlCodeGenRdWordBusNumber ( IN BOOLEAN  IsResourceConsumer,
IN BOOLEAN  IsMinFixed,
IN BOOLEAN  IsMaxFixed,
IN BOOLEAN  IsPosDecode,
IN UINT16  AddressGranularity,
IN UINT16  AddressMinimum,
IN UINT16  AddressMaximum,
IN UINT16  AddressTranslation,
IN UINT16  RangeLength,
IN UINT8  ResourceSourceIndex,
IN CONST CHAR8 *  ResourceSource,
IN AML_OBJECT_NODE_HANDLE  NameOpNode,
OPTIONAL OUT AML_DATA_NODE_HANDLE *NewRdNode  OPTIONAL 
)

Code generation for the "WordBusNumber ()" ASL function.

The Resource Data effectively created is a Word Address Space Resource Data. Cf ACPI 6.4:

  • s6.4.3.5.3 "Word Address Space Descriptor".
  • s19.6.149 "WordBusNumber".

The created resource data node can be:

  • appended to the list of resource data elements of the NameOpNode. In such case NameOpNode must be defined by a the "Name ()" ASL statement and initially contain a "ResourceTemplate ()".
  • returned through the NewRdNode parameter.

See ACPI 6.4 spec, s19.6.149 for more.

Parameters
[in]IsResourceConsumerResourceUsage parameter.
[in]IsMinFixedMinimum address is fixed.
[in]IsMaxFixedMaximum address is fixed.
[in]IsPosDecodeDecode parameter
[in]AddressGranularityAddress granularity.
[in]AddressMinimumMinimum address.
[in]AddressMaximumMaximum address.
[in]AddressTranslationAddress translation.
[in]RangeLengthRange length.
[in]ResourceSourceIndexResource Source index. Unused. Must be 0.
[in]ResourceSourceResource Source. Unused. Must be NULL.
[in]NameOpNodeNameOp object node defining a named object. If provided, append the new resource data node to the list of resource data elements of this node.
[out]NewRdNodeIf provided and success, contain the created node.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_OUT_OF_RESOURCESCould not allocate memory.

Definition at line 846 of file AmlResourceDataCodeGen.c.

◆ AmlCodeGenRdWordIo()

EFI_STATUS EFIAPI AmlCodeGenRdWordIo ( IN BOOLEAN  IsResourceConsumer,
IN BOOLEAN  IsMinFixed,
IN BOOLEAN  IsMaxFixed,
IN BOOLEAN  IsPosDecode,
IN UINT8  IsaRanges,
IN UINT16  AddressGranularity,
IN UINT16  AddressMinimum,
IN UINT16  AddressMaximum,
IN UINT16  AddressTranslation,
IN UINT16  RangeLength,
IN UINT8  ResourceSourceIndex,
IN CONST CHAR8 *  ResourceSource,
IN BOOLEAN  IsDenseTranslation,
IN BOOLEAN  IsTypeStatic,
IN AML_OBJECT_NODE_HANDLE  NameOpNode,
OPTIONAL OUT AML_DATA_NODE_HANDLE *NewRdNode  OPTIONAL 
)

Code generation for the "WordIO ()" ASL function.

The Resource Data effectively created is a Word Address Space Resource Data. Cf ACPI 6.5:

  • s6.4.3.5.3 "Word Address Space Descriptor".

The created resource data node can be:

  • appended to the list of resource data elements of the NameOpNode. In such case NameOpNode must be defined by a the "Name ()" ASL statement and initially contain a "ResourceTemplate ()".
  • returned through the NewRdNode parameter.
Parameters
[in]IsResourceConsumerResourceUsage parameter.
[in]IsMinFixedMinimum address is fixed.
[in]IsMaxFixedMaximum address is fixed.
[in]IsPosDecodeDecode parameter
[in]IsaRangesPossible values are: 0-Reserved 1-NonISAOnly 2-ISAOnly 3-EntireRange
[in]AddressGranularityAddress granularity.
[in]AddressMinimumMinimum address.
[in]AddressMaximumMaximum address.
[in]AddressTranslationAddress translation.
[in]RangeLengthRange length.
[in]ResourceSourceIndexResource Source index. Not supported. Must be 0.
[in]ResourceSourceResource Source. Not supported. Must be NULL.
[in]IsDenseTranslationTranslationDensity parameter.
[in]IsTypeStaticTranslationType parameter.
[in]NameOpNodeNameOp object node defining a named object. If provided, append the new resource data node to the list of resource data elements of this node.
[out]NewRdNodeIf provided and success, contain the created node.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_OUT_OF_RESOURCESCould not allocate memory.

Definition at line 927 of file AmlResourceDataCodeGen.c.

◆ AmlCodeGenRdWordSpace()

STATIC EFI_STATUS EFIAPI AmlCodeGenRdWordSpace ( IN UINT8  ResourceType,
IN BOOLEAN  IsResourceConsumer,
IN BOOLEAN  IsPosDecode,
IN BOOLEAN  IsMinFixed,
IN BOOLEAN  IsMaxFixed,
IN UINT8  TypeSpecificFlags,
IN UINT16  AddressGranularity,
IN UINT16  AddressMinimum,
IN UINT16  AddressMaximum,
IN UINT16  AddressTranslation,
IN UINT16  RangeLength,
IN UINT8  ResourceSourceIndex,
IN CONST CHAR8 *  ResourceSource,
IN AML_OBJECT_NODE_HANDLE  NameOpNode,
OPTIONAL OUT AML_DATA_NODE_HANDLE *NewRdNode  OPTIONAL 
)

Code generation for the "WordSpace ()" ASL function.

The Resource Data effectively created is a Word Address Space Resource Data. Cf ACPI 6.4:

  • s6.4.3.5.3 "Word Address Space Descriptor".
  • s19.6.151 "WordSpace".

The created resource data node can be:

  • appended to the list of resource data elements of the NameOpNode. In such case NameOpNode must be defined by a the "Name ()" ASL statement and initially contain a "ResourceTemplate ()".
  • returned through the NewRdNode parameter.

See ACPI 6.4 spec, s19.6.151 for more.

Parameters
[in]ResourceTypeResource type. Possible values are: 0: Memory range 1: I/O range 2: Bus number range 3-191: Reserved 192-255: Hardware Vendor Defined See ACPI 6.4 spec, s6.4.3.5.3 for more.
[in]IsResourceConsumerResourceUsage parameter.
[in]IsPosDecodeDecode parameter
[in]IsMinFixedMinimum address is fixed.
[in]IsMaxFixedMaximum address is fixed.
[in]TypeSpecificFlagsType specific flags. See ACPI 6.4 spec, s6.4.3.5.5 "Resource Type Specific Flags".
[in]AddressGranularityAddress granularity.
[in]AddressMinimumMinimum address.
[in]AddressMaximumMaximum address.
[in]AddressTranslationAddress translation.
[in]RangeLengthRange length.
[in]ResourceSourceIndexResource Source index. Unused. Must be 0.
[in]ResourceSourceResource Source. Unused. Must be NULL.
[in]NameOpNodeNameOp object node defining a named object. If provided, append the new resource data node to the list of resource data elements of this node.
[out]NewRdNodeIf provided and success, contain the created node.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_OUT_OF_RESOURCESCould not allocate memory.

Definition at line 724 of file AmlResourceDataCodeGen.c.

◆ CheckAddressSpaceFields()

STATIC EFI_STATUS EFIAPI CheckAddressSpaceFields ( IN BOOLEAN  IsMinFixed,
IN BOOLEAN  IsMaxFixed,
IN UINT64  AddressGranularity,
IN UINT64  AddressMinimum,
IN UINT64  AddressMaximum,
IN UINT64  AddressTranslation,
IN UINT64  RangeLength 
)

Check Address Space Descriptor Fields.

Cf. ACPI 6.4 Table 6.44: "Valid Combination of Address Space Descriptor Fields"

See ACPI 6.4 spec, s19.6.36 for more.

Parameters
[in]IsMinFixedMinimum address is fixed.
[in]IsMaxFixedMaximum address is fixed.
[in]AddressGranularityAddress granularity.
[in]AddressMinimumMinimum address.
[in]AddressMaximumMaximum address.
[in]AddressTranslationAddress translation.
[in]RangeLengthRange length.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.

Definition at line 240 of file AmlResourceDataCodeGen.c.

◆ LinkRdNode()

STATIC EFI_STATUS EFIAPI LinkRdNode ( IN AML_DATA_NODE RdNode,
IN AML_OBJECT_NODE ParentNode,
OUT AML_DATA_NODE **  NewRdNode 
)

If ParentNode is not NULL, append RdNode. If NewRdNode is not NULL, update its value to RdNode.

Parameters
[in]RdNodeNewly created Resource Data node. RdNode is deleted if an error occurs.
[in]ParentNodeIf not NULL, ParentNode must:
  • be a NameOp node, i.e. have the AML_NAME_OP opcode (cf "Name ()" ASL statement)
  • contain a list of resource data elements (cf "ResourceTemplate ()" ASL statement) RdNode is then added at the end of the variable list of resource data elements, but before the "End Tag" Resource Data.
[out]NewRdNodeIf not NULL:
  • and Success, contains RdNode.
  • and Error, reset to NULL.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.

Definition at line 47 of file AmlResourceDataCodeGen.c.

◆ MemoryRangeSpecificFlags()

STATIC UINT8 EFIAPI MemoryRangeSpecificFlags ( IN UINT8  Cacheable,
IN BOOLEAN  IsReadWrite,
IN UINT8  MemoryRangeType,
IN BOOLEAN  IsTypeStatic 
)

Construct the TypeSpecificFlags field for Memory ranges.

Parameters
[in]CacheablePossible values are: 0-The memory is non-cacheable 1-The memory is cacheable 2-The memory is cacheable and supports write combining 3-The memory is cacheable and prefetchable
[in]IsReadWriteReadAndWrite parameter.
[in]MemoryRangeTypePossible values are: 0-AddressRangeMemory 1-AddressRangeReserved 2-AddressRangeACPI 3-AddressRangeNVS See ACPI 6.4 spec, s19.6.35 for more.
[in]IsTypeStaticTranslationType parameter.
Returns
A type specific flags value. MAX_UINT8 if error.

Definition at line 167 of file AmlResourceDataCodeGen.c.

◆ RdIoRangeSpecificFlags()

STATIC UINT8 EFIAPI RdIoRangeSpecificFlags ( IN UINT8  IsaRanges,
IN BOOLEAN  IsDenseTranslation,
IN BOOLEAN  IsTypeStatic 
)

Construct the TypeSpecificFlags field for IO ranges.

See ACPI 6.4 spec, s19.6.34 for more.

Parameters
[in]IsaRangesPossible values are: 0-Reserved 1-NonISAOnly 2-ISAOnly 3-EntireRange See ACPI 6.4 spec, s19.6.34 for more.
[in]IsDenseTranslationTranslationDensity parameter.
[in]IsTypeStaticTranslationType parameter.
Returns
A type specific flags value. MAX_UINT8 if error.

Definition at line 124 of file AmlResourceDataCodeGen.c.