summaryrefslogtreecommitdiffstats
path: root/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h
diff options
context:
space:
mode:
Diffstat (limited to 'ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h')
-rw-r--r--ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h
index 5c916a4720..db8c88f6df 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h
@@ -2,6 +2,7 @@
Header file for ACPI parser
Copyright (c) 2016 - 2020, Arm Limited. All rights reserved.
+ Copyright (c) 2022, AMD Incorporated. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -251,6 +252,11 @@ typedef VOID (EFIAPI *FNPTR_FIELD_VALIDATOR)(UINT8 *Ptr, VOID *Context);
the field data. If the field is more complex and requires additional
processing for formatting and representation a print formatter function
can be specified in 'PrintFormatter'.
+
+ ParseAcpiBitFields() uses AcpiParser structure to parse the bit fields.
+ It considers Length as a number of bits that need to be parsed.
+ Also, the Offset field will be considered as starting offset of the bitfield.
+
The PrintFormatter function may choose to use the format string
specified by 'Format' or use its own internal format string.
@@ -264,10 +270,12 @@ typedef struct AcpiParser {
/// The length of the field.
/// (Byte Length column from ACPI table spec)
+ /// Length(in bits) of the bitfield if used with ParseAcpiBitFields().
UINT32 Length;
/// The offset of the field from the start of the table.
/// (Byte Offset column from ACPI table spec)
+ /// The Bit offset of the field if used with ParseAcpiBitFields().
UINT32 Offset;
/// Optional Print() style format string for tracing the data. If not
@@ -285,6 +293,7 @@ typedef struct AcpiParser {
/// a pointer to the field data. This value is set after the FieldValidator
/// has been called and therefore should not be used by the FieldValidator.
/// If unused this must be set to NULL.
+ /// ItemPtr is not supported with ParseAcpiBitFields().
VOID **ItemPtr;
/// Optional pointer to a field validator function.
@@ -365,6 +374,45 @@ ParseAcpi (
);
/**
+ This function is used to parse an ACPI table bitfield buffer.
+
+ The ACPI table buffer is parsed using the ACPI table parser information
+ specified by a pointer to an array of ACPI_PARSER elements. This parser
+ function iterates through each item on the ACPI_PARSER array and logs the ACPI table bitfields.
+
+ This function can optionally be used to parse ACPI tables and fetch specific
+ field values. The ItemPtr member of the ACPI_PARSER structure (where used)
+ is updated by this parser function to point to the selected field data
+ (e.g. useful for variable length nested fields).
+
+ ItemPtr member of ACPI_PARSER is not supported with this function.
+
+ @param [in] Trace Trace the ACPI fields TRUE else only parse the
+ table.
+ @param [in] Indent Number of spaces to indent the output.
+ @param [in] AsciiName Optional pointer to an ASCII string that describes
+ the table being parsed.
+ @param [in] Ptr Pointer to the start of the buffer.
+ @param [in] Length Length of the buffer pointed by Ptr.
+ @param [in] Parser Pointer to an array of ACPI_PARSER structure that
+ describes the table being parsed.
+ @param [in] ParserItems Number of items in the ACPI_PARSER array.
+
+ @retval Number of bits parsed.
+**/
+UINT32
+EFIAPI
+ParseAcpiBitFields (
+ IN BOOLEAN Trace,
+ IN UINT32 Indent,
+ IN CONST CHAR8 *AsciiName OPTIONAL,
+ IN UINT8 *Ptr,
+ IN UINT32 Length,
+ IN CONST ACPI_PARSER *Parser,
+ IN UINT32 ParserItems
+ );
+
+/**
This is a helper macro to pass parameters to the Parser functions.
@param [in] Parser The name of the ACPI_PARSER array describing the