blob: bcedb59a83f95573eaf6ab9f101d734f751e1743 [file] [log] [blame]
Nico Huber27d26272026-05-27 19:01:09 +02001--
2-- Copyright (C) 2022 Google, LLC
3--
4-- This program is free software; you can redistribute it and/or modify
5-- it under the terms of the GNU General Public License as published by
6-- the Free Software Foundation; either version 2 of the License, or
7-- (at your option) any later version.
8--
9-- This program is distributed in the hope that it will be useful,
10-- but WITHOUT ANY WARRANTY; without even the implied warranty of
11-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12-- GNU General Public License for more details.
13--
14
15private package HW.GFX.GMA.Power_Domains is
16
17 type Power_Domain is
18 (PW1, PW2, PW3, PW4, PW5,
19 DDI_A, DDI_B, DDI_C,
20 DDI_USBC1, DDI_USBC2, DDI_USBC3, DDI_USBC4, DDI_USBC5, DDI_USBC6,
21 AUX_A, AUX_B, AUX_C,
22 AUX_USBC1, AUX_USBC2, AUX_USBC3, AUX_USBC4, AUX_USBC5, AUX_USBC6);
23 subtype Dynamic_Domain is Power_Domain range PW2 .. Power_Domain'Last;
24 subtype PW_Domain is Power_Domain range PW1 .. PW5;
25 subtype Dynamic_Well is Power_Domain range PW2 .. PW_Domain'Last;
26 subtype Port_Domain is Power_Domain range DDI_A .. AUX_USBC6;
27 subtype DDI_Domain is Power_Domain range DDI_A .. DDI_USBC6;
28 subtype DDI_USBC_Domain is Power_Domain range DDI_USBC1 .. DDI_USBC6;
29 subtype AUX_Domain is Power_Domain range AUX_A .. AUX_USBC6;
30 subtype AUX_USBC_Domain is Power_Domain range AUX_USBC1 .. AUX_USBC6;
31
32 ----------------------------------------------------------------------------
33
34 FUSE_STATUS_PGx_DIST_STATUS : constant array (PW_Domain) of Word32 :=
35 (PW1 => 1 * 2 ** 26,
36 PW2 => 1 * 2 ** 25,
37 PW3 => 1 * 2 ** 24,
38 PW4 => 1 * 2 ** 23,
39 PW5 => 1 * 2 ** 22);
40
41 ----------------------------------------------------------------------------
42
43 function PW_State_Mask (PW : PW_Domain) return Word32
44 is
45 (1 * 2 ** (2 * (PW_Domain'Pos (PW) - PW_Domain'Pos (PW_Domain'First))));
46
47 ----------------------------------------------------------------------------
48
49 function To_GPU_Port (PD : Port_Domain) return GPU_Port
50 is
51 (case PD is
52 when DDI_A | AUX_A => DIGI_A,
53 when DDI_B | AUX_B => DIGI_B,
54 when DDI_C | AUX_C => DIGI_C,
55 when DDI_USBC1 | AUX_USBC1 => DDI_TC1,
56 when DDI_USBC2 | AUX_USBC2 => DDI_TC2,
57 when DDI_USBC3 | AUX_USBC3 => DDI_TC3,
58 when DDI_USBC4 | AUX_USBC4 => DDI_TC4,
59 when DDI_USBC5 | AUX_USBC5 => DDI_TC5,
60 when DDI_USBC6 | AUX_USBC6 => DDI_TC6);
61
62 ----------------------------------------------------------------------------
63
64 function Need_PW (PW : Dynamic_Well; Configs : Pipe_Configs) return Boolean;
65
66 procedure Power_Up (Port : Active_Port_Type; Success : out Boolean);
67
68end HW.GFX.GMA.Power_Domains;