summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2023-06-13 03:05:49 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2023-06-13 03:05:49 +0000
commitb04b3c4f6ab12a531c4d25c6d711a8fbff163987 (patch)
treee04c97610b404ca659a501b30fff8f0ba89f3ea0
parent24f64a2f4ded6b4ed9bafe85706543eca31a4c61 (diff)
drm/amd/display: filter out invalid bits in pipe_fuses
From Samson Tam 4c1e747ca61c6103bcc259ad7f2fc6d53acff291 in linux-6.1.y/6.1.29 682439fffad9fa9a38d37dd1b1318e9374232213 in mainline linux
-rw-r--r--sys/dev/pci/drm/amd/display/dc/dcn32/dcn32_resource.c10
-rw-r--r--sys/dev/pci/drm/amd/display/dc/dcn321/dcn321_resource.c10
2 files changed, 18 insertions, 2 deletions
diff --git a/sys/dev/pci/drm/amd/display/dc/dcn32/dcn32_resource.c b/sys/dev/pci/drm/amd/display/dc/dcn32/dcn32_resource.c
index 903f80a8c20..814620e6638 100644
--- a/sys/dev/pci/drm/amd/display/dc/dcn32/dcn32_resource.c
+++ b/sys/dev/pci/drm/amd/display/dc/dcn32/dcn32_resource.c
@@ -2037,6 +2037,14 @@ static struct resource_funcs dcn32_res_pool_funcs = {
.remove_phantom_pipes = dcn32_remove_phantom_pipes,
};
+static uint32_t read_pipe_fuses(struct dc_context *ctx)
+{
+ uint32_t value = REG_READ(CC_DC_PIPE_DIS);
+ /* DCN32 support max 4 pipes */
+ value = value & 0xf;
+ return value;
+}
+
static bool dcn32_resource_construct(
uint8_t num_virtual_links,
@@ -2079,7 +2087,7 @@ static bool dcn32_resource_construct(
pool->base.res_cap = &res_cap_dcn32;
/* max number of pipes for ASIC before checking for pipe fuses */
num_pipes = pool->base.res_cap->num_timing_generator;
- pipe_fuses = REG_READ(CC_DC_PIPE_DIS);
+ pipe_fuses = read_pipe_fuses(ctx);
for (i = 0; i < pool->base.res_cap->num_timing_generator; i++)
if (pipe_fuses & 1 << i)
diff --git a/sys/dev/pci/drm/amd/display/dc/dcn321/dcn321_resource.c b/sys/dev/pci/drm/amd/display/dc/dcn321/dcn321_resource.c
index d320e21680d..213ff3672bd 100644
--- a/sys/dev/pci/drm/amd/display/dc/dcn321/dcn321_resource.c
+++ b/sys/dev/pci/drm/amd/display/dc/dcn321/dcn321_resource.c
@@ -1621,6 +1621,14 @@ static struct resource_funcs dcn321_res_pool_funcs = {
.remove_phantom_pipes = dcn32_remove_phantom_pipes,
};
+static uint32_t read_pipe_fuses(struct dc_context *ctx)
+{
+ uint32_t value = REG_READ(CC_DC_PIPE_DIS);
+ /* DCN321 support max 4 pipes */
+ value = value & 0xf;
+ return value;
+}
+
static bool dcn321_resource_construct(
uint8_t num_virtual_links,
@@ -1663,7 +1671,7 @@ static bool dcn321_resource_construct(
pool->base.res_cap = &res_cap_dcn321;
/* max number of pipes for ASIC before checking for pipe fuses */
num_pipes = pool->base.res_cap->num_timing_generator;
- pipe_fuses = REG_READ(CC_DC_PIPE_DIS);
+ pipe_fuses = read_pipe_fuses(ctx);
for (i = 0; i < pool->base.res_cap->num_timing_generator; i++)
if (pipe_fuses & 1 << i)