From nobody Sat May 4 05:53:17 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 1527152996390349.09475187720557; Thu, 24 May 2018 02:09:56 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 8EA3E20837987; Thu, 24 May 2018 02:09:54 -0700 (PDT) Received: from mail-wr0-x229.google.com (mail-wr0-x229.google.com [IPv6:2a00:1450:400c:c0c::229]) (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 6E5622083797E for ; Thu, 24 May 2018 02:09:53 -0700 (PDT) Received: by mail-wr0-x229.google.com with SMTP id 94-v6so1695830wrf.5 for ; Thu, 24 May 2018 02:09:53 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:3995:5470:200:1aff:fe1b:b328]) by smtp.gmail.com with ESMTPSA id x16-v6sm8505467wmc.2.2018.05.24.02.09.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 May 2018 02:09:50 -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::229; helo=mail-wr0-x229.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=LCpnCNCs33DzSveES6v511Mbo9P1AMOOUBVpbmdpj3k=; b=Q0KPpL+Io+V049GFl/FoMLhz1kmbV0HUYOu8fOQkdaBVTr6STRHG4oqW/Na1MGzMH2 fO0IZ+4Mdq2PHYTidXf2CVcy00IgKscyyKHpL8O/zRoHOdFdeFsFqSXL9aVUpo1eF0ry JuiH+LAT+MnptTzpF4+LU6mANwt/IMjHRKZco= 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=LCpnCNCs33DzSveES6v511Mbo9P1AMOOUBVpbmdpj3k=; b=tzh4SUrt37OjDCTNTnVkzuxFXKXHiENY7wQpkL7uMb9HsImndQ4PX9IrDQo8J16ubo mHx1uY4Q4fQH5trbFqSsMoZWt6bDJ657SIwTOFAUy32ie+WUyI1Jbt17gcmPCEHpbFw7 sFnTR8oUHkyRdqX7Czn/vqjjjVpjEDC5hvwS1EA53sQZ69Hhtfxo+xYT7pRB/TNKcFmb a4CO6vip+XMe0dZ/3ldYv6yGy3REMQpaf0w38r+I8yPMuPiKOG0CJeqGj1P0cR5yX8As 3kAyWYgHbt8Pob8IUqEL60HOju34BQh7HBklzMVY/nAdApXOymXq/xRGMSHeNFBSf5Ho 7ShA== X-Gm-Message-State: ALKqPwdksMIy5wc5vqQXentCSUqhgv6un01k3tm3FxxKuTe+KA38XzyF jk0/hHcrdACnKJipxdn87nk8JHr22Ho= X-Google-Smtp-Source: AB8JxZpV3MzJGR5m4wMyPqGYKRI7NKOtQieV3Ry0nwUwbUwT9hpSlV/FIchWaZ6ulZ9HyVlUKPlYAQ== X-Received: by 2002:adf:9125:: with SMTP id j34-v6mr5971576wrj.156.1527152991593; Thu, 24 May 2018 02:09:51 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Thu, 24 May 2018 11:09:41 +0200 Message-Id: <20180524090945.10289-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524090945.10289-1-ard.biesheuvel@linaro.org> References: <20180524090945.10289-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v2 1/5] 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 Sat May 4 05:53:17 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 1527152998968958.9548285456322; Thu, 24 May 2018 02:09:58 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B998F2083798A; Thu, 24 May 2018 02:09:56 -0700 (PDT) Received: from mail-wr0-x232.google.com (mail-wr0-x232.google.com [IPv6:2a00:1450:400c:c0c::232]) (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 406D1207E6376 for ; Thu, 24 May 2018 02:09:55 -0700 (PDT) Received: by mail-wr0-x232.google.com with SMTP id w18-v6so1691454wrn.6 for ; Thu, 24 May 2018 02:09:55 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:3995:5470:200:1aff:fe1b:b328]) by smtp.gmail.com with ESMTPSA id x16-v6sm8505467wmc.2.2018.05.24.02.09.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 May 2018 02:09:52 -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::232; helo=mail-wr0-x232.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=LtaOyF5EP/jWZpzn3YTKYoEiPlyVmdLg+3R5UYQFlvY=; b=hXcbFuC5altCW7zdK1po0mS7nZoT8nWQOcnZaCT7/Ih0mgW/hyhq4wSFWa1foKfGEd 6qNbtN1F0q2GzjftftJ8SynW8uMjRWMN3XfCeWqj4gVZ0Ccccc0LIY4brhOb/gPu99WY jFocYGBzRNYrxHcCQUvYj/aUPlFfwFrhv6xUY= 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=LtaOyF5EP/jWZpzn3YTKYoEiPlyVmdLg+3R5UYQFlvY=; b=XI7xaWoCtI+INZ7V4/3nBVcIY+ExqyeF6Hdta9TLutkMwWv8uKivgdl9Wet86lL3CZ nMlXx9qXHrxnMMAwWcLNgbxO0oCeP9JAc+2FJs5kCn+UrTe2GvA+0UArVQjpVLJpy81I EV1IIbDAjgsmvS5tOkYcZBDitq7yKsdrXVCEMKKjHthyeed1rCQXdheHZ484APbwpcbC ogxLxEbF2cR3WH8bHNNy7XjokrI8RELtOFqZGP/E0lxZnaXeuw6zFmhdX+fDgcb/LFrF 6Su/e/2Xbv3zPEw7zfP7mWtGPYtfSCmQ8DLbfrNWiUISJOnZWnzE6YoJQ5MQdrOElppo 9B1Q== X-Gm-Message-State: ALKqPwcww31JGC6xC8bmaksIAPqBkpheDc2T9zOJ2MKCs3XJbPRLVnV5 eXiwiulsBuhwigWwvzwGjQakAGWfsms= X-Google-Smtp-Source: AB8JxZrGBNBer75vmbuANEqhxwu2LOgP4DxcEiSdzvv8a3fcuOWyIJ7N5cmq37gTXIGSzl0W1TfBBA== X-Received: by 2002:adf:e542:: with SMTP id z2-v6mr4838598wrm.111.1527152993544; Thu, 24 May 2018 02:09:53 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Thu, 24 May 2018 11:09:42 +0200 Message-Id: <20180524090945.10289-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524090945.10289-1-ard.biesheuvel@linaro.org> References: <20180524090945.10289-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v2 2/5] 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 Sat May 4 05:53:17 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 1527153002165993.9232504452816; Thu, 24 May 2018 02:10:02 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id E50F62083798F; Thu, 24 May 2018 02:09:58 -0700 (PDT) Received: from mail-wr0-x22e.google.com (mail-wr0-x22e.google.com [IPv6:2a00:1450:400c:c0c::22e]) (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 2E0E7207E6376 for ; Thu, 24 May 2018 02:09:57 -0700 (PDT) Received: by mail-wr0-x22e.google.com with SMTP id w18-v6so1691650wrn.6 for ; Thu, 24 May 2018 02:09:57 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:3995:5470:200:1aff:fe1b:b328]) by smtp.gmail.com with ESMTPSA id x16-v6sm8505467wmc.2.2018.05.24.02.09.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 May 2018 02:09:54 -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::22e; helo=mail-wr0-x22e.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=4WwapQSe19fvux92f/oRKcQdyHyZL37u0klOzxPwNzk=; b=Ym1wInppN3xAoivjVmOPYH8Efv4rZwF6FyFmLjg3525e70pccVhuinTRTMgvYwSeCf h2ijihcQmipNKw4DqKlgTaC+mDICfbQrKL1VfUlE4amUMXl5g7beZ6yCmGFw50maS0/P fwRpKeuOJcfdC/2Urm8XPE6msS2WZai3xjOTY= 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=4WwapQSe19fvux92f/oRKcQdyHyZL37u0klOzxPwNzk=; b=gSjTY4Qy9oDhXogIgDLyTTdRnywG4dN6ldwu9SboUmViT/8VE88e9iTLOO9DNoapmH Sv7KkT0Q3U0RqXRWjz1cCuesfn3tCvSXul2NOWde+JRPg4rsmaS1kRFeghe74hCs9AO2 toS2qkZYSIZPMoAfHMs93oNBx9A4BG5Qd7CGH/QKdJm4eXxIeVtjSxm6fv7rX4bOA8zx gp4QwUHi3FN11NmtNDedh8AOAAZJ08aNk8JNH3ySGRnAZacbCojwktE6tBMdvjWe+qnQ JTdEFaVSM7Jo3EINT6aQ595ZTnGIYceuWXvtSB9Rp5oURLpZUtir9+MeUMn1FZ1yl4aL pG0A== X-Gm-Message-State: ALKqPweVzNr+2EIvlTpRf++WJOLAWkqURbbUIk3lrn9PRPrCAGQeFtdG sPEBl6y/ZFfxBVHUQLwNO3C2TNK9TBw= X-Google-Smtp-Source: AB8JxZrEB6wenG28uUowErI49Ld3kdY4eHavACenHvxrOxzN88/bfOs07xJszkY9P42b9oV/I15erg== X-Received: by 2002:adf:c32b:: with SMTP id n40-v6mr5406697wrf.91.1527152995427; Thu, 24 May 2018 02:09:55 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Thu, 24 May 2018 11:09:43 +0200 Message-Id: <20180524090945.10289-4-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524090945.10289-1-ard.biesheuvel@linaro.org> References: <20180524090945.10289-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v2 3/5] MdePkg/DxeServicesLib: introduce AllocatePeiAccessiblePages 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 DxeServicesLib 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 Reviewed-by: Laszlo Ersek --- MdePkg/Include/Library/DxeServicesLib.h | 23 +++++++- MdePkg/Library/DxeServicesLib/DxeServicesLib.c | 55 ++++++++++++++++++++ MdePkg/Library/DxeServicesLib/DxeServicesLib.inf | 3 ++ 3 files changed, 80 insertions(+), 1 deletion(-) diff --git a/MdePkg/Include/Library/DxeServicesLib.h b/MdePkg/Include/Libra= ry/DxeServicesLib.h index 7c1c62236d96..20aee68af558 100644 --- a/MdePkg/Include/Library/DxeServicesLib.h +++ b/MdePkg/Include/Library/DxeServicesLib.h @@ -305,5 +305,26 @@ GetFileDevicePathFromAnyFv ( OUT EFI_DEVICE_PATH_PROTOCOL **FvFileDevicePath ); =20 -#endif +/** + 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. =20 + @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 +AllocatePeiAccessiblePages ( + IN EFI_MEMORY_TYPE MemoryType, + IN UINTN Pages + ); + +#endif diff --git a/MdePkg/Library/DxeServicesLib/DxeServicesLib.c b/MdePkg/Librar= y/DxeServicesLib/DxeServicesLib.c index 1827c9216fbc..6719aabe5d04 100644 --- a/MdePkg/Library/DxeServicesLib/DxeServicesLib.c +++ b/MdePkg/Library/DxeServicesLib/DxeServicesLib.c @@ -16,6 +16,7 @@ =20 #include #include +#include #include #include #include @@ -1093,3 +1094,57 @@ Done: =20 return Status; } + +/** + 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 +AllocatePeiAccessiblePages ( + IN EFI_MEMORY_TYPE MemoryType, + IN UINTN Pages + ) +{ + EFI_STATUS Status; + EFI_ALLOCATE_TYPE AllocType; + EFI_PHYSICAL_ADDRESS Memory; +#ifdef MDE_CPU_X64 + EFI_HOB_HANDOFF_INFO_TABLE *PhitHob; +#endif + + if (Pages =3D=3D 0) { + return NULL; + } + + AllocType =3D AllocateAnyPages; +#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 check the memory limit set by PEI, and allocate + // below 4 GB if the limit is set to 4 GB or lower. + // + PhitHob =3D (EFI_HOB_HANDOFF_INFO_TABLE *)GetHobList (); + if (PhitHob->EfiFreeMemoryTop <=3D MAX_UINT32) { + AllocType =3D AllocateMaxAddress; + Memory =3D MAX_UINT32; + } +#endif + + Status =3D gBS->AllocatePages (AllocType, MemoryType, Pages, &Memory); + if (EFI_ERROR (Status)) { + return NULL; + } + return (VOID *)(UINTN)Memory; +} diff --git a/MdePkg/Library/DxeServicesLib/DxeServicesLib.inf b/MdePkg/Libr= ary/DxeServicesLib/DxeServicesLib.inf index bd2faf2f6f2d..b0306c09872f 100644 --- a/MdePkg/Library/DxeServicesLib/DxeServicesLib.inf +++ b/MdePkg/Library/DxeServicesLib/DxeServicesLib.inf @@ -44,6 +44,9 @@ [LibraryClasses] UefiLib UefiBootServicesTableLib =20 +[LibraryClasses.common.X64] + HobLib + [Guids] gEfiFileInfoGuid ## SOMETIMES_CONSUMES ## U= NDEFINED =20 --=20 2.17.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Sat May 4 05:53:17 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 1527153005791888.1629270049849; Thu, 24 May 2018 02:10:05 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 1EB4E20837994; Thu, 24 May 2018 02:10:00 -0700 (PDT) Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) (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 27B7C207E6376 for ; Thu, 24 May 2018 02:09:59 -0700 (PDT) Received: by mail-wm0-x244.google.com with SMTP id q4-v6so6983818wmq.1 for ; Thu, 24 May 2018 02:09:59 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:3995:5470:200:1aff:fe1b:b328]) by smtp.gmail.com with ESMTPSA id x16-v6sm8505467wmc.2.2018.05.24.02.09.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 May 2018 02:09:56 -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::244; helo=mail-wm0-x244.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=rPtjPPs2OePpENhEcYxjOGfJODA/j7FNSfkyH+YwQWM=; b=McaetZ7bWeccHcj3stZ8Ushaxsr4mfXqfolUZIDAuhSZ69VKfp25CzrKH+rX9LQQei NsEV8WByDIDpELwULmAAnB9H+EgAaJp2rIoXGOv3p3CeTy/c67tvYfdDanEpzQHKdLuN 4/VnpPVl0Rq4y2eX7TRiH6eo81zRs2qQVlnY0= 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=rPtjPPs2OePpENhEcYxjOGfJODA/j7FNSfkyH+YwQWM=; b=KDnAYUzjMjdeTY8NRzcg53tI9BT/nM/isvXg2bPeSkyETx5US4JQYE8+F2iFo9PngG 8fjyXcJiLIE/FWIrFYDdP6mTeouinW0GS4/Slqtt6A5bmsFntawSsmdwCdWbKYJj/uMs uKM431iUGgZa78wypjYzhkEgyNYsvvQlRdOukN+Hb1AJcCCNwOSFjJXwmyYnuU0BYsu3 2SfEOEz9r029vp6a4jXF/BFmCz7PyLaSYLJOEoJtygdN0do9oqXjVsOYWjSuS3p22gNp GzRJOD/J+ocWBsOoPAkakGd8F00sibcqXpO7vxsGo9bAtf/OerasVdlbrVGDz81qjJk/ a+TQ== X-Gm-Message-State: ALKqPweJVMUeZEW8g1pkvadA0ZfUYmqUWOFpBuALJptmt6VEurwYyoiZ xY5rc9nREWo0ZzEQSBIW3U+cPwEf1yw= X-Google-Smtp-Source: AB8JxZpZ9xHdJLJpnAiXIcENgqW4W5CKv0dWyZI6Zv8zfD8WOv8PMxmGq/Ynfgsmf1s+qsTUc5o2eA== X-Received: by 2002:a1c:d809:: with SMTP id p9-v6mr7249555wmg.6.1527152997297; Thu, 24 May 2018 02:09:57 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Thu, 24 May 2018 11:09:44 +0200 Message-Id: <20180524090945.10289-5-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524090945.10289-1-ard.biesheuvel@linaro.org> References: <20180524090945.10289-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v2 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: 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 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 --- Note that the ZeroMem() call is dropped, but it is redundant anyway, given that the subsequent CopyMem() call supersedes it immediately. 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..b1f09710b65c 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 *) AllocatePeiAc= cessiblePages ( + 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 Sat May 4 05:53:17 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 152715301005680.92005543390474; Thu, 24 May 2018 02:10:10 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 4A8B620886FC6; Thu, 24 May 2018 02:10:02 -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 E81C6207E6376 for ; Thu, 24 May 2018 02:10:00 -0700 (PDT) Received: by mail-wm0-x243.google.com with SMTP id f8-v6so3054054wmc.4 for ; Thu, 24 May 2018 02:10:00 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:3995:5470:200:1aff:fe1b:b328]) by smtp.gmail.com with ESMTPSA id x16-v6sm8505467wmc.2.2018.05.24.02.09.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 May 2018 02:09:58 -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=5eF0ccwnc7SXGizXrhT5cyihgK0mFeyVuLwuitooXY0=; b=PTH5IMa2aSGgHBwD+sjV1t5Nvn8EIycUBwP8c50En3g33GiyNj3XJRlTIP6o2Pkhfq dewJXQtgnFcPW5NIegaj6bCXXWX7EzyW2anM3QLeuTM8A6kEqR4ngD31aeulaLnVIlEr AG7bH3ueWWsQ/xnEsaTtbfyEnUIEnppM7IqQo= 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=5eF0ccwnc7SXGizXrhT5cyihgK0mFeyVuLwuitooXY0=; b=kMivz+NfNOaV3QBDi7FUykqKbPzOCIEzqh7Cl8OJiTnnGE5SBMLjjpn89bVzoKe+bA 3EZ2XSJjFVAkgWgFvQuBCe6KBHSLCsWXMBQuYWLxIA3xK0RYnXxkU4GbScYrvQpkU0mM DZfdJQBSlO9IKDCn80eqCt4AMW9LSlv+T3gtwfrIt9r6c0GoED0OMflRyuA2s9MjFje5 VApA+oCsozWgMh30N/9Uz8Ro+YQBXAKxGXjkvvzRjYaEfqTNIHTCWYT+qOckqYZF7mvb /29539ySGuxyA99Ok6+3NzVLINO9vOwkjdwAz44jD860dnf/4vWNKUqayGwzVZCN8XH9 1yxA== X-Gm-Message-State: ALKqPwemxrP0fS8GcmI2qNnZRcYQQPhcOQQifhEtRZ2dsXijf1mP08oH aFPwlFHuCPRjgC74ASblkArT/kxK5x0= X-Google-Smtp-Source: AB8JxZrC3jwAtPlAgepPXaQgZdeCC/cQIHBEVgPqcO1+/TwjJjnfOFWS4IMMSUnW5O0FdKi8smDFjQ== X-Received: by 2002:a1c:b9d0:: with SMTP id j199-v6mr7137684wmf.131.1527152999123; Thu, 24 May 2018 02:09:59 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Thu, 24 May 2018 11:09:45 +0200 Message-Id: <20180524090945.10289-6-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524090945.10289-1-ard.biesheuvel@linaro.org> References: <20180524090945.10289-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v2 5/5] MdeModulePkg/FirmwarePerformanceDataTableDxe: 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: 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 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 --- Note that the ZeroMem() call is dropped, but it is redundant anyway, given that in both cases, the subsequent CopyMem() call supersedes it immediately. MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerfor= manceDxe.c | 51 ++++---------------- MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerfor= manceDxe.inf | 1 + 2 files changed, 10 insertions(+), 42 deletions(-) diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/Fi= rmwarePerformanceDxe.c b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDat= aTableDxe/FirmwarePerformanceDxe.c index e719e9e482cb..ded817f37301 100644 --- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwareP= erformanceDxe.c +++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwareP= erformanceDxe.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -179,46 +180,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 +248,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 *) AllocatePeiAc= cessiblePages ( + EfiReservedMe= moryType, + EFI_SIZE_TO_P= AGES (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 +332,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 *) AllocatePei= AccessiblePages ( + 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) { diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/Fi= rmwarePerformanceDxe.inf b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceD= ataTableDxe/FirmwarePerformanceDxe.inf index 8757bbd0aaa9..3d2dd6eb732f 100644 --- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwareP= erformanceDxe.inf +++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwareP= erformanceDxe.inf @@ -44,6 +44,7 @@ [LibraryClasses] UefiRuntimeServicesTableLib BaseLib DebugLib + DxeServicesLib TimerLib BaseMemoryLib MemoryAllocationLib --=20 2.17.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel