2 * Copyright 2019 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.
24 #ifndef __AMDGPU_MES_H__
25 #define __AMDGPU_MES_H__
27 struct amdgpu_mes_funcs
;
30 struct amdgpu_adev
*adev
;
32 const struct firmware
*fw
;
35 struct amdgpu_bo
*ucode_fw_obj
;
36 uint64_t ucode_fw_gpu_addr
;
37 uint32_t *ucode_fw_ptr
;
38 uint32_t ucode_fw_version
;
39 uint64_t uc_start_addr
;
42 struct amdgpu_bo
*data_fw_obj
;
43 uint64_t data_fw_gpu_addr
;
44 uint32_t *data_fw_ptr
;
45 uint32_t data_fw_version
;
46 uint64_t data_start_addr
;
48 /* ip specific functions */
49 struct amdgpu_mes_funcs
*funcs
;
52 struct mes_add_queue_input
{
54 uint64_t page_table_base_addr
;
55 uint64_t process_va_start
;
56 uint64_t process_va_end
;
57 uint64_t process_quantum
;
58 uint64_t process_context_addr
;
59 uint64_t gang_quantum
;
60 uint64_t gang_context_addr
;
61 uint32_t inprocess_gang_priority
;
62 uint32_t gang_global_priority_level
;
63 uint32_t doorbell_offset
;
70 struct mes_remove_queue_input
{
71 uint32_t doorbell_offset
;
72 uint64_t gang_context_addr
;
75 struct mes_suspend_gang_input
{
76 bool suspend_all_gangs
;
77 uint64_t gang_context_addr
;
78 uint64_t suspend_fence_addr
;
79 uint32_t suspend_fence_value
;
82 struct mes_resume_gang_input
{
83 bool resume_all_gangs
;
84 uint64_t gang_context_addr
;
87 struct amdgpu_mes_funcs
{
88 int (*add_hw_queue
)(struct amdgpu_mes
*mes
,
89 struct mes_add_queue_input
*input
);
91 int (*remove_hw_queue
)(struct amdgpu_mes
*mes
,
92 struct mes_remove_queue_input
*input
);
94 int (*suspend_gang
)(struct amdgpu_mes
*mes
,
95 struct mes_suspend_gang_input
*input
);
97 int (*resume_gang
)(struct amdgpu_mes
*mes
,
98 struct mes_resume_gang_input
*input
);
101 #endif /* __AMDGPU_MES_H__ */