[Patch V4 1/9] MdeModulePkg: Add Universal Payload general definition header file


Zhiguang Liu
 

V1:
Add Universal Payload general definition header file according to
Universal Payload's documentation
V2:
Add a macro function to check the Revision

V4:
The documentation link https://universalpayload.github.io/documentation/ is=
added
Change the term "PLD" to "UNIVERSAL_PAYLOAD".

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
---
MdeModulePkg/Include/UniversalPayload/UniversalPayload.h | 35 ++++++++++++=
+++++++++++++++++++++++
1 file changed, 35 insertions(+)

diff --git a/MdeModulePkg/Include/UniversalPayload/UniversalPayload.h b/Mde=
ModulePkg/Include/UniversalPayload/UniversalPayload.h
new file mode 100644
index 0000000000..fd3a2ea262
--- /dev/null
+++ b/MdeModulePkg/Include/UniversalPayload/UniversalPayload.h
@@ -0,0 +1,35 @@
+/** @file=0D
+ Universal Payload general definitions.=0D
+=0D
+Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>=0D
+SPDX-License-Identifier: BSD-2-Clause-Patent=0D
+=0D
+ @par Revision Reference:=0D
+ - Universal Payload Specification 0.75 (https://universalpayload.githu=
b.io/documentation/)=0D
+**/=0D
+=0D
+#ifndef __UNIVERSAL_PAYLOAD_H__=0D
+#define __UNIVERSAL_PAYLOAD_H__=0D
+=0D
+#pragma pack(1)=0D
+=0D
+typedef struct {=0D
+ UINT8 Revision;=0D
+ UINT8 Reserved;=0D
+ UINT16 Length;=0D
+} UNIVERSAL_PAYLOAD_GENERIC_HEADER;=0D
+=0D
+#pragma pack()=0D
+=0D
+/**=0D
+ Returns the size of a structure of known type, up through and including =
a specified field.=0D
+=0D
+ @param TYPE The name of the data structure that contains the field=
specified by Field.=0D
+ @param Field The name of the field in the data structure.=0D
+=0D
+ @return size, in bytes.=0D
+=0D
+**/=0D
+#define UNIVERSAL_PAYLOAD_SIZEOF_THROUGH_FIELD(TYPE, Field) (OFFSET_OF(TYP=
E, Field) + sizeof (((TYPE *) 0)->Field))=0D
+=0D
+#endif // __UNIVERSAL_PAYLOAD_H__=0D
--=20
2.30.0.windows.2