From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-x22a.google.com (mail-lf0-x22a.google.com [IPv6:2a00:1450:4010:c07::22a]) (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 8F9E42008092B for ; Wed, 5 Apr 2017 06:53:27 -0700 (PDT) Received: by mail-lf0-x22a.google.com with SMTP id x137so8882060lff.3 for ; Wed, 05 Apr 2017 06:53:27 -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=jijuZiNoqhhnoqhU7ruhfEikQnaE0CePv0hHQW5Ht1o=; b=IKV3CqVOjyzYqiisxARieu/uWqrIKFJLXDJToH8Eeqp0PKxYFfxuVUGwlQPMIsNd1O v4wTJ62g9XxKrw3A22r/Dtulxyhn9mL1Y/DGlVDAu1jygtF+R0oTH3NYEB+BfW6FQm0G 8P0IL6WA2sDqNvL9AZpoUV88zsf0t89ULuHnI= 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=jijuZiNoqhhnoqhU7ruhfEikQnaE0CePv0hHQW5Ht1o=; b=ulDTJzRbhAWReNXpSoavA6s5j2wRlSoKS7+vbOAzmfc3QcBDraacKxysEzJtFGk/t1 4TAgneDmf8t/PlIaW/BCWtWKb0zUOGJ/Dzh1b/a6pYOK88bddKAnraP7zVzqn0DyZapt c98LoZFLCbRx1VVDzUOjpaE3+hCfRklTQmWr5NLFTA1xBdOL4GlqMNIwtSXnXCWn4ShZ oJHncds8FoyqAEuy4fXUP1P3h6GPepxn2FkB9cbOmFJRDiG0xi18ouOXmf9Oci9UDeGd PPBZpu3zvjVwlIT796l43xH/PKE28k01sWYf/zpJEbTN7bbgugK8Noshu170NhQsSe67 AisA== X-Gm-Message-State: AFeK/H1hswZfl/vCJCB+xmnmdGt7Q6YgmgQ/+OiyvohRFG8bW5z8ZRw9 f9XNaEnlNFeAXGL4 X-Received: by 10.28.148.143 with SMTP id w137mr19308786wmd.72.1491400405881; Wed, 05 Apr 2017 06:53:25 -0700 (PDT) Received: from localhost.localdomain ([160.163.145.113]) by smtp.gmail.com with ESMTPSA id y29sm18881023wmh.3.2017.04.05.06.53.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Apr 2017 06:53:25 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Cc: leif.lindholm@linaro.org, ryan.harkin@linaro.org, Ard Biesheuvel Date: Wed, 5 Apr 2017 14:53:06 +0100 Message-Id: <20170405135311.26798-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170405135311.26798-1-ard.biesheuvel@linaro.org> References: <20170405135311.26798-1-ard.biesheuvel@linaro.org> Subject: [PATCH v4 1/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: , X-List-Received-Date: Wed, 05 Apr 2017 13:53:28 -0000 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 Reviewed-by: Leif Lindholm --- ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.inf | 1 - ArmPlatformPkg/Library/ArmShellCmdRunAxf/RunAxf.c | 58 +++++++++++++++++++- 2 files changed, 57 insertions(+), 2 deletions(-) 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 -- 2.9.3