3 * Copyright 2014 Advanced Micro Devices, Inc.
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 * OTHER DEALINGS IN THE SOFTWARE.
25 #ifndef __AMDGPU_RLC_H__
26 #define __AMDGPU_RLC_H__
28 #include "clearstate_defs.h"
30 struct amdgpu_rlc_funcs {
31 void (*enter_safe_mode)(struct amdgpu_device *adev);
32 void (*exit_safe_mode)(struct amdgpu_device *adev);
33 int (*init)(struct amdgpu_device *adev);
34 int (*resume)(struct amdgpu_device *adev);
35 void (*stop)(struct amdgpu_device *adev);
36 void (*reset)(struct amdgpu_device *adev);
37 void (*start)(struct amdgpu_device *adev);
41 /* for power gating */
42 struct amdgpu_bo *save_restore_obj;
43 uint64_t save_restore_gpu_addr;
44 volatile uint32_t *sr_ptr;
48 struct amdgpu_bo *clear_state_obj;
49 uint64_t clear_state_gpu_addr;
50 volatile uint32_t *cs_ptr;
51 const struct cs_section_def *cs_data;
54 struct amdgpu_bo *cp_table_obj;
55 uint64_t cp_table_gpu_addr;
56 volatile uint32_t *cp_table_ptr;
59 /* safe mode for updating CG/PG state */
61 const struct amdgpu_rlc_funcs *funcs;
63 /* for firmware data */
64 u32 save_and_restore_offset;
65 u32 clear_state_descriptor_offset;
66 u32 avail_scratch_ram_locations;
67 u32 reg_restore_list_size;
68 u32 reg_list_format_start;
69 u32 reg_list_format_separate_start;
70 u32 starting_offsets_start;
71 u32 reg_list_format_size_bytes;
72 u32 reg_list_size_bytes;
73 u32 reg_list_format_direct_reg_list_length;
74 u32 save_restore_list_cntl_size_bytes;
75 u32 save_restore_list_gpm_size_bytes;
76 u32 save_restore_list_srm_size_bytes;
78 u32 *register_list_format;
79 u32 *register_restore;
80 u8 *save_restore_list_cntl;
81 u8 *save_restore_list_gpm;
82 u8 *save_restore_list_srm;
87 void amdgpu_gfx_rlc_fini(struct amdgpu_device *adev);