DynamicTablesPkg: Correct parser for X64 architecture objects

- Add array size to CmArchCommonSpmiInterfaceInfoParser
   to correctly parse the SPMI interface object.
- Use the size of enum values instead of fixed sizes.
- Apply #pragma pack to the X64 object structure
   to ensure the total size of the structure matches
   the parser's combined individual field sizes without padding.

Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Pierre Gondois <pierre.gondois@arm.com>
Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
This commit is contained in:
Abdul Lateef Attar 2024-11-30 06:40:48 +00:00 committed by mergify[bot]
parent cf8241facc
commit 95972f966e
2 changed files with 9 additions and 5 deletions

View File

@ -15,7 +15,10 @@
#ifndef X64_NAMESPACE_OBJECTS_H_
#define X64_NAMESPACE_OBJECTS_H_
#include <IndustryStandard/Acpi.h>
#include <AcpiObjects.h>
#include <StandardNameSpaceObjects.h>
#pragma pack(1)
/** The LOCAL_APIC_MODE enum describes the Local APIC
mode in the X64 Namespace
@ -262,4 +265,5 @@ typedef struct CmX64LocalApicX2ApicNmiInfo {
UINT8 LocalApicLint;
} CM_X64_LOCAL_APIC_X2APIC_NMI_INFO;
#pragma pack()
#endif // X64_NAMESPACE_OBJECTS_H_

View File

@ -682,7 +682,7 @@ STATIC CONST CM_OBJ_PARSER CmArchCommonTpm2InterfaceInfo[] = {
STATIC CONST CM_OBJ_PARSER CmArchCommonSpmiInterfaceInfoParser[] = {
{ "InterfaceType", sizeof (UINT8), "0x%x", NULL },
{ "BaseAddress", sizeof (EFI_ACPI_6_5_GENERIC_ADDRESS_STRUCTURE),
NULL, NULL, AcpiGenericAddressParser }
NULL, NULL, AcpiGenericAddressParser, ARRAY_SIZE (AcpiGenericAddressParser) },
};
/** A parser for EArchCommonObjSpmiInterruptDeviceInfo.
@ -887,9 +887,9 @@ STATIC CONST CM_OBJ_PARSER CmX64ObjHpetInfoParser[] = {
/** A parser for EX64ObjMadtInfo.
*/
STATIC CONST CM_OBJ_PARSER CmX64ObjMadtInfoParser[] = {
{ "LocalApicAddress", 4, "0x%x", NULL },
{ "Flags", 4, "0x%x", NULL },
{ "ApicMode", 1, "0x%x", NULL }
{ "LocalApicAddress", 4, "0x%x", NULL },
{ "Flags", 4, "0x%x", NULL },
{ "ApicMode", sizeof (LOCAL_APIC_MODE), "0x%x", NULL }
};
/** A parser for CmArchCommonLocalApicX2ApicInfoParser.