* [Patch] Build spec: Add flexible PCD value format into spec
@ 2018-01-31 16:00 Yonghong Zhu
2018-01-31 16:00 ` [Patch] DEC " Yonghong Zhu
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Yonghong Zhu @ 2018-01-31 16:00 UTC (permalink / raw)
To: edk2-devel; +Cc: Liming Gao, Michael Kinney, Kevin W Shaw
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 | 60 +++++++++++++++++++---
3 files changed, 65 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..3dbfc33 100644
--- a/appendix_d_buildexe_command/d4_usage.md
+++ b/appendix_d_buildexe_command/d4_usage.md
@@ -195,24 +195,68 @@ 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> ::= {<NumArray>} {<GuidStr>} {<DevicePath>}
+<NumArray> ::= {<Boolean>} {<Number>} {<String>} {<Offset>} {<UintMac>}
+<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(" <NumArray> ")"
+<Uint16Mac> ::= "UINT16(" <NumArray> ")"
+<Uint32Mac> ::= "UINT32(" <NumArray> ")"
+<Uint64Mac> ::= "UINT64(" <NumArray> ")"
+<Lable> ::= "LABEL(" <CName> ")"
+<Offset> ::= "OFFSET_OF(" <CName> ")"
```
--
2.6.1.windows.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Patch] DEC spec: Add flexible PCD value format into spec
2018-01-31 16:00 [Patch] Build spec: Add flexible PCD value format into spec Yonghong Zhu
@ 2018-01-31 16:00 ` Yonghong Zhu
2018-01-31 16:00 ` [Patch] DSC " Yonghong Zhu
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Yonghong Zhu @ 2018-01-31 16:00 UTC (permalink / raw)
To: edk2-devel; +Cc: Liming Gao, Michael Kinney, Kevin W Shaw
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 | 70 +++++++++++++++++-----
2 files changed, 63 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..d7f9067 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,45 @@ 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> ::= "{"[<Lable>] <ArrayVal>
+ [<CommaSpace> [<Lable>] <ArrayVal>]*"}"
+<ArrayVal> ::= {<NumArray>} {<GuidStr>} {<DevicePath>}
+<NumArray> ::= {<BoolVal>} {<Number>} {<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
+<UintMac> ::= {<Uint8Mac>} {<Uint16Mac>} {<Uint32Mac>} {<Uint64Mac>}
+<Uint8Mac> ::= "UINT8(" <NumArray> ")"
+<Uint16Mac> ::= "UINT16(" <NumArray> ")"
+<Uint32Mac> ::= "UINT32(" <NumArray> ")"
+<Uint64Mac> ::= "UINT64(" <NumArray> ")"
+<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 +234,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 +275,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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Patch] DSC spec: Add flexible PCD value format into spec
2018-01-31 16:00 [Patch] Build spec: Add flexible PCD value format into spec Yonghong Zhu
2018-01-31 16:00 ` [Patch] DEC " Yonghong Zhu
@ 2018-01-31 16:00 ` Yonghong Zhu
2018-01-31 16:00 ` [Patch] FDF " Yonghong Zhu
2018-01-31 16:00 ` [Patch] INF " Yonghong Zhu
3 siblings, 0 replies; 5+ messages in thread
From: Yonghong Zhu @ 2018-01-31 16:00 UTC (permalink / raw)
To: edk2-devel; +Cc: Liming Gao, Michael Kinney, Kevin W Shaw
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 | 74 +++++++---
2 files changed, 157 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..618f681 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,45 @@ 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> ::= "{"[<Lable>] <ArrayVal>
+ [<CommaSpace> [<Lable>] <ArrayVal>]*"}"
+<ArrayVal> ::= {<NumArray>} {<GuidStr>} {<DevicePath>}
+<NumArray> ::= {<BoolVal>} {<Number>} {<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
+<UintMac> ::= {<Uint8Mac>} {<Uint16Mac>} {<Uint32Mac>} {<Uint64Mac>}
+<Uint8Mac> ::= "UINT8(" <NumArray> ")"
+<Uint16Mac> ::= "UINT16(" <NumArray> ")"
+<Uint32Mac> ::= "UINT32(" <NumArray> ")"
+<Uint64Mac> ::= "UINT64(" <NumArray> ")"
+<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 +278,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 +307,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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Patch] FDF spec: Add flexible PCD value format into spec
2018-01-31 16:00 [Patch] Build spec: Add flexible PCD value format into spec Yonghong Zhu
2018-01-31 16:00 ` [Patch] DEC " Yonghong Zhu
2018-01-31 16:00 ` [Patch] DSC " Yonghong Zhu
@ 2018-01-31 16:00 ` Yonghong Zhu
2018-01-31 16:00 ` [Patch] INF " Yonghong Zhu
3 siblings, 0 replies; 5+ messages in thread
From: Yonghong Zhu @ 2018-01-31 16:00 UTC (permalink / raw)
To: edk2-devel; +Cc: Liming Gao, Michael Kinney, Kevin W Shaw
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_fdf_design_discussion/24_[fd]_sections.md | 6 ---
2_fdf_design_discussion/25_[fv]_sections.md | 6 ---
2_fdf_design_discussion/26_[capsule]_sections.md | 6 ---
3_edk_ii_fdf_file_format/32_fdf_definition.md | 62 +++++++++++++++++++----
3_edk_ii_fdf_file_format/34_[defines]_section.md | 4 +-
3_edk_ii_fdf_file_format/35_[fd]_sections.md | 9 ++--
3_edk_ii_fdf_file_format/36_[fv]_sections.md | 2 +-
3_edk_ii_fdf_file_format/37_[capsule]_sections.md | 2 +-
8 files changed, 60 insertions(+), 37 deletions(-)
diff --git a/2_fdf_design_discussion/24_[fd]_sections.md b/2_fdf_design_discussion/24_[fd]_sections.md
index d55b793..2e1facb 100644
--- a/2_fdf_design_discussion/24_[fd]_sections.md
+++ b/2_fdf_design_discussion/24_[fd]_sections.md
@@ -155,16 +155,10 @@ The following is an example of the `SET` statement:
`SET gFlashDevicePkgTokenSpaceGuid.PcdEfiMemoryMapped = TRUE`
The `VALUE` specified must match the PCD's datum type and must be the content
data.
-For a PCD that has a datum type of `VOID`*, the data can be a Unicode string,
-as in `L"text"`, a valid C data array (it must be either a C format GUID or a
-hex byte array), as in `{0x20, 0x01, 0x50, 0x00, 0x32, 0xFF, 0x00, 0xAA, {0xFF, 0xF0, 0x00, 0x00, 0x00}}.`
-For other PCD datum types, the value may be a boolean or a hex value, as in
-`0x0000000F,` with a value that is consistent with the PCD's datum type.
-
The value may also be a macro or it may be computed, using arithmetic
operations, arithmetic expressions and or logical expressions. The value
portion of the `SET` statement, when using any of these computations are in-fix
expressions that are evaluated left to right, with items within parenthesis
evaluated before the outer expressions are evaluated. Use of parenthesis is
diff --git a/2_fdf_design_discussion/25_[fv]_sections.md b/2_fdf_design_discussion/25_[fv]_sections.md
index 7b50017..343e252 100644
--- a/2_fdf_design_discussion/25_[fv]_sections.md
+++ b/2_fdf_design_discussion/25_[fv]_sections.md
@@ -130,16 +130,10 @@ The following is an example of the `SET` statement:
`SET gEfiMyTokenSpaceGuid.PcdDisableOnboardVideo = TRUE`
The `VALUE` specified must match the Pcd's datum type and must be the content
data.
-For a PCD that has a datum type of `VOID`*, the data can be a Unicode string,
-as in `L"text"`, a valid C data array (it must be either a C format GUID or a
-hex byte array), as in `{0x20, 0x00, 0x20, 0x00, 0x32, 0xFF, 0x00, 0xAA, {0xFF, 0xF0, 0x00, 0x00, 0x00}}.`
-Other PCD datum types are either boolean values or a hex value, as in
-`0x0000000F`, with a value that is consistent with the PCD's datum type
-
The value may also be a macro or it may be computed, using arithmetic
operations, arithmetic expressions and or logical expressions. The value
portion of the `SET` statement, when using any of these computations are in-fix
expressions that are evaluated left to right, with items within parenthesis
evaluated before the outer expressions are evaluated. Use of parenthesis is
diff --git a/2_fdf_design_discussion/26_[capsule]_sections.md b/2_fdf_design_discussion/26_[capsule]_sections.md
index ba93268..d0b956a 100644
--- a/2_fdf_design_discussion/26_[capsule]_sections.md
+++ b/2_fdf_design_discussion/26_[capsule]_sections.md
@@ -97,16 +97,10 @@ The following is an example of the `SET` statement.
`SET gEfiMyTokenSpaceGuid.PcdSecStartLocalApicTimer = TRUE`
The `VALUE` specified must match the PCD's datum type and must be the content
data.
-For a PCD that has a datum type of `VOID`*, the data can be a Unicode string,
-as in `L"text"`, a valid C data array (it must be either a C format GUID or a
-hex Byte array), as in `{0x20002000, 0x32FF, 0x00AA, {0xFF, 0xF0, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xEF, 0x1A, 0x55}}.`
-Other PCD datum types are either boolean values or a hex value, as in
-`0x0000000F`, with a value that is consistent with the PCD's datum type.
-
### 2.6.3 Capsule Data
`EFI_CAPSULE_DATA` follows the `EFI_CAPSULE_HEADER` token definitions in the
`[Capsule]` section or sub-sections. The content consists of one or more files,
FD UiName, FV UiName or the following.
diff --git a/3_edk_ii_fdf_file_format/32_fdf_definition.md b/3_edk_ii_fdf_file_format/32_fdf_definition.md
index 1379db4..0eb9108 100644
--- a/3_edk_ii_fdf_file_format/32_fdf_definition.md
+++ b/3_edk_ii_fdf_file_format/32_fdf_definition.md
@@ -96,15 +96,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
@@ -122,15 +123,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>?
@@ -169,11 +171,12 @@ The following are common definitions used by multiple section types.
<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>
@@ -195,14 +198,45 @@ 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> ::= "{"[<Lable>] <ArrayVal>
+ [<CommaSpace> [<Lable>] <ArrayVal>]*"}"
+<ArrayVal> ::= {<NumArray>} {<GuidStr>} {<DevicePath>}
+<NumArray> ::= {<BoolVal>} {<Number>} {<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
+<UintMac> ::= {<Uint8Mac>} {<Uint16Mac>} {<Uint32Mac>} {<Uint64Mac>}
+<Uint8Mac> ::= "UINT8(" <NumArray> ")"
+<Uint16Mac> ::= "UINT16(" <NumArray> ")"
+<Uint32Mac> ::= "UINT32(" <NumArray> ")"
+<Uint64Mac> ::= "UINT64(" <NumArray> ")"
+<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"}
@@ -231,10 +265,18 @@ The following are common definitions used by multiple section types.
{"256K"} {"512K"} {"1M"} {"2M"} {"4M"} {"8M"}
{"16M"}
```
**********
+**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 FDF file, provided they follow
the rules that a comment may not be enclosed within Section headers, and that
diff --git a/3_edk_ii_fdf_file_format/34_[defines]_section.md b/3_edk_ii_fdf_file_format/34_[defines]_section.md
index 7011db8..5bbb890 100644
--- a/3_edk_ii_fdf_file_format/34_[defines]_section.md
+++ b/3_edk_ii_fdf_file_format/34_[defines]_section.md
@@ -60,12 +60,12 @@ Conditional statements may be used anywhere within this section.
[<TS> "FDF_VERSION" <Eq> <DecimalVersion> <EOL>] <DefStmts>*
<DefStmts> ::= {<MacroDefinition>} {<SetStmts>} {<IncludeStatement>}
<UiNameType> ::= <AsciiString>
<SpecVer> ::= {<HexVersion>} {(0-9)+ "." (0-9)+}
<SetStmts> ::= <TS> "SET" <MTS> <PcdName> <Eq> [<VALUE>] <EOL>
-<VALUE> ::= {<Number>} {<Boolean>} {<GUID>} {<CArray>}
- {<CString>} {<UnicodeString>} {<Expression>}
+<VALUE> ::= {<Number>} {<BoolVal>} {<Array>} {<UnicodeString>}
+ {<CString>} {<Expression>}
```
#### Parameters
**_Expression_**
diff --git a/3_edk_ii_fdf_file_format/35_[fd]_sections.md b/3_edk_ii_fdf_file_format/35_[fd]_sections.md
index 6c87ebd..8558e7e 100644
--- a/3_edk_ii_fdf_file_format/35_[fd]_sections.md
+++ b/3_edk_ii_fdf_file_format/35_[fd]_sections.md
@@ -65,11 +65,11 @@ Conditional statements may be used anywhere within this section.
<SetPcd> ::= <FS> <PcdName>
<BlockStatements> ::= <TS> "BlockSize" <Eq> <UINT32> [<SetPcd>]
<EOL>
[<TS> "NumBlocks" <Eq> <UINT32> <EOL>]
<SetStatements> ::= <TS> "SET" <PcdName> <Eq> <VALUE> <EOL>
-<VALUE> ::= {<Number>} {<Boolean>} {<GUID>} {<CArray>}
+<VALUE> ::= {<Number>} {<BoolVal>} {<Array>}
{<CString>} {<UnicodeString>} {<Expression>}
<RegionLayout> ::= <TS> <Offset> <FS> <Size> <EOL>
[<TS> <PcdOffset> [<FS> <PcdSize>] <EOL>]
[<RegionType>]
<Offset> ::= {<HexNumber>} {<Expression>}
@@ -149,14 +149,13 @@ in this the file.
The `FvUiName` must be specified in a `[FV]` section header defined in this the
file.
**_PcdValue_**
-The PCD Value may be a specific numeric value, an array of numeric bytes, a
-GUID, a quoted string, an L quoted string (representing a unicode string), an
-arithmetic expression, a logic expression or a macro from a previously defined
-macro statement.
+The PCD Value may be a specific numeric value, an byte array, a quoted
+string, an L quoted string (representing a unicode string), an expression
+or a macro from a previously defined macro statement.
**_Expression_**
Refer to the EDK II Expression Syntax Specification for more information.
diff --git a/3_edk_ii_fdf_file_format/36_[fv]_sections.md b/3_edk_ii_fdf_file_format/36_[fv]_sections.md
index b4f292a..63e877e 100644
--- a/3_edk_ii_fdf_file_format/36_[fv]_sections.md
+++ b/3_edk_ii_fdf_file_format/36_[fv]_sections.md
@@ -85,11 +85,11 @@ Conditional statements may be used anywhere within this section.
<GlobalStmts> ::= {<MacroDefinition>} {<IncludeStatement>}
<BlockStatements> ::= <FixedBlocks>
<FixedBlocks> ::= [<TS> "BlockSize" <Eq> <UINT32> <EOL>]
[<TS> "NumBlocks" <Eq> <UINT32> <EOL>]
<SetStatements> ::= <TS> "SET" <MTS> <PcdName> <Eq> <VALUE> <EOL>
-<VALUE> ::= {<Number>} {<Boolean>} {<GUID>} {<CArray>}
+<VALUE> ::= {<Number>} {<BoolVal>} {<Array>}
{<CString>} {<UnicodeString>} {<Expression>}
<FvAlignment> ::= [<TS> "FvBaseAddress" <Eq> <UINT64> <EOL>]
[<TS> "FvForceRebase" <Eq> <TrueFalse> <EOL>]
<TS> "FvAlignment" <Eq>
<FvAlignmentValues> <EOL>
diff --git a/3_edk_ii_fdf_file_format/37_[capsule]_sections.md b/3_edk_ii_fdf_file_format/37_[capsule]_sections.md
index 6606d56..673cb37 100644
--- a/3_edk_ii_fdf_file_format/37_[capsule]_sections.md
+++ b/3_edk_ii_fdf_file_format/37_[capsule]_sections.md
@@ -48,11 +48,11 @@ Conditional statements may be used anywhere within this section.
<Capsule> ::= "[Capsule" <UiCapsuleName> "]" <EOL>
<UefiTokens>
<CapsuleStmts>*
<UiCapsuleName> ::= "." <Word>
<SetStatements> ::= <TS> "SET" <MTS> <PcdName> <Eq> <VALUE> <EOL>
-<VALUE> ::= {<Number>} {<Boolean>} {<GUID>} {<CArray>}
+<VALUE> ::= {<Number>} {<BoolVal>} {<Array>}
{<CString>} {<UnicodeString>} {<Expression>}
<UefiTokens> ::= <TS> "CAPSULE_GUID" <Eq> <GuidValue> <EOL>
[<TS> "CAPSULE_HEADER_SIZE" <Eq> <Bytes> <EOL>] [<TS>
"CAPSULE_FLAGS" <Eq> <Flags> <EOL>]
[<TS> "CAPSULE_HEADER_INIT_VERSION" <Eq> <Hex2> <EOL>]
--
2.6.1.windows.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Patch] INF spec: Add flexible PCD value format into spec
2018-01-31 16:00 [Patch] Build spec: Add flexible PCD value format into spec Yonghong Zhu
` (2 preceding siblings ...)
2018-01-31 16:00 ` [Patch] FDF " Yonghong Zhu
@ 2018-01-31 16:00 ` Yonghong Zhu
3 siblings, 0 replies; 5+ messages in thread
From: Yonghong Zhu @ 2018-01-31 16:00 UTC (permalink / raw)
To: edk2-devel; +Cc: Liming Gao, Michael Kinney, Kevin W Shaw
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 | 71 +++++++++++++++++-----
3_edk_ii_inf_file_format/38_pcd_sections.md | 39 +++++++-----
2 files changed, 79 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..7af9072 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,45 @@ 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> ::= "{"[<Lable>] <ArrayVal>
+ [<CommaSpace> [<Lable>] <ArrayVal>]*"}"
+<ArrayVal> ::= {<NumArray>} {<GuidStr>} {<DevicePath>}
+<NumArray> ::= {<BoolVal>} {<Number>} {<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
+<UintMac> ::= {<Uint8Mac>} {<Uint16Mac>} {<Uint32Mac>} {<Uint64Mac>}
+<Uint8Mac> ::= "UINT8(" <NumArray> ")"
+<Uint16Mac> ::= "UINT16(" <NumArray> ")"
+<Uint32Mac> ::= "UINT32(" <NumArray> ")"
+<Uint64Mac> ::= "UINT64(" <NumArray> ")"
+<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 +266,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 +293,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
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-01-31 15:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-31 16:00 [Patch] Build spec: Add flexible PCD value format into spec Yonghong Zhu
2018-01-31 16:00 ` [Patch] DEC " Yonghong Zhu
2018-01-31 16:00 ` [Patch] DSC " Yonghong Zhu
2018-01-31 16:00 ` [Patch] FDF " Yonghong Zhu
2018-01-31 16:00 ` [Patch] INF " Yonghong Zhu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox