Wiktor Gołgowski | ba6727e | 2020-03-13 18:25:01 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */ |
| 2 | #ifndef _LIBMCTP_CMDS_H |
| 3 | #define _LIBMCTP_CMDS_H |
| 4 | |
| 5 | #ifdef __cplusplus |
| 6 | extern "C" { |
| 7 | #endif |
| 8 | |
| 9 | #include "libmctp.h" |
| 10 | |
| 11 | /* |
| 12 | * Helper structs and functions for MCTP control messages. |
| 13 | * See DSP0236 v1.3.0 sec. 11 for reference. |
| 14 | */ |
| 15 | |
| 16 | struct mctp_ctrl_msg_hdr { |
| 17 | uint8_t ic_msg_type; |
| 18 | uint8_t rq_dgram_inst; |
| 19 | uint8_t command_code; |
| 20 | uint8_t completion_code; |
| 21 | }; |
| 22 | |
Andrew Jeffery | 8737538 | 2020-06-19 17:20:17 +0930 | [diff] [blame] | 23 | #define MCTP_CTRL_HDR_MSG_TYPE 0 |
| 24 | #define MCTP_CTRL_HDR_FLAG_REQUEST (1 << 7) |
| 25 | #define MCTP_CTRL_HDR_FLAG_DGRAM (1 << 6) |
Wiktor Gołgowski | ba6727e | 2020-03-13 18:25:01 +0100 | [diff] [blame] | 26 | #define MCTP_CTRL_HDR_INSTANCE_ID_MASK 0x1F |
| 27 | |
| 28 | /* |
| 29 | * MCTP Control Command IDs |
| 30 | * See DSP0236 v1.3.0 Table 12. |
| 31 | */ |
Andrew Jeffery | 8737538 | 2020-06-19 17:20:17 +0930 | [diff] [blame] | 32 | #define MCTP_CTRL_CMD_RESERVED 0x00 |
| 33 | #define MCTP_CTRL_CMD_SET_ENDPOINT_ID 0x01 |
| 34 | #define MCTP_CTRL_CMD_GET_ENDPOINT_ID 0x02 |
| 35 | #define MCTP_CTRL_CMD_GET_ENDPOINT_UUID 0x03 |
| 36 | #define MCTP_CTRL_CMD_GET_VERSION_SUPPORT 0x04 |
| 37 | #define MCTP_CTRL_CMD_GET_MESSAGE_TYPE_SUPPORT 0x05 |
Wiktor Gołgowski | ba6727e | 2020-03-13 18:25:01 +0100 | [diff] [blame] | 38 | #define MCTP_CTRL_CMD_GET_VENDOR_MESSAGE_SUPPORT 0x06 |
Andrew Jeffery | 8737538 | 2020-06-19 17:20:17 +0930 | [diff] [blame] | 39 | #define MCTP_CTRL_CMD_RESOLVE_ENDPOINT_ID 0x07 |
| 40 | #define MCTP_CTRL_CMD_ALLOCATE_ENDPOINT_IDS 0x08 |
| 41 | #define MCTP_CTRL_CMD_ROUTING_INFO_UPDATE 0x09 |
| 42 | #define MCTP_CTRL_CMD_GET_ROUTING_TABLE_ENTRIES 0x0A |
Wiktor Gołgowski | ba6727e | 2020-03-13 18:25:01 +0100 | [diff] [blame] | 43 | #define MCTP_CTRL_CMD_PREPARE_ENDPOINT_DISCOVERY 0x0B |
Andrew Jeffery | 8737538 | 2020-06-19 17:20:17 +0930 | [diff] [blame] | 44 | #define MCTP_CTRL_CMD_ENDPOINT_DISCOVERY 0x0C |
| 45 | #define MCTP_CTRL_CMD_DISCOVERY_NOTIFY 0x0D |
| 46 | #define MCTP_CTRL_CMD_GET_NETWORK_ID 0x0E |
| 47 | #define MCTP_CTRL_CMD_QUERY_HOP 0x0F |
| 48 | #define MCTP_CTRL_CMD_RESOLVE_UUID 0x10 |
| 49 | #define MCTP_CTRL_CMD_QUERY_RATE_LIMIT 0x11 |
| 50 | #define MCTP_CTRL_CMD_REQUEST_TX_RATE_LIMIT 0x12 |
| 51 | #define MCTP_CTRL_CMD_UPDATE_RATE_LIMIT 0x13 |
Wiktor Gołgowski | ba6727e | 2020-03-13 18:25:01 +0100 | [diff] [blame] | 52 | #define MCTP_CTRL_CMD_QUERY_SUPPORTED_INTERFACES 0x14 |
Andrew Jeffery | 8737538 | 2020-06-19 17:20:17 +0930 | [diff] [blame] | 53 | #define MCTP_CTRL_CMD_MAX 0x15 |
Wiktor Gołgowski | ba6727e | 2020-03-13 18:25:01 +0100 | [diff] [blame] | 54 | /* 0xF0 - 0xFF are transport specific */ |
| 55 | #define MCTP_CTRL_CMD_FIRST_TRANSPORT 0xF0 |
Andrew Jeffery | 8737538 | 2020-06-19 17:20:17 +0930 | [diff] [blame] | 56 | #define MCTP_CTRL_CMD_LAST_TRANSPORT 0xFF |
Wiktor Gołgowski | ba6727e | 2020-03-13 18:25:01 +0100 | [diff] [blame] | 57 | |
| 58 | /* |
| 59 | * MCTP Control Completion Codes |
| 60 | * See DSP0236 v1.3.0 Table 13. |
| 61 | */ |
Andrew Jeffery | 8737538 | 2020-06-19 17:20:17 +0930 | [diff] [blame] | 62 | #define MCTP_CTRL_CC_SUCCESS 0x00 |
| 63 | #define MCTP_CTRL_CC_ERROR 0x01 |
| 64 | #define MCTP_CTRL_CC_ERROR_INVALID_DATA 0x02 |
| 65 | #define MCTP_CTRL_CC_ERROR_INVALID_LENGTH 0x03 |
| 66 | #define MCTP_CTRL_CC_ERROR_NOT_READY 0x04 |
Wiktor Gołgowski | ba6727e | 2020-03-13 18:25:01 +0100 | [diff] [blame] | 67 | #define MCTP_CTRL_CC_ERROR_UNSUPPORTED_CMD 0x05 |
| 68 | /* 0x80 - 0xFF are command specific */ |
| 69 | |
| 70 | #ifdef __cplusplus |
| 71 | } |
| 72 | #endif |
| 73 | |
| 74 | #endif /* _LIBMCTP_CMDS_H */ |