gma: Make PCI config access mandatory
We always have access to the PCI device now. So we can drop the old
`Check_Platform ()` that relied on the MMIO space only. Some paths
also get simplified, as we don't need the `PCI_Usable` flag anymore.
Change-Id: I29f2d79484eae2f84b8547e52869d8f6246024a0
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.sourcearcade.org/c/libgfxinit/+/537
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Thomas Heijligen <src@posteo.de>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/common/g45/hw-gfx-gma-power_and_clocks.adb b/common/g45/hw-gfx-gma-power_and_clocks.adb
index e082a6d..3c73dcc 100644
--- a/common/g45/hw-gfx-gma-power_and_clocks.adb
+++ b/common/g45/hw-gfx-gma-power_and_clocks.adb
@@ -102,7 +102,7 @@
is
use type HW.Word16;
- Tmp_Clk : Int64 := 0;
+ Tmp_Clk : Int64;
VCO : Int64;
Divisors : Div_Array;
@@ -110,23 +110,21 @@
GCFGC : Word16;
CDClk_Sel : Natural range 0 .. 7;
begin
- if PCI_Usable then
- Get_VCO (VCO, Divisors);
- PCI_Read16 (GCFGC, 16#f0#);
- if Config.GMCH_GM965 then
- -- Linux i965gm_get_cdclk: cdclk_sel = ((tmp >> 8) & 0x1f) - 1
- if (Shift_Right (GCFGC, 8) and 16#1f#) in 1 .. 3 then
- CDClk_Sel := Natural (Shift_Right (GCFGC, 8) and 16#1f#) - 1;
- else
- CDClk_Sel := Div_Array'Last;
- end if;
- elsif Config.Has_GMCH_Mobile_VCO then
- CDClk_Sel := Natural (Shift_Right (GCFGC, 12) and 1);
+ Get_VCO (VCO, Divisors);
+ PCI_Read16 (GCFGC, 16#f0#);
+ if Config.GMCH_GM965 then
+ -- Linux i965gm_get_cdclk: cdclk_sel = ((tmp >> 8) & 0x1f) - 1
+ if (Shift_Right (GCFGC, 8) and 16#1f#) in 1 .. 3 then
+ CDClk_Sel := Natural (Shift_Right (GCFGC, 8) and 16#1f#) - 1;
else
- CDClk_Sel := Natural (Shift_Right (GCFGC, 4) and 7);
+ CDClk_Sel := Div_Array'Last;
end if;
- Tmp_Clk := VCO / Divisors (CDClk_Sel);
+ elsif Config.Has_GMCH_Mobile_VCO then
+ CDClk_Sel := Natural (Shift_Right (GCFGC, 12) and 1);
+ else
+ CDClk_Sel := Natural (Shift_Right (GCFGC, 4) and 7);
end if;
+ Tmp_Clk := VCO / Divisors (CDClk_Sel);
if Tmp_Clk in Config.CDClk_Range then
CDClk := Tmp_Clk;