From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 4F64E7803CE for ; Thu, 4 Apr 2024 13:33:42 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=UEv5tTJfhLk6E4AIcY474eIIUO2p4jfHQNCQ5boDxe0=; c=relaxed/simple; d=groups.io; h=From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20240206; t=1712237620; v=1; b=js0I5oe6rkCvO9ck0su9IdST29HM7Qnuy0D9X8FfwYiTxsml0qqlsiZtRSEv1+yhDFJPMWmi KeVHoF5eFQOE33vwRvZkegul1OP6YbksBTTmE41nIApDgRdc5M+swb82DGfOdl0drI4SZJYwTV2 s+R09+jULngi2yBauVjMexB28tl/YiIIycoraI1yQL7pwGSPzzjnFAtD+GVwxXXeaKibUVmRGut OH9F2NTNXRZbjmFlVN+gzOqJ4DR04/tOH6mS6tfEUI2F68Tnu3GFpqViinOmh4Nj51ScuiOWiNd W6ympdz2GMF/MWdiKVufEL/voZo+AXnGkchK/v0lO1IYg== X-Received: by 127.0.0.2 with SMTP id 2SwuYY7687511xtkBOYijnkd; Thu, 04 Apr 2024 06:33:40 -0700 X-Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.139]) by mx.groups.io with SMTP id smtpd.web10.38186.1712237619222175525 for ; Thu, 04 Apr 2024 06:33:39 -0700 X-Received: from BLAPR10MB5185.namprd10.prod.outlook.com (2603:10b6:208:328::16) by DM6PR10MB4298.namprd10.prod.outlook.com (2603:10b6:5:21f::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Thu, 4 Apr 2024 13:33:34 +0000 X-Received: from BLAPR10MB5185.namprd10.prod.outlook.com ([fe80::a03f:4d36:9713:33d0]) by BLAPR10MB5185.namprd10.prod.outlook.com ([fe80::a03f:4d36:9713:33d0%5]) with mapi id 15.20.7409.042; Thu, 4 Apr 2024 13:33:34 +0000 From: "Igor Kulchytskyy via groups.io" To: "abner.chang@amd.com" , "devel@edk2.groups.io" CC: Nickle Wang Subject: Re: [edk2-devel] [PATCH V3 2/6] RedfishPkg/RedfishDebugLib: Introduce Redfish DEBUG macro Thread-Topic: [EXTERNAL] [PATCH V3 2/6] RedfishPkg/RedfishDebugLib: Introduce Redfish DEBUG macro Thread-Index: AQHahnlvcoBSb50XU0SENM1B16Ad5LFYHCog Date: Thu, 4 Apr 2024 13:33:34 +0000 Message-ID: References: <20240404101758.84-1-abner.chang@amd.com> <20240404101758.84-3-abner.chang@amd.com> In-Reply-To: <20240404101758.84-3-abner.chang@amd.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: BLAPR10MB5185:EE_|DM6PR10MB4298:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: FVJjc2Uy9oRXsxFaT+aKPMMeBWcDkylDM2pNPQNSUCQwYpdOwgzhTqk5+3DDwgkMN+OiypHEFyMiFFqehO/IkWXhg5p7C58u5ocEACa6MDJWwx10fk0VGmI9sZ1T4soQufR2JFKMSq6v3y6fpTa0djahE8d9NlqjsCsKivwvuB29OfTXZFgG56aVovUTEkdlTAb7X5WsvKIXQGn6XFSL0bQpXcq4fbSxB3nbyl4VoFK2FYCvVdziPo28gg/2NHDBNLnvk8zCJk7zo9gFg+1Mq7WyH4dR2YlKY3/YjbV2a1s4HA7D5G1E7Py9Sc2dTmJuPxPmlAGUW20hWdjQz3YFp3h1r2SNo3ZQBDMda+jRlJQq1YZa3+AveFujUDXT4NdGPE8pn1E1lYei4tJorhHL7S9Beg3+EGpDQcmEBa3cqeP2L0snZE4EBPONGZVsK66p8pA1A4Gt4RTA/b1yhSEQuvRHDFCagDZPm3MEBXy/Ez0Vgk0TgjKXuqO0mR+ZNPfN9sseaHhwA6+6BECs2hMLvvKxxaUWJjPOm0aO+ZJPeSlvScLwb3thXy86k0WX8v/GoX9y1d3r6Vtajl6f3heRgLYvmQtvg7agrkTqijZb3sTu+QOYDwIJ1hgsyVKb4OoBJYI7OUY3QGgWhIiGEcu/AowUNf+FYe4FBn08+rcxEqQ= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?n9VDAGP6D6sx9ixEwsVZ3o7u0i6g0y1wl/pud2NKyt/ZYdz+bUuw5K/81iNg?= =?us-ascii?Q?VXtZwCmyZqvps8KfYRSolM4ScQu7wRKdGrNOLh3+1n1WT5LWKnQmb53foQQr?= =?us-ascii?Q?wjdV+9STFgIQeTZ/lhuSXB7mO9fC4UAD9FSWnsKBxE4JSFid+mRJEzyaro8G?= =?us-ascii?Q?AYc18p0ZFZu38F3nSRLNX4SAbi4tRerSJzRlZUTqXsa1hefs3DC09qE8Scdj?= =?us-ascii?Q?d3C6Xy49KVDrEmYJUtVtEl6JyMSp89iF5I7ulOfGwwrysaTPyL3aDBabyeTa?= =?us-ascii?Q?5y3Qd5NfHmDP1vAzZ+XCAOZmVX9h/iwaOFjC6neqkf9GyHOcEpyqzorMHMoe?= =?us-ascii?Q?ttPRoV7Y78iSEo0+V8vww9fk33WrRRybjBbEsTa6lLh+lQuMquSN8SVBQPTl?= =?us-ascii?Q?HTcrgRqfcU3V98+L4bp5CpsoefKOMatTz2dxfHiPKzlFnBrU+5HRWYh0vuIq?= =?us-ascii?Q?VYrZFFLIbJbZb73LZGAeokdzmHjKv6KM/f07zXuWn1YANd1Rpj6Z4X9Cej/S?= =?us-ascii?Q?QNxTpfrn0cCimvtcbNkP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ii?Q?FrdG/rTzs8qR/sP3UWtx+147n40e8kH9sy/m9PBp7OYs0+LegBpkV040QX04?= =?us-ascii?Q?Ii3qC+rr9i35M1ZRjegSCtiXa9iaBIaCCy24nwSx0gvFdPYx2eAGExywpbNr?= =?us-ascii?Q?K/pc8+60dDVosGJw/SQ=3D?= MIME-Version: 1.0 X-OriginatorOrg: ami.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BLAPR10MB5185.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7595028f-80f4-4472-df8a-08dc54abd39a X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Apr 2024 13:33:34.5761 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 27e97857-e15f-486c-b58e-86c2b3040f93 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 0WXK1nPDof5mKzQEC62plcVAuZvZTQuRGwIXtFK1AafiqOPaKIvcR4l7DCsHbYAj X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4298 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Thu, 04 Apr 2024 06:33:39 -0700 Resent-From: igork@ami.com Reply-To: devel@edk2.groups.io,igork@ami.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: SAjcprfWBSHwjGbcOzm2CYcFx7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=js0I5oe6; dmarc=pass (policy=none) header.from=groups.io; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Reviewed-by: Igor Kulchytskyy Regards, Igor -----Original Message----- From: abner.chang@amd.com Sent: Thursday, April 4, 2024 6:18 AM To: devel@edk2.groups.io Cc: Nickle Wang ; Igor Kulchytskyy Subject: [EXTERNAL] [PATCH V3 2/6] RedfishPkg/RedfishDebugLib: Introduce Re= dfish DEBUG macro **CAUTION: The e-mail below is from an external source. Please exercise cau= tion before opening attachments, clicking links, or following guidance.** From: Abner Chang Introduce DEBUG_REDFISH macro for the debug message of edk2 Redfish components. DEBUG_REDFISH can be used in any edk2 Redfish component with Redfish DebugCatagory as the first parameter. Whether the debug message is output or not depends on the platform setting of PcdRedfishDebugCatagory. Signed-off-by: Abner Chang Cc: Nickle Wang Cc: Igor Kulchytskyy Reviewed-by: Nickle Wang --- RedfishPkg/RedfishPkg.dec | 9 +++ .../RedfishDebugLib/RedfishDebugLib.inf | 4 ++ RedfishPkg/Include/Library/RedfishDebugLib.h | 43 +++++++++++---- .../Library/RedfishDebugLib/RedfishDebugLib.c | 55 ++++--------------- 4 files changed, 57 insertions(+), 54 deletions(-) diff --git a/RedfishPkg/RedfishPkg.dec b/RedfishPkg/RedfishPkg.dec index 1a9c9ed7bc5..a9665ff68ef 100644 --- a/RedfishPkg/RedfishPkg.dec +++ b/RedfishPkg/RedfishPkg.dec @@ -5,6 +5,7 @@ # (C) Copyright 2021 Hewlett Packard Enterprise Development LP
# Copyright (c) 2023, American Megatrends International LLC. # Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights res= erved. +# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent ## @@ -184,3 +185,11 @@ gEfiRedfishPkgTokenSpaceGuid.PcdHttpRetryWaitInSecond|1|UINT16|0x0000101= 0 ## This is used to disable Redfish HTTP cache function and every request= will be sent to Redfish service. gEfiRedfishPkgTokenSpaceGuid.PcdHttpCacheDisabled|FALSE|BOOLEAN|0x000010= 11 + # + # Redfish debug catagories + # To enable the debug message for the entire edk2 Redfish implementation= , below PCDs must be set. + # DEBUG_MANAGEABILITY must be set PcdDebugPrintErrorLevel. + # + # 0x0000000000000001 RedfishPlatformConfigDxe driver debug enabled. + # + gEfiRedfishPkgTokenSpaceGuid.PcdRedfishDebugCategory|0|UINT64|0x00001012 diff --git a/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.inf b/Redfi= shPkg/Library/RedfishDebugLib/RedfishDebugLib.inf index d468bb213b6..42ff321b48e 100644 --- a/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.inf +++ b/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.inf @@ -2,6 +2,7 @@ # INF file for Redfish debug library. # # Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights re= served. +# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -35,5 +36,8 @@ RedfishHttpLib UefiLib +[FixedPcd] + gEfiRedfishPkgTokenSpaceGuid.PcdRedfishDebugCategory + [Depex] TRUE diff --git a/RedfishPkg/Include/Library/RedfishDebugLib.h b/RedfishPkg/Incl= ude/Library/RedfishDebugLib.h index ad7a6975867..19e5a895cc8 100644 --- a/RedfishPkg/Include/Library/RedfishDebugLib.h +++ b/RedfishPkg/Include/Library/RedfishDebugLib.h @@ -2,6 +2,7 @@ This file defines the Redfish debug library interface. Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights res= erved. + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -11,28 +12,48 @@ #define REDFISH_DEBUG_LIB_H_ #include +#include #include #include #include #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 +// Used with MdePKg DEBUG macro. +#define DEBUG_REDFISH_NETWORK DEBUG_MANAGEABILITY ///< D= ebug error level for Redfish networking function +#define DEBUG_REDFISH_HOST_INTERFACE DEBUG_MANAGEABILITY ///< D= ebug error level for Redfish Host INterface +#define DEBUG_REDFISH_PLATFORM_CONFIG DEBUG_MANAGEABILITY ///< D= ebug error level for Redfish Platform Configure Driver + +// +// Definitions of Redfish debug capability in Redfish component scope, use= d with DEBUG_REDFISH macro +// For example, Redfish Platform Config Driver +// DEBUG_REDFISH(DEBUG_REDFISH_PLATFORM_CONFIG_DXE, ...) +// +#define DEBUG_REDFISH_COMPONENT_PLATFORM_CONFIG_DXE 0x00000001 + +#define DEBUG_REDFISH(DebugCategory, ...) \ + do { \ + if (!DebugPrintEnabled()) { \ + break; \ + } \ + if (!DebugRedfishComponentEnabled (DebugCategory)) { \ + break; \ + } \ + DEBUG ((DEBUG_MANAGEABILITY, ##__VA_ARGS__)); \ + } while (FALSE) /** - Debug print the value of StatementValue. + Determine whether the Redfish debug category is enabled in + gEfiRedfishPkgTokenSpaceGuid.PcdRedfishDebugCategory. - @param[in] ErrorLevel DEBUG macro error level. - @param[in] StatementValue The statement value to print. + @param[in] DebugCategory Redfish debug category. - @retval EFI_SUCCESS StatementValue is printed. - @retval EFI_INVALID_PARAMETER StatementValue is NULL. + @retval TRUE This debug category is enabled. + @retval FALSE This debug category is disabled.. **/ -EFI_STATUS -DumpHiiStatementValue ( - IN UINTN ErrorLevel, - IN HII_STATEMENT_VALUE *StatementValue +BOOLEAN +DebugRedfishComponentEnabled ( + IN UINT64 DebugCategory ); /** diff --git a/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c b/Redfish= Pkg/Library/RedfishDebugLib/RedfishDebugLib.c index 8b0425b8c3b..f8bb51ff532 100644 --- a/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c +++ b/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c @@ -2,6 +2,7 @@ Redfish debug library to debug Redfish application. Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights res= erved. + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent @@ -25,55 +26,23 @@ #define REDFISH_PRINT_BUFFER_BYTES_PER_ROW 16 /** - Debug print the value of StatementValue. + Determine whether the Redfish debug category is enabled in + gEfiRedfishPkgTokenSpaceGuid.PcdRedfishDebugCategory. - @param[in] ErrorLevel DEBUG macro error level. - @param[in] StatementValue The statement value to print. + @param[in] RedfishDebugCategory Redfish debug category. - @retval EFI_SUCCESS StatementValue is printed. - @retval EFI_INVALID_PARAMETER StatementValue is NULL. + @retval TRUE This debug category is enabled. + @retval FALSE This debug category is disabled.. **/ -EFI_STATUS -DumpHiiStatementValue ( - IN UINTN ErrorLevel, - IN HII_STATEMENT_VALUE *StatementValue +BOOLEAN +DebugRedfishComponentEnabled ( + IN UINT64 RedfishDebugCategory ) { - if (StatementValue =3D=3D NULL) { - return EFI_INVALID_PARAMETER; - } + UINT64 DebugCategory; - 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; + DebugCategory =3D FixedPcdGet64 (PcdRedfishDebugCategory); + return ((DebugCategory & RedfishDebugCategory) !=3D 0); } /** -- 2.37.1.windows.1 -The information contained in this message may be confidential and propriet= ary 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 desig= nee. If the reader of this message is not the intended recipient, you are o= n notice that any distribution of this message, in any form, is strictly pr= ohibited. 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= . -=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 (#117430): https://edk2.groups.io/g/devel/message/117430 Mute This Topic: https://groups.io/mt/105326103/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-