From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web12.9296.1636445558303037993 for ; Tue, 09 Nov 2021 00:12:38 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=XUgsIn9/; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: jakub.fedorowicz@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10162"; a="295839239" X-IronPort-AV: E=Sophos;i="5.87,219,1631602800"; d="scan'208";a="295839239" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Nov 2021 00:12:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,219,1631602800"; d="scan'208";a="451836944" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga003.jf.intel.com with ESMTP; 09 Nov 2021 00:12:37 -0800 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Tue, 9 Nov 2021 00:12:36 -0800 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Tue, 9 Nov 2021 00:12:36 -0800 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Tue, 9 Nov 2021 00:12:36 -0800 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.108) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Tue, 9 Nov 2021 00:12:36 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c1TRXq0KqKHRJN6eR1Ch3u/S58uTUxpLHwq0I4GMXG1ookPG2kwt3lP/F/DQcY/M+aMOIwUi693GKtFUnsJIpqAhe2fO7Segmjr75Ur6BaHTMdjKAzNkjuG2mC2HI98+FmMj2BMve/Rp6BUhD8Sb8WLJjnlqVSJndjiD6z7RZE4IHW2LkQWmxysvioBzycA0w436zHzEYX9PDS0hney1aJ8e94p/gPNpm4dg3v7cKntD640N0e0LABcvBemeHLNsYYng+tNtRwux8pMZ8/FFMTbZq2r4iP/vKi9uDAGL2QlO6NDMcb95106WXzOkk6D5MtkoaF8Ibxbr/uiyWRRhxw== 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=Zzb1pX/pnImD6IPbgjLzuQrtJylFGtNQJLwOxMOek7g=; b=IqOv++zP71e357LNyEW0LEicHMrwnLD6bOPJ0gXJfjgtg/tPuowVY8Ui+yC6Rw+Kr4T2F4SLRlEmksAed3HY163EIV2QejO5tPUXDB5sFI12dRRWXuFXn81FT+vBDz7d4iqv7KnDqcnUeV0h2paAvpeh0Q1xrwDN67laM9knMl6HvRXRSB9kH+RSjZCG3GuCbbVElQA1pWjXV0JobaoQyQ1U2Hv3VzTacQBJ4KrkqWrb01SwvLr/yUhKuerkvGE5dpGQ6wdyqLc/Lux2qvIVNaMcobPuZ1Kc94dD6uE7/UX0OB/ZUtJ4YGFEA+wCUnnyRnrQEedCnDrYYzvJoX82qQ== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Zzb1pX/pnImD6IPbgjLzuQrtJylFGtNQJLwOxMOek7g=; b=XUgsIn9/eAqXBNIEt7Mw9r7uYasU9ySQkAOzj24IAVEtmaE+K04i5GPjJsCeoZkpHg6o4W7x1UqdycvzTeZsKvvZn0+tzx8TB12MrWLuwxdhw1MJACTln+3p4qrkJA/rFMLhOQN1FMP2FnbUbvD6sYBpFWoMWzGZCBZJ4TUxiJM= Received: from BYAPR11MB2709.namprd11.prod.outlook.com (2603:10b6:a02:be::10) by BYAPR11MB3046.namprd11.prod.outlook.com (2603:10b6:a03:86::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.13; Tue, 9 Nov 2021 08:12:35 +0000 Received: from BYAPR11MB2709.namprd11.prod.outlook.com ([fe80::f492:735:caf8:1a67]) by BYAPR11MB2709.namprd11.prod.outlook.com ([fe80::f492:735:caf8:1a67%6]) with mapi id 15.20.4669.016; Tue, 9 Nov 2021 08:12:35 +0000 From: "Fedorowicz, Jakub" To: "devel@edk2.groups.io" CC: "Chaganty, Rangasai V" , "Ni, Ray" Subject: [PATCH v2] IntelSiliconPkg/BaseConfigBlockLib: Add function to iterate over Config Blocks Thread-Topic: [PATCH v2] IntelSiliconPkg/BaseConfigBlockLib: Add function to iterate over Config Blocks Thread-Index: AdfVQIkuYtdbEfsJRg6oFjHq+hG2KA== Date: Tue, 9 Nov 2021 08:12:35 +0000 Message-ID: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.6.200.16 dlp-reaction: no-action authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 60738c71-6168-48db-8807-08d9a358afe9 x-ms-traffictypediagnostic: BYAPR11MB3046: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: uZFvijTbvLr5zB1bXOXB2kjdqA3bU8Elnx/Nm/OEwdFyC6qrnkMo/WKVQq73UnHGr7cW1uAX9k/eygB2M2X2LeJmyR7nNI5fY+Egvb20esH2ydB31rPGVmQjnzNMLjiw6ahfdIGkcB9RjEKxFGZC5KxfpuNFezftSR7dq3PGWOSrPLTBhopevhl7Qhq/6LfHlfBYY6I73M3DlwP/1okVyg7W385zm9C09FkD/K9xVwPPK8XYhkukTjZOnThHRj/ogYT5tTChu5loUUaJQ/s6LgfwVcKCae5eu7aMr1IDLg/flWyqNL2zWn1mVgjayEWxVIR8jWYg6peWjcOeNegJIulvedQVsn8Wb2WvKqQH0b3kCRGyYR9ERs7jJEsl6PPkU08wXM8szLB0OsoIAMgllEtamlgk6xwN1MpZ5WCdwm0r8zG4IGM09oXVkaidWQFIQgHjqswfT9qZNpYglzQ55r46guUd2sFRDJUMSdpZkq61BLNlQZvWDjGboK7PuwP3zDlqVI563KMGlTqTHy8+PRmRLueKl5zw+XsTSIxxY83DZvpxmWeoyHW1G+DmYIqCflEwslKBku/oeCb780Inmfe1kzShDF+fAePlLGY+CX8hMNENUhyJST0LPVCjoLM+d42SEehrnlTsmMsHjHkPm2EOUniowoABj/PbaByn7McxQliQ1/oLN/nGYslLoqeF8G4yJ2ptdaSDnCw5t/HrNIFwBeOFGxJHwsr5nPaZZ+o3wjk3u1W2GYVih3C9jgAZOjhVSj8ZhNb3+u8Za7qy2wIBZtQPIFRWwaOb+VRygbw= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR11MB2709.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(66946007)(66476007)(38070700005)(38100700002)(66556008)(508600001)(4326008)(76116006)(83380400001)(71200400001)(52536014)(33656002)(7696005)(86362001)(66446008)(82960400001)(64756008)(54906003)(2906002)(6916009)(966005)(316002)(6506007)(26005)(55016002)(186003)(8936002)(8676002)(5660300002)(122000001)(107886003)(9686003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?eQFoHrwEDmofgyGIksWLNznzwXZauiuAbrNoeg6GhW848RU7RanbsISYE4LD?= =?us-ascii?Q?yj48SwL/pUjxU+KvFxoD9mjEdS56KjwG6gDrmMiipufx+iOhekx+0eD8PYqr?= =?us-ascii?Q?u2no1uJdx2f1UVak9YaPAYrsWh8jQPmeeKIfTKtkAxUK6hZ1HFDvKsboePBB?= =?us-ascii?Q?2HGedeDZpdwRO+RUIxOAOXojv/4shdlyeX+dEIfSupd3lwvevTkOud5Rr0C6?= =?us-ascii?Q?VbT7a+E6OwIcSoYqiANe6ZbvS67fM6BNxjVtbT8DpSUoT9ZrCaE9m7jGgehW?= =?us-ascii?Q?/Pv7X4ewnSKMNZN3atKC5o6PDwOLKKa/hmurXE5JhVg3jsex8n4cTNMJUAEn?= =?us-ascii?Q?8zHvE3FZIwt8h6+iaekBfaWeb43t+XBuSsZxIacEk3vP7OEcjZEmnVO2518j?= =?us-ascii?Q?4bfJ/vshrL1PAmcecgtp2Mf8gg4s9LaCCl8wyGanjroNIYzmtjwzahOZ88lV?= =?us-ascii?Q?fwTwNq92qb/5MWWflR7jfuCnsXEzPo3n2QY+wh5tYJYlvsAND6Nb9b0UP1O5?= =?us-ascii?Q?AGKzLPgcSAwKXd71JmIuBFthLn1mW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-ascii?Q?AnRkJGmqbJ/1Lu1cVhIHzbt6zRKyyH8IKF1SP+qpf6eV1fswo/rubhqZt6Ln?= =?us-ascii?Q?kQ4zaEsLACB2UY0XbRkK2wkjeaYBjR3xDgKTH5ERir0TN1hspH1XKg5qOd2z?= =?us-ascii?Q?ESGE5gvZDY+2g4shU2NqFJLemlxxkFBjNxRji9omhMbDQ6tjUlYnxrM/qD9J?= =?us-ascii?Q?Oc+ftPT3qO2SKQ3/RjAOvJ0AvbhV9AqtdlcBcLTj60HEHtwOHwzqWAeghtGB?= =?us-ascii?Q?TujDJw=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR11MB2709.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 60738c71-6168-48db-8807-08d9a358afe9 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Nov 2021 08:12:35.2023 (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: 2RJ9qpKF1wmV/p1OS9uVNaY7yPtCVx39whMiDS1/SfcwUWAoqWU7T4axwx1ov11vyy/csNJR12/eLaUO6f3Q8vwY4EBlf24ZK4zGjnH3RqA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3046 Return-Path: jakub.fedorowicz@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable In BaseConfigBlockLib add function to get next config block from config blo= cks table in order to iterate over blocks of the same type. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3700 Signed-off-by: Jakub Fedorowicz mailto:jakub.fedorowicz@intel.com Cc: Ray Ni mailto:ray.ni@intel.com Cc: Rangasai V Chaganty mailto:rangasai.v.chaganty@intel.com --- .../Include/Library/ConfigBlockLib.h | 20 ++++++++ .../BaseConfigBlockLib/BaseConfigBlockLib.c | 50 +++++++++++++++++++ 2 files changed, 70 insertions(+) diff --git a/Silicon/Intel/IntelSiliconPkg/Include/Library/ConfigBlockLib.h= b/Silicon/Intel/IntelSiliconPkg/Include/Library/ConfigBlockLib.h index 37a39681..77eff21b 100644 --- a/Silicon/Intel/IntelSiliconPkg/Include/Library/ConfigBlockLib.h +++ b/Silicon/Intel/IntelSiliconPkg/Include/Library/ConfigBlockLib.h @@ -45,6 +45,7 @@ AddConfigBlock ( = /** Retrieve a specific Config Block data by GUID. + If there is more than one Config Block with given GUID, return the first= found with given GUID. = @param[in] ConfigBlockTableAddress - A pointer to the beginnin= g of Config Block Table Address @param[in] ConfigBlockGuid - A pointer to the GUID use= s to search specific Config Block @@ -61,4 +62,23 @@ GetConfigBlock ( OUT VOID **ConfigBlockAddress ); = +/** + Search through ConfigBlockTable blocks to find following Config Block of= the same GUID. + If there is no following Config Block found until the end of the table, = return EFI_NOT_FOUND. + + @param[in] ConfigBlockTableAddress - A pointer to the beginning o= f Config Block Table + @param[in] ConfigBlockAddress - A pointer to the Config Bloc= k, in relation to which we start the search + @param[out] NextConfigBlockAddress - On return, points to a point= er to the found Config Block + + @retval EFI_NOT_FOUND - Could not find the following Config Block + @retval EFI_SUCCESS - Config Block found and return +**/ +EFI_STATUS +EFIAPI +GetNextConfigBlock ( + IN VOID *ConfigBlockTableAddress, + IN VOID *ConfigBlockAddress, + OUT VOID **NextConfigBlockAddress + ); + #endif // _CONFIG_BLOCK_LIB_H_ diff --git a/Silicon/Intel/IntelSiliconPkg/Library/BaseConfigBlockLib/BaseC= onfigBlockLib.c b/Silicon/Intel/IntelSiliconPkg/Library/BaseConfigBlockLib/= BaseConfigBlockLib.c index c89699ea..f026ac0b 100644 --- a/Silicon/Intel/IntelSiliconPkg/Library/BaseConfigBlockLib/BaseConfigBl= ockLib.c +++ b/Silicon/Intel/IntelSiliconPkg/Library/BaseConfigBlockLib/BaseConfigBl= ockLib.c @@ -95,6 +95,7 @@ AddConfigBlock ( = /** Retrieve a specific Config Block data by GUID. + If there is more than one Config Block with given GUID, return the first= found with given GUID. = @param[in] ConfigBlockTableAddress - A pointer to the beginnin= g of Config Block Table Address @param[in] ConfigBlockGuid - A pointer to the GUID use= s to search specific Config Block @@ -137,3 +138,52 @@ GetConfigBlock ( = return EFI_NOT_FOUND; } + +/** + Search through ConfigBlockTable blocks to find following Config Block of= the same GUID. + If there is no following Config Block found until the end of the table, = return EFI_NOT_FOUND. + + @param[in] ConfigBlockTableAddress - A pointer to the beginning o= f Config Block Table + @param[in] ConfigBlockAddress - A pointer to the Config Bloc= k, in relation to which we start the search + @param[out] NextConfigBlockAddress - On return, points to a point= er to the found Config Block + + @retval EFI_NOT_FOUND - Could not find the following Config Block + @retval EFI_SUCCESS - Config Block found and return +**/ +EFI_STATUS +EFIAPI +GetNextConfigBlock ( + IN VOID *ConfigBlockTableAddress, + IN VOID *ConfigBlockAddress, + OUT VOID **NextConfigBlockAddress + ) +{ + CONFIG_BLOCK_TABLE_HEADER *ConfigBlkTblHdrPtr; + UINTN ConfigBlkTblEndAddr; + UINTN ConfigBlkOffset; + CONFIG_BLOCK *TempConfigBlk; + EFI_GUID *TargetGuid; + + ConfigBlkTblHdrPtr =3D (CONFIG_BLOCK_TABLE_HEADER *) ConfigBlockTableAdd= ress; + ConfigBlkTblEndAddr =3D (UINTN) ConfigBlockTableAddress + (UINTN) Config= BlkTblHdrPtr->Header.GuidHob.Header.HobLength; + + TempConfigBlk =3D (CONFIG_BLOCK *) ConfigBlockAddress; + TargetGuid =3D &(TempConfigBlk->Header.GuidHob.Name); + ConfigBlkOffset =3D (UINTN) ConfigBlockAddress + (UINTN) TempConfigBlk->= Header.GuidHob.Header.HobLength; + + // + // Loop until exceeding ConfigBlockTable range + // + while (ConfigBlkOffset < ConfigBlkTblEndAddr) { + TempConfigBlk =3D (CONFIG_BLOCK *) ConfigBlkOffset; + + if (CompareGuid (TargetGuid, &(TempConfigBlk->Header.GuidHob.Name))) { + *NextConfigBlockAddress =3D (VOID *) TempConfigBlk; + return EFI_SUCCESS; + } + + ConfigBlkOffset +=3D (UINTN) TempConfigBlk->Header.GuidHob.Header.HobL= ength; + } + + return EFI_NOT_FOUND; +} -- = 2.30.0.windows.2 --------------------------------------------------------------------- Intel Technology Poland sp. z o.o. ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydz= ial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-31= 6 | Kapital zakladowy 200.000 PLN. Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata= i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wi= adomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiek= olwiek przegladanie lub rozpowszechnianie jest zabronione. This e-mail and any attachments may contain confidential material for the s= ole use of the intended recipient(s). If you are not the intended recipient= , please contact the sender and delete all copies; any review or distributi= on by others is strictly prohibited.