Skip to content

Commit

Permalink
DynamicTablesPkg: AML Code generation for I/O ranges
Browse files Browse the repository at this point in the history
Add helper functions to generate AML Resource Data describing I/O
ranges of four words long. API AmlCodeGenRdQWordIo () is exposed.

Signed-off-by: Jeff Brasen <[email protected]>
Reviewed-by: Pierre Gondois <[email protected]>
Reviewed-by: Sami Mujawar <[email protected]>
  • Loading branch information
Vidya Sagar authored and mergify[bot] committed Sep 22, 2023
1 parent b5003ab commit 909e870
Show file tree
Hide file tree
Showing 2 changed files with 157 additions and 0 deletions.
67 changes: 67 additions & 0 deletions DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,73 @@ AmlCodeGenRdWordBusNumber (
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.
@param [in] IsResourceConsumer ResourceUsage parameter.
@param [in] IsMinFixed Minimum address is fixed.
@param [in] IsMaxFixed Maximum address is fixed.
@param [in] IsPosDecode Decode parameter
@param [in] IsaRanges Possible values are:
0-Reserved
1-NonISAOnly
2-ISAOnly
3-EntireRange
@param [in] AddressGranularity Address granularity.
@param [in] AddressMinimum Minimum address.
@param [in] AddressMaximum Maximum address.
@param [in] AddressTranslation Address translation.
@param [in] RangeLength Range length.
@param [in] ResourceSourceIndex Resource Source index.
Unused. Must be 0.
@param [in] ResourceSource Resource Source.
Unused. Must be NULL.
@param [in] IsDenseTranslation TranslationDensity parameter.
@param [in] IsTypeStatic TranslationType parameter.
@param [in] NameOpNode NameOp object node defining a named object.
If provided, append the new resource data
node to the list of resource data elements
of this node.
@param [out] NewRdNode If provided and success,
contain the created node.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@retval EFI_OUT_OF_RESOURCES Could not allocate memory.
**/
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 "QWordMemory ()" ASL function.
The Resource Data effectively created is a QWord Address Space Resource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1012,6 +1012,96 @@ AmlCodeGenRdQWordSpace (
return LinkRdNode (RdNode, NameOpNode, NewRdNode);
}

/** 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.
@param [in] IsResourceConsumer ResourceUsage parameter.
@param [in] IsMinFixed Minimum address is fixed.
@param [in] IsMaxFixed Maximum address is fixed.
@param [in] IsPosDecode Decode parameter
@param [in] IsaRanges Possible values are:
0-Reserved
1-NonISAOnly
2-ISAOnly
3-EntireRange
@param [in] AddressGranularity Address granularity.
@param [in] AddressMinimum Minimum address.
@param [in] AddressMaximum Maximum address.
@param [in] AddressTranslation Address translation.
@param [in] RangeLength Range length.
@param [in] ResourceSourceIndex Resource Source index.
Unused. Must be 0.
@param [in] ResourceSource Resource Source.
Unused. Must be NULL.
@param [in] IsDenseTranslation TranslationDensity parameter.
@param [in] IsTypeStatic TranslationType parameter.
@param [in] NameOpNode NameOp object node defining a named object.
If provided, append the new resource data
node to the list of resource data elements
of this node.
@param [out] NewRdNode If provided and success,
contain the created node.
@retval EFI_SUCCESS The function completed successfully.
@retval EFI_INVALID_PARAMETER Invalid parameter.
@retval EFI_OUT_OF_RESOURCES Could not allocate memory.
**/
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
)
{
return AmlCodeGenRdQWordSpace (
ACPI_ADDRESS_SPACE_TYPE_IO,
IsResourceConsumer,
IsPosDecode,
IsMinFixed,
IsMaxFixed,
RdIoRangeSpecificFlags (
IsaRanges,
IsDenseTranslation,
IsTypeStatic
),
AddressGranularity,
AddressMinimum,
AddressMaximum,
AddressTranslation,
RangeLength,
ResourceSourceIndex,
ResourceSource,
NameOpNode,
NewRdNode
);
}

/** Code generation for the "QWordMemory ()" ASL function.
The Resource Data effectively created is a QWord Address Space Resource
Expand Down

0 comments on commit 909e870

Please sign in to comment.