2 * Copyright 2018 Advanced Micro Devices, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
27 /* Responses have bit 31 set */
28 #define RSP_ID_MASK (1U << 31)
29 #define RSP_ID(cmdId) (((uint32_t)(cmdId)) | RSP_ID_MASK)
31 enum ta_command_xgmi
{
32 TA_COMMAND_XGMI__INITIALIZE
= 0x00,
33 TA_COMMAND_XGMI__GET_NODE_ID
= 0x01,
34 TA_COMMAND_XGMI__GET_HIVE_ID
= 0x02,
35 TA_COMMAND_XGMI__GET_GET_TOPOLOGY_INFO
= 0x03,
36 TA_COMMAND_XGMI__SET_TOPOLOGY_INFO
= 0x04
39 /* XGMI related enumerations */
40 /**********************************************************/;
41 enum ta_xgmi_connected_nodes
{
42 TA_XGMI__MAX_CONNECTED_NODES
= 64
46 TA_XGMI_STATUS__SUCCESS
= 0x00,
47 TA_XGMI_STATUS__GENERIC_FAILURE
= 0x01,
48 TA_XGMI_STATUS__NULL_POINTER
= 0x02,
49 TA_XGMI_STATUS__INVALID_PARAMETER
= 0x03,
50 TA_XGMI_STATUS__NOT_INITIALIZED
= 0x04,
51 TA_XGMI_STATUS__INVALID_NODE_NUM
= 0x05,
52 TA_XGMI_STATUS__INVALID_NODE_ID
= 0x06,
53 TA_XGMI_STATUS__INVALID_TOPOLOGY
= 0x07,
54 TA_XGMI_STATUS__FAILED_ID_GEN
= 0x08,
55 TA_XGMI_STATUS__FAILED_TOPOLOGY_INIT
= 0x09,
56 TA_XGMI_STATUS__SET_SHARING_ERROR
= 0x0A
59 enum ta_xgmi_assigned_sdma_engine
{
60 TA_XGMI_ASSIGNED_SDMA_ENGINE__NOT_ASSIGNED
= -1,
61 TA_XGMI_ASSIGNED_SDMA_ENGINE__SDMA0
= 0,
62 TA_XGMI_ASSIGNED_SDMA_ENGINE__SDMA1
= 1,
63 TA_XGMI_ASSIGNED_SDMA_ENGINE__SDMA2
= 2,
64 TA_XGMI_ASSIGNED_SDMA_ENGINE__SDMA3
= 3,
65 TA_XGMI_ASSIGNED_SDMA_ENGINE__SDMA4
= 4,
66 TA_XGMI_ASSIGNED_SDMA_ENGINE__SDMA5
= 5
69 /* input/output structures for XGMI commands */
70 /**********************************************************/
71 struct ta_xgmi_node_info
{
74 uint8_t is_sharing_enabled
;
75 enum ta_xgmi_assigned_sdma_engine sdma_engine
;
78 struct ta_xgmi_cmd_initialize_output
{
82 struct ta_xgmi_cmd_get_node_id_output
{
86 struct ta_xgmi_cmd_get_hive_id_output
{
90 struct ta_xgmi_cmd_get_topology_info_input
{
92 struct ta_xgmi_node_info nodes
[TA_XGMI__MAX_CONNECTED_NODES
];
95 struct ta_xgmi_cmd_get_topology_info_output
{
97 struct ta_xgmi_node_info nodes
[TA_XGMI__MAX_CONNECTED_NODES
];
100 struct ta_xgmi_cmd_set_topology_info_input
{
102 struct ta_xgmi_node_info nodes
[TA_XGMI__MAX_CONNECTED_NODES
];
105 /**********************************************************/
106 /* Common input structure for XGMI callbacks */
107 union ta_xgmi_cmd_input
{
108 struct ta_xgmi_cmd_get_topology_info_input get_topology_info
;
109 struct ta_xgmi_cmd_set_topology_info_input set_topology_info
;
112 /* Common output structure for XGMI callbacks */
113 union ta_xgmi_cmd_output
{
114 struct ta_xgmi_cmd_initialize_output initialize
;
115 struct ta_xgmi_cmd_get_node_id_output get_node_id
;
116 struct ta_xgmi_cmd_get_hive_id_output get_hive_id
;
117 struct ta_xgmi_cmd_get_topology_info_output get_topology_info
;
119 /**********************************************************/
121 struct ta_xgmi_shared_memory
{
124 enum ta_xgmi_status xgmi_status
;
126 union ta_xgmi_cmd_input xgmi_in_message
;
127 union ta_xgmi_cmd_output xgmi_out_message
;
130 #endif //_TA_XGMI_IF_H