15fc3aeebSyanyang1 /*
25fc3aeebSyanyang1  * Copyright 2015 Advanced Micro Devices, Inc.
35fc3aeebSyanyang1  *
45fc3aeebSyanyang1  * Permission is hereby granted, free of charge, to any person obtaining a
55fc3aeebSyanyang1  * copy of this software and associated documentation files (the "Software"),
65fc3aeebSyanyang1  * to deal in the Software without restriction, including without limitation
75fc3aeebSyanyang1  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
85fc3aeebSyanyang1  * and/or sell copies of the Software, and to permit persons to whom the
95fc3aeebSyanyang1  * Software is furnished to do so, subject to the following conditions:
105fc3aeebSyanyang1  *
115fc3aeebSyanyang1  * The above copyright notice and this permission notice shall be included in
125fc3aeebSyanyang1  * all copies or substantial portions of the Software.
135fc3aeebSyanyang1  *
145fc3aeebSyanyang1  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
155fc3aeebSyanyang1  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
165fc3aeebSyanyang1  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
175fc3aeebSyanyang1  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
185fc3aeebSyanyang1  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
195fc3aeebSyanyang1  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
205fc3aeebSyanyang1  * OTHER DEALINGS IN THE SOFTWARE.
215fc3aeebSyanyang1  */
225fc3aeebSyanyang1 
235fc3aeebSyanyang1 #ifndef __AMD_SHARED_H__
245fc3aeebSyanyang1 #define __AMD_SHARED_H__
255fc3aeebSyanyang1 
26f674bd28SAkshu Agrawal #include <drm/amd_asic_type.h>
270b2daf09SJammy Zhou 
28cfa289fdSRex Zhu 
29617a64dcSEvan Quan #define AMD_MAX_USEC_TIMEOUT		1000000  /* 1000 ms */
302f7d10b3SJammy Zhou 
312f7d10b3SJammy Zhou /*
322f7d10b3SJammy Zhou  * Chip flags
332f7d10b3SJammy Zhou  */
342f7d10b3SJammy Zhou enum amd_chip_flags {
352f7d10b3SJammy Zhou 	AMD_ASIC_MASK = 0x0000ffffUL,
362f7d10b3SJammy Zhou 	AMD_FLAGS_MASK  = 0xffff0000UL,
372f7d10b3SJammy Zhou 	AMD_IS_MOBILITY = 0x00010000UL,
382f7d10b3SJammy Zhou 	AMD_IS_APU      = 0x00020000UL,
392f7d10b3SJammy Zhou 	AMD_IS_PX       = 0x00040000UL,
402f7d10b3SJammy Zhou 	AMD_EXP_HW_SUPPORT = 0x00080000UL,
412f7d10b3SJammy Zhou };
422f7d10b3SJammy Zhou 
4354f78a76SAlex Deucher enum amd_apu_flags {
4454f78a76SAlex Deucher 	AMD_APU_IS_RAVEN = 0x00000001UL,
4554f78a76SAlex Deucher 	AMD_APU_IS_RAVEN2 = 0x00000002UL,
4654f78a76SAlex Deucher 	AMD_APU_IS_PICASSO = 0x00000004UL,
4754f78a76SAlex Deucher 	AMD_APU_IS_RENOIR = 0x00000008UL,
48d205c3ccSAlex Deucher 	AMD_APU_IS_GREEN_SARDINE = 0x00000010UL,
49c345c89bSHuang Rui 	AMD_APU_IS_VANGOGH = 0x00000020UL,
50d0f56dc2STao Zhou 	AMD_APU_IS_CYAN_SKILLFISH2 = 0x00000040UL,
5154f78a76SAlex Deucher };
5254f78a76SAlex Deucher 
5352ef3a1aSRyan Taylor /**
5452ef3a1aSRyan Taylor * DOC: IP Blocks
5552ef3a1aSRyan Taylor *
5652ef3a1aSRyan Taylor * GPUs are composed of IP (intellectual property) blocks. These
5752ef3a1aSRyan Taylor * IP blocks provide various functionalities: display, graphics,
5852ef3a1aSRyan Taylor * video decode, etc. The IP blocks that comprise a particular GPU
5952ef3a1aSRyan Taylor * are listed in the GPU's respective SoC file. amdgpu_device.c
6052ef3a1aSRyan Taylor * acquires the list of IP blocks for the GPU in use on initialization.
6152ef3a1aSRyan Taylor * It can then operate on this list to perform standard driver operations
6252ef3a1aSRyan Taylor * such as: init, fini, suspend, resume, etc.
6352ef3a1aSRyan Taylor *
6452ef3a1aSRyan Taylor *
6552ef3a1aSRyan Taylor * IP block implementations are named using the following convention:
6652ef3a1aSRyan Taylor * <functionality>_v<version> (E.g.: gfx_v6_0).
6752ef3a1aSRyan Taylor */
6852ef3a1aSRyan Taylor 
6952ef3a1aSRyan Taylor /**
7052ef3a1aSRyan Taylor * enum amd_ip_block_type - Used to classify IP blocks by functionality.
7152ef3a1aSRyan Taylor *
7252ef3a1aSRyan Taylor * @AMD_IP_BLOCK_TYPE_COMMON: GPU Family
7352ef3a1aSRyan Taylor * @AMD_IP_BLOCK_TYPE_GMC: Graphics Memory Controller
7452ef3a1aSRyan Taylor * @AMD_IP_BLOCK_TYPE_IH: Interrupt Handler
7552ef3a1aSRyan Taylor * @AMD_IP_BLOCK_TYPE_SMC: System Management Controller
7652ef3a1aSRyan Taylor * @AMD_IP_BLOCK_TYPE_PSP: Platform Security Processor
7752ef3a1aSRyan Taylor * @AMD_IP_BLOCK_TYPE_DCE: Display and Compositing Engine
7852ef3a1aSRyan Taylor * @AMD_IP_BLOCK_TYPE_GFX: Graphics and Compute Engine
7952ef3a1aSRyan Taylor * @AMD_IP_BLOCK_TYPE_SDMA: System DMA Engine
8052ef3a1aSRyan Taylor * @AMD_IP_BLOCK_TYPE_UVD: Unified Video Decoder
8152ef3a1aSRyan Taylor * @AMD_IP_BLOCK_TYPE_VCE: Video Compression Engine
8252ef3a1aSRyan Taylor * @AMD_IP_BLOCK_TYPE_ACP: Audio Co-Processor
8352ef3a1aSRyan Taylor * @AMD_IP_BLOCK_TYPE_VCN: Video Core/Codec Next
8452ef3a1aSRyan Taylor * @AMD_IP_BLOCK_TYPE_MES: Micro-Engine Scheduler
8552ef3a1aSRyan Taylor * @AMD_IP_BLOCK_TYPE_JPEG: JPEG Engine
8652ef3a1aSRyan Taylor */
875fc3aeebSyanyang1 enum amd_ip_block_type {
885fc3aeebSyanyang1 	AMD_IP_BLOCK_TYPE_COMMON,
895fc3aeebSyanyang1 	AMD_IP_BLOCK_TYPE_GMC,
905fc3aeebSyanyang1 	AMD_IP_BLOCK_TYPE_IH,
915fc3aeebSyanyang1 	AMD_IP_BLOCK_TYPE_SMC,
920e5ca0d1SHuang Rui 	AMD_IP_BLOCK_TYPE_PSP,
935fc3aeebSyanyang1 	AMD_IP_BLOCK_TYPE_DCE,
945fc3aeebSyanyang1 	AMD_IP_BLOCK_TYPE_GFX,
955fc3aeebSyanyang1 	AMD_IP_BLOCK_TYPE_SDMA,
965fc3aeebSyanyang1 	AMD_IP_BLOCK_TYPE_UVD,
975fc3aeebSyanyang1 	AMD_IP_BLOCK_TYPE_VCE,
98a8fe58ceSMaruthi Bayyavarapu 	AMD_IP_BLOCK_TYPE_ACP,
99886f82aaSJack Xiao 	AMD_IP_BLOCK_TYPE_VCN,
1008d1b04a6SLeo Liu 	AMD_IP_BLOCK_TYPE_MES,
1018d1b04a6SLeo Liu 	AMD_IP_BLOCK_TYPE_JPEG
1025fc3aeebSyanyang1 };
1035fc3aeebSyanyang1 
1045fc3aeebSyanyang1 enum amd_clockgating_state {
1055fc3aeebSyanyang1 	AMD_CG_STATE_GATE = 0,
1065fc3aeebSyanyang1 	AMD_CG_STATE_UNGATE,
1075fc3aeebSyanyang1 };
1085fc3aeebSyanyang1 
109e5d03ac2SRex Zhu 
1105fc3aeebSyanyang1 enum amd_powergating_state {
1115fc3aeebSyanyang1 	AMD_PG_STATE_GATE = 0,
1125fc3aeebSyanyang1 	AMD_PG_STATE_UNGATE,
1135fc3aeebSyanyang1 };
1145fc3aeebSyanyang1 
115cfa289fdSRex Zhu 
116e3b04bc7SAlex Deucher /* CG flags */
117e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_GFX_MGCG			(1 << 0)
118e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_GFX_MGLS			(1 << 1)
119e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_GFX_CGCG			(1 << 2)
120e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_GFX_CGLS			(1 << 3)
121e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_GFX_CGTS			(1 << 4)
122e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_GFX_CGTS_LS		(1 << 5)
123e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_GFX_CP_LS		(1 << 6)
124e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_GFX_RLC_LS		(1 << 7)
125e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_MC_LS			(1 << 8)
126e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_MC_MGCG			(1 << 9)
127e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_SDMA_LS			(1 << 10)
128e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_SDMA_MGCG		(1 << 11)
129e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_BIF_LS			(1 << 12)
130e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_UVD_MGCG			(1 << 13)
131e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_VCE_MGCG			(1 << 14)
132e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_HDP_LS			(1 << 15)
133e3b04bc7SAlex Deucher #define AMD_CG_SUPPORT_HDP_MGCG			(1 << 16)
1344fae91c5SAlex Deucher #define AMD_CG_SUPPORT_ROM_MGCG			(1 << 17)
135398d82ccSRex Zhu #define AMD_CG_SUPPORT_DRM_LS			(1 << 18)
136398d82ccSRex Zhu #define AMD_CG_SUPPORT_BIF_MGCG			(1 << 19)
137398d82ccSRex Zhu #define AMD_CG_SUPPORT_GFX_3D_CGCG		(1 << 20)
138398d82ccSRex Zhu #define AMD_CG_SUPPORT_GFX_3D_CGLS		(1 << 21)
139e929c98dSHuang Rui #define AMD_CG_SUPPORT_DRM_MGCG			(1 << 22)
140c773a632SHuang Rui #define AMD_CG_SUPPORT_DF_MGCG			(1 << 23)
1418dbb8cdfSRex Zhu #define AMD_CG_SUPPORT_VCN_MGCG			(1 << 24)
142714ff852SHawking Zhang #define AMD_CG_SUPPORT_HDP_DS			(1 << 25)
143714ff852SHawking Zhang #define AMD_CG_SUPPORT_HDP_SD			(1 << 26)
1449faa494eSHawking Zhang #define AMD_CG_SUPPORT_IH_CG			(1 << 27)
145367adb2aSJack Xiao #define AMD_CG_SUPPORT_ATHUB_LS			(1 << 28)
146367adb2aSJack Xiao #define AMD_CG_SUPPORT_ATHUB_MGCG		(1 << 29)
14718e6d414SLeo Liu #define AMD_CG_SUPPORT_JPEG_MGCG		(1 << 30)
148adf16996SJinzhou.Su #define AMD_CG_SUPPORT_GFX_FGCG			(1 << 31)
149e3b04bc7SAlex Deucher /* PG flags */
150e3b04bc7SAlex Deucher #define AMD_PG_SUPPORT_GFX_PG			(1 << 0)
151e3b04bc7SAlex Deucher #define AMD_PG_SUPPORT_GFX_SMG			(1 << 1)
152e3b04bc7SAlex Deucher #define AMD_PG_SUPPORT_GFX_DMG			(1 << 2)
153e3b04bc7SAlex Deucher #define AMD_PG_SUPPORT_UVD			(1 << 3)
154e3b04bc7SAlex Deucher #define AMD_PG_SUPPORT_VCE			(1 << 4)
155e3b04bc7SAlex Deucher #define AMD_PG_SUPPORT_CP			(1 << 5)
156e3b04bc7SAlex Deucher #define AMD_PG_SUPPORT_GDS			(1 << 6)
157e3b04bc7SAlex Deucher #define AMD_PG_SUPPORT_RLC_SMU_HS		(1 << 7)
158e3b04bc7SAlex Deucher #define AMD_PG_SUPPORT_SDMA			(1 << 8)
159e3b04bc7SAlex Deucher #define AMD_PG_SUPPORT_ACP			(1 << 9)
160e3b04bc7SAlex Deucher #define AMD_PG_SUPPORT_SAMU			(1 << 10)
1616b0432b7SAlex Deucher #define AMD_PG_SUPPORT_GFX_QUICK_MG		(1 << 11)
1626b0432b7SAlex Deucher #define AMD_PG_SUPPORT_GFX_PIPELINE		(1 << 12)
163f8386b35SHawking Zhang #define AMD_PG_SUPPORT_MMHUB			(1 << 13)
1648dbb8cdfSRex Zhu #define AMD_PG_SUPPORT_VCN			(1 << 14)
165f28ff062SJames Zhu #define AMD_PG_SUPPORT_VCN_DPG			(1 << 15)
166a201b6acSHuang Rui #define AMD_PG_SUPPORT_ATHUB			(1 << 16)
16718e6d414SLeo Liu #define AMD_PG_SUPPORT_JPEG			(1 << 17)
168e3b04bc7SAlex Deucher 
169549750a3SRyan Taylor /**
170549750a3SRyan Taylor  * enum PP_FEATURE_MASK - Used to mask power play features.
171549750a3SRyan Taylor  *
172549750a3SRyan Taylor  * @PP_SCLK_DPM_MASK: Dynamic adjustment of the system (graphics) clock.
173549750a3SRyan Taylor  * @PP_MCLK_DPM_MASK: Dynamic adjustment of the memory clock.
174549750a3SRyan Taylor  * @PP_PCIE_DPM_MASK: Dynamic adjustment of PCIE clocks and lanes.
175549750a3SRyan Taylor  * @PP_SCLK_DEEP_SLEEP_MASK: System (graphics) clock deep sleep.
176549750a3SRyan Taylor  * @PP_POWER_CONTAINMENT_MASK: Power containment.
177549750a3SRyan Taylor  * @PP_UVD_HANDSHAKE_MASK: Unified video decoder handshake.
178549750a3SRyan Taylor  * @PP_SMC_VOLTAGE_CONTROL_MASK: Dynamic voltage control.
179549750a3SRyan Taylor  * @PP_VBI_TIME_SUPPORT_MASK: Vertical blank interval support.
180549750a3SRyan Taylor  * @PP_ULV_MASK: Ultra low voltage.
181549750a3SRyan Taylor  * @PP_ENABLE_GFX_CG_THRU_SMU: SMU control of GFX engine clockgating.
182549750a3SRyan Taylor  * @PP_CLOCK_STRETCH_MASK: Clock stretching.
183549750a3SRyan Taylor  * @PP_OD_FUZZY_FAN_CONTROL_MASK: Overdrive fuzzy fan control.
184549750a3SRyan Taylor  * @PP_SOCCLK_DPM_MASK: Dynamic adjustment of the SoC clock.
185549750a3SRyan Taylor  * @PP_DCEFCLK_DPM_MASK: Dynamic adjustment of the Display Controller Engine Fabric clock.
186549750a3SRyan Taylor  * @PP_OVERDRIVE_MASK: Over- and under-clocking support.
187549750a3SRyan Taylor  * @PP_GFXOFF_MASK: Dynamic graphics engine power control.
188549750a3SRyan Taylor  * @PP_ACG_MASK: Adaptive clock generator.
189549750a3SRyan Taylor  * @PP_STUTTER_MODE: Stutter mode.
190549750a3SRyan Taylor  * @PP_AVFS_MASK: Adaptive voltage and frequency scaling.
191549750a3SRyan Taylor  *
192549750a3SRyan Taylor  * To override these settings on boot, append amdgpu.ppfeaturemask=<mask> to
193549750a3SRyan Taylor  * the kernel's command line parameters. This is usually done through a system's
194549750a3SRyan Taylor  * boot loader (E.g. GRUB). If manually loading the driver, pass
195549750a3SRyan Taylor  * ppfeaturemask=<mask> as a modprobe parameter.
196549750a3SRyan Taylor  */
197fa7bd27dSHuang Rui enum PP_FEATURE_MASK {
198fa7bd27dSHuang Rui 	PP_SCLK_DPM_MASK = 0x1,
199fa7bd27dSHuang Rui 	PP_MCLK_DPM_MASK = 0x2,
200fa7bd27dSHuang Rui 	PP_PCIE_DPM_MASK = 0x4,
201fa7bd27dSHuang Rui 	PP_SCLK_DEEP_SLEEP_MASK = 0x8,
202fa7bd27dSHuang Rui 	PP_POWER_CONTAINMENT_MASK = 0x10,
203fa7bd27dSHuang Rui 	PP_UVD_HANDSHAKE_MASK = 0x20,
204fa7bd27dSHuang Rui 	PP_SMC_VOLTAGE_CONTROL_MASK = 0x40,
205fa7bd27dSHuang Rui 	PP_VBI_TIME_SUPPORT_MASK = 0x80,
206fa7bd27dSHuang Rui 	PP_ULV_MASK = 0x100,
207fa7bd27dSHuang Rui 	PP_ENABLE_GFX_CG_THRU_SMU = 0x200,
208fa7bd27dSHuang Rui 	PP_CLOCK_STRETCH_MASK = 0x400,
209fa7bd27dSHuang Rui 	PP_OD_FUZZY_FAN_CONTROL_MASK = 0x800,
210fa7bd27dSHuang Rui 	PP_SOCCLK_DPM_MASK = 0x1000,
211fa7bd27dSHuang Rui 	PP_DCEFCLK_DPM_MASK = 0x2000,
212fa7bd27dSHuang Rui 	PP_OVERDRIVE_MASK = 0x4000,
2136f92ad2aSHuang Rui 	PP_GFXOFF_MASK = 0x8000,
214fa7bd27dSHuang Rui 	PP_ACG_MASK = 0x10000,
21522994e16Srex zhu 	PP_STUTTER_MODE = 0x20000,
216a4ead3e5SAlex Deucher 	PP_AVFS_MASK = 0x40000,
217680602d6SKenneth Feng 	PP_GFX_DCS_MASK = 0x80000,
218fa7bd27dSHuang Rui };
219fa7bd27dSHuang Rui 
22083a0b863SLikun GAO enum amd_harvest_ip_mask {
22183a0b863SLikun GAO     AMD_HARVEST_IP_VCN_MASK = 0x1,
22283a0b863SLikun GAO     AMD_HARVEST_IP_JPEG_MASK = 0x2,
22383a0b863SLikun GAO     AMD_HARVEST_IP_DMU_MASK = 0x4,
22483a0b863SLikun GAO };
22583a0b863SLikun GAO 
2267875a226SAlex Deucher enum DC_FEATURE_MASK {
227a5148245SZhan Liu 	//Default value can be found at "uint amdgpu_dc_feature_mask"
228a5148245SZhan Liu 	DC_FBC_MASK = (1 << 0), //0x1, disabled by default
229a5148245SZhan Liu 	DC_MULTI_MON_PP_MCLK_SWITCH_MASK = (1 << 1), //0x2, enabled by default
230a5148245SZhan Liu 	DC_DISABLE_FRACTIONAL_PWM_MASK = (1 << 2), //0x4, disabled by default
231*9470620eSNicholas Kazlauskas 	DC_PSR_MASK = (1 << 3), //0x8, disabled by default for dcn < 3.1
232a5148245SZhan Liu 	DC_EDP_NO_POWER_SEQUENCING = (1 << 4), //0x10, disabled by default
2337875a226SAlex Deucher };
2347875a226SAlex Deucher 
2358a791dabSHarry Wentland enum DC_DEBUG_MASK {
2368a791dabSHarry Wentland 	DC_DISABLE_PIPE_SPLIT = 0x1,
2378a791dabSHarry Wentland 	DC_DISABLE_STUTTER = 0x2,
2388a791dabSHarry Wentland 	DC_DISABLE_DSC = 0x4,
239*9470620eSNicholas Kazlauskas 	DC_DISABLE_CLOCK_GATING = 0x8,
240*9470620eSNicholas Kazlauskas 	DC_DISABLE_PSR = 0x10,
2418a791dabSHarry Wentland };
2428a791dabSHarry Wentland 
24349d27e91SChengming Gui enum amd_dpm_forced_level;
24452ef3a1aSRyan Taylor 
24543911fb6SDarren Powell /**
24643911fb6SDarren Powell  * struct amd_ip_funcs - general hooks for managing amdgpu IP Blocks
24752ef3a1aSRyan Taylor  * @name: Name of IP block
24852ef3a1aSRyan Taylor  * @early_init: sets up early driver state (pre sw_init),
24952ef3a1aSRyan Taylor  *              does not configure hw - Optional
25052ef3a1aSRyan Taylor  * @late_init: sets up late driver/hw state (post hw_init) - Optional
25152ef3a1aSRyan Taylor  * @sw_init: sets up driver state, does not configure hw
25252ef3a1aSRyan Taylor  * @sw_fini: tears down driver state, does not configure hw
253e9669fb7SAndrey Grodzovsky  * @early_fini: tears down stuff before dev detached from driver
25452ef3a1aSRyan Taylor  * @hw_init: sets up the hw state
25552ef3a1aSRyan Taylor  * @hw_fini: tears down the hw state
25652ef3a1aSRyan Taylor  * @late_fini: final cleanup
25752ef3a1aSRyan Taylor  * @suspend: handles IP specific hw/sw changes for suspend
25852ef3a1aSRyan Taylor  * @resume: handles IP specific hw/sw changes for resume
25952ef3a1aSRyan Taylor  * @is_idle: returns current IP block idle status
26052ef3a1aSRyan Taylor  * @wait_for_idle: poll for idle
26152ef3a1aSRyan Taylor  * @check_soft_reset: check soft reset the IP block
26252ef3a1aSRyan Taylor  * @pre_soft_reset: pre soft reset the IP block
26352ef3a1aSRyan Taylor  * @soft_reset: soft reset the IP block
26452ef3a1aSRyan Taylor  * @post_soft_reset: post soft reset the IP block
26552ef3a1aSRyan Taylor  * @set_clockgating_state: enable/disable cg for the IP block
26652ef3a1aSRyan Taylor  * @set_powergating_state: enable/disable pg for the IP block
26752ef3a1aSRyan Taylor  * @get_clockgating_state: get current clockgating status
26852ef3a1aSRyan Taylor  * @enable_umd_pstate: enable UMD powerstate
26952ef3a1aSRyan Taylor  *
27052ef3a1aSRyan Taylor  * These hooks provide an interface for controlling the operational state
27152ef3a1aSRyan Taylor  * of IP blocks. After acquiring a list of IP blocks for the GPU in use,
27252ef3a1aSRyan Taylor  * the driver can make chip-wide state changes by walking this list and
27352ef3a1aSRyan Taylor  * making calls to hooks from each IP block. This list is ordered to ensure
27452ef3a1aSRyan Taylor  * that the driver initializes the IP blocks in a safe sequence.
27543911fb6SDarren Powell  */
2765fc3aeebSyanyang1 struct amd_ip_funcs {
27788a907d6STom St Denis 	char *name;
2785fc3aeebSyanyang1 	int (*early_init)(void *handle);
2795fc3aeebSyanyang1 	int (*late_init)(void *handle);
2805fc3aeebSyanyang1 	int (*sw_init)(void *handle);
2815fc3aeebSyanyang1 	int (*sw_fini)(void *handle);
282e9669fb7SAndrey Grodzovsky 	int (*early_fini)(void *handle);
2835fc3aeebSyanyang1 	int (*hw_init)(void *handle);
2845fc3aeebSyanyang1 	int (*hw_fini)(void *handle);
285212cb3b6SMonk Liu 	void (*late_fini)(void *handle);
2865fc3aeebSyanyang1 	int (*suspend)(void *handle);
2875fc3aeebSyanyang1 	int (*resume)(void *handle);
2885fc3aeebSyanyang1 	bool (*is_idle)(void *handle);
2895fc3aeebSyanyang1 	int (*wait_for_idle)(void *handle);
290da146d3bSAlex Deucher 	bool (*check_soft_reset)(void *handle);
291d31a501eSChunming Zhou 	int (*pre_soft_reset)(void *handle);
2925fc3aeebSyanyang1 	int (*soft_reset)(void *handle);
29335d782feSChunming Zhou 	int (*post_soft_reset)(void *handle);
2945fc3aeebSyanyang1 	int (*set_clockgating_state)(void *handle,
2955fc3aeebSyanyang1 				     enum amd_clockgating_state state);
2965fc3aeebSyanyang1 	int (*set_powergating_state)(void *handle,
2975fc3aeebSyanyang1 				     enum amd_powergating_state state);
2986cb2d4e4SHuang Rui 	void (*get_clockgating_state)(void *handle, u32 *flags);
29949d27e91SChengming Gui 	int (*enable_umd_pstate)(void *handle, enum amd_dpm_forced_level *level);
3005fc3aeebSyanyang1 };
3015fc3aeebSyanyang1 
302f93f0c3aSRex Zhu 
3035fc3aeebSyanyang1 #endif /* __AMD_SHARED_H__ */
304