Skip to content

Commit

Permalink
DynamicTablesPkg: Correct parser for X64 architecture objects
Browse files Browse the repository at this point in the history
- 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 <[email protected]>
Cc: Pierre Gondois <[email protected]>
Signed-off-by: Abdul Lateef Attar <[email protected]>
  • Loading branch information
Abdul Lateef Attar authored and mergify[bot] committed Dec 11, 2024
1 parent cf8241f commit 95972f9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 5 additions & 1 deletion DynamicTablesPkg/Include/X64NameSpaceObjects.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -262,4 +265,5 @@ typedef struct CmX64LocalApicX2ApicNmiInfo {
UINT8 LocalApicLint;
} CM_X64_LOCAL_APIC_X2APIC_NMI_INFO;

#pragma pack()
#endif // X64_NAMESPACE_OBJECTS_H_
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 95972f9

Please sign in to comment.