From patchwork Thu May 24 09:09:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 136721 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1938267lji; Thu, 24 May 2018 02:09:55 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoLSe2tBnT0MIFXit88rWrlnyQwrftgHQQ8h8V6QdUnYuKw2auMMKsI3Y/oROMHMbjOLzT4 X-Received: by 2002:a17:902:1007:: with SMTP id b7-v6mr6355683pla.88.1527152995265; Thu, 24 May 2018 02:09:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527152995; cv=none; d=google.com; s=arc-20160816; b=Sx/DtV8/+MluBl5Tw7XXZg9ySaBthneUeCHWBEgM2kB+vnOM/VR8j5GN6uIvN/lWPy cgj4oWmkHDydLBYBCAcgrkmm7OV84K3117/ABK8bPiXUR28qu10I8PVHLBQnVlCKlyuZ zuIUbt19aJr387PXePLYSuXWD3C7Bs025bz/s/iaRtIMzygIpGBSTCIaxlwGgXtPyB1u dl8cA2hKAIOCRbLBZeTU2b46qN4dQbyX0/d3diYrQIjqv71dXdgyc9PVzBawbd2oxr6+ 0Gtqz6aXOw1ML7cIWpAG5mp9+wJLvU4eDiYVoBxJBLYTgzULnZE8jK8FdyZxhxo6Odpe yduA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=OlAxj2EqcnwnzRmv/vl8xfFPge6gdapBm93k00JPrRE=; b=tl1NQsRhP1cAnDocsBnOnp8SwjhE8D3zIH1ozj7ts4zP87E89WgCcQAE9nqsQsbyot 6EyaJwjT5xss4Y3UpbNtAe/jULzBCWr7EMAdrL3cmH6msQH3gq/IbAOtPwXrwvRtdbwo dBWewNS2NM5N2lUTKjiXu8gcTdq67KzDv9ZsgmBec9UuwqThhW3O33Sj7RnMhdd+7Kfl SkLUabG3xeleD5heIyOLLygoJEUmMbW2KbieAztqzvj47e5U2Tr5yTwAlTGeltUnVNoD 5BbM98H13PYeZODmlHjk4Ks8OunvSIH8svpHNk+gOpv83SS4ZPT+35R5cAnkL1VNcp+6 /uGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Q0KPpL+I; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id w24-v6si19689995plq.254.2018.05.24.02.09.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 May 2018 02:09:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Q0KPpL+I; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.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 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) 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-Received: by 2002:adf:9125:: with SMTP id j34-v6mr5971576wrj.156.1527152991593; Thu, 24 May 2018 02:09:51 -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) 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 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(+) -- 2.17.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel 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 [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 @@ -149,6 +150,9 @@ TryRunningQemuKernel ( // EfiSignalEventReadyToBoot(); + REPORT_STATUS_CODE (EFI_PROGRESS_CODE, + (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_READY_TO_BOOT_EVENT)); + Status = LoadLinux (KernelBuf, SetupBuf); FreeAndReturn: From patchwork Thu May 24 09:09:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 136722 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1938294lji; Thu, 24 May 2018 02:09:58 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr10hJyDFftKRnUjD5mr/MUB9ilG0hh/0Gbous5P5s58fIiShxuy5tOHoxfgAosorJx6TW5 X-Received: by 2002:a17:902:680c:: with SMTP id h12-v6mr6618200plk.113.1527152998054; Thu, 24 May 2018 02:09:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527152998; cv=none; d=google.com; s=arc-20160816; b=RRequebITMp/7mwz86A03dh2kOqJtBausmy1IWYYEhcE9dLnNKnN2osbG6IAch3mOZ qAifI8/Ih4gV/Nqd1fNZeQS0kExzPnQTUEjIOIKXXcb9dgKLQ684FK460hjpXCcTZUVH /LGuk0zb6taI/BcyoKeLqLfxI13FIyNNEF9VSMuquzRWKjQZsh+2SCZ+B0FMNy9sy3PN 9za1URRn+LsskLmuITjqstLCP/ypozRw/1kN1k6Z3gRDte2dFLr4/8eFT4+Z+3Dv8l7m Onu0HX4oZLltWnw7yorgrMyaGDyFNMwOv08nupqy+aGUZkSmTLfPtnszNKy9Ji6M8vqt qOUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=Vw/IdDoR1+zlmNBBsCkH1mTjbrK2w/MQr8HazPIKEDI=; b=WFvmIPjh9KMkX7dZMY4p5vhSythorOkPnPzUZmLznQxp9QI9n+1VmQq0K5WhZxraZw aRC4Q/npFy0PmFQTSMaE+Xsjd8Ql6gBWBoTukfaxVYvNrP6Ca5XWuVE1YFGEJ1iCWrRb B2G2SG+3uOtZrYHDBp7mSjovZ5BstNr68ThgoUgPzFyPiNoT4ADsIYc6lYnz3CAUaXEj Cx989Wu3nHkiO6Isr/w+Xu/441EQKA+E6CbTLwtSL9DmPn9LMsxokVOvQigX6WTpqTob LElCEOOi4D84bDh6jRVCoTKIf7Pqa2E0ejcTHdqUuh2qrmmNUAaG0wsy2oAr/g7Bu/of yfbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=hXcbFuC5; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id a69-v6si20931346pli.391.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) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=hXcbFuC5; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.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 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) 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-Received: by 2002:adf:e542:: with SMTP id z2-v6mr4838598wrm.111.1527152993544; 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.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 May 2018 02:09:52 -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 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(+) -- 2.17.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf 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/ArmVirtPkg/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(); + REPORT_STATUS_CODE (EFI_PROGRESS_CODE, + (EFI_SOFTWARE_DXE_BS_DRIVER | EFI_SW_DXE_BS_PC_READY_TO_BOOT_EVENT)); + // // Start the image. // From patchwork Thu May 24 09:09:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 136723 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1938349lji; Thu, 24 May 2018 02:10:01 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp8uW+xeK6y58nVT1CynYT0CBmExqpxRGEFNPzL503XgY9hD8dHwPycue6SKd0SM7blj+Zj X-Received: by 2002:a17:902:778c:: with SMTP id o12-v6mr5598476pll.199.1527153001268; Thu, 24 May 2018 02:10:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527153001; cv=none; d=google.com; s=arc-20160816; b=zRf0JmtvmDZ/DcqRXhs7t44POYbDHS5dHRBEEFRKenEpSoH4KXubR+4JHagd0Dm/dz xZgVDeLVM3eK5B8tj8Pk8fMszwe4XI1v8LOzyTAK8vYwXykkBgqEhOxxJSA/4z9ZkK/H n2AhNd7s7alP/FWWtxH568WZ+JW3DeKipchccpmp+Vgblj8C7GftiECnJnzCAXWCiSyX FKF2VPkX9hK2Ajkew08JYDTjGPfdq3BgT28D25X3gvARxq9Q4A5w49FNoR7lfyg9gP74 Yze9zZKq1jki3UNATVWcpvBMENjGymYp4tLoEuDI+p6yU+OMikI1ItxrFkKCrvPoP/Ia ymHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=x798+fWfITI+3B3mvt98T5VxTuvOZEwsd9pHOXOof1o=; b=Y3eXRaRHPfvPut6jO/Qj7M0Y9qvDtM5EEAUFT1IpRcJXsEm82KaiFYI06M9V43ZOBt D88evgzRQyiViQdKqlKrhd/Nc+RzetlXiVJPSbNyBmyCpp+arf8t3cYKqHCQ1SU0Kwby xhLXDQQK3tIuWcf+KIHrrF7Geo4UlK9PuQwdgvxLLEAniLwwIptPE9I7w3gcGm2MQk6Y A27eei7qbya6Zahda/QgssSjHOo8B0ysuI04/qao6LcrO1taCb3S//dPTsg1ng5wKbuo 55DEMURaQtoUuldUOlfhXlivMgHAHhoTUIVeKepXwmtnRxWOjTG5Hdsi/d9P1jtvX3vq GQLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Ym1wInpp; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id d15-v6si3994574pgf.390.2018.05.24.02.10.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 May 2018 02:10:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Ym1wInpp; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.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 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) 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-Received: by 2002:adf:c32b:: with SMTP id n40-v6mr5406697wrf.91.1527152995427; 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.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 May 2018 02:09:54 -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 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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 --- 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(-) -- 2.17.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Laszlo Ersek diff --git a/MdePkg/Include/Library/DxeServicesLib.h b/MdePkg/Include/Library/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 ); -#endif +/** + Allocates one or more 4KB pages of a given type from a memory region that 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 + ); + +#endif diff --git a/MdePkg/Library/DxeServicesLib/DxeServicesLib.c b/MdePkg/Library/DxeServicesLib/DxeServicesLib.c index 1827c9216fbc..6719aabe5d04 100644 --- a/MdePkg/Library/DxeServicesLib/DxeServicesLib.c +++ b/MdePkg/Library/DxeServicesLib/DxeServicesLib.c @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -1093,3 +1094,57 @@ Done: return Status; } + +/** + Allocates one or more 4KB pages of a given type from a memory region that 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 == 0) { + return NULL; + } + + AllocType = AllocateAnyPages; +#ifdef MDE_CPU_X64 + // + // On X64 systems, a X64 build of DXE may be combined with a 32-bit build 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 = (EFI_HOB_HANDOFF_INFO_TABLE *)GetHobList (); + if (PhitHob->EfiFreeMemoryTop <= MAX_UINT32) { + AllocType = AllocateMaxAddress; + Memory = MAX_UINT32; + } +#endif + + Status = 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/Library/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 +[LibraryClasses.common.X64] + HobLib + [Guids] gEfiFileInfoGuid ## SOMETIMES_CONSUMES ## UNDEFINED From patchwork Thu May 24 09:09:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 136724 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1938414lji; Thu, 24 May 2018 02:10:05 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqReNUWjcIbr4QrBVI0pnkKh2j+GmPj7BcB+UwfJdn1HyIgqI3F41rwotHU1Hf0Iew9VedK X-Received: by 2002:a65:510c:: with SMTP id f12-v6mr5057816pgq.385.1527153004858; Thu, 24 May 2018 02:10:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527153004; cv=none; d=google.com; s=arc-20160816; b=mQUbihnuwpJlOAUznxbhnIjt7P9SVWkdfy2xiVEuVjFCNCr2/w5HNUd4KvRzIv5OFJ WM+fg9MGnWHzmpxWcFg1k+HCm196dtSxHjDr4vd8+M/ZL9NfGekcLgsHoD13Y7NqWtjH tZpfXhLXPQWbMvfpbBa6yo7LfqGERT51FB43x2K3A7PDL6oixKTuBJJXECX2yBPmyQOQ e24WiexrEFPxMsErUb5ymAJpW9CaaC+OFe7kSU9TI3xuIl/ayplRjZqSmwORg3Ei3oF7 P5vkpNtP4lVd1jqkEwWt+aF3xel9WLZGVwI6CrqmGi6/9KpLNn53YYpX3nSBrHHFsW65 t6bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=ZCy1DnyedmdGeiHV2EKLk7ZCmQVbWY4w4BlkD9TVQVY=; b=TxzCh6t0iYdxJEtz0DXGx3fsZjC6nuhOvYc+Gf5WiYgfWGt9TCRYIrq2v6oUp00huU ODvqL0eCTIsGpxnPf7DP6vx1jdbb/D/maUvI8NyE9WaiGl4GzudMjbTcwkt1cIHvzOfV xiCi7l0RJi0y2FnYQJYQJb3s0rS8wz3Nb/x/8V1AUNe75xrV7DqPQ7rzMS9OGhsoDBRw XW9DWWXHw+Bu5ldiEOakYsezPZp79vpkLoMylJ2bn5dGHoZXE/sDcrKxPNU87TKbXinz wVxJ2Abjxed/cvbqbtY2vv3Con3ygmGzemwc5QKCNiNNbf38zx3rfNZNlYhqbzh0ikvE moSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=McaetZ7b; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id l187-v6si16181208pgl.485.2018.05.24.02.10.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 May 2018 02:10:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=McaetZ7b; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.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 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) 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-Received: by 2002:a1c:d809:: with SMTP id p9-v6mr7249555wmg.6.1527152997297; 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.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 May 2018 02:09:56 -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 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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 --- 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(-) -- 2.17.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Laszlo Ersek diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.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 ( } } -/** - 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 = NULL; - Pages = EFI_SIZE_TO_PAGES (Size); - Address = 0xffffffff; - - Status = gBS->AllocatePages ( - AllocateMaxAddress, - EfiReservedMemoryType, - Pages, - &Address - ); - ASSERT_EFI_ERROR (Status); - - if (!EFI_ERROR (Status)) { - Buffer = (VOID *) (UINTN) Address; - ZeroMem (Buffer, Size); - } - - return Buffer; -} - /** Allocate buffer for Boot Performance table. @@ -348,7 +308,10 @@ AllocateBootPerformanceTable ( // // Fail to allocate at specified address, continue to allocate at any address. // - mAcpiBootPerformanceTable = (BOOT_PERFORMANCE_TABLE *) FpdtAllocateReservedMemoryBelow4G (BootPerformanceDataSize); + mAcpiBootPerformanceTable = (BOOT_PERFORMANCE_TABLE *) AllocatePeiAccessiblePages ( + EfiReservedMemoryType, + EFI_SIZE_TO_PAGES (BootPerformanceDataSize) + ); } DEBUG ((DEBUG_INFO, "DxeCorePerformanceLib: ACPI Boot Performance Table address = 0x%x\n", mAcpiBootPerformanceTable)); From patchwork Thu May 24 09:09:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 136725 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1938490lji; Thu, 24 May 2018 02:10:09 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpiWA0CpnBvNfAIEF0QnEW3iIfaPoCRWf96zFoEPYG4h2QYkx95rwYgrFHqVtI9KXKr4kQS X-Received: by 2002:a17:902:a711:: with SMTP id w17-v6mr6533952plq.292.1527153008888; Thu, 24 May 2018 02:10:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527153008; cv=none; d=google.com; s=arc-20160816; b=ICxfml4RZtsBnrnLFof72D8v0c0Gc0oLgtgoz7wHC5Sl1eQMNbs5nbRYEoqi4jz0oo 5VHo/zBJLHrF8U2/z7LOG3oKCYNBCU2DRMJiUdB0X6bYEDFzoKwxK+AtF1DWbcvLQHPW 3v7DG6wWUQb1ClJFItKPRLJnBKIKU0PDE1g0GuqoabK4UQKAUYL80e356lx0P4QSGYZW OHHG7YvrWbbue+EAkJA0mZ3QZjQElljlNzOG9P51qKLEuubArcdvrGtLG3u4V1XVnZqV jVubDd76B4cLqd+Vrf57u2wJKRyOl9s+2h0mmGjMtdPIT8LmILAp3TfK038LV9PlTWdM l2Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=vBWc7SBD2gPmfJviP/FrkC3p3lIamOmkJszznQtfvRQ=; b=TKumzgocEWirdlVdOwbzal/jBqrlOFyNPgJLMLYX7pco1mNDAsA/aNwQgLa/A/ivuu QHSb1v8tfkcupoETamgfYYXWMsLtdSDrQhh3X10xjoT7TWgDKBF5GuDHKt26az/8nDio J16S1EAYsEsIxlukjS6vXV/OSpypQFePt3JXEZSkFCJNkXT1JLn4t2oy4LqLSFxkYO/h WL8jqAWuGsygwIr0G7ma/12EVSLNOfqYzTbc8fQcHkAiWA5iBa+kKRDPm/HqJJ0CquIJ yKgz4JzQJJHGsBUljE9Q1WnqERy9AculcYagh7taAeZlrCLXiUA89oPZUYjxxaoHgC0m oL8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=PTH5IMa2; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id b66-v6si722282pgc.319.2018.05.24.02.10.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 May 2018 02:10:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=PTH5IMa2; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.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 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) 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-Received: by 2002:a1c:b9d0:: with SMTP id j199-v6mr7137684wmf.131.1527152999123; 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.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 May 2018 02:09:58 -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 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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 --- 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/FirmwarePerformanceDxe.c | 51 ++++---------------- MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf | 1 + 2 files changed, 10 insertions(+), 42 deletions(-) -- 2.17.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Laszlo Ersek diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c index e719e9e482cb..ded817f37301 100644 --- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c +++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -179,46 +180,6 @@ FpdtAcpiTableChecksum ( Buffer[ChecksumOffset] = CalculateCheckSum8 (Buffer, Size); } -/** - 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 = NULL; - Pages = EFI_SIZE_TO_PAGES (Size); - Address = 0xffffffff; - - Status = gBS->AllocatePages ( - AllocateMaxAddress, - EfiReservedMemoryType, - Pages, - &Address - ); - ASSERT_EFI_ERROR (Status); - - if (!EFI_ERROR (Status)) { - Buffer = (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 = (S3_PERFORMANCE_TABLE *) FpdtAllocateReservedMemoryBelow4G (sizeof (S3_PERFORMANCE_TABLE)); + mAcpiS3PerformanceTable = (S3_PERFORMANCE_TABLE *) AllocatePeiAccessiblePages ( + EfiReservedMemoryType, + EFI_SIZE_TO_PAGES (sizeof (S3_PERFORMANCE_TABLE)) + ); } DEBUG ((EFI_D_INFO, "FPDT: ACPI S3 Performance Table address = 0x%x\n", mAcpiS3PerformanceTable)); if (mAcpiS3PerformanceTable != NULL) { @@ -368,7 +332,10 @@ InstallFirmwarePerformanceDataTable ( // // Fail to allocate at specified address, continue to allocate at any address. // - mAcpiBootPerformanceTable = (BOOT_PERFORMANCE_TABLE *) FpdtAllocateReservedMemoryBelow4G (BootPerformanceDataSize); + mAcpiBootPerformanceTable = (BOOT_PERFORMANCE_TABLE *) AllocatePeiAccessiblePages ( + EfiReservedMemoryType, + EFI_SIZE_TO_PAGES (BootPerformanceDataSize) + ); } DEBUG ((DEBUG_INFO, "FPDT: ACPI Boot Performance Table address = 0x%x\n", mAcpiBootPerformanceTable)); if (mAcpiBootPerformanceTable == NULL) { diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf index 8757bbd0aaa9..3d2dd6eb732f 100644 --- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf +++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf @@ -44,6 +44,7 @@ [LibraryClasses] UefiRuntimeServicesTableLib BaseLib DebugLib + DxeServicesLib TimerLib BaseMemoryLib MemoryAllocationLib