Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: rename amdgpu_ip_funcs to amd_ip_funcs (v2)

The structure is renamed and moved to amd_shared.h to make
the component independent. This makes it easier to add
new components in the future.

v2: fix include path

Reviewed-by: Jammy Zhou <Jammy.Zhou@amd.com>
Signed-off-by: yanyang1 <young.yang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

yanyang1 and committed by
Alex Deucher
5fc3aeeb dcc357e6

+1079 -719
+2 -1
drivers/gpu/drm/amd/amdgpu/Makefile
··· 2 2 # Makefile for the drm device driver. This driver provides support for the 3 3 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. 4 4 5 - ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/amd/include/asic_reg 5 + ccflags-y := -Iinclude/drm -Idrivers/gpu/drm/amd/include/asic_reg \ 6 + -Idrivers/gpu/drm/amd/include 6 7 7 8 amdgpu-y := amdgpu_drv.o 8 9
+9 -66
drivers/gpu/drm/amd/amdgpu/amdgpu.h
··· 44 44 45 45 #include <drm/drm_gem.h> 46 46 47 + #include "amd_shared.h" 47 48 #include "amdgpu_family.h" 48 49 #include "amdgpu_mode.h" 49 50 #include "amdgpu_ih.h" ··· 206 205 AMDGPU_THERMAL_IRQ_LAST 207 206 }; 208 207 209 - /* 210 - * IP block functions 211 - */ 212 - enum amdgpu_ip_block_type { 213 - AMDGPU_IP_BLOCK_TYPE_COMMON, 214 - AMDGPU_IP_BLOCK_TYPE_GMC, 215 - AMDGPU_IP_BLOCK_TYPE_IH, 216 - AMDGPU_IP_BLOCK_TYPE_SMC, 217 - AMDGPU_IP_BLOCK_TYPE_DCE, 218 - AMDGPU_IP_BLOCK_TYPE_GFX, 219 - AMDGPU_IP_BLOCK_TYPE_SDMA, 220 - AMDGPU_IP_BLOCK_TYPE_UVD, 221 - AMDGPU_IP_BLOCK_TYPE_VCE, 222 - }; 223 - 224 - enum amdgpu_clockgating_state { 225 - AMDGPU_CG_STATE_GATE = 0, 226 - AMDGPU_CG_STATE_UNGATE, 227 - }; 228 - 229 - enum amdgpu_powergating_state { 230 - AMDGPU_PG_STATE_GATE = 0, 231 - AMDGPU_PG_STATE_UNGATE, 232 - }; 233 - 234 - struct amdgpu_ip_funcs { 235 - /* sets up early driver state (pre sw_init), does not configure hw - Optional */ 236 - int (*early_init)(struct amdgpu_device *adev); 237 - /* sets up late driver/hw state (post hw_init) - Optional */ 238 - int (*late_init)(struct amdgpu_device *adev); 239 - /* sets up driver state, does not configure hw */ 240 - int (*sw_init)(struct amdgpu_device *adev); 241 - /* tears down driver state, does not configure hw */ 242 - int (*sw_fini)(struct amdgpu_device *adev); 243 - /* sets up the hw state */ 244 - int (*hw_init)(struct amdgpu_device *adev); 245 - /* tears down the hw state */ 246 - int (*hw_fini)(struct amdgpu_device *adev); 247 - /* handles IP specific hw/sw changes for suspend */ 248 - int (*suspend)(struct amdgpu_device *adev); 249 - /* handles IP specific hw/sw changes for resume */ 250 - int (*resume)(struct amdgpu_device *adev); 251 - /* returns current IP block idle status */ 252 - bool (*is_idle)(struct amdgpu_device *adev); 253 - /* poll for idle */ 254 - int (*wait_for_idle)(struct amdgpu_device *adev); 255 - /* soft reset the IP block */ 256 - int (*soft_reset)(struct amdgpu_device *adev); 257 - /* dump the IP block status registers */ 258 - void (*print_status)(struct amdgpu_device *adev); 259 - /* enable/disable cg for the IP block */ 260 - int (*set_clockgating_state)(struct amdgpu_device *adev, 261 - enum amdgpu_clockgating_state state); 262 - /* enable/disable pg for the IP block */ 263 - int (*set_powergating_state)(struct amdgpu_device *adev, 264 - enum amdgpu_powergating_state state); 265 - }; 266 - 267 208 int amdgpu_set_clockgating_state(struct amdgpu_device *adev, 268 - enum amdgpu_ip_block_type block_type, 269 - enum amdgpu_clockgating_state state); 209 + enum amd_ip_block_type block_type, 210 + enum amd_clockgating_state state); 270 211 int amdgpu_set_powergating_state(struct amdgpu_device *adev, 271 - enum amdgpu_ip_block_type block_type, 272 - enum amdgpu_powergating_state state); 212 + enum amd_ip_block_type block_type, 213 + enum amd_powergating_state state); 273 214 274 215 struct amdgpu_ip_block_version { 275 - enum amdgpu_ip_block_type type; 216 + enum amd_ip_block_type type; 276 217 u32 major; 277 218 u32 minor; 278 219 u32 rev; 279 - const struct amdgpu_ip_funcs *funcs; 220 + const struct amd_ip_funcs *funcs; 280 221 }; 281 222 282 223 int amdgpu_ip_block_version_cmp(struct amdgpu_device *adev, 283 - enum amdgpu_ip_block_type type, 224 + enum amd_ip_block_type type, 284 225 u32 major, u32 minor); 285 226 286 227 const struct amdgpu_ip_block_version * amdgpu_get_ip_block( 287 228 struct amdgpu_device *adev, 288 - enum amdgpu_ip_block_type type); 229 + enum amd_ip_block_type type); 289 230 290 231 /* provided by hw blocks that can move/clear data. e.g., gfx or sdma */ 291 232 struct amdgpu_buffer_funcs {
+25 -25
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
··· 1081 1081 }; 1082 1082 1083 1083 int amdgpu_set_clockgating_state(struct amdgpu_device *adev, 1084 - enum amdgpu_ip_block_type block_type, 1085 - enum amdgpu_clockgating_state state) 1084 + enum amd_ip_block_type block_type, 1085 + enum amd_clockgating_state state) 1086 1086 { 1087 1087 int i, r = 0; 1088 1088 1089 1089 for (i = 0; i < adev->num_ip_blocks; i++) { 1090 1090 if (adev->ip_blocks[i].type == block_type) { 1091 - r = adev->ip_blocks[i].funcs->set_clockgating_state(adev, 1091 + r = adev->ip_blocks[i].funcs->set_clockgating_state((void *)adev, 1092 1092 state); 1093 1093 if (r) 1094 1094 return r; ··· 1098 1098 } 1099 1099 1100 1100 int amdgpu_set_powergating_state(struct amdgpu_device *adev, 1101 - enum amdgpu_ip_block_type block_type, 1102 - enum amdgpu_powergating_state state) 1101 + enum amd_ip_block_type block_type, 1102 + enum amd_powergating_state state) 1103 1103 { 1104 1104 int i, r = 0; 1105 1105 1106 1106 for (i = 0; i < adev->num_ip_blocks; i++) { 1107 1107 if (adev->ip_blocks[i].type == block_type) { 1108 - r = adev->ip_blocks[i].funcs->set_powergating_state(adev, 1108 + r = adev->ip_blocks[i].funcs->set_powergating_state((void *)adev, 1109 1109 state); 1110 1110 if (r) 1111 1111 return r; ··· 1116 1116 1117 1117 const struct amdgpu_ip_block_version * amdgpu_get_ip_block( 1118 1118 struct amdgpu_device *adev, 1119 - enum amdgpu_ip_block_type type) 1119 + enum amd_ip_block_type type) 1120 1120 { 1121 1121 int i; 1122 1122 ··· 1131 1131 * amdgpu_ip_block_version_cmp 1132 1132 * 1133 1133 * @adev: amdgpu_device pointer 1134 - * @type: enum amdgpu_ip_block_type 1134 + * @type: enum amd_ip_block_type 1135 1135 * @major: major version 1136 1136 * @minor: minor version 1137 1137 * ··· 1139 1139 * return 1 if smaller or the ip_block doesn't exist 1140 1140 */ 1141 1141 int amdgpu_ip_block_version_cmp(struct amdgpu_device *adev, 1142 - enum amdgpu_ip_block_type type, 1142 + enum amd_ip_block_type type, 1143 1143 u32 major, u32 minor) 1144 1144 { 1145 1145 const struct amdgpu_ip_block_version *ip_block; ··· 1204 1204 adev->ip_block_enabled[i] = false; 1205 1205 } else { 1206 1206 if (adev->ip_blocks[i].funcs->early_init) { 1207 - r = adev->ip_blocks[i].funcs->early_init(adev); 1207 + r = adev->ip_blocks[i].funcs->early_init((void *)adev); 1208 1208 if (r) 1209 1209 return r; 1210 1210 } ··· 1222 1222 for (i = 0; i < adev->num_ip_blocks; i++) { 1223 1223 if (!adev->ip_block_enabled[i]) 1224 1224 continue; 1225 - r = adev->ip_blocks[i].funcs->sw_init(adev); 1225 + r = adev->ip_blocks[i].funcs->sw_init((void *)adev); 1226 1226 if (r) 1227 1227 return r; 1228 1228 /* need to do gmc hw init early so we can allocate gpu mem */ 1229 - if (adev->ip_blocks[i].type == AMDGPU_IP_BLOCK_TYPE_GMC) { 1229 + if (adev->ip_blocks[i].type == AMD_IP_BLOCK_TYPE_GMC) { 1230 1230 r = amdgpu_vram_scratch_init(adev); 1231 1231 if (r) 1232 1232 return r; 1233 - r = adev->ip_blocks[i].funcs->hw_init(adev); 1233 + r = adev->ip_blocks[i].funcs->hw_init((void *)adev); 1234 1234 if (r) 1235 1235 return r; 1236 1236 r = amdgpu_wb_init(adev); ··· 1243 1243 if (!adev->ip_block_enabled[i]) 1244 1244 continue; 1245 1245 /* gmc hw init is done early */ 1246 - if (adev->ip_blocks[i].type == AMDGPU_IP_BLOCK_TYPE_GMC) 1246 + if (adev->ip_blocks[i].type == AMD_IP_BLOCK_TYPE_GMC) 1247 1247 continue; 1248 - r = adev->ip_blocks[i].funcs->hw_init(adev); 1248 + r = adev->ip_blocks[i].funcs->hw_init((void *)adev); 1249 1249 if (r) 1250 1250 return r; 1251 1251 } ··· 1261 1261 if (!adev->ip_block_enabled[i]) 1262 1262 continue; 1263 1263 /* enable clockgating to save power */ 1264 - r = adev->ip_blocks[i].funcs->set_clockgating_state(adev, 1265 - AMDGPU_CG_STATE_GATE); 1264 + r = adev->ip_blocks[i].funcs->set_clockgating_state((void *)adev, 1265 + AMD_CG_STATE_GATE); 1266 1266 if (r) 1267 1267 return r; 1268 1268 if (adev->ip_blocks[i].funcs->late_init) { 1269 - r = adev->ip_blocks[i].funcs->late_init(adev); 1269 + r = adev->ip_blocks[i].funcs->late_init((void *)adev); 1270 1270 if (r) 1271 1271 return r; 1272 1272 } ··· 1282 1282 for (i = adev->num_ip_blocks - 1; i >= 0; i--) { 1283 1283 if (!adev->ip_block_enabled[i]) 1284 1284 continue; 1285 - if (adev->ip_blocks[i].type == AMDGPU_IP_BLOCK_TYPE_GMC) { 1285 + if (adev->ip_blocks[i].type == AMD_IP_BLOCK_TYPE_GMC) { 1286 1286 amdgpu_wb_fini(adev); 1287 1287 amdgpu_vram_scratch_fini(adev); 1288 1288 } 1289 1289 /* ungate blocks before hw fini so that we can shutdown the blocks safely */ 1290 - r = adev->ip_blocks[i].funcs->set_clockgating_state(adev, 1291 - AMDGPU_CG_STATE_UNGATE); 1290 + r = adev->ip_blocks[i].funcs->set_clockgating_state((void *)adev, 1291 + AMD_CG_STATE_UNGATE); 1292 1292 if (r) 1293 1293 return r; 1294 - r = adev->ip_blocks[i].funcs->hw_fini(adev); 1294 + r = adev->ip_blocks[i].funcs->hw_fini((void *)adev); 1295 1295 /* XXX handle errors */ 1296 1296 } 1297 1297 1298 1298 for (i = adev->num_ip_blocks - 1; i >= 0; i--) { 1299 1299 if (!adev->ip_block_enabled[i]) 1300 1300 continue; 1301 - r = adev->ip_blocks[i].funcs->sw_fini(adev); 1301 + r = adev->ip_blocks[i].funcs->sw_fini((void *)adev); 1302 1302 /* XXX handle errors */ 1303 1303 adev->ip_block_enabled[i] = false; 1304 1304 } ··· 1314 1314 if (!adev->ip_block_enabled[i]) 1315 1315 continue; 1316 1316 /* ungate blocks so that suspend can properly shut them down */ 1317 - r = adev->ip_blocks[i].funcs->set_clockgating_state(adev, 1318 - AMDGPU_CG_STATE_UNGATE); 1317 + r = adev->ip_blocks[i].funcs->set_clockgating_state((void *)adev, 1318 + AMD_CG_STATE_UNGATE); 1319 1319 /* XXX handle errors */ 1320 1320 r = adev->ip_blocks[i].funcs->suspend(adev); 1321 1321 /* XXX handle errors */
+12 -12
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
··· 186 186 return copy_to_user(out, &ui32, min(size, 4u)) ? -EFAULT : 0; 187 187 case AMDGPU_INFO_HW_IP_INFO: { 188 188 struct drm_amdgpu_info_hw_ip ip = {}; 189 - enum amdgpu_ip_block_type type; 189 + enum amd_ip_block_type type; 190 190 uint32_t ring_mask = 0; 191 191 192 192 if (info->query_hw_ip.ip_instance >= AMDGPU_HW_IP_INSTANCE_MAX_COUNT) ··· 194 194 195 195 switch (info->query_hw_ip.type) { 196 196 case AMDGPU_HW_IP_GFX: 197 - type = AMDGPU_IP_BLOCK_TYPE_GFX; 197 + type = AMD_IP_BLOCK_TYPE_GFX; 198 198 for (i = 0; i < adev->gfx.num_gfx_rings; i++) 199 199 ring_mask |= ((adev->gfx.gfx_ring[i].ready ? 1 : 0) << i); 200 200 break; 201 201 case AMDGPU_HW_IP_COMPUTE: 202 - type = AMDGPU_IP_BLOCK_TYPE_GFX; 202 + type = AMD_IP_BLOCK_TYPE_GFX; 203 203 for (i = 0; i < adev->gfx.num_compute_rings; i++) 204 204 ring_mask |= ((adev->gfx.compute_ring[i].ready ? 1 : 0) << i); 205 205 break; 206 206 case AMDGPU_HW_IP_DMA: 207 - type = AMDGPU_IP_BLOCK_TYPE_SDMA; 207 + type = AMD_IP_BLOCK_TYPE_SDMA; 208 208 ring_mask = adev->sdma[0].ring.ready ? 1 : 0; 209 209 ring_mask |= ((adev->sdma[1].ring.ready ? 1 : 0) << 1); 210 210 break; 211 211 case AMDGPU_HW_IP_UVD: 212 - type = AMDGPU_IP_BLOCK_TYPE_UVD; 212 + type = AMD_IP_BLOCK_TYPE_UVD; 213 213 ring_mask = adev->uvd.ring.ready ? 1 : 0; 214 214 break; 215 215 case AMDGPU_HW_IP_VCE: 216 - type = AMDGPU_IP_BLOCK_TYPE_VCE; 216 + type = AMD_IP_BLOCK_TYPE_VCE; 217 217 for (i = 0; i < AMDGPU_MAX_VCE_RINGS; i++) 218 218 ring_mask |= ((adev->vce.ring[i].ready ? 1 : 0) << i); 219 219 break; ··· 235 235 min((size_t)size, sizeof(ip))) ? -EFAULT : 0; 236 236 } 237 237 case AMDGPU_INFO_HW_IP_COUNT: { 238 - enum amdgpu_ip_block_type type; 238 + enum amd_ip_block_type type; 239 239 uint32_t count = 0; 240 240 241 241 switch (info->query_hw_ip.type) { 242 242 case AMDGPU_HW_IP_GFX: 243 - type = AMDGPU_IP_BLOCK_TYPE_GFX; 243 + type = AMD_IP_BLOCK_TYPE_GFX; 244 244 break; 245 245 case AMDGPU_HW_IP_COMPUTE: 246 - type = AMDGPU_IP_BLOCK_TYPE_GFX; 246 + type = AMD_IP_BLOCK_TYPE_GFX; 247 247 break; 248 248 case AMDGPU_HW_IP_DMA: 249 - type = AMDGPU_IP_BLOCK_TYPE_SDMA; 249 + type = AMD_IP_BLOCK_TYPE_SDMA; 250 250 break; 251 251 case AMDGPU_HW_IP_UVD: 252 - type = AMDGPU_IP_BLOCK_TYPE_UVD; 252 + type = AMD_IP_BLOCK_TYPE_UVD; 253 253 break; 254 254 case AMDGPU_HW_IP_VCE: 255 - type = AMDGPU_IP_BLOCK_TYPE_VCE; 255 + type = AMD_IP_BLOCK_TYPE_VCE; 256 256 break; 257 257 default: 258 258 return -EINVAL;
+1 -1
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
··· 185 185 } 186 186 187 187 /* from uvd v5.0 HW addressing capacity increased to 64 bits */ 188 - if (!amdgpu_ip_block_version_cmp(adev, AMDGPU_IP_BLOCK_TYPE_UVD, 5, 0)) 188 + if (!amdgpu_ip_block_version_cmp(adev, AMD_IP_BLOCK_TYPE_UVD, 5, 0)) 189 189 adev->uvd.address_64_bit = true; 190 190 191 191 return 0;
+36 -21
drivers/gpu/drm/amd/amdgpu/ci_dpm.c
··· 4227 4227 if (amdgpu_current_state->evclk != amdgpu_new_state->evclk) { 4228 4228 if (amdgpu_new_state->evclk) { 4229 4229 /* turn the clocks on when encoding */ 4230 - ret = amdgpu_set_clockgating_state(adev, AMDGPU_IP_BLOCK_TYPE_VCE, 4231 - AMDGPU_CG_STATE_UNGATE); 4230 + ret = amdgpu_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_VCE, 4231 + AMD_CG_STATE_UNGATE); 4232 4232 if (ret) 4233 4233 return ret; 4234 4234 ··· 4241 4241 ret = ci_enable_vce_dpm(adev, true); 4242 4242 } else { 4243 4243 /* turn the clocks off when not encoding */ 4244 - ret = amdgpu_set_clockgating_state(adev, AMDGPU_IP_BLOCK_TYPE_VCE, 4245 - AMDGPU_CG_STATE_GATE); 4244 + ret = amdgpu_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_VCE, 4245 + AMD_CG_STATE_GATE); 4246 4246 if (ret) 4247 4247 return ret; 4248 4248 ··· 6171 6171 return ret; 6172 6172 } 6173 6173 6174 - static int ci_dpm_early_init(struct amdgpu_device *adev) 6174 + static int ci_dpm_early_init(void *handle) 6175 6175 { 6176 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 6177 + 6176 6178 ci_dpm_set_dpm_funcs(adev); 6177 6179 ci_dpm_set_irq_funcs(adev); 6178 6180 6179 6181 return 0; 6180 6182 } 6181 6183 6182 - static int ci_dpm_late_init(struct amdgpu_device *adev) 6184 + static int ci_dpm_late_init(void *handle) 6183 6185 { 6184 6186 int ret; 6187 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 6185 6188 6186 6189 if (!amdgpu_dpm) 6187 6190 return 0; ··· 6198 6195 return 0; 6199 6196 } 6200 6197 6201 - static int ci_dpm_sw_init(struct amdgpu_device *adev) 6198 + static int ci_dpm_sw_init(void *handle) 6202 6199 { 6203 6200 int ret; 6201 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 6204 6202 6205 6203 ret = amdgpu_irq_add_id(adev, 230, &adev->pm.dpm.thermal.irq); 6206 6204 if (ret) ··· 6247 6243 return ret; 6248 6244 } 6249 6245 6250 - static int ci_dpm_sw_fini(struct amdgpu_device *adev) 6246 + static int ci_dpm_sw_fini(void *handle) 6251 6247 { 6248 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 6249 + 6252 6250 mutex_lock(&adev->pm.mutex); 6253 6251 amdgpu_pm_sysfs_fini(adev); 6254 6252 ci_dpm_fini(adev); ··· 6259 6253 return 0; 6260 6254 } 6261 6255 6262 - static int ci_dpm_hw_init(struct amdgpu_device *adev) 6256 + static int ci_dpm_hw_init(void *handle) 6263 6257 { 6264 6258 int ret; 6259 + 6260 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 6265 6261 6266 6262 if (!amdgpu_dpm) 6267 6263 return 0; ··· 6280 6272 return ret; 6281 6273 } 6282 6274 6283 - static int ci_dpm_hw_fini(struct amdgpu_device *adev) 6275 + static int ci_dpm_hw_fini(void *handle) 6284 6276 { 6277 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 6278 + 6285 6279 if (adev->pm.dpm_enabled) { 6286 6280 mutex_lock(&adev->pm.mutex); 6287 6281 ci_dpm_disable(adev); ··· 6293 6283 return 0; 6294 6284 } 6295 6285 6296 - static int ci_dpm_suspend(struct amdgpu_device *adev) 6286 + static int ci_dpm_suspend(void *handle) 6297 6287 { 6288 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 6289 + 6298 6290 if (adev->pm.dpm_enabled) { 6299 6291 mutex_lock(&adev->pm.mutex); 6300 6292 /* disable dpm */ ··· 6308 6296 return 0; 6309 6297 } 6310 6298 6311 - static int ci_dpm_resume(struct amdgpu_device *adev) 6299 + static int ci_dpm_resume(void *handle) 6312 6300 { 6313 6301 int ret; 6302 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 6314 6303 6315 6304 if (adev->pm.dpm_enabled) { 6316 6305 /* asic init will reset to the boot state */ ··· 6329 6316 return 0; 6330 6317 } 6331 6318 6332 - static bool ci_dpm_is_idle(struct amdgpu_device *adev) 6319 + static bool ci_dpm_is_idle(void *handle) 6333 6320 { 6334 6321 /* XXX */ 6335 6322 return true; 6336 6323 } 6337 6324 6338 - static int ci_dpm_wait_for_idle(struct amdgpu_device *adev) 6325 + static int ci_dpm_wait_for_idle(void *handle) 6339 6326 { 6340 6327 /* XXX */ 6341 6328 return 0; 6342 6329 } 6343 6330 6344 - static void ci_dpm_print_status(struct amdgpu_device *adev) 6331 + static void ci_dpm_print_status(void *handle) 6345 6332 { 6333 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 6334 + 6346 6335 dev_info(adev->dev, "CIK DPM registers\n"); 6347 6336 dev_info(adev->dev, " BIOS_SCRATCH_4=0x%08X\n", 6348 6337 RREG32(mmBIOS_SCRATCH_4)); ··· 6550 6535 RREG32_SMC(ixSMC_PC_C)); 6551 6536 } 6552 6537 6553 - static int ci_dpm_soft_reset(struct amdgpu_device *adev) 6538 + static int ci_dpm_soft_reset(void *handle) 6554 6539 { 6555 6540 return 0; 6556 6541 } ··· 6633 6618 return 0; 6634 6619 } 6635 6620 6636 - static int ci_dpm_set_clockgating_state(struct amdgpu_device *adev, 6637 - enum amdgpu_clockgating_state state) 6621 + static int ci_dpm_set_clockgating_state(void *handle, 6622 + enum amd_clockgating_state state) 6638 6623 { 6639 6624 return 0; 6640 6625 } 6641 6626 6642 - static int ci_dpm_set_powergating_state(struct amdgpu_device *adev, 6643 - enum amdgpu_powergating_state state) 6627 + static int ci_dpm_set_powergating_state(void *handle, 6628 + enum amd_powergating_state state) 6644 6629 { 6645 6630 return 0; 6646 6631 } 6647 6632 6648 - const struct amdgpu_ip_funcs ci_dpm_ip_funcs = { 6633 + const struct amd_ip_funcs ci_dpm_ip_funcs = { 6649 6634 .early_init = ci_dpm_early_init, 6650 6635 .late_init = ci_dpm_late_init, 6651 6636 .sw_init = ci_dpm_sw_init,
+69 -61
drivers/gpu/drm/amd/amdgpu/cik.c
··· 1892 1892 { 1893 1893 /* ORDER MATTERS! */ 1894 1894 { 1895 - .type = AMDGPU_IP_BLOCK_TYPE_COMMON, 1895 + .type = AMD_IP_BLOCK_TYPE_COMMON, 1896 1896 .major = 1, 1897 1897 .minor = 0, 1898 1898 .rev = 0, 1899 1899 .funcs = &cik_common_ip_funcs, 1900 1900 }, 1901 1901 { 1902 - .type = AMDGPU_IP_BLOCK_TYPE_GMC, 1902 + .type = AMD_IP_BLOCK_TYPE_GMC, 1903 1903 .major = 7, 1904 1904 .minor = 0, 1905 1905 .rev = 0, 1906 1906 .funcs = &gmc_v7_0_ip_funcs, 1907 1907 }, 1908 1908 { 1909 - .type = AMDGPU_IP_BLOCK_TYPE_IH, 1909 + .type = AMD_IP_BLOCK_TYPE_IH, 1910 1910 .major = 2, 1911 1911 .minor = 0, 1912 1912 .rev = 0, 1913 1913 .funcs = &cik_ih_ip_funcs, 1914 1914 }, 1915 1915 { 1916 - .type = AMDGPU_IP_BLOCK_TYPE_SMC, 1916 + .type = AMD_IP_BLOCK_TYPE_SMC, 1917 1917 .major = 7, 1918 1918 .minor = 0, 1919 1919 .rev = 0, 1920 1920 .funcs = &ci_dpm_ip_funcs, 1921 1921 }, 1922 1922 { 1923 - .type = AMDGPU_IP_BLOCK_TYPE_DCE, 1923 + .type = AMD_IP_BLOCK_TYPE_DCE, 1924 1924 .major = 8, 1925 1925 .minor = 2, 1926 1926 .rev = 0, 1927 1927 .funcs = &dce_v8_0_ip_funcs, 1928 1928 }, 1929 1929 { 1930 - .type = AMDGPU_IP_BLOCK_TYPE_GFX, 1930 + .type = AMD_IP_BLOCK_TYPE_GFX, 1931 1931 .major = 7, 1932 1932 .minor = 2, 1933 1933 .rev = 0, 1934 1934 .funcs = &gfx_v7_0_ip_funcs, 1935 1935 }, 1936 1936 { 1937 - .type = AMDGPU_IP_BLOCK_TYPE_SDMA, 1937 + .type = AMD_IP_BLOCK_TYPE_SDMA, 1938 1938 .major = 2, 1939 1939 .minor = 0, 1940 1940 .rev = 0, 1941 1941 .funcs = &cik_sdma_ip_funcs, 1942 1942 }, 1943 1943 { 1944 - .type = AMDGPU_IP_BLOCK_TYPE_UVD, 1944 + .type = AMD_IP_BLOCK_TYPE_UVD, 1945 1945 .major = 4, 1946 1946 .minor = 2, 1947 1947 .rev = 0, 1948 1948 .funcs = &uvd_v4_2_ip_funcs, 1949 1949 }, 1950 1950 { 1951 - .type = AMDGPU_IP_BLOCK_TYPE_VCE, 1951 + .type = AMD_IP_BLOCK_TYPE_VCE, 1952 1952 .major = 2, 1953 1953 .minor = 0, 1954 1954 .rev = 0, ··· 1960 1960 { 1961 1961 /* ORDER MATTERS! */ 1962 1962 { 1963 - .type = AMDGPU_IP_BLOCK_TYPE_COMMON, 1963 + .type = AMD_IP_BLOCK_TYPE_COMMON, 1964 1964 .major = 1, 1965 1965 .minor = 0, 1966 1966 .rev = 0, 1967 1967 .funcs = &cik_common_ip_funcs, 1968 1968 }, 1969 1969 { 1970 - .type = AMDGPU_IP_BLOCK_TYPE_GMC, 1970 + .type = AMD_IP_BLOCK_TYPE_GMC, 1971 1971 .major = 7, 1972 1972 .minor = 0, 1973 1973 .rev = 0, 1974 1974 .funcs = &gmc_v7_0_ip_funcs, 1975 1975 }, 1976 1976 { 1977 - .type = AMDGPU_IP_BLOCK_TYPE_IH, 1977 + .type = AMD_IP_BLOCK_TYPE_IH, 1978 1978 .major = 2, 1979 1979 .minor = 0, 1980 1980 .rev = 0, 1981 1981 .funcs = &cik_ih_ip_funcs, 1982 1982 }, 1983 1983 { 1984 - .type = AMDGPU_IP_BLOCK_TYPE_SMC, 1984 + .type = AMD_IP_BLOCK_TYPE_SMC, 1985 1985 .major = 7, 1986 1986 .minor = 0, 1987 1987 .rev = 0, 1988 1988 .funcs = &ci_dpm_ip_funcs, 1989 1989 }, 1990 1990 { 1991 - .type = AMDGPU_IP_BLOCK_TYPE_DCE, 1991 + .type = AMD_IP_BLOCK_TYPE_DCE, 1992 1992 .major = 8, 1993 1993 .minor = 5, 1994 1994 .rev = 0, 1995 1995 .funcs = &dce_v8_0_ip_funcs, 1996 1996 }, 1997 1997 { 1998 - .type = AMDGPU_IP_BLOCK_TYPE_GFX, 1998 + .type = AMD_IP_BLOCK_TYPE_GFX, 1999 1999 .major = 7, 2000 2000 .minor = 3, 2001 2001 .rev = 0, 2002 2002 .funcs = &gfx_v7_0_ip_funcs, 2003 2003 }, 2004 2004 { 2005 - .type = AMDGPU_IP_BLOCK_TYPE_SDMA, 2005 + .type = AMD_IP_BLOCK_TYPE_SDMA, 2006 2006 .major = 2, 2007 2007 .minor = 0, 2008 2008 .rev = 0, 2009 2009 .funcs = &cik_sdma_ip_funcs, 2010 2010 }, 2011 2011 { 2012 - .type = AMDGPU_IP_BLOCK_TYPE_UVD, 2012 + .type = AMD_IP_BLOCK_TYPE_UVD, 2013 2013 .major = 4, 2014 2014 .minor = 2, 2015 2015 .rev = 0, 2016 2016 .funcs = &uvd_v4_2_ip_funcs, 2017 2017 }, 2018 2018 { 2019 - .type = AMDGPU_IP_BLOCK_TYPE_VCE, 2019 + .type = AMD_IP_BLOCK_TYPE_VCE, 2020 2020 .major = 2, 2021 2021 .minor = 0, 2022 2022 .rev = 0, ··· 2028 2028 { 2029 2029 /* ORDER MATTERS! */ 2030 2030 { 2031 - .type = AMDGPU_IP_BLOCK_TYPE_COMMON, 2031 + .type = AMD_IP_BLOCK_TYPE_COMMON, 2032 2032 .major = 1, 2033 2033 .minor = 0, 2034 2034 .rev = 0, 2035 2035 .funcs = &cik_common_ip_funcs, 2036 2036 }, 2037 2037 { 2038 - .type = AMDGPU_IP_BLOCK_TYPE_GMC, 2038 + .type = AMD_IP_BLOCK_TYPE_GMC, 2039 2039 .major = 7, 2040 2040 .minor = 0, 2041 2041 .rev = 0, 2042 2042 .funcs = &gmc_v7_0_ip_funcs, 2043 2043 }, 2044 2044 { 2045 - .type = AMDGPU_IP_BLOCK_TYPE_IH, 2045 + .type = AMD_IP_BLOCK_TYPE_IH, 2046 2046 .major = 2, 2047 2047 .minor = 0, 2048 2048 .rev = 0, 2049 2049 .funcs = &cik_ih_ip_funcs, 2050 2050 }, 2051 2051 { 2052 - .type = AMDGPU_IP_BLOCK_TYPE_SMC, 2052 + .type = AMD_IP_BLOCK_TYPE_SMC, 2053 2053 .major = 7, 2054 2054 .minor = 0, 2055 2055 .rev = 0, 2056 2056 .funcs = &kv_dpm_ip_funcs, 2057 2057 }, 2058 2058 { 2059 - .type = AMDGPU_IP_BLOCK_TYPE_DCE, 2059 + .type = AMD_IP_BLOCK_TYPE_DCE, 2060 2060 .major = 8, 2061 2061 .minor = 3, 2062 2062 .rev = 0, 2063 2063 .funcs = &dce_v8_0_ip_funcs, 2064 2064 }, 2065 2065 { 2066 - .type = AMDGPU_IP_BLOCK_TYPE_GFX, 2066 + .type = AMD_IP_BLOCK_TYPE_GFX, 2067 2067 .major = 7, 2068 2068 .minor = 2, 2069 2069 .rev = 0, 2070 2070 .funcs = &gfx_v7_0_ip_funcs, 2071 2071 }, 2072 2072 { 2073 - .type = AMDGPU_IP_BLOCK_TYPE_SDMA, 2073 + .type = AMD_IP_BLOCK_TYPE_SDMA, 2074 2074 .major = 2, 2075 2075 .minor = 0, 2076 2076 .rev = 0, 2077 2077 .funcs = &cik_sdma_ip_funcs, 2078 2078 }, 2079 2079 { 2080 - .type = AMDGPU_IP_BLOCK_TYPE_UVD, 2080 + .type = AMD_IP_BLOCK_TYPE_UVD, 2081 2081 .major = 4, 2082 2082 .minor = 2, 2083 2083 .rev = 0, 2084 2084 .funcs = &uvd_v4_2_ip_funcs, 2085 2085 }, 2086 2086 { 2087 - .type = AMDGPU_IP_BLOCK_TYPE_VCE, 2087 + .type = AMD_IP_BLOCK_TYPE_VCE, 2088 2088 .major = 2, 2089 2089 .minor = 0, 2090 2090 .rev = 0, ··· 2096 2096 { 2097 2097 /* ORDER MATTERS! */ 2098 2098 { 2099 - .type = AMDGPU_IP_BLOCK_TYPE_COMMON, 2099 + .type = AMD_IP_BLOCK_TYPE_COMMON, 2100 2100 .major = 1, 2101 2101 .minor = 0, 2102 2102 .rev = 0, 2103 2103 .funcs = &cik_common_ip_funcs, 2104 2104 }, 2105 2105 { 2106 - .type = AMDGPU_IP_BLOCK_TYPE_GMC, 2106 + .type = AMD_IP_BLOCK_TYPE_GMC, 2107 2107 .major = 7, 2108 2108 .minor = 0, 2109 2109 .rev = 0, 2110 2110 .funcs = &gmc_v7_0_ip_funcs, 2111 2111 }, 2112 2112 { 2113 - .type = AMDGPU_IP_BLOCK_TYPE_IH, 2113 + .type = AMD_IP_BLOCK_TYPE_IH, 2114 2114 .major = 2, 2115 2115 .minor = 0, 2116 2116 .rev = 0, 2117 2117 .funcs = &cik_ih_ip_funcs, 2118 2118 }, 2119 2119 { 2120 - .type = AMDGPU_IP_BLOCK_TYPE_SMC, 2120 + .type = AMD_IP_BLOCK_TYPE_SMC, 2121 2121 .major = 7, 2122 2122 .minor = 0, 2123 2123 .rev = 0, 2124 2124 .funcs = &kv_dpm_ip_funcs, 2125 2125 }, 2126 2126 { 2127 - .type = AMDGPU_IP_BLOCK_TYPE_DCE, 2127 + .type = AMD_IP_BLOCK_TYPE_DCE, 2128 2128 .major = 8, 2129 2129 .minor = 3, 2130 2130 .rev = 0, 2131 2131 .funcs = &dce_v8_0_ip_funcs, 2132 2132 }, 2133 2133 { 2134 - .type = AMDGPU_IP_BLOCK_TYPE_GFX, 2134 + .type = AMD_IP_BLOCK_TYPE_GFX, 2135 2135 .major = 7, 2136 2136 .minor = 2, 2137 2137 .rev = 0, 2138 2138 .funcs = &gfx_v7_0_ip_funcs, 2139 2139 }, 2140 2140 { 2141 - .type = AMDGPU_IP_BLOCK_TYPE_SDMA, 2141 + .type = AMD_IP_BLOCK_TYPE_SDMA, 2142 2142 .major = 2, 2143 2143 .minor = 0, 2144 2144 .rev = 0, 2145 2145 .funcs = &cik_sdma_ip_funcs, 2146 2146 }, 2147 2147 { 2148 - .type = AMDGPU_IP_BLOCK_TYPE_UVD, 2148 + .type = AMD_IP_BLOCK_TYPE_UVD, 2149 2149 .major = 4, 2150 2150 .minor = 2, 2151 2151 .rev = 0, 2152 2152 .funcs = &uvd_v4_2_ip_funcs, 2153 2153 }, 2154 2154 { 2155 - .type = AMDGPU_IP_BLOCK_TYPE_VCE, 2155 + .type = AMD_IP_BLOCK_TYPE_VCE, 2156 2156 .major = 2, 2157 2157 .minor = 0, 2158 2158 .rev = 0, ··· 2164 2164 { 2165 2165 /* ORDER MATTERS! */ 2166 2166 { 2167 - .type = AMDGPU_IP_BLOCK_TYPE_COMMON, 2167 + .type = AMD_IP_BLOCK_TYPE_COMMON, 2168 2168 .major = 1, 2169 2169 .minor = 0, 2170 2170 .rev = 0, 2171 2171 .funcs = &cik_common_ip_funcs, 2172 2172 }, 2173 2173 { 2174 - .type = AMDGPU_IP_BLOCK_TYPE_GMC, 2174 + .type = AMD_IP_BLOCK_TYPE_GMC, 2175 2175 .major = 7, 2176 2176 .minor = 0, 2177 2177 .rev = 0, 2178 2178 .funcs = &gmc_v7_0_ip_funcs, 2179 2179 }, 2180 2180 { 2181 - .type = AMDGPU_IP_BLOCK_TYPE_IH, 2181 + .type = AMD_IP_BLOCK_TYPE_IH, 2182 2182 .major = 2, 2183 2183 .minor = 0, 2184 2184 .rev = 0, 2185 2185 .funcs = &cik_ih_ip_funcs, 2186 2186 }, 2187 2187 { 2188 - .type = AMDGPU_IP_BLOCK_TYPE_SMC, 2188 + .type = AMD_IP_BLOCK_TYPE_SMC, 2189 2189 .major = 7, 2190 2190 .minor = 0, 2191 2191 .rev = 0, 2192 2192 .funcs = &kv_dpm_ip_funcs, 2193 2193 }, 2194 2194 { 2195 - .type = AMDGPU_IP_BLOCK_TYPE_DCE, 2195 + .type = AMD_IP_BLOCK_TYPE_DCE, 2196 2196 .major = 8, 2197 2197 .minor = 1, 2198 2198 .rev = 0, 2199 2199 .funcs = &dce_v8_0_ip_funcs, 2200 2200 }, 2201 2201 { 2202 - .type = AMDGPU_IP_BLOCK_TYPE_GFX, 2202 + .type = AMD_IP_BLOCK_TYPE_GFX, 2203 2203 .major = 7, 2204 2204 .minor = 1, 2205 2205 .rev = 0, 2206 2206 .funcs = &gfx_v7_0_ip_funcs, 2207 2207 }, 2208 2208 { 2209 - .type = AMDGPU_IP_BLOCK_TYPE_SDMA, 2209 + .type = AMD_IP_BLOCK_TYPE_SDMA, 2210 2210 .major = 2, 2211 2211 .minor = 0, 2212 2212 .rev = 0, 2213 2213 .funcs = &cik_sdma_ip_funcs, 2214 2214 }, 2215 2215 { 2216 - .type = AMDGPU_IP_BLOCK_TYPE_UVD, 2216 + .type = AMD_IP_BLOCK_TYPE_UVD, 2217 2217 .major = 4, 2218 2218 .minor = 2, 2219 2219 .rev = 0, 2220 2220 .funcs = &uvd_v4_2_ip_funcs, 2221 2221 }, 2222 2222 { 2223 - .type = AMDGPU_IP_BLOCK_TYPE_VCE, 2223 + .type = AMD_IP_BLOCK_TYPE_VCE, 2224 2224 .major = 2, 2225 2225 .minor = 0, 2226 2226 .rev = 0, ··· 2278 2278 .wait_for_mc_idle = &gmc_v7_0_mc_wait_for_idle, 2279 2279 }; 2280 2280 2281 - static int cik_common_early_init(struct amdgpu_device *adev) 2281 + static int cik_common_early_init(void *handle) 2282 2282 { 2283 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 2284 + 2283 2285 adev->smc_rreg = &cik_smc_rreg; 2284 2286 adev->smc_wreg = &cik_smc_wreg; 2285 2287 adev->pcie_rreg = &cik_pcie_rreg; ··· 2419 2417 return 0; 2420 2418 } 2421 2419 2422 - static int cik_common_sw_init(struct amdgpu_device *adev) 2420 + static int cik_common_sw_init(void *handle) 2423 2421 { 2424 2422 return 0; 2425 2423 } 2426 2424 2427 - static int cik_common_sw_fini(struct amdgpu_device *adev) 2425 + static int cik_common_sw_fini(void *handle) 2428 2426 { 2429 2427 return 0; 2430 2428 } 2431 2429 2432 - static int cik_common_hw_init(struct amdgpu_device *adev) 2430 + static int cik_common_hw_init(void *handle) 2433 2431 { 2432 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 2433 + 2434 2434 /* move the golden regs per IP block */ 2435 2435 cik_init_golden_registers(adev); 2436 2436 /* enable pcie gen2/3 link */ ··· 2443 2439 return 0; 2444 2440 } 2445 2441 2446 - static int cik_common_hw_fini(struct amdgpu_device *adev) 2442 + static int cik_common_hw_fini(void *handle) 2447 2443 { 2448 2444 return 0; 2449 2445 } 2450 2446 2451 - static int cik_common_suspend(struct amdgpu_device *adev) 2447 + static int cik_common_suspend(void *handle) 2452 2448 { 2449 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 2450 + 2453 2451 return cik_common_hw_fini(adev); 2454 2452 } 2455 2453 2456 - static int cik_common_resume(struct amdgpu_device *adev) 2454 + static int cik_common_resume(void *handle) 2457 2455 { 2456 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 2457 + 2458 2458 return cik_common_hw_init(adev); 2459 2459 } 2460 2460 2461 - static bool cik_common_is_idle(struct amdgpu_device *adev) 2461 + static bool cik_common_is_idle(void *handle) 2462 2462 { 2463 2463 return true; 2464 2464 } 2465 2465 2466 - static int cik_common_wait_for_idle(struct amdgpu_device *adev) 2466 + static int cik_common_wait_for_idle(void *handle) 2467 2467 { 2468 2468 return 0; 2469 2469 } 2470 2470 2471 - static void cik_common_print_status(struct amdgpu_device *adev) 2471 + static void cik_common_print_status(void *handle) 2472 2472 { 2473 2473 2474 2474 } 2475 2475 2476 - static int cik_common_soft_reset(struct amdgpu_device *adev) 2476 + static int cik_common_soft_reset(void *handle) 2477 2477 { 2478 2478 /* XXX hard reset?? */ 2479 2479 return 0; 2480 2480 } 2481 2481 2482 - static int cik_common_set_clockgating_state(struct amdgpu_device *adev, 2483 - enum amdgpu_clockgating_state state) 2482 + static int cik_common_set_clockgating_state(void *handle, 2483 + enum amd_clockgating_state state) 2484 2484 { 2485 2485 return 0; 2486 2486 } 2487 2487 2488 - static int cik_common_set_powergating_state(struct amdgpu_device *adev, 2489 - enum amdgpu_powergating_state state) 2488 + static int cik_common_set_powergating_state(void *handle, 2489 + enum amd_powergating_state state) 2490 2490 { 2491 2491 return 0; 2492 2492 } 2493 2493 2494 - const struct amdgpu_ip_funcs cik_common_ip_funcs = { 2494 + const struct amd_ip_funcs cik_common_ip_funcs = { 2495 2495 .early_init = cik_common_early_init, 2496 2496 .late_init = NULL, 2497 2497 .sw_init = cik_common_sw_init,
+1 -1
drivers/gpu/drm/amd/amdgpu/cik.h
··· 24 24 #ifndef __CIK_H__ 25 25 #define __CIK_H__ 26 26 27 - extern const struct amdgpu_ip_funcs cik_common_ip_funcs; 27 + extern const struct amd_ip_funcs cik_common_ip_funcs; 28 28 29 29 void cik_srbm_select(struct amdgpu_device *adev, 30 30 u32 me, u32 pipe, u32 queue, u32 vmid);
+2 -2
drivers/gpu/drm/amd/amdgpu/cik_dpm.h
··· 24 24 #ifndef __CIK_DPM_H__ 25 25 #define __CIK_DPM_H__ 26 26 27 - extern const struct amdgpu_ip_funcs ci_dpm_ip_funcs; 28 - extern const struct amdgpu_ip_funcs kv_dpm_ip_funcs; 27 + extern const struct amd_ip_funcs ci_dpm_ip_funcs; 28 + extern const struct amd_ip_funcs kv_dpm_ip_funcs; 29 29 30 30 #endif
+36 -18
drivers/gpu/drm/amd/amdgpu/cik_ih.c
··· 271 271 WREG32(mmIH_RB_RPTR, adev->irq.ih.rptr); 272 272 } 273 273 274 - static int cik_ih_early_init(struct amdgpu_device *adev) 274 + static int cik_ih_early_init(void *handle) 275 275 { 276 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 277 + 276 278 cik_ih_set_interrupt_funcs(adev); 277 279 278 280 return 0; 279 281 } 280 282 281 - static int cik_ih_sw_init(struct amdgpu_device *adev) 283 + static int cik_ih_sw_init(void *handle) 282 284 { 283 285 int r; 286 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 284 287 285 288 r = amdgpu_ih_ring_init(adev, 64 * 1024, false); 286 289 if (r) ··· 294 291 return r; 295 292 } 296 293 297 - static int cik_ih_sw_fini(struct amdgpu_device *adev) 294 + static int cik_ih_sw_fini(void *handle) 298 295 { 296 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 297 + 299 298 amdgpu_irq_fini(adev); 300 299 amdgpu_ih_ring_fini(adev); 301 300 302 301 return 0; 303 302 } 304 303 305 - static int cik_ih_hw_init(struct amdgpu_device *adev) 304 + static int cik_ih_hw_init(void *handle) 306 305 { 307 306 int r; 307 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 308 308 309 309 r = cik_ih_irq_init(adev); 310 310 if (r) ··· 316 310 return 0; 317 311 } 318 312 319 - static int cik_ih_hw_fini(struct amdgpu_device *adev) 313 + static int cik_ih_hw_fini(void *handle) 320 314 { 315 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 316 + 321 317 cik_ih_irq_disable(adev); 322 318 323 319 return 0; 324 320 } 325 321 326 - static int cik_ih_suspend(struct amdgpu_device *adev) 322 + static int cik_ih_suspend(void *handle) 327 323 { 324 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 325 + 328 326 return cik_ih_hw_fini(adev); 329 327 } 330 328 331 - static int cik_ih_resume(struct amdgpu_device *adev) 329 + static int cik_ih_resume(void *handle) 332 330 { 331 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 332 + 333 333 return cik_ih_hw_init(adev); 334 334 } 335 335 336 - static bool cik_ih_is_idle(struct amdgpu_device *adev) 336 + static bool cik_ih_is_idle(void *handle) 337 337 { 338 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 338 339 u32 tmp = RREG32(mmSRBM_STATUS); 339 340 340 341 if (tmp & SRBM_STATUS__IH_BUSY_MASK) ··· 350 337 return true; 351 338 } 352 339 353 - static int cik_ih_wait_for_idle(struct amdgpu_device *adev) 340 + static int cik_ih_wait_for_idle(void *handle) 354 341 { 355 342 unsigned i; 356 343 u32 tmp; 344 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 357 345 358 346 for (i = 0; i < adev->usec_timeout; i++) { 359 347 /* read MC_STATUS */ ··· 366 352 return -ETIMEDOUT; 367 353 } 368 354 369 - static void cik_ih_print_status(struct amdgpu_device *adev) 355 + static void cik_ih_print_status(void *handle) 370 356 { 357 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 358 + 371 359 dev_info(adev->dev, "CIK IH registers\n"); 372 360 dev_info(adev->dev, " SRBM_STATUS=0x%08X\n", 373 361 RREG32(mmSRBM_STATUS)); ··· 395 379 RREG32(mmIH_RB_WPTR)); 396 380 } 397 381 398 - static int cik_ih_soft_reset(struct amdgpu_device *adev) 382 + static int cik_ih_soft_reset(void *handle) 399 383 { 384 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 385 + 400 386 u32 srbm_soft_reset = 0; 401 387 u32 tmp = RREG32(mmSRBM_STATUS); 402 388 ··· 406 388 srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_IH_MASK; 407 389 408 390 if (srbm_soft_reset) { 409 - cik_ih_print_status(adev); 391 + cik_ih_print_status((void *)adev); 410 392 411 393 tmp = RREG32(mmSRBM_SOFT_RESET); 412 394 tmp |= srbm_soft_reset; ··· 423 405 /* Wait a little for things to settle down */ 424 406 udelay(50); 425 407 426 - cik_ih_print_status(adev); 408 + cik_ih_print_status((void *)adev); 427 409 } 428 410 429 411 return 0; 430 412 } 431 413 432 - static int cik_ih_set_clockgating_state(struct amdgpu_device *adev, 433 - enum amdgpu_clockgating_state state) 414 + static int cik_ih_set_clockgating_state(void *handle, 415 + enum amd_clockgating_state state) 434 416 { 435 417 return 0; 436 418 } 437 419 438 - static int cik_ih_set_powergating_state(struct amdgpu_device *adev, 439 - enum amdgpu_powergating_state state) 420 + static int cik_ih_set_powergating_state(void *handle, 421 + enum amd_powergating_state state) 440 422 { 441 423 return 0; 442 424 } 443 425 444 - const struct amdgpu_ip_funcs cik_ih_ip_funcs = { 426 + const struct amd_ip_funcs cik_ih_ip_funcs = { 445 427 .early_init = cik_ih_early_init, 446 428 .late_init = NULL, 447 429 .sw_init = cik_ih_sw_init,
+1 -1
drivers/gpu/drm/amd/amdgpu/cik_ih.h
··· 24 24 #ifndef __CIK_IH_H__ 25 25 #define __CIK_IH_H__ 26 26 27 - extern const struct amdgpu_ip_funcs cik_ih_ip_funcs; 27 + extern const struct amd_ip_funcs cik_ih_ip_funcs; 28 28 29 29 #endif
+34 -19
drivers/gpu/drm/amd/amdgpu/cik_sdma.c
··· 927 927 } 928 928 } 929 929 930 - static int cik_sdma_early_init(struct amdgpu_device *adev) 930 + static int cik_sdma_early_init(void *handle) 931 931 { 932 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 933 + 932 934 cik_sdma_set_ring_funcs(adev); 933 935 cik_sdma_set_irq_funcs(adev); 934 936 cik_sdma_set_buffer_funcs(adev); ··· 939 937 return 0; 940 938 } 941 939 942 - static int cik_sdma_sw_init(struct amdgpu_device *adev) 940 + static int cik_sdma_sw_init(void *handle) 943 941 { 944 942 struct amdgpu_ring *ring; 943 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 945 944 int r; 946 945 947 946 r = cik_sdma_init_microcode(adev); ··· 993 990 return r; 994 991 } 995 992 996 - static int cik_sdma_sw_fini(struct amdgpu_device *adev) 993 + static int cik_sdma_sw_fini(void *handle) 997 994 { 995 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 996 + 998 997 amdgpu_ring_fini(&adev->sdma[0].ring); 999 998 amdgpu_ring_fini(&adev->sdma[1].ring); 1000 999 1001 1000 return 0; 1002 1001 } 1003 1002 1004 - static int cik_sdma_hw_init(struct amdgpu_device *adev) 1003 + static int cik_sdma_hw_init(void *handle) 1005 1004 { 1006 1005 int r; 1006 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1007 1007 1008 1008 r = cik_sdma_start(adev); 1009 1009 if (r) ··· 1015 1009 return r; 1016 1010 } 1017 1011 1018 - static int cik_sdma_hw_fini(struct amdgpu_device *adev) 1012 + static int cik_sdma_hw_fini(void *handle) 1019 1013 { 1014 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1015 + 1020 1016 cik_sdma_enable(adev, false); 1021 1017 1022 1018 return 0; 1023 1019 } 1024 1020 1025 - static int cik_sdma_suspend(struct amdgpu_device *adev) 1021 + static int cik_sdma_suspend(void *handle) 1026 1022 { 1023 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1027 1024 1028 1025 return cik_sdma_hw_fini(adev); 1029 1026 } 1030 1027 1031 - static int cik_sdma_resume(struct amdgpu_device *adev) 1028 + static int cik_sdma_resume(void *handle) 1032 1029 { 1030 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1033 1031 1034 1032 return cik_sdma_hw_init(adev); 1035 1033 } 1036 1034 1037 - static bool cik_sdma_is_idle(struct amdgpu_device *adev) 1035 + static bool cik_sdma_is_idle(void *handle) 1038 1036 { 1037 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1039 1038 u32 tmp = RREG32(mmSRBM_STATUS2); 1040 1039 1041 1040 if (tmp & (SRBM_STATUS2__SDMA_BUSY_MASK | ··· 1050 1039 return true; 1051 1040 } 1052 1041 1053 - static int cik_sdma_wait_for_idle(struct amdgpu_device *adev) 1042 + static int cik_sdma_wait_for_idle(void *handle) 1054 1043 { 1055 1044 unsigned i; 1056 1045 u32 tmp; 1046 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1057 1047 1058 1048 for (i = 0; i < adev->usec_timeout; i++) { 1059 1049 tmp = RREG32(mmSRBM_STATUS2) & (SRBM_STATUS2__SDMA_BUSY_MASK | ··· 1067 1055 return -ETIMEDOUT; 1068 1056 } 1069 1057 1070 - static void cik_sdma_print_status(struct amdgpu_device *adev) 1058 + static void cik_sdma_print_status(void *handle) 1071 1059 { 1072 1060 int i, j; 1061 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1073 1062 1074 1063 dev_info(adev->dev, "CIK SDMA registers\n"); 1075 1064 dev_info(adev->dev, " SRBM_STATUS2=0x%08X\n", ··· 1116 1103 } 1117 1104 } 1118 1105 1119 - static int cik_sdma_soft_reset(struct amdgpu_device *adev) 1106 + static int cik_sdma_soft_reset(void *handle) 1120 1107 { 1121 1108 u32 srbm_soft_reset = 0; 1109 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1122 1110 u32 tmp = RREG32(mmSRBM_STATUS2); 1123 1111 1124 1112 if (tmp & SRBM_STATUS2__SDMA_BUSY_MASK) { ··· 1138 1124 } 1139 1125 1140 1126 if (srbm_soft_reset) { 1141 - cik_sdma_print_status(adev); 1127 + cik_sdma_print_status((void *)adev); 1142 1128 1143 1129 tmp = RREG32(mmSRBM_SOFT_RESET); 1144 1130 tmp |= srbm_soft_reset; ··· 1155 1141 /* Wait a little for things to settle down */ 1156 1142 udelay(50); 1157 1143 1158 - cik_sdma_print_status(adev); 1144 + cik_sdma_print_status((void *)adev); 1159 1145 } 1160 1146 1161 1147 return 0; ··· 1257 1243 return 0; 1258 1244 } 1259 1245 1260 - static int cik_sdma_set_clockgating_state(struct amdgpu_device *adev, 1261 - enum amdgpu_clockgating_state state) 1246 + static int cik_sdma_set_clockgating_state(void *handle, 1247 + enum amd_clockgating_state state) 1262 1248 { 1263 1249 bool gate = false; 1250 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1264 1251 1265 - if (state == AMDGPU_CG_STATE_GATE) 1252 + if (state == AMD_CG_STATE_GATE) 1266 1253 gate = true; 1267 1254 1268 1255 cik_enable_sdma_mgcg(adev, gate); ··· 1272 1257 return 0; 1273 1258 } 1274 1259 1275 - static int cik_sdma_set_powergating_state(struct amdgpu_device *adev, 1276 - enum amdgpu_powergating_state state) 1260 + static int cik_sdma_set_powergating_state(void *handle, 1261 + enum amd_powergating_state state) 1277 1262 { 1278 1263 return 0; 1279 1264 } 1280 1265 1281 - const struct amdgpu_ip_funcs cik_sdma_ip_funcs = { 1266 + const struct amd_ip_funcs cik_sdma_ip_funcs = { 1282 1267 .early_init = cik_sdma_early_init, 1283 1268 .late_init = NULL, 1284 1269 .sw_init = cik_sdma_sw_init,
+1 -1
drivers/gpu/drm/amd/amdgpu/cik_sdma.h
··· 24 24 #ifndef __CIK_SDMA_H__ 25 25 #define __CIK_SDMA_H__ 26 26 27 - extern const struct amdgpu_ip_funcs cik_sdma_ip_funcs; 27 + extern const struct amd_ip_funcs cik_sdma_ip_funcs; 28 28 29 29 #endif
+32 -21
drivers/gpu/drm/amd/amdgpu/cz_dpm.c
··· 542 542 543 543 static void cz_dpm_set_funcs(struct amdgpu_device *adev); 544 544 545 - static int cz_dpm_early_init(struct amdgpu_device *adev) 545 + static int cz_dpm_early_init(void *handle) 546 546 { 547 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 548 + 547 549 cz_dpm_set_funcs(adev); 548 550 549 551 return 0; 550 552 } 551 553 552 554 553 - static int cz_dpm_late_init(struct amdgpu_device *adev) 555 + static int cz_dpm_late_init(void *handle) 554 556 { 557 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 558 + 555 559 /* powerdown unused blocks for now */ 556 560 cz_dpm_powergate_uvd(adev, true); 557 561 558 562 return 0; 559 563 } 560 564 561 - static int cz_dpm_sw_init(struct amdgpu_device *adev) 565 + static int cz_dpm_sw_init(void *handle) 562 566 { 567 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 563 568 int ret = 0; 564 569 /* fix me to add thermal support TODO */ 565 570 ··· 607 602 return ret; 608 603 } 609 604 610 - static int cz_dpm_sw_fini(struct amdgpu_device *adev) 605 + static int cz_dpm_sw_fini(void *handle) 611 606 { 607 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 608 + 612 609 mutex_lock(&adev->pm.mutex); 613 610 amdgpu_pm_sysfs_fini(adev); 614 611 cz_dpm_fini(adev); ··· 1223 1216 return 0; 1224 1217 } 1225 1218 1226 - static int cz_dpm_hw_init(struct amdgpu_device *adev) 1219 + static int cz_dpm_hw_init(void *handle) 1227 1220 { 1221 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1228 1222 int ret = 0; 1229 1223 1230 1224 mutex_lock(&adev->pm.mutex); ··· 1290 1282 return 0; 1291 1283 } 1292 1284 1293 - static int cz_dpm_hw_fini(struct amdgpu_device *adev) 1285 + static int cz_dpm_hw_fini(void *handle) 1294 1286 { 1295 1287 int ret = 0; 1288 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1296 1289 1297 1290 mutex_lock(&adev->pm.mutex); 1298 1291 ··· 1314 1305 return ret; 1315 1306 } 1316 1307 1317 - static int cz_dpm_suspend(struct amdgpu_device *adev) 1308 + static int cz_dpm_suspend(void *handle) 1318 1309 { 1319 1310 int ret = 0; 1311 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1320 1312 1321 1313 if (adev->pm.dpm_enabled) { 1322 1314 mutex_lock(&adev->pm.mutex); ··· 1334 1324 return ret; 1335 1325 } 1336 1326 1337 - static int cz_dpm_resume(struct amdgpu_device *adev) 1327 + static int cz_dpm_resume(void *handle) 1338 1328 { 1339 1329 int ret = 0; 1330 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1340 1331 1341 1332 mutex_lock(&adev->pm.mutex); 1342 1333 ret = cz_smu_init(adev); ··· 1379 1368 return 0; 1380 1369 } 1381 1370 1382 - static int cz_dpm_set_clockgating_state(struct amdgpu_device *adev, 1383 - enum amdgpu_clockgating_state state) 1371 + static int cz_dpm_set_clockgating_state(void *handle, 1372 + enum amd_clockgating_state state) 1384 1373 { 1385 1374 return 0; 1386 1375 } 1387 1376 1388 - static int cz_dpm_set_powergating_state(struct amdgpu_device *adev, 1389 - enum amdgpu_powergating_state state) 1377 + static int cz_dpm_set_powergating_state(void *handle, 1378 + enum amd_powergating_state state) 1390 1379 { 1391 1380 return 0; 1392 1381 } ··· 1744 1733 if (gate) { 1745 1734 if (pi->caps_uvd_pg) { 1746 1735 /* disable clockgating so we can properly shut down the block */ 1747 - ret = amdgpu_set_clockgating_state(adev, AMDGPU_IP_BLOCK_TYPE_UVD, 1748 - AMDGPU_CG_STATE_UNGATE); 1736 + ret = amdgpu_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_UVD, 1737 + AMD_CG_STATE_UNGATE); 1749 1738 /* shutdown the UVD block */ 1750 - ret = amdgpu_set_powergating_state(adev, AMDGPU_IP_BLOCK_TYPE_UVD, 1751 - AMDGPU_PG_STATE_GATE); 1739 + ret = amdgpu_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_UVD, 1740 + AMD_PG_STATE_GATE); 1752 1741 /* XXX: check for errors */ 1753 1742 } 1754 1743 cz_update_uvd_dpm(adev, gate); ··· 1763 1752 else 1764 1753 cz_send_msg_to_smc_with_parameter(adev, PPSMC_MSG_UVDPowerON, 0); 1765 1754 /* re-init the UVD block */ 1766 - ret = amdgpu_set_powergating_state(adev, AMDGPU_IP_BLOCK_TYPE_UVD, 1767 - AMDGPU_PG_STATE_UNGATE); 1755 + ret = amdgpu_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_UVD, 1756 + AMD_PG_STATE_UNGATE); 1768 1757 /* enable clockgating. hw will dynamically gate/ungate clocks on the fly */ 1769 - ret = amdgpu_set_clockgating_state(adev, AMDGPU_IP_BLOCK_TYPE_UVD, 1770 - AMDGPU_CG_STATE_GATE); 1758 + ret = amdgpu_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_UVD, 1759 + AMD_CG_STATE_GATE); 1771 1760 /* XXX: check for errors */ 1772 1761 } 1773 1762 cz_update_uvd_dpm(adev, gate); 1774 1763 } 1775 1764 } 1776 1765 1777 - const struct amdgpu_ip_funcs cz_dpm_ip_funcs = { 1766 + const struct amd_ip_funcs cz_dpm_ip_funcs = { 1778 1767 .early_init = cz_dpm_early_init, 1779 1768 .late_init = cz_dpm_late_init, 1780 1769 .sw_init = cz_dpm_sw_init,
+35 -18
drivers/gpu/drm/amd/amdgpu/cz_ih.c
··· 250 250 WREG32(mmIH_RB_RPTR, adev->irq.ih.rptr); 251 251 } 252 252 253 - static int cz_ih_early_init(struct amdgpu_device *adev) 253 + static int cz_ih_early_init(void *handle) 254 254 { 255 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 256 + 255 257 cz_ih_set_interrupt_funcs(adev); 256 258 return 0; 257 259 } 258 260 259 - static int cz_ih_sw_init(struct amdgpu_device *adev) 261 + static int cz_ih_sw_init(void *handle) 260 262 { 261 263 int r; 264 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 262 265 263 266 r = amdgpu_ih_ring_init(adev, 64 * 1024, false); 264 267 if (r) ··· 272 269 return r; 273 270 } 274 271 275 - static int cz_ih_sw_fini(struct amdgpu_device *adev) 272 + static int cz_ih_sw_fini(void *handle) 276 273 { 274 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 275 + 277 276 amdgpu_irq_fini(adev); 278 277 amdgpu_ih_ring_fini(adev); 279 278 280 279 return 0; 281 280 } 282 281 283 - static int cz_ih_hw_init(struct amdgpu_device *adev) 282 + static int cz_ih_hw_init(void *handle) 284 283 { 285 284 int r; 285 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 286 286 287 287 r = cz_ih_irq_init(adev); 288 288 if (r) ··· 294 288 return 0; 295 289 } 296 290 297 - static int cz_ih_hw_fini(struct amdgpu_device *adev) 291 + static int cz_ih_hw_fini(void *handle) 298 292 { 293 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 294 + 299 295 cz_ih_irq_disable(adev); 300 296 301 297 return 0; 302 298 } 303 299 304 - static int cz_ih_suspend(struct amdgpu_device *adev) 300 + static int cz_ih_suspend(void *handle) 305 301 { 302 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 303 + 306 304 return cz_ih_hw_fini(adev); 307 305 } 308 306 309 - static int cz_ih_resume(struct amdgpu_device *adev) 307 + static int cz_ih_resume(void *handle) 310 308 { 309 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 310 + 311 311 return cz_ih_hw_init(adev); 312 312 } 313 313 314 - static bool cz_ih_is_idle(struct amdgpu_device *adev) 314 + static bool cz_ih_is_idle(void *handle) 315 315 { 316 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 316 317 u32 tmp = RREG32(mmSRBM_STATUS); 317 318 318 319 if (REG_GET_FIELD(tmp, SRBM_STATUS, IH_BUSY)) ··· 328 315 return true; 329 316 } 330 317 331 - static int cz_ih_wait_for_idle(struct amdgpu_device *adev) 318 + static int cz_ih_wait_for_idle(void *handle) 332 319 { 333 320 unsigned i; 334 321 u32 tmp; 322 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 335 323 336 324 for (i = 0; i < adev->usec_timeout; i++) { 337 325 /* read MC_STATUS */ ··· 344 330 return -ETIMEDOUT; 345 331 } 346 332 347 - static void cz_ih_print_status(struct amdgpu_device *adev) 333 + static void cz_ih_print_status(void *handle) 348 334 { 335 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 336 + 349 337 dev_info(adev->dev, "CZ IH registers\n"); 350 338 dev_info(adev->dev, " SRBM_STATUS=0x%08X\n", 351 339 RREG32(mmSRBM_STATUS)); ··· 373 357 RREG32(mmIH_RB_WPTR)); 374 358 } 375 359 376 - static int cz_ih_soft_reset(struct amdgpu_device *adev) 360 + static int cz_ih_soft_reset(void *handle) 377 361 { 378 362 u32 srbm_soft_reset = 0; 363 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 379 364 u32 tmp = RREG32(mmSRBM_STATUS); 380 365 381 366 if (tmp & SRBM_STATUS__IH_BUSY_MASK) ··· 384 367 SOFT_RESET_IH, 1); 385 368 386 369 if (srbm_soft_reset) { 387 - cz_ih_print_status(adev); 370 + cz_ih_print_status((void *)adev); 388 371 389 372 tmp = RREG32(mmSRBM_SOFT_RESET); 390 373 tmp |= srbm_soft_reset; ··· 401 384 /* Wait a little for things to settle down */ 402 385 udelay(50); 403 386 404 - cz_ih_print_status(adev); 387 + cz_ih_print_status((void *)adev); 405 388 } 406 389 407 390 return 0; 408 391 } 409 392 410 - static int cz_ih_set_clockgating_state(struct amdgpu_device *adev, 411 - enum amdgpu_clockgating_state state) 393 + static int cz_ih_set_clockgating_state(void *handle, 394 + enum amd_clockgating_state state) 412 395 { 413 396 // TODO 414 397 return 0; 415 398 } 416 399 417 - static int cz_ih_set_powergating_state(struct amdgpu_device *adev, 418 - enum amdgpu_powergating_state state) 400 + static int cz_ih_set_powergating_state(void *handle, 401 + enum amd_powergating_state state) 419 402 { 420 403 // TODO 421 404 return 0; 422 405 } 423 406 424 - const struct amdgpu_ip_funcs cz_ih_ip_funcs = { 407 + const struct amd_ip_funcs cz_ih_ip_funcs = { 425 408 .early_init = cz_ih_early_init, 426 409 .late_init = NULL, 427 410 .sw_init = cz_ih_sw_init,
+1 -1
drivers/gpu/drm/amd/amdgpu/cz_ih.h
··· 24 24 #ifndef __CZ_IH_H__ 25 25 #define __CZ_IH_H__ 26 26 27 - extern const struct amdgpu_ip_funcs cz_ih_ip_funcs; 27 + extern const struct amd_ip_funcs cz_ih_ip_funcs; 28 28 29 29 #endif /* __CZ_IH_H__ */
+30 -20
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
··· 2864 2864 return 0; 2865 2865 } 2866 2866 2867 - static int dce_v10_0_early_init(struct amdgpu_device *adev) 2867 + static int dce_v10_0_early_init(void *handle) 2868 2868 { 2869 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 2870 + 2869 2871 adev->audio_endpt_rreg = &dce_v10_0_audio_endpt_rreg; 2870 2872 adev->audio_endpt_wreg = &dce_v10_0_audio_endpt_wreg; 2871 2873 ··· 2888 2886 return 0; 2889 2887 } 2890 2888 2891 - static int dce_v10_0_sw_init(struct amdgpu_device *adev) 2889 + static int dce_v10_0_sw_init(void *handle) 2892 2890 { 2893 2891 int r, i; 2892 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 2894 2893 2895 2894 for (i = 0; i < adev->mode_info.num_crtc; i++) { 2896 2895 r = amdgpu_irq_add_id(adev, i + 1, &adev->crtc_irq); ··· 2953 2950 return r; 2954 2951 } 2955 2952 2956 - static int dce_v10_0_sw_fini(struct amdgpu_device *adev) 2953 + static int dce_v10_0_sw_fini(void *handle) 2957 2954 { 2955 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 2956 + 2958 2957 kfree(adev->mode_info.bios_hardcoded_edid); 2959 2958 2960 2959 drm_kms_helper_poll_fini(adev->ddev); ··· 2971 2966 return 0; 2972 2967 } 2973 2968 2974 - static int dce_v10_0_hw_init(struct amdgpu_device *adev) 2969 + static int dce_v10_0_hw_init(void *handle) 2975 2970 { 2976 2971 int i; 2972 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 2977 2973 2978 2974 dce_v10_0_init_golden_registers(adev); 2979 2975 ··· 2992 2986 return 0; 2993 2987 } 2994 2988 2995 - static int dce_v10_0_hw_fini(struct amdgpu_device *adev) 2989 + static int dce_v10_0_hw_fini(void *handle) 2996 2990 { 2997 2991 int i; 2992 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 2998 2993 2999 2994 dce_v10_0_hpd_fini(adev); 3000 2995 ··· 3006 2999 return 0; 3007 3000 } 3008 3001 3009 - static int dce_v10_0_suspend(struct amdgpu_device *adev) 3002 + static int dce_v10_0_suspend(void *handle) 3010 3003 { 3011 3004 struct drm_connector *connector; 3005 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 3012 3006 3013 3007 drm_kms_helper_poll_disable(adev->ddev); 3014 3008 ··· 3025 3017 return 0; 3026 3018 } 3027 3019 3028 - static int dce_v10_0_resume(struct amdgpu_device *adev) 3020 + static int dce_v10_0_resume(void *handle) 3029 3021 { 3030 3022 struct drm_connector *connector; 3023 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 3031 3024 3032 3025 dce_v10_0_init_golden_registers(adev); 3033 3026 ··· 3060 3051 return 0; 3061 3052 } 3062 3053 3063 - static bool dce_v10_0_is_idle(struct amdgpu_device *adev) 3054 + static bool dce_v10_0_is_idle(void *handle) 3064 3055 { 3065 - /* XXX todo */ 3066 3056 return true; 3067 3057 } 3068 3058 3069 - static int dce_v10_0_wait_for_idle(struct amdgpu_device *adev) 3059 + static int dce_v10_0_wait_for_idle(void *handle) 3070 3060 { 3071 - /* XXX todo */ 3072 3061 return 0; 3073 3062 } 3074 3063 3075 - static void dce_v10_0_print_status(struct amdgpu_device *adev) 3064 + static void dce_v10_0_print_status(void *handle) 3076 3065 { 3066 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 3067 + 3077 3068 dev_info(adev->dev, "DCE 10.x registers\n"); 3078 3069 /* XXX todo */ 3079 3070 } 3080 3071 3081 - static int dce_v10_0_soft_reset(struct amdgpu_device *adev) 3072 + static int dce_v10_0_soft_reset(void *handle) 3082 3073 { 3083 3074 u32 srbm_soft_reset = 0, tmp; 3075 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 3084 3076 3085 3077 if (dce_v10_0_is_display_hung(adev)) 3086 3078 srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_DC_MASK; 3087 3079 3088 3080 if (srbm_soft_reset) { 3089 - dce_v10_0_print_status(adev); 3081 + dce_v10_0_print_status((void *)adev); 3090 3082 3091 3083 tmp = RREG32(mmSRBM_SOFT_RESET); 3092 3084 tmp |= srbm_soft_reset; ··· 3103 3093 3104 3094 /* Wait a little for things to settle down */ 3105 3095 udelay(50); 3106 - dce_v10_0_print_status(adev); 3096 + dce_v10_0_print_status((void *)adev); 3107 3097 } 3108 3098 return 0; 3109 3099 } ··· 3459 3449 return 0; 3460 3450 } 3461 3451 3462 - static int dce_v10_0_set_clockgating_state(struct amdgpu_device *adev, 3463 - enum amdgpu_clockgating_state state) 3452 + static int dce_v10_0_set_clockgating_state(void *handle, 3453 + enum amd_clockgating_state state) 3464 3454 { 3465 3455 return 0; 3466 3456 } 3467 3457 3468 - static int dce_v10_0_set_powergating_state(struct amdgpu_device *adev, 3469 - enum amdgpu_powergating_state state) 3458 + static int dce_v10_0_set_powergating_state(void *handle, 3459 + enum amd_powergating_state state) 3470 3460 { 3471 3461 return 0; 3472 3462 } 3473 3463 3474 - const struct amdgpu_ip_funcs dce_v10_0_ip_funcs = { 3464 + const struct amd_ip_funcs dce_v10_0_ip_funcs = { 3475 3465 .early_init = dce_v10_0_early_init, 3476 3466 .late_init = NULL, 3477 3467 .sw_init = dce_v10_0_sw_init,
+1 -1
drivers/gpu/drm/amd/amdgpu/dce_v10_0.h
··· 24 24 #ifndef __DCE_V10_0_H__ 25 25 #define __DCE_V10_0_H__ 26 26 27 - extern const struct amdgpu_ip_funcs dce_v10_0_ip_funcs; 27 + extern const struct amd_ip_funcs dce_v10_0_ip_funcs; 28 28 29 29 #endif
+30 -20
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
··· 2863 2863 return 0; 2864 2864 } 2865 2865 2866 - static int dce_v11_0_early_init(struct amdgpu_device *adev) 2866 + static int dce_v11_0_early_init(void *handle) 2867 2867 { 2868 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 2869 + 2868 2870 adev->audio_endpt_rreg = &dce_v11_0_audio_endpt_rreg; 2869 2871 adev->audio_endpt_wreg = &dce_v11_0_audio_endpt_wreg; 2870 2872 ··· 2887 2885 return 0; 2888 2886 } 2889 2887 2890 - static int dce_v11_0_sw_init(struct amdgpu_device *adev) 2888 + static int dce_v11_0_sw_init(void *handle) 2891 2889 { 2892 2890 int r, i; 2891 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 2893 2892 2894 2893 for (i = 0; i < adev->mode_info.num_crtc; i++) { 2895 2894 r = amdgpu_irq_add_id(adev, i + 1, &adev->crtc_irq); ··· 2952 2949 return r; 2953 2950 } 2954 2951 2955 - static int dce_v11_0_sw_fini(struct amdgpu_device *adev) 2952 + static int dce_v11_0_sw_fini(void *handle) 2956 2953 { 2954 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 2955 + 2957 2956 kfree(adev->mode_info.bios_hardcoded_edid); 2958 2957 2959 2958 drm_kms_helper_poll_fini(adev->ddev); ··· 2969 2964 return 0; 2970 2965 } 2971 2966 2972 - static int dce_v11_0_hw_init(struct amdgpu_device *adev) 2967 + static int dce_v11_0_hw_init(void *handle) 2973 2968 { 2974 2969 int i; 2970 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 2975 2971 2976 2972 dce_v11_0_init_golden_registers(adev); 2977 2973 ··· 2990 2984 return 0; 2991 2985 } 2992 2986 2993 - static int dce_v11_0_hw_fini(struct amdgpu_device *adev) 2987 + static int dce_v11_0_hw_fini(void *handle) 2994 2988 { 2995 2989 int i; 2990 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 2996 2991 2997 2992 dce_v11_0_hpd_fini(adev); 2998 2993 ··· 3004 2997 return 0; 3005 2998 } 3006 2999 3007 - static int dce_v11_0_suspend(struct amdgpu_device *adev) 3000 + static int dce_v11_0_suspend(void *handle) 3008 3001 { 3009 3002 struct drm_connector *connector; 3003 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 3010 3004 3011 3005 drm_kms_helper_poll_disable(adev->ddev); 3012 3006 ··· 3023 3015 return 0; 3024 3016 } 3025 3017 3026 - static int dce_v11_0_resume(struct amdgpu_device *adev) 3018 + static int dce_v11_0_resume(void *handle) 3027 3019 { 3028 3020 struct drm_connector *connector; 3021 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 3029 3022 3030 3023 dce_v11_0_init_golden_registers(adev); 3031 3024 ··· 3059 3050 return 0; 3060 3051 } 3061 3052 3062 - static bool dce_v11_0_is_idle(struct amdgpu_device *adev) 3053 + static bool dce_v11_0_is_idle(void *handle) 3063 3054 { 3064 - /* XXX todo */ 3065 3055 return true; 3066 3056 } 3067 3057 3068 - static int dce_v11_0_wait_for_idle(struct amdgpu_device *adev) 3058 + static int dce_v11_0_wait_for_idle(void *handle) 3069 3059 { 3070 - /* XXX todo */ 3071 3060 return 0; 3072 3061 } 3073 3062 3074 - static void dce_v11_0_print_status(struct amdgpu_device *adev) 3063 + static void dce_v11_0_print_status(void *handle) 3075 3064 { 3065 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 3066 + 3076 3067 dev_info(adev->dev, "DCE 10.x registers\n"); 3077 3068 /* XXX todo */ 3078 3069 } 3079 3070 3080 - static int dce_v11_0_soft_reset(struct amdgpu_device *adev) 3071 + static int dce_v11_0_soft_reset(void *handle) 3081 3072 { 3082 3073 u32 srbm_soft_reset = 0, tmp; 3074 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 3083 3075 3084 3076 if (dce_v11_0_is_display_hung(adev)) 3085 3077 srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_DC_MASK; 3086 3078 3087 3079 if (srbm_soft_reset) { 3088 - dce_v11_0_print_status(adev); 3080 + dce_v11_0_print_status((void *)adev); 3089 3081 3090 3082 tmp = RREG32(mmSRBM_SOFT_RESET); 3091 3083 tmp |= srbm_soft_reset; ··· 3102 3092 3103 3093 /* Wait a little for things to settle down */ 3104 3094 udelay(50); 3105 - dce_v11_0_print_status(adev); 3095 + dce_v11_0_print_status((void *)adev); 3106 3096 } 3107 3097 return 0; 3108 3098 } ··· 3458 3448 return 0; 3459 3449 } 3460 3450 3461 - static int dce_v11_0_set_clockgating_state(struct amdgpu_device *adev, 3462 - enum amdgpu_clockgating_state state) 3451 + static int dce_v11_0_set_clockgating_state(void *handle, 3452 + enum amd_clockgating_state state) 3463 3453 { 3464 3454 return 0; 3465 3455 } 3466 3456 3467 - static int dce_v11_0_set_powergating_state(struct amdgpu_device *adev, 3468 - enum amdgpu_powergating_state state) 3457 + static int dce_v11_0_set_powergating_state(void *handle, 3458 + enum amd_powergating_state state) 3469 3459 { 3470 3460 return 0; 3471 3461 } 3472 3462 3473 - const struct amdgpu_ip_funcs dce_v11_0_ip_funcs = { 3463 + const struct amd_ip_funcs dce_v11_0_ip_funcs = { 3474 3464 .early_init = dce_v11_0_early_init, 3475 3465 .late_init = NULL, 3476 3466 .sw_init = dce_v11_0_sw_init,
+1 -1
drivers/gpu/drm/amd/amdgpu/dce_v11_0.h
··· 24 24 #ifndef __DCE_V11_0_H__ 25 25 #define __DCE_V11_0_H__ 26 26 27 - extern const struct amdgpu_ip_funcs dce_v11_0_ip_funcs; 27 + extern const struct amd_ip_funcs dce_v11_0_ip_funcs; 28 28 29 29 #endif
+30 -20
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
··· 2794 2794 return 0; 2795 2795 } 2796 2796 2797 - static int dce_v8_0_early_init(struct amdgpu_device *adev) 2797 + static int dce_v8_0_early_init(void *handle) 2798 2798 { 2799 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 2800 + 2799 2801 adev->audio_endpt_rreg = &dce_v8_0_audio_endpt_rreg; 2800 2802 adev->audio_endpt_wreg = &dce_v8_0_audio_endpt_wreg; 2801 2803 ··· 2830 2828 return 0; 2831 2829 } 2832 2830 2833 - static int dce_v8_0_sw_init(struct amdgpu_device *adev) 2831 + static int dce_v8_0_sw_init(void *handle) 2834 2832 { 2835 2833 int r, i; 2834 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 2836 2835 2837 2836 for (i = 0; i < adev->mode_info.num_crtc; i++) { 2838 2837 r = amdgpu_irq_add_id(adev, i + 1, &adev->crtc_irq); ··· 2895 2892 return r; 2896 2893 } 2897 2894 2898 - static int dce_v8_0_sw_fini(struct amdgpu_device *adev) 2895 + static int dce_v8_0_sw_fini(void *handle) 2899 2896 { 2897 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 2898 + 2900 2899 kfree(adev->mode_info.bios_hardcoded_edid); 2901 2900 2902 2901 drm_kms_helper_poll_fini(adev->ddev); ··· 2913 2908 return 0; 2914 2909 } 2915 2910 2916 - static int dce_v8_0_hw_init(struct amdgpu_device *adev) 2911 + static int dce_v8_0_hw_init(void *handle) 2917 2912 { 2918 2913 int i; 2914 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 2919 2915 2920 2916 /* init dig PHYs, disp eng pll */ 2921 2917 amdgpu_atombios_encoder_init_dig(adev); ··· 2932 2926 return 0; 2933 2927 } 2934 2928 2935 - static int dce_v8_0_hw_fini(struct amdgpu_device *adev) 2929 + static int dce_v8_0_hw_fini(void *handle) 2936 2930 { 2937 2931 int i; 2932 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 2938 2933 2939 2934 dce_v8_0_hpd_fini(adev); 2940 2935 ··· 2946 2939 return 0; 2947 2940 } 2948 2941 2949 - static int dce_v8_0_suspend(struct amdgpu_device *adev) 2942 + static int dce_v8_0_suspend(void *handle) 2950 2943 { 2951 2944 struct drm_connector *connector; 2945 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 2952 2946 2953 2947 drm_kms_helper_poll_disable(adev->ddev); 2954 2948 ··· 2965 2957 return 0; 2966 2958 } 2967 2959 2968 - static int dce_v8_0_resume(struct amdgpu_device *adev) 2960 + static int dce_v8_0_resume(void *handle) 2969 2961 { 2970 2962 struct drm_connector *connector; 2963 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 2971 2964 2972 2965 amdgpu_atombios_scratch_regs_restore(adev); 2973 2966 ··· 2998 2989 return 0; 2999 2990 } 3000 2991 3001 - static bool dce_v8_0_is_idle(struct amdgpu_device *adev) 2992 + static bool dce_v8_0_is_idle(void *handle) 3002 2993 { 3003 - /* XXX todo */ 3004 2994 return true; 3005 2995 } 3006 2996 3007 - static int dce_v8_0_wait_for_idle(struct amdgpu_device *adev) 2997 + static int dce_v8_0_wait_for_idle(void *handle) 3008 2998 { 3009 - /* XXX todo */ 3010 2999 return 0; 3011 3000 } 3012 3001 3013 - static void dce_v8_0_print_status(struct amdgpu_device *adev) 3002 + static void dce_v8_0_print_status(void *handle) 3014 3003 { 3004 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 3005 + 3015 3006 dev_info(adev->dev, "DCE 8.x registers\n"); 3016 3007 /* XXX todo */ 3017 3008 } 3018 3009 3019 - static int dce_v8_0_soft_reset(struct amdgpu_device *adev) 3010 + static int dce_v8_0_soft_reset(void *handle) 3020 3011 { 3021 3012 u32 srbm_soft_reset = 0, tmp; 3013 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 3022 3014 3023 3015 if (dce_v8_0_is_display_hung(adev)) 3024 3016 srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_DC_MASK; 3025 3017 3026 3018 if (srbm_soft_reset) { 3027 - dce_v8_0_print_status(adev); 3019 + dce_v8_0_print_status((void *)adev); 3028 3020 3029 3021 tmp = RREG32(mmSRBM_SOFT_RESET); 3030 3022 tmp |= srbm_soft_reset; ··· 3041 3031 3042 3032 /* Wait a little for things to settle down */ 3043 3033 udelay(50); 3044 - dce_v8_0_print_status(adev); 3034 + dce_v8_0_print_status((void *)adev); 3045 3035 } 3046 3036 return 0; 3047 3037 } ··· 3419 3409 3420 3410 } 3421 3411 3422 - static int dce_v8_0_set_clockgating_state(struct amdgpu_device *adev, 3423 - enum amdgpu_clockgating_state state) 3412 + static int dce_v8_0_set_clockgating_state(void *handle, 3413 + enum amd_clockgating_state state) 3424 3414 { 3425 3415 return 0; 3426 3416 } 3427 3417 3428 - static int dce_v8_0_set_powergating_state(struct amdgpu_device *adev, 3429 - enum amdgpu_powergating_state state) 3418 + static int dce_v8_0_set_powergating_state(void *handle, 3419 + enum amd_powergating_state state) 3430 3420 { 3431 3421 return 0; 3432 3422 } 3433 3423 3434 - const struct amdgpu_ip_funcs dce_v8_0_ip_funcs = { 3424 + const struct amd_ip_funcs dce_v8_0_ip_funcs = { 3435 3425 .early_init = dce_v8_0_early_init, 3436 3426 .late_init = NULL, 3437 3427 .sw_init = dce_v8_0_sw_init,
+1 -1
drivers/gpu/drm/amd/amdgpu/dce_v8_0.h
··· 24 24 #ifndef __DCE_V8_0_H__ 25 25 #define __DCE_V8_0_H__ 26 26 27 - extern const struct amdgpu_ip_funcs dce_v8_0_ip_funcs; 27 + extern const struct amd_ip_funcs dce_v8_0_ip_funcs; 28 28 29 29 #endif
+37 -20
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
··· 4682 4682 amdgpu_ring_write(ring, (1 << (oa_size + oa_base)) - (1 << oa_base)); 4683 4683 } 4684 4684 4685 - static int gfx_v7_0_early_init(struct amdgpu_device *adev) 4685 + static int gfx_v7_0_early_init(void *handle) 4686 4686 { 4687 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 4687 4688 4688 4689 adev->gfx.num_gfx_rings = GFX7_NUM_GFX_RINGS; 4689 4690 adev->gfx.num_compute_rings = GFX7_NUM_COMPUTE_RINGS; ··· 4695 4694 return 0; 4696 4695 } 4697 4696 4698 - static int gfx_v7_0_sw_init(struct amdgpu_device *adev) 4697 + static int gfx_v7_0_sw_init(void *handle) 4699 4698 { 4700 4699 struct amdgpu_ring *ring; 4700 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 4701 4701 int i, r; 4702 4702 4703 4703 /* EOP Event */ ··· 4807 4805 return r; 4808 4806 } 4809 4807 4810 - static int gfx_v7_0_sw_fini(struct amdgpu_device *adev) 4808 + static int gfx_v7_0_sw_fini(void *handle) 4811 4809 { 4812 4810 int i; 4811 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 4813 4812 4814 4813 amdgpu_bo_unref(&adev->gds.oa_gfx_bo); 4815 4814 amdgpu_bo_unref(&adev->gds.gws_gfx_bo); ··· 4830 4827 return 0; 4831 4828 } 4832 4829 4833 - static int gfx_v7_0_hw_init(struct amdgpu_device *adev) 4830 + static int gfx_v7_0_hw_init(void *handle) 4834 4831 { 4835 4832 int r; 4833 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 4836 4834 4837 4835 gfx_v7_0_gpu_init(adev); 4838 4836 ··· 4849 4845 return r; 4850 4846 } 4851 4847 4852 - static int gfx_v7_0_hw_fini(struct amdgpu_device *adev) 4848 + static int gfx_v7_0_hw_fini(void *handle) 4853 4849 { 4850 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 4851 + 4854 4852 gfx_v7_0_cp_enable(adev, false); 4855 4853 gfx_v7_0_rlc_stop(adev); 4856 4854 gfx_v7_0_fini_pg(adev); ··· 4860 4854 return 0; 4861 4855 } 4862 4856 4863 - static int gfx_v7_0_suspend(struct amdgpu_device *adev) 4857 + static int gfx_v7_0_suspend(void *handle) 4864 4858 { 4859 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 4860 + 4865 4861 return gfx_v7_0_hw_fini(adev); 4866 4862 } 4867 4863 4868 - static int gfx_v7_0_resume(struct amdgpu_device *adev) 4864 + static int gfx_v7_0_resume(void *handle) 4869 4865 { 4866 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 4867 + 4870 4868 return gfx_v7_0_hw_init(adev); 4871 4869 } 4872 4870 4873 - static bool gfx_v7_0_is_idle(struct amdgpu_device *adev) 4871 + static bool gfx_v7_0_is_idle(void *handle) 4874 4872 { 4873 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 4874 + 4875 4875 if (RREG32(mmGRBM_STATUS) & GRBM_STATUS__GUI_ACTIVE_MASK) 4876 4876 return false; 4877 4877 else 4878 4878 return true; 4879 4879 } 4880 4880 4881 - static int gfx_v7_0_wait_for_idle(struct amdgpu_device *adev) 4881 + static int gfx_v7_0_wait_for_idle(void *handle) 4882 4882 { 4883 4883 unsigned i; 4884 4884 u32 tmp; 4885 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 4885 4886 4886 4887 for (i = 0; i < adev->usec_timeout; i++) { 4887 4888 /* read MC_STATUS */ ··· 4901 4888 return -ETIMEDOUT; 4902 4889 } 4903 4890 4904 - static void gfx_v7_0_print_status(struct amdgpu_device *adev) 4891 + static void gfx_v7_0_print_status(void *handle) 4905 4892 { 4906 4893 int i; 4894 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 4907 4895 4908 4896 dev_info(adev->dev, "GFX 7.x registers\n"); 4909 4897 dev_info(adev->dev, " GRBM_STATUS=0x%08X\n", ··· 5161 5147 mutex_unlock(&adev->srbm_mutex); 5162 5148 } 5163 5149 5164 - static int gfx_v7_0_soft_reset(struct amdgpu_device *adev) 5150 + static int gfx_v7_0_soft_reset(void *handle) 5165 5151 { 5166 5152 u32 grbm_soft_reset = 0, srbm_soft_reset = 0; 5167 5153 u32 tmp; 5154 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 5168 5155 5169 5156 /* GRBM_STATUS */ 5170 5157 tmp = RREG32(mmGRBM_STATUS); ··· 5194 5179 srbm_soft_reset |= SRBM_SOFT_RESET__SOFT_RESET_GRBM_MASK; 5195 5180 5196 5181 if (grbm_soft_reset || srbm_soft_reset) { 5197 - gfx_v7_0_print_status(adev); 5182 + gfx_v7_0_print_status((void *)adev); 5198 5183 /* disable CG/PG */ 5199 5184 gfx_v7_0_fini_pg(adev); 5200 5185 gfx_v7_0_update_cg(adev, false); ··· 5237 5222 } 5238 5223 /* Wait a little for things to settle down */ 5239 5224 udelay(50); 5240 - gfx_v7_0_print_status(adev); 5225 + gfx_v7_0_print_status((void *)adev); 5241 5226 } 5242 5227 return 0; 5243 5228 } ··· 5440 5425 return 0; 5441 5426 } 5442 5427 5443 - static int gfx_v7_0_set_clockgating_state(struct amdgpu_device *adev, 5444 - enum amdgpu_clockgating_state state) 5428 + static int gfx_v7_0_set_clockgating_state(void *handle, 5429 + enum amd_clockgating_state state) 5445 5430 { 5446 5431 bool gate = false; 5432 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 5447 5433 5448 - if (state == AMDGPU_CG_STATE_GATE) 5434 + if (state == AMD_CG_STATE_GATE) 5449 5435 gate = true; 5450 5436 5451 5437 gfx_v7_0_enable_gui_idle_interrupt(adev, false); ··· 5463 5447 return 0; 5464 5448 } 5465 5449 5466 - static int gfx_v7_0_set_powergating_state(struct amdgpu_device *adev, 5467 - enum amdgpu_powergating_state state) 5450 + static int gfx_v7_0_set_powergating_state(void *handle, 5451 + enum amd_powergating_state state) 5468 5452 { 5469 5453 bool gate = false; 5454 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 5470 5455 5471 - if (state == AMDGPU_PG_STATE_GATE) 5456 + if (state == AMD_PG_STATE_GATE) 5472 5457 gate = true; 5473 5458 5474 5459 if (adev->pg_flags & (AMDGPU_PG_SUPPORT_GFX_PG | ··· 5488 5471 return 0; 5489 5472 } 5490 5473 5491 - const struct amdgpu_ip_funcs gfx_v7_0_ip_funcs = { 5474 + const struct amd_ip_funcs gfx_v7_0_ip_funcs = { 5492 5475 .early_init = gfx_v7_0_early_init, 5493 5476 .late_init = NULL, 5494 5477 .sw_init = gfx_v7_0_sw_init,
+1 -1
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.h
··· 24 24 #ifndef __GFX_V7_0_H__ 25 25 #define __GFX_V7_0_H__ 26 26 27 - extern const struct amdgpu_ip_funcs gfx_v7_0_ip_funcs; 27 + extern const struct amd_ip_funcs gfx_v7_0_ip_funcs; 28 28 29 29 /* XXX these shouldn't be exported */ 30 30 void gfx_v7_0_enter_rlc_safe_mode(struct amdgpu_device *adev);
+33 -18
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
··· 784 784 return 0; 785 785 } 786 786 787 - static int gfx_v8_0_sw_init(struct amdgpu_device *adev) 787 + static int gfx_v8_0_sw_init(void *handle) 788 788 { 789 789 int i, r; 790 790 struct amdgpu_ring *ring; 791 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 791 792 792 793 /* EOP Event */ 793 794 r = amdgpu_irq_add_id(adev, 181, &adev->gfx.eop_irq); ··· 898 897 return 0; 899 898 } 900 899 901 - static int gfx_v8_0_sw_fini(struct amdgpu_device *adev) 900 + static int gfx_v8_0_sw_fini(void *handle) 902 901 { 903 902 int i; 903 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 904 904 905 905 amdgpu_bo_unref(&adev->gds.oa_gfx_bo); 906 906 amdgpu_bo_unref(&adev->gds.gws_gfx_bo); ··· 3150 3148 gfx_v8_0_cp_compute_enable(adev, enable); 3151 3149 } 3152 3150 3153 - static int gfx_v8_0_hw_init(struct amdgpu_device *adev) 3151 + static int gfx_v8_0_hw_init(void *handle) 3154 3152 { 3155 3153 int r; 3154 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 3156 3155 3157 3156 gfx_v8_0_init_golden_registers(adev); 3158 3157 ··· 3170 3167 return r; 3171 3168 } 3172 3169 3173 - static int gfx_v8_0_hw_fini(struct amdgpu_device *adev) 3170 + static int gfx_v8_0_hw_fini(void *handle) 3174 3171 { 3172 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 3173 + 3175 3174 gfx_v8_0_cp_enable(adev, false); 3176 3175 gfx_v8_0_rlc_stop(adev); 3177 3176 gfx_v8_0_cp_compute_fini(adev); ··· 3181 3176 return 0; 3182 3177 } 3183 3178 3184 - static int gfx_v8_0_suspend(struct amdgpu_device *adev) 3179 + static int gfx_v8_0_suspend(void *handle) 3185 3180 { 3181 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 3182 + 3186 3183 return gfx_v8_0_hw_fini(adev); 3187 3184 } 3188 3185 3189 - static int gfx_v8_0_resume(struct amdgpu_device *adev) 3186 + static int gfx_v8_0_resume(void *handle) 3190 3187 { 3188 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 3189 + 3191 3190 return gfx_v8_0_hw_init(adev); 3192 3191 } 3193 3192 3194 - static bool gfx_v8_0_is_idle(struct amdgpu_device *adev) 3193 + static bool gfx_v8_0_is_idle(void *handle) 3195 3194 { 3195 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 3196 + 3196 3197 if (REG_GET_FIELD(RREG32(mmGRBM_STATUS), GRBM_STATUS, GUI_ACTIVE)) 3197 3198 return false; 3198 3199 else 3199 3200 return true; 3200 3201 } 3201 3202 3202 - static int gfx_v8_0_wait_for_idle(struct amdgpu_device *adev) 3203 + static int gfx_v8_0_wait_for_idle(void *handle) 3203 3204 { 3204 3205 unsigned i; 3205 3206 u32 tmp; 3207 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 3206 3208 3207 3209 for (i = 0; i < adev->usec_timeout; i++) { 3208 3210 /* read MC_STATUS */ ··· 3222 3210 return -ETIMEDOUT; 3223 3211 } 3224 3212 3225 - static void gfx_v8_0_print_status(struct amdgpu_device *adev) 3213 + static void gfx_v8_0_print_status(void *handle) 3226 3214 { 3227 3215 int i; 3216 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 3228 3217 3229 3218 dev_info(adev->dev, "GFX 8.x registers\n"); 3230 3219 dev_info(adev->dev, " GRBM_STATUS=0x%08X\n", ··· 3411 3398 mutex_unlock(&adev->srbm_mutex); 3412 3399 } 3413 3400 3414 - static int gfx_v8_0_soft_reset(struct amdgpu_device *adev) 3401 + static int gfx_v8_0_soft_reset(void *handle) 3415 3402 { 3416 3403 u32 grbm_soft_reset = 0, srbm_soft_reset = 0; 3417 3404 u32 tmp; 3405 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 3418 3406 3419 3407 /* GRBM_STATUS */ 3420 3408 tmp = RREG32(mmGRBM_STATUS); ··· 3451 3437 SRBM_SOFT_RESET, SOFT_RESET_GRBM, 1); 3452 3438 3453 3439 if (grbm_soft_reset || srbm_soft_reset) { 3454 - gfx_v8_0_print_status(adev); 3440 + gfx_v8_0_print_status((void *)adev); 3455 3441 /* stop the rlc */ 3456 3442 gfx_v8_0_rlc_stop(adev); 3457 3443 ··· 3490 3476 } 3491 3477 /* Wait a little for things to settle down */ 3492 3478 udelay(50); 3493 - gfx_v8_0_print_status(adev); 3479 + gfx_v8_0_print_status((void *)adev); 3494 3480 } 3495 3481 return 0; 3496 3482 } ··· 3563 3549 amdgpu_ring_write(ring, (1 << (oa_size + oa_base)) - (1 << oa_base)); 3564 3550 } 3565 3551 3566 - static int gfx_v8_0_early_init(struct amdgpu_device *adev) 3552 + static int gfx_v8_0_early_init(void *handle) 3567 3553 { 3554 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 3568 3555 3569 3556 adev->gfx.num_gfx_rings = GFX8_NUM_GFX_RINGS; 3570 3557 adev->gfx.num_compute_rings = GFX8_NUM_COMPUTE_RINGS; ··· 3576 3561 return 0; 3577 3562 } 3578 3563 3579 - static int gfx_v8_0_set_powergating_state(struct amdgpu_device *adev, 3580 - enum amdgpu_powergating_state state) 3564 + static int gfx_v8_0_set_powergating_state(void *handle, 3565 + enum amd_powergating_state state) 3581 3566 { 3582 3567 return 0; 3583 3568 } 3584 3569 3585 - static int gfx_v8_0_set_clockgating_state(struct amdgpu_device *adev, 3586 - enum amdgpu_clockgating_state state) 3570 + static int gfx_v8_0_set_clockgating_state(void *handle, 3571 + enum amd_clockgating_state state) 3587 3572 { 3588 3573 return 0; 3589 3574 } ··· 4131 4116 return 0; 4132 4117 } 4133 4118 4134 - const struct amdgpu_ip_funcs gfx_v8_0_ip_funcs = { 4119 + const struct amd_ip_funcs gfx_v8_0_ip_funcs = { 4135 4120 .early_init = gfx_v8_0_early_init, 4136 4121 .late_init = NULL, 4137 4122 .sw_init = gfx_v8_0_sw_init,
+1 -1
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.h
··· 24 24 #ifndef __GFX_V8_0_H__ 25 25 #define __GFX_V8_0_H__ 26 26 27 - extern const struct amdgpu_ip_funcs gfx_v8_0_ip_funcs; 27 + extern const struct amd_ip_funcs gfx_v8_0_ip_funcs; 28 28 29 29 uint64_t gfx_v8_0_get_gpu_clock_counter(struct amdgpu_device *adev); 30 30 void gfx_v8_0_select_se_sh(struct amdgpu_device *adev, u32 se_num, u32 sh_num);
+33 -19
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
··· 812 812 WREG32(mmHDP_MEM_POWER_LS, data); 813 813 } 814 814 815 - static int gmc_v7_0_early_init(struct amdgpu_device *adev) 815 + static int gmc_v7_0_early_init(void *handle) 816 816 { 817 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 818 + 817 819 gmc_v7_0_set_gart_funcs(adev); 818 820 gmc_v7_0_set_irq_funcs(adev); 819 821 ··· 834 832 return 0; 835 833 } 836 834 837 - static int gmc_v7_0_sw_init(struct amdgpu_device *adev) 835 + static int gmc_v7_0_sw_init(void *handle) 838 836 { 839 837 int r; 840 838 int dma_bits; 839 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 841 840 842 841 r = amdgpu_gem_init(adev); 843 842 if (r) ··· 914 911 return r; 915 912 } 916 913 917 - static int gmc_v7_0_sw_fini(struct amdgpu_device *adev) 914 + static int gmc_v7_0_sw_fini(void *handle) 918 915 { 919 916 int i; 917 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 920 918 921 919 if (adev->vm_manager.enabled) { 922 920 for (i = 0; i < AMDGPU_NUM_VM; ++i) ··· 932 928 return 0; 933 929 } 934 930 935 - static int gmc_v7_0_hw_init(struct amdgpu_device *adev) 931 + static int gmc_v7_0_hw_init(void *handle) 936 932 { 937 933 int r; 934 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 938 935 939 936 gmc_v7_0_mc_program(adev); 940 937 ··· 954 949 return r; 955 950 } 956 951 957 - static int gmc_v7_0_hw_fini(struct amdgpu_device *adev) 952 + static int gmc_v7_0_hw_fini(void *handle) 958 953 { 954 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 955 + 959 956 gmc_v7_0_gart_disable(adev); 960 957 961 958 return 0; 962 959 } 963 960 964 - static int gmc_v7_0_suspend(struct amdgpu_device *adev) 961 + static int gmc_v7_0_suspend(void *handle) 965 962 { 966 963 int i; 964 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 967 965 968 966 if (adev->vm_manager.enabled) { 969 967 for (i = 0; i < AMDGPU_NUM_VM; ++i) ··· 979 971 return 0; 980 972 } 981 973 982 - static int gmc_v7_0_resume(struct amdgpu_device *adev) 974 + static int gmc_v7_0_resume(void *handle) 983 975 { 984 976 int r; 977 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 985 978 986 979 r = gmc_v7_0_hw_init(adev); 987 980 if (r) ··· 1000 991 return r; 1001 992 } 1002 993 1003 - static bool gmc_v7_0_is_idle(struct amdgpu_device *adev) 994 + static bool gmc_v7_0_is_idle(void *handle) 1004 995 { 996 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1005 997 u32 tmp = RREG32(mmSRBM_STATUS); 1006 998 1007 999 if (tmp & (SRBM_STATUS__MCB_BUSY_MASK | SRBM_STATUS__MCB_NON_DISPLAY_BUSY_MASK | ··· 1012 1002 return true; 1013 1003 } 1014 1004 1015 - static int gmc_v7_0_wait_for_idle(struct amdgpu_device *adev) 1005 + static int gmc_v7_0_wait_for_idle(void *handle) 1016 1006 { 1017 1007 unsigned i; 1018 1008 u32 tmp; 1009 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1019 1010 1020 1011 for (i = 0; i < adev->usec_timeout; i++) { 1021 1012 /* read MC_STATUS */ ··· 1033 1022 1034 1023 } 1035 1024 1036 - static void gmc_v7_0_print_status(struct amdgpu_device *adev) 1025 + static void gmc_v7_0_print_status(void *handle) 1037 1026 { 1038 1027 int i, j; 1028 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1039 1029 1040 1030 dev_info(adev->dev, "GMC 8.x registers\n"); 1041 1031 dev_info(adev->dev, " SRBM_STATUS=0x%08X\n", ··· 1141 1129 RREG32(mmBIF_FB_EN)); 1142 1130 } 1143 1131 1144 - static int gmc_v7_0_soft_reset(struct amdgpu_device *adev) 1132 + static int gmc_v7_0_soft_reset(void *handle) 1145 1133 { 1134 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1146 1135 struct amdgpu_mode_mc_save save; 1147 1136 u32 srbm_soft_reset = 0; 1148 1137 u32 tmp = RREG32(mmSRBM_STATUS); ··· 1160 1147 } 1161 1148 1162 1149 if (srbm_soft_reset) { 1163 - gmc_v7_0_print_status(adev); 1150 + gmc_v7_0_print_status((void *)adev); 1164 1151 1165 1152 gmc_v7_0_mc_stop(adev, &save); 1166 1153 if (gmc_v7_0_wait_for_idle(adev)) { ··· 1186 1173 gmc_v7_0_mc_resume(adev, &save); 1187 1174 udelay(50); 1188 1175 1189 - gmc_v7_0_print_status(adev); 1176 + gmc_v7_0_print_status((void *)adev); 1190 1177 } 1191 1178 1192 1179 return 0; ··· 1255 1242 return 0; 1256 1243 } 1257 1244 1258 - static int gmc_v7_0_set_clockgating_state(struct amdgpu_device *adev, 1259 - enum amdgpu_clockgating_state state) 1245 + static int gmc_v7_0_set_clockgating_state(void *handle, 1246 + enum amd_clockgating_state state) 1260 1247 { 1261 1248 bool gate = false; 1249 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1262 1250 1263 - if (state == AMDGPU_CG_STATE_GATE) 1251 + if (state == AMD_CG_STATE_GATE) 1264 1252 gate = true; 1265 1253 1266 1254 if (!(adev->flags & AMDGPU_IS_APU)) { ··· 1275 1261 return 0; 1276 1262 } 1277 1263 1278 - static int gmc_v7_0_set_powergating_state(struct amdgpu_device *adev, 1279 - enum amdgpu_powergating_state state) 1264 + static int gmc_v7_0_set_powergating_state(void *handle, 1265 + enum amd_powergating_state state) 1280 1266 { 1281 1267 return 0; 1282 1268 } 1283 1269 1284 - const struct amdgpu_ip_funcs gmc_v7_0_ip_funcs = { 1270 + const struct amd_ip_funcs gmc_v7_0_ip_funcs = { 1285 1271 .early_init = gmc_v7_0_early_init, 1286 1272 .late_init = NULL, 1287 1273 .sw_init = gmc_v7_0_sw_init,
+1 -1
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.h
··· 24 24 #ifndef __GMC_V7_0_H__ 25 25 #define __GMC_V7_0_H__ 26 26 27 - extern const struct amdgpu_ip_funcs gmc_v7_0_ip_funcs; 27 + extern const struct amd_ip_funcs gmc_v7_0_ip_funcs; 28 28 29 29 /* XXX these shouldn't be exported */ 30 30 void gmc_v7_0_mc_stop(struct amdgpu_device *adev,
+35 -24
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
··· 786 786 "write" : "read", block, mc_client, mc_id); 787 787 } 788 788 789 - static int gmc_v8_0_early_init(struct amdgpu_device *adev) 789 + static int gmc_v8_0_early_init(void *handle) 790 790 { 791 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 792 + 791 793 gmc_v8_0_set_gart_funcs(adev); 792 794 gmc_v8_0_set_irq_funcs(adev); 793 795 ··· 808 806 return 0; 809 807 } 810 808 811 - static int gmc_v8_0_sw_init(struct amdgpu_device *adev) 809 + static int gmc_v8_0_sw_init(void *handle) 812 810 { 813 811 int r; 814 812 int dma_bits; 813 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 815 814 816 815 r = amdgpu_gem_init(adev); 817 816 if (r) ··· 888 885 return r; 889 886 } 890 887 891 - static int gmc_v8_0_sw_fini(struct amdgpu_device *adev) 888 + static int gmc_v8_0_sw_fini(void *handle) 892 889 { 893 890 int i; 891 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 894 892 895 893 if (adev->vm_manager.enabled) { 896 894 for (i = 0; i < AMDGPU_NUM_VM; ++i) ··· 906 902 return 0; 907 903 } 908 904 909 - static int gmc_v8_0_hw_init(struct amdgpu_device *adev) 905 + static int gmc_v8_0_hw_init(void *handle) 910 906 { 911 907 int r; 908 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 912 909 913 910 gmc_v8_0_init_golden_registers(adev); 914 911 ··· 930 925 return r; 931 926 } 932 927 933 - static int gmc_v8_0_hw_fini(struct amdgpu_device *adev) 928 + static int gmc_v8_0_hw_fini(void *handle) 934 929 { 930 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 931 + 935 932 gmc_v8_0_gart_disable(adev); 936 933 937 934 return 0; 938 935 } 939 936 940 - static int gmc_v8_0_suspend(struct amdgpu_device *adev) 937 + static int gmc_v8_0_suspend(void *handle) 941 938 { 942 939 int i; 940 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 943 941 944 942 if (adev->vm_manager.enabled) { 945 943 for (i = 0; i < AMDGPU_NUM_VM; ++i) ··· 955 947 return 0; 956 948 } 957 949 958 - static int gmc_v8_0_resume(struct amdgpu_device *adev) 950 + static int gmc_v8_0_resume(void *handle) 959 951 { 960 952 int r; 953 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 961 954 962 955 r = gmc_v8_0_hw_init(adev); 963 956 if (r) ··· 976 967 return r; 977 968 } 978 969 979 - static bool gmc_v8_0_is_idle(struct amdgpu_device *adev) 970 + static bool gmc_v8_0_is_idle(void *handle) 980 971 { 972 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 981 973 u32 tmp = RREG32(mmSRBM_STATUS); 982 974 983 975 if (tmp & (SRBM_STATUS__MCB_BUSY_MASK | SRBM_STATUS__MCB_NON_DISPLAY_BUSY_MASK | ··· 988 978 return true; 989 979 } 990 980 991 - static int gmc_v8_0_wait_for_idle(struct amdgpu_device *adev) 981 + static int gmc_v8_0_wait_for_idle(void *handle) 992 982 { 993 983 unsigned i; 994 984 u32 tmp; 985 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 995 986 996 987 for (i = 0; i < adev->usec_timeout; i++) { 997 988 /* read MC_STATUS */ ··· 1010 999 1011 1000 } 1012 1001 1013 - static void gmc_v8_0_print_status(struct amdgpu_device *adev) 1002 + static void gmc_v8_0_print_status(void *handle) 1014 1003 { 1015 1004 int i, j; 1005 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1016 1006 1017 1007 dev_info(adev->dev, "GMC 8.x registers\n"); 1018 1008 dev_info(adev->dev, " SRBM_STATUS=0x%08X\n", ··· 1115 1103 RREG32(mmBIF_FB_EN)); 1116 1104 } 1117 1105 1118 - static int gmc_v8_0_soft_reset(struct amdgpu_device *adev) 1106 + static int gmc_v8_0_soft_reset(void *handle) 1119 1107 { 1120 1108 struct amdgpu_mode_mc_save save; 1121 1109 u32 srbm_soft_reset = 0; 1110 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1122 1111 u32 tmp = RREG32(mmSRBM_STATUS); 1123 1112 1124 1113 if (tmp & SRBM_STATUS__VMC_BUSY_MASK) ··· 1134 1121 } 1135 1122 1136 1123 if (srbm_soft_reset) { 1137 - gmc_v8_0_print_status(adev); 1124 + gmc_v8_0_print_status((void *)adev); 1138 1125 1139 1126 gmc_v8_0_mc_stop(adev, &save); 1140 1127 if (gmc_v8_0_wait_for_idle(adev)) { ··· 1160 1147 gmc_v8_0_mc_resume(adev, &save); 1161 1148 udelay(50); 1162 1149 1163 - gmc_v8_0_print_status(adev); 1150 + gmc_v8_0_print_status((void *)adev); 1164 1151 } 1165 1152 1166 1153 return 0; ··· 1230 1217 return 0; 1231 1218 } 1232 1219 1233 - static int gmc_v8_0_set_clockgating_state(struct amdgpu_device *adev, 1234 - enum amdgpu_clockgating_state state) 1235 - { 1236 - /* XXX handled via the smc on VI */ 1237 - 1238 - return 0; 1239 - } 1240 - 1241 - static int gmc_v8_0_set_powergating_state(struct amdgpu_device *adev, 1242 - enum amdgpu_powergating_state state) 1220 + static int gmc_v8_0_set_clockgating_state(void *handle, 1221 + enum amd_clockgating_state state) 1243 1222 { 1244 1223 return 0; 1245 1224 } 1246 1225 1247 - const struct amdgpu_ip_funcs gmc_v8_0_ip_funcs = { 1226 + static int gmc_v8_0_set_powergating_state(void *handle, 1227 + enum amd_powergating_state state) 1228 + { 1229 + return 0; 1230 + } 1231 + 1232 + const struct amd_ip_funcs gmc_v8_0_ip_funcs = { 1248 1233 .early_init = gmc_v8_0_early_init, 1249 1234 .late_init = NULL, 1250 1235 .sw_init = gmc_v8_0_sw_init,
+1 -1
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.h
··· 24 24 #ifndef __GMC_V8_0_H__ 25 25 #define __GMC_V8_0_H__ 26 26 27 - extern const struct amdgpu_ip_funcs gmc_v8_0_ip_funcs; 27 + extern const struct amd_ip_funcs gmc_v8_0_ip_funcs; 28 28 29 29 /* XXX these shouldn't be exported */ 30 30 void gmc_v8_0_mc_stop(struct amdgpu_device *adev,
+22 -12
drivers/gpu/drm/amd/amdgpu/iceland_dpm.c
··· 30 30 31 31 static void iceland_dpm_set_funcs(struct amdgpu_device *adev); 32 32 33 - static int iceland_dpm_early_init(struct amdgpu_device *adev) 33 + static int iceland_dpm_early_init(void *handle) 34 34 { 35 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 36 + 35 37 iceland_dpm_set_funcs(adev); 36 38 37 39 return 0; ··· 58 56 return err; 59 57 } 60 58 61 - static int iceland_dpm_sw_init(struct amdgpu_device *adev) 59 + static int iceland_dpm_sw_init(void *handle) 62 60 { 63 61 int ret; 62 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 64 63 65 64 ret = iceland_dpm_init_microcode(adev); 66 65 if (ret) ··· 70 67 return 0; 71 68 } 72 69 73 - static int iceland_dpm_sw_fini(struct amdgpu_device *adev) 70 + static int iceland_dpm_sw_fini(void *handle) 74 71 { 75 72 return 0; 76 73 } 77 74 78 - static int iceland_dpm_hw_init(struct amdgpu_device *adev) 75 + static int iceland_dpm_hw_init(void *handle) 79 76 { 80 77 int ret; 78 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 81 79 82 80 mutex_lock(&adev->pm.mutex); 83 81 ··· 103 99 return -EINVAL; 104 100 } 105 101 106 - static int iceland_dpm_hw_fini(struct amdgpu_device *adev) 102 + static int iceland_dpm_hw_fini(void *handle) 107 103 { 104 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 105 + 108 106 mutex_lock(&adev->pm.mutex); 109 107 iceland_smu_fini(adev); 110 108 mutex_unlock(&adev->pm.mutex); 111 109 return 0; 112 110 } 113 111 114 - static int iceland_dpm_suspend(struct amdgpu_device *adev) 112 + static int iceland_dpm_suspend(void *handle) 115 113 { 114 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 115 + 116 116 iceland_dpm_hw_fini(adev); 117 117 118 118 return 0; 119 119 } 120 120 121 - static int iceland_dpm_resume(struct amdgpu_device *adev) 121 + static int iceland_dpm_resume(void *handle) 122 122 { 123 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 124 + 123 125 iceland_dpm_hw_init(adev); 124 126 125 127 return 0; 126 128 } 127 129 128 - static int iceland_dpm_set_clockgating_state(struct amdgpu_device *adev, 129 - enum amdgpu_clockgating_state state) 130 + static int iceland_dpm_set_clockgating_state(void *handle, 131 + enum amd_clockgating_state state) 130 132 { 131 133 return 0; 132 134 } 133 135 134 - static int iceland_dpm_set_powergating_state(struct amdgpu_device *adev, 135 - enum amdgpu_powergating_state state) 136 + static int iceland_dpm_set_powergating_state(void *handle, 137 + enum amd_powergating_state state) 136 138 { 137 139 return 0; 138 140 } 139 141 140 - const struct amdgpu_ip_funcs iceland_dpm_ip_funcs = { 142 + const struct amd_ip_funcs iceland_dpm_ip_funcs = { 141 143 .early_init = iceland_dpm_early_init, 142 144 .late_init = NULL, 143 145 .sw_init = iceland_dpm_sw_init,
+35 -20
drivers/gpu/drm/amd/amdgpu/iceland_ih.c
··· 250 250 WREG32(mmIH_RB_RPTR, adev->irq.ih.rptr); 251 251 } 252 252 253 - static int iceland_ih_early_init(struct amdgpu_device *adev) 253 + static int iceland_ih_early_init(void *handle) 254 254 { 255 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 256 + 255 257 iceland_ih_set_interrupt_funcs(adev); 256 258 return 0; 257 259 } 258 260 259 - static int iceland_ih_sw_init(struct amdgpu_device *adev) 261 + static int iceland_ih_sw_init(void *handle) 260 262 { 261 263 int r; 264 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 262 265 263 266 r = amdgpu_ih_ring_init(adev, 64 * 1024, false); 264 267 if (r) ··· 272 269 return r; 273 270 } 274 271 275 - static int iceland_ih_sw_fini(struct amdgpu_device *adev) 272 + static int iceland_ih_sw_fini(void *handle) 276 273 { 274 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 275 + 277 276 amdgpu_irq_fini(adev); 278 277 amdgpu_ih_ring_fini(adev); 279 278 280 279 return 0; 281 280 } 282 281 283 - static int iceland_ih_hw_init(struct amdgpu_device *adev) 282 + static int iceland_ih_hw_init(void *handle) 284 283 { 285 284 int r; 285 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 286 286 287 287 r = iceland_ih_irq_init(adev); 288 288 if (r) ··· 294 288 return 0; 295 289 } 296 290 297 - static int iceland_ih_hw_fini(struct amdgpu_device *adev) 291 + static int iceland_ih_hw_fini(void *handle) 298 292 { 293 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 294 + 299 295 iceland_ih_irq_disable(adev); 300 296 301 297 return 0; 302 298 } 303 299 304 - static int iceland_ih_suspend(struct amdgpu_device *adev) 300 + static int iceland_ih_suspend(void *handle) 305 301 { 302 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 303 + 306 304 return iceland_ih_hw_fini(adev); 307 305 } 308 306 309 - static int iceland_ih_resume(struct amdgpu_device *adev) 307 + static int iceland_ih_resume(void *handle) 310 308 { 309 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 310 + 311 311 return iceland_ih_hw_init(adev); 312 312 } 313 313 314 - static bool iceland_ih_is_idle(struct amdgpu_device *adev) 314 + static bool iceland_ih_is_idle(void *handle) 315 315 { 316 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 316 317 u32 tmp = RREG32(mmSRBM_STATUS); 317 318 318 319 if (REG_GET_FIELD(tmp, SRBM_STATUS, IH_BUSY)) ··· 328 315 return true; 329 316 } 330 317 331 - static int iceland_ih_wait_for_idle(struct amdgpu_device *adev) 318 + static int iceland_ih_wait_for_idle(void *handle) 332 319 { 333 320 unsigned i; 334 321 u32 tmp; 322 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 335 323 336 324 for (i = 0; i < adev->usec_timeout; i++) { 337 325 /* read MC_STATUS */ ··· 344 330 return -ETIMEDOUT; 345 331 } 346 332 347 - static void iceland_ih_print_status(struct amdgpu_device *adev) 333 + static void iceland_ih_print_status(void *handle) 348 334 { 335 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 336 + 349 337 dev_info(adev->dev, "ICELAND IH registers\n"); 350 338 dev_info(adev->dev, " SRBM_STATUS=0x%08X\n", 351 339 RREG32(mmSRBM_STATUS)); ··· 373 357 RREG32(mmIH_RB_WPTR)); 374 358 } 375 359 376 - static int iceland_ih_soft_reset(struct amdgpu_device *adev) 360 + static int iceland_ih_soft_reset(void *handle) 377 361 { 378 362 u32 srbm_soft_reset = 0; 363 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 379 364 u32 tmp = RREG32(mmSRBM_STATUS); 380 365 381 366 if (tmp & SRBM_STATUS__IH_BUSY_MASK) ··· 384 367 SOFT_RESET_IH, 1); 385 368 386 369 if (srbm_soft_reset) { 387 - iceland_ih_print_status(adev); 370 + iceland_ih_print_status((void *)adev); 388 371 389 372 tmp = RREG32(mmSRBM_SOFT_RESET); 390 373 tmp |= srbm_soft_reset; ··· 401 384 /* Wait a little for things to settle down */ 402 385 udelay(50); 403 386 404 - iceland_ih_print_status(adev); 387 + iceland_ih_print_status((void *)adev); 405 388 } 406 389 407 390 return 0; 408 391 } 409 392 410 - static int iceland_ih_set_clockgating_state(struct amdgpu_device *adev, 411 - enum amdgpu_clockgating_state state) 393 + static int iceland_ih_set_clockgating_state(void *handle, 394 + enum amd_clockgating_state state) 412 395 { 413 - // TODO 414 396 return 0; 415 397 } 416 398 417 - static int iceland_ih_set_powergating_state(struct amdgpu_device *adev, 418 - enum amdgpu_powergating_state state) 399 + static int iceland_ih_set_powergating_state(void *handle, 400 + enum amd_powergating_state state) 419 401 { 420 - // TODO 421 402 return 0; 422 403 } 423 404 424 - const struct amdgpu_ip_funcs iceland_ih_ip_funcs = { 405 + const struct amd_ip_funcs iceland_ih_ip_funcs = { 425 406 .early_init = iceland_ih_early_init, 426 407 .late_init = NULL, 427 408 .sw_init = iceland_ih_sw_init,
+1 -1
drivers/gpu/drm/amd/amdgpu/iceland_ih.h
··· 24 24 #ifndef __ICELAND_IH_H__ 25 25 #define __ICELAND_IH_H__ 26 26 27 - extern const struct amdgpu_ip_funcs iceland_ih_ip_funcs; 27 + extern const struct amd_ip_funcs iceland_ih_ip_funcs; 28 28 29 29 #endif /* __ICELAND_IH_H__ */
+48 -41
drivers/gpu/drm/amd/amdgpu/kv_dpm.c
··· 1552 1552 if (amdgpu_new_state->evclk > 0 && amdgpu_current_state->evclk == 0) { 1553 1553 kv_dpm_powergate_vce(adev, false); 1554 1554 /* turn the clocks on when encoding */ 1555 - ret = amdgpu_set_clockgating_state(adev, AMDGPU_IP_BLOCK_TYPE_VCE, 1556 - AMDGPU_CG_STATE_UNGATE); 1555 + ret = amdgpu_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_VCE, 1556 + AMD_CG_STATE_UNGATE); 1557 1557 if (ret) 1558 1558 return ret; 1559 1559 if (pi->caps_stable_p_state) ··· 1579 1579 } else if (amdgpu_new_state->evclk == 0 && amdgpu_current_state->evclk > 0) { 1580 1580 kv_enable_vce_dpm(adev, false); 1581 1581 /* turn the clocks off when not encoding */ 1582 - ret = amdgpu_set_clockgating_state(adev, AMDGPU_IP_BLOCK_TYPE_VCE, 1583 - AMDGPU_CG_STATE_GATE); 1582 + ret = amdgpu_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_VCE, 1583 + AMD_CG_STATE_GATE); 1584 1584 if (ret) 1585 1585 return ret; 1586 1586 kv_dpm_powergate_vce(adev, true); ··· 1697 1697 if (gate) { 1698 1698 if (pi->caps_uvd_pg) { 1699 1699 /* disable clockgating so we can properly shut down the block */ 1700 - ret = amdgpu_set_clockgating_state(adev, AMDGPU_IP_BLOCK_TYPE_UVD, 1701 - AMDGPU_CG_STATE_UNGATE); 1700 + ret = amdgpu_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_UVD, 1701 + AMD_CG_STATE_UNGATE); 1702 1702 /* shutdown the UVD block */ 1703 - ret = amdgpu_set_powergating_state(adev, AMDGPU_IP_BLOCK_TYPE_UVD, 1704 - AMDGPU_PG_STATE_GATE); 1703 + ret = amdgpu_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_UVD, 1704 + AMD_PG_STATE_GATE); 1705 1705 /* XXX: check for errors */ 1706 1706 } 1707 1707 kv_update_uvd_dpm(adev, gate); ··· 1713 1713 /* power on the UVD block */ 1714 1714 amdgpu_kv_notify_message_to_smu(adev, PPSMC_MSG_UVDPowerON); 1715 1715 /* re-init the UVD block */ 1716 - ret = amdgpu_set_powergating_state(adev, AMDGPU_IP_BLOCK_TYPE_UVD, 1717 - AMDGPU_PG_STATE_UNGATE); 1716 + ret = amdgpu_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_UVD, 1717 + AMD_PG_STATE_UNGATE); 1718 1718 /* enable clockgating. hw will dynamically gate/ungate clocks on the fly */ 1719 - ret = amdgpu_set_clockgating_state(adev, AMDGPU_IP_BLOCK_TYPE_UVD, 1720 - AMDGPU_CG_STATE_GATE); 1719 + ret = amdgpu_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_UVD, 1720 + AMD_CG_STATE_GATE); 1721 1721 /* XXX: check for errors */ 1722 1722 } 1723 1723 kv_update_uvd_dpm(adev, gate); ··· 1737 1737 if (gate) { 1738 1738 if (pi->caps_vce_pg) { 1739 1739 /* shutdown the VCE block */ 1740 - ret = amdgpu_set_powergating_state(adev, AMDGPU_IP_BLOCK_TYPE_VCE, 1741 - AMDGPU_PG_STATE_GATE); 1740 + ret = amdgpu_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCE, 1741 + AMD_PG_STATE_GATE); 1742 1742 /* XXX: check for errors */ 1743 1743 /* power off the VCE block */ 1744 1744 amdgpu_kv_notify_message_to_smu(adev, PPSMC_MSG_VCEPowerOFF); ··· 1748 1748 /* power on the VCE block */ 1749 1749 amdgpu_kv_notify_message_to_smu(adev, PPSMC_MSG_VCEPowerON); 1750 1750 /* re-init the VCE block */ 1751 - ret = amdgpu_set_powergating_state(adev, AMDGPU_IP_BLOCK_TYPE_VCE, 1752 - AMDGPU_PG_STATE_UNGATE); 1751 + ret = amdgpu_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCE, 1752 + AMD_PG_STATE_UNGATE); 1753 1753 /* XXX: check for errors */ 1754 1754 } 1755 1755 } ··· 2981 2981 return actual_temp; 2982 2982 } 2983 2983 2984 - static int kv_dpm_early_init(struct amdgpu_device *adev) 2984 + static int kv_dpm_early_init(void *handle) 2985 2985 { 2986 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 2987 + 2986 2988 kv_dpm_set_dpm_funcs(adev); 2987 2989 kv_dpm_set_irq_funcs(adev); 2988 2990 2989 2991 return 0; 2990 2992 } 2991 2993 2992 - static int kv_dpm_late_init(struct amdgpu_device *adev) 2994 + static int kv_dpm_late_init(void *handle) 2993 2995 { 2994 - if (!amdgpu_dpm) 2995 - return 0; 2996 - 2997 2996 /* powerdown unused blocks for now */ 2997 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 2998 + 2998 2999 kv_dpm_powergate_acp(adev, true); 2999 3000 kv_dpm_powergate_samu(adev, true); 3000 3001 kv_dpm_powergate_vce(adev, true); ··· 3004 3003 return 0; 3005 3004 } 3006 3005 3007 - static int kv_dpm_sw_init(struct amdgpu_device *adev) 3006 + static int kv_dpm_sw_init(void *handle) 3008 3007 { 3009 3008 int ret; 3009 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 3010 3010 3011 3011 ret = amdgpu_irq_add_id(adev, 230, &adev->pm.dpm.thermal.irq); 3012 3012 if (ret) ··· 3053 3051 return ret; 3054 3052 } 3055 3053 3056 - static int kv_dpm_sw_fini(struct amdgpu_device *adev) 3054 + static int kv_dpm_sw_fini(void *handle) 3057 3055 { 3056 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 3057 + 3058 3058 mutex_lock(&adev->pm.mutex); 3059 3059 amdgpu_pm_sysfs_fini(adev); 3060 3060 kv_dpm_fini(adev); ··· 3065 3061 return 0; 3066 3062 } 3067 3063 3068 - static int kv_dpm_hw_init(struct amdgpu_device *adev) 3064 + static int kv_dpm_hw_init(void *handle) 3069 3065 { 3070 3066 int ret; 3071 - 3072 - if (!amdgpu_dpm) 3073 - return 0; 3067 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 3074 3068 3075 3069 mutex_lock(&adev->pm.mutex); 3076 3070 kv_dpm_setup_asic(adev); ··· 3082 3080 return ret; 3083 3081 } 3084 3082 3085 - static int kv_dpm_hw_fini(struct amdgpu_device *adev) 3083 + static int kv_dpm_hw_fini(void *handle) 3086 3084 { 3085 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 3086 + 3087 3087 if (adev->pm.dpm_enabled) { 3088 3088 mutex_lock(&adev->pm.mutex); 3089 3089 kv_dpm_disable(adev); ··· 3095 3091 return 0; 3096 3092 } 3097 3093 3098 - static int kv_dpm_suspend(struct amdgpu_device *adev) 3094 + static int kv_dpm_suspend(void *handle) 3099 3095 { 3096 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 3097 + 3100 3098 if (adev->pm.dpm_enabled) { 3101 3099 mutex_lock(&adev->pm.mutex); 3102 3100 /* disable dpm */ ··· 3110 3104 return 0; 3111 3105 } 3112 3106 3113 - static int kv_dpm_resume(struct amdgpu_device *adev) 3107 + static int kv_dpm_resume(void *handle) 3114 3108 { 3115 3109 int ret; 3110 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 3116 3111 3117 3112 if (adev->pm.dpm_enabled) { 3118 3113 /* asic init will reset to the boot state */ ··· 3131 3124 return 0; 3132 3125 } 3133 3126 3134 - static bool kv_dpm_is_idle(struct amdgpu_device *adev) 3127 + static bool kv_dpm_is_idle(void *handle) 3135 3128 { 3136 - /* XXX */ 3137 3129 return true; 3138 3130 } 3139 3131 3140 - static int kv_dpm_wait_for_idle(struct amdgpu_device *adev) 3132 + static int kv_dpm_wait_for_idle(void *handle) 3141 3133 { 3142 - /* XXX */ 3143 3134 return 0; 3144 3135 } 3145 3136 3146 - static void kv_dpm_print_status(struct amdgpu_device *adev) 3137 + static void kv_dpm_print_status(void *handle) 3147 3138 { 3139 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 3140 + 3148 3141 dev_info(adev->dev, "KV/KB DPM registers\n"); 3149 3142 dev_info(adev->dev, " DIDT_SQ_CTRL0=0x%08X\n", 3150 3143 RREG32_DIDT(ixDIDT_SQ_CTRL0)); ··· 3198 3191 RREG32(mmSMC_IND_ACCESS_CNTL)); 3199 3192 } 3200 3193 3201 - static int kv_dpm_soft_reset(struct amdgpu_device *adev) 3194 + static int kv_dpm_soft_reset(void *handle) 3202 3195 { 3203 3196 return 0; 3204 3197 } ··· 3281 3274 return 0; 3282 3275 } 3283 3276 3284 - static int kv_dpm_set_clockgating_state(struct amdgpu_device *adev, 3285 - enum amdgpu_clockgating_state state) 3277 + static int kv_dpm_set_clockgating_state(void *handle, 3278 + enum amd_clockgating_state state) 3286 3279 { 3287 3280 return 0; 3288 3281 } 3289 3282 3290 - static int kv_dpm_set_powergating_state(struct amdgpu_device *adev, 3291 - enum amdgpu_powergating_state state) 3283 + static int kv_dpm_set_powergating_state(void *handle, 3284 + enum amd_powergating_state state) 3292 3285 { 3293 3286 return 0; 3294 3287 } 3295 3288 3296 - const struct amdgpu_ip_funcs kv_dpm_ip_funcs = { 3289 + const struct amd_ip_funcs kv_dpm_ip_funcs = { 3297 3290 .early_init = kv_dpm_early_init, 3298 3291 .late_init = kv_dpm_late_init, 3299 3292 .sw_init = kv_dpm_sw_init,
+32 -19
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
··· 955 955 SDMA_PKT_POLL_REGMEM_DW5_INTERVAL(10)); /* retry count, poll interval */ 956 956 } 957 957 958 - static int sdma_v2_4_early_init(struct amdgpu_device *adev) 958 + static int sdma_v2_4_early_init(void *handle) 959 959 { 960 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 961 + 960 962 sdma_v2_4_set_ring_funcs(adev); 961 963 sdma_v2_4_set_buffer_funcs(adev); 962 964 sdma_v2_4_set_vm_pte_funcs(adev); ··· 967 965 return 0; 968 966 } 969 967 970 - static int sdma_v2_4_sw_init(struct amdgpu_device *adev) 968 + static int sdma_v2_4_sw_init(void *handle) 971 969 { 972 970 struct amdgpu_ring *ring; 973 971 int r; 972 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 974 973 975 974 /* SDMA trap event */ 976 975 r = amdgpu_irq_add_id(adev, 224, &adev->sdma_trap_irq); ··· 1023 1020 return r; 1024 1021 } 1025 1022 1026 - static int sdma_v2_4_sw_fini(struct amdgpu_device *adev) 1023 + static int sdma_v2_4_sw_fini(void *handle) 1027 1024 { 1025 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1026 + 1028 1027 amdgpu_ring_fini(&adev->sdma[0].ring); 1029 1028 amdgpu_ring_fini(&adev->sdma[1].ring); 1030 1029 1031 1030 return 0; 1032 1031 } 1033 1032 1034 - static int sdma_v2_4_hw_init(struct amdgpu_device *adev) 1033 + static int sdma_v2_4_hw_init(void *handle) 1035 1034 { 1036 1035 int r; 1036 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1037 1037 1038 1038 sdma_v2_4_init_golden_registers(adev); 1039 1039 ··· 1047 1041 return r; 1048 1042 } 1049 1043 1050 - static int sdma_v2_4_hw_fini(struct amdgpu_device *adev) 1044 + static int sdma_v2_4_hw_fini(void *handle) 1051 1045 { 1046 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1047 + 1052 1048 sdma_v2_4_enable(adev, false); 1053 1049 1054 1050 return 0; 1055 1051 } 1056 1052 1057 - static int sdma_v2_4_suspend(struct amdgpu_device *adev) 1053 + static int sdma_v2_4_suspend(void *handle) 1058 1054 { 1055 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1059 1056 1060 1057 return sdma_v2_4_hw_fini(adev); 1061 1058 } 1062 1059 1063 - static int sdma_v2_4_resume(struct amdgpu_device *adev) 1060 + static int sdma_v2_4_resume(void *handle) 1064 1061 { 1062 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1065 1063 1066 1064 return sdma_v2_4_hw_init(adev); 1067 1065 } 1068 1066 1069 - static bool sdma_v2_4_is_idle(struct amdgpu_device *adev) 1067 + static bool sdma_v2_4_is_idle(void *handle) 1070 1068 { 1069 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1071 1070 u32 tmp = RREG32(mmSRBM_STATUS2); 1072 1071 1073 1072 if (tmp & (SRBM_STATUS2__SDMA_BUSY_MASK | ··· 1082 1071 return true; 1083 1072 } 1084 1073 1085 - static int sdma_v2_4_wait_for_idle(struct amdgpu_device *adev) 1074 + static int sdma_v2_4_wait_for_idle(void *handle) 1086 1075 { 1087 1076 unsigned i; 1088 1077 u32 tmp; 1078 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1089 1079 1090 1080 for (i = 0; i < adev->usec_timeout; i++) { 1091 1081 tmp = RREG32(mmSRBM_STATUS2) & (SRBM_STATUS2__SDMA_BUSY_MASK | ··· 1099 1087 return -ETIMEDOUT; 1100 1088 } 1101 1089 1102 - static void sdma_v2_4_print_status(struct amdgpu_device *adev) 1090 + static void sdma_v2_4_print_status(void *handle) 1103 1091 { 1104 1092 int i, j; 1093 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1105 1094 1106 1095 dev_info(adev->dev, "VI SDMA registers\n"); 1107 1096 dev_info(adev->dev, " SRBM_STATUS2=0x%08X\n", ··· 1146 1133 } 1147 1134 } 1148 1135 1149 - static int sdma_v2_4_soft_reset(struct amdgpu_device *adev) 1136 + static int sdma_v2_4_soft_reset(void *handle) 1150 1137 { 1151 1138 u32 srbm_soft_reset = 0; 1139 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1152 1140 u32 tmp = RREG32(mmSRBM_STATUS2); 1153 1141 1154 1142 if (tmp & SRBM_STATUS2__SDMA_BUSY_MASK) { ··· 1168 1154 } 1169 1155 1170 1156 if (srbm_soft_reset) { 1171 - sdma_v2_4_print_status(adev); 1157 + sdma_v2_4_print_status((void *)adev); 1172 1158 1173 1159 tmp = RREG32(mmSRBM_SOFT_RESET); 1174 1160 tmp |= srbm_soft_reset; ··· 1185 1171 /* Wait a little for things to settle down */ 1186 1172 udelay(50); 1187 1173 1188 - sdma_v2_4_print_status(adev); 1174 + sdma_v2_4_print_status((void *)adev); 1189 1175 } 1190 1176 1191 1177 return 0; ··· 1286 1272 return 0; 1287 1273 } 1288 1274 1289 - static int sdma_v2_4_set_clockgating_state(struct amdgpu_device *adev, 1290 - enum amdgpu_clockgating_state state) 1275 + static int sdma_v2_4_set_clockgating_state(void *handle, 1276 + enum amd_clockgating_state state) 1291 1277 { 1292 1278 /* XXX handled via the smc on VI */ 1293 - 1294 1279 return 0; 1295 1280 } 1296 1281 1297 - static int sdma_v2_4_set_powergating_state(struct amdgpu_device *adev, 1298 - enum amdgpu_powergating_state state) 1282 + static int sdma_v2_4_set_powergating_state(void *handle, 1283 + enum amd_powergating_state state) 1299 1284 { 1300 1285 return 0; 1301 1286 } 1302 1287 1303 - const struct amdgpu_ip_funcs sdma_v2_4_ip_funcs = { 1288 + const struct amd_ip_funcs sdma_v2_4_ip_funcs = { 1304 1289 .early_init = sdma_v2_4_early_init, 1305 1290 .late_init = NULL, 1306 1291 .sw_init = sdma_v2_4_sw_init,
+1 -1
drivers/gpu/drm/amd/amdgpu/sdma_v2_4.h
··· 24 24 #ifndef __SDMA_V2_4_H__ 25 25 #define __SDMA_V2_4_H__ 26 26 27 - extern const struct amdgpu_ip_funcs sdma_v2_4_ip_funcs; 27 + extern const struct amd_ip_funcs sdma_v2_4_ip_funcs; 28 28 29 29 #endif
+36 -24
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
··· 1018 1018 SDMA_PKT_POLL_REGMEM_DW5_INTERVAL(10)); /* retry count, poll interval */ 1019 1019 } 1020 1020 1021 - static int sdma_v3_0_early_init(struct amdgpu_device *adev) 1021 + static int sdma_v3_0_early_init(void *handle) 1022 1022 { 1023 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1024 + 1023 1025 sdma_v3_0_set_ring_funcs(adev); 1024 1026 sdma_v3_0_set_buffer_funcs(adev); 1025 1027 sdma_v3_0_set_vm_pte_funcs(adev); ··· 1030 1028 return 0; 1031 1029 } 1032 1030 1033 - static int sdma_v3_0_sw_init(struct amdgpu_device *adev) 1031 + static int sdma_v3_0_sw_init(void *handle) 1034 1032 { 1035 1033 struct amdgpu_ring *ring; 1036 1034 int r; 1035 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1037 1036 1038 1037 /* SDMA trap event */ 1039 1038 r = amdgpu_irq_add_id(adev, 224, &adev->sdma_trap_irq); ··· 1088 1085 return r; 1089 1086 } 1090 1087 1091 - static int sdma_v3_0_sw_fini(struct amdgpu_device *adev) 1088 + static int sdma_v3_0_sw_fini(void *handle) 1092 1089 { 1090 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1091 + 1093 1092 amdgpu_ring_fini(&adev->sdma[0].ring); 1094 1093 amdgpu_ring_fini(&adev->sdma[1].ring); 1095 1094 1096 1095 return 0; 1097 1096 } 1098 1097 1099 - static int sdma_v3_0_hw_init(struct amdgpu_device *adev) 1098 + static int sdma_v3_0_hw_init(void *handle) 1100 1099 { 1101 1100 int r; 1101 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1102 1102 1103 1103 sdma_v3_0_init_golden_registers(adev); 1104 1104 ··· 1112 1106 return r; 1113 1107 } 1114 1108 1115 - static int sdma_v3_0_hw_fini(struct amdgpu_device *adev) 1109 + static int sdma_v3_0_hw_fini(void *handle) 1116 1110 { 1111 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1112 + 1117 1113 sdma_v3_0_enable(adev, false); 1118 1114 1119 1115 return 0; 1120 1116 } 1121 1117 1122 - static int sdma_v3_0_suspend(struct amdgpu_device *adev) 1118 + static int sdma_v3_0_suspend(void *handle) 1123 1119 { 1120 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1124 1121 1125 1122 return sdma_v3_0_hw_fini(adev); 1126 1123 } 1127 1124 1128 - static int sdma_v3_0_resume(struct amdgpu_device *adev) 1125 + static int sdma_v3_0_resume(void *handle) 1129 1126 { 1127 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1130 1128 1131 1129 return sdma_v3_0_hw_init(adev); 1132 1130 } 1133 1131 1134 - static bool sdma_v3_0_is_idle(struct amdgpu_device *adev) 1132 + static bool sdma_v3_0_is_idle(void *handle) 1135 1133 { 1134 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1136 1135 u32 tmp = RREG32(mmSRBM_STATUS2); 1137 1136 1138 1137 if (tmp & (SRBM_STATUS2__SDMA_BUSY_MASK | ··· 1147 1136 return true; 1148 1137 } 1149 1138 1150 - static int sdma_v3_0_wait_for_idle(struct amdgpu_device *adev) 1139 + static int sdma_v3_0_wait_for_idle(void *handle) 1151 1140 { 1152 1141 unsigned i; 1153 1142 u32 tmp; 1143 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1154 1144 1155 1145 for (i = 0; i < adev->usec_timeout; i++) { 1156 1146 tmp = RREG32(mmSRBM_STATUS2) & (SRBM_STATUS2__SDMA_BUSY_MASK | ··· 1164 1152 return -ETIMEDOUT; 1165 1153 } 1166 1154 1167 - static void sdma_v3_0_print_status(struct amdgpu_device *adev) 1155 + static void sdma_v3_0_print_status(void *handle) 1168 1156 { 1169 1157 int i, j; 1158 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1170 1159 1171 1160 dev_info(adev->dev, "VI SDMA registers\n"); 1172 1161 dev_info(adev->dev, " SRBM_STATUS2=0x%08X\n", ··· 1213 1200 } 1214 1201 } 1215 1202 1216 - static int sdma_v3_0_soft_reset(struct amdgpu_device *adev) 1203 + static int sdma_v3_0_soft_reset(void *handle) 1217 1204 { 1218 1205 u32 srbm_soft_reset = 0; 1206 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1219 1207 u32 tmp = RREG32(mmSRBM_STATUS2); 1220 1208 1221 1209 if (tmp & SRBM_STATUS2__SDMA_BUSY_MASK) { ··· 1235 1221 } 1236 1222 1237 1223 if (srbm_soft_reset) { 1238 - sdma_v3_0_print_status(adev); 1224 + sdma_v3_0_print_status((void *)adev); 1239 1225 1240 1226 tmp = RREG32(mmSRBM_SOFT_RESET); 1241 1227 tmp |= srbm_soft_reset; ··· 1252 1238 /* Wait a little for things to settle down */ 1253 1239 udelay(50); 1254 1240 1255 - sdma_v3_0_print_status(adev); 1241 + sdma_v3_0_print_status((void *)adev); 1256 1242 } 1257 1243 1258 1244 return 0; ··· 1353 1339 return 0; 1354 1340 } 1355 1341 1356 - static int sdma_v3_0_set_clockgating_state(struct amdgpu_device *adev, 1357 - enum amdgpu_clockgating_state state) 1358 - { 1359 - /* XXX handled via the smc on VI */ 1360 - 1361 - return 0; 1362 - } 1363 - 1364 - static int sdma_v3_0_set_powergating_state(struct amdgpu_device *adev, 1365 - enum amdgpu_powergating_state state) 1342 + static int sdma_v3_0_set_clockgating_state(void *handle, 1343 + enum amd_clockgating_state state) 1366 1344 { 1367 1345 return 0; 1368 1346 } 1369 1347 1370 - const struct amdgpu_ip_funcs sdma_v3_0_ip_funcs = { 1348 + static int sdma_v3_0_set_powergating_state(void *handle, 1349 + enum amd_powergating_state state) 1350 + { 1351 + return 0; 1352 + } 1353 + 1354 + const struct amd_ip_funcs sdma_v3_0_ip_funcs = { 1371 1355 .early_init = sdma_v3_0_early_init, 1372 1356 .late_init = NULL, 1373 1357 .sw_init = sdma_v3_0_sw_init,
+1 -1
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.h
··· 24 24 #ifndef __SDMA_V3_0_H__ 25 25 #define __SDMA_V3_0_H__ 26 26 27 - extern const struct amdgpu_ip_funcs sdma_v3_0_ip_funcs; 27 + extern const struct amd_ip_funcs sdma_v3_0_ip_funcs; 28 28 29 29 #endif
+22 -13
drivers/gpu/drm/amd/amdgpu/tonga_dpm.c
··· 30 30 31 31 static void tonga_dpm_set_funcs(struct amdgpu_device *adev); 32 32 33 - static int tonga_dpm_early_init(struct amdgpu_device *adev) 33 + static int tonga_dpm_early_init(void *handle) 34 34 { 35 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 36 + 35 37 tonga_dpm_set_funcs(adev); 36 38 37 39 return 0; ··· 43 41 { 44 42 char fw_name[30] = "amdgpu/tonga_smc.bin"; 45 43 int err; 46 - 47 44 err = request_firmware(&adev->pm.fw, fw_name, adev->dev); 48 45 if (err) 49 46 goto out; ··· 57 56 return err; 58 57 } 59 58 60 - static int tonga_dpm_sw_init(struct amdgpu_device *adev) 59 + static int tonga_dpm_sw_init(void *handle) 61 60 { 62 61 int ret; 62 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 63 63 64 64 ret = tonga_dpm_init_microcode(adev); 65 65 if (ret) ··· 69 67 return 0; 70 68 } 71 69 72 - static int tonga_dpm_sw_fini(struct amdgpu_device *adev) 70 + static int tonga_dpm_sw_fini(void *handle) 73 71 { 74 72 return 0; 75 73 } 76 74 77 - static int tonga_dpm_hw_init(struct amdgpu_device *adev) 75 + static int tonga_dpm_hw_init(void *handle) 78 76 { 79 77 int ret; 78 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 80 79 81 80 mutex_lock(&adev->pm.mutex); 82 81 ··· 102 99 return -EINVAL; 103 100 } 104 101 105 - static int tonga_dpm_hw_fini(struct amdgpu_device *adev) 102 + static int tonga_dpm_hw_fini(void *handle) 106 103 { 104 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 105 + 107 106 mutex_lock(&adev->pm.mutex); 108 107 tonga_smu_fini(adev); 109 108 mutex_unlock(&adev->pm.mutex); 110 109 return 0; 111 110 } 112 111 113 - static int tonga_dpm_suspend(struct amdgpu_device *adev) 112 + static int tonga_dpm_suspend(void *handle) 114 113 { 114 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 115 + 115 116 tonga_dpm_hw_fini(adev); 116 117 117 118 return 0; 118 119 } 119 120 120 - static int tonga_dpm_resume(struct amdgpu_device *adev) 121 + static int tonga_dpm_resume(void *handle) 121 122 { 123 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 124 + 122 125 tonga_dpm_hw_init(adev); 123 126 124 127 return 0; 125 128 } 126 129 127 - static int tonga_dpm_set_clockgating_state(struct amdgpu_device *adev, 128 - enum amdgpu_clockgating_state state) 130 + static int tonga_dpm_set_clockgating_state(void *handle, 131 + enum amd_clockgating_state state) 129 132 { 130 133 return 0; 131 134 } 132 135 133 - static int tonga_dpm_set_powergating_state(struct amdgpu_device *adev, 134 - enum amdgpu_powergating_state state) 136 + static int tonga_dpm_set_powergating_state(void *handle, 137 + enum amd_powergating_state state) 135 138 { 136 139 return 0; 137 140 } 138 141 139 - const struct amdgpu_ip_funcs tonga_dpm_ip_funcs = { 142 + const struct amd_ip_funcs tonga_dpm_ip_funcs = { 140 143 .early_init = tonga_dpm_early_init, 141 144 .late_init = NULL, 142 145 .sw_init = tonga_dpm_sw_init,
+33 -18
drivers/gpu/drm/amd/amdgpu/tonga_ih.c
··· 270 270 } 271 271 } 272 272 273 - static int tonga_ih_early_init(struct amdgpu_device *adev) 273 + static int tonga_ih_early_init(void *handle) 274 274 { 275 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 276 + 275 277 tonga_ih_set_interrupt_funcs(adev); 276 278 return 0; 277 279 } 278 280 279 - static int tonga_ih_sw_init(struct amdgpu_device *adev) 281 + static int tonga_ih_sw_init(void *handle) 280 282 { 281 283 int r; 284 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 282 285 283 286 r = amdgpu_ih_ring_init(adev, 4 * 1024, true); 284 287 if (r) ··· 295 292 return r; 296 293 } 297 294 298 - static int tonga_ih_sw_fini(struct amdgpu_device *adev) 295 + static int tonga_ih_sw_fini(void *handle) 299 296 { 297 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 298 + 300 299 amdgpu_irq_fini(adev); 301 300 amdgpu_ih_ring_fini(adev); 302 301 303 302 return 0; 304 303 } 305 304 306 - static int tonga_ih_hw_init(struct amdgpu_device *adev) 305 + static int tonga_ih_hw_init(void *handle) 307 306 { 308 307 int r; 308 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 309 309 310 310 r = tonga_ih_irq_init(adev); 311 311 if (r) ··· 317 311 return 0; 318 312 } 319 313 320 - static int tonga_ih_hw_fini(struct amdgpu_device *adev) 314 + static int tonga_ih_hw_fini(void *handle) 321 315 { 316 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 317 + 322 318 tonga_ih_irq_disable(adev); 323 319 324 320 return 0; 325 321 } 326 322 327 - static int tonga_ih_suspend(struct amdgpu_device *adev) 323 + static int tonga_ih_suspend(void *handle) 328 324 { 325 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 326 + 329 327 return tonga_ih_hw_fini(adev); 330 328 } 331 329 332 - static int tonga_ih_resume(struct amdgpu_device *adev) 330 + static int tonga_ih_resume(void *handle) 333 331 { 332 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 333 + 334 334 return tonga_ih_hw_init(adev); 335 335 } 336 336 337 - static bool tonga_ih_is_idle(struct amdgpu_device *adev) 337 + static bool tonga_ih_is_idle(void *handle) 338 338 { 339 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 339 340 u32 tmp = RREG32(mmSRBM_STATUS); 340 341 341 342 if (REG_GET_FIELD(tmp, SRBM_STATUS, IH_BUSY)) ··· 351 338 return true; 352 339 } 353 340 354 - static int tonga_ih_wait_for_idle(struct amdgpu_device *adev) 341 + static int tonga_ih_wait_for_idle(void *handle) 355 342 { 356 343 unsigned i; 357 344 u32 tmp; 345 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 358 346 359 347 for (i = 0; i < adev->usec_timeout; i++) { 360 348 /* read MC_STATUS */ ··· 367 353 return -ETIMEDOUT; 368 354 } 369 355 370 - static void tonga_ih_print_status(struct amdgpu_device *adev) 356 + static void tonga_ih_print_status(void *handle) 371 357 { 358 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 359 + 372 360 dev_info(adev->dev, "TONGA IH registers\n"); 373 361 dev_info(adev->dev, " SRBM_STATUS=0x%08X\n", 374 362 RREG32(mmSRBM_STATUS)); ··· 396 380 RREG32(mmIH_RB_WPTR)); 397 381 } 398 382 399 - static int tonga_ih_soft_reset(struct amdgpu_device *adev) 383 + static int tonga_ih_soft_reset(void *handle) 400 384 { 401 385 u32 srbm_soft_reset = 0; 386 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 402 387 u32 tmp = RREG32(mmSRBM_STATUS); 403 388 404 389 if (tmp & SRBM_STATUS__IH_BUSY_MASK) ··· 430 413 return 0; 431 414 } 432 415 433 - static int tonga_ih_set_clockgating_state(struct amdgpu_device *adev, 434 - enum amdgpu_clockgating_state state) 416 + static int tonga_ih_set_clockgating_state(void *handle, 417 + enum amd_clockgating_state state) 435 418 { 436 - // TODO 437 419 return 0; 438 420 } 439 421 440 - static int tonga_ih_set_powergating_state(struct amdgpu_device *adev, 441 - enum amdgpu_powergating_state state) 422 + static int tonga_ih_set_powergating_state(void *handle, 423 + enum amd_powergating_state state) 442 424 { 443 - // TODO 444 425 return 0; 445 426 } 446 427 447 - const struct amdgpu_ip_funcs tonga_ih_ip_funcs = { 428 + const struct amd_ip_funcs tonga_ih_ip_funcs = { 448 429 .early_init = tonga_ih_early_init, 449 430 .late_init = NULL, 450 431 .sw_init = tonga_ih_sw_init,
+1 -1
drivers/gpu/drm/amd/amdgpu/tonga_ih.h
··· 24 24 #ifndef __TONGA_IH_H__ 25 25 #define __TONGA_IH_H__ 26 26 27 - extern const struct amdgpu_ip_funcs tonga_ih_ip_funcs; 27 + extern const struct amd_ip_funcs tonga_ih_ip_funcs; 28 28 29 29 #endif /* __CZ_IH_H__ */
+35 -18
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c
··· 83 83 WREG32(mmUVD_RBC_RB_WPTR, ring->wptr); 84 84 } 85 85 86 - static int uvd_v4_2_early_init(struct amdgpu_device *adev) 86 + static int uvd_v4_2_early_init(void *handle) 87 87 { 88 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 89 + 88 90 uvd_v4_2_set_ring_funcs(adev); 89 91 uvd_v4_2_set_irq_funcs(adev); 90 92 91 93 return 0; 92 94 } 93 95 94 - static int uvd_v4_2_sw_init(struct amdgpu_device *adev) 96 + static int uvd_v4_2_sw_init(void *handle) 95 97 { 96 98 struct amdgpu_ring *ring; 99 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 97 100 int r; 98 101 99 102 /* UVD TRAP */ ··· 120 117 return r; 121 118 } 122 119 123 - static int uvd_v4_2_sw_fini(struct amdgpu_device *adev) 120 + static int uvd_v4_2_sw_fini(void *handle) 124 121 { 125 122 int r; 123 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 126 124 127 125 r = amdgpu_uvd_suspend(adev); 128 126 if (r) ··· 143 139 * 144 140 * Initialize the hardware, boot up the VCPU and do some testing 145 141 */ 146 - static int uvd_v4_2_hw_init(struct amdgpu_device *adev) 142 + static int uvd_v4_2_hw_init(void *handle) 147 143 { 144 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 148 145 struct amdgpu_ring *ring = &adev->uvd.ring; 149 146 uint32_t tmp; 150 147 int r; ··· 208 203 * 209 204 * Stop the UVD block, mark ring as not ready any more 210 205 */ 211 - static int uvd_v4_2_hw_fini(struct amdgpu_device *adev) 206 + static int uvd_v4_2_hw_fini(void *handle) 212 207 { 208 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 213 209 struct amdgpu_ring *ring = &adev->uvd.ring; 214 210 215 211 uvd_v4_2_stop(adev); ··· 219 213 return 0; 220 214 } 221 215 222 - static int uvd_v4_2_suspend(struct amdgpu_device *adev) 216 + static int uvd_v4_2_suspend(void *handle) 223 217 { 224 218 int r; 219 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 225 220 226 221 r = uvd_v4_2_hw_fini(adev); 227 222 if (r) ··· 235 228 return r; 236 229 } 237 230 238 - static int uvd_v4_2_resume(struct amdgpu_device *adev) 231 + static int uvd_v4_2_resume(void *handle) 239 232 { 240 233 int r; 234 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 241 235 242 236 r = amdgpu_uvd_resume(adev); 243 237 if (r) ··· 670 662 } 671 663 } 672 664 673 - static bool uvd_v4_2_is_idle(struct amdgpu_device *adev) 665 + static bool uvd_v4_2_is_idle(void *handle) 674 666 { 667 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 668 + 675 669 return !(RREG32(mmSRBM_STATUS) & SRBM_STATUS__UVD_BUSY_MASK); 676 670 } 677 671 678 - static int uvd_v4_2_wait_for_idle(struct amdgpu_device *adev) 672 + static int uvd_v4_2_wait_for_idle(void *handle) 679 673 { 680 674 unsigned i; 675 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 681 676 682 677 for (i = 0; i < adev->usec_timeout; i++) { 683 678 if (!(RREG32(mmSRBM_STATUS) & SRBM_STATUS__UVD_BUSY_MASK)) ··· 689 678 return -ETIMEDOUT; 690 679 } 691 680 692 - static int uvd_v4_2_soft_reset(struct amdgpu_device *adev) 681 + static int uvd_v4_2_soft_reset(void *handle) 693 682 { 683 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 684 + 694 685 uvd_v4_2_stop(adev); 695 686 696 687 WREG32_P(mmSRBM_SOFT_RESET, SRBM_SOFT_RESET__SOFT_RESET_UVD_MASK, ··· 702 689 return uvd_v4_2_start(adev); 703 690 } 704 691 705 - static void uvd_v4_2_print_status(struct amdgpu_device *adev) 692 + static void uvd_v4_2_print_status(void *handle) 706 693 { 694 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 707 695 dev_info(adev->dev, "UVD 4.2 registers\n"); 708 696 dev_info(adev->dev, " UVD_SEMA_ADDR_LOW=0x%08X\n", 709 697 RREG32(mmUVD_SEMA_ADDR_LOW)); ··· 824 810 return 0; 825 811 } 826 812 827 - static int uvd_v4_2_set_clockgating_state(struct amdgpu_device *adev, 828 - enum amdgpu_clockgating_state state) 813 + static int uvd_v4_2_set_clockgating_state(void *handle, 814 + enum amd_clockgating_state state) 829 815 { 830 816 bool gate = false; 817 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 831 818 832 - if (state == AMDGPU_CG_STATE_GATE) 819 + if (state == AMD_CG_STATE_GATE) 833 820 gate = true; 834 821 835 822 uvd_v4_2_enable_mgcg(adev, gate); ··· 838 823 return 0; 839 824 } 840 825 841 - static int uvd_v4_2_set_powergating_state(struct amdgpu_device *adev, 842 - enum amdgpu_powergating_state state) 826 + static int uvd_v4_2_set_powergating_state(void *handle, 827 + enum amd_powergating_state state) 843 828 { 844 829 /* This doesn't actually powergate the UVD block. 845 830 * That's done in the dpm code via the SMC. This ··· 848 833 * revisit this when there is a cleaner line between 849 834 * the smc and the hw blocks 850 835 */ 851 - if (state == AMDGPU_PG_STATE_GATE) { 836 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 837 + 838 + if (state == AMD_PG_STATE_GATE) { 852 839 uvd_v4_2_stop(adev); 853 840 return 0; 854 841 } else { ··· 858 841 } 859 842 } 860 843 861 - const struct amdgpu_ip_funcs uvd_v4_2_ip_funcs = { 844 + const struct amd_ip_funcs uvd_v4_2_ip_funcs = { 862 845 .early_init = uvd_v4_2_early_init, 863 846 .late_init = NULL, 864 847 .sw_init = uvd_v4_2_sw_init,
+1 -1
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.h
··· 24 24 #ifndef __UVD_V4_2_H__ 25 25 #define __UVD_V4_2_H__ 26 26 27 - extern const struct amdgpu_ip_funcs uvd_v4_2_ip_funcs; 27 + extern const struct amd_ip_funcs uvd_v4_2_ip_funcs; 28 28 29 29 #endif
+33 -19
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c
··· 79 79 WREG32(mmUVD_RBC_RB_WPTR, ring->wptr); 80 80 } 81 81 82 - static int uvd_v5_0_early_init(struct amdgpu_device *adev) 82 + static int uvd_v5_0_early_init(void *handle) 83 83 { 84 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 85 + 84 86 uvd_v5_0_set_ring_funcs(adev); 85 87 uvd_v5_0_set_irq_funcs(adev); 86 88 87 89 return 0; 88 90 } 89 91 90 - static int uvd_v5_0_sw_init(struct amdgpu_device *adev) 92 + static int uvd_v5_0_sw_init(void *handle) 91 93 { 92 94 struct amdgpu_ring *ring; 95 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 93 96 int r; 94 97 95 98 /* UVD TRAP */ ··· 116 113 return r; 117 114 } 118 115 119 - static int uvd_v5_0_sw_fini(struct amdgpu_device *adev) 116 + static int uvd_v5_0_sw_fini(void *handle) 120 117 { 121 118 int r; 119 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 122 120 123 121 r = amdgpu_uvd_suspend(adev); 124 122 if (r) ··· 139 135 * 140 136 * Initialize the hardware, boot up the VCPU and do some testing 141 137 */ 142 - static int uvd_v5_0_hw_init(struct amdgpu_device *adev) 138 + static int uvd_v5_0_hw_init(void *handle) 143 139 { 140 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 144 141 struct amdgpu_ring *ring = &adev->uvd.ring; 145 142 uint32_t tmp; 146 143 int r; ··· 204 199 * 205 200 * Stop the UVD block, mark ring as not ready any more 206 201 */ 207 - static int uvd_v5_0_hw_fini(struct amdgpu_device *adev) 202 + static int uvd_v5_0_hw_fini(void *handle) 208 203 { 204 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 209 205 struct amdgpu_ring *ring = &adev->uvd.ring; 210 206 211 207 uvd_v5_0_stop(adev); ··· 215 209 return 0; 216 210 } 217 211 218 - static int uvd_v5_0_suspend(struct amdgpu_device *adev) 212 + static int uvd_v5_0_suspend(void *handle) 219 213 { 220 214 int r; 215 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 221 216 222 217 r = uvd_v5_0_hw_fini(adev); 223 218 if (r) ··· 231 224 return r; 232 225 } 233 226 234 - static int uvd_v5_0_resume(struct amdgpu_device *adev) 227 + static int uvd_v5_0_resume(void *handle) 235 228 { 236 229 int r; 230 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 237 231 238 232 r = amdgpu_uvd_resume(adev); 239 233 if (r) ··· 613 605 return r; 614 606 } 615 607 616 - static bool uvd_v5_0_is_idle(struct amdgpu_device *adev) 608 + static bool uvd_v5_0_is_idle(void *handle) 617 609 { 610 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 611 + 618 612 return !(RREG32(mmSRBM_STATUS) & SRBM_STATUS__UVD_BUSY_MASK); 619 613 } 620 614 621 - static int uvd_v5_0_wait_for_idle(struct amdgpu_device *adev) 615 + static int uvd_v5_0_wait_for_idle(void *handle) 622 616 { 623 617 unsigned i; 618 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 624 619 625 620 for (i = 0; i < adev->usec_timeout; i++) { 626 621 if (!(RREG32(mmSRBM_STATUS) & SRBM_STATUS__UVD_BUSY_MASK)) ··· 632 621 return -ETIMEDOUT; 633 622 } 634 623 635 - static int uvd_v5_0_soft_reset(struct amdgpu_device *adev) 624 + static int uvd_v5_0_soft_reset(void *handle) 636 625 { 626 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 627 + 637 628 uvd_v5_0_stop(adev); 638 629 639 630 WREG32_P(mmSRBM_SOFT_RESET, SRBM_SOFT_RESET__SOFT_RESET_UVD_MASK, ··· 645 632 return uvd_v5_0_start(adev); 646 633 } 647 634 648 - static void uvd_v5_0_print_status(struct amdgpu_device *adev) 635 + static void uvd_v5_0_print_status(void *handle) 649 636 { 637 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 650 638 dev_info(adev->dev, "UVD 5.0 registers\n"); 651 639 dev_info(adev->dev, " UVD_SEMA_ADDR_LOW=0x%08X\n", 652 640 RREG32(mmUVD_SEMA_ADDR_LOW)); ··· 771 757 return 0; 772 758 } 773 759 774 - static int uvd_v5_0_set_clockgating_state(struct amdgpu_device *adev, 775 - enum amdgpu_clockgating_state state) 760 + static int uvd_v5_0_set_clockgating_state(void *handle, 761 + enum amd_clockgating_state state) 776 762 { 777 - //TODO 778 - 779 763 return 0; 780 764 } 781 765 782 - static int uvd_v5_0_set_powergating_state(struct amdgpu_device *adev, 783 - enum amdgpu_powergating_state state) 766 + static int uvd_v5_0_set_powergating_state(void *handle, 767 + enum amd_powergating_state state) 784 768 { 785 769 /* This doesn't actually powergate the UVD block. 786 770 * That's done in the dpm code via the SMC. This ··· 787 775 * revisit this when there is a cleaner line between 788 776 * the smc and the hw blocks 789 777 */ 790 - if (state == AMDGPU_PG_STATE_GATE) { 778 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 779 + 780 + if (state == AMD_PG_STATE_GATE) { 791 781 uvd_v5_0_stop(adev); 792 782 return 0; 793 783 } else { ··· 797 783 } 798 784 } 799 785 800 - const struct amdgpu_ip_funcs uvd_v5_0_ip_funcs = { 786 + const struct amd_ip_funcs uvd_v5_0_ip_funcs = { 801 787 .early_init = uvd_v5_0_early_init, 802 788 .late_init = NULL, 803 789 .sw_init = uvd_v5_0_sw_init,
+1 -1
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.h
··· 24 24 #ifndef __UVD_V5_0_H__ 25 25 #define __UVD_V5_0_H__ 26 26 27 - extern const struct amdgpu_ip_funcs uvd_v5_0_ip_funcs; 27 + extern const struct amd_ip_funcs uvd_v5_0_ip_funcs; 28 28 29 29 #endif
+33 -19
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c
··· 79 79 WREG32(mmUVD_RBC_RB_WPTR, ring->wptr); 80 80 } 81 81 82 - static int uvd_v6_0_early_init(struct amdgpu_device *adev) 82 + static int uvd_v6_0_early_init(void *handle) 83 83 { 84 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 85 + 84 86 uvd_v6_0_set_ring_funcs(adev); 85 87 uvd_v6_0_set_irq_funcs(adev); 86 88 87 89 return 0; 88 90 } 89 91 90 - static int uvd_v6_0_sw_init(struct amdgpu_device *adev) 92 + static int uvd_v6_0_sw_init(void *handle) 91 93 { 92 94 struct amdgpu_ring *ring; 93 95 int r; 96 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 94 97 95 98 /* UVD TRAP */ 96 99 r = amdgpu_irq_add_id(adev, 124, &adev->uvd.irq); ··· 116 113 return r; 117 114 } 118 115 119 - static int uvd_v6_0_sw_fini(struct amdgpu_device *adev) 116 + static int uvd_v6_0_sw_fini(void *handle) 120 117 { 121 118 int r; 119 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 122 120 123 121 r = amdgpu_uvd_suspend(adev); 124 122 if (r) ··· 139 135 * 140 136 * Initialize the hardware, boot up the VCPU and do some testing 141 137 */ 142 - static int uvd_v6_0_hw_init(struct amdgpu_device *adev) 138 + static int uvd_v6_0_hw_init(void *handle) 143 139 { 140 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 144 141 struct amdgpu_ring *ring = &adev->uvd.ring; 145 142 uint32_t tmp; 146 143 int r; ··· 198 193 * 199 194 * Stop the UVD block, mark ring as not ready any more 200 195 */ 201 - static int uvd_v6_0_hw_fini(struct amdgpu_device *adev) 196 + static int uvd_v6_0_hw_fini(void *handle) 202 197 { 198 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 203 199 struct amdgpu_ring *ring = &adev->uvd.ring; 204 200 205 201 uvd_v6_0_stop(adev); ··· 209 203 return 0; 210 204 } 211 205 212 - static int uvd_v6_0_suspend(struct amdgpu_device *adev) 206 + static int uvd_v6_0_suspend(void *handle) 213 207 { 214 208 int r; 209 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 215 210 216 211 r = uvd_v6_0_hw_fini(adev); 217 212 if (r) ··· 225 218 return r; 226 219 } 227 220 228 - static int uvd_v6_0_resume(struct amdgpu_device *adev) 221 + static int uvd_v6_0_resume(void *handle) 229 222 { 230 223 int r; 224 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 231 225 232 226 r = amdgpu_uvd_resume(adev); 233 227 if (r) ··· 601 593 return r; 602 594 } 603 595 604 - static bool uvd_v6_0_is_idle(struct amdgpu_device *adev) 596 + static bool uvd_v6_0_is_idle(void *handle) 605 597 { 598 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 599 + 606 600 return !(RREG32(mmSRBM_STATUS) & SRBM_STATUS__UVD_BUSY_MASK); 607 601 } 608 602 609 - static int uvd_v6_0_wait_for_idle(struct amdgpu_device *adev) 603 + static int uvd_v6_0_wait_for_idle(void *handle) 610 604 { 611 605 unsigned i; 606 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 612 607 613 608 for (i = 0; i < adev->usec_timeout; i++) { 614 609 if (!(RREG32(mmSRBM_STATUS) & SRBM_STATUS__UVD_BUSY_MASK)) ··· 620 609 return -ETIMEDOUT; 621 610 } 622 611 623 - static int uvd_v6_0_soft_reset(struct amdgpu_device *adev) 612 + static int uvd_v6_0_soft_reset(void *handle) 624 613 { 614 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 615 + 625 616 uvd_v6_0_stop(adev); 626 617 627 618 WREG32_P(mmSRBM_SOFT_RESET, SRBM_SOFT_RESET__SOFT_RESET_UVD_MASK, ··· 633 620 return uvd_v6_0_start(adev); 634 621 } 635 622 636 - static void uvd_v6_0_print_status(struct amdgpu_device *adev) 623 + static void uvd_v6_0_print_status(void *handle) 637 624 { 625 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 638 626 dev_info(adev->dev, "UVD 6.0 registers\n"); 639 627 dev_info(adev->dev, " UVD_SEMA_ADDR_LOW=0x%08X\n", 640 628 RREG32(mmUVD_SEMA_ADDR_LOW)); ··· 751 737 return 0; 752 738 } 753 739 754 - static int uvd_v6_0_set_clockgating_state(struct amdgpu_device *adev, 755 - enum amdgpu_clockgating_state state) 740 + static int uvd_v6_0_set_clockgating_state(void *handle, 741 + enum amd_clockgating_state state) 756 742 { 757 - //TODO 758 - 759 743 return 0; 760 744 } 761 745 762 - static int uvd_v6_0_set_powergating_state(struct amdgpu_device *adev, 763 - enum amdgpu_powergating_state state) 746 + static int uvd_v6_0_set_powergating_state(void *handle, 747 + enum amd_powergating_state state) 764 748 { 765 749 /* This doesn't actually powergate the UVD block. 766 750 * That's done in the dpm code via the SMC. This ··· 767 755 * revisit this when there is a cleaner line between 768 756 * the smc and the hw blocks 769 757 */ 770 - if (state == AMDGPU_PG_STATE_GATE) { 758 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 759 + 760 + if (state == AMD_PG_STATE_GATE) { 771 761 uvd_v6_0_stop(adev); 772 762 return 0; 773 763 } else { ··· 777 763 } 778 764 } 779 765 780 - const struct amdgpu_ip_funcs uvd_v6_0_ip_funcs = { 766 + const struct amd_ip_funcs uvd_v6_0_ip_funcs = { 781 767 .early_init = uvd_v6_0_early_init, 782 768 .late_init = NULL, 783 769 .sw_init = uvd_v6_0_sw_init,
+1 -1
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.h
··· 24 24 #ifndef __UVD_V6_0_H__ 25 25 #define __UVD_V6_0_H__ 26 26 27 - extern const struct amdgpu_ip_funcs uvd_v6_0_ip_funcs; 27 + extern const struct amd_ip_funcs uvd_v6_0_ip_funcs; 28 28 29 29 #endif
+35 -19
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c
··· 169 169 return 0; 170 170 } 171 171 172 - static int vce_v2_0_early_init(struct amdgpu_device *adev) 172 + static int vce_v2_0_early_init(void *handle) 173 173 { 174 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 175 + 174 176 vce_v2_0_set_ring_funcs(adev); 175 177 vce_v2_0_set_irq_funcs(adev); 176 178 177 179 return 0; 178 180 } 179 181 180 - static int vce_v2_0_sw_init(struct amdgpu_device *adev) 182 + static int vce_v2_0_sw_init(void *handle) 181 183 { 182 184 struct amdgpu_ring *ring; 183 185 int r; 186 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 184 187 185 188 /* VCE */ 186 189 r = amdgpu_irq_add_id(adev, 167, &adev->vce.irq); ··· 216 213 return r; 217 214 } 218 215 219 - static int vce_v2_0_sw_fini(struct amdgpu_device *adev) 216 + static int vce_v2_0_sw_fini(void *handle) 220 217 { 221 218 int r; 219 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 222 220 223 221 r = amdgpu_vce_suspend(adev); 224 222 if (r) ··· 232 228 return r; 233 229 } 234 230 235 - static int vce_v2_0_hw_init(struct amdgpu_device *adev) 231 + static int vce_v2_0_hw_init(void *handle) 236 232 { 237 233 struct amdgpu_ring *ring; 238 234 int r; 235 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 239 236 240 237 r = vce_v2_0_start(adev); 241 238 if (r) ··· 263 258 return 0; 264 259 } 265 260 266 - static int vce_v2_0_hw_fini(struct amdgpu_device *adev) 261 + static int vce_v2_0_hw_fini(void *handle) 267 262 { 268 - // TODO 269 263 return 0; 270 264 } 271 265 272 - static int vce_v2_0_suspend(struct amdgpu_device *adev) 266 + static int vce_v2_0_suspend(void *handle) 273 267 { 274 268 int r; 269 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 275 270 276 271 r = vce_v2_0_hw_fini(adev); 277 272 if (r) ··· 284 279 return r; 285 280 } 286 281 287 - static int vce_v2_0_resume(struct amdgpu_device *adev) 282 + static int vce_v2_0_resume(void *handle) 288 283 { 289 284 int r; 285 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 290 286 291 287 r = amdgpu_vce_resume(adev); 292 288 if (r) ··· 448 442 vce_v2_0_init_cg(adev); 449 443 } 450 444 451 - static bool vce_v2_0_is_idle(struct amdgpu_device *adev) 445 + static bool vce_v2_0_is_idle(void *handle) 452 446 { 447 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 448 + 453 449 return !(RREG32(mmSRBM_STATUS2) & SRBM_STATUS2__VCE_BUSY_MASK); 454 450 } 455 451 456 - static int vce_v2_0_wait_for_idle(struct amdgpu_device *adev) 452 + static int vce_v2_0_wait_for_idle(void *handle) 457 453 { 458 454 unsigned i; 455 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 459 456 460 457 for (i = 0; i < adev->usec_timeout; i++) { 461 458 if (!(RREG32(mmSRBM_STATUS2) & SRBM_STATUS2__VCE_BUSY_MASK)) ··· 467 458 return -ETIMEDOUT; 468 459 } 469 460 470 - static int vce_v2_0_soft_reset(struct amdgpu_device *adev) 461 + static int vce_v2_0_soft_reset(void *handle) 471 462 { 463 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 464 + 472 465 WREG32_P(mmSRBM_SOFT_RESET, SRBM_SOFT_RESET__SOFT_RESET_VCE_MASK, 473 466 ~SRBM_SOFT_RESET__SOFT_RESET_VCE_MASK); 474 467 mdelay(5); ··· 478 467 return vce_v2_0_start(adev); 479 468 } 480 469 481 - static void vce_v2_0_print_status(struct amdgpu_device *adev) 470 + static void vce_v2_0_print_status(void *handle) 482 471 { 472 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 473 + 483 474 dev_info(adev->dev, "VCE 2.0 registers\n"); 484 475 dev_info(adev->dev, " VCE_STATUS=0x%08X\n", 485 476 RREG32(mmVCE_STATUS)); ··· 582 569 return 0; 583 570 } 584 571 585 - static int vce_v2_0_set_clockgating_state(struct amdgpu_device *adev, 586 - enum amdgpu_clockgating_state state) 572 + static int vce_v2_0_set_clockgating_state(void *handle, 573 + enum amd_clockgating_state state) 587 574 { 588 575 bool gate = false; 576 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 589 577 590 - if (state == AMDGPU_CG_STATE_GATE) 578 + if (state == AMD_CG_STATE_GATE) 591 579 gate = true; 592 580 593 581 vce_v2_0_enable_mgcg(adev, gate); ··· 596 582 return 0; 597 583 } 598 584 599 - static int vce_v2_0_set_powergating_state(struct amdgpu_device *adev, 600 - enum amdgpu_powergating_state state) 585 + static int vce_v2_0_set_powergating_state(void *handle, 586 + enum amd_powergating_state state) 601 587 { 602 588 /* This doesn't actually powergate the VCE block. 603 589 * That's done in the dpm code via the SMC. This ··· 606 592 * revisit this when there is a cleaner line between 607 593 * the smc and the hw blocks 608 594 */ 609 - if (state == AMDGPU_PG_STATE_GATE) 595 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 596 + 597 + if (state == AMD_PG_STATE_GATE) 610 598 /* XXX do we need a vce_v2_0_stop()? */ 611 599 return 0; 612 600 else 613 601 return vce_v2_0_start(adev); 614 602 } 615 603 616 - const struct amdgpu_ip_funcs vce_v2_0_ip_funcs = { 604 + const struct amd_ip_funcs vce_v2_0_ip_funcs = { 617 605 .early_init = vce_v2_0_early_init, 618 606 .late_init = NULL, 619 607 .sw_init = vce_v2_0_sw_init,
+1 -1
drivers/gpu/drm/amd/amdgpu/vce_v2_0.h
··· 24 24 #ifndef __VCE_V2_0_H__ 25 25 #define __VCE_V2_0_H__ 26 26 27 - extern const struct amdgpu_ip_funcs vce_v2_0_ip_funcs; 27 + extern const struct amd_ip_funcs vce_v2_0_ip_funcs; 28 28 29 29 #endif
+33 -19
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c
··· 190 190 return 0; 191 191 } 192 192 193 - static int vce_v3_0_early_init(struct amdgpu_device *adev) 193 + static int vce_v3_0_early_init(void *handle) 194 194 { 195 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 196 + 195 197 vce_v3_0_set_ring_funcs(adev); 196 198 vce_v3_0_set_irq_funcs(adev); 197 199 198 200 return 0; 199 201 } 200 202 201 - static int vce_v3_0_sw_init(struct amdgpu_device *adev) 203 + static int vce_v3_0_sw_init(void *handle) 202 204 { 205 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 203 206 struct amdgpu_ring *ring; 204 207 int r; 205 208 ··· 237 234 return r; 238 235 } 239 236 240 - static int vce_v3_0_sw_fini(struct amdgpu_device *adev) 237 + static int vce_v3_0_sw_fini(void *handle) 241 238 { 242 239 int r; 240 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 243 241 244 242 r = amdgpu_vce_suspend(adev); 245 243 if (r) ··· 253 249 return r; 254 250 } 255 251 256 - static int vce_v3_0_hw_init(struct amdgpu_device *adev) 252 + static int vce_v3_0_hw_init(void *handle) 257 253 { 258 254 struct amdgpu_ring *ring; 259 255 int r; 256 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 260 257 261 258 r = vce_v3_0_start(adev); 262 259 if (r) ··· 284 279 return 0; 285 280 } 286 281 287 - static int vce_v3_0_hw_fini(struct amdgpu_device *adev) 282 + static int vce_v3_0_hw_fini(void *handle) 288 283 { 289 - // TODO 290 284 return 0; 291 285 } 292 286 293 - static int vce_v3_0_suspend(struct amdgpu_device *adev) 287 + static int vce_v3_0_suspend(void *handle) 294 288 { 295 289 int r; 290 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 296 291 297 292 r = vce_v3_0_hw_fini(adev); 298 293 if (r) ··· 305 300 return r; 306 301 } 307 302 308 - static int vce_v3_0_resume(struct amdgpu_device *adev) 303 + static int vce_v3_0_resume(void *handle) 309 304 { 310 305 int r; 306 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 311 307 312 308 r = amdgpu_vce_resume(adev); 313 309 if (r) ··· 368 362 ~VCE_SYS_INT_EN__VCE_SYS_INT_TRAP_INTERRUPT_EN_MASK); 369 363 } 370 364 371 - static bool vce_v3_0_is_idle(struct amdgpu_device *adev) 365 + static bool vce_v3_0_is_idle(void *handle) 372 366 { 367 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 368 + 373 369 return !(RREG32(mmSRBM_STATUS2) & SRBM_STATUS2__VCE_BUSY_MASK); 374 370 } 375 371 376 - static int vce_v3_0_wait_for_idle(struct amdgpu_device *adev) 372 + static int vce_v3_0_wait_for_idle(void *handle) 377 373 { 378 374 unsigned i; 375 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 379 376 380 377 for (i = 0; i < adev->usec_timeout; i++) { 381 378 if (!(RREG32(mmSRBM_STATUS2) & SRBM_STATUS2__VCE_BUSY_MASK)) ··· 387 378 return -ETIMEDOUT; 388 379 } 389 380 390 - static int vce_v3_0_soft_reset(struct amdgpu_device *adev) 381 + static int vce_v3_0_soft_reset(void *handle) 391 382 { 383 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 384 + 392 385 WREG32_P(mmSRBM_SOFT_RESET, SRBM_SOFT_RESET__SOFT_RESET_VCE_MASK, 393 386 ~SRBM_SOFT_RESET__SOFT_RESET_VCE_MASK); 394 387 mdelay(5); ··· 398 387 return vce_v3_0_start(adev); 399 388 } 400 389 401 - static void vce_v3_0_print_status(struct amdgpu_device *adev) 390 + static void vce_v3_0_print_status(void *handle) 402 391 { 392 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 393 + 403 394 dev_info(adev->dev, "VCE 3.0 registers\n"); 404 395 dev_info(adev->dev, " VCE_STATUS=0x%08X\n", 405 396 RREG32(mmVCE_STATUS)); ··· 500 487 return 0; 501 488 } 502 489 503 - static int vce_v3_0_set_clockgating_state(struct amdgpu_device *adev, 504 - enum amdgpu_clockgating_state state) 490 + static int vce_v3_0_set_clockgating_state(void *handle, 491 + enum amd_clockgating_state state) 505 492 { 506 - //TODO 507 493 return 0; 508 494 } 509 495 510 - static int vce_v3_0_set_powergating_state(struct amdgpu_device *adev, 511 - enum amdgpu_powergating_state state) 496 + static int vce_v3_0_set_powergating_state(void *handle, 497 + enum amd_powergating_state state) 512 498 { 513 499 /* This doesn't actually powergate the VCE block. 514 500 * That's done in the dpm code via the SMC. This ··· 516 504 * revisit this when there is a cleaner line between 517 505 * the smc and the hw blocks 518 506 */ 519 - if (state == AMDGPU_PG_STATE_GATE) 507 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 508 + 509 + if (state == AMD_PG_STATE_GATE) 520 510 /* XXX do we need a vce_v3_0_stop()? */ 521 511 return 0; 522 512 else 523 513 return vce_v3_0_start(adev); 524 514 } 525 515 526 - const struct amdgpu_ip_funcs vce_v3_0_ip_funcs = { 516 + const struct amd_ip_funcs vce_v3_0_ip_funcs = { 527 517 .early_init = vce_v3_0_early_init, 528 518 .late_init = NULL, 529 519 .sw_init = vce_v3_0_sw_init,
+1 -1
drivers/gpu/drm/amd/amdgpu/vce_v3_0.h
··· 24 24 #ifndef __VCE_V3_0_H__ 25 25 #define __VCE_V3_0_H__ 26 26 27 - extern const struct amdgpu_ip_funcs vce_v3_0_ip_funcs; 27 + extern const struct amd_ip_funcs vce_v3_0_ip_funcs; 28 28 29 29 #endif
+56 -48
drivers/gpu/drm/amd/amdgpu/vi.c
··· 994 994 { 995 995 /* ORDER MATTERS! */ 996 996 { 997 - .type = AMDGPU_IP_BLOCK_TYPE_COMMON, 997 + .type = AMD_IP_BLOCK_TYPE_COMMON, 998 998 .major = 2, 999 999 .minor = 0, 1000 1000 .rev = 0, 1001 1001 .funcs = &vi_common_ip_funcs, 1002 1002 }, 1003 1003 { 1004 - .type = AMDGPU_IP_BLOCK_TYPE_GMC, 1004 + .type = AMD_IP_BLOCK_TYPE_GMC, 1005 1005 .major = 8, 1006 1006 .minor = 0, 1007 1007 .rev = 0, 1008 1008 .funcs = &gmc_v8_0_ip_funcs, 1009 1009 }, 1010 1010 { 1011 - .type = AMDGPU_IP_BLOCK_TYPE_IH, 1011 + .type = AMD_IP_BLOCK_TYPE_IH, 1012 1012 .major = 2, 1013 1013 .minor = 4, 1014 1014 .rev = 0, 1015 1015 .funcs = &iceland_ih_ip_funcs, 1016 1016 }, 1017 1017 { 1018 - .type = AMDGPU_IP_BLOCK_TYPE_SMC, 1018 + .type = AMD_IP_BLOCK_TYPE_SMC, 1019 1019 .major = 7, 1020 1020 .minor = 1, 1021 1021 .rev = 0, 1022 1022 .funcs = &iceland_dpm_ip_funcs, 1023 1023 }, 1024 1024 { 1025 - .type = AMDGPU_IP_BLOCK_TYPE_GFX, 1025 + .type = AMD_IP_BLOCK_TYPE_GFX, 1026 1026 .major = 8, 1027 1027 .minor = 0, 1028 1028 .rev = 0, 1029 1029 .funcs = &gfx_v8_0_ip_funcs, 1030 1030 }, 1031 1031 { 1032 - .type = AMDGPU_IP_BLOCK_TYPE_SDMA, 1032 + .type = AMD_IP_BLOCK_TYPE_SDMA, 1033 1033 .major = 2, 1034 1034 .minor = 4, 1035 1035 .rev = 0, ··· 1041 1041 { 1042 1042 /* ORDER MATTERS! */ 1043 1043 { 1044 - .type = AMDGPU_IP_BLOCK_TYPE_COMMON, 1044 + .type = AMD_IP_BLOCK_TYPE_COMMON, 1045 1045 .major = 2, 1046 1046 .minor = 0, 1047 1047 .rev = 0, 1048 1048 .funcs = &vi_common_ip_funcs, 1049 1049 }, 1050 1050 { 1051 - .type = AMDGPU_IP_BLOCK_TYPE_GMC, 1051 + .type = AMD_IP_BLOCK_TYPE_GMC, 1052 1052 .major = 8, 1053 1053 .minor = 0, 1054 1054 .rev = 0, 1055 1055 .funcs = &gmc_v8_0_ip_funcs, 1056 1056 }, 1057 1057 { 1058 - .type = AMDGPU_IP_BLOCK_TYPE_IH, 1058 + .type = AMD_IP_BLOCK_TYPE_IH, 1059 1059 .major = 3, 1060 1060 .minor = 0, 1061 1061 .rev = 0, 1062 1062 .funcs = &tonga_ih_ip_funcs, 1063 1063 }, 1064 1064 { 1065 - .type = AMDGPU_IP_BLOCK_TYPE_SMC, 1065 + .type = AMD_IP_BLOCK_TYPE_SMC, 1066 1066 .major = 7, 1067 1067 .minor = 1, 1068 1068 .rev = 0, 1069 1069 .funcs = &tonga_dpm_ip_funcs, 1070 1070 }, 1071 1071 { 1072 - .type = AMDGPU_IP_BLOCK_TYPE_DCE, 1072 + .type = AMD_IP_BLOCK_TYPE_DCE, 1073 1073 .major = 10, 1074 1074 .minor = 0, 1075 1075 .rev = 0, 1076 1076 .funcs = &dce_v10_0_ip_funcs, 1077 1077 }, 1078 1078 { 1079 - .type = AMDGPU_IP_BLOCK_TYPE_GFX, 1079 + .type = AMD_IP_BLOCK_TYPE_GFX, 1080 1080 .major = 8, 1081 1081 .minor = 0, 1082 1082 .rev = 0, 1083 1083 .funcs = &gfx_v8_0_ip_funcs, 1084 1084 }, 1085 1085 { 1086 - .type = AMDGPU_IP_BLOCK_TYPE_SDMA, 1086 + .type = AMD_IP_BLOCK_TYPE_SDMA, 1087 1087 .major = 3, 1088 1088 .minor = 0, 1089 1089 .rev = 0, 1090 1090 .funcs = &sdma_v3_0_ip_funcs, 1091 1091 }, 1092 1092 { 1093 - .type = AMDGPU_IP_BLOCK_TYPE_UVD, 1093 + .type = AMD_IP_BLOCK_TYPE_UVD, 1094 1094 .major = 5, 1095 1095 .minor = 0, 1096 1096 .rev = 0, 1097 1097 .funcs = &uvd_v5_0_ip_funcs, 1098 1098 }, 1099 1099 { 1100 - .type = AMDGPU_IP_BLOCK_TYPE_VCE, 1100 + .type = AMD_IP_BLOCK_TYPE_VCE, 1101 1101 .major = 3, 1102 1102 .minor = 0, 1103 1103 .rev = 0, ··· 1109 1109 { 1110 1110 /* ORDER MATTERS! */ 1111 1111 { 1112 - .type = AMDGPU_IP_BLOCK_TYPE_COMMON, 1112 + .type = AMD_IP_BLOCK_TYPE_COMMON, 1113 1113 .major = 2, 1114 1114 .minor = 0, 1115 1115 .rev = 0, 1116 1116 .funcs = &vi_common_ip_funcs, 1117 1117 }, 1118 1118 { 1119 - .type = AMDGPU_IP_BLOCK_TYPE_GMC, 1119 + .type = AMD_IP_BLOCK_TYPE_GMC, 1120 1120 .major = 8, 1121 1121 .minor = 0, 1122 1122 .rev = 0, 1123 1123 .funcs = &gmc_v8_0_ip_funcs, 1124 1124 }, 1125 1125 { 1126 - .type = AMDGPU_IP_BLOCK_TYPE_IH, 1126 + .type = AMD_IP_BLOCK_TYPE_IH, 1127 1127 .major = 3, 1128 1128 .minor = 0, 1129 1129 .rev = 0, 1130 1130 .funcs = &cz_ih_ip_funcs, 1131 1131 }, 1132 1132 { 1133 - .type = AMDGPU_IP_BLOCK_TYPE_SMC, 1133 + .type = AMD_IP_BLOCK_TYPE_SMC, 1134 1134 .major = 8, 1135 1135 .minor = 0, 1136 1136 .rev = 0, 1137 1137 .funcs = &cz_dpm_ip_funcs, 1138 1138 }, 1139 1139 { 1140 - .type = AMDGPU_IP_BLOCK_TYPE_DCE, 1140 + .type = AMD_IP_BLOCK_TYPE_DCE, 1141 1141 .major = 11, 1142 1142 .minor = 0, 1143 1143 .rev = 0, 1144 1144 .funcs = &dce_v11_0_ip_funcs, 1145 1145 }, 1146 1146 { 1147 - .type = AMDGPU_IP_BLOCK_TYPE_GFX, 1147 + .type = AMD_IP_BLOCK_TYPE_GFX, 1148 1148 .major = 8, 1149 1149 .minor = 0, 1150 1150 .rev = 0, 1151 1151 .funcs = &gfx_v8_0_ip_funcs, 1152 1152 }, 1153 1153 { 1154 - .type = AMDGPU_IP_BLOCK_TYPE_SDMA, 1154 + .type = AMD_IP_BLOCK_TYPE_SDMA, 1155 1155 .major = 3, 1156 1156 .minor = 0, 1157 1157 .rev = 0, 1158 1158 .funcs = &sdma_v3_0_ip_funcs, 1159 1159 }, 1160 1160 { 1161 - .type = AMDGPU_IP_BLOCK_TYPE_UVD, 1161 + .type = AMD_IP_BLOCK_TYPE_UVD, 1162 1162 .major = 6, 1163 1163 .minor = 0, 1164 1164 .rev = 0, 1165 1165 .funcs = &uvd_v6_0_ip_funcs, 1166 1166 }, 1167 1167 { 1168 - .type = AMDGPU_IP_BLOCK_TYPE_VCE, 1168 + .type = AMD_IP_BLOCK_TYPE_VCE, 1169 1169 .major = 3, 1170 1170 .minor = 0, 1171 1171 .rev = 0, ··· 1225 1225 .wait_for_mc_idle = &gmc_v8_0_mc_wait_for_idle, 1226 1226 }; 1227 1227 1228 - static int vi_common_early_init(struct amdgpu_device *adev) 1228 + static int vi_common_early_init(void *handle) 1229 1229 { 1230 1230 bool smc_enabled = false; 1231 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1231 1232 1232 1233 adev->smc_rreg = &vi_smc_rreg; 1233 1234 adev->smc_wreg = &vi_smc_wreg; ··· 1241 1240 1242 1241 adev->asic_funcs = &vi_asic_funcs; 1243 1242 1244 - if (amdgpu_get_ip_block(adev, AMDGPU_IP_BLOCK_TYPE_SMC) && 1245 - (amdgpu_ip_block_mask & (1 << AMDGPU_IP_BLOCK_TYPE_SMC))) 1243 + if (amdgpu_get_ip_block(adev, AMD_IP_BLOCK_TYPE_SMC) && 1244 + (amdgpu_ip_block_mask & (1 << AMD_IP_BLOCK_TYPE_SMC))) 1246 1245 smc_enabled = true; 1247 1246 1248 1247 adev->rev_id = vi_get_rev_id(adev); ··· 1280 1279 return 0; 1281 1280 } 1282 1281 1283 - static int vi_common_sw_init(struct amdgpu_device *adev) 1282 + static int vi_common_sw_init(void *handle) 1284 1283 { 1285 1284 return 0; 1286 1285 } 1287 1286 1288 - static int vi_common_sw_fini(struct amdgpu_device *adev) 1287 + static int vi_common_sw_fini(void *handle) 1289 1288 { 1290 1289 return 0; 1291 1290 } 1292 1291 1293 - static int vi_common_hw_init(struct amdgpu_device *adev) 1292 + static int vi_common_hw_init(void *handle) 1294 1293 { 1294 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1295 + 1295 1296 /* move the golden regs per IP block */ 1296 1297 vi_init_golden_registers(adev); 1297 1298 /* enable pcie gen2/3 link */ ··· 1306 1303 return 0; 1307 1304 } 1308 1305 1309 - static int vi_common_hw_fini(struct amdgpu_device *adev) 1306 + static int vi_common_hw_fini(void *handle) 1310 1307 { 1308 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1309 + 1311 1310 /* enable the doorbell aperture */ 1312 1311 vi_enable_doorbell_aperture(adev, false); 1313 1312 1314 1313 return 0; 1315 1314 } 1316 1315 1317 - static int vi_common_suspend(struct amdgpu_device *adev) 1316 + static int vi_common_suspend(void *handle) 1318 1317 { 1318 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1319 + 1319 1320 return vi_common_hw_fini(adev); 1320 1321 } 1321 1322 1322 - static int vi_common_resume(struct amdgpu_device *adev) 1323 + static int vi_common_resume(void *handle) 1323 1324 { 1325 + struct amdgpu_device *adev = (struct amdgpu_device *)handle; 1326 + 1324 1327 return vi_common_hw_init(adev); 1325 1328 } 1326 1329 1327 - static bool vi_common_is_idle(struct amdgpu_device *adev) 1330 + static bool vi_common_is_idle(void *handle) 1328 1331 { 1329 1332 return true; 1330 1333 } 1331 1334 1332 - static int vi_common_wait_for_idle(struct amdgpu_device *adev) 1335 + static int vi_common_wait_for_idle(void *handle) 1333 1336 { 1334 1337 return 0; 1335 1338 } 1336 1339 1337 - static void vi_common_print_status(struct amdgpu_device *adev) 1340 + static void vi_common_print_status(void *handle) 1338 1341 { 1339 - 1342 + return; 1340 1343 } 1341 1344 1342 - static int vi_common_soft_reset(struct amdgpu_device *adev) 1343 - { 1344 - /* XXX hard reset?? */ 1345 - return 0; 1346 - } 1347 - 1348 - static int vi_common_set_clockgating_state(struct amdgpu_device *adev, 1349 - enum amdgpu_clockgating_state state) 1345 + static int vi_common_soft_reset(void *handle) 1350 1346 { 1351 1347 return 0; 1352 1348 } 1353 1349 1354 - static int vi_common_set_powergating_state(struct amdgpu_device *adev, 1355 - enum amdgpu_powergating_state state) 1350 + static int vi_common_set_clockgating_state(void *handle, 1351 + enum amd_clockgating_state state) 1356 1352 { 1357 1353 return 0; 1358 1354 } 1359 1355 1360 - const struct amdgpu_ip_funcs vi_common_ip_funcs = { 1356 + static int vi_common_set_powergating_state(void *handle, 1357 + enum amd_powergating_state state) 1358 + { 1359 + return 0; 1360 + } 1361 + 1362 + const struct amd_ip_funcs vi_common_ip_funcs = { 1361 1363 .early_init = vi_common_early_init, 1362 1364 .late_init = NULL, 1363 1365 .sw_init = vi_common_sw_init,
+1 -1
drivers/gpu/drm/amd/amdgpu/vi.h
··· 24 24 #ifndef __VI_H__ 25 25 #define __VI_H__ 26 26 27 - extern const struct amdgpu_ip_funcs vi_common_ip_funcs; 27 + extern const struct amd_ip_funcs vi_common_ip_funcs; 28 28 29 29 void vi_srbm_select(struct amdgpu_device *adev, 30 30 u32 me, u32 pipe, u32 queue, u32 vmid);
+3 -3
drivers/gpu/drm/amd/amdgpu/vi_dpm.h
··· 24 24 #ifndef __VI_DPM_H__ 25 25 #define __VI_DPM_H__ 26 26 27 - extern const struct amdgpu_ip_funcs cz_dpm_ip_funcs; 27 + extern const struct amd_ip_funcs cz_dpm_ip_funcs; 28 28 int cz_smu_init(struct amdgpu_device *adev); 29 29 int cz_smu_start(struct amdgpu_device *adev); 30 30 int cz_smu_fini(struct amdgpu_device *adev); 31 31 32 - extern const struct amdgpu_ip_funcs tonga_dpm_ip_funcs; 32 + extern const struct amd_ip_funcs tonga_dpm_ip_funcs; 33 33 34 - extern const struct amdgpu_ip_funcs iceland_dpm_ip_funcs; 34 + extern const struct amd_ip_funcs iceland_dpm_ip_funcs; 35 35 36 36 #endif
+81
drivers/gpu/drm/amd/include/amd_shared.h
··· 1 + /* 2 + * Copyright 2015 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 + #ifndef __AMD_SHARED_H__ 24 + #define __AMD_SHARED_H__ 25 + 26 + enum amd_ip_block_type { 27 + AMD_IP_BLOCK_TYPE_COMMON, 28 + AMD_IP_BLOCK_TYPE_GMC, 29 + AMD_IP_BLOCK_TYPE_IH, 30 + AMD_IP_BLOCK_TYPE_SMC, 31 + AMD_IP_BLOCK_TYPE_DCE, 32 + AMD_IP_BLOCK_TYPE_GFX, 33 + AMD_IP_BLOCK_TYPE_SDMA, 34 + AMD_IP_BLOCK_TYPE_UVD, 35 + AMD_IP_BLOCK_TYPE_VCE, 36 + }; 37 + 38 + enum amd_clockgating_state { 39 + AMD_CG_STATE_GATE = 0, 40 + AMD_CG_STATE_UNGATE, 41 + }; 42 + 43 + enum amd_powergating_state { 44 + AMD_PG_STATE_GATE = 0, 45 + AMD_PG_STATE_UNGATE, 46 + }; 47 + 48 + struct amd_ip_funcs { 49 + /* sets up early driver state (pre sw_init), does not configure hw - Optional */ 50 + int (*early_init)(void *handle); 51 + /* sets up late driver/hw state (post hw_init) - Optional */ 52 + int (*late_init)(void *handle); 53 + /* sets up driver state, does not configure hw */ 54 + int (*sw_init)(void *handle); 55 + /* tears down driver state, does not configure hw */ 56 + int (*sw_fini)(void *handle); 57 + /* sets up the hw state */ 58 + int (*hw_init)(void *handle); 59 + /* tears down the hw state */ 60 + int (*hw_fini)(void *handle); 61 + /* handles IP specific hw/sw changes for suspend */ 62 + int (*suspend)(void *handle); 63 + /* handles IP specific hw/sw changes for resume */ 64 + int (*resume)(void *handle); 65 + /* returns current IP block idle status */ 66 + bool (*is_idle)(void *handle); 67 + /* poll for idle */ 68 + int (*wait_for_idle)(void *handle); 69 + /* soft reset the IP block */ 70 + int (*soft_reset)(void *handle); 71 + /* dump the IP block status registers */ 72 + void (*print_status)(void *handle); 73 + /* enable/disable cg for the IP block */ 74 + int (*set_clockgating_state)(void *handle, 75 + enum amd_clockgating_state state); 76 + /* enable/disable pg for the IP block */ 77 + int (*set_powergating_state)(void *handle, 78 + enum amd_powergating_state state); 79 + }; 80 + 81 + #endif /* __AMD_SHARED_H__ */