2_expression_overview.md | 3 +++ 3_expression_format.md | 50 +++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 48 insertions(+), 5 deletions(-)
V2: update EBNF for Array format.
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Kevin W Shaw <kevin.w.shaw@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
2_expression_overview.md | 3 +++
3_expression_format.md | 50 +++++++++++++++++++++++++++++++++++++++++++-----
2 files changed, 48 insertions(+), 5 deletions(-)
diff --git a/2_expression_overview.md b/2_expression_overview.md
index 34ceb97..c29a632 100644
--- a/2_expression_overview.md
+++ b/2_expression_overview.md
@@ -100,5 +100,8 @@ directives section do not apply.
12. Logical operators require operands that are type scalar.
13. For the Conditional Operator, the first operand must be scalar, while the
second and third operands must have the same type (i.e., both being scalar,
both being integers, or both being string literals).
+
+14. Array format like "{0x10, 0x20}" can't be a operand of any operator except
+ Relational and equality operators.
diff --git a/3_expression_format.md b/3_expression_format.md
index 50b94c4..1f90fc9 100644
--- a/3_expression_format.md
+++ b/3_expression_format.md
@@ -93,10 +93,21 @@ GRACEFULLY._
<HexNumber> ::= <Base16>
<Base16> ::= <HexPrefix> [<HexDigit>]+
<HexDigit> ::= (a-fA-F0-9)
<HexPrefix> ::= {"0x"} {"0X"}
<GuidValue> ::= {<RformatGuid>} {<CformatGuid>}
+<UINT8> ::= <HexPrefix> (\x0 - \xFF)
+<UINT16> ::= <HexPrefix> (\x0 - \xFFFF)
+<UINT32> ::= <HexPrefix> (\x0 - \xFFFFFFFF)
+<UINT64> ::= <HexPrefix> (\x0 - \xFFFFFFFFFFFFFFFF)
+<ShortNum> ::= (0-255)
+<IntNum> ::= (0-65535)
+<LongNum> ::= (0-4294967295)
+<LongLongNum> ::= (0-18446744073709551615)
+<GuidStr> ::= "GUID(" <GuidVal> ")"
+<GuidVal> ::= {<DblQuote> <RformatGuid> <DblQuote>}
+ {<CformatGuid>} {<CName>}
Rhex2 ::= [<HexDigit>] <HexDigit>
Rhex4 ::= [<HexDigit>] [<HexDigit>] Rhex2
Rhex8 ::= [<HexDigit>] [<HexDigit>] [<HexDigit>] [<HexDigit>] Rhex4
<RformatGuid> ::= Rghex8 "-" Rghex4 "-" Rghex4 "-" Rghex4 "-" Rghex12
Rghex2 ::= <HexDigit> <HexDigit>
@@ -111,19 +122,42 @@ Rghex12 ::= <HexDigit> <HexDigit> <HexDigit> <HexDigit> Rghex8
<CformatGuid> ::= "{" [<TSP>]* <Hex32> <CSP> <Hex16> <CSP> <Part2>
<Part2> ::= <Hex16> <CSP> "{" [<TSP>]* <Byte> <CSP> <Part3>
<Part3> ::= <Byte> <CSP> <Byte> <CSP> <Byte> <CSP> <Part4>
<Part4> ::= <Byte> <CSP> <Byte> <CSP> <Byte> <CSP> <Part5>
<Part5> ::= <Byte> [<TSP>]* "}" [<TSP>]* "}"
-<Array> ::= {<EmptyArray>} {<Array>}
+<Array> ::= {<EmptyArray>} {<NonEmptyArray>}
<EmptyArray> ::= "{" <TSP>* "}"
-<ByteArray> ::= "{" <TSP>* <Byte> [<CSP> <Byte>]* "}"
+<NonEmptyArray> ::= "{" <TSP>* [<Lable>] <ArrayVal>
+ [<CSP> [<Lable>] <ArrayVal>]* "}"
+<ArrayVal> ::= {<Num8Array>} {<GuidStr>} {<DevicePath>}
+<DevicePath> ::= "DEVICE_PATH(" <DevicePathStr> ")"
+<DevicePathStr> ::= A double quoted string that follow the device path
+ as string format defined in UEFI Specification 2.6
+ Section 9.6
+<Lable> ::= "LABEL(" <CName> ")"
+<Offset> ::= "OFFSET_OF(" <CName> ")"
<StringLiteral> ::= {<QuotedString>} {"L" <QuotedString>}
+ {<SglQuotedString>} {"L" <SglQuotedString>}
<DblQuote> ::= 0x22
+<SglQuote> ::= 0x27
<QuotedString> ::= <DblQuote> [<CCHAR>]* <DblQuote>
+<SglQuotedString> ::= <SglQuote> [<CCHAR>]* <SglQuote>
<CCHAR> ::= {<SingleChars>} {<EscapeCharSeq>}
-<SingleChars> ::= {0x20} {0x21} {(0x23 - 0x5B)} {(0x5D - 0x7E)}
-<EscapeCharSeq> ::= "\" {"n"} {"r"} {"t"} {"f"} {"b"} {"0"} {"\"} {<DblQuote>}
+<SingleChars> ::= {0x21} {(0x23 - 0x26)} {(0x28 - 0x5B)}
+ {(0x5D - 0x7E)} {<EscapeSequence>}
+<EscapeCharSeq> ::= "\" {"n"} {"r"} {"t"} {"f"} {"b"} {"0"} {"\"}
+ {<DblQuote>} {<SglQuote>}
+<NonNumType> ::= {<TrueFalse>} {<StringLiteral>} {<Offset>} {<UintMac>}
+<Num8Array> ::= {<NonNumType>} {<ShortNum>} {<UINT8>}
+<Num16Array> ::= {<NonNumType>} {<IntNum>} {<UINT16>}
+<Num32Array> ::= {<NonNumType>} {<LongNum>} {<UINT32>}
+<Num64Array> ::= {<NonNumType>} {<LongLongNum>} {<UINT64>}
+<UintMac> ::= {<Uint8Mac>} {<Uint16Mac>} {<Uint32Mac>} {<Uint64Mac>}
+<Uint8Mac> ::= "UINT8(" <Num8Array> ")"
+<Uint16Mac> ::= "UINT16(" <Num16Array> ")"
+<Uint32Mac> ::= "UINT32(" <Num32Array> ")"
+<Uint64Mac> ::= "UINT64(" <Num64Array> ")"
<PostFixExpression> ::= {<PrimaryExpression>} {<PcdName>}
<PcdName> ::= <CName> "." <CName>
<UnaryExpression> ::= {<PostFixExpression>} {<UnaryOp> <UnaryExpression>}
<UnaryOp> ::= {<IntegerOps>} {<ScalarOps>}
<IntegerOps> ::= {"+"} {"-"} {"~"}
@@ -187,13 +221,19 @@ gUefiCpuPkgTokenSpaceGuid.PcdCpuLocalApicBaseAddress | !gCrownBayTokenSpaceGuid.
This is the value of the MACRO assigned in a DEFINE statement.
**Expressions**
-If the "|" character is used in an expression, the expression must be
+If the "|" or "||"character is used in an expression, the expression must be
encapsulated by parenthesis.
+**OFFSET_OF()**
+
+LABEL() macro in byte arrays to tag the byte offset of a location in a byte
+array. OFFSET_OF() macro in byte arrays that returns the byte offset of a
+LABEL() declared in a byte array.
+
## 3.2 Conditional Directive Expressions
Conditional directive statements are defined in the EDK II Platform Description
(DSC) File and Flash Definition (FDF) File. The following EBNF describes the
format for expressions used in conditional directives. The format is based on
--
2.6.1.windows.1
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Reviewed-by: Liming Gao <liming.gao@intel.com> >-----Original Message----- >From: Zhu, Yonghong >Sent: Wednesday, February 07, 2018 8:36 PM >To: edk2-devel@lists.01.org >Cc: Gao, Liming <liming.gao@intel.com>; Kinney, Michael D ><michael.d.kinney@intel.com>; Shaw, Kevin W <kevin.w.shaw@intel.com> >Subject: [Patch V2] Expression spec: update format to support flexible Pcd >format > >V2: update EBNF for Array format. > >Cc: Liming Gao <liming.gao@intel.com> >Cc: Michael Kinney <michael.d.kinney@intel.com> >Cc: Kevin W Shaw <kevin.w.shaw@intel.com> >Contributed-under: TianoCore Contribution Agreement 1.1 >Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> >--- > 2_expression_overview.md | 3 +++ > 3_expression_format.md | 50 >+++++++++++++++++++++++++++++++++++++++++++----- > 2 files changed, 48 insertions(+), 5 deletions(-) > >diff --git a/2_expression_overview.md b/2_expression_overview.md >index 34ceb97..c29a632 100644 >--- a/2_expression_overview.md >+++ b/2_expression_overview.md >@@ -100,5 +100,8 @@ directives section do not apply. > 12. Logical operators require operands that are type scalar. > > 13. For the Conditional Operator, the first operand must be scalar, while the > second and third operands must have the same type (i.e., both being scalar, > both being integers, or both being string literals). >+ >+14. Array format like "{0x10, 0x20}" can't be a operand of any operator >except >+ Relational and equality operators. >diff --git a/3_expression_format.md b/3_expression_format.md >index 50b94c4..1f90fc9 100644 >--- a/3_expression_format.md >+++ b/3_expression_format.md >@@ -93,10 +93,21 @@ GRACEFULLY._ > <HexNumber> ::= <Base16> > <Base16> ::= <HexPrefix> [<HexDigit>]+ > <HexDigit> ::= (a-fA-F0-9) > <HexPrefix> ::= {"0x"} {"0X"} > <GuidValue> ::= {<RformatGuid>} {<CformatGuid>} >+<UINT8> ::= <HexPrefix> (\x0 - \xFF) >+<UINT16> ::= <HexPrefix> (\x0 - \xFFFF) >+<UINT32> ::= <HexPrefix> (\x0 - \xFFFFFFFF) >+<UINT64> ::= <HexPrefix> (\x0 - \xFFFFFFFFFFFFFFFF) >+<ShortNum> ::= (0-255) >+<IntNum> ::= (0-65535) >+<LongNum> ::= (0-4294967295) >+<LongLongNum> ::= (0-18446744073709551615) >+<GuidStr> ::= "GUID(" <GuidVal> ")" >+<GuidVal> ::= {<DblQuote> <RformatGuid> <DblQuote>} >+ {<CformatGuid>} {<CName>} > Rhex2 ::= [<HexDigit>] <HexDigit> > Rhex4 ::= [<HexDigit>] [<HexDigit>] Rhex2 > Rhex8 ::= [<HexDigit>] [<HexDigit>] [<HexDigit>] [<HexDigit>] Rhex4 > <RformatGuid> ::= Rghex8 "-" Rghex4 "-" Rghex4 "-" Rghex4 "-" Rghex12 > Rghex2 ::= <HexDigit> <HexDigit> >@@ -111,19 +122,42 @@ Rghex12 ::= <HexDigit> <HexDigit> <HexDigit> ><HexDigit> Rghex8 > <CformatGuid> ::= "{" [<TSP>]* <Hex32> <CSP> <Hex16> <CSP> <Part2> > <Part2> ::= <Hex16> <CSP> "{" [<TSP>]* <Byte> <CSP> <Part3> > <Part3> ::= <Byte> <CSP> <Byte> <CSP> <Byte> <CSP> <Part4> > <Part4> ::= <Byte> <CSP> <Byte> <CSP> <Byte> <CSP> <Part5> > <Part5> ::= <Byte> [<TSP>]* "}" [<TSP>]* "}" >-<Array> ::= {<EmptyArray>} {<Array>} >+<Array> ::= {<EmptyArray>} {<NonEmptyArray>} > <EmptyArray> ::= "{" <TSP>* "}" >-<ByteArray> ::= "{" <TSP>* <Byte> [<CSP> <Byte>]* "}" >+<NonEmptyArray> ::= "{" <TSP>* [<Lable>] <ArrayVal> >+ [<CSP> [<Lable>] <ArrayVal>]* "}" >+<ArrayVal> ::= {<Num8Array>} {<GuidStr>} {<DevicePath>} >+<DevicePath> ::= "DEVICE_PATH(" <DevicePathStr> ")" >+<DevicePathStr> ::= A double quoted string that follow the device path >+ as string format defined in UEFI Specification 2.6 >+ Section 9.6 >+<Lable> ::= "LABEL(" <CName> ")" >+<Offset> ::= "OFFSET_OF(" <CName> ")" > <StringLiteral> ::= {<QuotedString>} {"L" <QuotedString>} >+ {<SglQuotedString>} {"L" <SglQuotedString>} > <DblQuote> ::= 0x22 >+<SglQuote> ::= 0x27 > <QuotedString> ::= <DblQuote> [<CCHAR>]* <DblQuote> >+<SglQuotedString> ::= <SglQuote> [<CCHAR>]* <SglQuote> > <CCHAR> ::= {<SingleChars>} {<EscapeCharSeq>} >-<SingleChars> ::= {0x20} {0x21} {(0x23 - 0x5B)} {(0x5D - 0x7E)} >-<EscapeCharSeq> ::= "\" {"n"} {"r"} {"t"} {"f"} {"b"} {"0"} {"\"} >{<DblQuote>} >+<SingleChars> ::= {0x21} {(0x23 - 0x26)} {(0x28 - 0x5B)} >+ {(0x5D - 0x7E)} {<EscapeSequence>} >+<EscapeCharSeq> ::= "\" {"n"} {"r"} {"t"} {"f"} {"b"} {"0"} {"\"} >+ {<DblQuote>} {<SglQuote>} >+<NonNumType> ::= {<TrueFalse>} {<StringLiteral>} {<Offset>} >{<UintMac>} >+<Num8Array> ::= {<NonNumType>} {<ShortNum>} {<UINT8>} >+<Num16Array> ::= {<NonNumType>} {<IntNum>} {<UINT16>} >+<Num32Array> ::= {<NonNumType>} {<LongNum>} {<UINT32>} >+<Num64Array> ::= {<NonNumType>} {<LongLongNum>} {<UINT64>} >+<UintMac> ::= {<Uint8Mac>} {<Uint16Mac>} {<Uint32Mac>} >{<Uint64Mac>} >+<Uint8Mac> ::= "UINT8(" <Num8Array> ")" >+<Uint16Mac> ::= "UINT16(" <Num16Array> ")" >+<Uint32Mac> ::= "UINT32(" <Num32Array> ")" >+<Uint64Mac> ::= "UINT64(" <Num64Array> ")" > <PostFixExpression> ::= {<PrimaryExpression>} {<PcdName>} > <PcdName> ::= <CName> "." <CName> > <UnaryExpression> ::= {<PostFixExpression>} {<UnaryOp> ><UnaryExpression>} > <UnaryOp> ::= {<IntegerOps>} {<ScalarOps>} > <IntegerOps> ::= {"+"} {"-"} {"~"} >@@ -187,13 +221,19 @@ >gUefiCpuPkgTokenSpaceGuid.PcdCpuLocalApicBaseAddress >| !gCrownBayTokenSpaceGuid. > > This is the value of the MACRO assigned in a DEFINE statement. > > **Expressions** > >-If the "|" character is used in an expression, the expression must be >+If the "|" or "||"character is used in an expression, the expression must be > encapsulated by parenthesis. > >+**OFFSET_OF()** >+ >+LABEL() macro in byte arrays to tag the byte offset of a location in a byte >+array. OFFSET_OF() macro in byte arrays that returns the byte offset of a >+LABEL() declared in a byte array. >+ > ## 3.2 Conditional Directive Expressions > > Conditional directive statements are defined in the EDK II Platform >Description > (DSC) File and Flash Definition (FDF) File. The following EBNF describes the > format for expressions used in conditional directives. The format is based on >-- >2.6.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
© 2016 - 2024 Red Hat, Inc.