From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id A5E6521E8799E for ; Fri, 15 Sep 2017 00:03:16 -0700 (PDT) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Sep 2017 00:06:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,396,1500966000"; d="scan'208";a="151620755" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga005.fm.intel.com with ESMTP; 15 Sep 2017 00:06:15 -0700 Received: from fmsmsx122.amr.corp.intel.com (10.18.125.37) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 15 Sep 2017 00:06:15 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx122.amr.corp.intel.com (10.18.125.37) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 15 Sep 2017 00:06:15 -0700 Received: from shsmsx152.ccr.corp.intel.com ([169.254.6.93]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.98]) with mapi id 14.03.0319.002; Fri, 15 Sep 2017 15:06:12 +0800 From: "Gao, Liming" To: "Bi, Dandan" , "edk2-devel@lists.01.org" CC: "Dong, Eric" Thread-Topic: [edk2-VfrSpecification PATCH V2] Add union data type and bit fields in VFR Data Struct Definition Thread-Index: AQHTLfDvewKiMgsk/Uas664iiXmuEqK1hhcg Date: Fri, 15 Sep 2017 07:06:12 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E14F9AC@SHSMSX152.ccr.corp.intel.com> References: <1505459067-411912-1-git-send-email-dandan.bi@intel.com> In-Reply-To: <1505459067-411912-1-git-send-email-dandan.bi@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [edk2-VfrSpecification PATCH V2] Add union data type and bit fields in VFR Data Struct Definition X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Sep 2017 07:03:16 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao >-----Original Message----- >From: Bi, Dandan >Sent: Friday, September 15, 2017 3:04 PM >To: edk2-devel@lists.01.org >Cc: Dong, Eric ; Gao, Liming >Subject: [edk2-VfrSpecification PATCH V2] Add union data type and bit fiel= ds >in VFR Data Struct Definition > >V2: Add a note in the doc:for the bit field, the number of >the bit width could not exceed 32. > >https://bugzilla.tianocore.org/show_bug.cgi?id=3D683 > >Cc: Eric Dong >Cc: Liming Gao >Contributed-under: TianoCore Contribution Agreement 1.1 >Signed-off-by: Dandan Bi >Reviewed-by: Eric Dong >--- > .../23_vfr_data_struct_definition.md | 40 >++++++++++++++++++++++ > README.md | 1 + > 2 files changed, 41 insertions(+) > >diff --git a/2_vfr_description_in_bnf/23_vfr_data_struct_definition.md >b/2_vfr_description_in_bnf/23_vfr_data_struct_definition.md >index 6d6730d..2769d4f 100644 >--- a/2_vfr_description_in_bnf/23_vfr_data_struct_definition.md >+++ b/2_vfr_description_in_bnf/23_vfr_data_struct_definition.md >@@ -36,10 +36,16 @@ vfrDataStructDefinition ::=3D > { "typedef" } "struct" > { StringIdentifier } > "{" vfrDataStructFields "}" > { StringIdentifier } ";" > >+vfrDataStructDefinition ::=3D >+ { "typedef" } "union" >+ { StringIdentifier } >+ "{" vfrDataStructFields "}" >+ { StringIdentifier } ";" >+ > vfrDataStructFields ::=3D > ( > dataStructField64 > | dataStructField32 > | dataStructField16 >@@ -48,10 +54,14 @@ vfrDataStructFields ::=3D > | dataStructFieldString > | dataStructFieldDate > | dataStructFieldTime > | dataStructFieldRef > | dataStructFieldUser >+ | dataStructBitField64 >+ | dataStructBitField32 >+ | dataStructBitField16 >+ | dataStructBitField8 > )* > > dataStructField64 ::=3D > "UINT64" > StringIdentifier { "[" Number "]" } ";" >@@ -89,29 +99,59 @@ dataStructFieldRef ::=3D > StringIdentifier { "[" Number "]" } ";" > > dataStructFieldUser ::=3D > StringIdentifier > StringIdentifier { "[" Number "]" } ";" >+ >+dataStructBitField64 ::=3D >+ "UINT64" >+ { StringIdentifier } ":" Number ";" >+ >+dataStructBitField32 ::=3D >+ "UINT32" >+ { StringIdentifier } ":" Number ";" >+ >+dataStructBitField16 ::=3D >+ "UINT16" >+ { StringIdentifier } ":" Number ";" >+ >+dataStructBitField8 ::=3D >+ "UINT8" >+ { StringIdentifier } ":" Number ";" > ``` > > #### BEHAVIORS AND RESTRICTIONS > > The data structure definition is in C-style language. `enum` type is not > supported. The keyword of the fields' type must be a user defined data > structure or one of these types: `UINT8`, `UINT16`, `UINT32`, `UINT64`, > `BOOLEAN`, `EFI_STRING_ID`, `EFI_HII_DATA`, `EFI_HII_TIME EFI_HII_REF`, >and at > most one-dimensional array is permitted. >+Note: for the bit field, the number of the bit width could not exceed 32. > > #### Example > > ```c > typedef struct { > UINT8 mU8; > UINT16 mU16; > UINT32 mU32[10]; > UINT64 mU64; > } MyData; >+ >+typedef union { >+ UINT16 Field16; >+ UINT8 Field8; >+} MyUnionData; >+ >+typedef struct { >+ UINT16 Field16; >+ UINT8 MyBits1 : 1; >+ UINT8 MyBits2 : 3; >+ UINT8 MyBits3 : 3; >+ UINT16 MyBits4 : 4; >+} MyBitsData; > ``` > > **Unsupported Example of enum type:** > > ```c >diff --git a/README.md b/README.md >index 888eb81..0a596eb 100644 >--- a/README.md >+++ b/README.md >@@ -89,5 +89,6 @@ Copyright (c) 2007-2017, Intel Corporation. All rights >reserved. > | 1.60 | Update syntax for goto, image, questionref and constant valu= e >opcodes, correct CALLBACK flag to INTEREACTIVE, correct help string for ol= d >syntax date/time example, and add examples for expression opcodes. | >December 1, 2011 | > | 1.70 | Clarify restriction that enum type and struct data filed wit= h more >than one dimensions array are not supported. >| May 18, 2012 | > | 1.80 | Add syntax for warningif opcode, update definition for name/= value >varstore and subtitle opcode, update referenced UEFI spec version info. >| Jan 14, 2014 | > | 1.90 | Correct sample code for catenate/match/cond opcode. Add synt= ax >for match2 opcode. Add sample code to show the buffer type constant value >for orderedlist opcode and default opcode. | Ju= ly 2, 2015 | > | 1.91 | Convert to Gitbook >| April 2017 | >+| | [#683](https://bugzilla.tianocore.org/show_bug.cgi?id=3D683)= VFR >Spec: Add union data type and bit fields in VFR Data Struct Definition >| | >-- >1.9.5.msysgit.1