⬢ DragonFlyBSD Kernel Audit
DF-5005 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/drm/amd/amdgpu/amdgpu_atombios.c b/sys/dev/drm/amd/amdgpu/amdgpu_atombios.c
index 1111111..2222222 100644
--- a/sys/dev/drm/amd/amdgpu/amdgpu_atombios.c
+++ b/sys/dev/drm/amd/amdgpu/amdgpu_atombios.c
@@ -590,6 +590,11 @@ int amdgpu_atombios_get_clock_info(struct amdgpu_device *adev)
 		/* pixel clocks */
 		ppll->reference_freq =
 		    le16_to_cpu(firmware_info->info.usReferenceClock);
+		/* a zero reference clock makes every PLL calculation divide
+		 * by zero (amdgpu_pll.c uses it as the denominator); default
+		 * to 27 MHz like every sane VBIOS (mirrors the pll_out_min /
+		 * lcd_pll_out_* / max_pixel_clock fixups below) */
+		if (ppll->reference_freq == 0)
+			ppll->reference_freq = 2700;
 		ppll->reference_div = 0;
 
 		ppll->pll_out_min =
@@ -631,6 +636,11 @@ int amdgpu_atombios_get_clock_info(struct amdgpu_device *adev)
 		/* system clock */
 		spll->reference_freq =
 			le16_to_cpu(firmware_info->info_21.usCoreReferenceClock);
+		if (spll->reference_freq == 0)
+			spll->reference_freq = 2700;
 		spll->reference_div = 0;
 
 		spll->pll_out_min =
@@ -659,6 +669,11 @@ int amdgpu_atombios_get_clock_info(struct amdgpu_device *adev)
 		/* memory clock */
 		mpll->reference_freq =
 			le16_to_cpu(firmware_info->info_21.usMemoryReferenceClock);
+		if (mpll->reference_freq == 0)
+			mpll->reference_freq = 1000;
 		mpll->reference_div = 0;
 
 		mpll->pll_out_min =