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]
https://lists.01.org/mailman/listinfo/edk2-devel