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 EC609AC0F99 for ; Tue, 9 Jan 2024 07:59:49 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=fuKgfOj3b4a8++T13oY9qvwLuPC04KWeZzHhrjjn8+I=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:msip_labels:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1704787188; v=1; b=oWmZtNTm33cfbkRERdNVzH49EAB96Qot3Ny6B6dQKgjBVN7n6acN1yI15FAltw/9kbRbEqCb IjrKh8glVNM+nnFAAiRCx2WctcNpJZpA+Naw+JRSbUWyTE9cYtt+gEB0qxaoT5vdLyJQn0nlI41 eawTMWnxMaGHrUijrHsAQnQs= X-Received: by 127.0.0.2 with SMTP id gMsdYY7687511xA7u3njVRpL; Mon, 08 Jan 2024 23:59:48 -0800 X-Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.107.223.70]) by mx.groups.io with SMTP id smtpd.web10.12217.1704787187608405997 for ; Mon, 08 Jan 2024 23:59:48 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B08IlBggoIVByHfrw7nDV9w+zKYj1WweLsiWN14uI5Ot/hZcH11P8Eu3zIv71gj2W0X2y26XTPVx6BpHtdOz2aRwGPCVJxKn0zbmriqvBJaSgranZJuCbAtP/E04gN5ljG83ZSpmgNjpOuakCqkkA0LmESBZEL778S+0Hs7pdtk4Y77qVaoCQtrggA9+mUGM8i2rYLkv6x07i6PUm1FvD/DvNcHbYXsJUqwj+pTYlGOqEDSRNDFBc7qXFvgudooIZ+KcNftnidMW2AT4kLH+6/vnqrhRUQlZoeoA6SgCTj0yvqPqEJ+dS0KimqY8iFQLKhpOBAkJOs30HeBu93jdxQ== 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=iKJdYMIGMT2udbaEfPvK336MQSMrY0aMF0IYrwVVOLc=; b=YBFW7DTCI8zoCYZiBTSBjBuNAE5n0qN98k2CAHqZ695jbmLdwIBRXIfSnFaaEdh0RA0CXdWQRukccAzxkNMAzZTV9o8egKpGarCr57dkf085ZTp848NXv/re9VRsuzl2AeC/a09Hio8rZ/4RPXi790gputIkjeIE0VbPNIiWqf+X5T4nfZ8eTZ44zCM9YENVCYEEcXkQDgqZYyvFWh55HJ5cxxqjMqcB2G/Qr9iAl7vczczxyF0+3/d0sN21zduGebmYxYdP2EZC6useLhpHhaFNr4/poTIFi2UxTm/Oyfh5NXhWnDuwk3eBqx5Jnv40EzO9VYWZ3kXpszX+T3inqQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none X-Received: from LV8PR12MB9452.namprd12.prod.outlook.com (2603:10b6:408:200::8) by SJ2PR12MB8781.namprd12.prod.outlook.com (2603:10b6:a03:4d0::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.21; Tue, 9 Jan 2024 07:59:45 +0000 X-Received: from LV8PR12MB9452.namprd12.prod.outlook.com ([fe80::67bd:f1b9:58a3:d2e6]) by LV8PR12MB9452.namprd12.prod.outlook.com ([fe80::67bd:f1b9:58a3:d2e6%7]) with mapi id 15.20.7159.020; Tue, 9 Jan 2024 07:59:45 +0000 From: "Chang, Abner via groups.io" To: Nickle Wang , "devel@edk2.groups.io" CC: Igor Kulchytskyy , Nick Ramirez Subject: Re: [edk2-devel] [PATCH] RedfishPkg/RedfishDebugLib: add function to print buffer. Thread-Topic: [PATCH] RedfishPkg/RedfishDebugLib: add function to print buffer. Thread-Index: AQHaQsuIgC3vEycfh069dT3ZWb/2mrDRGxNw Date: Tue, 9 Jan 2024 07:59:44 +0000 Message-ID: References: <20240109071432.32648-1-nicklew@nvidia.com> In-Reply-To: <20240109071432.32648-1-nicklew@nvidia.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=c67af31a-2a92-4ca0-8a0f-cf7211cf6521;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=0;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2024-01-09T07:49:11Z;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LV8PR12MB9452:EE_|SJ2PR12MB8781:EE_ x-ms-office365-filtering-correlation-id: 703177f1-b776-4ef1-5dcf-08dc10e8f17c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: wec0nZo6fere2neGdeGsKM+jhfM1FwjZzasmYBopfjDWhb7kmEjfp24WNZld9s0Bnc6YpXF2ex4INZxTbCByVmb1JQFtheuY37fBRd9nmqVU1IxeLSikJpqdm5HZ6IUixpV57UMO5oKi4Pybh/utSQ7/V59TbB+D4nLqMAh17uEr22FFNH0KW878vSBUWCa54bV7WnbbmMh4ChE1X4Pse5aVsmhR6DZNLfeeY1vcXJHexkTkd0ekOKL74lYYIRbbdyJSKqS3iBFrf5xctrtYNaQnc2gIN5PzAL3NIVDzqJIPlejUqecKNTbJwL/hYZb5eHn7ssR53z3bFNcbIqxS4COxUMSIAFwT6YflvlqfXbH0B12vWXw4prCzQgx92zZbOjj33GwLovjM5nGb3xxgwImEfeYPAHBn/c4xo0y1BUMzTL32S5eaiDVheTB7BGxBW0tSjfjmUkdyrw4WKKMLOoBXuPRbsy/sNHYoZ0zjIgwBXoiPxkftVczBXT5OqMOzJrMRibgHcvdnXO9PR5kNkqRgvRg75WSGphFL8td553O0VuwanPSgFKCc56Nn6I54UeOx8E0QRY83VpBrhHLZmTg4bAWgPFpi+fZ/d48C1yIdt0mPz1qmz24Ih3kpxFIhDHZF3meReaug9Wjby7b0eg6nsjeWnhwlfYoj2pfmzJE= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?/gvk9veVuZgHYodPC+p8O/mDC2IRi0LCRoX8UaxdxAp/xtJ+i9MYISJ7BVc3?= =?us-ascii?Q?eg2jsEou4AEiqx1R5iBk89CFI8c/+ysL/EWj6LsaUgItTcv6JIff+CGDXbp8?= =?us-ascii?Q?ypP2pAptla5qZlZOvEHYOBr6m02f94+GHB8+6IvYh4nkq1JWpGc4B0nTQImq?= =?us-ascii?Q?QEQGfdjGV44u1G+Fed4IZ5NppSxjJGsUfS7CUFNhd9xtgYjwpYlnYZI3IBGq?= =?us-ascii?Q?+3WYwlvjUeW7eW3yOJMKQ2OXMEYnNtQw7wunJQLkiypY31+AjXeLj7xBzOt5?= =?us-ascii?Q?JaiZoKiUSWZZe47coACrIYoUkFSht9PP8fQuC+Z6iw0xM9tQdiglml+Gj/F7?= =?us-ascii?Q?wHZiemHzUWPeE8Da/eKaS7XXuWSaFKYSn0LByRRMCE8hwttHBLkRau4MB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zhkfqfhka5MgANEoae3ciZoOx3DtgbcIAjpsopd5yxfr?= =?us-ascii?Q?zzgnmVzIMVIJeMFWEdRd1jeUPfAV4kJefkaPG3A8t97qZfSS+iTo01hC8Wi4?= =?us-ascii?Q?tMus+YfgJ0irr2jig0Wb85Kgk2sVJvgD2mMFOF/iWfYv1r/qDDLZPVf0ts77?= =?us-ascii?Q?tmBY2zHBAhZM4Vvx8nFIQfJCwDEONzmGDEPq+tqPTP7ld2vU09QY/bkyJLe+?= =?us-ascii?Q?xy1TkOLVoZ0SfIVfW0fzLnNEw8imcX8qkXAsIwsSehkJJH2SMuhA8ePyFxEZ?= =?us-ascii?Q?MNcMe0D0ucH3BAIwL5U=3D?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: LV8PR12MB9452.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 703177f1-b776-4ef1-5dcf-08dc10e8f17c X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Jan 2024 07:59:44.9080 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: qiVFKG9XRwoFZkF19Db1UDRJ2h3u1McT1xzKBuB+/Qdle2srEKdfN6ue1MjbpakmGG2D+VAcDQ19jmLztt65qg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8781 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 Reply-To: devel@edk2.groups.io,abner.chang@amd.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: SXhdJVnJiIMsFcHLO3FJUbcIx7686176AA= 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=20140610 header.b=oWmZtNTm; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io [AMD Official Use Only - General] > -----Original Message----- > From: Nickle Wang > Sent: Tuesday, January 9, 2024 3:15 PM > To: devel@edk2.groups.io > Cc: Chang, Abner ; Igor Kulchytskyy > ; Nick Ramirez > Subject: [PATCH] RedfishPkg/RedfishDebugLib: add function to print buffer= . > > Caution: This message originated from an External Source. Use proper caut= ion > when opening attachments, clicking links, or responding. > > > Introduce DumpBuffer function to print the buffer content. This helps > developer to debug Redfish issue. > > Signed-off-by: Nickle Wang > Cc: Abner Chang > Cc: Igor Kulchytskyy > Cc: Nick Ramirez > --- > RedfishPkg/Include/Library/RedfishDebugLib.h | 20 ++++++++- > .../Library/RedfishDebugLib/RedfishDebugLib.c | 41 ++++++++++++++++++- > 2 files changed, 59 insertions(+), 2 deletions(-) > > diff --git a/RedfishPkg/Include/Library/RedfishDebugLib.h > b/RedfishPkg/Include/Library/RedfishDebugLib.h > index 5f75bad12a..3430cf1d14 100644 > --- a/RedfishPkg/Include/Library/RedfishDebugLib.h > +++ b/RedfishPkg/Include/Library/RedfishDebugLib.h > @@ -1,7 +1,7 @@ > /** @file > This file defines the Redfish debug library interface. > > - Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserv= ed. > + Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights > reserved. > > SPDX-License-Identifier: BSD-2-Clause-Patent > > @@ -138,4 +138,22 @@ DumpIpv4Address ( > IN EFI_IPv4_ADDRESS *Ipv4Address > ); > > +/** > + Debug output raw data buffer. > + > + @param[in] ErrorLevel DEBUG macro error level > + @param[in] Buffer Debug output data buffer. > + @param[in] BufferSize The size of Buffer in byte. > + > + @retval EFI_SUCCESS Debug dump finished. > + @retval EFI_INVALID_PARAMETER Buffer is NULL. > + > +**/ > +EFI_STATUS > +DumpBuffer ( > + IN UINTN ErrorLevel, > + IN UINT8 *Buffer, > + IN UINTN BufferSize > + ); > + > #endif > diff --git a/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c > b/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c > index efa9a5ca13..5fd40ad955 100644 > --- a/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c > +++ b/RedfishPkg/Library/RedfishDebugLib/RedfishDebugLib.c > @@ -1,7 +1,7 @@ > /** @file > Redfish debug library to debug Redfish application. > > - Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserv= ed. > + Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights > reserved. > > SPDX-License-Identifier: BSD-2-Clause-Patent > > @@ -21,6 +21,7 @@ > > #define REDFISH_JSON_STRING_LENGTH 200 > #define REDFISH_JSON_OUTPUT_FORMAT (EDKII_JSON_COMPACT | > EDKII_JSON_INDENT(2)) > +#define REDFISH_SIZE_PER_ROW 16 How about name this as REDFISH_PRINT_BUFFER_BYTES_PER_ROW, looks more clear= . Abner > > /** > Debug print the value of StatementValue. > @@ -366,3 +367,41 @@ DumpIpv4Address ( > > return EFI_SUCCESS; > } > + > +/** > + Debug output raw data buffer. > + > + @param[in] ErrorLevel DEBUG macro error level > + @param[in] Buffer Debug output data buffer. > + @param[in] BufferSize The size of Buffer in byte. > + > + @retval EFI_SUCCESS Debug dump finished. > + @retval EFI_INVALID_PARAMETER Buffer is NULL. > + > +**/ > +EFI_STATUS > +DumpBuffer ( > + IN UINTN ErrorLevel, > + IN UINT8 *Buffer, > + IN UINTN BufferSize > + ) > +{ > + UINTN Index; > + > + if (Buffer =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + DEBUG ((ErrorLevel, "Address: 0x%p size: %d\n", Buffer, BufferSize)); > + for (Index =3D 0; Index < BufferSize; Index++) { > + if (Index % REDFISH_SIZE_PER_ROW =3D=3D 0) { > + DEBUG ((ErrorLevel, "\n%04X: ", Index)); > + } > + > + DEBUG ((ErrorLevel, "%02X ", Buffer[Index])); > + } > + > + DEBUG ((ErrorLevel, "\n")); > + > + return EFI_SUCCESS; > +} > -- > 2.34.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 (#113426): https://edk2.groups.io/g/devel/message/113426 Mute This Topic: https://groups.io/mt/103616099/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-