blob: 725bc0807317ffceb03e69b84d8481cfb497bd66 [file] [log] [blame]
Nico Huber83693c82016-10-08 22:17:55 +02001--
2-- Copyright (C) 2015-2016 secunet Security Networks AG
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
Nico Huber125a29e2016-10-18 00:23:54 +02006-- the Free Software Foundation; either version 2 of the License, or
7-- (at your option) any later version.
Nico Huber83693c82016-10-08 22:17:55 +02008--
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
15with HW.GFX.GMA.Registers;
16
Nico Huber47ff0692016-11-04 14:29:39 +010017use type HW.Int32;
18
Nico Huber83693c82016-10-08 22:17:55 +020019private package HW.GFX.GMA.Pipe_Setup
20is
21
Nico Huber83693c82016-10-08 22:17:55 +020022 procedure On
Nico Huberf3e23662016-12-05 21:33:03 +010023 (Pipe : Pipe_Index;
Nico Huber83693c82016-10-08 22:17:55 +020024 Port_Cfg : Port_Config;
Nico Huber47ff0692016-11-04 14:29:39 +010025 Framebuffer : Framebuffer_Type)
26 with
27 Pre =>
28 Framebuffer.Width <= Pos32 (Port_Cfg.Mode.H_Visible) and
29 Framebuffer.Height <= Pos32 (Port_Cfg.Mode.V_Visible);
Nico Huber83693c82016-10-08 22:17:55 +020030
Nico Huber7ad2d652016-12-07 15:19:32 +010031 procedure Off (Pipe : Pipe_Index);
Nico Huber83693c82016-10-08 22:17:55 +020032
Nico Huber33912aa2016-12-06 20:36:23 +010033 procedure Legacy_VGA_Off;
34
Nico Huber83693c82016-10-08 22:17:55 +020035 procedure All_Off;
36
Nico Huberf3e23662016-12-05 21:33:03 +010037 procedure Update_Offset (Pipe : Pipe_Index; Framebuffer : Framebuffer_Type);
Nico Huber83693c82016-10-08 22:17:55 +020038
39private
40
41 subtype WM_Levels is Natural range 0 .. 7;
42 type PLANE_WM_Type is array (WM_Levels) of Registers.Registers_Index;
43
44 type Controller_Type is
45 record
Nico Huberf3e23662016-12-05 21:33:03 +010046 Pipe : Pipe_Index;
Nico Huber83693c82016-10-08 22:17:55 +020047 PIPESRC : Registers.Registers_Index;
48 PIPEMISC : Registers.Registers_Index;
Nico Huber4916e342016-11-04 14:37:53 +010049 PF_CTRL : Registers.Registers_Index;
Nico Huber83693c82016-10-08 22:17:55 +020050 PF_WIN_POS : Registers.Registers_Index;
51 PF_WIN_SZ : Registers.Registers_Index;
52 DSPCNTR : Registers.Registers_Index;
53 DSPLINOFF : Registers.Registers_Index;
54 DSPSTRIDE : Registers.Registers_Index;
55 DSPSURF : Registers.Registers_Index;
56 DSPTILEOFF : Registers.Registers_Index;
57 SPCNTR : Registers.Registers_Index;
Nico Huber83693c82016-10-08 22:17:55 +020058 -- Skylake registers (partially aliased)
59 PLANE_CTL : Registers.Registers_Index;
60 PLANE_OFFSET : Registers.Registers_Index;
61 PLANE_POS : Registers.Registers_Index;
62 PLANE_SIZE : Registers.Registers_Index;
63 PLANE_STRIDE : Registers.Registers_Index;
64 PLANE_SURF : Registers.Registers_Index;
65 PS_CTRL_1 : Registers.Registers_Index;
Nico Huber4916e342016-11-04 14:37:53 +010066 PS_WIN_POS_1 : Registers.Registers_Index;
Nico Huber83693c82016-10-08 22:17:55 +020067 PS_WIN_SZ_1 : Registers.Registers_Index;
Nico Huber4916e342016-11-04 14:37:53 +010068 PS_CTRL_2 : Registers.Registers_Invalid_Index;
Nico Huber83693c82016-10-08 22:17:55 +020069 PS_WIN_SZ_2 : Registers.Registers_Invalid_Index;
70 WM_LINETIME : Registers.Registers_Index;
71 PLANE_BUF_CFG : Registers.Registers_Index;
72 PLANE_WM : PLANE_WM_Type;
73 end record;
74
Nico Huberf3e23662016-12-05 21:33:03 +010075 type Controller_Array is array (Pipe_Index) of Controller_Type;
76
Nico Huberf3e23662016-12-05 21:33:03 +010077 Controllers : constant Controller_Array :=
78 (Primary => Controller_Type'
79 (Pipe => Primary,
Nico Huber83693c82016-10-08 22:17:55 +020080 PIPESRC => Registers.PIPEASRC,
81 PIPEMISC => Registers.PIPEAMISC,
Nico Huber4916e342016-11-04 14:37:53 +010082 PF_CTRL => Registers.PFA_CTL_1,
Nico Huber83693c82016-10-08 22:17:55 +020083 PF_WIN_POS => Registers.PFA_WIN_POS,
84 PF_WIN_SZ => Registers.PFA_WIN_SZ,
85 DSPCNTR => Registers.DSPACNTR,
86 DSPLINOFF => Registers.DSPALINOFF,
87 DSPSTRIDE => Registers.DSPASTRIDE,
88 DSPSURF => Registers.DSPASURF,
89 DSPTILEOFF => Registers.DSPATILEOFF,
90 SPCNTR => Registers.SPACNTR,
Nico Huber83693c82016-10-08 22:17:55 +020091 PLANE_CTL => Registers.DSPACNTR,
92 PLANE_OFFSET => Registers.DSPATILEOFF,
93 PLANE_POS => Registers.PLANE_POS_1_A,
94 PLANE_SIZE => Registers.PLANE_SIZE_1_A,
95 PLANE_STRIDE => Registers.DSPASTRIDE,
96 PLANE_SURF => Registers.DSPASURF,
97 PS_CTRL_1 => Registers.PS_CTRL_1_A,
Nico Huber4916e342016-11-04 14:37:53 +010098 PS_WIN_POS_1 => Registers.PS_WIN_POS_1_A,
Nico Huber83693c82016-10-08 22:17:55 +020099 PS_WIN_SZ_1 => Registers.PS_WIN_SZ_1_A,
Nico Huber4916e342016-11-04 14:37:53 +0100100 PS_CTRL_2 => Registers.PS_CTRL_2_A,
Nico Huber83693c82016-10-08 22:17:55 +0200101 PS_WIN_SZ_2 => Registers.PS_WIN_SZ_2_A,
102 WM_LINETIME => Registers.WM_LINETIME_A,
103 PLANE_BUF_CFG => Registers.PLANE_BUF_CFG_1_A,
104 PLANE_WM => PLANE_WM_Type'(
105 Registers.PLANE_WM_1_A_0,
106 Registers.PLANE_WM_1_A_1,
107 Registers.PLANE_WM_1_A_2,
108 Registers.PLANE_WM_1_A_3,
109 Registers.PLANE_WM_1_A_4,
110 Registers.PLANE_WM_1_A_5,
111 Registers.PLANE_WM_1_A_6,
112 Registers.PLANE_WM_1_A_7)),
Nico Huberf3e23662016-12-05 21:33:03 +0100113 Secondary => Controller_Type'
114 (Pipe => Secondary,
Nico Huber83693c82016-10-08 22:17:55 +0200115 PIPESRC => Registers.PIPEBSRC,
116 PIPEMISC => Registers.PIPEBMISC,
Nico Huber4916e342016-11-04 14:37:53 +0100117 PF_CTRL => Registers.PFB_CTL_1,
Nico Huber83693c82016-10-08 22:17:55 +0200118 PF_WIN_POS => Registers.PFB_WIN_POS,
119 PF_WIN_SZ => Registers.PFB_WIN_SZ,
120 DSPCNTR => Registers.DSPBCNTR,
121 DSPLINOFF => Registers.DSPBLINOFF,
122 DSPSTRIDE => Registers.DSPBSTRIDE,
123 DSPSURF => Registers.DSPBSURF,
124 DSPTILEOFF => Registers.DSPBTILEOFF,
125 SPCNTR => Registers.SPBCNTR,
Nico Huber83693c82016-10-08 22:17:55 +0200126 PLANE_CTL => Registers.DSPBCNTR,
127 PLANE_OFFSET => Registers.DSPBTILEOFF,
128 PLANE_POS => Registers.PLANE_POS_1_B,
129 PLANE_SIZE => Registers.PLANE_SIZE_1_B,
130 PLANE_STRIDE => Registers.DSPBSTRIDE,
131 PLANE_SURF => Registers.DSPBSURF,
132 PS_CTRL_1 => Registers.PS_CTRL_1_B,
Nico Huber4916e342016-11-04 14:37:53 +0100133 PS_WIN_POS_1 => Registers.PS_WIN_POS_1_B,
Nico Huber83693c82016-10-08 22:17:55 +0200134 PS_WIN_SZ_1 => Registers.PS_WIN_SZ_1_B,
Nico Huber4916e342016-11-04 14:37:53 +0100135 PS_CTRL_2 => Registers.PS_CTRL_2_B,
Nico Huber83693c82016-10-08 22:17:55 +0200136 PS_WIN_SZ_2 => Registers.PS_WIN_SZ_2_B,
137 WM_LINETIME => Registers.WM_LINETIME_B,
138 PLANE_BUF_CFG => Registers.PLANE_BUF_CFG_1_B,
139 PLANE_WM => PLANE_WM_Type'(
140 Registers.PLANE_WM_1_B_0,
141 Registers.PLANE_WM_1_B_1,
142 Registers.PLANE_WM_1_B_2,
143 Registers.PLANE_WM_1_B_3,
144 Registers.PLANE_WM_1_B_4,
145 Registers.PLANE_WM_1_B_5,
146 Registers.PLANE_WM_1_B_6,
147 Registers.PLANE_WM_1_B_7)),
Nico Huberf3e23662016-12-05 21:33:03 +0100148 Tertiary => Controller_Type'
149 (Pipe => Tertiary,
Nico Huber83693c82016-10-08 22:17:55 +0200150 PIPESRC => Registers.PIPECSRC,
151 PIPEMISC => Registers.PIPECMISC,
Nico Huber4916e342016-11-04 14:37:53 +0100152 PF_CTRL => Registers.PFC_CTL_1,
Nico Huber83693c82016-10-08 22:17:55 +0200153 PF_WIN_POS => Registers.PFC_WIN_POS,
154 PF_WIN_SZ => Registers.PFC_WIN_SZ,
155 DSPCNTR => Registers.DSPCCNTR,
156 DSPLINOFF => Registers.DSPCLINOFF,
157 DSPSTRIDE => Registers.DSPCSTRIDE,
158 DSPSURF => Registers.DSPCSURF,
159 DSPTILEOFF => Registers.DSPCTILEOFF,
160 SPCNTR => Registers.SPCCNTR,
Nico Huber83693c82016-10-08 22:17:55 +0200161 PLANE_CTL => Registers.DSPCCNTR,
162 PLANE_OFFSET => Registers.DSPCTILEOFF,
163 PLANE_POS => Registers.PLANE_POS_1_C,
164 PLANE_SIZE => Registers.PLANE_SIZE_1_C,
165 PLANE_STRIDE => Registers.DSPCSTRIDE,
166 PLANE_SURF => Registers.DSPCSURF,
167 PS_CTRL_1 => Registers.PS_CTRL_1_C,
Nico Huber4916e342016-11-04 14:37:53 +0100168 PS_WIN_POS_1 => Registers.PS_WIN_POS_1_C,
Nico Huber83693c82016-10-08 22:17:55 +0200169 PS_WIN_SZ_1 => Registers.PS_WIN_SZ_1_C,
Nico Huber4916e342016-11-04 14:37:53 +0100170 PS_CTRL_2 => Registers.Invalid_Register,
Nico Huber83693c82016-10-08 22:17:55 +0200171 PS_WIN_SZ_2 => Registers.Invalid_Register,
172 WM_LINETIME => Registers.WM_LINETIME_C,
173 PLANE_BUF_CFG => Registers.PLANE_BUF_CFG_1_C,
174 PLANE_WM => PLANE_WM_Type'(
175 Registers.PLANE_WM_1_C_0,
176 Registers.PLANE_WM_1_C_1,
177 Registers.PLANE_WM_1_C_2,
178 Registers.PLANE_WM_1_C_3,
179 Registers.PLANE_WM_1_C_4,
180 Registers.PLANE_WM_1_C_5,
181 Registers.PLANE_WM_1_C_6,
182 Registers.PLANE_WM_1_C_7)));
183
Nico Huber83693c82016-10-08 22:17:55 +0200184end HW.GFX.GMA.Pipe_Setup;