Date   

[PATCH v3 0/2] CryptoPkg/OpensslLib: Add native instruction support for X64

Zurcher, Christopher J
 

V3 Changes:
Added definitions for ptrdiff_t and wchar_t to CrtLibSupport.h for
LLVM/Clang build support.
Added -UWIN32 to GCC Flags for LLVM/Clang build support.
Added missing AES GCM assembly file.

V2 Changes:
Limit scope of assembly config to SHA and AES functions.
Removed IA32 native support (reduced config was causing build failure and
can be added in a later patch).
Removed XMM instructions from assembly generation.
Added automatic copyright header porting for generated assembly files.

This patch adds support for building the native instruction algorithms for
the X64 architecture in OpensslLib. The process_files.pl script was modified
to parse the .asm file targets from the OpenSSL build config data struct, and
generate the necessary assembly files for the EDK2 build environment.

For the X64 variant, OpenSSL includes calls to a Windows error handling API,
and that function has been stubbed out in ApiHooks.c.

For all variants, a constructor is added to call the required CPUID function
within OpenSSL to facilitate processor capability checks in the native
algorithms.

Additional native architecture variants should be simple to add by following
the changes made for this architecture.

The OpenSSL assembly files are traditionally generated at build time using a
perl script. To avoid that burden on EDK2 users, these end-result assembly
files are generated during the configuration steps performed by the package
maintainer (through process_files.pl). The perl generator scripts inside
OpenSSL do not parse file comments as they are only meant to create
intermediate build files, so process_files.pl contains additional hooks to
preserve the copyright headers as well as clean up tabs and line endings to
comply with EDK2 coding standards. The resulting file headers align with
the generated .h files which are already included in the EDK2 repository.

Cc: Jiewen Yao <jiewen.yao@...>
Cc: Jian J Wang <jian.j.wang@...>
Cc: Xiaoyu Lu <xiaoyux.lu@...>
Cc: Ard Biesheuvel <ard.biesheuvel@...>

Christopher J Zurcher (2):
CryptoPkg/OpensslLib: Add native instruction support for X64
CryptoPkg/OpensslLib: Commit the auto-generated assembly files for X64

CryptoPkg/Library/OpensslLib/OpensslLib.inf | 2 +-
CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf | 2 +-
CryptoPkg/Library/OpensslLib/OpensslLibX64.inf | 657 +++
CryptoPkg/Library/Include/CrtLibSupport.h | 2 +
CryptoPkg/Library/Include/openssl/opensslconf.h | 3 -
CryptoPkg/Library/OpensslLib/ApiHooks.c | 18 +
CryptoPkg/Library/OpensslLib/OpensslLibConstructor.c | 34 +
CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-mb-x86_64.nasm | 732 +++
CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-sha1-x86_64.nasm | 1916 ++++++++
CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-sha256-x86_64.nasm | 78 +
CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-x86_64.nasm | 5103 ++++++++++++++++++++
CryptoPkg/Library/OpensslLib/X64/crypto/aes/vpaes-x86_64.nasm | 1173 +++++
CryptoPkg/Library/OpensslLib/X64/crypto/modes/aesni-gcm-x86_64.nasm | 34 +
CryptoPkg/Library/OpensslLib/X64/crypto/modes/ghash-x86_64.nasm | 1569 ++++++
CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha1-mb-x86_64.nasm | 3137 ++++++++++++
CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha1-x86_64.nasm | 2884 +++++++++++
CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha256-mb-x86_64.nasm | 3461 +++++++++++++
CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha256-x86_64.nasm | 3313 +++++++++++++
CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha512-x86_64.nasm | 1938 ++++++++
CryptoPkg/Library/OpensslLib/X64/crypto/x86_64cpuid.nasm | 491 ++
CryptoPkg/Library/OpensslLib/process_files.pl | 223 +-
CryptoPkg/Library/OpensslLib/uefi-asm.conf | 15 +
22 files changed, 26735 insertions(+), 50 deletions(-)
create mode 100644 CryptoPkg/Library/OpensslLib/OpensslLibX64.inf
create mode 100644 CryptoPkg/Library/OpensslLib/ApiHooks.c
create mode 100644 CryptoPkg/Library/OpensslLib/OpensslLibConstructor.c
create mode 100644 CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-mb-x86_64.nasm
create mode 100644 CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-sha1-x86_64.nasm
create mode 100644 CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-sha256-x86_64.nasm
create mode 100644 CryptoPkg/Library/OpensslLib/X64/crypto/aes/aesni-x86_64.nasm
create mode 100644 CryptoPkg/Library/OpensslLib/X64/crypto/aes/vpaes-x86_64.nasm
create mode 100644 CryptoPkg/Library/OpensslLib/X64/crypto/modes/aesni-gcm-x86_64.nasm
create mode 100644 CryptoPkg/Library/OpensslLib/X64/crypto/modes/ghash-x86_64.nasm
create mode 100644 CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha1-mb-x86_64.nasm
create mode 100644 CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha1-x86_64.nasm
create mode 100644 CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha256-mb-x86_64.nasm
create mode 100644 CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha256-x86_64.nasm
create mode 100644 CryptoPkg/Library/OpensslLib/X64/crypto/sha/sha512-x86_64.nasm
create mode 100644 CryptoPkg/Library/OpensslLib/X64/crypto/x86_64cpuid.nasm
create mode 100644 CryptoPkg/Library/OpensslLib/uefi-asm.conf

--
2.28.0.windows.1


Re: [RestJsonStructureDxe PATCH 1/2] MdePkg/Include: Definitions of EFI REST JSON Structure Protocol

Abner Chang
 

-----Original Message-----
From: gaoliming [mailto:gaoliming@...]
Sent: Wednesday, October 14, 2020 1:42 PM
To: devel@edk2.groups.io; Chang, Abner (HPS SW/FW Technologist)
<abner.chang@...>
Cc: 'Michael D Kinney' <michael.d.kinney@...>; 'Zhiguang Liu'
<zhiguang.liu@...>; 'Jiaxin Wu' <jiaxin.wu@...>; 'Siyuan Fu'
<siyuan.fu@...>; 'Fan Wang' <fan.wang@...>; 'Jiewen Yao'
<jiewen.yao@...>; Wang, Nickle (HPS SW) <nickle.wang@...>
Subject: 回复: [edk2-devel] [RestJsonStructureDxe PATCH 1/2]
MdePkg/Include: Definitions of EFI REST JSON Structure Protocol

Abner:

-----邮件原件-----
发件人: bounce+27952+66030+4905953+8761045@groups.io
<bounce+27952+66030+4905953+8761045@groups.io> 代表 Abner Chang
发送时间: 2020年10月8日 23:11
收件人: devel@edk2.groups.io
抄送: Michael D Kinney <michael.d.kinney@...>; Liming Gao
<gaoliming@...>; Zhiguang Liu <zhiguang.liu@...>;
Jiaxin Wu <jiaxin.wu@...>; Siyuan Fu <siyuan.fu@...>; Fan
Wang <fan.wang@...>; Jiewen Yao <jiewen.yao@...>; Nickle
Wang <nickle.wang@...>
主题: [edk2-devel] [RestJsonStructureDxe PATCH 1/2] MdePkg/Include:
Definitions of EFI REST JSON Structure Protocol

Add definitions of EFI REST JSON Structure according to UEFI spec
2.8 Section 29.7.3 EFI REST JSON Resource to C Structure Converter.

Signed-off-by: Abner Chang <abner.chang@...>

Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Liming Gao <gaoliming@...>
Cc: Zhiguang Liu <zhiguang.liu@...>
Cc: Jiaxin Wu <jiaxin.wu@...>
Cc: Siyuan Fu <siyuan.fu@...>
Cc: Fan Wang <fan.wang@...>
Cc: Jiewen Yao <jiewen.yao@...>
Cc: Nickle Wang <nickle.wang@...>
---
MdePkg/Include/Protocol/RestJsonStructure.h | 160
++++++++++++++++++++
MdePkg/MdePkg.dec | 6 +
2 files changed, 166 insertions(+)
create mode 100644 MdePkg/Include/Protocol/RestJsonStructure.h

diff --git a/MdePkg/Include/Protocol/RestJsonStructure.h
b/MdePkg/Include/Protocol/RestJsonStructure.h
new file mode 100644
index 0000000000..5e4fef8cff
--- /dev/null
+++ b/MdePkg/Include/Protocol/RestJsonStructure.h
@@ -0,0 +1,160 @@
+/** @file
+ This file defines the EFI REST JSON Structure Protocol interface.
+
Please also specify UEFI spec version.

+ (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef EFI_REST_JSON_STRUCTURE_PROTOCOL_H_
+#define EFI_REST_JSON_STRUCTURE_PROTOCOL_H_
+
+#include <Uefi.h>
+
Uefi.h is not required. The module will include this header file.

+//
+// GUID definitions
+//
+#define EFI_REST_JSON_STRUCTURE_PROTOCOL_GUID \
+ { \
+ 0xa9a048f6, 0x48a0, 0x4714, {0xb7, 0xda, 0xa9, 0xad,0x87, 0xd4,
+0xda,
0xc9 } \
+ }
+
+typedef struct _EFI_REST_JSON_STRUCTURE_PROTOCOL
EFI_REST_JSON_STRUCTURE_PROTOCOL;
+typedef CHAR8 * EFI_REST_JSON_RESOURCE_TYPE_DATATYPE;
+typedef CHAR8 * EFI_REST_RESOURCE_RELATIVE_PATH;
EFI_REST_RESOURCE_RELATIVE_PATH is not in UEFI spec. Can you confirm it?
Good catch. We don’t use this anymore.

+
+/** Structure defintions of resource name space.
+ *
+ * The fields declared in this structure define the
+ * name and revision of payload delievered throught
+ * REST API.
+**/
Structure comments start with /// or //. /**/ style is for the function.
Please update them.

+typedef struct _EFI_REST_JSON_RESOURCE_TYPE_NAMESPACE {
+ CHAR8 *ResourceTypeName; ///< Resource type name
+ CHAR8 *MajorVersion; ///< Resource major version
+ CHAR8 *MinorVersion; ///< Resource minor version
+ CHAR8 *ErrataVersion; ///< Resource errata version
+} EFI_REST_JSON_RESOURCE_TYPE_NAMESPACE;
+
+/** REST resource type identifier
+ *
+ * REST resource type consists of name space and data type.
+**/
+typedef struct _EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER {
+ EFI_REST_JSON_RESOURCE_TYPE_NAMESPACE NameSpace; ///<
Namespace of this resource type.
+ EFI_REST_JSON_RESOURCE_TYPE_DATATYPE DataType; ///< Name of
data type declared in this
+ ///<
resource type.
+} EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER;
+
+/** List of JSON to C structure conversions which this convertor
supports.
+ *
+**/
+typedef struct _EFI_REST_JSON_STRUCTURE_SUPPORTED {
+ LIST_ENTRY NextSupportedRsrcInterp; ///<
Linklist to next supported conversion.
+ EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER RestResourceInterp; ///<
JSON resource type this convertor supports.
+} EFI_REST_JSON_STRUCTURE_SUPPORTED;
+
+/** The header file of JSON C structure
+ *
+**/
+typedef struct _EFI_REST_JSON_STRUCTURE_HEADER {
+ EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER JsonRsrcIdentifier;
///< Resource identifier which use to
+
///< choice the proper interpreter.
+ ///< Follow by a pointer points to JSON structure, the content in
+ the ///< JSON structure is implementation-specific according to
+ converter
producer.
+ ///
+ VOID *JsonStructurePointer;
+} EFI_REST_JSON_STRUCTURE_HEADER;
+
+/**
+ JSON-IN C Structure-OUT function. Convert the given REST JSON
+resource
into structure.
+
+ @param[in] This This is the
EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
+ @param[in] JsonRsrcIdentifier This indicates the resource type and
version is given in
+ ResourceJsonText.
+ @param[in] ResourceJsonText REST JSON resource in text
format.
+ @param[out] JsonStructure Pointer to receive the pointer to
EFI_REST_JSON_STRUCTURE_HEADER
+
+ @retval EFI_SUCCESS
+ @retval Others
+--*/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_JSON_STRUCTURE_TO_STRUCTURE)(
+ IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
+ IN EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *JsonRsrcIdentifier
OPTIONAL,
+ IN CHAR8
*ResourceJsonText,
+ OUT EFI_REST_JSON_STRUCTURE_HEADER **JsonStructure
+);
+
+/**
+ Convert the given REST JSON structure into JSON text.
+
+ @param[in] This This is the
EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
+ @param[in] JsonStructureHeader The point to
EFI_REST_JSON_STRUCTURE_HEADER structure.
+ @param[out] ResourceJsonText Pointer to receive REST JSON
resource in text format.
+
+ @retval EFI_SUCCESS
+ @retval Others
+
+--*/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_JSON_STRUCTURE_TO_JSON)(
+ IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
+ IN EFI_REST_JSON_STRUCTURE_HEADER *JsonStructureHeader,
+ OUT CHAR8 **ResourceJsonText
+);
+
+/**
+ This function destroys the REST JSON structure.
+
+ @param[in] This This is the
EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
+ @param[in] JsonStructureHeader JSON structure to destroy.
+
+ @retval EFI_SUCCESS
+ @retval Others
+
+--*/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_JSON_STRUCTURE_DESTORY_STRUCTURE)(
+ IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
+ IN EFI_REST_JSON_STRUCTURE_HEADER *JsonStructureHeader
+);
+/**
+ This function provides REST JSON resource to structure converter
registration.
+
+ @param[in] This This is the
EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
+ @param[in] JsonStructureSupported The type and version of REST
JSON resource which this converter
+ supports.
+ @param[in] ToStructure The function to convert
REST JSON resource to structure.
+ @param[in] ToJson The function to convert
REST JSON structure to JSON in text format.
+ @param[out] DestroyStructure Destroy REST JSON
structure returned in ToStructure() function.
+
+ @retval EFI_SUCCESS Register successfully.
+ @retval Others Fail to register.
+
+--*/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_JSON_STRUCTURE_REGISTER)(
+ IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
+ IN EFI_REST_JSON_STRUCTURE_SUPPORTED
*JsonStructureSupported,
+ IN EFI_REST_JSON_STRUCTURE_TO_STRUCTURE ToStructure,
+ IN EFI_REST_JSON_STRUCTURE_TO_JSON ToJson,
+ IN EFI_REST_JSON_STRUCTURE_DESTORY_STRUCTURE
DestroyStructure );
+
+/** EFI REST JSON to C structure protocol definition.
+ *
+**/
+typedef struct _EFI_REST_JSON_STRUCTURE_PROTOCOL {
+ EFI_REST_JSON_STRUCTURE_REGISTER Register;
///< Register JSON to C structure convertor
+ EFI_REST_JSON_STRUCTURE_TO_STRUCTURE ToStructure;
///< The function to convert JSON to C structure
+ EFI_REST_JSON_STRUCTURE_TO_JSON ToJson;
///< The function to convert C structure to JSON
+ EFI_REST_JSON_STRUCTURE_DESTORY_STRUCTURE DestoryStructure;
///< Destory C structure.
+} EFI_REST_JSON_STRUCTURE_PROTOCOL;
Here, typedef is not required, because
EFI_REST_JSON_STRUCTURE_PROTOCOL has been defined in the begin of
this file.
All comments were addressed, v2 was sent.
Thanks.

Thanks
Liming
+
+#endif
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index
812be75fb3..0943816825 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -1848,6 +1848,12 @@
## Include/Protocol/NvdimmLabel.h
gEfiNvdimmLabelProtocolGuid = { 0xd40b6b80, 0x97d5,
0x4282, { 0xbb, 0x1d, 0x22, 0x3a, 0x16, 0x91, 0x80, 0x58 }}

+ #
+ # Protocols defined in UEFI2.8
+ #
+ ## Include/Protocol/RestJsonStructure.h
+ gEfiRestJsonStructureProtocolGuid = { 0xa9a048f6, 0x48a0, 0x4714,
{0xb7, 0xda, 0xa9, 0xad,0x87, 0xd4, 0xda, 0xc9 }}
+
#
# Protocols defined in Shell2.0
#
--
2.17.1





[RestJsonStructureDxe PATCH v2 1/2] MdePkg/Include: Definitions of EFI REST JSON Structure Protocol

Abner Chang
 

Add definitions of EFI REST JSON Structure according to UEFI spec
2.8 Section 29.7.3 EFI REST JSON Resource to C Structure Converter.

Signed-off-by: Abner Chang <abner.chang@...>

Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Liming Gao <gaoliming@...>
Cc: Zhiguang Liu <zhiguang.liu@...>
Cc: Jiaxin Wu <jiaxin.wu@...>
Cc: Siyuan Fu <siyuan.fu@...>
Cc: Fan Wang <fan.wang@...>
Cc: Jiewen Yao <jiewen.yao@...>
Cc: Nickle Wang <nickle.wang@...>
---
MdePkg/Include/Protocol/RestJsonStructure.h | 161 ++++++++++++++++++++
MdePkg/MdePkg.dec | 6 +
2 files changed, 167 insertions(+)
create mode 100644 MdePkg/Include/Protocol/RestJsonStructure.h

diff --git a/MdePkg/Include/Protocol/RestJsonStructure.h b/MdePkg/Include/Protocol/RestJsonStructure.h
new file mode 100644
index 0000000000..adaf148f71
--- /dev/null
+++ b/MdePkg/Include/Protocol/RestJsonStructure.h
@@ -0,0 +1,161 @@
+/** @file
+ This file defines the EFI REST JSON Structure Protocol interface.
+
+ (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Revision Reference:
+ This Protocol is introduced in UEFI Specification 2.8
+
+**/
+
+#ifndef EFI_REST_JSON_STRUCTURE_PROTOCOL_H_
+#define EFI_REST_JSON_STRUCTURE_PROTOCOL_H_
+
+///
+/// GUID definitions
+///
+#define EFI_REST_JSON_STRUCTURE_PROTOCOL_GUID \
+ { \
+ 0xa9a048f6, 0x48a0, 0x4714, {0xb7, 0xda, 0xa9, 0xad,0x87, 0xd4, 0xda, 0xc9 } \
+ }
+
+typedef struct _EFI_REST_JSON_STRUCTURE_PROTOCOL EFI_REST_JSON_STRUCTURE_PROTOCOL;
+typedef CHAR8 * EFI_REST_JSON_RESOURCE_TYPE_DATATYPE;
+
+///
+/// Structure defintions of resource name space.
+///
+/// The fields declared in this structure define the
+/// name and revision of payload delievered throught
+/// REST API.
+///
+typedef struct _EFI_REST_JSON_RESOURCE_TYPE_NAMESPACE {
+ CHAR8 *ResourceTypeName; ///< Resource type name
+ CHAR8 *MajorVersion; ///< Resource major version
+ CHAR8 *MinorVersion; ///< Resource minor version
+ CHAR8 *ErrataVersion; ///< Resource errata version
+} EFI_REST_JSON_RESOURCE_TYPE_NAMESPACE;
+
+///
+/// REST resource type identifier
+///
+/// REST resource type consists of name space and data type.
+///
+typedef struct _EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER {
+ EFI_REST_JSON_RESOURCE_TYPE_NAMESPACE NameSpace; ///< Namespace of this resource type.
+ EFI_REST_JSON_RESOURCE_TYPE_DATATYPE DataType; ///< Name of data type declared in this
+ ///< resource type.
+} EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER;
+
+///
+/// List of JSON to C structure conversions which this convertor supports.
+///
+typedef struct _EFI_REST_JSON_STRUCTURE_SUPPORTED {
+ LIST_ENTRY NextSupportedRsrcInterp; ///< Linklist to next supported conversion.
+ EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER RestResourceInterp; ///< JSON resource type this convertor supports.
+} EFI_REST_JSON_STRUCTURE_SUPPORTED;
+
+///
+/// The header file of JSON C structure
+///
+typedef struct _EFI_REST_JSON_STRUCTURE_HEADER {
+ EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER JsonRsrcIdentifier; ///< Resource identifier which use to
+ ///< choice the proper interpreter.
+ ///< Follow by a pointer points to JSON structure, the content in the
+ ///< JSON structure is implementation-specific according to converter producer.
+ VOID *JsonStructurePointer;
+} EFI_REST_JSON_STRUCTURE_HEADER;
+
+/**
+ JSON-IN C Structure-OUT function. Convert the given REST JSON resource into structure.
+
+ @param[in] This This is the EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
+ @param[in] JsonRsrcIdentifier This indicates the resource type and version is given in
+ ResourceJsonText.
+ @param[in] ResourceJsonText REST JSON resource in text format.
+ @param[out] JsonStructure Pointer to receive the pointer to EFI_REST_JSON_STRUCTURE_HEADER
+
+ @retval EFI_SUCCESS
+ @retval Others
+--*/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_JSON_STRUCTURE_TO_STRUCTURE)(
+ IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
+ IN EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *JsonRsrcIdentifier OPTIONAL,
+ IN CHAR8 *ResourceJsonText,
+ OUT EFI_REST_JSON_STRUCTURE_HEADER **JsonStructure
+);
+
+/**
+ Convert the given REST JSON structure into JSON text.
+
+ @param[in] This This is the EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
+ @param[in] JsonStructureHeader The point to EFI_REST_JSON_STRUCTURE_HEADER structure.
+ @param[out] ResourceJsonText Pointer to receive REST JSON resource in text format.
+
+ @retval EFI_SUCCESS
+ @retval Others
+
+--*/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_JSON_STRUCTURE_TO_JSON)(
+ IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
+ IN EFI_REST_JSON_STRUCTURE_HEADER *JsonStructureHeader,
+ OUT CHAR8 **ResourceJsonText
+);
+
+/**
+ This function destroys the REST JSON structure.
+
+ @param[in] This This is the EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
+ @param[in] JsonStructureHeader JSON structure to destroy.
+
+ @retval EFI_SUCCESS
+ @retval Others
+
+--*/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_JSON_STRUCTURE_DESTORY_STRUCTURE)(
+ IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
+ IN EFI_REST_JSON_STRUCTURE_HEADER *JsonStructureHeader
+);
+/**
+ This function provides REST JSON resource to structure converter registration.
+
+ @param[in] This This is the EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
+ @param[in] JsonStructureSupported The type and version of REST JSON resource which this converter
+ supports.
+ @param[in] ToStructure The function to convert REST JSON resource to structure.
+ @param[in] ToJson The function to convert REST JSON structure to JSON in text format.
+ @param[out] DestroyStructure Destroy REST JSON structure returned in ToStructure() function.
+
+ @retval EFI_SUCCESS Register successfully.
+ @retval Others Fail to register.
+
+--*/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_JSON_STRUCTURE_REGISTER)(
+ IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
+ IN EFI_REST_JSON_STRUCTURE_SUPPORTED *JsonStructureSupported,
+ IN EFI_REST_JSON_STRUCTURE_TO_STRUCTURE ToStructure,
+ IN EFI_REST_JSON_STRUCTURE_TO_JSON ToJson,
+ IN EFI_REST_JSON_STRUCTURE_DESTORY_STRUCTURE DestroyStructure
+);
+
+///
+/// EFI REST JSON to C structure protocol definition.
+///
+struct _EFI_REST_JSON_STRUCTURE_PROTOCOL {
+ EFI_REST_JSON_STRUCTURE_REGISTER Register; ///< Register JSON to C structure convertor
+ EFI_REST_JSON_STRUCTURE_TO_STRUCTURE ToStructure; ///< The function to convert JSON to C structure
+ EFI_REST_JSON_STRUCTURE_TO_JSON ToJson; ///< The function to convert C structure to JSON
+ EFI_REST_JSON_STRUCTURE_DESTORY_STRUCTURE DestoryStructure; ///< Destory C structure.
+};
+
+#endif
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index 812be75fb3..0943816825 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -1848,6 +1848,12 @@
## Include/Protocol/NvdimmLabel.h
gEfiNvdimmLabelProtocolGuid = { 0xd40b6b80, 0x97d5, 0x4282, { 0xbb, 0x1d, 0x22, 0x3a, 0x16, 0x91, 0x80, 0x58 }}

+ #
+ # Protocols defined in UEFI2.8
+ #
+ ## Include/Protocol/RestJsonStructure.h
+ gEfiRestJsonStructureProtocolGuid = { 0xa9a048f6, 0x48a0, 0x4714, {0xb7, 0xda, 0xa9, 0xad,0x87, 0xd4, 0xda, 0xc9 }}
+
#
# Protocols defined in Shell2.0
#
--
2.17.1


[RestJsonStructureDxe PATCH v2 0/2] EFI REST JSON Structure Protocol

Abner Chang
 

This is the implementation of EFI_REST_JSON_STRUCTURE_PROTOCOL,
refer to UEFI spec 2.8 Section 29.7.3 EFI REST JSON Resource to C Structure
Converter.

In v2:
- Couple feedbacks given by Liming on patch 1/2 were addressed.
- Cosmetics on the source code in patch 2/2.

Signed-off-by: Abner Chang <abner.chang@...>

Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Liming Gao <gaoliming@...>
Cc: Zhiguang Liu <zhiguang.liu@...>
Cc: Jiaxin Wu <jiaxin.wu@...>
Cc: Siyuan Fu <siyuan.fu@...>
Cc: Fan Wang <fan.wang@...>
Cc: Jiewen Yao <jiewen.yao@...>
Cc: Nickle Wang <nickle.wang@...>

Abner Chang (2):
MdePkg/Include: Definitions of EFI REST JSON Structure Protocol
RedfishPkg/RestJsonStructureDxe: EFI REST JSON Structure Protocol

MdePkg/Include/Protocol/RestJsonStructure.h | 161 +++++
MdePkg/MdePkg.dec | 6 +
RedfishPkg/RedfishPkg.dsc | 3 +
.../RestJsonStructureDxe.c | 583 ++++++++++++++++++
.../RestJsonStructureDxe.inf | 40 ++
.../RestJsonStructureInternal.h | 35 ++
6 files changed, 828 insertions(+)
create mode 100644 MdePkg/Include/Protocol/RestJsonStructure.h
create mode 100644 RedfishPkg/RestJsonStructureDxe/RestJsonStructureDxe.c
create mode 100644 RedfishPkg/RestJsonStructureDxe/RestJsonStructureDxe.inf
create mode 100644 RedfishPkg/RestJsonStructureDxe/RestJsonStructureInternal.h

--
2.17.1


[RestJsonStructureDxe PATCH v2 2/2] RedfishPkg/RestJsonStructureDxe: EFI REST JSON Structure Protocol

Abner Chang
 

Implementation of EFI_REST_JSON_STRUCTURE_PROTOCOL, refer to UEFI spec
2.8 Section 29.7.3 EFI REST JSON Resource to C Structure Converter.

Signed-off-by: Abner Chang <abner.chang@...>

Cc: Jiaxin Wu <jiaxin.wu@...>
Cc: Siyuan Fu <siyuan.fu@...>
Cc: Fan Wang <fan.wang@...>
Cc: Jiewen Yao <jiewen.yao@...>
Cc: Nickle Wang <nickle.wang@...>
---
RedfishPkg/RedfishPkg.dsc | 3 +
.../RestJsonStructureDxe.c | 585 ++++++++++++++++++
.../RestJsonStructureDxe.inf | 40 ++
.../RestJsonStructureInternal.h | 33 +
4 files changed, 661 insertions(+)
create mode 100644 RedfishPkg/RestJsonStructureDxe/RestJsonStructureDxe.c
create mode 100644 RedfishPkg/RestJsonStructureDxe/RestJsonStructureDxe.inf
create mode 100644 RedfishPkg/RestJsonStructureDxe/RestJsonStructureInternal.h

diff --git a/RedfishPkg/RedfishPkg.dsc b/RedfishPkg/RedfishPkg.dsc
index 8acadddefc..5ef375ce40 100644
--- a/RedfishPkg/RedfishPkg.dsc
+++ b/RedfishPkg/RedfishPkg.dsc
@@ -38,3 +38,6 @@
DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
+
+[Components]
+ RedfishPkg/RestJsonStructureDxe/RestJsonStructureDxe.inf
diff --git a/RedfishPkg/RestJsonStructureDxe/RestJsonStructureDxe.c b/RedfishPkg/RestJsonStructureDxe/RestJsonStructureDxe.c
new file mode 100644
index 0000000000..6156c33efa
--- /dev/null
+++ b/RedfishPkg/RestJsonStructureDxe/RestJsonStructureDxe.c
@@ -0,0 +1,585 @@
+/** @file
+
+ The implementation of EFI REST Resource JSON to C structure convertor
+ Protocol.
+
+ (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Uefi.h>
+#include <Protocol/RestJsonStructure.h>
+#include "RestJsonStructureInternal.h"
+
+LIST_ENTRY mRestJsonStructureList;
+EFI_HANDLE mProtocolHandle;
+
+/**
+ This function registers Restful resource interpreter for the
+ specific schema.
+
+ @param[in] This This is the EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
+ @param[in] JsonStructureSupported The type and version of REST JSON resource which this converter
+ supports.
+ @param[in] ToStructure The function to convert REST JSON resource to structure.
+ @param[in] ToJson The function to convert REST JSON structure to JSON in text format.
+ @param[in] DestroyStructure Destroy REST JSON structure returned in ToStructure() function.
+
+ @retval EFI_SUCCESS Register successfully.
+ @retval Others Fail to register.
+
+**/
+EFI_STATUS
+EFIAPI
+RestJsonStructureRegister (
+ IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
+ IN EFI_REST_JSON_STRUCTURE_SUPPORTED *JsonStructureSupported,
+ IN EFI_REST_JSON_STRUCTURE_TO_STRUCTURE ToStructure,
+ IN EFI_REST_JSON_STRUCTURE_TO_JSON ToJson,
+ IN EFI_REST_JSON_STRUCTURE_DESTORY_STRUCTURE DestroyStructure
+)
+{
+ UINTN NumberOfNS;
+ UINTN Index;
+ LIST_ENTRY *ThisList;
+ REST_JSON_STRUCTURE_INSTANCE *Instance;
+ EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *CloneSupportedInterpId;
+ EFI_REST_JSON_STRUCTURE_SUPPORTED *ThisSupportedInterp;
+
+ if (This == NULL ||
+ ToStructure == NULL ||
+ ToJson == NULL ||
+ DestroyStructure == NULL ||
+ JsonStructureSupported == NULL
+ ) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
+ // Check how many name space interpreter can interpret.
+ //
+ ThisList = &JsonStructureSupported->NextSupportedRsrcInterp;
+ NumberOfNS = 1;
+ while (TRUE) {
+ if (ThisList->ForwardLink == &JsonStructureSupported->NextSupportedRsrcInterp) {
+ break;
+ } else {
+ ThisList = ThisList->ForwardLink;
+ NumberOfNS ++;
+ }
+ };
+
+ Instance =
+ (REST_JSON_STRUCTURE_INSTANCE *)AllocateZeroPool (sizeof (REST_JSON_STRUCTURE_INSTANCE) + NumberOfNS * sizeof (EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER));
+ if (Instance == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ InitializeListHead (&Instance->NextRestJsonStructureInstance);
+ Instance->NumberOfNameSpaceToConvert = NumberOfNS;
+ Instance->SupportedRsrcIndentifier = (EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *)((REST_JSON_STRUCTURE_INSTANCE *)Instance + 1);
+ //
+ // Copy supported resource identifer interpreter.
+ //
+ CloneSupportedInterpId = Instance->SupportedRsrcIndentifier;
+ ThisSupportedInterp = JsonStructureSupported;
+ for (Index = 0; Index < NumberOfNS; Index ++) {
+ CopyMem ((VOID *)CloneSupportedInterpId, (VOID *)&ThisSupportedInterp->RestResourceInterp, sizeof (EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER));
+ ThisSupportedInterp = (EFI_REST_JSON_STRUCTURE_SUPPORTED *)ThisSupportedInterp->NextSupportedRsrcInterp.ForwardLink;
+ CloneSupportedInterpId ++;
+ }
+ Instance->JsonToStructure = ToStructure;
+ Instance->StructureToJson = ToJson;
+ Instance->DestroyStructure = DestroyStructure;
+ InsertTailList (&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance);
+ return EFI_SUCCESS;
+}
+
+/**
+ This function check if this interpreter instance support the given namesapce.
+
+ @param[in] This EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
+ @param[in] InterpreterInstance REST_JSON_STRUCTURE_INSTANCE
+ @param[in] RsrcTypeIdentifier Resource type identifier.
+ @param[in] ResourceRaw Given Restful resource.
+ @param[out] InterpProp Property interpreted from given ResourceRaw.
+
+ @retval EFI_SUCCESS
+ @retval Others.
+
+**/
+EFI_STATUS
+InterpreterInstanceToStruct (
+ IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
+ IN REST_JSON_STRUCTURE_INSTANCE *InterpreterInstance,
+ IN EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *RsrcTypeIdentifier OPTIONAL,
+ IN CHAR8 *ResourceRaw,
+ OUT EFI_REST_JSON_STRUCTURE_HEADER **InterpProp
+ )
+{
+ UINTN Index;
+ EFI_STATUS Status;
+ EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *ThisSupportedRsrcTypeId;
+
+ if (This == NULL ||
+ InterpreterInstance == NULL ||
+ ResourceRaw == NULL ||
+ InterpProp == NULL
+ ) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Status = EFI_UNSUPPORTED;
+ if (RsrcTypeIdentifier == NULL) {
+ //
+ // No resource type identifier, send to intepreter anyway.
+ // Interpreter may recognize this resource.
+ //
+ Status = InterpreterInstance->JsonToStructure (
+ This,
+ NULL,
+ ResourceRaw,
+ InterpProp
+ );
+ } else {
+ //
+ // Check if the namesapce and version is supported by this interpreter.
+ //
+ ThisSupportedRsrcTypeId = InterpreterInstance->SupportedRsrcIndentifier;
+ for (Index = 0; Index < InterpreterInstance->NumberOfNameSpaceToConvert; Index ++){
+ if (AsciiStrCmp (
+ RsrcTypeIdentifier->NameSpace.ResourceTypeName,
+ ThisSupportedRsrcTypeId->NameSpace.ResourceTypeName) == 0){
+ if ((RsrcTypeIdentifier->NameSpace.MajorVersion == NULL) &&
+ (RsrcTypeIdentifier->NameSpace.MinorVersion == NULL) &&
+ (RsrcTypeIdentifier->NameSpace.ErrataVersion == NULL)
+ ) {
+ //
+ // Don't check version of this resource type identifier.
+ //
+ Status = InterpreterInstance->JsonToStructure (
+ This,
+ RsrcTypeIdentifier,
+ ResourceRaw,
+ InterpProp
+ );
+ break;
+ } else {
+ //
+ // Check version.
+ //
+ if ((AsciiStrCmp (
+ RsrcTypeIdentifier->NameSpace.MajorVersion,
+ ThisSupportedRsrcTypeId->NameSpace.MajorVersion) == 0) &&
+ (AsciiStrCmp (
+ RsrcTypeIdentifier->NameSpace.MinorVersion,
+ ThisSupportedRsrcTypeId->NameSpace.MinorVersion) == 0) &&
+ (AsciiStrCmp (
+ RsrcTypeIdentifier->NameSpace.ErrataVersion,
+ ThisSupportedRsrcTypeId->NameSpace.ErrataVersion) == 0)) {
+ Status = InterpreterInstance->JsonToStructure (
+ This,
+ RsrcTypeIdentifier,
+ ResourceRaw,
+ InterpProp
+ );
+ break;
+ }
+ }
+ }
+ ThisSupportedRsrcTypeId ++;
+ }
+ }
+ return Status;
+}
+/**
+ This function converts JSON C structure to JSON property.
+
+ @param[in] This EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
+ @param[in] InterpreterInstance REST_JSON_STRUCTURE_INSTANCE
+ @param[in] RsrcTypeIdentifier Resource type identifier.
+ @param[out] ResourceRaw Output in JSON text format.
+
+ @retval EFI_SUCCESS
+ @retval Others.
+
+**/
+EFI_STATUS
+InterpreterEfiStructToInstance (
+ IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
+ IN REST_JSON_STRUCTURE_INSTANCE *InterpreterInstance,
+ IN EFI_REST_JSON_STRUCTURE_HEADER *InterpProp,
+ OUT CHAR8 **ResourceRaw
+)
+{
+ UINTN Index;
+ EFI_STATUS Status;
+ EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *ThisSupportedRsrcTypeId;
+ EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *RsrcTypeIdentifier;
+
+ if (This == NULL ||
+ InterpreterInstance == NULL ||
+ InterpProp == NULL ||
+ ResourceRaw == NULL
+ ) {
+ return EFI_INVALID_PARAMETER;
+ }
+ RsrcTypeIdentifier = &InterpProp->JsonRsrcIdentifier;
+ if (RsrcTypeIdentifier == NULL ||
+ RsrcTypeIdentifier->NameSpace.ResourceTypeName == NULL ||
+ RsrcTypeIdentifier->NameSpace.MajorVersion == NULL ||
+ RsrcTypeIdentifier->NameSpace.MinorVersion == NULL ||
+ RsrcTypeIdentifier->NameSpace.ErrataVersion == NULL
+ ) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
+ // Check if the namesapce and version is supported by this interpreter.
+ //
+ Status = EFI_UNSUPPORTED;
+ ThisSupportedRsrcTypeId = InterpreterInstance->SupportedRsrcIndentifier;
+ for (Index = 0; Index < InterpreterInstance->NumberOfNameSpaceToConvert; Index ++){
+ if (AsciiStrCmp (
+ RsrcTypeIdentifier->NameSpace.ResourceTypeName,
+ ThisSupportedRsrcTypeId->NameSpace.ResourceTypeName) == 0){
+ //
+ // Check version.
+ //
+ if ((AsciiStrCmp (
+ RsrcTypeIdentifier->NameSpace.MajorVersion,
+ ThisSupportedRsrcTypeId->NameSpace.MajorVersion) == 0) &&
+ (AsciiStrCmp (
+ RsrcTypeIdentifier->NameSpace.MinorVersion,
+ ThisSupportedRsrcTypeId->NameSpace.MinorVersion) == 0) &&
+ (AsciiStrCmp (
+ RsrcTypeIdentifier->NameSpace.ErrataVersion,
+ ThisSupportedRsrcTypeId->NameSpace.ErrataVersion) == 0)) {
+ Status = InterpreterInstance->StructureToJson (
+ This,
+ InterpProp,
+ ResourceRaw
+ );
+ break;
+ }
+ }
+ ThisSupportedRsrcTypeId ++;
+ }
+ return Status;
+}
+
+/**
+ This function destory REST property structure.
+
+ @param[in] This EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
+ @param[in] InterpreterInstance REST_JSON_STRUCTURE_INSTANCE
+ @param[out] InterpProp Property interpreted from given ResourceRaw.
+
+ @retval EFI_SUCCESS
+ @retval Others.
+
+**/
+EFI_STATUS
+InterpreterInstanceDestoryJsonStruct (
+ IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
+ IN REST_JSON_STRUCTURE_INSTANCE *InterpreterInstance,
+ IN EFI_REST_JSON_STRUCTURE_HEADER *InterpProp
+ )
+{
+ UINTN Index;
+ EFI_STATUS Status;
+ EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *ThisSupportedRsrcTypeId;
+
+ if (This == NULL ||
+ InterpreterInstance == NULL ||
+ InterpProp == NULL
+ ) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Status = EFI_UNSUPPORTED;
+ //
+ // Check if the namesapce and version is supported by this interpreter.
+ //
+ ThisSupportedRsrcTypeId = InterpreterInstance->SupportedRsrcIndentifier;
+ for (Index = 0; Index < InterpreterInstance->NumberOfNameSpaceToConvert; Index ++){
+ if (AsciiStrCmp (
+ InterpProp->JsonRsrcIdentifier.NameSpace.ResourceTypeName,
+ ThisSupportedRsrcTypeId->NameSpace.ResourceTypeName) == 0) {
+ if ((InterpProp->JsonRsrcIdentifier.NameSpace.MajorVersion == NULL) &&
+ (InterpProp->JsonRsrcIdentifier.NameSpace.MinorVersion == NULL) &&
+ (InterpProp->JsonRsrcIdentifier.NameSpace.ErrataVersion == NULL)
+ ) {
+ //
+ // Don't check version of this resource type identifier.
+ //
+ Status = InterpreterInstance->DestroyStructure (
+ This,
+ InterpProp
+ );
+ break;
+ } else {
+ //
+ // Check version.
+ //
+ if ((AsciiStrCmp (
+ InterpProp->JsonRsrcIdentifier.NameSpace.MajorVersion,
+ ThisSupportedRsrcTypeId->NameSpace.MajorVersion) == 0) &&
+ (AsciiStrCmp (
+ InterpProp->JsonRsrcIdentifier.NameSpace.MinorVersion,
+ ThisSupportedRsrcTypeId->NameSpace.MinorVersion) == 0) &&
+ (AsciiStrCmp (
+ InterpProp->JsonRsrcIdentifier.NameSpace.ErrataVersion,
+ ThisSupportedRsrcTypeId->NameSpace.ErrataVersion) == 0)) {
+ Status = InterpreterInstance->DestroyStructure (
+ This,
+ InterpProp
+ );
+ break;
+ }
+ }
+ }
+ ThisSupportedRsrcTypeId ++;
+ }
+ return Status;
+}
+
+/**
+ This function translates the given JSON text to JSON C Structure.
+
+ @param[in] This EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
+ @param[in] RsrcTypeIdentifier Resource type identifier.
+ @param[in] ResourceJsonText Given Restful resource.
+ @param[out] JsonStructure Property interpreted from given ResourceRaw.
+
+ @retval EFI_SUCCESS
+ @retval Others.
+
+**/
+EFI_STATUS
+EFIAPI
+RestJsonStructureToStruct (
+ IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
+ IN EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *RsrcTypeIdentifier OPTIONAL,
+ IN CHAR8 *ResourceJsonText,
+ OUT EFI_REST_JSON_STRUCTURE_HEADER **JsonStructure
+)
+{
+ EFI_STATUS Status;
+ REST_JSON_STRUCTURE_INSTANCE *Instance;
+
+ if (This == NULL ||
+ ResourceJsonText == NULL ||
+ JsonStructure == NULL
+ ) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (IsListEmpty (&mRestJsonStructureList)) {
+ return EFI_UNSUPPORTED;
+ }
+ Status = EFI_SUCCESS;
+ Instance = (REST_JSON_STRUCTURE_INSTANCE *)GetFirstNode (&mRestJsonStructureList);
+ while (TRUE) {
+ Status = InterpreterInstanceToStruct (
+ This,
+ Instance,
+ RsrcTypeIdentifier,
+ ResourceJsonText,
+ JsonStructure
+ );
+ if (!EFI_ERROR (Status)) {
+ break;
+ }
+ if (IsNodeAtEnd(&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance)) {
+ Status = EFI_UNSUPPORTED;
+ break;
+ }
+ Instance = (REST_JSON_STRUCTURE_INSTANCE *)GetNextNode (&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance);
+ };
+ return Status;
+}
+
+/**
+ This function destory REST property EFI structure which returned in
+ JsonToStructure().
+
+ @param[in] This EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
+ @param[in] InterpProp Property to destory.
+
+ @retval EFI_SUCCESS
+ @retval Others
+
+**/
+EFI_STATUS
+EFIAPI
+RestJsonStructureDestroyStruct (
+ IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
+ IN EFI_REST_JSON_STRUCTURE_HEADER *JsonStructureHeader
+)
+{
+ EFI_STATUS Status;
+ REST_JSON_STRUCTURE_INSTANCE *Instance;
+
+ if (This == NULL || JsonStructureHeader == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (IsListEmpty (&mRestJsonStructureList)) {
+ return EFI_UNSUPPORTED;
+ }
+ Status = EFI_SUCCESS;
+ Instance = (REST_JSON_STRUCTURE_INSTANCE *)GetFirstNode (&mRestJsonStructureList);
+ while (TRUE) {
+ Status = InterpreterInstanceDestoryJsonStruct (
+ This,
+ Instance,
+ JsonStructureHeader
+ );
+ if (!EFI_ERROR (Status)) {
+ break;
+ }
+ if (IsNodeAtEnd(&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance)) {
+ Status = EFI_UNSUPPORTED;
+ break;
+ }
+ Instance = (REST_JSON_STRUCTURE_INSTANCE *)GetNextNode (&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance);
+ };
+ return Status;
+}
+
+/**
+ This function translates the given JSON C Structure to JSON text.
+
+ @param[in] This EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
+ @param[in] InterpProp Given Restful resource.
+ @param[out] ResourceRaw Resource in RESTfuls service oriented.
+
+ @retval EFI_SUCCESS
+ @retval Others Fail to remove the entry
+
+**/
+EFI_STATUS
+EFIAPI
+RestJsonStructureToJson (
+ IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
+ IN EFI_REST_JSON_STRUCTURE_HEADER *InterpProp,
+ OUT CHAR8 **ResourceRaw
+)
+{
+ EFI_STATUS Status;
+ REST_JSON_STRUCTURE_INSTANCE *Instance;
+
+ if (This == NULL || InterpProp == NULL || ResourceRaw == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (IsListEmpty (&mRestJsonStructureList)) {
+ return EFI_UNSUPPORTED;
+ }
+ Status = EFI_SUCCESS;
+ Instance = (REST_JSON_STRUCTURE_INSTANCE *)GetFirstNode (&mRestJsonStructureList);
+ while (TRUE) {
+ Status = InterpreterEfiStructToInstance (
+ This,
+ Instance,
+ InterpProp,
+ ResourceRaw
+ );
+ if (!EFI_ERROR (Status)) {
+ break;
+ }
+ if (IsNodeAtEnd(&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance)) {
+ Status = EFI_UNSUPPORTED;
+ break;
+ }
+ Instance = (REST_JSON_STRUCTURE_INSTANCE *)GetNextNode (&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance);
+ };
+ return Status;
+}
+
+EFI_REST_JSON_STRUCTURE_PROTOCOL mRestJsonStructureProtocol = {
+ RestJsonStructureRegister,
+ RestJsonStructureToStruct,
+ RestJsonStructureToJson,
+ RestJsonStructureDestroyStruct
+};
+
+/**
+ This is the declaration of an EFI image entry point.
+
+ @param ImageHandle The firmware allocated handle for the UEFI image.
+ @param SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The operation completed successfully.
+ @retval Others An unexpected error occurred.
+**/
+EFI_STATUS
+EFIAPI
+RestJsonStructureEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ InitializeListHead (&mRestJsonStructureList);
+ //
+ // Install the Restful Resource Interpreter Protocol.
+ //
+ mProtocolHandle = NULL;
+ Status = gBS->InstallProtocolInterface (
+ &mProtocolHandle,
+ &gEfiRestJsonStructureProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ (VOID *)&mRestJsonStructureProtocol
+ );
+ return Status;
+}
+
+/**
+ This is the unload handle for Redfish discover module.
+
+ Disconnect the driver specified by ImageHandle from all the devices in the handle database.
+ Uninstall all the protocols installed in the driver entry point.
+
+ @param[in] ImageHandle The drivers' driver image.
+
+ @retval EFI_SUCCESS The image is unloaded.
+ @retval Others Failed to unload the image.
+
+**/
+EFI_STATUS
+EFIAPI
+RestJsonStructureUnload (
+ IN EFI_HANDLE ImageHandle
+ )
+{
+ EFI_STATUS Status;
+ REST_JSON_STRUCTURE_INSTANCE *Instance;
+ REST_JSON_STRUCTURE_INSTANCE *NextInstance;
+
+ if (IsListEmpty (&mRestJsonStructureList)) {
+ return EFI_SUCCESS;
+ }
+ //
+ // Free memory of REST_JSON_STRUCTURE_INSTANCE instance.
+ //
+ Instance = (REST_JSON_STRUCTURE_INSTANCE *)GetFirstNode (&mRestJsonStructureList);
+ do {
+ NextInstance = NULL;
+ if (!IsNodeAtEnd(&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance)) {
+ NextInstance = (REST_JSON_STRUCTURE_INSTANCE *)GetNextNode (&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance);
+ }
+ FreePool ((VOID *)Instance);
+ Instance = NextInstance;
+ } while (Instance != NULL);
+
+ Status = gBS->UninstallProtocolInterface (
+ mProtocolHandle,
+ &gEfiRestJsonStructureProtocolGuid,
+ (VOID *)&mRestJsonStructureProtocol
+ );
+ return Status;
+}
diff --git a/RedfishPkg/RestJsonStructureDxe/RestJsonStructureDxe.inf b/RedfishPkg/RestJsonStructureDxe/RestJsonStructureDxe.inf
new file mode 100644
index 0000000000..df774de715
--- /dev/null
+++ b/RedfishPkg/RestJsonStructureDxe/RestJsonStructureDxe.inf
@@ -0,0 +1,40 @@
+## @file
+# Implementation of EFI REST JSON Structure Protocol.
+#
+# (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = RestJsonStructureDxe
+ FILE_GUID = 83FAAFBF-FC4B-469F-892A-798E66A6F50A
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = RestJsonStructureEntryPoint
+ UNLOAD_IMAGE = RestJsonStructureUnload
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ RedfishPkg/RedfishPkg.dec
+
+[Sources]
+ RestJsonStructureDxe.c
+
+[LibraryClasses]
+ BaseLib
+ BaseMemoryLib
+ MemoryAllocationLib
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+ UefiLib
+
+[Protocols]
+ gEfiRestJsonStructureProtocolGuid ## Producing
+
+[Depex]
+ TRUE
+
diff --git a/RedfishPkg/RestJsonStructureDxe/RestJsonStructureInternal.h b/RedfishPkg/RestJsonStructureDxe/RestJsonStructureInternal.h
new file mode 100644
index 0000000000..e8a3408404
--- /dev/null
+++ b/RedfishPkg/RestJsonStructureDxe/RestJsonStructureInternal.h
@@ -0,0 +1,33 @@
+/** @file
+ The internal definitions of EFI REST Resource JSON to C structure convertor
+ Protocol.
+
+ (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef EFI_REST_JSON_STRUCTURE_INTERNAL_H_
+#define EFI_REST_JSON_STRUCTURE_INTERNAL_H_
+
+#include <Library/BaseLib.h>
+#include <Library/UefiLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiDriverEntryPoint.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/MemoryAllocationLib.h>
+
+///
+/// Internal structure to maintain the information of JSON to
+/// C structure convertor.
+///
+typedef struct _REST_JSON_STRUCTURE_INSTANCE {
+ LIST_ENTRY NextRestJsonStructureInstance; ///< Next convertor instance
+ UINTN NumberOfNameSpaceToConvert; ///< Number of resource type this convertor supports.
+ EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *SupportedRsrcIndentifier; ///< The resource type linklist
+ EFI_REST_JSON_STRUCTURE_TO_STRUCTURE JsonToStructure; ///< JSON to C structure function
+ EFI_REST_JSON_STRUCTURE_TO_JSON StructureToJson; ///< C structure to JSON function
+ EFI_REST_JSON_STRUCTURE_DESTORY_STRUCTURE DestroyStructure; ///< Destory C struture function.
+} REST_JSON_STRUCTURE_INSTANCE;
+#endif
--
2.17.1


Re: [RedfishPkg PATCH v6 3/4] .azurepipelines/templates: Add RedfishPkg to target build

Abner Chang
 

Hi Sean and Bret,
I picked up patch 2/4 and 3/4 from v6 and created a PR. https://github.com/tianocore/edk2/pull/1013
Are you able to take a look and set Push label to merge it? However the PR was closed.

Thanks
Abner

-----Original Message-----
From: Chang, Abner (HPS SW/FW Technologist)
Sent: Thursday, October 8, 2020 11:57 AM
To: devel@edk2.groups.io; Chang, Abner (HPS SW/FW Technologist)
<abner.chang@...>; spbrogan@...
Cc: Sean Brogan <sean.brogan@...>; Bret Barkelew
<Bret.Barkelew@...>; Michael D Kinney
<michael.d.kinney@...>; Liming Gao <gaoliming@...>;
Wang, Nickle (HPS SW) <nickle.wang@...>; Laszlo Ersek
<lersek@...>; Leif Lindholm <leif@...>
Subject: RE: [edk2-devel] [RedfishPkg PATCH v6
3/4] .azurepipelines/templates: Add RedfishPkg to target build

Add Laszlo and Leif to aware of this conversation.

-----Original Message-----
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
Abner Chang
Sent: Thursday, October 8, 2020 9:09 AM
To: devel@edk2.groups.io; spbrogan@...
Cc: Sean Brogan <sean.brogan@...>; Bret Barkelew
<Bret.Barkelew@...>; Michael D Kinney
<michael.d.kinney@...>; Liming Gao <gaoliming@...>;
Wang, Nickle (HPS SW) <nickle.wang@...>
Subject: Re: [edk2-devel] [RedfishPkg PATCH v6 3/4]
.azurepipelines/templates: Add RedfishPkg to target build

Ok thanks for clarifying this!

I think the entire series of patch for the initial version of
RedfishPkg is all good now. I will push my part (1/4) and please help
to push 2/4 and 3/4, with your feedback tag is better because v6 has
updates on pr-gate-build-job.yml.


-----Original Message-----
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf
Of Sean
Sent: Thursday, October 8, 2020 9:01 AM
To: devel@edk2.groups.io; Chang, Abner (HPS SW/FW Technologist)
<abner.chang@...>
Cc: Sean Brogan <sean.brogan@...>; Bret Barkelew
<Bret.Barkelew@...>; Michael D Kinney
<michael.d.kinney@...>; Liming Gao
<gaoliming@...>;
Wang, Nickle (HPS SW) <nickle.wang@...>
Subject: Re: [edk2-devel] [RedfishPkg PATCH v6 3/4]
.azurepipelines/templates: Add RedfishPkg to target build

thats correct. The grouping in the "matrix" is just to load balance
the servers when CI/PR gates run.



On 10/7/2020 5:59 PM, Abner Chang wrote:
Hi Sean and Bret,
The v6 update for .azurepiplines is to put RedfishPkg together
with
Network in the TARGET_NETWORK? Is that ok RedfishPkg is involved in
TARGET_NETWORK CI test? I think it should be fine right? They don't
impact each other when developers are working on these two packages
separately.

-----Original Message-----
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On
Behalf Of Abner Chang
Sent: Wednesday, October 7, 2020 10:16 AM
To: devel@edk2.groups.io
Cc: Sean Brogan <sean.brogan@...>; Bret Barkelew
<Bret.Barkelew@...>; Michael D Kinney
<michael.d.kinney@...>; Liming Gao
<gaoliming@...>; Wang, Nickle (HPS SW)
<nickle.wang@...>
Subject: [edk2-devel] [RedfishPkg PATCH v6
3/4] .azurepipelines/templates:
Add RedfishPkg to target build

Signed-off-by: Abner Chang <abner.chang@...>
Cc: Sean Brogan <sean.brogan@...>
Cc: Bret Barkelew <Bret.Barkelew@...>
Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Liming Gao <gaoliming@...>
Cc: Nickle Wang <nickle.wang@...>
Reviewed-by: Bret Barkelew <Bret.Barkelew@...>
---
.azurepipelines/templates/pr-gate-build-job.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.azurepipelines/templates/pr-gate-build-job.yml
b/.azurepipelines/templates/pr-gate-build-job.yml
index 2683687a1c..89c632c0a7 100644
--- a/.azurepipelines/templates/pr-gate-build-job.yml
+++ b/.azurepipelines/templates/pr-gate-build-job.yml
@@ -31,7 +31,7 @@ jobs:
Build.Pkgs: 'MdeModulePkg'
Build.Targets: 'RELEASE,NO-TARGET'
TARGET_NETWORK:
- Build.Pkgs: 'NetworkPkg'
+ Build.Pkgs: 'NetworkPkg,RedfishPkg'
Build.Targets: 'DEBUG,RELEASE,NO-TARGET'
TARGET_OTHER:
Build.Pkgs: 'PcAtChipsetPkg,ShellPkg'
--
2.17.1














Re: OpensslLib compiling error : cannot open include file : openssl/aes.h

Bob Feng
 

cc_resp.txt is generated by build tool.

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Tiger Liu(BJ-RD)
Sent: Wednesday, October 14, 2020 3:26 PM
To: gaoliming <gaoliming@...>; devel@edk2.groups.io
Subject: 答复: [edk2-devel] OpensslLib compiling error : cannot open include file : openssl/aes.h

Hi, liming:
Got it.

Is Cc_resp.txt produced by compiler automatically? Or by UDK build tools?

The problem I met may be caused by violating the limitation length of the compiler command line.
After trim the length, could pass the failed point.

Thanks
-----邮件原件-----
发件人: gaoliming <gaoliming@...>
发送时间: 2020年10月14日 13:35
收件人: devel@edk2.groups.io; Tiger Liu(BJ-RD) <TigerLiu@...>
主题: 回复: [edk2-devel] OpensslLib compiling error : cannot open include file : openssl/aes.h

cc_resp.txt includes the compiler flag and include path. It will be used by the compiler. Then, the compile command line length can be reduced. It can avoid nmake limitation of the command line length 4096.

Thanks
Liming
-----邮件原件-----
发件人: bounce+27952+66197+4905953+8761045@groups.io
<bounce+27952+66197+4905953+8761045@groups.io> 代表 Tiger
Liu(BJ-RD)
发送时间: 2020年10月14日 9:45
收件人: gaoliming <gaoliming@...>; devel@edk2.groups.io
主题: 答复: [edk2-devel] OpensslLib compiling error : cannot open include
file : openssl/aes.h

Hi, Liming:
From Build.log, it seems include path is ok:
......
cl.exe"
/Foy:\Build\ZxxPlatformPkg\DEBUG_VS2015x86\X64\CryptoPkg\Library\Base
CryptLib\RuntimeCryptLib\OUTPUT\Hash\ /showIncludes /nologo /c /GS-
/W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF
/Z7 /Gw /wd4090 -
......
/Iy:\CryptoPkg /Iy:\CryptoPkg\Include /Iy:\CryptoPkg\Private
/Iy:\CryptoPkg\Library\Include
/Iy:\CryptoPkg\Library\OpensslLib\openssl\include
y:\CryptoPkg\Library\BaseCryptLib\Hash\CryptSm3.c
y:\CryptoPkg\Library\BaseCryptLib\Hash\CryptMd5.c
y:\CryptoPkg\Library\BaseCryptLib\Hash\CryptSha256.c
y:\CryptoPkg\Library\BaseCryptLib\Hash\CryptSha512Null.c
y:\CryptoPkg\Library\BaseCryptLib\Hash\CryptSha1.c

And BaseCryptLib / IntrinsicLib compiled successfully.

And I found a cc_resp.txt file in
Build\...\DEBUG_VS2015x86\X64\CryptoPkg\Library\OpensslLib\OpensslLib\
OUTPUT
Why produce a cc_resp.txt?

Thanks
-----邮件原件-----
发件人: gaoliming <gaoliming@...>
发送时间: 2020年10月13日 18:03
收件人: devel@edk2.groups.io; Tiger Liu(BJ-RD) <TigerLiu@...>
主题: 回复: [edk2-devel] OpensslLib compiling error : cannot open include
file : openssl/aes.h

Can you print the full build log and check the compiler include path?

Is this a clean build issue or incremental build issue?

Thanks
Liming
-----邮件原件-----
发件人: bounce+27952+66166+4905953+8761045@groups.io
<bounce+27952+66166+4905953+8761045@groups.io> 代表 Tiger
Liu(BJ-RD)
发送时间: 2020年10月13日 16:38
收件人: devel@edk2.groups.io
主题: [edk2-devel] OpensslLib compiling error : cannot open include file :
openssl/aes.h

Hi, experts:
When I compiled OpensslLib, I met a problem:
......
\CryptoPkg\Library\OpensslLib\openssl\crypto\aes\aes_core.c(42):
fatal error C1083: Cannot open include file: 'openssl/crypto.h': No
such file or directory
\CryptoPkg\Library\OpensslLib\openssl\crypto\aes\aes_misc.c(10):
fatal error C1083: Cannot open include file: 'openssl/opensslv.h':
No such file or directory ......

But these files exist in
CryptoPkg\Library\OpensslLib\openssl\include\openssl .

Does anybody meet same problems?

Note:
CryptoPkg.dec has also declared this include path:
......
[Includes.Common.Private]
Private
Library/Include
Library/OpensslLib/openssl/include
......

Thanks


保密声明:
本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或

内容做任何未经授权的查阅、使用、复制或转发。
CONFIDENTIAL NOTE:
This email contains confidential or legally privileged information
and is for the sole use of its intended recipient. Any unauthorized
review, use, copying or forwarding of this email or the content of
this email is
strictly prohibited.







保密声明:
本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或其
内容做任何未经授权的查阅、使用、复制或转发。
CONFIDENTIAL NOTE:
This email contains confidential or legally privileged information and
is for the sole use of its intended recipient. Any unauthorized
review, use, copying or forwarding of this email or the content of this email is strictly prohibited.







保密声明:
本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或其内容做任何未经授权的查阅、使用、复制或转发。
CONFIDENTIAL NOTE:
This email contains confidential or legally privileged information and is for the sole use of its intended recipient. Any unauthorized review, use, copying or forwarding of this email or the content of this email is strictly prohibited.


Re: [Rest Ex Definition PATCH 1/2] MdePkg/Include: Definitions of EFI REST EX Protocol

Abner Chang
 

Thanks Liming, v2 patch sent.

CI test passed on PR: https://github.com/tianocore/edk2/pull/1012

-----Original Message-----
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
gaoliming
Sent: Wednesday, October 14, 2020 1:37 PM
To: 'Wu, Jiaxin' <jiaxin.wu@...>; devel@edk2.groups.io; Chang, Abner
(HPS SW/FW Technologist) <abner.chang@...>
Cc: 'Kinney, Michael D' <michael.d.kinney@...>; 'Liu, Zhiguang'
<zhiguang.liu@...>; 'Yao, Jiewen' <jiewen.yao@...>; Wang,
Nickle (HPS SW) <nickle.wang@...>
Subject: 回复: [edk2-devel] [Rest Ex Definition PATCH 1/2] MdePkg/Include:
Definitions of EFI REST EX Protocol

Abner:
In the file header, please describe this definition is from which version UEFI
spec. With this change, Reviewed-by: Liming Gao <gaoliming@....
cn>

Thanks
Liming
-----邮件原件-----
发件人: Wu, Jiaxin <jiaxin.wu@...>
发送时间: 2020年10月12日 16:54
收件人: devel@edk2.groups.io; abner.chang@...
抄送: Kinney, Michael D <michael.d.kinney@...>; Liming Gao
<gaoliming@...>; Liu, Zhiguang <zhiguang.liu@...>;
Yao, Jiewen <jiewen.yao@...>; Nickle Wang
<nickle.wang@...>
主题: RE: [edk2-devel] [Rest Ex Definition PATCH 1/2] MdePkg/Include:
Definitions of EFI REST EX Protocol

Reviewed-by: Jiaxin Wu <jiaxin.wu@...>



-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of
Abner
Chang
Sent: Monday, October 12, 2020 3:04 PM
To: devel@edk2.groups.io
Cc: Kinney, Michael D <michael.d.kinney@...>; Liming Gao
<gaoliming@...>; Liu, Zhiguang <zhiguang.liu@...>;
Yao, Jiewen <jiewen.yao@...>; Nickle Wang
<nickle.wang@...>
Subject: [edk2-devel] [Rest Ex Definition PATCH 1/2] MdePkg/Include:
Definitions of EFI REST EX Protocol

Add definitions of EFI REST EX Protocol according to UEFI spec v2.8
Section 29.7.2 EFI REST EX Protocol.

Signed-off-by: Jiaxin Wu <jiaxin.wu@...>
Signed-off-by: Siyuan Fu <siyuan.fu@...>
Signed-off-by: Fan Wang <fan.wang@...>
Signed-off-by: Abner Chang <abner.chang@...>

Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Liming Gao <gaoliming@...>
Cc: Zhiguang Liu <zhiguang.liu@...>
Cc: Jiewen Yao <jiewen.yao@...>
Cc: Nickle Wang <nickle.wang@...>
---
MdePkg/Include/Protocol/RestEx.h | 388
+++++++++++++++++++++++++++++++
MdePkg/MdePkg.dec | 7 +
2 files changed, 395 insertions(+)
create mode 100644 MdePkg/Include/Protocol/RestEx.h

diff --git a/MdePkg/Include/Protocol/RestEx.h
b/MdePkg/Include/Protocol/RestEx.h
new file mode 100644
index 0000000000..c42096d14c
--- /dev/null
+++ b/MdePkg/Include/Protocol/RestEx.h
@@ -0,0 +1,388 @@
+/** @file
+ This file defines the EFI REST EX Protocol interface. It is
+ split into the following two main sections.
+
+ - REST EX Service Binding Protocol
+ - REST EX Protocol
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+
+**/
+
+#ifndef EFI_REST_EX_PROTOCOL_H_
+#define EFI_REST_EX_PROTOCOL_H_
+
+#include <Protocol/Http.h>
+
+//
+//GUID definitions
+//
+#define EFI_REST_EX_SERVICE_BINDING_PROTOCOL_GUID \
+ { \
+ 0x456bbe01, 0x99d0, 0x45ea, {0xbb, 0x5f, 0x16, 0xd8, 0x4b,
+0xed,
0xc5,
0x59 } \
+ }
+
+#define EFI_REST_EX_PROTOCOL_GUID \
+ { \
+ 0x55648b91, 0xe7d, 0x40a3, {0xa9, 0xb3, 0xa8, 0x15, 0xd7, 0xea,
0xdf,
0x97 } \
+ }
+
+typedef struct _EFI_REST_EX_PROTOCOL EFI_REST_EX_PROTOCOL;
+
+//*******************************************************
+//EFI_REST_EX_SERVICE_INFO_VER
+//*******************************************************
+typedef struct {
+ UINT8 Major;
+ UINT8 Minor;
+} EFI_REST_EX_SERVICE_INFO_VER;
+
+//*******************************************************
+//EFI_REST_EX_SERVICE_INFO_HEADER
+//*******************************************************
+typedef struct {
+ UINT32 Length;
+ EFI_REST_EX_SERVICE_INFO_VER RestServiceInfoVer;
+} EFI_REST_EX_SERVICE_INFO_HEADER;
+
+//*******************************************************
+// EFI_REST_EX_SERVICE_TYPE
+//*******************************************************
+typedef enum {
+ EfiRestExServiceUnspecific = 1,
+ EfiRestExServiceRedfish,
+ EfiRestExServiceOdata,
+ EfiRestExServiceVendorSpecific = 0xff,
+ EfiRestExServiceTypeMax
+} EFI_REST_EX_SERVICE_TYPE;
+
+//*******************************************************
+// EFI_REST_EX_SERVICE_ACCESS_MODE
+//*******************************************************
+typedef enum {
+ EfiRestExServiceInBandAccess = 1,
+ EfiRestExServiceOutOfBandAccess = 2,
+ EfiRestExServiceModeMax
+} EFI_REST_EX_SERVICE_ACCESS_MODE;
+
+//*******************************************************
+// EFI_REST_EX_CONFIG_TYPE
+//*******************************************************
+typedef enum {
+ EfiRestExConfigHttp,
+ EfiRestExConfigUnspecific,
+ EfiRestExConfigTypeMax
+} EFI_REST_EX_CONFIG_TYPE;
+
+//*******************************************************
+//EFI_REST_EX_SERVICE_INFO v1.0
+//*******************************************************
+typedef struct {
+ EFI_REST_EX_SERVICE_INFO_HEADER EfiRestExServiceInfoHeader;
+ EFI_REST_EX_SERVICE_TYPE RestServiceType;
+ EFI_REST_EX_SERVICE_ACCESS_MODE RestServiceAccessMode;
+ EFI_GUID VendorRestServiceName;
+ UINT32 VendorSpecificDataLength;
+ UINT8 *VendorSpecifcData;
+ EFI_REST_EX_CONFIG_TYPE RestExConfigType;
+ UINT8 RestExConfigDataLength;
+} EFI_REST_EX_SERVICE_INFO_V_1_0;
+
+//*******************************************************
+//EFI_REST_EX_SERVICE_INFO
+//*******************************************************
+typedef union {
+ EFI_REST_EX_SERVICE_INFO_HEADER EfiRestExServiceInfoHeader;
+ EFI_REST_EX_SERVICE_INFO_V_1_0 EfiRestExServiceInfoV10; }
+EFI_REST_EX_SERVICE_INFO;
+
+//*******************************************************
+// EFI_REST_EX_HTTP_CONFIG_DATA
+//*******************************************************
+typedef struct {
+ EFI_HTTP_CONFIG_DATA HttpConfigData;
+ UINT32 SendReceiveTimeout;
+} EFI_REST_EX_HTTP_CONFIG_DATA;
+
+//*******************************************************
+//EFI_REST_EX_CONFIG_DATA
+//*******************************************************
+typedef UINT8 *EFI_REST_EX_CONFIG_DATA;
+
+//*******************************************************
+//EFI_REST_EX_TOKEN
+//*******************************************************
+typedef struct {
+ EFI_EVENT Event;
+ EFI_STATUS Status;
+ EFI_HTTP_MESSAGE *ResponseMessage; } EFI_REST_EX_TOKEN;
+
+/**
+ Provides a simple HTTP-like interface to send and receive
+resources
from a
REST service.
+
+ The SendReceive() function sends an HTTP request to this REST
service,
and returns a
+ response when the data is retrieved from the service.
+ RequestMessage
contains the HTTP
+ request to the REST resource identified by
RequestMessage.Request.Url.
The
+ ResponseMessage is the returned HTTP response for that request,
including any HTTP
+ status.
+
+ @param[in] This Pointer to
EFI_REST_EX_PROTOCOL instance for a
particular
+ REST service.
+ @param[in] RequestMessage Pointer to the HTTP request data
for this
resource
+ @param[out] ResponseMessage Pointer to the HTTP response
data
obtained for this requested.
+
+ @retval EFI_SUCCESS operation succeeded.
+ @retval EFI_INVALID_PARAMETER This, RequestMessage, or
ResponseMessage are NULL.
+ @retval EFI_DEVICE_ERROR An unexpected system or
network error
occurred.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_SEND_RECEIVE)(
+ IN EFI_REST_EX_PROTOCOL *This,
+ IN EFI_HTTP_MESSAGE *RequestMessage,
+ OUT EFI_HTTP_MESSAGE *ResponseMessage
+ );
+
+/**
+ Obtain the current time from this REST service instance.
+
+ The GetServiceTime() function is an optional interface to obtain
+ the
current time from
+ this REST service instance. If this REST service does not support
+ to
retrieve
the time,
+ this function returns EFI_UNSUPPORTED. This function must returns
EFI_UNSUPPORTED if
+ EFI_REST_EX_SERVICE_TYPE returned in EFI_REST_EX_SERVICE_INFO
from
GetService() is
+ EFI_REST_EX_SERVICE_UNSPECIFIC.
+
+ @param[in] This Pointer to
EFI_REST_EX_PROTOCOL instance for a
particular
+ REST service.
+ @param[out] Time A pointer to storage to receive a
snapshot of
the current time of
+ the REST service.
+
+ @retval EFI_SUCCESS operation succeeded.
+ @retval EFI_INVALID_PARAMETER This or Time are NULL.
+ @retval EFI_UNSUPPORTED The RESTful service does not
support
returning the time.
+ @retval EFI_DEVICE_ERROR An unexpected system or
network error
occurred.
+ @retval EFI_NOT_READY The configuration of this instance
is not set
yet. Configure() must
+ be executed and returns
successfully prior to invoke this
function.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_GET_TIME)(
+ IN EFI_REST_EX_PROTOCOL *This,
+ OUT EFI_TIME *Time
+ );
+
+/**
+ This function returns the information of REST service provided by
this EFI
REST EX driver instance.
+
+ The information such as the type of REST service and the access
+ mode
of
REST EX driver instance
+ (In-band or Out-of-band) are described in
+ EFI_REST_EX_SERVICE_INFO
structure. For the vendor-specific
+ REST service, vendor-specific REST service information is
+ returned in
VendorSpecifcData.
+ REST EX driver designer is well know what REST service this REST
+ EX
driver
instance intends to
+ communicate with. The designer also well know this driver
+ instance is
used
to talk to BMC through
+ specific platform mechanism or talk to REST server through UEFI
+ HTTP
protocol. REST EX driver is
+ responsible to fill up the correct information in
EFI_REST_EX_SERVICE_INFO. EFI_REST_EX_SERVICE_INFO
+ is referred by EFI REST clients to pickup the proper EFI REST EX
driver
instance to get and set resource.
+ GetService() is a basic and mandatory function which must be able
+ to
use
even Configure() is not invoked
+ in previously.
+
+ @param[in] This Pointer to
EFI_REST_EX_PROTOCOL instance for a
particular
+ REST service.
+ @param[out] RestExServiceInfo Pointer to receive a pointer to
EFI_REST_EX_SERVICE_INFO structure. The
+ format of
EFI_REST_EX_SERVICE_INFO is version
controlled for the future
+ extension. The version of
EFI_REST_EX_SERVICE_INFO
structure is returned
+ in the header within this
structure. EFI REST client refers to
the correct
+ format of structure according to
the version number. The
pointer to
+ EFI_REST_EX_SERVICE_INFO is
a memory block allocated
by EFI REST EX driver
+ instance. That is caller's
responsibility to free this memory
when this
+ structure is no longer needed.
Refer to Related Definitions
below for the
+ definitions of
EFI_REST_EX_SERVICE_INFO structure.
+
+ @retval EFI_SUCCESS EFI_REST_EX_SERVICE_INFO is
returned in
RestExServiceInfo. This function
+ is not supported in this REST EX
Protocol driver instance.
+ @retval EFI_UNSUPPORTED This function is not supported in
this REST
EX Protocol driver instance.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_EX_GET_SERVICE)(
+ IN EFI_REST_EX_PROTOCOL *This,
+ OUT EFI_REST_EX_SERVICE_INFO **RestExServiceInfo
+ );
+
+/**
+ This function returns operational configuration of current EFI
+REST
EX
child
instance.
+
+ This function returns the current configuration of EFI REST EX
+ child
instance.
The format of
+ operational configuration depends on the implementation of EFI
+ REST
EX
driver instance. For
+ example, HTTP-aware EFI REST EX driver instance uses EFI HTTP
protocol as
the undying protocol
+ to communicate with REST service. In this case, the type of
configuration
is
+ EFI_REST_EX_CONFIG_TYPE_HTTP returned from GetService().
EFI_HTTP_CONFIG_DATA is used as EFI REST
+ EX configuration format and returned to EFI REST client. User has
+ to
type
cast RestExConfigData
+ to EFI_HTTP_CONFIG_DATA. For those non HTTP-aware REST EX driver
instances, the type of configuration
+ is EFI_REST_EX_CONFIG_TYPE_UNSPECIFIC returned from
GetService().
In
this case, the format of
+ returning data could be non industrial. Instead, the format of
configuration
data is system/platform
+ specific definition such as BMC mechanism used in EFI REST EX
+ driver
instance. EFI REST client and
+ EFI REST EX driver instance have to refer to the specific system
/platform
spec which is out of UEFI scope.
+
+ @param[in] This This is the
EFI_REST_EX_PROTOCOL instance.
+ @param[out] RestExConfigData Pointer to receive a pointer to
EFI_REST_EX_CONFIG_DATA.
+ The memory allocated for
configuration data should be
freed
+ by caller. See Related
+ Definitions
for the details.
+
+ @retval EFI_SUCCESS EFI_REST_EX_CONFIG_DATA is
returned in
successfully.
+ @retval EFI_UNSUPPORTED This function is not supported in
this REST
EX Protocol driver instance.
+ @retval EFI_NOT_READY The configuration of this instance
is not set
yet. Configure() must be
+ executed and returns
successfully prior to invoke this
function.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_EX_GET_MODE_DATA)(
+ IN EFI_REST_EX_PROTOCOL *This,
+ OUT EFI_REST_EX_CONFIG_DATA *RestExConfigData
+ );
+
+/**
+ This function is used to configure EFI REST EX child instance.
+
+ This function is used to configure the setting of underlying
+ protocol
of
REST
EX child
+ instance. The type of configuration is according to the
implementation of
EFI REST EX
+ driver instance. For example, HTTP-aware EFI REST EX driver
+ instance
uses
EFI HTTP protocol
+ as the undying protocol to communicate with REST service. The
+ type of
configuration is
+ EFI_REST_EX_CONFIG_TYPE_HTTP and RestExConfigData is the same
format with EFI_HTTP_CONFIG_DATA.
+ Akin to HTTP configuration, REST EX child instance can be
+ configure
to
use
different HTTP
+ local access point for the data transmission. Multiple REST
+ clients
may
use
different
+ configuration of HTTP to distinguish themselves, such as to use
+ the
different TCP port.
+ For those non HTTP-aware REST EX driver instance, the type of
configuration is
+ EFI_REST_EX_CONFIG_TYPE_UNSPECIFIC. RestExConfigData refers to
the
non industrial standard.
+ Instead, the format of configuration data is system/platform
+ specific
definition such as BMC.
+ In this case, EFI REST client and EFI REST EX driver instance
+ have to
refer
to
the specific
+ system/platform spec which is out of the UEFI scope. Besides
GetService()function, no other
+ EFI REST EX functions can be executed by this instance until
Configure()is
executed and returns
+ successfully. All other functions must returns EFI_NOT_READY if
+ this
instance is not configured
+ yet. Set RestExConfigData to NULL means to put EFI REST EX child
instance
into the unconfigured
+ state.
+
+ @param[in] This This is the
EFI_REST_EX_PROTOCOL instance.
+ @param[in] RestExConfigData Pointer to
EFI_REST_EX_CONFIG_DATA.
See Related Definitions in
+ GetModeData() protocol
interface.
+
+ @retval EFI_SUCCESS EFI_REST_EX_CONFIG_DATA is
set in
successfully.
+ @retval EFI_DEVICE_ERROR Configuration for this REST EX
child
instance is failed with the given
+ EFI_REST_EX_CONFIG_DATA.
+ @retval EFI_UNSUPPORTED This function is not supported in
this REST
EX Protocol driver instance.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_EX_CONFIGURE)(
+ IN EFI_REST_EX_PROTOCOL *This,
+ IN EFI_REST_EX_CONFIG_DATA RestExConfigData
+ );
+
+/**
+ This function sends REST request to REST service and signal
+caller's
event
asynchronously when
+ the final response is received by REST EX Protocol driver instance.
+
+ The essential design of this function is to handle asynchronous
send/receive implicitly according
+ to REST service asynchronous request mechanism. Caller will get
+ the
notification once the response
+ is returned from REST service.
+
+ @param[in] This This is the
EFI_REST_EX_PROTOCOL instance.
+ @param[in] RequestMessage This is the HTTP request
message sent
to REST service. Set RequestMessage
+ to NULL to cancel the
previous asynchronous request
associated with the
+ corresponding RestExToken.
See descriptions for the
details.
+ @param[in] RestExToken REST EX token which REST EX
Protocol
instance uses to notify REST client
+ the status of response of
asynchronous REST request. See
related definition
+ of EFI_REST_EX_TOKEN.
+ @param[in] TimeOutInMilliSeconds The pointer to the timeout in
milliseconds which REST EX Protocol driver
+ instance refers as the
duration to drop asynchronous REST
request. NULL
+ pointer means no timeout for
this REST request. REST EX
Protocol driver
+ signals caller's event with
EFI_STATUS set to EFI_TIMEOUT
in RestExToken
+ if REST EX Protocol can't get
the response from REST
service within
+ TimeOutInMilliSeconds.
+
+ @retval EFI_SUCCESS Asynchronous REST request is
established.
+ @retval EFI_UNSUPPORTED This REST EX Protocol driver
instance
doesn't support asynchronous request.
+ @retval EFI_TIMEOUT Asynchronous REST request is
not
established and timeout is expired.
+ @retval EFI_ABORT Previous asynchronous REST
request has been
canceled.
+ @retval EFI_DEVICE_ERROR Otherwise, returns
EFI_DEVICE_ERROR
for other errors according to HTTP Status Code.
+ @retval EFI_NOT_READY The configuration of this
instance is not set
yet. Configure() must be executed
+ and returns successfully prior
to invoke this function.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_EX_ASYNC_SEND_RECEIVE)(
+ IN EFI_REST_EX_PROTOCOL *This,
+ IN EFI_HTTP_MESSAGE *RequestMessage OPTIONAL,
+ IN EFI_REST_EX_TOKEN *RestExToken,
+ IN UINTN *TimeOutInMilliSeconds
OPTIONAL
+ );
+
+/**
+ This function sends REST request to a REST Event service and
+signals
caller's
event
+ token asynchronously when the URI resource change event is
+ received
by
REST EX
+ Protocol driver instance.
+
+ The essential design of this function is to monitor event
+ implicitly
according
to
+ REST service event service mechanism. Caller will get the
notification if
certain
+ resource is changed.
+
+ @param[in] This This is the
EFI_REST_EX_PROTOCOL instance.
+ @param[in] RequestMessage This is the HTTP request
message sent
to REST service. Set RequestMessage
+ to NULL to cancel the
previous event service associated
with the corresponding
+ RestExToken. See
descriptions for the details.
+ @param[in] RestExToken REST EX token which REST EX
Protocol
driver instance uses to notify REST client
+ the URI resource which
monitored by REST client has
been changed. See the related
+ definition of
EFI_REST_EX_TOKEN in
EFI_REST_EX_PROTOCOL.AsyncSendReceive().
+
+ @retval EFI_SUCCESS Asynchronous REST request is
established.
+ @retval EFI_UNSUPPORTED This REST EX Protocol driver
instance
doesn't support asynchronous request.
+ @retval EFI_ABORT Previous asynchronous REST
request has been
canceled or event subscription has been
+ delete from service.
+ @retval EFI_DEVICE_ERROR Otherwise, returns
EFI_DEVICE_ERROR
for other errors according to HTTP Status Code.
+ @retval EFI_NOT_READY The configuration of this
instance is not set
yet. Configure() must be executed
+ and returns successfully prior
to invoke this function.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_EX_EVENT_SERVICE)(
+ IN EFI_REST_EX_PROTOCOL *This,
+ IN EFI_HTTP_MESSAGE *RequestMessage OPTIONAL,
+ IN EFI_REST_EX_TOKEN *RestExToken
+);
+
+///
+/// EFI REST(EX) protocols are designed to support REST
+communication
between EFI REST client
+/// applications/drivers and REST services. EFI REST client tool
+uses
EFI
REST(EX) protocols
+/// to send/receive resources to/from REST service to manage
+systems,
configure systems or
+/// manipulate resources on REST service. Due to HTTP protocol is
commonly used to communicate
+/// with REST service in practice, EFI REST(EX) protocols adopt
+HTTP as
the
message format to
+/// send and receive REST service resource. EFI REST(EX) driver
instance
abstracts EFI REST
+/// client functionality and provides underlying interface to
communicate
with REST service.
+/// EFI REST(EX) driver instance knows how to communicate with REST
service through certain
+/// interface after the corresponding configuration is initialized.
+///
+struct _EFI_REST_EX_PROTOCOL {
+ EFI_REST_SEND_RECEIVE SendReceive;
+ EFI_REST_GET_TIME GetServiceTime;
+ EFI_REST_EX_GET_SERVICE GetService;
+ EFI_REST_EX_GET_MODE_DATA GetModeData;
+ EFI_REST_EX_CONFIGURE Configure;
+ EFI_REST_EX_ASYNC_SEND_RECEIVE AyncSendReceive;
+ EFI_REST_EX_EVENT_SERVICE EventService;
+};
+
+extern EFI_GUID gEfiRestExServiceBindingProtocolGuid;
+extern EFI_GUID gEfiRestExProtocolGuid;
+
+#endif
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index
812be75fb3..5205374d62 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -1848,6 +1848,13 @@
## Include/Protocol/NvdimmLabel.h
gEfiNvdimmLabelProtocolGuid = { 0xd40b6b80,
0x97d5, 0x4282,
{ 0xbb, 0x1d, 0x22, 0x3a, 0x16, 0x91, 0x80, 0x58 }}

+ #
+ # Protocols defined in UEFI2.8
+ #
+ ## Include/Protocol/RestEx.h
+ gEfiRestExProtocolGuid = { 0x55648b91, 0xe7d,
0x40a3, { 0xa9, 0xb3,
0xa8, 0x15, 0xd7, 0xea, 0xdf, 0x97 }}
+ gEfiRestExServiceBindingProtocolGuid = { 0x456bbe01, 0x99d0,
+ 0x45ea,
{ 0xbb, 0x5f, 0x16, 0xd8, 0x4b, 0xed, 0xc5, 0x59 }}
+
#
# Protocols defined in Shell2.0
#
--
2.17.1










[Rest Ex Definition PATCH v2 1/2] MdePkg/Include: Definitions of EFI REST EX Protocol

Abner Chang
 

Add definitions of EFI REST EX Protocol according
to UEFI spec v2.8 Section 29.7.2 EFI REST EX Protocol.

Signed-off-by: Jiaxin Wu <jiaxin.wu@...>
Signed-off-by: Siyuan Fu <siyuan.fu@...>
Signed-off-by: Fan Wang <fan.wang@...>
Signed-off-by: Abner Chang <abner.chang@...>

Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Liming Gao <gaoliming@...>
Cc: Zhiguang Liu <zhiguang.liu@...>
Cc: Jiewen Yao <jiewen.yao@...>
Cc: Nickle Wang <nickle.wang@...>

Reviewed-by: Jiaxin Wu <jiaxin.wu@...>
Reviewed-by: Liming Gao <gaoliming@...>
---
MdePkg/Include/Protocol/RestEx.h | 390 +++++++++++++++++++++++++++++++
MdePkg/MdePkg.dec | 7 +
2 files changed, 397 insertions(+)
create mode 100644 MdePkg/Include/Protocol/RestEx.h

diff --git a/MdePkg/Include/Protocol/RestEx.h b/MdePkg/Include/Protocol/RestEx.h
new file mode 100644
index 0000000000..dc1b4381b9
--- /dev/null
+++ b/MdePkg/Include/Protocol/RestEx.h
@@ -0,0 +1,390 @@
+/** @file
+ This file defines the EFI REST EX Protocol interface. It is
+ split into the following two main sections.
+
+ - REST EX Service Binding Protocol
+ - REST EX Protocol
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Revision Reference:
+ This Protocol is introduced in UEFI Specification 2.8
+
+**/
+
+#ifndef EFI_REST_EX_PROTOCOL_H_
+#define EFI_REST_EX_PROTOCOL_H_
+
+#include <Protocol/Http.h>
+
+//
+//GUID definitions
+//
+#define EFI_REST_EX_SERVICE_BINDING_PROTOCOL_GUID \
+ { \
+ 0x456bbe01, 0x99d0, 0x45ea, {0xbb, 0x5f, 0x16, 0xd8, 0x4b, 0xed, 0xc5, 0x59 } \
+ }
+
+#define EFI_REST_EX_PROTOCOL_GUID \
+ { \
+ 0x55648b91, 0xe7d, 0x40a3, {0xa9, 0xb3, 0xa8, 0x15, 0xd7, 0xea, 0xdf, 0x97 } \
+ }
+
+typedef struct _EFI_REST_EX_PROTOCOL EFI_REST_EX_PROTOCOL;
+
+//*******************************************************
+//EFI_REST_EX_SERVICE_INFO_VER
+//*******************************************************
+typedef struct {
+ UINT8 Major;
+ UINT8 Minor;
+} EFI_REST_EX_SERVICE_INFO_VER;
+
+//*******************************************************
+//EFI_REST_EX_SERVICE_INFO_HEADER
+//*******************************************************
+typedef struct {
+ UINT32 Length;
+ EFI_REST_EX_SERVICE_INFO_VER RestServiceInfoVer;
+} EFI_REST_EX_SERVICE_INFO_HEADER;
+
+//*******************************************************
+// EFI_REST_EX_SERVICE_TYPE
+//*******************************************************
+typedef enum {
+ EfiRestExServiceUnspecific = 1,
+ EfiRestExServiceRedfish,
+ EfiRestExServiceOdata,
+ EfiRestExServiceVendorSpecific = 0xff,
+ EfiRestExServiceTypeMax
+} EFI_REST_EX_SERVICE_TYPE;
+
+//*******************************************************
+// EFI_REST_EX_SERVICE_ACCESS_MODE
+//*******************************************************
+typedef enum {
+ EfiRestExServiceInBandAccess = 1,
+ EfiRestExServiceOutOfBandAccess = 2,
+ EfiRestExServiceModeMax
+} EFI_REST_EX_SERVICE_ACCESS_MODE;
+
+//*******************************************************
+// EFI_REST_EX_CONFIG_TYPE
+//*******************************************************
+typedef enum {
+ EfiRestExConfigHttp,
+ EfiRestExConfigUnspecific,
+ EfiRestExConfigTypeMax
+} EFI_REST_EX_CONFIG_TYPE;
+
+//*******************************************************
+//EFI_REST_EX_SERVICE_INFO v1.0
+//*******************************************************
+typedef struct {
+ EFI_REST_EX_SERVICE_INFO_HEADER EfiRestExServiceInfoHeader;
+ EFI_REST_EX_SERVICE_TYPE RestServiceType;
+ EFI_REST_EX_SERVICE_ACCESS_MODE RestServiceAccessMode;
+ EFI_GUID VendorRestServiceName;
+ UINT32 VendorSpecificDataLength;
+ UINT8 *VendorSpecifcData;
+ EFI_REST_EX_CONFIG_TYPE RestExConfigType;
+ UINT8 RestExConfigDataLength;
+} EFI_REST_EX_SERVICE_INFO_V_1_0;
+
+//*******************************************************
+//EFI_REST_EX_SERVICE_INFO
+//*******************************************************
+typedef union {
+ EFI_REST_EX_SERVICE_INFO_HEADER EfiRestExServiceInfoHeader;
+ EFI_REST_EX_SERVICE_INFO_V_1_0 EfiRestExServiceInfoV10;
+} EFI_REST_EX_SERVICE_INFO;
+
+//*******************************************************
+// EFI_REST_EX_HTTP_CONFIG_DATA
+//*******************************************************
+typedef struct {
+ EFI_HTTP_CONFIG_DATA HttpConfigData;
+ UINT32 SendReceiveTimeout;
+} EFI_REST_EX_HTTP_CONFIG_DATA;
+
+//*******************************************************
+//EFI_REST_EX_CONFIG_DATA
+//*******************************************************
+typedef UINT8 *EFI_REST_EX_CONFIG_DATA;
+
+//*******************************************************
+//EFI_REST_EX_TOKEN
+//*******************************************************
+typedef struct {
+ EFI_EVENT Event;
+ EFI_STATUS Status;
+ EFI_HTTP_MESSAGE *ResponseMessage;
+} EFI_REST_EX_TOKEN;
+
+/**
+ Provides a simple HTTP-like interface to send and receive resources from a REST service.
+
+ The SendReceive() function sends an HTTP request to this REST service, and returns a
+ response when the data is retrieved from the service. RequestMessage contains the HTTP
+ request to the REST resource identified by RequestMessage.Request.Url. The
+ ResponseMessage is the returned HTTP response for that request, including any HTTP
+ status.
+
+ @param[in] This Pointer to EFI_REST_EX_PROTOCOL instance for a particular
+ REST service.
+ @param[in] RequestMessage Pointer to the HTTP request data for this resource
+ @param[out] ResponseMessage Pointer to the HTTP response data obtained for this requested.
+
+ @retval EFI_SUCCESS operation succeeded.
+ @retval EFI_INVALID_PARAMETER This, RequestMessage, or ResponseMessage are NULL.
+ @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_SEND_RECEIVE)(
+ IN EFI_REST_EX_PROTOCOL *This,
+ IN EFI_HTTP_MESSAGE *RequestMessage,
+ OUT EFI_HTTP_MESSAGE *ResponseMessage
+ );
+
+/**
+ Obtain the current time from this REST service instance.
+
+ The GetServiceTime() function is an optional interface to obtain the current time from
+ this REST service instance. If this REST service does not support to retrieve the time,
+ this function returns EFI_UNSUPPORTED. This function must returns EFI_UNSUPPORTED if
+ EFI_REST_EX_SERVICE_TYPE returned in EFI_REST_EX_SERVICE_INFO from GetService() is
+ EFI_REST_EX_SERVICE_UNSPECIFIC.
+
+ @param[in] This Pointer to EFI_REST_EX_PROTOCOL instance for a particular
+ REST service.
+ @param[out] Time A pointer to storage to receive a snapshot of the current time of
+ the REST service.
+
+ @retval EFI_SUCCESS operation succeeded.
+ @retval EFI_INVALID_PARAMETER This or Time are NULL.
+ @retval EFI_UNSUPPORTED The RESTful service does not support returning the time.
+ @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
+ @retval EFI_NOT_READY The configuration of this instance is not set yet. Configure() must
+ be executed and returns successfully prior to invoke this function.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_GET_TIME)(
+ IN EFI_REST_EX_PROTOCOL *This,
+ OUT EFI_TIME *Time
+ );
+
+/**
+ This function returns the information of REST service provided by this EFI REST EX driver instance.
+
+ The information such as the type of REST service and the access mode of REST EX driver instance
+ (In-band or Out-of-band) are described in EFI_REST_EX_SERVICE_INFO structure. For the vendor-specific
+ REST service, vendor-specific REST service information is returned in VendorSpecifcData.
+ REST EX driver designer is well know what REST service this REST EX driver instance intends to
+ communicate with. The designer also well know this driver instance is used to talk to BMC through
+ specific platform mechanism or talk to REST server through UEFI HTTP protocol. REST EX driver is
+ responsible to fill up the correct information in EFI_REST_EX_SERVICE_INFO. EFI_REST_EX_SERVICE_INFO
+ is referred by EFI REST clients to pickup the proper EFI REST EX driver instance to get and set resource.
+ GetService() is a basic and mandatory function which must be able to use even Configure() is not invoked
+ in previously.
+
+ @param[in] This Pointer to EFI_REST_EX_PROTOCOL instance for a particular
+ REST service.
+ @param[out] RestExServiceInfo Pointer to receive a pointer to EFI_REST_EX_SERVICE_INFO structure. The
+ format of EFI_REST_EX_SERVICE_INFO is version controlled for the future
+ extension. The version of EFI_REST_EX_SERVICE_INFO structure is returned
+ in the header within this structure. EFI REST client refers to the correct
+ format of structure according to the version number. The pointer to
+ EFI_REST_EX_SERVICE_INFO is a memory block allocated by EFI REST EX driver
+ instance. That is caller's responsibility to free this memory when this
+ structure is no longer needed. Refer to Related Definitions below for the
+ definitions of EFI_REST_EX_SERVICE_INFO structure.
+
+ @retval EFI_SUCCESS EFI_REST_EX_SERVICE_INFO is returned in RestExServiceInfo. This function
+ is not supported in this REST EX Protocol driver instance.
+ @retval EFI_UNSUPPORTED This function is not supported in this REST EX Protocol driver instance.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_EX_GET_SERVICE)(
+ IN EFI_REST_EX_PROTOCOL *This,
+ OUT EFI_REST_EX_SERVICE_INFO **RestExServiceInfo
+ );
+
+/**
+ This function returns operational configuration of current EFI REST EX child instance.
+
+ This function returns the current configuration of EFI REST EX child instance. The format of
+ operational configuration depends on the implementation of EFI REST EX driver instance. For
+ example, HTTP-aware EFI REST EX driver instance uses EFI HTTP protocol as the undying protocol
+ to communicate with REST service. In this case, the type of configuration is
+ EFI_REST_EX_CONFIG_TYPE_HTTP returned from GetService(). EFI_HTTP_CONFIG_DATA is used as EFI REST
+ EX configuration format and returned to EFI REST client. User has to type cast RestExConfigData
+ to EFI_HTTP_CONFIG_DATA. For those non HTTP-aware REST EX driver instances, the type of configuration
+ is EFI_REST_EX_CONFIG_TYPE_UNSPECIFIC returned from GetService(). In this case, the format of
+ returning data could be non industrial. Instead, the format of configuration data is system/platform
+ specific definition such as BMC mechanism used in EFI REST EX driver instance. EFI REST client and
+ EFI REST EX driver instance have to refer to the specific system /platform spec which is out of UEFI scope.
+
+ @param[in] This This is the EFI_REST_EX_PROTOCOL instance.
+ @param[out] RestExConfigData Pointer to receive a pointer to EFI_REST_EX_CONFIG_DATA.
+ The memory allocated for configuration data should be freed
+ by caller. See Related Definitions for the details.
+
+ @retval EFI_SUCCESS EFI_REST_EX_CONFIG_DATA is returned in successfully.
+ @retval EFI_UNSUPPORTED This function is not supported in this REST EX Protocol driver instance.
+ @retval EFI_NOT_READY The configuration of this instance is not set yet. Configure() must be
+ executed and returns successfully prior to invoke this function.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_EX_GET_MODE_DATA)(
+ IN EFI_REST_EX_PROTOCOL *This,
+ OUT EFI_REST_EX_CONFIG_DATA *RestExConfigData
+ );
+
+/**
+ This function is used to configure EFI REST EX child instance.
+
+ This function is used to configure the setting of underlying protocol of REST EX child
+ instance. The type of configuration is according to the implementation of EFI REST EX
+ driver instance. For example, HTTP-aware EFI REST EX driver instance uses EFI HTTP protocol
+ as the undying protocol to communicate with REST service. The type of configuration is
+ EFI_REST_EX_CONFIG_TYPE_HTTP and RestExConfigData is the same format with EFI_HTTP_CONFIG_DATA.
+ Akin to HTTP configuration, REST EX child instance can be configure to use different HTTP
+ local access point for the data transmission. Multiple REST clients may use different
+ configuration of HTTP to distinguish themselves, such as to use the different TCP port.
+ For those non HTTP-aware REST EX driver instance, the type of configuration is
+ EFI_REST_EX_CONFIG_TYPE_UNSPECIFIC. RestExConfigData refers to the non industrial standard.
+ Instead, the format of configuration data is system/platform specific definition such as BMC.
+ In this case, EFI REST client and EFI REST EX driver instance have to refer to the specific
+ system/platform spec which is out of the UEFI scope. Besides GetService()function, no other
+ EFI REST EX functions can be executed by this instance until Configure()is executed and returns
+ successfully. All other functions must returns EFI_NOT_READY if this instance is not configured
+ yet. Set RestExConfigData to NULL means to put EFI REST EX child instance into the unconfigured
+ state.
+
+ @param[in] This This is the EFI_REST_EX_PROTOCOL instance.
+ @param[in] RestExConfigData Pointer to EFI_REST_EX_CONFIG_DATA. See Related Definitions in
+ GetModeData() protocol interface.
+
+ @retval EFI_SUCCESS EFI_REST_EX_CONFIG_DATA is set in successfully.
+ @retval EFI_DEVICE_ERROR Configuration for this REST EX child instance is failed with the given
+ EFI_REST_EX_CONFIG_DATA.
+ @retval EFI_UNSUPPORTED This function is not supported in this REST EX Protocol driver instance.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_EX_CONFIGURE)(
+ IN EFI_REST_EX_PROTOCOL *This,
+ IN EFI_REST_EX_CONFIG_DATA RestExConfigData
+ );
+
+/**
+ This function sends REST request to REST service and signal caller's event asynchronously when
+ the final response is received by REST EX Protocol driver instance.
+
+ The essential design of this function is to handle asynchronous send/receive implicitly according
+ to REST service asynchronous request mechanism. Caller will get the notification once the response
+ is returned from REST service.
+
+ @param[in] This This is the EFI_REST_EX_PROTOCOL instance.
+ @param[in] RequestMessage This is the HTTP request message sent to REST service. Set RequestMessage
+ to NULL to cancel the previous asynchronous request associated with the
+ corresponding RestExToken. See descriptions for the details.
+ @param[in] RestExToken REST EX token which REST EX Protocol instance uses to notify REST client
+ the status of response of asynchronous REST request. See related definition
+ of EFI_REST_EX_TOKEN.
+ @param[in] TimeOutInMilliSeconds The pointer to the timeout in milliseconds which REST EX Protocol driver
+ instance refers as the duration to drop asynchronous REST request. NULL
+ pointer means no timeout for this REST request. REST EX Protocol driver
+ signals caller's event with EFI_STATUS set to EFI_TIMEOUT in RestExToken
+ if REST EX Protocol can't get the response from REST service within
+ TimeOutInMilliSeconds.
+
+ @retval EFI_SUCCESS Asynchronous REST request is established.
+ @retval EFI_UNSUPPORTED This REST EX Protocol driver instance doesn't support asynchronous request.
+ @retval EFI_TIMEOUT Asynchronous REST request is not established and timeout is expired.
+ @retval EFI_ABORT Previous asynchronous REST request has been canceled.
+ @retval EFI_DEVICE_ERROR Otherwise, returns EFI_DEVICE_ERROR for other errors according to HTTP Status Code.
+ @retval EFI_NOT_READY The configuration of this instance is not set yet. Configure() must be executed
+ and returns successfully prior to invoke this function.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_EX_ASYNC_SEND_RECEIVE)(
+ IN EFI_REST_EX_PROTOCOL *This,
+ IN EFI_HTTP_MESSAGE *RequestMessage OPTIONAL,
+ IN EFI_REST_EX_TOKEN *RestExToken,
+ IN UINTN *TimeOutInMilliSeconds OPTIONAL
+ );
+
+/**
+ This function sends REST request to a REST Event service and signals caller's event
+ token asynchronously when the URI resource change event is received by REST EX
+ Protocol driver instance.
+
+ The essential design of this function is to monitor event implicitly according to
+ REST service event service mechanism. Caller will get the notification if certain
+ resource is changed.
+
+ @param[in] This This is the EFI_REST_EX_PROTOCOL instance.
+ @param[in] RequestMessage This is the HTTP request message sent to REST service. Set RequestMessage
+ to NULL to cancel the previous event service associated with the corresponding
+ RestExToken. See descriptions for the details.
+ @param[in] RestExToken REST EX token which REST EX Protocol driver instance uses to notify REST client
+ the URI resource which monitored by REST client has been changed. See the related
+ definition of EFI_REST_EX_TOKEN in EFI_REST_EX_PROTOCOL.AsyncSendReceive().
+
+ @retval EFI_SUCCESS Asynchronous REST request is established.
+ @retval EFI_UNSUPPORTED This REST EX Protocol driver instance doesn't support asynchronous request.
+ @retval EFI_ABORT Previous asynchronous REST request has been canceled or event subscription has been
+ delete from service.
+ @retval EFI_DEVICE_ERROR Otherwise, returns EFI_DEVICE_ERROR for other errors according to HTTP Status Code.
+ @retval EFI_NOT_READY The configuration of this instance is not set yet. Configure() must be executed
+ and returns successfully prior to invoke this function.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_EX_EVENT_SERVICE)(
+ IN EFI_REST_EX_PROTOCOL *This,
+ IN EFI_HTTP_MESSAGE *RequestMessage OPTIONAL,
+ IN EFI_REST_EX_TOKEN *RestExToken
+);
+
+///
+/// EFI REST(EX) protocols are designed to support REST communication between EFI REST client
+/// applications/drivers and REST services. EFI REST client tool uses EFI REST(EX) protocols
+/// to send/receive resources to/from REST service to manage systems, configure systems or
+/// manipulate resources on REST service. Due to HTTP protocol is commonly used to communicate
+/// with REST service in practice, EFI REST(EX) protocols adopt HTTP as the message format to
+/// send and receive REST service resource. EFI REST(EX) driver instance abstracts EFI REST
+/// client functionality and provides underlying interface to communicate with REST service.
+/// EFI REST(EX) driver instance knows how to communicate with REST service through certain
+/// interface after the corresponding configuration is initialized.
+///
+struct _EFI_REST_EX_PROTOCOL {
+ EFI_REST_SEND_RECEIVE SendReceive;
+ EFI_REST_GET_TIME GetServiceTime;
+ EFI_REST_EX_GET_SERVICE GetService;
+ EFI_REST_EX_GET_MODE_DATA GetModeData;
+ EFI_REST_EX_CONFIGURE Configure;
+ EFI_REST_EX_ASYNC_SEND_RECEIVE AyncSendReceive;
+ EFI_REST_EX_EVENT_SERVICE EventService;
+};
+
+extern EFI_GUID gEfiRestExServiceBindingProtocolGuid;
+extern EFI_GUID gEfiRestExProtocolGuid;
+
+#endif
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index 812be75fb3..5205374d62 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -1848,6 +1848,13 @@
## Include/Protocol/NvdimmLabel.h
gEfiNvdimmLabelProtocolGuid = { 0xd40b6b80, 0x97d5, 0x4282, { 0xbb, 0x1d, 0x22, 0x3a, 0x16, 0x91, 0x80, 0x58 }}

+ #
+ # Protocols defined in UEFI2.8
+ #
+ ## Include/Protocol/RestEx.h
+ gEfiRestExProtocolGuid = { 0x55648b91, 0xe7d, 0x40a3, { 0xa9, 0xb3, 0xa8, 0x15, 0xd7, 0xea, 0xdf, 0x97 }}
+ gEfiRestExServiceBindingProtocolGuid = { 0x456bbe01, 0x99d0, 0x45ea, { 0xbb, 0x5f, 0x16, 0xd8, 0x4b, 0xed, 0xc5, 0x59 }}
+
#
# Protocols defined in Shell2.0
#
--
2.17.1


[Rest Ex Definition PATCH v2 0/2] The definitions for EFI REST EX

Abner Chang
 

This is the commit of definitions required by EFI REST EX UEFI driver.

In v2: Address Liming's feedback to add UEFI spec revision on which
EFI REST EX protocol is introduced.

In patch (1/2), add the definitions of EFI REST EX Protocol according
to UEFI spec v2.8 Section 29.7.2 EFI REST EX Protocol.

In patch (2/2), add the definitions of structure PCD for Redfish Host
Interface EFI device path.

Signed-off-by: Abner Chang <abner.chang@...>

Cc: Jiaxin Wu <jiaxin.wu@...>
Cc: Siyuan Fu <siyuan.fu@...>
Cc: Fan Wang <fan.wang@...>
Cc: Jiewen Yao <jiewen.yao@...>
Cc: Nickle Wang <nickle.wang@...>
Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Liming Gao <gaoliming@...>

Abner Chang (2):
MdePkg/Include: Definitions of EFI REST EX Protocol
RedfishPkg/Include: PCD definitions of Host Interface EFI device path

MdePkg/Include/Protocol/RestEx.h | 390 ++++++++++++++++++
MdePkg/MdePkg.dec | 7 +
.../Include/Pcd/RestExServiceDevicePath.h | 38 ++
RedfishPkg/RedfishPkg.dec | 3 +
4 files changed, 438 insertions(+)
create mode 100644 MdePkg/Include/Protocol/RestEx.h
create mode 100644 RedfishPkg/Include/Pcd/RestExServiceDevicePath.h

--
2.17.1


[Rest Ex Definition PATCH v2 2/2] RedfishPkg/Include: PCD definitions of Host Interface EFI device path

Abner Chang
 

The definitions of Host Interface EFI device path structure PCD.

Signed-off-by: Jiaxin Wu <jiaxin.wu@...>
Signed-off-by: Siyuan Fu <siyuan.fu@...>
Signed-off-by: Fan Wang <fan.wang@...>
Signed-off-by: Abner Chang <abner.chang@...>

Cc: Jiewen Yao <jiewen.yao@...>
Cc: Nickle Wang <nickle.wang@...>

Reviewed-by: Jiaxin Wu <jiaxin.wu@...>
Reviewed-by: Nickle Wang <nickle.wang@...>
---
.../Include/Pcd/RestExServiceDevicePath.h | 38 +++++++++++++++++++
RedfishPkg/RedfishPkg.dec | 3 ++
2 files changed, 41 insertions(+)
create mode 100644 RedfishPkg/Include/Pcd/RestExServiceDevicePath.h

diff --git a/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h b/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h
new file mode 100644
index 0000000000..89de3b1a21
--- /dev/null
+++ b/RedfishPkg/Include/Pcd/RestExServiceDevicePath.h
@@ -0,0 +1,38 @@
+/** @file
+ This library defines the UEFI device path data of network device for REST
+ service to decide which should be used as the Redfish host interface.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef REST_EX_SERVICE_DEVICE_PATH_H_
+#define REST_EX_SERVICE_DEVICE_PATH_H_
+
+#include <Protocol/DevicePath.h>
+
+typedef enum {
+ DEVICE_PATH_MATCH_MAC_NODE = 1,
+ DEVICE_PATH_MATCH_PCI_NODE = 2,
+ DEVICE_PATH_MATCH_MODE_MAX
+} DEVICE_PATH_MATCH_MODE;
+
+typedef struct {
+ UINT32 DevicePathMatchMode;
+ UINT32 DevicePathNum;
+ //
+ // Example:
+ // {DEVICE_PATH("PciRoot(0)/Pci(0,0)/MAC(005056C00002,0x1)")}
+ // DevicePath will be parsed as below:
+ // {0x02,0x01,0x0c,0x00,0xd0,0x41,0x03,0x0a,0x00,0x00,0x00,0x00,
+ // 0x01,0x01,0x06,0x00,0x00,0x00,
+ // 0x03,0x0b,0x25,0x00,0x00,0x50,0x56,0xc0,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
+ // 0x7f,0xff,0x04,0x00}
+ //
+ EFI_DEVICE_PATH_PROTOCOL DevicePath[];
+} REST_EX_SERVICE_DEVICE_PATH_DATA;
+
+#endif
diff --git a/RedfishPkg/RedfishPkg.dec b/RedfishPkg/RedfishPkg.dec
index e95ec5fe10..de3611252e 100644
--- a/RedfishPkg/RedfishPkg.dec
+++ b/RedfishPkg/RedfishPkg.dec
@@ -13,6 +13,9 @@
PACKAGE_GUID = c432b76e-5232-11e7-9010-005056c00008
PACKAGE_VERSION = 1.0

+[Includes]
+ Include
+
[Guids]
gEfiRedfishPkgTokenSpaceGuid = { 0x4fdbccb7, 0xe829, 0x4b4c, { 0x88, 0x87, 0xb2, 0x3f, 0xd7, 0x25, 0x4b, 0x85 }}

--
2.17.1


Re: [PATCH v2 1/1] Silicon/Qemu/Sbsa: Add SBSA-wdt entry to GTDT

Graeme Gregory <graeme@...>
 

On Tue, Oct 13, 2020 at 12:14:35PM -0400, Shashi Mallela wrote:
SBSA generic watchdog timer structure entry has been added
to GTDT table as per BSAv0.9.
This enables acpi detection of wdt in qemu sbsa platform

Signed-off-by: Shashi Mallela <shashi.mallela@...>
New version is looking fine to me.

Reviewed-by: Graeme Gregory <graeme@...>

---
Silicon/Qemu/SbsaQemu/AcpiTables/Gtdt.aslc | 53 +++++++++++++++++---
1 file changed, 45 insertions(+), 8 deletions(-)

diff --git a/Silicon/Qemu/SbsaQemu/AcpiTables/Gtdt.aslc b/Silicon/Qemu/SbsaQemu/AcpiTables/Gtdt.aslc
index d16778e01a5c..2312fd74e26d 100644
--- a/Silicon/Qemu/SbsaQemu/AcpiTables/Gtdt.aslc
+++ b/Silicon/Qemu/SbsaQemu/AcpiTables/Gtdt.aslc
@@ -24,27 +24,55 @@
#define SYSTEM_TIMER_BASE_ADDRESS 0xFFFFFFFFFFFFFFFF
#endif

-#define GTDT_TIMER_EDGE_TRIGGERED EFI_ACPI_5_0_GTDT_TIMER_FLAG_TIMER_INTERRUPT_MODE
+#define GTDT_TIMER_EDGE_TRIGGERED EFI_ACPI_6_3_GTDT_TIMER_FLAG_TIMER_INTERRUPT_MODE
#define GTDT_TIMER_LEVEL_TRIGGERED 0
-#define GTDT_TIMER_ACTIVE_LOW EFI_ACPI_5_0_GTDT_TIMER_FLAG_TIMER_INTERRUPT_POLARITY
+#define GTDT_TIMER_ACTIVE_LOW EFI_ACPI_6_3_GTDT_TIMER_FLAG_TIMER_INTERRUPT_POLARITY
#define GTDT_TIMER_ACTIVE_HIGH 0

#define GTDT_GTIMER_FLAGS (GTDT_TIMER_ACTIVE_LOW | GTDT_TIMER_LEVEL_TRIGGERED)

+#define SBSA_PLATFORM_WATCHDOG_COUNT 1
+#define SBSA_PLATFORM_TIMER_COUNT (SBSA_PLATFORM_WATCHDOG_COUNT)
+
+#define SBSAQEMU_WDT_REFRESH_FRAME_BASE 0x50010000
+#define SBSAQEMU_WDT_CONTROL_FRAME_BASE 0x50011000
+#define SBSAQEMU_WDT_IRQ 44
+
+#define GTDT_WDTIMER_EDGE_TRIGGERED EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_FLAG_TIMER_INTERRUPT_MODE
+#define GTDT_WDTIMER_LEVEL_TRIGGERED 0
+#define GTDT_WDTIMER_ACTIVE_LOW EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_FLAG_TIMER_INTERRUPT_POLARITY
+#define GTDT_WDTIMER_ACTIVE_HIGH 0
+
+#define GTDT_WDTIMER_FLAGS (GTDT_WDTIMER_ACTIVE_HIGH | GTDT_WDTIMER_LEVEL_TRIGGERED)
+
+#define EFI_ACPI_6_3_SBSA_GENERIC_WATCHDOG_STRUCTURE_INIT( \
+ RefreshFramePhysicalAddress, ControlFramePhysicalAddress, \
+ WatchdogTimerGSIV, WatchdogTimerFlags) \
+ { \
+ EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG, \
+ sizeof(EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE), \
+ EFI_ACPI_RESERVED_WORD, \
+ RefreshFramePhysicalAddress, \
+ ControlFramePhysicalAddress, \
+ WatchdogTimerGSIV, \
+ WatchdogTimerFlags \
+ }
+
#pragma pack (1)

typedef struct {
- EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLE Gtdt;
- } GENERIC_TIMER_DESCRIPTION_TABLE;
+ EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE Gtdt;
+ EFI_ACPI_6_3_GTDT_SBSA_GENERIC_WATCHDOG_STRUCTURE Gwdt;
+ } GENERIC_TIMER_DESCRIPTION_TABLES;

#pragma pack ()

GENERIC_TIMER_DESCRIPTION_TABLE Gtdt = {
{
SBSAQEMU_ACPI_HEADER(
- EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE,
+ EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_SIGNATURE,
GENERIC_TIMER_DESCRIPTION_TABLE,
- EFI_ACPI_5_1_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION
+ EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE_REVISION
),
SYSTEM_TIMER_BASE_ADDRESS, // UINT64 PhysicalAddress
0, // UINT32 Reserved
@@ -57,9 +85,18 @@
FixedPcdGet32 (PcdArmArchTimerHypIntrNum), // UINT32 NonSecurePL2TimerGSIV
GTDT_GTIMER_FLAGS, // UINT32 NonSecurePL2TimerFlags
0xFFFFFFFFFFFFFFFF, // UINT64 CntReadBasePhysicalAddress
- 0, // UINT32 PlatformTimerCount
- 0
+ SBSA_PLATFORM_TIMER_COUNT, // UINT32 PlatformTimerCount
+ sizeof(EFI_ACPI_6_3_GENERIC_TIMER_DESCRIPTION_TABLE),
+ // UINT32 PlatformTimerOffset
+ 0, // UINT32 VirtualPL2TimerGSIV
+ 0 // UINT32 VirtualPL2TimerFlags
},
+ EFI_ACPI_6_3_SBSA_GENERIC_WATCHDOG_STRUCTURE_INIT(
+ SBSAQEMU_WDT_REFRESH_FRAME_BASE,
+ SBSAQEMU_WDT_CONTROL_FRAME_BASE,
+ SBSAQEMU_WDT_IRQ,
+ GTDT_WDTIMER_FLAGS
+ )
};

// Reference the table being generated to prevent the optimizer from removing the
--
2.18.4


Re: Query regarding build error

Andrew Goodbody
 

On 12/10/2020 07:13, Bhavsar, Samprat wrote:
Hi,
I’m a new intern and I was trying to add a library in the DCG10nm project which lead to a fatal error while building. Please can you help me out for finding and resolving the issue. PFA of build log file.
Look further back in the log file. There is a missing include file. Fix that error and try again.

Andrew


Re: [edk2-platforms] [PATCH v3-resend] SgiPkg/RdN1EdgeX2: Add missing reference to PcdChipCount

Vijayenthiran Subramaniam
 

Hi all,

On Tue, Oct 6, 2020 at 1:42 PM Vijayenthiran Subramaniam
<vijayenthiran.subramaniam@...> wrote:

Commit e8fe2026dd79 (“Platform/ARM/SgiPkg: Use chip count constant on
rdn1edgex2 platform”) used the PcdChipCount constant but did not declare
its use in the ACPI table module. Fix this by listing it in the list of
PCDs to be looked up.

Signed-off-by: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@...>
Reviewed-by: Thomas Abraham <thomas.abraham@...>
Reviewed-by: Sami Mujawar <sami.mujawar@...>
---

Resending PATCH-v3 [1] with Reviewed-bys added.

[1]: https://edk2.groups.io/g/devel/topic/77339902

Changes since v2:
- Rebased to latest master and repost.

Changes since v1:
- Add commit id in commit message for which this patch fixes the build
failure.

Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeX2AcpiTables.inf | 2 ++
1 file changed, 2 insertions(+)

diff --git a/Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeX2AcpiTables.inf b/Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeX2AcpiTables.inf
index 974d9db543..d44f02ab0c 100644
--- a/Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeX2AcpiTables.inf
+++ b/Platform/ARM/SgiPkg/AcpiTables/RdN1EdgeX2AcpiTables.inf
@@ -45,6 +45,8 @@
gArmSgiTokenSpaceGuid.PcdDramBlock2Base
gArmSgiTokenSpaceGuid.PcdDramBlock2Size

+ gArmSgiTokenSpaceGuid.PcdChipCount
+
gArmTokenSpaceGuid.PcdArmArchTimerSecIntrNum
gArmTokenSpaceGuid.PcdArmArchTimerIntrNum
gArmTokenSpaceGuid.PcdArmArchTimerHypIntrNum
--
2.17.1
A kindly reminder for this patch.

Regards,
Vijayenthiran


Re: 答复: [edk2-devel] OpensslLib compiling error : cannot open include file : openssl/aes.h

Tiger Liu(BJ-RD)
 

Hi, liming:
Got it.

Is Cc_resp.txt produced by compiler automatically? Or by UDK build tools?

The problem I met may be caused by violating the limitation length of the compiler command line.
After trim the length, could pass the failed point.

Thanks
-----邮件原件-----
发件人: gaoliming <gaoliming@...>
发送时间: 2020年10月14日 13:35
收件人: devel@edk2.groups.io; Tiger Liu(BJ-RD) <TigerLiu@...>
主题: 回复: [edk2-devel] OpensslLib compiling error : cannot open include file : openssl/aes.h

cc_resp.txt includes the compiler flag and include path. It will be used by the compiler. Then, the compile command line length can be reduced. It can avoid nmake limitation of the command line length 4096.

Thanks
Liming
-----邮件原件-----
发件人: bounce+27952+66197+4905953+8761045@groups.io
<bounce+27952+66197+4905953+8761045@groups.io> 代表 Tiger
Liu(BJ-RD)
发送时间: 2020年10月14日 9:45
收件人: gaoliming <gaoliming@...>; devel@edk2.groups.io
主题: 答复: [edk2-devel] OpensslLib compiling error : cannot open include
file : openssl/aes.h

Hi, Liming:
From Build.log, it seems include path is ok:
......
cl.exe"
/Foy:\Build\ZxxPlatformPkg\DEBUG_VS2015x86\X64\CryptoPkg\Library\Base
CryptLib\RuntimeCryptLib\OUTPUT\Hash\ /showIncludes /nologo /c /GS-
/W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF
/Z7 /Gw /wd4090 -
......
/Iy:\CryptoPkg /Iy:\CryptoPkg\Include /Iy:\CryptoPkg\Private
/Iy:\CryptoPkg\Library\Include
/Iy:\CryptoPkg\Library\OpensslLib\openssl\include
y:\CryptoPkg\Library\BaseCryptLib\Hash\CryptSm3.c
y:\CryptoPkg\Library\BaseCryptLib\Hash\CryptMd5.c
y:\CryptoPkg\Library\BaseCryptLib\Hash\CryptSha256.c
y:\CryptoPkg\Library\BaseCryptLib\Hash\CryptSha512Null.c
y:\CryptoPkg\Library\BaseCryptLib\Hash\CryptSha1.c

And BaseCryptLib / IntrinsicLib compiled successfully.

And I found a cc_resp.txt file in
Build\...\DEBUG_VS2015x86\X64\CryptoPkg\Library\OpensslLib\OpensslLib\
OUTPUT
Why produce a cc_resp.txt?

Thanks
-----邮件原件-----
发件人: gaoliming <gaoliming@...>
发送时间: 2020年10月13日 18:03
收件人: devel@edk2.groups.io; Tiger Liu(BJ-RD) <TigerLiu@...>
主题: 回复: [edk2-devel] OpensslLib compiling error : cannot open include
file : openssl/aes.h

Can you print the full build log and check the compiler include path?

Is this a clean build issue or incremental build issue?

Thanks
Liming
-----邮件原件-----
发件人: bounce+27952+66166+4905953+8761045@groups.io
<bounce+27952+66166+4905953+8761045@groups.io> 代表 Tiger
Liu(BJ-RD)
发送时间: 2020年10月13日 16:38
收件人: devel@edk2.groups.io
主题: [edk2-devel] OpensslLib compiling error : cannot open include file :
openssl/aes.h

Hi, experts:
When I compiled OpensslLib, I met a problem:
......
\CryptoPkg\Library\OpensslLib\openssl\crypto\aes\aes_core.c(42):
fatal error C1083: Cannot open include file: 'openssl/crypto.h': No
such file or directory
\CryptoPkg\Library\OpensslLib\openssl\crypto\aes\aes_misc.c(10):
fatal error C1083: Cannot open include file: 'openssl/opensslv.h':
No such file or directory ......

But these files exist in
CryptoPkg\Library\OpensslLib\openssl\include\openssl .

Does anybody meet same problems?

Note:
CryptoPkg.dec has also declared this include path:
......
[Includes.Common.Private]
Private
Library/Include
Library/OpensslLib/openssl/include
......

Thanks


保密声明:
本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或

内容做任何未经授权的查阅、使用、复制或转发。
CONFIDENTIAL NOTE:
This email contains confidential or legally privileged information
and is for the sole use of its intended recipient. Any unauthorized
review, use, copying or forwarding of this email or the content of
this email is
strictly prohibited.







保密声明:
本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或其
内容做任何未经授权的查阅、使用、复制或转发。
CONFIDENTIAL NOTE:
This email contains confidential or legally privileged information and
is for the sole use of its intended recipient. Any unauthorized
review, use, copying or forwarding of this email or the content of this email is strictly prohibited.







保密声明:
本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或其内容做任何未经授权的查阅、使用、复制或转发。
CONFIDENTIAL NOTE:
This email contains confidential or legally privileged information and is for the sole use of its intended recipient. Any unauthorized review, use, copying or forwarding of this email or the content of this email is strictly prohibited.


Re: [PATCH] MdeModulePkg/PartitionDxe: Revert the child handler blocksize change

Zhiguang Liu
 

Hi Ray,
Could you help merge this patch?

Thanks
Zhiguang

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Ni, Ray
Sent: Tuesday, October 13, 2020 10:54 AM
To: Gao, Zhichao <zhichao.gao@...>; devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@...>
Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/PartitionDxe: Revert the
child handler blocksize change

Reviewed-by: Ray Ni <ray.ni@...>

-----Original Message-----
From: Gao, Zhichao <zhichao.gao@...>
Sent: Monday, October 12, 2020 3:23 PM
To: devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@...>; Wu, Hao A <hao.a.wu@...>
Subject: [PATCH] MdeModulePkg/PartitionDxe: Revert the child handler
blocksize change

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2843

Revert the patch to change the block size in child handler. It would
block the CD (Eltorito) Hard disk media type's sub partition being
observed.
The blocksize patch used to fix the CD image's MBR table issue. The CD
MBR table would always be ignored because it would be handled by the
Eltorito partition handler first and never go into the MBR handler. So
directly revert it.

Cc: Ray Ni <ray.ni@...>
Cc: Hao A Wu <hao.a.wu@...>
Signed-off-by: Zhichao Gao <zhichao.gao@...>
---
MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c | 12
+++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
index f10ce7c65b..473e091320 100644
--- a/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
+++ b/MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
@@ -1149,8 +1149,8 @@ PartitionInstallChildHandle (

Private->Signature = PARTITION_PRIVATE_DATA_SIGNATURE;

- Private->Start = MultU64x32 (Start, BlockSize);
- Private->End = MultU64x32 (End + 1, BlockSize);
+ Private->Start = MultU64x32 (Start, ParentBlockIo->Media-
BlockSize);
+ Private->End = MultU64x32 (End + 1, ParentBlockIo->Media-
BlockSize);

Private->BlockSize = BlockSize;
Private->ParentBlockIo = ParentBlockIo;
@@ -1187,7 +1187,13 @@ PartitionInstallChildHandle (

Private->Media.IoAlign = 0;
Private->Media.LogicalPartition = TRUE;
- Private->Media.LastBlock = End - Start;
+ Private->Media.LastBlock = DivU64x32 (
+ MultU64x32 (
+ End - Start + 1,
+ ParentBlockIo->Media->BlockSize
+ ),
+ BlockSize
+ ) - 1;

Private->Media.BlockSize = (UINT32) BlockSize;

--
2.21.0.windows.1




回复: [edk2-devel] [RestJsonStructureDxe PATCH 1/2] MdePkg/Include: Definitions of EFI REST JSON Structure Protocol

gaoliming
 

Abner:

-----邮件原件-----
发件人: bounce+27952+66030+4905953+8761045@groups.io
<bounce+27952+66030+4905953+8761045@groups.io> 代表 Abner Chang
发送时间: 2020年10月8日 23:11
收件人: devel@edk2.groups.io
抄送: Michael D Kinney <michael.d.kinney@...>; Liming Gao
<gaoliming@...>; Zhiguang Liu <zhiguang.liu@...>; Jiaxin
Wu <jiaxin.wu@...>; Siyuan Fu <siyuan.fu@...>; Fan Wang
<fan.wang@...>; Jiewen Yao <jiewen.yao@...>; Nickle Wang
<nickle.wang@...>
主题: [edk2-devel] [RestJsonStructureDxe PATCH 1/2] MdePkg/Include:
Definitions of EFI REST JSON Structure Protocol

Add definitions of EFI REST JSON Structure according to UEFI spec
2.8 Section 29.7.3 EFI REST JSON Resource to C Structure Converter.

Signed-off-by: Abner Chang <abner.chang@...>

Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Liming Gao <gaoliming@...>
Cc: Zhiguang Liu <zhiguang.liu@...>
Cc: Jiaxin Wu <jiaxin.wu@...>
Cc: Siyuan Fu <siyuan.fu@...>
Cc: Fan Wang <fan.wang@...>
Cc: Jiewen Yao <jiewen.yao@...>
Cc: Nickle Wang <nickle.wang@...>
---
MdePkg/Include/Protocol/RestJsonStructure.h | 160
++++++++++++++++++++
MdePkg/MdePkg.dec | 6 +
2 files changed, 166 insertions(+)
create mode 100644 MdePkg/Include/Protocol/RestJsonStructure.h

diff --git a/MdePkg/Include/Protocol/RestJsonStructure.h
b/MdePkg/Include/Protocol/RestJsonStructure.h
new file mode 100644
index 0000000000..5e4fef8cff
--- /dev/null
+++ b/MdePkg/Include/Protocol/RestJsonStructure.h
@@ -0,0 +1,160 @@
+/** @file
+ This file defines the EFI REST JSON Structure Protocol interface.
+
Please also specify UEFI spec version.

+ (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef EFI_REST_JSON_STRUCTURE_PROTOCOL_H_
+#define EFI_REST_JSON_STRUCTURE_PROTOCOL_H_
+
+#include <Uefi.h>
+
Uefi.h is not required. The module will include this header file.

+//
+// GUID definitions
+//
+#define EFI_REST_JSON_STRUCTURE_PROTOCOL_GUID \
+ { \
+ 0xa9a048f6, 0x48a0, 0x4714, {0xb7, 0xda, 0xa9, 0xad,0x87, 0xd4, 0xda,
0xc9 } \
+ }
+
+typedef struct _EFI_REST_JSON_STRUCTURE_PROTOCOL
EFI_REST_JSON_STRUCTURE_PROTOCOL;
+typedef CHAR8 * EFI_REST_JSON_RESOURCE_TYPE_DATATYPE;
+typedef CHAR8 * EFI_REST_RESOURCE_RELATIVE_PATH;
EFI_REST_RESOURCE_RELATIVE_PATH is not in UEFI spec. Can you confirm it?

+
+/** Structure defintions of resource name space.
+ *
+ * The fields declared in this structure define the
+ * name and revision of payload delievered throught
+ * REST API.
+**/
Structure comments start with /// or //. /**/ style is for the function.
Please update them.

+typedef struct _EFI_REST_JSON_RESOURCE_TYPE_NAMESPACE {
+ CHAR8 *ResourceTypeName; ///< Resource type name
+ CHAR8 *MajorVersion; ///< Resource major version
+ CHAR8 *MinorVersion; ///< Resource minor version
+ CHAR8 *ErrataVersion; ///< Resource errata version
+} EFI_REST_JSON_RESOURCE_TYPE_NAMESPACE;
+
+/** REST resource type identifier
+ *
+ * REST resource type consists of name space and data type.
+**/
+typedef struct _EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER {
+ EFI_REST_JSON_RESOURCE_TYPE_NAMESPACE NameSpace; ///<
Namespace of this resource type.
+ EFI_REST_JSON_RESOURCE_TYPE_DATATYPE DataType; ///< Name of
data type declared in this
+ ///<
resource type.
+} EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER;
+
+/** List of JSON to C structure conversions which this convertor
supports.
+ *
+**/
+typedef struct _EFI_REST_JSON_STRUCTURE_SUPPORTED {
+ LIST_ENTRY NextSupportedRsrcInterp; ///<
Linklist to next supported conversion.
+ EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER RestResourceInterp; ///<
JSON resource type this convertor supports.
+} EFI_REST_JSON_STRUCTURE_SUPPORTED;
+
+/** The header file of JSON C structure
+ *
+**/
+typedef struct _EFI_REST_JSON_STRUCTURE_HEADER {
+ EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER JsonRsrcIdentifier;
///< Resource identifier which use to
+
///< choice the proper interpreter.
+ ///< Follow by a pointer points to JSON structure, the content in the
+ ///< JSON structure is implementation-specific according to converter
producer.
+ ///
+ VOID *JsonStructurePointer;
+} EFI_REST_JSON_STRUCTURE_HEADER;
+
+/**
+ JSON-IN C Structure-OUT function. Convert the given REST JSON resource
into structure.
+
+ @param[in] This This is the
EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
+ @param[in] JsonRsrcIdentifier This indicates the resource type and
version is given in
+ ResourceJsonText.
+ @param[in] ResourceJsonText REST JSON resource in text
format.
+ @param[out] JsonStructure Pointer to receive the pointer to
EFI_REST_JSON_STRUCTURE_HEADER
+
+ @retval EFI_SUCCESS
+ @retval Others
+--*/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_JSON_STRUCTURE_TO_STRUCTURE)(
+ IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
+ IN EFI_REST_JSON_RESOURCE_TYPE_IDENTIFIER *JsonRsrcIdentifier
OPTIONAL,
+ IN CHAR8
*ResourceJsonText,
+ OUT EFI_REST_JSON_STRUCTURE_HEADER **JsonStructure
+);
+
+/**
+ Convert the given REST JSON structure into JSON text.
+
+ @param[in] This This is the
EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
+ @param[in] JsonStructureHeader The point to
EFI_REST_JSON_STRUCTURE_HEADER structure.
+ @param[out] ResourceJsonText Pointer to receive REST JSON
resource in text format.
+
+ @retval EFI_SUCCESS
+ @retval Others
+
+--*/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_JSON_STRUCTURE_TO_JSON)(
+ IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
+ IN EFI_REST_JSON_STRUCTURE_HEADER *JsonStructureHeader,
+ OUT CHAR8 **ResourceJsonText
+);
+
+/**
+ This function destroys the REST JSON structure.
+
+ @param[in] This This is the
EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
+ @param[in] JsonStructureHeader JSON structure to destroy.
+
+ @retval EFI_SUCCESS
+ @retval Others
+
+--*/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_JSON_STRUCTURE_DESTORY_STRUCTURE)(
+ IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
+ IN EFI_REST_JSON_STRUCTURE_HEADER *JsonStructureHeader
+);
+/**
+ This function provides REST JSON resource to structure converter
registration.
+
+ @param[in] This This is the
EFI_REST_JSON_STRUCTURE_PROTOCOL instance.
+ @param[in] JsonStructureSupported The type and version of REST
JSON resource which this converter
+ supports.
+ @param[in] ToStructure The function to convert
REST JSON resource to structure.
+ @param[in] ToJson The function to convert
REST JSON structure to JSON in text format.
+ @param[out] DestroyStructure Destroy REST JSON
structure returned in ToStructure() function.
+
+ @retval EFI_SUCCESS Register successfully.
+ @retval Others Fail to register.
+
+--*/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_JSON_STRUCTURE_REGISTER)(
+ IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This,
+ IN EFI_REST_JSON_STRUCTURE_SUPPORTED
*JsonStructureSupported,
+ IN EFI_REST_JSON_STRUCTURE_TO_STRUCTURE ToStructure,
+ IN EFI_REST_JSON_STRUCTURE_TO_JSON ToJson,
+ IN EFI_REST_JSON_STRUCTURE_DESTORY_STRUCTURE DestroyStructure
+);
+
+/** EFI REST JSON to C structure protocol definition.
+ *
+**/
+typedef struct _EFI_REST_JSON_STRUCTURE_PROTOCOL {
+ EFI_REST_JSON_STRUCTURE_REGISTER Register;
///< Register JSON to C structure convertor
+ EFI_REST_JSON_STRUCTURE_TO_STRUCTURE ToStructure;
///< The function to convert JSON to C structure
+ EFI_REST_JSON_STRUCTURE_TO_JSON ToJson;
///< The function to convert C structure to JSON
+ EFI_REST_JSON_STRUCTURE_DESTORY_STRUCTURE DestoryStructure;
///< Destory C structure.
+} EFI_REST_JSON_STRUCTURE_PROTOCOL;
Here, typedef is not required, because EFI_REST_JSON_STRUCTURE_PROTOCOL has
been defined in the begin of this file.

Thanks
Liming
+
+#endif
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index 812be75fb3..0943816825 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -1848,6 +1848,12 @@
## Include/Protocol/NvdimmLabel.h
gEfiNvdimmLabelProtocolGuid = { 0xd40b6b80, 0x97d5,
0x4282, { 0xbb, 0x1d, 0x22, 0x3a, 0x16, 0x91, 0x80, 0x58 }}

+ #
+ # Protocols defined in UEFI2.8
+ #
+ ## Include/Protocol/RestJsonStructure.h
+ gEfiRestJsonStructureProtocolGuid = { 0xa9a048f6, 0x48a0, 0x4714,
{0xb7, 0xda, 0xa9, 0xad,0x87, 0xd4, 0xda, 0xc9 }}
+
#
# Protocols defined in Shell2.0
#
--
2.17.1





回复: [edk2-devel] [Rest Ex Definition PATCH 1/2] MdePkg/Include: Definitions of EFI REST EX Protocol

gaoliming
 

Abner:
In the file header, please describe this definition is from which version
UEFI spec. With this change, Reviewed-by: Liming Gao <gaoliming@....
cn>

Thanks
Liming
-----邮件原件-----
发件人: Wu, Jiaxin <jiaxin.wu@...>
发送时间: 2020年10月12日 16:54
收件人: devel@edk2.groups.io; abner.chang@...
抄送: Kinney, Michael D <michael.d.kinney@...>; Liming Gao
<gaoliming@...>; Liu, Zhiguang <zhiguang.liu@...>; Yao,
Jiewen <jiewen.yao@...>; Nickle Wang <nickle.wang@...>
主题: RE: [edk2-devel] [Rest Ex Definition PATCH 1/2] MdePkg/Include:
Definitions of EFI REST EX Protocol

Reviewed-by: Jiaxin Wu <jiaxin.wu@...>



-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Abner
Chang
Sent: Monday, October 12, 2020 3:04 PM
To: devel@edk2.groups.io
Cc: Kinney, Michael D <michael.d.kinney@...>; Liming Gao
<gaoliming@...>; Liu, Zhiguang <zhiguang.liu@...>; Yao,
Jiewen <jiewen.yao@...>; Nickle Wang <nickle.wang@...>
Subject: [edk2-devel] [Rest Ex Definition PATCH 1/2] MdePkg/Include:
Definitions of EFI REST EX Protocol

Add definitions of EFI REST EX Protocol according
to UEFI spec v2.8 Section 29.7.2 EFI REST EX Protocol.

Signed-off-by: Jiaxin Wu <jiaxin.wu@...>
Signed-off-by: Siyuan Fu <siyuan.fu@...>
Signed-off-by: Fan Wang <fan.wang@...>
Signed-off-by: Abner Chang <abner.chang@...>

Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Liming Gao <gaoliming@...>
Cc: Zhiguang Liu <zhiguang.liu@...>
Cc: Jiewen Yao <jiewen.yao@...>
Cc: Nickle Wang <nickle.wang@...>
---
MdePkg/Include/Protocol/RestEx.h | 388
+++++++++++++++++++++++++++++++
MdePkg/MdePkg.dec | 7 +
2 files changed, 395 insertions(+)
create mode 100644 MdePkg/Include/Protocol/RestEx.h

diff --git a/MdePkg/Include/Protocol/RestEx.h
b/MdePkg/Include/Protocol/RestEx.h
new file mode 100644
index 0000000000..c42096d14c
--- /dev/null
+++ b/MdePkg/Include/Protocol/RestEx.h
@@ -0,0 +1,388 @@
+/** @file
+ This file defines the EFI REST EX Protocol interface. It is
+ split into the following two main sections.
+
+ - REST EX Service Binding Protocol
+ - REST EX Protocol
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+
+**/
+
+#ifndef EFI_REST_EX_PROTOCOL_H_
+#define EFI_REST_EX_PROTOCOL_H_
+
+#include <Protocol/Http.h>
+
+//
+//GUID definitions
+//
+#define EFI_REST_EX_SERVICE_BINDING_PROTOCOL_GUID \
+ { \
+ 0x456bbe01, 0x99d0, 0x45ea, {0xbb, 0x5f, 0x16, 0xd8, 0x4b, 0xed,
0xc5,
0x59 } \
+ }
+
+#define EFI_REST_EX_PROTOCOL_GUID \
+ { \
+ 0x55648b91, 0xe7d, 0x40a3, {0xa9, 0xb3, 0xa8, 0x15, 0xd7, 0xea,
0xdf,
0x97 } \
+ }
+
+typedef struct _EFI_REST_EX_PROTOCOL EFI_REST_EX_PROTOCOL;
+
+//*******************************************************
+//EFI_REST_EX_SERVICE_INFO_VER
+//*******************************************************
+typedef struct {
+ UINT8 Major;
+ UINT8 Minor;
+} EFI_REST_EX_SERVICE_INFO_VER;
+
+//*******************************************************
+//EFI_REST_EX_SERVICE_INFO_HEADER
+//*******************************************************
+typedef struct {
+ UINT32 Length;
+ EFI_REST_EX_SERVICE_INFO_VER RestServiceInfoVer;
+} EFI_REST_EX_SERVICE_INFO_HEADER;
+
+//*******************************************************
+// EFI_REST_EX_SERVICE_TYPE
+//*******************************************************
+typedef enum {
+ EfiRestExServiceUnspecific = 1,
+ EfiRestExServiceRedfish,
+ EfiRestExServiceOdata,
+ EfiRestExServiceVendorSpecific = 0xff,
+ EfiRestExServiceTypeMax
+} EFI_REST_EX_SERVICE_TYPE;
+
+//*******************************************************
+// EFI_REST_EX_SERVICE_ACCESS_MODE
+//*******************************************************
+typedef enum {
+ EfiRestExServiceInBandAccess = 1,
+ EfiRestExServiceOutOfBandAccess = 2,
+ EfiRestExServiceModeMax
+} EFI_REST_EX_SERVICE_ACCESS_MODE;
+
+//*******************************************************
+// EFI_REST_EX_CONFIG_TYPE
+//*******************************************************
+typedef enum {
+ EfiRestExConfigHttp,
+ EfiRestExConfigUnspecific,
+ EfiRestExConfigTypeMax
+} EFI_REST_EX_CONFIG_TYPE;
+
+//*******************************************************
+//EFI_REST_EX_SERVICE_INFO v1.0
+//*******************************************************
+typedef struct {
+ EFI_REST_EX_SERVICE_INFO_HEADER EfiRestExServiceInfoHeader;
+ EFI_REST_EX_SERVICE_TYPE RestServiceType;
+ EFI_REST_EX_SERVICE_ACCESS_MODE RestServiceAccessMode;
+ EFI_GUID VendorRestServiceName;
+ UINT32 VendorSpecificDataLength;
+ UINT8 *VendorSpecifcData;
+ EFI_REST_EX_CONFIG_TYPE RestExConfigType;
+ UINT8 RestExConfigDataLength;
+} EFI_REST_EX_SERVICE_INFO_V_1_0;
+
+//*******************************************************
+//EFI_REST_EX_SERVICE_INFO
+//*******************************************************
+typedef union {
+ EFI_REST_EX_SERVICE_INFO_HEADER EfiRestExServiceInfoHeader;
+ EFI_REST_EX_SERVICE_INFO_V_1_0 EfiRestExServiceInfoV10;
+} EFI_REST_EX_SERVICE_INFO;
+
+//*******************************************************
+// EFI_REST_EX_HTTP_CONFIG_DATA
+//*******************************************************
+typedef struct {
+ EFI_HTTP_CONFIG_DATA HttpConfigData;
+ UINT32 SendReceiveTimeout;
+} EFI_REST_EX_HTTP_CONFIG_DATA;
+
+//*******************************************************
+//EFI_REST_EX_CONFIG_DATA
+//*******************************************************
+typedef UINT8 *EFI_REST_EX_CONFIG_DATA;
+
+//*******************************************************
+//EFI_REST_EX_TOKEN
+//*******************************************************
+typedef struct {
+ EFI_EVENT Event;
+ EFI_STATUS Status;
+ EFI_HTTP_MESSAGE *ResponseMessage;
+} EFI_REST_EX_TOKEN;
+
+/**
+ Provides a simple HTTP-like interface to send and receive resources
from a
REST service.
+
+ The SendReceive() function sends an HTTP request to this REST
service,
and returns a
+ response when the data is retrieved from the service. RequestMessage
contains the HTTP
+ request to the REST resource identified by
RequestMessage.Request.Url.
The
+ ResponseMessage is the returned HTTP response for that request,
including any HTTP
+ status.
+
+ @param[in] This Pointer to
EFI_REST_EX_PROTOCOL instance for a
particular
+ REST service.
+ @param[in] RequestMessage Pointer to the HTTP request data
for this
resource
+ @param[out] ResponseMessage Pointer to the HTTP response
data
obtained for this requested.
+
+ @retval EFI_SUCCESS operation succeeded.
+ @retval EFI_INVALID_PARAMETER This, RequestMessage, or
ResponseMessage are NULL.
+ @retval EFI_DEVICE_ERROR An unexpected system or
network error
occurred.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_SEND_RECEIVE)(
+ IN EFI_REST_EX_PROTOCOL *This,
+ IN EFI_HTTP_MESSAGE *RequestMessage,
+ OUT EFI_HTTP_MESSAGE *ResponseMessage
+ );
+
+/**
+ Obtain the current time from this REST service instance.
+
+ The GetServiceTime() function is an optional interface to obtain the
current time from
+ this REST service instance. If this REST service does not support to
retrieve
the time,
+ this function returns EFI_UNSUPPORTED. This function must returns
EFI_UNSUPPORTED if
+ EFI_REST_EX_SERVICE_TYPE returned in EFI_REST_EX_SERVICE_INFO
from
GetService() is
+ EFI_REST_EX_SERVICE_UNSPECIFIC.
+
+ @param[in] This Pointer to
EFI_REST_EX_PROTOCOL instance for a
particular
+ REST service.
+ @param[out] Time A pointer to storage to receive a
snapshot of
the current time of
+ the REST service.
+
+ @retval EFI_SUCCESS operation succeeded.
+ @retval EFI_INVALID_PARAMETER This or Time are NULL.
+ @retval EFI_UNSUPPORTED The RESTful service does not
support
returning the time.
+ @retval EFI_DEVICE_ERROR An unexpected system or
network error
occurred.
+ @retval EFI_NOT_READY The configuration of this instance
is not set
yet. Configure() must
+ be executed and returns
successfully prior to invoke this
function.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_GET_TIME)(
+ IN EFI_REST_EX_PROTOCOL *This,
+ OUT EFI_TIME *Time
+ );
+
+/**
+ This function returns the information of REST service provided by
this EFI
REST EX driver instance.
+
+ The information such as the type of REST service and the access mode
of
REST EX driver instance
+ (In-band or Out-of-band) are described in EFI_REST_EX_SERVICE_INFO
structure. For the vendor-specific
+ REST service, vendor-specific REST service information is returned in
VendorSpecifcData.
+ REST EX driver designer is well know what REST service this REST EX
driver
instance intends to
+ communicate with. The designer also well know this driver instance is
used
to talk to BMC through
+ specific platform mechanism or talk to REST server through UEFI HTTP
protocol. REST EX driver is
+ responsible to fill up the correct information in
EFI_REST_EX_SERVICE_INFO. EFI_REST_EX_SERVICE_INFO
+ is referred by EFI REST clients to pickup the proper EFI REST EX
driver
instance to get and set resource.
+ GetService() is a basic and mandatory function which must be able to
use
even Configure() is not invoked
+ in previously.
+
+ @param[in] This Pointer to
EFI_REST_EX_PROTOCOL instance for a
particular
+ REST service.
+ @param[out] RestExServiceInfo Pointer to receive a pointer to
EFI_REST_EX_SERVICE_INFO structure. The
+ format of
EFI_REST_EX_SERVICE_INFO is version
controlled for the future
+ extension. The version of
EFI_REST_EX_SERVICE_INFO
structure is returned
+ in the header within this
structure. EFI REST client refers to
the correct
+ format of structure according to
the version number. The
pointer to
+ EFI_REST_EX_SERVICE_INFO is
a memory block allocated
by EFI REST EX driver
+ instance. That is caller's
responsibility to free this memory
when this
+ structure is no longer needed.
Refer to Related Definitions
below for the
+ definitions of
EFI_REST_EX_SERVICE_INFO structure.
+
+ @retval EFI_SUCCESS EFI_REST_EX_SERVICE_INFO is
returned in
RestExServiceInfo. This function
+ is not supported in this REST EX
Protocol driver instance.
+ @retval EFI_UNSUPPORTED This function is not supported in
this REST
EX Protocol driver instance.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_EX_GET_SERVICE)(
+ IN EFI_REST_EX_PROTOCOL *This,
+ OUT EFI_REST_EX_SERVICE_INFO **RestExServiceInfo
+ );
+
+/**
+ This function returns operational configuration of current EFI REST
EX
child
instance.
+
+ This function returns the current configuration of EFI REST EX child
instance.
The format of
+ operational configuration depends on the implementation of EFI REST
EX
driver instance. For
+ example, HTTP-aware EFI REST EX driver instance uses EFI HTTP
protocol as
the undying protocol
+ to communicate with REST service. In this case, the type of
configuration
is
+ EFI_REST_EX_CONFIG_TYPE_HTTP returned from GetService().
EFI_HTTP_CONFIG_DATA is used as EFI REST
+ EX configuration format and returned to EFI REST client. User has to
type
cast RestExConfigData
+ to EFI_HTTP_CONFIG_DATA. For those non HTTP-aware REST EX driver
instances, the type of configuration
+ is EFI_REST_EX_CONFIG_TYPE_UNSPECIFIC returned from GetService().
In
this case, the format of
+ returning data could be non industrial. Instead, the format of
configuration
data is system/platform
+ specific definition such as BMC mechanism used in EFI REST EX driver
instance. EFI REST client and
+ EFI REST EX driver instance have to refer to the specific system
/platform
spec which is out of UEFI scope.
+
+ @param[in] This This is the
EFI_REST_EX_PROTOCOL instance.
+ @param[out] RestExConfigData Pointer to receive a pointer to
EFI_REST_EX_CONFIG_DATA.
+ The memory allocated for
configuration data should be
freed
+ by caller. See Related Definitions
for the details.
+
+ @retval EFI_SUCCESS EFI_REST_EX_CONFIG_DATA is
returned in
successfully.
+ @retval EFI_UNSUPPORTED This function is not supported in
this REST
EX Protocol driver instance.
+ @retval EFI_NOT_READY The configuration of this instance
is not set
yet. Configure() must be
+ executed and returns
successfully prior to invoke this
function.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_EX_GET_MODE_DATA)(
+ IN EFI_REST_EX_PROTOCOL *This,
+ OUT EFI_REST_EX_CONFIG_DATA *RestExConfigData
+ );
+
+/**
+ This function is used to configure EFI REST EX child instance.
+
+ This function is used to configure the setting of underlying protocol
of
REST
EX child
+ instance. The type of configuration is according to the
implementation of
EFI REST EX
+ driver instance. For example, HTTP-aware EFI REST EX driver instance
uses
EFI HTTP protocol
+ as the undying protocol to communicate with REST service. The type of
configuration is
+ EFI_REST_EX_CONFIG_TYPE_HTTP and RestExConfigData is the same
format with EFI_HTTP_CONFIG_DATA.
+ Akin to HTTP configuration, REST EX child instance can be configure
to
use
different HTTP
+ local access point for the data transmission. Multiple REST clients
may
use
different
+ configuration of HTTP to distinguish themselves, such as to use the
different TCP port.
+ For those non HTTP-aware REST EX driver instance, the type of
configuration is
+ EFI_REST_EX_CONFIG_TYPE_UNSPECIFIC. RestExConfigData refers to
the
non industrial standard.
+ Instead, the format of configuration data is system/platform specific
definition such as BMC.
+ In this case, EFI REST client and EFI REST EX driver instance have to
refer
to
the specific
+ system/platform spec which is out of the UEFI scope. Besides
GetService()function, no other
+ EFI REST EX functions can be executed by this instance until
Configure()is
executed and returns
+ successfully. All other functions must returns EFI_NOT_READY if this
instance is not configured
+ yet. Set RestExConfigData to NULL means to put EFI REST EX child
instance
into the unconfigured
+ state.
+
+ @param[in] This This is the
EFI_REST_EX_PROTOCOL instance.
+ @param[in] RestExConfigData Pointer to
EFI_REST_EX_CONFIG_DATA.
See Related Definitions in
+ GetModeData() protocol
interface.
+
+ @retval EFI_SUCCESS EFI_REST_EX_CONFIG_DATA is
set in
successfully.
+ @retval EFI_DEVICE_ERROR Configuration for this REST EX
child
instance is failed with the given
+ EFI_REST_EX_CONFIG_DATA.
+ @retval EFI_UNSUPPORTED This function is not supported in
this REST
EX Protocol driver instance.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_EX_CONFIGURE)(
+ IN EFI_REST_EX_PROTOCOL *This,
+ IN EFI_REST_EX_CONFIG_DATA RestExConfigData
+ );
+
+/**
+ This function sends REST request to REST service and signal caller's
event
asynchronously when
+ the final response is received by REST EX Protocol driver instance.
+
+ The essential design of this function is to handle asynchronous
send/receive implicitly according
+ to REST service asynchronous request mechanism. Caller will get the
notification once the response
+ is returned from REST service.
+
+ @param[in] This This is the
EFI_REST_EX_PROTOCOL instance.
+ @param[in] RequestMessage This is the HTTP request
message sent
to REST service. Set RequestMessage
+ to NULL to cancel the
previous asynchronous request
associated with the
+ corresponding RestExToken.
See descriptions for the
details.
+ @param[in] RestExToken REST EX token which REST EX
Protocol
instance uses to notify REST client
+ the status of response of
asynchronous REST request. See
related definition
+ of EFI_REST_EX_TOKEN.
+ @param[in] TimeOutInMilliSeconds The pointer to the timeout in
milliseconds which REST EX Protocol driver
+ instance refers as the
duration to drop asynchronous REST
request. NULL
+ pointer means no timeout for
this REST request. REST EX
Protocol driver
+ signals caller's event with
EFI_STATUS set to EFI_TIMEOUT
in RestExToken
+ if REST EX Protocol can't get
the response from REST
service within
+ TimeOutInMilliSeconds.
+
+ @retval EFI_SUCCESS Asynchronous REST request is
established.
+ @retval EFI_UNSUPPORTED This REST EX Protocol driver
instance
doesn't support asynchronous request.
+ @retval EFI_TIMEOUT Asynchronous REST request is
not
established and timeout is expired.
+ @retval EFI_ABORT Previous asynchronous REST
request has been
canceled.
+ @retval EFI_DEVICE_ERROR Otherwise, returns
EFI_DEVICE_ERROR
for other errors according to HTTP Status Code.
+ @retval EFI_NOT_READY The configuration of this
instance is not set
yet. Configure() must be executed
+ and returns successfully prior
to invoke this function.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_EX_ASYNC_SEND_RECEIVE)(
+ IN EFI_REST_EX_PROTOCOL *This,
+ IN EFI_HTTP_MESSAGE *RequestMessage OPTIONAL,
+ IN EFI_REST_EX_TOKEN *RestExToken,
+ IN UINTN *TimeOutInMilliSeconds
OPTIONAL
+ );
+
+/**
+ This function sends REST request to a REST Event service and signals
caller's
event
+ token asynchronously when the URI resource change event is received
by
REST EX
+ Protocol driver instance.
+
+ The essential design of this function is to monitor event implicitly
according
to
+ REST service event service mechanism. Caller will get the
notification if
certain
+ resource is changed.
+
+ @param[in] This This is the
EFI_REST_EX_PROTOCOL instance.
+ @param[in] RequestMessage This is the HTTP request
message sent
to REST service. Set RequestMessage
+ to NULL to cancel the
previous event service associated
with the corresponding
+ RestExToken. See
descriptions for the details.
+ @param[in] RestExToken REST EX token which REST EX
Protocol
driver instance uses to notify REST client
+ the URI resource which
monitored by REST client has
been changed. See the related
+ definition of
EFI_REST_EX_TOKEN in
EFI_REST_EX_PROTOCOL.AsyncSendReceive().
+
+ @retval EFI_SUCCESS Asynchronous REST request is
established.
+ @retval EFI_UNSUPPORTED This REST EX Protocol driver
instance
doesn't support asynchronous request.
+ @retval EFI_ABORT Previous asynchronous REST
request has been
canceled or event subscription has been
+ delete from service.
+ @retval EFI_DEVICE_ERROR Otherwise, returns
EFI_DEVICE_ERROR
for other errors according to HTTP Status Code.
+ @retval EFI_NOT_READY The configuration of this
instance is not set
yet. Configure() must be executed
+ and returns successfully prior
to invoke this function.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_REST_EX_EVENT_SERVICE)(
+ IN EFI_REST_EX_PROTOCOL *This,
+ IN EFI_HTTP_MESSAGE *RequestMessage OPTIONAL,
+ IN EFI_REST_EX_TOKEN *RestExToken
+);
+
+///
+/// EFI REST(EX) protocols are designed to support REST communication
between EFI REST client
+/// applications/drivers and REST services. EFI REST client tool uses
EFI
REST(EX) protocols
+/// to send/receive resources to/from REST service to manage systems,
configure systems or
+/// manipulate resources on REST service. Due to HTTP protocol is
commonly used to communicate
+/// with REST service in practice, EFI REST(EX) protocols adopt HTTP as
the
message format to
+/// send and receive REST service resource. EFI REST(EX) driver
instance
abstracts EFI REST
+/// client functionality and provides underlying interface to
communicate
with REST service.
+/// EFI REST(EX) driver instance knows how to communicate with REST
service through certain
+/// interface after the corresponding configuration is initialized.
+///
+struct _EFI_REST_EX_PROTOCOL {
+ EFI_REST_SEND_RECEIVE SendReceive;
+ EFI_REST_GET_TIME GetServiceTime;
+ EFI_REST_EX_GET_SERVICE GetService;
+ EFI_REST_EX_GET_MODE_DATA GetModeData;
+ EFI_REST_EX_CONFIGURE Configure;
+ EFI_REST_EX_ASYNC_SEND_RECEIVE AyncSendReceive;
+ EFI_REST_EX_EVENT_SERVICE EventService;
+};
+
+extern EFI_GUID gEfiRestExServiceBindingProtocolGuid;
+extern EFI_GUID gEfiRestExProtocolGuid;
+
+#endif
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index 812be75fb3..5205374d62 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -1848,6 +1848,13 @@
## Include/Protocol/NvdimmLabel.h
gEfiNvdimmLabelProtocolGuid = { 0xd40b6b80,
0x97d5, 0x4282,
{ 0xbb, 0x1d, 0x22, 0x3a, 0x16, 0x91, 0x80, 0x58 }}

+ #
+ # Protocols defined in UEFI2.8
+ #
+ ## Include/Protocol/RestEx.h
+ gEfiRestExProtocolGuid = { 0x55648b91, 0xe7d,
0x40a3, { 0xa9, 0xb3,
0xa8, 0x15, 0xd7, 0xea, 0xdf, 0x97 }}
+ gEfiRestExServiceBindingProtocolGuid = { 0x456bbe01, 0x99d0, 0x45ea,
{ 0xbb, 0x5f, 0x16, 0xd8, 0x4b, 0xed, 0xc5, 0x59 }}
+
#
# Protocols defined in Shell2.0
#
--
2.17.1





回复: [edk2-devel] OpensslLib compiling error : cannot open include file : openssl/aes.h

gaoliming
 

cc_resp.txt includes the compiler flag and include path. It will be used by the compiler. Then, the compile command line length can be reduced. It can avoid nmake limitation of the command line length 4096.

Thanks
Liming

-----邮件原件-----
发件人: bounce+27952+66197+4905953+8761045@groups.io
<bounce+27952+66197+4905953+8761045@groups.io> 代表 Tiger
Liu(BJ-RD)
发送时间: 2020年10月14日 9:45
收件人: gaoliming <gaoliming@...>; devel@edk2.groups.io
主题: 答复: [edk2-devel] OpensslLib compiling error : cannot open include
file : openssl/aes.h

Hi, Liming:
From Build.log, it seems include path is ok:
......
cl.exe"
/Foy:\Build\ZxxPlatformPkg\DEBUG_VS2015x86\X64\CryptoPkg\Library\Base
CryptLib\RuntimeCryptLib\OUTPUT\Hash\ /showIncludes /nologo /c /GS-
/W4 /Gs32768 /D UNICODE /O1b2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF
/Z7 /Gw /wd4090 -
......
/Iy:\CryptoPkg /Iy:\CryptoPkg\Include /Iy:\CryptoPkg\Private
/Iy:\CryptoPkg\Library\Include
/Iy:\CryptoPkg\Library\OpensslLib\openssl\include
y:\CryptoPkg\Library\BaseCryptLib\Hash\CryptSm3.c
y:\CryptoPkg\Library\BaseCryptLib\Hash\CryptMd5.c
y:\CryptoPkg\Library\BaseCryptLib\Hash\CryptSha256.c
y:\CryptoPkg\Library\BaseCryptLib\Hash\CryptSha512Null.c
y:\CryptoPkg\Library\BaseCryptLib\Hash\CryptSha1.c

And BaseCryptLib / IntrinsicLib compiled successfully.

And I found a cc_resp.txt file in
Build\...\DEBUG_VS2015x86\X64\CryptoPkg\Library\OpensslLib\OpensslLib\
OUTPUT
Why produce a cc_resp.txt?

Thanks
-----邮件原件-----
发件人: gaoliming <gaoliming@...>
发送时间: 2020年10月13日 18:03
收件人: devel@edk2.groups.io; Tiger Liu(BJ-RD) <TigerLiu@...>
主题: 回复: [edk2-devel] OpensslLib compiling error : cannot open include
file : openssl/aes.h

Can you print the full build log and check the compiler include path?

Is this a clean build issue or incremental build issue?

Thanks
Liming
-----邮件原件-----
发件人: bounce+27952+66166+4905953+8761045@groups.io
<bounce+27952+66166+4905953+8761045@groups.io> 代表 Tiger
Liu(BJ-RD)
发送时间: 2020年10月13日 16:38
收件人: devel@edk2.groups.io
主题: [edk2-devel] OpensslLib compiling error : cannot open include file :
openssl/aes.h

Hi, experts:
When I compiled OpensslLib, I met a problem:
......
\CryptoPkg\Library\OpensslLib\openssl\crypto\aes\aes_core.c(42): fatal
error C1083: Cannot open include file: 'openssl/crypto.h': No such
file or directory
\CryptoPkg\Library\OpensslLib\openssl\crypto\aes\aes_misc.c(10): fatal
error C1083: Cannot open include file: 'openssl/opensslv.h': No such
file or directory ......

But these files exist in
CryptoPkg\Library\OpensslLib\openssl\include\openssl .

Does anybody meet same problems?

Note:
CryptoPkg.dec has also declared this include path:
......
[Includes.Common.Private]
Private
Library/Include
Library/OpensslLib/openssl/include
......

Thanks


保密声明:
本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或

内容做任何未经授权的查阅、使用、复制或转发。
CONFIDENTIAL NOTE:
This email contains confidential or legally privileged information and
is for the sole use of its intended recipient. Any unauthorized
review, use, copying or forwarding of this email or the content of this email is
strictly prohibited.







保密声明:
本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或其
内容做任何未经授权的查阅、使用、复制或转发。
CONFIDENTIAL NOTE:
This email contains confidential or legally privileged information and is for the
sole use of its intended recipient. Any unauthorized review, use, copying or
forwarding of this email or the content of this email is strictly prohibited.




回复: [edk2-devel] [PATCH] MdePkg/Include: Add HTTP definitions

gaoliming
 

Reviewed-by: Liming Gao <gaoliming@...>

-----邮件原件-----
发件人: bounce+27952+65675+4905953+8761045@groups.io
<bounce+27952+65675+4905953+8761045@groups.io> 代表 Abner Chang
发送时间: 2020年9月28日 14:01
收件人: devel@edk2.groups.io
抄送: abner.chang@...; Michael D Kinney
<michael.d.kinney@...>; Liming Gao <gaoliming@...>;
Zhiguang Liu <zhiguang.liu@...>; Wu Jiaxin <jiaxin.wu@...>; Fu
Siyuan <siyuan.fu@...>; Wang Fan <fan.wang@...>; Nickle
Wang <nickle.wang@...>; Maciej Rabeda
<maciej.rabeda@...>
主题: [edk2-devel] [PATCH] MdePkg/Include: Add HTTP definitions

BZ #2915,
https://bugzilla.tianocore.org/show_bug.cgi?id=2915

Add definitions for HTTP chunk transfer. HTTP chunk
would be used in UEFI Redfish solution for provisioning
or patch BIOS Redfish properties.

Signed-off-by: Abner Chang <abner.chang@...>

Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Liming Gao <gaoliming@...>
Cc: Zhiguang Liu <zhiguang.liu@...>
Cc: Wu Jiaxin <jiaxin.wu@...>
Cc: Fu Siyuan <siyuan.fu@...>
Cc: Wang Fan <fan.wang@...>
Cc: Nickle Wang <nickle.wang@...>
Cc: Maciej Rabeda <maciej.rabeda@...>
---
MdePkg/Include/IndustryStandard/Http11.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/MdePkg/Include/IndustryStandard/Http11.h
b/MdePkg/Include/IndustryStandard/Http11.h
index d124bec37b0..890bb6913bd 100644
--- a/MdePkg/Include/IndustryStandard/Http11.h
+++ b/MdePkg/Include/IndustryStandard/Http11.h
@@ -146,7 +146,11 @@
/// is a property of the message, not of the entity.
///
#define HTTP_HEADER_TRANSFER_ENCODING "Transfer-Encoding"
-
+#define HTTP_HEADER_TRANSFER_ENCODING_CHUNKED "chunked"
+#define CHUNKED_TRNASFER_CODING_CR '\r'
+#define CHUNKED_TRNASFER_CODING_LF '\n'
+#define CHUNKED_TRNASFER_CODING_LAST_CHUNK '0'
+#define CHUNKED_TRNASFER_CODING_EXTENSION_SAPERATOR ';'

///
/// User Agent Request Header
--
2.21.0.windows.1