diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_device.c')
| -rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 45 | 
1 files changed, 40 insertions, 5 deletions
| diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 856378434ea2..690cf77b950e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -87,6 +87,8 @@ static const char *amdgpu_asic_name[] = {  	"LAST",  }; +static void amdgpu_device_get_pcie_info(struct amdgpu_device *adev); +  bool amdgpu_device_is_px(struct drm_device *dev)  {  	struct amdgpu_device *adev = dev->dev_private; @@ -121,6 +123,32 @@ uint32_t amdgpu_mm_rreg(struct amdgpu_device *adev, uint32_t reg,  	return ret;  } +/* + * MMIO register read with bytes helper functions + * @offset:bytes offset from MMIO start + * +*/ + +uint8_t amdgpu_mm_rreg8(struct amdgpu_device *adev, uint32_t offset) { +	if (offset < adev->rmmio_size) +		return (readb(adev->rmmio + offset)); +	BUG(); +} + +/* + * MMIO register write with bytes helper functions + * @offset:bytes offset from MMIO start + * @value: the value want to be written to the register + * +*/ +void amdgpu_mm_wreg8(struct amdgpu_device *adev, uint32_t offset, uint8_t value) { +	if (offset < adev->rmmio_size) +		writeb(value, adev->rmmio + offset); +	else +		BUG(); +} + +  void amdgpu_mm_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v,  		    uint32_t acc_flags)  { @@ -830,6 +858,8 @@ static void amdgpu_device_check_arguments(struct amdgpu_device *adev)  		dev_warn(adev->dev, "lockup_timeout msut be > 0, adjusting to 10000\n");  		amdgpu_lockup_timeout = 10000;  	} + +	adev->firmware.load_type = amdgpu_ucode_get_load_type(adev, amdgpu_fw_load_type);  }  /** @@ -1387,7 +1417,8 @@ static int amdgpu_device_ip_late_set_cg_state(struct amdgpu_device *adev)  			continue;  		/* skip CG for VCE/UVD, it's handled specially */  		if (adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_UVD && -		    adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_VCE) { +		    adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_VCE && +		    adev->ip_blocks[i].version->funcs->set_clockgating_state) {  			/* enable clockgating to save power */  			r = adev->ip_blocks[i].version->funcs->set_clockgating_state((void *)adev,  										     AMD_CG_STATE_GATE); @@ -1436,7 +1467,8 @@ static int amdgpu_device_ip_fini(struct amdgpu_device *adev)  	for (i = 0; i < adev->num_ip_blocks; i++) {  		if (!adev->ip_blocks[i].status.hw)  			continue; -		if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_SMC) { +		if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_SMC && +			adev->ip_blocks[i].version->funcs->set_clockgating_state) {  			/* ungate blocks before hw fini so that we can shutdown the blocks safely */  			r = adev->ip_blocks[i].version->funcs->set_clockgating_state((void *)adev,  										     AMD_CG_STATE_UNGATE); @@ -1545,7 +1577,8 @@ int amdgpu_device_ip_suspend(struct amdgpu_device *adev)  		if (!adev->ip_blocks[i].status.valid)  			continue;  		/* ungate blocks so that suspend can properly shut them down */ -		if (i != AMD_IP_BLOCK_TYPE_SMC) { +		if (adev->ip_blocks[i].version->type != AMD_IP_BLOCK_TYPE_SMC && +			adev->ip_blocks[i].version->funcs->set_clockgating_state) {  			r = adev->ip_blocks[i].version->funcs->set_clockgating_state((void *)adev,  										     AMD_CG_STATE_UNGATE);  			if (r) { @@ -1878,6 +1911,8 @@ int amdgpu_device_init(struct amdgpu_device *adev,  	if (adev->rio_mem == NULL)  		DRM_INFO("PCI I/O BAR is not found.\n"); +	amdgpu_device_get_pcie_info(adev); +  	/* early init functions */  	r = amdgpu_device_ip_early_init(adev);  	if (r) @@ -2086,6 +2121,7 @@ void amdgpu_device_fini(struct amdgpu_device *adev)  	amdgpu_ib_pool_fini(adev);  	amdgpu_fence_driver_fini(adev); +	amdgpu_pm_sysfs_fini(adev);  	amdgpu_fbdev_fini(adev);  	r = amdgpu_device_ip_fini(adev);  	if (adev->firmware.gpu_info_fw) { @@ -2114,7 +2150,6 @@ void amdgpu_device_fini(struct amdgpu_device *adev)  	iounmap(adev->rmmio);  	adev->rmmio = NULL;  	amdgpu_device_doorbell_fini(adev); -	amdgpu_pm_sysfs_fini(adev);  	amdgpu_debugfs_regs_cleanup(adev);  } @@ -2755,7 +2790,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,  	return r;  } -void amdgpu_device_get_pcie_info(struct amdgpu_device *adev) +static void amdgpu_device_get_pcie_info(struct amdgpu_device *adev)  {  	u32 mask;  	int ret; | 
