summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNickle Wang <nicklew@nvidia.com>2023-05-29 11:49:39 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-05-30 03:12:47 +0000
commit9d9761af50e538d983e00b1cb2d0ffcee261e552 (patch)
treecd9cffcfaf330a90f31c55b2bc3dc22b62410ffb
parent1034d223f8cc6bf8b9b86c57e564753cdad46f88 (diff)
downloadedk2-9d9761af50e538d983e00b1cb2d0ffcee261e552.tar.gz
edk2-9d9761af50e538d983e00b1cb2d0ffcee261e552.tar.bz2
edk2-9d9761af50e538d983e00b1cb2d0ffcee261e552.zip
RedfishPkg/RedfishPlatformConfigDxe: fix value type issue.
Fix incorrect value type issue for checked-box op-code. When the variable for checked-box is defined as UINT8 in varstore structure, IFR compiler assign its value type to EFI_IFR_TYPE_NUM_SIZE_8 instead of EFI_IFR_TYPE_BOOLEAN. However, the value type for checked-box is boolean value. Redfish service may return error because of incorrect value type passed to BIOS attribute registry. Signed-off-by: Nickle Wang <nicklew@nvidia.com> Cc: Abner Chang <abner.chang@amd.com> Cc: Igor Kulchytskyy <igork@ami.com> Reviewed-by: Abner Chang <abner.chang@amd.com>
-rw-r--r--RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
index 1172d1094b..462f269f6a 100644
--- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
+++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
@@ -1221,6 +1221,16 @@ HiiValueToRedfishValue (
RedfishValue->Type = RedfishValueTypeString;
break;
case EFI_IFR_CHECKBOX_OP:
+ //
+ // There is case where HII driver defines UINT8 for checked-box opcode storage.
+ // IFR compiler will assign EFI_IFR_TYPE_NUM_SIZE_8 to its value type instead of
+ // EFI_IFR_TYPE_BOOLEAN. We do a patch here and use boolean value type for this
+ // case.
+ //
+ if (Value->Type != EFI_IFR_TYPE_BOOLEAN) {
+ Value->Type = EFI_IFR_TYPE_BOOLEAN;
+ }
+
case EFI_IFR_NUMERIC_OP:
Status = HiiValueToRedfishNumeric (Value, RedfishValue);
if (EFI_ERROR (Status)) {