Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit da69c161 authored by Ken Wang's avatar Ken Wang Committed by Alex Deucher
Browse files

drm/amdgpu: add si specific logic into the device initialize function v3



v3: guard doorbell_fini as well

Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarKen Wang <Qingqing.Wang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 33f34802
Loading
Loading
Loading
Loading
+17 −5
Original line number Diff line number Diff line
@@ -55,6 +55,11 @@ static int amdgpu_debugfs_regs_init(struct amdgpu_device *adev);
static void amdgpu_debugfs_regs_cleanup(struct amdgpu_device *adev);

static const char *amdgpu_asic_name[] = {
	"TAHITI",
	"PITCAIRN",
	"VERDE",
	"OLAND",
	"HAINAN",
	"BONAIRE",
	"KAVERI",
	"KABINI",
@@ -1571,8 +1576,13 @@ int amdgpu_device_init(struct amdgpu_device *adev,
	INIT_LIST_HEAD(&adev->shadow_list);
	mutex_init(&adev->shadow_list_lock);

	if (adev->asic_type >= CHIP_BONAIRE) {
		adev->rmmio_base = pci_resource_start(adev->pdev, 5);
		adev->rmmio_size = pci_resource_len(adev->pdev, 5);
	} else {
		adev->rmmio_base = pci_resource_start(adev->pdev, 2);
		adev->rmmio_size = pci_resource_len(adev->pdev, 2);
	}
	adev->rmmio = ioremap(adev->rmmio_base, adev->rmmio_size);
	if (adev->rmmio == NULL) {
		return -ENOMEM;
@@ -1580,6 +1590,7 @@ int amdgpu_device_init(struct amdgpu_device *adev,
	DRM_INFO("register mmio base: 0x%08X\n", (uint32_t)adev->rmmio_base);
	DRM_INFO("register mmio size: %u\n", (unsigned)adev->rmmio_size);

	if (adev->asic_type >= CHIP_BONAIRE)
		/* doorbell bar mapping */
		amdgpu_doorbell_init(adev);

@@ -1790,6 +1801,7 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
	adev->rio_mem = NULL;
	iounmap(adev->rmmio);
	adev->rmmio = NULL;
	if (adev->asic_type >= CHIP_BONAIRE)
		amdgpu_doorbell_fini(adev);
	amdgpu_debugfs_regs_cleanup(adev);
	amdgpu_debugfs_remove_files(adev);