From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mx.groups.io with SMTP id smtpd.web10.51686.1658306979773102174 for ; Wed, 20 Jul 2022 01:49:39 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=gfRDZWxW; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: min.m.xu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1658306979; x=1689842979; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=G4ywJjTpx/wyVMseVrgOspS9LxpwcmvBuBDsJZwKA68=; b=gfRDZWxW/81hmJnslUaVGDoxccXW51YUZQUGXMGHSUAPSvw+r1wxxZWa bYdB8wr23G05WaV689lvcwK/2qyKeZBoTeVVQBNizH3OJOYDlR2Fpngl7 gQDLQahI6EJJGlOPyMhEwVV05oSUX/zM32BSsc86Sk6MC8RHA5S9VIG/V GcysgAE5DiJvk+VMf0drTSitskOQgn15Y1fn2gpUFhb7IDXtAFQoEp3Q5 qgE+hGPiCcxd+zKD93/OWFBcXv9WGvNU8wjuNPrFd7s0AdA6xnFLBG41j 1D6TQ9a5JXUZq+cr7r5gGYBBntnZGt+HO+TAqJUvx2hHEoyrHSSpFFOXc w==; X-IronPort-AV: E=McAfee;i="6400,9594,10413"; a="285484941" X-IronPort-AV: E=Sophos;i="5.92,286,1650956400"; d="scan'208";a="285484941" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jul 2022 01:49:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,286,1650956400"; d="scan'208";a="656174779" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga008.fm.intel.com with ESMTP; 20 Jul 2022 01:49:39 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) 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.2375.28; Wed, 20 Jul 2022 01:49:38 -0700 Received: from fmsmsx606.amr.corp.intel.com (10.18.126.86) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Wed, 20 Jul 2022 01:49:38 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28 via Frontend Transport; Wed, 20 Jul 2022 01:49:38 -0700 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (104.47.73.46) 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.27; Wed, 20 Jul 2022 01:49:38 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GRz67Q/BPmlUOM8xEO98igdTieT4D+8mDRYIouf+YaBZ2aMbgX5nXasTBqPnG/+Rw8Sr8MSO2c1BzRScdaudCzxLGAcP8+UNF0meGqk3kdRcuvAo3MwZRuaor8n6rEJILnhHRHNaCo1PgKqwer/mAXKydSWdAmDK+1coZmfxT4OLhdCMWoJMaYoqcrzQiCWOBYTH/StgDoylIjSU5Ah261Gh8TTOGWCYvDrg4bbkofnP3U9Ab+XAe6tIsgh4VPiQNiQHNzOsDZde4Dg45/WArsOHDiO2Tchrx1s/L4YBqyM25xCPwuhF1nqv0jeGYw2cYoT56U2TNvfUZaxQKAiZlg== 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=gzhaZhdjdtTy6frc3lFlhHQva/E7oNTMlKEtVfn66F8=; b=EoRK0TUN5jAqgMi7/H7djbnSJIdJYs6vZU4BqTu+ytX7L7KsCMQYjxrxtsqXXd62G2pwQKkv/vEJqmKyY7s3/iXlm3igdIuu6/6DXFGU/TRXYbsRmkfBz0wHrvEu9J2dXPwq1tcembBzDeRks2RDe9H1dBu43O269XbG/V6cVN6Pa/MVvv6avpqL3BeWty9kDIpSTsmC9lzk+pc++MzqUYlpMeh24sOluEE2pj0m+cdvKlI1pVpX3Meklzq3Fn1v0ZAiqR8dOtfw8xJGI99EICw3rU4oQdnT9ELAXwXYW213Xf3cVLPzYICrZea1O4ECvTyVCRCgFHXgObl5RD4Hew== 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 PH0PR11MB5064.namprd11.prod.outlook.com (2603:10b6:510:3b::15) by DM6PR11MB2795.namprd11.prod.outlook.com (2603:10b6:5:bf::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5438.21; Wed, 20 Jul 2022 08:49:35 +0000 Received: from PH0PR11MB5064.namprd11.prod.outlook.com ([fe80::61e0:6297:8d54:672e]) by PH0PR11MB5064.namprd11.prod.outlook.com ([fe80::61e0:6297:8d54:672e%3]) with mapi id 15.20.5438.025; Wed, 20 Jul 2022 08:49:35 +0000 From: "Min Xu" To: "devel@edk2.groups.io" , Leif Lindholm , Ard Biesheuvel , "Chang, Abner" , "Schaefer, Daniel" CC: Gerd Hoffmann , "Xu, Min M" Subject: Re: [PATCH V2 3/8] EmbeddedPkg: Add AllocateRuntimePages in PrePiMemoryAllocationLib Thread-Topic: [PATCH V2 3/8] EmbeddedPkg: Add AllocateRuntimePages in PrePiMemoryAllocationLib Thread-Index: AQHYiQm7d4kD/ASyAkGoIEXhEsvJeK2HGFSw Date: Wed, 20 Jul 2022 08:49:35 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.500.17 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: a76b4ac7-fc4c-4fd5-9dce-08da6a2cc599 x-ms-traffictypediagnostic: DM6PR11MB2795:EE_ x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Vh9jn8xNTddbUC1fbtYR4unVgV4h6DrhxdUEvGbLgWjT8cZW0nCTXCUQGfDs5VphxXquTcDQiTHv2aK8YJTyLUf+mmYLBruElbEe7Du/t5R6EcNBMVm4QZzA2/fdDKx8Z8zgLtHH6rR97C6I4hxn4+QvopnJkDYN+zrBgK4laZRGkz7z2VjNwD+QuY6GI6rJXrndA6DZ8hL3aq67Mn0qQotZs3MuBdl3xRA50eSbknMLbuqp15Cpai818azxZDP6MrpjzgqznUmv380Um9VNqeN8EVLj6CBc0ADTt0gY4FUtYIpeB48HuSY0NS3FTwP244GIR2J4OzZqudgYB47wKaIZUDpAwc1dONSUoEIcDvFJPsVkK0Pg+HZqHynaV5mgvxGb8XRJ12G89Nu5WfZASQgS2IHG9KYLVgtlZAbwXgg6rrbLqXN4KhyCkMB6pTVog7sXYQafdXtcYMKWfcQ8dfZ96cX9aifP7mpnCDAj2V3FrHy+u1vrc21vRgFZeIpXYxk3jJPXrRFnC8bX9QRQndd6rGZq4kFnbRltJvJLHOxGkwYc19q7jr+4/Lxq/1lC8pDTetV/BIN3MwmCaCF8fi1ibXrfb4OmjivBGFfi5I+tVhQl8cVQnolXJ7+kovMnXOHUkmFtUXB7gAf1KozB8GEuV5K05jQycOcSYDduyK+qlG86QBxFjyQAgGwdBESjSIoqaigDW4zmPnDwq5ni8e2ODLbX6XIP3QDvKlYv6U8aGa/f+UOTf8pOJsn0zQ3VngwqwVDoRGw02qruP7GY8QT+u7LxRlGm05aRxCbclJzOBFnD7LthfG7+4+KofdGL x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR11MB5064.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(6029001)(346002)(39860400002)(376002)(396003)(136003)(366004)(107886003)(186003)(38070700005)(83380400001)(38100700002)(64756008)(4326008)(66446008)(8676002)(66556008)(71200400001)(316002)(76116006)(66476007)(110136005)(54906003)(66946007)(53546011)(9686003)(41300700001)(6506007)(2906002)(26005)(33656002)(5660300002)(8936002)(478600001)(52536014)(55016003)(82960400001)(122000001)(7696005)(86362001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?A35DmponV5GMx+4Vebv3x6oWkUmzfQSCErLwUe2z9ta9sp5q3DQeXuc7S/yx?= =?us-ascii?Q?S9IEqmHub9vs5kvEWw8iynTA5rwBJ+5y2GB2er6olEf39mNZ51RWYjDjdQez?= =?us-ascii?Q?yB9AYdtcCU4mX8lfbho3IGVdcdGmUbFWyl0VOsVX4181akMA8Tz1A8eSu7gq?= =?us-ascii?Q?Jd16FFGJ9HuL0ByTbkn5+cRNkoFn+CmFNMcVAPjbdz0maMyBOPMs9tQ+hQDp?= =?us-ascii?Q?+0oexfAD8/5HpiPy0n+zJf8XGT4AbP/6+QZQf9SFdR1qPOsGQ+0wo0c/4Cpe?= =?us-ascii?Q?6qxAbEiHW/NoRQBZfoB8PAmNoPuq/94jCfO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-ascii?Q?tacI5EH9eCN/7jmmjHQqaAI16IMFlCbKQO4sY1Ht9WhHPYalNZXdZhsZyytU?= =?us-ascii?Q?ThZ+/zW1B44RxXQGgLUqdsPG/W/lMEL0q+jWkzxsKPfjhUZHOuG1qvbVNEGQ?= =?us-ascii?Q?7mx+YkqmqdFBPoLeQIS3yZGy0tz1Di+Vqum+IwkNGdUjdvHiVXjSPy6ERxQu?= =?us-ascii?Q?L4LSTx1ACme+76cAwTpqrvWpo5KSusSJ1x2qkgHrZA8jmjFcy5J0VGztRV6H?= =?us-ascii?Q?L+vQHN4MvLL8oSe4r3cJnhz81wVpxbblUPrQOBFbVf6E+H5Jiq0gZngYRaYI?= =?us-ascii?Q?9LByzsiHj9EnZRsU4Det2pF/vTsNGDEjKW9UzOJ8A10uoz/UYgYJqOm/2iY3?= =?us-ascii?Q?wx7tcu2vv4y8lxcVaZE9aWi+pBAMH8DjsaCIgWDA?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5064.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a76b4ac7-fc4c-4fd5-9dce-08da6a2cc599 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jul 2022 08:49:35.2318 (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: IJWCLbuOmUApMO3pkEjWIAC+ncmvihjpLyQPvpfesezJxgJP1ZrS6RSA60PHd7/PR78qeaQE1iM1DzyVtMgLOQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB2795 Return-Path: min.m.xu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, Leif/Ard/Abner/Daniel Since you're maintainers/reviewers of EmbeddedPkg. Do you have any comments= to this patch? Thanks Min > -----Original Message----- > From: Xu, Min M > Sent: Sunday, June 26, 2022 11:06 AM > To: devel@edk2.groups.io > Cc: Xu, Min M ; Leif Lindholm > ; Ard Biesheuvel ; > Chang, Abner ; Schaefer, Daniel > ; Gerd Hoffmann > Subject: [PATCH V2 3/8] EmbeddedPkg: Add AllocateRuntimePages in > PrePiMemoryAllocationLib >=20 > From: Min M Xu >=20 > AllocateRuntimePages is used to allocate one or more 4KB pages of type > EfiRuntimeServicesData. >=20 > Cc: Leif Lindholm > Cc: Ard Biesheuvel > Cc: Abner Chang > Cc: Daniel Schaefer > Cc: Gerd Hoffmann > Signed-off-by: Min Xu > --- > EmbeddedPkg/Include/Library/PrePiLib.h | 19 ++++++ > .../MemoryAllocationLib.c | 64 ++++++++++++++----- > 2 files changed, 67 insertions(+), 16 deletions(-) >=20 > diff --git a/EmbeddedPkg/Include/Library/PrePiLib.h > b/EmbeddedPkg/Include/Library/PrePiLib.h > index 7b2cea296f1c..3741b08c4478 100644 > --- a/EmbeddedPkg/Include/Library/PrePiLib.h > +++ b/EmbeddedPkg/Include/Library/PrePiLib.h > @@ -665,6 +665,25 @@ AllocatePages ( > IN UINTN Pages > ); >=20 > +/** > + Allocates one or more 4KB pages of type EfiRuntimeServicesData. > + > + Allocates the number of 4KB pages of type EfiRuntimeServicesData and > + returns a pointer to the allocated buffer. The buffer returned is > + aligned on a 4KB boundary. If Pages is 0, then NULL is returned. If > + there is not enough memory remaining to satisfy the request, then NULL = is > returned. > + > + @param Pages The number of 4 KB pages to allocate. > + > + @return A pointer to the allocated buffer or NULL if allocation fails. > + > +**/ > +VOID * > +EFIAPI > +AllocateRuntimePages ( > + IN UINTN Pages > + ); > + > /** > Allocates a buffer of type EfiBootServicesData. >=20 > diff --git > a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c > b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c > index 78f8da5e9527..9d7b34ad28fa 100644 > --- > a/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c > +++ > b/EmbeddedPkg/Library/PrePiMemoryAllocationLib/MemoryAllocationLib.c > @@ -14,23 +14,11 @@ > #include > #include >=20 > -/** > - Allocates one or more 4KB pages of type EfiBootServicesData. > - > - Allocates the number of 4KB pages of MemoryType and returns a pointer > to the > - allocated buffer. The buffer returned is aligned on a 4KB boundary. = If > Pages is 0, then NULL > - is returned. If there is not enough memory remaining to satisfy the > request, then NULL is > - returned. > - > - @param Pages The number of 4 KB pages to allocate. > - > - @return A pointer to the allocated buffer or NULL if allocation fails. > - > -**/ > VOID * > EFIAPI > -AllocatePages ( > - IN UINTN Pages > +InternalAllocatePages ( > + IN UINTN Pages, > + IN EFI_MEMORY_TYPE MemoryType > ) > { > EFI_PEI_HOB_POINTERS Hob; > @@ -65,12 +53,56 @@ AllocatePages ( > BuildMemoryAllocationHob ( > Hob.HandoffInformationTable->EfiFreeMemoryTop, > Pages * EFI_PAGE_SIZE, > - EfiBootServicesData > + MemoryType > ); > return (VOID *)(UINTN)Hob.HandoffInformationTable- > >EfiFreeMemoryTop; > } > } >=20 > +/** > + Allocates one or more 4KB pages of type EfiBootServicesData. > + > + Allocates the number of 4KB pages of MemoryType and returns a pointer > + to the allocated buffer. The buffer returned is aligned on a 4KB > + boundary. If Pages is 0, then NULL is returned. If there is not > + enough memory remaining to satisfy the request, then NULL is returned. > + > + @param Pages The number of 4 KB pages to allocate. > + > + @return A pointer to the allocated buffer or NULL if allocation fails. > + > +**/ > +VOID * > +EFIAPI > +AllocatePages ( > + IN UINTN Pages > + ) > +{ > + return InternalAllocatePages (Pages, EfiBootServicesData); } > + > +/** > + Allocates one or more 4KB pages of type EfiRuntimeServicesData. > + > + Allocates the number of 4KB pages of type EfiRuntimeServicesData and > + returns a pointer to the allocated buffer. The buffer returned is > + aligned on a 4KB boundary. If Pages is 0, then NULL is returned. If > + there is not enough memory remaining to satisfy the request, then NULL = is > returned. > + > + @param Pages The number of 4 KB pages to allocate. > + > + @return A pointer to the allocated buffer or NULL if allocation fails. > + > +**/ > +VOID * > +EFIAPI > +AllocateRuntimePages ( > + IN UINTN Pages > + ) > +{ > + return InternalAllocatePages (Pages, EfiRuntimeServicesData); } > + > /** > Allocates one or more 4KB pages of type EfiBootServicesData at a speci= fied > alignment. >=20 > -- > 2.29.2.windows.2