mirror of https://github.com/acidanthera/audk.git
DynamicTablesPkg: AML code generation for IO resouce descriptor.
Add helper functions to generate AML resource data for I/O resource descriptor. Cc: Pierre Gondois <pierre.gondois@arm.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
This commit is contained in:
parent
b6c4708c4d
commit
6a7be5a841
|
@ -1028,6 +1028,48 @@ AmlCodeGenRdInterrupt (
|
||||||
OUT AML_DATA_NODE_HANDLE *NewRdNode 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.
|
||||||
|
|
||||||
|
@param [in] IsDecoder16 Decoder parameter.
|
||||||
|
TRUE if 16-bit decoder.
|
||||||
|
FALSE if 10-bit decoder.
|
||||||
|
@param [in] AddressMinimum Minimum address.
|
||||||
|
@param [in] AddressMaximum Maximum address.
|
||||||
|
@param [in] Alignment Alignment.
|
||||||
|
@param [in] RangeLength Range length.
|
||||||
|
@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.
|
||||||
|
**/
|
||||||
|
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
|
||||||
|
);
|
||||||
|
|
||||||
/** AML code generation for DefinitionBlock.
|
/** AML code generation for DefinitionBlock.
|
||||||
|
|
||||||
Create a Root Node handle.
|
Create a Root Node handle.
|
||||||
|
|
|
@ -1475,6 +1475,89 @@ AmlCodeGenRdRegister (
|
||||||
return LinkRdNode (RdNode, NameOpNode, NewRdNode);
|
return LinkRdNode (RdNode, NameOpNode, NewRdNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 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.
|
||||||
|
|
||||||
|
@param [in] IsDecoder16 Decoder parameter.
|
||||||
|
TRUE if 16-bit decoder.
|
||||||
|
FALSE if 10-bit decoder.
|
||||||
|
@param [in] AddressMinimum Minimum address.
|
||||||
|
@param [in] AddressMaximum Maximum address.
|
||||||
|
@param [in] Alignment Alignment.
|
||||||
|
@param [in] RangeLength Range length.
|
||||||
|
@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.
|
||||||
|
**/
|
||||||
|
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 Status;
|
||||||
|
EFI_ACPI_IO_PORT_DESCRIPTOR IoDesc;
|
||||||
|
AML_DATA_NODE *IoNode;
|
||||||
|
|
||||||
|
if (AddressMinimum > AddressMaximum) {
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Alignment != 0) {
|
||||||
|
/// check the alignment
|
||||||
|
if ((AddressMinimum % Alignment) != 0) {
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((AddressMaximum % Alignment) != 0) {
|
||||||
|
return EFI_INVALID_PARAMETER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IoDesc.Header.Byte = ACPI_IO_PORT_DESCRIPTOR;
|
||||||
|
IoDesc.Information = IsDecoder16 ? BIT0 : 0;
|
||||||
|
|
||||||
|
IoDesc.BaseAddressMin = AddressMinimum;
|
||||||
|
IoDesc.BaseAddressMax = AddressMaximum;
|
||||||
|
IoDesc.Alignment = Alignment;
|
||||||
|
IoDesc.Length = RangeLength;
|
||||||
|
|
||||||
|
Status = AmlCreateDataNode (
|
||||||
|
EAmlNodeDataTypeResourceData,
|
||||||
|
(UINT8 *)&IoDesc,
|
||||||
|
sizeof (IoDesc),
|
||||||
|
&IoNode
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
ASSERT (0);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
return LinkRdNode (IoNode, NameOpNode, NewRdNode);
|
||||||
|
}
|
||||||
|
|
||||||
/** Code generation for the EndTag resource data.
|
/** Code generation for the EndTag resource data.
|
||||||
|
|
||||||
The EndTag resource data is automatically generated by the ASL compiler
|
The EndTag resource data is automatically generated by the ASL compiler
|
||||||
|
|
Loading…
Reference in New Issue