drm/amdgpu/gmc9: get vram width from atom for Raven

Get it from the system info table.

Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Alex Deucher 2017-07-05 15:37:35 -04:00
parent 21f6bcb6d4
commit 8d6a5230e1
1 changed files with 39 additions and 35 deletions

View File

@ -23,6 +23,7 @@
#include <linux/firmware.h> #include <linux/firmware.h>
#include "amdgpu.h" #include "amdgpu.h"
#include "gmc_v9_0.h" #include "gmc_v9_0.h"
#include "amdgpu_atomfirmware.h"
#include "vega10/soc15ip.h" #include "vega10/soc15ip.h"
#include "vega10/HDP/hdp_4_0_offset.h" #include "vega10/HDP/hdp_4_0_offset.h"
@ -442,43 +443,46 @@ static int gmc_v9_0_mc_init(struct amdgpu_device *adev)
u32 tmp; u32 tmp;
int chansize, numchan; int chansize, numchan;
/* hbm memory channel size */ adev->mc.vram_width = amdgpu_atomfirmware_get_vram_width(adev);
chansize = 128; if (!adev->mc.vram_width) {
/* hbm memory channel size */
chansize = 128;
tmp = RREG32_SOC15(DF, 0, mmDF_CS_AON0_DramBaseAddress0); tmp = RREG32_SOC15(DF, 0, mmDF_CS_AON0_DramBaseAddress0);
tmp &= DF_CS_AON0_DramBaseAddress0__IntLvNumChan_MASK; tmp &= DF_CS_AON0_DramBaseAddress0__IntLvNumChan_MASK;
tmp >>= DF_CS_AON0_DramBaseAddress0__IntLvNumChan__SHIFT; tmp >>= DF_CS_AON0_DramBaseAddress0__IntLvNumChan__SHIFT;
switch (tmp) { switch (tmp) {
case 0: case 0:
default: default:
numchan = 1; numchan = 1;
break; break;
case 1: case 1:
numchan = 2; numchan = 2;
break; break;
case 2: case 2:
numchan = 0; numchan = 0;
break; break;
case 3: case 3:
numchan = 4; numchan = 4;
break; break;
case 4: case 4:
numchan = 0; numchan = 0;
break; break;
case 5: case 5:
numchan = 8; numchan = 8;
break; break;
case 6: case 6:
numchan = 0; numchan = 0;
break; break;
case 7: case 7:
numchan = 16; numchan = 16;
break; break;
case 8: case 8:
numchan = 2; numchan = 2;
break; break;
}
adev->mc.vram_width = numchan * chansize;
} }
adev->mc.vram_width = numchan * chansize;
/* Could aper size report 0 ? */ /* Could aper size report 0 ? */
adev->mc.aper_base = pci_resource_start(adev->pdev, 0); adev->mc.aper_base = pci_resource_start(adev->pdev, 0);