audk/DynamicTablesPkg/Library/Common/AmlLib/Parser/AmlResourceDataParser.h

71 lines
2.2 KiB
C
Raw Normal View History

DynamicTablesPkg: AML resource data parser Resource data are defined in the ACPI 6.3 specification, s6.4 "Resource Data Types for ACPI". They can be created using the ASL ResourceTemplate () statement, cf s19.3.3 "ASL Resource Templates". Resource data can be of the small or large type and are defined by their encoding. The resource data is stored in the Bytelist of a BufferOp node. The Bytelist of a BufferOp node is represented by an AML Data node in the AML tree. The resource data parser, examines the Bytelist (Data node buffer) to detect the presence of resource data. If the Bytelist data matches the encoding for resource data types, the resource data parser fragments the Bytelist containing the resource data buffer into resource data elements represented as individual Data nodes and stores them in the variable arguments list of the BufferOp object nodes. Example: ASL code and the corresponding AML tree representation for the resource data. ASL Code -------- Name (_CRS, ResourceTemplate() { QWordMemory (...) Interrupt (...) } AML Tree -------- (NameOp) \ |-[_CRS]-[BufferOp] # Fixed Arguments |-{NULL} \ # Variable Argument \ list |-[BuffSize] # Fixed Arguments |-{(Rd1)->(Rd2)->(EndTag)} # Variable Argument list Where: Rd1 - QWordMemory resource data element. Rd2 - Interrupt resource data element. EndTag - Resource data end tag. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
2020-08-04 18:09:09 +02:00
/** @file
AML Resource Data Parser.
Copyright (c) 2019 - 2020, Arm Limited. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@par Glossary:
- Rd or RD - Resource Data
- Rds or RDS - Resource Data Small
- Rdl or RDL - Resource Data Large
**/
#ifndef AML_RESOURCE_DATA_PARSER_H_
#define AML_RESOURCE_DATA_PARSER_H_
#include <AmlNodeDefines.h>
#include <Stream/AmlStream.h>
#include <ResourceData/AmlResourceData.h>
/** Check whether the input stream is pointing to a valid list
of resource data elements.
The check is based on the size of resource data elements.
This means that a buffer can pass this check with non-existing descriptor Ids
that have a correct size.
A list of resource data elements can contain one unique resource data
element, without an end tag resource data. This is the case for
a FieldList.
@param [in] FStream Forward stream ideally pointing to a resource
data element. The stream is not
modified/progressing.
The stream must not be at its end.
@retval TRUE The buffer is holding a valid list of resource data elements.
@retval FALSE Otherwise.
**/
BOOLEAN
EFIAPI
AmlRdIsResourceDataBuffer (
IN CONST AML_STREAM *FStream
DynamicTablesPkg: AML resource data parser Resource data are defined in the ACPI 6.3 specification, s6.4 "Resource Data Types for ACPI". They can be created using the ASL ResourceTemplate () statement, cf s19.3.3 "ASL Resource Templates". Resource data can be of the small or large type and are defined by their encoding. The resource data is stored in the Bytelist of a BufferOp node. The Bytelist of a BufferOp node is represented by an AML Data node in the AML tree. The resource data parser, examines the Bytelist (Data node buffer) to detect the presence of resource data. If the Bytelist data matches the encoding for resource data types, the resource data parser fragments the Bytelist containing the resource data buffer into resource data elements represented as individual Data nodes and stores them in the variable arguments list of the BufferOp object nodes. Example: ASL code and the corresponding AML tree representation for the resource data. ASL Code -------- Name (_CRS, ResourceTemplate() { QWordMemory (...) Interrupt (...) } AML Tree -------- (NameOp) \ |-[_CRS]-[BufferOp] # Fixed Arguments |-{NULL} \ # Variable Argument \ list |-[BuffSize] # Fixed Arguments |-{(Rd1)->(Rd2)->(EndTag)} # Variable Argument list Where: Rd1 - QWordMemory resource data element. Rd2 - Interrupt resource data element. EndTag - Resource data end tag. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
2020-08-04 18:09:09 +02:00
);
/** Parse a ResourceDataBuffer.
For each resource data element, create a data node
and add them to the variable list of arguments of the BufferNode.
The input stream is expected to point to a valid list of resource data
elements. A function is available to check it for the caller.
@param [in] BufferNode Buffer node.
@param [in] FStream Forward stream pointing to a resource data
element.
The stream must not be at its end.
@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
AmlParseResourceData (
IN AML_OBJECT_NODE *BufferNode,
IN AML_STREAM *FStream
DynamicTablesPkg: AML resource data parser Resource data are defined in the ACPI 6.3 specification, s6.4 "Resource Data Types for ACPI". They can be created using the ASL ResourceTemplate () statement, cf s19.3.3 "ASL Resource Templates". Resource data can be of the small or large type and are defined by their encoding. The resource data is stored in the Bytelist of a BufferOp node. The Bytelist of a BufferOp node is represented by an AML Data node in the AML tree. The resource data parser, examines the Bytelist (Data node buffer) to detect the presence of resource data. If the Bytelist data matches the encoding for resource data types, the resource data parser fragments the Bytelist containing the resource data buffer into resource data elements represented as individual Data nodes and stores them in the variable arguments list of the BufferOp object nodes. Example: ASL code and the corresponding AML tree representation for the resource data. ASL Code -------- Name (_CRS, ResourceTemplate() { QWordMemory (...) Interrupt (...) } AML Tree -------- (NameOp) \ |-[_CRS]-[BufferOp] # Fixed Arguments |-{NULL} \ # Variable Argument \ list |-[BuffSize] # Fixed Arguments |-{(Rd1)->(Rd2)->(EndTag)} # Variable Argument list Where: Rd1 - QWordMemory resource data element. Rd2 - Interrupt resource data element. EndTag - Resource data end tag. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>
2020-08-04 18:09:09 +02:00
);
#endif // AML_RESOURCE_DATA_PARSER_H_