[edk2] [Patch V3] DSC spec: Add flexible PCD value format into spec

Yonghong Zhu posted 1 patch 6 years, 1 month ago
Failed in applying to current master (apply log)
3_edk_ii_dsc_file_format/310_pcd_sections.md       | 160 +++++++++++++--------
.../311_[components]_sections.md                   |  23 +--
.../33_platform_dsc_definition.md                  |  78 +++++++---
3 files changed, 174 insertions(+), 87 deletions(-)
[edk2] [Patch V3] DSC spec: Add flexible PCD value format into spec
Posted by Yonghong Zhu 6 years, 1 month ago
V3: Update the Pcd value format in [Components] section
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>
---
 3_edk_ii_dsc_file_format/310_pcd_sections.md       | 160 +++++++++++++--------
 .../311_[components]_sections.md                   |  23 +--
 .../33_platform_dsc_definition.md                  |  78 +++++++---
 3 files changed, 174 insertions(+), 87 deletions(-)

diff --git a/3_edk_ii_dsc_file_format/310_pcd_sections.md b/3_edk_ii_dsc_file_format/310_pcd_sections.md
index 2af42cc..18a243d 100644
--- a/3_edk_ii_dsc_file_format/310_pcd_sections.md
+++ b/3_edk_ii_dsc_file_format/310_pcd_sections.md
@@ -98,13 +98,11 @@ is permissible to list multiple architectures in a single method section as in:
 It is permissible to list a PCD in a common architecture section and also list
 it in an architecturally modified section. In this case, the value in the
 architectural section overrides the value specified in the common section.
 
 The PCD values must match the datum type declared for a given PCD in the DEC
-file. While a PCD of datum type `BOOLEAN` is permitted to have a `1` or a `0`
-(instead of TRUE or FALSE) in the value field, a PCD of type UINT* cannot use
-`TRUE` or `FALSE` for values.
+file.
 
 PCDs with a data type of `VOID`* can optionally provide the maximum size of the
 value. If not provided, the maximum length will be calculated as the largest of
 the size of the data in the DSC file, the size of the data in the INF file or
 the size of the data in the DEC file that declares the PCD.
@@ -220,21 +218,24 @@ fields that are separated by the pipe character, "|".
 <SkuIdS>        ::= <Keyword> [<FS> <Keyword>]*
 <Keyword>       ::= <UiName>
 <UiName>        ::= <Word>
 <FabStatements> ::= {<MacroDefinition>} {<IncludeStatement>} {<PcdEntry>}
 <PcdEntry>      ::= <TS> <PcdName> [<FS> <PcdValue>] <EOL>
-<PcdValue>      ::= if (pcddatumtype == "BOOLEAN"): {<Boolean>} {<Expression>}
-                    elif (pcddatumtype == "UINT8"): {<NumValUint8>}
-                    {<Expression>} elif (pcddatumtype == "UINT16"):
-                    {<NumValUint16>} {<Expression>} elif (pcddatumtype ==
-                    "UINT32"): {<NumValUint32>} {<Expression>} elif
-                    (pcddatumtype == "UINT64"): {<NumValUint64>} {<Expression>}
+<PcdValue>      ::= if (pcddatumtype == "BOOLEAN"):
+                      {<BoolType>} {<Expression>}
+                    elif (pcddatumtype == "UINT8"):
+                      {<NumValUint8>} {<Expression>}
+                    elif (pcddatumtype == "UINT16"):
+                      {<NumValUint16>} {<Expression>}
+                    elif (pcddatumtype == "UINT32"):
+                      {<NumValUint32>} {<Expression>}
+                    elif (pcddatumtype == "UINT64"):
+                      {<NumValUint64>} {<Expression>}
                     else:
-                    <StringValue> [<MaxSize>]
+                      <StringValue> [<MaxSize>]
 <MaxSize>       ::= <FS> "VOID*" <FS> {<Number>} {<Expression>}
-<StringValue>   ::= {<UnicodeString>} {<CString>} {<CArray>}
-                    {<MACROVAL>} {<Expression>}
+<StringValue>   ::= {<StringVal>} {<MACROVAL>} {<Expression>}
 ```
 
 #### Parameters
 
 **_Expression_**
@@ -325,21 +326,24 @@ of the DSC file.
 <SkuIdS>        ::= <Keyword> [<FS> <Keyword>]*
 <Keyword>       ::= <UiName>
 <UiName>        ::= <Word>
 <PimStatements> ::= {<MacroDefinition>} {<IncludeStatement>} {<PcdEntry>}
 <PcdEntry>      ::= <TS> <PcdName> [<FS> <PcdValue>] <EOL>
-<PcdValue>      ::= if (pcddatumtype == "BOOLEAN"): {<Boolean>} {<Expression>}
-                    elif (pcddatumtype == "UINT8"): {<NumValUint8>}
-                    {<Expression>} elif (pcddatumtype == "UINT16"):
-                    {<NumValUint16>} {<Expression>} elif (pcddatumtype ==
-                    "UINT32"): {<NumValUint32>} {<Expression>} elif
-                    (pcddatumtype == "UINT64"): {<NumValUint64>} {<Expression>}
+<PcdValue>      ::= if (pcddatumtype == "BOOLEAN"):
+                      {<BoolType>} {<Expression>}
+                    elif (pcddatumtype == "UINT8"):
+                      {<NumValUint8>} {<Expression>}
+                    elif (pcddatumtype == "UINT16"):
+                      {<NumValUint16>} {<Expression>}
+                    elif (pcddatumtype == "UINT32"):
+                      {<NumValUint32>} {<Expression>}
+                    elif (pcddatumtype == "UINT64"):
+                      {<NumValUint64>} {<Expression>}
                     else:
-                    <StringValue> [<MaxSize>]
+                      <StringValue> [<MaxSize>]
 <MaxSize>       ::= <FS> {<Number>} {<Expression>}
-<StringValue>   ::= {<UnicodeString>} {<CString>} {<CArray>}
-                    {<MACROVAL>} {<Expression>}
+<StringValue>   ::= {<StringVal>} {<MACROVAL>} {<Expression>}
 ```
 
 #### Parameters
 
 **_Expression_**
@@ -458,41 +462,58 @@ sections of the DSC file.
 <attrs>          ::= "." <arch> ["." <SkuIds>]
 <SkuIdS>         ::= <Keyword> [<FS> <Keyword>]*
 <Keyword>        ::= <UiName>
 <UiName>         ::= <Word>
 <MinEntry>       ::= <PcdName> [<FS> <PcdValue>] <EOL>
-<PcdValue>       ::= if (pcddatumtype == "BOOLEAN"): {<Boolean>} {<Expression>}
-                     elif (pcddatumtype == "UINT8"): {<NumValUint8>}
-                     {<Expression>} elif (pcddatumtype == "UINT16"):
-                     {<NumValUint16>} {<Expression>} elif (pcddatumtype ==
-                     "UINT32"): {<NumValUint32>} {<Expression>} elif
-                     (pcddatumtype == "UINT64"): {<NumValUint64>}
-                     {<Expression>} else:
-                     <StringValue> [<MaxSize>]
+<PcdValue>       ::= if (pcddatumtype == "BOOLEAN"):
+                       {<BoolType>} {<Expression>}
+                     elif (pcddatumtype == "UINT8"):
+                       {<NumValUint8>} {<Expression>}
+                     elif (pcddatumtype == "UINT16"):
+                       {<NumValUint16>} {<Expression>}
+                     elif (pcddatumtype == "UINT32"):
+                       {<NumValUint32>} {<Expression>}
+                     elif (pcddatumtype == "UINT64"):
+                       {<NumValUint64>} {<Expression>}
+                     else:
+                       <StringValue> [<MaxSize>]
 <MaxSize>        ::= <FS> "VOID*" [<FS> <SizeValue>]
 <SizeValue>      ::= {<Number>} {<Expression>}
-<StringValue>    ::= {<UnicodeString>} {<CString>} {<CArray>} {<MACROVAL>}
-                     {<Expression>}
+<StringValue>    ::= {<StringVal>} {<MACROVAL>} {<Expression>}
 <VpdEntry>       ::= <PcdName> <FS> <VpdOffset> [<FS> <VpdData>] <EOL>
 <VpdOffset>      ::= {<Number>} {"*"}
-<VpdData>        ::= if (pcddatumtype == "BOOLEAN"): {<Boolean>} {<Expression>}
-                     elif (pcddatumtype == "UINT8"): {<NumValUint8>}
-                     {<Expression>} elif (pcddatumtype == "UINT16"):
-                     {<NumValUint16>} {<Expression>} elif (pcddatumtype ==
-                     "UINT32"): {<NumValUint32>} {<Expression>} elif
-                     (pcddatumtype == "UINT64"): {<NumValUint64>}
-                     {<Expression>} else:
-                     <VpdMaxSize>
+<VpdData>        ::= if (pcddatumtype == "BOOLEAN"):
+                       {<BoolType>} {<Expression>}
+                     elif (pcddatumtype == "UINT8"):
+                       {<NumValUint8>} {<Expression>}
+                     elif (pcddatumtype == "UINT16"):
+                       {<NumValUint16>} {<Expression>}
+                     elif (pcddatumtype == "UINT32"):
+                       {<NumValUint32>} {<Expression>}
+                     elif(pcddatumtype == "UINT64"):
+                       {<NumValUint64>} {<Expression>}
+                     else:
+                       <VpdMaxSize>
 <VpdMaxSize>     ::= <NumValUint32> [<FS> <StringValue>]
 <HiiEntry>       ::= <PcdName> <FS> <HiiString> <Field2> <EOL>
 <HiiString>      ::= {<CArray>} {<UnicodeString>}
 <Field2>         ::= <FS> <VariableGuid> <FS> <VariableOffset> [<ValueField>]
 <VariableGuid>   ::= <CName>
 <ValueField>     ::= <FS> <DefaultValue> [<FS> <HiiAttrs>]
 <VariableOffset> ::= <Number>
-<DefaultValue>   ::= {<Boolean>} {<Number>} {<String>} {<CArray>}
-                     {<MACROVAL>} {<Expression>}
+<DefaultValue>   ::= if (pcddatumtype == "BOOLEAN"):
+                       {<BoolType>} {<Expression>}
+                     elif (pcddatumtype == "UINT8"):
+                       {<NumValUint8>} {<Expression>}
+                     elif (pcddatumtype == "UINT16"):
+                       {<NumValUint16>} {<Expression>}
+                     elif (pcddatumtype == "UINT32"):
+                       {<NumValUint32>} {<Expression>}
+                     elif (pcddatumtype == "UINT64"):
+                       {<NumValUint64>} {<Expression>}
+                     else:
+                       <StringValue>
 <HiiAttrs>       ::= <HiiAttr> [<CS> <HiiAttr>]*
 <HiiAttr>        ::= {"NV"} {"BS"} {"RT"} {"RO"}
 ```
 
 #### Parameters
@@ -618,41 +639,58 @@ sections of the DSC file.
 <attrs>          ::= "." <arch> ["." <SkuIds>]
 <SkuIdS>         ::= <Keyword> [<FS> <Keyword>]*
 <Keyword>        ::= <UiName>
 <UiName>         ::= <Word>
 <MinEntry>       ::= <PcdName> [<FS> <PcdValue>] <EOL>
-<PcdValue>       ::= if (pcddatumtype == "BOOLEAN"): {<Boolean>} {<Expression>}
-                     elif (pcddatumtype == "UINT8"): {<NumValUint8>}
-                     {<Expression>} elif (pcddatumtype == "UINT16"):
-                     {<NumValUint16>} {<Expression>} elif (pcddatumtype ==
-                     "UINT32"): {<NumValUint32>} {<Expression>} elif
-                     (pcddatumtype == "UINT64"): {<NumValUint64>}
-                     {<Expression>} else:
-                     <StringValue> [<MaxSize>]
+<PcdValue>       ::= if (pcddatumtype == "BOOLEAN"):
+                       {<BoolType>} {<Expression>}
+                     elif (pcddatumtype == "UINT8"):
+                       {<NumValUint8>} {<Expression>}
+                     elif (pcddatumtype == "UINT16"):
+                       {<NumValUint16>} {<Expression>}
+                     elif (pcddatumtype == "UINT32"):
+                       {<NumValUint32>} {<Expression>}
+                     elif (pcddatumtype == "UINT64"):
+                       {<NumValUint64>} {<Expression>}
+                     else:
+                       <StringValue> [<MaxSize>]
 <MaxSize>        ::= <FS> "VOID*" [<FS> <SizeValue>]
 <SizeValue>      ::= {<Number>} {<Expression>}
-<StringValue>    ::= {<UnicodeString>} {<CString>} {<CArray>} {<MACROVAL>}
-                     {<Expression>}
+<StringValue>    ::= {<StringVal>} {<MACROVAL>} {<Expression>}
 <VpdEntry>       ::= <PcdName> <FS> <VpdOffset> [<FS> <VpdData>] <EOL>
 <VpdOffset>      ::= {<Number>} {"*"}
-<VpdData>        ::= if (pcddatumtype == "BOOLEAN"): {<Boolean>} {<Expression>}
-                     elif (pcddatumtype == "UINT8"): {<NumValUint8>}
-                     {<Expression>} elif (pcddatumtype == "UINT16"):
-                     {<NumValUint16>} {<Expression>} elif (pcddatumtype ==
-                     "UINT32"): {<NumValUint32>} {<Expression>} elif
-                     (pcddatumtype == "UINT64"): {<NumValUint64>}
-                     {<Expression>} else:
-                     <VpdMaxSize>
+<VpdData>        ::= if (pcddatumtype == "BOOLEAN"):
+                       {<BoolType>} {<Expression>}
+                     elif (pcddatumtype == "UINT8"):
+                       {<NumValUint8>} {<Expression>}
+                     elif (pcddatumtype == "UINT16"):
+                       {<NumValUint16>} {<Expression>}
+                     elif (pcddatumtype == "UINT32"):
+                       {<NumValUint32>} {<Expression>}
+                     elif (pcddatumtype == "UINT64"):
+                       {<NumValUint64>} {<Expression>}
+                     else:
+                       <VpdMaxSize>
 <VpdMaxSize>     ::= <NumValUint32> [<FS> <StringValue>]
 <HiiEntry>       ::= <PcdName> <FS> <HiiString> <Field2> <EOL>
 <HiiString>      ::= {<CArray>} {<UnicodeString>}
 <Field2>         ::= <FS> <VariableGuid> <FS> <VariableOffset> [<ValueField>]
 <VariableGuid>   ::= <CName>
 <ValueField>     ::= <FS> <DefaultValue> [<FS> <HiiAttrs>]
 <VariableOffset> ::= <Number>
-<DefaultValue>   ::= {<Boolean>} {<Number>} {<String>} {<CArray>}
-                     {<MACROVAL>} {<Expression>}
+<DefaultValue>   ::= if (pcddatumtype == "BOOLEAN"):
+                       {<BoolType>} {<Expression>}
+                     elif (pcddatumtype == "UINT8"):
+                       {<NumValUint8>} {<Expression>}
+                     elif (pcddatumtype == "UINT16"):
+                       {<NumValUint16>} {<Expression>}
+                     elif (pcddatumtype == "UINT32"):
+                       {<NumValUint32>} {<Expression>}
+                     elif(pcddatumtype == "UINT64"):
+                       {<NumValUint64>} {<Expression>}
+                     else:
+                       <StringValue>
 <HiiAttrs>       ::= <HiiAttr> [<CS> <HiiAttr>]*
 <HiiAttr>        ::= {"NV"} {"BS"} {"RT"} {"RO"}
 ```
 
 #### Parameters
diff --git a/3_edk_ii_dsc_file_format/311_[components]_sections.md b/3_edk_ii_dsc_file_format/311_[components]_sections.md
index 119d17b..5a3594a 100644
--- a/3_edk_ii_dsc_file_format/311_[components]_sections.md
+++ b/3_edk_ii_dsc_file_format/311_[components]_sections.md
@@ -165,22 +165,25 @@ modules in a binary image (the FDF file describes that ordering).
 <PcdEntries>       ::= {<MacroDefinition>} {<IncludeStatement>}
                        {<TS> <PcdsEntry>}
 <PcdsPatchable>    ::= "<PcdsPatchableInModule>" <EOL>
                        <PcdEntries>*
 <PcdEntry>         ::= <PcdName> [<FS> <PcdValue>] <EOL>
-<PcdValue>         ::= if (pcddatumtype == "BOOLEAN"): {<Boolean>}
-                       {<Expression>} elif (pcddatumtype == "UINT8"):
-                       {<NumValUint8>} {<Expression>} elif (pcddatumtype ==
-                       "UINT16"): {<NumValUint16>} {<Expression>} elif
-                       (pcddatumtype == "UINT32"): {<NumValUint32>}
-                       {<Expression>} elif (pcddatumtype == "UINT64"):
-                       {<NumValUint64>} {<Expression>} else:
-                       <StringVal> [<MaxSize>]
+<PcdValue>         ::= if (pcddatumtype == "BOOLEAN"):
+                         {<BoolType>} {<Expression>}
+                       elif (pcddatumtype == "UINT8"):
+                         {<NumValUint8>} {<Expression>}
+                       elif (pcddatumtype == "UINT16"): 
+                         {<NumValUint16>} {<Expression>}
+                       elif (pcddatumtype == "UINT32"):
+                         {<NumValUint32>} {<Expression>}
+                       elif (pcddatumtype == "UINT64"):
+                         {<NumValUint64>} {<Expression>}
+                       else:
+                         <StringValue> [<MaxSize>]
 <MaxSize>          ::= <FS> "VOID*" [<FS> <SizeValue>]
 <SizeValue>        ::= {<Number>} {<Expression>}
-<StringValue>      ::= {<UnicodeString>} {<CString>} {<CArray>}
-                       {<MACROVAL>}
+<StringValue>      ::= {<StringVal>} {<MACROVAL>} {<Expression>}
 <BuildOptions>     ::= "<BuildOptions>" <EOL>
                        [<DefineStatements>]*
                        [<TS> <ToolFlags>]+
                        [<TS> <ToolPath>]*
                        [<TS> <ToolCmd>]*
diff --git a/3_edk_ii_dsc_file_format/33_platform_dsc_definition.md b/3_edk_ii_dsc_file_format/33_platform_dsc_definition.md
index bfe730c..bbe6b10 100644
--- a/3_edk_ii_dsc_file_format/33_platform_dsc_definition.md
+++ b/3_edk_ii_dsc_file_format/33_platform_dsc_definition.md
@@ -112,15 +112,16 @@ The following are common definitions used by multiple section types.
 <Digit>                ::= (0-9)
 <NonDigit>             ::= (a-zA-Z_)
 <Identifier>           ::= [<NonDigit> <Chars>]*
 <CName>                ::= <Identifier> # A valid C variable name.
 <AsciiChars>           ::= (0x21 - 0x7E)
-<CChars>               ::= [{0x21} {(0x23 - 0x5B)} {(0x5D - 0x7E)}
-                           {<EscapeSequence>}]*
+<CChars>               ::= [{0x21} {(0x23 - 0x26)} {(0x28 - 0x5B)}
+                           {(0x5D - 0x7E)} {<EscapeSequence>}]*
 <DblQuote>             ::= 0x22
+<SglQuote>             ::= 0x27
 <EscapeSequence>       ::= "\" {"n"} {"t"} {"f"} {"r"} {"b"} {"0"} {"\"}
-                           {<DblQuote>}
+                           {<DblQuote>} {<SglQuote>}
 <TabSpace>             ::= {<Tab>} {<Space>}
 <TS>                   ::= <TabSpace>*
 <MTS>                  ::= <TabSpace>+
 <Tab>                  ::= 0x09
 <Space>                ::= 0x20
@@ -138,15 +139,16 @@ The following are common definitions used by multiple section types.
 <AsciiString>          ::= [ <TS>* <AsciiChars>* ]*
 <EmptyString>          ::= <DblQuote><DblQuote>
 <CFlags>               ::= <AsciiString>
 <PrintChars>           ::= {<TS>} {<CChars>}
 <QuotedString>         ::= <DblQuote> <PrintChars>* <DblQuote>
-<CString>              ::= ["L"] <QuotedString>
+<SglQuotedString>      ::= <SglQuote> <PrintChars>* <SglQuote>
+<CString>              ::= {<QuotedString>} {<SglQuotedString>}
 <NormalizedString>     ::= <DblQuote> [{<Word>} {<Space>}]+ <DblQuote>
 <GlobalComment>        ::= <WS> "#" [<AsciiString>] <EOL>+
 <Comment>              ::= "#" <AsciiString> <EOL>+
-<UnicodeString>        ::= "L" <QuotedString>
+<UnicodeString>        ::= "L" {<QuotedString>} {<SglQuotedString>}
 <HexDigit>             ::= (a-fA-F0-9)
 <HexByte>              ::= {"0x"} {"0X"} [<HexDigit>] <HexDigit>
 <HexNumber>            ::= {"0x"} {"0X"} <HexDigit>+
 <HexVersion>           ::= "0x" [0]* <Major> <Minor>
 <Major>                ::= <HexDigit>? <HexDigit>? <HexDigit>?
@@ -184,11 +186,12 @@ The following are common definitions used by multiple section types.
 <HexNz>                ::= (\x1 - \xFFFFFFFFFFFFFFFF)
 <NumNz>                ::= (1-18446744073709551615)
 <GZ>                   ::= {<NumNz>} {<HexNz>}
 <TRUE>                 ::= {"TRUE"} {"true"} {"True"} {"0x1"} {"0x01"} {"1"}
 <FALSE>                ::= {"FALSE"} {"false"} {"False"} {"0x0"} {"0x00"} {"0"}
-<BoolType>             ::= {<TRUE>} {<FALSE>}
+<BoolVal>              ::= {<TRUE>} {<FALSE>}
+<BoolType>             ::= {<BoolVal>} {"{"<BoolVal>"}"}
 <MACRO>                ::= (A-Z)(A-Z0-9_)*
 <MACROVAL>             ::= "$(" <MACRO> ")"
 <PcdName>              ::= <TokenSpaceGuidCName> "." <PcdCName>
 <PcdCName>             ::= <CName>
 <TokenSpaceGuidCName>  ::= <CName>
@@ -210,14 +213,49 @@ The following are common definitions used by multiple section types.
                            <HexDigit>
 <ShortNum>             ::= (0-255)
 <IntNum>               ::= (0-65535)
 <LongNum>              ::= (0-4294967295)
 <LongLongNum>          ::= (0-18446744073709551615)
-<NumValUint8>          ::= {<ShortNum>} {<UINT8>}
-<NumValUint16>         ::= {<IntNum>} {<UINT16>}
-<NumValUint32>         ::= {<LongNum>} {<UINT32>}
-<NumValUint64>         ::= {<LongLongNum>} {<UINT64>}
+<ValUint8>             ::= {<ShortNum>} {<UINT8>} {<BoolVal>}
+                           {<CString>} {<UnicodeString>}
+<ValUint16>            ::= {<IntNum>} {<UINT16>} {<BoolVal>}
+                           {<CString>} {<UnicodeString>}
+<ValUint32>            ::= {<LongNum>} {<UINT32>} {<BoolVal>}
+                           {<CString>} {<UnicodeString>}
+<ValUint64>            ::= {<LongLongNum>} {<UINT64>} {<BoolVal>}
+                           {<CString>} {<UnicodeString>}
+<NumValUint8>          ::= {<ValUint8>} {"{"<ValUint8>"}"}
+<NumValUint16>         ::= {<ValUint16>}
+                           {"{"<ValUint8> [<CommaSpace> <ValUint8>]*"}"}
+<NumValUint32>         ::= {<ValUint32>}
+                           {"{"<ValUint8> [<CommaSpace> <ValUint8>]*"}"}
+<NumValUint64>         ::= {<ValUint64>}
+                           {"{"<ValUint8> [<CommaSpace> <ValUint8>]*"}"}
+<StringVal>            ::= {<UnicodeString>} {<CString>} {<Array>}
+<Array>                ::= "{" {<Array>} {[<Lable>] <ArrayVal>
+                           [<CommaSpace> [<Lable>] <ArrayVal>]* } "}"
+<ArrayVal>             ::= {<Num8Array>} {<GuidStr>} {<DevicePath>}
+<NonNumType>           ::= {<BoolVal>} {<UnicodeString>} {<CString>}
+                           {<Offset>} {<UintMac>}
+<GuidStr>              ::= "GUID(" <GuidVal> ")"
+<GuidVal>              ::= {<DblQuote> <RegistryFormatGUID> <DblQuote>}
+                           {<CFormatGUID>} {<CName>}
+<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
+<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> ")"
+<Lable>                ::= "LABEL(" <CName> ")"
+<Offset>               ::= "OFFSET_OF(" <CName> ")"
 <ModuleType>           ::= {"BASE"} {"SEC"} {"PEI_CORE"} {"PEIM"}
                            {"DXE_CORE"} {"DXE_DRIVER"} {"SMM_CORE"}
                            {"DXE_RUNTIME_DRIVER"} {"DXE_SAL_DRIVER"}
                            {"DXE_SMM_DRIVER"} {"UEFI_DRIVER"}
                            {"UEFI_APPLICATION"} {"USER_DEFINED"}
@@ -244,10 +282,18 @@ The following are common definitions used by multiple section types.
                            {"SMM_CORE"} {"DXE_SMM_DRIVER"}
                            {"UEFI_DRIVER"} {"UEFI_APPLICATION"}
 ```
 
 **********
+**Note:** When using CString, UnicodeString or byte array format as
+UINT8/UINT16/UINT32/UINT64 values, please make sure they fit in the
+target type's size, otherwise tool would report failure.
+**********
+**Note:** 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.
+**********
 **Note:** When using the characters "|" or "||" in an expression, the
 expression must be encapsulated in open "(" and close ")" parenthesis.
 **********
 **Note:** Comments may appear anywhere within a DSC file, provided they follow
 the rules that a comment may not be enclosed within Section headers, and that
@@ -265,16 +311,16 @@ chain tag names that are being built. Refer to the EDK II Expression Syntax
 Specification for additional information.
 
 **_UnicodeString_**
 
 When the `<UnicodeString>` element (these characters are string literals as
-defined by the C99 specification: L"string", not actual Unicode characters) is
-included in a value, the build tools may be required to expand the ASCII string
-between the quotation marks into a valid UCS-2 character string. The build
-tools parser must treat all content between the field separators (excluding
-white space characters around the field separators) as ASCII literal content
-when generating the AutoGen.c and AutoGen.h files.
+defined by the C99 specification: L"string"/L'string', not actual Unicode
+characters) is included in a value, the build tools may be required to expand
+the ASCII string between the quotation marks into a valid UCS-2 character string.
+The build tools parser must treat all content between the field separators
+(excluding white space characters around the field separators) as ASCII literal
+content when generating the AutoGen.c and AutoGen.h files.
 
 **_Comments_**
 
 Strings that appear in comments may be ignored by the build tools. An ASCII
 string matching the format of the ASCII string defined by `<UnicodeString>`
-- 
2.6.1.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch V3] DSC spec: Add flexible PCD value format into spec
Posted by Gao, Liming 6 years, 1 month ago
Reviewed-by: Liming Gao <liming.gao@intel.com>

>-----Original Message-----
>From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>Yonghong Zhu
>Sent: Monday, February 26, 2018 4:05 PM
>To: edk2-devel@lists.01.org
>Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Shaw, Kevin W
><kevin.w.shaw@intel.com>; Gao, Liming <liming.gao@intel.com>
>Subject: [edk2] [Patch V3] DSC spec: Add flexible PCD value format into spec
>
>V3: Update the Pcd value format in [Components] section
>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>
>---
> 3_edk_ii_dsc_file_format/310_pcd_sections.md       | 160 +++++++++++++---
>-----
> .../311_[components]_sections.md                   |  23 +--
> .../33_platform_dsc_definition.md                  |  78 +++++++---
> 3 files changed, 174 insertions(+), 87 deletions(-)
>
>diff --git a/3_edk_ii_dsc_file_format/310_pcd_sections.md
>b/3_edk_ii_dsc_file_format/310_pcd_sections.md
>index 2af42cc..18a243d 100644
>--- a/3_edk_ii_dsc_file_format/310_pcd_sections.md
>+++ b/3_edk_ii_dsc_file_format/310_pcd_sections.md
>@@ -98,13 +98,11 @@ is permissible to list multiple architectures in a single
>method section as in:
> It is permissible to list a PCD in a common architecture section and also list
> it in an architecturally modified section. In this case, the value in the
> architectural section overrides the value specified in the common section.
>
> The PCD values must match the datum type declared for a given PCD in the
>DEC
>-file. While a PCD of datum type `BOOLEAN` is permitted to have a `1` or a `0`
>-(instead of TRUE or FALSE) in the value field, a PCD of type UINT* cannot use
>-`TRUE` or `FALSE` for values.
>+file.
>
> PCDs with a data type of `VOID`* can optionally provide the maximum size of
>the
> value. If not provided, the maximum length will be calculated as the largest of
> the size of the data in the DSC file, the size of the data in the INF file or
> the size of the data in the DEC file that declares the PCD.
>@@ -220,21 +218,24 @@ fields that are separated by the pipe character, "|".
> <SkuIdS>        ::= <Keyword> [<FS> <Keyword>]*
> <Keyword>       ::= <UiName>
> <UiName>        ::= <Word>
> <FabStatements> ::= {<MacroDefinition>} {<IncludeStatement>} {<PcdEntry>}
> <PcdEntry>      ::= <TS> <PcdName> [<FS> <PcdValue>] <EOL>
>-<PcdValue>      ::= if (pcddatumtype == "BOOLEAN"): {<Boolean>}
>{<Expression>}
>-                    elif (pcddatumtype == "UINT8"): {<NumValUint8>}
>-                    {<Expression>} elif (pcddatumtype == "UINT16"):
>-                    {<NumValUint16>} {<Expression>} elif (pcddatumtype ==
>-                    "UINT32"): {<NumValUint32>} {<Expression>} elif
>-                    (pcddatumtype == "UINT64"): {<NumValUint64>} {<Expression>}
>+<PcdValue>      ::= if (pcddatumtype == "BOOLEAN"):
>+                      {<BoolType>} {<Expression>}
>+                    elif (pcddatumtype == "UINT8"):
>+                      {<NumValUint8>} {<Expression>}
>+                    elif (pcddatumtype == "UINT16"):
>+                      {<NumValUint16>} {<Expression>}
>+                    elif (pcddatumtype == "UINT32"):
>+                      {<NumValUint32>} {<Expression>}
>+                    elif (pcddatumtype == "UINT64"):
>+                      {<NumValUint64>} {<Expression>}
>                     else:
>-                    <StringValue> [<MaxSize>]
>+                      <StringValue> [<MaxSize>]
> <MaxSize>       ::= <FS> "VOID*" <FS> {<Number>} {<Expression>}
>-<StringValue>   ::= {<UnicodeString>} {<CString>} {<CArray>}
>-                    {<MACROVAL>} {<Expression>}
>+<StringValue>   ::= {<StringVal>} {<MACROVAL>} {<Expression>}
> ```
>
> #### Parameters
>
> **_Expression_**
>@@ -325,21 +326,24 @@ of the DSC file.
> <SkuIdS>        ::= <Keyword> [<FS> <Keyword>]*
> <Keyword>       ::= <UiName>
> <UiName>        ::= <Word>
> <PimStatements> ::= {<MacroDefinition>} {<IncludeStatement>}
>{<PcdEntry>}
> <PcdEntry>      ::= <TS> <PcdName> [<FS> <PcdValue>] <EOL>
>-<PcdValue>      ::= if (pcddatumtype == "BOOLEAN"): {<Boolean>}
>{<Expression>}
>-                    elif (pcddatumtype == "UINT8"): {<NumValUint8>}
>-                    {<Expression>} elif (pcddatumtype == "UINT16"):
>-                    {<NumValUint16>} {<Expression>} elif (pcddatumtype ==
>-                    "UINT32"): {<NumValUint32>} {<Expression>} elif
>-                    (pcddatumtype == "UINT64"): {<NumValUint64>} {<Expression>}
>+<PcdValue>      ::= if (pcddatumtype == "BOOLEAN"):
>+                      {<BoolType>} {<Expression>}
>+                    elif (pcddatumtype == "UINT8"):
>+                      {<NumValUint8>} {<Expression>}
>+                    elif (pcddatumtype == "UINT16"):
>+                      {<NumValUint16>} {<Expression>}
>+                    elif (pcddatumtype == "UINT32"):
>+                      {<NumValUint32>} {<Expression>}
>+                    elif (pcddatumtype == "UINT64"):
>+                      {<NumValUint64>} {<Expression>}
>                     else:
>-                    <StringValue> [<MaxSize>]
>+                      <StringValue> [<MaxSize>]
> <MaxSize>       ::= <FS> {<Number>} {<Expression>}
>-<StringValue>   ::= {<UnicodeString>} {<CString>} {<CArray>}
>-                    {<MACROVAL>} {<Expression>}
>+<StringValue>   ::= {<StringVal>} {<MACROVAL>} {<Expression>}
> ```
>
> #### Parameters
>
> **_Expression_**
>@@ -458,41 +462,58 @@ sections of the DSC file.
> <attrs>          ::= "." <arch> ["." <SkuIds>]
> <SkuIdS>         ::= <Keyword> [<FS> <Keyword>]*
> <Keyword>        ::= <UiName>
> <UiName>         ::= <Word>
> <MinEntry>       ::= <PcdName> [<FS> <PcdValue>] <EOL>
>-<PcdValue>       ::= if (pcddatumtype == "BOOLEAN"): {<Boolean>}
>{<Expression>}
>-                     elif (pcddatumtype == "UINT8"): {<NumValUint8>}
>-                     {<Expression>} elif (pcddatumtype == "UINT16"):
>-                     {<NumValUint16>} {<Expression>} elif (pcddatumtype ==
>-                     "UINT32"): {<NumValUint32>} {<Expression>} elif
>-                     (pcddatumtype == "UINT64"): {<NumValUint64>}
>-                     {<Expression>} else:
>-                     <StringValue> [<MaxSize>]
>+<PcdValue>       ::= if (pcddatumtype == "BOOLEAN"):
>+                       {<BoolType>} {<Expression>}
>+                     elif (pcddatumtype == "UINT8"):
>+                       {<NumValUint8>} {<Expression>}
>+                     elif (pcddatumtype == "UINT16"):
>+                       {<NumValUint16>} {<Expression>}
>+                     elif (pcddatumtype == "UINT32"):
>+                       {<NumValUint32>} {<Expression>}
>+                     elif (pcddatumtype == "UINT64"):
>+                       {<NumValUint64>} {<Expression>}
>+                     else:
>+                       <StringValue> [<MaxSize>]
> <MaxSize>        ::= <FS> "VOID*" [<FS> <SizeValue>]
> <SizeValue>      ::= {<Number>} {<Expression>}
>-<StringValue>    ::= {<UnicodeString>} {<CString>} {<CArray>} {<MACROVAL>}
>-                     {<Expression>}
>+<StringValue>    ::= {<StringVal>} {<MACROVAL>} {<Expression>}
> <VpdEntry>       ::= <PcdName> <FS> <VpdOffset> [<FS> <VpdData>] <EOL>
> <VpdOffset>      ::= {<Number>} {"*"}
>-<VpdData>        ::= if (pcddatumtype == "BOOLEAN"): {<Boolean>}
>{<Expression>}
>-                     elif (pcddatumtype == "UINT8"): {<NumValUint8>}
>-                     {<Expression>} elif (pcddatumtype == "UINT16"):
>-                     {<NumValUint16>} {<Expression>} elif (pcddatumtype ==
>-                     "UINT32"): {<NumValUint32>} {<Expression>} elif
>-                     (pcddatumtype == "UINT64"): {<NumValUint64>}
>-                     {<Expression>} else:
>-                     <VpdMaxSize>
>+<VpdData>        ::= if (pcddatumtype == "BOOLEAN"):
>+                       {<BoolType>} {<Expression>}
>+                     elif (pcddatumtype == "UINT8"):
>+                       {<NumValUint8>} {<Expression>}
>+                     elif (pcddatumtype == "UINT16"):
>+                       {<NumValUint16>} {<Expression>}
>+                     elif (pcddatumtype == "UINT32"):
>+                       {<NumValUint32>} {<Expression>}
>+                     elif(pcddatumtype == "UINT64"):
>+                       {<NumValUint64>} {<Expression>}
>+                     else:
>+                       <VpdMaxSize>
> <VpdMaxSize>     ::= <NumValUint32> [<FS> <StringValue>]
> <HiiEntry>       ::= <PcdName> <FS> <HiiString> <Field2> <EOL>
> <HiiString>      ::= {<CArray>} {<UnicodeString>}
> <Field2>         ::= <FS> <VariableGuid> <FS> <VariableOffset> [<ValueField>]
> <VariableGuid>   ::= <CName>
> <ValueField>     ::= <FS> <DefaultValue> [<FS> <HiiAttrs>]
> <VariableOffset> ::= <Number>
>-<DefaultValue>   ::= {<Boolean>} {<Number>} {<String>} {<CArray>}
>-                     {<MACROVAL>} {<Expression>}
>+<DefaultValue>   ::= if (pcddatumtype == "BOOLEAN"):
>+                       {<BoolType>} {<Expression>}
>+                     elif (pcddatumtype == "UINT8"):
>+                       {<NumValUint8>} {<Expression>}
>+                     elif (pcddatumtype == "UINT16"):
>+                       {<NumValUint16>} {<Expression>}
>+                     elif (pcddatumtype == "UINT32"):
>+                       {<NumValUint32>} {<Expression>}
>+                     elif (pcddatumtype == "UINT64"):
>+                       {<NumValUint64>} {<Expression>}
>+                     else:
>+                       <StringValue>
> <HiiAttrs>       ::= <HiiAttr> [<CS> <HiiAttr>]*
> <HiiAttr>        ::= {"NV"} {"BS"} {"RT"} {"RO"}
> ```
>
> #### Parameters
>@@ -618,41 +639,58 @@ sections of the DSC file.
> <attrs>          ::= "." <arch> ["." <SkuIds>]
> <SkuIdS>         ::= <Keyword> [<FS> <Keyword>]*
> <Keyword>        ::= <UiName>
> <UiName>         ::= <Word>
> <MinEntry>       ::= <PcdName> [<FS> <PcdValue>] <EOL>
>-<PcdValue>       ::= if (pcddatumtype == "BOOLEAN"): {<Boolean>}
>{<Expression>}
>-                     elif (pcddatumtype == "UINT8"): {<NumValUint8>}
>-                     {<Expression>} elif (pcddatumtype == "UINT16"):
>-                     {<NumValUint16>} {<Expression>} elif (pcddatumtype ==
>-                     "UINT32"): {<NumValUint32>} {<Expression>} elif
>-                     (pcddatumtype == "UINT64"): {<NumValUint64>}
>-                     {<Expression>} else:
>-                     <StringValue> [<MaxSize>]
>+<PcdValue>       ::= if (pcddatumtype == "BOOLEAN"):
>+                       {<BoolType>} {<Expression>}
>+                     elif (pcddatumtype == "UINT8"):
>+                       {<NumValUint8>} {<Expression>}
>+                     elif (pcddatumtype == "UINT16"):
>+                       {<NumValUint16>} {<Expression>}
>+                     elif (pcddatumtype == "UINT32"):
>+                       {<NumValUint32>} {<Expression>}
>+                     elif (pcddatumtype == "UINT64"):
>+                       {<NumValUint64>} {<Expression>}
>+                     else:
>+                       <StringValue> [<MaxSize>]
> <MaxSize>        ::= <FS> "VOID*" [<FS> <SizeValue>]
> <SizeValue>      ::= {<Number>} {<Expression>}
>-<StringValue>    ::= {<UnicodeString>} {<CString>} {<CArray>} {<MACROVAL>}
>-                     {<Expression>}
>+<StringValue>    ::= {<StringVal>} {<MACROVAL>} {<Expression>}
> <VpdEntry>       ::= <PcdName> <FS> <VpdOffset> [<FS> <VpdData>] <EOL>
> <VpdOffset>      ::= {<Number>} {"*"}
>-<VpdData>        ::= if (pcddatumtype == "BOOLEAN"): {<Boolean>}
>{<Expression>}
>-                     elif (pcddatumtype == "UINT8"): {<NumValUint8>}
>-                     {<Expression>} elif (pcddatumtype == "UINT16"):
>-                     {<NumValUint16>} {<Expression>} elif (pcddatumtype ==
>-                     "UINT32"): {<NumValUint32>} {<Expression>} elif
>-                     (pcddatumtype == "UINT64"): {<NumValUint64>}
>-                     {<Expression>} else:
>-                     <VpdMaxSize>
>+<VpdData>        ::= if (pcddatumtype == "BOOLEAN"):
>+                       {<BoolType>} {<Expression>}
>+                     elif (pcddatumtype == "UINT8"):
>+                       {<NumValUint8>} {<Expression>}
>+                     elif (pcddatumtype == "UINT16"):
>+                       {<NumValUint16>} {<Expression>}
>+                     elif (pcddatumtype == "UINT32"):
>+                       {<NumValUint32>} {<Expression>}
>+                     elif (pcddatumtype == "UINT64"):
>+                       {<NumValUint64>} {<Expression>}
>+                     else:
>+                       <VpdMaxSize>
> <VpdMaxSize>     ::= <NumValUint32> [<FS> <StringValue>]
> <HiiEntry>       ::= <PcdName> <FS> <HiiString> <Field2> <EOL>
> <HiiString>      ::= {<CArray>} {<UnicodeString>}
> <Field2>         ::= <FS> <VariableGuid> <FS> <VariableOffset> [<ValueField>]
> <VariableGuid>   ::= <CName>
> <ValueField>     ::= <FS> <DefaultValue> [<FS> <HiiAttrs>]
> <VariableOffset> ::= <Number>
>-<DefaultValue>   ::= {<Boolean>} {<Number>} {<String>} {<CArray>}
>-                     {<MACROVAL>} {<Expression>}
>+<DefaultValue>   ::= if (pcddatumtype == "BOOLEAN"):
>+                       {<BoolType>} {<Expression>}
>+                     elif (pcddatumtype == "UINT8"):
>+                       {<NumValUint8>} {<Expression>}
>+                     elif (pcddatumtype == "UINT16"):
>+                       {<NumValUint16>} {<Expression>}
>+                     elif (pcddatumtype == "UINT32"):
>+                       {<NumValUint32>} {<Expression>}
>+                     elif(pcddatumtype == "UINT64"):
>+                       {<NumValUint64>} {<Expression>}
>+                     else:
>+                       <StringValue>
> <HiiAttrs>       ::= <HiiAttr> [<CS> <HiiAttr>]*
> <HiiAttr>        ::= {"NV"} {"BS"} {"RT"} {"RO"}
> ```
>
> #### Parameters
>diff --git a/3_edk_ii_dsc_file_format/311_[components]_sections.md
>b/3_edk_ii_dsc_file_format/311_[components]_sections.md
>index 119d17b..5a3594a 100644
>--- a/3_edk_ii_dsc_file_format/311_[components]_sections.md
>+++ b/3_edk_ii_dsc_file_format/311_[components]_sections.md
>@@ -165,22 +165,25 @@ modules in a binary image (the FDF file describes
>that ordering).
> <PcdEntries>       ::= {<MacroDefinition>} {<IncludeStatement>}
>                        {<TS> <PcdsEntry>}
> <PcdsPatchable>    ::= "<PcdsPatchableInModule>" <EOL>
>                        <PcdEntries>*
> <PcdEntry>         ::= <PcdName> [<FS> <PcdValue>] <EOL>
>-<PcdValue>         ::= if (pcddatumtype == "BOOLEAN"): {<Boolean>}
>-                       {<Expression>} elif (pcddatumtype == "UINT8"):
>-                       {<NumValUint8>} {<Expression>} elif (pcddatumtype ==
>-                       "UINT16"): {<NumValUint16>} {<Expression>} elif
>-                       (pcddatumtype == "UINT32"): {<NumValUint32>}
>-                       {<Expression>} elif (pcddatumtype == "UINT64"):
>-                       {<NumValUint64>} {<Expression>} else:
>-                       <StringVal> [<MaxSize>]
>+<PcdValue>         ::= if (pcddatumtype == "BOOLEAN"):
>+                         {<BoolType>} {<Expression>}
>+                       elif (pcddatumtype == "UINT8"):
>+                         {<NumValUint8>} {<Expression>}
>+                       elif (pcddatumtype == "UINT16"):
>+                         {<NumValUint16>} {<Expression>}
>+                       elif (pcddatumtype == "UINT32"):
>+                         {<NumValUint32>} {<Expression>}
>+                       elif (pcddatumtype == "UINT64"):
>+                         {<NumValUint64>} {<Expression>}
>+                       else:
>+                         <StringValue> [<MaxSize>]
> <MaxSize>          ::= <FS> "VOID*" [<FS> <SizeValue>]
> <SizeValue>        ::= {<Number>} {<Expression>}
>-<StringValue>      ::= {<UnicodeString>} {<CString>} {<CArray>}
>-                       {<MACROVAL>}
>+<StringValue>      ::= {<StringVal>} {<MACROVAL>} {<Expression>}
> <BuildOptions>     ::= "<BuildOptions>" <EOL>
>                        [<DefineStatements>]*
>                        [<TS> <ToolFlags>]+
>                        [<TS> <ToolPath>]*
>                        [<TS> <ToolCmd>]*
>diff --git a/3_edk_ii_dsc_file_format/33_platform_dsc_definition.md
>b/3_edk_ii_dsc_file_format/33_platform_dsc_definition.md
>index bfe730c..bbe6b10 100644
>--- a/3_edk_ii_dsc_file_format/33_platform_dsc_definition.md
>+++ b/3_edk_ii_dsc_file_format/33_platform_dsc_definition.md
>@@ -112,15 +112,16 @@ The following are common definitions used by
>multiple section types.
> <Digit>                ::= (0-9)
> <NonDigit>             ::= (a-zA-Z_)
> <Identifier>           ::= [<NonDigit> <Chars>]*
> <CName>                ::= <Identifier> # A valid C variable name.
> <AsciiChars>           ::= (0x21 - 0x7E)
>-<CChars>               ::= [{0x21} {(0x23 - 0x5B)} {(0x5D - 0x7E)}
>-                           {<EscapeSequence>}]*
>+<CChars>               ::= [{0x21} {(0x23 - 0x26)} {(0x28 - 0x5B)}
>+                           {(0x5D - 0x7E)} {<EscapeSequence>}]*
> <DblQuote>             ::= 0x22
>+<SglQuote>             ::= 0x27
> <EscapeSequence>       ::= "\" {"n"} {"t"} {"f"} {"r"} {"b"} {"0"} {"\"}
>-                           {<DblQuote>}
>+                           {<DblQuote>} {<SglQuote>}
> <TabSpace>             ::= {<Tab>} {<Space>}
> <TS>                   ::= <TabSpace>*
> <MTS>                  ::= <TabSpace>+
> <Tab>                  ::= 0x09
> <Space>                ::= 0x20
>@@ -138,15 +139,16 @@ The following are common definitions used by
>multiple section types.
> <AsciiString>          ::= [ <TS>* <AsciiChars>* ]*
> <EmptyString>          ::= <DblQuote><DblQuote>
> <CFlags>               ::= <AsciiString>
> <PrintChars>           ::= {<TS>} {<CChars>}
> <QuotedString>         ::= <DblQuote> <PrintChars>* <DblQuote>
>-<CString>              ::= ["L"] <QuotedString>
>+<SglQuotedString>      ::= <SglQuote> <PrintChars>* <SglQuote>
>+<CString>              ::= {<QuotedString>} {<SglQuotedString>}
> <NormalizedString>     ::= <DblQuote> [{<Word>} {<Space>}]+ <DblQuote>
> <GlobalComment>        ::= <WS> "#" [<AsciiString>] <EOL>+
> <Comment>              ::= "#" <AsciiString> <EOL>+
>-<UnicodeString>        ::= "L" <QuotedString>
>+<UnicodeString>        ::= "L" {<QuotedString>} {<SglQuotedString>}
> <HexDigit>             ::= (a-fA-F0-9)
> <HexByte>              ::= {"0x"} {"0X"} [<HexDigit>] <HexDigit>
> <HexNumber>            ::= {"0x"} {"0X"} <HexDigit>+
> <HexVersion>           ::= "0x" [0]* <Major> <Minor>
> <Major>                ::= <HexDigit>? <HexDigit>? <HexDigit>?
>@@ -184,11 +186,12 @@ The following are common definitions used by
>multiple section types.
> <HexNz>                ::= (\x1 - \xFFFFFFFFFFFFFFFF)
> <NumNz>                ::= (1-18446744073709551615)
> <GZ>                   ::= {<NumNz>} {<HexNz>}
> <TRUE>                 ::= {"TRUE"} {"true"} {"True"} {"0x1"} {"0x01"} {"1"}
> <FALSE>                ::= {"FALSE"} {"false"} {"False"} {"0x0"} {"0x00"} {"0"}
>-<BoolType>             ::= {<TRUE>} {<FALSE>}
>+<BoolVal>              ::= {<TRUE>} {<FALSE>}
>+<BoolType>             ::= {<BoolVal>} {"{"<BoolVal>"}"}
> <MACRO>                ::= (A-Z)(A-Z0-9_)*
> <MACROVAL>             ::= "$(" <MACRO> ")"
> <PcdName>              ::= <TokenSpaceGuidCName> "." <PcdCName>
> <PcdCName>             ::= <CName>
> <TokenSpaceGuidCName>  ::= <CName>
>@@ -210,14 +213,49 @@ The following are common definitions used by
>multiple section types.
>                            <HexDigit>
> <ShortNum>             ::= (0-255)
> <IntNum>               ::= (0-65535)
> <LongNum>              ::= (0-4294967295)
> <LongLongNum>          ::= (0-18446744073709551615)
>-<NumValUint8>          ::= {<ShortNum>} {<UINT8>}
>-<NumValUint16>         ::= {<IntNum>} {<UINT16>}
>-<NumValUint32>         ::= {<LongNum>} {<UINT32>}
>-<NumValUint64>         ::= {<LongLongNum>} {<UINT64>}
>+<ValUint8>             ::= {<ShortNum>} {<UINT8>} {<BoolVal>}
>+                           {<CString>} {<UnicodeString>}
>+<ValUint16>            ::= {<IntNum>} {<UINT16>} {<BoolVal>}
>+                           {<CString>} {<UnicodeString>}
>+<ValUint32>            ::= {<LongNum>} {<UINT32>} {<BoolVal>}
>+                           {<CString>} {<UnicodeString>}
>+<ValUint64>            ::= {<LongLongNum>} {<UINT64>} {<BoolVal>}
>+                           {<CString>} {<UnicodeString>}
>+<NumValUint8>          ::= {<ValUint8>} {"{"<ValUint8>"}"}
>+<NumValUint16>         ::= {<ValUint16>}
>+                           {"{"<ValUint8> [<CommaSpace> <ValUint8>]*"}"}
>+<NumValUint32>         ::= {<ValUint32>}
>+                           {"{"<ValUint8> [<CommaSpace> <ValUint8>]*"}"}
>+<NumValUint64>         ::= {<ValUint64>}
>+                           {"{"<ValUint8> [<CommaSpace> <ValUint8>]*"}"}
>+<StringVal>            ::= {<UnicodeString>} {<CString>} {<Array>}
>+<Array>                ::= "{" {<Array>} {[<Lable>] <ArrayVal>
>+                           [<CommaSpace> [<Lable>] <ArrayVal>]* } "}"
>+<ArrayVal>             ::= {<Num8Array>} {<GuidStr>} {<DevicePath>}
>+<NonNumType>           ::= {<BoolVal>} {<UnicodeString>} {<CString>}
>+                           {<Offset>} {<UintMac>}
>+<GuidStr>              ::= "GUID(" <GuidVal> ")"
>+<GuidVal>              ::= {<DblQuote> <RegistryFormatGUID> <DblQuote>}
>+                           {<CFormatGUID>} {<CName>}
>+<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
>+<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> ")"
>+<Lable>                ::= "LABEL(" <CName> ")"
>+<Offset>               ::= "OFFSET_OF(" <CName> ")"
> <ModuleType>           ::= {"BASE"} {"SEC"} {"PEI_CORE"} {"PEIM"}
>                            {"DXE_CORE"} {"DXE_DRIVER"} {"SMM_CORE"}
>                            {"DXE_RUNTIME_DRIVER"} {"DXE_SAL_DRIVER"}
>                            {"DXE_SMM_DRIVER"} {"UEFI_DRIVER"}
>                            {"UEFI_APPLICATION"} {"USER_DEFINED"}
>@@ -244,10 +282,18 @@ The following are common definitions used by
>multiple section types.
>                            {"SMM_CORE"} {"DXE_SMM_DRIVER"}
>                            {"UEFI_DRIVER"} {"UEFI_APPLICATION"}
> ```
>
> **********
>+**Note:** When using CString, UnicodeString or byte array format as
>+UINT8/UINT16/UINT32/UINT64 values, please make sure they fit in the
>+target type's size, otherwise tool would report failure.
>+**********
>+**Note:** 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.
>+**********
> **Note:** When using the characters "|" or "||" in an expression, the
> expression must be encapsulated in open "(" and close ")" parenthesis.
> **********
> **Note:** Comments may appear anywhere within a DSC file, provided they
>follow
> the rules that a comment may not be enclosed within Section headers, and
>that
>@@ -265,16 +311,16 @@ chain tag names that are being built. Refer to the
>EDK II Expression Syntax
> Specification for additional information.
>
> **_UnicodeString_**
>
> When the `<UnicodeString>` element (these characters are string literals as
>-defined by the C99 specification: L"string", not actual Unicode characters) is
>-included in a value, the build tools may be required to expand the ASCII string
>-between the quotation marks into a valid UCS-2 character string. The build
>-tools parser must treat all content between the field separators (excluding
>-white space characters around the field separators) as ASCII literal content
>-when generating the AutoGen.c and AutoGen.h files.
>+defined by the C99 specification: L"string"/L'string', not actual Unicode
>+characters) is included in a value, the build tools may be required to expand
>+the ASCII string between the quotation marks into a valid UCS-2 character
>string.
>+The build tools parser must treat all content between the field separators
>+(excluding white space characters around the field separators) as ASCII literal
>+content when generating the AutoGen.c and AutoGen.h files.
>
> **_Comments_**
>
> Strings that appear in comments may be ignored by the build tools. An ASCII
> string matching the format of the ASCII string defined by `<UnicodeString>`
>--
>2.6.1.windows.1
>
>_______________________________________________
>edk2-devel mailing list
>edk2-devel@lists.01.org
>https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch V3] DSC spec: Add flexible PCD value format into spec
Posted by Gao, Liming 6 years, 1 month ago
Reviewed-by: Liming Gao <liming.gao@intel.com>

>-----Original Message-----
>From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>Yonghong Zhu
>Sent: Monday, February 26, 2018 4:05 PM
>To: edk2-devel@lists.01.org
>Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Shaw, Kevin W
><kevin.w.shaw@intel.com>; Gao, Liming <liming.gao@intel.com>
>Subject: [edk2] [Patch V3] DSC spec: Add flexible PCD value format into spec
>
>V3: Update the Pcd value format in [Components] section
>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>
>---
> 3_edk_ii_dsc_file_format/310_pcd_sections.md       | 160 +++++++++++++---
>-----
> .../311_[components]_sections.md                   |  23 +--
> .../33_platform_dsc_definition.md                  |  78 +++++++---
> 3 files changed, 174 insertions(+), 87 deletions(-)
>
>diff --git a/3_edk_ii_dsc_file_format/310_pcd_sections.md
>b/3_edk_ii_dsc_file_format/310_pcd_sections.md
>index 2af42cc..18a243d 100644
>--- a/3_edk_ii_dsc_file_format/310_pcd_sections.md
>+++ b/3_edk_ii_dsc_file_format/310_pcd_sections.md
>@@ -98,13 +98,11 @@ is permissible to list multiple architectures in a single
>method section as in:
> It is permissible to list a PCD in a common architecture section and also list
> it in an architecturally modified section. In this case, the value in the
> architectural section overrides the value specified in the common section.
>
> The PCD values must match the datum type declared for a given PCD in the
>DEC
>-file. While a PCD of datum type `BOOLEAN` is permitted to have a `1` or a `0`
>-(instead of TRUE or FALSE) in the value field, a PCD of type UINT* cannot use
>-`TRUE` or `FALSE` for values.
>+file.
>
> PCDs with a data type of `VOID`* can optionally provide the maximum size of
>the
> value. If not provided, the maximum length will be calculated as the largest of
> the size of the data in the DSC file, the size of the data in the INF file or
> the size of the data in the DEC file that declares the PCD.
>@@ -220,21 +218,24 @@ fields that are separated by the pipe character, "|".
> <SkuIdS>        ::= <Keyword> [<FS> <Keyword>]*
> <Keyword>       ::= <UiName>
> <UiName>        ::= <Word>
> <FabStatements> ::= {<MacroDefinition>} {<IncludeStatement>} {<PcdEntry>}
> <PcdEntry>      ::= <TS> <PcdName> [<FS> <PcdValue>] <EOL>
>-<PcdValue>      ::= if (pcddatumtype == "BOOLEAN"): {<Boolean>}
>{<Expression>}
>-                    elif (pcddatumtype == "UINT8"): {<NumValUint8>}
>-                    {<Expression>} elif (pcddatumtype == "UINT16"):
>-                    {<NumValUint16>} {<Expression>} elif (pcddatumtype ==
>-                    "UINT32"): {<NumValUint32>} {<Expression>} elif
>-                    (pcddatumtype == "UINT64"): {<NumValUint64>} {<Expression>}
>+<PcdValue>      ::= if (pcddatumtype == "BOOLEAN"):
>+                      {<BoolType>} {<Expression>}
>+                    elif (pcddatumtype == "UINT8"):
>+                      {<NumValUint8>} {<Expression>}
>+                    elif (pcddatumtype == "UINT16"):
>+                      {<NumValUint16>} {<Expression>}
>+                    elif (pcddatumtype == "UINT32"):
>+                      {<NumValUint32>} {<Expression>}
>+                    elif (pcddatumtype == "UINT64"):
>+                      {<NumValUint64>} {<Expression>}
>                     else:
>-                    <StringValue> [<MaxSize>]
>+                      <StringValue> [<MaxSize>]
> <MaxSize>       ::= <FS> "VOID*" <FS> {<Number>} {<Expression>}
>-<StringValue>   ::= {<UnicodeString>} {<CString>} {<CArray>}
>-                    {<MACROVAL>} {<Expression>}
>+<StringValue>   ::= {<StringVal>} {<MACROVAL>} {<Expression>}
> ```
>
> #### Parameters
>
> **_Expression_**
>@@ -325,21 +326,24 @@ of the DSC file.
> <SkuIdS>        ::= <Keyword> [<FS> <Keyword>]*
> <Keyword>       ::= <UiName>
> <UiName>        ::= <Word>
> <PimStatements> ::= {<MacroDefinition>} {<IncludeStatement>}
>{<PcdEntry>}
> <PcdEntry>      ::= <TS> <PcdName> [<FS> <PcdValue>] <EOL>
>-<PcdValue>      ::= if (pcddatumtype == "BOOLEAN"): {<Boolean>}
>{<Expression>}
>-                    elif (pcddatumtype == "UINT8"): {<NumValUint8>}
>-                    {<Expression>} elif (pcddatumtype == "UINT16"):
>-                    {<NumValUint16>} {<Expression>} elif (pcddatumtype ==
>-                    "UINT32"): {<NumValUint32>} {<Expression>} elif
>-                    (pcddatumtype == "UINT64"): {<NumValUint64>} {<Expression>}
>+<PcdValue>      ::= if (pcddatumtype == "BOOLEAN"):
>+                      {<BoolType>} {<Expression>}
>+                    elif (pcddatumtype == "UINT8"):
>+                      {<NumValUint8>} {<Expression>}
>+                    elif (pcddatumtype == "UINT16"):
>+                      {<NumValUint16>} {<Expression>}
>+                    elif (pcddatumtype == "UINT32"):
>+                      {<NumValUint32>} {<Expression>}
>+                    elif (pcddatumtype == "UINT64"):
>+                      {<NumValUint64>} {<Expression>}
>                     else:
>-                    <StringValue> [<MaxSize>]
>+                      <StringValue> [<MaxSize>]
> <MaxSize>       ::= <FS> {<Number>} {<Expression>}
>-<StringValue>   ::= {<UnicodeString>} {<CString>} {<CArray>}
>-                    {<MACROVAL>} {<Expression>}
>+<StringValue>   ::= {<StringVal>} {<MACROVAL>} {<Expression>}
> ```
>
> #### Parameters
>
> **_Expression_**
>@@ -458,41 +462,58 @@ sections of the DSC file.
> <attrs>          ::= "." <arch> ["." <SkuIds>]
> <SkuIdS>         ::= <Keyword> [<FS> <Keyword>]*
> <Keyword>        ::= <UiName>
> <UiName>         ::= <Word>
> <MinEntry>       ::= <PcdName> [<FS> <PcdValue>] <EOL>
>-<PcdValue>       ::= if (pcddatumtype == "BOOLEAN"): {<Boolean>}
>{<Expression>}
>-                     elif (pcddatumtype == "UINT8"): {<NumValUint8>}
>-                     {<Expression>} elif (pcddatumtype == "UINT16"):
>-                     {<NumValUint16>} {<Expression>} elif (pcddatumtype ==
>-                     "UINT32"): {<NumValUint32>} {<Expression>} elif
>-                     (pcddatumtype == "UINT64"): {<NumValUint64>}
>-                     {<Expression>} else:
>-                     <StringValue> [<MaxSize>]
>+<PcdValue>       ::= if (pcddatumtype == "BOOLEAN"):
>+                       {<BoolType>} {<Expression>}
>+                     elif (pcddatumtype == "UINT8"):
>+                       {<NumValUint8>} {<Expression>}
>+                     elif (pcddatumtype == "UINT16"):
>+                       {<NumValUint16>} {<Expression>}
>+                     elif (pcddatumtype == "UINT32"):
>+                       {<NumValUint32>} {<Expression>}
>+                     elif (pcddatumtype == "UINT64"):
>+                       {<NumValUint64>} {<Expression>}
>+                     else:
>+                       <StringValue> [<MaxSize>]
> <MaxSize>        ::= <FS> "VOID*" [<FS> <SizeValue>]
> <SizeValue>      ::= {<Number>} {<Expression>}
>-<StringValue>    ::= {<UnicodeString>} {<CString>} {<CArray>} {<MACROVAL>}
>-                     {<Expression>}
>+<StringValue>    ::= {<StringVal>} {<MACROVAL>} {<Expression>}
> <VpdEntry>       ::= <PcdName> <FS> <VpdOffset> [<FS> <VpdData>] <EOL>
> <VpdOffset>      ::= {<Number>} {"*"}
>-<VpdData>        ::= if (pcddatumtype == "BOOLEAN"): {<Boolean>}
>{<Expression>}
>-                     elif (pcddatumtype == "UINT8"): {<NumValUint8>}
>-                     {<Expression>} elif (pcddatumtype == "UINT16"):
>-                     {<NumValUint16>} {<Expression>} elif (pcddatumtype ==
>-                     "UINT32"): {<NumValUint32>} {<Expression>} elif
>-                     (pcddatumtype == "UINT64"): {<NumValUint64>}
>-                     {<Expression>} else:
>-                     <VpdMaxSize>
>+<VpdData>        ::= if (pcddatumtype == "BOOLEAN"):
>+                       {<BoolType>} {<Expression>}
>+                     elif (pcddatumtype == "UINT8"):
>+                       {<NumValUint8>} {<Expression>}
>+                     elif (pcddatumtype == "UINT16"):
>+                       {<NumValUint16>} {<Expression>}
>+                     elif (pcddatumtype == "UINT32"):
>+                       {<NumValUint32>} {<Expression>}
>+                     elif(pcddatumtype == "UINT64"):
>+                       {<NumValUint64>} {<Expression>}
>+                     else:
>+                       <VpdMaxSize>
> <VpdMaxSize>     ::= <NumValUint32> [<FS> <StringValue>]
> <HiiEntry>       ::= <PcdName> <FS> <HiiString> <Field2> <EOL>
> <HiiString>      ::= {<CArray>} {<UnicodeString>}
> <Field2>         ::= <FS> <VariableGuid> <FS> <VariableOffset> [<ValueField>]
> <VariableGuid>   ::= <CName>
> <ValueField>     ::= <FS> <DefaultValue> [<FS> <HiiAttrs>]
> <VariableOffset> ::= <Number>
>-<DefaultValue>   ::= {<Boolean>} {<Number>} {<String>} {<CArray>}
>-                     {<MACROVAL>} {<Expression>}
>+<DefaultValue>   ::= if (pcddatumtype == "BOOLEAN"):
>+                       {<BoolType>} {<Expression>}
>+                     elif (pcddatumtype == "UINT8"):
>+                       {<NumValUint8>} {<Expression>}
>+                     elif (pcddatumtype == "UINT16"):
>+                       {<NumValUint16>} {<Expression>}
>+                     elif (pcddatumtype == "UINT32"):
>+                       {<NumValUint32>} {<Expression>}
>+                     elif (pcddatumtype == "UINT64"):
>+                       {<NumValUint64>} {<Expression>}
>+                     else:
>+                       <StringValue>
> <HiiAttrs>       ::= <HiiAttr> [<CS> <HiiAttr>]*
> <HiiAttr>        ::= {"NV"} {"BS"} {"RT"} {"RO"}
> ```
>
> #### Parameters
>@@ -618,41 +639,58 @@ sections of the DSC file.
> <attrs>          ::= "." <arch> ["." <SkuIds>]
> <SkuIdS>         ::= <Keyword> [<FS> <Keyword>]*
> <Keyword>        ::= <UiName>
> <UiName>         ::= <Word>
> <MinEntry>       ::= <PcdName> [<FS> <PcdValue>] <EOL>
>-<PcdValue>       ::= if (pcddatumtype == "BOOLEAN"): {<Boolean>}
>{<Expression>}
>-                     elif (pcddatumtype == "UINT8"): {<NumValUint8>}
>-                     {<Expression>} elif (pcddatumtype == "UINT16"):
>-                     {<NumValUint16>} {<Expression>} elif (pcddatumtype ==
>-                     "UINT32"): {<NumValUint32>} {<Expression>} elif
>-                     (pcddatumtype == "UINT64"): {<NumValUint64>}
>-                     {<Expression>} else:
>-                     <StringValue> [<MaxSize>]
>+<PcdValue>       ::= if (pcddatumtype == "BOOLEAN"):
>+                       {<BoolType>} {<Expression>}
>+                     elif (pcddatumtype == "UINT8"):
>+                       {<NumValUint8>} {<Expression>}
>+                     elif (pcddatumtype == "UINT16"):
>+                       {<NumValUint16>} {<Expression>}
>+                     elif (pcddatumtype == "UINT32"):
>+                       {<NumValUint32>} {<Expression>}
>+                     elif (pcddatumtype == "UINT64"):
>+                       {<NumValUint64>} {<Expression>}
>+                     else:
>+                       <StringValue> [<MaxSize>]
> <MaxSize>        ::= <FS> "VOID*" [<FS> <SizeValue>]
> <SizeValue>      ::= {<Number>} {<Expression>}
>-<StringValue>    ::= {<UnicodeString>} {<CString>} {<CArray>} {<MACROVAL>}
>-                     {<Expression>}
>+<StringValue>    ::= {<StringVal>} {<MACROVAL>} {<Expression>}
> <VpdEntry>       ::= <PcdName> <FS> <VpdOffset> [<FS> <VpdData>] <EOL>
> <VpdOffset>      ::= {<Number>} {"*"}
>-<VpdData>        ::= if (pcddatumtype == "BOOLEAN"): {<Boolean>}
>{<Expression>}
>-                     elif (pcddatumtype == "UINT8"): {<NumValUint8>}
>-                     {<Expression>} elif (pcddatumtype == "UINT16"):
>-                     {<NumValUint16>} {<Expression>} elif (pcddatumtype ==
>-                     "UINT32"): {<NumValUint32>} {<Expression>} elif
>-                     (pcddatumtype == "UINT64"): {<NumValUint64>}
>-                     {<Expression>} else:
>-                     <VpdMaxSize>
>+<VpdData>        ::= if (pcddatumtype == "BOOLEAN"):
>+                       {<BoolType>} {<Expression>}
>+                     elif (pcddatumtype == "UINT8"):
>+                       {<NumValUint8>} {<Expression>}
>+                     elif (pcddatumtype == "UINT16"):
>+                       {<NumValUint16>} {<Expression>}
>+                     elif (pcddatumtype == "UINT32"):
>+                       {<NumValUint32>} {<Expression>}
>+                     elif (pcddatumtype == "UINT64"):
>+                       {<NumValUint64>} {<Expression>}
>+                     else:
>+                       <VpdMaxSize>
> <VpdMaxSize>     ::= <NumValUint32> [<FS> <StringValue>]
> <HiiEntry>       ::= <PcdName> <FS> <HiiString> <Field2> <EOL>
> <HiiString>      ::= {<CArray>} {<UnicodeString>}
> <Field2>         ::= <FS> <VariableGuid> <FS> <VariableOffset> [<ValueField>]
> <VariableGuid>   ::= <CName>
> <ValueField>     ::= <FS> <DefaultValue> [<FS> <HiiAttrs>]
> <VariableOffset> ::= <Number>
>-<DefaultValue>   ::= {<Boolean>} {<Number>} {<String>} {<CArray>}
>-                     {<MACROVAL>} {<Expression>}
>+<DefaultValue>   ::= if (pcddatumtype == "BOOLEAN"):
>+                       {<BoolType>} {<Expression>}
>+                     elif (pcddatumtype == "UINT8"):
>+                       {<NumValUint8>} {<Expression>}
>+                     elif (pcddatumtype == "UINT16"):
>+                       {<NumValUint16>} {<Expression>}
>+                     elif (pcddatumtype == "UINT32"):
>+                       {<NumValUint32>} {<Expression>}
>+                     elif(pcddatumtype == "UINT64"):
>+                       {<NumValUint64>} {<Expression>}
>+                     else:
>+                       <StringValue>
> <HiiAttrs>       ::= <HiiAttr> [<CS> <HiiAttr>]*
> <HiiAttr>        ::= {"NV"} {"BS"} {"RT"} {"RO"}
> ```
>
> #### Parameters
>diff --git a/3_edk_ii_dsc_file_format/311_[components]_sections.md
>b/3_edk_ii_dsc_file_format/311_[components]_sections.md
>index 119d17b..5a3594a 100644
>--- a/3_edk_ii_dsc_file_format/311_[components]_sections.md
>+++ b/3_edk_ii_dsc_file_format/311_[components]_sections.md
>@@ -165,22 +165,25 @@ modules in a binary image (the FDF file describes
>that ordering).
> <PcdEntries>       ::= {<MacroDefinition>} {<IncludeStatement>}
>                        {<TS> <PcdsEntry>}
> <PcdsPatchable>    ::= "<PcdsPatchableInModule>" <EOL>
>                        <PcdEntries>*
> <PcdEntry>         ::= <PcdName> [<FS> <PcdValue>] <EOL>
>-<PcdValue>         ::= if (pcddatumtype == "BOOLEAN"): {<Boolean>}
>-                       {<Expression>} elif (pcddatumtype == "UINT8"):
>-                       {<NumValUint8>} {<Expression>} elif (pcddatumtype ==
>-                       "UINT16"): {<NumValUint16>} {<Expression>} elif
>-                       (pcddatumtype == "UINT32"): {<NumValUint32>}
>-                       {<Expression>} elif (pcddatumtype == "UINT64"):
>-                       {<NumValUint64>} {<Expression>} else:
>-                       <StringVal> [<MaxSize>]
>+<PcdValue>         ::= if (pcddatumtype == "BOOLEAN"):
>+                         {<BoolType>} {<Expression>}
>+                       elif (pcddatumtype == "UINT8"):
>+                         {<NumValUint8>} {<Expression>}
>+                       elif (pcddatumtype == "UINT16"):
>+                         {<NumValUint16>} {<Expression>}
>+                       elif (pcddatumtype == "UINT32"):
>+                         {<NumValUint32>} {<Expression>}
>+                       elif (pcddatumtype == "UINT64"):
>+                         {<NumValUint64>} {<Expression>}
>+                       else:
>+                         <StringValue> [<MaxSize>]
> <MaxSize>          ::= <FS> "VOID*" [<FS> <SizeValue>]
> <SizeValue>        ::= {<Number>} {<Expression>}
>-<StringValue>      ::= {<UnicodeString>} {<CString>} {<CArray>}
>-                       {<MACROVAL>}
>+<StringValue>      ::= {<StringVal>} {<MACROVAL>} {<Expression>}
> <BuildOptions>     ::= "<BuildOptions>" <EOL>
>                        [<DefineStatements>]*
>                        [<TS> <ToolFlags>]+
>                        [<TS> <ToolPath>]*
>                        [<TS> <ToolCmd>]*
>diff --git a/3_edk_ii_dsc_file_format/33_platform_dsc_definition.md
>b/3_edk_ii_dsc_file_format/33_platform_dsc_definition.md
>index bfe730c..bbe6b10 100644
>--- a/3_edk_ii_dsc_file_format/33_platform_dsc_definition.md
>+++ b/3_edk_ii_dsc_file_format/33_platform_dsc_definition.md
>@@ -112,15 +112,16 @@ The following are common definitions used by
>multiple section types.
> <Digit>                ::= (0-9)
> <NonDigit>             ::= (a-zA-Z_)
> <Identifier>           ::= [<NonDigit> <Chars>]*
> <CName>                ::= <Identifier> # A valid C variable name.
> <AsciiChars>           ::= (0x21 - 0x7E)
>-<CChars>               ::= [{0x21} {(0x23 - 0x5B)} {(0x5D - 0x7E)}
>-                           {<EscapeSequence>}]*
>+<CChars>               ::= [{0x21} {(0x23 - 0x26)} {(0x28 - 0x5B)}
>+                           {(0x5D - 0x7E)} {<EscapeSequence>}]*
> <DblQuote>             ::= 0x22
>+<SglQuote>             ::= 0x27
> <EscapeSequence>       ::= "\" {"n"} {"t"} {"f"} {"r"} {"b"} {"0"} {"\"}
>-                           {<DblQuote>}
>+                           {<DblQuote>} {<SglQuote>}
> <TabSpace>             ::= {<Tab>} {<Space>}
> <TS>                   ::= <TabSpace>*
> <MTS>                  ::= <TabSpace>+
> <Tab>                  ::= 0x09
> <Space>                ::= 0x20
>@@ -138,15 +139,16 @@ The following are common definitions used by
>multiple section types.
> <AsciiString>          ::= [ <TS>* <AsciiChars>* ]*
> <EmptyString>          ::= <DblQuote><DblQuote>
> <CFlags>               ::= <AsciiString>
> <PrintChars>           ::= {<TS>} {<CChars>}
> <QuotedString>         ::= <DblQuote> <PrintChars>* <DblQuote>
>-<CString>              ::= ["L"] <QuotedString>
>+<SglQuotedString>      ::= <SglQuote> <PrintChars>* <SglQuote>
>+<CString>              ::= {<QuotedString>} {<SglQuotedString>}
> <NormalizedString>     ::= <DblQuote> [{<Word>} {<Space>}]+ <DblQuote>
> <GlobalComment>        ::= <WS> "#" [<AsciiString>] <EOL>+
> <Comment>              ::= "#" <AsciiString> <EOL>+
>-<UnicodeString>        ::= "L" <QuotedString>
>+<UnicodeString>        ::= "L" {<QuotedString>} {<SglQuotedString>}
> <HexDigit>             ::= (a-fA-F0-9)
> <HexByte>              ::= {"0x"} {"0X"} [<HexDigit>] <HexDigit>
> <HexNumber>            ::= {"0x"} {"0X"} <HexDigit>+
> <HexVersion>           ::= "0x" [0]* <Major> <Minor>
> <Major>                ::= <HexDigit>? <HexDigit>? <HexDigit>?
>@@ -184,11 +186,12 @@ The following are common definitions used by
>multiple section types.
> <HexNz>                ::= (\x1 - \xFFFFFFFFFFFFFFFF)
> <NumNz>                ::= (1-18446744073709551615)
> <GZ>                   ::= {<NumNz>} {<HexNz>}
> <TRUE>                 ::= {"TRUE"} {"true"} {"True"} {"0x1"} {"0x01"} {"1"}
> <FALSE>                ::= {"FALSE"} {"false"} {"False"} {"0x0"} {"0x00"} {"0"}
>-<BoolType>             ::= {<TRUE>} {<FALSE>}
>+<BoolVal>              ::= {<TRUE>} {<FALSE>}
>+<BoolType>             ::= {<BoolVal>} {"{"<BoolVal>"}"}
> <MACRO>                ::= (A-Z)(A-Z0-9_)*
> <MACROVAL>             ::= "$(" <MACRO> ")"
> <PcdName>              ::= <TokenSpaceGuidCName> "." <PcdCName>
> <PcdCName>             ::= <CName>
> <TokenSpaceGuidCName>  ::= <CName>
>@@ -210,14 +213,49 @@ The following are common definitions used by
>multiple section types.
>                            <HexDigit>
> <ShortNum>             ::= (0-255)
> <IntNum>               ::= (0-65535)
> <LongNum>              ::= (0-4294967295)
> <LongLongNum>          ::= (0-18446744073709551615)
>-<NumValUint8>          ::= {<ShortNum>} {<UINT8>}
>-<NumValUint16>         ::= {<IntNum>} {<UINT16>}
>-<NumValUint32>         ::= {<LongNum>} {<UINT32>}
>-<NumValUint64>         ::= {<LongLongNum>} {<UINT64>}
>+<ValUint8>             ::= {<ShortNum>} {<UINT8>} {<BoolVal>}
>+                           {<CString>} {<UnicodeString>}
>+<ValUint16>            ::= {<IntNum>} {<UINT16>} {<BoolVal>}
>+                           {<CString>} {<UnicodeString>}
>+<ValUint32>            ::= {<LongNum>} {<UINT32>} {<BoolVal>}
>+                           {<CString>} {<UnicodeString>}
>+<ValUint64>            ::= {<LongLongNum>} {<UINT64>} {<BoolVal>}
>+                           {<CString>} {<UnicodeString>}
>+<NumValUint8>          ::= {<ValUint8>} {"{"<ValUint8>"}"}
>+<NumValUint16>         ::= {<ValUint16>}
>+                           {"{"<ValUint8> [<CommaSpace> <ValUint8>]*"}"}
>+<NumValUint32>         ::= {<ValUint32>}
>+                           {"{"<ValUint8> [<CommaSpace> <ValUint8>]*"}"}
>+<NumValUint64>         ::= {<ValUint64>}
>+                           {"{"<ValUint8> [<CommaSpace> <ValUint8>]*"}"}
>+<StringVal>            ::= {<UnicodeString>} {<CString>} {<Array>}
>+<Array>                ::= "{" {<Array>} {[<Lable>] <ArrayVal>
>+                           [<CommaSpace> [<Lable>] <ArrayVal>]* } "}"
>+<ArrayVal>             ::= {<Num8Array>} {<GuidStr>} {<DevicePath>}
>+<NonNumType>           ::= {<BoolVal>} {<UnicodeString>} {<CString>}
>+                           {<Offset>} {<UintMac>}
>+<GuidStr>              ::= "GUID(" <GuidVal> ")"
>+<GuidVal>              ::= {<DblQuote> <RegistryFormatGUID> <DblQuote>}
>+                           {<CFormatGUID>} {<CName>}
>+<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
>+<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> ")"
>+<Lable>                ::= "LABEL(" <CName> ")"
>+<Offset>               ::= "OFFSET_OF(" <CName> ")"
> <ModuleType>           ::= {"BASE"} {"SEC"} {"PEI_CORE"} {"PEIM"}
>                            {"DXE_CORE"} {"DXE_DRIVER"} {"SMM_CORE"}
>                            {"DXE_RUNTIME_DRIVER"} {"DXE_SAL_DRIVER"}
>                            {"DXE_SMM_DRIVER"} {"UEFI_DRIVER"}
>                            {"UEFI_APPLICATION"} {"USER_DEFINED"}
>@@ -244,10 +282,18 @@ The following are common definitions used by
>multiple section types.
>                            {"SMM_CORE"} {"DXE_SMM_DRIVER"}
>                            {"UEFI_DRIVER"} {"UEFI_APPLICATION"}
> ```
>
> **********
>+**Note:** When using CString, UnicodeString or byte array format as
>+UINT8/UINT16/UINT32/UINT64 values, please make sure they fit in the
>+target type's size, otherwise tool would report failure.
>+**********
>+**Note:** 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.
>+**********
> **Note:** When using the characters "|" or "||" in an expression, the
> expression must be encapsulated in open "(" and close ")" parenthesis.
> **********
> **Note:** Comments may appear anywhere within a DSC file, provided they
>follow
> the rules that a comment may not be enclosed within Section headers, and
>that
>@@ -265,16 +311,16 @@ chain tag names that are being built. Refer to the
>EDK II Expression Syntax
> Specification for additional information.
>
> **_UnicodeString_**
>
> When the `<UnicodeString>` element (these characters are string literals as
>-defined by the C99 specification: L"string", not actual Unicode characters) is
>-included in a value, the build tools may be required to expand the ASCII string
>-between the quotation marks into a valid UCS-2 character string. The build
>-tools parser must treat all content between the field separators (excluding
>-white space characters around the field separators) as ASCII literal content
>-when generating the AutoGen.c and AutoGen.h files.
>+defined by the C99 specification: L"string"/L'string', not actual Unicode
>+characters) is included in a value, the build tools may be required to expand
>+the ASCII string between the quotation marks into a valid UCS-2 character
>string.
>+The build tools parser must treat all content between the field separators
>+(excluding white space characters around the field separators) as ASCII literal
>+content when generating the AutoGen.c and AutoGen.h files.
>
> **_Comments_**
>
> Strings that appear in comments may be ignored by the build tools. An ASCII
> string matching the format of the ASCII string defined by `<UnicodeString>`
>--
>2.6.1.windows.1
>
>_______________________________________________
>edk2-devel mailing list
>edk2-devel@lists.01.org
>https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel