From nobody Fri May 3 09:10:08 2024 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 1526998142247553.5729649943055; Tue, 22 May 2018 07:09:02 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 097BA203BA4EB; Tue, 22 May 2018 07:09:01 -0700 (PDT) Received: from mail-wr0-x233.google.com (mail-wr0-x233.google.com [IPv6:2a00:1450:400c:c0c::233]) (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 AC4E3203B992C for ; Tue, 22 May 2018 07:08:59 -0700 (PDT) Received: by mail-wr0-x233.google.com with SMTP id i14-v6so20473386wre.2 for ; Tue, 22 May 2018 07:08:59 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:3995:5470:200:1aff:fe1b:b328]) by smtp.gmail.com with ESMTPSA id r6-v6sm17755545wrg.73.2018.05.22.07.08.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 07:08:57 -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:c0c::233; helo=mail-wr0-x233.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=ushk7N92icX3jm01x7NKo2+E8evrRWmoMV8mc3LM30s=; b=it8BVsvr1ujKkVP5Qvo5E2GBQ+pao0NWC58vBOKDkW326Cut5qCyezvXu2lLB5M4VG xq3Ccf804onUbv5Vvv8UBpv24v3QrpM8+75Ex3jgd90O54dJuO3JkwbWgx7y4lSTm/Js E0ZethJ912i3p38jEQwG7D0+Ys2esD65zeNVg= 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=ushk7N92icX3jm01x7NKo2+E8evrRWmoMV8mc3LM30s=; b=F3JK+IhIiM0lb2uux1Seps2dEvfD03TwI2JAQqyeqDw8b5vswddQSc8Wu+Ibwifl26 k1gHULM2LniMOrF3zMh75tw/xPWjGBZVXRokCDUaN2rUlJalKOplNbvQn2KRn9zHFFGp h9J2c4f/G6/tw2aKgU9slfC8Hk6cka9fu1u5Vjy5zosmhA6YV98eoRupr+AutJvX9Y/g mQqj0WpfsUqWOb2N0upf6A0Cx+sSZLtYiisEf/59J6Juwxef3vHJqRSOGmN8TEaG7K2a O1+jUaXbJZH0eSoIsRZavPTGQMwbd+qMPDfZ2bnR/GLzYOSSgZL5yS6Srw+U7MHhwcjH sY+A== X-Gm-Message-State: ALKqPwfm8803q0e8JDfPDIOnxNy8q8/XdyQN4u661NKFG/EVOZlQ1hPA qudipk6aHt/8nubYaqZK6sWbQEUeNSk= X-Google-Smtp-Source: AB8JxZq098/n9OoIfBxyBRsx/90mbLx7RBUnCIghvwmNjpYAUpVFw2cglA4Rq95cHONerkI/qkHkuw== X-Received: by 2002:adf:88e8:: with SMTP id g37-v6mr17362725wrg.62.1526998137983; Tue, 22 May 2018 07:08:57 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Tue, 22 May 2018 16:08:45 +0200 Message-Id: <20180522140850.30369-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180522140850.30369-1-ard.biesheuvel@linaro.org> References: <20180522140850.30369-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 1/6] OvmfPkg/PlatformBootManagerLib: add missing report status code call 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: Eric Dong , Ard Biesheuvel , Liming Gao , Dandan Bi , Leif Lindholm , Michael D Kinney , Laszlo Ersek , Star Zeng 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" Consumers of status code reports may rely on a status code to be reported when the ReadyToBoot event is signalled. For instance, FirmwarePerformanceDxe will fail to install the FPDT ACPI table in this case. So add the missing call. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf | 1 + OvmfPkg/Library/PlatformBootManagerLib/QemuKernel.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.= inf b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf index 27789b7377bc..f10b68424b91 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf +++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf @@ -55,6 +55,7 @@ [LibraryClasses] QemuFwCfgS3Lib LoadLinuxLib QemuBootOrderLib + ReportStatusCodeLib UefiLib =20 [Pcd] diff --git a/OvmfPkg/Library/PlatformBootManagerLib/QemuKernel.c b/OvmfPkg/= Library/PlatformBootManagerLib/QemuKernel.c index ef728dfdeb60..f20df9533fda 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/QemuKernel.c +++ b/OvmfPkg/Library/PlatformBootManagerLib/QemuKernel.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include =20 @@ -149,6 +150,9 @@ TryRunningQemuKernel ( // EfiSignalEventReadyToBoot(); =20 + REPORT_STATUS_CODE (EFI_PROGRESS_CODE, + (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_READY_TO_BOOT_EVENT)); + Status =3D LoadLinux (KernelBuf, SetupBuf); =20 FreeAndReturn: --=20 2.17.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Fri May 3 09:10:08 2024 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 1526998145394534.8653492063291; Tue, 22 May 2018 07:09:05 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 35C62203BA4E2; Tue, 22 May 2018 07:09:04 -0700 (PDT) Received: from mail-wm0-x236.google.com (mail-wm0-x236.google.com [IPv6:2a00:1450:400c:c09::236]) (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 D6131203B992C for ; Tue, 22 May 2018 07:09:02 -0700 (PDT) Received: by mail-wm0-x236.google.com with SMTP id j5-v6so85562wme.5 for ; Tue, 22 May 2018 07:09:02 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:3995:5470:200:1aff:fe1b:b328]) by smtp.gmail.com with ESMTPSA id r6-v6sm17755545wrg.73.2018.05.22.07.08.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 07:08:59 -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::236; helo=mail-wm0-x236.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=Z3jDPMon68EBAQk3Xxxlb6MZD02G7CN6D6MQ9V4ylFg=; b=hMasWY9i1y7hHO08+Ewxqhk2JEgLbBWO+qO6gSrAh0GSpWpG3j3aOxsa1AaDocTBqY O2xE9lTNMzOjtrHufF+IqK8Q+CG8FecMs+rNgC3iUH626a46Ic8u1uILUj/693z5fSw0 EMn9xJgOq3X6zH/dJPcuhAiT8MmIGJgZFPTas= 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=Z3jDPMon68EBAQk3Xxxlb6MZD02G7CN6D6MQ9V4ylFg=; b=cp3869NB2nRtzRYicNA7QLreRVbLfGYOWeP9gBVfnaH2NWbEEimrzY5PPP/TB7k9XD zhH3EHdHNm9xbguCYwXMmlG/N/RKpT+St7WsS2nBb05wiRqkCjfYb2vr6cgQU+y3cO31 TW8GHnf7KwYmJVW4ZwB5WHYcYbeO7+tP6xSNcZaN9y6jAAW5fX20m3JHlP1limJXFElH 0cSxZpOI2r89Ap4vOmk7H+QVtedigVxCC2dg7S2nqPlyArgwFpiXHK+gpzouaFvChosX 46YSJu9FEZqswEdTkujEog9AFOdSVeDKPi7ZMNvimX4xFSxEbdORVApY/fxgP1oaTZYz u/pQ== X-Gm-Message-State: ALKqPwft0U7Z364BWqn+EeeQj2ufKFIVtWiYnShcS7DTfuMsdPiuTPl6 1qeFN+7j3yw/tNLY6b9gMjYQMGAWGCo= X-Google-Smtp-Source: AB8JxZr0sIsyAOVHwgfZ69hKWbL3uEb4MhkS9shmhQxKA7nkunWPl9s4cE30bhfohVaPz60AKi9gYg== X-Received: by 2002:a1c:da13:: with SMTP id r19-v6mr1492007wmg.2.1526998140375; Tue, 22 May 2018 07:09:00 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Tue, 22 May 2018 16:08:46 +0200 Message-Id: <20180522140850.30369-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180522140850.30369-1-ard.biesheuvel@linaro.org> References: <20180522140850.30369-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 2/6] ArmVirtPkg/PlatformBootManagerLib: add missing report status code call 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: Eric Dong , Ard Biesheuvel , Liming Gao , Dandan Bi , Leif Lindholm , Michael D Kinney , Laszlo Ersek , Star Zeng 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" Consumers of status code reports may rely on a status code to be reported when the ReadyToBoot event is signalled. For instance, FirmwarePerformanceDxe will fail to install the FPDT ACPI table in this case. So add the missing call. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf | 1 + ArmVirtPkg/Library/PlatformBootManagerLib/QemuKernel.c | 4 += +++ 2 files changed, 5 insertions(+) diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerL= ib.inf b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.i= nf index d6c1ef95dc44..0cbc82f5d27d 100644 --- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf +++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf @@ -53,6 +53,7 @@ [LibraryClasses] PrintLib QemuBootOrderLib QemuFwCfgLib + ReportStatusCodeLib UefiBootManagerLib UefiBootServicesTableLib UefiLib diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/QemuKernel.c b/ArmVi= rtPkg/Library/PlatformBootManagerLib/QemuKernel.c index ac47d21e71c8..7b59f57eb19f 100644 --- a/ArmVirtPkg/Library/PlatformBootManagerLib/QemuKernel.c +++ b/ArmVirtPkg/Library/PlatformBootManagerLib/QemuKernel.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -1072,6 +1073,9 @@ TryRunningQemuKernel ( // EfiSignalEventReadyToBoot(); =20 + REPORT_STATUS_CODE (EFI_PROGRESS_CODE, + (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_READY_TO_BOOT_EVENT)); + // // Start the image. // --=20 2.17.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Fri May 3 09:10:08 2024 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 1526998149000270.50729564027597; Tue, 22 May 2018 07:09:09 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 63F95203BB520; Tue, 22 May 2018 07:09:06 -0700 (PDT) Received: from mail-wm0-x235.google.com (mail-wm0-x235.google.com [IPv6:2a00:1450:400c:c09::235]) (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 9CF8B203B992C for ; Tue, 22 May 2018 07:09:04 -0700 (PDT) Received: by mail-wm0-x235.google.com with SMTP id a67-v6so133274wmf.3 for ; Tue, 22 May 2018 07:09:04 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:3995:5470:200:1aff:fe1b:b328]) by smtp.gmail.com with ESMTPSA id r6-v6sm17755545wrg.73.2018.05.22.07.09.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 07:09:02 -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::235; helo=mail-wm0-x235.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=LHlwcmVHos8NZgj2kGrntQDGOb8hzisISq9LYld3ZUU=; b=djJvkh3QOuxwTexaH9J75kuD599gt+IXxy1LJFrMjyrUpy7dNp9xJt76FsUeG28eut VKdZMJiEiUKHJNiNTst5Tp8ird0+/jOuzqsCx1mYfu1o3JNRX0sNKEXHrivBfEVlx41Z YN+z1SYnV8Kj5FbDc8eOOv0EeXEUTOnn0op+0= 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=LHlwcmVHos8NZgj2kGrntQDGOb8hzisISq9LYld3ZUU=; b=ZCcjjb6uhc4Ou5pLBH6okmzQG23b2h1otEQCLX2cSQ0UnMtyluXNYG43zUGwlfMHQQ aTSjJd+Zk64c/pGzlkDTbNwNVNyrf7pfxgwJ4M4staiN4ncO2AU4F/9f6Ak9JkRSVeVd GiJUy0/bru0E8MJZsbxkTr8bXHQi0O0isX3t1A9K9OL3gTnB4dMd+vVTUy/XaPFYujPv NqWg4unnFg1v4QuG3mH8aBt1MJeJF0vkbGDa3gc8X59VFzp014R6eQThGt5ptsdMMv3z esy7Pu52vQKVlTa8p9FjTzuxQv5BmuU+Aq6nWFMjVWirgAFVhnDGxxw/WohLQYbpiLcV a23A== X-Gm-Message-State: ALKqPwdOQEdBouP7XikdVdC3Cmc4b/nrib2a/epxlxVMjCGf9wqMxq4f DsLTqREmpKKuiaZ735UG7+TnE1vfJ+E= X-Google-Smtp-Source: AB8JxZrdMAD67rijFcEoqGlDB77OHLzqMQvBKgH2TMWFEM9yAkXjQM0zNwW9C3w/prQdg8hsscAoTQ== X-Received: by 2002:a1c:a84d:: with SMTP id r74-v6mr1458905wme.114.1526998142791; Tue, 22 May 2018 07:09:02 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Tue, 22 May 2018 16:08:47 +0200 Message-Id: <20180522140850.30369-4-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180522140850.30369-1-ard.biesheuvel@linaro.org> References: <20180522140850.30369-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 3/6] MdePkg/UefiLib: introduce EfiAllocatePeiAccessiblePages routine 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: Eric Dong , Ard Biesheuvel , Liming Gao , Dandan Bi , Leif Lindholm , Michael D Kinney , Laszlo Ersek , Star Zeng 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" Add a routine to UefiLib that abstracts the allocation of memory that should be accessible by PEI after a warm reboot. We will use it to replace open coded implementations that limit the address to < 4 GB, which may not be possible on non-Intel systems that have no 32-bit addressable memory at all. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- MdePkg/Include/Library/UefiLib.h | 23 ++++++++++ MdePkg/Library/UefiLib/UefiLib.c | 48 ++++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/MdePkg/Include/Library/UefiLib.h b/MdePkg/Include/Library/Uefi= Lib.h index 256498e3fd8d..8fa077af41e0 100644 --- a/MdePkg/Include/Library/UefiLib.h +++ b/MdePkg/Include/Library/UefiLib.h @@ -1520,4 +1520,27 @@ EfiLocateProtocolBuffer ( OUT UINTN *NoProtocols, OUT VOID ***Buffer ); + +/** + Allocates one or more 4KB pages of a given type from a memory region tha= t is + accessible to PEI. + + Allocates the number of 4KB pages of type '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[in] MemoryType The memory type to allocate + @param[in] Pages The number of 4 KB pages to allocate. + + @return A pointer to the allocated buffer or NULL if allocation fails. + +**/ +VOID * +EFIAPI +EfiAllocatePeiAccessiblePages ( + IN EFI_MEMORY_TYPE MemoryType, + IN UINTN Pages + ); + #endif diff --git a/MdePkg/Library/UefiLib/UefiLib.c b/MdePkg/Library/UefiLib/Uefi= Lib.c index ba449a1c34ce..3a9d75149dd7 100644 --- a/MdePkg/Library/UefiLib/UefiLib.c +++ b/MdePkg/Library/UefiLib/UefiLib.c @@ -1715,3 +1715,51 @@ EfiLocateProtocolBuffer ( =20 return EFI_SUCCESS; } + +/** + Allocates one or more 4KB pages of a given type from a memory region tha= t is + accessible to PEI. + + Allocates the number of 4KB pages of type '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[in] MemoryType The memory type to allocate + @param[in] Pages The number of 4 KB pages to allocate. + + @return A pointer to the allocated buffer or NULL if allocation fails. + +**/ +VOID * +EFIAPI +EfiAllocatePeiAccessiblePages ( + IN EFI_MEMORY_TYPE MemoryType, + IN UINTN Pages + ) +{ + EFI_STATUS Status; + EFI_PHYSICAL_ADDRESS Memory; + EFI_ALLOCATE_TYPE AllocType; + + if (Pages =3D=3D 0) { + return NULL; + } + +#ifdef MDE_CPU_X64 + // + // On X64 systems, a X64 build of DXE may be combined with a 32-bit buil= d of + // PEI, and so we need to allocate below 4 GB to ensure that the allocat= ion + // is accessible by PEI. + // + AllocType =3D AllocateMaxAddress; + Memory =3D MAX_UINT32; +#else + AllocType =3D AllocateAnyPages; +#endif + Status =3D gBS->AllocatePages (AllocType, MemoryType, Pages, &Memory); + if (EFI_ERROR (Status)) { + return NULL; + } + return (VOID *)(UINTN)Memory; +} --=20 2.17.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Fri May 3 09:10:08 2024 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 1526998152507540.7164751464188; Tue, 22 May 2018 07:09:12 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9A90C203BBB85; Tue, 22 May 2018 07:09:07 -0700 (PDT) Received: from mail-wr0-x242.google.com (mail-wr0-x242.google.com [IPv6:2a00:1450:400c:c0c::242]) (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 1860C203B992C for ; Tue, 22 May 2018 07:09:07 -0700 (PDT) Received: by mail-wr0-x242.google.com with SMTP id w3-v6so12746042wrl.12 for ; Tue, 22 May 2018 07:09:06 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:3995:5470:200:1aff:fe1b:b328]) by smtp.gmail.com with ESMTPSA id r6-v6sm17755545wrg.73.2018.05.22.07.09.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 07:09:04 -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:c0c::242; helo=mail-wr0-x242.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=ZC5QBrtv23WgGxbJieOYq5dVBsba/B5Edhq//D6cVRM=; b=TCPKksGiS3LwTARl3LcoWay2uoy7XsC1x/dkanpFv/8MPnZs4tzQiq95V88TZS6cO1 Dr7upgx4Prit2YuSuT3lPh+FeA/wpQWAm6GZ0+dbWZzN4YM+ol3tEyh+jm3oasH3bfyJ yVvXVUAYdjPsX2wvIHecF4ZIguiSrzrR3u5b4= 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=ZC5QBrtv23WgGxbJieOYq5dVBsba/B5Edhq//D6cVRM=; b=D+qbkVaBdrj8ZXlQh4Gw78QBZFUwpyKtwzvrdkiUQtAvIBhonk5SRlEpJVWo/h5iNI N7ZQ71umGYRRnjlQ7r1DBxJlwU0GiEeKCtQOs/zfcW8EVedsG47sYvwGPIBAtqzr0311 XWnUt/MlWYijASwwUT4lGg7iV5WbnE3FNpOetU0opSxYAIAm7wNPFZtJDzkyaTKE3azM o9P1c88FeLaiUpmcxC0RKTFYyWgnEwkVuuwCHTdRnFRx9Iw0PKWsNeOI+/H9WYZ2G6Kg mY8LuulKqdTxsvEuW7+CWl7Xpmp98cMeVbGDF0vG+XZlMIqROrgijkczn3bMbqCNqdsv CAkQ== X-Gm-Message-State: ALKqPweB7il2z9RYhFTR/g/CyJMnzziYKgmI+IGeMB9ClmUfHo5jBVA7 GyBr7vrr5kFK3DM/EAcGVcL4TvH27S8= X-Google-Smtp-Source: AB8JxZrl4GVz/7zIgDg/h92QMDwJENkcA0hYycDUjhO0JPm5MnS7PMMlQXEV3xaj/msGUKyj/IZfJg== X-Received: by 2002:adf:9c01:: with SMTP id f1-v6mr18278525wrc.171.1526998145371; Tue, 22 May 2018 07:09:05 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Tue, 22 May 2018 16:08:48 +0200 Message-Id: <20180522140850.30369-5-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180522140850.30369-1-ard.biesheuvel@linaro.org> References: <20180522140850.30369-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 4/6] IntelFrameworkPkg/FrameworkUefiLib: add EfiAllocatePeiAccessiblePages routine 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: Eric Dong , Ard Biesheuvel , Liming Gao , Dandan Bi , Leif Lindholm , Michael D Kinney , Laszlo Ersek , Star Zeng 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" Add the newly introduced EfiAllocatePeiAccessiblePages() routine which allocates memory in a way that guarantees that PEI can access it after a warm reboot. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c | 48 ++++++++++++++++= ++++ 1 file changed, 48 insertions(+) diff --git a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c b/IntelFr= ameworkPkg/Library/FrameworkUefiLib/UefiLib.c index 443a73917215..a488fe780b04 100644 --- a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c +++ b/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c @@ -1687,3 +1687,51 @@ EfiLocateProtocolBuffer ( =20 return EFI_SUCCESS; } + +/** + Allocates one or more 4KB pages of a given type from a memory region tha= t is + accessible to PEI. + + Allocates the number of 4KB pages of type '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[in] MemoryType The memory type to allocate + @param[in] Pages The number of 4 KB pages to allocate. + + @return A pointer to the allocated buffer or NULL if allocation fails. + +**/ +VOID * +EFIAPI +EfiAllocatePeiAccessiblePages ( + IN EFI_MEMORY_TYPE MemoryType, + IN UINTN Pages + ) +{ + EFI_STATUS Status; + EFI_PHYSICAL_ADDRESS Memory; + EFI_ALLOCATE_TYPE AllocType; + + if (Pages =3D=3D 0) { + return NULL; + } + +#ifdef MDE_CPU_X64 + // + // On X64 systems, a X64 build of DXE may be combined with a 32-bit buil= d of + // PEI, and so we need to allocate below 4 GB to ensure that the allocat= ion + // is accessible by PEI. + // + AllocType =3D AllocateMaxAddress; + Memory =3D MAX_UINT32; +#else + AllocType =3D AllocateAnyPages; +#endif + Status =3D gBS->AllocatePages (AllocType, MemoryType, Pages, &Memory); + if (EFI_ERROR (Status)) { + return NULL; + } + return (VOID *)(UINTN)Memory; +} --=20 2.17.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Fri May 3 09:10:08 2024 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 1526998156019887.1784847654609; Tue, 22 May 2018 07:09:16 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id CBE35203BBB81; Tue, 22 May 2018 07:09:10 -0700 (PDT) Received: from mail-wr0-x243.google.com (mail-wr0-x243.google.com [IPv6:2a00:1450:400c:c0c::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 310C1203BA517 for ; Tue, 22 May 2018 07:09:09 -0700 (PDT) Received: by mail-wr0-x243.google.com with SMTP id i12-v6so7289949wrc.4 for ; Tue, 22 May 2018 07:09:09 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:3995:5470:200:1aff:fe1b:b328]) by smtp.gmail.com with ESMTPSA id r6-v6sm17755545wrg.73.2018.05.22.07.09.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 07:09:07 -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:c0c::243; helo=mail-wr0-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=qTkV/oPWWertT8HQ/H30NgTe8FFSj3CzCejtUi6pTds=; b=A7JxjQFszCvmLGll3UHVW+RU5LJx9zHfOXjD8hfNV91ysQffQyp+mfOTSS4wvjh1mn 2NOSWpjOnDXSst4dVU6Be7kQqQWX8phrbrzB0JMGVDroqDyWUHL/uhtY4S2rFnFeixsV xom0WNAALTZ2YvCdUACExPWDGYa5nmIyaYfag= 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=qTkV/oPWWertT8HQ/H30NgTe8FFSj3CzCejtUi6pTds=; b=cb+tCZXK+0Gp6/ntmor++pGCa4Dn8rNG/wemoHraPaHRKt7WSw8W1Jzthm6HvEg8HT kDjGQvq1YrX1fauQjVATzsfNR6Hawo9TZYWBoXYHq03UJhcarW9HvQCVsLyjqCysDClQ rGGCjkxcteETCoCoeNlKvYydIFeO3+ky+NJ4s/Z0g7tk9RRIEVsHky4CfSuMkAVQuPqs MGh7RQ4lIQpD6FTOeK3K8vs91uaMrI2Qfdbng3gYgF3gnoTRehykoodJ0eqD6J8Yyjto Yi1UE8GzZGpOOxo1XiQ18Y4geyBILhIEDfKMCZD4yZvjmxRvTOZz9iwccbbTtV7/9uS2 QtVg== X-Gm-Message-State: ALKqPwdiUwbniNC3HJp84HpOHd0c1I7+XJqw7U3QrOsX1MRwQ66S5tyn x5peUIZKW+9bIPFtV03nZqDMn0hFrgw= X-Google-Smtp-Source: AB8JxZoiwg5U4Y90KH1r9FFtwNc31JIIkEim5g4wuOe6Fa1lcwxI0rbKf/l9iGsGnXVb+9f14JJ7ZA== X-Received: by 2002:adf:9301:: with SMTP id 1-v6mr5015571wro.175.1526998147587; Tue, 22 May 2018 07:09:07 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Tue, 22 May 2018 16:08:49 +0200 Message-Id: <20180522140850.30369-6-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180522140850.30369-1-ard.biesheuvel@linaro.org> References: <20180522140850.30369-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 5/6] MdeModulePkg/DxeCorePerformanceLib: use EfiAllocatePeiAccessiblePages 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: Eric Dong , Ard Biesheuvel , Liming Gao , Dandan Bi , Leif Lindholm , Michael D Kinney , Laszlo Ersek , Star Zeng 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 EfiAllocatePeiAccessiblePages, 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 --- MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c | 45 ++= ------------------ 1 file changed, 4 insertions(+), 41 deletions(-) diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceL= ib.c b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c index 71d624fc9ce9..301ea4c32a78 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,10 @@ 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 *) EfiAllocatePe= iAccessiblePages ( + EfiReservedMe= moryType, + EFI_SIZE_TO_P= AGES (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 From nobody Fri May 3 09:10:08 2024 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 1526998159564852.7230846179792; Tue, 22 May 2018 07:09:19 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 0384E203BBBA8; Tue, 22 May 2018 07:09:13 -0700 (PDT) Received: from mail-wr0-x243.google.com (mail-wr0-x243.google.com [IPv6:2a00:1450:400c:c0c::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 B2870203BBB9D for ; Tue, 22 May 2018 07:09:11 -0700 (PDT) Received: by mail-wr0-x243.google.com with SMTP id 94-v6so20443425wrf.5 for ; Tue, 22 May 2018 07:09:11 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:3995:5470:200:1aff:fe1b:b328]) by smtp.gmail.com with ESMTPSA id r6-v6sm17755545wrg.73.2018.05.22.07.09.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 07:09:09 -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:c0c::243; helo=mail-wr0-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=dJb7Uzr4P2g7MxLj0zkOrlo4J97LJz22TQl6IDozbG8=; b=NXNfigykrQClJ+euBUD4Myi97IaB8LfAFkwa9TqBolm3RaaWBi/9GYKEedufBL9gf9 hOPcERCEM3TCH8+d31fmiZET6hX/ALj7qF+IeePL3ey1X30KFNL/NQRELkKN0YHo6a/J 52V7baOmJ+aKhcWmR/UbZVZy/tt9/bVf6+nXQ= 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=dJb7Uzr4P2g7MxLj0zkOrlo4J97LJz22TQl6IDozbG8=; b=CR4wxfg+UMhp1K0MwCMgXkvBaSpbu5Xs6QX+ZS4cwhoczhvafPjJZEajdrbp0Rhcd6 dVfbhDgH2tEAYy5/+zXjILmtutvb7tLDCGnWeDSTM6w0fTv3ftowYbJdmERkfJBgn9HC 8K2MlX+0c26EAlSsufo8goAYxG7R2ixPGSs2R7QwDfJ/NuCq5enggFjtH+YtJUSS0U9V sLB0WY/mUi/2T/uyCIfhSlLZcmJqrFvqdJah6UpOGQYqrALrq12X/4QWjfoVxEbi7UAd 4xAK5ikZc0x9MHbWfi/e7JH0cTqr8TGGDCz62/rGckjNvzjsBjrtzQ5SuBLgXzMTMQeN UTrw== X-Gm-Message-State: ALKqPwcu8M5YhwIPhJBkJhp6dxh9CGDQ0U6FTo/H//+/mcF771XTYdGz dJRXftdzHRGfQ7pDxS8StDuWskiZfcg= X-Google-Smtp-Source: AB8JxZq3LF1ozSeBYpKOHZF4Je5LvDo6zwr5UYbuIqgGV8ll8wGzxGC+3GtQD8iJMKKxqTlJmk+oQw== X-Received: by 2002:adf:b852:: with SMTP id u18-v6mr1020633wrf.162.1526998149980; Tue, 22 May 2018 07:09:09 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Tue, 22 May 2018 16:08:50 +0200 Message-Id: <20180522140850.30369-7-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180522140850.30369-1-ard.biesheuvel@linaro.org> References: <20180522140850.30369-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 6/6] MdeModulePkg/FirmwarePerformanceDataTableDxe: use EfiAllocatePeiAccessiblePages 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: Eric Dong , Ard Biesheuvel , Liming Gao , Dandan Bi , Leif Lindholm , Michael D Kinney , Laszlo Ersek , Star Zeng 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 EfiAllocatePeiAccessiblePages, 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 --- MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerfor= manceDxe.c | 50 ++++---------------- 1 file changed, 8 insertions(+), 42 deletions(-) diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/Fi= rmwarePerformanceDxe.c b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDat= aTableDxe/FirmwarePerformanceDxe.c index e719e9e482cb..6663cbeac501 100644 --- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwareP= erformanceDxe.c +++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwareP= erformanceDxe.c @@ -179,46 +179,6 @@ FpdtAcpiTableChecksum ( Buffer[ChecksumOffset] =3D CalculateCheckSum8 (Buffer, Size); } =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; -} - /** Callback function upon VariableArchProtocol and LockBoxProtocol to allocate S3 performance table memory and save the pointer to LockBox. @@ -287,7 +247,10 @@ FpdtAllocateS3PerformanceTableMemory ( // // Fail to allocate at specified address, continue to allocate at = any address. // - mAcpiS3PerformanceTable =3D (S3_PERFORMANCE_TABLE *) FpdtAllocateR= eservedMemoryBelow4G (sizeof (S3_PERFORMANCE_TABLE)); + mAcpiS3PerformanceTable =3D (S3_PERFORMANCE_TABLE *) EfiAllocatePe= iAccessiblePages ( + EfiReserved= MemoryType, + EFI_SIZE_TO= _PAGES (sizeof (S3_PERFORMANCE_TABLE)) + ); } DEBUG ((EFI_D_INFO, "FPDT: ACPI S3 Performance Table address =3D 0x%= x\n", mAcpiS3PerformanceTable)); if (mAcpiS3PerformanceTable !=3D NULL) { @@ -368,7 +331,10 @@ InstallFirmwarePerformanceDataTable ( // // Fail to allocate at specified address, continue to allocate at an= y address. // - mAcpiBootPerformanceTable =3D (BOOT_PERFORMANCE_TABLE *) FpdtAllocat= eReservedMemoryBelow4G (BootPerformanceDataSize); + mAcpiBootPerformanceTable =3D (BOOT_PERFORMANCE_TABLE *) EfiAllocate= PeiAccessiblePages ( + EfiReserved= MemoryType, + EFI_SIZE_TO= _PAGES (BootPerformanceDataSize) + ); } DEBUG ((DEBUG_INFO, "FPDT: ACPI Boot Performance Table address =3D 0x%= x\n", mAcpiBootPerformanceTable)); if (mAcpiBootPerformanceTable =3D=3D NULL) { --=20 2.17.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel