For DCN 4.x, the vram_info moved into the umc_info table.
However, it appears some DCN 2.x based boards also happen
to have a umc table with a version matching DCN 4.x which
causes them to match the wrong table.

Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3678
Fixes: 00c391102abc ("drm/amd/display: Add misc DC changes for DCN401")
Signed-off-by: Alex Deucher <[email protected]>
---
 .../drm/amd/display/dc/bios/bios_parser2.c    | 49 ++++++++++---------
 1 file changed, 25 insertions(+), 24 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c 
b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
index 0d8498ab9b23..a8181631a40b 100644
--- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
+++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
@@ -3126,29 +3126,7 @@ static enum bp_result bios_parser_get_vram_info(
        struct atom_common_table_header *header;
        struct atom_data_revision revision;
 
-       // vram info moved to umc_info for DCN4x
-       if (info && DATA_TABLES(umc_info)) {
-               header = GET_IMAGE(struct atom_common_table_header,
-                                       DATA_TABLES(umc_info));
-
-               get_atom_data_table_revision(header, &revision);
-
-               switch (revision.major) {
-               case 4:
-                       switch (revision.minor) {
-                       case 0:
-                               result = get_vram_info_from_umc_info_v40(bp, 
info);
-                               break;
-                       default:
-                               break;
-                       }
-                       break;
-               default:
-                       break;
-               }
-       }
-
-       if (result != BP_RESULT_OK && info && DATA_TABLES(vram_info)) {
+       if (info && DATA_TABLES(vram_info)) {
                header = GET_IMAGE(struct atom_common_table_header,
                                        DATA_TABLES(vram_info));
 
@@ -3182,10 +3160,33 @@ static enum bp_result bios_parser_get_vram_info(
                        break;
 
                default:
-                       return result;
+                       break;
                }
 
        }
+
+       // vram info moved to umc_info for DCN4x
+       if (result != BP_RESULT_OK && info && DATA_TABLES(umc_info)) {
+               header = GET_IMAGE(struct atom_common_table_header,
+                                       DATA_TABLES(umc_info));
+
+               get_atom_data_table_revision(header, &revision);
+
+               switch (revision.major) {
+               case 4:
+                       switch (revision.minor) {
+                       case 0:
+                               result = get_vram_info_from_umc_info_v40(bp, 
info);
+                               break;
+                       default:
+                               break;
+                       }
+                       break;
+               default:
+                       break;
+               }
+       }
+
        return result;
 }
 
-- 
2.46.2

Reply via email to