public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Laszlo Ersek" <lersek@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>,
	edk2-devel-groups-io <devel@edk2.groups.io>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>,
	Jordan Justen <jordan.l.justen@intel.com>,
	Per Sundstrom <per_sundstrom@yahoo.com>
Subject: Re: [PATCH 3/7] OvmfPkg/PlatformPei: use QemuFwCfgParseBool in UPDATE_BOOLEAN_PCD_FROM_...
Date: Tue, 28 Apr 2020 13:40:58 +0200	[thread overview]
Message-ID: <2c575cbd-c645-7491-cfd4-79e21347894a@redhat.com> (raw)
In-Reply-To: <07023f7c-3862-7e89-8739-68ce8731a8a9@redhat.com>

On 04/24/20 10:55, Philippe Mathieu-Daudé wrote:
> On 4/24/20 9:53 AM, Laszlo Ersek wrote:
>> The UPDATE_BOOLEAN_PCD_FROM_FW_CFG() macro currently calls the
>> module-private helper function GetNamedFwCfgBoolean(). Replace the latter
>> with QemuFwCfgParseBool() from QemuFwCfgSimpleParserLib.
>>
>> This change is compatible with valid strings accepted previously.
>>
>> Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
>> Cc: Jordan Justen <jordan.l.justen@intel.com>
>> Cc: Per Sundstrom <per_sundstrom@yahoo.com>
>> Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
>> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2681
>> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
>> ---
>>   OvmfPkg/PlatformPei/Platform.c | 47 +-------------------
>>   1 file changed, 2 insertions(+), 45 deletions(-)
>>
>> diff --git a/OvmfPkg/PlatformPei/Platform.c
>> b/OvmfPkg/PlatformPei/Platform.c
>> index 088e616a980c..3b850c2c2626 100644
>> --- a/OvmfPkg/PlatformPei/Platform.c
>> +++ b/OvmfPkg/PlatformPei/Platform.c
>> @@ -27,6 +27,7 @@
>>   #include <Library/PeiServicesLib.h>
>>   #include <Library/QemuFwCfgLib.h>
>>   #include <Library/QemuFwCfgS3Lib.h>
>> +#include <Library/QemuFwCfgSimpleParserLib.h>
>>   #include <Library/ResourcePublicationLib.h>
>>   #include <Ppi/MasterBootMode.h>
>>   #include <IndustryStandard/I440FxPiix4.h>
>> @@ -254,56 +255,12 @@ MemMapInitialization (
>>     ASSERT_RETURN_ERROR (PcdStatus);
>>   }
>>   -EFI_STATUS
>> -GetNamedFwCfgBoolean (
>> -  IN  CHAR8   *FwCfgFileName,
>> -  OUT BOOLEAN *Setting
>> -  )
>> -{
>> -  EFI_STATUS           Status;
>> -  FIRMWARE_CONFIG_ITEM FwCfgItem;
>> -  UINTN                FwCfgSize;
>> -  UINT8                Value[3];
>> -
>> -  Status = QemuFwCfgFindFile (FwCfgFileName, &FwCfgItem, &FwCfgSize);
>> -  if (EFI_ERROR (Status)) {
>> -    return Status;
>> -  }
>> -  if (FwCfgSize > sizeof Value) {
>> -    return EFI_BAD_BUFFER_SIZE;
>> -  }
>> -  QemuFwCfgSelectItem (FwCfgItem);
>> -  QemuFwCfgReadBytes (FwCfgSize, Value);
> 
> Until here QemuFwCfgGetAsString(), OK.
> 
>> -
>> -  if ((FwCfgSize == 1) ||
>> -      (FwCfgSize == 2 && Value[1] == '\n') ||
>> -      (FwCfgSize == 3 && Value[1] == '\r' && Value[2] == '\n')) {
> 
> StripNewline(), OK.
> 
>> -    switch (Value[0]) {
>> -      case '0':
>> -      case 'n':
>> -      case 'N':
>> -        *Setting = FALSE;
> 
> mFalseString[], OK.
> 
> (And we get disable[d] + false).
> 
>> -        return EFI_SUCCESS;
>> -
>> -      case '1':
>> -      case 'y':
>> -      case 'Y':
>> -        *Setting = TRUE;
> 
> mTrueString[], OK.
> 
> (And we get enable[d] + true).
> 
>> -        return EFI_SUCCESS;
>> -
>> -      default:
>> -        break;
>> -    }
>> -  }
>> -  return EFI_PROTOCOL_ERROR;
>> -}
>> -
>>   #define UPDATE_BOOLEAN_PCD_FROM_FW_CFG(TokenName)                   \
>>             do {                                                      \
>>               BOOLEAN       Setting;                                  \
>>               RETURN_STATUS PcdStatus;                                \
>>                                                                       \
>> -            if (!EFI_ERROR (GetNamedFwCfgBoolean (                  \
>> +            if (!RETURN_ERROR (QemuFwCfgParseBool (                 \
> 
> :)
> 
> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>

Thanks for the careful review! :)
Laszlo

> 
>>                                 "opt/ovmf/" #TokenName, &Setting))) { \
>>                 PcdStatus = PcdSetBoolS (TokenName, Setting);         \
>>                 ASSERT_RETURN_ERROR (PcdStatus);                      \
>>
> 


  reply	other threads:[~2020-04-28 11:41 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-24  7:53 [PATCH 0/7] OvmfPkg, ArmVirtPkg: control PXE v4/v6 boot support from the QEMU cmdline Laszlo Ersek
2020-04-24  7:53 ` [PATCH 1/7] OvmfPkg: introduce QemuFwCfgSimpleParserLib Laszlo Ersek
2020-04-24  9:13   ` Philippe Mathieu-Daudé
2020-04-28 11:47     ` Laszlo Ersek
2020-04-24  7:53 ` [PATCH 2/7] OvmfPkg/PlatformPei: parse "X-PciMmio64Mb" with QemuFwCfgSimpleParserLib Laszlo Ersek
2020-04-24  8:51   ` Philippe Mathieu-Daudé
2020-04-24  7:53 ` [PATCH 3/7] OvmfPkg/PlatformPei: use QemuFwCfgParseBool in UPDATE_BOOLEAN_PCD_FROM_ Laszlo Ersek
2020-04-24  8:55   ` Philippe Mathieu-Daudé
2020-04-28 11:40     ` Laszlo Ersek [this message]
2020-04-24  7:53 ` [PATCH 4/7] OvmfPkg/QemuFwCfgDxeLib: allow UEFI_DRIVER modules Laszlo Ersek
2020-04-28 12:48   ` Philippe Mathieu-Daudé
2020-04-24  7:53 ` [PATCH 5/7] OvmfPkg: control PXEv4 / PXEv6 boot support from the QEMU command line Laszlo Ersek
2020-04-28 12:45   ` Philippe Mathieu-Daudé
2020-04-24  7:53 ` [PATCH 6/7] ArmVirtPkg/QemuFwCfgLib: allow UEFI_DRIVER modules Laszlo Ersek
2020-04-28 12:48   ` Philippe Mathieu-Daudé
2020-04-24  7:53 ` [PATCH 7/7] ArmVirtPkg: control PXEv4 / PXEv6 boot support from the QEMU command line Laszlo Ersek
2020-04-28 12:47   ` Philippe Mathieu-Daudé
2020-04-24  9:00 ` [PATCH 0/7] OvmfPkg, ArmVirtPkg: control PXE v4/v6 boot support from the QEMU cmdline Ard Biesheuvel
2020-04-28 22:39 ` [edk2-devel] " Laszlo Ersek
2020-04-29  7:21   ` Philippe Mathieu-Daudé

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=2c575cbd-c645-7491-cfd4-79e21347894a@redhat.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