TianoCore EDK2 master
Loading...
Searching...
No Matches
ErstParser.c File Reference
#include <IndustryStandard/Acpi.h>
#include <Library/UefiLib.h>
#include "AcpiParser.h"
#include "AcpiTableParser.h"

Go to the source code of this file.

Functions

STATIC VOID EFIAPI ValidateErstAction (IN UINT8 *Ptr, IN UINT32 Length, IN VOID *Context)
 
STATIC VOID EFIAPI ValidateErstInstruction (IN UINT8 *Ptr, IN UINT32 Length, IN VOID *Context)
 
STATIC VOID EFIAPI ValidateErstFlags (IN UINT8 *Ptr, IN UINT32 Length, IN VOID *Context)
 
STATIC VOID EFIAPI FormatByte (IN CONST CHAR16 *Table[], IN UINT8 Index, IN UINT8 NumEntries)
 
STATIC VOID EFIAPI DumpErstAction (IN CONST CHAR16 *Format OPTIONAL, IN UINT8 *Ptr, IN UINT32 Length)
 
STATIC VOID EFIAPI DumpErstInstruction (IN CONST CHAR16 *Format OPTIONAL, IN UINT8 *Ptr, IN UINT32 Length)
 
VOID EFIAPI ParseAcpiErst (IN BOOLEAN Trace, IN UINT8 *Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision)
 

Variables

STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo
 
STATIC UINT32 * InstructionEntryCount
 
STATIC CONST CHAR16 * ErstActionTable []
 
STATIC CONST CHAR16 * ErstInstructionTable []
 
STATIC CONST ACPI_PARSER ErstParser []
 
STATIC CONST ACPI_PARSER SerializationInstructionEntryParser []
 

Detailed Description

ERST table parser

Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. Copyright (c) 2016 - 2024, Arm Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent

Reference(s):
  • ACPI 6.5 Specification - August 2022

Definition in file ErstParser.c.

Function Documentation

◆ DumpErstAction()

STATIC VOID EFIAPI DumpErstAction ( IN CONST CHAR16 *Format  OPTIONAL,
IN UINT8 *  Ptr,
IN UINT32  Length 
)

Prints the Erst Action.

Parameters
[in]FormatOptional format string for tracing the data.
[in]PtrPointer to the Action byte.
[in]LengthLength of the field.

Definition at line 179 of file ErstParser.c.

◆ DumpErstInstruction()

STATIC VOID EFIAPI DumpErstInstruction ( IN CONST CHAR16 *Format  OPTIONAL,
IN UINT8 *  Ptr,
IN UINT32  Length 
)

Prints the Erst Instruction.

Parameters
[in]FormatOptional format string for tracing the data.
[in]PtrPointer to the Instruction byte.
[in]LengthLength of the field.

Definition at line 198 of file ErstParser.c.

◆ FormatByte()

STATIC VOID EFIAPI FormatByte ( IN CONST CHAR16 *  Table[],
IN UINT8  Index,
IN UINT8  NumEntries 
)

Looks up and prints the string corresponding to the index.

Parameters
[in]TableLookup table.
[in]IndexEntry to print.
[in]NumEntriesNumber of valid entries in the table.

Definition at line 148 of file ErstParser.c.

◆ ParseAcpiErst()

VOID EFIAPI ParseAcpiErst ( IN BOOLEAN  Trace,
IN UINT8 *  Ptr,
IN UINT32  AcpiTableLength,
IN UINT8  AcpiTableRevision 
)

This function parses the ACPI ERST table. When trace is enabled this function parses the ERST table and traces the ACPI table fields.

This function also performs validation of the ACPI table fields.

Parameters
[in]TraceIf TRUE, trace the ACPI fields.
[in]PtrPointer to the start of the buffer.
[in]AcpiTableLengthLength of the ACPI table.
[in]AcpiTableRevisionRevision of the ACPI table.

Definition at line 244 of file ErstParser.c.

◆ ValidateErstAction()

STATIC VOID EFIAPI ValidateErstAction ( IN UINT8 *  Ptr,
IN UINT32  Length,
IN VOID *  Context 
)

Validate Erst action.

Parameters
[in]PtrPointer to the start of the field data.
[in]LengthLength of the field.
[in]ContextPointer to context specific information e.g. this could be a pointer to the ACPI table header.

Definition at line 80 of file ErstParser.c.

◆ ValidateErstFlags()

STATIC VOID EFIAPI ValidateErstFlags ( IN UINT8 *  Ptr,
IN UINT32  Length,
IN VOID *  Context 
)

Validate Erst flags.

Parameters
[in]PtrPointer to the start of the field data.
[in]LengthLength of the field.
[in]ContextPointer to context specific information e.g. this could be a pointer to the ACPI table header.

Definition at line 126 of file ErstParser.c.

◆ ValidateErstInstruction()

STATIC VOID EFIAPI ValidateErstInstruction ( IN UINT8 *  Ptr,
IN UINT32  Length,
IN VOID *  Context 
)

Validate Erst instruction.

Parameters
[in]PtrPointer to the start of the field data.
[in]LengthLength of the field.
[in]ContextPointer to context specific information e.g. this could be a pointer to the ACPI table header.

Definition at line 103 of file ErstParser.c.

Variable Documentation

◆ AcpiHdrInfo

Definition at line 18 of file ErstParser.c.

◆ ErstActionTable

STATIC CONST CHAR16* ErstActionTable[]
Initial value:
= {
L"BEGIN_WRITE_OPERATION",
L"BEGIN_READ_OPERATION",
L"BEGIN_CLEAR_OPERATION",
L"END_OPERATION",
L"SET_RECORD_OFFSET",
L"EXECUTE_OPERATION",
L"CHECK_BUSY_STATUS",
L"GET_COMMAND_STATUS",
L"GET_RECORD_IDENTIFIER",
L"SET_RECORD_IDENTIFIER",
L"GET_RECORD_COUNT",
L"BEGIN_DUMMY_WRITE_OPERATION",
L"RESERVED",
L"GET_ERROR_LOG_ADDRESS_RANGE",
L"GET_ERROR_LOG_ADDRESS_RANGE_LENGTH",
L"GET_ERROR_LOG_ADDRESS_RANGE_ATTRIBUTES",
L"GET_EXECUTE_OPERATION_TIMINGS"
}

An array of strings describing the Erst actions

Definition at line 24 of file ErstParser.c.

◆ ErstInstructionTable

STATIC CONST CHAR16* ErstInstructionTable[]
Initial value:
= {
L"READ_REGISTER",
L"READ_REGISTER_VALUE",
L"WRITE_REGISTER",
L"WRITE_REGISTER_VALUE",
L"NOOP",
L"LOAD_VAR1",
L"LOAD_VAR2",
L"STORE_VAR1",
L"ADD",
L"SUBTRACT",
L"ADD_VALUE",
L"SUBTRACT_VALUE",
L"STALL",
L"STALL_WHILE_TRUE",
L"SKIP_NEXT_INSTRUCTION_IF_TRUE",
L"GOTO",
L"SET_SRC_ADDRESS_BASE",
L"SET_DST_ADDRESS_BASE",
L"MOVE_DATA"
}

An array of strings describing the Erst instructions

Definition at line 47 of file ErstParser.c.

◆ ErstParser

STATIC CONST ACPI_PARSER ErstParser[]
Initial value:
= {
PARSE_ACPI_HEADER (&AcpiHdrInfo),
{ L"Serialization Header Size", 4, 36, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reserved", 4, 40, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Instruction Entry Count", 4, 44, L"0x%x", NULL, (VOID **)&InstructionEntryCount, NULL, NULL }
}
#define PARSE_ACPI_HEADER(Info)
Definition: AcpiParser.h:501
#define NULL
Definition: Base.h:319

An ACPI_PARSER array describing the ACPI ERST Table.

Definition at line 210 of file ErstParser.c.

◆ InstructionEntryCount

STATIC UINT32* InstructionEntryCount

Definition at line 19 of file ErstParser.c.

◆ SerializationInstructionEntryParser

STATIC CONST ACPI_PARSER SerializationInstructionEntryParser[]
Initial value:
= {
{ L"Serialization Action", 1, 0, L"0x%x", DumpErstAction, NULL, ValidateErstAction, NULL },
{ L"Instruction", 1, 1, L"0x%x", DumpErstInstruction, NULL, ValidateErstInstruction, NULL },
{ L"Flags", 1, 2, L"0x%x", NULL, NULL, ValidateErstFlags, NULL },
{ L"Reserved", 1, 3, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Register Region", 12, 4, NULL, DumpGas, NULL, NULL, NULL },
{ L"Value", 8, 16, L"0x%llx", NULL, NULL, NULL, NULL },
{ L"Mask", 8, 24, L"0x%llx", NULL, NULL, NULL, NULL }
}
VOID EFIAPI DumpGas(IN CONST CHAR16 *Format OPTIONAL, IN UINT8 *Ptr, IN UINT32 Length)
Definition: AcpiParser.c:867
STATIC VOID EFIAPI DumpErstInstruction(IN CONST CHAR16 *Format OPTIONAL, IN UINT8 *Ptr, IN UINT32 Length)
Definition: ErstParser.c:198
STATIC VOID EFIAPI ValidateErstFlags(IN UINT8 *Ptr, IN UINT32 Length, IN VOID *Context)
Definition: ErstParser.c:126
STATIC VOID EFIAPI DumpErstAction(IN CONST CHAR16 *Format OPTIONAL, IN UINT8 *Ptr, IN UINT32 Length)
Definition: ErstParser.c:179
STATIC VOID EFIAPI ValidateErstAction(IN UINT8 *Ptr, IN UINT32 Length, IN VOID *Context)
Definition: ErstParser.c:80
STATIC VOID EFIAPI ValidateErstInstruction(IN UINT8 *Ptr, IN UINT32 Length, IN VOID *Context)
Definition: ErstParser.c:103

An ACPI_PARSER array describing the Serialization Instruction Entry structure.

Definition at line 220 of file ErstParser.c.