From patchwork Tue May 22 14:08: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: 136548 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1682833lji; Tue, 22 May 2018 07:09:01 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrRJK8R0yalDWE76X8WQlWo1OHBqipe45FlbmawIeBcIWc32ciIlvFhflblqyOfmDLsNALR X-Received: by 2002:a63:734f:: with SMTP id d15-v6mr8207258pgn.149.1526998141401; Tue, 22 May 2018 07:09:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526998141; cv=none; d=google.com; s=arc-20160816; b=UciDIY1nKugZ3jwxNALevsbLAkJ4f8VNTs/ht07kzTRSxuNQU8R8qBv9eFTy313Wnh N7uDBPDrhoNaMkjtfSiDzWtQlr5iOI48o94x8VL4G3L17CNMVWME8YlebNYfavxB+XkG v84TV6+NZHdDy42jYYQewVajJxN/2ERrTM8OyOpA6sw0u3dAmqWiREw9m6Kf2WaK/K4n sEiaQ90zBqMbbfvDEjytORyW81gamvycYPg5co6i3nx1RDSMuNiwsotN8gEdfegc82i1 HqrU2dtKK6O8eGIyUqQMtHlnMpF0EdGNBctP6baoNs3GIB2oPtJ50Ryf0M4E63omFNPo bvAw== 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=/chJFNBHNiXhgTeSDSLlAKE/CfTf9/xSMU8TQS/CQEg=; b=HFm4R0/3wFuoH3dPZ7r/BklIXEnNYbS1TN9vE+SGrqn+y/Wq/aWazTNacD36u7x+P5 AtmK033txmNr6VllfoDN1K27JvP9AedKgkNx5Vl+Ocxn8ZdYA1bOe9rGuMwmcnrGf65H oBiTyWGhgCsnUmF8fUu0bRTeC6zUU/kstrGkj60SSDav72Nd8aBut3arN93TV+t9LJ8A wFR4suRV4Tjrewq7p8o94PmVdaToWXm9xFIqAkqpZ3kFFvJKszlHrVaRJpAKd1XK3vnC 053jat3c5Aif4DzU84Wfs+6V7Umhu2ju7edxQz7JcpKqKQnE7MJd8av/gPd1yNekNjs6 Gf4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=it8BVsvr; 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 j12-v6si12855801pgf.222.2018.05.22.07.09.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 07:09: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=it8BVsvr; 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 097BA203BA4EB; Tue, 22 May 2018 07:09:01 -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::233; helo=mail-wr0-x233.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x233.google.com (mail-wr0-x233.google.com [IPv6:2a00:1450:400c:c0c::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id AC4E3203B992C for ; Tue, 22 May 2018 07:08:59 -0700 (PDT) Received: by mail-wr0-x233.google.com with SMTP id i14-v6so20473386wre.2 for ; Tue, 22 May 2018 07:08:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ushk7N92icX3jm01x7NKo2+E8evrRWmoMV8mc3LM30s=; b=it8BVsvr1ujKkVP5Qvo5E2GBQ+pao0NWC58vBOKDkW326Cut5qCyezvXu2lLB5M4VG xq3Ccf804onUbv5Vvv8UBpv24v3QrpM8+75Ex3jgd90O54dJuO3JkwbWgx7y4lSTm/Js E0ZethJ912i3p38jEQwG7D0+Ys2esD65zeNVg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ushk7N92icX3jm01x7NKo2+E8evrRWmoMV8mc3LM30s=; b=F3JK+IhIiM0lb2uux1Seps2dEvfD03TwI2JAQqyeqDw8b5vswddQSc8Wu+Ibwifl26 k1gHULM2LniMOrF3zMh75tw/xPWjGBZVXRokCDUaN2rUlJalKOplNbvQn2KRn9zHFFGp h9J2c4f/G6/tw2aKgU9slfC8Hk6cka9fu1u5Vjy5zosmhA6YV98eoRupr+AutJvX9Y/g mQqj0WpfsUqWOb2N0upf6A0Cx+sSZLtYiisEf/59J6Juwxef3vHJqRSOGmN8TEaG7K2a O1+jUaXbJZH0eSoIsRZavPTGQMwbd+qMPDfZ2bnR/GLzYOSSgZL5yS6Srw+U7MHhwcjH sY+A== X-Gm-Message-State: ALKqPwfm8803q0e8JDfPDIOnxNy8q8/XdyQN4u661NKFG/EVOZlQ1hPA qudipk6aHt/8nubYaqZK6sWbQEUeNSk= X-Received: by 2002:adf:88e8:: with SMTP id g37-v6mr17362725wrg.62.1526998137983; Tue, 22 May 2018 07:08:57 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:3995:5470:200:1aff:fe1b:b328]) by smtp.gmail.com with ESMTPSA id r6-v6sm17755545wrg.73.2018.05.22.07.08.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 07:08:57 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Tue, 22 May 2018 16:08:45 +0200 Message-Id: <20180522140850.30369-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180522140850.30369-1-ard.biesheuvel@linaro.org> References: <20180522140850.30369-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 1/6] OvmfPkg/PlatformBootManagerLib: add missing report status code call X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Dong , Ard Biesheuvel , Liming Gao , Dandan Bi , Leif Lindholm , Michael D Kinney , Laszlo Ersek , Star Zeng MIME-Version: 1.0 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 --- 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 Reviewed-by: Laszlo Ersek 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 Tue May 22 14:08:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 136549 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1682913lji; Tue, 22 May 2018 07:09:05 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpR1j2DtDY8fXTJ52vPHPHxOkZN7tn2dD4JoE1x6pF4zzMXXNlx36CFh66d7LID5Dq5uhk2 X-Received: by 2002:a17:902:5a88:: with SMTP id r8-v6mr17146338pli.78.1526998145190; Tue, 22 May 2018 07:09:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526998145; cv=none; d=google.com; s=arc-20160816; b=QX6i4fLwfcwTYb4Mb1U+FG55aWOPZWPk+XGuhokbWy8IK0bKhX0owtYlJxhitU8DXb t0iQuGwFv1RRJlbRRZdJuu4svQRneW2Ylfm2oKHo2iPp27YLJcilCklY3d8zbk/U6hPb cbTpO/2xzelBEj95cNUEy0Pk0744TFP+v9Mmn2mKk7SI5pke7eulSHw0+Iitq8tLlfAD T1hdM58MrNMtFjbTO8rjh0WtySrk4wFooj58fZa2aB9yKG8HzV+ZXaFdSCMPvXGUcNP1 KzxSECQpWkl8sbEpPQIKuvhYJ3MxkN+If6lsRcHcZZsIBHAqeN9MNgFT30k1OM6pD4FB i5sg== 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=z2kHimSS/4Mw/po8WLZemifHj9S3MhCM/Qu9V3Ji8n8=; b=IQyEymXly8RSIAwy2ZPW5FQ72SXmt44J9COpfmwNfszvYo4/0YJjctinEqm8DvkFcC sIzd9CQfbm6EoS8f6bqzRUExgAEBxa75QdohoT2GPK1qMrbI4ZosrzgH79amlifqn+Pv hvSL6jWrv1u1dkcsqi5cuSAiswbkyUa0xmYbhvv0GrgiNQo71F7Xf2qcMTxJVZKlvdNr ll4RURfA3CRx4Eyo7jbb/eCcOHnhPnEdoaLMsUNw5gB/z3CFTr3h3ZzaWiDoUHGancal IfCe6/8WoStjDtrOaqlYsMZpZhDvVF+lRESGlgEIDPBLydnK/cIHITKAdcS4vLtj87l5 TA6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=hMasWY9i; 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 q11-v6si16121023pll.15.2018.05.22.07.09.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 07:09:05 -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=hMasWY9i; 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 35C62203BA4E2; Tue, 22 May 2018 07:09:04 -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 D6131203B992C for ; Tue, 22 May 2018 07:09:02 -0700 (PDT) Received: by mail-wm0-x236.google.com with SMTP id j5-v6so85562wme.5 for ; Tue, 22 May 2018 07:09:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Z3jDPMon68EBAQk3Xxxlb6MZD02G7CN6D6MQ9V4ylFg=; b=hMasWY9i1y7hHO08+Ewxqhk2JEgLbBWO+qO6gSrAh0GSpWpG3j3aOxsa1AaDocTBqY O2xE9lTNMzOjtrHufF+IqK8Q+CG8FecMs+rNgC3iUH626a46Ic8u1uILUj/693z5fSw0 EMn9xJgOq3X6zH/dJPcuhAiT8MmIGJgZFPTas= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Z3jDPMon68EBAQk3Xxxlb6MZD02G7CN6D6MQ9V4ylFg=; b=cp3869NB2nRtzRYicNA7QLreRVbLfGYOWeP9gBVfnaH2NWbEEimrzY5PPP/TB7k9XD zhH3EHdHNm9xbguCYwXMmlG/N/RKpT+St7WsS2nBb05wiRqkCjfYb2vr6cgQU+y3cO31 TW8GHnf7KwYmJVW4ZwB5WHYcYbeO7+tP6xSNcZaN9y6jAAW5fX20m3JHlP1limJXFElH 0cSxZpOI2r89Ap4vOmk7H+QVtedigVxCC2dg7S2nqPlyArgwFpiXHK+gpzouaFvChosX 46YSJu9FEZqswEdTkujEog9AFOdSVeDKPi7ZMNvimX4xFSxEbdORVApY/fxgP1oaTZYz u/pQ== X-Gm-Message-State: ALKqPwft0U7Z364BWqn+EeeQj2ufKFIVtWiYnShcS7DTfuMsdPiuTPl6 1qeFN+7j3yw/tNLY6b9gMjYQMGAWGCo= X-Received: by 2002:a1c:da13:: with SMTP id r19-v6mr1492007wmg.2.1526998140375; Tue, 22 May 2018 07:09:00 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:3995:5470:200:1aff:fe1b:b328]) by smtp.gmail.com with ESMTPSA id r6-v6sm17755545wrg.73.2018.05.22.07.08.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 07:08:59 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Tue, 22 May 2018 16:08:46 +0200 Message-Id: <20180522140850.30369-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180522140850.30369-1-ard.biesheuvel@linaro.org> References: <20180522140850.30369-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 2/6] ArmVirtPkg/PlatformBootManagerLib: add missing report status code call X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Dong , Ard Biesheuvel , Liming Gao , Dandan Bi , Leif Lindholm , Michael D Kinney , Laszlo Ersek , Star Zeng MIME-Version: 1.0 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 --- 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 Reviewed-by: Laszlo Ersek 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 Tue May 22 14:08:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 136550 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1682984lji; Tue, 22 May 2018 07:09:08 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrYYNcZYzY7PU8YXbVVe9FdzYAlB+olFRFsPQum88JSEhd5pJFE568h6PzZkmIvzzvGYJHu X-Received: by 2002:a62:5050:: with SMTP id e77-v6mr24716471pfb.16.1526998148438; Tue, 22 May 2018 07:09:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526998148; cv=none; d=google.com; s=arc-20160816; b=FWbLLAjKZWcbnO3M2h6cDtS5N9YtwRIIC2NbOWtczgNr8VLTzVnj7xJUa17l4oorrI 7nCzHZ55iMHlPgs4s+NY9gHH2Y1LS8OKntdZDyMnNxtZhF7yIduIs0pV5Q+OPmHIpEpA mMkdUzNLy1mqA0T6m/KlKxbEbyYIf3Pu58XsMfjllxns2ykLhjFlJa9EMmNKW3QRw55x UC6wBVziOo+MhECYc8V7lK4mNH8XGShW44WK1lWDcwJlt+yTnR+hNP3piyAYn3SVgIUw YF8vjUoEaYxDYb6+O+YyqDebkZzaT1ZXyZBPfLb+F8ZQpyOsv9cyxAjwvsAbKK6f/Djl frqA== 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=RvG/adXqwn3PcoGd1t2P2vEKOuAWU89ayKP0ytV4fHs=; b=K5njUm2hkZkN0KGgg+KSStDi5EX5sjxml/cAIqHW4Wuc3gzTa+3ciNqsVvw3unV9S9 ymhm9PBx3G4BYZmkPnT+O7tTgnUpz9kmi9drnnRhgqdROEqWKFesFQzRPFhT8NeQnX4r LXvWnl5IpAgUSQU/uaIMRB/N2B/Ikhlqg3KD/mcCeUtP2hq5r6emU5OgjxZGWW2As2op GrVmBRtrWqeoE33Z8UX/WOJVj3F9Gw42SdV+j01ZCekHDNlG3flEv8tT7eGQqGC6u7Cn 0NjzrhhCPZHLCLunp4xLOnsBFnVF9ovQxi/CxZ4GKLc5JiSD3ec2U2DPl+Jokzu2OFJO B52w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=djJvkh3Q; 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 n22-v6si16605946pfb.126.2018.05.22.07.09.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 07:09: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=djJvkh3Q; 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 63F95203BB520; Tue, 22 May 2018 07:09:06 -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::235; helo=mail-wm0-x235.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x235.google.com (mail-wm0-x235.google.com [IPv6:2a00:1450:400c:c09::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9CF8B203B992C for ; Tue, 22 May 2018 07:09:04 -0700 (PDT) Received: by mail-wm0-x235.google.com with SMTP id a67-v6so133274wmf.3 for ; Tue, 22 May 2018 07:09:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LHlwcmVHos8NZgj2kGrntQDGOb8hzisISq9LYld3ZUU=; b=djJvkh3QOuxwTexaH9J75kuD599gt+IXxy1LJFrMjyrUpy7dNp9xJt76FsUeG28eut VKdZMJiEiUKHJNiNTst5Tp8ird0+/jOuzqsCx1mYfu1o3JNRX0sNKEXHrivBfEVlx41Z YN+z1SYnV8Kj5FbDc8eOOv0EeXEUTOnn0op+0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LHlwcmVHos8NZgj2kGrntQDGOb8hzisISq9LYld3ZUU=; b=ZCcjjb6uhc4Ou5pLBH6okmzQG23b2h1otEQCLX2cSQ0UnMtyluXNYG43zUGwlfMHQQ aTSjJd+Zk64c/pGzlkDTbNwNVNyrf7pfxgwJ4M4staiN4ncO2AU4F/9f6Ak9JkRSVeVd GiJUy0/bru0E8MJZsbxkTr8bXHQi0O0isX3t1A9K9OL3gTnB4dMd+vVTUy/XaPFYujPv NqWg4unnFg1v4QuG3mH8aBt1MJeJF0vkbGDa3gc8X59VFzp014R6eQThGt5ptsdMMv3z esy7Pu52vQKVlTa8p9FjTzuxQv5BmuU+Aq6nWFMjVWirgAFVhnDGxxw/WohLQYbpiLcV a23A== X-Gm-Message-State: ALKqPwdOQEdBouP7XikdVdC3Cmc4b/nrib2a/epxlxVMjCGf9wqMxq4f DsLTqREmpKKuiaZ735UG7+TnE1vfJ+E= X-Received: by 2002:a1c:a84d:: with SMTP id r74-v6mr1458905wme.114.1526998142791; Tue, 22 May 2018 07:09:02 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:3995:5470:200:1aff:fe1b:b328]) by smtp.gmail.com with ESMTPSA id r6-v6sm17755545wrg.73.2018.05.22.07.09.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 07:09:02 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Tue, 22 May 2018 16:08:47 +0200 Message-Id: <20180522140850.30369-4-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180522140850.30369-1-ard.biesheuvel@linaro.org> References: <20180522140850.30369-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 3/6] MdePkg/UefiLib: introduce EfiAllocatePeiAccessiblePages routine X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Dong , Ard Biesheuvel , Liming Gao , Dandan Bi , Leif Lindholm , Michael D Kinney , Laszlo Ersek , Star Zeng MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Add a routine to UefiLib that abstracts the allocation of memory that should be accessible by PEI after a warm reboot. We will use it to replace open coded implementations that limit the address to < 4 GB, which may not be possible on non-Intel systems that have no 32-bit addressable memory at all. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- MdePkg/Include/Library/UefiLib.h | 23 ++++++++++ MdePkg/Library/UefiLib/UefiLib.c | 48 ++++++++++++++++++++ 2 files changed, 71 insertions(+) -- 2.17.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/MdePkg/Include/Library/UefiLib.h b/MdePkg/Include/Library/UefiLib.h index 256498e3fd8d..8fa077af41e0 100644 --- a/MdePkg/Include/Library/UefiLib.h +++ b/MdePkg/Include/Library/UefiLib.h @@ -1520,4 +1520,27 @@ EfiLocateProtocolBuffer ( OUT UINTN *NoProtocols, OUT VOID ***Buffer ); + +/** + Allocates one or more 4KB pages of a given type from a memory region 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 +EfiAllocatePeiAccessiblePages ( + IN EFI_MEMORY_TYPE MemoryType, + IN UINTN Pages + ); + #endif diff --git a/MdePkg/Library/UefiLib/UefiLib.c b/MdePkg/Library/UefiLib/UefiLib.c index ba449a1c34ce..3a9d75149dd7 100644 --- a/MdePkg/Library/UefiLib/UefiLib.c +++ b/MdePkg/Library/UefiLib/UefiLib.c @@ -1715,3 +1715,51 @@ EfiLocateProtocolBuffer ( return EFI_SUCCESS; } + +/** + 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 +EfiAllocatePeiAccessiblePages ( + IN EFI_MEMORY_TYPE MemoryType, + IN UINTN Pages + ) +{ + EFI_STATUS Status; + EFI_PHYSICAL_ADDRESS Memory; + EFI_ALLOCATE_TYPE AllocType; + + if (Pages == 0) { + return NULL; + } + +#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 allocate below 4 GB to ensure that the allocation + // is accessible by PEI. + // + AllocType = AllocateMaxAddress; + Memory = MAX_UINT32; +#else + AllocType = AllocateAnyPages; +#endif + Status = gBS->AllocatePages (AllocType, MemoryType, Pages, &Memory); + if (EFI_ERROR (Status)) { + return NULL; + } + return (VOID *)(UINTN)Memory; +} From patchwork Tue May 22 14:08:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 136551 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1683046lji; Tue, 22 May 2018 07:09:11 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr4gk1p473TcmrYl2orAjKZ0F/kIlYumdZ0l8D+vp0yendBQGyyDgq9eLQfOFna+MVq11Bm X-Received: by 2002:a17:902:14cb:: with SMTP id y11-v6mr24471866plg.229.1526998151617; Tue, 22 May 2018 07:09:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526998151; cv=none; d=google.com; s=arc-20160816; b=oXkGVcX0PeQmH4Rx+q2o8rBTNokNzgd4GRHkj6MtFU3jDhRJDMYdC5Y5UWZyhZhp4/ hdfa2VEvROLC+Sxy8Jc7TA0wKlxET86jd1w5W4J1S26QHe6R8h+NRlNA1qorZQ5ySKSB 0sWUtkQw1FPNVlWpvKsdp0mLr9D7x7th2C5F+DcO0Q4fj+dfGiD7ajqiIW2PhEDUFHcF vzcaZfEf/aUFWCIlhgmsilHyl74WSxz4S4H85WIXpyq7arKOfhLxEkD2LFwOQzuqYTt6 qKKyHwdBJh9AZk1TFIy7YnMBckc5+/YQ0tyu610zAl1ezEPaIIzGaO42u+XshmszjgO9 AqeA== 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=kY5llQbt3MBmY07PWnRld/hnBmLkwZlQmSbXpsyPdOY=; b=UugNQmtyCtI7EIoqwq7CtNb8diEqSWa665BLQB9UVQD1pY+NiPpgMDbRqk0Cx2c1e8 W2uAzQYOCmv/5rpf6KNo8dttPaYrHLCGNh4Yg6zDeQ8ESyExNtABctLyMizwTdyFWrK9 psVNH4NeBxaRmkZxdiCQ36iFW9bvKfcKshHz1EgtKXnd+9+2zN0pV0MOsA4JG9FyWX5/ bcYuUCpgujx2hejjDuZxnSpBPEyg/fQ/pfICjV3dMCs9MC1ns77EuK+t1BMRtIQ20qv8 VT4/Yn6deqWBTATEmvJcygaxA10jnJelxyxPy2PybPb11wmt51j7NbnqpVg71XJWk+po vGeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=TCPKksGi; 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 a23-v6si16287378pls.571.2018.05.22.07.09.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 07:09:11 -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=TCPKksGi; 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 9A90C203BBB85; Tue, 22 May 2018 07:09:07 -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::242; helo=mail-wr0-x242.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x242.google.com (mail-wr0-x242.google.com [IPv6:2a00:1450:400c:c0c::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1860C203B992C for ; Tue, 22 May 2018 07:09:07 -0700 (PDT) Received: by mail-wr0-x242.google.com with SMTP id w3-v6so12746042wrl.12 for ; Tue, 22 May 2018 07:09:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZC5QBrtv23WgGxbJieOYq5dVBsba/B5Edhq//D6cVRM=; b=TCPKksGiS3LwTARl3LcoWay2uoy7XsC1x/dkanpFv/8MPnZs4tzQiq95V88TZS6cO1 Dr7upgx4Prit2YuSuT3lPh+FeA/wpQWAm6GZ0+dbWZzN4YM+ol3tEyh+jm3oasH3bfyJ yVvXVUAYdjPsX2wvIHecF4ZIguiSrzrR3u5b4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZC5QBrtv23WgGxbJieOYq5dVBsba/B5Edhq//D6cVRM=; b=D+qbkVaBdrj8ZXlQh4Gw78QBZFUwpyKtwzvrdkiUQtAvIBhonk5SRlEpJVWo/h5iNI N7ZQ71umGYRRnjlQ7r1DBxJlwU0GiEeKCtQOs/zfcW8EVedsG47sYvwGPIBAtqzr0311 XWnUt/MlWYijASwwUT4lGg7iV5WbnE3FNpOetU0opSxYAIAm7wNPFZtJDzkyaTKE3azM o9P1c88FeLaiUpmcxC0RKTFYyWgnEwkVuuwCHTdRnFRx9Iw0PKWsNeOI+/H9WYZ2G6Kg mY8LuulKqdTxsvEuW7+CWl7Xpmp98cMeVbGDF0vG+XZlMIqROrgijkczn3bMbqCNqdsv CAkQ== X-Gm-Message-State: ALKqPweB7il2z9RYhFTR/g/CyJMnzziYKgmI+IGeMB9ClmUfHo5jBVA7 GyBr7vrr5kFK3DM/EAcGVcL4TvH27S8= X-Received: by 2002:adf:9c01:: with SMTP id f1-v6mr18278525wrc.171.1526998145371; Tue, 22 May 2018 07:09:05 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:3995:5470:200:1aff:fe1b:b328]) by smtp.gmail.com with ESMTPSA id r6-v6sm17755545wrg.73.2018.05.22.07.09.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 07:09:04 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Tue, 22 May 2018 16:08:48 +0200 Message-Id: <20180522140850.30369-5-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180522140850.30369-1-ard.biesheuvel@linaro.org> References: <20180522140850.30369-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 4/6] IntelFrameworkPkg/FrameworkUefiLib: add EfiAllocatePeiAccessiblePages routine X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Dong , Ard Biesheuvel , Liming Gao , Dandan Bi , Leif Lindholm , Michael D Kinney , Laszlo Ersek , Star Zeng MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Add the newly introduced EfiAllocatePeiAccessiblePages() routine which allocates memory in a way that guarantees that PEI can access it after a warm reboot. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c | 48 ++++++++++++++++++++ 1 file changed, 48 insertions(+) -- 2.17.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c b/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c index 443a73917215..a488fe780b04 100644 --- a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c +++ b/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c @@ -1687,3 +1687,51 @@ EfiLocateProtocolBuffer ( return EFI_SUCCESS; } + +/** + 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 +EfiAllocatePeiAccessiblePages ( + IN EFI_MEMORY_TYPE MemoryType, + IN UINTN Pages + ) +{ + EFI_STATUS Status; + EFI_PHYSICAL_ADDRESS Memory; + EFI_ALLOCATE_TYPE AllocType; + + if (Pages == 0) { + return NULL; + } + +#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 allocate below 4 GB to ensure that the allocation + // is accessible by PEI. + // + AllocType = AllocateMaxAddress; + Memory = MAX_UINT32; +#else + AllocType = AllocateAnyPages; +#endif + Status = gBS->AllocatePages (AllocType, MemoryType, Pages, &Memory); + if (EFI_ERROR (Status)) { + return NULL; + } + return (VOID *)(UINTN)Memory; +} From patchwork Tue May 22 14:08:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 136552 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1683122lji; Tue, 22 May 2018 07:09:15 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpwlm8YFX+P7uRSkWp+kQPGoYLTZn3YBmZISEETVJ8K6TumyIDiM+qzNxcErQyDofO2mlT2 X-Received: by 2002:a17:902:6181:: with SMTP id u1-v6mr24521007plj.272.1526998155255; Tue, 22 May 2018 07:09:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526998155; cv=none; d=google.com; s=arc-20160816; b=Qc1V6HVWi9pKdLn+y7OqhBmvy/rQtUgg6Lryo9W+mt5zy7J8RvGOAvDUA6q9uvat3e ICajqsEhnEWVwwzG9Fqp7zXpJ107yIF6HdDwhvZ1092GN0M7219MgvzGu34pFKYHEDMs fvmB0/FxSmOGd4DyTBxYPPrvS10kb3qLrurAmLVyFM7R/7/xo9+t2Eon9sNPVuUu4COj H4DRbJtYKdeNzdv5OdxmswdgC7IFuTiGufMrWq46AJ2kUlC6IMWuj7HyJA5DoX3QFyPr zTryOVuiDJ1h+dowq5/LkuBAXEP6J98QqhhAeaiWEwiCVcGZprl0zDZlxmEnu9qMS9QT RrFw== 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=7PrGUR/Q8Mpjn5BI+HzTvRc/0EGleJp3RHsHwG/lSB0=; b=c2QfFTn94FQ/C5xDeN75QVE/NZSiKtkg5TFwnMpdIdO+QsNpd6chqkal+dykiMMjpF gxLQWSIFekjd9cyu/t5/xjy0ZgqHIhDiKdrIQHkvQOZX6Ad7ez4oQcbiJenf/SrjV98d 342n9H7JYhLWpmGWrt3oEdCicf9Gup9Mp8qZCNFFT4BWaDROWwcGHZxdVYJI86pnoYaQ O72ruHraxU3huVtlmsboZe095Jfv/o6+GiHoSGpzDbu4Pjhr3v4SniKxDZRKTEYSjZPk I1QUsV4rw2KI82ZKLpGSSQZp52Cw+O+pp2TJMsktzCIaURjh3m+cnYY23IL9xtr9eFij dGeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=A7JxjQFs; 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 t24-v6si16291357pfj.231.2018.05.22.07.09.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 07:09:15 -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=A7JxjQFs; 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 CBE35203BBB81; Tue, 22 May 2018 07:09:10 -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::243; helo=mail-wr0-x243.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x243.google.com (mail-wr0-x243.google.com [IPv6:2a00:1450:400c:c0c::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 310C1203BA517 for ; Tue, 22 May 2018 07:09:09 -0700 (PDT) Received: by mail-wr0-x243.google.com with SMTP id i12-v6so7289949wrc.4 for ; Tue, 22 May 2018 07:09:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qTkV/oPWWertT8HQ/H30NgTe8FFSj3CzCejtUi6pTds=; b=A7JxjQFszCvmLGll3UHVW+RU5LJx9zHfOXjD8hfNV91ysQffQyp+mfOTSS4wvjh1mn 2NOSWpjOnDXSst4dVU6Be7kQqQWX8phrbrzB0JMGVDroqDyWUHL/uhtY4S2rFnFeixsV xom0WNAALTZ2YvCdUACExPWDGYa5nmIyaYfag= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qTkV/oPWWertT8HQ/H30NgTe8FFSj3CzCejtUi6pTds=; b=cb+tCZXK+0Gp6/ntmor++pGCa4Dn8rNG/wemoHraPaHRKt7WSw8W1Jzthm6HvEg8HT kDjGQvq1YrX1fauQjVATzsfNR6Hawo9TZYWBoXYHq03UJhcarW9HvQCVsLyjqCysDClQ rGGCjkxcteETCoCoeNlKvYydIFeO3+ky+NJ4s/Z0g7tk9RRIEVsHky4CfSuMkAVQuPqs MGh7RQ4lIQpD6FTOeK3K8vs91uaMrI2Qfdbng3gYgF3gnoTRehykoodJ0eqD6J8Yyjto Yi1UE8GzZGpOOxo1XiQ18Y4geyBILhIEDfKMCZD4yZvjmxRvTOZz9iwccbbTtV7/9uS2 QtVg== X-Gm-Message-State: ALKqPwdiUwbniNC3HJp84HpOHd0c1I7+XJqw7U3QrOsX1MRwQ66S5tyn x5peUIZKW+9bIPFtV03nZqDMn0hFrgw= X-Received: by 2002:adf:9301:: with SMTP id 1-v6mr5015571wro.175.1526998147587; Tue, 22 May 2018 07:09:07 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:3995:5470:200:1aff:fe1b:b328]) by smtp.gmail.com with ESMTPSA id r6-v6sm17755545wrg.73.2018.05.22.07.09.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 07:09:07 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Tue, 22 May 2018 16:08:49 +0200 Message-Id: <20180522140850.30369-6-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180522140850.30369-1-ard.biesheuvel@linaro.org> References: <20180522140850.30369-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 5/6] MdeModulePkg/DxeCorePerformanceLib: use EfiAllocatePeiAccessiblePages X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Dong , Ard Biesheuvel , Liming Gao , Dandan Bi , Leif Lindholm , Michael D Kinney , Laszlo Ersek , Star Zeng MIME-Version: 1.0 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 EfiAllocatePeiAccessiblePages, which boils down to the same on X64, but does not crash non-X64 systems that lack memory below 4 GB. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c | 45 ++------------------ 1 file changed, 4 insertions(+), 41 deletions(-) -- 2.17.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c index 71d624fc9ce9..301ea4c32a78 100644 --- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c @@ -165,46 +165,6 @@ IsKnownID ( } } -/** - 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 *) EfiAllocatePeiAccessiblePages ( + EfiReservedMemoryType, + EFI_SIZE_TO_PAGES (BootPerformanceDataSize) + ); } DEBUG ((DEBUG_INFO, "DxeCorePerformanceLib: ACPI Boot Performance Table address = 0x%x\n", mAcpiBootPerformanceTable)); From patchwork Tue May 22 14:08:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 136553 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1683191lji; Tue, 22 May 2018 07:09:18 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqjnwa07tllVU/NfRpoZv1QI1fZ/awqnb91HyP8FJ6Dshy6VuggMsPlKk+HecCumKc8crfo X-Received: by 2002:a17:902:264:: with SMTP id 91-v6mr24740748plc.341.1526998158627; Tue, 22 May 2018 07:09:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526998158; cv=none; d=google.com; s=arc-20160816; b=yAF2cYwHwDg47be6SiQ3q9PR1VSZomxNd+FjF6qqLUt6gNyIfMGnN2LMxGKi7s+cFa rUzX40VJJjX8DJILqksUxt7fBct3u19AvImGl5JhbIJh/hTC2pRcpN/sKGe3RmpsXZdV EHDY5lTwZmAwI6LAITnxjlYrI4qawkEUp/5mUrgo55moCBCmrmWKaHmswrL9y7u3V+jD 7sYeNMJLG0V+29XPkUElq7EDnlg0TtcMcxhHUnT4fVLAtY5nFxPkKzcbOqEo0kRZpC2u hXhJnEwykblRTx5AYkiekj7Hghsm0zBd3bVnyEz+lgsn+SxMH9qoIh2K8DDanDGJ3bxE /rIQ== 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=QELOMD8TfreaLGHZaYVaA9bALPNNOvW2pLQ+CoFe/ZE=; b=ynM7Hxdcj5WlvKCnSPlSsiYx+U/qFjyQOewPVRIL6lGka9U+ZYpOmQnQREUe8kJESJ BPFGZEHF3dQyrgSRNnj5FPQ2g/NDgr3tPUN3gQhqY/LM3H+S+i8zf6+pc1a0pIJ6bBdn CBeysvZZLbSphfxVb3Pn9vaSFKVuLQhWWKFqcYHTeAXLac3oX5E/4U/zO/AYhegRUPys a5lSNGNB8dOhbtcwiLIkddTPxA893GwJRNB9Fb9Vi52yl3qdlvQ4R3swQyNmiEX9c+lC /Le7BNoGWNUI044ypWPOgpqaXcGu46iW5iVtlnSqG1ZXazqrdFUebR4xDmds4cWcv2L+ 9ZQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=NXNfigyk; 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 v5-v6si15585932pfe.63.2018.05.22.07.09.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 07:09:18 -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=NXNfigyk; 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 0384E203BBBA8; Tue, 22 May 2018 07:09:13 -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::243; helo=mail-wr0-x243.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x243.google.com (mail-wr0-x243.google.com [IPv6:2a00:1450:400c:c0c::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B2870203BBB9D for ; Tue, 22 May 2018 07:09:11 -0700 (PDT) Received: by mail-wr0-x243.google.com with SMTP id 94-v6so20443425wrf.5 for ; Tue, 22 May 2018 07:09:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=dJb7Uzr4P2g7MxLj0zkOrlo4J97LJz22TQl6IDozbG8=; b=NXNfigykrQClJ+euBUD4Myi97IaB8LfAFkwa9TqBolm3RaaWBi/9GYKEedufBL9gf9 hOPcERCEM3TCH8+d31fmiZET6hX/ALj7qF+IeePL3ey1X30KFNL/NQRELkKN0YHo6a/J 52V7baOmJ+aKhcWmR/UbZVZy/tt9/bVf6+nXQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dJb7Uzr4P2g7MxLj0zkOrlo4J97LJz22TQl6IDozbG8=; b=CR4wxfg+UMhp1K0MwCMgXkvBaSpbu5Xs6QX+ZS4cwhoczhvafPjJZEajdrbp0Rhcd6 dVfbhDgH2tEAYy5/+zXjILmtutvb7tLDCGnWeDSTM6w0fTv3ftowYbJdmERkfJBgn9HC 8K2MlX+0c26EAlSsufo8goAYxG7R2ixPGSs2R7QwDfJ/NuCq5enggFjtH+YtJUSS0U9V sLB0WY/mUi/2T/uyCIfhSlLZcmJqrFvqdJah6UpOGQYqrALrq12X/4QWjfoVxEbi7UAd 4xAK5ikZc0x9MHbWfi/e7JH0cTqr8TGGDCz62/rGckjNvzjsBjrtzQ5SuBLgXzMTMQeN UTrw== X-Gm-Message-State: ALKqPwcu8M5YhwIPhJBkJhp6dxh9CGDQ0U6FTo/H//+/mcF771XTYdGz dJRXftdzHRGfQ7pDxS8StDuWskiZfcg= X-Received: by 2002:adf:b852:: with SMTP id u18-v6mr1020633wrf.162.1526998149980; Tue, 22 May 2018 07:09:09 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:3995:5470:200:1aff:fe1b:b328]) by smtp.gmail.com with ESMTPSA id r6-v6sm17755545wrg.73.2018.05.22.07.09.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 07:09:09 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Tue, 22 May 2018 16:08:50 +0200 Message-Id: <20180522140850.30369-7-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180522140850.30369-1-ard.biesheuvel@linaro.org> References: <20180522140850.30369-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 6/6] MdeModulePkg/FirmwarePerformanceDataTableDxe: use EfiAllocatePeiAccessiblePages X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Dong , Ard Biesheuvel , Liming Gao , Dandan Bi , Leif Lindholm , Michael D Kinney , Laszlo Ersek , Star Zeng MIME-Version: 1.0 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 EfiAllocatePeiAccessiblePages, which boils down to the same on X64, but does not crash non-X64 systems that lack memory below 4 GB. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c | 50 ++++---------------- 1 file changed, 8 insertions(+), 42 deletions(-) -- 2.17.0 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c index e719e9e482cb..6663cbeac501 100644 --- a/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c +++ b/MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.c @@ -179,46 +179,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 +247,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 *) EfiAllocatePeiAccessiblePages ( + 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 +331,10 @@ InstallFirmwarePerformanceDataTable ( // // Fail to allocate at specified address, continue to allocate at any address. // - mAcpiBootPerformanceTable = (BOOT_PERFORMANCE_TABLE *) FpdtAllocateReservedMemoryBelow4G (BootPerformanceDataSize); + mAcpiBootPerformanceTable = (BOOT_PERFORMANCE_TABLE *) EfiAllocatePeiAccessiblePages ( + EfiReservedMemoryType, + EFI_SIZE_TO_PAGES (BootPerformanceDataSize) + ); } DEBUG ((DEBUG_INFO, "FPDT: ACPI Boot Performance Table address = 0x%x\n", mAcpiBootPerformanceTable)); if (mAcpiBootPerformanceTable == NULL) {