2 * Copyright 2008 Advanced Micro Devices, Inc.
3 * Copyright 2008 Red Hat Inc.
4 * Copyright 2009 Jerome Glisse.
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:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
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.
24 * Authors: Dave Airlie
29 #include "radeon_reg.h"
32 /* rv770,rv730,rv710 depends on : */
33 void rs600_mc_disable_clients(struct radeon_device
*rdev
);
35 /* This files gather functions specifics to:
38 * Some of these functions might be used by newer ASICs.
40 int rv770_mc_wait_for_idle(struct radeon_device
*rdev
);
41 void rv770_gpu_init(struct radeon_device
*rdev
);
47 int rv770_mc_init(struct radeon_device
*rdev
)
53 /* setup the gart before changing location so we can ask to
54 * discard unmapped mc request
56 /* FIXME: disable out of gart access */
57 tmp
= rdev
->mc
.gtt_location
/ 4096;
58 tmp
= REG_SET(R700_LOGICAL_PAGE_NUMBER
, tmp
);
59 WREG32(R700_MC_VM_SYSTEM_APERTURE_LOW_ADDR
, tmp
);
60 tmp
= (rdev
->mc
.gtt_location
+ rdev
->mc
.gtt_size
) / 4096;
61 tmp
= REG_SET(R700_LOGICAL_PAGE_NUMBER
, tmp
);
62 WREG32(R700_MC_VM_SYSTEM_APERTURE_HIGH_ADDR
, tmp
);
64 rs600_mc_disable_clients(rdev
);
65 if (rv770_mc_wait_for_idle(rdev
)) {
66 printk(KERN_WARNING
"Failed to wait MC idle while "
67 "programming pipes. Bad things might happen.\n");
70 tmp
= rdev
->mc
.vram_location
+ rdev
->mc
.vram_size
- 1;
71 tmp
= REG_SET(R700_MC_FB_TOP
, tmp
>> 24);
72 tmp
|= REG_SET(R700_MC_FB_BASE
, rdev
->mc
.vram_location
>> 24);
73 WREG32(R700_MC_VM_FB_LOCATION
, tmp
);
74 tmp
= rdev
->mc
.gtt_location
+ rdev
->mc
.gtt_size
- 1;
75 tmp
= REG_SET(R700_MC_AGP_TOP
, tmp
>> 22);
76 WREG32(R700_MC_VM_AGP_TOP
, tmp
);
77 tmp
= REG_SET(R700_MC_AGP_BOT
, rdev
->mc
.gtt_location
>> 22);
78 WREG32(R700_MC_VM_AGP_BOT
, tmp
);
82 void rv770_mc_fini(struct radeon_device
*rdev
)
84 /* FIXME: implement */
89 * Global GPU functions
91 void rv770_errata(struct radeon_device
*rdev
)
96 int rv770_mc_wait_for_idle(struct radeon_device
*rdev
)
98 /* FIXME: implement */
102 void rv770_gpu_init(struct radeon_device
*rdev
)
104 /* FIXME: implement */
111 void rv770_vram_get_type(struct radeon_device
*rdev
)
113 /* FIXME: implement */
116 void rv770_vram_info(struct radeon_device
*rdev
)
118 rv770_vram_get_type(rdev
);
120 /* FIXME: implement */
121 /* Could aper size report 0 ? */
122 rdev
->mc
.aper_base
= drm_get_resource_start(rdev
->ddev
, 0);
123 rdev
->mc
.aper_size
= drm_get_resource_len(rdev
->ddev
, 0);