Skip to content

Commit 39acf3a

Browse files
committed
Dec Spec: Support the syntax of the structure array for structure PCD
In V2, update array style to more than one dimension array. In V3, Update Pcd Field value assignment with array index. BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1292 1. Support the syntax of the structure array for structure PCD 2. Add the syntax to initialize structure PCD with C style value Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
1 parent 6a6e6af commit 39acf3a

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

3_edk_ii_dec_file_format/310_pcd_sections.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ PCDs listed in `PcdsFeatureFlag` sections must only be listed in
125125
<PcdUint32> ::= {<NumValUint32>} {<Expression>} <FS> "UINT32"
126126
<Pcd64> ::= <PcdName> <FS> <PcdUint64> <FS> <Token> <CbOrEol>
127127
<PcdUint64> ::= {<NumValUint64>} {<Expression>} <FS> "UINT64"
128-
<PcdStruct> ::= <PcdName> <FS> <PtrVal> <FS> <CName> <FS> <Token> "{" <EOL>
128+
<PcdStruct> ::= <PcdName> <FS> <PtrVal> <FS> {<CName>} {<CArrayName>} <FS> <Token> "{" <EOL>
129129
<TS> <PcdStructHF>
130130
<TS> <PcdStructPKGs> "}" <CbOrEol>
131131
<PcdStructHF> ::= "<HeaderFile>" <EOL> <PcdStructFile>

3_edk_ii_dec_file_format/32_package_declaration_dec_definitions.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ DEC file (for example, `<Expression>` statements are not permitted).
8787
<NonDigit> ::= (a-zA-Z_)
8888
<Identifier> ::= <NonDigit> <Chars>*
8989
<CName> ::= <Identifier> # A valid C variable name.
90+
<CArrayName> ::= <Identifier>["["[<Number>]"]"]+ # A valid C variable array name.
9091
<AsciiChars> ::= (0x21 - 0x7E)
9192
<CChars> ::= [{0x21} {(0x23 - 0x26)} {(0x28 - 0x5B)}
9293
{(0x5D - 0x7E)} {<EscapeSequence>}]*
@@ -166,7 +167,7 @@ DEC file (for example, `<Expression>` statements are not permitted).
166167
<MACRO> ::= (A-Z)(A-Z0-9_)*
167168
<MACROVAL> ::= "$(" <MACRO> ")"
168169
<PcdName> ::= <TokenSpaceGuidCName> "." <PcdCName>
169-
<PcdFieldName> ::= <TokenSpaceGuidCName> "." <PcdCName> "." <Field>
170+
<PcdFieldName> ::= <TokenSpaceGuidCName> "." <PcdCName> ["["<Number>"]"]* "." <Field>
170171
<PcdCName> ::= <CName>
171172
<TokenSpaceGuidCName> ::= <CName>
172173
<PcdFieldEntry> ::= <PcdFieldName> <FS> <PcdFieldValue> <EOL>
@@ -208,14 +209,15 @@ DEC file (for example, `<Expression>` statements are not permitted).
208209
<StringVal> ::= {<UnicodeString>} {<CString>} {<Array>}
209210
<Array> ::= "{" {<Array>} {[<Lable>] <ArrayVal>
210211
[<CommaSpace> [<Lable>] <ArrayVal>]* } "}"
211-
<ArrayVal> ::= {<Num8Array>} {<GuidStr>} {<DevicePath>}
212+
<ArrayVal> ::= {<Num8Array>} {<GuidStr>} {<DevicePath>} {<CodeStr>}
212213
<NonNumType> ::= {<BoolVal>}{<UnicodeString>} {<CString>}
213214
{<Offset>} {<UintMac>}
214215
<Num8Array> ::= {<NonNumType>} {<ShortNum>} {<UINT8>}
215216
<Num16Array> ::= {<NonNumType>} {<IntNum>} {<UINT16>}
216217
<Num32Array> ::= {<NonNumType>} {<LongNum>} {<UINT32>}
217218
<Num64Array> ::= {<NonNumType>} {<LongLongNum>} {<UINT64>}
218219
<GuidStr> ::= "GUID(" <GuidVal> ")"
220+
<CodeStr> ::= "CODE(" <CData> ")"
219221
<GuidVal> ::= {<DblQuote> <RegistryFormatGUID> <DblQuote>}
220222
{<CFormatGUID>} {<CName>}
221223
<DevicePath> ::= "DEVICE_PATH(" <DevicePathStr> ")"
@@ -326,6 +328,11 @@ All C data arrays used in PCD value fields must be byte arrays. The C format
326328
GUID style is a special case that is permitted in some fields that use the
327329
`<CArray>` nomenclature.
328330
331+
**_CData_**
332+
333+
All C data used in PCD value CODE syntax can be C style value to initialize
334+
C structure or Array in C source code.
335+
329336
**_EOL_**
330337
331338
The DOS End Of Line: "0x0D 0x0A" character sequence must be used for all EDK II

0 commit comments

Comments
 (0)