DynamicTablesPkg: Deprecate Crs specific methods in AmlLib
Some functions in the AmlLib have 'Crs' in their name and can only be applied to '_CRS' AML objects. To re-use them on AML objects that have different names: - Rename them and remove the '_CRS' name check. - Create aliases having of the 'Crs' function prototypes. These aliases are available when DISABLE_NEW_DEPRECATED_INTERFACES is not defined. They will be deprecated in a near future. The deprecated functions are: - AmlNameOpCrsGetFirstRdNode() - AmlNameOpCrsGetNextRdNode() - AmlCodeGenCrsAddRdInterrupt() Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
This commit is contained in:
committed by
mergify[bot]
parent
7a8c037e9e
commit
691c5f7762
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
AML Resource Data Code Generation.
|
||||
|
||||
Copyright (c) 2020, Arm Limited. All rights reserved.<BR>
|
||||
Copyright (c) 2020 - 2021, Arm Limited. All rights reserved.<BR>
|
||||
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
@ -161,6 +161,109 @@ AmlCodeGenInterrupt (
|
||||
This function creates a Resource Data element corresponding to the
|
||||
"Interrupt ()" ASL function, stores it in an AML Data Node.
|
||||
|
||||
It then adds it after the input NameOpNode in the list of resource data
|
||||
element.
|
||||
|
||||
The Resource Data effectively created is an Extended Interrupt Resource
|
||||
Data. See ACPI 6.3 specification, s6.4.3.6 "Extended Interrupt Descriptor"
|
||||
for more information about Extended Interrupt Resource Data.
|
||||
|
||||
The Extended Interrupt contains one single interrupt.
|
||||
|
||||
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.
|
||||
|
||||
Note:
|
||||
The named node must be defined using the ASL "Name ()" statement.
|
||||
E.g. Name (_CRS, ResourceTemplate () { ... })
|
||||
Methods cannot be modified with this function.
|
||||
|
||||
@param [in] NameOpNode NameOp object node defining a named object.
|
||||
Must have an OpCode=AML_NAME_OP, SubOpCode=0.
|
||||
NameOp object nodes are defined in ASL
|
||||
using the "Name ()" function.
|
||||
@param [in] ResourceConsumer The device consumes the specified interrupt
|
||||
or produces it for use by a child device.
|
||||
@param [in] EdgeTriggered The interrupt is edge triggered or
|
||||
level triggered.
|
||||
@param [in] ActiveLow The interrupt is active-high or active-low.
|
||||
@param [in] Shared The interrupt can be shared with other
|
||||
devices or not (Exclusive).
|
||||
@param [in] IrqList Interrupt list. Must be non-NULL.
|
||||
@param [in] IrqCount Interrupt count. Must be non-zero.
|
||||
|
||||
|
||||
@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
|
||||
AmlCodeGenAddRdInterrupt (
|
||||
IN AML_OBJECT_NODE_HANDLE NameOpNode,
|
||||
IN BOOLEAN ResourceConsumer,
|
||||
IN BOOLEAN EdgeTriggered,
|
||||
IN BOOLEAN ActiveLow,
|
||||
IN BOOLEAN Shared,
|
||||
IN UINT32 * IrqList,
|
||||
IN UINT8 IrqCount
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
AML_OBJECT_NODE_HANDLE BufferOpNode;
|
||||
|
||||
if ((IrqList == NULL) ||
|
||||
(IrqCount == 0) ||
|
||||
(!AmlNodeHasOpCode (NameOpNode, AML_NAME_OP, 0))) {
|
||||
ASSERT (0);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
// Get the value which is represented as a BufferOp object node
|
||||
// which is the 2nd fixed argument (i.e. index 1).
|
||||
BufferOpNode = (AML_OBJECT_NODE_HANDLE)AmlGetFixedArgument (
|
||||
NameOpNode,
|
||||
EAmlParseIndexTerm1
|
||||
);
|
||||
if ((BufferOpNode == NULL) ||
|
||||
(AmlGetNodeType ((AML_NODE_HANDLE)BufferOpNode) != EAmlNodeObject) ||
|
||||
(!AmlNodeHasOpCode (BufferOpNode, AML_BUFFER_OP, 0))) {
|
||||
ASSERT (0);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
// Generate the Extended Interrupt Resource Data node,
|
||||
// and attach it as the last variable argument of the BufferOpNode.
|
||||
Status = AmlCodeGenInterrupt (
|
||||
ResourceConsumer,
|
||||
EdgeTriggered,
|
||||
ActiveLow,
|
||||
Shared,
|
||||
IrqList,
|
||||
IrqCount,
|
||||
BufferOpNode,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ASSERT (0);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
// DEPRECATED APIS
|
||||
#ifndef DISABLE_NEW_DEPRECATED_INTERFACES
|
||||
|
||||
/** DEPRECATED API
|
||||
|
||||
Add an Interrupt Resource Data node.
|
||||
|
||||
This function creates a Resource Data element corresponding to the
|
||||
"Interrupt ()" ASL function, stores it in an AML Data Node.
|
||||
|
||||
It then adds it after the input CurrRdNode in the list of resource data
|
||||
element.
|
||||
|
||||
@ -180,6 +283,8 @@ AmlCodeGenInterrupt (
|
||||
...
|
||||
}
|
||||
|
||||
@ingroup UserApis
|
||||
|
||||
@param [in] NameOpCrsNode NameOp object node defining a "_CRS" object.
|
||||
Must have an OpCode=AML_NAME_OP, SubOpCode=0.
|
||||
NameOp object nodes are defined in ASL
|
||||
@ -211,46 +316,16 @@ AmlCodeGenCrsAddRdInterrupt (
|
||||
IN UINT8 IrqCount
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
AML_OBJECT_NODE_HANDLE BufferOpNode;
|
||||
|
||||
if ((IrqList == NULL) ||
|
||||
(IrqCount == 0) ||
|
||||
(!AmlNodeHasOpCode (NameOpCrsNode, AML_NAME_OP, 0)) ||
|
||||
(!AmlNameOpCompareName (NameOpCrsNode, "_CRS"))) {
|
||||
ASSERT (0);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
// Get the _CRS value which is represented as a BufferOp object node
|
||||
// which is the 2nd fixed argument (i.e. index 1).
|
||||
BufferOpNode = (AML_OBJECT_NODE_HANDLE)AmlGetFixedArgument (
|
||||
NameOpCrsNode,
|
||||
EAmlParseIndexTerm1
|
||||
);
|
||||
if ((BufferOpNode == NULL) ||
|
||||
(AmlGetNodeType ((AML_NODE_HANDLE)BufferOpNode) != EAmlNodeObject) ||
|
||||
(!AmlNodeHasOpCode (BufferOpNode, AML_BUFFER_OP, 0))) {
|
||||
ASSERT (0);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
// Generate the Extended Interrupt Resource Data node,
|
||||
// and attach it as the last variable argument of the BufferOpNode.
|
||||
Status = AmlCodeGenInterrupt (
|
||||
ResourceConsumer,
|
||||
EdgeTriggered,
|
||||
ActiveLow,
|
||||
Shared,
|
||||
IrqList,
|
||||
IrqCount,
|
||||
BufferOpNode,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
ASSERT (0);
|
||||
}
|
||||
|
||||
return Status;
|
||||
return AmlCodeGenAddRdInterrupt (
|
||||
NameOpCrsNode,
|
||||
NameOpNode,
|
||||
ResourceConsumer,
|
||||
EdgeTriggered,
|
||||
ActiveLow,
|
||||
Shared,
|
||||
IrqList,
|
||||
IrqCount
|
||||
);
|
||||
}
|
||||
|
||||
#endif // DISABLE_NEW_DEPRECATED_INTERFACES
|
||||
|
Reference in New Issue
Block a user