From nobody Thu Dec 26 12:28:42 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1504514430977474.326031222878; Mon, 4 Sep 2017 01:40:30 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 7D8D321E3EA8E; Mon, 4 Sep 2017 01:37:41 -0700 (PDT) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 E38A521E3EA76 for ; Mon, 4 Sep 2017 01:37:39 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Sep 2017 01:40:26 -0700 Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by fmsmga002.fm.intel.com with ESMTP; 04 Sep 2017 01:40:25 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,473,1498546800"; d="scan'208";a="1214411374" From: Dandan Bi To: edk2-devel@lists.01.org Date: Mon, 4 Sep 2017 16:39:07 +0800 Message-Id: <1504514347-352780-1-git-send-email-dandan.bi@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 Subject: [edk2] [edk2-VfrSpecification PATCH] 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: , Cc: Eric Dong , Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 --- .../23_vfr_data_struct_definition.md | 39 ++++++++++++++++++= ++++ README.md | 1 + 2 files changed, 40 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..4937e6a 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 } ";" =20 +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 )* =20 dataStructField64 ::=3D "UINT64" StringIdentifier { "[" Number "]" } ";" @@ -89,10 +99,26 @@ dataStructFieldRef ::=3D StringIdentifier { "[" Number "]" } ";" =20 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 ";" ``` =20 #### BEHAVIORS AND RESTRICTIONS =20 The data structure definition is in C-style language. `enum` type is not @@ -108,10 +134,23 @@ 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; ``` =20 **Unsupported Example of enum type:** =20 ```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 re= served. | 1.60 | Update syntax for goto, image, questionref and constant value= opcodes, correct CALLBACK flag to INTEREACTIVE, correct help string for ol= d syntax date/time example, and add examples for expression opcodes. | De= cember 1, 2011 | | 1.70 | Clarify restriction that enum type and struct data filed with= more than one dimensions array are not supported. = | Ma= y 18, 2012 | | 1.80 | Add syntax for warningif opcode, update definition for name/v= alue varstore and subtitle opcode, update referenced UEFI spec version info= . | Ja= n 14, 2014 | | 1.90 | Correct sample code for catenate/match/cond opcode. Add synta= x 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 = = | Ap= ril 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 = | = | --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel