From nobody Thu May 9 22:17:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+106652+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1688525407521871.6237174874303; Tue, 4 Jul 2023 19:50:07 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id SlSfYY1788612xbQ62eahjKK; Tue, 04 Jul 2023 19:50:07 -0700 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.77]) by mx.groups.io with SMTP id smtpd.web10.8727.1688525406423770455 for ; Tue, 04 Jul 2023 19:50:06 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=N8sCkSNQTAtxPTEYY1jXlj/Cv3aUOSEuDZ7lLfjS6KowxBBySQKamXxiM20U8lEXky24WqPolDMGW2jZqA9P3iOOl+YI+7MKSopla0rNIOggYL/yFJIl5v46L9ndcoMgMdb8cuXCoa6m7MJVfTczDP/VNVNB0yr3aheKDImZmhKD+R0DLuJUfJndlj5LHoYNI09DJ+DmKFn+RjtJg7VDZVp8heWZcSHEF0VsJq/HG3G85FmTJ0LHZr2iTqWCFE54w1eXFoLz6OHhVuSh6WqAGhnqpTIfWXF5ddBLvJSZb8/kEd+e3C0uQdtqohb2UhrzWwKi+Vcw3apd//5z+IAlkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ZRbd5LoJTNVY1XW/ZUTFoMxTXkW3xYDOD4eedXdMqNw=; b=GKIZLRlyzClCpW+MvU0IQBC9ftI9WUR++gosM/ZHYMK/UCb+hGtET/nQf+dgblbToQGbeMZ9tOhu84njYSQtm4vtrfxHNkxn62R/C2+EXpcpOC5SsluDhJxLzQLr4SV97aq+4lNpPoZRcwo2qfAZPG5r2XEeaUHBGXDOUlA/55mTETNGPq5qab12qOv55pE7qWAN7paK3OmjgEXUGGV4rchf25hTt5eEzec79gujAe4L6/XF1h+fh4ZggOtrHPWrxP1WrygRuVyZ/zkYziZA/up5W3brWypOLPnfRt9CQv3Y/CQvLkUl0VevZCYA8PUc6NjtvJ2sSij+/6R3x079RA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.232) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none X-Received: from BYAPR05CA0030.namprd05.prod.outlook.com (2603:10b6:a03:c0::43) by MW4PR12MB6754.namprd12.prod.outlook.com (2603:10b6:303:1eb::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.17; Wed, 5 Jul 2023 02:50:03 +0000 X-Received: from DM6NAM11FT114.eop-nam11.prod.protection.outlook.com (2603:10b6:a03:c0:cafe::54) by BYAPR05CA0030.outlook.office365.com (2603:10b6:a03:c0::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.18 via Frontend Transport; Wed, 5 Jul 2023 02:50:02 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.232) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+106652+1787277+3901457@groups.io; helo=mail02.groups.io; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.232 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.232; helo=mail.nvidia.com; pr=C X-Received: from mail.nvidia.com (216.228.118.232) by DM6NAM11FT114.mail.protection.outlook.com (10.13.172.206) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.45 via Frontend Transport; Wed, 5 Jul 2023 02:50:02 +0000 X-Received: from drhqmail202.nvidia.com (10.126.190.181) by mail.nvidia.com (10.127.129.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Tue, 4 Jul 2023 19:49:55 -0700 X-Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Tue, 4 Jul 2023 19:49:55 -0700 X-Received: from NV-CL38DL3.nvidia.com (10.127.8.9) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Tue, 4 Jul 2023 19:49:54 -0700 From: "Nickle Wang via groups.io" To: CC: Abner Chang , Igor Kulchytskyy Subject: [edk2-devel] [PATCH] RedfishPkg/RedfishDebugLib: add new interfaces Date: Wed, 5 Jul 2023 10:49:53 +0800 Message-ID: <20230705024953.1136-1-nicklew@nvidia.com> MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT114:EE_|MW4PR12MB6754:EE_ X-MS-Office365-Filtering-Correlation-Id: aa8afe2d-0d3d-4e90-1c0e-08db7d0287c1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: t5SlZyO4JsVxWTuCHrRGpXrLHG4IEEDKlDRABSMsEySzmU2ZjzJ6QuRNlA5bHRHUYt11mo8zJPWn/CMl6ON8tGTYhZUKY+R7psNXa6w+8Nr9y8rIuGFabuAlsdIMnZQCxZlm04ogJWA0HqUt6JFBf3GiM/+64ILyTBPNvbo9rWY7+/oD/u5Ddhc7sTc9MXDU0yK6Bbdf0GWPizj9YYDYad4tnLlHFFaed/ZB5qRPQSfeFa/uQMXQl8ghKawdMD5sKMYYRt39CEGNyQ9lU0PC//3/8/etZNrXm4VOj14YxZKoLADaf18zYkTjkYjf92SBS/pPJ5T/E/B/1pk8qQM1GbWGbNdwBdn9sBML7vxoF5f9SWark7f+2p5ZD4HEc1eTxkkf1OVdaabcQbdg6rwz9KA56/wuvy0unPlmD7QGpiydNYQVQzGvdO2NDMdIJi2XAruvydtEkmr7ZxEtPXNp2BdH8DlLcs2DK9Z+6PjJu7tC+uq//5nwxACCE6R/HAQjVshtyTDeJc1fRHhXjzSAeLAtMkNfCTHB5hOYZzJwNGM/979HbR33osNRtwTOmE8WF2zxzSKZT0DWXiKJ6dV40JeVVCI7gKDVplP+qvWS2GhHxfPrXGggkKdVnOLX42f55wiuZFz0OF7ChRGKj11x2LmT2JGRtPHy16lElWqTL7zZpchKUn7OtLWXbErKhZdjZJpzJPnkcPQtQiQLTacI7igaIv7Bw+UlkYds5Juhcg6zQfKSZ+zWuhy7QHM54A0x X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2023 02:50:02.2481 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aa8afe2d-0d3d-4e90-1c0e-08db7d0287c1 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.232];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT114.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6754 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nicklew@nvidia.com X-Gm-Message-State: JhKaJrCI0qKYfbABWZNZxfoAx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1688525407; bh=pPj3U0WTd2na0KZzUsMfvMIaiEPpY0u3IBPU1id1Gz8=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=Mi1I1JAP4Vm8I1L0fp/Bv1y2vStrNeraOFNKiBteTmMO2YlwppjIFP2VhqF21ZAlGSc Mdu7QrFCmX7Kn9CPTHKPfnVJAbi0NIxKHjJ0kezMyR5ZrcpbAjVlXvRTyO1A6crVJgH/e Z7p0NBf54emGQMfd1Ra/VyjSEZNNlywHvFo= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1688525408868100001 Content-Type: text/plain; charset="utf-8" Introduce DumpHiiStatementValue() and DumpRedfishValue() to RedfishDebugLib. Application uses these functions to debug print the value of HII_STATEMENT_VALUE and EDKII_REDFISH_VALUE. Signed-off-by: Nickle Wang Cc: Abner Chang Cc: Igor Kulchytskyy Reviewed-by: Abner Chang --- RedfishPkg/Include/Library/RedfishDebugLib.h | 33 +++++ .../Library/RedfishDebugLib/RedfishDebugLib.c | 113 ++++++++++++++++++ 2 files changed, 146 insertions(+) diff --git a/RedfishPkg/Include/Library/RedfishDebugLib.h b/RedfishPkg/Incl= ude/Library/RedfishDebugLib.h index 73f1469ac62b..da7e0d0bc9fc 100644 --- a/RedfishPkg/Include/Library/RedfishDebugLib.h +++ b/RedfishPkg/Include/Library/RedfishDebugLib.h @@ -11,12 +11,45 @@ #define REDFISH_DEBUG_LIB_H_ =20 #include +#include #include #include =20 +#include + #define DEBUG_REDFISH_NETWORK DEBUG_MANAGEABILITY ///< Debug err= or level for Redfish networking function #define DEBUG_REDFISH_HOST_INTERFACE DEBUG_MANAGEABILITY ///< Debug err= or level for Redfish networking function =20 +/** + Debug print the value of StatementValue. + + @param[in] ErrorLevel DEBUG macro error level. + @param[in] StatementValue The statement value to print. + + @retval EFI_SUCCESS StatementValue is printed. + @retval EFI_INVALID_PARAMETER StatementValue is NULL. +**/ +EFI_STATUS +DumpHiiStatementValue ( + IN UINTN ErrorLevel, + IN HII_STATEMENT_VALUE *StatementValue + ); + +/** + Debug print the value of RedfishValue. + + @param[in] ErrorLevel DEBUG macro error level. + @param[in] RedfishValue The statement value to print. + + @retval EFI_SUCCESS RedfishValue is printed. + @retval EFI_INVALID_PARAMETER RedfishValue is NULL. +**/ +EFI_STATUS +DumpRedfishValue ( + IN UINTN ErrorLevel, + IN EDKII_REDFISH_VALUE *RedfishValue + ); + /** =20 This function dump the Json string in given error level. diff --git a/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c b/Redfish= Pkg/Library/RedfishDebugLib/RedfishDebugLib.c index 6f1d9de25e0a..0b2a9a5c4ec8 100644 --- a/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c +++ b/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c @@ -22,6 +22,119 @@ #define REDFISH_JSON_STRING_LENGTH 200 #define REDFISH_JSON_OUTPUT_FORMAT (EDKII_JSON_COMPACT | EDKII_JSON_INDEN= T(2)) =20 +/** + Debug print the value of StatementValue. + + @param[in] ErrorLevel DEBUG macro error level. + @param[in] StatementValue The statement value to print. + + @retval EFI_SUCCESS StatementValue is printed. + @retval EFI_INVALID_PARAMETER StatementValue is NULL. +**/ +EFI_STATUS +DumpHiiStatementValue ( + IN UINTN ErrorLevel, + IN HII_STATEMENT_VALUE *StatementValue + ) +{ + if (StatementValue =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + DEBUG ((ErrorLevel, "BufferValueType: 0x%x\n", StatementValue->BufferVal= ueType)); + DEBUG ((ErrorLevel, "BufferLen: 0x%x\n", StatementValue->BufferLen)); + DEBUG ((ErrorLevel, "Buffer: 0x%p\n", StatementValue->Buffer)); + DEBUG ((ErrorLevel, "Type: 0x%p\n", StatementValue->Type)); + + switch (StatementValue->Type) { + case EFI_IFR_TYPE_NUM_SIZE_8: + DEBUG ((ErrorLevel, "Value: 0x%x\n", StatementValue->Value.u8)); + break; + case EFI_IFR_TYPE_NUM_SIZE_16: + DEBUG ((ErrorLevel, "Value: 0x%x\n", StatementValue->Value.u16)); + break; + case EFI_IFR_TYPE_NUM_SIZE_32: + DEBUG ((ErrorLevel, "Value: 0x%x\n", StatementValue->Value.u32)); + break; + case EFI_IFR_TYPE_NUM_SIZE_64: + DEBUG ((ErrorLevel, "Value: 0x%lx\n", StatementValue->Value.u64)= ); + break; + case EFI_IFR_TYPE_BOOLEAN: + DEBUG ((ErrorLevel, "Value: %a\n", (StatementValue->Value.b ? "t= rue" : "false"))); + break; + case EFI_IFR_TYPE_STRING: + DEBUG ((ErrorLevel, "Value: 0x%x\n", StatementValue->Value.strin= g)); + break; + case EFI_IFR_TYPE_TIME: + case EFI_IFR_TYPE_DATE: + default: + break; + } + + return EFI_SUCCESS; +} + +/** + Debug print the value of RedfishValue. + + @param[in] ErrorLevel DEBUG macro error level. + @param[in] RedfishValue The statement value to print. + + @retval EFI_SUCCESS RedfishValue is printed. + @retval EFI_INVALID_PARAMETER RedfishValue is NULL. +**/ +EFI_STATUS +DumpRedfishValue ( + IN UINTN ErrorLevel, + IN EDKII_REDFISH_VALUE *RedfishValue + ) +{ + UINTN Index; + + if (RedfishValue =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + DEBUG ((ErrorLevel, "Type: 0x%x\n", RedfishValue->Type)); + DEBUG ((ErrorLevel, "ArrayCount: 0x%x\n", RedfishValue->ArrayCount)); + + switch (RedfishValue->Type) { + case RedfishValueTypeInteger: + DEBUG ((ErrorLevel, "Value: 0x%x\n", RedfishValue->Value.Intege= r)); + break; + case RedfishValueTypeBoolean: + DEBUG ((ErrorLevel, "Value: %a\n", (RedfishValue->Value.Boolean= ? "true" : "false"))); + break; + case RedfishValueTypeString: + DEBUG ((ErrorLevel, "Value: %a\n", RedfishValue->Value.Buffer)); + break; + case RedfishValueTypeStringArray: + for (Index =3D 0; Index < RedfishValue->ArrayCount; Index++) { + DEBUG ((ErrorLevel, "Value[%d]: %a\n", Index, RedfishValue->V= alue.StringArray[Index])); + } + + break; + case RedfishValueTypeIntegerArray: + for (Index =3D 0; Index < RedfishValue->ArrayCount; Index++) { + DEBUG ((ErrorLevel, "Value[%d]: 0x%x\n", Index, RedfishValue-= >Value.IntegerArray[Index])); + } + + break; + case RedfishValueTypeBooleanArray: + for (Index =3D 0; Index < RedfishValue->ArrayCount; Index++) { + DEBUG ((ErrorLevel, "Value[%d]: %a\n", Index, (RedfishValue->= Value.BooleanArray[Index] ? "true" : "false"))); + } + + break; + case RedfishValueTypeUnknown: + case RedfishValueTypeMax: + default: + break; + } + + return EFI_SUCCESS; +} + /** =20 This function dump the Json string in given error level. --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#106652): https://edk2.groups.io/g/devel/message/106652 Mute This Topic: https://groups.io/mt/99958452/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-