From patchwork Mon May 28 14:40:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 137082 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp2908840lji; Mon, 28 May 2018 07:40:36 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqtLkXLCxVs1PtU/RvTiY4S+EsQkwRXBCRG/cNvBSEDAs7vk4GKdRtWtUi2zTOVukfIlBIj X-Received: by 2002:aa7:80c6:: with SMTP id a6-v6mr13686077pfn.120.1527518435946; Mon, 28 May 2018 07:40:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527518435; cv=none; d=google.com; s=arc-20160816; b=bAAqPNhtSejvmwLz+fA5Ip9TD48T+Jeczg2LHq3iAxNZqDoA+3szdzFQ6fWvyK3nMW 0TZWkOexGPfnzwrK2mw/uaOJ5DvlIk9otytvckUwH53zEN2HXjT6lC68Mo8CpPqvMD88 jU9Rtl/WMj0qClb2iZDxgFYY/JHqs8xX+tYUzJsySBtNYrYcDmKd2W+2tjXaCS6qJAbz YxWeKUh78koZ5f3aob3TgTv3WIl6vfAR3278FkWRbpO7jGMZJX/KztWPnrtPkrGht9OJ ldLXi2E+uM8PrfsmZ9A5r3DSsGTXdn1jMLysd+z09rRY3f+JGUGWNDjn5rn1U7STKnpJ MaPg== 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=wLmWp0Y8quDbIzEGD0Vc41Y9kLTnat0R1iX9LVSaK0I=; b=HYBl8zHjhv0kX5Xj/z8SSQRYfmMZ7TWGvYTsXJdyyHMwTrg/3X6rstz91g4eNiGtvk uMKdz+fIuwXO7g31Dnk/S1fgKEmpBtDO8j/u4PBWYWbNSEQAWzFW5t9zGlO5qOwGDaDx XCjNcUZENUCk7E19R4qJjnNGIW/RUwNvjA0K1XAfTRmay9ps6VEkoU0HHzeOCVyH8yJS pyUPVi08Hm3hQIg0xhs5TXIKuEpVK5QWnagp1gO5IBRSM1TGAP0r1SF1yyYh+PjJgiat I+/2sdxWFEG/Rckja5ApUmB25yU7g8BXyx71Mi3vm9eFj32xz8Rdu05U4va5VbriH59c Kv2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=VGD3LGnS; 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 f85-v6si30204339pfj.125.2018.05.28.07.40.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 May 2018 07:40:35 -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=VGD3LGnS; 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 17D25203B9933; Mon, 28 May 2018 07:40:35 -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::236; helo=mail-wm0-x236.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org 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 6010020977877 for ; Mon, 28 May 2018 07:40:33 -0700 (PDT) Received: by mail-wm0-x236.google.com with SMTP id m129-v6so32613772wmb.3 for ; Mon, 28 May 2018 07:40:33 -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=p7ups/9ZdYsiMQSjbYeXAzS9Lyu9fSQlANLgL0VADt8=; b=VGD3LGnS291x6TPafxiBk5JgiYblTP6I6sg/tjSBm/i7fcNlPmpcANrGhdGnVMVARp xzwuy2/LzaViALSeD2SOM+3sL9ttuA23MyO8k+5c/CYZU3EWHYh9Df2ZKMHgqHSEyfvr S3tFvmZytvcRYry8h/nhcFgxrFB3Y6FWzdyi0= 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=p7ups/9ZdYsiMQSjbYeXAzS9Lyu9fSQlANLgL0VADt8=; b=tCmlRBqoIfaaFQ03BgoLurUqFy8E8ydF2H4BDwuIiQ4GhJrK1nwF9tVDsq84EBxIJo IIM8KgQ24sSuYvojOJ1L3uxNGo0GSF7pfRVY2XWwVIJqO3kuaDV5OWgpocryF9PJPd98 GRuUPGIstrzeJ1wqz31rx64nI/tDiOQbCy+u8mf0NPGQcISAwR1gJs2P4XJJgVCu7a5a sATe3D5PBMSN6TwS+cdHRjcyjwepLymXHMpBIKHUI7abNqxL3nzucl65j7sBnb15sNvF xTiyygcPdNRt7LhD7QU7Ow094M6LpB3biCSy6dNeykR/it1PpazQbl7zOPqaoloilady jBsw== X-Gm-Message-State: ALKqPwcUUqa9QfxtTbSlbdIesnoENjQ0ITgnyS2O0+k5wCsNU7nSsMlj hUqA7Kf2kHtakU0HPBYInvg/AffZqy0= X-Received: by 2002:a1c:ca:: with SMTP id 193-v6mr7909058wma.99.1527518431344; Mon, 28 May 2018 07:40:31 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:3995:5470:200:1aff:fe1b:b328]) by smtp.gmail.com with ESMTPSA id y18-v6sm4177938wrl.53.2018.05.28.07.40.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 May 2018 07:40:30 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Mon, 28 May 2018 16:40:20 +0200 Message-Id: <20180528144024.10809-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528144024.10809-1-ard.biesheuvel@linaro.org> References: <20180528144024.10809-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v3 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: Ard Biesheuvel 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 4b72c44bcf0a..d355d0440efd 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf +++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf @@ -56,6 +56,7 @@ [LibraryClasses] QemuFwCfgS3Lib LoadLinuxLib QemuBootOrderLib + ReportStatusCodeLib UefiLib Tcg2PhysicalPresenceLib 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 Mon May 28 14:40:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 137083 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp2908891lji; Mon, 28 May 2018 07:40:38 -0700 (PDT) X-Google-Smtp-Source: AB8JxZonVgF4sJ4c8PrNm456y5lfWU+hEXxIjdf3Mnw7j+KGP59kjE8Nd5mAGjsYvpswUACZM6+D X-Received: by 2002:a17:902:5a4b:: with SMTP id f11-v6mr13844172plm.85.1527518438564; Mon, 28 May 2018 07:40:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527518438; cv=none; d=google.com; s=arc-20160816; b=KrA7vC9RMxab8rEke+dAVsd5urYGbxA27XvqSUAa/mayy10Tlhe+Ov+mAJDrW+YOkH iMwta2iVPB4QroPMP6iGnfMThxivyQLpUwctRIridGIwTQ1PvhbU56Q0Ip+sVwWZfuC3 DA8Y6O6FbHjGcUjXMpaNLByW3vAhlLTHClQAil7KFqguOSONbNRNCkARp7Gi6kq1oaAU ckrled+jDxiJ0i8EwgYmpD0+SsIfT5azdVR2N682w2EBpgM3jhreHL3bafRk8rnweLp+ Z01W6yJQHxlNwCBtZHFArMFInskEIm51QD6LSduz7D0IaHd8M3i1LZ5AOKu2LH05JA77 gBUQ== 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=jZBeS7aVeFnsq/PfJn6FM0TnMU/gB5taqJjxhaPRezBoKNEOPpXKUYfHsrq2HrknRo DB+7q826Kzqm1lVQ4U0NsWy4WURWcxQDqulpIxKu3PRvjAp2tJ402eEDr3BSUspJhaEK zhw0ApJzN3hDlg2ojedtOteiq1upriOT3pfLF9L+cpSlhhyIUn0MWbZOqwpe7aEjIBuc z2g0OAeEYTm3fFWdWMELRqwdH5PAvBlwmeqjRAGEAEj40JZczXTkQZOyoDJmpEfF0lKq pKXDPB6q51wg48l2xLXFStdjYGSQ2l7E1Y/VUg/vbhCdQ8lez6PEoxrbYQu/p0KZq/zH /Gxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=aBmRk6n5; 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 z13-v6si30953312pfc.128.2018.05.28.07.40.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 May 2018 07:40:38 -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=aBmRk6n5; 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 479D1203B9918; Mon, 28 May 2018 07:40:36 -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::22c; helo=mail-wm0-x22c.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x22c.google.com (mail-wm0-x22c.google.com [IPv6:2a00:1450:400c:c09::22c]) (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 92D322083797D for ; Mon, 28 May 2018 07:40:34 -0700 (PDT) Received: by mail-wm0-x22c.google.com with SMTP id l1-v6so32744590wmb.2 for ; Mon, 28 May 2018 07:40:34 -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=aBmRk6n56g80dHgb+gYy5c+VUSzfAZwOjLdC2mXsCZZJbXjJbvfQQ6vbBcMTO9rTLw nVBIdrZWuMc9mBCOi5iuF8wdQM8OBxNZ5udf/CiPBB5xHJKNSbnIQQFft7mYcGnbkDSB iS+aUDvVOVG93gYV1N24LkIdspKKoWax5Jgi0= 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=ukezqfoQNgk9hiQMkPmxfS44+ej2DetmW2cMOZ4Kp09Eirf/wgOvTixb14JgwUSw0g U5HnPOeadE0rwr44mtNiCfOF3HfVhSNmkO6CC0qt0uAYypo66jmLoOSQXwz1GCEnQ0h7 7nO6clcMaGz3dqNhBHokc6VmpzGTWVP8+BFlAXt1cZUbBg4QSJgbvzcBigt+k2cFDc/+ Fg+rRWFWkBHSl1p4MpMiMJceBttloE6VVMBL/jmK++yInJmBL5nKb61wCBE2+EmIqK6e 5O5OJj/fyRV36CG+2GCxSLrSWjyiGUcOGc42CukMNWCKKQfIzRw5bJMV/AdBVwb6gEtd TGGw== X-Gm-Message-State: ALKqPwdWKgybyanDx8XDWZOQd2yeNsGzpZJR3AikMDIeb25QhBYqBvsl +njDgoYEQUI5ezrcRflfChJFCkD4NNM= X-Received: by 2002:a1c:d106:: with SMTP id i6-v6mr3999036wmg.1.1527518432902; Mon, 28 May 2018 07:40:32 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:3995:5470:200:1aff:fe1b:b328]) by smtp.gmail.com with ESMTPSA id y18-v6sm4177938wrl.53.2018.05.28.07.40.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 May 2018 07:40:32 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Mon, 28 May 2018 16:40:21 +0200 Message-Id: <20180528144024.10809-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528144024.10809-1-ard.biesheuvel@linaro.org> References: <20180528144024.10809-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v3 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: Ard Biesheuvel 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 Mon May 28 14:40:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 137084 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp2908957lji; Mon, 28 May 2018 07:40:41 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrP7OCdbBZ+PR63awbJYBiwts/dGMM4cq5dchhC1BN/3rmNkJ9crbRlT7UjbtFprT2Ks04R X-Received: by 2002:a63:744c:: with SMTP id e12-v6mr10913954pgn.4.1527518441549; Mon, 28 May 2018 07:40:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527518441; cv=none; d=google.com; s=arc-20160816; b=0YAyhQDsC1vbfj3GZMc+ZKORDvWUuqF4OxsVnHAEs52DCjrkOuyFROfP8U5gk6ljsc OWq+1xlFfwEdfbtf8Idc7CzdoXYk+mXdtO6YUbMyWkAdbfptmouq1mtcMhHG8Wclmwca k197J2OZgLp2C8dYFVRP6dH67zENMqai4KNM5NvPCa0+K2Rv+YlX3G+//BtAt8Nar7ku YR05LGsuonesmhgJdPN3AMVreHKUboPX8ADv3FeazTDTH6POzPIh4yLJruu0V/VHoebQ hdwtPNpD7rqouL1DsMB1j611InfMaz/qlthEhVZ5fA5RIgXl6IP48WFiqVkVmqAlNwBN cf1g== 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=yvOh/19Q5Hl221IvWSUiOpyv7bm670b/XlPYx/uPDJM=; b=Ma0j5XttGWRh248yY9/h1iEPFX8rPlSkSfkghgUBCiBVV3siIu7/ounJJdlRip+u32 +jr3B3RrLV+3jVbX8xVZA012cawOa2dUggwrzlg5QeR1DDiYp4UsyCuDut+6yncM2hVq ax2CN04b5FFpPChKfHylxU3Sr4JbE2d+7YSl11vOgrSsr+1+8XzUp/6WrO81Vl74Yy5d CGbQWoeAo+50ImNs9cOQ7iP19RFbC9nzlszp6T7lSyWGeR8N3DkqU2+vSncPj031QfZz aFwTNyc6dEu0jgggNCkjABKT7vBtEPrBWYivraV3Dq7aHg+XbvBcqEQHwki31KBx3Gi2 489g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=AhUs3h4+; 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 n4-v6si24017664pgn.691.2018.05.28.07.40.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 May 2018 07:40:41 -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=AhUs3h4+; 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 776342096DCEE; Mon, 28 May 2018 07:40:38 -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::229; helo=mail-wm0-x229.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x229.google.com (mail-wm0-x229.google.com [IPv6:2a00:1450:400c:c09::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 0FE8720348603 for ; Mon, 28 May 2018 07:40:36 -0700 (PDT) Received: by mail-wm0-x229.google.com with SMTP id 18-v6so27177241wml.2 for ; Mon, 28 May 2018 07:40:35 -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=u6zCqFp2IaaQxo92GOnrrGKK5FBwiSrmNNmvxZqOObs=; b=AhUs3h4+pKPZqzwXhEgwPjrExAsJoqdTvyowA2u7EwtNMA0tDkSYmWJ/mHd3IkFoS/ YGoXESOx+zT9OKK3+zYj6utSuRB011IJTvfqBJwpwMc0mD8QGKTtYZoaV8SqnihXXdgW u2bl7Evi6A5FJ/WZ+PV403eEPUuGfgSN1n1L0= 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=u6zCqFp2IaaQxo92GOnrrGKK5FBwiSrmNNmvxZqOObs=; b=BNtfH13hVNs1BdrPguBiWf1b0W/kbqrsYRR8krL87M9w/esjT9Vgnsw3wtbRcNKQG0 pdJm9rctA02by2JGe0qjoMbb4BSqAEsJoUKk8UbT7C7CypDSQ6aigLYaOHd7muM2niIw zOcg+FhZddjdnnzVYzGtHGgQE1wGNSctV2ZbwS5CWJ3Mt09ngDgux+M9gRHPOXWTuoGh xR1zzA154y9+cyzVUGRKyNr6q1xxM/xkq/ZKcWdafaxtWQp9e9KHHVVPalN8D++RVKan oEuTeTKoFapSxnw+IMzG1ESFo/Cr0svwWmC0Jqy/AdC7yvh7dygotFqHVhRKdSkVgRMB NNJg== X-Gm-Message-State: ALKqPwe0ZtvE/xBN+Hsoj5aMJ65KsqvMgvAWuwnVHFA/Wouj7k4QgqOF QlWiEyLeYyv4ap0pPQeUJ8+5CC3B/lY= X-Received: by 2002:a1c:6dd3:: with SMTP id b80-v6mr7968979wmi.32.1527518434317; Mon, 28 May 2018 07:40:34 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:3995:5470:200:1aff:fe1b:b328]) by smtp.gmail.com with ESMTPSA id y18-v6sm4177938wrl.53.2018.05.28.07.40.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 May 2018 07:40:33 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Mon, 28 May 2018 16:40:22 +0200 Message-Id: <20180528144024.10809-4-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528144024.10809-1-ard.biesheuvel@linaro.org> References: <20180528144024.10809-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v3 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: Ard Biesheuvel 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/Allocate.c | 54 +++++++++++++++ MdePkg/Library/DxeServicesLib/DxeServicesLib.inf | 11 +++- MdePkg/Library/DxeServicesLib/X64/Allocate.c | 69 ++++++++++++++++++++ 4 files changed, 155 insertions(+), 2 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 Signed-off-by: Ard Biesheuvel Reviewed-by: Liming Gao 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/Allocate.c b/MdePkg/Library/DxeServicesLib/Allocate.c new file mode 100644 index 000000000000..4d118f766d49 --- /dev/null +++ b/MdePkg/Library/DxeServicesLib/Allocate.c @@ -0,0 +1,54 @@ +/** @file + DxeServicesLib memory allocation routines + + Copyright (c) 2018, Linaro, Ltd. All rights reserved.
+ + This program and the accompanying materials are licensed and made available + under the terms and conditions of the BSD License which accompanies this + distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include +#include +#include + +/** + 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_PHYSICAL_ADDRESS Memory; + + if (Pages == 0) { + return NULL; + } + + Status = gBS->AllocatePages (AllocateAnyPages, 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..50ae24f8ee22 100644 --- a/MdePkg/Library/DxeServicesLib/DxeServicesLib.inf +++ b/MdePkg/Library/DxeServicesLib/DxeServicesLib.inf @@ -27,12 +27,18 @@ [Defines] LIBRARY_CLASS = DxeServicesLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER SMM_CORE UEFI_APPLICATION UEFI_DRIVER # -# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# VALID_ARCHITECTURES = IA32 X64 IPF EBC ARM AARCH64 # [Sources] DxeServicesLib.c +[Sources.IA32, Sources.IPF, Sources.EBC, Sources.ARM, Sources.AARCH64] + Allocate.c + +[Sources.X64] + X64/Allocate.c + [Packages] MdePkg/MdePkg.dec @@ -44,6 +50,9 @@ [LibraryClasses] UefiLib UefiBootServicesTableLib +[LibraryClasses.X64] + HobLib + [Guids] gEfiFileInfoGuid ## SOMETIMES_CONSUMES ## UNDEFINED diff --git a/MdePkg/Library/DxeServicesLib/X64/Allocate.c b/MdePkg/Library/DxeServicesLib/X64/Allocate.c new file mode 100644 index 000000000000..b6d34ba20881 --- /dev/null +++ b/MdePkg/Library/DxeServicesLib/X64/Allocate.c @@ -0,0 +1,69 @@ +/** @file + DxeServicesLib memory allocation routines + + Copyright (c) 2018, Linaro, Ltd. All rights reserved.
+ + This program and the accompanying materials are licensed and made available + under the terms and conditions of the BSD License which accompanies this + distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#include +#include +#include +#include + +/** + 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; + EFI_HOB_HANDOFF_INFO_TABLE *PhitHob; + + if (Pages == 0) { + return NULL; + } + + AllocType = AllocateAnyPages; + // + // 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; + } + + Status = gBS->AllocatePages (AllocType, MemoryType, Pages, &Memory); + if (EFI_ERROR (Status)) { + return NULL; + } + return (VOID *)(UINTN)Memory; +} From patchwork Mon May 28 14:40:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 137085 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp2909022lji; Mon, 28 May 2018 07:40:45 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoVvlXmiGOuiXVhP5ybrf4a9mHBT6Zuy2oUNdGIDRyzr+T3AI4AoQDaMJ9u6OpPghGzlpPU X-Received: by 2002:a17:902:7686:: with SMTP id m6-v6mr14009541pll.340.1527518445101; Mon, 28 May 2018 07:40:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527518445; cv=none; d=google.com; s=arc-20160816; b=is30NVY/W4FYP0L+2w5x6b/+ff11LrNsOPNpATDCAPFs9OuB+7ED2f7z6Q6yydiHur JM4b/RKFZust1MJv0aBkQa6hzVikVdLiZND18vYrKgQWQwo/aULq2V5+AYQuOJNy0Naf jCH+8OW1mFRyRXv079cYw0dqNbDXu/o20Y8VhQwkPiq9Voy2s4vHZ3KpCQO6npzGSgeA IROZ/IE7kYjAoFpz30ZuQENaAu+NHimmp0Fo7ruRR0z4znSfrMWR7M4YvT7jH8v7iJD9 Inim0Rnc94GxVPlC0QFQLbmc2N01533h6v3wJYbBIJTu0r2wWieGxkebjAHz7V3BS1/4 fcJg== 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=FZw/QAR9EyKwKsv691Caa/oM9dCTw4XYDXwAxE9Nytg=; b=SxMc41MThh1WJYAHKSeGYu3rFpyU8wqPjA8sXg1h5NyNMAPlFhQpWtBm9bhjlKCb8y 8LWO8TULWdkMF+RlkL2DsRd/oM2BiqdJa41xiMRjjKTWlBfKO0saDZMJNgTNNqB4UkMe Gkpl5AQrWe9DBGJoikbr1wNFm/Ak0xbydM4ShBkjIVeUxl1h4AgEgOPvC++3D3OpQP0/ cE9vkW+aS4LmhZjnC1NbT+3eMkTKzVGkEWKpvQstH3U6Rt8mcpVAwpjvsRsXfHXFJIq8 0+mRrUbxw6YuYtCQA9jx6db1nn1fWtvAKNpO/RAJKUMR5EMneFt8w1sMyTRVUCd5xyNi gRVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Up/RJK47; 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 b2-v6si24373588pgc.569.2018.05.28.07.40.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 May 2018 07:40:45 -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=Up/RJK47; 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 A83E020971743; Mon, 28 May 2018 07:40:38 -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 730592007E7EA for ; Mon, 28 May 2018 07:40:37 -0700 (PDT) Received: by mail-wm0-x243.google.com with SMTP id f6-v6so32744573wmc.4 for ; Mon, 28 May 2018 07:40:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/JEKeo7S/737rZrZeZuXQkl9OAczJ86VGCjE1eeWUIA=; b=Up/RJK47oDFE/H6Qqai9BP4SuOp/6kurwIAnZDXVyApboCmn5MgHcXvTulqf/8p+Rh D2u5/QjWUVsYIcasVn9Lqfn0gF8pSfNgNwRUmKdZl14eSJDtjdBL/LWEJKWnV3PBGWAn ryUrzOioIL2NPUD5o0w6cyJt1fDiZzrIJapOM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/JEKeo7S/737rZrZeZuXQkl9OAczJ86VGCjE1eeWUIA=; b=SXYcvtPunWGVau4xrBBWwol/C92m6a9S0D2GnKcV6y2NwSZROBaow4tspCt7vj2dor UOE+h2Ws1ueGrGXwE29lKuj0hpkUcSG57C2X7W7JCgK1cNEyA39IUevtioIKpMkIjeYV ldWtaVgoU4Zt7RXRhU1jLHWIxmM11rujQFK3ed6MJ3dRj0BA6Biv8PcTezVGFkXQjBm2 qUfGgrGRNR9IiOMqmISVHy2WeNugHOw2XO3a6VQUT9Oc1X5a/gG4g5IB/5FW/uWBphpC ucPoade8JSZe/9MlqtYK3KV0+qtJNeYlWZaOjHVHJL1YwCrTQfzHpYQizpK8wpGNUOX8 bv9g== X-Gm-Message-State: ALKqPwfwBTxhVuQZZHtoVkoE1j0Etooz/BDll9r7NP5K0oi9ElaYssux LRm2JhTMfJeYLFe9Nea+qAANhVCYlnE= X-Received: by 2002:a1c:9c2:: with SMTP id 185-v6mr9033332wmj.53.1527518435737; Mon, 28 May 2018 07:40:35 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:3995:5470:200:1aff:fe1b:b328]) by smtp.gmail.com with ESMTPSA id y18-v6sm4177938wrl.53.2018.05.28.07.40.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 May 2018 07:40:35 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Mon, 28 May 2018 16:40:23 +0200 Message-Id: <20180528144024.10809-5-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528144024.10809-1-ard.biesheuvel@linaro.org> References: <20180528144024.10809-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v3 4/5] MdeModulePkg/DxeCorePerformanceLib: use AllocatePeiAccessiblePages X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 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 Reviewed-by: Laszlo Ersek --- MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c | 48 +++----------------- 1 file changed, 7 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: Star Zeng Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c index 71d624fc9ce9..68b29ac5a9e2 100644 --- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c @@ -165,46 +165,6 @@ IsKnownID ( } } -/** - 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,13 @@ 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) + ); + if (mAcpiBootPerformanceTable != NULL) { + ZeroMem (mAcpiBootPerformanceTable, BootPerformanceDataSize); + } } DEBUG ((DEBUG_INFO, "DxeCorePerformanceLib: ACPI Boot Performance Table address = 0x%x\n", mAcpiBootPerformanceTable)); From patchwork Mon May 28 14:40:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 137086 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp2909111lji; Mon, 28 May 2018 07:40:50 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL8hipV54bV/u76xAiHtp+MiV62bzQGeuvPuPdSWJsfwmbk26IvajuxPGin4KLGw0ocn+T0 X-Received: by 2002:a63:778b:: with SMTP id s133-v6mr4752317pgc.400.1527518450446; Mon, 28 May 2018 07:40:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527518450; cv=none; d=google.com; s=arc-20160816; b=QANb1k9yJjizXQ4PcfPTuZNBldgaEM8iA6MxHodZVp8gFGZz9Atuhm7yDV5CBysuC5 rpNZXszpmHIARq3trAIeBzaw1VdoCYE0RqQiqydFxp1zh4yWIhM0wjCod+r7wv4zLAqB WfG8nUsVCkEkvxmgT0EvUVjgrcdhQPZ3H6Pcp4kvAAFi9CTaZadRJThCfUEG7+5TFCbe BkhOUuxoXffSnCA653HHSTpU1MSBps4ySzCFDsIzM0mgSrrWPjhkq1mVO8sDAV6qO+EG rKGWWj+sNtc6WQL/cSSbXrtP5/wn9kbATYnDDaIFjnc1KbY/uofCx+gaqc8cqdSIzCDL CU2g== 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=7nFY9gnPiY8Cm4X7Vd7J6YlrSN439IjFRzxhz1Iimco=; b=fximQB4Q6wTVR4Jg6738Tmvd1ShdDxvJNtIWcoo8Np+wltBpVPdlZEeD3/s0LXHPkA Dv19VrwqOaU1N6e7oIA05peVyHqIjenl0StJAl8iHyXMk0SInp9yqdOyRa/VE5f+d+4D drNRfnpp48OIR8HXJsaCpt2gAsI9IGJ1t2s46MQLgLQTL8o3xEQx7NNE1vILRCqf4Wsx 6LJtGQ18JHuGe8SqQbVZrbBkW2FKA2JpE9dJow1cX0mhy0NtsZxu7NwOm+9f1o+yBKpX OCoSh4cxuaml3ByJA0GUicKTTKp6rEZwRd0hQ82cSxM+XFx3eWzBwhJCKPjempCKEE2f uVbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=UWNNWgtq; 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 x14-v6si29529501pfn.41.2018.05.28.07.40.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 May 2018 07:40:50 -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=UWNNWgtq; 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 EB26820348603; Mon, 28 May 2018 07:40:41 -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 C285020977877 for ; Mon, 28 May 2018 07:40:38 -0700 (PDT) Received: by mail-wm0-x243.google.com with SMTP id f8-v6so32749703wmc.4 for ; Mon, 28 May 2018 07:40:38 -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=2mfqJqNMucuBxDg42ENRB7P/wgjoANgMFzPCFg5NVWA=; b=UWNNWgtqHDt7SC7mjPnlsiVlbPw3qXBtCxG3eGcUncwjZUloUpK/J2JLMbcI4ba7FU oKwrBUCKwNhtU0H4hauSmB6P20vfa+z/BPlh5tOsIoArmSD79eMKRHbadbhMkBNDoQfe FxxltARrK3xjxb87dvUtumwHRhAsDLoQv53Jk= 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=2mfqJqNMucuBxDg42ENRB7P/wgjoANgMFzPCFg5NVWA=; b=oqPcLZzhtcecwBtG5drzU166hcsT45tycLWz2GaMtvIqGgc2FVFRPBAsW/11c6LeMc 9tIaLMF/a+49Qelt4IH3Rz/IrL3cV+o95eYjQZenDcfqTc+P3GZCldaJTFOIz4PlV5y4 w7hs9k+Wn9lfDTTRKbjldIKA1Dt7z6l/rOSXIQzDyiC7E3BHT5ye5s01DH4JWKJnvJn5 w2TEyZhQlX0VCAMSo48G35FNa4dxxWvhG/3DKET/Roqo0InVWuz3T5Eg5gCU54ZvEAeN 1FqYfrY57XLIHSLWhfZwPrbxv19i88cAZH3wM2UVXDaYB4zwSjCDBd67t/ZTBTPWjM06 reXQ== X-Gm-Message-State: ALKqPwez8Q5npDYWPU1tT7SevpkJ8CDQVYTZ0InL8zv0Jkp0pZAzwxvq doCJtaaERn4ZpRoAIk1achdUVCNmzfw= X-Received: by 2002:a1c:e906:: with SMTP id q6-v6mr8708808wmc.23.1527518437126; Mon, 28 May 2018 07:40:37 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:3995:5470:200:1aff:fe1b:b328]) by smtp.gmail.com with ESMTPSA id y18-v6sm4177938wrl.53.2018.05.28.07.40.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 May 2018 07:40:36 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Mon, 28 May 2018 16:40:24 +0200 Message-Id: <20180528144024.10809-6-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528144024.10809-1-ard.biesheuvel@linaro.org> References: <20180528144024.10809-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH v3 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: Ard Biesheuvel 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 Reviewed-by: Laszlo Ersek --- 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: Star Zeng Signed-off-by: Ard Biesheuvel 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