public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Leif Lindholm <leif.lindholm@linaro.org>
Cc: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	Ryan Harkin <ryan.harkin@linaro.org>
Subject: Re: [PATCH v3 1/6] ArmPlatformPkg/ArmShellCmdRunAxf: remove BdsLib dependency
Date: Wed, 5 Apr 2017 14:11:44 +0100	[thread overview]
Message-ID: <CAKv+Gu-zrQwkk7oP6sogwnQz8KjhqT2YmsX4Bvf2LRrw_MN=eg@mail.gmail.com> (raw)
In-Reply-To: <20170405130946.GC25239@bivouac.eciton.net>

On 5 April 2017 at 14:09, Leif Lindholm <leif.lindholm@linaro.org> wrote:
> On Tue, Apr 04, 2017 at 01:30:05PM +0100, Ard Biesheuvel wrote:
>> 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.
>
> I was going to go through these individually and give a R-b for the
> whole series at the end if I didn't come across anything, but I'd just
> like to add for this one:
>
> This is abslutely the right thing to do - BdsLib only had this
> functionality due to the LinuxLoader, and it could be deleted now (but
> I guess we're planning to get rid of the whole thing?).
>

I'd like to avoid doing any 'improvements' to BdsLib while it's on its
way you -- once AndroidFastBootApp is the last remaining user, we can
fold whatever it uses into it instead.


> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
>

Thanks

>>
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> ---
>>  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 <Library/DevicePathLib.h>
>>  #include <Library/BaseLib.h>
>>  #include <Library/BaseMemoryLib.h>
>> -#include <Library/BdsLib.h>
>>  #include <Library/MemoryAllocationLib.h>
>>  #include <Library/DebugLib.h>
>>
>> @@ -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
>>


  reply	other threads:[~2017-04-05 13:11 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-04 12:30 [PATCH v3 0/6] Juno cleanup -- EDK2 edition Ard Biesheuvel
2017-04-04 12:30 ` [PATCH v3 1/6] ArmPlatformPkg/ArmShellCmdRunAxf: remove BdsLib dependency Ard Biesheuvel
2017-04-05 13:09   ` Leif Lindholm
2017-04-05 13:11     ` Ard Biesheuvel [this message]
2017-04-05 13:15       ` Ard Biesheuvel
2017-04-05 14:56       ` Leif Lindholm
2017-04-04 12:30 ` [PATCH v3 2/6] ArmPlatformPkg/ArmJunoDxe: " Ard Biesheuvel
2017-04-05 13:19   ` Leif Lindholm
2017-04-04 12:30 ` [PATCH v3 3/6] ArmPlatformPkg/ArmJunoDxe: use the generic non-discoverable device support Ard Biesheuvel
2017-04-05 13:20   ` Leif Lindholm
2017-04-04 12:30 ` [PATCH v3 4/6] ArmPlatformPkg/ArmJunoDxe: don't register OnEndOfDxe event on rev R0 Ard Biesheuvel
2017-04-05 13:17   ` Leif Lindholm
2017-04-04 12:30 ` [PATCH v3 5/6] ArmPlatformPkg/ArmJunoPkg: remove PCI host bridge driver Ard Biesheuvel
2017-04-05 13:18   ` Leif Lindholm
2017-04-05 13:20     ` Ard Biesheuvel
2017-04-04 12:30 ` [PATCH v3 6/6] ArmPlatformPkg/ArmJunoDxe: simplify ACPI table installation Ard Biesheuvel
2017-04-05 13:19   ` Leif Lindholm
2017-04-04 15:47 ` [PATCH v3 0/6] Juno cleanup -- EDK2 edition Ryan Harkin
2017-04-04 15:48   ` Ryan Harkin
2017-04-04 15:49     ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKv+Gu-zrQwkk7oP6sogwnQz8KjhqT2YmsX4Bvf2LRrw_MN=eg@mail.gmail.com' \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox