From 9e83101fdfdbe97c9d5b9586b69a8444bb49584b Mon Sep 17 00:00:00 2001 From: Dongyan Qian Date: Mon, 13 Jul 2026 16:47:38 +0800 Subject: [PATCH] DynamicTablesPkg/Smbios: Use EFIAPI for extended callbacks The SMBIOS_TABLE_GENERATOR_BUILD_TABLEEX and SMBIOS_TABLE_GENERATOR_FREE_TABLEEX callback types do not specify EFIAPI. The Type 37 implementations specify it, while the other extended callback implementations follow the omission in the shared types. For X64 GCC builds, BaseTools/Conf/tools_def.template adds -DEFIAPI=__attribute__((ms_abi)). Therefore, callbacks marked with EFIAPI use the Microsoft x64 ABI, while unannotated callback types use the compiler default ABI. If the two sides differ, the caller and callee use different argument registers, and GCC rejects the function pointer assignment. This mismatch remained hidden while the standalone Type 37 generator was built only for AARCH64. Moving the SMBIOS generators to the common component section adds X64 build coverage and exposes it. Add EFIAPI to the extended callback types and all matching implementations. This follows the ACPI generator callback convention and provides the ABI prerequisite for expanding the SMBIOS standalone build coverage. Signed-off-by: Dongyan Qian --- DynamicTablesPkg/Include/SmbiosTableGenerator.h | 4 ++-- .../Library/Smbios/SmbiosType16Lib/SmbiosType16Generator.c | 2 ++ .../Library/Smbios/SmbiosType17Lib/SmbiosType17Generator.c | 2 ++ .../Library/Smbios/SmbiosType19Lib/SmbiosType19Generator.c | 2 ++ .../Library/Smbios/SmbiosType20Lib/SmbiosType20Generator.c | 2 ++ .../Library/Smbios/SmbiosType26Lib/SmbiosType26Generator.c | 2 ++ .../Library/Smbios/SmbiosType27Lib/SmbiosType27Generator.c | 2 ++ .../Library/Smbios/SmbiosType28Lib/SmbiosType28Generator.c | 2 ++ .../Library/Smbios/SmbiosType29Lib/SmbiosType29Generator.c | 2 ++ .../Library/Smbios/SmbiosType44Lib/SmbiosType44Generator.c | 2 ++ .../Library/Smbios/SmbiosType4Lib/SmbiosType4Generator.c | 2 ++ .../Library/Smbios/SmbiosType7Lib/SmbiosType7Generator.c | 2 ++ 12 files changed, 24 insertions(+), 2 deletions(-) diff --git a/DynamicTablesPkg/Include/SmbiosTableGenerator.h b/DynamicTablesPkg/Include/SmbiosTableGenerator.h index 70133554da..62ab4e593f 100644 --- a/DynamicTablesPkg/Include/SmbiosTableGenerator.h +++ b/DynamicTablesPkg/Include/SmbiosTableGenerator.h @@ -211,7 +211,7 @@ typedef EFI_STATUS (*SMBIOS_TABLE_GENERATOR_FREE_TABLE) ( @return EFI_SUCCESS If the table is generated successfully or other failure codes as returned by the generator. **/ -typedef EFI_STATUS (*SMBIOS_TABLE_GENERATOR_BUILD_TABLEEX) ( +typedef EFI_STATUS (EFIAPI *SMBIOS_TABLE_GENERATOR_BUILD_TABLEEX)( IN CONST SMBIOS_TABLE_GENERATOR *Generator, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol, IN CM_STD_OBJ_SMBIOS_TABLE_INFO *CONST SmbiosTableInfo, @@ -239,7 +239,7 @@ typedef EFI_STATUS (*SMBIOS_TABLE_GENERATOR_BUILD_TABLEEX) ( @return EFI_SUCCESS If freed successfully or other failure codes as returned by the generator. **/ -typedef EFI_STATUS (*SMBIOS_TABLE_GENERATOR_FREE_TABLEEX) ( +typedef EFI_STATUS (EFIAPI *SMBIOS_TABLE_GENERATOR_FREE_TABLEEX)( IN CONST SMBIOS_TABLE_GENERATOR *Generator, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol, IN CONST CM_STD_OBJ_SMBIOS_TABLE_INFO *CONST SmbiosTableInfo, diff --git a/DynamicTablesPkg/Library/Smbios/SmbiosType16Lib/SmbiosType16Generator.c b/DynamicTablesPkg/Library/Smbios/SmbiosType16Lib/SmbiosType16Generator.c index e8af2a5df8..ad6a62f124 100644 --- a/DynamicTablesPkg/Library/Smbios/SmbiosType16Lib/SmbiosType16Generator.c +++ b/DynamicTablesPkg/Library/Smbios/SmbiosType16Lib/SmbiosType16Generator.c @@ -58,6 +58,7 @@ GET_OBJECT_LIST ( **/ STATIC EFI_STATUS +EFIAPI FreeSmbiosType16TableEx ( IN CONST SMBIOS_TABLE_GENERATOR *CONST This, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol, @@ -161,6 +162,7 @@ AddMemErrDeviceHandle ( **/ STATIC EFI_STATUS +EFIAPI BuildSmbiosType16TableEx ( IN CONST SMBIOS_TABLE_GENERATOR *This, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol, diff --git a/DynamicTablesPkg/Library/Smbios/SmbiosType17Lib/SmbiosType17Generator.c b/DynamicTablesPkg/Library/Smbios/SmbiosType17Lib/SmbiosType17Generator.c index 34a6ca8723..e40d8c9201 100644 --- a/DynamicTablesPkg/Library/Smbios/SmbiosType17Lib/SmbiosType17Generator.c +++ b/DynamicTablesPkg/Library/Smbios/SmbiosType17Lib/SmbiosType17Generator.c @@ -57,6 +57,7 @@ GET_OBJECT_LIST ( **/ STATIC EFI_STATUS +EFIAPI FreeSmbiosType17TableEx ( IN CONST SMBIOS_TABLE_GENERATOR *CONST This, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol, @@ -250,6 +251,7 @@ UpdateSmbiosType17Rank ( **/ STATIC EFI_STATUS +EFIAPI BuildSmbiosType17TableEx ( IN CONST SMBIOS_TABLE_GENERATOR *This, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol, diff --git a/DynamicTablesPkg/Library/Smbios/SmbiosType19Lib/SmbiosType19Generator.c b/DynamicTablesPkg/Library/Smbios/SmbiosType19Lib/SmbiosType19Generator.c index 855c6bb6c9..8c4f4742d6 100644 --- a/DynamicTablesPkg/Library/Smbios/SmbiosType19Lib/SmbiosType19Generator.c +++ b/DynamicTablesPkg/Library/Smbios/SmbiosType19Lib/SmbiosType19Generator.c @@ -58,6 +58,7 @@ GET_OBJECT_LIST ( **/ STATIC EFI_STATUS +EFIAPI FreeSmbiosType19TableEx ( IN CONST SMBIOS_TABLE_GENERATOR *CONST This, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol, @@ -177,6 +178,7 @@ UpdateSmbiosType19Address ( **/ STATIC EFI_STATUS +EFIAPI BuildSmbiosType19TableEx ( IN CONST SMBIOS_TABLE_GENERATOR *This, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol, diff --git a/DynamicTablesPkg/Library/Smbios/SmbiosType20Lib/SmbiosType20Generator.c b/DynamicTablesPkg/Library/Smbios/SmbiosType20Lib/SmbiosType20Generator.c index 3b7d0e8919..56221e397a 100644 --- a/DynamicTablesPkg/Library/Smbios/SmbiosType20Lib/SmbiosType20Generator.c +++ b/DynamicTablesPkg/Library/Smbios/SmbiosType20Lib/SmbiosType20Generator.c @@ -59,6 +59,7 @@ GET_OBJECT_LIST ( **/ STATIC EFI_STATUS +EFIAPI FreeSmbiosType20TableEx ( IN CONST SMBIOS_TABLE_GENERATOR *CONST This, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol, @@ -112,6 +113,7 @@ FreeSmbiosType20TableEx ( **/ STATIC EFI_STATUS +EFIAPI BuildSmbiosType20TableEx ( IN CONST SMBIOS_TABLE_GENERATOR *This, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol, diff --git a/DynamicTablesPkg/Library/Smbios/SmbiosType26Lib/SmbiosType26Generator.c b/DynamicTablesPkg/Library/Smbios/SmbiosType26Lib/SmbiosType26Generator.c index af617ab4a9..be3f4516b5 100644 --- a/DynamicTablesPkg/Library/Smbios/SmbiosType26Lib/SmbiosType26Generator.c +++ b/DynamicTablesPkg/Library/Smbios/SmbiosType26Lib/SmbiosType26Generator.c @@ -111,6 +111,7 @@ IsValidVoltageProbeLocation ( **/ STATIC EFI_STATUS +EFIAPI FreeSmbiosType26TableEx ( IN CONST SMBIOS_TABLE_GENERATOR *CONST This, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol, @@ -168,6 +169,7 @@ FreeSmbiosType26TableEx ( **/ STATIC EFI_STATUS +EFIAPI BuildSmbiosType26TableEx ( IN CONST SMBIOS_TABLE_GENERATOR *This, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol, diff --git a/DynamicTablesPkg/Library/Smbios/SmbiosType27Lib/SmbiosType27Generator.c b/DynamicTablesPkg/Library/Smbios/SmbiosType27Lib/SmbiosType27Generator.c index 48acc82278..6a4ccb44c8 100644 --- a/DynamicTablesPkg/Library/Smbios/SmbiosType27Lib/SmbiosType27Generator.c +++ b/DynamicTablesPkg/Library/Smbios/SmbiosType27Lib/SmbiosType27Generator.c @@ -159,6 +159,7 @@ AddTemperatureProbeHandle ( **/ STATIC EFI_STATUS +EFIAPI FreeSmbiosType27TableEx ( IN CONST SMBIOS_TABLE_GENERATOR *CONST This, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol, @@ -216,6 +217,7 @@ FreeSmbiosType27TableEx ( **/ STATIC EFI_STATUS +EFIAPI BuildSmbiosType27TableEx ( IN CONST SMBIOS_TABLE_GENERATOR *This, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol, diff --git a/DynamicTablesPkg/Library/Smbios/SmbiosType28Lib/SmbiosType28Generator.c b/DynamicTablesPkg/Library/Smbios/SmbiosType28Lib/SmbiosType28Generator.c index db664c5afc..fc56f88f98 100644 --- a/DynamicTablesPkg/Library/Smbios/SmbiosType28Lib/SmbiosType28Generator.c +++ b/DynamicTablesPkg/Library/Smbios/SmbiosType28Lib/SmbiosType28Generator.c @@ -111,6 +111,7 @@ IsValidTemperatureProbeLocation ( **/ STATIC EFI_STATUS +EFIAPI FreeSmbiosType28TableEx ( IN CONST SMBIOS_TABLE_GENERATOR *CONST This, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol, @@ -168,6 +169,7 @@ FreeSmbiosType28TableEx ( **/ STATIC EFI_STATUS +EFIAPI BuildSmbiosType28TableEx ( IN CONST SMBIOS_TABLE_GENERATOR *This, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol, diff --git a/DynamicTablesPkg/Library/Smbios/SmbiosType29Lib/SmbiosType29Generator.c b/DynamicTablesPkg/Library/Smbios/SmbiosType29Lib/SmbiosType29Generator.c index 6790162fcf..2d29a8cb41 100644 --- a/DynamicTablesPkg/Library/Smbios/SmbiosType29Lib/SmbiosType29Generator.c +++ b/DynamicTablesPkg/Library/Smbios/SmbiosType29Lib/SmbiosType29Generator.c @@ -111,6 +111,7 @@ IsValidElectricalCurrentProbeLocation ( **/ STATIC EFI_STATUS +EFIAPI FreeSmbiosType29TableEx ( IN CONST SMBIOS_TABLE_GENERATOR *CONST This, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol, @@ -168,6 +169,7 @@ FreeSmbiosType29TableEx ( **/ STATIC EFI_STATUS +EFIAPI BuildSmbiosType29TableEx ( IN CONST SMBIOS_TABLE_GENERATOR *This, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol, diff --git a/DynamicTablesPkg/Library/Smbios/SmbiosType44Lib/SmbiosType44Generator.c b/DynamicTablesPkg/Library/Smbios/SmbiosType44Lib/SmbiosType44Generator.c index f130ef5f0f..20436eed0d 100644 --- a/DynamicTablesPkg/Library/Smbios/SmbiosType44Lib/SmbiosType44Generator.c +++ b/DynamicTablesPkg/Library/Smbios/SmbiosType44Lib/SmbiosType44Generator.c @@ -757,6 +757,7 @@ STATIC PROCESSOR_SPECIFIC_BLOCK_OPS mProcSpecificBlockOps[] = { **/ STATIC EFI_STATUS +EFIAPI FreeSmbiosType44TableEx ( IN CONST SMBIOS_TABLE_GENERATOR *CONST This, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol, @@ -810,6 +811,7 @@ FreeSmbiosType44TableEx ( **/ STATIC EFI_STATUS +EFIAPI BuildSmbiosType44TableEx ( IN CONST SMBIOS_TABLE_GENERATOR *This, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol, diff --git a/DynamicTablesPkg/Library/Smbios/SmbiosType4Lib/SmbiosType4Generator.c b/DynamicTablesPkg/Library/Smbios/SmbiosType4Lib/SmbiosType4Generator.c index 462ebeb8f2..676357498c 100644 --- a/DynamicTablesPkg/Library/Smbios/SmbiosType4Lib/SmbiosType4Generator.c +++ b/DynamicTablesPkg/Library/Smbios/SmbiosType4Lib/SmbiosType4Generator.c @@ -69,6 +69,7 @@ GET_OBJECT_LIST ( **/ STATIC EFI_STATUS +EFIAPI FreeSmbiosType4TableEx ( IN CONST SMBIOS_TABLE_GENERATOR *CONST This, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol, @@ -157,6 +158,7 @@ FindProcHierarchyInfoFromToken ( **/ STATIC EFI_STATUS +EFIAPI BuildSmbiosType4TableEx ( IN CONST SMBIOS_TABLE_GENERATOR *This, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol, diff --git a/DynamicTablesPkg/Library/Smbios/SmbiosType7Lib/SmbiosType7Generator.c b/DynamicTablesPkg/Library/Smbios/SmbiosType7Lib/SmbiosType7Generator.c index 3bb3fee11d..2592a2fdca 100644 --- a/DynamicTablesPkg/Library/Smbios/SmbiosType7Lib/SmbiosType7Generator.c +++ b/DynamicTablesPkg/Library/Smbios/SmbiosType7Lib/SmbiosType7Generator.c @@ -79,6 +79,7 @@ GET_OBJECT_LIST ( **/ STATIC EFI_STATUS +EFIAPI FreeSmbiosType7TableEx ( IN CONST SMBIOS_TABLE_GENERATOR *CONST This, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol, @@ -411,6 +412,7 @@ FindExistingCacheRecord ( **/ STATIC EFI_STATUS +EFIAPI BuildSmbiosType7TableEx ( IN CONST SMBIOS_TABLE_GENERATOR *This, IN CONST EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL *CONST TableFactoryProtocol,