From nobody Tue Feb 10 05:46:03 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1527518445704656.3692230678655; Mon, 28 May 2018 07:40:45 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A83E020971743; Mon, 28 May 2018 07:40:38 -0700 (PDT) Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 730592007E7EA for ; Mon, 28 May 2018 07:40:37 -0700 (PDT) Received: by mail-wm0-x243.google.com with SMTP id f6-v6so32744573wmc.4 for ; Mon, 28 May 2018 07:40:37 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:3995:5470:200:1aff:fe1b:b328]) by smtp.gmail.com with ESMTPSA id y18-v6sm4177938wrl.53.2018.05.28.07.40.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 May 2018 07:40:35 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::243; helo=mail-wm0-x243.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/JEKeo7S/737rZrZeZuXQkl9OAczJ86VGCjE1eeWUIA=; b=Up/RJK47oDFE/H6Qqai9BP4SuOp/6kurwIAnZDXVyApboCmn5MgHcXvTulqf/8p+Rh D2u5/QjWUVsYIcasVn9Lqfn0gF8pSfNgNwRUmKdZl14eSJDtjdBL/LWEJKWnV3PBGWAn ryUrzOioIL2NPUD5o0w6cyJt1fDiZzrIJapOM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/JEKeo7S/737rZrZeZuXQkl9OAczJ86VGCjE1eeWUIA=; b=SXYcvtPunWGVau4xrBBWwol/C92m6a9S0D2GnKcV6y2NwSZROBaow4tspCt7vj2dor UOE+h2Ws1ueGrGXwE29lKuj0hpkUcSG57C2X7W7JCgK1cNEyA39IUevtioIKpMkIjeYV ldWtaVgoU4Zt7RXRhU1jLHWIxmM11rujQFK3ed6MJ3dRj0BA6Biv8PcTezVGFkXQjBm2 qUfGgrGRNR9IiOMqmISVHy2WeNugHOw2XO3a6VQUT9Oc1X5a/gG4g5IB/5FW/uWBphpC ucPoade8JSZe/9MlqtYK3KV0+qtJNeYlWZaOjHVHJL1YwCrTQfzHpYQizpK8wpGNUOX8 bv9g== X-Gm-Message-State: ALKqPwfwBTxhVuQZZHtoVkoE1j0Etooz/BDll9r7NP5K0oi9ElaYssux LRm2JhTMfJeYLFe9Nea+qAANhVCYlnE= X-Google-Smtp-Source: ADUXVKJoCrvWYNcjGsMDOuO4lmTFp6ni2V1pNqbuWVcwC0W3d34f5EFTHocy8kxCcpXkK+LDC5rDrg== X-Received: by 2002:a1c:9c2:: with SMTP id 185-v6mr9033332wmj.53.1527518435737; Mon, 28 May 2018 07:40:35 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Mon, 28 May 2018 16:40:23 +0200 Message-Id: <20180528144024.10809-5-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528144024.10809-1-ard.biesheuvel@linaro.org> References: <20180528144024.10809-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v3 4/5] MdeModulePkg/DxeCorePerformanceLib: use AllocatePeiAccessiblePages X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Replace the call to and implementation of the function FpdtAllocateReservedMemoryBelow4G() with a call to AllocatePeiAccessiblePages, which boils down to the same on X64, but does not crash non-X64 systems that lack memory below 4 GB. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek Reviewed-by: Star Zeng --- MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c | 48 ++= +----------------- 1 file changed, 7 insertions(+), 41 deletions(-) diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceL= ib.c b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c index 71d624fc9ce9..68b29ac5a9e2 100644 --- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c @@ -165,46 +165,6 @@ IsKnownID ( } } =20 -/** - Allocate EfiReservedMemoryType below 4G memory address. - - This function allocates EfiReservedMemoryType below 4G memory address. - - @param[in] Size Size of memory to allocate. - - @return Allocated address for output. - -**/ -VOID * -FpdtAllocateReservedMemoryBelow4G ( - IN UINTN Size - ) -{ - UINTN Pages; - EFI_PHYSICAL_ADDRESS Address; - EFI_STATUS Status; - VOID *Buffer; - - Buffer =3D NULL; - Pages =3D EFI_SIZE_TO_PAGES (Size); - Address =3D 0xffffffff; - - Status =3D gBS->AllocatePages ( - AllocateMaxAddress, - EfiReservedMemoryType, - Pages, - &Address - ); - ASSERT_EFI_ERROR (Status); - - if (!EFI_ERROR (Status)) { - Buffer =3D (VOID *) (UINTN) Address; - ZeroMem (Buffer, Size); - } - - return Buffer; -} - /** Allocate buffer for Boot Performance table. =20 @@ -348,7 +308,13 @@ AllocateBootPerformanceTable ( // // Fail to allocate at specified address, continue to allocate at any = address. // - mAcpiBootPerformanceTable =3D (BOOT_PERFORMANCE_TABLE *) FpdtAllocateR= eservedMemoryBelow4G (BootPerformanceDataSize); + mAcpiBootPerformanceTable =3D (BOOT_PERFORMANCE_TABLE *) AllocatePeiAc= cessiblePages ( + EfiReservedMe= moryType, + EFI_SIZE_TO_P= AGES (BootPerformanceDataSize) + ); + if (mAcpiBootPerformanceTable !=3D NULL) { + ZeroMem (mAcpiBootPerformanceTable, BootPerformanceDataSize); + } } DEBUG ((DEBUG_INFO, "DxeCorePerformanceLib: ACPI Boot Performance Table = address =3D 0x%x\n", mAcpiBootPerformanceTable)); =20 --=20 2.17.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel