From fc31c0d4dbeaae0f23ccdccdabb97478326d2a9a Mon Sep 17 00:00:00 2001 From: Kun Qin Date: Fri, 26 Apr 2024 13:25:17 -0700 Subject: [PATCH] This should do better? --- .../Include/Library/MfciDeviceIdSupportLib.h | 12 +++++++++++ .../MfciDeviceIdSupportLibNull.c | 2 ++ .../MfciDeviceIdSupportLibSmbios.c | 8 +++++++ MfciPkg/MfciDxe/MfciDxe.c | 21 ------------------- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/MfciPkg/Include/Library/MfciDeviceIdSupportLib.h b/MfciPkg/Include/Library/MfciDeviceIdSupportLib.h index b0b95dc42e..859364120f 100644 --- a/MfciPkg/Include/Library/MfciDeviceIdSupportLib.h +++ b/MfciPkg/Include/Library/MfciDeviceIdSupportLib.h @@ -130,4 +130,16 @@ MfciIdSupportGetOem2 ( OUT UINTN *Oem2Size OPTIONAL ); +// +// The following helps iterate over the functions and set the corresponding target variable names. +// + +// define a structure that pairs up the function pointer with the UEFI variable name +typedef struct { + MFCI_DEVICE_ID_FN DeviceIdFn; + CHAR16 *DeviceIdVarName; +} MFCI_DEVICE_ID_FN_TO_VAR_NAME_MAP; + +extern CONST MFCI_DEVICE_ID_FN_TO_VAR_NAME_MAP gDeviceIdFnToTargetVarNameMap[]; + #endif //MFCI_DEVICE_ID_SUPPORT_LIB_H_ diff --git a/MfciPkg/Library/MfciDeviceIdSupportLibNull/MfciDeviceIdSupportLibNull.c b/MfciPkg/Library/MfciDeviceIdSupportLibNull/MfciDeviceIdSupportLibNull.c index 55cb0fa7cd..7bb3492166 100644 --- a/MfciPkg/Library/MfciDeviceIdSupportLibNull/MfciDeviceIdSupportLibNull.c +++ b/MfciPkg/Library/MfciDeviceIdSupportLibNull/MfciDeviceIdSupportLibNull.c @@ -13,6 +13,8 @@ #include #include +CONST MFCI_DEVICE_ID_FN_TO_VAR_NAME_MAP gDeviceIdFnToTargetVarNameMap[]; + /** * Get the Manufacturer Name * diff --git a/MfciPkg/Library/MfciDeviceIdSupportLibSmbios/MfciDeviceIdSupportLibSmbios.c b/MfciPkg/Library/MfciDeviceIdSupportLibSmbios/MfciDeviceIdSupportLibSmbios.c index 2f9bda21d7..70def36c84 100644 --- a/MfciPkg/Library/MfciDeviceIdSupportLibSmbios/MfciDeviceIdSupportLibSmbios.c +++ b/MfciPkg/Library/MfciDeviceIdSupportLibSmbios/MfciDeviceIdSupportLibSmbios.c @@ -21,6 +21,14 @@ #define ID_NOT_FOUND "Not Found" +CONST MFCI_DEVICE_ID_FN_TO_VAR_NAME_MAP gDeviceIdFnToTargetVarNameMap[] = { + { MfciIdSupportGetManufacturer, MFCI_MANUFACTURER_VARIABLE_NAME }, + { MfciIdSupportGetProductName, MFCI_PRODUCT_VARIABLE_NAME }, + { MfciIdSupportGetSerialNumber, MFCI_SERIALNUMBER_VARIABLE_NAME }, + { MfciIdSupportGetOem1, MFCI_OEM_01_VARIABLE_NAME }, + { MfciIdSupportGetOem2, MFCI_OEM_02_VARIABLE_NAME } +}; + // Note: This protocol will guarantee to be met by the Depex and located at the // constructor of this library, thus no null-pointer check in library code flow. EFI_SMBIOS_PROTOCOL *mSmbiosProtocol; diff --git a/MfciPkg/MfciDxe/MfciDxe.c b/MfciPkg/MfciDxe/MfciDxe.c index 3b05d72f8c..cebd8d796a 100644 --- a/MfciPkg/MfciDxe/MfciDxe.c +++ b/MfciPkg/MfciDxe/MfciDxe.c @@ -31,27 +31,6 @@ #include "MfciDxe.h" -// -// The following helps iterate over the functions and set the corresponding target variable names. -// - -// define a structure that pairs up the function pointer with the UEFI variable name -typedef struct { - MFCI_DEVICE_ID_FN DeviceIdFn; - CHAR16 *DeviceIdVarName; -} MFCI_DEVICE_ID_FN_TO_VAR_NAME_MAP; - -// populate the array of structures that pair up the functions with variable names -#define MFCI_TARGET_VAR_COUNT 5 - -STATIC CONST MFCI_DEVICE_ID_FN_TO_VAR_NAME_MAP gDeviceIdFnToTargetVarNameMap[MFCI_TARGET_VAR_COUNT] = { - { MfciIdSupportGetManufacturer, MFCI_MANUFACTURER_VARIABLE_NAME }, - { MfciIdSupportGetProductName, MFCI_PRODUCT_VARIABLE_NAME }, - { MfciIdSupportGetSerialNumber, MFCI_SERIALNUMBER_VARIABLE_NAME }, - { MfciIdSupportGetOem1, MFCI_OEM_01_VARIABLE_NAME }, - { MfciIdSupportGetOem2, MFCI_OEM_02_VARIABLE_NAME } -}; - MFCI_POLICY_TYPE mCurrentPolicy; BOOLEAN mVarPolicyRegistered;