* [PATCH v1 0/7] Add definitions introduced in UEFI 2.8 @ 2020-04-09 20:25 Oleksiy Yakovlev 2020-04-09 20:25 ` [PATCH v1 1/7] MdePkg: Extend SERIAL_IO with DeviceTypeGuid Oleksiy Yakovlev ` (7 more replies) 0 siblings, 8 replies; 15+ messages in thread From: Oleksiy Yakovlev @ 2020-04-09 20:25 UTC (permalink / raw) To: devel; +Cc: bob.c.feng, liming.gao, michael.d.kinney, Felixp, oleksiyy Following patches add/update structures/definitions, that was introduced/modified by UEFI Spec v.2.8. Oleksiy Yakovlev (7): MdePkg: Extend SERIAL_IO with DeviceTypeGuid (UEFI 2.8 mantis 1832) BaseTools: REST style formset (UEFI 2.8 mantis 1853) MdePkg: REST style formset (UEFI 2.8 mantis 1853) BaseTools: Bootable NVDIMM namespaces (UEFI 2.8 mantis 1858) MdePkg: Bootable NVDIMM namespaces (UEFI 2.8 mantis 1858) MdePkg: Add UEFI Spec Revision 2.8 (UEFI 2.8 mantis 1926) MdePkg: UEFI JSON Capsule Support (UEFI 2.8 mantis 1935) .../Common/UefiInternalFormRepresentation.h | 1 + BaseTools/Source/C/Include/Protocol/DevicePath.h | 12 +++ MdePkg/Include/Guid/CapsuleReport.h | 32 ++++++- MdePkg/Include/Guid/HiiPlatformSetupFormset.h | 4 + MdePkg/Include/Guid/JsonCapsule.h | 99 ++++++++++++++++++++++ MdePkg/Include/Protocol/DevicePath.h | 12 +++ MdePkg/Include/Protocol/SerialIo.h | 3 +- .../Include/Uefi/UefiInternalFormRepresentation.h | 1 + MdePkg/Include/Uefi/UefiSpec.h | 2 + MdePkg/MdePkg.dec | 12 +++ 10 files changed, 176 insertions(+), 2 deletions(-) create mode 100644 MdePkg/Include/Guid/JsonCapsule.h -- 2.9.0.windows.1 Please consider the environment before printing this email. The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission. ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v1 1/7] MdePkg: Extend SERIAL_IO with DeviceTypeGuid 2020-04-09 20:25 [PATCH v1 0/7] Add definitions introduced in UEFI 2.8 Oleksiy Yakovlev @ 2020-04-09 20:25 ` Oleksiy Yakovlev 2020-04-09 20:25 ` [PATCH v1 2/7] BaseTools: REST style formset Oleksiy Yakovlev ` (6 subsequent siblings) 7 siblings, 0 replies; 15+ messages in thread From: Oleksiy Yakovlev @ 2020-04-09 20:25 UTC (permalink / raw) To: devel; +Cc: bob.c.feng, liming.gao, michael.d.kinney, Felixp, oleksiyy EFI_SERIAL_IO_PROTOCOL_REVISION incremented to 0x00010001 and CONST EFI_GUID *DeviceTypeGuid field added to the protocol structure. (UEFI 2.8 mantis 1832) Signed-off-by: Oleksiy Yakovlev <oleksiyy@ami.com> --- MdePkg/Include/Protocol/SerialIo.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MdePkg/Include/Protocol/SerialIo.h b/MdePkg/Include/Protocol/SerialIo.h index 51eaa53..b2398c2 100644 --- a/MdePkg/Include/Protocol/SerialIo.h +++ b/MdePkg/Include/Protocol/SerialIo.h @@ -262,7 +262,7 @@ typedef struct { UINT32 StopBits; } EFI_SERIAL_IO_MODE; -#define EFI_SERIAL_IO_PROTOCOL_REVISION 0x00010000 +#define EFI_SERIAL_IO_PROTOCOL_REVISION 0x00010001 #define SERIAL_IO_INTERFACE_REVISION EFI_SERIAL_IO_PROTOCOL_REVISION /// @@ -287,6 +287,7 @@ struct _EFI_SERIAL_IO_PROTOCOL { /// Pointer to SERIAL_IO_MODE data. /// EFI_SERIAL_IO_MODE *Mode; + CONST EFI_GUID *DeviceTypeGuid; // Revision 1.1 }; extern EFI_GUID gEfiSerialIoProtocolGuid; -- 2.9.0.windows.1 Please consider the environment before printing this email. The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission. ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v1 2/7] BaseTools: REST style formset 2020-04-09 20:25 [PATCH v1 0/7] Add definitions introduced in UEFI 2.8 Oleksiy Yakovlev 2020-04-09 20:25 ` [PATCH v1 1/7] MdePkg: Extend SERIAL_IO with DeviceTypeGuid Oleksiy Yakovlev @ 2020-04-09 20:25 ` Oleksiy Yakovlev 2020-04-09 20:25 ` [PATCH v1 3/7] MdePkg: " Oleksiy Yakovlev ` (5 subsequent siblings) 7 siblings, 0 replies; 15+ messages in thread From: Oleksiy Yakovlev @ 2020-04-09 20:25 UTC (permalink / raw) To: devel; +Cc: bob.c.feng, liming.gao, michael.d.kinney, Felixp, oleksiyy New ClassGuid EFI_HII_REST_STYLE_FORMSET_GUID is defined. A formset with this class GUID indicates all the questions in the formset support REST style operation and can be exposed to a REST service point. In question level, a new flag EFI_IFR_FLAG_REST_STYLE is defined. An Opcode with this flag indicates this question support REST style operation and can be exposed to a REST service point. (UEFI 2.8 mantis 1853) Signed-off-by: Oleksiy Yakovlev <oleksiyy@ami.com> --- BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h | 1 + 1 file changed, 1 insertion(+) diff --git a/BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h b/BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h index b0bd7c5..ca6b509 100644 --- a/BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h +++ b/BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h @@ -728,6 +728,7 @@ typedef struct _EFI_IFR_QUESTION_HEADER { #define EFI_IFR_FLAG_READ_ONLY 0x01 #define EFI_IFR_FLAG_CALLBACK 0x04 #define EFI_IFR_FLAG_RESET_REQUIRED 0x10 +#define EFI_IFR_FLAG_REST_STYLE 0x20 #define EFI_IFR_FLAG_RECONNECT_REQUIRED 0x40 #define EFI_IFR_FLAG_OPTIONS_ONLY 0x80 -- 2.9.0.windows.1 Please consider the environment before printing this email. The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission. ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v1 3/7] MdePkg: REST style formset 2020-04-09 20:25 [PATCH v1 0/7] Add definitions introduced in UEFI 2.8 Oleksiy Yakovlev 2020-04-09 20:25 ` [PATCH v1 1/7] MdePkg: Extend SERIAL_IO with DeviceTypeGuid Oleksiy Yakovlev 2020-04-09 20:25 ` [PATCH v1 2/7] BaseTools: REST style formset Oleksiy Yakovlev @ 2020-04-09 20:25 ` Oleksiy Yakovlev 2020-04-09 20:25 ` [PATCH v1 4/7] BaseTools: Bootable NVDIMM namespaces Oleksiy Yakovlev ` (4 subsequent siblings) 7 siblings, 0 replies; 15+ messages in thread From: Oleksiy Yakovlev @ 2020-04-09 20:25 UTC (permalink / raw) To: devel; +Cc: bob.c.feng, liming.gao, michael.d.kinney, Felixp, oleksiyy New ClassGuid EFI_HII_REST_STYLE_FORMSET_GUID is defined. A formset with this class GUID indicates all the questions in the formset support REST style operation and can be exposed to a REST service point. In question level, a new flag EFI_IFR_FLAG_REST_STYLE is defined. An Opcode with this flag indicates this question support REST style operation and can be exposed to a REST service point. (UEFI 2.8 mantis 1853) Signed-off-by: Oleksiy Yakovlev <oleksiyy@ami.com> --- MdePkg/Include/Guid/HiiPlatformSetupFormset.h | 4 ++++ MdePkg/Include/Uefi/UefiInternalFormRepresentation.h | 1 + 2 files changed, 5 insertions(+) diff --git a/MdePkg/Include/Guid/HiiPlatformSetupFormset.h b/MdePkg/Include/Guid/HiiPlatformSetupFormset.h index 540483d..a6ba55b 100644 --- a/MdePkg/Include/Guid/HiiPlatformSetupFormset.h +++ b/MdePkg/Include/Guid/HiiPlatformSetupFormset.h @@ -22,8 +22,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #define EFI_HII_USER_CREDENTIAL_FORMSET_GUID \ { 0x337f4407, 0x5aee, 0x4b83, { 0xb2, 0xa7, 0x4e, 0xad, 0xca, 0x30, 0x88, 0xcd } } +#define EFI_HII_REST_STYLE_FORMSET_GUID \ + { 0x790217bd, 0xbecf, 0x485b, { 0x91, 0x70, 0x5f, 0xf7, 0x11, 0x31, 0x8b, 0x27 } } + extern EFI_GUID gEfiHiiPlatformSetupFormsetGuid; extern EFI_GUID gEfiHiiDriverHealthFormsetGuid; extern EFI_GUID gEfiHiiUserCredentialFormsetGuid; +extern EFI_GUID gEfiHiiRestStyleFormsetGuid; #endif diff --git a/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h b/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h index 4a1346a..40fcdb7 100644 --- a/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h +++ b/MdePkg/Include/Uefi/UefiInternalFormRepresentation.h @@ -825,6 +825,7 @@ typedef struct _EFI_IFR_QUESTION_HEADER { #define EFI_IFR_FLAG_READ_ONLY 0x01 #define EFI_IFR_FLAG_CALLBACK 0x04 #define EFI_IFR_FLAG_RESET_REQUIRED 0x10 +#define EFI_IFR_FLAG_REST_STYLE 0x20 #define EFI_IFR_FLAG_RECONNECT_REQUIRED 0x40 #define EFI_IFR_FLAG_OPTIONS_ONLY 0x80 -- 2.9.0.windows.1 Please consider the environment before printing this email. The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission. ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v1 4/7] BaseTools: Bootable NVDIMM namespaces 2020-04-09 20:25 [PATCH v1 0/7] Add definitions introduced in UEFI 2.8 Oleksiy Yakovlev ` (2 preceding siblings ...) 2020-04-09 20:25 ` [PATCH v1 3/7] MdePkg: " Oleksiy Yakovlev @ 2020-04-09 20:25 ` Oleksiy Yakovlev 2020-04-09 20:25 ` [PATCH v1 5/7] MdePkg: " Oleksiy Yakovlev ` (3 subsequent siblings) 7 siblings, 0 replies; 15+ messages in thread From: Oleksiy Yakovlev @ 2020-04-09 20:25 UTC (permalink / raw) To: devel; +Cc: bob.c.feng, liming.gao, michael.d.kinney, Felixp, oleksiyy Privided a mechanism for UEFI FW to identify and hand off bootable NVDIMM namespaces to the OS by standardizing the EFI device path. EFI device path for physical NVDIMM devices changed from an ACPI _ADR device to an ACPI NVDIMM device for correctness. (UEFI 2.8 mantis 1858) Signed-off-by: Oleksiy Yakovlev <oleksiyy@ami.com> --- BaseTools/Source/C/Include/Protocol/DevicePath.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/BaseTools/Source/C/Include/Protocol/DevicePath.h b/BaseTools/Source/C/Include/Protocol/DevicePath.h index e3571ef..7101bc2 100644 --- a/BaseTools/Source/C/Include/Protocol/DevicePath.h +++ b/BaseTools/Source/C/Include/Protocol/DevicePath.h @@ -719,6 +719,18 @@ typedef struct { UINT8 StopBits; } UART_DEVICE_PATH; +/// +/// NVDIMM Namespace Device Path SubType. +/// +#define NVDIMM_NAMESPACE_DP 0x20 +typedef struct { + EFI_DEVICE_PATH_PROTOCOL Header; + /// + /// Namespace unique label identifier UUID. + /// + EFI_GUID Uuid; +} NVDIMM_NAMESPACE_DEVICE_PATH; + // // Use VENDOR_DEVICE_PATH struct // -- 2.9.0.windows.1 Please consider the environment before printing this email. The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission. ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v1 5/7] MdePkg: Bootable NVDIMM namespaces 2020-04-09 20:25 [PATCH v1 0/7] Add definitions introduced in UEFI 2.8 Oleksiy Yakovlev ` (3 preceding siblings ...) 2020-04-09 20:25 ` [PATCH v1 4/7] BaseTools: Bootable NVDIMM namespaces Oleksiy Yakovlev @ 2020-04-09 20:25 ` Oleksiy Yakovlev 2020-04-09 20:25 ` [PATCH v1 6/7] MdePkg: Add UEFI Spec Revision 2.8 Oleksiy Yakovlev ` (2 subsequent siblings) 7 siblings, 0 replies; 15+ messages in thread From: Oleksiy Yakovlev @ 2020-04-09 20:25 UTC (permalink / raw) To: devel; +Cc: bob.c.feng, liming.gao, michael.d.kinney, Felixp, oleksiyy Privided a mechanism for UEFI FW to identify and hand off bootable NVDIMM namespaces to the OS by standardizing the EFI device path. EFI device path for physical NVDIMM devices changed from an ACPI _ADR device to an ACPI NVDIMM device for correctness. (UEFI 2.8 mantis 1858) Signed-off-by: Oleksiy Yakovlev <oleksiyy@ami.com> --- MdePkg/Include/Protocol/DevicePath.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/MdePkg/Include/Protocol/DevicePath.h b/MdePkg/Include/Protocol/DevicePath.h index aaec0a6..c1f8352 100644 --- a/MdePkg/Include/Protocol/DevicePath.h +++ b/MdePkg/Include/Protocol/DevicePath.h @@ -712,6 +712,18 @@ typedef struct { UINT8 StopBits; } UART_DEVICE_PATH; +/// +/// NVDIMM Namespace Device Path SubType. +/// +#define NVDIMM_NAMESPACE_DP 0x20 +typedef struct { + EFI_DEVICE_PATH_PROTOCOL Header; + /// + /// Namespace unique label identifier UUID. + /// + EFI_GUID Uuid; +} NVDIMM_NAMESPACE_DEVICE_PATH; + // // Use VENDOR_DEVICE_PATH struct // -- 2.9.0.windows.1 Please consider the environment before printing this email. The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission. ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v1 6/7] MdePkg: Add UEFI Spec Revision 2.8 2020-04-09 20:25 [PATCH v1 0/7] Add definitions introduced in UEFI 2.8 Oleksiy Yakovlev ` (4 preceding siblings ...) 2020-04-09 20:25 ` [PATCH v1 5/7] MdePkg: " Oleksiy Yakovlev @ 2020-04-09 20:25 ` Oleksiy Yakovlev 2020-04-09 20:25 ` [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support Oleksiy Yakovlev 2020-04-22 8:51 ` [edk2-devel] [PATCH v1 0/7] Add definitions introduced in UEFI 2.8 Zhiguang Liu 7 siblings, 0 replies; 15+ messages in thread From: Oleksiy Yakovlev @ 2020-04-09 20:25 UTC (permalink / raw) To: devel; +Cc: bob.c.feng, liming.gao, michael.d.kinney, Felixp, oleksiyy Added entrie in the EFI_SYSTEM_TABLE related definitions section, to signify UEFI 2.8 spec revision. (UEFI 2.8 mantis 1926) Signed-off-by: Oleksiy Yakovlev <oleksiyy@ami.com> --- MdePkg/Include/Uefi/UefiSpec.h | 1 + 1 file changed, 1 insertion(+) diff --git a/MdePkg/Include/Uefi/UefiSpec.h b/MdePkg/Include/Uefi/UefiSpec.h index 444aa35..c6d306d 100644 --- a/MdePkg/Include/Uefi/UefiSpec.h +++ b/MdePkg/Include/Uefi/UefiSpec.h @@ -1786,6 +1786,7 @@ EFI_STATUS // EFI Runtime Services Table // #define EFI_SYSTEM_TABLE_SIGNATURE SIGNATURE_64 ('I','B','I',' ','S','Y','S','T') +#define EFI_2_80_SYSTEM_TABLE_REVISION ((2 << 16) | (80)) #define EFI_2_70_SYSTEM_TABLE_REVISION ((2 << 16) | (70)) #define EFI_2_60_SYSTEM_TABLE_REVISION ((2 << 16) | (60)) #define EFI_2_50_SYSTEM_TABLE_REVISION ((2 << 16) | (50)) -- 2.9.0.windows.1 Please consider the environment before printing this email. The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission. ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support 2020-04-09 20:25 [PATCH v1 0/7] Add definitions introduced in UEFI 2.8 Oleksiy Yakovlev ` (5 preceding siblings ...) 2020-04-09 20:25 ` [PATCH v1 6/7] MdePkg: Add UEFI Spec Revision 2.8 Oleksiy Yakovlev @ 2020-04-09 20:25 ` Oleksiy Yakovlev 2020-04-22 8:50 ` [edk2-devel] " Zhiguang Liu 2020-04-22 8:51 ` [edk2-devel] [PATCH v1 0/7] Add definitions introduced in UEFI 2.8 Zhiguang Liu 7 siblings, 1 reply; 15+ messages in thread From: Oleksiy Yakovlev @ 2020-04-09 20:25 UTC (permalink / raw) To: devel; +Cc: bob.c.feng, liming.gao, michael.d.kinney, Felixp, oleksiyy Added Guids and structures, that defines the work flow to perform capsule update using JSON objects. (UEFI 2.8 mantis 1935) Signed-off-by: Oleksiy Yakovlev <oleksiyy@ami.com> --- MdePkg/Include/Guid/CapsuleReport.h | 32 +++++++++++- MdePkg/Include/Guid/JsonCapsule.h | 99 +++++++++++++++++++++++++++++++++++++ MdePkg/Include/Uefi/UefiSpec.h | 1 + MdePkg/MdePkg.dec | 12 +++++ 4 files changed, 143 insertions(+), 1 deletion(-) create mode 100644 MdePkg/Include/Guid/JsonCapsule.h diff --git a/MdePkg/Include/Guid/CapsuleReport.h b/MdePkg/Include/Guid/CapsuleReport.h index 93d2bb7..bdaf275 100644 --- a/MdePkg/Include/Guid/CapsuleReport.h +++ b/MdePkg/Include/Guid/CapsuleReport.h @@ -93,7 +93,37 @@ typedef struct { /// } EFI_CAPSULE_RESULT_VARIABLE_FMP; - +typedef struct { + + /// + /// Version of this structure, currently 0x00000001 + /// + UINT32 Version; + + /// + /// The unique identifier of the capsule whose processing result is recorded in this variable. + /// 0x00000000 b \x13 0xEFFFFFFF b \x13 Implementation Reserved + /// 0xF0000000 b \x13 0xFFFFFFFF b \x13 Specification Reserved + /// #define REDFISH_DEFINED_JSON_SCHEMA 0xF000000 + /// The JSON payload shall conform to a Redfish-defined JSON schema, see DMTF-Redfish + /// Specification. + /// + UINT32 CapsuleId; + + /// + /// The length of Resp in bytes. + /// + UINT32 RespLength; + + /// + /// Variable length buffer containing the replied JSON payload to the caller who delivered JSON + /// capsule to system. The definition of the JSON schema used in the replied payload is beyond + /// the scope of this specification. + /// + /// UINT8 Resp[]; + /// + } EFI_CAPSULE_RESULT_VARIABLE_JSON; + extern EFI_GUID gEfiCapsuleReportGuid; #endif diff --git a/MdePkg/Include/Guid/JsonCapsule.h b/MdePkg/Include/Guid/JsonCapsule.h new file mode 100644 index 0000000..eaa126f --- /dev/null +++ b/MdePkg/Include/Guid/JsonCapsule.h @@ -0,0 +1,99 @@ +/** @file +Guid & data structure for tables defined for reporting firmware configuration data to EFI +Configuration Tables and also for processing JSON payload capsule. + + +Copyright (c) 2020, American Megatrends International LLC. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _JSON_CAPSULE_GUID_H__ +#define _JSON_CAPSULE_GUID_H__ + +// +// The address reported in the table entry identified by EFI_JSON_CAPSULE_DATA_TABLE_GUID will be +// referenced as physical and will not be fixed up when transition from preboot to runtime phase. The +// addresses reported in these table entries identified by EFI_JSON_CONFIG_DATA_TABLE_GUID and +// EFI_JSON_CAPSULE_RESULT_TABLE_GUID will be referenced as virtual and will be fixed up when +// transition from preboot to runtime phase. +// +#define EFI_JSON_CONFIG_DATA_TABLE_GUID \ + {0x87367f87, 0x1119, 0x41ce, \ + {0xaa, 0xec, 0x8b, 0xe0, 0x11, 0x1f, 0x55, 0x8a }} +#define EFI_JSON_CAPSULE_DATA_TABLE_GUID \ + {0x35e7a725, 0x8dd2, 0x4cac, \ + {0x80, 0x11, 0x33, 0xcd, 0xa8, 0x10, 0x90, 0x56 }} +#define EFI_JSON_CAPSULE_RESULT_TABLE_GUID \ + {0xdbc461c3, 0xb3de, 0x422a,\ + {0xb9, 0xb4, 0x98, 0x86, 0xfd, 0x49, 0xa1, 0xe5 }} +#define EFI_JSON_CAPSULE_ID_GUID \ + {0x67d6f4cd, 0xd6b8, 0x4573, \ + {0xbf, 0x4a, 0xde, 0x5e, 0x25, 0x2d, 0x61, 0xae }} + + + + +#pragma pack(1) + +typedef struct { + /// + /// Version of the structure, initially 0x00000001. + /// + UINT32 Version; + + /// + /// The unique identifier of this capsule. + /// + UINT32 CapsuleId; + + /// + /// The length of the JSON payload immediately following this header, in bytes. + /// + UINT32 PayloadLength; + + /// + /// Variable length buffer containing the JSON payload that should be parsed and applied to the system. The + /// definition of the JSON schema used in the payload is beyond the scope of this specification. + /// UINT8 Payload[]; +} EFI_JSON_CAPSULE_HEADER; + +typedef struct { + /// + /// The length of the following ConfigData, in bytes. + /// + UINT32 ConfigDataLength; + + /// + /// Variable length buffer containing the JSON payload that describes one group of configuration data within + /// current system. The definition of the JSON schema used in this payload is beyond the scope of this specification. + /// + ///UINT8 ConfigData[ConfigDataLength]; +} EFI_JSON_CONFIG_DATA_ITEM; + +typedef struct { + /// + /// Version of the structure, initially 0x00000001. + /// + UINT32 Version; + + /// + ////The total length of EFI_JSON_CAPSULE_CONFIG_DATA, in bytes. + /// + UINT32 TotalLength; + + /// + /// Array of configuration data groups. + /// + /// EFI_JSON_CONFIG_DATA_ITEM ConfigDataList[]; +} EFI_JSON_CAPSULE_CONFIG_DATA; + +#pragma pack() + +extern EFI_GUID gEfiJsonConfigDataTableGuid; +extern EFI_GUID gEfiJsonCapsuleDataTableGuid; +extern EFI_GUID gEfiJsonCapsuleResultTableGuid; +extern EFI_GUID gEfiJsonCapsuleIdGuid; + + +#endif diff --git a/MdePkg/Include/Uefi/UefiSpec.h b/MdePkg/Include/Uefi/UefiSpec.h index c6d306d..ce1b624 100644 --- a/MdePkg/Include/Uefi/UefiSpec.h +++ b/MdePkg/Include/Uefi/UefiSpec.h @@ -1781,6 +1781,7 @@ EFI_STATUS #define EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED 0x0000000000000008 #define EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED 0x0000000000000010 #define EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY 0x0000000000000040 +#define EFI_OS_INDICATIONS_JSON_CONFIG_DATA_REFRESH 0x0000000000000080 // // EFI Runtime Services Table diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index ac1f533..77c573e 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -646,6 +646,18 @@ gEfiBttAbstractionGuid = { 0x18633bfc, 0x1735, 0x4217, { 0x8a, 0xc9, 0x17, 0x23, 0x92, 0x82, 0xd3, 0xf8 }} # + # GUIDs defined in UEFI2.8 + # + ## Include/Guid/JsonCapsule.h + gEfiJsonConfigDataTableGuid = { 0x87367f87, 0x1119, 0x41ce, { 0xaa, 0xec, 0x8b, 0xe0, 0x11, 0x1f, 0x55, 0x8a }} + gEfiJsonCapsuleDataTableGuid = { 0x35e7a725, 0x8dd2, 0x4cac, { 0x80, 0x11, 0x33, 0xcd, 0xa8, 0x10, 0x90, 0x56 }} + gEfiJsonCapsuleResultTableGuid = { 0xdbc461c3, 0xb3de, 0x422a, { 0xb9, 0xb4, 0x98, 0x86, 0xfd, 0x49, 0xa1, 0xe5 }} + gEfiJsonCapsuleIdGuid = { 0x67d6f4cd, 0xd6b8, 0x4573, { 0xbf, 0x4a, 0xde, 0x5e, 0x25, 0x2d, 0x61, 0xae }} + + ## Include\Guid\HiiPlatformSetupFormset.h + gEfiHiiResetStyleFormsetGuid = { 0x790217bd, 0xbecf, 0x485b, { 0x91, 0x70, 0x5f, 0xf7, 0x11, 0x31, 0x8b, 0x27 }} + + # # GUID defined in PI1.0 # ## Include/Guid/AprioriFileName.h -- 2.9.0.windows.1 Please consider the environment before printing this email. The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission. ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [edk2-devel] [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support 2020-04-09 20:25 ` [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support Oleksiy Yakovlev @ 2020-04-22 8:50 ` Zhiguang Liu 2020-04-22 20:41 ` Oleksiy Yakovlev 0 siblings, 1 reply; 15+ messages in thread From: Zhiguang Liu @ 2020-04-22 8:50 UTC (permalink / raw) To: devel@edk2.groups.io, oleksiyy@ami.com Cc: Feng, Bob C, Gao, Liming, Kinney, Michael D, Felixp@ami.com Hi Oleksiy, The definition of EFI_JSON_CONFIG_DATA_ITEM doesn't totally follow the spec. It is as below in spec without commenting ConfigData. typedef struct { UINT32 ConfigDataLength; UINT8 ConfigData[ConfigDataLength]; } EFI_JSON_CONFIG_DATA_ITEM; Can you explain why? Thanks Zhiguang -----Original Message----- From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Oleksiy Yakovlev Sent: Friday, April 10, 2020 4:26 AM To: devel@edk2.groups.io Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Felixp@ami.com; oleksiyy@ami.com Subject: [edk2-devel] [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support Added Guids and structures, that defines the work flow to perform capsule update using JSON objects. (UEFI 2.8 mantis 1935) Signed-off-by: Oleksiy Yakovlev <oleksiyy@ami.com> --- MdePkg/Include/Guid/CapsuleReport.h | 32 +++++++++++- MdePkg/Include/Guid/JsonCapsule.h | 99 +++++++++++++++++++++++++++++++++++++ MdePkg/Include/Uefi/UefiSpec.h | 1 + MdePkg/MdePkg.dec | 12 +++++ 4 files changed, 143 insertions(+), 1 deletion(-) create mode 100644 MdePkg/Include/Guid/JsonCapsule.h diff --git a/MdePkg/Include/Guid/CapsuleReport.h b/MdePkg/Include/Guid/CapsuleReport.h index 93d2bb7..bdaf275 100644 --- a/MdePkg/Include/Guid/CapsuleReport.h +++ b/MdePkg/Include/Guid/CapsuleReport.h @@ -93,7 +93,37 @@ typedef struct { /// } EFI_CAPSULE_RESULT_VARIABLE_FMP; - +typedef struct { + + /// + /// Version of this structure, currently 0x00000001 + /// + UINT32 Version; + + /// + /// The unique identifier of the capsule whose processing result is recorded in this variable. + /// 0x00000000 b 0xEFFFFFFF b Implementation Reserved + /// 0xF0000000 b 0xFFFFFFFF b Specification Reserved + /// #define REDFISH_DEFINED_JSON_SCHEMA 0xF000000 + /// The JSON payload shall conform to a Redfish-defined JSON schema, see DMTF-Redfish + /// Specification. + /// + UINT32 CapsuleId; + + /// + /// The length of Resp in bytes. + /// + UINT32 RespLength; + + /// + /// Variable length buffer containing the replied JSON payload to the caller who delivered JSON + /// capsule to system. The definition of the JSON schema used in the replied payload is beyond + /// the scope of this specification. + /// + /// UINT8 Resp[]; + /// + } EFI_CAPSULE_RESULT_VARIABLE_JSON; + extern EFI_GUID gEfiCapsuleReportGuid; #endif diff --git a/MdePkg/Include/Guid/JsonCapsule.h b/MdePkg/Include/Guid/JsonCapsule.h new file mode 100644 index 0000000..eaa126f --- /dev/null +++ b/MdePkg/Include/Guid/JsonCapsule.h @@ -0,0 +1,99 @@ +/** @file +Guid & data structure for tables defined for reporting firmware configuration data to EFI +Configuration Tables and also for processing JSON payload capsule. + + +Copyright (c) 2020, American Megatrends International LLC. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _JSON_CAPSULE_GUID_H__ +#define _JSON_CAPSULE_GUID_H__ + +// +// The address reported in the table entry identified by EFI_JSON_CAPSULE_DATA_TABLE_GUID will be +// referenced as physical and will not be fixed up when transition from preboot to runtime phase. The +// addresses reported in these table entries identified by EFI_JSON_CONFIG_DATA_TABLE_GUID and +// EFI_JSON_CAPSULE_RESULT_TABLE_GUID will be referenced as virtual and will be fixed up when +// transition from preboot to runtime phase. +// +#define EFI_JSON_CONFIG_DATA_TABLE_GUID \ + {0x87367f87, 0x1119, 0x41ce, \ + {0xaa, 0xec, 0x8b, 0xe0, 0x11, 0x1f, 0x55, 0x8a }} +#define EFI_JSON_CAPSULE_DATA_TABLE_GUID \ + {0x35e7a725, 0x8dd2, 0x4cac, \ + {0x80, 0x11, 0x33, 0xcd, 0xa8, 0x10, 0x90, 0x56 }} +#define EFI_JSON_CAPSULE_RESULT_TABLE_GUID \ + {0xdbc461c3, 0xb3de, 0x422a,\ + {0xb9, 0xb4, 0x98, 0x86, 0xfd, 0x49, 0xa1, 0xe5 }} +#define EFI_JSON_CAPSULE_ID_GUID \ + {0x67d6f4cd, 0xd6b8, 0x4573, \ + {0xbf, 0x4a, 0xde, 0x5e, 0x25, 0x2d, 0x61, 0xae }} + + + + +#pragma pack(1) + +typedef struct { + /// + /// Version of the structure, initially 0x00000001. + /// + UINT32 Version; + + /// + /// The unique identifier of this capsule. + /// + UINT32 CapsuleId; + + /// + /// The length of the JSON payload immediately following this header, in bytes. + /// + UINT32 PayloadLength; + + /// + /// Variable length buffer containing the JSON payload that should be parsed and applied to the system. The + /// definition of the JSON schema used in the payload is beyond the scope of this specification. + /// UINT8 Payload[]; +} EFI_JSON_CAPSULE_HEADER; + +typedef struct { + /// + /// The length of the following ConfigData, in bytes. + /// + UINT32 ConfigDataLength; + + /// + /// Variable length buffer containing the JSON payload that describes one group of configuration data within + /// current system. The definition of the JSON schema used in this payload is beyond the scope of this specification. + /// + ///UINT8 ConfigData[ConfigDataLength]; +} EFI_JSON_CONFIG_DATA_ITEM; + +typedef struct { + /// + /// Version of the structure, initially 0x00000001. + /// + UINT32 Version; + + /// + ////The total length of EFI_JSON_CAPSULE_CONFIG_DATA, in bytes. + /// + UINT32 TotalLength; + + /// + /// Array of configuration data groups. + /// + /// EFI_JSON_CONFIG_DATA_ITEM ConfigDataList[]; +} EFI_JSON_CAPSULE_CONFIG_DATA; + +#pragma pack() + +extern EFI_GUID gEfiJsonConfigDataTableGuid; +extern EFI_GUID gEfiJsonCapsuleDataTableGuid; +extern EFI_GUID gEfiJsonCapsuleResultTableGuid; +extern EFI_GUID gEfiJsonCapsuleIdGuid; + + +#endif diff --git a/MdePkg/Include/Uefi/UefiSpec.h b/MdePkg/Include/Uefi/UefiSpec.h index c6d306d..ce1b624 100644 --- a/MdePkg/Include/Uefi/UefiSpec.h +++ b/MdePkg/Include/Uefi/UefiSpec.h @@ -1781,6 +1781,7 @@ EFI_STATUS #define EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED 0x0000000000000008 #define EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED 0x0000000000000010 #define EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY 0x0000000000000040 +#define EFI_OS_INDICATIONS_JSON_CONFIG_DATA_REFRESH 0x0000000000000080 // // EFI Runtime Services Table diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index ac1f533..77c573e 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -646,6 +646,18 @@ gEfiBttAbstractionGuid = { 0x18633bfc, 0x1735, 0x4217, { 0x8a, 0xc9, 0x17, 0x23, 0x92, 0x82, 0xd3, 0xf8 }} # + # GUIDs defined in UEFI2.8 + # + ## Include/Guid/JsonCapsule.h + gEfiJsonConfigDataTableGuid = { 0x87367f87, 0x1119, 0x41ce, { 0xaa, 0xec, 0x8b, 0xe0, 0x11, 0x1f, 0x55, 0x8a }} + gEfiJsonCapsuleDataTableGuid = { 0x35e7a725, 0x8dd2, 0x4cac, { 0x80, 0x11, 0x33, 0xcd, 0xa8, 0x10, 0x90, 0x56 }} + gEfiJsonCapsuleResultTableGuid = { 0xdbc461c3, 0xb3de, 0x422a, { 0xb9, 0xb4, 0x98, 0x86, 0xfd, 0x49, 0xa1, 0xe5 }} + gEfiJsonCapsuleIdGuid = { 0x67d6f4cd, 0xd6b8, 0x4573, { 0xbf, 0x4a, 0xde, 0x5e, 0x25, 0x2d, 0x61, 0xae }} + + ## Include\Guid\HiiPlatformSetupFormset.h + gEfiHiiResetStyleFormsetGuid = { 0x790217bd, 0xbecf, 0x485b, { 0x91, 0x70, 0x5f, 0xf7, 0x11, 0x31, 0x8b, 0x27 }} + + # # GUID defined in PI1.0 # ## Include/Guid/AprioriFileName.h -- 2.9.0.windows.1 Please consider the environment before printing this email. The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission. ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [edk2-devel] [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support 2020-04-22 8:50 ` [edk2-devel] " Zhiguang Liu @ 2020-04-22 20:41 ` Oleksiy Yakovlev 2020-04-23 2:30 ` Zhiguang Liu 0 siblings, 1 reply; 15+ messages in thread From: Oleksiy Yakovlev @ 2020-04-22 20:41 UTC (permalink / raw) To: Liu, Zhiguang, devel@edk2.groups.io Cc: Feng, Bob C, Gao, Liming, Kinney, Michael D, Felix Polyudov [-- Attachment #1: Type: text/plain, Size: 9935 bytes --] Hi Zhiguang. Thank you for your feedback. Using definition from Spec: typedef struct { UINT32 ConfigDataLength; UINT8 ConfigData[ConfigDataLength]; } EFI_JSON_CONFIG_DATA_ITEM; will result in build error. You can't use structure field to define array size. I addressed this issue by commenting out ConfigData, because 3 additional structures, introduced by same mantis use this approach for arrays of unknown size. But discussing it further with my colleagues here at AMI, we decided that commenting out arrays of unknown size in structures make them harder to use. So I proposed another approach - use UINT8 ConfigData[]; for this structure and for additional 3 structures introduced by this JSON capsule update feature. See here: Mantis 2096<https://mantis.uefi.noclick_org/mantis/view.php?id=2096> Regards, Oleksiy. -----Original Message----- From: Liu, Zhiguang [mailto:zhiguang.liu@intel.com] Sent: Wednesday, April 22, 2020 4:51 AM To: devel@edk2.groups.io; Oleksiy Yakovlev Cc: Feng, Bob C; Gao, Liming; Kinney, Michael D; Felix Polyudov Subject: RE: [edk2-devel] [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support Hi Oleksiy, The definition of EFI_JSON_CONFIG_DATA_ITEM doesn't totally follow the spec. It is as below in spec without commenting ConfigData. typedef struct { UINT32 ConfigDataLength; UINT8 ConfigData[ConfigDataLength]; } EFI_JSON_CONFIG_DATA_ITEM; Can you explain why? Thanks Zhiguang -----Original Message----- From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Oleksiy Yakovlev Sent: Friday, April 10, 2020 4:26 AM To: devel@edk2.groups.io Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Felixp@ami.com; oleksiyy@ami.com Subject: [edk2-devel] [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support Added Guids and structures, that defines the work flow to perform capsule update using JSON objects. (UEFI 2.8 mantis 1935) Signed-off-by: Oleksiy Yakovlev <oleksiyy@ami.com> --- MdePkg/Include/Guid/CapsuleReport.h | 32 +++++++++++- MdePkg/Include/Guid/JsonCapsule.h | 99 +++++++++++++++++++++++++++++++++++++ MdePkg/Include/Uefi/UefiSpec.h | 1 + MdePkg/MdePkg.dec | 12 +++++ 4 files changed, 143 insertions(+), 1 deletion(-) create mode 100644 MdePkg/Include/Guid/JsonCapsule.h diff --git a/MdePkg/Include/Guid/CapsuleReport.h b/MdePkg/Include/Guid/CapsuleReport.h index 93d2bb7..bdaf275 100644 --- a/MdePkg/Include/Guid/CapsuleReport.h +++ b/MdePkg/Include/Guid/CapsuleReport.h @@ -93,7 +93,37 @@ typedef struct { /// } EFI_CAPSULE_RESULT_VARIABLE_FMP; - +typedef struct { + + /// + /// Version of this structure, currently 0x00000001 + /// + UINT32 Version; + + /// + /// The unique identifier of the capsule whose processing result is recorded in this variable. + /// 0x00000000 b 0xEFFFFFFF b Implementation Reserved + /// 0xF0000000 b 0xFFFFFFFF b Specification Reserved + /// #define REDFISH_DEFINED_JSON_SCHEMA 0xF000000 + /// The JSON payload shall conform to a Redfish-defined JSON schema, see DMTF-Redfish + /// Specification. + /// + UINT32 CapsuleId; + + /// + /// The length of Resp in bytes. + /// + UINT32 RespLength; + + /// + /// Variable length buffer containing the replied JSON payload to the caller who delivered JSON + /// capsule to system. The definition of the JSON schema used in the replied payload is beyond + /// the scope of this specification. + /// + /// UINT8 Resp[]; + /// + } EFI_CAPSULE_RESULT_VARIABLE_JSON; + extern EFI_GUID gEfiCapsuleReportGuid; #endif diff --git a/MdePkg/Include/Guid/JsonCapsule.h b/MdePkg/Include/Guid/JsonCapsule.h new file mode 100644 index 0000000..eaa126f --- /dev/null +++ b/MdePkg/Include/Guid/JsonCapsule.h @@ -0,0 +1,99 @@ +/** @file +Guid & data structure for tables defined for reporting firmware configuration data to EFI +Configuration Tables and also for processing JSON payload capsule. + + +Copyright (c) 2020, American Megatrends International LLC. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _JSON_CAPSULE_GUID_H__ +#define _JSON_CAPSULE_GUID_H__ + +// +// The address reported in the table entry identified by EFI_JSON_CAPSULE_DATA_TABLE_GUID will be +// referenced as physical and will not be fixed up when transition from preboot to runtime phase. The +// addresses reported in these table entries identified by EFI_JSON_CONFIG_DATA_TABLE_GUID and +// EFI_JSON_CAPSULE_RESULT_TABLE_GUID will be referenced as virtual and will be fixed up when +// transition from preboot to runtime phase. +// +#define EFI_JSON_CONFIG_DATA_TABLE_GUID \ + {0x87367f87, 0x1119, 0x41ce, \ + {0xaa, 0xec, 0x8b, 0xe0, 0x11, 0x1f, 0x55, 0x8a }} +#define EFI_JSON_CAPSULE_DATA_TABLE_GUID \ + {0x35e7a725, 0x8dd2, 0x4cac, \ + {0x80, 0x11, 0x33, 0xcd, 0xa8, 0x10, 0x90, 0x56 }} +#define EFI_JSON_CAPSULE_RESULT_TABLE_GUID \ + {0xdbc461c3, 0xb3de, 0x422a,\ + {0xb9, 0xb4, 0x98, 0x86, 0xfd, 0x49, 0xa1, 0xe5 }} +#define EFI_JSON_CAPSULE_ID_GUID \ + {0x67d6f4cd, 0xd6b8, 0x4573, \ + {0xbf, 0x4a, 0xde, 0x5e, 0x25, 0x2d, 0x61, 0xae }} + + + + +#pragma pack(1) + +typedef struct { + /// + /// Version of the structure, initially 0x00000001. + /// + UINT32 Version; + + /// + /// The unique identifier of this capsule. + /// + UINT32 CapsuleId; + + /// + /// The length of the JSON payload immediately following this header, in bytes. + /// + UINT32 PayloadLength; + + /// + /// Variable length buffer containing the JSON payload that should be parsed and applied to the system. The + /// definition of the JSON schema used in the payload is beyond the scope of this specification. + /// UINT8 Payload[]; +} EFI_JSON_CAPSULE_HEADER; + +typedef struct { + /// + /// The length of the following ConfigData, in bytes. + /// + UINT32 ConfigDataLength; + + /// + /// Variable length buffer containing the JSON payload that describes one group of configuration data within + /// current system. The definition of the JSON schema used in this payload is beyond the scope of this specification. + /// + ///UINT8 ConfigData[ConfigDataLength]; +} EFI_JSON_CONFIG_DATA_ITEM; + +typedef struct { + /// + /// Version of the structure, initially 0x00000001. + /// + UINT32 Version; + + /// + ////The total length of EFI_JSON_CAPSULE_CONFIG_DATA, in bytes. + /// + UINT32 TotalLength; + + /// + /// Array of configuration data groups. + /// + /// EFI_JSON_CONFIG_DATA_ITEM ConfigDataList[]; +} EFI_JSON_CAPSULE_CONFIG_DATA; + +#pragma pack() + +extern EFI_GUID gEfiJsonConfigDataTableGuid; +extern EFI_GUID gEfiJsonCapsuleDataTableGuid; +extern EFI_GUID gEfiJsonCapsuleResultTableGuid; +extern EFI_GUID gEfiJsonCapsuleIdGuid; + + +#endif diff --git a/MdePkg/Include/Uefi/UefiSpec.h b/MdePkg/Include/Uefi/UefiSpec.h index c6d306d..ce1b624 100644 --- a/MdePkg/Include/Uefi/UefiSpec.h +++ b/MdePkg/Include/Uefi/UefiSpec.h @@ -1781,6 +1781,7 @@ EFI_STATUS #define EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED 0x0000000000000008 #define EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED 0x0000000000000010 #define EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY 0x0000000000000040 +#define EFI_OS_INDICATIONS_JSON_CONFIG_DATA_REFRESH 0x0000000000000080 // // EFI Runtime Services Table diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index ac1f533..77c573e 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -646,6 +646,18 @@ gEfiBttAbstractionGuid = { 0x18633bfc, 0x1735, 0x4217, { 0x8a, 0xc9, 0x17, 0x23, 0x92, 0x82, 0xd3, 0xf8 }} # + # GUIDs defined in UEFI2.8 + # + ## Include/Guid/JsonCapsule.h + gEfiJsonConfigDataTableGuid = { 0x87367f87, 0x1119, 0x41ce, { 0xaa, 0xec, 0x8b, 0xe0, 0x11, 0x1f, 0x55, 0x8a }} + gEfiJsonCapsuleDataTableGuid = { 0x35e7a725, 0x8dd2, 0x4cac, { 0x80, 0x11, 0x33, 0xcd, 0xa8, 0x10, 0x90, 0x56 }} + gEfiJsonCapsuleResultTableGuid = { 0xdbc461c3, 0xb3de, 0x422a, { 0xb9, 0xb4, 0x98, 0x86, 0xfd, 0x49, 0xa1, 0xe5 }} + gEfiJsonCapsuleIdGuid = { 0x67d6f4cd, 0xd6b8, 0x4573, { 0xbf, 0x4a, 0xde, 0x5e, 0x25, 0x2d, 0x61, 0xae }} + + ## Include\Guid\HiiPlatformSetupFormset.h + gEfiHiiResetStyleFormsetGuid = { 0x790217bd, 0xbecf, 0x485b, { 0x91, 0x70, 0x5f, 0xf7, 0x11, 0x31, 0x8b, 0x27 }} + + # # GUID defined in PI1.0 # ## Include/Guid/AprioriFileName.h -- 2.9.0.windows.1 Please consider the environment before printing this email. The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission. Please consider the environment before printing this email. The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission. [-- Attachment #2: Type: text/html, Size: 15876 bytes --] ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [edk2-devel] [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support 2020-04-22 20:41 ` Oleksiy Yakovlev @ 2020-04-23 2:30 ` Zhiguang Liu 2020-04-23 2:38 ` Rothman, Michael A 0 siblings, 1 reply; 15+ messages in thread From: Zhiguang Liu @ 2020-04-23 2:30 UTC (permalink / raw) To: Oleksiy Yakovlev, devel@edk2.groups.io Cc: Feng, Bob C, Gao, Liming, Kinney, Michael D, Felix Polyudov [-- Attachment #1: Type: text/plain, Size: 10796 bytes --] Hi Oleksiy, I agree with you that your original code change is good. But I can't open the link you posted. Can you send your new code change here, so that everyone can give their comments. Thanks Zhiguang From: Oleksiy Yakovlev <Oleksiyy@ami.com> Sent: Thursday, April 23, 2020 4:41 AM To: Liu, Zhiguang <zhiguang.liu@intel.com>; devel@edk2.groups.io Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Felix Polyudov <Felixp@ami.com> Subject: RE: [edk2-devel] [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support Hi Zhiguang. Thank you for your feedback. Using definition from Spec: typedef struct { UINT32 ConfigDataLength; UINT8 ConfigData[ConfigDataLength]; } EFI_JSON_CONFIG_DATA_ITEM; will result in build error. You can't use structure field to define array size. I addressed this issue by commenting out ConfigData, because 3 additional structures, introduced by same mantis use this approach for arrays of unknown size. But discussing it further with my colleagues here at AMI, we decided that commenting out arrays of unknown size in structures make them harder to use. So I proposed another approach - use UINT8 ConfigData[]; for this structure and for additional 3 structures introduced by this JSON capsule update feature. See here: Mantis 2096<https://mantis.uefi.noclick_org/mantis/view.php?id=2096> Regards, Oleksiy. -----Original Message----- From: Liu, Zhiguang [mailto:zhiguang.liu@intel.com] Sent: Wednesday, April 22, 2020 4:51 AM To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Oleksiy Yakovlev Cc: Feng, Bob C; Gao, Liming; Kinney, Michael D; Felix Polyudov Subject: RE: [edk2-devel] [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support Hi Oleksiy, The definition of EFI_JSON_CONFIG_DATA_ITEM doesn't totally follow the spec. It is as below in spec without commenting ConfigData. typedef struct { UINT32 ConfigDataLength; UINT8 ConfigData[ConfigDataLength]; } EFI_JSON_CONFIG_DATA_ITEM; Can you explain why? Thanks Zhiguang -----Original Message----- From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> On Behalf Of Oleksiy Yakovlev Sent: Friday, April 10, 2020 4:26 AM To: devel@edk2.groups.io<mailto:devel@edk2.groups.io> Cc: Feng, Bob C <bob.c.feng@intel.com<mailto:bob.c.feng@intel.com>>; Gao, Liming <liming.gao@intel.com<mailto:liming.gao@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; Felixp@ami.com<mailto:Felixp@ami.com>; oleksiyy@ami.com<mailto:oleksiyy@ami.com> Subject: [edk2-devel] [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support Added Guids and structures, that defines the work flow to perform capsule update using JSON objects. (UEFI 2.8 mantis 1935) Signed-off-by: Oleksiy Yakovlev <oleksiyy@ami.com<mailto:oleksiyy@ami.com>> --- MdePkg/Include/Guid/CapsuleReport.h | 32 +++++++++++- MdePkg/Include/Guid/JsonCapsule.h | 99 +++++++++++++++++++++++++++++++++++++ MdePkg/Include/Uefi/UefiSpec.h | 1 + MdePkg/MdePkg.dec | 12 +++++ 4 files changed, 143 insertions(+), 1 deletion(-) create mode 100644 MdePkg/Include/Guid/JsonCapsule.h diff --git a/MdePkg/Include/Guid/CapsuleReport.h b/MdePkg/Include/Guid/CapsuleReport.h index 93d2bb7..bdaf275 100644 --- a/MdePkg/Include/Guid/CapsuleReport.h +++ b/MdePkg/Include/Guid/CapsuleReport.h @@ -93,7 +93,37 @@ typedef struct { /// } EFI_CAPSULE_RESULT_VARIABLE_FMP; - +typedef struct { + + /// + /// Version of this structure, currently 0x00000001 + /// + UINT32 Version; + + /// + /// The unique identifier of the capsule whose processing result is recorded in this variable. + /// 0x00000000 b 0xEFFFFFFF b Implementation Reserved + /// 0xF0000000 b 0xFFFFFFFF b Specification Reserved + /// #define REDFISH_DEFINED_JSON_SCHEMA 0xF000000 + /// The JSON payload shall conform to a Redfish-defined JSON schema, see DMTF-Redfish + /// Specification. + /// + UINT32 CapsuleId; + + /// + /// The length of Resp in bytes. + /// + UINT32 RespLength; + + /// + /// Variable length buffer containing the replied JSON payload to the caller who delivered JSON + /// capsule to system. The definition of the JSON schema used in the replied payload is beyond + /// the scope of this specification. + /// + /// UINT8 Resp[]; + /// + } EFI_CAPSULE_RESULT_VARIABLE_JSON; + extern EFI_GUID gEfiCapsuleReportGuid; #endif diff --git a/MdePkg/Include/Guid/JsonCapsule.h b/MdePkg/Include/Guid/JsonCapsule.h new file mode 100644 index 0000000..eaa126f --- /dev/null +++ b/MdePkg/Include/Guid/JsonCapsule.h @@ -0,0 +1,99 @@ +/** @file +Guid & data structure for tables defined for reporting firmware configuration data to EFI +Configuration Tables and also for processing JSON payload capsule. + + +Copyright (c) 2020, American Megatrends International LLC. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _JSON_CAPSULE_GUID_H__ +#define _JSON_CAPSULE_GUID_H__ + +// +// The address reported in the table entry identified by EFI_JSON_CAPSULE_DATA_TABLE_GUID will be +// referenced as physical and will not be fixed up when transition from preboot to runtime phase. The +// addresses reported in these table entries identified by EFI_JSON_CONFIG_DATA_TABLE_GUID and +// EFI_JSON_CAPSULE_RESULT_TABLE_GUID will be referenced as virtual and will be fixed up when +// transition from preboot to runtime phase. +// +#define EFI_JSON_CONFIG_DATA_TABLE_GUID \ + {0x87367f87, 0x1119, 0x41ce, \ + {0xaa, 0xec, 0x8b, 0xe0, 0x11, 0x1f, 0x55, 0x8a }} +#define EFI_JSON_CAPSULE_DATA_TABLE_GUID \ + {0x35e7a725, 0x8dd2, 0x4cac, \ + {0x80, 0x11, 0x33, 0xcd, 0xa8, 0x10, 0x90, 0x56 }} +#define EFI_JSON_CAPSULE_RESULT_TABLE_GUID \ + {0xdbc461c3, 0xb3de, 0x422a,\ + {0xb9, 0xb4, 0x98, 0x86, 0xfd, 0x49, 0xa1, 0xe5 }} +#define EFI_JSON_CAPSULE_ID_GUID \ + {0x67d6f4cd, 0xd6b8, 0x4573, \ + {0xbf, 0x4a, 0xde, 0x5e, 0x25, 0x2d, 0x61, 0xae }} + + + + +#pragma pack(1) + +typedef struct { + /// + /// Version of the structure, initially 0x00000001. + /// + UINT32 Version; + + /// + /// The unique identifier of this capsule. + /// + UINT32 CapsuleId; + + /// + /// The length of the JSON payload immediately following this header, in bytes. + /// + UINT32 PayloadLength; + + /// + /// Variable length buffer containing the JSON payload that should be parsed and applied to the system. The + /// definition of the JSON schema used in the payload is beyond the scope of this specification. + /// UINT8 Payload[]; +} EFI_JSON_CAPSULE_HEADER; + +typedef struct { + /// + /// The length of the following ConfigData, in bytes. + /// + UINT32 ConfigDataLength; + + /// + /// Variable length buffer containing the JSON payload that describes one group of configuration data within + /// current system. The definition of the JSON schema used in this payload is beyond the scope of this specification. + /// + ///UINT8 ConfigData[ConfigDataLength]; +} EFI_JSON_CONFIG_DATA_ITEM; + +typedef struct { + /// + /// Version of the structure, initially 0x00000001. + /// + UINT32 Version; + + /// + ////The total length of EFI_JSON_CAPSULE_CONFIG_DATA, in bytes. + /// + UINT32 TotalLength; + + /// + /// Array of configuration data groups. + /// + /// EFI_JSON_CONFIG_DATA_ITEM ConfigDataList[]; +} EFI_JSON_CAPSULE_CONFIG_DATA; + +#pragma pack() + +extern EFI_GUID gEfiJsonConfigDataTableGuid; +extern EFI_GUID gEfiJsonCapsuleDataTableGuid; +extern EFI_GUID gEfiJsonCapsuleResultTableGuid; +extern EFI_GUID gEfiJsonCapsuleIdGuid; + + +#endif diff --git a/MdePkg/Include/Uefi/UefiSpec.h b/MdePkg/Include/Uefi/UefiSpec.h index c6d306d..ce1b624 100644 --- a/MdePkg/Include/Uefi/UefiSpec.h +++ b/MdePkg/Include/Uefi/UefiSpec.h @@ -1781,6 +1781,7 @@ EFI_STATUS #define EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED 0x0000000000000008 #define EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED 0x0000000000000010 #define EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY 0x0000000000000040 +#define EFI_OS_INDICATIONS_JSON_CONFIG_DATA_REFRESH 0x0000000000000080 // // EFI Runtime Services Table diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index ac1f533..77c573e 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -646,6 +646,18 @@ gEfiBttAbstractionGuid = { 0x18633bfc, 0x1735, 0x4217, { 0x8a, 0xc9, 0x17, 0x23, 0x92, 0x82, 0xd3, 0xf8 }} # + # GUIDs defined in UEFI2.8 + # + ## Include/Guid/JsonCapsule.h + gEfiJsonConfigDataTableGuid = { 0x87367f87, 0x1119, 0x41ce, { 0xaa, 0xec, 0x8b, 0xe0, 0x11, 0x1f, 0x55, 0x8a }} + gEfiJsonCapsuleDataTableGuid = { 0x35e7a725, 0x8dd2, 0x4cac, { 0x80, 0x11, 0x33, 0xcd, 0xa8, 0x10, 0x90, 0x56 }} + gEfiJsonCapsuleResultTableGuid = { 0xdbc461c3, 0xb3de, 0x422a, { 0xb9, 0xb4, 0x98, 0x86, 0xfd, 0x49, 0xa1, 0xe5 }} + gEfiJsonCapsuleIdGuid = { 0x67d6f4cd, 0xd6b8, 0x4573, { 0xbf, 0x4a, 0xde, 0x5e, 0x25, 0x2d, 0x61, 0xae }} + + ## Include\Guid\HiiPlatformSetupFormset.h + gEfiHiiResetStyleFormsetGuid = { 0x790217bd, 0xbecf, 0x485b, { 0x91, 0x70, 0x5f, 0xf7, 0x11, 0x31, 0x8b, 0x27 }} + + # # GUID defined in PI1.0 # ## Include/Guid/AprioriFileName.h -- 2.9.0.windows.1 Please consider the environment before printing this email. The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission. P Please consider the environment before printing this email The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission. [-- Attachment #2: Type: text/html, Size: 29640 bytes --] ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [edk2-devel] [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support 2020-04-23 2:30 ` Zhiguang Liu @ 2020-04-23 2:38 ` Rothman, Michael A 2020-04-23 5:45 ` Liming Gao 0 siblings, 1 reply; 15+ messages in thread From: Rothman, Michael A @ 2020-04-23 2:38 UTC (permalink / raw) To: devel@edk2.groups.io, Liu, Zhiguang, Oleksiy Yakovlev Cc: Feng, Bob C, Gao, Liming, Kinney, Michael D, Felix Polyudov [-- Attachment #1: Type: text/plain, Size: 12212 bytes --] As a general rule, there are places in the specification where we have had fields like this: // UINT8 Field[]; } STRUC_NAME; This has a history because not all the compilers supported compiling a non-commented version of the above field without a warning. Today, this isn’t the case and I think it is safe (no warnings) to instead have the final parameter without the comment marker. I talked with Kinney to verify this and we believe this should work without any issues, and in fact brings development benefits like being able to reference the field directly and having a valid offset to that field. Thanks, Mike Rothman (迈克 罗斯曼 / माइकल रोथ्मेन् / Михаил Ротман / משה רוטמן) רועה עיקרי של חתולים From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Zhiguang Liu Sent: Wednesday, April 22, 2020 7:30 PM To: Oleksiy Yakovlev <Oleksiyy@ami.com>; devel@edk2.groups.io Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Felix Polyudov <Felixp@ami.com> Subject: Re: [edk2-devel] [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support Hi Oleksiy, I agree with you that your original code change is good. But I can’t open the link you posted. Can you send your new code change here, so that everyone can give their comments. Thanks Zhiguang From: Oleksiy Yakovlev <Oleksiyy@ami.com<mailto:Oleksiyy@ami.com>> Sent: Thursday, April 23, 2020 4:41 AM To: Liu, Zhiguang <zhiguang.liu@intel.com<mailto:zhiguang.liu@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io> Cc: Feng, Bob C <bob.c.feng@intel.com<mailto:bob.c.feng@intel.com>>; Gao, Liming <liming.gao@intel.com<mailto:liming.gao@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; Felix Polyudov <Felixp@ami.com<mailto:Felixp@ami.com>> Subject: RE: [edk2-devel] [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support Hi Zhiguang. Thank you for your feedback. Using definition from Spec: typedef struct { UINT32 ConfigDataLength; UINT8 ConfigData[ConfigDataLength]; } EFI_JSON_CONFIG_DATA_ITEM; will result in build error. You can't use structure field to define array size. I addressed this issue by commenting out ConfigData, because 3 additional structures, introduced by same mantis use this approach for arrays of unknown size. But discussing it further with my colleagues here at AMI, we decided that commenting out arrays of unknown size in structures make them harder to use. So I proposed another approach - use UINT8 ConfigData[]; for this structure and for additional 3 structures introduced by this JSON capsule update feature. See here: Mantis 2096<https://mantis.uefi.noclick_org/mantis/view.php?id=2096> Regards, Oleksiy. -----Original Message----- From: Liu, Zhiguang [mailto:zhiguang.liu@intel.com] Sent: Wednesday, April 22, 2020 4:51 AM To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Oleksiy Yakovlev Cc: Feng, Bob C; Gao, Liming; Kinney, Michael D; Felix Polyudov Subject: RE: [edk2-devel] [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support Hi Oleksiy, The definition of EFI_JSON_CONFIG_DATA_ITEM doesn't totally follow the spec. It is as below in spec without commenting ConfigData. typedef struct { UINT32 ConfigDataLength; UINT8 ConfigData[ConfigDataLength]; } EFI_JSON_CONFIG_DATA_ITEM; Can you explain why? Thanks Zhiguang -----Original Message----- From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> On Behalf Of Oleksiy Yakovlev Sent: Friday, April 10, 2020 4:26 AM To: devel@edk2.groups.io<mailto:devel@edk2.groups.io> Cc: Feng, Bob C <bob.c.feng@intel.com<mailto:bob.c.feng@intel.com>>; Gao, Liming <liming.gao@intel.com<mailto:liming.gao@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; Felixp@ami.com<mailto:Felixp@ami.com>; oleksiyy@ami.com<mailto:oleksiyy@ami.com> Subject: [edk2-devel] [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support Added Guids and structures, that defines the work flow to perform capsule update using JSON objects. (UEFI 2.8 mantis 1935) Signed-off-by: Oleksiy Yakovlev <oleksiyy@ami.com<mailto:oleksiyy@ami.com>> --- MdePkg/Include/Guid/CapsuleReport.h | 32 +++++++++++- MdePkg/Include/Guid/JsonCapsule.h | 99 +++++++++++++++++++++++++++++++++++++ MdePkg/Include/Uefi/UefiSpec.h | 1 + MdePkg/MdePkg.dec | 12 +++++ 4 files changed, 143 insertions(+), 1 deletion(-) create mode 100644 MdePkg/Include/Guid/JsonCapsule.h diff --git a/MdePkg/Include/Guid/CapsuleReport.h b/MdePkg/Include/Guid/CapsuleReport.h index 93d2bb7..bdaf275 100644 --- a/MdePkg/Include/Guid/CapsuleReport.h +++ b/MdePkg/Include/Guid/CapsuleReport.h @@ -93,7 +93,37 @@ typedef struct { /// } EFI_CAPSULE_RESULT_VARIABLE_FMP; - +typedef struct { + + /// + /// Version of this structure, currently 0x00000001 + /// + UINT32 Version; + + /// + /// The unique identifier of the capsule whose processing result is recorded in this variable. + /// 0x00000000 b 0xEFFFFFFF b Implementation Reserved + /// 0xF0000000 b 0xFFFFFFFF b Specification Reserved + /// #define REDFISH_DEFINED_JSON_SCHEMA 0xF000000 + /// The JSON payload shall conform to a Redfish-defined JSON schema, see DMTF-Redfish + /// Specification. + /// + UINT32 CapsuleId; + + /// + /// The length of Resp in bytes. + /// + UINT32 RespLength; + + /// + /// Variable length buffer containing the replied JSON payload to the caller who delivered JSON + /// capsule to system. The definition of the JSON schema used in the replied payload is beyond + /// the scope of this specification. + /// + /// UINT8 Resp[]; + /// + } EFI_CAPSULE_RESULT_VARIABLE_JSON; + extern EFI_GUID gEfiCapsuleReportGuid; #endif diff --git a/MdePkg/Include/Guid/JsonCapsule.h b/MdePkg/Include/Guid/JsonCapsule.h new file mode 100644 index 0000000..eaa126f --- /dev/null +++ b/MdePkg/Include/Guid/JsonCapsule.h @@ -0,0 +1,99 @@ +/** @file +Guid & data structure for tables defined for reporting firmware configuration data to EFI +Configuration Tables and also for processing JSON payload capsule. + + +Copyright (c) 2020, American Megatrends International LLC. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _JSON_CAPSULE_GUID_H__ +#define _JSON_CAPSULE_GUID_H__ + +// +// The address reported in the table entry identified by EFI_JSON_CAPSULE_DATA_TABLE_GUID will be +// referenced as physical and will not be fixed up when transition from preboot to runtime phase. The +// addresses reported in these table entries identified by EFI_JSON_CONFIG_DATA_TABLE_GUID and +// EFI_JSON_CAPSULE_RESULT_TABLE_GUID will be referenced as virtual and will be fixed up when +// transition from preboot to runtime phase. +// +#define EFI_JSON_CONFIG_DATA_TABLE_GUID \ + {0x87367f87, 0x1119, 0x41ce, \ + {0xaa, 0xec, 0x8b, 0xe0, 0x11, 0x1f, 0x55, 0x8a }} +#define EFI_JSON_CAPSULE_DATA_TABLE_GUID \ + {0x35e7a725, 0x8dd2, 0x4cac, \ + {0x80, 0x11, 0x33, 0xcd, 0xa8, 0x10, 0x90, 0x56 }} +#define EFI_JSON_CAPSULE_RESULT_TABLE_GUID \ + {0xdbc461c3, 0xb3de, 0x422a,\ + {0xb9, 0xb4, 0x98, 0x86, 0xfd, 0x49, 0xa1, 0xe5 }} +#define EFI_JSON_CAPSULE_ID_GUID \ + {0x67d6f4cd, 0xd6b8, 0x4573, \ + {0xbf, 0x4a, 0xde, 0x5e, 0x25, 0x2d, 0x61, 0xae }} + + + + +#pragma pack(1) + +typedef struct { + /// + /// Version of the structure, initially 0x00000001. + /// + UINT32 Version; + + /// + /// The unique identifier of this capsule. + /// + UINT32 CapsuleId; + + /// + /// The length of the JSON payload immediately following this header, in bytes. + /// + UINT32 PayloadLength; + + /// + /// Variable length buffer containing the JSON payload that should be parsed and applied to the system. The + /// definition of the JSON schema used in the payload is beyond the scope of this specification. + /// UINT8 Payload[]; +} EFI_JSON_CAPSULE_HEADER; + +typedef struct { + /// + /// The length of the following ConfigData, in bytes. + /// + UINT32 ConfigDataLength; + + /// + /// Variable length buffer containing the JSON payload that describes one group of configuration data within + /// current system. The definition of the JSON schema used in this payload is beyond the scope of this specification. + /// + ///UINT8 ConfigData[ConfigDataLength]; +} EFI_JSON_CONFIG_DATA_ITEM; + +typedef struct { + /// + /// Version of the structure, initially 0x00000001. + /// + UINT32 Version; + + /// + ////The total length of EFI_JSON_CAPSULE_CONFIG_DATA, in bytes. + /// + UINT32 TotalLength; + + /// + /// Array of configuration data groups. + /// + /// EFI_JSON_CONFIG_DATA_ITEM ConfigDataList[]; +} EFI_JSON_CAPSULE_CONFIG_DATA; + +#pragma pack() + +extern EFI_GUID gEfiJsonConfigDataTableGuid; +extern EFI_GUID gEfiJsonCapsuleDataTableGuid; +extern EFI_GUID gEfiJsonCapsuleResultTableGuid; +extern EFI_GUID gEfiJsonCapsuleIdGuid; + + +#endif diff --git a/MdePkg/Include/Uefi/UefiSpec.h b/MdePkg/Include/Uefi/UefiSpec.h index c6d306d..ce1b624 100644 --- a/MdePkg/Include/Uefi/UefiSpec.h +++ b/MdePkg/Include/Uefi/UefiSpec.h @@ -1781,6 +1781,7 @@ EFI_STATUS #define EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED 0x0000000000000008 #define EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED 0x0000000000000010 #define EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY 0x0000000000000040 +#define EFI_OS_INDICATIONS_JSON_CONFIG_DATA_REFRESH 0x0000000000000080 // // EFI Runtime Services Table diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index ac1f533..77c573e 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -646,6 +646,18 @@ gEfiBttAbstractionGuid = { 0x18633bfc, 0x1735, 0x4217, { 0x8a, 0xc9, 0x17, 0x23, 0x92, 0x82, 0xd3, 0xf8 }} # + # GUIDs defined in UEFI2.8 + # + ## Include/Guid/JsonCapsule.h + gEfiJsonConfigDataTableGuid = { 0x87367f87, 0x1119, 0x41ce, { 0xaa, 0xec, 0x8b, 0xe0, 0x11, 0x1f, 0x55, 0x8a }} + gEfiJsonCapsuleDataTableGuid = { 0x35e7a725, 0x8dd2, 0x4cac, { 0x80, 0x11, 0x33, 0xcd, 0xa8, 0x10, 0x90, 0x56 }} + gEfiJsonCapsuleResultTableGuid = { 0xdbc461c3, 0xb3de, 0x422a, { 0xb9, 0xb4, 0x98, 0x86, 0xfd, 0x49, 0xa1, 0xe5 }} + gEfiJsonCapsuleIdGuid = { 0x67d6f4cd, 0xd6b8, 0x4573, { 0xbf, 0x4a, 0xde, 0x5e, 0x25, 0x2d, 0x61, 0xae }} + + ## Include\Guid\HiiPlatformSetupFormset.h + gEfiHiiResetStyleFormsetGuid = { 0x790217bd, 0xbecf, 0x485b, { 0x91, 0x70, 0x5f, 0xf7, 0x11, 0x31, 0x8b, 0x27 }} + + # # GUID defined in PI1.0 # ## Include/Guid/AprioriFileName.h -- 2.9.0.windows.1 Please consider the environment before printing this email. The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission. P Please consider the environment before printing this email The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission. [-- Attachment #2: Type: text/html, Size: 33777 bytes --] ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [edk2-devel] [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support 2020-04-23 2:38 ` Rothman, Michael A @ 2020-04-23 5:45 ` Liming Gao 2020-04-23 13:54 ` Oleksiy Yakovlev 0 siblings, 1 reply; 15+ messages in thread From: Liming Gao @ 2020-04-23 5:45 UTC (permalink / raw) To: Rothman, Michael A, devel@edk2.groups.io, Liu, Zhiguang, Oleksiy Yakovlev Cc: Feng, Bob C, Kinney, Michael D, Felix Polyudov [-- Attachment #1: Type: text/plain, Size: 12962 bytes --] So, the better way should be UINT8 Field[]; if the compiler doesn’t report error. From: Rothman, Michael A <michael.a.rothman@intel.com> Sent: Thursday, April 23, 2020 10:38 AM To: devel@edk2.groups.io; Liu, Zhiguang <zhiguang.liu@intel.com>; Oleksiy Yakovlev <Oleksiyy@ami.com> Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Felix Polyudov <Felixp@ami.com> Subject: RE: [edk2-devel] [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support As a general rule, there are places in the specification where we have had fields like this: // UINT8 Field[]; } STRUC_NAME; This has a history because not all the compilers supported compiling a non-commented version of the above field without a warning. Today, this isn’t the case and I think it is safe (no warnings) to instead have the final parameter without the comment marker. I talked with Kinney to verify this and we believe this should work without any issues, and in fact brings development benefits like being able to reference the field directly and having a valid offset to that field. Thanks, Mike Rothman (迈克 罗斯曼 / माइकल रोथ्मेन् / Михаил Ротман / משה רוטמן) רועה עיקרי של חתולים From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> On Behalf Of Zhiguang Liu Sent: Wednesday, April 22, 2020 7:30 PM To: Oleksiy Yakovlev <Oleksiyy@ami.com<mailto:Oleksiyy@ami.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io> Cc: Feng, Bob C <bob.c.feng@intel.com<mailto:bob.c.feng@intel.com>>; Gao, Liming <liming.gao@intel.com<mailto:liming.gao@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; Felix Polyudov <Felixp@ami.com<mailto:Felixp@ami.com>> Subject: Re: [edk2-devel] [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support Hi Oleksiy, I agree with you that your original code change is good. But I can’t open the link you posted. Can you send your new code change here, so that everyone can give their comments. Thanks Zhiguang From: Oleksiy Yakovlev <Oleksiyy@ami.com<mailto:Oleksiyy@ami.com>> Sent: Thursday, April 23, 2020 4:41 AM To: Liu, Zhiguang <zhiguang.liu@intel.com<mailto:zhiguang.liu@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io> Cc: Feng, Bob C <bob.c.feng@intel.com<mailto:bob.c.feng@intel.com>>; Gao, Liming <liming.gao@intel.com<mailto:liming.gao@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; Felix Polyudov <Felixp@ami.com<mailto:Felixp@ami.com>> Subject: RE: [edk2-devel] [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support Hi Zhiguang. Thank you for your feedback. Using definition from Spec: typedef struct { UINT32 ConfigDataLength; UINT8 ConfigData[ConfigDataLength]; } EFI_JSON_CONFIG_DATA_ITEM; will result in build error. You can't use structure field to define array size. I addressed this issue by commenting out ConfigData, because 3 additional structures, introduced by same mantis use this approach for arrays of unknown size. But discussing it further with my colleagues here at AMI, we decided that commenting out arrays of unknown size in structures make them harder to use. So I proposed another approach - use UINT8 ConfigData[]; for this structure and for additional 3 structures introduced by this JSON capsule update feature. See here: Mantis 2096<https://mantis.uefi.noclick_org/mantis/view.php?id=2096> Regards, Oleksiy. -----Original Message----- From: Liu, Zhiguang [mailto:zhiguang.liu@intel.com] Sent: Wednesday, April 22, 2020 4:51 AM To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Oleksiy Yakovlev Cc: Feng, Bob C; Gao, Liming; Kinney, Michael D; Felix Polyudov Subject: RE: [edk2-devel] [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support Hi Oleksiy, The definition of EFI_JSON_CONFIG_DATA_ITEM doesn't totally follow the spec. It is as below in spec without commenting ConfigData. typedef struct { UINT32 ConfigDataLength; UINT8 ConfigData[ConfigDataLength]; } EFI_JSON_CONFIG_DATA_ITEM; Can you explain why? Thanks Zhiguang -----Original Message----- From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> On Behalf Of Oleksiy Yakovlev Sent: Friday, April 10, 2020 4:26 AM To: devel@edk2.groups.io<mailto:devel@edk2.groups.io> Cc: Feng, Bob C <bob.c.feng@intel.com<mailto:bob.c.feng@intel.com>>; Gao, Liming <liming.gao@intel.com<mailto:liming.gao@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; Felixp@ami.com<mailto:Felixp@ami.com>; oleksiyy@ami.com<mailto:oleksiyy@ami.com> Subject: [edk2-devel] [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support Added Guids and structures, that defines the work flow to perform capsule update using JSON objects. (UEFI 2.8 mantis 1935) Signed-off-by: Oleksiy Yakovlev <oleksiyy@ami.com<mailto:oleksiyy@ami.com>> --- MdePkg/Include/Guid/CapsuleReport.h | 32 +++++++++++- MdePkg/Include/Guid/JsonCapsule.h | 99 +++++++++++++++++++++++++++++++++++++ MdePkg/Include/Uefi/UefiSpec.h | 1 + MdePkg/MdePkg.dec | 12 +++++ 4 files changed, 143 insertions(+), 1 deletion(-) create mode 100644 MdePkg/Include/Guid/JsonCapsule.h diff --git a/MdePkg/Include/Guid/CapsuleReport.h b/MdePkg/Include/Guid/CapsuleReport.h index 93d2bb7..bdaf275 100644 --- a/MdePkg/Include/Guid/CapsuleReport.h +++ b/MdePkg/Include/Guid/CapsuleReport.h @@ -93,7 +93,37 @@ typedef struct { /// } EFI_CAPSULE_RESULT_VARIABLE_FMP; - +typedef struct { + + /// + /// Version of this structure, currently 0x00000001 + /// + UINT32 Version; + + /// + /// The unique identifier of the capsule whose processing result is recorded in this variable. + /// 0x00000000 b 0xEFFFFFFF b Implementation Reserved + /// 0xF0000000 b 0xFFFFFFFF b Specification Reserved + /// #define REDFISH_DEFINED_JSON_SCHEMA 0xF000000 + /// The JSON payload shall conform to a Redfish-defined JSON schema, see DMTF-Redfish + /// Specification. + /// + UINT32 CapsuleId; + + /// + /// The length of Resp in bytes. + /// + UINT32 RespLength; + + /// + /// Variable length buffer containing the replied JSON payload to the caller who delivered JSON + /// capsule to system. The definition of the JSON schema used in the replied payload is beyond + /// the scope of this specification. + /// + /// UINT8 Resp[]; + /// + } EFI_CAPSULE_RESULT_VARIABLE_JSON; + extern EFI_GUID gEfiCapsuleReportGuid; #endif diff --git a/MdePkg/Include/Guid/JsonCapsule.h b/MdePkg/Include/Guid/JsonCapsule.h new file mode 100644 index 0000000..eaa126f --- /dev/null +++ b/MdePkg/Include/Guid/JsonCapsule.h @@ -0,0 +1,99 @@ +/** @file +Guid & data structure for tables defined for reporting firmware configuration data to EFI +Configuration Tables and also for processing JSON payload capsule. + + +Copyright (c) 2020, American Megatrends International LLC. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _JSON_CAPSULE_GUID_H__ +#define _JSON_CAPSULE_GUID_H__ + +// +// The address reported in the table entry identified by EFI_JSON_CAPSULE_DATA_TABLE_GUID will be +// referenced as physical and will not be fixed up when transition from preboot to runtime phase. The +// addresses reported in these table entries identified by EFI_JSON_CONFIG_DATA_TABLE_GUID and +// EFI_JSON_CAPSULE_RESULT_TABLE_GUID will be referenced as virtual and will be fixed up when +// transition from preboot to runtime phase. +// +#define EFI_JSON_CONFIG_DATA_TABLE_GUID \ + {0x87367f87, 0x1119, 0x41ce, \ + {0xaa, 0xec, 0x8b, 0xe0, 0x11, 0x1f, 0x55, 0x8a }} +#define EFI_JSON_CAPSULE_DATA_TABLE_GUID \ + {0x35e7a725, 0x8dd2, 0x4cac, \ + {0x80, 0x11, 0x33, 0xcd, 0xa8, 0x10, 0x90, 0x56 }} +#define EFI_JSON_CAPSULE_RESULT_TABLE_GUID \ + {0xdbc461c3, 0xb3de, 0x422a,\ + {0xb9, 0xb4, 0x98, 0x86, 0xfd, 0x49, 0xa1, 0xe5 }} +#define EFI_JSON_CAPSULE_ID_GUID \ + {0x67d6f4cd, 0xd6b8, 0x4573, \ + {0xbf, 0x4a, 0xde, 0x5e, 0x25, 0x2d, 0x61, 0xae }} + + + + +#pragma pack(1) + +typedef struct { + /// + /// Version of the structure, initially 0x00000001. + /// + UINT32 Version; + + /// + /// The unique identifier of this capsule. + /// + UINT32 CapsuleId; + + /// + /// The length of the JSON payload immediately following this header, in bytes. + /// + UINT32 PayloadLength; + + /// + /// Variable length buffer containing the JSON payload that should be parsed and applied to the system. The + /// definition of the JSON schema used in the payload is beyond the scope of this specification. + /// UINT8 Payload[]; +} EFI_JSON_CAPSULE_HEADER; + +typedef struct { + /// + /// The length of the following ConfigData, in bytes. + /// + UINT32 ConfigDataLength; + + /// + /// Variable length buffer containing the JSON payload that describes one group of configuration data within + /// current system. The definition of the JSON schema used in this payload is beyond the scope of this specification. + /// + ///UINT8 ConfigData[ConfigDataLength]; +} EFI_JSON_CONFIG_DATA_ITEM; + +typedef struct { + /// + /// Version of the structure, initially 0x00000001. + /// + UINT32 Version; + + /// + ////The total length of EFI_JSON_CAPSULE_CONFIG_DATA, in bytes. + /// + UINT32 TotalLength; + + /// + /// Array of configuration data groups. + /// + /// EFI_JSON_CONFIG_DATA_ITEM ConfigDataList[]; +} EFI_JSON_CAPSULE_CONFIG_DATA; + +#pragma pack() + +extern EFI_GUID gEfiJsonConfigDataTableGuid; +extern EFI_GUID gEfiJsonCapsuleDataTableGuid; +extern EFI_GUID gEfiJsonCapsuleResultTableGuid; +extern EFI_GUID gEfiJsonCapsuleIdGuid; + + +#endif diff --git a/MdePkg/Include/Uefi/UefiSpec.h b/MdePkg/Include/Uefi/UefiSpec.h index c6d306d..ce1b624 100644 --- a/MdePkg/Include/Uefi/UefiSpec.h +++ b/MdePkg/Include/Uefi/UefiSpec.h @@ -1781,6 +1781,7 @@ EFI_STATUS #define EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED 0x0000000000000008 #define EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED 0x0000000000000010 #define EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY 0x0000000000000040 +#define EFI_OS_INDICATIONS_JSON_CONFIG_DATA_REFRESH 0x0000000000000080 // // EFI Runtime Services Table diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index ac1f533..77c573e 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -646,6 +646,18 @@ gEfiBttAbstractionGuid = { 0x18633bfc, 0x1735, 0x4217, { 0x8a, 0xc9, 0x17, 0x23, 0x92, 0x82, 0xd3, 0xf8 }} # + # GUIDs defined in UEFI2.8 + # + ## Include/Guid/JsonCapsule.h + gEfiJsonConfigDataTableGuid = { 0x87367f87, 0x1119, 0x41ce, { 0xaa, 0xec, 0x8b, 0xe0, 0x11, 0x1f, 0x55, 0x8a }} + gEfiJsonCapsuleDataTableGuid = { 0x35e7a725, 0x8dd2, 0x4cac, { 0x80, 0x11, 0x33, 0xcd, 0xa8, 0x10, 0x90, 0x56 }} + gEfiJsonCapsuleResultTableGuid = { 0xdbc461c3, 0xb3de, 0x422a, { 0xb9, 0xb4, 0x98, 0x86, 0xfd, 0x49, 0xa1, 0xe5 }} + gEfiJsonCapsuleIdGuid = { 0x67d6f4cd, 0xd6b8, 0x4573, { 0xbf, 0x4a, 0xde, 0x5e, 0x25, 0x2d, 0x61, 0xae }} + + ## Include\Guid\HiiPlatformSetupFormset.h + gEfiHiiResetStyleFormsetGuid = { 0x790217bd, 0xbecf, 0x485b, { 0x91, 0x70, 0x5f, 0xf7, 0x11, 0x31, 0x8b, 0x27 }} + + # # GUID defined in PI1.0 # ## Include/Guid/AprioriFileName.h -- 2.9.0.windows.1 Please consider the environment before printing this email. The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission. P Please consider the environment before printing this email The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission. [-- Attachment #2: Type: text/html, Size: 35388 bytes --] ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [edk2-devel] [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support 2020-04-23 5:45 ` Liming Gao @ 2020-04-23 13:54 ` Oleksiy Yakovlev 0 siblings, 0 replies; 15+ messages in thread From: Oleksiy Yakovlev @ 2020-04-23 13:54 UTC (permalink / raw) To: Gao, Liming, Rothman, Michael A, devel@edk2.groups.io, Liu, Zhiguang Cc: Feng, Bob C, Kinney, Michael D, Felix Polyudov [-- Attachment #1: Type: text/plain, Size: 13935 bytes --] Here is a mantis I opened: https://mantis.uefi.org/mantis/view.php?id=2096 From: Gao, Liming [mailto:liming.gao@intel.com] Sent: Thursday, April 23, 2020 1:45 AM To: Rothman, Michael A; devel@edk2.groups.io; Liu, Zhiguang; Oleksiy Yakovlev Cc: Feng, Bob C; Kinney, Michael D; Felix Polyudov Subject: RE: [edk2-devel] [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support So, the better way should be UINT8 Field[]; if the compiler doesn’t report error. From: Rothman, Michael A <michael.a.rothman@intel.com> Sent: Thursday, April 23, 2020 10:38 AM To: devel@edk2.groups.io; Liu, Zhiguang <zhiguang.liu@intel.com>; Oleksiy Yakovlev <Oleksiyy@ami.com> Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Felix Polyudov <Felixp@ami.com> Subject: RE: [edk2-devel] [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support As a general rule, there are places in the specification where we have had fields like this: // UINT8 Field[]; } STRUC_NAME; This has a history because not all the compilers supported compiling a non-commented version of the above field without a warning. Today, this isn’t the case and I think it is safe (no warnings) to instead have the final parameter without the comment marker. I talked with Kinney to verify this and we believe this should work without any issues, and in fact brings development benefits like being able to reference the field directly and having a valid offset to that field. Thanks, Mike Rothman (迈克 罗斯曼 / माइकल रोथ्मेन् / Михаил Ротман / משה רוטמן) רועה עיקרי של חתולים From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> On Behalf Of Zhiguang Liu Sent: Wednesday, April 22, 2020 7:30 PM To: Oleksiy Yakovlev <Oleksiyy@ami.com<mailto:Oleksiyy@ami.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io> Cc: Feng, Bob C <bob.c.feng@intel.com<mailto:bob.c.feng@intel.com>>; Gao, Liming <liming.gao@intel.com<mailto:liming.gao@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; Felix Polyudov <Felixp@ami.com<mailto:Felixp@ami.com>> Subject: Re: [edk2-devel] [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support Hi Oleksiy, I agree with you that your original code change is good. But I can’t open the link you posted. Can you send your new code change here, so that everyone can give their comments. Thanks Zhiguang From: Oleksiy Yakovlev <Oleksiyy@ami.com<mailto:Oleksiyy@ami.com>> Sent: Thursday, April 23, 2020 4:41 AM To: Liu, Zhiguang <zhiguang.liu@intel.com<mailto:zhiguang.liu@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io> Cc: Feng, Bob C <bob.c.feng@intel.com<mailto:bob.c.feng@intel.com>>; Gao, Liming <liming.gao@intel.com<mailto:liming.gao@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; Felix Polyudov <Felixp@ami.com<mailto:Felixp@ami.com>> Subject: RE: [edk2-devel] [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support Hi Zhiguang. Thank you for your feedback. Using definition from Spec: typedef struct { UINT32 ConfigDataLength; UINT8 ConfigData[ConfigDataLength]; } EFI_JSON_CONFIG_DATA_ITEM; will result in build error. You can't use structure field to define array size. I addressed this issue by commenting out ConfigData, because 3 additional structures, introduced by same mantis use this approach for arrays of unknown size. But discussing it further with my colleagues here at AMI, we decided that commenting out arrays of unknown size in structures make them harder to use. So I proposed another approach - use UINT8 ConfigData[]; for this structure and for additional 3 structures introduced by this JSON capsule update feature. See here: Mantis 2096<https://mantis.uefi.noclick_org/mantis/view.php?id=2096> Regards, Oleksiy. -----Original Message----- From: Liu, Zhiguang [mailto:zhiguang.liu@intel.com] Sent: Wednesday, April 22, 2020 4:51 AM To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Oleksiy Yakovlev Cc: Feng, Bob C; Gao, Liming; Kinney, Michael D; Felix Polyudov Subject: RE: [edk2-devel] [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support Hi Oleksiy, The definition of EFI_JSON_CONFIG_DATA_ITEM doesn't totally follow the spec. It is as below in spec without commenting ConfigData. typedef struct { UINT32 ConfigDataLength; UINT8 ConfigData[ConfigDataLength]; } EFI_JSON_CONFIG_DATA_ITEM; Can you explain why? Thanks Zhiguang -----Original Message----- From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> On Behalf Of Oleksiy Yakovlev Sent: Friday, April 10, 2020 4:26 AM To: devel@edk2.groups.io<mailto:devel@edk2.groups.io> Cc: Feng, Bob C <bob.c.feng@intel.com<mailto:bob.c.feng@intel.com>>; Gao, Liming <liming.gao@intel.com<mailto:liming.gao@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; Felixp@ami.com<mailto:Felixp@ami.com>; oleksiyy@ami.com<mailto:oleksiyy@ami.com> Subject: [edk2-devel] [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support Added Guids and structures, that defines the work flow to perform capsule update using JSON objects. (UEFI 2.8 mantis 1935) Signed-off-by: Oleksiy Yakovlev <oleksiyy@ami.com<mailto:oleksiyy@ami.com>> --- MdePkg/Include/Guid/CapsuleReport.h | 32 +++++++++++- MdePkg/Include/Guid/JsonCapsule.h | 99 +++++++++++++++++++++++++++++++++++++ MdePkg/Include/Uefi/UefiSpec.h | 1 + MdePkg/MdePkg.dec | 12 +++++ 4 files changed, 143 insertions(+), 1 deletion(-) create mode 100644 MdePkg/Include/Guid/JsonCapsule.h diff --git a/MdePkg/Include/Guid/CapsuleReport.h b/MdePkg/Include/Guid/CapsuleReport.h index 93d2bb7..bdaf275 100644 --- a/MdePkg/Include/Guid/CapsuleReport.h +++ b/MdePkg/Include/Guid/CapsuleReport.h @@ -93,7 +93,37 @@ typedef struct { /// } EFI_CAPSULE_RESULT_VARIABLE_FMP; - +typedef struct { + + /// + /// Version of this structure, currently 0x00000001 + /// + UINT32 Version; + + /// + /// The unique identifier of the capsule whose processing result is recorded in this variable. + /// 0x00000000 b 0xEFFFFFFF b Implementation Reserved + /// 0xF0000000 b 0xFFFFFFFF b Specification Reserved + /// #define REDFISH_DEFINED_JSON_SCHEMA 0xF000000 + /// The JSON payload shall conform to a Redfish-defined JSON schema, see DMTF-Redfish + /// Specification. + /// + UINT32 CapsuleId; + + /// + /// The length of Resp in bytes. + /// + UINT32 RespLength; + + /// + /// Variable length buffer containing the replied JSON payload to the caller who delivered JSON + /// capsule to system. The definition of the JSON schema used in the replied payload is beyond + /// the scope of this specification. + /// + /// UINT8 Resp[]; + /// + } EFI_CAPSULE_RESULT_VARIABLE_JSON; + extern EFI_GUID gEfiCapsuleReportGuid; #endif diff --git a/MdePkg/Include/Guid/JsonCapsule.h b/MdePkg/Include/Guid/JsonCapsule.h new file mode 100644 index 0000000..eaa126f --- /dev/null +++ b/MdePkg/Include/Guid/JsonCapsule.h @@ -0,0 +1,99 @@ +/** @file +Guid & data structure for tables defined for reporting firmware configuration data to EFI +Configuration Tables and also for processing JSON payload capsule. + + +Copyright (c) 2020, American Megatrends International LLC. All rights reserved.<BR> +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef _JSON_CAPSULE_GUID_H__ +#define _JSON_CAPSULE_GUID_H__ + +// +// The address reported in the table entry identified by EFI_JSON_CAPSULE_DATA_TABLE_GUID will be +// referenced as physical and will not be fixed up when transition from preboot to runtime phase. The +// addresses reported in these table entries identified by EFI_JSON_CONFIG_DATA_TABLE_GUID and +// EFI_JSON_CAPSULE_RESULT_TABLE_GUID will be referenced as virtual and will be fixed up when +// transition from preboot to runtime phase. +// +#define EFI_JSON_CONFIG_DATA_TABLE_GUID \ + {0x87367f87, 0x1119, 0x41ce, \ + {0xaa, 0xec, 0x8b, 0xe0, 0x11, 0x1f, 0x55, 0x8a }} +#define EFI_JSON_CAPSULE_DATA_TABLE_GUID \ + {0x35e7a725, 0x8dd2, 0x4cac, \ + {0x80, 0x11, 0x33, 0xcd, 0xa8, 0x10, 0x90, 0x56 }} +#define EFI_JSON_CAPSULE_RESULT_TABLE_GUID \ + {0xdbc461c3, 0xb3de, 0x422a,\ + {0xb9, 0xb4, 0x98, 0x86, 0xfd, 0x49, 0xa1, 0xe5 }} +#define EFI_JSON_CAPSULE_ID_GUID \ + {0x67d6f4cd, 0xd6b8, 0x4573, \ + {0xbf, 0x4a, 0xde, 0x5e, 0x25, 0x2d, 0x61, 0xae }} + + + + +#pragma pack(1) + +typedef struct { + /// + /// Version of the structure, initially 0x00000001. + /// + UINT32 Version; + + /// + /// The unique identifier of this capsule. + /// + UINT32 CapsuleId; + + /// + /// The length of the JSON payload immediately following this header, in bytes. + /// + UINT32 PayloadLength; + + /// + /// Variable length buffer containing the JSON payload that should be parsed and applied to the system. The + /// definition of the JSON schema used in the payload is beyond the scope of this specification. + /// UINT8 Payload[]; +} EFI_JSON_CAPSULE_HEADER; + +typedef struct { + /// + /// The length of the following ConfigData, in bytes. + /// + UINT32 ConfigDataLength; + + /// + /// Variable length buffer containing the JSON payload that describes one group of configuration data within + /// current system. The definition of the JSON schema used in this payload is beyond the scope of this specification. + /// + ///UINT8 ConfigData[ConfigDataLength]; +} EFI_JSON_CONFIG_DATA_ITEM; + +typedef struct { + /// + /// Version of the structure, initially 0x00000001. + /// + UINT32 Version; + + /// + ////The total length of EFI_JSON_CAPSULE_CONFIG_DATA, in bytes. + /// + UINT32 TotalLength; + + /// + /// Array of configuration data groups. + /// + /// EFI_JSON_CONFIG_DATA_ITEM ConfigDataList[]; +} EFI_JSON_CAPSULE_CONFIG_DATA; + +#pragma pack() + +extern EFI_GUID gEfiJsonConfigDataTableGuid; +extern EFI_GUID gEfiJsonCapsuleDataTableGuid; +extern EFI_GUID gEfiJsonCapsuleResultTableGuid; +extern EFI_GUID gEfiJsonCapsuleIdGuid; + + +#endif diff --git a/MdePkg/Include/Uefi/UefiSpec.h b/MdePkg/Include/Uefi/UefiSpec.h index c6d306d..ce1b624 100644 --- a/MdePkg/Include/Uefi/UefiSpec.h +++ b/MdePkg/Include/Uefi/UefiSpec.h @@ -1781,6 +1781,7 @@ EFI_STATUS #define EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED 0x0000000000000008 #define EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED 0x0000000000000010 #define EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY 0x0000000000000040 +#define EFI_OS_INDICATIONS_JSON_CONFIG_DATA_REFRESH 0x0000000000000080 // // EFI Runtime Services Table diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index ac1f533..77c573e 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -646,6 +646,18 @@ gEfiBttAbstractionGuid = { 0x18633bfc, 0x1735, 0x4217, { 0x8a, 0xc9, 0x17, 0x23, 0x92, 0x82, 0xd3, 0xf8 }} # + # GUIDs defined in UEFI2.8 + # + ## Include/Guid/JsonCapsule.h + gEfiJsonConfigDataTableGuid = { 0x87367f87, 0x1119, 0x41ce, { 0xaa, 0xec, 0x8b, 0xe0, 0x11, 0x1f, 0x55, 0x8a }} + gEfiJsonCapsuleDataTableGuid = { 0x35e7a725, 0x8dd2, 0x4cac, { 0x80, 0x11, 0x33, 0xcd, 0xa8, 0x10, 0x90, 0x56 }} + gEfiJsonCapsuleResultTableGuid = { 0xdbc461c3, 0xb3de, 0x422a, { 0xb9, 0xb4, 0x98, 0x86, 0xfd, 0x49, 0xa1, 0xe5 }} + gEfiJsonCapsuleIdGuid = { 0x67d6f4cd, 0xd6b8, 0x4573, { 0xbf, 0x4a, 0xde, 0x5e, 0x25, 0x2d, 0x61, 0xae }} + + ## Include\Guid\HiiPlatformSetupFormset.h + gEfiHiiResetStyleFormsetGuid = { 0x790217bd, 0xbecf, 0x485b, { 0x91, 0x70, 0x5f, 0xf7, 0x11, 0x31, 0x8b, 0x27 }} + + # # GUID defined in PI1.0 # ## Include/Guid/AprioriFileName.h -- 2.9.0.windows.1 Please consider the environment before printing this email. The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission. P Please consider the environment before printing this email The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission. Please consider the environment before printing this email. The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission. [-- Attachment #2: Type: text/html, Size: 40503 bytes --] ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [edk2-devel] [PATCH v1 0/7] Add definitions introduced in UEFI 2.8 2020-04-09 20:25 [PATCH v1 0/7] Add definitions introduced in UEFI 2.8 Oleksiy Yakovlev ` (6 preceding siblings ...) 2020-04-09 20:25 ` [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support Oleksiy Yakovlev @ 2020-04-22 8:51 ` Zhiguang Liu 7 siblings, 0 replies; 15+ messages in thread From: Zhiguang Liu @ 2020-04-22 8:51 UTC (permalink / raw) To: devel@edk2.groups.io, oleksiyy@ami.com Cc: Feng, Bob C, Gao, Liming, Kinney, Michael D, Felixp@ami.com Hi Oleksiy, There are tabs and Trailing whitespace in this patch set, which is not consistent with edk2 coding type. Please run ECC tool to check your code. https://github.com/tianocore/tianocore.github.io/wiki/ECC-tool Thanks Zhiguang -----Original Message----- From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Oleksiy Yakovlev Sent: Friday, April 10, 2020 4:26 AM To: devel@edk2.groups.io Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Felixp@ami.com; oleksiyy@ami.com Subject: [edk2-devel] [PATCH v1 0/7] Add definitions introduced in UEFI 2.8 Following patches add/update structures/definitions, that was introduced/modified by UEFI Spec v.2.8. Oleksiy Yakovlev (7): MdePkg: Extend SERIAL_IO with DeviceTypeGuid (UEFI 2.8 mantis 1832) BaseTools: REST style formset (UEFI 2.8 mantis 1853) MdePkg: REST style formset (UEFI 2.8 mantis 1853) BaseTools: Bootable NVDIMM namespaces (UEFI 2.8 mantis 1858) MdePkg: Bootable NVDIMM namespaces (UEFI 2.8 mantis 1858) MdePkg: Add UEFI Spec Revision 2.8 (UEFI 2.8 mantis 1926) MdePkg: UEFI JSON Capsule Support (UEFI 2.8 mantis 1935) .../Common/UefiInternalFormRepresentation.h | 1 + BaseTools/Source/C/Include/Protocol/DevicePath.h | 12 +++ MdePkg/Include/Guid/CapsuleReport.h | 32 ++++++- MdePkg/Include/Guid/HiiPlatformSetupFormset.h | 4 + MdePkg/Include/Guid/JsonCapsule.h | 99 ++++++++++++++++++++++ MdePkg/Include/Protocol/DevicePath.h | 12 +++ MdePkg/Include/Protocol/SerialIo.h | 3 +- .../Include/Uefi/UefiInternalFormRepresentation.h | 1 + MdePkg/Include/Uefi/UefiSpec.h | 2 + MdePkg/MdePkg.dec | 12 +++ 10 files changed, 176 insertions(+), 2 deletions(-) create mode 100644 MdePkg/Include/Guid/JsonCapsule.h -- 2.9.0.windows.1 Please consider the environment before printing this email. The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission. ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2020-04-23 13:54 UTC | newest] Thread overview: 15+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-04-09 20:25 [PATCH v1 0/7] Add definitions introduced in UEFI 2.8 Oleksiy Yakovlev 2020-04-09 20:25 ` [PATCH v1 1/7] MdePkg: Extend SERIAL_IO with DeviceTypeGuid Oleksiy Yakovlev 2020-04-09 20:25 ` [PATCH v1 2/7] BaseTools: REST style formset Oleksiy Yakovlev 2020-04-09 20:25 ` [PATCH v1 3/7] MdePkg: " Oleksiy Yakovlev 2020-04-09 20:25 ` [PATCH v1 4/7] BaseTools: Bootable NVDIMM namespaces Oleksiy Yakovlev 2020-04-09 20:25 ` [PATCH v1 5/7] MdePkg: " Oleksiy Yakovlev 2020-04-09 20:25 ` [PATCH v1 6/7] MdePkg: Add UEFI Spec Revision 2.8 Oleksiy Yakovlev 2020-04-09 20:25 ` [PATCH v1 7/7] MdePkg: UEFI JSON Capsule Support Oleksiy Yakovlev 2020-04-22 8:50 ` [edk2-devel] " Zhiguang Liu 2020-04-22 20:41 ` Oleksiy Yakovlev 2020-04-23 2:30 ` Zhiguang Liu 2020-04-23 2:38 ` Rothman, Michael A 2020-04-23 5:45 ` Liming Gao 2020-04-23 13:54 ` Oleksiy Yakovlev 2020-04-22 8:51 ` [edk2-devel] [PATCH v1 0/7] Add definitions introduced in UEFI 2.8 Zhiguang Liu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox