aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/radeon/r420.c17
-rw-r--r--drivers/gpu/drm/radeon/r420d.h43
-rw-r--r--drivers/gpu/drm/radeon/radeon.h4
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c4
4 files changed, 68 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c
index 97426a6f370..96303f064db 100644
--- a/drivers/gpu/drm/radeon/r420.c
+++ b/drivers/gpu/drm/radeon/r420.c
@@ -29,6 +29,7 @@
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 "r420d.h"
32 33
33/* r420,r423,rv410 depends on : */ 34/* r420,r423,rv410 depends on : */
34void r100_pci_gart_disable(struct radeon_device *rdev); 35void r100_pci_gart_disable(struct radeon_device *rdev);
@@ -232,3 +233,19 @@ int r420_debugfs_pipes_info_init(struct radeon_device *rdev)
232 return 0; 233 return 0;
233#endif 234#endif
234} 235}
236
237u32 r420_mc_rreg(struct radeon_device *rdev, u32 reg)
238{
239 u32 r;
240
241 WREG32(R_0001F8_MC_IND_INDEX, S_0001F8_MC_IND_ADDR(reg));
242 r = RREG32(R_0001FC_MC_IND_DATA);
243 return r;
244}
245
246void r420_mc_wreg(struct radeon_device *rdev, u32 reg, u32 v)
247{
248 WREG32(R_0001F8_MC_IND_INDEX, S_0001F8_MC_IND_ADDR(reg) |
249 S_0001F8_MC_IND_WR_EN(1));
250 WREG32(R_0001FC_MC_IND_DATA, v);
251}
diff --git a/drivers/gpu/drm/radeon/r420d.h b/drivers/gpu/drm/radeon/r420d.h
new file mode 100644
index 00000000000..8b946c1883b
--- /dev/null
+++ b/drivers/gpu/drm/radeon/r420d.h
@@ -0,0 +1,43 @@
1/*
2 * Copyright 2008 Advanced Micro Devices, Inc.
3 * Copyright 2008 Red Hat Inc.
4 * Copyright 2009 Jerome Glisse.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
23 *
24 * Authors: Dave Airlie
25 * Alex Deucher
26 * Jerome Glisse
27 */
28#ifndef R420D_H
29#define R420D_H
30
31#define R_0001F8_MC_IND_INDEX 0x0001F8
32#define S_0001F8_MC_IND_ADDR(x) (((x) & 0x7F) << 0)
33#define G_0001F8_MC_IND_ADDR(x) (((x) >> 0) & 0x7F)
34#define C_0001F8_MC_IND_ADDR 0xFFFFFF80
35#define S_0001F8_MC_IND_WR_EN(x) (((x) & 0x1) << 8)
36#define G_0001F8_MC_IND_WR_EN(x) (((x) >> 8) & 0x1)
37#define C_0001F8_MC_IND_WR_EN 0xFFFFFEFF
38#define R_0001FC_MC_IND_DATA 0x0001FC
39#define S_0001FC_MC_IND_DATA(x) (((x) & 0xFFFFFFFF) << 0)
40#define G_0001FC_MC_IND_DATA(x) (((x) >> 0) & 0xFFFFFFFF)
41#define C_0001FC_MC_IND_DATA 0x00000000
42
43#endif
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 24574bc0f2a..fa84c77577a 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -936,4 +936,8 @@ static inline void radeon_ring_write(struct radeon_device *rdev, uint32_t v)
936/* r100,rv100,rs100,rv200,rs200,r200,rv250,rs300,rv280 */ 936/* r100,rv100,rs100,rv200,rs200,r200,rv250,rs300,rv280 */
937void r100_cp_disable(struct radeon_device *rdev); 937void r100_cp_disable(struct radeon_device *rdev);
938 938
939/* r420,r423,rv410 */
940u32 r420_mc_rreg(struct radeon_device *rdev, u32 reg);
941void r420_mc_wreg(struct radeon_device *rdev, u32 reg, u32 v);
942
939#endif 943#endif
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index f2469c51178..05e1af0156c 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -266,6 +266,10 @@ void radeon_register_accessor_init(struct radeon_device *rdev)
266 rdev->pll_rreg = &r100_pll_rreg; 266 rdev->pll_rreg = &r100_pll_rreg;
267 rdev->pll_wreg = &r100_pll_wreg; 267 rdev->pll_wreg = &r100_pll_wreg;
268 } 268 }
269 if (rdev->family >= CHIP_R420) {
270 rdev->mc_rreg = &r420_mc_rreg;
271 rdev->mc_wreg = &r420_mc_wreg;
272 }
269 if (rdev->family >= CHIP_RV515) { 273 if (rdev->family >= CHIP_RV515) {
270 rdev->mc_rreg = &rv515_mc_rreg; 274 rdev->mc_rreg = &rv515_mc_rreg;
271 rdev->mc_wreg = &rv515_mc_wreg; 275 rdev->mc_wreg = &rv515_mc_wreg;