1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /* Copyright (c) 2024 NVIDIA Corporation & Affiliates */
3
4 #ifndef MLX5HWS_DEBUG_H_
5 #define MLX5HWS_DEBUG_H_
6
7 #define HWS_DEBUG_FORMAT_VERSION "1.0"
8
9 #define HWS_PTR_TO_ID(p) ((u64)(uintptr_t)(p) & 0xFFFFFFFFULL)
10
11 enum mlx5hws_debug_res_type {
12 MLX5HWS_DEBUG_RES_TYPE_CONTEXT = 4000,
13 MLX5HWS_DEBUG_RES_TYPE_CONTEXT_ATTR = 4001,
14 MLX5HWS_DEBUG_RES_TYPE_CONTEXT_CAPS = 4002,
15 MLX5HWS_DEBUG_RES_TYPE_CONTEXT_SEND_ENGINE = 4003,
16 MLX5HWS_DEBUG_RES_TYPE_CONTEXT_SEND_RING = 4004,
17 MLX5HWS_DEBUG_RES_TYPE_CONTEXT_STC = 4005,
18
19 MLX5HWS_DEBUG_RES_TYPE_TABLE = 4100,
20
21 MLX5HWS_DEBUG_RES_TYPE_MATCHER = 4200,
22 MLX5HWS_DEBUG_RES_TYPE_MATCHER_ATTR = 4201,
23 MLX5HWS_DEBUG_RES_TYPE_MATCHER_MATCH_TEMPLATE = 4202,
24 MLX5HWS_DEBUG_RES_TYPE_MATCHER_TEMPLATE_MATCH_DEFINER = 4203,
25 MLX5HWS_DEBUG_RES_TYPE_MATCHER_ACTION_TEMPLATE = 4204,
26 MLX5HWS_DEBUG_RES_TYPE_MATCHER_TEMPLATE_HASH_DEFINER = 4205,
27 MLX5HWS_DEBUG_RES_TYPE_MATCHER_TEMPLATE_RANGE_DEFINER = 4206,
28 MLX5HWS_DEBUG_RES_TYPE_MATCHER_TEMPLATE_COMPARE_MATCH_DEFINER = 4207,
29 };
30
31 static inline u64
mlx5hws_debug_icm_to_idx(u64 icm_addr)32 mlx5hws_debug_icm_to_idx(u64 icm_addr)
33 {
34 return (icm_addr >> 6) & 0xffffffff;
35 }
36
37 void mlx5hws_debug_init_dump(struct mlx5hws_context *ctx);
38 void mlx5hws_debug_uninit_dump(struct mlx5hws_context *ctx);
39
40 #endif /* MLX5HWS_DEBUG_H_ */
41