aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorJerome Glisse <jglisse@redhat.com>2009-09-11 09:35:22 -0400
committerDave Airlie <airlied@redhat.com>2009-09-14 02:09:59 -0400
commit9f022ddfb23793b475ff7e57ac08a766dd5d31bd (patch)
treeb90a004e7eaf6f79f52ac112abbe44abec141613 /drivers/gpu
parentd42571efe33552cd519b7f3800a788b5f2d51798 (diff)
drm/radeon/kms: convert r4xx to new init path
This convert r4xx to new init path it also fix few bugs. Signed-off-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/radeon/r100.c114
-rw-r--r--drivers/gpu/drm/radeon/r100d.h471
-rw-r--r--drivers/gpu/drm/radeon/r300.c50
-rw-r--r--drivers/gpu/drm/radeon/r300d.h25
-rw-r--r--drivers/gpu/drm/radeon/r420.c293
-rw-r--r--drivers/gpu/drm/radeon/r420d.h206
-rw-r--r--drivers/gpu/drm/radeon/radeon.h32
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.h33
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c19
-rw-r--r--drivers/gpu/drm/radeon/radeon_ring.c2
10 files changed, 1121 insertions, 124 deletions
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index 4dd5ca50c0c5..47263d3ede98 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -299,6 +299,17 @@ int r100_irq_set(struct radeon_device *rdev)
299 return 0; 299 return 0;
300} 300}
301 301
302void r100_irq_disable(struct radeon_device *rdev)
303{
304 u32 tmp;
305
306 WREG32(R_000040_GEN_INT_CNTL, 0);
307 /* Wait and acknowledge irq */
308 mdelay(1);
309 tmp = RREG32(R_000044_GEN_INT_STATUS);
310 WREG32(R_000044_GEN_INT_STATUS, tmp);
311}
312
302static inline uint32_t r100_irq_ack(struct radeon_device *rdev) 313static inline uint32_t r100_irq_ack(struct radeon_device *rdev)
303{ 314{
304 uint32_t irqs = RREG32(RADEON_GEN_INT_STATUS); 315 uint32_t irqs = RREG32(RADEON_GEN_INT_STATUS);
@@ -396,14 +407,21 @@ int r100_wb_init(struct radeon_device *rdev)
396 return r; 407 return r;
397 } 408 }
398 } 409 }
399 WREG32(RADEON_SCRATCH_ADDR, rdev->wb.gpu_addr); 410 WREG32(R_000774_SCRATCH_ADDR, rdev->wb.gpu_addr);
400 WREG32(RADEON_CP_RB_RPTR_ADDR, rdev->wb.gpu_addr + 1024); 411 WREG32(R_00070C_CP_RB_RPTR_ADDR,
401 WREG32(RADEON_SCRATCH_UMSK, 0xff); 412 S_00070C_RB_RPTR_ADDR((rdev->wb.gpu_addr + 1024) >> 2));
413 WREG32(R_000770_SCRATCH_UMSK, 0xff);
402 return 0; 414 return 0;
403} 415}
404 416
417void r100_wb_disable(struct radeon_device *rdev)
418{
419 WREG32(R_000770_SCRATCH_UMSK, 0);
420}
421
405void r100_wb_fini(struct radeon_device *rdev) 422void r100_wb_fini(struct radeon_device *rdev)
406{ 423{
424 r100_wb_disable(rdev);
407 if (rdev->wb.wb_obj) { 425 if (rdev->wb.wb_obj) {
408 radeon_object_kunmap(rdev->wb.wb_obj); 426 radeon_object_kunmap(rdev->wb.wb_obj);
409 radeon_object_unpin(rdev->wb.wb_obj); 427 radeon_object_unpin(rdev->wb.wb_obj);
@@ -1581,11 +1599,12 @@ static int r100_packet3_check(struct radeon_cs_parser *p,
1581int r100_cs_parse(struct radeon_cs_parser *p) 1599int r100_cs_parse(struct radeon_cs_parser *p)
1582{ 1600{
1583 struct radeon_cs_packet pkt; 1601 struct radeon_cs_packet pkt;
1584 struct r100_cs_track track; 1602 struct r100_cs_track *track;
1585 int r; 1603 int r;
1586 1604
1587 r100_cs_track_clear(p->rdev, &track); 1605 track = kzalloc(sizeof(*track), GFP_KERNEL);
1588 p->track = &track; 1606 r100_cs_track_clear(p->rdev, track);
1607 p->track = track;
1589 do { 1608 do {
1590 r = r100_cs_packet_parse(p, &pkt, p->idx); 1609 r = r100_cs_packet_parse(p, &pkt, p->idx);
1591 if (r) { 1610 if (r) {
@@ -3085,3 +3104,86 @@ int r100_ib_test(struct radeon_device *rdev)
3085 radeon_ib_free(rdev, &ib); 3104 radeon_ib_free(rdev, &ib);
3086 return r; 3105 return r;
3087} 3106}
3107
3108void r100_ib_fini(struct radeon_device *rdev)
3109{
3110 radeon_ib_pool_fini(rdev);
3111}
3112
3113int r100_ib_init(struct radeon_device *rdev)
3114{
3115 int r;
3116
3117 r = radeon_ib_pool_init(rdev);
3118 if (r) {
3119 dev_err(rdev->dev, "failled initializing IB pool (%d).\n", r);
3120 r100_ib_fini(rdev);
3121 return r;
3122 }
3123 r = r100_ib_test(rdev);
3124 if (r) {
3125 dev_err(rdev->dev, "failled testing IB (%d).\n", r);
3126 r100_ib_fini(rdev);
3127 return r;
3128 }
3129 return 0;
3130}
3131
3132void r100_mc_stop(struct radeon_device *rdev, struct r100_mc_save *save)
3133{
3134 /* Shutdown CP we shouldn't need to do that but better be safe than
3135 * sorry
3136 */
3137 rdev->cp.ready = false;
3138 WREG32(R_000740_CP_CSQ_CNTL, 0);
3139
3140 /* Save few CRTC registers */
3141 save->GENMO_WT = RREG32(R_0003C0_GENMO_WT);
3142 save->CRTC_EXT_CNTL = RREG32(R_000054_CRTC_EXT_CNTL);
3143 save->CRTC_GEN_CNTL = RREG32(R_000050_CRTC_GEN_CNTL);
3144 save->CUR_OFFSET = RREG32(R_000260_CUR_OFFSET);
3145 if (!(rdev->flags & RADEON_SINGLE_CRTC)) {
3146 save->CRTC2_GEN_CNTL = RREG32(R_0003F8_CRTC2_GEN_CNTL);
3147 save->CUR2_OFFSET = RREG32(R_000360_CUR2_OFFSET);
3148 }
3149
3150 /* Disable VGA aperture access */
3151 WREG32(R_0003C0_GENMO_WT, C_0003C0_VGA_RAM_EN & save->GENMO_WT);
3152 /* Disable cursor, overlay, crtc */
3153 WREG32(R_000260_CUR_OFFSET, save->CUR_OFFSET | S_000260_CUR_LOCK(1));
3154 WREG32(R_000054_CRTC_EXT_CNTL, save->CRTC_EXT_CNTL |
3155 S_000054_CRTC_DISPLAY_DIS(1));
3156 WREG32(R_000050_CRTC_GEN_CNTL,
3157 (C_000050_CRTC_CUR_EN & save->CRTC_GEN_CNTL) |
3158 S_000050_CRTC_DISP_REQ_EN_B(1));
3159 WREG32(R_000420_OV0_SCALE_CNTL,
3160 C_000420_OV0_OVERLAY_EN & RREG32(R_000420_OV0_SCALE_CNTL));
3161 WREG32(R_000260_CUR_OFFSET, C_000260_CUR_LOCK & save->CUR_OFFSET);
3162 if (!(rdev->flags & RADEON_SINGLE_CRTC)) {
3163 WREG32(R_000360_CUR2_OFFSET, save->CUR2_OFFSET |
3164 S_000360_CUR2_LOCK(1));
3165 WREG32(R_0003F8_CRTC2_GEN_CNTL,
3166 (C_0003F8_CRTC2_CUR_EN & save->CRTC2_GEN_CNTL) |
3167 S_0003F8_CRTC2_DISPLAY_DIS(1) |
3168 S_0003F8_CRTC2_DISP_REQ_EN_B(1));
3169 WREG32(R_000360_CUR2_OFFSET,
3170 C_000360_CUR2_LOCK & save->CUR2_OFFSET);
3171 }
3172}
3173
3174void r100_mc_resume(struct radeon_device *rdev, struct r100_mc_save *save)
3175{
3176 /* Update base address for crtc */
3177 WREG32(R_00023C_DISPLAY_BASE_ADDR, rdev->mc.vram_location);
3178 if (!(rdev->flags & RADEON_SINGLE_CRTC)) {
3179 WREG32(R_00033C_CRTC2_DISPLAY_BASE_ADDR,
3180 rdev->mc.vram_location);
3181 }
3182 /* Restore CRTC registers */
3183 WREG32(R_0003C0_GENMO_WT, save->GENMO_WT);
3184 WREG32(R_000054_CRTC_EXT_CNTL, save->CRTC_EXT_CNTL);
3185 WREG32(R_000050_CRTC_GEN_CNTL, save->CRTC_GEN_CNTL);
3186 if (!(rdev->flags & RADEON_SINGLE_CRTC)) {
3187 WREG32(R_0003F8_CRTC2_GEN_CNTL, save->CRTC2_GEN_CNTL);
3188 }
3189}
diff --git a/drivers/gpu/drm/radeon/r100d.h b/drivers/gpu/drm/radeon/r100d.h
index 1d951ab77dce..c4b257ec920e 100644
--- a/drivers/gpu/drm/radeon/r100d.h
+++ b/drivers/gpu/drm/radeon/r100d.h
@@ -74,6 +74,477 @@
74#define CP_PACKET3_GET_OPCODE(h) (((h) >> 8) & 0xFF) 74#define CP_PACKET3_GET_OPCODE(h) (((h) >> 8) & 0xFF)
75 75
76/* Registers */ 76/* Registers */
77#define R_000040_GEN_INT_CNTL 0x000040
78#define S_000040_CRTC_VBLANK(x) (((x) & 0x1) << 0)
79#define G_000040_CRTC_VBLANK(x) (((x) >> 0) & 0x1)
80#define C_000040_CRTC_VBLANK 0xFFFFFFFE
81#define S_000040_CRTC_VLINE(x) (((x) & 0x1) << 1)
82#define G_000040_CRTC_VLINE(x) (((x) >> 1) & 0x1)
83#define C_000040_CRTC_VLINE 0xFFFFFFFD
84#define S_000040_CRTC_VSYNC(x) (((x) & 0x1) << 2)
85#define G_000040_CRTC_VSYNC(x) (((x) >> 2) & 0x1)
86#define C_000040_CRTC_VSYNC 0xFFFFFFFB
87#define S_000040_SNAPSHOT(x) (((x) & 0x1) << 3)
88#define G_000040_SNAPSHOT(x) (((x) >> 3) & 0x1)
89#define C_000040_SNAPSHOT 0xFFFFFFF7
90#define S_000040_FP_DETECT(x) (((x) & 0x1) << 4)
91#define G_000040_FP_DETECT(x) (((x) >> 4) & 0x1)
92#define C_000040_FP_DETECT 0xFFFFFFEF
93#define S_000040_CRTC2_VLINE(x) (((x) & 0x1) << 5)
94#define G_000040_CRTC2_VLINE(x) (((x) >> 5) & 0x1)
95#define C_000040_CRTC2_VLINE 0xFFFFFFDF
96#define S_000040_DMA_VIPH0_INT_EN(x) (((x) & 0x1) << 12)
97#define G_000040_DMA_VIPH0_INT_EN(x) (((x) >> 12) & 0x1)
98#define C_000040_DMA_VIPH0_INT_EN 0xFFFFEFFF
99#define S_000040_CRTC2_VSYNC(x) (((x) & 0x1) << 6)
100#define G_000040_CRTC2_VSYNC(x) (((x) >> 6) & 0x1)
101#define C_000040_CRTC2_VSYNC 0xFFFFFFBF
102#define S_000040_SNAPSHOT2(x) (((x) & 0x1) << 7)
103#define G_000040_SNAPSHOT2(x) (((x) >> 7) & 0x1)
104#define C_000040_SNAPSHOT2 0xFFFFFF7F
105#define S_000040_CRTC2_VBLANK(x) (((x) & 0x1) << 9)
106#define G_000040_CRTC2_VBLANK(x) (((x) >> 9) & 0x1)
107#define C_000040_CRTC2_VBLANK 0xFFFFFDFF
108#define S_000040_FP2_DETECT(x) (((x) & 0x1) << 10)
109#define G_000040_FP2_DETECT(x) (((x) >> 10) & 0x1)
110#define C_000040_FP2_DETECT 0xFFFFFBFF
111#define S_000040_VSYNC_DIFF_OVER_LIMIT(x) (((x) & 0x1) << 11)
112#define G_000040_VSYNC_DIFF_OVER_LIMIT(x) (((x) >> 11) & 0x1)
113#define C_000040_VSYNC_DIFF_OVER_LIMIT 0xFFFFF7FF
114#define S_000040_DMA_VIPH1_INT_EN(x) (((x) & 0x1) << 13)
115#define G_000040_DMA_VIPH1_INT_EN(x) (((x) >> 13) & 0x1)
116#define C_000040_DMA_VIPH1_INT_EN 0xFFFFDFFF
117#define S_000040_DMA_VIPH2_INT_EN(x) (((x) & 0x1) << 14)
118#define G_000040_DMA_VIPH2_INT_EN(x) (((x) >> 14) & 0x1)
119#define C_000040_DMA_VIPH2_INT_EN 0xFFFFBFFF
120#define S_000040_DMA_VIPH3_INT_EN(x) (((x) & 0x1) << 15)
121#define G_000040_DMA_VIPH3_INT_EN(x) (((x) >> 15) & 0x1)
122#define C_000040_DMA_VIPH3_INT_EN 0xFFFF7FFF
123#define S_000040_I2C_INT_EN(x) (((x) & 0x1) << 17)
124#define G_000040_I2C_INT_EN(x) (((x) >> 17) & 0x1)
125#define C_000040_I2C_INT_EN 0xFFFDFFFF
126#define S_000040_GUI_IDLE(x) (((x) & 0x1) << 19)
127#define G_000040_GUI_IDLE(x) (((x) >> 19) & 0x1)
128#define C_000040_GUI_IDLE 0xFFF7FFFF
129#define S_000040_VIPH_INT_EN(x) (((x) & 0x1) << 24)
130#define G_000040_VIPH_INT_EN(x) (((x) >> 24) & 0x1)
131#define C_000040_VIPH_INT_EN 0xFEFFFFFF
132#define S_000040_SW_INT_EN(x) (((x) & 0x1) << 25)
133#define G_000040_SW_INT_EN(x) (((x) >> 25) & 0x1)
134#define C_000040_SW_INT_EN 0xFDFFFFFF
135#define S_000040_GEYSERVILLE(x) (((x) & 0x1) << 27)
136#define G_000040_GEYSERVILLE(x) (((x) >> 27) & 0x1)
137#define C_000040_GEYSERVILLE 0xF7FFFFFF
138#define S_000040_HDCP_AUTHORIZED_INT(x) (((x) & 0x1) << 28)
139#define G_000040_HDCP_AUTHORIZED_INT(x) (((x) >> 28) & 0x1)
140#define C_000040_HDCP_AUTHORIZED_INT 0xEFFFFFFF
141#define S_000040_DVI_I2C_INT(x) (((x) & 0x1) << 29)
142#define G_000040_DVI_I2C_INT(x) (((x) >> 29) & 0x1)
143#define C_000040_DVI_I2C_INT 0xDFFFFFFF
144#define S_000040_GUIDMA(x) (((x) & 0x1) << 30)
145#define G_000040_GUIDMA(x) (((x) >> 30) & 0x1)
146#define C_000040_GUIDMA 0xBFFFFFFF
147#define S_000040_VIDDMA(x) (((x) & 0x1) << 31)
148#define G_000040_VIDDMA(x) (((x) >> 31) & 0x1)
149#define C_000040_VIDDMA 0x7FFFFFFF
150#define R_000044_GEN_INT_STATUS 0x000044
151#define S_000044_CRTC_VBLANK_STAT(x) (((x) & 0x1) << 0)
152#define G_000044_CRTC_VBLANK_STAT(x) (((x) >> 0) & 0x1)
153#define C_000044_CRTC_VBLANK_STAT 0xFFFFFFFE
154#define S_000044_CRTC_VBLANK_STAT_AK(x) (((x) & 0x1) << 0)
155#define G_000044_CRTC_VBLANK_STAT_AK(x) (((x) >> 0) & 0x1)
156#define C_000044_CRTC_VBLANK_STAT_AK 0xFFFFFFFE
157#define S_000044_CRTC_VLINE_STAT(x) (((x) & 0x1) << 1)
158#define G_000044_CRTC_VLINE_STAT(x) (((x) >> 1) & 0x1)
159#define C_000044_CRTC_VLINE_STAT 0xFFFFFFFD
160#define S_000044_CRTC_VLINE_STAT_AK(x) (((x) & 0x1) << 1)
161#define G_000044_CRTC_VLINE_STAT_AK(x) (((x) >> 1) & 0x1)
162#define C_000044_CRTC_VLINE_STAT_AK 0xFFFFFFFD
163#define S_000044_CRTC_VSYNC_STAT(x) (((x) & 0x1) << 2)
164#define G_000044_CRTC_VSYNC_STAT(x) (((x) >> 2) & 0x1)
165#define C_000044_CRTC_VSYNC_STAT 0xFFFFFFFB
166#define S_000044_CRTC_VSYNC_STAT_AK(x) (((x) & 0x1) << 2)
167#define G_000044_CRTC_VSYNC_STAT_AK(x) (((x) >> 2) & 0x1)
168#define C_000044_CRTC_VSYNC_STAT_AK 0xFFFFFFFB
169#define S_000044_SNAPSHOT_STAT(x) (((x) & 0x1) << 3)
170#define G_000044_SNAPSHOT_STAT(x) (((x) >> 3) & 0x1)
171#define C_000044_SNAPSHOT_STAT 0xFFFFFFF7
172#define S_000044_SNAPSHOT_STAT_AK(x) (((x) & 0x1) << 3)
173#define G_000044_SNAPSHOT_STAT_AK(x) (((x) >> 3) & 0x1)
174#define C_000044_SNAPSHOT_STAT_AK 0xFFFFFFF7
175#define S_000044_FP_DETECT_STAT(x) (((x) & 0x1) << 4)
176#define G_000044_FP_DETECT_STAT(x) (((x) >> 4) & 0x1)
177#define C_000044_FP_DETECT_STAT 0xFFFFFFEF
178#define S_000044_FP_DETECT_STAT_AK(x) (((x) & 0x1) << 4)
179#define G_000044_FP_DETECT_STAT_AK(x) (((x) >> 4) & 0x1)
180#define C_000044_FP_DETECT_STAT_AK 0xFFFFFFEF
181#define S_000044_CRTC2_VLINE_STAT(x) (((x) & 0x1) << 5)
182#define G_000044_CRTC2_VLINE_STAT(x) (((x) >> 5) & 0x1)
183#define C_000044_CRTC2_VLINE_STAT 0xFFFFFFDF
184#define S_000044_CRTC2_VLINE_STAT_AK(x) (((x) & 0x1) << 5)
185#define G_000044_CRTC2_VLINE_STAT_AK(x) (((x) >> 5) & 0x1)
186#define C_000044_CRTC2_VLINE_STAT_AK 0xFFFFFFDF
187#define S_000044_CRTC2_VSYNC_STAT(x) (((x) & 0x1) << 6)
188#define G_000044_CRTC2_VSYNC_STAT(x) (((x) >> 6) & 0x1)
189#define C_000044_CRTC2_VSYNC_STAT 0xFFFFFFBF
190#define S_000044_CRTC2_VSYNC_STAT_AK(x) (((x) & 0x1) << 6)
191#define G_000044_CRTC2_VSYNC_STAT_AK(x) (((x) >> 6) & 0x1)
192#define C_000044_CRTC2_VSYNC_STAT_AK 0xFFFFFFBF
193#define S_000044_SNAPSHOT2_STAT(x) (((x) & 0x1) << 7)
194#define G_000044_SNAPSHOT2_STAT(x) (((x) >> 7) & 0x1)
195#define C_000044_SNAPSHOT2_STAT 0xFFFFFF7F
196#define S_000044_SNAPSHOT2_STAT_AK(x) (((x) & 0x1) << 7)
197#define G_000044_SNAPSHOT2_STAT_AK(x) (((x) >> 7) & 0x1)
198#define C_000044_SNAPSHOT2_STAT_AK 0xFFFFFF7F
199#define S_000044_CAP0_INT_ACTIVE(x) (((x) & 0x1) << 8)
200#define G_000044_CAP0_INT_ACTIVE(x) (((x) >> 8) & 0x1)
201#define C_000044_CAP0_INT_ACTIVE 0xFFFFFEFF
202#define S_000044_CRTC2_VBLANK_STAT(x) (((x) & 0x1) << 9)
203#define G_000044_CRTC2_VBLANK_STAT(x) (((x) >> 9) & 0x1)
204#define C_000044_CRTC2_VBLANK_STAT 0xFFFFFDFF
205#define S_000044_CRTC2_VBLANK_STAT_AK(x) (((x) & 0x1) << 9)
206#define G_000044_CRTC2_VBLANK_STAT_AK(x) (((x) >> 9) & 0x1)
207#define C_000044_CRTC2_VBLANK_STAT_AK 0xFFFFFDFF
208#define S_000044_FP2_DETECT_STAT(x) (((x) & 0x1) << 10)
209#define G_000044_FP2_DETECT_STAT(x) (((x) >> 10) & 0x1)
210#define C_000044_FP2_DETECT_STAT 0xFFFFFBFF
211#define S_000044_FP2_DETECT_STAT_AK(x) (((x) & 0x1) << 10)
212#define G_000044_FP2_DETECT_STAT_AK(x) (((x) >> 10) & 0x1)
213#define C_000044_FP2_DETECT_STAT_AK 0xFFFFFBFF
214#define S_000044_VSYNC_DIFF_OVER_LIMIT_STAT(x) (((x) & 0x1) << 11)
215#define G_000044_VSYNC_DIFF_OVER_LIMIT_STAT(x) (((x) >> 11) & 0x1)
216#define C_000044_VSYNC_DIFF_OVER_LIMIT_STAT 0xFFFFF7FF
217#define S_000044_VSYNC_DIFF_OVER_LIMIT_STAT_AK(x) (((x) & 0x1) << 11)
218#define G_000044_VSYNC_DIFF_OVER_LIMIT_STAT_AK(x) (((x) >> 11) & 0x1)
219#define C_000044_VSYNC_DIFF_OVER_LIMIT_STAT_AK 0xFFFFF7FF
220#define S_000044_DMA_VIPH0_INT(x) (((x) & 0x1) << 12)
221#define G_000044_DMA_VIPH0_INT(x) (((x) >> 12) & 0x1)
222#define C_000044_DMA_VIPH0_INT 0xFFFFEFFF
223#define S_000044_DMA_VIPH0_INT_AK(x) (((x) & 0x1) << 12)
224#define G_000044_DMA_VIPH0_INT_AK(x) (((x) >> 12) & 0x1)
225#define C_000044_DMA_VIPH0_INT_AK 0xFFFFEFFF
226#define S_000044_DMA_VIPH1_INT(x) (((x) & 0x1) << 13)
227#define G_000044_DMA_VIPH1_INT(x) (((x) >> 13) & 0x1)
228#define C_000044_DMA_VIPH1_INT 0xFFFFDFFF
229#define S_000044_DMA_VIPH1_INT_AK(x) (((x) & 0x1) << 13)
230#define G_000044_DMA_VIPH1_INT_AK(x) (((x) >> 13) & 0x1)
231#define C_000044_DMA_VIPH1_INT_AK 0xFFFFDFFF
232#define S_000044_DMA_VIPH2_INT(x) (((x) & 0x1) << 14)
233#define G_000044_DMA_VIPH2_INT(x) (((x) >> 14) & 0x1)
234#define C_000044_DMA_VIPH2_INT 0xFFFFBFFF
235#define S_000044_DMA_VIPH2_INT_AK(x) (((x) & 0x1) << 14)
236#define G_000044_DMA_VIPH2_INT_AK(x) (((x) >> 14) & 0x1)
237#define C_000044_DMA_VIPH2_INT_AK 0xFFFFBFFF
238#define S_000044_DMA_VIPH3_INT(x) (((x) & 0x1) << 15)
239#define G_000044_DMA_VIPH3_INT(x) (((x) >> 15) & 0x1)
240#define C_000044_DMA_VIPH3_INT 0xFFFF7FFF
241#define S_000044_DMA_VIPH3_INT_AK(x) (((x) & 0x1) << 15)
242#define G_000044_DMA_VIPH3_INT_AK(x) (((x) >> 15) & 0x1)
243#define C_000044_DMA_VIPH3_INT_AK 0xFFFF7FFF
244#define S_000044_I2C_INT(x) (((x) & 0x1) << 17)
245#define G_000044_I2C_INT(x) (((x) >> 17) & 0x1)
246#define C_000044_I2C_INT 0xFFFDFFFF
247#define S_000044_I2C_INT_AK(x) (((x) & 0x1) << 17)
248#define G_000044_I2C_INT_AK(x) (((x) >> 17) & 0x1)
249#define C_000044_I2C_INT_AK 0xFFFDFFFF
250#define S_000044_GUI_IDLE_STAT(x) (((x) & 0x1) << 19)
251#define G_000044_GUI_IDLE_STAT(x) (((x) >> 19) & 0x1)
252#define C_000044_GUI_IDLE_STAT 0xFFF7FFFF
253#define S_000044_GUI_IDLE_STAT_AK(x) (((x) & 0x1) << 19)
254#define G_000044_GUI_IDLE_STAT_AK(x) (((x) >> 19) & 0x1)
255#define C_000044_GUI_IDLE_STAT_AK 0xFFF7FFFF
256#define S_000044_VIPH_INT(x) (((x) & 0x1) << 24)
257#define G_000044_VIPH_INT(x) (((x) >> 24) & 0x1)
258#define C_000044_VIPH_INT 0xFEFFFFFF
259#define S_000044_SW_INT(x) (((x) & 0x1) << 25)
260#define G_000044_SW_INT(x) (((x) >> 25) & 0x1)
261#define C_000044_SW_INT 0xFDFFFFFF
262#define S_000044_SW_INT_AK(x) (((x) & 0x1) << 25)
263#define G_000044_SW_INT_AK(x) (((x) >> 25) & 0x1)
264#define C_000044_SW_INT_AK 0xFDFFFFFF
265#define S_000044_SW_INT_SET(x) (((x) & 0x1) << 26)
266#define G_000044_SW_INT_SET(x) (((x) >> 26) & 0x1)
267#define C_000044_SW_INT_SET 0xFBFFFFFF
268#define S_000044_GEYSERVILLE_STAT(x) (((x) & 0x1) << 27)
269#define G_000044_GEYSERVILLE_STAT(x) (((x) >> 27) & 0x1)
270#define C_000044_GEYSERVILLE_STAT 0xF7FFFFFF
271#define S_000044_GEYSERVILLE_STAT_AK(x) (((x) & 0x1) << 27)
272#define G_000044_GEYSERVILLE_STAT_AK(x) (((x) >> 27) & 0x1)
273#define C_000044_GEYSERVILLE_STAT_AK 0xF7FFFFFF
274#define S_000044_HDCP_AUTHORIZED_INT_STAT(x) (((x) & 0x1) << 28)
275#define G_000044_HDCP_AUTHORIZED_INT_STAT(x) (((x) >> 28) & 0x1)
276#define C_000044_HDCP_AUTHORIZED_INT_STAT 0xEFFFFFFF
277#define S_000044_HDCP_AUTHORIZED_INT_AK(x) (((x) & 0x1) << 28)
278#define G_000044_HDCP_AUTHORIZED_INT_AK(x) (((x) >> 28) & 0x1)
279#define C_000044_HDCP_AUTHORIZED_INT_AK 0xEFFFFFFF
280#define S_000044_DVI_I2C_INT_STAT(x) (((x) & 0x1) << 29)
281#define G_000044_DVI_I2C_INT_STAT(x) (((x) >> 29) & 0x1)
282#define C_000044_DVI_I2C_INT_STAT 0xDFFFFFFF
283#define S_000044_DVI_I2C_INT_AK(x) (((x) & 0x1) << 29)
284#define G_000044_DVI_I2C_INT_AK(x) (((x) >> 29) & 0x1)
285#define C_000044_DVI_I2C_INT_AK 0xDFFFFFFF
286#define S_000044_GUIDMA_STAT(x) (((x) & 0x1) << 30)
287#define G_000044_GUIDMA_STAT(x) (((x) >> 30) & 0x1)
288#define C_000044_GUIDMA_STAT 0xBFFFFFFF
289#define S_000044_GUIDMA_AK(x) (((x) & 0x1) << 30)
290#define G_000044_GUIDMA_AK(x) (((x) >> 30) & 0x1)
291#define C_000044_GUIDMA_AK 0xBFFFFFFF
292#define S_000044_VIDDMA_STAT(x) (((x) & 0x1) << 31)
293#define G_000044_VIDDMA_STAT(x) (((x) >> 31) & 0x1)
294#define C_000044_VIDDMA_STAT 0x7FFFFFFF
295#define S_000044_VIDDMA_AK(x) (((x) & 0x1) << 31)
296#define G_000044_VIDDMA_AK(x) (((x) >> 31) & 0x1)
297#define C_000044_VIDDMA_AK 0x7FFFFFFF
298#define R_000050_CRTC_GEN_CNTL 0x000050
299#define S_000050_CRTC_DBL_SCAN_EN(x) (((x) & 0x1) << 0)
300#define G_000050_CRTC_DBL_SCAN_EN(x) (((x) >> 0) & 0x1)
301#define C_000050_CRTC_DBL_SCAN_EN 0xFFFFFFFE
302#define S_000050_CRTC_INTERLACE_EN(x) (((x) & 0x1) << 1)
303#define G_000050_CRTC_INTERLACE_EN(x) (((x) >> 1) & 0x1)
304#define C_000050_CRTC_INTERLACE_EN 0xFFFFFFFD
305#define S_000050_CRTC_C_SYNC_EN(x) (((x) & 0x1) << 4)
306#define G_000050_CRTC_C_SYNC_EN(x) (((x) >> 4) & 0x1)
307#define C_000050_CRTC_C_SYNC_EN 0xFFFFFFEF
308#define S_000050_CRTC_PIX_WIDTH(x) (((x) & 0xF) << 8)
309#define G_000050_CRTC_PIX_WIDTH(x) (((x) >> 8) & 0xF)
310#define C_000050_CRTC_PIX_WIDTH 0xFFFFF0FF
311#define S_000050_CRTC_ICON_EN(x) (((x) & 0x1) << 15)
312#define G_000050_CRTC_ICON_EN(x) (((x) >> 15) & 0x1)
313#define C_000050_CRTC_ICON_EN 0xFFFF7FFF
314#define S_000050_CRTC_CUR_EN(x) (((x) & 0x1) << 16)
315#define G_000050_CRTC_CUR_EN(x) (((x) >> 16) & 0x1)
316#define C_000050_CRTC_CUR_EN 0xFFFEFFFF
317#define S_000050_CRTC_VSTAT_MODE(x) (((x) & 0x3) << 17)
318#define G_000050_CRTC_VSTAT_MODE(x) (((x) >> 17) & 0x3)
319#define C_000050_CRTC_VSTAT_MODE 0xFFF9FFFF
320#define S_000050_CRTC_CUR_MODE(x) (((x) & 0x7) << 20)
321#define G_000050_CRTC_CUR_MODE(x) (((x) >> 20) & 0x7)
322#define C_000050_CRTC_CUR_MODE 0xFF8FFFFF
323#define S_000050_CRTC_EXT_DISP_EN(x) (((x) & 0x1) << 24)
324#define G_000050_CRTC_EXT_DISP_EN(x) (((x) >> 24) & 0x1)
325#define C_000050_CRTC_EXT_DISP_EN 0xFEFFFFFF
326#define S_000050_CRTC_EN(x) (((x) & 0x1) << 25)
327#define G_000050_CRTC_EN(x) (((x) >> 25) & 0x1)
328#define C_000050_CRTC_EN 0xFDFFFFFF
329#define S_000050_CRTC_DISP_REQ_EN_B(x) (((x) & 0x1) << 26)
330#define G_000050_CRTC_DISP_REQ_EN_B(x) (((x) >> 26) & 0x1)
331#define C_000050_CRTC_DISP_REQ_EN_B 0xFBFFFFFF
332#define R_000054_CRTC_EXT_CNTL 0x000054
333#define S_000054_CRTC_VGA_XOVERSCAN(x) (((x) & 0x1) << 0)
334#define G_000054_CRTC_VGA_XOVERSCAN(x) (((x) >> 0) & 0x1)
335#define C_000054_CRTC_VGA_XOVERSCAN 0xFFFFFFFE
336#define S_000054_VGA_BLINK_RATE(x) (((x) & 0x3) << 1)
337#define G_000054_VGA_BLINK_RATE(x) (((x) >> 1) & 0x3)
338#define C_000054_VGA_BLINK_RATE 0xFFFFFFF9
339#define S_000054_VGA_ATI_LINEAR(x) (((x) & 0x1) << 3)
340#define G_000054_VGA_ATI_LINEAR(x) (((x) >> 3) & 0x1)
341#define C_000054_VGA_ATI_LINEAR 0xFFFFFFF7
342#define S_000054_VGA_128KAP_PAGING(x) (((x) & 0x1) << 4)
343#define G_000054_VGA_128KAP_PAGING(x) (((x) >> 4) & 0x1)
344#define C_000054_VGA_128KAP_PAGING 0xFFFFFFEF
345#define S_000054_VGA_TEXT_132(x) (((x) & 0x1) << 5)
346#define G_000054_VGA_TEXT_132(x) (((x) >> 5) & 0x1)
347#define C_000054_VGA_TEXT_132 0xFFFFFFDF
348#define S_000054_VGA_XCRT_CNT_EN(x) (((x) & 0x1) << 6)
349#define G_000054_VGA_XCRT_CNT_EN(x) (((x) >> 6) & 0x1)
350#define C_000054_VGA_XCRT_CNT_EN 0xFFFFFFBF
351#define S_000054_CRTC_HSYNC_DIS(x) (((x) & 0x1) << 8)
352#define G_000054_CRTC_HSYNC_DIS(x) (((x) >> 8) & 0x1)
353#define C_000054_CRTC_HSYNC_DIS 0xFFFFFEFF
354#define S_000054_CRTC_VSYNC_DIS(x) (((x) & 0x1) << 9)
355#define G_000054_CRTC_VSYNC_DIS(x) (((x) >> 9) & 0x1)
356#define C_000054_CRTC_VSYNC_DIS 0xFFFFFDFF
357#define S_000054_CRTC_DISPLAY_DIS(x) (((x) & 0x1) << 10)
358#define G_000054_CRTC_DISPLAY_DIS(x) (((x) >> 10) & 0x1)
359#define C_000054_CRTC_DISPLAY_DIS 0xFFFFFBFF
360#define S_000054_CRTC_SYNC_TRISTATE(x) (((x) & 0x1) << 11)
361#define G_000054_CRTC_SYNC_TRISTATE(x) (((x) >> 11) & 0x1)
362#define C_000054_CRTC_SYNC_TRISTATE 0xFFFFF7FF
363#define S_000054_CRTC_HSYNC_TRISTATE(x) (((x) & 0x1) << 12)
364#define G_000054_CRTC_HSYNC_TRISTATE(x) (((x) >> 12) & 0x1)
365#define C_000054_CRTC_HSYNC_TRISTATE 0xFFFFEFFF
366#define S_000054_CRTC_VSYNC_TRISTATE(x) (((x) & 0x1) << 13)
367#define G_000054_CRTC_VSYNC_TRISTATE(x) (((x) >> 13) & 0x1)
368#define C_000054_CRTC_VSYNC_TRISTATE 0xFFFFDFFF
369#define S_000054_CRT_ON(x) (((x) & 0x1) << 15)
370#define G_000054_CRT_ON(x) (((x) >> 15) & 0x1)
371#define C_000054_CRT_ON 0xFFFF7FFF
372#define S_000054_VGA_CUR_B_TEST(x) (((x) & 0x1) << 17)
373#define G_000054_VGA_CUR_B_TEST(x) (((x) >> 17) & 0x1)
374#define C_000054_VGA_CUR_B_TEST 0xFFFDFFFF
375#define S_000054_VGA_PACK_DIS(x) (((x) & 0x1) << 18)
376#define G_000054_VGA_PACK_DIS(x) (((x) >> 18) & 0x1)
377#define C_000054_VGA_PACK_DIS 0xFFFBFFFF
378#define S_000054_VGA_MEM_PS_EN(x) (((x) & 0x1) << 19)
379#define G_000054_VGA_MEM_PS_EN(x) (((x) >> 19) & 0x1)
380#define C_000054_VGA_MEM_PS_EN 0xFFF7FFFF
381#define S_000054_VCRTC_IDX_MASTER(x) (((x) & 0x7F) << 24)
382#define G_000054_VCRTC_IDX_MASTER(x) (((x) >> 24) & 0x7F)
383#define C_000054_VCRTC_IDX_MASTER 0x80FFFFFF
384#define R_00023C_DISPLAY_BASE_ADDR 0x00023C
385#define S_00023C_DISPLAY_BASE_ADDR(x) (((x) & 0xFFFFFFFF) << 0)
386#define G_00023C_DISPLAY_BASE_ADDR(x) (((x) >> 0) & 0xFFFFFFFF)
387#define C_00023C_DISPLAY_BASE_ADDR 0x00000000
388#define R_000260_CUR_OFFSET 0x000260
389#define S_000260_CUR_OFFSET(x) (((x) & 0x7FFFFFF) << 0)
390#define G_000260_CUR_OFFSET(x) (((x) >> 0) & 0x7FFFFFF)
391#define C_000260_CUR_OFFSET 0xF8000000
392#define S_000260_CUR_LOCK(x) (((x) & 0x1) << 31)
393#define G_000260_CUR_LOCK(x) (((x) >> 31) & 0x1)
394#define C_000260_CUR_LOCK 0x7FFFFFFF
395#define R_00033C_CRTC2_DISPLAY_BASE_ADDR 0x00033C
396#define S_00033C_CRTC2_DISPLAY_BASE_ADDR(x) (((x) & 0xFFFFFFFF) << 0)
397#define G_00033C_CRTC2_DISPLAY_BASE_ADDR(x) (((x) >> 0) & 0xFFFFFFFF)
398#define C_00033C_CRTC2_DISPLAY_BASE_ADDR 0x00000000
399#define R_000360_CUR2_OFFSET 0x000360
400#define S_000360_CUR2_OFFSET(x) (((x) & 0x7FFFFFF) << 0)
401#define G_000360_CUR2_OFFSET(x) (((x) >> 0) & 0x7FFFFFF)
402#define C_000360_CUR2_OFFSET 0xF8000000
403#define S_000360_CUR2_LOCK(x) (((x) & 0x1) << 31)
404#define G_000360_CUR2_LOCK(x) (((x) >> 31) & 0x1)
405#define C_000360_CUR2_LOCK 0x7FFFFFFF
406#define R_0003C0_GENMO_WT 0x0003C0
407#define S_0003C0_GENMO_MONO_ADDRESS_B(x) (((x) & 0x1) << 0)
408#define G_0003C0_GENMO_MONO_ADDRESS_B(x) (((x) >> 0) & 0x1)
409#define C_0003C0_GENMO_MONO_ADDRESS_B 0xFFFFFFFE
410#define S_0003C0_VGA_RAM_EN(x) (((x) & 0x1) << 1)
411#define G_0003C0_VGA_RAM_EN(x) (((x) >> 1) & 0x1)
412#define C_0003C0_VGA_RAM_EN 0xFFFFFFFD
413#define S_0003C0_VGA_CKSEL(x) (((x) & 0x3) << 2)
414#define G_0003C0_VGA_CKSEL(x) (((x) >> 2) & 0x3)
415#define C_0003C0_VGA_CKSEL 0xFFFFFFF3
416#define S_0003C0_ODD_EVEN_MD_PGSEL(x) (((x) & 0x1) << 5)
417#define G_0003C0_ODD_EVEN_MD_PGSEL(x) (((x) >> 5) & 0x1)
418#define C_0003C0_ODD_EVEN_MD_PGSEL 0xFFFFFFDF
419#define S_0003C0_VGA_HSYNC_POL(x) (((x) & 0x1) << 6)
420#define G_0003C0_VGA_HSYNC_POL(x) (((x) >> 6) & 0x1)
421#define C_0003C0_VGA_HSYNC_POL 0xFFFFFFBF
422#define S_0003C0_VGA_VSYNC_POL(x) (((x) & 0x1) << 7)
423#define G_0003C0_VGA_VSYNC_POL(x) (((x) >> 7) & 0x1)
424#define C_0003C0_VGA_VSYNC_POL 0xFFFFFF7F
425#define R_0003F8_CRTC2_GEN_CNTL 0x0003F8
426#define S_0003F8_CRTC2_DBL_SCAN_EN(x) (((x) & 0x1) << 0)
427#define G_0003F8_CRTC2_DBL_SCAN_EN(x) (((x) >> 0) & 0x1)
428#define C_0003F8_CRTC2_DBL_SCAN_EN 0xFFFFFFFE
429#define S_0003F8_CRTC2_INTERLACE_EN(x) (((x) & 0x1) << 1)
430#define G_0003F8_CRTC2_INTERLACE_EN(x) (((x) >> 1) & 0x1)
431#define C_0003F8_CRTC2_INTERLACE_EN 0xFFFFFFFD
432#define S_0003F8_CRTC2_SYNC_TRISTATE(x) (((x) & 0x1) << 4)
433#define G_0003F8_CRTC2_SYNC_TRISTATE(x) (((x) >> 4) & 0x1)
434#define C_0003F8_CRTC2_SYNC_TRISTATE 0xFFFFFFEF
435#define S_0003F8_CRTC2_HSYNC_TRISTATE(x) (((x) & 0x1) << 5)
436#define G_0003F8_CRTC2_HSYNC_TRISTATE(x) (((x) >> 5) & 0x1)
437#define C_0003F8_CRTC2_HSYNC_TRISTATE 0xFFFFFFDF
438#define S_0003F8_CRTC2_VSYNC_TRISTATE(x) (((x) & 0x1) << 6)
439#define G_0003F8_CRTC2_VSYNC_TRISTATE(x) (((x) >> 6) & 0x1)
440#define C_0003F8_CRTC2_VSYNC_TRISTATE 0xFFFFFFBF
441#define S_0003F8_CRT2_ON(x) (((x) & 0x1) << 7)
442#define G_0003F8_CRT2_ON(x) (((x) >> 7) & 0x1)
443#define C_0003F8_CRT2_ON 0xFFFFFF7F
444#define S_0003F8_CRTC2_PIX_WIDTH(x) (((x) & 0xF) << 8)
445#define G_0003F8_CRTC2_PIX_WIDTH(x) (((x) >> 8) & 0xF)
446#define C_0003F8_CRTC2_PIX_WIDTH 0xFFFFF0FF
447#define S_0003F8_CRTC2_ICON_EN(x) (((x) & 0x1) << 15)
448#define G_0003F8_CRTC2_ICON_EN(x) (((x) >> 15) & 0x1)
449#define C_0003F8_CRTC2_ICON_EN 0xFFFF7FFF
450#define S_0003F8_CRTC2_CUR_EN(x) (((x) & 0x1) << 16)
451#define G_0003F8_CRTC2_CUR_EN(x) (((x) >> 16) & 0x1)
452#define C_0003F8_CRTC2_CUR_EN 0xFFFEFFFF
453#define S_0003F8_CRTC2_CUR_MODE(x) (((x) & 0x7) << 20)
454#define G_0003F8_CRTC2_CUR_MODE(x) (((x) >> 20) & 0x7)
455#define C_0003F8_CRTC2_CUR_MODE 0xFF8FFFFF
456#define S_0003F8_CRTC2_DISPLAY_DIS(x) (((x) & 0x1) << 23)
457#define G_0003F8_CRTC2_DISPLAY_DIS(x) (((x) >> 23) & 0x1)
458#define C_0003F8_CRTC2_DISPLAY_DIS 0xFF7FFFFF
459#define S_0003F8_CRTC2_EN(x) (((x) & 0x1) << 25)
460#define G_0003F8_CRTC2_EN(x) (((x) >> 25) & 0x1)
461#define C_0003F8_CRTC2_EN 0xFDFFFFFF
462#define S_0003F8_CRTC2_DISP_REQ_EN_B(x) (((x) & 0x1) << 26)
463#define G_0003F8_CRTC2_DISP_REQ_EN_B(x) (((x) >> 26) & 0x1)
464#define C_0003F8_CRTC2_DISP_REQ_EN_B 0xFBFFFFFF
465#define S_0003F8_CRTC2_C_SYNC_EN(x) (((x) & 0x1) << 27)
466#define G_0003F8_CRTC2_C_SYNC_EN(x) (((x) >> 27) & 0x1)
467#define C_0003F8_CRTC2_C_SYNC_EN 0xF7FFFFFF
468#define S_0003F8_CRTC2_HSYNC_DIS(x) (((x) & 0x1) << 28)
469#define G_0003F8_CRTC2_HSYNC_DIS(x) (((x) >> 28) & 0x1)
470#define C_0003F8_CRTC2_HSYNC_DIS 0xEFFFFFFF
471#define S_0003F8_CRTC2_VSYNC_DIS(x) (((x) & 0x1) << 29)
472#define G_0003F8_CRTC2_VSYNC_DIS(x) (((x) >> 29) & 0x1)
473#define C_0003F8_CRTC2_VSYNC_DIS 0xDFFFFFFF
474#define R_000420_OV0_SCALE_CNTL 0x000420
475#define S_000420_OV0_NO_READ_BEHIND_SCAN(x) (((x) & 0x1) << 1)
476#define G_000420_OV0_NO_READ_BEHIND_SCAN(x) (((x) >> 1) & 0x1)
477#define C_000420_OV0_NO_READ_BEHIND_SCAN 0xFFFFFFFD
478#define S_000420_OV0_HORZ_PICK_NEAREST(x) (((x) & 0x1) << 2)
479#define G_000420_OV0_HORZ_PICK_NEAREST(x) (((x) >> 2) & 0x1)
480#define C_000420_OV0_HORZ_PICK_NEAREST 0xFFFFFFFB
481#define S_000420_OV0_VERT_PICK_NEAREST(x) (((x) & 0x1) << 3)
482#define G_000420_OV0_VERT_PICK_NEAREST(x) (((x) >> 3) & 0x1)
483#define C_000420_OV0_VERT_PICK_NEAREST 0xFFFFFFF7
484#define S_000420_OV0_SIGNED_UV(x) (((x) & 0x1) << 4)
485#define G_000420_OV0_SIGNED_UV(x) (((x) >> 4) & 0x1)
486#define C_000420_OV0_SIGNED_UV 0xFFFFFFEF
487#define S_000420_OV0_GAMMA_SEL(x) (((x) & 0x7) << 5)
488#define G_000420_OV0_GAMMA_SEL(x) (((x) >> 5) & 0x7)
489#define C_000420_OV0_GAMMA_SEL 0xFFFFFF1F
490#define S_000420_OV0_SURFACE_FORMAT(x) (((x) & 0xF) << 8)
491#define G_000420_OV0_SURFACE_FORMAT(x) (((x) >> 8) & 0xF)
492#define C_000420_OV0_SURFACE_FORMAT 0xFFFFF0FF
493#define S_000420_OV0_ADAPTIVE_DEINT(x) (((x) & 0x1) << 12)
494#define G_000420_OV0_ADAPTIVE_DEINT(x) (((x) >> 12) & 0x1)
495#define C_000420_OV0_ADAPTIVE_DEINT 0xFFFFEFFF
496#define S_000420_OV0_CRTC_SEL(x) (((x) & 0x1) << 14)
497#define G_000420_OV0_CRTC_SEL(x) (((x) >> 14) & 0x1)
498#define C_000420_OV0_CRTC_SEL 0xFFFFBFFF
499#define S_000420_OV0_BURST_PER_PLANE(x) (((x) & 0x7F) << 16)
500#define G_000420_OV0_BURST_PER_PLANE(x) (((x) >> 16) & 0x7F)
501#define C_000420_OV0_BURST_PER_PLANE 0xFF80FFFF
502#define S_000420_OV0_DOUBLE_BUFFER_REGS(x) (((x) & 0x1) << 24)
503#define G_000420_OV0_DOUBLE_BUFFER_REGS(x) (((x) >> 24) & 0x1)
504#define C_000420_OV0_DOUBLE_BUFFER_REGS 0xFEFFFFFF
505#define S_000420_OV0_BANDWIDTH(x) (((x) & 0x1) << 26)
506#define G_000420_OV0_BANDWIDTH(x) (((x) >> 26) & 0x1)
507#define C_000420_OV0_BANDWIDTH 0xFBFFFFFF
508#define S_000420_OV0_LIN_TRANS_BYPASS(x) (((x) & 0x1) << 28)
509#define G_000420_OV0_LIN_TRANS_BYPASS(x) (((x) >> 28) & 0x1)
510#define C_000420_OV0_LIN_TRANS_BYPASS 0xEFFFFFFF
511#define S_000420_OV0_INT_EMU(x) (((x) & 0x1) << 29)
512#define G_000420_OV0_INT_EMU(x) (((x) >> 29) & 0x1)
513#define C_000420_OV0_INT_EMU 0xDFFFFFFF
514#define S_000420_OV0_OVERLAY_EN(x) (((x) & 0x1) << 30)
515#define G_000420_OV0_OVERLAY_EN(x) (((x) >> 30) & 0x1)
516#define C_000420_OV0_OVERLAY_EN 0xBFFFFFFF
517#define S_000420_OV0_SOFT_RESET(x) (((x) & 0x1) << 31)
518#define G_000420_OV0_SOFT_RESET(x) (((x) >> 31) & 0x1)
519#define C_000420_OV0_SOFT_RESET 0x7FFFFFFF
520#define R_00070C_CP_RB_RPTR_ADDR 0x00070C
521#define S_00070C_RB_RPTR_SWAP(x) (((x) & 0x3) << 0)
522#define G_00070C_RB_RPTR_SWAP(x) (((x) >> 0) & 0x3)
523#define C_00070C_RB_RPTR_SWAP 0xFFFFFFFC
524#define S_00070C_RB_RPTR_ADDR(x) (((x) & 0x3FFFFFFF) << 2)
525#define G_00070C_RB_RPTR_ADDR(x) (((x) >> 2) & 0x3FFFFFFF)
526#define C_00070C_RB_RPTR_ADDR 0x00000003
527#define R_000740_CP_CSQ_CNTL 0x000740
528#define S_000740_CSQ_CNT_PRIMARY(x) (((x) & 0xFF) << 0)
529#define G_000740_CSQ_CNT_PRIMARY(x) (((x) >> 0) & 0xFF)
530#define C_000740_CSQ_CNT_PRIMARY 0xFFFFFF00
531#define S_000740_CSQ_CNT_INDIRECT(x) (((x) & 0xFF) << 8)
532#define G_000740_CSQ_CNT_INDIRECT(x) (((x) >> 8) & 0xFF)
533#define C_000740_CSQ_CNT_INDIRECT 0xFFFF00FF
534#define S_000740_CSQ_MODE(x) (((x) & 0xF) << 28)
535#define G_000740_CSQ_MODE(x) (((x) >> 28) & 0xF)
536#define C_000740_CSQ_MODE 0x0FFFFFFF
537#define R_000770_SCRATCH_UMSK 0x000770
538#define S_000770_SCRATCH_UMSK(x) (((x) & 0x3F) << 0)
539#define G_000770_SCRATCH_UMSK(x) (((x) >> 0) & 0x3F)
540#define C_000770_SCRATCH_UMSK 0xFFFFFFC0
541#define S_000770_SCRATCH_SWAP(x) (((x) & 0x3) << 16)
542#define G_000770_SCRATCH_SWAP(x) (((x) >> 16) & 0x3)
543#define C_000770_SCRATCH_SWAP 0xFFFCFFFF
544#define R_000774_SCRATCH_ADDR 0x000774
545#define S_000774_SCRATCH_ADDR(x) (((x) & 0x7FFFFFF) << 5)
546#define G_000774_SCRATCH_ADDR(x) (((x) >> 5) & 0x7FFFFFF)
547#define C_000774_SCRATCH_ADDR 0x0000001F
77#define R_000E40_RBBM_STATUS 0x000E40 548#define R_000E40_RBBM_STATUS 0x000E40
78#define S_000E40_CMDFIFO_AVAIL(x) (((x) & 0x7F) << 0) 549#define S_000E40_CMDFIFO_AVAIL(x) (((x) & 0x7F) << 0)
79#define G_000E40_CMDFIFO_AVAIL(x) (((x) >> 0) & 0x7F) 550#define G_000E40_CMDFIFO_AVAIL(x) (((x) >> 0) & 0x7F)
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c
index 9c17b786982a..92f9cb74a7d2 100644
--- a/drivers/gpu/drm/radeon/r300.c
+++ b/drivers/gpu/drm/radeon/r300.c
@@ -1241,11 +1241,12 @@ static int r300_packet3_check(struct radeon_cs_parser *p,
1241int r300_cs_parse(struct radeon_cs_parser *p) 1241int r300_cs_parse(struct radeon_cs_parser *p)
1242{ 1242{
1243 struct radeon_cs_packet pkt; 1243 struct radeon_cs_packet pkt;
1244 struct r100_cs_track track; 1244 struct r100_cs_track *track;
1245 int r; 1245 int r;
1246 1246
1247 r100_cs_track_clear(p->rdev, &track); 1247 track = kzalloc(sizeof(*track), GFP_KERNEL);
1248 p->track = &track; 1248 r100_cs_track_clear(p->rdev, track);
1249 p->track = track;
1249 do { 1250 do {
1250 r = r100_cs_packet_parse(p, &pkt, p->idx); 1251 r = r100_cs_packet_parse(p, &pkt, p->idx);
1251 if (r) { 1252 if (r) {
@@ -1275,9 +1276,50 @@ int r300_cs_parse(struct radeon_cs_parser *p)
1275 return 0; 1276 return 0;
1276} 1277}
1277 1278
1278int r300_init(struct radeon_device *rdev) 1279void r300_set_reg_safe(struct radeon_device *rdev)
1279{ 1280{
1280 rdev->config.r300.reg_safe_bm = r300_reg_safe_bm; 1281 rdev->config.r300.reg_safe_bm = r300_reg_safe_bm;
1281 rdev->config.r300.reg_safe_bm_size = ARRAY_SIZE(r300_reg_safe_bm); 1282 rdev->config.r300.reg_safe_bm_size = ARRAY_SIZE(r300_reg_safe_bm);
1283}
1284
1285int r300_init(struct radeon_device *rdev)
1286{
1287 r300_set_reg_safe(rdev);
1282 return 0; 1288 return 0;
1283} 1289}
1290
1291void r300_mc_program(struct radeon_device *rdev)
1292{
1293 struct r100_mc_save save;
1294 int r;
1295
1296 r = r100_debugfs_mc_info_init(rdev);
1297 if (r) {
1298 dev_err(rdev->dev, "Failed to create r100_mc debugfs file.\n");
1299 }
1300
1301 /* Stops all mc clients */
1302 r100_mc_stop(rdev, &save);
1303 /* Shutdown PCI/PCIE GART */
1304 radeon_gart_disable(rdev);
1305 if (rdev->flags & RADEON_IS_AGP) {
1306 WREG32(R_00014C_MC_AGP_LOCATION,
1307 S_00014C_MC_AGP_START(rdev->mc.gtt_start >> 16) |
1308 S_00014C_MC_AGP_TOP(rdev->mc.gtt_end >> 16));
1309 WREG32(R_000170_AGP_BASE, lower_32_bits(rdev->mc.agp_base));
1310 WREG32(R_00015C_AGP_BASE_2,
1311 upper_32_bits(rdev->mc.agp_base) & 0xff);
1312 } else {
1313 WREG32(R_00014C_MC_AGP_LOCATION, 0x0FFFFFFF);
1314 WREG32(R_000170_AGP_BASE, 0);
1315 WREG32(R_00015C_AGP_BASE_2, 0);
1316 }
1317 /* Wait for mc idle */
1318 if (r300_mc_wait_for_idle(rdev))
1319 DRM_INFO("Failed to wait MC idle before programming MC.\n");
1320 /* Program MC, should be a 32bits limited address space */
1321 WREG32(R_000148_MC_FB_LOCATION,
1322 S_000148_MC_FB_START(rdev->mc.vram_start >> 16) |
1323 S_000148_MC_FB_TOP(rdev->mc.vram_end >> 16));
1324 r100_mc_resume(rdev, &save);
1325}
diff --git a/drivers/gpu/drm/radeon/r300d.h b/drivers/gpu/drm/radeon/r300d.h
index 63ec076f2cd4..d4fa3eb1074f 100644
--- a/drivers/gpu/drm/radeon/r300d.h
+++ b/drivers/gpu/drm/radeon/r300d.h
@@ -73,4 +73,29 @@
73#define CP_PACKET0_GET_ONE_REG_WR(h) (((h) >> 15) & 1) 73#define CP_PACKET0_GET_ONE_REG_WR(h) (((h) >> 15) & 1)
74#define CP_PACKET3_GET_OPCODE(h) (((h) >> 8) & 0xFF) 74#define CP_PACKET3_GET_OPCODE(h) (((h) >> 8) & 0xFF)
75 75
76/* Registers */
77#define R_000148_MC_FB_LOCATION 0x000148
78#define S_000148_MC_FB_START(x) (((x) & 0xFFFF) << 0)
79#define G_000148_MC_FB_START(x) (((x) >> 0) & 0xFFFF)
80#define C_000148_MC_FB_START 0xFFFF0000
81#define S_000148_MC_FB_TOP(x) (((x) & 0xFFFF) << 16)
82#define G_000148_MC_FB_TOP(x) (((x) >> 16) & 0xFFFF)
83#define C_000148_MC_FB_TOP 0x0000FFFF
84#define R_00014C_MC_AGP_LOCATION 0x00014C
85#define S_00014C_MC_AGP_START(x) (((x) & 0xFFFF) << 0)
86#define G_00014C_MC_AGP_START(x) (((x) >> 0) & 0xFFFF)
87#define C_00014C_MC_AGP_START 0xFFFF0000
88#define S_00014C_MC_AGP_TOP(x) (((x) & 0xFFFF) << 16)
89#define G_00014C_MC_AGP_TOP(x) (((x) >> 16) & 0xFFFF)
90#define C_00014C_MC_AGP_TOP 0x0000FFFF
91#define R_00015C_AGP_BASE_2 0x00015C
92#define S_00015C_AGP_BASE_ADDR_2(x) (((x) & 0xF) << 0)
93#define G_00015C_AGP_BASE_ADDR_2(x) (((x) >> 0) & 0xF)
94#define C_00015C_AGP_BASE_ADDR_2 0xFFFFFFF0
95#define R_000170_AGP_BASE 0x000170
96#define S_000170_AGP_BASE_ADDR(x) (((x) & 0xFFFFFFFF) << 0)
97#define G_000170_AGP_BASE_ADDR(x) (((x) >> 0) & 0xFFFFFFFF)
98#define C_000170_AGP_BASE_ADDR 0x00000000
99
100
76#endif 101#endif
diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c
index 551d6996d3f2..e57b9ba4aaf3 100644
--- a/drivers/gpu/drm/radeon/r420.c
+++ b/drivers/gpu/drm/radeon/r420.c
@@ -29,48 +29,13 @@
29#include "drmP.h" 29#include "drmP.h"
30#include "radeon_reg.h" 30#include "radeon_reg.h"
31#include "radeon.h" 31#include "radeon.h"
32#include "atom.h"
32#include "r420d.h" 33#include "r420d.h"
33 34
34/* r420,r423,rv410 depends on : */
35void r100_pci_gart_disable(struct radeon_device *rdev);
36void r100_hdp_reset(struct radeon_device *rdev);
37void r100_mc_setup(struct radeon_device *rdev);
38int r100_gui_wait_for_idle(struct radeon_device *rdev);
39void r100_mc_disable_clients(struct radeon_device *rdev);
40void r300_vram_info(struct radeon_device *rdev);
41int r300_mc_wait_for_idle(struct radeon_device *rdev);
42int rv370_pcie_gart_enable(struct radeon_device *rdev);
43void rv370_pcie_gart_disable(struct radeon_device *rdev);
44
45/* This files gather functions specifics to :
46 * r420,r423,rv410
47 *
48 * Some of these functions might be used by newer ASICs.
49 */
50void r420_gpu_init(struct radeon_device *rdev);
51int r420_debugfs_pipes_info_init(struct radeon_device *rdev);
52
53
54/*
55 * MC
56 */
57int r420_mc_init(struct radeon_device *rdev) 35int r420_mc_init(struct radeon_device *rdev)
58{ 36{
59 int r; 37 int r;
60 38
61 if (r100_debugfs_rbbm_init(rdev)) {
62 DRM_ERROR("Failed to register debugfs file for RBBM !\n");
63 }
64 if (r420_debugfs_pipes_info_init(rdev)) {
65 DRM_ERROR("Failed to register debugfs file for pipes !\n");
66 }
67
68 r420_gpu_init(rdev);
69 r100_pci_gart_disable(rdev);
70 if (rdev->flags & RADEON_IS_PCIE) {
71 rv370_pcie_gart_disable(rdev);
72 }
73
74 /* Setup GPU memory space */ 39 /* Setup GPU memory space */
75 rdev->mc.vram_location = 0xFFFFFFFFUL; 40 rdev->mc.vram_location = 0xFFFFFFFFUL;
76 rdev->mc.gtt_location = 0xFFFFFFFFUL; 41 rdev->mc.gtt_location = 0xFFFFFFFFUL;
@@ -88,38 +53,9 @@ int r420_mc_init(struct radeon_device *rdev)
88 if (r) { 53 if (r) {
89 return r; 54 return r;
90 } 55 }
91
92 /* Program GPU memory space */
93 r100_mc_disable_clients(rdev);
94 if (r300_mc_wait_for_idle(rdev)) {
95 printk(KERN_WARNING "Failed to wait MC idle while "
96 "programming pipes. Bad things might happen.\n");
97 }
98 r100_mc_setup(rdev);
99 return 0; 56 return 0;
100} 57}
101 58
102void r420_mc_fini(struct radeon_device *rdev)
103{
104 if (rdev->flags & RADEON_IS_PCIE) {
105 rv370_pcie_gart_disable(rdev);
106 radeon_gart_table_vram_free(rdev);
107 } else {
108 r100_pci_gart_disable(rdev);
109 radeon_gart_table_ram_free(rdev);
110 }
111 radeon_gart_fini(rdev);
112}
113
114
115/*
116 * Global GPU functions
117 */
118void r420_errata(struct radeon_device *rdev)
119{
120 rdev->pll_errata = 0;
121}
122
123void r420_pipes_init(struct radeon_device *rdev) 59void r420_pipes_init(struct radeon_device *rdev)
124{ 60{
125 unsigned tmp; 61 unsigned tmp;
@@ -185,25 +121,216 @@ void r420_pipes_init(struct radeon_device *rdev)
185 rdev->num_gb_pipes, rdev->num_z_pipes); 121 rdev->num_gb_pipes, rdev->num_z_pipes);
186} 122}
187 123
188void r420_gpu_init(struct radeon_device *rdev) 124u32 r420_mc_rreg(struct radeon_device *rdev, u32 reg)
189{ 125{
190 r100_hdp_reset(rdev); 126 u32 r;
127
128 WREG32(R_0001F8_MC_IND_INDEX, S_0001F8_MC_IND_ADDR(reg));
129 r = RREG32(R_0001FC_MC_IND_DATA);
130 return r;
131}
132
133void r420_mc_wreg(struct radeon_device *rdev, u32 reg, u32 v)
134{
135 WREG32(R_0001F8_MC_IND_INDEX, S_0001F8_MC_IND_ADDR(reg) |
136 S_0001F8_MC_IND_WR_EN(1));
137 WREG32(R_0001FC_MC_IND_DATA, v);
138}
139
140static void r420_debugfs(struct radeon_device *rdev)
141{
142 if (r100_debugfs_rbbm_init(rdev)) {
143 DRM_ERROR("Failed to register debugfs file for RBBM !\n");
144 }
145 if (r420_debugfs_pipes_info_init(rdev)) {
146 DRM_ERROR("Failed to register debugfs file for pipes !\n");
147 }
148}
149
150static void r420_clock_resume(struct radeon_device *rdev)
151{
152 u32 sclk_cntl;
153 sclk_cntl = RREG32_PLL(R_00000D_SCLK_CNTL);
154 sclk_cntl |= S_00000D_FORCE_CP(1) | S_00000D_FORCE_VIP(1);
155 if (rdev->family == CHIP_R420)
156 sclk_cntl |= S_00000D_FORCE_PX(1) | S_00000D_FORCE_TX(1);
157 WREG32_PLL(R_00000D_SCLK_CNTL, sclk_cntl);
158}
159
160int r420_resume(struct radeon_device *rdev)
161{
162 int r;
163
164 /* Resume clock before doing reset */
165 r420_clock_resume(rdev);
166 /* Reset gpu before posting otherwise ATOM will enter infinite loop */
167 if (radeon_gpu_reset(rdev)) {
168 dev_warn(rdev->dev, "GPU reset failed ! (0xE40=0x%08X, 0x7C0=0x%08X)\n",
169 RREG32(R_000E40_RBBM_STATUS),
170 RREG32(R_0007C0_CP_STAT));
171 }
172 /* check if cards are posted or not */
173 if (rdev->is_atom_bios) {
174 atom_asic_init(rdev->mode_info.atom_context);
175 } else {
176 radeon_combios_asic_init(rdev->ddev);
177 }
178 /* Resume clock after posting */
179 r420_clock_resume(rdev);
180 r300_mc_program(rdev);
181 /* Initialize GART (initialize after TTM so we can allocate
182 * memory through TTM but finalize after TTM) */
183 r = radeon_gart_enable(rdev);
184 if (r) {
185 dev_err(rdev->dev, "failled initializing GART (%d).\n", r);
186 return r;
187 }
191 r420_pipes_init(rdev); 188 r420_pipes_init(rdev);
192 if (r300_mc_wait_for_idle(rdev)) { 189 /* Enable IRQ */
193 printk(KERN_WARNING "Failed to wait MC idle while " 190 rdev->irq.sw_int = true;
194 "programming pipes. Bad things might happen.\n"); 191 r100_irq_set(rdev);
192 /* 1M ring buffer */
193 r = r100_cp_init(rdev, 1024 * 1024);
194 if (r) {
195 dev_err(rdev->dev, "failled initializing CP (%d).\n", r);
196 return r;
197 }
198 r = r100_wb_init(rdev);
199 if (r) {
200 dev_err(rdev->dev, "failled initializing WB (%d).\n", r);
195 } 201 }
202 r = r100_ib_init(rdev);
203 if (r) {
204 dev_err(rdev->dev, "failled initializing IB (%d).\n", r);
205 return r;
206 }
207 return 0;
196} 208}
197 209
210int r420_suspend(struct radeon_device *rdev)
211{
212 r100_cp_disable(rdev);
213 r100_wb_disable(rdev);
214 r100_irq_disable(rdev);
215 radeon_gart_disable(rdev);
216 return 0;
217}
198 218
199/* 219void r420_fini(struct radeon_device *rdev)
200 * r420,r423,rv410 VRAM info
201 */
202void r420_vram_info(struct radeon_device *rdev)
203{ 220{
204 r300_vram_info(rdev); 221 r100_cp_fini(rdev);
222 r100_wb_fini(rdev);
223 r100_ib_fini(rdev);
224 radeon_gem_fini(rdev);
225 if (rdev->flags & RADEON_IS_PCIE) {
226 rv370_pcie_gart_disable(rdev);
227 radeon_gart_table_vram_free(rdev);
228 } else {
229 r100_pci_gart_disable(rdev);
230 radeon_gart_table_ram_free(rdev);
231 }
232 radeon_gart_fini(rdev);
233 radeon_agp_fini(rdev);
234 radeon_irq_kms_fini(rdev);
235 radeon_fence_driver_fini(rdev);
236 radeon_object_fini(rdev);
237 if (rdev->is_atom_bios) {
238 radeon_atombios_fini(rdev);
239 } else {
240 radeon_combios_fini(rdev);
241 }
242 kfree(rdev->bios);
243 rdev->bios = NULL;
205} 244}
206 245
246int r420_init(struct radeon_device *rdev)
247{
248 int r;
249
250 rdev->new_init_path = true;
251 /* Initialize scratch registers */
252 radeon_scratch_init(rdev);
253 /* Initialize surface registers */
254 radeon_surface_init(rdev);
255 /* TODO: disable VGA need to use VGA request */
256 /* BIOS*/
257 if (!radeon_get_bios(rdev)) {
258 if (ASIC_IS_AVIVO(rdev))
259 return -EINVAL;
260 }
261 if (rdev->is_atom_bios) {
262 r = radeon_atombios_init(rdev);
263 if (r) {
264 return r;
265 }
266 } else {
267 r = radeon_combios_init(rdev);
268 if (r) {
269 return r;
270 }
271 }
272 /* Reset gpu before posting otherwise ATOM will enter infinite loop */
273 if (radeon_gpu_reset(rdev)) {
274 dev_warn(rdev->dev,
275 "GPU reset failed ! (0xE40=0x%08X, 0x7C0=0x%08X)\n",
276 RREG32(R_000E40_RBBM_STATUS),
277 RREG32(R_0007C0_CP_STAT));
278 }
279 /* check if cards are posted or not */
280 if (!radeon_card_posted(rdev) && rdev->bios) {
281 DRM_INFO("GPU not posted. posting now...\n");
282 if (rdev->is_atom_bios) {
283 atom_asic_init(rdev->mode_info.atom_context);
284 } else {
285 radeon_combios_asic_init(rdev->ddev);
286 }
287 }
288 /* Initialize clocks */
289 radeon_get_clock_info(rdev->ddev);
290 /* Get vram informations */
291 r300_vram_info(rdev);
292 /* Initialize memory controller (also test AGP) */
293 r = r420_mc_init(rdev);
294 if (r) {
295 return r;
296 }
297 r420_debugfs(rdev);
298 /* Fence driver */
299 r = radeon_fence_driver_init(rdev);
300 if (r) {
301 return r;
302 }
303 r = radeon_irq_kms_init(rdev);
304 if (r) {
305 return r;
306 }
307 /* Memory manager */
308 r = radeon_object_init(rdev);
309 if (r) {
310 return r;
311 }
312 r300_set_reg_safe(rdev);
313 r = r420_resume(rdev);
314 if (r) {
315 /* Somethings want wront with the accel init stop accel */
316 dev_err(rdev->dev, "Disabling GPU acceleration\n");
317 r420_suspend(rdev);
318 r100_cp_fini(rdev);
319 r100_wb_fini(rdev);
320 r100_ib_fini(rdev);
321 if (rdev->flags & RADEON_IS_PCIE) {
322 rv370_pcie_gart_disable(rdev);
323 radeon_gart_table_vram_free(rdev);
324 } else {
325 r100_pci_gart_disable(rdev);
326 radeon_gart_table_ram_free(rdev);
327 }
328 radeon_gart_fini(rdev);
329 radeon_agp_fini(rdev);
330 radeon_irq_kms_fini(rdev);
331 }
332 return 0;
333}
207 334
208/* 335/*
209 * Debugfs info 336 * Debugfs info
@@ -238,19 +365,3 @@ int r420_debugfs_pipes_info_init(struct radeon_device *rdev)
238 return 0; 365 return 0;
239#endif 366#endif
240} 367}
241
242u32 r420_mc_rreg(struct radeon_device *rdev, u32 reg)
243{
244 u32 r;
245
246 WREG32(R_0001F8_MC_IND_INDEX, S_0001F8_MC_IND_ADDR(reg));
247 r = RREG32(R_0001FC_MC_IND_DATA);
248 return r;
249}
250
251void r420_mc_wreg(struct radeon_device *rdev, u32 reg, u32 v)
252{
253 WREG32(R_0001F8_MC_IND_INDEX, S_0001F8_MC_IND_ADDR(reg) |
254 S_0001F8_MC_IND_WR_EN(1));
255 WREG32(R_0001FC_MC_IND_DATA, v);
256}
diff --git a/drivers/gpu/drm/radeon/r420d.h b/drivers/gpu/drm/radeon/r420d.h
index 8b946c1883ba..a48a7db1e2aa 100644
--- a/drivers/gpu/drm/radeon/r420d.h
+++ b/drivers/gpu/drm/radeon/r420d.h
@@ -39,5 +39,211 @@
39#define S_0001FC_MC_IND_DATA(x) (((x) & 0xFFFFFFFF) << 0) 39#define S_0001FC_MC_IND_DATA(x) (((x) & 0xFFFFFFFF) << 0)
40#define G_0001FC_MC_IND_DATA(x) (((x) >> 0) & 0xFFFFFFFF) 40#define G_0001FC_MC_IND_DATA(x) (((x) >> 0) & 0xFFFFFFFF)
41#define C_0001FC_MC_IND_DATA 0x00000000 41#define C_0001FC_MC_IND_DATA 0x00000000
42#define R_0007C0_CP_STAT 0x0007C0
43#define S_0007C0_MRU_BUSY(x) (((x) & 0x1) << 0)
44#define G_0007C0_MRU_BUSY(x) (((x) >> 0) & 0x1)
45#define C_0007C0_MRU_BUSY 0xFFFFFFFE
46#define S_0007C0_MWU_BUSY(x) (((x) & 0x1) << 1)
47#define G_0007C0_MWU_BUSY(x) (((x) >> 1) & 0x1)
48#define C_0007C0_MWU_BUSY 0xFFFFFFFD
49#define S_0007C0_RSIU_BUSY(x) (((x) & 0x1) << 2)
50#define G_0007C0_RSIU_BUSY(x) (((x) >> 2) & 0x1)
51#define C_0007C0_RSIU_BUSY 0xFFFFFFFB
52#define S_0007C0_RCIU_BUSY(x) (((x) & 0x1) << 3)
53#define G_0007C0_RCIU_BUSY(x) (((x) >> 3) & 0x1)
54#define C_0007C0_RCIU_BUSY 0xFFFFFFF7
55#define S_0007C0_CSF_PRIMARY_BUSY(x) (((x) & 0x1) << 9)
56#define G_0007C0_CSF_PRIMARY_BUSY(x) (((x) >> 9) & 0x1)
57#define C_0007C0_CSF_PRIMARY_BUSY 0xFFFFFDFF
58#define S_0007C0_CSF_INDIRECT_BUSY(x) (((x) & 0x1) << 10)
59#define G_0007C0_CSF_INDIRECT_BUSY(x) (((x) >> 10) & 0x1)
60#define C_0007C0_CSF_INDIRECT_BUSY 0xFFFFFBFF
61#define S_0007C0_CSQ_PRIMARY_BUSY(x) (((x) & 0x1) << 11)
62#define G_0007C0_CSQ_PRIMARY_BUSY(x) (((x) >> 11) & 0x1)
63#define C_0007C0_CSQ_PRIMARY_BUSY 0xFFFFF7FF
64#define S_0007C0_CSQ_INDIRECT_BUSY(x) (((x) & 0x1) << 12)
65#define G_0007C0_CSQ_INDIRECT_BUSY(x) (((x) >> 12) & 0x1)
66#define C_0007C0_CSQ_INDIRECT_BUSY 0xFFFFEFFF
67#define S_0007C0_CSI_BUSY(x) (((x) & 0x1) << 13)
68#define G_0007C0_CSI_BUSY(x) (((x) >> 13) & 0x1)
69#define C_0007C0_CSI_BUSY 0xFFFFDFFF
70#define S_0007C0_CSF_INDIRECT2_BUSY(x) (((x) & 0x1) << 14)
71#define G_0007C0_CSF_INDIRECT2_BUSY(x) (((x) >> 14) & 0x1)
72#define C_0007C0_CSF_INDIRECT2_BUSY 0xFFFFBFFF
73#define S_0007C0_CSQ_INDIRECT2_BUSY(x) (((x) & 0x1) << 15)
74#define G_0007C0_CSQ_INDIRECT2_BUSY(x) (((x) >> 15) & 0x1)
75#define C_0007C0_CSQ_INDIRECT2_BUSY 0xFFFF7FFF
76#define S_0007C0_GUIDMA_BUSY(x) (((x) & 0x1) << 28)
77#define G_0007C0_GUIDMA_BUSY(x) (((x) >> 28) & 0x1)
78#define C_0007C0_GUIDMA_BUSY 0xEFFFFFFF
79#define S_0007C0_VIDDMA_BUSY(x) (((x) & 0x1) << 29)
80#define G_0007C0_VIDDMA_BUSY(x) (((x) >> 29) & 0x1)
81#define C_0007C0_VIDDMA_BUSY 0xDFFFFFFF
82#define S_0007C0_CMDSTRM_BUSY(x) (((x) & 0x1) << 30)
83#define G_0007C0_CMDSTRM_BUSY(x) (((x) >> 30) & 0x1)
84#define C_0007C0_CMDSTRM_BUSY 0xBFFFFFFF
85#define S_0007C0_CP_BUSY(x) (((x) & 0x1) << 31)
86#define G_0007C0_CP_BUSY(x) (((x) >> 31) & 0x1)
87#define C_0007C0_CP_BUSY 0x7FFFFFFF
88#define R_000E40_RBBM_STATUS 0x000E40
89#define S_000E40_CMDFIFO_AVAIL(x) (((x) & 0x7F) << 0)
90#define G_000E40_CMDFIFO_AVAIL(x) (((x) >> 0) & 0x7F)
91#define C_000E40_CMDFIFO_AVAIL 0xFFFFFF80
92#define S_000E40_HIRQ_ON_RBB(x) (((x) & 0x1) << 8)
93#define G_000E40_HIRQ_ON_RBB(x) (((x) >> 8) & 0x1)
94#define C_000E40_HIRQ_ON_RBB 0xFFFFFEFF
95#define S_000E40_CPRQ_ON_RBB(x) (((x) & 0x1) << 9)
96#define G_000E40_CPRQ_ON_RBB(x) (((x) >> 9) & 0x1)
97#define C_000E40_CPRQ_ON_RBB 0xFFFFFDFF
98#define S_000E40_CFRQ_ON_RBB(x) (((x) & 0x1) << 10)
99#define G_000E40_CFRQ_ON_RBB(x) (((x) >> 10) & 0x1)
100#define C_000E40_CFRQ_ON_RBB 0xFFFFFBFF
101#define S_000E40_HIRQ_IN_RTBUF(x) (((x) & 0x1) << 11)
102#define G_000E40_HIRQ_IN_RTBUF(x) (((x) >> 11) & 0x1)
103#define C_000E40_HIRQ_IN_RTBUF 0xFFFFF7FF
104#define S_000E40_CPRQ_IN_RTBUF(x) (((x) & 0x1) << 12)
105#define G_000E40_CPRQ_IN_RTBUF(x) (((x) >> 12) & 0x1)
106#define C_000E40_CPRQ_IN_RTBUF 0xFFFFEFFF
107#define S_000E40_CFRQ_IN_RTBUF(x) (((x) & 0x1) << 13)
108#define G_000E40_CFRQ_IN_RTBUF(x) (((x) >> 13) & 0x1)
109#define C_000E40_CFRQ_IN_RTBUF 0xFFFFDFFF
110#define S_000E40_CF_PIPE_BUSY(x) (((x) & 0x1) << 14)
111#define G_000E40_CF_PIPE_BUSY(x) (((x) >> 14) & 0x1)
112#define C_000E40_CF_PIPE_BUSY 0xFFFFBFFF
113#define S_000E40_ENG_EV_BUSY(x) (((x) & 0x1) << 15)
114#define G_000E40_ENG_EV_BUSY(x) (((x) >> 15) & 0x1)
115#define C_000E40_ENG_EV_BUSY 0xFFFF7FFF
116#define S_000E40_CP_CMDSTRM_BUSY(x) (((x) & 0x1) << 16)
117#define G_000E40_CP_CMDSTRM_BUSY(x) (((x) >> 16) & 0x1)
118#define C_000E40_CP_CMDSTRM_BUSY 0xFFFEFFFF
119#define S_000E40_E2_BUSY(x) (((x) & 0x1) << 17)
120#define G_000E40_E2_BUSY(x) (((x) >> 17) & 0x1)
121#define C_000E40_E2_BUSY 0xFFFDFFFF
122#define S_000E40_RB2D_BUSY(x) (((x) & 0x1) << 18)
123#define G_000E40_RB2D_BUSY(x) (((x) >> 18) & 0x1)
124#define C_000E40_RB2D_BUSY 0xFFFBFFFF
125#define S_000E40_RB3D_BUSY(x) (((x) & 0x1) << 19)
126#define G_000E40_RB3D_BUSY(x) (((x) >> 19) & 0x1)
127#define C_000E40_RB3D_BUSY 0xFFF7FFFF
128#define S_000E40_VAP_BUSY(x) (((x) & 0x1) << 20)
129#define G_000E40_VAP_BUSY(x) (((x) >> 20) & 0x1)
130#define C_000E40_VAP_BUSY 0xFFEFFFFF
131#define S_000E40_RE_BUSY(x) (((x) & 0x1) << 21)
132#define G_000E40_RE_BUSY(x) (((x) >> 21) & 0x1)
133#define C_000E40_RE_BUSY 0xFFDFFFFF
134#define S_000E40_TAM_BUSY(x) (((x) & 0x1) << 22)
135#define G_000E40_TAM_BUSY(x) (((x) >> 22) & 0x1)
136#define C_000E40_TAM_BUSY 0xFFBFFFFF
137#define S_000E40_TDM_BUSY(x) (((x) & 0x1) << 23)
138#define G_000E40_TDM_BUSY(x) (((x) >> 23) & 0x1)
139#define C_000E40_TDM_BUSY 0xFF7FFFFF
140#define S_000E40_PB_BUSY(x) (((x) & 0x1) << 24)
141#define G_000E40_PB_BUSY(x) (((x) >> 24) & 0x1)
142#define C_000E40_PB_BUSY 0xFEFFFFFF
143#define S_000E40_TIM_BUSY(x) (((x) & 0x1) << 25)
144#define G_000E40_TIM_BUSY(x) (((x) >> 25) & 0x1)
145#define C_000E40_TIM_BUSY 0xFDFFFFFF
146#define S_000E40_GA_BUSY(x) (((x) & 0x1) << 26)
147#define G_000E40_GA_BUSY(x) (((x) >> 26) & 0x1)
148#define C_000E40_GA_BUSY 0xFBFFFFFF
149#define S_000E40_CBA2D_BUSY(x) (((x) & 0x1) << 27)
150#define G_000E40_CBA2D_BUSY(x) (((x) >> 27) & 0x1)
151#define C_000E40_CBA2D_BUSY 0xF7FFFFFF
152#define S_000E40_GUI_ACTIVE(x) (((x) & 0x1) << 31)
153#define G_000E40_GUI_ACTIVE(x) (((x) >> 31) & 0x1)
154#define C_000E40_GUI_ACTIVE 0x7FFFFFFF
155
156/* CLK registers */
157#define R_00000D_SCLK_CNTL 0x00000D
158#define S_00000D_SCLK_SRC_SEL(x) (((x) & 0x7) << 0)
159#define G_00000D_SCLK_SRC_SEL(x) (((x) >> 0) & 0x7)
160#define C_00000D_SCLK_SRC_SEL 0xFFFFFFF8
161#define S_00000D_CP_MAX_DYN_STOP_LAT(x) (((x) & 0x1) << 3)
162#define G_00000D_CP_MAX_DYN_STOP_LAT(x) (((x) >> 3) & 0x1)
163#define C_00000D_CP_MAX_DYN_STOP_LAT 0xFFFFFFF7
164#define S_00000D_HDP_MAX_DYN_STOP_LAT(x) (((x) & 0x1) << 4)
165#define G_00000D_HDP_MAX_DYN_STOP_LAT(x) (((x) >> 4) & 0x1)
166#define C_00000D_HDP_MAX_DYN_STOP_LAT 0xFFFFFFEF
167#define S_00000D_TV_MAX_DYN_STOP_LAT(x) (((x) & 0x1) << 5)
168#define G_00000D_TV_MAX_DYN_STOP_LAT(x) (((x) >> 5) & 0x1)
169#define C_00000D_TV_MAX_DYN_STOP_LAT 0xFFFFFFDF
170#define S_00000D_E2_MAX_DYN_STOP_LAT(x) (((x) & 0x1) << 6)
171#define G_00000D_E2_MAX_DYN_STOP_LAT(x) (((x) >> 6) & 0x1)
172#define C_00000D_E2_MAX_DYN_STOP_LAT 0xFFFFFFBF
173#define S_00000D_SE_MAX_DYN_STOP_LAT(x) (((x) & 0x1) << 7)
174#define G_00000D_SE_MAX_DYN_STOP_LAT(x) (((x) >> 7) & 0x1)
175#define C_00000D_SE_MAX_DYN_STOP_LAT 0xFFFFFF7F
176#define S_00000D_IDCT_MAX_DYN_STOP_LAT(x) (((x) & 0x1) << 8)
177#define G_00000D_IDCT_MAX_DYN_STOP_LAT(x) (((x) >> 8) & 0x1)
178#define C_00000D_IDCT_MAX_DYN_STOP_LAT 0xFFFFFEFF
179#define S_00000D_VIP_MAX_DYN_STOP_LAT(x) (((x) & 0x1) << 9)
180#define G_00000D_VIP_MAX_DYN_STOP_LAT(x) (((x) >> 9) & 0x1)
181#define C_00000D_VIP_MAX_DYN_STOP_LAT 0xFFFFFDFF
182#define S_00000D_RE_MAX_DYN_STOP_LAT(x) (((x) & 0x1) << 10)
183#define G_00000D_RE_MAX_DYN_STOP_LAT(x) (((x) >> 10) & 0x1)
184#define C_00000D_RE_MAX_DYN_STOP_LAT 0xFFFFFBFF
185#define S_00000D_PB_MAX_DYN_STOP_LAT(x) (((x) & 0x1) << 11)
186#define G_00000D_PB_MAX_DYN_STOP_LAT(x) (((x) >> 11) & 0x1)
187#define C_00000D_PB_MAX_DYN_STOP_LAT 0xFFFFF7FF
188#define S_00000D_TAM_MAX_DYN_STOP_LAT(x) (((x) & 0x1) << 12)
189#define G_00000D_TAM_MAX_DYN_STOP_LAT(x) (((x) >> 12) & 0x1)
190#define C_00000D_TAM_MAX_DYN_STOP_LAT 0xFFFFEFFF
191#define S_00000D_TDM_MAX_DYN_STOP_LAT(x) (((x) & 0x1) << 13)
192#define G_00000D_TDM_MAX_DYN_STOP_LAT(x) (((x) >> 13) & 0x1)
193#define C_00000D_TDM_MAX_DYN_STOP_LAT 0xFFFFDFFF
194#define S_00000D_RB_MAX_DYN_STOP_LAT(x) (((x) & 0x1) << 14)
195#define G_00000D_RB_MAX_DYN_STOP_LAT(x) (((x) >> 14) & 0x1)
196#define C_00000D_RB_MAX_DYN_STOP_LAT 0xFFFFBFFF
197#define S_00000D_FORCE_DISP2(x) (((x) & 0x1) << 15)
198#define G_00000D_FORCE_DISP2(x) (((x) >> 15) & 0x1)
199#define C_00000D_FORCE_DISP2 0xFFFF7FFF
200#define S_00000D_FORCE_CP(x) (((x) & 0x1) << 16)
201#define G_00000D_FORCE_CP(x) (((x) >> 16) & 0x1)
202#define C_00000D_FORCE_CP 0xFFFEFFFF
203#define S_00000D_FORCE_HDP(x) (((x) & 0x1) << 17)
204#define G_00000D_FORCE_HDP(x) (((x) >> 17) & 0x1)
205#define C_00000D_FORCE_HDP 0xFFFDFFFF
206#define S_00000D_FORCE_DISP1(x) (((x) & 0x1) << 18)
207#define G_00000D_FORCE_DISP1(x) (((x) >> 18) & 0x1)
208#define C_00000D_FORCE_DISP1 0xFFFBFFFF
209#define S_00000D_FORCE_TOP(x) (((x) & 0x1) << 19)
210#define G_00000D_FORCE_TOP(x) (((x) >> 19) & 0x1)
211#define C_00000D_FORCE_TOP 0xFFF7FFFF
212#define S_00000D_FORCE_E2(x) (((x) & 0x1) << 20)
213#define G_00000D_FORCE_E2(x) (((x) >> 20) & 0x1)
214#define C_00000D_FORCE_E2 0xFFEFFFFF
215#define S_00000D_FORCE_SE(x) (((x) & 0x1) << 21)
216#define G_00000D_FORCE_SE(x) (((x) >> 21) & 0x1)
217#define C_00000D_FORCE_SE 0xFFDFFFFF
218#define S_00000D_FORCE_IDCT(x) (((x) & 0x1) << 22)
219#define G_00000D_FORCE_IDCT(x) (((x) >> 22) & 0x1)
220#define C_00000D_FORCE_IDCT 0xFFBFFFFF
221#define S_00000D_FORCE_VIP(x) (((x) & 0x1) << 23)
222#define G_00000D_FORCE_VIP(x) (((x) >> 23) & 0x1)
223#define C_00000D_FORCE_VIP 0xFF7FFFFF
224#define S_00000D_FORCE_RE(x) (((x) & 0x1) << 24)
225#define G_00000D_FORCE_RE(x) (((x) >> 24) & 0x1)
226#define C_00000D_FORCE_RE 0xFEFFFFFF
227#define S_00000D_FORCE_PB(x) (((x) & 0x1) << 25)
228#define G_00000D_FORCE_PB(x) (((x) >> 25) & 0x1)
229#define C_00000D_FORCE_PB 0xFDFFFFFF
230#define S_00000D_FORCE_PX(x) (((x) & 0x1) << 26)
231#define G_00000D_FORCE_PX(x) (((x) >> 26) & 0x1)
232#define C_00000D_FORCE_PX 0xFBFFFFFF
233#define S_00000D_FORCE_TX(x) (((x) & 0x1) << 27)
234#define G_00000D_FORCE_TX(x) (((x) >> 27) & 0x1)
235#define C_00000D_FORCE_TX 0xF7FFFFFF
236#define S_00000D_FORCE_RB(x) (((x) & 0x1) << 28)
237#define G_00000D_FORCE_RB(x) (((x) >> 28) & 0x1)
238#define C_00000D_FORCE_RB 0xEFFFFFFF
239#define S_00000D_FORCE_TV_SCLK(x) (((x) & 0x1) << 29)
240#define G_00000D_FORCE_TV_SCLK(x) (((x) >> 29) & 0x1)
241#define C_00000D_FORCE_TV_SCLK 0xDFFFFFFF
242#define S_00000D_FORCE_SUBPIC(x) (((x) & 0x1) << 30)
243#define G_00000D_FORCE_SUBPIC(x) (((x) >> 30) & 0x1)
244#define C_00000D_FORCE_SUBPIC 0xBFFFFFFF
245#define S_00000D_FORCE_OV0(x) (((x) & 0x1) << 31)
246#define G_00000D_FORCE_OV0(x) (((x) >> 31) & 0x1)
247#define C_00000D_FORCE_OV0 0x7FFFFFFF
42 248
43#endif 249#endif
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 23ede0e4783e..e314756dacc3 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -690,6 +690,7 @@ typedef uint32_t (*radeon_rreg_t)(struct radeon_device*, uint32_t);
690typedef void (*radeon_wreg_t)(struct radeon_device*, uint32_t, uint32_t); 690typedef void (*radeon_wreg_t)(struct radeon_device*, uint32_t, uint32_t);
691 691
692struct radeon_device { 692struct radeon_device {
693 struct device *dev;
693 struct drm_device *ddev; 694 struct drm_device *ddev;
694 struct pci_dev *pdev; 695 struct pci_dev *pdev;
695 /* ASIC */ 696 /* ASIC */
@@ -936,16 +937,45 @@ static inline void radeon_ring_write(struct radeon_device *rdev, uint32_t v)
936/* Common functions */ 937/* Common functions */
937int radeon_modeset_init(struct radeon_device *rdev); 938int radeon_modeset_init(struct radeon_device *rdev);
938void radeon_modeset_fini(struct radeon_device *rdev); 939void radeon_modeset_fini(struct radeon_device *rdev);
940extern bool radeon_card_posted(struct radeon_device *rdev);
939 941
940/* r100,rv100,rs100,rv200,rs200,r200,rv250,rs300,rv280 */ 942/* r100,rv100,rs100,rv200,rs200,r200,rv250,rs300,rv280 */
941void r100_cp_disable(struct radeon_device *rdev); 943struct r100_mc_save {
944 u32 GENMO_WT;
945 u32 CRTC_EXT_CNTL;
946 u32 CRTC_GEN_CNTL;
947 u32 CRTC2_GEN_CNTL;
948 u32 CUR_OFFSET;
949 u32 CUR2_OFFSET;
950};
951extern void r100_cp_disable(struct radeon_device *rdev);
952extern int r100_cp_init(struct radeon_device *rdev, unsigned ring_size);
953extern void r100_cp_fini(struct radeon_device *rdev);
942void r100_pci_gart_tlb_flush(struct radeon_device *rdev); 954void r100_pci_gart_tlb_flush(struct radeon_device *rdev);
943int r100_pci_gart_enable(struct radeon_device *rdev); 955int r100_pci_gart_enable(struct radeon_device *rdev);
944void r100_pci_gart_disable(struct radeon_device *rdev); 956void r100_pci_gart_disable(struct radeon_device *rdev);
945int r100_pci_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr); 957int r100_pci_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr);
958extern int r100_debugfs_mc_info_init(struct radeon_device *rdev);
959extern int r100_gui_wait_for_idle(struct radeon_device *rdev);
960extern void r100_ib_fini(struct radeon_device *rdev);
961extern int r100_ib_init(struct radeon_device *rdev);
962extern void r100_irq_disable(struct radeon_device *rdev);
963extern int r100_irq_set(struct radeon_device *rdev);
964extern void r100_mc_stop(struct radeon_device *rdev, struct r100_mc_save *save);
965extern void r100_mc_resume(struct radeon_device *rdev, struct r100_mc_save *save);
966extern void r100_wb_disable(struct radeon_device *rdev);
967extern void r100_wb_fini(struct radeon_device *rdev);
968extern int r100_wb_init(struct radeon_device *rdev);
969
970/* r300,r350,rv350,rv370,rv380 */
971extern void r300_set_reg_safe(struct radeon_device *rdev);
972extern void r300_mc_program(struct radeon_device *rdev);
973extern void r300_vram_info(struct radeon_device *rdev);
974extern void rv370_pcie_gart_disable(struct radeon_device *rdev);
946 975
947/* r420,r423,rv410 */ 976/* r420,r423,rv410 */
948u32 r420_mc_rreg(struct radeon_device *rdev, u32 reg); 977u32 r420_mc_rreg(struct radeon_device *rdev, u32 reg);
949void r420_mc_wreg(struct radeon_device *rdev, u32 reg, u32 v); 978void r420_mc_wreg(struct radeon_device *rdev, u32 reg, u32 v);
979extern int r420_debugfs_pipes_info_init(struct radeon_device *rdev);
950 980
951#endif 981#endif
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h
index f9c8f9a041db..8f27be31e094 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.h
+++ b/drivers/gpu/drm/radeon/radeon_asic.h
@@ -189,31 +189,34 @@ static struct radeon_asic r300_asic = {
189/* 189/*
190 * r420,r423,rv410 190 * r420,r423,rv410
191 */ 191 */
192void r420_errata(struct radeon_device *rdev); 192extern int r420_init(struct radeon_device *rdev);
193void r420_vram_info(struct radeon_device *rdev); 193extern void r420_fini(struct radeon_device *rdev);
194int r420_mc_init(struct radeon_device *rdev); 194extern int r420_suspend(struct radeon_device *rdev);
195void r420_mc_fini(struct radeon_device *rdev); 195extern int r420_resume(struct radeon_device *rdev);
196static struct radeon_asic r420_asic = { 196static struct radeon_asic r420_asic = {
197 .init = &r300_init, 197 .init = &r420_init,
198 .errata = &r420_errata, 198 .fini = &r420_fini,
199 .vram_info = &r420_vram_info, 199 .suspend = &r420_suspend,
200 .resume = &r420_resume,
201 .errata = NULL,
202 .vram_info = NULL,
200 .gpu_reset = &r300_gpu_reset, 203 .gpu_reset = &r300_gpu_reset,
201 .mc_init = &r420_mc_init, 204 .mc_init = NULL,
202 .mc_fini = &r420_mc_fini, 205 .mc_fini = NULL,
203 .wb_init = &r100_wb_init, 206 .wb_init = NULL,
204 .wb_fini = &r100_wb_fini, 207 .wb_fini = NULL,
205 .gart_enable = &r300_gart_enable, 208 .gart_enable = &r300_gart_enable,
206 .gart_disable = &rv370_pcie_gart_disable, 209 .gart_disable = &rv370_pcie_gart_disable,
207 .gart_tlb_flush = &rv370_pcie_gart_tlb_flush, 210 .gart_tlb_flush = &rv370_pcie_gart_tlb_flush,
208 .gart_set_page = &rv370_pcie_gart_set_page, 211 .gart_set_page = &rv370_pcie_gart_set_page,
209 .cp_init = &r100_cp_init, 212 .cp_init = NULL,
210 .cp_fini = &r100_cp_fini, 213 .cp_fini = NULL,
211 .cp_disable = &r100_cp_disable, 214 .cp_disable = NULL,
212 .cp_commit = &r100_cp_commit, 215 .cp_commit = &r100_cp_commit,
213 .ring_start = &r300_ring_start, 216 .ring_start = &r300_ring_start,
214 .ring_test = &r100_ring_test, 217 .ring_test = &r100_ring_test,
215 .ring_ib_execute = &r100_ring_ib_execute, 218 .ring_ib_execute = &r100_ring_ib_execute,
216 .ib_test = &r100_ib_test, 219 .ib_test = NULL,
217 .irq_set = &r100_irq_set, 220 .irq_set = &r100_irq_set,
218 .irq_process = &r100_irq_process, 221 .irq_process = &r100_irq_process,
219 .get_vblank_counter = &r100_get_vblank_counter, 222 .get_vblank_counter = &r100_get_vblank_counter,
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 72f6262ea73b..633acf71400b 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -156,6 +156,10 @@ int radeon_mc_setup(struct radeon_device *rdev)
156 tmp = (tmp + rdev->mc.gtt_size - 1) & ~(rdev->mc.gtt_size - 1); 156 tmp = (tmp + rdev->mc.gtt_size - 1) & ~(rdev->mc.gtt_size - 1);
157 rdev->mc.gtt_location = tmp; 157 rdev->mc.gtt_location = tmp;
158 } 158 }
159 rdev->mc.vram_start = rdev->mc.vram_location;
160 rdev->mc.vram_end = rdev->mc.vram_location + rdev->mc.mc_vram_size - 1;
161 rdev->mc.gtt_start = rdev->mc.gtt_location;
162 rdev->mc.gtt_end = rdev->mc.gtt_location + rdev->mc.gtt_size - 1;
159 DRM_INFO("radeon: VRAM %uM\n", (unsigned)(rdev->mc.mc_vram_size >> 20)); 163 DRM_INFO("radeon: VRAM %uM\n", (unsigned)(rdev->mc.mc_vram_size >> 20));
160 DRM_INFO("radeon: VRAM from 0x%08X to 0x%08X\n", 164 DRM_INFO("radeon: VRAM from 0x%08X to 0x%08X\n",
161 (unsigned)rdev->mc.vram_location, 165 (unsigned)rdev->mc.vram_location,
@@ -171,7 +175,7 @@ int radeon_mc_setup(struct radeon_device *rdev)
171/* 175/*
172 * GPU helpers function. 176 * GPU helpers function.
173 */ 177 */
174static bool radeon_card_posted(struct radeon_device *rdev) 178bool radeon_card_posted(struct radeon_device *rdev)
175{ 179{
176 uint32_t reg; 180 uint32_t reg;
177 181
@@ -483,6 +487,7 @@ int radeon_device_init(struct radeon_device *rdev,
483 487
484 DRM_INFO("radeon: Initializing kernel modesetting.\n"); 488 DRM_INFO("radeon: Initializing kernel modesetting.\n");
485 rdev->shutdown = false; 489 rdev->shutdown = false;
490 rdev->dev = &pdev->dev;
486 rdev->ddev = ddev; 491 rdev->ddev = ddev;
487 rdev->pdev = pdev; 492 rdev->pdev = pdev;
488 rdev->flags = flags; 493 rdev->flags = flags;
@@ -497,6 +502,7 @@ int radeon_device_init(struct radeon_device *rdev,
497 mutex_init(&rdev->ib_pool.mutex); 502 mutex_init(&rdev->ib_pool.mutex);
498 mutex_init(&rdev->cp.mutex); 503 mutex_init(&rdev->cp.mutex);
499 rwlock_init(&rdev->fence_drv.lock); 504 rwlock_init(&rdev->fence_drv.lock);
505 INIT_LIST_HEAD(&rdev->gem.objects);
500 506
501 if (radeon_agpmode == -1) { 507 if (radeon_agpmode == -1) {
502 rdev->flags &= ~RADEON_IS_AGP; 508 rdev->flags &= ~RADEON_IS_AGP;
@@ -736,15 +742,14 @@ int radeon_suspend_kms(struct drm_device *dev, pm_message_t state)
736 if (!rdev->new_init_path) { 742 if (!rdev->new_init_path) {
737 radeon_cp_disable(rdev); 743 radeon_cp_disable(rdev);
738 radeon_gart_disable(rdev); 744 radeon_gart_disable(rdev);
745 rdev->irq.sw_int = false;
746 radeon_irq_set(rdev);
739 } else { 747 } else {
740 radeon_suspend(rdev); 748 radeon_suspend(rdev);
741 } 749 }
742 /* evict remaining vram memory */ 750 /* evict remaining vram memory */
743 radeon_object_evict_vram(rdev); 751 radeon_object_evict_vram(rdev);
744 752
745 rdev->irq.sw_int = false;
746 radeon_irq_set(rdev);
747
748 pci_save_state(dev->pdev); 753 pci_save_state(dev->pdev);
749 if (state.event == PM_EVENT_SUSPEND) { 754 if (state.event == PM_EVENT_SUSPEND) {
750 /* Shut down the device */ 755 /* Shut down the device */
@@ -771,10 +776,10 @@ int radeon_resume_kms(struct drm_device *dev)
771 } 776 }
772 pci_set_master(dev->pdev); 777 pci_set_master(dev->pdev);
773 /* Reset gpu before posting otherwise ATOM will enter infinite loop */ 778 /* Reset gpu before posting otherwise ATOM will enter infinite loop */
774 if (radeon_gpu_reset(rdev)) {
775 /* FIXME: what do we want to do here ? */
776 }
777 if (!rdev->new_init_path) { 779 if (!rdev->new_init_path) {
780 if (radeon_gpu_reset(rdev)) {
781 /* FIXME: what do we want to do here ? */
782 }
778 /* post card */ 783 /* post card */
779 if (rdev->is_atom_bios) { 784 if (rdev->is_atom_bios) {
780 atom_asic_init(rdev->mode_info.atom_context); 785 atom_asic_init(rdev->mode_info.atom_context);
diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c
index aa9837a6aa75..168a555d6fba 100644
--- a/drivers/gpu/drm/radeon/radeon_ring.c
+++ b/drivers/gpu/drm/radeon/radeon_ring.c
@@ -151,6 +151,8 @@ int radeon_ib_pool_init(struct radeon_device *rdev)
151 int i; 151 int i;
152 int r = 0; 152 int r = 0;
153 153
154 if (rdev->ib_pool.robj)
155 return 0;
154 /* Allocate 1M object buffer */ 156 /* Allocate 1M object buffer */
155 INIT_LIST_HEAD(&rdev->ib_pool.scheduled_ibs); 157 INIT_LIST_HEAD(&rdev->ib_pool.scheduled_ibs);
156 r = radeon_object_create(rdev, NULL, RADEON_IB_POOL_SIZE*64*1024, 158 r = radeon_object_create(rdev, NULL, RADEON_IB_POOL_SIZE*64*1024,