drm/amdgpu: use a define for the memory size of the vga emulator
authorAlex Deucher <alexander.deucher@amd.com>
Tue, 28 Jul 2020 18:10:46 +0000 (14:10 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 4 Aug 2020 21:29:28 +0000 (17:29 -0400)
Rather than open coding it everywhere.

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu.h
drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c

index 75631b3..5d605e4 100644 (file)
@@ -214,6 +214,8 @@ extern int amdgpu_num_kcq;
 #define AMDGPUFB_CONN_LIMIT                    4
 #define AMDGPU_BIOS_NUM_SCRATCH                        16
 
+#define AMDGPU_VBIOS_VGA_ALLOCATION            (9 * 1024 * 1024) /* reserve 8MB for vga emulator and 1 MB for FB */
+
 /* hard reset data */
 #define AMDGPU_ASIC_RESET_DATA                  0x39d5e86b
 
index dd91a93..943773e 100644 (file)
@@ -747,7 +747,7 @@ static unsigned gmc_v10_0_get_vbios_fb_size(struct amdgpu_device *adev)
        unsigned size;
 
        if (REG_GET_FIELD(d1vga_control, D1VGA_CONTROL, D1VGA_MODE_ENABLE)) {
-               size = 9 * 1024 * 1024; /* reserve 8MB for vga emulator and 1 MB for FB */
+               size = AMDGPU_VBIOS_VGA_ALLOCATION;
        } else {
                u32 viewport;
                u32 pitch;
index 538e7ee..4de9968 100644 (file)
@@ -805,7 +805,7 @@ static unsigned gmc_v6_0_get_vbios_fb_size(struct amdgpu_device *adev)
        unsigned size;
 
        if (REG_GET_FIELD(d1vga_control, D1VGA_CONTROL, D1VGA_MODE_ENABLE)) {
-               size = 9 * 1024 * 1024; /* reserve 8MB for vga emulator and 1 MB for FB */
+               size = AMDGPU_VBIOS_VGA_ALLOCATION;
        } else {
                u32 viewport = RREG32(mmVIEWPORT_SIZE);
                size = (REG_GET_FIELD(viewport, VIEWPORT_SIZE, VIEWPORT_HEIGHT) *
index 0f8e8af..4113f2d 100644 (file)
@@ -970,7 +970,7 @@ static unsigned gmc_v7_0_get_vbios_fb_size(struct amdgpu_device *adev)
        unsigned size;
 
        if (REG_GET_FIELD(d1vga_control, D1VGA_CONTROL, D1VGA_MODE_ENABLE)) {
-               size = 9 * 1024 * 1024; /* reserve 8MB for vga emulator and 1 MB for FB */
+               size = AMDGPU_VBIOS_VGA_ALLOCATION;
        } else {
                u32 viewport = RREG32(mmVIEWPORT_SIZE);
                size = (REG_GET_FIELD(viewport, VIEWPORT_SIZE, VIEWPORT_HEIGHT) *
index abe6401..f29ff9a 100644 (file)
@@ -1087,7 +1087,7 @@ static unsigned gmc_v8_0_get_vbios_fb_size(struct amdgpu_device *adev)
        unsigned size;
 
        if (REG_GET_FIELD(d1vga_control, D1VGA_CONTROL, D1VGA_MODE_ENABLE)) {
-               size = 9 * 1024 * 1024; /* reserve 8MB for vga emulator and 1 MB for FB */
+               size = AMDGPU_VBIOS_VGA_ALLOCATION;
        } else {
                u32 viewport = RREG32(mmVIEWPORT_SIZE);
                size = (REG_GET_FIELD(viewport, VIEWPORT_SIZE, VIEWPORT_HEIGHT) *
index c5f94ba..ac15d76 100644 (file)
@@ -1077,11 +1077,11 @@ static unsigned gmc_v9_0_get_vbios_fb_size(struct amdgpu_device *adev)
         * Check related code in gmc_v9_0_sw_fini
         * */
        if (gmc_v9_0_keep_stolen_memory(adev))
-               return 9 * 1024 * 1024;
+               return AMDGPU_VBIOS_VGA_ALLOCATION;
 
        d1vga_control = RREG32_SOC15(DCE, 0, mmD1VGA_CONTROL);
        if (REG_GET_FIELD(d1vga_control, D1VGA_CONTROL, D1VGA_MODE_ENABLE)) {
-               size = 9 * 1024 * 1024; /* reserve 8MB for vga emulator and 1 MB for FB */
+               size = AMDGPU_VBIOS_VGA_ALLOCATION;
        } else {
                u32 viewport;