From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.61]) by mx.groups.io with SMTP id smtpd.web11.5652.1588074458422631697 for ; Tue, 28 Apr 2020 04:47:38 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OMWLeYhp; spf=pass (domain: redhat.com, ip: 205.139.110.61, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588074457; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8rVzzvDZxcrbxgT0YC0i6f7yNhKoI7hJfamn0x2r2XU=; b=OMWLeYhpcKRKYon2MEOtDGjTvgLxcO3tiOld8tba/8/zAW4Gn0PvY6LrC5m51Vqp/GlsHD mQbZ2HDPZU1FN0Qvq8J+2oC9ZsG2UOB/PGds+rCxU/OjXZQpzTtDRN5RXa6/HpW9IqWm7W u452ug7Qsmy0DrSVJsgR+jbP77nuuds= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-404-Xs5BeHGmM3yozrni7xiyfA-1; Tue, 28 Apr 2020 07:47:33 -0400 X-MC-Unique: Xs5BeHGmM3yozrni7xiyfA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B8271462; Tue, 28 Apr 2020 11:47:32 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-33.ams2.redhat.com [10.36.113.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3A7731002388; Tue, 28 Apr 2020 11:47:31 +0000 (UTC) Subject: Re: [PATCH 1/7] OvmfPkg: introduce QemuFwCfgSimpleParserLib To: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= , edk2-devel-groups-io Cc: Ard Biesheuvel , Jordan Justen , Per Sundstrom References: <20200424075353.8489-1-lersek@redhat.com> <20200424075353.8489-2-lersek@redhat.com> <3c85c28f-745a-a0eb-2fd6-7a3e73ec0694@redhat.com> From: "Laszlo Ersek" Message-ID: Date: Tue, 28 Apr 2020 13:47:30 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <3c85c28f-745a-a0eb-2fd6-7a3e73ec0694@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 04/24/20 11:13, Philippe Mathieu-Daud=C3=A9 wrote: > On 4/24/20 9:53 AM, Laszlo Ersek wrote: >> We already parse some boolean and integer values from named fw_cfg files >> (usually into PCDs), and we're going to cover more. Add a dedicated >> library for centralizing the parsing logic. >> >> Cc: Ard Biesheuvel >> Cc: Jordan Justen >> Cc: Per Sundstrom >> Cc: Philippe Mathieu-Daud=C3=A9 >> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2681 >> Signed-off-by: Laszlo Ersek >> --- >> =C2=A0 >> OvmfPkg/OvmfPkg.dec=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 >> |=C2=A0=C2=A0 4 + >> =C2=A0 >> OvmfPkg/OvmfPkgIa32.dsc=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 >> |=C2=A0=C2=A0 1 + >> =C2=A0 >> OvmfPkg/OvmfPkgIa32X64.dsc=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 >> |=C2=A0=C2=A0 1 + >> =C2=A0 >> OvmfPkg/OvmfPkgX64.dsc=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 >> |=C2=A0=C2=A0 1 + >> =C2=A0 >> OvmfPkg/Include/Library/QemuFwCfgSimpleParserLib.h=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 >> | 128 +++++++ >> =C2=A0 >> OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf >> |=C2=A0 27 ++ >> =C2=A0 >> OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParser.c=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 >> | 398 ++++++++++++++++++++ >> =C2=A0 7 files changed, 560 insertions(+) >> >> diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec >> index 28030391cff2..8a46fe73344e 100644 >> --- a/OvmfPkg/OvmfPkg.dec >> +++ b/OvmfPkg/OvmfPkg.dec >> @@ -60,6 +60,10 @@ [LibraryClasses] >> =C2=A0=C2=A0=C2=A0 # >> =C2=A0=C2=A0=C2=A0 QemuFwCfgS3Lib|Include/Library/QemuFwCfgS3Lib.h >> =C2=A0 +=C2=A0 ##=C2=A0 @libraryclass=C2=A0 Parse the contents of named = fw_cfg files as >> simple >> +=C2=A0 #=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (scalar) data types. >> +=C2=A0 QemuFwCfgSimpleParserLib|Include/Library/QemuFwCfgSimpleParserLi= b.h >> + >> =C2=A0=C2=A0=C2=A0 ##=C2=A0 @libraryclass=C2=A0 Rewrite the BootOrder Nv= Var based on QEMU's >> "bootorder" >> =C2=A0=C2=A0=C2=A0 #=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 fw_cfg file. >> =C2=A0=C2=A0=C2=A0 # >> diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc >> index d5e90c001370..5e2972063110 100644 >> --- a/OvmfPkg/OvmfPkgIa32.dsc >> +++ b/OvmfPkg/OvmfPkgIa32.dsc >> @@ -160,6 +160,7 @@ [LibraryClasses] >> =C2=A0=C2=A0=C2=A0 UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf >> =C2=A0=C2=A0=C2=A0 >> SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVar= iablesLib.inf >> >> =C2=A0=C2=A0=C2=A0 QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDx= eLib.inf >> +=C2=A0 >> QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFw= CfgSimpleParserLib.inf >> >> =C2=A0=C2=A0=C2=A0 VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf >> =C2=A0=C2=A0=C2=A0 LoadLinuxLib|OvmfPkg/Library/LoadLinuxLib/LoadLinuxLi= b.inf >> =C2=A0=C2=A0=C2=A0 >> MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/BaseMemEncryptSevL= ib.inf >> >> diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc >> index 066f49aeaee0..18e6909a33fa 100644 >> --- a/OvmfPkg/OvmfPkgIa32X64.dsc >> +++ b/OvmfPkg/OvmfPkgIa32X64.dsc >> @@ -164,6 +164,7 @@ [LibraryClasses] >> =C2=A0=C2=A0=C2=A0 UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf >> =C2=A0=C2=A0=C2=A0 >> SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVar= iablesLib.inf >> >> =C2=A0=C2=A0=C2=A0 QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDx= eLib.inf >> +=C2=A0 >> QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFw= CfgSimpleParserLib.inf >> >> =C2=A0=C2=A0=C2=A0 VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf >> =C2=A0=C2=A0=C2=A0 LoadLinuxLib|OvmfPkg/Library/LoadLinuxLib/LoadLinuxLi= b.inf >> =C2=A0=C2=A0=C2=A0 >> MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/BaseMemEncryptSevL= ib.inf >> >> diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc >> index ac510522a9ff..3d24cc4c1cfb 100644 >> --- a/OvmfPkg/OvmfPkgX64.dsc >> +++ b/OvmfPkg/OvmfPkgX64.dsc >> @@ -164,6 +164,7 @@ [LibraryClasses] >> =C2=A0=C2=A0=C2=A0 UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf >> =C2=A0=C2=A0=C2=A0 >> SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVar= iablesLib.inf >> >> =C2=A0=C2=A0=C2=A0 QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDx= eLib.inf >> +=C2=A0 >> QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFw= CfgSimpleParserLib.inf >> >> =C2=A0=C2=A0=C2=A0 VirtioLib|OvmfPkg/Library/VirtioLib/VirtioLib.inf >> =C2=A0=C2=A0=C2=A0 LoadLinuxLib|OvmfPkg/Library/LoadLinuxLib/LoadLinuxLi= b.inf >> =C2=A0=C2=A0=C2=A0 >> MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/BaseMemEncryptSevL= ib.inf >> >> diff --git a/OvmfPkg/Include/Library/QemuFwCfgSimpleParserLib.h >> b/OvmfPkg/Include/Library/QemuFwCfgSimpleParserLib.h >> new file mode 100644 >> index 000000000000..c6062bae8770 >> --- /dev/null >> +++ b/OvmfPkg/Include/Library/QemuFwCfgSimpleParserLib.h >> @@ -0,0 +1,128 @@ >> +/** @file >> +=C2=A0 Parse the contents of named fw_cfg files as simple (scalar) data >> types. >> + >> +=C2=A0 Copyright (C) 2020, Red Hat, Inc. >> + >> +=C2=A0 SPDX-License-Identifier: BSD-2-Clause-Patent >> +**/ >> + >> +#ifndef QEMU_FW_CFG_SIMPLE_PARSER_LIB_H_ >> +#define QEMU_FW_CFG_SIMPLE_PARSER_LIB_H_ >> + >> +#include >> + >> +/** >> +=C2=A0 Look up FileName with QemuFwCfgFindFile() from QemuFwCfgLib. Rea= d >> the fw_cfg >> +=C2=A0 file into a small array with automatic storage duration. Parse t= he >> array as >> +=C2=A0 the textual representation of a BOOLEAN. >> + >> +=C2=A0 @param[in] FileName=C2=A0 The name of the fw_cfg file to look up= and parse. >> + >> +=C2=A0 @param[out] Value=C2=A0=C2=A0=C2=A0 On success, Value is TRUE if= the contents of >> the fw_cfg >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 file case-i= nsensitively match "true", "yes", "y", >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "enable", "= enabled", "1". >> + >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 On success,= Value is FALSE if the contents of >> the fw_cfg >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 file case-i= nsensitively match "false", "no", "n", >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "disable", = "disabled", "0". >> + >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 On failure,= Value is not changed. >> + >> +=C2=A0 @retval RETURN_SUCCESS=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 Parsing successful. Value has been set. >> + >> +=C2=A0 @retval RETURN_UNSUPPORTED=C2=A0=C2=A0=C2=A0=C2=A0 Firmware conf= iguration is unavailable. >> + >> +=C2=A0 @retval RETURN_PROTOCOL_ERROR=C2=A0 Parsing failed. Value has no= t been >> changed. >> + >> +=C2=A0 @return=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 Error codes propagated from >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 QemuFwCfgFindFile(). Value= has not been >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 changed. >> +**/ >> +RETURN_STATUS >> +EFIAPI >> +QemuFwCfgParseBool ( >> +=C2=A0 IN=C2=A0 CONST CHAR8 *FileName, >> +=C2=A0 OUT BOOLEAN=C2=A0=C2=A0=C2=A0=C2=A0 *Value >> +=C2=A0 ); >> + >> +/** >> +=C2=A0 Look up FileName with QemuFwCfgFindFile() from QemuFwCfgLib. Rea= d >> the fw_cfg >> +=C2=A0 file into a small array with automatic storage duration. Parse t= he >> array as >> +=C2=A0 the textual representation of a UINT8. >> + >> +=C2=A0 @param[in] FileName=C2=A0=C2=A0=C2=A0 The name of the fw_cfg fil= e to look up and >> parse. >> + >> +=C2=A0 @param[in] ParseAsHex=C2=A0 If TRUE, call BaseLib's >> AsciiStrHexToUint64S() for >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= parsing the fw_cfg file. >> + >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= If FALSE, call BaseLib's >> AsciiStrDecimalToUint64S() >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= for parsing the fw_cfg file. >> + >> +=C2=A0 @param[out] Value=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 On success, Valu= e has been parsed with the >> BaseLib >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= function determined by ParseAsHex, and also >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= range-checked for [0, MAX_UINT8]. >> + >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= On failure, Value is not changed. >> + >> +=C2=A0 @retval RETURN_SUCCESS=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 Parsing successful. Value has been set. >> + >> +=C2=A0 @retval RETURN_UNSUPPORTED=C2=A0=C2=A0=C2=A0=C2=A0 Firmware conf= iguration is unavailable. >> + >> +=C2=A0 @retval RETURN_PROTOCOL_ERROR=C2=A0 Parsing failed. Value has no= t been >> changed. >> + >> +=C2=A0 @retval RETURN_PROTOCOL_ERROR=C2=A0 Parsing succeeded, but the r= esult >> does not fit >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 in the [0, MAX_UINT8] rang= e. Value >> has not >> +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 been changed. >=20 > I wondered about RETURN_BAD_BUFFER_SIZE / RETURN_BUFFER_TOO_SMALL for > this case, but RETURN_PROTOCOL_ERROR is less confusing. Right. I too considered the ...BUFFER... error codes first. I opted for "protocol error" instead because the ...BUFFER... codes "blame the caller", or at least inform the caller to repeat the call with a more appropriately sized buffer (or integer range). But in this case, the caller knows best, by design. So "bad buffer size" is actually a QEMU misconfiguration / information exchange error (hence "protocol error") between QEMU and firmware. The caller (in edk2) is not supposed to retry with a differently sized buffer (or integer range). [...] > Neat. > Reviewed-by: Philippe Mathieu-Daude >=20 Thanks! Laszlo