From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web08.113.1648172450459356374 for ; Thu, 24 Mar 2022 18:40:51 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=ieP6gcQS; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: ray.ni@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648172450; x=1679708450; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=GzTB8NKk6FqVUGJIWriUi0eOh/i6A53AHHhIQWLwOIc=; b=ieP6gcQSqMmryqa/HGYnbqSw5+ca0YHxdZYk5gmQ9gzGTUn7SoAWMaTF T9gEFip5Opua47BnzjX4GtFykVXfi6+lNQEP87iIvGCE55Hzpfou7dbJD nzQYYzSbAWNdJMgWPZsCd4kN4WX13aHZ92Ne92OPs2QNGChQcMjRj5w8C XFOaK12/cnBiV9pSLRS42mkMGLTdnNs5vcmZ/Oi4ersCItFeSnv2R1WPm gultMmbvVQO/80+HiGO77ptKnCEBlHtlVXB0xrYIpSrNyxE6J06SQDRU7 AnKp4O4hw1FK+jyVacBC7laj+lTmj2UehW+xXXvditZIZf1Zx0yN/ntGt g==; X-IronPort-AV: E=McAfee;i="6200,9189,10296"; a="240687533" X-IronPort-AV: E=Sophos;i="5.90,209,1643702400"; d="scan'208";a="240687533" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2022 18:40:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,209,1643702400"; d="scan'208";a="501615686" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orsmga003.jf.intel.com with ESMTP; 24 Mar 2022 18:40:45 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Thu, 24 Mar 2022 18:40:44 -0700 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Thu, 24 Mar 2022 18:40:44 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Thu, 24 Mar 2022 18:40:43 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.107) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.21; Thu, 24 Mar 2022 18:40:42 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MHe3T9K8k9SOLw0EnAmAt/4fZvXAWKl/QFIMfQuxGJlgiJqxJ4uIUkksHDtkI6BBbqHfv1kwQOs/orSyg6hXwdii97hZRG3Pm8VAIQzWv72Fpi2/nM2bhjPCKlOolJSHbibw3KWVj6WYXJocIw8bzu/APBM6Cuy7dvCzsQN4YVYE9r03VrazLmIz0MPep4o1iNxYEbBltS3Ysyy5qqhMdFYS08RrfYomVqwHKzkZbjXRQ6nBKQoU1pSWiiI4mUg6uNW2s/cdKqekekU2m7LhLvGamqR73ghC9N5xc95b6MSIaf0CTzo1tbhabxsZKDPzV0Sa1xTvCJkr12HKOBEJlg== 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=w5jwYyoRRM3DnAgXaL7Y6Q53/sLbM8i0xr0j68/7nZI=; b=k0NtvNBGQDdjk6/3DHfoKWuruCYd7/WOKVOgUoQgNlWKcqOHKuyIcHGLTprwzoRK6ANLURNebGIaG4J6ReXJsYKWkqcgkEZF7kdrcgIZRfcaB0U/UAuBhqLBuFQYrrwymrTnd+jKW7IwCIQDF5lwIL1KQR3Q2LM1vG8qQTAoA8JfD7T6qEof+j2v777UJ4rg9Du6ZjRGkaa+KhfB4ZQwwvRsPhx6HpRe0B1dJCWFk0TXSC26tNtvj27A2DTA4W9JMfFYtAT4l2pWdEc8cNR0RY0zl/RxXjVzVTMa2OnWw4XuS7hbCu3pwBcA0IJzoq5BMvu+iXnOPJXlg9jMoB3Xcg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from MWHPR11MB1631.namprd11.prod.outlook.com (2603:10b6:301:10::10) by BL0PR11MB3027.namprd11.prod.outlook.com (2603:10b6:208:77::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5102.19; Fri, 25 Mar 2022 01:40:39 +0000 Received: from MWHPR11MB1631.namprd11.prod.outlook.com ([fe80::30a3:3926:64ca:50d5]) by MWHPR11MB1631.namprd11.prod.outlook.com ([fe80::30a3:3926:64ca:50d5%8]) with mapi id 15.20.5081.023; Fri, 25 Mar 2022 01:40:39 +0000 From: "Ni, Ray" To: "devel@edk2.groups.io" , "Xie, Yuanhao" CC: "Dong, Guo" , Maurice Ma , "You, Benjamin" , "Rhodes, Sean" Subject: Re: [edk2-devel] [PATCH 1/2] UefiPayloadPkg: Add a new DebugPrintErrorLevelLib instance. Thread-Topic: [edk2-devel] [PATCH 1/2] UefiPayloadPkg: Add a new DebugPrintErrorLevelLib instance. Thread-Index: AQHYPpz0hTp6dDwIIUy7PjAoVtjBGazPUtVQ Date: Fri, 25 Mar 2022 01:40:39 +0000 Message-ID: References: <20220323100053.373-1-yuanhao.xie@intel.com> In-Reply-To: <20220323100053.373-1-yuanhao.xie@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.6.401.20 dlp-reaction: no-action dlp-product: dlpe-windows authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f044e434-a1fa-41d4-33a6-08da0e007786 x-ms-traffictypediagnostic: BL0PR11MB3027:EE_ x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: GEet0V+YlrvAgDmQm4uZC4BsnEcZOsHNVMaPThMdxFrbD1VWIf9s5u7LPi8mlCnZRYXlIlu5wG+8S6bAvcYID0nH/21n1pGWbdCLNbSi8EXQjC4gmb/EO/vOM9y2D57fiPkL1dPLpwCqP8dmJRTnZH8mU8m2rt1TnJM+gne+9Fo80v4hyfEUZYvtY7Oj4k5dXcilhngiYzgFnHYCUedisNi+6QKDqzdUvPIrXvsEgwcS1hDFknRhOwlNgAo+TcUyuV+Gwqe5VuQZU6I+MdGQBYHe6NzzLZki2dolvFx4m6N/mpx4j9Il/JGGSNG838lkxBwyVOQ/oeR0yRRTjFNBGt3DzqRaaGVoCmeoiLwfEywlZdKFVziH79ltUOBtdUg98cvZXaPTOCd8t0JV/sah4I8LnI3yXAa/IKmEqzKm1SOi8BNd6RS8aNuLhxBIKv9am3efJsXJ3uO5uZ8+KyAiprb/90j7/Xf8Wk8/3Edm48Ai7mPxWvCa3J2zUJ7UCGZ8WeCwEcrpF215I5aUZ/sUmid7mXpKcJFUJZo7H7q8k3yqvONHXbUyeUJ2POzdIXs4rpL9W3aTF0rnEldkIJZVPFGlLR/Y6pSpcc1ehkCL7qvnzDxPQUP97VI5CNQfYr3XRntgKmsjGE96MG26xxinGbA36aGUiHvCxxUFBBzjrn2OJeWo+nYhfmUOYSBi0AQVfFpD+MKq2E7vH8WR3hk6YV6AmNAl1wHwbEmTKYr/Ay157k/Rad3H9a3Tw2Hn/jXP+aQt5QF6CJBv6qAlVAG3G0CkXTsGU6AekK/FONn5XVOH8KVk6dA4M3FPfOqvT7gZTyELfQX4IG6v/4Ok8Lkm0cOBduvknOstAe2RlW45KFc= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR11MB1631.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(66556008)(122000001)(66946007)(82960400001)(8676002)(64756008)(66446008)(66476007)(4326008)(76116006)(5660300002)(2906002)(55016003)(38070700005)(86362001)(52536014)(8936002)(38100700002)(316002)(83380400001)(7696005)(6506007)(26005)(9686003)(71200400001)(186003)(110136005)(54906003)(6636002)(966005)(508600001)(33656002)(213903007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?bSLgbPZ4zgDHk99wHZxlCz23ycSs/UFsr+kSV93EB7fkL/fJCBIReuNqkZfV?= =?us-ascii?Q?rU2Sy38qj5O9X1kxUK5ldyO0Hj1SvZiiLM/ii5ILklPDw6xfwttoKV9GQhCw?= =?us-ascii?Q?5q2SuNsuNG09wTNklcUViu2s/gjVTFYku10neA1zIRMIeUdNrrPig4ygJMBe?= =?us-ascii?Q?9WcKvxv5RFw+BC4XHuFQAZl2CPYvY6J7IBnUzh4qWNyBfzW5nJ/PeiHerZbw?= =?us-ascii?Q?8Ei9oKvIUyytO2+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JYzhsPlcDpwW6hLV5P?= =?us-ascii?Q?zhK4VD2YwM7Agzj2AREkwQpXiYIRKA2ClgAi9VyAZdAyQGBUX8WuNkBphs6n?= =?us-ascii?Q?Lwt/0QCfZ+rI+UXcnTWP8sxDFrd+RYnLaCcjYvkifmqVReld0V1Ansr5Ffh0?= =?us-ascii?Q?QO4BGfbJ+Uc/rRnrXxjLm0wpFH0mEnLKbAqTCntlgHkBDTaPw7rzLxhGXYl+?= =?us-ascii?Q?a/Q+pNMvwKGYge4Rgd+vaTPVPWf1OyV7+oRQjTs1PE8GVoXaHZpFQnZVXOto?= =?us-ascii?Q?JS8/Ih1qhfOKgvXlNuVfeTHqanUtzb/nLCe5FtrylfTGAXjr6kP1te1r2Bj+?= =?us-ascii?Q?wZqe7N1RyrPKh9PQPg7cEGBRAQtqXevDP4m40IMsxNcj7qBT+UznUpBCCLnU?= =?us-ascii?Q?2j27mLQi3jOSlffxjCqxHAvsEuGy86RkW0d5GNJE1R/apCoKbQXnJ3sFIt6e?= =?us-ascii?Q?SSzHIgKQipRnJaxfbswunjBUNkeDP/ZuSJaXmxKNUjBmmqxiNBQw/EbFM1qU?= =?us-ascii?Q?N5FUFpAEn105EQVncjGxIv9PvKZMaeeixJKQMwfeKbAXOvv4yWhQ8n7r557R?= =?us-ascii?Q?QhMb/S7+G6YH6jSWVdd5VwLH4On+/ENznkxRcH1NF86K5i/hjBf6mdL55xIy?= =?us-ascii?Q?deJb3ZnqhA=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MWHPR11MB1631.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f044e434-a1fa-41d4-33a6-08da0e007786 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Mar 2022 01:40:39.3169 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 4XkFKJw6Cbfvqk7BbGqfpcB7VPmfbdkhL4RPBB+PQe2rOQVx7S3pnDrDvV81y/+p6C9Lpo7WdSr7RRtqmR4SEg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR11MB3027 Return-Path: ray.ni@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable +++ b/UefiPayloadPkg/Library/DebugPrintErrorLevelLibCmos/DebugPrintErrorLev= elLibCmos.c 1. Please change the folder and file names to "DebugPrintErrorLevelLibHob/D= ebugPrintErrorLevelLibHob.c". Please change the INF file name accordingly. +#include 2. PiHob.h is included by PiDxe.h. So you can remove the above include. +#include 3. Can you try to remove the above line? Can build still pass? +#include +#include +#include 4. Similar comment. +#include +#include +#include + +/** + Returns the debug print error level mask for the current module. + + @return Debug print error level mask for the current module. + +**/ +UINT32 +EFIAPI +GetDebugPrintErrorLevel ( + VOID + ) +{ + VOID *GuidHob; + UNIVERSAL_PAYLOAD_GENERIC_HEADER *GenericHeader; + UNIVERSAL_PAYLOAD_DEBUG_PRINT_ERROR_LEVEL *DebugPrintErrorLevel; + 5. can you please use a global variable to cache the error level so that no= need to query from HOB always? e.g.: define two below variables in the beginning of the file. UINT32 gDebugPrintErrorLevel; BOOLEAN gDebugPrintErrorLevelInitialized =3D FALSE; then in this function: if (!gDebugPrintErrorLevelInitialized) { // re-use the below logic to get the value from HOB or PCD if HOB doesn't= exist // store the value in gDebugPrintErrorLevel } return gDebugPrintErrorLevel; + GuidHob =3D GetFirstGuidHob (&gEdkiiDebugPrintErrorLevelGuid); + + if (GuidHob =3D=3D NULL) { + // + // If the HOB is not create, the default value of PcdDebugPrintErrorLe= vel will be used. + // + return PcdGet32(PcdDebugPrintErrorLevel); + } + + GenericHeader =3D (UNIVERSAL_PAYLOAD_GENERIC_HEADER *)GET_GUID_HOB_DATA = (GuidHob); + if ((sizeof (UNIVERSAL_PAYLOAD_GENERIC_HEADER) > GET_GUID_HOB_DATA_SIZE = (GuidHob)) ||=20 + (GenericHeader->Length > GET_GUID_HOB_DATA_SIZE (GuidHob))) { + return PcdGet32(PcdDebugPrintErrorLevel); + } + + if (GenericHeader->Revision =3D=3D UNIVERSAL_PAYLOAD_DEBUG_PRINT_ERROR_L= EVEL_REVISION) { + DebugPrintErrorLevel =3D GET_GUID_HOB_DATA (GuidHob); + return DebugPrintErrorLevel->ErrorLevel; + } else { + return PcdGet32(PcdDebugPrintErrorLevel); + } + +} + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D DebugPrintErrorLevelLib 6. Please change the BASE_NAME to DebugPrintErrorLevelLibHob.