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 C22699413DB for ; Wed, 27 Mar 2024 07:38:20 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=bVmEOr0Y8TWaKzQ6I9x+A9ZCbCDGz/MbTxoX4Kt0h0U=; 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:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20240206; t=1711525099; v=1; b=fC3jIf1m157muDggr88r5OrjT7TvP/AgUBBmVk72oXDm2l2qnH5ohQjO9+82RD+jmYMK0ZLW eb74E7/+ysrK4edh6JmmU9wc1zlVC6A0pX6wTxJDc2uCh+ZGPenLk79ImligBIxzXG7U1nPC3rh ANIPmkQQsxkgOJY5w48jcSQZAZ5d0eW9Q1cOQ+Fqdq33uEJ9Ejtrb6gKIDSFDgr8Gai2tg1xlvy z0cs5xGxEWttt8RL0ggjpqnTj7GKGKW43X4lPByxV3FMX36Eb0IZtv3dU5obzcab04F0jqcV6za k4zGmsnaycm4cGk2zqP8zcRZK0aB9gxM7mYXC+26/9DbQ== X-Received: by 127.0.0.2 with SMTP id 8OHlYY7687511x7ncbWHcfGQ; Wed, 27 Mar 2024 00:38:19 -0700 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.40]) by mx.groups.io with SMTP id smtpd.web10.32054.1711525098677540969 for ; Wed, 27 Mar 2024 00:38:18 -0700 X-Received: from MW4PR12MB7031.namprd12.prod.outlook.com (2603:10b6:303:1ef::6) by DS0PR12MB8318.namprd12.prod.outlook.com (2603:10b6:8:f6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.31; Wed, 27 Mar 2024 07:38:15 +0000 X-Received: from MW4PR12MB7031.namprd12.prod.outlook.com ([fe80::fef9:2c9c:21b5:6f50]) by MW4PR12MB7031.namprd12.prod.outlook.com ([fe80::fef9:2c9c:21b5:6f50%2]) with mapi id 15.20.7409.031; Wed, 27 Mar 2024 07:38:15 +0000 From: "Nickle Wang via groups.io" To: "abner.chang@amd.com" , "devel@edk2.groups.io" CC: Igor Kulchytskyy Subject: Re: [edk2-devel] [PATCH V2 2/6] RedfishPkg/RedfishDebugLib: Introduce Redfish DEBUG macro Thread-Topic: [PATCH V2 2/6] RedfishPkg/RedfishDebugLib: Introduce Redfish DEBUG macro Thread-Index: AQHaf5B6h5WsuAY5jkmtmB1R+mnjSLFLNEww Date: Wed, 27 Mar 2024 07:38:15 +0000 Message-ID: References: <20240326151503.106-1-abner.chang@amd.com> <20240326151503.106-3-abner.chang@amd.com> In-Reply-To: <20240326151503.106-3-abner.chang@amd.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MW4PR12MB7031:EE_|DS0PR12MB8318:EE_ x-ms-office365-filtering-correlation-id: 97f32909-b269-487e-0d63-08dc4e30dd1d x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: 5U/4RD6a57ifJizMJXomZjzOxP5pWn4/0v5MHQn5ngUWoM84gklQfN7obCh4it/0Te8sdRsjSBwsFM9HFZxvttwoXxeloCC2Av4wbcQ06AYwz4orxsWDYDzuAuRfwLlSBkoIu/0nTmJokd72zN8kroe+PHGuS5z507zjm7ADmmW/LXgjDocyefvdze3WZZ11Eji4QXZ9xpqee6qfItwfNOaQMCpsq67mcTbfCoMxa/3GsxoFPomEumdfhN6FQSaq7EheIhP7bZ5JKV1rrjhlNO2bSNcBxsGxt3ltWJ8i7u4UWGeWfdKegFEZUECvQHATjeAbRS1dMyXWYSmVDNdUzdKDYCdam0UMewpHqJYZ0++pkpTU/ToZQj796OmhbCShKNO6iQNwOJdow0TswODUA6B1vK8ORnIXGHOBRgPmBPW1jjz0HD1Doo7NOMiZEFCcV0cVa1FIPQ2gPA83eEx3/3xnO6Uq+NCjaEkgrbBE6qZqLSV+fiFWXkBEMtHkG5fq8CB6B6FVLbyplnC/j86FqopM8lOFb4tAAXukhpVLPJM7I7H3TL8Bl6zKswSoM2x2Ug96fEoUQZ8dxnksfWb+9iSeweW4Esa/PF5wAjpXKVOJWwloko2fowVMh6qljHd1YoL/qAUi2RRGm1VbaXR9iqU9vA0ZQ/cRXszSGAsw1bUjPL3UiGfQHOELp0oTdaLFGNkHno+6I934YnYVdwJCk86GmbEo1O9GJzpiCVD3wTQ= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?uC01L/+lJY16LuPB3cfF49iDJWDIQQNpIl2PCpdZdJV7m7+axmNr1NJ+mU8c?= =?us-ascii?Q?6z8UCSS0Orwp+uNRmAz3/diR4cFcBLvYMZb2yBzC9clPtpPbrr9HKwThy6oK?= =?us-ascii?Q?6mqbFWnq4qipmMhJkGrUto12CvqY6SvBlOBhB8X8TCHFgesbqDQLAYgrayYS?= =?us-ascii?Q?9W9AyQkxv6fpngDhlLIElrHGi2fB5XsxAO4acKzq53ZtF9plNjxwsKcEDRyq?= =?us-ascii?Q?/K79OrtT+CjR51n2+sFsbsvp2+bUw3//sHA1O3wreWmT/xFN7ZokjCZEs7pP?= =?us-ascii?Q?eMGhe03r8h3ccL+5CzpSFcDv9pXh7/lJi7XGb9RYUVAOR3f/8yk9blxzfaDm?= =?us-ascii?Q?ip/UKYks0WtWTzh5/VcrqzvswCKjQ0bydePNb6EilL7NgyKneEBxIaV4PgVF?= =?us-ascii?Q?Kk5nEcGk6FstcJjKfoDgkgEI46IKyW8P010fB+plVJL1vqEdSO7lp3sYtE74?= =?us-ascii?Q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6FgPCTrkVEDOALicXNCiIzBn?= =?us-ascii?Q?nmz+IsdfQOoe3IRFakCatNjjgZ5h42OgdnWjhevjfGH2RWMQm7VchRiuCqA0?= =?us-ascii?Q?NER0WRQZ18gxWm3E2ScFYuM42qmO9KILeLfCjPv4iCzw21vmiY8JporXk6y8?= =?us-ascii?Q?DXXirLi2Elj3TMuRiQTxQIPHGAT7KNnAjAbUOQ4701CFcjjWm5Z4jOvYqDIj?= =?us-ascii?Q?8yJDjUGH+OC9sSmxNe8=3D?= MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR12MB7031.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 97f32909-b269-487e-0d63-08dc4e30dd1d X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Mar 2024 07:38:15.4642 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: yTNXWdlfiQT8P2kYhr9AdO+9PRwkdTb97Jpqdpmbd2cTS3QNa9NTRjQrUMYdm1iQeXdIMYTKFRU+QWNdtugVsg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8318 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: Wed, 27 Mar 2024 00:38:18 -0700 Reply-To: devel@edk2.groups.io,nicklew@nvidia.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: fC6eFzLgOEi8uDrE5fGFJ9fOx7686176AA= 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=fC3jIf1m; 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: Nickle Wang Regards, Nickle > -----Original Message----- > From: abner.chang@amd.com > Sent: Tuesday, March 26, 2024 11:15 PM > To: devel@edk2.groups.io > Cc: Nickle Wang ; Igor Kulchytskyy > Subject: [PATCH V2 2/6] RedfishPkg/RedfishDebugLib: Introduce Redfish DEB= UG > macro >=20 > External email: Use caution opening links or attachments >=20 >=20 > From: Abner Chang >=20 > 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 settin= g of > PcdRedfishDebugCatagory. >=20 > Signed-off-by: Abner Chang > Cc: Nickle Wang > Cc: Igor Kulchytskyy > --- > 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(-) >=20 > 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 > reserved. > +# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights > +reserved.
> # > # SPDX-License-Identifier: BSD-2-Clause-Patent ## @@ -184,3 +185,11 @@ >=20 > gEfiRedfishPkgTokenSpaceGuid.PcdHttpRetryWaitInSecond|1|UINT16|0x000010 > 10 > ## This is used to disable Redfish HTTP cache function and every reque= st will be > sent to Redfish service. >=20 > gEfiRedfishPkgTokenSpaceGuid.PcdHttpCacheDisabled|FALSE|BOOLEAN|0x0000 > 1011 > + # > + # Redfish debug catagories > + # To enable the debug message for the entire edk2 Redfish implementati= on, > below PCDs must be set. > + # DEBUG_MANAGEABILITY must be set PcdDebugPrintErrorLevel. > + # > + # 0x0000000000000001 RedfishPlatformConfigDxe driver debug enabled. > + # > + > + > gEfiRedfishPkgTokenSpaceGuid.PcdRedfishDebugCategory|0|UINT64|0x000010 > + 12 > diff --git a/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.inf > b/RedfishPkg/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 > reserved. > +# Copyright (C) 2024 Advanced Micro Devices, Inc. All rights > +reserved.
> # > # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -35,5 +36,8 @@ > RedfishHttpLib > UefiLib >=20 > +[FixedPcd] > + gEfiRedfishPkgTokenSpaceGuid.PcdRedfishDebugCategory > + > [Depex] > TRUE > diff --git a/RedfishPkg/Include/Library/RedfishDebugLib.h > b/RedfishPkg/Include/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. >=20 > Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights > reserved. > + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights > + reserved.
>=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @@ -11,28 +12,48 @@ > #define REDFISH_DEBUG_LIB_H_ >=20 > #include > +#include > #include > #include > #include >=20 > #include >=20 > -#define DEBUG_REDFISH_NETWORK DEBUG_MANAGEABILITY ///< Debug > error level for Redfish networking function > -#define DEBUG_REDFISH_HOST_INTERFACE DEBUG_MANAGEABILITY ///< > Debug error level for Redfish networking function > +// Used with MdePKg DEBUG macro. > +#define DEBUG_REDFISH_NETWORK DEBUG_MANAGEABILITY ///< > Debug error level for Redfish networking function > +#define DEBUG_REDFISH_HOST_INTERFACE DEBUG_MANAGEABILITY > ///< Debug error level for Redfish Host INterface > +#define DEBUG_REDFISH_PLATFORM_CONFIG DEBUG_MANAGEABILITY > ///< Debug error level for Redfish Platform Configure Driver > + > +// > +// Definitions of Redfish debug capability in Redfish component scope, > +used 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) >=20 > /** > - Debug print the value of StatementValue. > + Determine whether the Redfish debug category is enabled in > + gEfiRedfishPkgTokenSpaceGuid.PcdRedfishDebugCategory. >=20 > - @param[in] ErrorLevel DEBUG macro error level. > - @param[in] StatementValue The statement value to print. > + @param[in] DebugCategory Redfish debug category. >=20 > - @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 > ); >=20 > /** > diff --git a/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c > b/RedfishPkg/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. >=20 > Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights > reserved. > + Copyright (C) 2024 Advanced Micro Devices, Inc. All rights > + reserved.
>=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @@ -25,55 +26,23 @@ > #define REDFISH_PRINT_BUFFER_BYTES_PER_ROW 16 >=20 > /** > - Debug print the value of StatementValue. > + Determine whether the Redfish debug category is enabled in > + gEfiRedfishPkgTokenSpaceGuid.PcdRedfishDebugCategory. >=20 > - @param[in] ErrorLevel DEBUG macro error level. > - @param[in] StatementValue The statement value to print. > + @param[in] RedfishDebugCategory Redfish debug category. >=20 > - @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; >=20 > - DEBUG ((ErrorLevel, "BufferValueType: 0x%x\n", StatementValue- > >BufferValueType)); > - 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.u6= 4)); > - break; > - case EFI_IFR_TYPE_BOOLEAN: > - DEBUG ((ErrorLevel, "Value: %a\n", (StatementValue->Value.b ? = "true" : > "false"))); > - break; > - case EFI_IFR_TYPE_STRING: > - DEBUG ((ErrorLevel, "Value: 0x%x\n", StatementValue->Value.str= ing)); > - 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); > } >=20 > /** > -- > 2.37.1.windows.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 (#117152): https://edk2.groups.io/g/devel/message/117152 Mute This Topic: https://groups.io/mt/105159784/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-