public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Yonghong Zhu <yonghong.zhu@intel.com>
To: edk2-devel@lists.01.org
Cc: Liming Gao <liming.gao@intel.com>,
	Michael Kinney <michael.d.kinney@intel.com>,
	Kevin W Shaw <kevin.w.shaw@intel.com>
Subject: [Patch V2] Expression spec: update format to support flexible Pcd format
Date: Wed,  7 Feb 2018 20:35:55 +0800	[thread overview]
Message-ID: <1518006956-2284-4-git-send-email-yonghong.zhu@intel.com> (raw)
In-Reply-To: <1518006956-2284-1-git-send-email-yonghong.zhu@intel.com>

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



  parent reply	other threads:[~2018-02-07 12:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-07 12:35 [Patch V2] Build spec: Add flexible PCD value format into spec Yonghong Zhu
2018-02-07 12:35 ` [Patch V2] DEC " Yonghong Zhu
2018-03-05 14:21   ` Gao, Liming
2018-02-07 12:35 ` [Patch V2] DSC " Yonghong Zhu
2018-02-07 12:35 ` Yonghong Zhu [this message]
2018-03-05 14:20   ` [Patch V2] Expression spec: update format to support flexible Pcd format Gao, Liming
2018-02-07 12:35 ` [Patch V2] INF spec: Add flexible PCD value format into spec Yonghong Zhu
2018-03-05 14:20   ` Gao, Liming
2018-03-05 14:21 ` [Patch V2] Build " Gao, Liming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1518006956-2284-4-git-send-email-yonghong.zhu@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox