aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/drm')
-rw-r--r--drivers/char/drm/drm_pciids.h95
-rw-r--r--drivers/char/drm/r300_cmdbuf.c39
-rw-r--r--drivers/char/drm/radeon_cp.c135
-rw-r--r--drivers/char/drm/radeon_drm.h1
-rw-r--r--drivers/char/drm/radeon_drv.h26
-rw-r--r--drivers/char/drm/radeon_state.c3
6 files changed, 240 insertions, 59 deletions
diff --git a/drivers/char/drm/drm_pciids.h b/drivers/char/drm/drm_pciids.h
index c69a4d095e2d..f52468843678 100644
--- a/drivers/char/drm/drm_pciids.h
+++ b/drivers/char/drm/drm_pciids.h
@@ -139,6 +139,101 @@
139 {0x1002, 0x5e4c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ 139 {0x1002, 0x5e4c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \
140 {0x1002, 0x5e4d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ 140 {0x1002, 0x5e4d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \
141 {0x1002, 0x5e4f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \ 141 {0x1002, 0x5e4f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|RADEON_NEW_MEMMAP}, \
142 {0x1002, 0x7100, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
143 {0x1002, 0x7101, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
144 {0x1002, 0x7102, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
145 {0x1002, 0x7103, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
146 {0x1002, 0x7104, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
147 {0x1002, 0x7105, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
148 {0x1002, 0x7106, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
149 {0x1002, 0x7108, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
150 {0x1002, 0x7109, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
151 {0x1002, 0x710A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
152 {0x1002, 0x710B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
153 {0x1002, 0x710C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
154 {0x1002, 0x710E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
155 {0x1002, 0x710F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R520|RADEON_NEW_MEMMAP}, \
156 {0x1002, 0x7140, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
157 {0x1002, 0x7141, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
158 {0x1002, 0x7142, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
159 {0x1002, 0x7143, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
160 {0x1002, 0x7144, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
161 {0x1002, 0x7145, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
162 {0x1002, 0x7146, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
163 {0x1002, 0x7147, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
164 {0x1002, 0x7149, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
165 {0x1002, 0x714A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
166 {0x1002, 0x714B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
167 {0x1002, 0x714C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
168 {0x1002, 0x714D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
169 {0x1002, 0x714E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
170 {0x1002, 0x714F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
171 {0x1002, 0x7151, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
172 {0x1002, 0x7152, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
173 {0x1002, 0x7153, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
174 {0x1002, 0x715E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
175 {0x1002, 0x715F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
176 {0x1002, 0x7180, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
177 {0x1002, 0x7181, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
178 {0x1002, 0x7183, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
179 {0x1002, 0x7186, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
180 {0x1002, 0x7187, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
181 {0x1002, 0x7188, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
182 {0x1002, 0x718A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
183 {0x1002, 0x718B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
184 {0x1002, 0x718C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
185 {0x1002, 0x718D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
186 {0x1002, 0x718F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
187 {0x1002, 0x7193, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
188 {0x1002, 0x7196, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
189 {0x1002, 0x719B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
190 {0x1002, 0x719F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV515|RADEON_NEW_MEMMAP}, \
191 {0x1002, 0x71C0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
192 {0x1002, 0x71C1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
193 {0x1002, 0x71C2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
194 {0x1002, 0x71C3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
195 {0x1002, 0x71C4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
196 {0x1002, 0x71C5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
197 {0x1002, 0x71C6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
198 {0x1002, 0x71C7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
199 {0x1002, 0x71CD, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
200 {0x1002, 0x71CE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
201 {0x1002, 0x71D2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
202 {0x1002, 0x71D4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
203 {0x1002, 0x71D5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
204 {0x1002, 0x71D6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
205 {0x1002, 0x71DA, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
206 {0x1002, 0x71DE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
207 {0x1002, 0x7200, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_NEW_MEMMAP}, \
208 {0x1002, 0x7210, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
209 {0x1002, 0x7211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV530|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
210 {0x1002, 0x7240, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
211 {0x1002, 0x7243, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
212 {0x1002, 0x7244, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
213 {0x1002, 0x7245, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
214 {0x1002, 0x7246, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
215 {0x1002, 0x7247, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
216 {0x1002, 0x7248, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
217 {0x1002, 0x7249, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
218 {0x1002, 0x724A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
219 {0x1002, 0x724B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
220 {0x1002, 0x724C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
221 {0x1002, 0x724D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
222 {0x1002, 0x724E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
223 {0x1002, 0x724F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_NEW_MEMMAP}, \
224 {0x1002, 0x7280, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV570|RADEON_NEW_MEMMAP}, \
225 {0x1002, 0x7281, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV560|RADEON_NEW_MEMMAP}, \
226 {0x1002, 0x7283, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV560|RADEON_NEW_MEMMAP}, \
227 {0x1002, 0x7284, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R580|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
228 {0x1002, 0x7287, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV560|RADEON_NEW_MEMMAP}, \
229 {0x1002, 0x7288, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV570|RADEON_NEW_MEMMAP}, \
230 {0x1002, 0x7289, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV570|RADEON_NEW_MEMMAP}, \
231 {0x1002, 0x728B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV570|RADEON_NEW_MEMMAP}, \
232 {0x1002, 0x728C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV570|RADEON_NEW_MEMMAP}, \
233 {0x1002, 0x7290, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV560|RADEON_NEW_MEMMAP}, \
234 {0x1002, 0x7291, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV560|RADEON_NEW_MEMMAP}, \
235 {0x1002, 0x7293, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV560|RADEON_NEW_MEMMAP}, \
236 {0x1002, 0x7297, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV560|RADEON_NEW_MEMMAP}, \
142 {0x1002, 0x7834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_NEW_MEMMAP}, \ 237 {0x1002, 0x7834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_NEW_MEMMAP}, \
143 {0x1002, 0x7835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ 238 {0x1002, 0x7835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|RADEON_IS_IGP|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \
144 {0, 0, 0} 239 {0, 0, 0}
diff --git a/drivers/char/drm/r300_cmdbuf.c b/drivers/char/drm/r300_cmdbuf.c
index 8cd82710f6a0..0f4afc44245c 100644
--- a/drivers/char/drm/r300_cmdbuf.c
+++ b/drivers/char/drm/r300_cmdbuf.c
@@ -77,23 +77,31 @@ static int r300_emit_cliprects(drm_radeon_private_t *dev_priv,
77 return -EFAULT; 77 return -EFAULT;
78 } 78 }
79 79
80 box.x1 = 80 if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RV515) {
81 (box.x1 + 81 box.x1 = (box.x1) &
82 R300_CLIPRECT_OFFSET) & R300_CLIPRECT_MASK; 82 R300_CLIPRECT_MASK;
83 box.y1 = 83 box.y1 = (box.y1) &
84 (box.y1 + 84 R300_CLIPRECT_MASK;
85 R300_CLIPRECT_OFFSET) & R300_CLIPRECT_MASK; 85 box.x2 = (box.x2) &
86 box.x2 = 86 R300_CLIPRECT_MASK;
87 (box.x2 + 87 box.y2 = (box.y2) &
88 R300_CLIPRECT_OFFSET) & R300_CLIPRECT_MASK; 88 R300_CLIPRECT_MASK;
89 box.y2 = 89 } else {
90 (box.y2 + 90 box.x1 = (box.x1 + R300_CLIPRECT_OFFSET) &
91 R300_CLIPRECT_OFFSET) & R300_CLIPRECT_MASK; 91 R300_CLIPRECT_MASK;
92 box.y1 = (box.y1 + R300_CLIPRECT_OFFSET) &
93 R300_CLIPRECT_MASK;
94 box.x2 = (box.x2 + R300_CLIPRECT_OFFSET) &
95 R300_CLIPRECT_MASK;
96 box.y2 = (box.y2 + R300_CLIPRECT_OFFSET) &
97 R300_CLIPRECT_MASK;
92 98
99 }
93 OUT_RING((box.x1 << R300_CLIPRECT_X_SHIFT) | 100 OUT_RING((box.x1 << R300_CLIPRECT_X_SHIFT) |
94 (box.y1 << R300_CLIPRECT_Y_SHIFT)); 101 (box.y1 << R300_CLIPRECT_Y_SHIFT));
95 OUT_RING((box.x2 << R300_CLIPRECT_X_SHIFT) | 102 OUT_RING((box.x2 << R300_CLIPRECT_X_SHIFT) |
96 (box.y2 << R300_CLIPRECT_Y_SHIFT)); 103 (box.y2 << R300_CLIPRECT_Y_SHIFT));
104
97 } 105 }
98 106
99 OUT_RING_REG(R300_RE_CLIPRECT_CNTL, r300_cliprect_cntl[nr - 1]); 107 OUT_RING_REG(R300_RE_CLIPRECT_CNTL, r300_cliprect_cntl[nr - 1]);
@@ -133,9 +141,11 @@ static int r300_emit_cliprects(drm_radeon_private_t *dev_priv,
133 141
134static u8 r300_reg_flags[0x10000 >> 2]; 142static u8 r300_reg_flags[0x10000 >> 2];
135 143
136void r300_init_reg_flags(void) 144void r300_init_reg_flags(struct drm_device *dev)
137{ 145{
138 int i; 146 int i;
147 drm_radeon_private_t *dev_priv = dev->dev_private;
148
139 memset(r300_reg_flags, 0, 0x10000 >> 2); 149 memset(r300_reg_flags, 0, 0x10000 >> 2);
140#define ADD_RANGE_MARK(reg, count,mark) \ 150#define ADD_RANGE_MARK(reg, count,mark) \
141 for(i=((reg)>>2);i<((reg)>>2)+(count);i++)\ 151 for(i=((reg)>>2);i<((reg)>>2)+(count);i++)\
@@ -230,6 +240,9 @@ void r300_init_reg_flags(void)
230 ADD_RANGE(R300_VAP_INPUT_ROUTE_0_0, 8); 240 ADD_RANGE(R300_VAP_INPUT_ROUTE_0_0, 8);
231 ADD_RANGE(R300_VAP_INPUT_ROUTE_1_0, 8); 241 ADD_RANGE(R300_VAP_INPUT_ROUTE_1_0, 8);
232 242
243 if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RV515) {
244 ADD_RANGE(0x4074, 16);
245 }
233} 246}
234 247
235static __inline__ int r300_check_range(unsigned reg, int count) 248static __inline__ int r300_check_range(unsigned reg, int count)
diff --git a/drivers/char/drm/radeon_cp.c b/drivers/char/drm/radeon_cp.c
index 020323bd1626..5dc799ab86b8 100644
--- a/drivers/char/drm/radeon_cp.c
+++ b/drivers/char/drm/radeon_cp.c
@@ -816,6 +816,46 @@ static const u32 R300_cp_microcode[][2] = {
816 {0000000000, 0000000000}, 816 {0000000000, 0000000000},
817}; 817};
818 818
819static u32 RADEON_READ_MCIND(drm_radeon_private_t *dev_priv, int addr)
820{
821 u32 ret;
822 RADEON_WRITE(R520_MC_IND_INDEX, 0x7f0000 | (addr & 0xff));
823 ret = RADEON_READ(R520_MC_IND_DATA);
824 RADEON_WRITE(R520_MC_IND_INDEX, 0);
825 return ret;
826}
827
828u32 radeon_read_fb_location(drm_radeon_private_t *dev_priv)
829{
830
831 if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515)
832 return RADEON_READ_MCIND(dev_priv, RV515_MC_FB_LOCATION);
833 else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515)
834 return RADEON_READ_MCIND(dev_priv, R520_MC_FB_LOCATION);
835 else
836 return RADEON_READ(RADEON_MC_FB_LOCATION);
837}
838
839static void radeon_write_fb_location(drm_radeon_private_t *dev_priv, u32 fb_loc)
840{
841 if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515)
842 RADEON_WRITE_MCIND(RV515_MC_FB_LOCATION, fb_loc);
843 else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515)
844 RADEON_WRITE_MCIND(R520_MC_FB_LOCATION, fb_loc);
845 else
846 RADEON_WRITE(RADEON_MC_FB_LOCATION, fb_loc);
847}
848
849static void radeon_write_agp_location(drm_radeon_private_t *dev_priv, u32 agp_loc)
850{
851 if ((dev_priv->flags & RADEON_FAMILY_MASK) == CHIP_RV515)
852 RADEON_WRITE_MCIND(RV515_MC_AGP_LOCATION, agp_loc);
853 else if ((dev_priv->flags & RADEON_FAMILY_MASK) > CHIP_RV515)
854 RADEON_WRITE_MCIND(R520_MC_AGP_LOCATION, agp_loc);
855 else
856 RADEON_WRITE(RADEON_MC_AGP_LOCATION, agp_loc);
857}
858
819static int RADEON_READ_PLL(struct drm_device * dev, int addr) 859static int RADEON_READ_PLL(struct drm_device * dev, int addr)
820{ 860{
821 drm_radeon_private_t *dev_priv = dev->dev_private; 861 drm_radeon_private_t *dev_priv = dev->dev_private;
@@ -824,7 +864,7 @@ static int RADEON_READ_PLL(struct drm_device * dev, int addr)
824 return RADEON_READ(RADEON_CLOCK_CNTL_DATA); 864 return RADEON_READ(RADEON_CLOCK_CNTL_DATA);
825} 865}
826 866
827static int RADEON_READ_PCIE(drm_radeon_private_t *dev_priv, int addr) 867static u32 RADEON_READ_PCIE(drm_radeon_private_t *dev_priv, int addr)
828{ 868{
829 RADEON_WRITE8(RADEON_PCIE_INDEX, addr & 0xff); 869 RADEON_WRITE8(RADEON_PCIE_INDEX, addr & 0xff);
830 return RADEON_READ(RADEON_PCIE_DATA); 870 return RADEON_READ(RADEON_PCIE_DATA);
@@ -1074,41 +1114,43 @@ static int radeon_do_engine_reset(struct drm_device * dev)
1074 1114
1075 radeon_do_pixcache_flush(dev_priv); 1115 radeon_do_pixcache_flush(dev_priv);
1076 1116
1077 clock_cntl_index = RADEON_READ(RADEON_CLOCK_CNTL_INDEX); 1117 if ((dev_priv->flags & RADEON_FAMILY_MASK) < CHIP_RV515) {
1078 mclk_cntl = RADEON_READ_PLL(dev, RADEON_MCLK_CNTL); 1118 clock_cntl_index = RADEON_READ(RADEON_CLOCK_CNTL_INDEX);
1079 1119 mclk_cntl = RADEON_READ_PLL(dev, RADEON_MCLK_CNTL);
1080 RADEON_WRITE_PLL(RADEON_MCLK_CNTL, (mclk_cntl | 1120
1081 RADEON_FORCEON_MCLKA | 1121 RADEON_WRITE_PLL(RADEON_MCLK_CNTL, (mclk_cntl |
1082 RADEON_FORCEON_MCLKB | 1122 RADEON_FORCEON_MCLKA |
1083 RADEON_FORCEON_YCLKA | 1123 RADEON_FORCEON_MCLKB |
1084 RADEON_FORCEON_YCLKB | 1124 RADEON_FORCEON_YCLKA |
1085 RADEON_FORCEON_MC | 1125 RADEON_FORCEON_YCLKB |
1086 RADEON_FORCEON_AIC)); 1126 RADEON_FORCEON_MC |
1087 1127 RADEON_FORCEON_AIC));
1088 rbbm_soft_reset = RADEON_READ(RADEON_RBBM_SOFT_RESET); 1128
1089 1129 rbbm_soft_reset = RADEON_READ(RADEON_RBBM_SOFT_RESET);
1090 RADEON_WRITE(RADEON_RBBM_SOFT_RESET, (rbbm_soft_reset | 1130
1091 RADEON_SOFT_RESET_CP | 1131 RADEON_WRITE(RADEON_RBBM_SOFT_RESET, (rbbm_soft_reset |
1092 RADEON_SOFT_RESET_HI | 1132 RADEON_SOFT_RESET_CP |
1093 RADEON_SOFT_RESET_SE | 1133 RADEON_SOFT_RESET_HI |
1094 RADEON_SOFT_RESET_RE | 1134 RADEON_SOFT_RESET_SE |
1095 RADEON_SOFT_RESET_PP | 1135 RADEON_SOFT_RESET_RE |
1096 RADEON_SOFT_RESET_E2 | 1136 RADEON_SOFT_RESET_PP |
1097 RADEON_SOFT_RESET_RB)); 1137 RADEON_SOFT_RESET_E2 |
1098 RADEON_READ(RADEON_RBBM_SOFT_RESET); 1138 RADEON_SOFT_RESET_RB));
1099 RADEON_WRITE(RADEON_RBBM_SOFT_RESET, (rbbm_soft_reset & 1139 RADEON_READ(RADEON_RBBM_SOFT_RESET);
1100 ~(RADEON_SOFT_RESET_CP | 1140 RADEON_WRITE(RADEON_RBBM_SOFT_RESET, (rbbm_soft_reset &
1101 RADEON_SOFT_RESET_HI | 1141 ~(RADEON_SOFT_RESET_CP |
1102 RADEON_SOFT_RESET_SE | 1142 RADEON_SOFT_RESET_HI |
1103 RADEON_SOFT_RESET_RE | 1143 RADEON_SOFT_RESET_SE |
1104 RADEON_SOFT_RESET_PP | 1144 RADEON_SOFT_RESET_RE |
1105 RADEON_SOFT_RESET_E2 | 1145 RADEON_SOFT_RESET_PP |
1106 RADEON_SOFT_RESET_RB))); 1146 RADEON_SOFT_RESET_E2 |
1107 RADEON_READ(RADEON_RBBM_SOFT_RESET); 1147 RADEON_SOFT_RESET_RB)));
1108 1148 RADEON_READ(RADEON_RBBM_SOFT_RESET);
1109 RADEON_WRITE_PLL(RADEON_MCLK_CNTL, mclk_cntl); 1149
1110 RADEON_WRITE(RADEON_CLOCK_CNTL_INDEX, clock_cntl_index); 1150 RADEON_WRITE_PLL(RADEON_MCLK_CNTL, mclk_cntl);
1111 RADEON_WRITE(RADEON_RBBM_SOFT_RESET, rbbm_soft_reset); 1151 RADEON_WRITE(RADEON_CLOCK_CNTL_INDEX, clock_cntl_index);
1152 RADEON_WRITE(RADEON_RBBM_SOFT_RESET, rbbm_soft_reset);
1153 }
1112 1154
1113 /* Reset the CP ring */ 1155 /* Reset the CP ring */
1114 radeon_do_cp_reset(dev_priv); 1156 radeon_do_cp_reset(dev_priv);
@@ -1134,14 +1176,14 @@ static void radeon_cp_init_ring_buffer(struct drm_device * dev,
1134 * always appended to the fb which is not necessarily the case 1176 * always appended to the fb which is not necessarily the case
1135 */ 1177 */
1136 if (!dev_priv->new_memmap) 1178 if (!dev_priv->new_memmap)
1137 RADEON_WRITE(RADEON_MC_FB_LOCATION, 1179 radeon_write_fb_location(dev_priv,
1138 ((dev_priv->gart_vm_start - 1) & 0xffff0000) 1180 ((dev_priv->gart_vm_start - 1) & 0xffff0000)
1139 | (dev_priv->fb_location >> 16)); 1181 | (dev_priv->fb_location >> 16));
1140 1182
1141#if __OS_HAS_AGP 1183#if __OS_HAS_AGP
1142 if (dev_priv->flags & RADEON_IS_AGP) { 1184 if (dev_priv->flags & RADEON_IS_AGP) {
1143 RADEON_WRITE(RADEON_AGP_BASE, (unsigned int)dev->agp->base); 1185 RADEON_WRITE(RADEON_AGP_BASE, (unsigned int)dev->agp->base);
1144 RADEON_WRITE(RADEON_MC_AGP_LOCATION, 1186 radeon_write_agp_location(dev_priv,
1145 (((dev_priv->gart_vm_start - 1 + 1187 (((dev_priv->gart_vm_start - 1 +
1146 dev_priv->gart_size) & 0xffff0000) | 1188 dev_priv->gart_size) & 0xffff0000) |
1147 (dev_priv->gart_vm_start >> 16))); 1189 (dev_priv->gart_vm_start >> 16)));
@@ -1305,7 +1347,7 @@ static void radeon_set_igpgart(drm_radeon_private_t * dev_priv, int on)
1305 1347
1306 RADEON_WRITE(RADEON_AGP_BASE, (unsigned int)dev_priv->gart_vm_start); 1348 RADEON_WRITE(RADEON_AGP_BASE, (unsigned int)dev_priv->gart_vm_start);
1307 dev_priv->gart_size = 32*1024*1024; 1349 dev_priv->gart_size = 32*1024*1024;
1308 RADEON_WRITE(RADEON_MC_AGP_LOCATION, 1350 radeon_write_agp_location(dev_priv,
1309 (((dev_priv->gart_vm_start - 1 + 1351 (((dev_priv->gart_vm_start - 1 +
1310 dev_priv->gart_size) & 0xffff0000) | 1352 dev_priv->gart_size) & 0xffff0000) |
1311 (dev_priv->gart_vm_start >> 16))); 1353 (dev_priv->gart_vm_start >> 16)));
@@ -1339,7 +1381,7 @@ static void radeon_set_pciegart(drm_radeon_private_t * dev_priv, int on)
1339 dev_priv->gart_vm_start + 1381 dev_priv->gart_vm_start +
1340 dev_priv->gart_size - 1); 1382 dev_priv->gart_size - 1);
1341 1383
1342 RADEON_WRITE(RADEON_MC_AGP_LOCATION, 0xffffffc0); /* ?? */ 1384 radeon_write_agp_location(dev_priv, 0xffffffc0); /* ?? */
1343 1385
1344 RADEON_WRITE_PCIE(RADEON_PCIE_TX_GART_CNTL, 1386 RADEON_WRITE_PCIE(RADEON_PCIE_TX_GART_CNTL,
1345 RADEON_PCIE_TX_GART_EN); 1387 RADEON_PCIE_TX_GART_EN);
@@ -1382,7 +1424,7 @@ static void radeon_set_pcigart(drm_radeon_private_t * dev_priv, int on)
1382 1424
1383 /* Turn off AGP aperture -- is this required for PCI GART? 1425 /* Turn off AGP aperture -- is this required for PCI GART?
1384 */ 1426 */
1385 RADEON_WRITE(RADEON_MC_AGP_LOCATION, 0xffffffc0); /* ?? */ 1427 radeon_write_agp_location(dev_priv, 0xffffffc0);
1386 RADEON_WRITE(RADEON_AGP_COMMAND, 0); /* clear AGP_COMMAND */ 1428 RADEON_WRITE(RADEON_AGP_COMMAND, 0); /* clear AGP_COMMAND */
1387 } else { 1429 } else {
1388 RADEON_WRITE(RADEON_AIC_CNTL, 1430 RADEON_WRITE(RADEON_AIC_CNTL,
@@ -1587,10 +1629,9 @@ static int radeon_do_init_cp(struct drm_device * dev, drm_radeon_init_t * init)
1587 dev->agp_buffer_map->handle); 1629 dev->agp_buffer_map->handle);
1588 } 1630 }
1589 1631
1590 dev_priv->fb_location = (RADEON_READ(RADEON_MC_FB_LOCATION) 1632 dev_priv->fb_location = (radeon_read_fb_location(dev_priv) & 0xffff) << 16;
1591 & 0xffff) << 16;
1592 dev_priv->fb_size = 1633 dev_priv->fb_size =
1593 ((RADEON_READ(RADEON_MC_FB_LOCATION) & 0xffff0000u) + 0x10000) 1634 ((radeon_read_fb_location(dev_priv) & 0xffff0000u) + 0x10000)
1594 - dev_priv->fb_location; 1635 - dev_priv->fb_location;
1595 1636
1596 dev_priv->front_pitch_offset = (((dev_priv->front_pitch / 64) << 22) | 1637 dev_priv->front_pitch_offset = (((dev_priv->front_pitch / 64) << 22) |
@@ -1841,7 +1882,7 @@ int radeon_cp_init(struct drm_device *dev, void *data, struct drm_file *file_pri
1841 LOCK_TEST_WITH_RETURN(dev, file_priv); 1882 LOCK_TEST_WITH_RETURN(dev, file_priv);
1842 1883
1843 if (init->func == RADEON_INIT_R300_CP) 1884 if (init->func == RADEON_INIT_R300_CP)
1844 r300_init_reg_flags(); 1885 r300_init_reg_flags(dev);
1845 1886
1846 switch (init->func) { 1887 switch (init->func) {
1847 case RADEON_INIT_CP: 1888 case RADEON_INIT_CP:
@@ -2250,6 +2291,10 @@ int radeon_driver_load(struct drm_device *dev, unsigned long flags)
2250 case CHIP_R350: 2291 case CHIP_R350:
2251 case CHIP_R420: 2292 case CHIP_R420:
2252 case CHIP_RV410: 2293 case CHIP_RV410:
2294 case CHIP_RV515:
2295 case CHIP_R520:
2296 case CHIP_RV570:
2297 case CHIP_R580:
2253 dev_priv->flags |= RADEON_HAS_HIERZ; 2298 dev_priv->flags |= RADEON_HAS_HIERZ;
2254 break; 2299 break;
2255 default: 2300 default:
diff --git a/drivers/char/drm/radeon_drm.h b/drivers/char/drm/radeon_drm.h
index 5f8d0420634d..71e5b21fad2c 100644
--- a/drivers/char/drm/radeon_drm.h
+++ b/drivers/char/drm/radeon_drm.h
@@ -656,6 +656,7 @@ typedef struct drm_radeon_indirect {
656#define RADEON_PARAM_SCRATCH_OFFSET 11 656#define RADEON_PARAM_SCRATCH_OFFSET 11
657#define RADEON_PARAM_CARD_TYPE 12 657#define RADEON_PARAM_CARD_TYPE 12
658#define RADEON_PARAM_VBLANK_CRTC 13 /* VBLANK CRTC */ 658#define RADEON_PARAM_VBLANK_CRTC 13 /* VBLANK CRTC */
659#define RADEON_PARAM_FB_LOCATION 14 /* FB location */
659 660
660typedef struct drm_radeon_getparam { 661typedef struct drm_radeon_getparam {
661 int param; 662 int param;
diff --git a/drivers/char/drm/radeon_drv.h b/drivers/char/drm/radeon_drv.h
index 443a8952eced..4434332c79bc 100644
--- a/drivers/char/drm/radeon_drv.h
+++ b/drivers/char/drm/radeon_drv.h
@@ -123,6 +123,12 @@ enum radeon_family {
123 CHIP_R420, 123 CHIP_R420,
124 CHIP_RV410, 124 CHIP_RV410,
125 CHIP_RS400, 125 CHIP_RS400,
126 CHIP_RV515,
127 CHIP_R520,
128 CHIP_RV530,
129 CHIP_RV560,
130 CHIP_RV570,
131 CHIP_R580,
126 CHIP_LAST, 132 CHIP_LAST,
127}; 133};
128 134
@@ -342,6 +348,7 @@ extern int radeon_cp_resume(struct drm_device *dev, void *data, struct drm_file
342extern int radeon_engine_reset(struct drm_device *dev, void *data, struct drm_file *file_priv); 348extern int radeon_engine_reset(struct drm_device *dev, void *data, struct drm_file *file_priv);
343extern int radeon_fullscreen(struct drm_device *dev, void *data, struct drm_file *file_priv); 349extern int radeon_fullscreen(struct drm_device *dev, void *data, struct drm_file *file_priv);
344extern int radeon_cp_buffers(struct drm_device *dev, void *data, struct drm_file *file_priv); 350extern int radeon_cp_buffers(struct drm_device *dev, void *data, struct drm_file *file_priv);
351extern u32 radeon_read_fb_location(drm_radeon_private_t *dev_priv);
345 352
346extern void radeon_freelist_reset(struct drm_device * dev); 353extern void radeon_freelist_reset(struct drm_device * dev);
347extern struct drm_buf *radeon_freelist_get(struct drm_device * dev); 354extern struct drm_buf *radeon_freelist_get(struct drm_device * dev);
@@ -388,7 +395,7 @@ extern long radeon_compat_ioctl(struct file *filp, unsigned int cmd,
388 unsigned long arg); 395 unsigned long arg);
389 396
390/* r300_cmdbuf.c */ 397/* r300_cmdbuf.c */
391extern void r300_init_reg_flags(void); 398extern void r300_init_reg_flags(struct drm_device *dev);
392 399
393extern int r300_do_cp_cmdbuf(struct drm_device * dev, 400extern int r300_do_cp_cmdbuf(struct drm_device * dev,
394 struct drm_file *file_priv, 401 struct drm_file *file_priv,
@@ -460,6 +467,16 @@ extern int r300_do_cp_cmdbuf(struct drm_device * dev,
460#define RADEON_IGPGART_ENABLE 0x38 467#define RADEON_IGPGART_ENABLE 0x38
461#define RADEON_IGPGART_UNK_39 0x39 468#define RADEON_IGPGART_UNK_39 0x39
462 469
470#define R520_MC_IND_INDEX 0x70
471#define R520_MC_IND_WR_EN (1<<24)
472#define R520_MC_IND_DATA 0x74
473
474#define RV515_MC_FB_LOCATION 0x01
475#define RV515_MC_AGP_LOCATION 0x02
476
477#define R520_MC_FB_LOCATION 0x04
478#define R520_MC_AGP_LOCATION 0x05
479
463#define RADEON_MPP_TB_CONFIG 0x01c0 480#define RADEON_MPP_TB_CONFIG 0x01c0
464#define RADEON_MEM_CNTL 0x0140 481#define RADEON_MEM_CNTL 0x0140
465#define RADEON_MEM_SDRAM_MODE_REG 0x0158 482#define RADEON_MEM_SDRAM_MODE_REG 0x0158
@@ -1052,6 +1069,13 @@ do { \
1052 RADEON_WRITE( RADEON_PCIE_DATA, (val) ); \ 1069 RADEON_WRITE( RADEON_PCIE_DATA, (val) ); \
1053} while (0) 1070} while (0)
1054 1071
1072#define RADEON_WRITE_MCIND( addr, val ) \
1073 do { \
1074 RADEON_WRITE(R520_MC_IND_INDEX, 0xff0000 | ((addr) & 0xff)); \
1075 RADEON_WRITE(R520_MC_IND_DATA, (val)); \
1076 RADEON_WRITE(R520_MC_IND_INDEX, 0); \
1077 } while (0)
1078
1055#define CP_PACKET0( reg, n ) \ 1079#define CP_PACKET0( reg, n ) \
1056 (RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2)) 1080 (RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2))
1057#define CP_PACKET0_TABLE( reg, n ) \ 1081#define CP_PACKET0_TABLE( reg, n ) \
diff --git a/drivers/char/drm/radeon_state.c b/drivers/char/drm/radeon_state.c
index 1dffdc3e7ef0..6f75512f591e 100644
--- a/drivers/char/drm/radeon_state.c
+++ b/drivers/char/drm/radeon_state.c
@@ -3034,6 +3034,9 @@ static int radeon_cp_getparam(struct drm_device *dev, void *data, struct drm_fil
3034 case RADEON_PARAM_VBLANK_CRTC: 3034 case RADEON_PARAM_VBLANK_CRTC:
3035 value = radeon_vblank_crtc_get(dev); 3035 value = radeon_vblank_crtc_get(dev);
3036 break; 3036 break;
3037 case RADEON_PARAM_FB_LOCATION:
3038 value = radeon_read_fb_location(dev_priv);
3039 break;
3037 default: 3040 default:
3038 DRM_DEBUG("Invalid parameter %d\n", param->param); 3041 DRM_DEBUG("Invalid parameter %d\n", param->param);
3039 return -EINVAL; 3042 return -EINVAL;