Jiewen, Yes. It would be possible to support an OFFSET() operator, but we would have to add checks for overlaps and break the build if there is an overlap of bytes in the buffer for the PCD.
However, I want to emphasis that the purpose of this RFC is to initialize a VOID* PCD that cannot be associated with a C structure. Tim Lewis provided a very good example of a UEFI Load Option. There is a 2nd RFC for Structured PCDs, and that RFC covers how to initialize the values of named fields in a structure. Andrew Fish provided feedback that I am still evaluating that provides a method to initialize the contents of a PCD associated with a C structure using C syntax to initialize the fields with access to .h files for structs, enums, and #defines to initialize field values which is more flexible and readable than initializing field values with constants. I want to make sure we are adding features that will actually get used. Your example of an NVS structures seems to something that would be associated with a defined C structure, so may be out of scope for this specific RFC. Thanks, Mike From: Yao, Jiewen Sent: Thursday, June 30, 2016 5:47 PM To: Kinney, Michael D <[email protected]>; Gao, Liming <[email protected]>; [email protected]; Kinney, Michael D <[email protected]> Subject: RE: [RFC V2] Add more flexible PCD value formats in DEC/INF/DSC/FDF files HI Mike One possible "skip byte" usage is to align with ACPI ASL OPREGION global NVS structure. For example, Field(GNVS,AnyAcc,Lock,Preserve) { // // Miscellaneous Dynamic Registers: // Offset(0), AAAA, 16, Offset(4), BBBB, 8, Offset(6), CCCC, 8, I think we can claim to assign 0 to skipped field. Thank you Yao Jiewen From: edk2-devel [mailto:[email protected]] On Behalf Of Kinney, Michael D Sent: Friday, July 1, 2016 4:04 AM To: Gao, Liming <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>; Kinney, Michael D <[email protected]<mailto:[email protected]>> Subject: Re: [edk2] [RFC V2] Add more flexible PCD value formats in DEC/INF/DSC/FDF files Liming, Responses below. Mike > -----Original Message----- > From: Gao, Liming > Sent: Wednesday, June 22, 2016 6:33 PM > To: Kinney, Michael D > <[email protected]<mailto:[email protected]>>; > [email protected]<mailto:[email protected]>; Kinney, > Michael D <[email protected]<mailto:[email protected]>> > Subject: RE: [RFC V2] Add more flexible PCD value formats in DEC/INF/DSC/FDF > files > > Mike: > For GUID C Name in DEC file, how to find its value? Or require it be > defined in the > same package. DEC File - GUID C name must be defined in same package INF File - GUID C name must be defined in dependent package from [Packages] section DSC/FDF File - GUID C name must be defined in dependent package of module referenced in DSC/FDF > For VOID* byte array, could we support the usage to set the value in the > specified > offset. For example, VOID* { 0, 1, 2, OFFSET(8) 3, 4, 5 } Is this used to skip init of bytes? What value is assigned to skipped bytes? > > Thanks > Liming > > -----Original Message----- > > From: edk2-devel [mailto:[email protected]] On Behalf Of > > Kinney, Michael D > > Sent: Thursday, June 23, 2016 8:28 AM > > To: [email protected]<mailto:[email protected]>; Kinney, > > Michael D <[email protected]<mailto:[email protected]>> > > Subject: [edk2] [RFC V2] Add more flexible PCD value formats in > > DEC/INF/DSC/FDF files > > > > Hi > > > > I have updated this RFC to V2 that includes a concepts provided by > > Tim Lewis that includes extensions to initialize a VOID* PCD that > > cannot be described with a C structure (e.g. UEFI Load Option). > > > > The changes for V2 are: > > > > * Update examples to cover new syntax cases > > * Clarify that this proposal is for PCD values in DEC/INF/DSC/FDF > > files. Not just DEC/DSC. > > * Add support for multi character ASCII and UCS16 char constants > > and strings for VOID* PCD byte arrays > > * Add support for GUID() macro in VOID* PCD byte arrays > > * Add support for DEVICE_PATH() macro in VOID* PCD byte arrays > > * Add support for LABEL() and OFFSET_OF() macros in VOID* PCD > > byte arrays. > > * Add support for expressions to compute values. > > > > <proposal> > > > > I would like to propose more flexible value formats for PCDs > > in DEC/INF/DSC/FDF files and --pcd command line option. > > > > This would include the following additions: > > > > * ASCII character values using single quotes(e.g. 'A'). > > * ASCII multi-character values using single quotes(e.g. 'ABCD'). > > No null-terminator. > > * UCS16 character values using L and single quotes(e.g. L'A'). > > * UCS16 multi-character values using L and single quotes(e.g. L'ABCD'). > > No null-terminator. > > * Support TRUE/FALSE for UINT8/16/32/64 values > > * Support TRUE/FALSE in VOID* byte array > > * Support decimal values in VOID* byte array > > * Support ASCII single quote character values in VOID* byte arrays > > * Support byte arrays, ASCII string, Unicode String, > > ASCII multi-character strings, UCS16 multi-character strings for > > UINT8/16/32/64 values as long as they fit in the target type. > > * Support multi-character values using single quotes(e.g. 'ABCD') in > > VOID* byte arrays that are expanded to a sequence of byte values. > > * Support multi-character values using double quotes(e.g. "ABCD") in > > VOID* byte arrays that are expanded to a sequence of byte values. > > * Support UCS16 multi-character values using L and single quotes(e.g. > > L'ABCD') > > in VOID* byte arrays that are expanded to a sequence of byte values. > > * Support UCS16 multi-character values using L and double quotes(e.g. > > L"ABCD") > > in VOID* byte arrays that are expanded to a sequence of byte values. > > * Support UINT8(), UINT16, UINT32(), and UINT64() macros in > > VOID* byte arrays that are expanded to a sequence of byte values. > > * Support GUID() macro in VOID* byte arrays that are expanded to a > > sequence of 16 byte values. The GUID() operand supports Registry > > format GUIDs, C struct style GUIDs, and GUID C names. > > * Support DEVICE_PATH() macro in VOID* byte arrays that are expanded > > to a sequence of byte values. The DEVICE_PATH() operand is a > > double quoted string that follow the device path as string format > > defined in UEFI Specification 2.6 Section 9.6. > > * Support LABEL() macro in VOID* byte arrays to tag the byte > > offset of a location in a VOID* byte array. > > * Support OFFSET_OF() macro in VOID* byte arrays that returns the > > byte offset of a LABEL() declared in a VOID* byte array. > > * Support infix expressions that return an integer result that can > > be used to compute a PCD value with support for > > (, ), +, -, *, /, %, ~, &, |, ^ operators. > > > > Some examples of this additional flexibility are: > > BOOLEAN TRUE > > BOOLEAN FALSE > > BOOLEAN 0 > > BOOLEAN 1 > > BOOLEAN {0} > > BOOLEAN {1} > > UINT8 TRUE > > UINT8 FALSE > > UINT8 0x12 > > UINT8 12 > > UINT8 'A' > > UINT8 {TRUE} > > UINT8 {0x12} > > UINT8 {'A'} > > UINT8 (6 + 6) > > UINT16 TRUE > > UINT16 0x1234 > > UINT16 1234 > > UINT16 'AB' > > UINT16 "A" > > UINT16 L'A' > > UINT16 {0x34, TRUE} > > UINT16 {27, FALSE} > > UINT16 {'A', 'B'} > > UINT16 ('A' - 0x02) > > UINT32 FALSE > > UINT32 0x12345678 > > UINT32 12345678 > > UINT32 "ABC" > > UINT32 L"A" > > UINT32 'ABCD' > > UINT32 L'AB' > > UINT32 {0x12, 27, TRUE, 'A'} > > UINT32 ((5 * 0x100) / 0x10) > > UINT64 FALSE > > UINT64 0x1234567812345678 > > UINT64 1234567812345678 > > UINT64 "ABCDEFG" > > UINT64 L"ABC" > > UINT64 'ABCDEFGH' > > UINT64 L'ABCD' > > UINT64 {0x12, 27, TRUE, FALSE, 'A', 'B', 'C', 'D'} > > UINT64 (0x12345678 & 0xff00) > > VOID* {0x1, 0x2, 0x3} > > VOID* {10, 11, 12, 13, 14} > > VOID* {'X', 'Y', 'Z'} > > VOID* {TRUE, FALSE, FALSE, TRUE} > > VOID* {0x41, 0x42, 67, 68, 'E', 'F', TRUE, FALSE} > > VOID* { UINT8(7), UINT16(8), UINT32(0x27), UINT64(0x1234567812345678) } > > VOID* { 'AB', L'AB', "AB", L"AB" } > > VOID* { GUID("11E13869-1896-4A07-8B21-D8B23DD2A2B4") } > > VOID* { GUID({ 0x11e13869, 0x1896, 0x4a07, { 0x8b, 0x21, 0xd8, 0xb2, > > 0x3d, > > 0xd2, 0xa2, 0xb4 } }) } > > VOID* { GUID(gEfiBlockIoProtocolGuid) } > > VOID* { DEVICE_PATH("PciRoot(0)/Pci(0,0)") } > > VOID* { 0, 1, 2, LABEL(Start) 3, 4, 5, LABEL(End) 6, > > UINT8(OFFSET_OF(End) - > > OFFSET_OF(Start)) } > > > > </proposal> > > > > Mike > > > > _______________________________________________ > > edk2-devel mailing list > > [email protected]<mailto:[email protected]> > > https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list [email protected]<mailto:[email protected]> https://lists.01.org/mailman/listinfo/edk2-devel _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

