summaryrefslogtreecommitdiff
path: root/ManageabilityPkg/PrivateInclude/Library/ManageabilityTransportMctpLib.h
blob: ab34eea8a1d8ce9b8097e35b59c9fd68a5be399c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/** @file

  This file defines the manageability MCTP protocol specific transport data.

  Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.<BR>
  SPDX-License-Identifier: BSD-2-Clause-Patent
**/

#pragma once

#include <Library/ManageabilityTransportLib.h>

#define MCTP_KCS_HEADER_VERSION  0x01

// According to SMBUS spec, the polynomial is:
// C(x) = X^8 + X^2 + X^1 + 1, which is 0x107,
// just ignore bit8 in definition.
#define MCTP_KCS_PACKET_ERROR_CODE_POLY  0x07

///
/// The MCTP Message header which is apart from
/// the payload.
///

typedef struct {
  UINT8    IntegrityCheck : 1; ///< Message integrity check.
  UINT8    MessageType    : 7; ///< Message type.
} MANAGEABILITY_MCTP_MESSAGE_HEADER;

typedef struct {
  UINT8                                SourceEndpointId;
  UINT8                                DestinationEndpointId;
  MANAGEABILITY_MCTP_MESSAGE_HEADER    MessageHeader;
} MANAGEABILITY_MCTP_TRANSPORT_HEADER;

typedef struct {
  UINT8    NetFunc;      ///< Message integrity check.
  UINT8    DefiningBody; ///< Message type.
  UINT8    ByteCount;    ///< Byte count of payload.
} MANAGEABILITY_MCTP_KCS_HEADER;

typedef struct {
  UINT8    Pec;  ///< MCTP over KCS Packet Error Code.
} MANAGEABILITY_MCTP_KCS_TRAILER;

#define MCTP_KCS_NETFN_LUN                       0xb0
#define DEFINING_BODY_DMTF_PRE_OS_WORKING_GROUP  0x01

// This is used to track the response message. This value
// is not defined by the specification.
#define MCTP_MESSAGE_TAG  0x1

#define MCTP_MESSAGE_TAG_OWNER_REQUEST   1
#define MCTP_MESSAGE_TAG_OWNER_RESPONSE  0

#define MCTP_PACKET_SEQUENCE_MASK  0x3