* [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix value type issue.
@ 2023-05-29 6:24 Nickle Wang
2023-05-29 8:10 ` Chang, Abner
2023-05-30 14:28 ` Igor Kulchytskyy
0 siblings, 2 replies; 3+ messages in thread
From: Nickle Wang @ 2023-05-29 6:24 UTC (permalink / raw)
To: devel; +Cc: Abner Chang, Igor Kulchytskyy
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>
---
.../RedfishPlatformConfigDxe.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
index 1172d1094b06..462f269f6a3f 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)) {
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix value type issue.
2023-05-29 6:24 [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix value type issue Nickle Wang
@ 2023-05-29 8:10 ` Chang, Abner
2023-05-30 14:28 ` Igor Kulchytskyy
1 sibling, 0 replies; 3+ messages in thread
From: Chang, Abner @ 2023-05-29 8:10 UTC (permalink / raw)
To: Nickle Wang, devel@edk2.groups.io; +Cc: Igor Kulchytskyy
[AMD Official Use Only - General]
Reviewed-by: Abner Chang <abner.chang@amd.com>
> -----Original Message-----
> From: Nickle Wang <nicklew@nvidia.com>
> Sent: Monday, May 29, 2023 2:24 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner <Abner.Chang@amd.com>; Igor Kulchytskyy
> <igork@ami.com>
> Subject: [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix value type issue.
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> 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>
> ---
> .../RedfishPlatformConfigDxe.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
> b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
> index 1172d1094b06..462f269f6a3f 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)) {
> --
> 2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix value type issue.
2023-05-29 6:24 [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix value type issue Nickle Wang
2023-05-29 8:10 ` Chang, Abner
@ 2023-05-30 14:28 ` Igor Kulchytskyy
1 sibling, 0 replies; 3+ messages in thread
From: Igor Kulchytskyy @ 2023-05-30 14:28 UTC (permalink / raw)
To: Nickle Wang, devel@edk2.groups.io; +Cc: Abner Chang
Reviewed-by: Igor Kulchytskyy <igork@ami.com>
-----Original Message-----
From: Nickle Wang <nicklew@nvidia.com>
Sent: Monday, May 29, 2023 2:24 AM
To: devel@edk2.groups.io
Cc: Abner Chang <abner.chang@amd.com>; Igor Kulchytskyy <igork@ami.com>
Subject: [EXTERNAL] [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix value type issue.
**CAUTION: The e-mail below is from an external source. Please exercise caution before opening attachments, clicking links, or following guidance.**
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>
---
.../RedfishPlatformConfigDxe.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
index 1172d1094b06..462f269f6a3f 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)) {
--
2.17.1
-The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-05-30 14:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-29 6:24 [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix value type issue Nickle Wang
2023-05-29 8:10 ` Chang, Abner
2023-05-30 14:28 ` Igor Kulchytskyy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox