diff options
Diffstat (limited to 'drivers/gpu/drm/i915/i915_suspend.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_suspend.c | 763 |
1 files changed, 383 insertions, 380 deletions
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c index 5854bddb1e9f..63d4d30c39de 100644 --- a/drivers/gpu/drm/i915/i915_suspend.c +++ b/drivers/gpu/drm/i915/i915_suspend.c | |||
@@ -60,9 +60,9 @@ static void i915_save_palette(struct drm_device *dev, enum pipe pipe) | |||
60 | reg = (pipe == PIPE_A) ? _LGC_PALETTE_A : _LGC_PALETTE_B; | 60 | reg = (pipe == PIPE_A) ? _LGC_PALETTE_A : _LGC_PALETTE_B; |
61 | 61 | ||
62 | if (pipe == PIPE_A) | 62 | if (pipe == PIPE_A) |
63 | array = dev_priv->save_palette_a; | 63 | array = dev_priv->regfile.save_palette_a; |
64 | else | 64 | else |
65 | array = dev_priv->save_palette_b; | 65 | array = dev_priv->regfile.save_palette_b; |
66 | 66 | ||
67 | for (i = 0; i < 256; i++) | 67 | for (i = 0; i < 256; i++) |
68 | array[i] = I915_READ(reg + (i << 2)); | 68 | array[i] = I915_READ(reg + (i << 2)); |
@@ -82,9 +82,9 @@ static void i915_restore_palette(struct drm_device *dev, enum pipe pipe) | |||
82 | reg = (pipe == PIPE_A) ? _LGC_PALETTE_A : _LGC_PALETTE_B; | 82 | reg = (pipe == PIPE_A) ? _LGC_PALETTE_A : _LGC_PALETTE_B; |
83 | 83 | ||
84 | if (pipe == PIPE_A) | 84 | if (pipe == PIPE_A) |
85 | array = dev_priv->save_palette_a; | 85 | array = dev_priv->regfile.save_palette_a; |
86 | else | 86 | else |
87 | array = dev_priv->save_palette_b; | 87 | array = dev_priv->regfile.save_palette_b; |
88 | 88 | ||
89 | for (i = 0; i < 256; i++) | 89 | for (i = 0; i < 256; i++) |
90 | I915_WRITE(reg + (i << 2), array[i]); | 90 | I915_WRITE(reg + (i << 2), array[i]); |
@@ -131,11 +131,11 @@ static void i915_save_vga(struct drm_device *dev) | |||
131 | u16 cr_index, cr_data, st01; | 131 | u16 cr_index, cr_data, st01; |
132 | 132 | ||
133 | /* VGA color palette registers */ | 133 | /* VGA color palette registers */ |
134 | dev_priv->saveDACMASK = I915_READ8(VGA_DACMASK); | 134 | dev_priv->regfile.saveDACMASK = I915_READ8(VGA_DACMASK); |
135 | 135 | ||
136 | /* MSR bits */ | 136 | /* MSR bits */ |
137 | dev_priv->saveMSR = I915_READ8(VGA_MSR_READ); | 137 | dev_priv->regfile.saveMSR = I915_READ8(VGA_MSR_READ); |
138 | if (dev_priv->saveMSR & VGA_MSR_CGA_MODE) { | 138 | if (dev_priv->regfile.saveMSR & VGA_MSR_CGA_MODE) { |
139 | cr_index = VGA_CR_INDEX_CGA; | 139 | cr_index = VGA_CR_INDEX_CGA; |
140 | cr_data = VGA_CR_DATA_CGA; | 140 | cr_data = VGA_CR_DATA_CGA; |
141 | st01 = VGA_ST01_CGA; | 141 | st01 = VGA_ST01_CGA; |
@@ -150,35 +150,35 @@ static void i915_save_vga(struct drm_device *dev) | |||
150 | i915_read_indexed(dev, cr_index, cr_data, 0x11) & | 150 | i915_read_indexed(dev, cr_index, cr_data, 0x11) & |
151 | (~0x80)); | 151 | (~0x80)); |
152 | for (i = 0; i <= 0x24; i++) | 152 | for (i = 0; i <= 0x24; i++) |
153 | dev_priv->saveCR[i] = | 153 | dev_priv->regfile.saveCR[i] = |
154 | i915_read_indexed(dev, cr_index, cr_data, i); | 154 | i915_read_indexed(dev, cr_index, cr_data, i); |
155 | /* Make sure we don't turn off CR group 0 writes */ | 155 | /* Make sure we don't turn off CR group 0 writes */ |
156 | dev_priv->saveCR[0x11] &= ~0x80; | 156 | dev_priv->regfile.saveCR[0x11] &= ~0x80; |
157 | 157 | ||
158 | /* Attribute controller registers */ | 158 | /* Attribute controller registers */ |
159 | I915_READ8(st01); | 159 | I915_READ8(st01); |
160 | dev_priv->saveAR_INDEX = I915_READ8(VGA_AR_INDEX); | 160 | dev_priv->regfile.saveAR_INDEX = I915_READ8(VGA_AR_INDEX); |
161 | for (i = 0; i <= 0x14; i++) | 161 | for (i = 0; i <= 0x14; i++) |
162 | dev_priv->saveAR[i] = i915_read_ar(dev, st01, i, 0); | 162 | dev_priv->regfile.saveAR[i] = i915_read_ar(dev, st01, i, 0); |
163 | I915_READ8(st01); | 163 | I915_READ8(st01); |
164 | I915_WRITE8(VGA_AR_INDEX, dev_priv->saveAR_INDEX); | 164 | I915_WRITE8(VGA_AR_INDEX, dev_priv->regfile.saveAR_INDEX); |
165 | I915_READ8(st01); | 165 | I915_READ8(st01); |
166 | 166 | ||
167 | /* Graphics controller registers */ | 167 | /* Graphics controller registers */ |
168 | for (i = 0; i < 9; i++) | 168 | for (i = 0; i < 9; i++) |
169 | dev_priv->saveGR[i] = | 169 | dev_priv->regfile.saveGR[i] = |
170 | i915_read_indexed(dev, VGA_GR_INDEX, VGA_GR_DATA, i); | 170 | i915_read_indexed(dev, VGA_GR_INDEX, VGA_GR_DATA, i); |
171 | 171 | ||
172 | dev_priv->saveGR[0x10] = | 172 | dev_priv->regfile.saveGR[0x10] = |
173 | i915_read_indexed(dev, VGA_GR_INDEX, VGA_GR_DATA, 0x10); | 173 | i915_read_indexed(dev, VGA_GR_INDEX, VGA_GR_DATA, 0x10); |
174 | dev_priv->saveGR[0x11] = | 174 | dev_priv->regfile.saveGR[0x11] = |
175 | i915_read_indexed(dev, VGA_GR_INDEX, VGA_GR_DATA, 0x11); | 175 | i915_read_indexed(dev, VGA_GR_INDEX, VGA_GR_DATA, 0x11); |
176 | dev_priv->saveGR[0x18] = | 176 | dev_priv->regfile.saveGR[0x18] = |
177 | i915_read_indexed(dev, VGA_GR_INDEX, VGA_GR_DATA, 0x18); | 177 | i915_read_indexed(dev, VGA_GR_INDEX, VGA_GR_DATA, 0x18); |
178 | 178 | ||
179 | /* Sequencer registers */ | 179 | /* Sequencer registers */ |
180 | for (i = 0; i < 8; i++) | 180 | for (i = 0; i < 8; i++) |
181 | dev_priv->saveSR[i] = | 181 | dev_priv->regfile.saveSR[i] = |
182 | i915_read_indexed(dev, VGA_SR_INDEX, VGA_SR_DATA, i); | 182 | i915_read_indexed(dev, VGA_SR_INDEX, VGA_SR_DATA, i); |
183 | } | 183 | } |
184 | 184 | ||
@@ -189,8 +189,8 @@ static void i915_restore_vga(struct drm_device *dev) | |||
189 | u16 cr_index, cr_data, st01; | 189 | u16 cr_index, cr_data, st01; |
190 | 190 | ||
191 | /* MSR bits */ | 191 | /* MSR bits */ |
192 | I915_WRITE8(VGA_MSR_WRITE, dev_priv->saveMSR); | 192 | I915_WRITE8(VGA_MSR_WRITE, dev_priv->regfile.saveMSR); |
193 | if (dev_priv->saveMSR & VGA_MSR_CGA_MODE) { | 193 | if (dev_priv->regfile.saveMSR & VGA_MSR_CGA_MODE) { |
194 | cr_index = VGA_CR_INDEX_CGA; | 194 | cr_index = VGA_CR_INDEX_CGA; |
195 | cr_data = VGA_CR_DATA_CGA; | 195 | cr_data = VGA_CR_DATA_CGA; |
196 | st01 = VGA_ST01_CGA; | 196 | st01 = VGA_ST01_CGA; |
@@ -203,36 +203,36 @@ static void i915_restore_vga(struct drm_device *dev) | |||
203 | /* Sequencer registers, don't write SR07 */ | 203 | /* Sequencer registers, don't write SR07 */ |
204 | for (i = 0; i < 7; i++) | 204 | for (i = 0; i < 7; i++) |
205 | i915_write_indexed(dev, VGA_SR_INDEX, VGA_SR_DATA, i, | 205 | i915_write_indexed(dev, VGA_SR_INDEX, VGA_SR_DATA, i, |
206 | dev_priv->saveSR[i]); | 206 | dev_priv->regfile.saveSR[i]); |
207 | 207 | ||
208 | /* CRT controller regs */ | 208 | /* CRT controller regs */ |
209 | /* Enable CR group 0 writes */ | 209 | /* Enable CR group 0 writes */ |
210 | i915_write_indexed(dev, cr_index, cr_data, 0x11, dev_priv->saveCR[0x11]); | 210 | i915_write_indexed(dev, cr_index, cr_data, 0x11, dev_priv->regfile.saveCR[0x11]); |
211 | for (i = 0; i <= 0x24; i++) | 211 | for (i = 0; i <= 0x24; i++) |
212 | i915_write_indexed(dev, cr_index, cr_data, i, dev_priv->saveCR[i]); | 212 | i915_write_indexed(dev, cr_index, cr_data, i, dev_priv->regfile.saveCR[i]); |
213 | 213 | ||
214 | /* Graphics controller regs */ | 214 | /* Graphics controller regs */ |
215 | for (i = 0; i < 9; i++) | 215 | for (i = 0; i < 9; i++) |
216 | i915_write_indexed(dev, VGA_GR_INDEX, VGA_GR_DATA, i, | 216 | i915_write_indexed(dev, VGA_GR_INDEX, VGA_GR_DATA, i, |
217 | dev_priv->saveGR[i]); | 217 | dev_priv->regfile.saveGR[i]); |
218 | 218 | ||
219 | i915_write_indexed(dev, VGA_GR_INDEX, VGA_GR_DATA, 0x10, | 219 | i915_write_indexed(dev, VGA_GR_INDEX, VGA_GR_DATA, 0x10, |
220 | dev_priv->saveGR[0x10]); | 220 | dev_priv->regfile.saveGR[0x10]); |
221 | i915_write_indexed(dev, VGA_GR_INDEX, VGA_GR_DATA, 0x11, | 221 | i915_write_indexed(dev, VGA_GR_INDEX, VGA_GR_DATA, 0x11, |
222 | dev_priv->saveGR[0x11]); | 222 | dev_priv->regfile.saveGR[0x11]); |
223 | i915_write_indexed(dev, VGA_GR_INDEX, VGA_GR_DATA, 0x18, | 223 | i915_write_indexed(dev, VGA_GR_INDEX, VGA_GR_DATA, 0x18, |
224 | dev_priv->saveGR[0x18]); | 224 | dev_priv->regfile.saveGR[0x18]); |
225 | 225 | ||
226 | /* Attribute controller registers */ | 226 | /* Attribute controller registers */ |
227 | I915_READ8(st01); /* switch back to index mode */ | 227 | I915_READ8(st01); /* switch back to index mode */ |
228 | for (i = 0; i <= 0x14; i++) | 228 | for (i = 0; i <= 0x14; i++) |
229 | i915_write_ar(dev, st01, i, dev_priv->saveAR[i], 0); | 229 | i915_write_ar(dev, st01, i, dev_priv->regfile.saveAR[i], 0); |
230 | I915_READ8(st01); /* switch back to index mode */ | 230 | I915_READ8(st01); /* switch back to index mode */ |
231 | I915_WRITE8(VGA_AR_INDEX, dev_priv->saveAR_INDEX | 0x20); | 231 | I915_WRITE8(VGA_AR_INDEX, dev_priv->regfile.saveAR_INDEX | 0x20); |
232 | I915_READ8(st01); | 232 | I915_READ8(st01); |
233 | 233 | ||
234 | /* VGA color palette registers */ | 234 | /* VGA color palette registers */ |
235 | I915_WRITE8(VGA_DACMASK, dev_priv->saveDACMASK); | 235 | I915_WRITE8(VGA_DACMASK, dev_priv->regfile.saveDACMASK); |
236 | } | 236 | } |
237 | 237 | ||
238 | static void i915_save_modeset_reg(struct drm_device *dev) | 238 | static void i915_save_modeset_reg(struct drm_device *dev) |
@@ -244,156 +244,162 @@ static void i915_save_modeset_reg(struct drm_device *dev) | |||
244 | return; | 244 | return; |
245 | 245 | ||
246 | /* Cursor state */ | 246 | /* Cursor state */ |
247 | dev_priv->saveCURACNTR = I915_READ(_CURACNTR); | 247 | dev_priv->regfile.saveCURACNTR = I915_READ(_CURACNTR); |
248 | dev_priv->saveCURAPOS = I915_READ(_CURAPOS); | 248 | dev_priv->regfile.saveCURAPOS = I915_READ(_CURAPOS); |
249 | dev_priv->saveCURABASE = I915_READ(_CURABASE); | 249 | dev_priv->regfile.saveCURABASE = I915_READ(_CURABASE); |
250 | dev_priv->saveCURBCNTR = I915_READ(_CURBCNTR); | 250 | dev_priv->regfile.saveCURBCNTR = I915_READ(_CURBCNTR); |
251 | dev_priv->saveCURBPOS = I915_READ(_CURBPOS); | 251 | dev_priv->regfile.saveCURBPOS = I915_READ(_CURBPOS); |
252 | dev_priv->saveCURBBASE = I915_READ(_CURBBASE); | 252 | dev_priv->regfile.saveCURBBASE = I915_READ(_CURBBASE); |
253 | if (IS_GEN2(dev)) | 253 | if (IS_GEN2(dev)) |
254 | dev_priv->saveCURSIZE = I915_READ(CURSIZE); | 254 | dev_priv->regfile.saveCURSIZE = I915_READ(CURSIZE); |
255 | 255 | ||
256 | if (HAS_PCH_SPLIT(dev)) { | 256 | if (HAS_PCH_SPLIT(dev)) { |
257 | dev_priv->savePCH_DREF_CONTROL = I915_READ(PCH_DREF_CONTROL); | 257 | dev_priv->regfile.savePCH_DREF_CONTROL = I915_READ(PCH_DREF_CONTROL); |
258 | dev_priv->saveDISP_ARB_CTL = I915_READ(DISP_ARB_CTL); | 258 | dev_priv->regfile.saveDISP_ARB_CTL = I915_READ(DISP_ARB_CTL); |
259 | } | 259 | } |
260 | 260 | ||
261 | /* Pipe & plane A info */ | 261 | /* Pipe & plane A info */ |
262 | dev_priv->savePIPEACONF = I915_READ(_PIPEACONF); | 262 | dev_priv->regfile.savePIPEACONF = I915_READ(_PIPEACONF); |
263 | dev_priv->savePIPEASRC = I915_READ(_PIPEASRC); | 263 | dev_priv->regfile.savePIPEASRC = I915_READ(_PIPEASRC); |
264 | if (HAS_PCH_SPLIT(dev)) { | 264 | if (HAS_PCH_SPLIT(dev)) { |
265 | dev_priv->saveFPA0 = I915_READ(_PCH_FPA0); | 265 | dev_priv->regfile.saveFPA0 = I915_READ(_PCH_FPA0); |
266 | dev_priv->saveFPA1 = I915_READ(_PCH_FPA1); | 266 | dev_priv->regfile.saveFPA1 = I915_READ(_PCH_FPA1); |
267 | dev_priv->saveDPLL_A = I915_READ(_PCH_DPLL_A); | 267 | dev_priv->regfile.saveDPLL_A = I915_READ(_PCH_DPLL_A); |
268 | } else { | 268 | } else { |
269 | dev_priv->saveFPA0 = I915_READ(_FPA0); | 269 | dev_priv->regfile.saveFPA0 = I915_READ(_FPA0); |
270 | dev_priv->saveFPA1 = I915_READ(_FPA1); | 270 | dev_priv->regfile.saveFPA1 = I915_READ(_FPA1); |
271 | dev_priv->saveDPLL_A = I915_READ(_DPLL_A); | 271 | dev_priv->regfile.saveDPLL_A = I915_READ(_DPLL_A); |
272 | } | 272 | } |
273 | if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev)) | 273 | if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev)) |
274 | dev_priv->saveDPLL_A_MD = I915_READ(_DPLL_A_MD); | 274 | dev_priv->regfile.saveDPLL_A_MD = I915_READ(_DPLL_A_MD); |
275 | dev_priv->saveHTOTAL_A = I915_READ(_HTOTAL_A); | 275 | dev_priv->regfile.saveHTOTAL_A = I915_READ(_HTOTAL_A); |
276 | dev_priv->saveHBLANK_A = I915_READ(_HBLANK_A); | 276 | dev_priv->regfile.saveHBLANK_A = I915_READ(_HBLANK_A); |
277 | dev_priv->saveHSYNC_A = I915_READ(_HSYNC_A); | 277 | dev_priv->regfile.saveHSYNC_A = I915_READ(_HSYNC_A); |
278 | dev_priv->saveVTOTAL_A = I915_READ(_VTOTAL_A); | 278 | dev_priv->regfile.saveVTOTAL_A = I915_READ(_VTOTAL_A); |
279 | dev_priv->saveVBLANK_A = I915_READ(_VBLANK_A); | 279 | dev_priv->regfile.saveVBLANK_A = I915_READ(_VBLANK_A); |
280 | dev_priv->saveVSYNC_A = I915_READ(_VSYNC_A); | 280 | dev_priv->regfile.saveVSYNC_A = I915_READ(_VSYNC_A); |
281 | if (!HAS_PCH_SPLIT(dev)) | 281 | if (!HAS_PCH_SPLIT(dev)) |
282 | dev_priv->saveBCLRPAT_A = I915_READ(_BCLRPAT_A); | 282 | dev_priv->regfile.saveBCLRPAT_A = I915_READ(_BCLRPAT_A); |
283 | 283 | ||
284 | if (HAS_PCH_SPLIT(dev)) { | 284 | if (HAS_PCH_SPLIT(dev)) { |
285 | dev_priv->savePIPEA_DATA_M1 = I915_READ(_PIPEA_DATA_M1); | 285 | dev_priv->regfile.savePIPEA_DATA_M1 = I915_READ(_PIPEA_DATA_M1); |
286 | dev_priv->savePIPEA_DATA_N1 = I915_READ(_PIPEA_DATA_N1); | 286 | dev_priv->regfile.savePIPEA_DATA_N1 = I915_READ(_PIPEA_DATA_N1); |
287 | dev_priv->savePIPEA_LINK_M1 = I915_READ(_PIPEA_LINK_M1); | 287 | dev_priv->regfile.savePIPEA_LINK_M1 = I915_READ(_PIPEA_LINK_M1); |
288 | dev_priv->savePIPEA_LINK_N1 = I915_READ(_PIPEA_LINK_N1); | 288 | dev_priv->regfile.savePIPEA_LINK_N1 = I915_READ(_PIPEA_LINK_N1); |
289 | 289 | ||
290 | dev_priv->saveFDI_TXA_CTL = I915_READ(_FDI_TXA_CTL); | 290 | dev_priv->regfile.saveFDI_TXA_CTL = I915_READ(_FDI_TXA_CTL); |
291 | dev_priv->saveFDI_RXA_CTL = I915_READ(_FDI_RXA_CTL); | 291 | dev_priv->regfile.saveFDI_RXA_CTL = I915_READ(_FDI_RXA_CTL); |
292 | 292 | ||
293 | dev_priv->savePFA_CTL_1 = I915_READ(_PFA_CTL_1); | 293 | dev_priv->regfile.savePFA_CTL_1 = I915_READ(_PFA_CTL_1); |
294 | dev_priv->savePFA_WIN_SZ = I915_READ(_PFA_WIN_SZ); | 294 | dev_priv->regfile.savePFA_WIN_SZ = I915_READ(_PFA_WIN_SZ); |
295 | dev_priv->savePFA_WIN_POS = I915_READ(_PFA_WIN_POS); | 295 | dev_priv->regfile.savePFA_WIN_POS = I915_READ(_PFA_WIN_POS); |
296 | 296 | ||
297 | dev_priv->saveTRANSACONF = I915_READ(_TRANSACONF); | 297 | dev_priv->regfile.saveTRANSACONF = I915_READ(_TRANSACONF); |
298 | dev_priv->saveTRANS_HTOTAL_A = I915_READ(_TRANS_HTOTAL_A); | 298 | dev_priv->regfile.saveTRANS_HTOTAL_A = I915_READ(_TRANS_HTOTAL_A); |
299 | dev_priv->saveTRANS_HBLANK_A = I915_READ(_TRANS_HBLANK_A); | 299 | dev_priv->regfile.saveTRANS_HBLANK_A = I915_READ(_TRANS_HBLANK_A); |
300 | dev_priv->saveTRANS_HSYNC_A = I915_READ(_TRANS_HSYNC_A); | 300 | dev_priv->regfile.saveTRANS_HSYNC_A = I915_READ(_TRANS_HSYNC_A); |
301 | dev_priv->saveTRANS_VTOTAL_A = I915_READ(_TRANS_VTOTAL_A); | 301 | dev_priv->regfile.saveTRANS_VTOTAL_A = I915_READ(_TRANS_VTOTAL_A); |
302 | dev_priv->saveTRANS_VBLANK_A = I915_READ(_TRANS_VBLANK_A); | 302 | dev_priv->regfile.saveTRANS_VBLANK_A = I915_READ(_TRANS_VBLANK_A); |
303 | dev_priv->saveTRANS_VSYNC_A = I915_READ(_TRANS_VSYNC_A); | 303 | dev_priv->regfile.saveTRANS_VSYNC_A = I915_READ(_TRANS_VSYNC_A); |
304 | } | 304 | } |
305 | 305 | ||
306 | dev_priv->saveDSPACNTR = I915_READ(_DSPACNTR); | 306 | dev_priv->regfile.saveDSPACNTR = I915_READ(_DSPACNTR); |
307 | dev_priv->saveDSPASTRIDE = I915_READ(_DSPASTRIDE); | 307 | dev_priv->regfile.saveDSPASTRIDE = I915_READ(_DSPASTRIDE); |
308 | dev_priv->saveDSPASIZE = I915_READ(_DSPASIZE); | 308 | dev_priv->regfile.saveDSPASIZE = I915_READ(_DSPASIZE); |
309 | dev_priv->saveDSPAPOS = I915_READ(_DSPAPOS); | 309 | dev_priv->regfile.saveDSPAPOS = I915_READ(_DSPAPOS); |
310 | dev_priv->saveDSPAADDR = I915_READ(_DSPAADDR); | 310 | dev_priv->regfile.saveDSPAADDR = I915_READ(_DSPAADDR); |
311 | if (INTEL_INFO(dev)->gen >= 4) { | 311 | if (INTEL_INFO(dev)->gen >= 4) { |
312 | dev_priv->saveDSPASURF = I915_READ(_DSPASURF); | 312 | dev_priv->regfile.saveDSPASURF = I915_READ(_DSPASURF); |
313 | dev_priv->saveDSPATILEOFF = I915_READ(_DSPATILEOFF); | 313 | dev_priv->regfile.saveDSPATILEOFF = I915_READ(_DSPATILEOFF); |
314 | } | 314 | } |
315 | i915_save_palette(dev, PIPE_A); | 315 | i915_save_palette(dev, PIPE_A); |
316 | dev_priv->savePIPEASTAT = I915_READ(_PIPEASTAT); | 316 | dev_priv->regfile.savePIPEASTAT = I915_READ(_PIPEASTAT); |
317 | 317 | ||
318 | /* Pipe & plane B info */ | 318 | /* Pipe & plane B info */ |
319 | dev_priv->savePIPEBCONF = I915_READ(_PIPEBCONF); | 319 | dev_priv->regfile.savePIPEBCONF = I915_READ(_PIPEBCONF); |
320 | dev_priv->savePIPEBSRC = I915_READ(_PIPEBSRC); | 320 | dev_priv->regfile.savePIPEBSRC = I915_READ(_PIPEBSRC); |
321 | if (HAS_PCH_SPLIT(dev)) { | 321 | if (HAS_PCH_SPLIT(dev)) { |
322 | dev_priv->saveFPB0 = I915_READ(_PCH_FPB0); | 322 | dev_priv->regfile.saveFPB0 = I915_READ(_PCH_FPB0); |
323 | dev_priv->saveFPB1 = I915_READ(_PCH_FPB1); | 323 | dev_priv->regfile.saveFPB1 = I915_READ(_PCH_FPB1); |
324 | dev_priv->saveDPLL_B = I915_READ(_PCH_DPLL_B); | 324 | dev_priv->regfile.saveDPLL_B = I915_READ(_PCH_DPLL_B); |
325 | } else { | 325 | } else { |
326 | dev_priv->saveFPB0 = I915_READ(_FPB0); | 326 | dev_priv->regfile.saveFPB0 = I915_READ(_FPB0); |
327 | dev_priv->saveFPB1 = I915_READ(_FPB1); | 327 | dev_priv->regfile.saveFPB1 = I915_READ(_FPB1); |
328 | dev_priv->saveDPLL_B = I915_READ(_DPLL_B); | 328 | dev_priv->regfile.saveDPLL_B = I915_READ(_DPLL_B); |
329 | } | 329 | } |
330 | if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev)) | 330 | if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev)) |
331 | dev_priv->saveDPLL_B_MD = I915_READ(_DPLL_B_MD); | 331 | dev_priv->regfile.saveDPLL_B_MD = I915_READ(_DPLL_B_MD); |
332 | dev_priv->saveHTOTAL_B = I915_READ(_HTOTAL_B); | 332 | dev_priv->regfile.saveHTOTAL_B = I915_READ(_HTOTAL_B); |
333 | dev_priv->saveHBLANK_B = I915_READ(_HBLANK_B); | 333 | dev_priv->regfile.saveHBLANK_B = I915_READ(_HBLANK_B); |
334 | dev_priv->saveHSYNC_B = I915_READ(_HSYNC_B); | 334 | dev_priv->regfile.saveHSYNC_B = I915_READ(_HSYNC_B); |
335 | dev_priv->saveVTOTAL_B = I915_READ(_VTOTAL_B); | 335 | dev_priv->regfile.saveVTOTAL_B = I915_READ(_VTOTAL_B); |
336 | dev_priv->saveVBLANK_B = I915_READ(_VBLANK_B); | 336 | dev_priv->regfile.saveVBLANK_B = I915_READ(_VBLANK_B); |
337 | dev_priv->saveVSYNC_B = I915_READ(_VSYNC_B); | 337 | dev_priv->regfile.saveVSYNC_B = I915_READ(_VSYNC_B); |
338 | if (!HAS_PCH_SPLIT(dev)) | 338 | if (!HAS_PCH_SPLIT(dev)) |
339 | dev_priv->saveBCLRPAT_B = I915_READ(_BCLRPAT_B); | 339 | dev_priv->regfile.saveBCLRPAT_B = I915_READ(_BCLRPAT_B); |
340 | 340 | ||
341 | if (HAS_PCH_SPLIT(dev)) { | 341 | if (HAS_PCH_SPLIT(dev)) { |
342 | dev_priv->savePIPEB_DATA_M1 = I915_READ(_PIPEB_DATA_M1); | 342 | dev_priv->regfile.savePIPEB_DATA_M1 = I915_READ(_PIPEB_DATA_M1); |
343 | dev_priv->savePIPEB_DATA_N1 = I915_READ(_PIPEB_DATA_N1); | 343 | dev_priv->regfile.savePIPEB_DATA_N1 = I915_READ(_PIPEB_DATA_N1); |
344 | dev_priv->savePIPEB_LINK_M1 = I915_READ(_PIPEB_LINK_M1); | 344 | dev_priv->regfile.savePIPEB_LINK_M1 = I915_READ(_PIPEB_LINK_M1); |
345 | dev_priv->savePIPEB_LINK_N1 = I915_READ(_PIPEB_LINK_N1); | 345 | dev_priv->regfile.savePIPEB_LINK_N1 = I915_READ(_PIPEB_LINK_N1); |
346 | 346 | ||
347 | dev_priv->saveFDI_TXB_CTL = I915_READ(_FDI_TXB_CTL); | 347 | dev_priv->regfile.saveFDI_TXB_CTL = I915_READ(_FDI_TXB_CTL); |
348 | dev_priv->saveFDI_RXB_CTL = I915_READ(_FDI_RXB_CTL); | 348 | dev_priv->regfile.saveFDI_RXB_CTL = I915_READ(_FDI_RXB_CTL); |
349 | 349 | ||
350 | dev_priv->savePFB_CTL_1 = I915_READ(_PFB_CTL_1); | 350 | dev_priv->regfile.savePFB_CTL_1 = I915_READ(_PFB_CTL_1); |
351 | dev_priv->savePFB_WIN_SZ = I915_READ(_PFB_WIN_SZ); | 351 | dev_priv->regfile.savePFB_WIN_SZ = I915_READ(_PFB_WIN_SZ); |
352 | dev_priv->savePFB_WIN_POS = I915_READ(_PFB_WIN_POS); | 352 | dev_priv->regfile.savePFB_WIN_POS = I915_READ(_PFB_WIN_POS); |
353 | 353 | ||
354 | dev_priv->saveTRANSBCONF = I915_READ(_TRANSBCONF); | 354 | dev_priv->regfile.saveTRANSBCONF = I915_READ(_TRANSBCONF); |
355 | dev_priv->saveTRANS_HTOTAL_B = I915_READ(_TRANS_HTOTAL_B); | 355 | dev_priv->regfile.saveTRANS_HTOTAL_B = I915_READ(_TRANS_HTOTAL_B); |
356 | dev_priv->saveTRANS_HBLANK_B = I915_READ(_TRANS_HBLANK_B); | 356 | dev_priv->regfile.saveTRANS_HBLANK_B = I915_READ(_TRANS_HBLANK_B); |
357 | dev_priv->saveTRANS_HSYNC_B = I915_READ(_TRANS_HSYNC_B); | 357 | dev_priv->regfile.saveTRANS_HSYNC_B = I915_READ(_TRANS_HSYNC_B); |
358 | dev_priv->saveTRANS_VTOTAL_B = I915_READ(_TRANS_VTOTAL_B); | 358 | dev_priv->regfile.saveTRANS_VTOTAL_B = I915_READ(_TRANS_VTOTAL_B); |
359 | dev_priv->saveTRANS_VBLANK_B = I915_READ(_TRANS_VBLANK_B); | 359 | dev_priv->regfile.saveTRANS_VBLANK_B = I915_READ(_TRANS_VBLANK_B); |
360 | dev_priv->saveTRANS_VSYNC_B = I915_READ(_TRANS_VSYNC_B); | 360 | dev_priv->regfile.saveTRANS_VSYNC_B = I915_READ(_TRANS_VSYNC_B); |
361 | } | 361 | } |
362 | 362 | ||
363 | dev_priv->saveDSPBCNTR = I915_READ(_DSPBCNTR); | 363 | dev_priv->regfile.saveDSPBCNTR = I915_READ(_DSPBCNTR); |
364 | dev_priv->saveDSPBSTRIDE = I915_READ(_DSPBSTRIDE); | 364 | dev_priv->regfile.saveDSPBSTRIDE = I915_READ(_DSPBSTRIDE); |
365 | dev_priv->saveDSPBSIZE = I915_READ(_DSPBSIZE); | 365 | dev_priv->regfile.saveDSPBSIZE = I915_READ(_DSPBSIZE); |
366 | dev_priv->saveDSPBPOS = I915_READ(_DSPBPOS); | 366 | dev_priv->regfile.saveDSPBPOS = I915_READ(_DSPBPOS); |
367 | dev_priv->saveDSPBADDR = I915_READ(_DSPBADDR); | 367 | dev_priv->regfile.saveDSPBADDR = I915_READ(_DSPBADDR); |
368 | if (INTEL_INFO(dev)->gen >= 4) { | 368 | if (INTEL_INFO(dev)->gen >= 4) { |
369 | dev_priv->saveDSPBSURF = I915_READ(_DSPBSURF); | 369 | dev_priv->regfile.saveDSPBSURF = I915_READ(_DSPBSURF); |
370 | dev_priv->saveDSPBTILEOFF = I915_READ(_DSPBTILEOFF); | 370 | dev_priv->regfile.saveDSPBTILEOFF = I915_READ(_DSPBTILEOFF); |
371 | } | 371 | } |
372 | i915_save_palette(dev, PIPE_B); | 372 | i915_save_palette(dev, PIPE_B); |
373 | dev_priv->savePIPEBSTAT = I915_READ(_PIPEBSTAT); | 373 | dev_priv->regfile.savePIPEBSTAT = I915_READ(_PIPEBSTAT); |
374 | 374 | ||
375 | /* Fences */ | 375 | /* Fences */ |
376 | switch (INTEL_INFO(dev)->gen) { | 376 | switch (INTEL_INFO(dev)->gen) { |
377 | case 7: | 377 | case 7: |
378 | case 6: | 378 | case 6: |
379 | for (i = 0; i < 16; i++) | 379 | for (i = 0; i < 16; i++) |
380 | dev_priv->saveFENCE[i] = I915_READ64(FENCE_REG_SANDYBRIDGE_0 + (i * 8)); | 380 | dev_priv->regfile.saveFENCE[i] = I915_READ64(FENCE_REG_SANDYBRIDGE_0 + (i * 8)); |
381 | break; | 381 | break; |
382 | case 5: | 382 | case 5: |
383 | case 4: | 383 | case 4: |
384 | for (i = 0; i < 16; i++) | 384 | for (i = 0; i < 16; i++) |
385 | dev_priv->saveFENCE[i] = I915_READ64(FENCE_REG_965_0 + (i * 8)); | 385 | dev_priv->regfile.saveFENCE[i] = I915_READ64(FENCE_REG_965_0 + (i * 8)); |
386 | break; | 386 | break; |
387 | case 3: | 387 | case 3: |
388 | if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev)) | 388 | if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev)) |
389 | for (i = 0; i < 8; i++) | 389 | for (i = 0; i < 8; i++) |
390 | dev_priv->saveFENCE[i+8] = I915_READ(FENCE_REG_945_8 + (i * 4)); | 390 | dev_priv->regfile.saveFENCE[i+8] = I915_READ(FENCE_REG_945_8 + (i * 4)); |
391 | case 2: | 391 | case 2: |
392 | for (i = 0; i < 8; i++) | 392 | for (i = 0; i < 8; i++) |
393 | dev_priv->saveFENCE[i] = I915_READ(FENCE_REG_830_0 + (i * 4)); | 393 | dev_priv->regfile.saveFENCE[i] = I915_READ(FENCE_REG_830_0 + (i * 4)); |
394 | break; | 394 | break; |
395 | } | 395 | } |
396 | 396 | ||
397 | /* CRT state */ | ||
398 | if (HAS_PCH_SPLIT(dev)) | ||
399 | dev_priv->regfile.saveADPA = I915_READ(PCH_ADPA); | ||
400 | else | ||
401 | dev_priv->regfile.saveADPA = I915_READ(ADPA); | ||
402 | |||
397 | return; | 403 | return; |
398 | } | 404 | } |
399 | 405 | ||
@@ -412,20 +418,20 @@ static void i915_restore_modeset_reg(struct drm_device *dev) | |||
412 | case 7: | 418 | case 7: |
413 | case 6: | 419 | case 6: |
414 | for (i = 0; i < 16; i++) | 420 | for (i = 0; i < 16; i++) |
415 | I915_WRITE64(FENCE_REG_SANDYBRIDGE_0 + (i * 8), dev_priv->saveFENCE[i]); | 421 | I915_WRITE64(FENCE_REG_SANDYBRIDGE_0 + (i * 8), dev_priv->regfile.saveFENCE[i]); |
416 | break; | 422 | break; |
417 | case 5: | 423 | case 5: |
418 | case 4: | 424 | case 4: |
419 | for (i = 0; i < 16; i++) | 425 | for (i = 0; i < 16; i++) |
420 | I915_WRITE64(FENCE_REG_965_0 + (i * 8), dev_priv->saveFENCE[i]); | 426 | I915_WRITE64(FENCE_REG_965_0 + (i * 8), dev_priv->regfile.saveFENCE[i]); |
421 | break; | 427 | break; |
422 | case 3: | 428 | case 3: |
423 | case 2: | 429 | case 2: |
424 | if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev)) | 430 | if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev)) |
425 | for (i = 0; i < 8; i++) | 431 | for (i = 0; i < 8; i++) |
426 | I915_WRITE(FENCE_REG_945_8 + (i * 4), dev_priv->saveFENCE[i+8]); | 432 | I915_WRITE(FENCE_REG_945_8 + (i * 4), dev_priv->regfile.saveFENCE[i+8]); |
427 | for (i = 0; i < 8; i++) | 433 | for (i = 0; i < 8; i++) |
428 | I915_WRITE(FENCE_REG_830_0 + (i * 4), dev_priv->saveFENCE[i]); | 434 | I915_WRITE(FENCE_REG_830_0 + (i * 4), dev_priv->regfile.saveFENCE[i]); |
429 | break; | 435 | break; |
430 | } | 436 | } |
431 | 437 | ||
@@ -447,158 +453,164 @@ static void i915_restore_modeset_reg(struct drm_device *dev) | |||
447 | } | 453 | } |
448 | 454 | ||
449 | if (HAS_PCH_SPLIT(dev)) { | 455 | if (HAS_PCH_SPLIT(dev)) { |
450 | I915_WRITE(PCH_DREF_CONTROL, dev_priv->savePCH_DREF_CONTROL); | 456 | I915_WRITE(PCH_DREF_CONTROL, dev_priv->regfile.savePCH_DREF_CONTROL); |
451 | I915_WRITE(DISP_ARB_CTL, dev_priv->saveDISP_ARB_CTL); | 457 | I915_WRITE(DISP_ARB_CTL, dev_priv->regfile.saveDISP_ARB_CTL); |
452 | } | 458 | } |
453 | 459 | ||
454 | /* Pipe & plane A info */ | 460 | /* Pipe & plane A info */ |
455 | /* Prime the clock */ | 461 | /* Prime the clock */ |
456 | if (dev_priv->saveDPLL_A & DPLL_VCO_ENABLE) { | 462 | if (dev_priv->regfile.saveDPLL_A & DPLL_VCO_ENABLE) { |
457 | I915_WRITE(dpll_a_reg, dev_priv->saveDPLL_A & | 463 | I915_WRITE(dpll_a_reg, dev_priv->regfile.saveDPLL_A & |
458 | ~DPLL_VCO_ENABLE); | 464 | ~DPLL_VCO_ENABLE); |
459 | POSTING_READ(dpll_a_reg); | 465 | POSTING_READ(dpll_a_reg); |
460 | udelay(150); | 466 | udelay(150); |
461 | } | 467 | } |
462 | I915_WRITE(fpa0_reg, dev_priv->saveFPA0); | 468 | I915_WRITE(fpa0_reg, dev_priv->regfile.saveFPA0); |
463 | I915_WRITE(fpa1_reg, dev_priv->saveFPA1); | 469 | I915_WRITE(fpa1_reg, dev_priv->regfile.saveFPA1); |
464 | /* Actually enable it */ | 470 | /* Actually enable it */ |
465 | I915_WRITE(dpll_a_reg, dev_priv->saveDPLL_A); | 471 | I915_WRITE(dpll_a_reg, dev_priv->regfile.saveDPLL_A); |
466 | POSTING_READ(dpll_a_reg); | 472 | POSTING_READ(dpll_a_reg); |
467 | udelay(150); | 473 | udelay(150); |
468 | if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev)) { | 474 | if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev)) { |
469 | I915_WRITE(_DPLL_A_MD, dev_priv->saveDPLL_A_MD); | 475 | I915_WRITE(_DPLL_A_MD, dev_priv->regfile.saveDPLL_A_MD); |
470 | POSTING_READ(_DPLL_A_MD); | 476 | POSTING_READ(_DPLL_A_MD); |
471 | } | 477 | } |
472 | udelay(150); | 478 | udelay(150); |
473 | 479 | ||
474 | /* Restore mode */ | 480 | /* Restore mode */ |
475 | I915_WRITE(_HTOTAL_A, dev_priv->saveHTOTAL_A); | 481 | I915_WRITE(_HTOTAL_A, dev_priv->regfile.saveHTOTAL_A); |
476 | I915_WRITE(_HBLANK_A, dev_priv->saveHBLANK_A); | 482 | I915_WRITE(_HBLANK_A, dev_priv->regfile.saveHBLANK_A); |
477 | I915_WRITE(_HSYNC_A, dev_priv->saveHSYNC_A); | 483 | I915_WRITE(_HSYNC_A, dev_priv->regfile.saveHSYNC_A); |
478 | I915_WRITE(_VTOTAL_A, dev_priv->saveVTOTAL_A); | 484 | I915_WRITE(_VTOTAL_A, dev_priv->regfile.saveVTOTAL_A); |
479 | I915_WRITE(_VBLANK_A, dev_priv->saveVBLANK_A); | 485 | I915_WRITE(_VBLANK_A, dev_priv->regfile.saveVBLANK_A); |
480 | I915_WRITE(_VSYNC_A, dev_priv->saveVSYNC_A); | 486 | I915_WRITE(_VSYNC_A, dev_priv->regfile.saveVSYNC_A); |
481 | if (!HAS_PCH_SPLIT(dev)) | 487 | if (!HAS_PCH_SPLIT(dev)) |
482 | I915_WRITE(_BCLRPAT_A, dev_priv->saveBCLRPAT_A); | 488 | I915_WRITE(_BCLRPAT_A, dev_priv->regfile.saveBCLRPAT_A); |
483 | 489 | ||
484 | if (HAS_PCH_SPLIT(dev)) { | 490 | if (HAS_PCH_SPLIT(dev)) { |
485 | I915_WRITE(_PIPEA_DATA_M1, dev_priv->savePIPEA_DATA_M1); | 491 | I915_WRITE(_PIPEA_DATA_M1, dev_priv->regfile.savePIPEA_DATA_M1); |
486 | I915_WRITE(_PIPEA_DATA_N1, dev_priv->savePIPEA_DATA_N1); | 492 | I915_WRITE(_PIPEA_DATA_N1, dev_priv->regfile.savePIPEA_DATA_N1); |
487 | I915_WRITE(_PIPEA_LINK_M1, dev_priv->savePIPEA_LINK_M1); | 493 | I915_WRITE(_PIPEA_LINK_M1, dev_priv->regfile.savePIPEA_LINK_M1); |
488 | I915_WRITE(_PIPEA_LINK_N1, dev_priv->savePIPEA_LINK_N1); | 494 | I915_WRITE(_PIPEA_LINK_N1, dev_priv->regfile.savePIPEA_LINK_N1); |
489 | 495 | ||
490 | I915_WRITE(_FDI_RXA_CTL, dev_priv->saveFDI_RXA_CTL); | 496 | I915_WRITE(_FDI_RXA_CTL, dev_priv->regfile.saveFDI_RXA_CTL); |
491 | I915_WRITE(_FDI_TXA_CTL, dev_priv->saveFDI_TXA_CTL); | 497 | I915_WRITE(_FDI_TXA_CTL, dev_priv->regfile.saveFDI_TXA_CTL); |
492 | 498 | ||
493 | I915_WRITE(_PFA_CTL_1, dev_priv->savePFA_CTL_1); | 499 | I915_WRITE(_PFA_CTL_1, dev_priv->regfile.savePFA_CTL_1); |
494 | I915_WRITE(_PFA_WIN_SZ, dev_priv->savePFA_WIN_SZ); | 500 | I915_WRITE(_PFA_WIN_SZ, dev_priv->regfile.savePFA_WIN_SZ); |
495 | I915_WRITE(_PFA_WIN_POS, dev_priv->savePFA_WIN_POS); | 501 | I915_WRITE(_PFA_WIN_POS, dev_priv->regfile.savePFA_WIN_POS); |
496 | 502 | ||
497 | I915_WRITE(_TRANSACONF, dev_priv->saveTRANSACONF); | 503 | I915_WRITE(_TRANSACONF, dev_priv->regfile.saveTRANSACONF); |
498 | I915_WRITE(_TRANS_HTOTAL_A, dev_priv->saveTRANS_HTOTAL_A); | 504 | I915_WRITE(_TRANS_HTOTAL_A, dev_priv->regfile.saveTRANS_HTOTAL_A); |
499 | I915_WRITE(_TRANS_HBLANK_A, dev_priv->saveTRANS_HBLANK_A); | 505 | I915_WRITE(_TRANS_HBLANK_A, dev_priv->regfile.saveTRANS_HBLANK_A); |
500 | I915_WRITE(_TRANS_HSYNC_A, dev_priv->saveTRANS_HSYNC_A); | 506 | I915_WRITE(_TRANS_HSYNC_A, dev_priv->regfile.saveTRANS_HSYNC_A); |
501 | I915_WRITE(_TRANS_VTOTAL_A, dev_priv->saveTRANS_VTOTAL_A); | 507 | I915_WRITE(_TRANS_VTOTAL_A, dev_priv->regfile.saveTRANS_VTOTAL_A); |
502 | I915_WRITE(_TRANS_VBLANK_A, dev_priv->saveTRANS_VBLANK_A); | 508 | I915_WRITE(_TRANS_VBLANK_A, dev_priv->regfile.saveTRANS_VBLANK_A); |
503 | I915_WRITE(_TRANS_VSYNC_A, dev_priv->saveTRANS_VSYNC_A); | 509 | I915_WRITE(_TRANS_VSYNC_A, dev_priv->regfile.saveTRANS_VSYNC_A); |
504 | } | 510 | } |
505 | 511 | ||
506 | /* Restore plane info */ | 512 | /* Restore plane info */ |
507 | I915_WRITE(_DSPASIZE, dev_priv->saveDSPASIZE); | 513 | I915_WRITE(_DSPASIZE, dev_priv->regfile.saveDSPASIZE); |
508 | I915_WRITE(_DSPAPOS, dev_priv->saveDSPAPOS); | 514 | I915_WRITE(_DSPAPOS, dev_priv->regfile.saveDSPAPOS); |
509 | I915_WRITE(_PIPEASRC, dev_priv->savePIPEASRC); | 515 | I915_WRITE(_PIPEASRC, dev_priv->regfile.savePIPEASRC); |
510 | I915_WRITE(_DSPAADDR, dev_priv->saveDSPAADDR); | 516 | I915_WRITE(_DSPAADDR, dev_priv->regfile.saveDSPAADDR); |
511 | I915_WRITE(_DSPASTRIDE, dev_priv->saveDSPASTRIDE); | 517 | I915_WRITE(_DSPASTRIDE, dev_priv->regfile.saveDSPASTRIDE); |
512 | if (INTEL_INFO(dev)->gen >= 4) { | 518 | if (INTEL_INFO(dev)->gen >= 4) { |
513 | I915_WRITE(_DSPASURF, dev_priv->saveDSPASURF); | 519 | I915_WRITE(_DSPASURF, dev_priv->regfile.saveDSPASURF); |
514 | I915_WRITE(_DSPATILEOFF, dev_priv->saveDSPATILEOFF); | 520 | I915_WRITE(_DSPATILEOFF, dev_priv->regfile.saveDSPATILEOFF); |
515 | } | 521 | } |
516 | 522 | ||
517 | I915_WRITE(_PIPEACONF, dev_priv->savePIPEACONF); | 523 | I915_WRITE(_PIPEACONF, dev_priv->regfile.savePIPEACONF); |
518 | 524 | ||
519 | i915_restore_palette(dev, PIPE_A); | 525 | i915_restore_palette(dev, PIPE_A); |
520 | /* Enable the plane */ | 526 | /* Enable the plane */ |
521 | I915_WRITE(_DSPACNTR, dev_priv->saveDSPACNTR); | 527 | I915_WRITE(_DSPACNTR, dev_priv->regfile.saveDSPACNTR); |
522 | I915_WRITE(_DSPAADDR, I915_READ(_DSPAADDR)); | 528 | I915_WRITE(_DSPAADDR, I915_READ(_DSPAADDR)); |
523 | 529 | ||
524 | /* Pipe & plane B info */ | 530 | /* Pipe & plane B info */ |
525 | if (dev_priv->saveDPLL_B & DPLL_VCO_ENABLE) { | 531 | if (dev_priv->regfile.saveDPLL_B & DPLL_VCO_ENABLE) { |
526 | I915_WRITE(dpll_b_reg, dev_priv->saveDPLL_B & | 532 | I915_WRITE(dpll_b_reg, dev_priv->regfile.saveDPLL_B & |
527 | ~DPLL_VCO_ENABLE); | 533 | ~DPLL_VCO_ENABLE); |
528 | POSTING_READ(dpll_b_reg); | 534 | POSTING_READ(dpll_b_reg); |
529 | udelay(150); | 535 | udelay(150); |
530 | } | 536 | } |
531 | I915_WRITE(fpb0_reg, dev_priv->saveFPB0); | 537 | I915_WRITE(fpb0_reg, dev_priv->regfile.saveFPB0); |
532 | I915_WRITE(fpb1_reg, dev_priv->saveFPB1); | 538 | I915_WRITE(fpb1_reg, dev_priv->regfile.saveFPB1); |
533 | /* Actually enable it */ | 539 | /* Actually enable it */ |
534 | I915_WRITE(dpll_b_reg, dev_priv->saveDPLL_B); | 540 | I915_WRITE(dpll_b_reg, dev_priv->regfile.saveDPLL_B); |
535 | POSTING_READ(dpll_b_reg); | 541 | POSTING_READ(dpll_b_reg); |
536 | udelay(150); | 542 | udelay(150); |
537 | if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev)) { | 543 | if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev)) { |
538 | I915_WRITE(_DPLL_B_MD, dev_priv->saveDPLL_B_MD); | 544 | I915_WRITE(_DPLL_B_MD, dev_priv->regfile.saveDPLL_B_MD); |
539 | POSTING_READ(_DPLL_B_MD); | 545 | POSTING_READ(_DPLL_B_MD); |
540 | } | 546 | } |
541 | udelay(150); | 547 | udelay(150); |
542 | 548 | ||
543 | /* Restore mode */ | 549 | /* Restore mode */ |
544 | I915_WRITE(_HTOTAL_B, dev_priv->saveHTOTAL_B); | 550 | I915_WRITE(_HTOTAL_B, dev_priv->regfile.saveHTOTAL_B); |
545 | I915_WRITE(_HBLANK_B, dev_priv->saveHBLANK_B); | 551 | I915_WRITE(_HBLANK_B, dev_priv->regfile.saveHBLANK_B); |
546 | I915_WRITE(_HSYNC_B, dev_priv->saveHSYNC_B); | 552 | I915_WRITE(_HSYNC_B, dev_priv->regfile.saveHSYNC_B); |
547 | I915_WRITE(_VTOTAL_B, dev_priv->saveVTOTAL_B); | 553 | I915_WRITE(_VTOTAL_B, dev_priv->regfile.saveVTOTAL_B); |
548 | I915_WRITE(_VBLANK_B, dev_priv->saveVBLANK_B); | 554 | I915_WRITE(_VBLANK_B, dev_priv->regfile.saveVBLANK_B); |
549 | I915_WRITE(_VSYNC_B, dev_priv->saveVSYNC_B); | 555 | I915_WRITE(_VSYNC_B, dev_priv->regfile.saveVSYNC_B); |
550 | if (!HAS_PCH_SPLIT(dev)) | 556 | if (!HAS_PCH_SPLIT(dev)) |
551 | I915_WRITE(_BCLRPAT_B, dev_priv->saveBCLRPAT_B); | 557 | I915_WRITE(_BCLRPAT_B, dev_priv->regfile.saveBCLRPAT_B); |
552 | 558 | ||
553 | if (HAS_PCH_SPLIT(dev)) { | 559 | if (HAS_PCH_SPLIT(dev)) { |
554 | I915_WRITE(_PIPEB_DATA_M1, dev_priv->savePIPEB_DATA_M1); | 560 | I915_WRITE(_PIPEB_DATA_M1, dev_priv->regfile.savePIPEB_DATA_M1); |
555 | I915_WRITE(_PIPEB_DATA_N1, dev_priv->savePIPEB_DATA_N1); | 561 | I915_WRITE(_PIPEB_DATA_N1, dev_priv->regfile.savePIPEB_DATA_N1); |
556 | I915_WRITE(_PIPEB_LINK_M1, dev_priv->savePIPEB_LINK_M1); | 562 | I915_WRITE(_PIPEB_LINK_M1, dev_priv->regfile.savePIPEB_LINK_M1); |
557 | I915_WRITE(_PIPEB_LINK_N1, dev_priv->savePIPEB_LINK_N1); | 563 | I915_WRITE(_PIPEB_LINK_N1, dev_priv->regfile.savePIPEB_LINK_N1); |
558 | 564 | ||
559 | I915_WRITE(_FDI_RXB_CTL, dev_priv->saveFDI_RXB_CTL); | 565 | I915_WRITE(_FDI_RXB_CTL, dev_priv->regfile.saveFDI_RXB_CTL); |
560 | I915_WRITE(_FDI_TXB_CTL, dev_priv->saveFDI_TXB_CTL); | 566 | I915_WRITE(_FDI_TXB_CTL, dev_priv->regfile.saveFDI_TXB_CTL); |
561 | 567 | ||
562 | I915_WRITE(_PFB_CTL_1, dev_priv->savePFB_CTL_1); | 568 | I915_WRITE(_PFB_CTL_1, dev_priv->regfile.savePFB_CTL_1); |
563 | I915_WRITE(_PFB_WIN_SZ, dev_priv->savePFB_WIN_SZ); | 569 | I915_WRITE(_PFB_WIN_SZ, dev_priv->regfile.savePFB_WIN_SZ); |
564 | I915_WRITE(_PFB_WIN_POS, dev_priv->savePFB_WIN_POS); | 570 | I915_WRITE(_PFB_WIN_POS, dev_priv->regfile.savePFB_WIN_POS); |
565 | 571 | ||
566 | I915_WRITE(_TRANSBCONF, dev_priv->saveTRANSBCONF); | 572 | I915_WRITE(_TRANSBCONF, dev_priv->regfile.saveTRANSBCONF); |
567 | I915_WRITE(_TRANS_HTOTAL_B, dev_priv->saveTRANS_HTOTAL_B); | 573 | I915_WRITE(_TRANS_HTOTAL_B, dev_priv->regfile.saveTRANS_HTOTAL_B); |
568 | I915_WRITE(_TRANS_HBLANK_B, dev_priv->saveTRANS_HBLANK_B); | 574 | I915_WRITE(_TRANS_HBLANK_B, dev_priv->regfile.saveTRANS_HBLANK_B); |
569 | I915_WRITE(_TRANS_HSYNC_B, dev_priv->saveTRANS_HSYNC_B); | 575 | I915_WRITE(_TRANS_HSYNC_B, dev_priv->regfile.saveTRANS_HSYNC_B); |
570 | I915_WRITE(_TRANS_VTOTAL_B, dev_priv->saveTRANS_VTOTAL_B); | 576 | I915_WRITE(_TRANS_VTOTAL_B, dev_priv->regfile.saveTRANS_VTOTAL_B); |
571 | I915_WRITE(_TRANS_VBLANK_B, dev_priv->saveTRANS_VBLANK_B); | 577 | I915_WRITE(_TRANS_VBLANK_B, dev_priv->regfile.saveTRANS_VBLANK_B); |
572 | I915_WRITE(_TRANS_VSYNC_B, dev_priv->saveTRANS_VSYNC_B); | 578 | I915_WRITE(_TRANS_VSYNC_B, dev_priv->regfile.saveTRANS_VSYNC_B); |
573 | } | 579 | } |
574 | 580 | ||
575 | /* Restore plane info */ | 581 | /* Restore plane info */ |
576 | I915_WRITE(_DSPBSIZE, dev_priv->saveDSPBSIZE); | 582 | I915_WRITE(_DSPBSIZE, dev_priv->regfile.saveDSPBSIZE); |
577 | I915_WRITE(_DSPBPOS, dev_priv->saveDSPBPOS); | 583 | I915_WRITE(_DSPBPOS, dev_priv->regfile.saveDSPBPOS); |
578 | I915_WRITE(_PIPEBSRC, dev_priv->savePIPEBSRC); | 584 | I915_WRITE(_PIPEBSRC, dev_priv->regfile.savePIPEBSRC); |
579 | I915_WRITE(_DSPBADDR, dev_priv->saveDSPBADDR); | 585 | I915_WRITE(_DSPBADDR, dev_priv->regfile.saveDSPBADDR); |
580 | I915_WRITE(_DSPBSTRIDE, dev_priv->saveDSPBSTRIDE); | 586 | I915_WRITE(_DSPBSTRIDE, dev_priv->regfile.saveDSPBSTRIDE); |
581 | if (INTEL_INFO(dev)->gen >= 4) { | 587 | if (INTEL_INFO(dev)->gen >= 4) { |
582 | I915_WRITE(_DSPBSURF, dev_priv->saveDSPBSURF); | 588 | I915_WRITE(_DSPBSURF, dev_priv->regfile.saveDSPBSURF); |
583 | I915_WRITE(_DSPBTILEOFF, dev_priv->saveDSPBTILEOFF); | 589 | I915_WRITE(_DSPBTILEOFF, dev_priv->regfile.saveDSPBTILEOFF); |
584 | } | 590 | } |
585 | 591 | ||
586 | I915_WRITE(_PIPEBCONF, dev_priv->savePIPEBCONF); | 592 | I915_WRITE(_PIPEBCONF, dev_priv->regfile.savePIPEBCONF); |
587 | 593 | ||
588 | i915_restore_palette(dev, PIPE_B); | 594 | i915_restore_palette(dev, PIPE_B); |
589 | /* Enable the plane */ | 595 | /* Enable the plane */ |
590 | I915_WRITE(_DSPBCNTR, dev_priv->saveDSPBCNTR); | 596 | I915_WRITE(_DSPBCNTR, dev_priv->regfile.saveDSPBCNTR); |
591 | I915_WRITE(_DSPBADDR, I915_READ(_DSPBADDR)); | 597 | I915_WRITE(_DSPBADDR, I915_READ(_DSPBADDR)); |
592 | 598 | ||
593 | /* Cursor state */ | 599 | /* Cursor state */ |
594 | I915_WRITE(_CURAPOS, dev_priv->saveCURAPOS); | 600 | I915_WRITE(_CURAPOS, dev_priv->regfile.saveCURAPOS); |
595 | I915_WRITE(_CURACNTR, dev_priv->saveCURACNTR); | 601 | I915_WRITE(_CURACNTR, dev_priv->regfile.saveCURACNTR); |
596 | I915_WRITE(_CURABASE, dev_priv->saveCURABASE); | 602 | I915_WRITE(_CURABASE, dev_priv->regfile.saveCURABASE); |
597 | I915_WRITE(_CURBPOS, dev_priv->saveCURBPOS); | 603 | I915_WRITE(_CURBPOS, dev_priv->regfile.saveCURBPOS); |
598 | I915_WRITE(_CURBCNTR, dev_priv->saveCURBCNTR); | 604 | I915_WRITE(_CURBCNTR, dev_priv->regfile.saveCURBCNTR); |
599 | I915_WRITE(_CURBBASE, dev_priv->saveCURBBASE); | 605 | I915_WRITE(_CURBBASE, dev_priv->regfile.saveCURBBASE); |
600 | if (IS_GEN2(dev)) | 606 | if (IS_GEN2(dev)) |
601 | I915_WRITE(CURSIZE, dev_priv->saveCURSIZE); | 607 | I915_WRITE(CURSIZE, dev_priv->regfile.saveCURSIZE); |
608 | |||
609 | /* CRT state */ | ||
610 | if (HAS_PCH_SPLIT(dev)) | ||
611 | I915_WRITE(PCH_ADPA, dev_priv->regfile.saveADPA); | ||
612 | else | ||
613 | I915_WRITE(ADPA, dev_priv->regfile.saveADPA); | ||
602 | 614 | ||
603 | return; | 615 | return; |
604 | } | 616 | } |
@@ -608,89 +620,84 @@ static void i915_save_display(struct drm_device *dev) | |||
608 | struct drm_i915_private *dev_priv = dev->dev_private; | 620 | struct drm_i915_private *dev_priv = dev->dev_private; |
609 | 621 | ||
610 | /* Display arbitration control */ | 622 | /* Display arbitration control */ |
611 | dev_priv->saveDSPARB = I915_READ(DSPARB); | 623 | dev_priv->regfile.saveDSPARB = I915_READ(DSPARB); |
612 | 624 | ||
613 | /* This is only meaningful in non-KMS mode */ | 625 | /* This is only meaningful in non-KMS mode */ |
614 | /* Don't save them in KMS mode */ | 626 | /* Don't regfile.save them in KMS mode */ |
615 | i915_save_modeset_reg(dev); | 627 | i915_save_modeset_reg(dev); |
616 | 628 | ||
617 | /* CRT state */ | ||
618 | if (HAS_PCH_SPLIT(dev)) { | ||
619 | dev_priv->saveADPA = I915_READ(PCH_ADPA); | ||
620 | } else { | ||
621 | dev_priv->saveADPA = I915_READ(ADPA); | ||
622 | } | ||
623 | |||
624 | /* LVDS state */ | 629 | /* LVDS state */ |
625 | if (HAS_PCH_SPLIT(dev)) { | 630 | if (HAS_PCH_SPLIT(dev)) { |
626 | dev_priv->savePP_CONTROL = I915_READ(PCH_PP_CONTROL); | 631 | dev_priv->regfile.savePP_CONTROL = I915_READ(PCH_PP_CONTROL); |
627 | dev_priv->saveBLC_PWM_CTL = I915_READ(BLC_PWM_PCH_CTL1); | 632 | dev_priv->regfile.saveBLC_PWM_CTL = I915_READ(BLC_PWM_PCH_CTL1); |
628 | dev_priv->saveBLC_PWM_CTL2 = I915_READ(BLC_PWM_PCH_CTL2); | 633 | dev_priv->regfile.saveBLC_PWM_CTL2 = I915_READ(BLC_PWM_PCH_CTL2); |
629 | dev_priv->saveBLC_CPU_PWM_CTL = I915_READ(BLC_PWM_CPU_CTL); | 634 | dev_priv->regfile.saveBLC_CPU_PWM_CTL = I915_READ(BLC_PWM_CPU_CTL); |
630 | dev_priv->saveBLC_CPU_PWM_CTL2 = I915_READ(BLC_PWM_CPU_CTL2); | 635 | dev_priv->regfile.saveBLC_CPU_PWM_CTL2 = I915_READ(BLC_PWM_CPU_CTL2); |
631 | dev_priv->saveLVDS = I915_READ(PCH_LVDS); | 636 | dev_priv->regfile.saveLVDS = I915_READ(PCH_LVDS); |
632 | } else { | 637 | } else { |
633 | dev_priv->savePP_CONTROL = I915_READ(PP_CONTROL); | 638 | dev_priv->regfile.savePP_CONTROL = I915_READ(PP_CONTROL); |
634 | dev_priv->savePFIT_PGM_RATIOS = I915_READ(PFIT_PGM_RATIOS); | 639 | dev_priv->regfile.savePFIT_PGM_RATIOS = I915_READ(PFIT_PGM_RATIOS); |
635 | dev_priv->saveBLC_PWM_CTL = I915_READ(BLC_PWM_CTL); | 640 | dev_priv->regfile.saveBLC_PWM_CTL = I915_READ(BLC_PWM_CTL); |
636 | dev_priv->saveBLC_HIST_CTL = I915_READ(BLC_HIST_CTL); | 641 | dev_priv->regfile.saveBLC_HIST_CTL = I915_READ(BLC_HIST_CTL); |
637 | if (INTEL_INFO(dev)->gen >= 4) | 642 | if (INTEL_INFO(dev)->gen >= 4) |
638 | dev_priv->saveBLC_PWM_CTL2 = I915_READ(BLC_PWM_CTL2); | 643 | dev_priv->regfile.saveBLC_PWM_CTL2 = I915_READ(BLC_PWM_CTL2); |
639 | if (IS_MOBILE(dev) && !IS_I830(dev)) | 644 | if (IS_MOBILE(dev) && !IS_I830(dev)) |
640 | dev_priv->saveLVDS = I915_READ(LVDS); | 645 | dev_priv->regfile.saveLVDS = I915_READ(LVDS); |
641 | } | 646 | } |
642 | 647 | ||
643 | if (!IS_I830(dev) && !IS_845G(dev) && !HAS_PCH_SPLIT(dev)) | 648 | if (!IS_I830(dev) && !IS_845G(dev) && !HAS_PCH_SPLIT(dev)) |
644 | dev_priv->savePFIT_CONTROL = I915_READ(PFIT_CONTROL); | 649 | dev_priv->regfile.savePFIT_CONTROL = I915_READ(PFIT_CONTROL); |
645 | 650 | ||
646 | if (HAS_PCH_SPLIT(dev)) { | 651 | if (HAS_PCH_SPLIT(dev)) { |
647 | dev_priv->savePP_ON_DELAYS = I915_READ(PCH_PP_ON_DELAYS); | 652 | dev_priv->regfile.savePP_ON_DELAYS = I915_READ(PCH_PP_ON_DELAYS); |
648 | dev_priv->savePP_OFF_DELAYS = I915_READ(PCH_PP_OFF_DELAYS); | 653 | dev_priv->regfile.savePP_OFF_DELAYS = I915_READ(PCH_PP_OFF_DELAYS); |
649 | dev_priv->savePP_DIVISOR = I915_READ(PCH_PP_DIVISOR); | 654 | dev_priv->regfile.savePP_DIVISOR = I915_READ(PCH_PP_DIVISOR); |
650 | } else { | 655 | } else { |
651 | dev_priv->savePP_ON_DELAYS = I915_READ(PP_ON_DELAYS); | 656 | dev_priv->regfile.savePP_ON_DELAYS = I915_READ(PP_ON_DELAYS); |
652 | dev_priv->savePP_OFF_DELAYS = I915_READ(PP_OFF_DELAYS); | 657 | dev_priv->regfile.savePP_OFF_DELAYS = I915_READ(PP_OFF_DELAYS); |
653 | dev_priv->savePP_DIVISOR = I915_READ(PP_DIVISOR); | 658 | dev_priv->regfile.savePP_DIVISOR = I915_READ(PP_DIVISOR); |
654 | } | 659 | } |
655 | 660 | ||
656 | /* Display Port state */ | 661 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) { |
657 | if (SUPPORTS_INTEGRATED_DP(dev)) { | 662 | /* Display Port state */ |
658 | dev_priv->saveDP_B = I915_READ(DP_B); | 663 | if (SUPPORTS_INTEGRATED_DP(dev)) { |
659 | dev_priv->saveDP_C = I915_READ(DP_C); | 664 | dev_priv->regfile.saveDP_B = I915_READ(DP_B); |
660 | dev_priv->saveDP_D = I915_READ(DP_D); | 665 | dev_priv->regfile.saveDP_C = I915_READ(DP_C); |
661 | dev_priv->savePIPEA_GMCH_DATA_M = I915_READ(_PIPEA_GMCH_DATA_M); | 666 | dev_priv->regfile.saveDP_D = I915_READ(DP_D); |
662 | dev_priv->savePIPEB_GMCH_DATA_M = I915_READ(_PIPEB_GMCH_DATA_M); | 667 | dev_priv->regfile.savePIPEA_GMCH_DATA_M = I915_READ(_PIPEA_GMCH_DATA_M); |
663 | dev_priv->savePIPEA_GMCH_DATA_N = I915_READ(_PIPEA_GMCH_DATA_N); | 668 | dev_priv->regfile.savePIPEB_GMCH_DATA_M = I915_READ(_PIPEB_GMCH_DATA_M); |
664 | dev_priv->savePIPEB_GMCH_DATA_N = I915_READ(_PIPEB_GMCH_DATA_N); | 669 | dev_priv->regfile.savePIPEA_GMCH_DATA_N = I915_READ(_PIPEA_GMCH_DATA_N); |
665 | dev_priv->savePIPEA_DP_LINK_M = I915_READ(_PIPEA_DP_LINK_M); | 670 | dev_priv->regfile.savePIPEB_GMCH_DATA_N = I915_READ(_PIPEB_GMCH_DATA_N); |
666 | dev_priv->savePIPEB_DP_LINK_M = I915_READ(_PIPEB_DP_LINK_M); | 671 | dev_priv->regfile.savePIPEA_DP_LINK_M = I915_READ(_PIPEA_DP_LINK_M); |
667 | dev_priv->savePIPEA_DP_LINK_N = I915_READ(_PIPEA_DP_LINK_N); | 672 | dev_priv->regfile.savePIPEB_DP_LINK_M = I915_READ(_PIPEB_DP_LINK_M); |
668 | dev_priv->savePIPEB_DP_LINK_N = I915_READ(_PIPEB_DP_LINK_N); | 673 | dev_priv->regfile.savePIPEA_DP_LINK_N = I915_READ(_PIPEA_DP_LINK_N); |
669 | } | 674 | dev_priv->regfile.savePIPEB_DP_LINK_N = I915_READ(_PIPEB_DP_LINK_N); |
670 | /* FIXME: save TV & SDVO state */ | 675 | } |
671 | 676 | /* FIXME: regfile.save TV & SDVO state */ | |
672 | /* Only save FBC state on the platform that supports FBC */ | 677 | } |
678 | |||
679 | /* Only regfile.save FBC state on the platform that supports FBC */ | ||
673 | if (I915_HAS_FBC(dev)) { | 680 | if (I915_HAS_FBC(dev)) { |
674 | if (HAS_PCH_SPLIT(dev)) { | 681 | if (HAS_PCH_SPLIT(dev)) { |
675 | dev_priv->saveDPFC_CB_BASE = I915_READ(ILK_DPFC_CB_BASE); | 682 | dev_priv->regfile.saveDPFC_CB_BASE = I915_READ(ILK_DPFC_CB_BASE); |
676 | } else if (IS_GM45(dev)) { | 683 | } else if (IS_GM45(dev)) { |
677 | dev_priv->saveDPFC_CB_BASE = I915_READ(DPFC_CB_BASE); | 684 | dev_priv->regfile.saveDPFC_CB_BASE = I915_READ(DPFC_CB_BASE); |
678 | } else { | 685 | } else { |
679 | dev_priv->saveFBC_CFB_BASE = I915_READ(FBC_CFB_BASE); | 686 | dev_priv->regfile.saveFBC_CFB_BASE = I915_READ(FBC_CFB_BASE); |
680 | dev_priv->saveFBC_LL_BASE = I915_READ(FBC_LL_BASE); | 687 | dev_priv->regfile.saveFBC_LL_BASE = I915_READ(FBC_LL_BASE); |
681 | dev_priv->saveFBC_CONTROL2 = I915_READ(FBC_CONTROL2); | 688 | dev_priv->regfile.saveFBC_CONTROL2 = I915_READ(FBC_CONTROL2); |
682 | dev_priv->saveFBC_CONTROL = I915_READ(FBC_CONTROL); | 689 | dev_priv->regfile.saveFBC_CONTROL = I915_READ(FBC_CONTROL); |
683 | } | 690 | } |
684 | } | 691 | } |
685 | 692 | ||
686 | /* VGA state */ | 693 | /* VGA state */ |
687 | dev_priv->saveVGA0 = I915_READ(VGA0); | 694 | dev_priv->regfile.saveVGA0 = I915_READ(VGA0); |
688 | dev_priv->saveVGA1 = I915_READ(VGA1); | 695 | dev_priv->regfile.saveVGA1 = I915_READ(VGA1); |
689 | dev_priv->saveVGA_PD = I915_READ(VGA_PD); | 696 | dev_priv->regfile.saveVGA_PD = I915_READ(VGA_PD); |
690 | if (HAS_PCH_SPLIT(dev)) | 697 | if (HAS_PCH_SPLIT(dev)) |
691 | dev_priv->saveVGACNTRL = I915_READ(CPU_VGACNTRL); | 698 | dev_priv->regfile.saveVGACNTRL = I915_READ(CPU_VGACNTRL); |
692 | else | 699 | else |
693 | dev_priv->saveVGACNTRL = I915_READ(VGACNTRL); | 700 | dev_priv->regfile.saveVGACNTRL = I915_READ(VGACNTRL); |
694 | 701 | ||
695 | i915_save_vga(dev); | 702 | i915_save_vga(dev); |
696 | } | 703 | } |
@@ -700,97 +707,95 @@ static void i915_restore_display(struct drm_device *dev) | |||
700 | struct drm_i915_private *dev_priv = dev->dev_private; | 707 | struct drm_i915_private *dev_priv = dev->dev_private; |
701 | 708 | ||
702 | /* Display arbitration */ | 709 | /* Display arbitration */ |
703 | I915_WRITE(DSPARB, dev_priv->saveDSPARB); | 710 | I915_WRITE(DSPARB, dev_priv->regfile.saveDSPARB); |
704 | 711 | ||
705 | /* Display port ratios (must be done before clock is set) */ | 712 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) { |
706 | if (SUPPORTS_INTEGRATED_DP(dev)) { | 713 | /* Display port ratios (must be done before clock is set) */ |
707 | I915_WRITE(_PIPEA_GMCH_DATA_M, dev_priv->savePIPEA_GMCH_DATA_M); | 714 | if (SUPPORTS_INTEGRATED_DP(dev)) { |
708 | I915_WRITE(_PIPEB_GMCH_DATA_M, dev_priv->savePIPEB_GMCH_DATA_M); | 715 | I915_WRITE(_PIPEA_GMCH_DATA_M, dev_priv->regfile.savePIPEA_GMCH_DATA_M); |
709 | I915_WRITE(_PIPEA_GMCH_DATA_N, dev_priv->savePIPEA_GMCH_DATA_N); | 716 | I915_WRITE(_PIPEB_GMCH_DATA_M, dev_priv->regfile.savePIPEB_GMCH_DATA_M); |
710 | I915_WRITE(_PIPEB_GMCH_DATA_N, dev_priv->savePIPEB_GMCH_DATA_N); | 717 | I915_WRITE(_PIPEA_GMCH_DATA_N, dev_priv->regfile.savePIPEA_GMCH_DATA_N); |
711 | I915_WRITE(_PIPEA_DP_LINK_M, dev_priv->savePIPEA_DP_LINK_M); | 718 | I915_WRITE(_PIPEB_GMCH_DATA_N, dev_priv->regfile.savePIPEB_GMCH_DATA_N); |
712 | I915_WRITE(_PIPEB_DP_LINK_M, dev_priv->savePIPEB_DP_LINK_M); | 719 | I915_WRITE(_PIPEA_DP_LINK_M, dev_priv->regfile.savePIPEA_DP_LINK_M); |
713 | I915_WRITE(_PIPEA_DP_LINK_N, dev_priv->savePIPEA_DP_LINK_N); | 720 | I915_WRITE(_PIPEB_DP_LINK_M, dev_priv->regfile.savePIPEB_DP_LINK_M); |
714 | I915_WRITE(_PIPEB_DP_LINK_N, dev_priv->savePIPEB_DP_LINK_N); | 721 | I915_WRITE(_PIPEA_DP_LINK_N, dev_priv->regfile.savePIPEA_DP_LINK_N); |
722 | I915_WRITE(_PIPEB_DP_LINK_N, dev_priv->regfile.savePIPEB_DP_LINK_N); | ||
723 | } | ||
715 | } | 724 | } |
716 | 725 | ||
717 | /* This is only meaningful in non-KMS mode */ | 726 | /* This is only meaningful in non-KMS mode */ |
718 | /* Don't restore them in KMS mode */ | 727 | /* Don't restore them in KMS mode */ |
719 | i915_restore_modeset_reg(dev); | 728 | i915_restore_modeset_reg(dev); |
720 | 729 | ||
721 | /* CRT state */ | ||
722 | if (HAS_PCH_SPLIT(dev)) | ||
723 | I915_WRITE(PCH_ADPA, dev_priv->saveADPA); | ||
724 | else | ||
725 | I915_WRITE(ADPA, dev_priv->saveADPA); | ||
726 | |||
727 | /* LVDS state */ | 730 | /* LVDS state */ |
728 | if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev)) | 731 | if (INTEL_INFO(dev)->gen >= 4 && !HAS_PCH_SPLIT(dev)) |
729 | I915_WRITE(BLC_PWM_CTL2, dev_priv->saveBLC_PWM_CTL2); | 732 | I915_WRITE(BLC_PWM_CTL2, dev_priv->regfile.saveBLC_PWM_CTL2); |
730 | 733 | ||
731 | if (HAS_PCH_SPLIT(dev)) { | 734 | if (HAS_PCH_SPLIT(dev)) { |
732 | I915_WRITE(PCH_LVDS, dev_priv->saveLVDS); | 735 | I915_WRITE(PCH_LVDS, dev_priv->regfile.saveLVDS); |
733 | } else if (IS_MOBILE(dev) && !IS_I830(dev)) | 736 | } else if (IS_MOBILE(dev) && !IS_I830(dev)) |
734 | I915_WRITE(LVDS, dev_priv->saveLVDS); | 737 | I915_WRITE(LVDS, dev_priv->regfile.saveLVDS); |
735 | 738 | ||
736 | if (!IS_I830(dev) && !IS_845G(dev) && !HAS_PCH_SPLIT(dev)) | 739 | if (!IS_I830(dev) && !IS_845G(dev) && !HAS_PCH_SPLIT(dev)) |
737 | I915_WRITE(PFIT_CONTROL, dev_priv->savePFIT_CONTROL); | 740 | I915_WRITE(PFIT_CONTROL, dev_priv->regfile.savePFIT_CONTROL); |
738 | 741 | ||
739 | if (HAS_PCH_SPLIT(dev)) { | 742 | if (HAS_PCH_SPLIT(dev)) { |
740 | I915_WRITE(BLC_PWM_PCH_CTL1, dev_priv->saveBLC_PWM_CTL); | 743 | I915_WRITE(BLC_PWM_PCH_CTL1, dev_priv->regfile.saveBLC_PWM_CTL); |
741 | I915_WRITE(BLC_PWM_PCH_CTL2, dev_priv->saveBLC_PWM_CTL2); | 744 | I915_WRITE(BLC_PWM_PCH_CTL2, dev_priv->regfile.saveBLC_PWM_CTL2); |
742 | /* NOTE: BLC_PWM_CPU_CTL must be written after BLC_PWM_CPU_CTL2; | 745 | /* NOTE: BLC_PWM_CPU_CTL must be written after BLC_PWM_CPU_CTL2; |
743 | * otherwise we get blank eDP screen after S3 on some machines | 746 | * otherwise we get blank eDP screen after S3 on some machines |
744 | */ | 747 | */ |
745 | I915_WRITE(BLC_PWM_CPU_CTL2, dev_priv->saveBLC_CPU_PWM_CTL2); | 748 | I915_WRITE(BLC_PWM_CPU_CTL2, dev_priv->regfile.saveBLC_CPU_PWM_CTL2); |
746 | I915_WRITE(BLC_PWM_CPU_CTL, dev_priv->saveBLC_CPU_PWM_CTL); | 749 | I915_WRITE(BLC_PWM_CPU_CTL, dev_priv->regfile.saveBLC_CPU_PWM_CTL); |
747 | I915_WRITE(PCH_PP_ON_DELAYS, dev_priv->savePP_ON_DELAYS); | 750 | I915_WRITE(PCH_PP_ON_DELAYS, dev_priv->regfile.savePP_ON_DELAYS); |
748 | I915_WRITE(PCH_PP_OFF_DELAYS, dev_priv->savePP_OFF_DELAYS); | 751 | I915_WRITE(PCH_PP_OFF_DELAYS, dev_priv->regfile.savePP_OFF_DELAYS); |
749 | I915_WRITE(PCH_PP_DIVISOR, dev_priv->savePP_DIVISOR); | 752 | I915_WRITE(PCH_PP_DIVISOR, dev_priv->regfile.savePP_DIVISOR); |
750 | I915_WRITE(PCH_PP_CONTROL, dev_priv->savePP_CONTROL); | 753 | I915_WRITE(PCH_PP_CONTROL, dev_priv->regfile.savePP_CONTROL); |
751 | I915_WRITE(RSTDBYCTL, | 754 | I915_WRITE(RSTDBYCTL, |
752 | dev_priv->saveMCHBAR_RENDER_STANDBY); | 755 | dev_priv->regfile.saveMCHBAR_RENDER_STANDBY); |
753 | } else { | 756 | } else { |
754 | I915_WRITE(PFIT_PGM_RATIOS, dev_priv->savePFIT_PGM_RATIOS); | 757 | I915_WRITE(PFIT_PGM_RATIOS, dev_priv->regfile.savePFIT_PGM_RATIOS); |
755 | I915_WRITE(BLC_PWM_CTL, dev_priv->saveBLC_PWM_CTL); | 758 | I915_WRITE(BLC_PWM_CTL, dev_priv->regfile.saveBLC_PWM_CTL); |
756 | I915_WRITE(BLC_HIST_CTL, dev_priv->saveBLC_HIST_CTL); | 759 | I915_WRITE(BLC_HIST_CTL, dev_priv->regfile.saveBLC_HIST_CTL); |
757 | I915_WRITE(PP_ON_DELAYS, dev_priv->savePP_ON_DELAYS); | 760 | I915_WRITE(PP_ON_DELAYS, dev_priv->regfile.savePP_ON_DELAYS); |
758 | I915_WRITE(PP_OFF_DELAYS, dev_priv->savePP_OFF_DELAYS); | 761 | I915_WRITE(PP_OFF_DELAYS, dev_priv->regfile.savePP_OFF_DELAYS); |
759 | I915_WRITE(PP_DIVISOR, dev_priv->savePP_DIVISOR); | 762 | I915_WRITE(PP_DIVISOR, dev_priv->regfile.savePP_DIVISOR); |
760 | I915_WRITE(PP_CONTROL, dev_priv->savePP_CONTROL); | 763 | I915_WRITE(PP_CONTROL, dev_priv->regfile.savePP_CONTROL); |
761 | } | 764 | } |
762 | 765 | ||
763 | /* Display Port state */ | 766 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) { |
764 | if (SUPPORTS_INTEGRATED_DP(dev)) { | 767 | /* Display Port state */ |
765 | I915_WRITE(DP_B, dev_priv->saveDP_B); | 768 | if (SUPPORTS_INTEGRATED_DP(dev)) { |
766 | I915_WRITE(DP_C, dev_priv->saveDP_C); | 769 | I915_WRITE(DP_B, dev_priv->regfile.saveDP_B); |
767 | I915_WRITE(DP_D, dev_priv->saveDP_D); | 770 | I915_WRITE(DP_C, dev_priv->regfile.saveDP_C); |
771 | I915_WRITE(DP_D, dev_priv->regfile.saveDP_D); | ||
772 | } | ||
773 | /* FIXME: restore TV & SDVO state */ | ||
768 | } | 774 | } |
769 | /* FIXME: restore TV & SDVO state */ | ||
770 | 775 | ||
771 | /* only restore FBC info on the platform that supports FBC*/ | 776 | /* only restore FBC info on the platform that supports FBC*/ |
772 | intel_disable_fbc(dev); | 777 | intel_disable_fbc(dev); |
773 | if (I915_HAS_FBC(dev)) { | 778 | if (I915_HAS_FBC(dev)) { |
774 | if (HAS_PCH_SPLIT(dev)) { | 779 | if (HAS_PCH_SPLIT(dev)) { |
775 | I915_WRITE(ILK_DPFC_CB_BASE, dev_priv->saveDPFC_CB_BASE); | 780 | I915_WRITE(ILK_DPFC_CB_BASE, dev_priv->regfile.saveDPFC_CB_BASE); |
776 | } else if (IS_GM45(dev)) { | 781 | } else if (IS_GM45(dev)) { |
777 | I915_WRITE(DPFC_CB_BASE, dev_priv->saveDPFC_CB_BASE); | 782 | I915_WRITE(DPFC_CB_BASE, dev_priv->regfile.saveDPFC_CB_BASE); |
778 | } else { | 783 | } else { |
779 | I915_WRITE(FBC_CFB_BASE, dev_priv->saveFBC_CFB_BASE); | 784 | I915_WRITE(FBC_CFB_BASE, dev_priv->regfile.saveFBC_CFB_BASE); |
780 | I915_WRITE(FBC_LL_BASE, dev_priv->saveFBC_LL_BASE); | 785 | I915_WRITE(FBC_LL_BASE, dev_priv->regfile.saveFBC_LL_BASE); |
781 | I915_WRITE(FBC_CONTROL2, dev_priv->saveFBC_CONTROL2); | 786 | I915_WRITE(FBC_CONTROL2, dev_priv->regfile.saveFBC_CONTROL2); |
782 | I915_WRITE(FBC_CONTROL, dev_priv->saveFBC_CONTROL); | 787 | I915_WRITE(FBC_CONTROL, dev_priv->regfile.saveFBC_CONTROL); |
783 | } | 788 | } |
784 | } | 789 | } |
785 | /* VGA state */ | 790 | /* VGA state */ |
786 | if (HAS_PCH_SPLIT(dev)) | 791 | if (HAS_PCH_SPLIT(dev)) |
787 | I915_WRITE(CPU_VGACNTRL, dev_priv->saveVGACNTRL); | 792 | I915_WRITE(CPU_VGACNTRL, dev_priv->regfile.saveVGACNTRL); |
788 | else | 793 | else |
789 | I915_WRITE(VGACNTRL, dev_priv->saveVGACNTRL); | 794 | I915_WRITE(VGACNTRL, dev_priv->regfile.saveVGACNTRL); |
790 | 795 | ||
791 | I915_WRITE(VGA0, dev_priv->saveVGA0); | 796 | I915_WRITE(VGA0, dev_priv->regfile.saveVGA0); |
792 | I915_WRITE(VGA1, dev_priv->saveVGA1); | 797 | I915_WRITE(VGA1, dev_priv->regfile.saveVGA1); |
793 | I915_WRITE(VGA_PD, dev_priv->saveVGA_PD); | 798 | I915_WRITE(VGA_PD, dev_priv->regfile.saveVGA_PD); |
794 | POSTING_READ(VGA_PD); | 799 | POSTING_READ(VGA_PD); |
795 | udelay(150); | 800 | udelay(150); |
796 | 801 | ||
@@ -802,46 +807,45 @@ int i915_save_state(struct drm_device *dev) | |||
802 | struct drm_i915_private *dev_priv = dev->dev_private; | 807 | struct drm_i915_private *dev_priv = dev->dev_private; |
803 | int i; | 808 | int i; |
804 | 809 | ||
805 | pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB); | 810 | pci_read_config_byte(dev->pdev, LBB, &dev_priv->regfile.saveLBB); |
806 | 811 | ||
807 | mutex_lock(&dev->struct_mutex); | 812 | mutex_lock(&dev->struct_mutex); |
808 | 813 | ||
809 | /* Hardware status page */ | ||
810 | dev_priv->saveHWS = I915_READ(HWS_PGA); | ||
811 | |||
812 | i915_save_display(dev); | 814 | i915_save_display(dev); |
813 | 815 | ||
814 | /* Interrupt state */ | 816 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) { |
815 | if (HAS_PCH_SPLIT(dev)) { | 817 | /* Interrupt state */ |
816 | dev_priv->saveDEIER = I915_READ(DEIER); | 818 | if (HAS_PCH_SPLIT(dev)) { |
817 | dev_priv->saveDEIMR = I915_READ(DEIMR); | 819 | dev_priv->regfile.saveDEIER = I915_READ(DEIER); |
818 | dev_priv->saveGTIER = I915_READ(GTIER); | 820 | dev_priv->regfile.saveDEIMR = I915_READ(DEIMR); |
819 | dev_priv->saveGTIMR = I915_READ(GTIMR); | 821 | dev_priv->regfile.saveGTIER = I915_READ(GTIER); |
820 | dev_priv->saveFDI_RXA_IMR = I915_READ(_FDI_RXA_IMR); | 822 | dev_priv->regfile.saveGTIMR = I915_READ(GTIMR); |
821 | dev_priv->saveFDI_RXB_IMR = I915_READ(_FDI_RXB_IMR); | 823 | dev_priv->regfile.saveFDI_RXA_IMR = I915_READ(_FDI_RXA_IMR); |
822 | dev_priv->saveMCHBAR_RENDER_STANDBY = | 824 | dev_priv->regfile.saveFDI_RXB_IMR = I915_READ(_FDI_RXB_IMR); |
823 | I915_READ(RSTDBYCTL); | 825 | dev_priv->regfile.saveMCHBAR_RENDER_STANDBY = |
824 | dev_priv->savePCH_PORT_HOTPLUG = I915_READ(PCH_PORT_HOTPLUG); | 826 | I915_READ(RSTDBYCTL); |
825 | } else { | 827 | dev_priv->regfile.savePCH_PORT_HOTPLUG = I915_READ(PCH_PORT_HOTPLUG); |
826 | dev_priv->saveIER = I915_READ(IER); | 828 | } else { |
827 | dev_priv->saveIMR = I915_READ(IMR); | 829 | dev_priv->regfile.saveIER = I915_READ(IER); |
830 | dev_priv->regfile.saveIMR = I915_READ(IMR); | ||
831 | } | ||
828 | } | 832 | } |
829 | 833 | ||
830 | intel_disable_gt_powersave(dev); | 834 | intel_disable_gt_powersave(dev); |
831 | 835 | ||
832 | /* Cache mode state */ | 836 | /* Cache mode state */ |
833 | dev_priv->saveCACHE_MODE_0 = I915_READ(CACHE_MODE_0); | 837 | dev_priv->regfile.saveCACHE_MODE_0 = I915_READ(CACHE_MODE_0); |
834 | 838 | ||
835 | /* Memory Arbitration state */ | 839 | /* Memory Arbitration state */ |
836 | dev_priv->saveMI_ARB_STATE = I915_READ(MI_ARB_STATE); | 840 | dev_priv->regfile.saveMI_ARB_STATE = I915_READ(MI_ARB_STATE); |
837 | 841 | ||
838 | /* Scratch space */ | 842 | /* Scratch space */ |
839 | for (i = 0; i < 16; i++) { | 843 | for (i = 0; i < 16; i++) { |
840 | dev_priv->saveSWF0[i] = I915_READ(SWF00 + (i << 2)); | 844 | dev_priv->regfile.saveSWF0[i] = I915_READ(SWF00 + (i << 2)); |
841 | dev_priv->saveSWF1[i] = I915_READ(SWF10 + (i << 2)); | 845 | dev_priv->regfile.saveSWF1[i] = I915_READ(SWF10 + (i << 2)); |
842 | } | 846 | } |
843 | for (i = 0; i < 3; i++) | 847 | for (i = 0; i < 3; i++) |
844 | dev_priv->saveSWF2[i] = I915_READ(SWF30 + (i << 2)); | 848 | dev_priv->regfile.saveSWF2[i] = I915_READ(SWF30 + (i << 2)); |
845 | 849 | ||
846 | mutex_unlock(&dev->struct_mutex); | 850 | mutex_unlock(&dev->struct_mutex); |
847 | 851 | ||
@@ -853,41 +857,40 @@ int i915_restore_state(struct drm_device *dev) | |||
853 | struct drm_i915_private *dev_priv = dev->dev_private; | 857 | struct drm_i915_private *dev_priv = dev->dev_private; |
854 | int i; | 858 | int i; |
855 | 859 | ||
856 | pci_write_config_byte(dev->pdev, LBB, dev_priv->saveLBB); | 860 | pci_write_config_byte(dev->pdev, LBB, dev_priv->regfile.saveLBB); |
857 | 861 | ||
858 | mutex_lock(&dev->struct_mutex); | 862 | mutex_lock(&dev->struct_mutex); |
859 | 863 | ||
860 | /* Hardware status page */ | ||
861 | I915_WRITE(HWS_PGA, dev_priv->saveHWS); | ||
862 | |||
863 | i915_restore_display(dev); | 864 | i915_restore_display(dev); |
864 | 865 | ||
865 | /* Interrupt state */ | 866 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) { |
866 | if (HAS_PCH_SPLIT(dev)) { | 867 | /* Interrupt state */ |
867 | I915_WRITE(DEIER, dev_priv->saveDEIER); | 868 | if (HAS_PCH_SPLIT(dev)) { |
868 | I915_WRITE(DEIMR, dev_priv->saveDEIMR); | 869 | I915_WRITE(DEIER, dev_priv->regfile.saveDEIER); |
869 | I915_WRITE(GTIER, dev_priv->saveGTIER); | 870 | I915_WRITE(DEIMR, dev_priv->regfile.saveDEIMR); |
870 | I915_WRITE(GTIMR, dev_priv->saveGTIMR); | 871 | I915_WRITE(GTIER, dev_priv->regfile.saveGTIER); |
871 | I915_WRITE(_FDI_RXA_IMR, dev_priv->saveFDI_RXA_IMR); | 872 | I915_WRITE(GTIMR, dev_priv->regfile.saveGTIMR); |
872 | I915_WRITE(_FDI_RXB_IMR, dev_priv->saveFDI_RXB_IMR); | 873 | I915_WRITE(_FDI_RXA_IMR, dev_priv->regfile.saveFDI_RXA_IMR); |
873 | I915_WRITE(PCH_PORT_HOTPLUG, dev_priv->savePCH_PORT_HOTPLUG); | 874 | I915_WRITE(_FDI_RXB_IMR, dev_priv->regfile.saveFDI_RXB_IMR); |
874 | } else { | 875 | I915_WRITE(PCH_PORT_HOTPLUG, dev_priv->regfile.savePCH_PORT_HOTPLUG); |
875 | I915_WRITE(IER, dev_priv->saveIER); | 876 | } else { |
876 | I915_WRITE(IMR, dev_priv->saveIMR); | 877 | I915_WRITE(IER, dev_priv->regfile.saveIER); |
878 | I915_WRITE(IMR, dev_priv->regfile.saveIMR); | ||
879 | } | ||
877 | } | 880 | } |
878 | 881 | ||
879 | /* Cache mode state */ | 882 | /* Cache mode state */ |
880 | I915_WRITE(CACHE_MODE_0, dev_priv->saveCACHE_MODE_0 | 0xffff0000); | 883 | I915_WRITE(CACHE_MODE_0, dev_priv->regfile.saveCACHE_MODE_0 | 0xffff0000); |
881 | 884 | ||
882 | /* Memory arbitration state */ | 885 | /* Memory arbitration state */ |
883 | I915_WRITE(MI_ARB_STATE, dev_priv->saveMI_ARB_STATE | 0xffff0000); | 886 | I915_WRITE(MI_ARB_STATE, dev_priv->regfile.saveMI_ARB_STATE | 0xffff0000); |
884 | 887 | ||
885 | for (i = 0; i < 16; i++) { | 888 | for (i = 0; i < 16; i++) { |
886 | I915_WRITE(SWF00 + (i << 2), dev_priv->saveSWF0[i]); | 889 | I915_WRITE(SWF00 + (i << 2), dev_priv->regfile.saveSWF0[i]); |
887 | I915_WRITE(SWF10 + (i << 2), dev_priv->saveSWF1[i]); | 890 | I915_WRITE(SWF10 + (i << 2), dev_priv->regfile.saveSWF1[i]); |
888 | } | 891 | } |
889 | for (i = 0; i < 3; i++) | 892 | for (i = 0; i < 3; i++) |
890 | I915_WRITE(SWF30 + (i << 2), dev_priv->saveSWF2[i]); | 893 | I915_WRITE(SWF30 + (i << 2), dev_priv->regfile.saveSWF2[i]); |
891 | 894 | ||
892 | mutex_unlock(&dev->struct_mutex); | 895 | mutex_unlock(&dev->struct_mutex); |
893 | 896 | ||