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 ACEDA740035 for ; Wed, 10 Jan 2024 02:25:55 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=oIoi51kh3FQ17JVRxWYGObwXDUvGrA7yEB7sCQkZ6TQ=; 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=1704853554; v=1; b=m5sHjMgI0yXE7pdpmSWfYRFTtg8MASJT+uEBPPQrN+9LZT03h1E9OtF+6KaSrSamIAdOXEAI KALNf4W1lGEBMeGnB12yh7/9QtT6eqbMdN4WvU9aCYfB+BcCTIJvD/o05oOMYwk4LvkrdYBiqxo nYIYFdAUlf8tAb+bQjQrUGDs= X-Received: by 127.0.0.2 with SMTP id JRAKYY7687511xvbtqrGXPHY; Tue, 09 Jan 2024 18:25:54 -0800 X-Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.107.223.50]) by mx.groups.io with SMTP id smtpd.web11.3279.1704853553291432740 for ; Tue, 09 Jan 2024 18:25:53 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z5u5cuBVeC1tnBr55R9pPxkny73ANSy3li83TZLpSh+yIOFSBJzq5F9tQbsDlx3uYN7Y1jFBVP8nhHzvxz/rMwsed6ItwPbfoZaH3I0QVZl8ro5U61qCkdmpvWrzP3GCXJmiS2OnSKdEg2brgmMPl1rBaj9Is0mRkapEYMccD4Mz9MUZw18Hk1rIKWccaVvlxIJcawHKgFHorHJzOfnJ8e5lFgBImfWYInr1ktUO4WwhbHh6sPr+8HPk8l/MhqtYvFV1FtavztxkNSzEzOKPoj/vUCbNROSja5PnN9EjmapemfX67oti049mnwbSy9Oe1A8jQ5B1LALDn4BjY+QMkA== 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=svUgOxtk0DPsSvLG+GUTwbkjwte4yvXJ4wHn9u2cars=; b=T5Ui6bm9fNBimmh8TggC8KnJERzLk5ca4QX8qrCLc2j5oFxbhc5lm8WAfWWqNAcmt7bcB3akWqpnV2dQDIUXn3GdGycjgmb5cDwgwSJ+3r2Qx7GrKsygi4VHtswbzhlRVfoX4ceZFymX0fSBq9NqGwd1q5ePcpkpqQb3JNpqlVNT6cI/xKv89Ty1C+62VxE1uIcseP/SsNKK99q4v035bl1TVvBNCGQFxF19vBA3KpTMU/hKadiP73M2Iogre8OYjOSA+DmRxWGOZ878waATMCS3lAuSJiMcuKsmwGeP37b/+4IGgbdtPsoInV13FnKxwCLkk+6riWPsUpXfKWWufA== 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 PH0PR12MB5677.namprd12.prod.outlook.com (2603:10b6:510:14d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.23; Wed, 10 Jan 2024 02:25:51 +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; Wed, 10 Jan 2024 02:25:50 +0000 From: "Chang, Abner via groups.io" To: Nickle Wang , "devel@edk2.groups.io" CC: Igor Kulchytskyy , Nick Ramirez Subject: Re: [edk2-devel] [PATCH v2] RedfishPkg/RedfishDebugLib: add function to print buffer. Thread-Topic: [PATCH v2] RedfishPkg/RedfishDebugLib: add function to print buffer. Thread-Index: AQHaQuzj7iC3ZRvfVUafYbIxB19Fl7DSTsbQ Date: Wed, 10 Jan 2024 02:25:50 +0000 Message-ID: References: <20240109111314.536-1-nicklew@nvidia.com> In-Reply-To: <20240109111314.536-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=1b4da3b2-bce2-4816-bf47-5d857c5c95c9;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-10T02:11:24Z;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: LV8PR12MB9452:EE_|PH0PR12MB5677:EE_ x-ms-office365-filtering-correlation-id: f760c70a-81a5-4818-a5df-08dc1183763b x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: QkLHZxxFcI9uikuRhuvSJXl+33rRLGWwnV4KmEBqfZAoAR3Eij2B79MsVzy3iJYVg1LTlT1/oEpDMiO7XEuQnDmUkCltLrxPnvvHhaauMjclHsaFnOOpSXJyODC8rpva+jdC3ofB6bZ9po15ZTvPCA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4Un8fIYpa1MxIsTfz+N9kAVhJs0DK8c5KYl8R18hkTHUDmQhWc4?= =?us-ascii?Q?TiifNcsKa92K2GS6N53Zmi5KJ35XWc+wE/KHAFVd/HQooyruOZDovWBb6luY?= =?us-ascii?Q?ZofuEMNMrHqtVZNJbj420TsOc0yxwy4T+25eLKZP9dc36JanV/KJlvPhXVZ8?= =?us-ascii?Q?ZYo0AsXSm2ueBTqtyGqRATghwKXQveOOw+lXMsB/UonEreZNAnTm0BPfbqHs?= =?us-ascii?Q?+NAgL2XoesYErSgJdx6zCEOoIXeecc/hNBK6UwsYW488NZ2DSoeUPDvay8HA?= =?us-ascii?Q?OuXjszIvCEkPXR+PeMU=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: f760c70a-81a5-4818-a5df-08dc1183763b X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Jan 2024 02:25:50.1275 (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: CDl0+PoKM97UMtIk0BR6Hnzf+OuGE4ZHS2OJtmX/+W8WZGnot+ikV5RAKcdjT77IectyrDAlt74/0JDzpopyCQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5677 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: sSpTxi3g19cXZC3ZYwlnFQBkx7686176AA= 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=m5sHjMgI; 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; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") [AMD Official Use Only - General] Reviewed-by: Abner Chang > -----Original Message----- > From: Nickle Wang > Sent: Tuesday, January 9, 2024 7:13 PM > To: devel@edk2.groups.io > Cc: Chang, Abner ; Igor Kulchytskyy > ; Nick Ramirez > Subject: [PATCH v2] 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 | 45 +++++++++++++++++-- > 2 files changed, 61 insertions(+), 4 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..3728f51213 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 > > @@ -19,8 +19,9 @@ > #define IS_EMPTY_STRING(a) ((a) =3D=3D NULL || (a)[0] =3D=3D '\0') > #endif > > -#define REDFISH_JSON_STRING_LENGTH 200 > -#define REDFISH_JSON_OUTPUT_FORMAT (EDKII_JSON_COMPACT | > EDKII_JSON_INDENT(2)) > +#define REDFISH_JSON_STRING_LENGTH 200 > +#define REDFISH_JSON_OUTPUT_FORMAT (EDKII_JSON_COMPACT | > EDKII_JSON_INDENT(2)) > +#define REDFISH_PRINT_BUFFER_BYTES_PER_ROW 16 > > /** > 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_PRINT_BUFFER_BYTES_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 (#113509): https://edk2.groups.io/g/devel/message/113509 Mute This Topic: https://groups.io/mt/103617651/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-