Re: [edk2-devel] [PATCH v3] MdePkg/Include: Add DMTF MCTP definitions

2023-03-23 Thread Chang, Abner via groups.io
[AMD Official Use Only - General]

Hi Mike,
MCTP v4 was just sent.
Thanks
Abner

> -Original Message-
> From: Kinney, Michael D 
> Sent: Friday, March 24, 2023 6:24 AM
> To: Chang, Abner ; devel@edk2.groups.io
> Cc: Gao, Liming ; Liu, Zhiguang
> ; Nickle Wang ; Igor
> Kulchytskyy ; Oram, Isaac W ;
> Attar, AbdulLateef (Abdul Lateef) ; Kinney,
> Michael D 
> Subject: RE: [PATCH v3] MdePkg/Include: Add DMTF MCTP definitions
> 
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
> 
> 
> > -Original Message-
> > From: abner.ch...@amd.com 
> > Sent: Thursday, March 23, 2023 8:05 AM
> > To: devel@edk2.groups.io
> > Cc: Kinney, Michael D ; Gao, Liming
> > ; Liu, Zhiguang ;
> > Nickle Wang ; Igor Kulchytskyy ;
> > Oram, Isaac W ; Abdul Lateef Attar
> > 
> > Subject: [PATCH v3] MdePkg/Include: Add DMTF MCTP definitions
> >
> > From: Abner Chang 
> >
> > BZ #4355
> > This change adds definitions for DMTF MCTP base specification.
> >
> > Spec ref:
> >
> https://www.dmtf.org/sites/default/files/standards/documents/DSP0236_1
> > .3.1.pdf
> >
> > Signed-off-by: Abner Chang 
> > Cc: Michael D Kinney 
> > Cc: Liming Gao 
> > Cc: Zhiguang Liu 
> > Cc: Nickle Wang 
> > Cc: Igor Kulchytskyy 
> > Cc: Isaac Oram 
> > Cc: Abdul Lateef Attar 
> > Acked-by: Isaac Oram 
> > ---
> >  MdePkg/Include/IndustryStandard/Mctp.h | 138
> > +
> >  1 file changed, 138 insertions(+)
> >  create mode 100644 MdePkg/Include/IndustryStandard/Mctp.h
> >
> > diff --git a/MdePkg/Include/IndustryStandard/Mctp.h
> > b/MdePkg/Include/IndustryStandard/Mctp.h
> > new file mode 100644
> > index 000..bfbc843c7f1
> > --- /dev/null
> > +++ b/MdePkg/Include/IndustryStandard/Mctp.h
> > @@ -0,0 +1,138 @@
> > +/** @file
> > +
> > +  The definitions of DMTF Management Component Transport Protocol
> > + (MCTP)  Base Specification.
> > +
> > +  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights
> > + reserved.
> > +  SPDX-License-Identifier: BSD-2-Clause-Patent
> > +
> > +  @par Revision Reference:
> > +  DMTF Management Component Transport Protocol (MCTP) Base
> > +Specification
> > +  Version 1.3.1
> > +
> >
> +https://www.dmtf.org/sites/default/files/standards/documents/DSP0236_
> > +1.3.1.pdf
> > +**/
> > +
> > +#ifndef MCTP_H_
> > +#define MCTP_H_
> > +
> > +///
> > +/// Definitions of endpoint ID
> > +///
> > +#define MCTP_NULL_DESTINATION_ENDPOINT_ID  0
> > +#define MCTP_NULL_SOURCE_ENDPOINT_ID   0
> > +#define MCTP_RESERVED_ENDPOINT_START_ID1
> > +#define MCTP_RESERVED_ENDPOINT_END_ID  7
> > +#define MCTP_BROADCAST_ENDPOINT_ID 0xFF
> > +
> > +/// Minimum transmission size is 64 bytes.
> > +/// The value of 64 is defined in MCTP Base Specification.
> > +#define MCTP_BASELINE_MINIMUM_UNIT_TRANSMISSION_SIZE  0x40
> > +
> > +///
> > +/// The 32-bit Header of MCTP packet.
> > +///
> > +typedef union {
> > +  struct {
> > +UINT8HeaderVersion : 4; ///< The version of header.
> > +UINT8Reserved  : 4; ///< Reserved for future 
> > definitions.
> > +UINT8DestinationEndpointId : 8; ///< Destination endpoint Id (EID).
> > +UINT8SourceEndpointIdId: 8; ///< Source endpoint Id (EID)
> > +UINT8MessageTag: 3; ///< Check the MCTP Base 
> > specification
> for the
> > +///< usages.
> > +UINT8TagOwner  : 1; ///< Tag owner identifies the 
> > message was
> > +///< originated by the source EID 
> > or
> > +///< destination EID.
> > +UINT8PacketSequence: 2; ///< Sequence number increments
> Modulo 4 on
> > +///< each packet.
> > +UINT8EndOfMessage  : 1; ///< Indicates the last packet of
> message.
> > +UINT8StartOfMessage: 1; ///< Indicates the first packet of
> message.
> 
> These bitfields should be type UINT32
> 
> > +  } Bits;
> > +  UINT32Header;
> > +} MCTP_TRANSPORT_HEADER;
> > +
> > +///
> > +/// The 8-bit Message Header of MCTP packet.
> > +///
> > +typedef union {
> > +  struct {
> > +UINT8MessageType   : 7;
> > +UINT8ItegrityCheck : 1;
> > +  } Bits;
> > +  UINT8MessageHeader;
> > +} MCTP_MESSAGE_HEADER;
> > +
> > +///
> > +/// MCTP Control Commands
> > +///
> > +#define   MCTP_CONTROL_RESERVED0x00
> > +#define   MCTP_CONTROL_SET_ENDPOINT_ID 0x01
> > +#define   MCTP_CONTROL_GET_ENDPOINT_ID 0x02
> > +#define   MCTP_CONTROL_GET_ENDPOINT_UUID   0x03
> > +#define   MCTP_CONTROL_GET_MCTP_VERSION_SUPPORT0x04
> > +#define   MCTP_CONTROL_GET_MESSAGE_TYPE_SUPPORT0x05
> > +#define   MCTP_CONTROL_GET_VENDOR_DEFINED_MESSAGE_SUPPORT
> 0x06
> > +#define   MCTP_CONTROL_RESOLVE_ENDPOINT_ID 

Re: [edk2-devel] [PATCH v3] MdePkg/Include: Add DMTF MCTP definitions

2023-03-23 Thread Michael D Kinney


> -Original Message-
> From: abner.ch...@amd.com 
> Sent: Thursday, March 23, 2023 8:05 AM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D ; Gao, Liming 
> ; Liu, Zhiguang ;
> Nickle Wang ; Igor Kulchytskyy ; Oram, 
> Isaac W ; Abdul Lateef Attar
> 
> Subject: [PATCH v3] MdePkg/Include: Add DMTF MCTP definitions
> 
> From: Abner Chang 
> 
> BZ #4355
> This change adds definitions for DMTF MCTP
> base specification.
> 
> Spec ref:
> https://www.dmtf.org/sites/default/files/standards/documents/DSP0236_1.3.1.pdf
> 
> Signed-off-by: Abner Chang 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> Cc: Zhiguang Liu 
> Cc: Nickle Wang 
> Cc: Igor Kulchytskyy 
> Cc: Isaac Oram 
> Cc: Abdul Lateef Attar 
> Acked-by: Isaac Oram 
> ---
>  MdePkg/Include/IndustryStandard/Mctp.h | 138 +
>  1 file changed, 138 insertions(+)
>  create mode 100644 MdePkg/Include/IndustryStandard/Mctp.h
> 
> diff --git a/MdePkg/Include/IndustryStandard/Mctp.h 
> b/MdePkg/Include/IndustryStandard/Mctp.h
> new file mode 100644
> index 000..bfbc843c7f1
> --- /dev/null
> +++ b/MdePkg/Include/IndustryStandard/Mctp.h
> @@ -0,0 +1,138 @@
> +/** @file
> +
> +  The definitions of DMTF Management Component Transport Protocol (MCTP)
> +  Base Specification.
> +
> +  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +  @par Revision Reference:
> +  DMTF Management Component Transport Protocol (MCTP) Base Specification
> +  Version 1.3.1
> +  
> https://www.dmtf.org/sites/default/files/standards/documents/DSP0236_1.3.1.pdf
> +**/
> +
> +#ifndef MCTP_H_
> +#define MCTP_H_
> +
> +///
> +/// Definitions of endpoint ID
> +///
> +#define MCTP_NULL_DESTINATION_ENDPOINT_ID  0
> +#define MCTP_NULL_SOURCE_ENDPOINT_ID   0
> +#define MCTP_RESERVED_ENDPOINT_START_ID1
> +#define MCTP_RESERVED_ENDPOINT_END_ID  7
> +#define MCTP_BROADCAST_ENDPOINT_ID 0xFF
> +
> +/// Minimum transmission size is 64 bytes.
> +/// The value of 64 is defined in MCTP Base Specification.
> +#define MCTP_BASELINE_MINIMUM_UNIT_TRANSMISSION_SIZE  0x40
> +
> +///
> +/// The 32-bit Header of MCTP packet.
> +///
> +typedef union {
> +  struct {
> +UINT8HeaderVersion : 4; ///< The version of header.
> +UINT8Reserved  : 4; ///< Reserved for future definitions.
> +UINT8DestinationEndpointId : 8; ///< Destination endpoint Id (EID).
> +UINT8SourceEndpointIdId: 8; ///< Source endpoint Id (EID)
> +UINT8MessageTag: 3; ///< Check the MCTP Base 
> specification for the
> +///< usages.
> +UINT8TagOwner  : 1; ///< Tag owner identifies the 
> message was
> +///< originated by the source EID or
> +///< destination EID.
> +UINT8PacketSequence: 2; ///< Sequence number increments 
> Modulo 4 on
> +///< each packet.
> +UINT8EndOfMessage  : 1; ///< Indicates the last packet of 
> message.
> +UINT8StartOfMessage: 1; ///< Indicates the first packet of 
> message.

These bitfields should be type UINT32

> +  } Bits;
> +  UINT32Header;
> +} MCTP_TRANSPORT_HEADER;
> +
> +///
> +/// The 8-bit Message Header of MCTP packet.
> +///
> +typedef union {
> +  struct {
> +UINT8MessageType   : 7;
> +UINT8ItegrityCheck : 1;
> +  } Bits;
> +  UINT8MessageHeader;
> +} MCTP_MESSAGE_HEADER;
> +
> +///
> +/// MCTP Control Commands
> +///
> +#define   MCTP_CONTROL_RESERVED0x00
> +#define   MCTP_CONTROL_SET_ENDPOINT_ID 0x01
> +#define   MCTP_CONTROL_GET_ENDPOINT_ID 0x02
> +#define   MCTP_CONTROL_GET_ENDPOINT_UUID   0x03
> +#define   MCTP_CONTROL_GET_MCTP_VERSION_SUPPORT0x04
> +#define   MCTP_CONTROL_GET_MESSAGE_TYPE_SUPPORT0x05
> +#define   MCTP_CONTROL_GET_VENDOR_DEFINED_MESSAGE_SUPPORT  0x06
> +#define   MCTP_CONTROL_RESOLVE_ENDPOINT_ID 0x07
> +#define   MCTP_CONTROL_ALLOCATE_ENDPOINT_IDS   0x08
> +#define   MCTP_CONTROL_ROUTING_INFORMATION_UPDATE  0x09
> +#define   MCTP_CONTROL_GET_ROUTINE_TABLE_ENTRIES   0x0A
> +#define   MCTP_CONTROL_PREPARE_FOR_ENDPOINT_DISCOVERY  0x0B
> +#define   MCTP_CONTROL_ENDPOINT_DISCOVERY  0x0C
> +#define   MCTP_CONTROL_DISCOVERY_NOTIFY0x0D
> +#define   MCTP_CONTROL_GET_NETWORK_ID  0x0E
> +#define   MCTP_CONTROL_QUERY_HOP   0x0F
> +#define   MCTP_CONTROL_RESOLVE_UUID0x10
> +#define   MCTP_CONTROL_QUERY_RATE_LIMIT0x11
> +#define   MCTP_CONTROL_REQUEST_TX_RATE_LIMIT   0x12
> +#define   MCTP_CONTROL_UPDATE_RATE_LIMIT   0x13
> +#define