From patchwork Wed Mar 29 13:48:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 96193 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp2208527qgd; Wed, 29 Mar 2017 06:48:54 -0700 (PDT) X-Received: by 10.99.39.194 with SMTP id n185mr652244pgn.24.1490795334579; Wed, 29 Mar 2017 06:48:54 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id y13si5455352pfi.252.2017.03.29.06.48.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Mar 2017 06:48:54 -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; 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 E73982041D9F1; Wed, 29 Mar 2017 06:48:52 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-wr0-x22e.google.com (mail-wr0-x22e.google.com [IPv6:2a00:1450:400c:c0c::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 930D02041D9DF for ; Wed, 29 Mar 2017 06:48:50 -0700 (PDT) Received: by mail-wr0-x22e.google.com with SMTP id w43so16328921wrb.0 for ; Wed, 29 Mar 2017 06:48:50 -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=oci815GXPAFGsT4XnGr5teSS2muXRJzcPg9KzeY3gtk=; b=AzKqvlzz5hPvW8MbxnDGmGZSo7CwTrayaFmhh/qbK230IJrXZYEX4QlVS87bLWhra4 /YDiC1nroxPQFXOcmY8/yo7tDxXqIHKkbZnVaYYIrGArOyD62pnaJM3PfVWwtFSPeGNB 8qx46hCQaHXIcD6qjmHIS8ls7MZwdiwbqIJtM= 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=oci815GXPAFGsT4XnGr5teSS2muXRJzcPg9KzeY3gtk=; b=BjuOyT6/r/gy/CUPbr8hD5NOnCsycJXZQkMyIPQ4wl93OCAocOU7rTUG117PTfG5oP 69NtxmpbXY0uadnDeS6+K0NWJELi2K0ZQ/+tc63RQYRaSDp52Zq/KzhWcl1MFcuKetpk cxLBjf8ltaOnHpM06P9DpZxiu7JlfrYKl3mHBzmZ0a6ewNrRZj5vwCcoLVxI16cYUea5 8DHUitCNIuKq+TeN3Q+aHjsrVy9e0U0fCVHmWUjrY8kzW9xDDRbsmiCUyPHgO6bckMIT z3eGX3wrMjZuwtbGW3kSbcWP6HMh+6asqQ5M+KTLq26X1mf2k5jCk0BhZ8gm6YRdJafg WNqw== X-Gm-Message-State: AFeK/H3uedCeTFKuQnybAl7d5wKCDofTTbfEaxItWZ+SX/MI+tEYvZ8iWC763dqU0pfyzWpj X-Received: by 10.28.136.204 with SMTP id k195mr817798wmd.99.1490795329231; Wed, 29 Mar 2017 06:48:49 -0700 (PDT) Received: from localhost.localdomain ([196.81.160.3]) by smtp.gmail.com with ESMTPSA id h65sm9479406wrh.32.2017.03.29.06.48.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Mar 2017 06:48:48 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org Date: Wed, 29 Mar 2017 14:48:30 +0100 Message-Id: <20170329134833.12956-4-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170329134833.12956-1-ard.biesheuvel@linaro.org> References: <20170329134833.12956-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 3/6] ArmPlatformPkg/ArmShellCmdRunAxf: remove BdsLib dependency X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ryan.harkin@linaro.org, lersek@redhat.com, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Remove ArmShellCmdRunAxf's dependency on the deprecated BdsLib by cloning the ShutdownUefiBootServices() routine into a local source file; this is the only BdsLib feature 'runaxf' depends on. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.inf | 1 - ArmPlatformPkg/Library/ArmShellCmdRunAxf/RunAxf.c | 58 +++++++++++++++++++- 2 files changed, 57 insertions(+), 2 deletions(-) -- 2.9.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.inf b/ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.inf index 9a34f666612a..7d15f6934608 100644 --- a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.inf +++ b/ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.inf @@ -43,7 +43,6 @@ [Packages] [LibraryClasses] ArmLib BaseLib - BdsLib DebugLib HiiLib ShellLib diff --git a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/RunAxf.c b/ArmPlatformPkg/Library/ArmShellCmdRunAxf/RunAxf.c index 2abfb6cc1053..9f4fc780307d 100644 --- a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/RunAxf.c +++ b/ArmPlatformPkg/Library/ArmShellCmdRunAxf/RunAxf.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include @@ -35,6 +34,63 @@ typedef VOID (*ELF_ENTRYPOINT)(UINTN arg0, UINTN arg1, UINTN arg2, UINTN arg3); +STATIC +EFI_STATUS +ShutdownUefiBootServices ( + VOID + ) +{ + EFI_STATUS Status; + UINTN MemoryMapSize; + EFI_MEMORY_DESCRIPTOR *MemoryMap; + UINTN MapKey; + UINTN DescriptorSize; + UINT32 DescriptorVersion; + UINTN Pages; + + MemoryMap = NULL; + MemoryMapSize = 0; + Pages = 0; + + do { + Status = gBS->GetMemoryMap ( + &MemoryMapSize, + MemoryMap, + &MapKey, + &DescriptorSize, + &DescriptorVersion + ); + if (Status == EFI_BUFFER_TOO_SMALL) { + + Pages = EFI_SIZE_TO_PAGES (MemoryMapSize) + 1; + MemoryMap = AllocatePages (Pages); + + // + // Get System MemoryMap + // + Status = gBS->GetMemoryMap ( + &MemoryMapSize, + MemoryMap, + &MapKey, + &DescriptorSize, + &DescriptorVersion + ); + } + + // Don't do anything between the GetMemoryMap() and ExitBootServices() + if (!EFI_ERROR(Status)) { + Status = gBS->ExitBootServices (gImageHandle, MapKey); + if (EFI_ERROR(Status)) { + FreePages (MemoryMap, Pages); + MemoryMap = NULL; + MemoryMapSize = 0; + } + } + } while (EFI_ERROR(Status)); + + return Status; +} + STATIC EFI_STATUS