diff --git a/ArmPkg/Include/Library/BdsLib.h b/ArmPkg/Include/Library/BdsLib.h index 68dbfd57f2..eb7f8f293f 100644 --- a/ArmPkg/Include/Library/BdsLib.h +++ b/ArmPkg/Include/Library/BdsLib.h @@ -1,6 +1,6 @@ /** @file * -* Copyright (c) 2013, ARM Limited. All rights reserved. +* Copyright (c) 2013-2015, ARM Limited. All rights reserved. * * This program and the accompanying materials * are licensed and made available under the terms and conditions of the BSD License @@ -221,4 +221,12 @@ BdsLoadImage ( OUT UINTN *FileSize ); +/** + * Call BS.ExitBootServices with the appropriate Memory Map information + */ +EFI_STATUS +ShutdownUefiBootServices ( + VOID + ); + #endif diff --git a/ArmPkg/Library/BdsLib/BdsInternal.h b/ArmPkg/Library/BdsLib/BdsInternal.h index a29d8ccd8b..1fab2aed4a 100644 --- a/ArmPkg/Library/BdsLib/BdsInternal.h +++ b/ArmPkg/Library/BdsLib/BdsInternal.h @@ -103,11 +103,6 @@ typedef struct { } BDS_TFTP_CONTEXT; // BdsHelper.c -EFI_STATUS -ShutdownUefiBootServices ( - VOID - ); - EFI_STATUS GetSystemMemoryResources ( LIST_ENTRY *ResourceList diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.inf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.inf index 01d9f5002b..da14fc2b15 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.inf +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmFvpDxe.inf @@ -44,6 +44,7 @@ ArmLib ArmPlatformLib BaseMemoryLib + DxeServicesTableLib MemoryAllocationLib UefiDriverEntryPoint UefiBootServicesTableLib diff --git a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmHwDxe.inf b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmHwDxe.inf index 952d624b45..1a007627ad 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmHwDxe.inf +++ b/ArmPlatformPkg/ArmVExpressPkg/ArmVExpressDxe/ArmHwDxe.inf @@ -32,6 +32,7 @@ [LibraryClasses] ArmShellCmdRunAxfLib + DxeServicesTableLib MemoryAllocationLib UefiDriverEntryPoint diff --git a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.inf b/ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.inf index 7d15f69346..9a34f66661 100644 --- a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.inf +++ b/ArmPlatformPkg/Library/ArmShellCmdRunAxf/ArmShellCmdRunAxf.inf @@ -43,6 +43,7 @@ [LibraryClasses] ArmLib BaseLib + BdsLib DebugLib HiiLib ShellLib diff --git a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/RunAxf.c b/ArmPlatformPkg/Library/ArmShellCmdRunAxf/RunAxf.c index e8576afa75..2abfb6cc10 100644 --- a/ArmPlatformPkg/Library/ArmShellCmdRunAxf/RunAxf.c +++ b/ArmPlatformPkg/Library/ArmShellCmdRunAxf/RunAxf.c @@ -15,11 +15,13 @@ **/ #include + #include #include #include #include #include +#include #include #include @@ -34,64 +36,6 @@ 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 PreparePlatformHardware (