From nobody Sun May 19 10:57:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+75166+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+75166+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1621223228; cv=none; d=zohomail.com; s=zohoarc; b=ZK7ALanOHKko3G82TKPbC3OjdIUYnJI/9U2tleete8BbwZEdIrFCUarnLZTH7T1jrck65VmEUddG85MT3Hv7TUzpJ1hM4tJumDEZ1WeyZdn2pQPTCAZeuuFBexWx7hVjK+5j5ndmBS5vnGr7kow4fNNjerBZNeKQ1kK4IyGGnjI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621223228; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=ldh0TUoA1DzX66pQ+HM1J/SqFmrNICBOTJYxwIj7R9M=; b=L8Fwd+pa0QCtzsgLZYlLV09KqMy4/bJTV1ON6OV2QgJSUHsO8cO05Pg6BeGbWH2JLLtMVXg0VXvHpJVw5g4YIXZPQCgd/CH69Swpbg8PAu1BjcZaH74MAU8/tiOjxP1XZWXqW9QTHfL6ejV4cgi1LudKPGmOWgNA/+Jnivd/FVQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+75166+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1621223228684740.8236001581802; Sun, 16 May 2021 20:47:08 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id C91BYY1788612xXtcTGpQEAs; Sun, 16 May 2021 20:47:08 -0700 X-Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web09.14467.1621223221662435904 for ; Sun, 16 May 2021 20:47:02 -0700 IronPort-SDR: csaSH30pLBrKVhYzcC+T3hwF12lsV+JHC67HLtrNHTabd0tGWXmVPN3Rp5wpcJ1hFsuqycZOqp MwgHVbaGiBew== X-IronPort-AV: E=McAfee;i="6200,9189,9986"; a="179968313" X-IronPort-AV: E=Sophos;i="5.82,306,1613462400"; d="scan'208";a="179968313" X-Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 May 2021 20:47:00 -0700 IronPort-SDR: 8tv7GjtWYVDD+OhHxdGkvr7TtNWiGP4dKR+BWfthHQ306kM9DN27t6UZAzTR7BaWh1fl7PQxrV l7oBJFrED1FQ== X-IronPort-AV: E=Sophos;i="5.82,306,1613462400"; d="scan'208";a="611436739" X-Received: from tunglunl-mobl1.gar.corp.intel.com ([10.215.163.77]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 May 2021 20:46:57 -0700 From: "Tung Lun" To: devel@edk2.groups.io Cc: Loo Tung Lun , Maurice Ma , Nate DeSimone , Star Zeng , Chasel Chiu Subject: [edk2-devel] [PATCH v2] IntelFsp2Pkg: YAML script bug fix Date: Mon, 17 May 2021 11:46:52 +0800 Message-Id: <20210517034652.862-1-tung.lun.loo@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,tung.lun.loo@intel.com X-Gm-Message-State: 4naKmMz53wOE4INNCJdZdbT2x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621223228; bh=VlQssNW73dfqPPvFd8IAuHuEkoNxJXmiRA1Mc0FEZEk=; h=Cc:Date:From:Reply-To:Subject:To; b=PwuYiKDEI6lWu1FR1eCR+4AWOcP9CcENDhX4pIwxLosfsXUSsdcOxF6b3OA31fGup69 LSx3XOZ9D1J++evVdHAEKWuBY/O9BU/gULtOqdSEhCsFfT2aPUt7+YjebyLu47CmlebyX 8uwEpPjwu2MzHUezpSPYumDhTgzCT2xdbV4= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" This patch fixes the issue observed during BSF file to YAML file conversion. It also addresses the issue during multibyte array data conversion check, for example the data representation of 0xFFFF instead of 0xFF, 0xFF would be thrown exception "Array size is not proper" without this patch. Cc: Maurice Ma Cc: Nate DeSimone Cc: Star Zeng Cc: Chasel Chiu Signed-off-by: Loo Tung Lun --- IntelFsp2Pkg/Tools/FspDscBsf2Yaml.py | 11 +++++++++-- IntelFsp2Pkg/Tools/GenCfgOpt.py | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/IntelFsp2Pkg/Tools/FspDscBsf2Yaml.py b/IntelFsp2Pkg/Tools/FspD= scBsf2Yaml.py index cad9b60e73..d2ca7145ae 100644 --- a/IntelFsp2Pkg/Tools/FspDscBsf2Yaml.py +++ b/IntelFsp2Pkg/Tools/FspDscBsf2Yaml.py @@ -46,6 +46,13 @@ def Bytes2Val(Bytes): return reduce(lambda x, y: (x << 8) | y, Bytes[::-1]) =20 =20 +def Str2Bytes(Value, Blen): + Result =3D bytearray(Value[1:-1], 'utf-8') # Excluding quotes + if len(Result) < Blen: + Result.extend(b'\x00' * (Blen - len(Result))) + return Result + + class CFspBsf2Dsc: =20 def __init__(self, bsf_file): @@ -108,7 +115,8 @@ class CFspBsf2Dsc: cfg_item['find'] =3D prefix cfg_item['cname'] =3D 'Signature' cfg_item['length'] =3D len(finds[0][1]) - cfg_item['value'] =3D '0x%X' % Bytes2Val(finds[0][1].encod= e('UTF-8')) + str2byte =3D Str2Bytes("'" + finds[0][1] + "'", len(finds[= 0][1])) + cfg_item['value'] =3D '0x%X' % Bytes2Val(str2byte) cfg_list.append(dict(cfg_item)) cfg_item =3D dict(cfg_temp) find_list.pop(0) @@ -291,7 +299,6 @@ class CFspDsc2Yaml(): raise Exception('DSC variable creation error !') else: raise Exception('Unsupported file "%s" !' % file_name) - gen_cfg_data.UpdateDefaultValue() self.gen_cfg_data =3D gen_cfg_data =20 def print_dsc_line(self): diff --git a/IntelFsp2Pkg/Tools/GenCfgOpt.py b/IntelFsp2Pkg/Tools/GenCfgOpt= .py index 660824b740..714b2d8b1a 100644 --- a/IntelFsp2Pkg/Tools/GenCfgOpt.py +++ b/IntelFsp2Pkg/Tools/GenCfgOpt.py @@ -708,7 +708,8 @@ EndList for Page in PageList: Page =3D Page.strip() Match =3D re.match("(\w+):\"(.+)\"", Page) - self._CfgPageDict[Match.group(1)] =3D Matc= h.group(2) + if Match !=3D None: + self._CfgPageDict[Match.group(1)] =3D = Match.group(2) =20 Match =3D re.match("(?:^|.+\s+)BLOCK:{NAME:\"(.+)\= "\s*,\s*VER:\"(.+)\"\s*}", Remaining) if Match: --=20 2.28.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#75166): https://edk2.groups.io/g/devel/message/75166 Mute This Topic: https://groups.io/mt/82879060/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-