xref: /linux/drivers/gpu/drm/amd/amdgpu/amdgpu_vf_error.h (revision e9f0878c4b2004ac19581274c1ae4c61ae3ca70e)
1 /*
2  * Copyright 2017 Advanced Micro Devices, Inc.
3  *
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:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
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.
21  *
22  */
23 
24 #ifndef __VF_ERROR_H__
25 #define __VF_ERROR_H__
26 
27 #define AMDGIM_ERROR_CODE_FLAGS_TO_MAILBOX(c,f)    (((c & 0xFFFF) << 16) | (f & 0xFFFF))
28 #define AMDGIM_ERROR_CODE(t,c)       (((t&0xF)<<12)|(c&0xFFF))
29 
30 /* Please keep enum same as AMD GIM driver */
31 enum AMDGIM_ERROR_VF {
32 	AMDGIM_ERROR_VF_ATOMBIOS_INIT_FAIL = 0,
33 	AMDGIM_ERROR_VF_NO_VBIOS,
34 	AMDGIM_ERROR_VF_GPU_POST_ERROR,
35 	AMDGIM_ERROR_VF_ATOMBIOS_GET_CLOCK_FAIL,
36 	AMDGIM_ERROR_VF_FENCE_INIT_FAIL,
37 
38 	AMDGIM_ERROR_VF_AMDGPU_INIT_FAIL,
39 	AMDGIM_ERROR_VF_IB_INIT_FAIL,
40 	AMDGIM_ERROR_VF_AMDGPU_LATE_INIT_FAIL,
41 	AMDGIM_ERROR_VF_ASIC_RESUME_FAIL,
42 	AMDGIM_ERROR_VF_GPU_RESET_FAIL,
43 
44 	AMDGIM_ERROR_VF_TEST,
45 	AMDGIM_ERROR_VF_MAX
46 };
47 
48 enum AMDGIM_ERROR_CATEGORY {
49 	AMDGIM_ERROR_CATEGORY_NON_USED = 0,
50 	AMDGIM_ERROR_CATEGORY_GIM,
51 	AMDGIM_ERROR_CATEGORY_PF,
52 	AMDGIM_ERROR_CATEGORY_VF,
53 	AMDGIM_ERROR_CATEGORY_VBIOS,
54 	AMDGIM_ERROR_CATEGORY_MONITOR,
55 
56 	AMDGIM_ERROR_CATEGORY_MAX
57 };
58 
59 void amdgpu_vf_error_put(struct amdgpu_device *adev,
60 			 uint16_t sub_error_code,
61 			 uint16_t error_flags,
62 			 uint64_t error_data);
63 void amdgpu_vf_error_trans_all (struct amdgpu_device *adev);
64 
65 #endif /* __VF_ERROR_H__ */
66