1 /*	$NetBSD: amdgpu_vf_error.h,v 1.2 2021/12/18 23:44:58 riastradh Exp $	*/
2 
3 /*
4  * Copyright 2017 Advanced Micro Devices, Inc.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the
11  * Software is furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
20  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22  * OTHER DEALINGS IN THE SOFTWARE.
23  *
24  */
25 
26 #ifndef __VF_ERROR_H__
27 #define __VF_ERROR_H__
28 
29 #define AMDGIM_ERROR_CODE_FLAGS_TO_MAILBOX(c,f)    (((c & 0xFFFF) << 16) | (f & 0xFFFF))
30 #define AMDGIM_ERROR_CODE(t,c)       (((t&0xF)<<12)|(c&0xFFF))
31 
32 /* Please keep enum same as AMD GIM driver */
33 enum AMDGIM_ERROR_VF {
34 	AMDGIM_ERROR_VF_ATOMBIOS_INIT_FAIL = 0,
35 	AMDGIM_ERROR_VF_NO_VBIOS,
36 	AMDGIM_ERROR_VF_GPU_POST_ERROR,
37 	AMDGIM_ERROR_VF_ATOMBIOS_GET_CLOCK_FAIL,
38 	AMDGIM_ERROR_VF_FENCE_INIT_FAIL,
39 
40 	AMDGIM_ERROR_VF_AMDGPU_INIT_FAIL,
41 	AMDGIM_ERROR_VF_IB_INIT_FAIL,
42 	AMDGIM_ERROR_VF_AMDGPU_LATE_INIT_FAIL,
43 	AMDGIM_ERROR_VF_ASIC_RESUME_FAIL,
44 	AMDGIM_ERROR_VF_GPU_RESET_FAIL,
45 
46 	AMDGIM_ERROR_VF_TEST,
47 	AMDGIM_ERROR_VF_MAX
48 };
49 
50 enum AMDGIM_ERROR_CATEGORY {
51 	AMDGIM_ERROR_CATEGORY_NON_USED = 0,
52 	AMDGIM_ERROR_CATEGORY_GIM,
53 	AMDGIM_ERROR_CATEGORY_PF,
54 	AMDGIM_ERROR_CATEGORY_VF,
55 	AMDGIM_ERROR_CATEGORY_VBIOS,
56 	AMDGIM_ERROR_CATEGORY_MONITOR,
57 
58 	AMDGIM_ERROR_CATEGORY_MAX
59 };
60 
61 void amdgpu_vf_error_put(struct amdgpu_device *adev,
62 			 uint16_t sub_error_code,
63 			 uint16_t error_flags,
64 			 uint64_t error_data);
65 void amdgpu_vf_error_trans_all (struct amdgpu_device *adev);
66 
67 #endif /* __VF_ERROR_H__ */
68