2 * Copyright 2014 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 F32_MES_PM4_PACKETS_H
25 #define F32_MES_PM4_PACKETS_H
27 #ifndef PM4_MES_HEADER_DEFINED
28 #define PM4_MES_HEADER_DEFINED
29 union PM4_MES_TYPE_3_HEADER
{
31 uint32_t reserved1
: 8; /* < reserved */
32 uint32_t opcode
: 8; /* < IT opcode */
33 uint32_t count
: 14;/* < number of DWORDs - 1 in the
35 uint32_t type
: 2; /* < packet identifier.
36 It should be 3 for type 3 packets */
40 #endif /* PM4_MES_HEADER_DEFINED */
42 /*--------------------MES_SET_RESOURCES--------------------*/
44 #ifndef PM4_MES_SET_RESOURCES_DEFINED
45 #define PM4_MES_SET_RESOURCES_DEFINED
46 enum mes_set_resources_queue_type_enum
{
47 queue_type__mes_set_resources__kernel_interface_queue_kiq
= 0,
48 queue_type__mes_set_resources__hsa_interface_queue_hiq
= 1,
49 queue_type__mes_set_resources__hsa_debug_interface_queue
= 4
53 struct pm4_mes_set_resources
{
55 union PM4_MES_TYPE_3_HEADER header
; /* header */
61 uint32_t vmid_mask
:16;
62 uint32_t unmap_latency
:8;
64 enum mes_set_resources_queue_type_enum queue_type
:3;
69 uint32_t queue_mask_lo
;
70 uint32_t queue_mask_hi
;
77 uint32_t reserved2
:16;
84 uint32_t gds_heap_base
:6;
86 uint32_t gds_heap_size
:6;
87 uint32_t reserved4
:15;
95 /*--------------------MES_RUN_LIST--------------------*/
97 #ifndef PM4_MES_RUN_LIST_DEFINED
98 #define PM4_MES_RUN_LIST_DEFINED
100 struct pm4_mes_runlist
{
102 union PM4_MES_TYPE_3_HEADER header
; /* header */
108 uint32_t reserved1
:2;
109 uint32_t ib_base_lo
:30;
116 uint32_t ib_base_hi
:16;
117 uint32_t reserved2
:16;
126 uint32_t offload_polling
:1;
127 uint32_t reserved3
:1;
129 uint32_t reserved4
:8;
137 /*--------------------MES_MAP_PROCESS--------------------*/
139 #ifndef PM4_MES_MAP_PROCESS_DEFINED
140 #define PM4_MES_MAP_PROCESS_DEFINED
142 struct pm4_mes_map_process
{
144 union PM4_MES_TYPE_3_HEADER header
; /* header */
151 uint32_t reserved1
:8;
152 uint32_t diq_enable
:1;
153 uint32_t process_quantum
:7;
160 uint32_t page_table_base
:28;
161 uint32_t reserved2
:4;
166 uint32_t sh_mem_bases
;
167 uint32_t sh_mem_ape1_base
;
168 uint32_t sh_mem_ape1_limit
;
169 uint32_t sh_mem_config
;
170 uint32_t gds_addr_lo
;
171 uint32_t gds_addr_hi
;
176 uint32_t reserved3
:2;
178 uint32_t reserved4
:4;
180 uint32_t num_queues
:10;
188 /*--------------------MES_MAP_QUEUES--------------------*/
190 #ifndef PM4_MES_MAP_QUEUES_VI_DEFINED
191 #define PM4_MES_MAP_QUEUES_VI_DEFINED
192 enum mes_map_queues_queue_sel_vi_enum
{
193 queue_sel__mes_map_queues__map_to_specified_queue_slots_vi
= 0,
194 queue_sel__mes_map_queues__map_to_hws_determined_queue_slots_vi
= 1
197 enum mes_map_queues_queue_type_vi_enum
{
198 queue_type__mes_map_queues__normal_compute_vi
= 0,
199 queue_type__mes_map_queues__debug_interface_queue_vi
= 1,
200 queue_type__mes_map_queues__normal_latency_static_queue_vi
= 2,
201 queue_type__mes_map_queues__low_latency_static_queue_vi
= 3
204 enum mes_map_queues_alloc_format_vi_enum
{
205 alloc_format__mes_map_queues__one_per_pipe_vi
= 0,
206 alloc_format__mes_map_queues__all_on_one_pipe_vi
= 1
209 enum mes_map_queues_engine_sel_vi_enum
{
210 engine_sel__mes_map_queues__compute_vi
= 0,
211 engine_sel__mes_map_queues__sdma0_vi
= 2,
212 engine_sel__mes_map_queues__sdma1_vi
= 3
216 struct pm4_mes_map_queues
{
218 union PM4_MES_TYPE_3_HEADER header
; /* header */
224 uint32_t reserved1
:4;
225 enum mes_map_queues_queue_sel_vi_enum queue_sel
:2;
226 uint32_t reserved2
:15;
227 enum mes_map_queues_queue_type_vi_enum queue_type
:3;
228 enum mes_map_queues_alloc_format_vi_enum alloc_format
:2;
229 enum mes_map_queues_engine_sel_vi_enum engine_sel
:3;
230 uint32_t num_queues
:3;
237 uint32_t reserved3
:1;
238 uint32_t check_disable
:1;
239 uint32_t doorbell_offset
:21;
240 uint32_t reserved4
:3;
246 uint32_t mqd_addr_lo
;
247 uint32_t mqd_addr_hi
;
248 uint32_t wptr_addr_lo
;
249 uint32_t wptr_addr_hi
;
253 /*--------------------MES_QUERY_STATUS--------------------*/
255 #ifndef PM4_MES_QUERY_STATUS_DEFINED
256 #define PM4_MES_QUERY_STATUS_DEFINED
257 enum mes_query_status_interrupt_sel_enum
{
258 interrupt_sel__mes_query_status__completion_status
= 0,
259 interrupt_sel__mes_query_status__process_status
= 1,
260 interrupt_sel__mes_query_status__queue_status
= 2
263 enum mes_query_status_command_enum
{
264 command__mes_query_status__interrupt_only
= 0,
265 command__mes_query_status__fence_only_immediate
= 1,
266 command__mes_query_status__fence_only_after_write_ack
= 2,
267 command__mes_query_status__fence_wait_for_write_ack_send_interrupt
= 3
270 enum mes_query_status_engine_sel_enum
{
271 engine_sel__mes_query_status__compute
= 0,
272 engine_sel__mes_query_status__sdma0_queue
= 2,
273 engine_sel__mes_query_status__sdma1_queue
= 3
276 struct pm4_mes_query_status
{
278 union PM4_MES_TYPE_3_HEADER header
; /* header */
284 uint32_t context_id
:28;
285 enum mes_query_status_interrupt_sel_enum
287 enum mes_query_status_command_enum command
:2;
295 uint32_t reserved1
:16;
298 uint32_t reserved2
:2;
299 uint32_t doorbell_offset
:21;
300 uint32_t reserved3
:2;
301 enum mes_query_status_engine_sel_enum engine_sel
:3;
302 uint32_t reserved4
:4;
314 /*--------------------MES_UNMAP_QUEUES--------------------*/
316 #ifndef PM4_MES_UNMAP_QUEUES_DEFINED
317 #define PM4_MES_UNMAP_QUEUES_DEFINED
318 enum mes_unmap_queues_action_enum
{
319 action__mes_unmap_queues__preempt_queues
= 0,
320 action__mes_unmap_queues__reset_queues
= 1,
321 action__mes_unmap_queues__disable_process_queues
= 2,
322 action__mes_unmap_queues__reserved
= 3
325 enum mes_unmap_queues_queue_sel_enum
{
326 queue_sel__mes_unmap_queues__perform_request_on_specified_queues
= 0,
327 queue_sel__mes_unmap_queues__perform_request_on_pasid_queues
= 1,
328 queue_sel__mes_unmap_queues__unmap_all_queues
= 2,
329 queue_sel__mes_unmap_queues__unmap_all_non_static_queues
= 3
332 enum mes_unmap_queues_engine_sel_enum
{
333 engine_sel__mes_unmap_queues__compute
= 0,
334 engine_sel__mes_unmap_queues__sdma0
= 2,
335 engine_sel__mes_unmap_queues__sdmal
= 3
338 struct PM4_MES_UNMAP_QUEUES
{
340 union PM4_MES_TYPE_3_HEADER header
; /* header */
346 enum mes_unmap_queues_action_enum action
:2;
347 uint32_t reserved1
:2;
348 enum mes_unmap_queues_queue_sel_enum queue_sel
:2;
349 uint32_t reserved2
:20;
350 enum mes_unmap_queues_engine_sel_enum engine_sel
:3;
351 uint32_t num_queues
:3;
359 uint32_t reserved3
:16;
362 uint32_t reserved4
:2;
363 uint32_t doorbell_offset0
:21;
364 uint32_t reserved5
:9;
371 uint32_t reserved6
:2;
372 uint32_t doorbell_offset1
:21;
373 uint32_t reserved7
:9;
380 uint32_t reserved8
:2;
381 uint32_t doorbell_offset2
:21;
382 uint32_t reserved9
:9;
389 uint32_t reserved10
:2;
390 uint32_t doorbell_offset3
:21;
391 uint32_t reserved11
:9;