7_build_environment/73_guided_tools.md | 8 +-- .../82_auto-generation_process.md | 18 +++--- appendix_d_buildexe_command/d4_usage.md | 72 +++++++++++++++++++--- 3 files changed, 77 insertions(+), 21 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>
---
7_build_environment/73_guided_tools.md | 8 +--
.../82_auto-generation_process.md | 18 +++---
appendix_d_buildexe_command/d4_usage.md | 72 +++++++++++++++++++---
3 files changed, 77 insertions(+), 21 deletions(-)
diff --git a/7_build_environment/73_guided_tools.md b/7_build_environment/73_guided_tools.md
index a8881d3..50119f1 100644
--- a/7_build_environment/73_guided_tools.md
+++ b/7_build_environment/73_guided_tools.md
@@ -119,21 +119,21 @@ file required by the build system is provided in the appendix, VPD Tool.
```
If using automatic offset feature, the build tools byte-align numeric values,
while `VOID*` PCD types will be aligned using the following rules:
- * ASCII strings, "string", will be byte aligned.
- * Unicode strings, L"string" will be two-byte aligned.
+ * ASCII strings, "string" or 'string', will be byte aligned.
+ * Unicode strings, L"string" or L'string' will be two-byte aligned.
* Byte arrays, {0x00, 0x01} will be 8-byte aligned.
If the developer manually assigns offset values in the DSC file, the developer
must follow the same rules.
**********
**Note:** If a developer manually sets the offset of a `VOID*` PCD with
- Unicode string, L"string", style to a value that is not 2-byte aligned, then
- an error is generated and the build halts.
+ Unicode string, L"string"/L'string' style to a value that is not 2-byte aligned,
+ then an error is generated and the build halts.
**********
**Note:** If a developer manually sets the offset of a `VOID*` PCD with byte
array {} style to a value that is not 8-byte aligned, then a warning is
generated, but the build will continue.
**********
diff --git a/8_pre-build_autogen_stage/82_auto-generation_process.md b/8_pre-build_autogen_stage/82_auto-generation_process.md
index f610185..5a950d7 100644
--- a/8_pre-build_autogen_stage/82_auto-generation_process.md
+++ b/8_pre-build_autogen_stage/82_auto-generation_process.md
@@ -875,41 +875,41 @@ A PCD value set on the command-line has the highest precedence. It overrides
all instances of the PCD value specified in the DSC or FDF file. The following
is the syntax to override the value of a PCD on the command line:
`--pcd [<TokenSpaceGuidCname>.]<PcdCName>=<Value>`
-For `VOID*` type PCDs, `<Value>` supports the following syntax:
+`<Value>` supports the following syntax:
-* ASCII string value for a `VOID*` PCD
+* ASCII string value for a PCD
`--pcd [<TokenSpaceGuidCname>.]<PcdCName>="String"`
+ `--pcd [<TokenSpaceGuidCname>.]<PcdCName>='String'`
-* Unicode string value for a `VOID*` PCD
+* Unicode string value for a PCD
`--pcd [<TokenSpaceGuidCname>.]<PcdCName>=L"String"`
+ `--pcd [<TokenSpaceGuidCname>.]<PcdCName>=L'String'`
-* Byte array value for a `VOID*` PCD
+* Byte array value for a PCD
`--pcd [<TokenSpaceGuidCname>.]<PcdCName>= H"{0x1, 0x2}"`
**********
**Note:** The EDK II meta-data specs have changed to permit a PCD entry (or any
other entry) to be listed only one time per section.
**********
-**Caution:** Dynamic and DynamicEx `VOID*` VPD PCD array values must be hex byte
-arrays. Using a Registry or C format GUID value in the value field of a `VOID*`
-VPD PCD is not permitted.
-**********
If the maximum size of a `VOID*` PCD is not specified in the DSC file, then the
maximum size is calculated based on the largest size of 1) the string or array
in the DSC file, 2) the string or array in the INF file and 3) the string or
array in the DEC file. If the value is a quoted text string, the size of the
string will be incremented by one to handle string termination. If the quoted
string is preceded by L, as in `L"This is a string"`, then the size of the string
will be incremented by two to handle unicode string termination. If the value
-is a byte array, then the size of the byte array is not modified.
+is a byte array, then the size of the byte array is not modified. If the value is
+a single quoted string, as in 'string' or L'string', the size of the string doesn't
+need to include string null termination character.
For example, if the string in the DSC file is `L"DSC Length"`, the INF file has
`L"Module Length"` and the DEC file declares the default as `L"Length"`, then
the maximum size that will be allocated for this PCD will be 28 bytes (`
L"Module Length"` 26 bytes, 2 bytes for null termination character).
diff --git a/appendix_d_buildexe_command/d4_usage.md b/appendix_d_buildexe_command/d4_usage.md
index c901266..57d2656 100644
--- a/appendix_d_buildexe_command/d4_usage.md
+++ b/appendix_d_buildexe_command/d4_usage.md
@@ -195,24 +195,80 @@ precedence over PCD provided in DSC, FDF, INF, and DEC files.
```c
<PcdOption> ::= "--pcd" <PcdName> ["=" <PcdValue>] <MTS>
<SP> ::= 0x20
<MTS> ::= <SP>+
+<TS> ::= <SP>*
+<CommaSpace> ::= "," <SP>*
+<HexDigit> ::= (a-fA-F0-9)
+<CName> ::= A valid C variable name.
<PcdName> ::= [<TokenSpaceCName> "."] <PcdCName>
<TokenSpaceCName> ::= C Variable Name of the Token Space GUID
<PcdCName> ::= C Variable Name of the PCD
-<PcdValue> ::= {<Boolean>} {<Number>} {<CString>} {<CArray>}
+<PcdValue> ::= {<Boolean>} {<Number>} {<String>} {<Array>}
<Number> ::= {<Integer>} {<HexNumber>}
<Integer> ::= {(0-9)} {(1-9)(0-9)+}
<HexNumber> ::= {"0x"} {"0X"} (a-fA-F0-9){1,16}
<Boolean> ::= {<True>} {<False>}
<True> ::= {"TRUE"} {"True"} {"true"} {"1"} {"0x1"} {"0x01"}
<False> ::= {"FALSE"} {"False"} {"false"} {"0"} {"0x0"} {"0x00"}
-<CString> ::= ["L"] <QuotedString>
-<QuotedString> ::= <DblQuote> <CChars>* <DblQuote>
+<String> ::= ["L"] {<QuotedString>} {<SglQuotedString>}
+<SglQuotedString> ::= <SglQuote> <PrintChars>* <SglQuote>
+<QuotedString> ::= <DblQuote> <PrintChars>* <DblQuote>
+<PrintChars> ::= {<TS>} {<CChars>}
<DblQuote> ::= 0x22
-<CChars> ::= {0x21} {(0x23 - 0x5B)} {(0x5D - 0x7E)} {<EscapeSequence>}
-<EscapeSequence> ::= "\" {"n"} {"t"} {"f"} {"r"} {"b"} {"0"} {"\"} {0x22}
-<CArray> ::= "H" "{" <NList> "}"
-<NList> ::= <HexByte> ["," <HexByte>]*
-<HexByte> ::= {"0x"} {"0X"} (a-fA-F0-9){1,2}
+<SglQuote> ::= 0x27
+<CChars> ::= {0x21} {(0x23 - 0x26)} {(0x28 - 0x5B)} {(0x5D - 0x7E)}
+ {<EscapeSequence>}
+<EscapeSequence> ::= "\" {"n"} {"t"} {"f"} {"r"} {"b"} {"0"} {"\"}
+ {<DblQuote>} {<SglQuote>}
+<Array> ::= "H" "{"[<Lable>] <ArrayVal>
+ [<CommaSpace> [<Lable>] <ArrayVal>]*"}"
+<ArrayVal> ::= {<Num8Array>} {<GuidStr>} {<DevicePath>}
+<ShortNum> ::= (0-255)
+<IntNum> ::= (0-65535)
+<LongNum> ::= (0-4294967295)
+<LongLongNum> ::= (0-18446744073709551615)
+<UINT8> ::= {"0x"} {"0X"} (a-fA-F0-9){1,2}
+<UINT16> ::= {"0x"} {"0X"} (a-fA-F0-9){1,4}
+<UINT32> ::= {"0x"} {"0X"} (a-fA-F0-9){1,8}
+<UINT64> ::= <HexNumber>
+<NonNumType> ::= {<Boolean>} {<String>} {<Offset>} {<UintMac>}
+<Num8Array> ::= {<NonNumType>} {<ShortNum>} {<UINT8>}
+<Num16Array> ::= {<NonNumType>} {<IntNum>} {<UINT16>}
+<Num32Array> ::= {<NonNumType>} {<LongNum>} {<UINT32>}
+<Num64Array> ::= {<NonNumType>} {<LongLongNum>} {<UINT64>}
+<GuidStr> ::= "GUID(" <GuidVal> ")"
+<GuidVal> ::= {<DblQuote> <RegistryFormatGUID> <DblQuote>}
+ {<CFormatGUID>} {<CName>}
+<RegistryFormatGUID>::= <RHex8> "-" <RHex4> "-" <RHex4> "-" <RHex4> "-"
+ <RHex12>
+<RHex4> ::= <HexDigit> <HexDigit> <HexDigit> <HexDigit>
+<RHex8> ::= <RHex4> <RHex4>
+<RHex12> ::= <RHex4> <RHex4> <RHex4>
+<RawH2> ::= <HexDigit>? <HexDigit>
+<RawH4> ::= <HexDigit>? <HexDigit>? <HexDigit>? <HexDigit>
+<OptRawH4> ::= <HexDigit>? <HexDigit>? <HexDigit>? <HexDigit>?
+<Hex2> ::= {"0x"} {"0X"} <RawH2>
+<Hex4> ::= {"0x"} {"0X"} <RawH4>
+<Hex8> ::= {"0x"} {"0X"} <OptRawH4> <RawH4>
+<Hex12> ::= {"0x"} {"0X"} <OptRawH4> <OptRawH4> <RawH4>
+<Hex16> ::= {"0x"} {"0X"} <OptRawH4> <OptRawH4> <OptRawH4>
+ <RawH4>
+<CFormatGUID> ::= "{" <Hex8> <CommaSpace> <Hex4> <CommaSpace>
+ <Hex4> <CommaSpace> "{"
+ <Hex2> <CommaSpace> <Hex2> <CommaSpace>
+ <Hex2> <CommaSpace> <Hex2> <CommaSpace>
+ <Hex2> <CommaSpace> <Hex2> <CommaSpace>
+ <Hex2> <CommaSpace> <Hex2> "}" "}"
+<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
+<UintMac> ::= {<Uint8Mac>} {<Uint16Mac>} {<Uint32Mac>} {<Uint64Mac>}
+<Uint8Mac> ::= "UINT8(" <Num8Array> ")"
+<Uint16Mac> ::= "UINT16(" <Num16Array> ")"
+<Uint32Mac> ::= "UINT32(" <Num32Array> ")"
+<Uint64Mac> ::= "UINT64(" <Num64Array> ")"
+<Lable> ::= "LABEL(" <CName> ")"
+<Offset> ::= "OFFSET_OF(" <CName> ")"
```
--
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] Build spec: Add flexible PCD value format into spec > >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> >--- > 7_build_environment/73_guided_tools.md | 8 +-- > .../82_auto-generation_process.md | 18 +++--- > appendix_d_buildexe_command/d4_usage.md | 72 >+++++++++++++++++++--- > 3 files changed, 77 insertions(+), 21 deletions(-) > >diff --git a/7_build_environment/73_guided_tools.md >b/7_build_environment/73_guided_tools.md >index a8881d3..50119f1 100644 >--- a/7_build_environment/73_guided_tools.md >+++ b/7_build_environment/73_guided_tools.md >@@ -119,21 +119,21 @@ file required by the build system is provided in the >appendix, VPD Tool. > ``` > > If using automatic offset feature, the build tools byte-align numeric values, > while `VOID*` PCD types will be aligned using the following rules: > >- * ASCII strings, "string", will be byte aligned. >- * Unicode strings, L"string" will be two-byte aligned. >+ * ASCII strings, "string" or 'string', will be byte aligned. >+ * Unicode strings, L"string" or L'string' will be two-byte aligned. > * Byte arrays, {0x00, 0x01} will be 8-byte aligned. > > If the developer manually assigns offset values in the DSC file, the developer > must follow the same rules. > > ********** > **Note:** If a developer manually sets the offset of a `VOID*` PCD with >- Unicode string, L"string", style to a value that is not 2-byte aligned, then >- an error is generated and the build halts. >+ Unicode string, L"string"/L'string' style to a value that is not 2-byte aligned, >+ then an error is generated and the build halts. > ********** > **Note:** If a developer manually sets the offset of a `VOID*` PCD with >byte > array {} style to a value that is not 8-byte aligned, then a warning is > generated, but the build will continue. > ********** >diff --git a/8_pre-build_autogen_stage/82_auto-generation_process.md >b/8_pre-build_autogen_stage/82_auto-generation_process.md >index f610185..5a950d7 100644 >--- a/8_pre-build_autogen_stage/82_auto-generation_process.md >+++ b/8_pre-build_autogen_stage/82_auto-generation_process.md >@@ -875,41 +875,41 @@ A PCD value set on the command-line has the >highest precedence. It overrides > all instances of the PCD value specified in the DSC or FDF file. The following > is the syntax to override the value of a PCD on the command line: > > `--pcd [<TokenSpaceGuidCname>.]<PcdCName>=<Value>` > >-For `VOID*` type PCDs, `<Value>` supports the following syntax: >+`<Value>` supports the following syntax: > >-* ASCII string value for a `VOID*` PCD >+* ASCII string value for a PCD > > `--pcd [<TokenSpaceGuidCname>.]<PcdCName>="String"` >+ `--pcd [<TokenSpaceGuidCname>.]<PcdCName>='String'` > >-* Unicode string value for a `VOID*` PCD >+* Unicode string value for a PCD > > `--pcd [<TokenSpaceGuidCname>.]<PcdCName>=L"String"` >+ `--pcd [<TokenSpaceGuidCname>.]<PcdCName>=L'String'` > >-* Byte array value for a `VOID*` PCD >+* Byte array value for a PCD > > `--pcd [<TokenSpaceGuidCname>.]<PcdCName>= H"{0x1, 0x2}"` > > ********** > **Note:** The EDK II meta-data specs have changed to permit a PCD entry >(or any > other entry) to be listed only one time per section. > ********** >-**Caution:** Dynamic and DynamicEx `VOID*` VPD PCD array values must be >hex byte >-arrays. Using a Registry or C format GUID value in the value field of a `VOID*` >-VPD PCD is not permitted. >-********** > > If the maximum size of a `VOID*` PCD is not specified in the DSC file, then the > maximum size is calculated based on the largest size of 1) the string or array > in the DSC file, 2) the string or array in the INF file and 3) the string or > array in the DEC file. If the value is a quoted text string, the size of the > string will be incremented by one to handle string termination. If the quoted > string is preceded by L, as in `L"This is a string"`, then the size of the string > will be incremented by two to handle unicode string termination. If the value >-is a byte array, then the size of the byte array is not modified. >+is a byte array, then the size of the byte array is not modified. If the value is >+a single quoted string, as in 'string' or L'string', the size of the string doesn't >+need to include string null termination character. > > For example, if the string in the DSC file is `L"DSC Length"`, the INF file has > `L"Module Length"` and the DEC file declares the default as `L"Length"`, then > the maximum size that will be allocated for this PCD will be 28 bytes (` > L"Module Length"` 26 bytes, 2 bytes for null termination character). >diff --git a/appendix_d_buildexe_command/d4_usage.md >b/appendix_d_buildexe_command/d4_usage.md >index c901266..57d2656 100644 >--- a/appendix_d_buildexe_command/d4_usage.md >+++ b/appendix_d_buildexe_command/d4_usage.md >@@ -195,24 +195,80 @@ precedence over PCD provided in DSC, FDF, INF, and >DEC files. > > ```c > <PcdOption> ::= "--pcd" <PcdName> ["=" <PcdValue>] <MTS> > <SP> ::= 0x20 > <MTS> ::= <SP>+ >+<TS> ::= <SP>* >+<CommaSpace> ::= "," <SP>* >+<HexDigit> ::= (a-fA-F0-9) >+<CName> ::= A valid C variable name. > <PcdName> ::= [<TokenSpaceCName> "."] <PcdCName> > <TokenSpaceCName> ::= C Variable Name of the Token Space GUID > <PcdCName> ::= C Variable Name of the PCD >-<PcdValue> ::= {<Boolean>} {<Number>} {<CString>} {<CArray>} >+<PcdValue> ::= {<Boolean>} {<Number>} {<String>} {<Array>} > <Number> ::= {<Integer>} {<HexNumber>} > <Integer> ::= {(0-9)} {(1-9)(0-9)+} > <HexNumber> ::= {"0x"} {"0X"} (a-fA-F0-9){1,16} > <Boolean> ::= {<True>} {<False>} > <True> ::= {"TRUE"} {"True"} {"true"} {"1"} {"0x1"} {"0x01"} > <False> ::= {"FALSE"} {"False"} {"false"} {"0"} {"0x0"} {"0x00"} >-<CString> ::= ["L"] <QuotedString> >-<QuotedString> ::= <DblQuote> <CChars>* <DblQuote> >+<String> ::= ["L"] {<QuotedString>} {<SglQuotedString>} >+<SglQuotedString> ::= <SglQuote> <PrintChars>* <SglQuote> >+<QuotedString> ::= <DblQuote> <PrintChars>* <DblQuote> >+<PrintChars> ::= {<TS>} {<CChars>} > <DblQuote> ::= 0x22 >-<CChars> ::= {0x21} {(0x23 - 0x5B)} {(0x5D - 0x7E)} {<EscapeSequence>} >-<EscapeSequence> ::= "\" {"n"} {"t"} {"f"} {"r"} {"b"} {"0"} {"\"} {0x22} >-<CArray> ::= "H" "{" <NList> "}" >-<NList> ::= <HexByte> ["," <HexByte>]* >-<HexByte> ::= {"0x"} {"0X"} (a-fA-F0-9){1,2} >+<SglQuote> ::= 0x27 >+<CChars> ::= {0x21} {(0x23 - 0x26)} {(0x28 - 0x5B)} {(0x5D - 0x7E)} >+ {<EscapeSequence>} >+<EscapeSequence> ::= "\" {"n"} {"t"} {"f"} {"r"} {"b"} {"0"} {"\"} >+ {<DblQuote>} {<SglQuote>} >+<Array> ::= "H" "{"[<Lable>] <ArrayVal> >+ [<CommaSpace> [<Lable>] <ArrayVal>]*"}" >+<ArrayVal> ::= {<Num8Array>} {<GuidStr>} {<DevicePath>} >+<ShortNum> ::= (0-255) >+<IntNum> ::= (0-65535) >+<LongNum> ::= (0-4294967295) >+<LongLongNum> ::= (0-18446744073709551615) >+<UINT8> ::= {"0x"} {"0X"} (a-fA-F0-9){1,2} >+<UINT16> ::= {"0x"} {"0X"} (a-fA-F0-9){1,4} >+<UINT32> ::= {"0x"} {"0X"} (a-fA-F0-9){1,8} >+<UINT64> ::= <HexNumber> >+<NonNumType> ::= {<Boolean>} {<String>} {<Offset>} {<UintMac>} >+<Num8Array> ::= {<NonNumType>} {<ShortNum>} {<UINT8>} >+<Num16Array> ::= {<NonNumType>} {<IntNum>} {<UINT16>} >+<Num32Array> ::= {<NonNumType>} {<LongNum>} {<UINT32>} >+<Num64Array> ::= {<NonNumType>} {<LongLongNum>} {<UINT64>} >+<GuidStr> ::= "GUID(" <GuidVal> ")" >+<GuidVal> ::= {<DblQuote> <RegistryFormatGUID> <DblQuote>} >+ {<CFormatGUID>} {<CName>} >+<RegistryFormatGUID>::= <RHex8> "-" <RHex4> "-" <RHex4> "-" <RHex4> "- >" >+ <RHex12> >+<RHex4> ::= <HexDigit> <HexDigit> <HexDigit> <HexDigit> >+<RHex8> ::= <RHex4> <RHex4> >+<RHex12> ::= <RHex4> <RHex4> <RHex4> >+<RawH2> ::= <HexDigit>? <HexDigit> >+<RawH4> ::= <HexDigit>? <HexDigit>? <HexDigit>? <HexDigit> >+<OptRawH4> ::= <HexDigit>? <HexDigit>? <HexDigit>? <HexDigit>? >+<Hex2> ::= {"0x"} {"0X"} <RawH2> >+<Hex4> ::= {"0x"} {"0X"} <RawH4> >+<Hex8> ::= {"0x"} {"0X"} <OptRawH4> <RawH4> >+<Hex12> ::= {"0x"} {"0X"} <OptRawH4> <OptRawH4> <RawH4> >+<Hex16> ::= {"0x"} {"0X"} <OptRawH4> <OptRawH4> <OptRawH4> >+ <RawH4> >+<CFormatGUID> ::= "{" <Hex8> <CommaSpace> <Hex4> <CommaSpace> >+ <Hex4> <CommaSpace> "{" >+ <Hex2> <CommaSpace> <Hex2> <CommaSpace> >+ <Hex2> <CommaSpace> <Hex2> <CommaSpace> >+ <Hex2> <CommaSpace> <Hex2> <CommaSpace> >+ <Hex2> <CommaSpace> <Hex2> "}" "}" >+<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 >+<UintMac> ::= {<Uint8Mac>} {<Uint16Mac>} {<Uint32Mac>} >{<Uint64Mac>} >+<Uint8Mac> ::= "UINT8(" <Num8Array> ")" >+<Uint16Mac> ::= "UINT16(" <Num16Array> ")" >+<Uint32Mac> ::= "UINT32(" <Num32Array> ")" >+<Uint64Mac> ::= "UINT64(" <Num64Array> ")" >+<Lable> ::= "LABEL(" <CName> ")" >+<Offset> ::= "OFFSET_OF(" <CName> ")" > ``` >-- >2.6.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
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_dec_file_format/310_pcd_sections.md | 14 ++--
.../32_package_declaration_dec_definitions.md | 74 ++++++++++++++++++----
2 files changed, 67 insertions(+), 21 deletions(-)
diff --git a/3_edk_ii_dec_file_format/310_pcd_sections.md b/3_edk_ii_dec_file_format/310_pcd_sections.md
index 488f17f..36c32ff 100644
--- a/3_edk_ii_dec_file_format/310_pcd_sections.md
+++ b/3_edk_ii_dec_file_format/310_pcd_sections.md
@@ -113,24 +113,24 @@ PCDs listed in `PcdsFeatureFlag` sections must only be listed in
[<TS> <Prompt>]
[<DoxComment>] <PcdEntry>
<PcdEntry> ::= <TS> {<PcdBool>} {<PcdNumEntry>} {<PcdPtr>}
<PcdNumEntry> ::= {<Pcd8>} {<Pcd16>} {<Pcd32>} {<Pcd64>}
<PcdBool> ::= <PcdName> <FS> <BoolPcd> <FS> <Token> <CbOrEol>
-<BoolPcd> ::= <BoolType> <FS> "BOOLEAN"
+<BoolPcd> ::= <Boolean> <FS> "BOOLEAN"
<CbOrEol> ::= {<CommentBlock>} {<EOL>}
<Pcd8> ::= <PcdName> <FS> <PcdUint8> <FS> <Token> <CbOrEol>
-<PcdUint8> ::= <NumValUint8> <FS> "UINT8"
+<PcdUint8> ::= {<NumValUint8>} {<Expression>} <FS> "UINT8"
<Pcd16> ::= <PcdName> <FS> <PcdUint16> <FS> <Token> <CbOrEol>
-<PcdUint16> ::= <NumValUint16> <FS> "UINT16"
+<PcdUint16> ::= {<NumValUint16>} {<Expression>} <FS> "UINT16"
<Pcd32> ::= <PcdName> <FS> <PcdUint32> <FS> <Token> <CbOrEol>
-<PcdUint32> ::= <NumValUint32> <FS> "UINT32"
+<PcdUint32> ::= {<NumValUint32>} {<Expression>} <FS> "UINT32"
<Pcd64> ::= <PcdName> <FS> <PcdUint64> <FS> <Token> <CbOrEol>
-<PcdUint64> ::= <NumValUint64> <FS> "UINT64"
+<PcdUint64> ::= {<NumValUint64>} {<Expression>} <FS> "UINT64"
<PcdPtr> ::= <PcdName> <FS> <PcdPtrVal> <FS> <Token> <CbOrEol>
<PcdPtrVal> ::= <PtrVal> <FS> "VOID*"
-<PtrVal> ::= {<CString>} {<CArray>}
-<Token> ::= <NumValUint32>
+<PtrVal> ::= {<StringVal>} {<Expression>}
+<Token> ::= {<LongNum>} {<UINT32>}
<DoxComment> ::= <TS> {<Range>+} {<List>} {<Express>+}
<Prompt> ::= "#" <TS> "@Prompt <MTS> <AsciiString> <EOL>
<Range> ::= "#" <TS> "@ValidRange" <TS> <ERangeValues> <EOL>
<ERangeValues> ::= [<ErrorCode> <TS>] <RangeValues>
<List> ::= "#" <TS> "@ValidList" <TS> <EValidValueList> <EOL>
diff --git a/3_edk_ii_dec_file_format/32_package_declaration_dec_definitions.md b/3_edk_ii_dec_file_format/32_package_declaration_dec_definitions.md
index 8e473f2..c701603 100644
--- a/3_edk_ii_dec_file_format/32_package_declaration_dec_definitions.md
+++ b/3_edk_ii_dec_file_format/32_package_declaration_dec_definitions.md
@@ -86,15 +86,16 @@ DEC file (for example, `<Expression>` statements are not permitted).
<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
@@ -112,15 +113,16 @@ DEC file (for example, `<Expression>` statements are not permitted).
<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> "#" [<TS> <AsciiString>] <EOL>+
<Comment> ::= "#" <TS> <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>?
@@ -157,11 +159,12 @@ DEC file (for example, `<Expression>` statements are not permitted).
<Number> ::= {<Integer>} {<HexNumber>}
<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>
@@ -182,14 +185,49 @@ DEC file (for example, `<Expression>` statements are not permitted).
<HexDigit> <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>}
+ {"{"<ValUint16> [<CommaSpace> <ValUint16>]*"}"}
+<NumValUint32> ::= {<ValUint32>}
+ {"{"<ValUint32> [<CommaSpace> <ValUint32>]*"}"}
+<NumValUint64> ::= {<ValUint64>}
+ {"{"<ValUint64> [<CommaSpace> <ValUint64>]*"}"}
+<StringVal> ::= {<UnicodeString>} {<CString>} {<Array>}
+<Array> ::= "{" {<Array>} {[<Lable>] <ArrayVal>
+ [<CommaSpace> [<Lable>] <ArrayVal>]* } "}"
+<ArrayVal> ::= {<Num8Array>} {<GuidStr>} {<DevicePath>}
+<NonNumType> ::= {<BoolVal>}{<UnicodeString>} {<CString>}
+ {<Offset>} {<UintMac>}
+<Num8Array> ::= {<NonNumType>} {<ShortNum>} {<UINT8>}
+<Num16Array> ::= {<NonNumType>} {<IntNum>} {<UINT16>}
+<Num32Array> ::= {<NonNumType>} {<LongNum>} {<UINT32>}
+<Num64Array> ::= {<NonNumType>} {<LongLongNum>} {<UINT64>}
+<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
+<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"}
@@ -200,10 +238,18 @@ DEC file (for example, `<Expression>` statements are not permitted).
<OA> ::= (a-zA-Z)(a-zA-Z0-9)*
<arch> ::= {"IA32"} {"X64"} {"IPF"} {"EBC"} {<OA>}
```
**********
+**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 DEC file, provided they follow
the rules that a comment may not be enclosed within Section headers, and that
@@ -233,14 +279,14 @@ must cause a build break.
**********
**_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 format string. The
-build tools parser must treat all content between the field separators
+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 format
+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_**
--
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] DEC spec: Add flexible PCD value format into spec > >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_dec_file_format/310_pcd_sections.md | 14 ++-- > .../32_package_declaration_dec_definitions.md | 74 >++++++++++++++++++---- > 2 files changed, 67 insertions(+), 21 deletions(-) > >diff --git a/3_edk_ii_dec_file_format/310_pcd_sections.md >b/3_edk_ii_dec_file_format/310_pcd_sections.md >index 488f17f..36c32ff 100644 >--- a/3_edk_ii_dec_file_format/310_pcd_sections.md >+++ b/3_edk_ii_dec_file_format/310_pcd_sections.md >@@ -113,24 +113,24 @@ PCDs listed in `PcdsFeatureFlag` sections must only >be listed in > [<TS> <Prompt>] > [<DoxComment>] <PcdEntry> > <PcdEntry> ::= <TS> {<PcdBool>} {<PcdNumEntry>} {<PcdPtr>} > <PcdNumEntry> ::= {<Pcd8>} {<Pcd16>} {<Pcd32>} {<Pcd64>} > <PcdBool> ::= <PcdName> <FS> <BoolPcd> <FS> <Token> <CbOrEol> >-<BoolPcd> ::= <BoolType> <FS> "BOOLEAN" >+<BoolPcd> ::= <Boolean> <FS> "BOOLEAN" > <CbOrEol> ::= {<CommentBlock>} {<EOL>} > <Pcd8> ::= <PcdName> <FS> <PcdUint8> <FS> <Token> <CbOrEol> >-<PcdUint8> ::= <NumValUint8> <FS> "UINT8" >+<PcdUint8> ::= {<NumValUint8>} {<Expression>} <FS> "UINT8" > <Pcd16> ::= <PcdName> <FS> <PcdUint16> <FS> <Token> <CbOrEol> >-<PcdUint16> ::= <NumValUint16> <FS> "UINT16" >+<PcdUint16> ::= {<NumValUint16>} {<Expression>} <FS> "UINT16" > <Pcd32> ::= <PcdName> <FS> <PcdUint32> <FS> <Token> <CbOrEol> >-<PcdUint32> ::= <NumValUint32> <FS> "UINT32" >+<PcdUint32> ::= {<NumValUint32>} {<Expression>} <FS> "UINT32" > <Pcd64> ::= <PcdName> <FS> <PcdUint64> <FS> <Token> <CbOrEol> >-<PcdUint64> ::= <NumValUint64> <FS> "UINT64" >+<PcdUint64> ::= {<NumValUint64>} {<Expression>} <FS> "UINT64" > <PcdPtr> ::= <PcdName> <FS> <PcdPtrVal> <FS> <Token> <CbOrEol> > <PcdPtrVal> ::= <PtrVal> <FS> "VOID*" >-<PtrVal> ::= {<CString>} {<CArray>} >-<Token> ::= <NumValUint32> >+<PtrVal> ::= {<StringVal>} {<Expression>} >+<Token> ::= {<LongNum>} {<UINT32>} > <DoxComment> ::= <TS> {<Range>+} {<List>} {<Express>+} > <Prompt> ::= "#" <TS> "@Prompt <MTS> <AsciiString> <EOL> > <Range> ::= "#" <TS> "@ValidRange" <TS> <ERangeValues> <EOL> > <ERangeValues> ::= [<ErrorCode> <TS>] <RangeValues> > <List> ::= "#" <TS> "@ValidList" <TS> <EValidValueList> <EOL> >diff --git >a/3_edk_ii_dec_file_format/32_package_declaration_dec_definitions.md >b/3_edk_ii_dec_file_format/32_package_declaration_dec_definitions.md >index 8e473f2..c701603 100644 >--- a/3_edk_ii_dec_file_format/32_package_declaration_dec_definitions.md >+++ >b/3_edk_ii_dec_file_format/32_package_declaration_dec_definitions.md >@@ -86,15 +86,16 @@ DEC file (for example, `<Expression>` statements are >not permitted). > <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 >@@ -112,15 +113,16 @@ DEC file (for example, `<Expression>` statements are >not permitted). > <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> "#" [<TS> <AsciiString>] <EOL>+ > <Comment> ::= "#" <TS> <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>? >@@ -157,11 +159,12 @@ DEC file (for example, `<Expression>` statements are >not permitted). > <Number> ::= {<Integer>} {<HexNumber>} > <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> >@@ -182,14 +185,49 @@ DEC file (for example, `<Expression>` statements are >not permitted). > <HexDigit> <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>} >+ {"{"<ValUint16> [<CommaSpace> <ValUint16>]*"}"} >+<NumValUint32> ::= {<ValUint32>} >+ {"{"<ValUint32> [<CommaSpace> <ValUint32>]*"}"} >+<NumValUint64> ::= {<ValUint64>} >+ {"{"<ValUint64> [<CommaSpace> <ValUint64>]*"}"} >+<StringVal> ::= {<UnicodeString>} {<CString>} {<Array>} >+<Array> ::= "{" {<Array>} {[<Lable>] <ArrayVal> >+ [<CommaSpace> [<Lable>] <ArrayVal>]* } "}" >+<ArrayVal> ::= {<Num8Array>} {<GuidStr>} {<DevicePath>} >+<NonNumType> ::= {<BoolVal>}{<UnicodeString>} {<CString>} >+ {<Offset>} {<UintMac>} >+<Num8Array> ::= {<NonNumType>} {<ShortNum>} {<UINT8>} >+<Num16Array> ::= {<NonNumType>} {<IntNum>} {<UINT16>} >+<Num32Array> ::= {<NonNumType>} {<LongNum>} {<UINT32>} >+<Num64Array> ::= {<NonNumType>} {<LongLongNum>} {<UINT64>} >+<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 >+<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"} >@@ -200,10 +238,18 @@ DEC file (for example, `<Expression>` statements are >not permitted). > <OA> ::= (a-zA-Z)(a-zA-Z0-9)* > <arch> ::= {"IA32"} {"X64"} {"IPF"} {"EBC"} {<OA>} > ``` > > ********** >+**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 DEC file, provided they >follow > the rules that a comment may not be enclosed within Section headers, and >that >@@ -233,14 +279,14 @@ must cause a build break. > ********** > > **_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 format string. The >-build tools parser must treat all content between the field separators >+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 >format >+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_** > >-- >2.6.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
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 +++++++++++++--------
.../33_platform_dsc_definition.md | 78 +++++++---
2 files changed, 161 insertions(+), 77 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/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>}
+ {"{"<ValUint16> [<CommaSpace> <ValUint16>]*"}"}
+<NumValUint32> ::= {<ValUint32>}
+ {"{"<ValUint32> [<CommaSpace> <ValUint32>]*"}"}
+<NumValUint64> ::= {<ValUint64>}
+ {"{"<ValUint64> [<CommaSpace> <ValUint64>]*"}"}
+<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
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
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>
---
.../32_component_inf_definition.md | 75 +++++++++++++++++-----
3_edk_ii_inf_file_format/38_pcd_sections.md | 39 ++++++-----
2 files changed, 83 insertions(+), 31 deletions(-)
diff --git a/3_edk_ii_inf_file_format/32_component_inf_definition.md b/3_edk_ii_inf_file_format/32_component_inf_definition.md
index 72bcf2c..ef70927 100644
--- a/3_edk_ii_inf_file_format/32_component_inf_definition.md
+++ b/3_edk_ii_inf_file_format/32_component_inf_definition.md
@@ -111,15 +111,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
@@ -137,15 +138,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" <Major> <Minor>
<Major> ::= <HexDigit>? <HexDigit>? <HexDigit>?
@@ -181,14 +183,14 @@ The following are common definitions used by multiple section types.
<Number> ::= {<Integer>} {<HexNumber>}
<HexNz> ::= (\x1 - \xFFFFFFFFFFFFFFFF)
<NumNz> ::= (1-18446744073709551615)
<GZ> ::= {<NumNz>} {<HexNz>}
<TRUE> ::= {"TRUE"} {"true"} {"True"} {"0x1"} {"0x01"} {"1"}
- {<GZ>}
<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>
@@ -209,14 +211,49 @@ The following are common definitions used by multiple section types.
<HexDigit> <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>}
+ {"{"<ValUint16> [<CommaSpace> <ValUint16>]*"}"}
+<NumValUint32> ::= {<ValUint32>}
+ {"{"<ValUint32> [<CommaSpace> <ValUint32>]*"}"}
+<NumValUint64> ::= {<ValUint64>}
+ {"{"<ValUint64> [<CommaSpace> <ValUint64>]*"}"}
+<StringVal> ::= {<UnicodeString>} {<CString>} {<Array>}
+<Array> ::= "{" {<Array>} {[<Lable>] <ArrayVal>
+ [<CommaSpace> [<Lable>] <ArrayVal>]* } "}"
+<ArrayVal> ::= {<Num8Array>} {<GuidStr>} {<DevicePath>}
+<NonNumType> ::= {<BoolVal>} {<UnicodeString>} {<CString>}
+ {<Offset>} {<UintMac>}
+<Num8Array> ::= {<NonNumType>} {<ShortNum>} {<UINT8>}
+<Num16Array> ::= {<NonNumType>} {<IntNum>} {<UINT16>}
+<Num32Array> ::= {<NonNumType>} {<LongNum>} {<UINT32>}
+<Num64Array> ::= {<NonNumType>} {<LongLongNum>} {<UINT64>}
+<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
+<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"}
@@ -233,10 +270,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 INF file, provided they follow
the rules that a comment may not be enclosed within Section headers, and that
@@ -252,14 +297,14 @@ in line comments must appear at the end of a statement.
Expression syntax is defined the _EDK II Expression Syntax Specification_.
**_Unicode String_**
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 encoded string. The
-build tools parser must treat all content between the field separators
+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 encoded
+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_**
diff --git a/3_edk_ii_inf_file_format/38_pcd_sections.md b/3_edk_ii_inf_file_format/38_pcd_sections.md
index cef87a8..82636d5 100644
--- a/3_edk_ii_inf_file_format/38_pcd_sections.md
+++ b/3_edk_ii_inf_file_format/38_pcd_sections.md
@@ -124,34 +124,41 @@ content.
<ValuePcd> ::= <TS> <PcdName> <FS> <ValUse>
<ValUse> ::= <AsBuiltValue> <TailCmt>
<ValueOffsetPcd> ::= [<NUsageBlock>]
<TS> <PcdName> <FS> <ValOffUse>
<ValOffUse> ::= <AsBuiltValue> <Offset> <TailCmt>
-<Offset> ::= <FS> <NumValUint32>
+<Offset> ::= <FS> {<LongNum>} {<UINT32>}
<AsBuiltByteArray> ::= "{" <NList> "}"
<AsBuiltValue> ::= if (pcddatumtype == "BOOLEAN"):
- {"0x00"} {"0x01"} elif (pcddatumtype == "UINT8"):
- <UINT8z> elif (pcddatumtype == "UINT16"):
- <UINT16z> elif (pcddatumtype == "UINT32"): <UINT32z>
+ {"0x00"} {"0x01"}
+ elif (pcddatumtype == "UINT8"):
+ <UINT8z>
+ elif (pcddatumtype == "UINT16"):
+ <UINT16z>
+ elif (pcddatumtype == "UINT32"):
+ <UINT32z>
elif (pcddatumtype == "UINT64"):
- <UINT64z> else:
- <AsBuiltByteArray>
+ <UINT64z>
+ else:
+ <AsBuiltByteArray>
<PcdEntries> ::= [<NUsageBlock>]
<TS> <PcdName> [<PField1>] <TailCmt>
<PField1> ::= <FS> [<Value>] [<FFE>]
<Value> ::= if (pcddatumtype == "BOOLEAN"):
- <Boolean> elif (pcddatumtype == "UINT8"):
- <NumValUint8> elif (pcddatumtype == "UINT16"):
- <NumValUint16> elif (pcddatumtype == "UINT32"):
- <NumValUint32> elif (pcddatumtype == "UINT64"):
- <NumValUint64> else:
- <StringVal>
-<StringVal> ::= {<StringType>} {<CArray>}
-<StringType> ::= {<UnicodeString>} {<CString>}
+ <Boolean>
+ elif (pcddatumtype == "UINT8"):
+ {<NumValUint8>} {<Expression>}
+ elif (pcddatumtype == "UINT16"):
+ {<NumValUint16>} {<Expression>}
+ elif (pcddatumtype == "UINT32"):
+ {<NumValUint32>} {<Expression>}
+ elif (pcddatumtype == "UINT64"):
+ {<NumValUint64>} {<Expression>}
+ else:
+ {<StringVal>} {<Expression>}
<FFE> ::= <FS> <FeatureFlagExpress>
- <1
-UsageBlock> ::= <CommentBlock>
+<1UsageBlock> ::= <CommentBlock>
<NUsageBlock> ::= <CommentBlock>+
<FeatureFlagExpress> ::= <Boolean>
<CommentBlock> ::= <TS> ["##" <TS> <Usage>] <TS> <CmtOrEol>
<CmtOrEol> ::= {<Comment>} {<EOL>}
<Usage> ::= {"CONSUMES"} {"SOMETIMES_CONSUMES"}
--
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] INF spec: Add flexible PCD value format into spec > >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> >--- > .../32_component_inf_definition.md | 75 +++++++++++++++++----- > 3_edk_ii_inf_file_format/38_pcd_sections.md | 39 ++++++----- > 2 files changed, 83 insertions(+), 31 deletions(-) > >diff --git a/3_edk_ii_inf_file_format/32_component_inf_definition.md >b/3_edk_ii_inf_file_format/32_component_inf_definition.md >index 72bcf2c..ef70927 100644 >--- a/3_edk_ii_inf_file_format/32_component_inf_definition.md >+++ b/3_edk_ii_inf_file_format/32_component_inf_definition.md >@@ -111,15 +111,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 >@@ -137,15 +138,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" <Major> <Minor> > <Major> ::= <HexDigit>? <HexDigit>? <HexDigit>? >@@ -181,14 +183,14 @@ The following are common definitions used by >multiple section types. > <Number> ::= {<Integer>} {<HexNumber>} > <HexNz> ::= (\x1 - \xFFFFFFFFFFFFFFFF) > <NumNz> ::= (1-18446744073709551615) > <GZ> ::= {<NumNz>} {<HexNz>} > <TRUE> ::= {"TRUE"} {"true"} {"True"} {"0x1"} {"0x01"} {"1"} >- {<GZ>} > <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> >@@ -209,14 +211,49 @@ The following are common definitions used by >multiple section types. > <HexDigit> <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>} >+ {"{"<ValUint16> [<CommaSpace> <ValUint16>]*"}"} >+<NumValUint32> ::= {<ValUint32>} >+ {"{"<ValUint32> [<CommaSpace> <ValUint32>]*"}"} >+<NumValUint64> ::= {<ValUint64>} >+ {"{"<ValUint64> [<CommaSpace> <ValUint64>]*"}"} >+<StringVal> ::= {<UnicodeString>} {<CString>} {<Array>} >+<Array> ::= "{" {<Array>} {[<Lable>] <ArrayVal> >+ [<CommaSpace> [<Lable>] <ArrayVal>]* } "}" >+<ArrayVal> ::= {<Num8Array>} {<GuidStr>} {<DevicePath>} >+<NonNumType> ::= {<BoolVal>} {<UnicodeString>} {<CString>} >+ {<Offset>} {<UintMac>} >+<Num8Array> ::= {<NonNumType>} {<ShortNum>} {<UINT8>} >+<Num16Array> ::= {<NonNumType>} {<IntNum>} {<UINT16>} >+<Num32Array> ::= {<NonNumType>} {<LongNum>} {<UINT32>} >+<Num64Array> ::= {<NonNumType>} {<LongLongNum>} {<UINT64>} >+<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 >+<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"} >@@ -233,10 +270,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 INF file, provided they >follow > the rules that a comment may not be enclosed within Section headers, and >that >@@ -252,14 +297,14 @@ in line comments must appear at the end of a >statement. > Expression syntax is defined the _EDK II Expression Syntax Specification_. > > **_Unicode String_** > > 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 encoded string. >The >-build tools parser must treat all content between the field separators >+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 >encoded >+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_** > >diff --git a/3_edk_ii_inf_file_format/38_pcd_sections.md >b/3_edk_ii_inf_file_format/38_pcd_sections.md >index cef87a8..82636d5 100644 >--- a/3_edk_ii_inf_file_format/38_pcd_sections.md >+++ b/3_edk_ii_inf_file_format/38_pcd_sections.md >@@ -124,34 +124,41 @@ content. > <ValuePcd> ::= <TS> <PcdName> <FS> <ValUse> > <ValUse> ::= <AsBuiltValue> <TailCmt> > <ValueOffsetPcd> ::= [<NUsageBlock>] > <TS> <PcdName> <FS> <ValOffUse> > <ValOffUse> ::= <AsBuiltValue> <Offset> <TailCmt> >-<Offset> ::= <FS> <NumValUint32> >+<Offset> ::= <FS> {<LongNum>} {<UINT32>} > <AsBuiltByteArray> ::= "{" <NList> "}" > <AsBuiltValue> ::= if (pcddatumtype == "BOOLEAN"): >- {"0x00"} {"0x01"} elif (pcddatumtype == "UINT8"): >- <UINT8z> elif (pcddatumtype == "UINT16"): >- <UINT16z> elif (pcddatumtype == "UINT32"): <UINT32z> >+ {"0x00"} {"0x01"} >+ elif (pcddatumtype == "UINT8"): >+ <UINT8z> >+ elif (pcddatumtype == "UINT16"): >+ <UINT16z> >+ elif (pcddatumtype == "UINT32"): >+ <UINT32z> > elif (pcddatumtype == "UINT64"): >- <UINT64z> else: >- <AsBuiltByteArray> >+ <UINT64z> >+ else: >+ <AsBuiltByteArray> > <PcdEntries> ::= [<NUsageBlock>] > <TS> <PcdName> [<PField1>] <TailCmt> > <PField1> ::= <FS> [<Value>] [<FFE>] > <Value> ::= if (pcddatumtype == "BOOLEAN"): >- <Boolean> elif (pcddatumtype == "UINT8"): >- <NumValUint8> elif (pcddatumtype == "UINT16"): >- <NumValUint16> elif (pcddatumtype == "UINT32"): >- <NumValUint32> elif (pcddatumtype == "UINT64"): >- <NumValUint64> else: >- <StringVal> >-<StringVal> ::= {<StringType>} {<CArray>} >-<StringType> ::= {<UnicodeString>} {<CString>} >+ <Boolean> >+ elif (pcddatumtype == "UINT8"): >+ {<NumValUint8>} {<Expression>} >+ elif (pcddatumtype == "UINT16"): >+ {<NumValUint16>} {<Expression>} >+ elif (pcddatumtype == "UINT32"): >+ {<NumValUint32>} {<Expression>} >+ elif (pcddatumtype == "UINT64"): >+ {<NumValUint64>} {<Expression>} >+ else: >+ {<StringVal>} {<Expression>} > <FFE> ::= <FS> <FeatureFlagExpress> >- <1 >-UsageBlock> ::= <CommentBlock> >+<1UsageBlock> ::= <CommentBlock> > <NUsageBlock> ::= <CommentBlock>+ > <FeatureFlagExpress> ::= <Boolean> > <CommentBlock> ::= <TS> ["##" <TS> <Usage>] <TS> <CmtOrEol> > <CmtOrEol> ::= {<Comment>} {<EOL>} > <Usage> ::= {"CONSUMES"} {"SOMETIMES_CONSUMES"} >-- >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.