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

Go to the source code of this file.

Functions

STATIC VOID EFIAPI ValidateSratReserved (IN UINT8 *Ptr, IN UINT32 Length, IN VOID *Context)
 
STATIC VOID EFIAPI ValidateSratDeviceHandleType (IN UINT8 *Ptr, IN UINT32 Length, IN VOID *Context)
 
STATIC VOID EFIAPI DumpSratPciBdfNumber (IN CONST CHAR16 *Format, IN UINT8 *Ptr, IN UINT32 Length)
 
STATIC VOID EFIAPI DumpSratDeviceHandle (IN CONST CHAR16 *Format, IN UINT8 *Ptr, IN UINT32 Length)
 
STATIC VOID EFIAPI DumpSratApicProximity (IN CONST CHAR16 *Format, IN UINT8 *Ptr, IN UINT32 Length)
 
VOID EFIAPI ParseAcpiSrat (IN BOOLEAN Trace, IN UINT8 *Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision)
 

Variables

STATIC CONST UINT8 * SratRAType
 
STATIC CONST UINT8 * SratRALength
 
STATIC CONST UINT8 * SratDeviceHandleType
 
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo
 
STATIC CONST ACPI_PARSER SratDeviceHandleAcpiParser []
 
STATIC CONST ACPI_PARSER SratDeviceHandlePciParser []
 
STATIC CONST ACPI_PARSER SratParser []
 
STATIC CONST ACPI_PARSER SratResourceAllocationParser []
 
STATIC CONST ACPI_PARSER SratGicCAffinityParser []
 
STATIC CONST ACPI_PARSER SratGicITSAffinityParser []
 
STATIC CONST ACPI_PARSER SratGenericInitiatorAffinityParser []
 
STATIC CONST ACPI_PARSER SratMemAffinityParser []
 
STATIC CONST ACPI_PARSER SratApciSapicAffinityParser []
 
STATIC CONST ACPI_PARSER SratX2ApciAffinityParser []
 

Detailed Description

SRAT table parser

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

Reference(s):
  • ACPI 6.3 Specification - January 2019

Definition in file SratParser.c.

Function Documentation

◆ DumpSratApicProximity()

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

This function traces the APIC Proximity Domain field.

Parameters
[in]FormatFormat string for tracing the data.
[in]PtrPointer to the start of the buffer.
[in]LengthLength of the field.

Definition at line 224 of file SratParser.c.

◆ DumpSratDeviceHandle()

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

This function traces the Device Handle field inside Generic Initiator Affinity Structure.

Parameters
[in]FormatFormat string for tracing the data.
[in]PtrPointer to the start of the buffer.
[in]LengthLength of the field.

Definition at line 179 of file SratParser.c.

◆ DumpSratPciBdfNumber()

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

This function traces the PCI BDF Number field inside Device Handle - PCI

Parameters
[in]FormatFormat string for tracing the data.
[in]PtrPointer to the start of the buffer.
[in]LengthLength of the field.

Definition at line 89 of file SratParser.c.

◆ ParseAcpiSrat()

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

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

This function parses the following Resource Allocation Structures:

  • Processor Local APIC/SAPIC Affinity Structure
  • Memory Affinity Structure
  • Processor Local x2APIC Affinity Structure
  • GICC Affinity Structure

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 364 of file SratParser.c.

◆ ValidateSratDeviceHandleType()

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

This function validates the Device Handle Type field in the Generic Initiator Affinity Structure.

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 59 of file SratParser.c.

◆ ValidateSratReserved()

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

This function validates the Reserved field in the SRAT table header.

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 35 of file SratParser.c.

Variable Documentation

◆ AcpiHdrInfo

Definition at line 22 of file SratParser.c.

◆ SratApciSapicAffinityParser

STATIC CONST ACPI_PARSER SratApciSapicAffinityParser[]
Initial value:
= {
{ L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Proximity Domain [7:0]", 1, 2, L"0x%x", NULL, NULL, NULL, NULL },
{ L"APIC ID", 1, 3, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Flags", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Local SAPIC EID", 1, 8, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Proximity Domain [31:8]", 3, 9, L"0x%x", DumpSratApicProximity,
NULL, NULL, NULL },
{ L"Clock Domain", 4, 12, L"0x%x", NULL, NULL, NULL, NULL }
}
#define NULL
Definition: Base.h:319
STATIC VOID EFIAPI DumpSratApicProximity(IN CONST CHAR16 *Format, IN UINT8 *Ptr, IN UINT32 Length)
Definition: SratParser.c:224

An ACPI_PARSER array describing the APIC/SAPIC Affinity structure.

Definition at line 316 of file SratParser.c.

◆ SratDeviceHandleAcpiParser

STATIC CONST ACPI_PARSER SratDeviceHandleAcpiParser[]
Initial value:
= {
{ L"ACPI_HID", 8, 0, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"ACPI_UID", 4, 8, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reserved", 4, 12, L"0x%x", NULL, NULL, NULL, NULL }
}

An ACPI_PARSER array describing the Device Handle - ACPI

Definition at line 152 of file SratParser.c.

◆ SratDeviceHandlePciParser

STATIC CONST ACPI_PARSER SratDeviceHandlePciParser[]
Initial value:
= {
{ L"PCI Segment", 2, 0, L"0x%x", NULL, NULL, NULL, NULL },
{ L"PCI BDF Number", 2, 2, NULL, DumpSratPciBdfNumber, NULL, NULL, NULL },
{ L"Reserved", 12, 4, L"%x %x %x %x - %x %x %x %x - %x %x %x %x", Dump12Chars,
}
VOID EFIAPI Dump12Chars(IN CONST CHAR16 *Format OPTIONAL, IN UINT8 *Ptr, IN UINT32 Length)
Definition: AcpiParser.c:439
STATIC VOID EFIAPI DumpSratPciBdfNumber(IN CONST CHAR16 *Format, IN UINT8 *Ptr, IN UINT32 Length)
Definition: SratParser.c:89

An ACPI_PARSER array describing the Device Handle - PCI

Definition at line 161 of file SratParser.c.

◆ SratDeviceHandleType

STATIC CONST UINT8* SratDeviceHandleType

Definition at line 21 of file SratParser.c.

◆ SratGenericInitiatorAffinityParser

STATIC CONST ACPI_PARSER SratGenericInitiatorAffinityParser[]
Initial value:
= {
{ L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reserved", 1, 2, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Device Handle Type", 1, 3, L"%d", NULL, (VOID **)&SratDeviceHandleType,
{ L"Proximity Domain", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Device Handle", 16, 8, L"%s", DumpSratDeviceHandle, NULL, NULL, NULL },
{ L"Flags", 4, 24, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reserved", 4, 28, L"0x%x", NULL, NULL, NULL, NULL }
}
STATIC VOID EFIAPI DumpSratDeviceHandle(IN CONST CHAR16 *Format, IN UINT8 *Ptr, IN UINT32 Length)
Definition: SratParser.c:179
STATIC VOID EFIAPI ValidateSratDeviceHandleType(IN UINT8 *Ptr, IN UINT32 Length, IN VOID *Context)
Definition: SratParser.c:59

An ACPI_PARSER array describing the Generic Initiator Affinity Structure

Definition at line 282 of file SratParser.c.

◆ SratGicCAffinityParser

STATIC CONST ACPI_PARSER SratGicCAffinityParser[]
Initial value:
= {
{ L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Proximity Domain", 4, 2, L"0x%x", NULL, NULL, NULL, NULL },
{ L"ACPI Processor UID", 4, 6, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Flags", 4, 10, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Clock Domain", 4, 14, L"0x%x", NULL, NULL, NULL, NULL }
}

An ACPI_PARSER array describing the GICC Affinity structure.

Definition at line 257 of file SratParser.c.

◆ SratGicITSAffinityParser

STATIC CONST ACPI_PARSER SratGicITSAffinityParser[]
Initial value:
= {
{ L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Proximity Domain", 4, 2, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reserved", 2, 6, L"0x%x", NULL, NULL, NULL, NULL },
{ L"ITS Id", 4, 8, L"0x%x", NULL, NULL, NULL, NULL },
}

An ACPI_PARSER array describing the GIC ITS Affinity structure.

Definition at line 270 of file SratParser.c.

◆ SratMemAffinityParser

STATIC CONST ACPI_PARSER SratMemAffinityParser[]
Initial value:
= {
{ L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Proximity Domain", 4, 2, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reserved", 2, 6, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Base Address Low", 4, 8, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Base Address High", 4, 12, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Length Low", 4, 16, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Length High", 4, 20, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reserved", 4, 24, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Flags", 4, 28, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reserved", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL }
}

An ACPI_PARSER array describing the Memory Affinity structure.

Definition at line 298 of file SratParser.c.

◆ SratParser

STATIC CONST ACPI_PARSER SratParser[]
Initial value:
= {
PARSE_ACPI_HEADER (&AcpiHdrInfo),
{ L"Reserved", 4, 36, L"0x%x", NULL, NULL, ValidateSratReserved, NULL },
{ L"Reserved", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL }
}
#define PARSE_ACPI_HEADER(Info)
Definition: AcpiParser.h:501
STATIC VOID EFIAPI ValidateSratReserved(IN UINT8 *Ptr, IN UINT32 Length, IN VOID *Context)
Definition: SratParser.c:35

An ACPI_PARSER array describing the SRAT Table.

Definition at line 240 of file SratParser.c.

◆ SratRALength

STATIC CONST UINT8* SratRALength

Definition at line 20 of file SratParser.c.

◆ SratRAType

STATIC CONST UINT8* SratRAType

Definition at line 19 of file SratParser.c.

◆ SratResourceAllocationParser

STATIC CONST ACPI_PARSER SratResourceAllocationParser[]
Initial value:
= {
{ L"Type", 1, 0, NULL, NULL, (VOID **)&SratRAType, NULL, NULL },
{ L"Length", 1, 1, NULL, NULL, (VOID **)&SratRALength, NULL, NULL }
}

An ACPI_PARSER array describing the Resource Allocation structure header.

Definition at line 249 of file SratParser.c.

◆ SratX2ApciAffinityParser

STATIC CONST ACPI_PARSER SratX2ApciAffinityParser[]
Initial value:
= {
{ L"Type", 1, 0, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Length", 1, 1, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reserved", 2, 2, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Proximity Domain", 4, 4, L"0x%x", NULL, NULL, NULL, NULL },
{ L"X2APIC ID", 4, 8, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Flags", 4, 12, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Clock Domain", 4, 16, L"0x%x", NULL, NULL, NULL, NULL },
{ L"Reserved", 4, 20, L"0x%x", NULL, NULL, NULL, NULL }
}

An ACPI_PARSER array describing the Processor Local x2APIC Affinity structure.

Definition at line 332 of file SratParser.c.