1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
/** @file
CCEL table parser
Copyright (c) 2025, Arm Limited. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
@par Reference(s):
- ACPI 6.5 Specification - 29 Aug 2022
**/
#include <IndustryStandard/Acpi.h>
#include <Library/UefiLib.h>
#include "AcpiParser.h"
#include "AcpiTableParser.h"
#include "AcpiViewConfig.h"
// Local variables.
STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo;
/**
Print the CC Type.
@param [in] Format Optional format string for tracing the data.
@param [in] Ptr Pointer to the start of the buffer.
@param [in] Length Length of the field.
**/
VOID
EFIAPI
PrintCcType (
IN CONST CHAR16 *Format OPTIONAL,
IN UINT8 *Ptr,
IN UINT32 Length
)
{
UINT8 CcType;
CcType = *Ptr;
switch (CcType) {
case EFI_ACPI_6_5_CC_TYPE_NONE:
Print (L"CC Type '%u' - None", CcType);
break;
case EFI_ACPI_6_5_CC_TYPE_SEV:
Print (L"CC Type '%u' - SEV", CcType);
break;
case EFI_ACPI_6_5_CC_TYPE_TDX:
Print (L"CC Type '%u' - TDX", CcType);
break;
case EFI_ACPI_6_5_CC_TYPE_APTEE:
Print (L"CC Type '%u' - APTEE", CcType);
break;
case EFI_ACPI_6_5_CC_TYPE_ARMCCA:
Print (L"CC Type '%u' - Arm CCA", CcType);
break;
default:
Print (L"CC Type '%u' - Unknown", CcType);
} // switch
}
/**
This function validates CC Type field.
@param [in] Ptr Pointer to the start of the field data.
@param [in] Length Length of the field.
@param [in] Context Pointer to context specific information.
**/
VOID
EFIAPI
ValidateCcType (
IN UINT8 *Ptr,
IN UINT32 Length,
IN VOID *Context
)
{
UINT8 CcType;
CcType = *Ptr;
if (CcType > EFI_ACPI_6_5_CC_TYPE_ARMCCA) {
IncrementErrorCount ();
Print (L"\nERROR : Invalid/Unknown CC Type - %u.\n", CcType);
}
}
/**
An ACPI_PARSER array describing the ACPI CCEL Table.
**/
STATIC CONST ACPI_PARSER CcelParser[] = {
PARSE_ACPI_HEADER (&AcpiHdrInfo),
{ L"CC Type", 1, 36, L"%d", NULL, NULL, NULL, NULL },
{ L"CC Subtype", 1, 37, L"%d", PrintCcType, NULL, ValidateCcType, NULL },
{ L"Reserved", 2, 38, NULL, DumpReserved, NULL, ValidateReserved, NULL },
{ L"Log Area Minimum Length (LAML)",8, 40, L"0x%lx", NULL, NULL, NULL, NULL },
{ L"Log Area Start Address (LASA)",8, 48, L"0x%lx", NULL, NULL, NULL, NULL }
};
/**
This function parses the ACPI CCEL table.
When trace is enabled this function parses the CCEL table and
traces the ACPI table fields.
@param [in] Trace If TRUE, trace the ACPI fields.
@param [in] Ptr Pointer to the start of the buffer.
@param [in] AcpiTableLength Length of the ACPI table.
@param [in] AcpiTableRevision Revision of the ACPI table.
**/
VOID
EFIAPI
ParseAcpiCcel (
IN BOOLEAN Trace,
IN UINT8 *Ptr,
IN UINT32 AcpiTableLength,
IN UINT8 AcpiTableRevision
)
{
if (!Trace) {
return;
}
ParseAcpi (
TRUE,
0,
"CCEL",
Ptr,
AcpiTableLength,
PARSER_PARAMS (CcelParser)
);
}
|