Skip to content

Commit

Permalink
This should do better?
Browse files Browse the repository at this point in the history
  • Loading branch information
kuqin12 committed Apr 26, 2024
1 parent 9bb9aaa commit fc31c0d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
12 changes: 12 additions & 0 deletions MfciPkg/Include/Library/MfciDeviceIdSupportLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>

CONST MFCI_DEVICE_ID_FN_TO_VAR_NAME_MAP gDeviceIdFnToTargetVarNameMap[];

/**
* Get the Manufacturer Name
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
21 changes: 0 additions & 21 deletions MfciPkg/MfciDxe/MfciDxe.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit fc31c0d

Please sign in to comment.