summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/dev/pci/drm/radeon/atombios_encoders.c2
-rw-r--r--sys/dev/pci/drm/radeon/evergreen.c16
-rw-r--r--sys/dev/pci/drm/radeon/evergreen_cs.c3
-rw-r--r--sys/dev/pci/drm/radeon/ni.c5
-rw-r--r--sys/dev/pci/drm/radeon/r100.c32
-rw-r--r--sys/dev/pci/drm/radeon/r300.c8
-rw-r--r--sys/dev/pci/drm/radeon/r420.c11
-rw-r--r--sys/dev/pci/drm/radeon/r520.c3
-rw-r--r--sys/dev/pci/drm/radeon/r600.c18
-rw-r--r--sys/dev/pci/drm/radeon/r600_cs.c3
-rw-r--r--sys/dev/pci/drm/radeon/radeon.h23
-rw-r--r--sys/dev/pci/drm/radeon/radeon_agp.c15
-rw-r--r--sys/dev/pci/drm/radeon/radeon_atombios.c3
-rw-r--r--sys/dev/pci/drm/radeon/radeon_bios.c7
-rw-r--r--sys/dev/pci/drm/radeon/radeon_combios.c17
-rw-r--r--sys/dev/pci/drm/radeon/radeon_cs.c2
-rw-r--r--sys/dev/pci/drm/radeon/radeon_device.c20
-rw-r--r--sys/dev/pci/drm/radeon/radeon_display.c66
-rw-r--r--sys/dev/pci/drm/radeon/radeon_fb.c9
-rw-r--r--sys/dev/pci/drm/radeon/radeon_i2c.c2
-rw-r--r--sys/dev/pci/drm/radeon/radeon_irq_kms.c68
-rw-r--r--sys/dev/pci/drm/radeon/radeon_kms.c10
-rw-r--r--sys/dev/pci/drm/radeon/radeon_legacy_encoders.c2
-rw-r--r--sys/dev/pci/drm/radeon/radeon_object.c8
-rw-r--r--sys/dev/pci/drm/radeon/radeon_pm.c12
-rw-r--r--sys/dev/pci/drm/radeon/radeon_ttm.c11
-rw-r--r--sys/dev/pci/drm/radeon/rs400.c6
-rw-r--r--sys/dev/pci/drm/radeon/rs600.c16
-rw-r--r--sys/dev/pci/drm/radeon/rs690.c3
-rw-r--r--sys/dev/pci/drm/radeon/rv515.c3
-rw-r--r--sys/dev/pci/drm/radeon/rv770.c3
-rw-r--r--sys/dev/pci/drm/radeon/si.c16
32 files changed, 174 insertions, 249 deletions
diff --git a/sys/dev/pci/drm/radeon/atombios_encoders.c b/sys/dev/pci/drm/radeon/atombios_encoders.c
index cf2db639e39..b999713c7b3 100644
--- a/sys/dev/pci/drm/radeon/atombios_encoders.c
+++ b/sys/dev/pci/drm/radeon/atombios_encoders.c
@@ -2075,7 +2075,7 @@ static int radeon_atom_pick_dig_encoder(struct drm_encoder *encoder)
void
radeon_atom_encoder_init(struct radeon_device *rdev)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
+ struct drm_device *dev = rdev->ddev;
struct drm_encoder *encoder;
list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
diff --git a/sys/dev/pci/drm/radeon/evergreen.c b/sys/dev/pci/drm/radeon/evergreen.c
index f497cc0950a..52d67395f3e 100644
--- a/sys/dev/pci/drm/radeon/evergreen.c
+++ b/sys/dev/pci/drm/radeon/evergreen.c
@@ -443,7 +443,7 @@ void evergreen_pm_misc(struct radeon_device *rdev)
*/
void evergreen_pm_prepare(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
+ struct drm_device *ddev = rdev->ddev;
struct drm_crtc *crtc;
struct radeon_crtc *radeon_crtc;
u32 tmp;
@@ -468,7 +468,7 @@ void evergreen_pm_prepare(struct radeon_device *rdev)
*/
void evergreen_pm_finish(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
+ struct drm_device *ddev = rdev->ddev;
struct drm_crtc *crtc;
struct radeon_crtc *radeon_crtc;
u32 tmp;
@@ -607,7 +607,7 @@ void evergreen_hpd_set_polarity(struct radeon_device *rdev,
*/
void evergreen_hpd_init(struct radeon_device *rdev)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
+ struct drm_device *dev = rdev->ddev;
struct drm_connector *connector;
unsigned enabled = 0;
u32 tmp = DC_HPDx_CONNECTION_TIMER(0x9c4) |
@@ -653,7 +653,7 @@ void evergreen_hpd_init(struct radeon_device *rdev)
*/
void evergreen_hpd_fini(struct radeon_device *rdev)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
+ struct drm_device *dev = rdev->ddev;
struct drm_connector *connector;
unsigned disabled = 0;
@@ -1720,7 +1720,7 @@ static int evergreen_cp_resume(struct radeon_device *rdev)
*/
static void evergreen_gpu_init(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
+ struct drm_device *ddev = rdev->ddev;
u32 gb_addr_config;
u32 mc_shared_chmap, mc_arb_ramcfg;
u32 sx_debug_1;
@@ -2931,7 +2931,7 @@ static u32 evergreen_get_ih_wptr(struct radeon_device *rdev)
int evergreen_irq_process(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
+ struct drm_device *ddev = rdev->ddev;
u32 wptr;
u32 rptr;
u32 src_id, src_data;
@@ -3593,7 +3593,7 @@ int evergreen_suspend(struct radeon_device *rdev)
*/
int evergreen_init(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
+ struct drm_device *ddev = rdev->ddev;
int r;
/* Read BIOS */
@@ -3718,7 +3718,7 @@ void evergreen_pcie_gen2_enable(struct radeon_device *rdev)
{
printf("%s stub\n", __func__);
#ifdef notyet
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
+ struct drm_device *ddev = rdev->ddev;
u32 link_width_cntl, speed_cntl, mask;
int ret;
diff --git a/sys/dev/pci/drm/radeon/evergreen_cs.c b/sys/dev/pci/drm/radeon/evergreen_cs.c
index 8c6f5d130b3..1457fb1cdac 100644
--- a/sys/dev/pci/drm/radeon/evergreen_cs.c
+++ b/sys/dev/pci/drm/radeon/evergreen_cs.c
@@ -1142,7 +1142,6 @@ static bool evergreen_cs_packet_next_is_pkt3_nop(struct radeon_cs_parser *p)
*/
static int evergreen_cs_packet_parse_vline(struct radeon_cs_parser *p)
{
- struct drm_device *ddev = (struct drm_device *)p->rdev->drmdev;
struct drm_mode_object *obj;
struct drm_crtc *crtc;
struct radeon_crtc *radeon_crtc;
@@ -1199,7 +1198,7 @@ static int evergreen_cs_packet_parse_vline(struct radeon_cs_parser *p)
header = radeon_get_ib_value(p, h_idx);
crtc_id = radeon_get_ib_value(p, h_idx + 2 + 7 + 1);
reg = CP_PACKET0_GET_REG(header);
- obj = drm_mode_object_find(ddev, crtc_id, DRM_MODE_OBJECT_CRTC);
+ obj = drm_mode_object_find(p->rdev->ddev, crtc_id, DRM_MODE_OBJECT_CRTC);
if (!obj) {
DRM_ERROR("cannot find crtc %d\n", crtc_id);
return -EINVAL;
diff --git a/sys/dev/pci/drm/radeon/ni.c b/sys/dev/pci/drm/radeon/ni.c
index a597cfd2320..69363d9b9dc 100644
--- a/sys/dev/pci/drm/radeon/ni.c
+++ b/sys/dev/pci/drm/radeon/ni.c
@@ -424,7 +424,7 @@ out:
*/
static void cayman_gpu_init(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
+ struct drm_device *ddev = rdev->ddev;
u32 gb_addr_config = 0;
u32 mc_shared_chmap, mc_arb_ramcfg;
u32 cgts_tcc_disable;
@@ -1709,7 +1709,6 @@ int cayman_suspend(struct radeon_device *rdev)
*/
int cayman_init(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
struct radeon_ring *ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX];
int r;
@@ -1741,7 +1740,7 @@ int cayman_init(struct radeon_device *rdev)
/* Initialize surface registers */
radeon_surface_init(rdev);
/* Initialize clocks */
- radeon_get_clock_info(ddev);
+ radeon_get_clock_info(rdev->ddev);
/* Fence driver */
r = radeon_fence_driver_init(rdev);
if (r)
diff --git a/sys/dev/pci/drm/radeon/r100.c b/sys/dev/pci/drm/radeon/r100.c
index 04fee1766b4..9799fe303a5 100644
--- a/sys/dev/pci/drm/radeon/r100.c
+++ b/sys/dev/pci/drm/radeon/r100.c
@@ -428,7 +428,7 @@ void r100_pm_misc(struct radeon_device *rdev)
*/
void r100_pm_prepare(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
+ struct drm_device *ddev = rdev->ddev;
struct drm_crtc *crtc;
struct radeon_crtc *radeon_crtc;
u32 tmp;
@@ -459,7 +459,7 @@ void r100_pm_prepare(struct radeon_device *rdev)
*/
void r100_pm_finish(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
+ struct drm_device *ddev = rdev->ddev;
struct drm_crtc *crtc;
struct radeon_crtc *radeon_crtc;
u32 tmp;
@@ -572,7 +572,7 @@ void r100_hpd_set_polarity(struct radeon_device *rdev,
*/
void r100_hpd_init(struct radeon_device *rdev)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
+ struct drm_device *dev = rdev->ddev;
struct drm_connector *connector;
unsigned enable = 0;
@@ -594,7 +594,7 @@ void r100_hpd_init(struct radeon_device *rdev)
*/
void r100_hpd_fini(struct radeon_device *rdev)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
+ struct drm_device *dev = rdev->ddev;
struct drm_connector *connector;
unsigned disable = 0;
@@ -742,7 +742,6 @@ static uint32_t r100_irq_ack(struct radeon_device *rdev)
int r100_irq_process(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
uint32_t status, msi_rearm;
bool queue_hotplug = false;
@@ -761,7 +760,7 @@ int r100_irq_process(struct radeon_device *rdev)
/* Vertical blank interrupts */
if (status & RADEON_CRTC_VBLANK_STAT) {
if (rdev->irq.crtc_vblank_int[0]) {
- drm_handle_vblank(ddev, 0);
+ drm_handle_vblank(rdev->ddev, 0);
rdev->pm.vblank_sync = true;
wakeup(&rdev->irq.vblank_queue);
}
@@ -770,7 +769,7 @@ int r100_irq_process(struct radeon_device *rdev)
}
if (status & RADEON_CRTC2_VBLANK_STAT) {
if (rdev->irq.crtc_vblank_int[1]) {
- drm_handle_vblank(ddev, 1);
+ drm_handle_vblank(rdev->ddev, 1);
rdev->pm.vblank_sync = true;
wakeup(&rdev->irq.vblank_queue);
}
@@ -1435,7 +1434,6 @@ int r100_cs_packet_parse(struct radeon_cs_parser *p,
*/
int r100_cs_packet_parse_vline(struct radeon_cs_parser *p)
{
- struct drm_device *ddev;
struct drm_mode_object *obj;
struct drm_crtc *crtc;
struct radeon_crtc *radeon_crtc;
@@ -1476,8 +1474,7 @@ int r100_cs_packet_parse_vline(struct radeon_cs_parser *p)
header = radeon_get_ib_value(p, h_idx);
crtc_id = radeon_get_ib_value(p, h_idx + 5);
reg = CP_PACKET0_GET_REG(header);
- ddev = (struct drm_device *)p->rdev->drmdev;
- obj = drm_mode_object_find(ddev, crtc_id, DRM_MODE_OBJECT_CRTC);
+ obj = drm_mode_object_find(p->rdev->ddev, crtc_id, DRM_MODE_OBJECT_CRTC);
if (!obj) {
DRM_ERROR("cannot find crtc %d\n", crtc_id);
return -EINVAL;
@@ -2686,7 +2683,7 @@ int r100_asic_reset(struct radeon_device *rdev)
void r100_set_common_regs(struct radeon_device *rdev)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
+ struct drm_device *dev = rdev->ddev;
bool force_dac2 = false;
u32 tmp;
@@ -2974,9 +2971,7 @@ void r100_pll_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v)
static void r100_set_safe_registers(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
-
- if (ASIC_IS_RN50(ddev)) {
+ if (ASIC_IS_RN50(rdev)) {
rdev->config.r100.reg_safe_bm = rn50_reg_safe_bm;
rdev->config.r100.reg_safe_bm_size = ARRAY_SIZE(rn50_reg_safe_bm);
} else if (rdev->family < CHIP_R200) {
@@ -3163,7 +3158,6 @@ int r100_set_surface_reg(struct radeon_device *rdev, int reg,
uint32_t tiling_flags, uint32_t pitch,
uint32_t offset, uint32_t obj_size)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
int surf_index = reg * 16;
int flags = 0;
@@ -3193,7 +3187,7 @@ int r100_set_surface_reg(struct radeon_device *rdev, int reg,
/* when we aren't tiling the pitch seems to needs to be furtherdivided down. - tested on power5 + rn50 server */
if (tiling_flags & (RADEON_TILING_SWAP_16BIT | RADEON_TILING_SWAP_32BIT)) {
if (!(tiling_flags & (RADEON_TILING_MACRO | RADEON_TILING_MICRO)))
- if (ASIC_IS_RN50(ddev))
+ if (ASIC_IS_RN50(rdev))
pitch /= 16;
}
@@ -3985,7 +3979,6 @@ static int r100_startup(struct radeon_device *rdev)
int r100_resume(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
int r;
/* Make sur GART are not working */
@@ -4000,7 +3993,7 @@ int r100_resume(struct radeon_device *rdev)
RREG32(R_0007C0_CP_STAT));
}
/* post */
- radeon_combios_asic_init(ddev);
+ radeon_combios_asic_init(rdev->ddev);
/* Resume clock after posting */
r100_clock_startup(rdev);
/* Initialize surface registers */
@@ -4068,7 +4061,6 @@ void r100_restore_sanity(struct radeon_device *rdev)
int r100_init(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
int r;
/* Register debugfs file specific to this group of asics */
@@ -4108,7 +4100,7 @@ int r100_init(struct radeon_device *rdev)
/* Set asic errata */
r100_errata(rdev);
/* Initialize clocks */
- radeon_get_clock_info(ddev);
+ radeon_get_clock_info(rdev->ddev);
/* initialize AGP */
if (rdev->flags & RADEON_IS_AGP) {
r = radeon_agp_init(rdev);
diff --git a/sys/dev/pci/drm/radeon/r300.c b/sys/dev/pci/drm/radeon/r300.c
index 74e71016a40..247f1b1e1d8 100644
--- a/sys/dev/pci/drm/radeon/r300.c
+++ b/sys/dev/pci/drm/radeon/r300.c
@@ -323,7 +323,7 @@ int r300_mc_wait_for_idle(struct radeon_device *rdev)
static void r300_gpu_init(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
+ struct drm_device *ddev = rdev->ddev;
uint32_t gb_tile_config, tmp;
if ((rdev->family == CHIP_R300 && ddev->pci_device != 0x4144) ||
@@ -1406,7 +1406,6 @@ static int r300_startup(struct radeon_device *rdev)
int r300_resume(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
int r;
/* Make sur GART are not working */
@@ -1423,7 +1422,7 @@ int r300_resume(struct radeon_device *rdev)
RREG32(R_0007C0_CP_STAT));
}
/* post */
- radeon_combios_asic_init(ddev);
+ radeon_combios_asic_init(rdev->ddev);
/* Resume clock after posting */
r300_clock_startup(rdev);
/* Initialize surface registers */
@@ -1470,7 +1469,6 @@ void r300_fini(struct radeon_device *rdev)
int r300_init(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
int r;
/* Disable VGA */
@@ -1508,7 +1506,7 @@ int r300_init(struct radeon_device *rdev)
/* Set asic errata */
r300_errata(rdev);
/* Initialize clocks */
- radeon_get_clock_info(ddev);
+ radeon_get_clock_info(rdev->ddev);
/* initialize AGP */
if (rdev->flags & RADEON_IS_AGP) {
r = radeon_agp_init(rdev);
diff --git a/sys/dev/pci/drm/radeon/r420.c b/sys/dev/pci/drm/radeon/r420.c
index 0f5080e2d83..c6d3fb7daa8 100644
--- a/sys/dev/pci/drm/radeon/r420.c
+++ b/sys/dev/pci/drm/radeon/r420.c
@@ -81,7 +81,6 @@ static void r420_set_reg_safe(struct radeon_device *rdev)
void r420_pipes_init(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
unsigned tmp;
unsigned gb_pipe_select;
unsigned num_pipes;
@@ -99,8 +98,8 @@ void r420_pipes_init(struct radeon_device *rdev)
num_pipes = ((gb_pipe_select >> 12) & 3) + 1;
/* SE chips have 1 pipe */
- if ((ddev->pci_device == 0x5e4c) ||
- (ddev->pci_device == 0x5e4f))
+ if ((rdev->ddev->pci_device == 0x5e4c) ||
+ (rdev->ddev->pci_device == 0x5e4f))
num_pipes = 1;
rdev->num_gb_pipes = num_pipes;
@@ -285,7 +284,6 @@ static int r420_startup(struct radeon_device *rdev)
int r420_resume(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
int r;
/* Make sur GART are not working */
@@ -305,7 +303,7 @@ int r420_resume(struct radeon_device *rdev)
if (rdev->is_atom_bios) {
atom_asic_init(rdev->mode_info.atom_context);
} else {
- radeon_combios_asic_init(ddev);
+ radeon_combios_asic_init(rdev->ddev);
}
/* Resume clock after posting */
r420_clock_resume(rdev);
@@ -358,7 +356,6 @@ void r420_fini(struct radeon_device *rdev)
int r420_init(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
int r;
/* Initialize scratch registers */
@@ -396,7 +393,7 @@ int r420_init(struct radeon_device *rdev)
return -EINVAL;
/* Initialize clocks */
- radeon_get_clock_info(ddev);
+ radeon_get_clock_info(rdev->ddev);
/* initialize AGP */
if (rdev->flags & RADEON_IS_AGP) {
r = radeon_agp_init(rdev);
diff --git a/sys/dev/pci/drm/radeon/r520.c b/sys/dev/pci/drm/radeon/r520.c
index 9f274f80668..c6ab0b33faa 100644
--- a/sys/dev/pci/drm/radeon/r520.c
+++ b/sys/dev/pci/drm/radeon/r520.c
@@ -244,7 +244,6 @@ int r520_resume(struct radeon_device *rdev)
int r520_init(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
int r;
/* Initialize scratch registers */
@@ -283,7 +282,7 @@ int r520_init(struct radeon_device *rdev)
atom_asic_init(rdev->mode_info.atom_context);
}
/* Initialize clocks */
- radeon_get_clock_info(ddev);
+ radeon_get_clock_info(rdev->ddev);
/* initialize AGP */
if (rdev->flags & RADEON_IS_AGP) {
r = radeon_agp_init(rdev);
diff --git a/sys/dev/pci/drm/radeon/r600.c b/sys/dev/pci/drm/radeon/r600.c
index 0b5cd35a432..a0ed88d0660 100644
--- a/sys/dev/pci/drm/radeon/r600.c
+++ b/sys/dev/pci/drm/radeon/r600.c
@@ -706,7 +706,7 @@ void r600_hpd_set_polarity(struct radeon_device *rdev,
void r600_hpd_init(struct radeon_device *rdev)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
+ struct drm_device *dev = rdev->ddev;
struct drm_connector *connector;
unsigned enable = 0;
@@ -772,7 +772,7 @@ void r600_hpd_init(struct radeon_device *rdev)
void r600_hpd_fini(struct radeon_device *rdev)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
+ struct drm_device *dev = rdev->ddev;
struct drm_connector *connector;
unsigned disable = 0;
@@ -2914,7 +2914,6 @@ int r600_suspend(struct radeon_device *rdev)
*/
int r600_init(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
int r;
if (r600_debugfs_mc_info_init(rdev)) {
@@ -2947,7 +2946,7 @@ int r600_init(struct radeon_device *rdev)
/* Initialize surface registers */
radeon_surface_init(rdev);
/* Initialize clocks */
- radeon_get_clock_info(ddev);
+ radeon_get_clock_info(rdev->ddev);
/* Fence driver */
r = radeon_fence_driver_init(rdev);
if (r)
@@ -3853,7 +3852,6 @@ static u32 r600_get_ih_wptr(struct radeon_device *rdev)
int r600_irq_process(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
u32 wptr;
u32 rptr;
u32 src_id, src_data;
@@ -3896,7 +3894,7 @@ restart_ih:
case 0: /* D1 vblank */
if (rdev->irq.stat_regs.r600.disp_int & LB_D1_VBLANK_INTERRUPT) {
if (rdev->irq.crtc_vblank_int[0]) {
- drm_handle_vblank(ddev, 0);
+ drm_handle_vblank(rdev->ddev, 0);
rdev->pm.vblank_sync = true;
wakeup(&rdev->irq.vblank_queue);
}
@@ -3922,7 +3920,7 @@ restart_ih:
case 0: /* D2 vblank */
if (rdev->irq.stat_regs.r600.disp_int & LB_D2_VBLANK_INTERRUPT) {
if (rdev->irq.crtc_vblank_int[1]) {
- drm_handle_vblank(ddev, 1);
+ drm_handle_vblank(rdev->ddev, 1);
rdev->pm.vblank_sync = true;
wakeup(&rdev->irq.vblank_queue);
}
@@ -4120,7 +4118,6 @@ void r600_ioctl_wait_idle(struct radeon_device *rdev, struct radeon_bo *bo)
void r600_set_pcie_lanes(struct radeon_device *rdev, int lanes)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
u32 link_width_cntl, mask, target_reg;
if (rdev->flags & RADEON_IS_IGP)
@@ -4130,7 +4127,7 @@ void r600_set_pcie_lanes(struct radeon_device *rdev, int lanes)
return;
/* x2 cards have a special sequence */
- if (ASIC_IS_X2(ddev))
+ if (ASIC_IS_X2(rdev))
return;
/* FIXME wait for idle */
@@ -4203,7 +4200,6 @@ void r600_set_pcie_lanes(struct radeon_device *rdev, int lanes)
int r600_get_pcie_lanes(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
u32 link_width_cntl;
if (rdev->flags & RADEON_IS_IGP)
@@ -4213,7 +4209,7 @@ int r600_get_pcie_lanes(struct radeon_device *rdev)
return 0;
/* x2 cards have a special sequence */
- if (ASIC_IS_X2(ddev))
+ if (ASIC_IS_X2(rdev))
return 0;
/* FIXME wait for idle */
diff --git a/sys/dev/pci/drm/radeon/r600_cs.c b/sys/dev/pci/drm/radeon/r600_cs.c
index 9d284645388..31cfc7637f6 100644
--- a/sys/dev/pci/drm/radeon/r600_cs.c
+++ b/sys/dev/pci/drm/radeon/r600_cs.c
@@ -967,7 +967,6 @@ static int r600_cs_packet_next_is_pkt3_nop(struct radeon_cs_parser *p)
*/
static int r600_cs_packet_parse_vline(struct radeon_cs_parser *p)
{
- struct drm_device *ddev = (struct drm_device *)p->rdev->drmdev;
struct drm_mode_object *obj;
struct drm_crtc *crtc;
struct radeon_crtc *radeon_crtc;
@@ -1025,7 +1024,7 @@ static int r600_cs_packet_parse_vline(struct radeon_cs_parser *p)
crtc_id = radeon_get_ib_value(p, h_idx + 2 + 7 + 1);
reg = CP_PACKET0_GET_REG(header);
- obj = drm_mode_object_find(ddev, crtc_id, DRM_MODE_OBJECT_CRTC);
+ obj = drm_mode_object_find(p->rdev->ddev, crtc_id, DRM_MODE_OBJECT_CRTC);
if (!obj) {
DRM_ERROR("cannot find crtc %d\n", crtc_id);
return -EINVAL;
diff --git a/sys/dev/pci/drm/radeon/radeon.h b/sys/dev/pci/drm/radeon/radeon.h
index c346027948e..7ffe80ca35a 100644
--- a/sys/dev/pci/drm/radeon/radeon.h
+++ b/sys/dev/pci/drm/radeon/radeon.h
@@ -1544,7 +1544,8 @@ typedef void (*radeon_wreg_t)(struct radeon_device*, uint32_t, uint32_t);
struct radeon_device {
struct device dev;
- struct device *drmdev;
+ struct drm_device *ddev;
+// struct device *drmdev;
pci_chipset_tag_t pc;
pcitag_t pa_tag;
@@ -1745,8 +1746,8 @@ void r100_pll_errata_after_index(struct radeon_device *rdev);
/*
* ASICs helpers.
*/
-#define ASIC_IS_RN50(ddev) ((ddev->pci_device == 0x515e) || \
- (ddev->pci_device == 0x5969))
+#define ASIC_IS_RN50(rdev) ((rdev->ddev->pci_device == 0x515e) || \
+ (rdev->ddev->pci_device == 0x5969))
#define ASIC_IS_RV100(rdev) ((rdev->family == CHIP_RV100) || \
(rdev->family == CHIP_RV200) || \
(rdev->family == CHIP_RS100) || \
@@ -1763,14 +1764,14 @@ void r100_pll_errata_after_index(struct radeon_device *rdev);
(rdev->family == CHIP_RV410) || \
(rdev->family == CHIP_RS400) || \
(rdev->family == CHIP_RS480))
-#define ASIC_IS_X2(ddev) ((ddev->pci_device == 0x9441) || \
- (ddev->pci_device == 0x9443) || \
- (ddev->pci_device == 0x944B) || \
- (ddev->pci_device == 0x9506) || \
- (ddev->pci_device == 0x9509) || \
- (ddev->pci_device == 0x950F) || \
- (ddev->pci_device == 0x689C) || \
- (ddev->pci_device == 0x689D))
+#define ASIC_IS_X2(rdev) ((rdev->ddev->pci_device == 0x9441) || \
+ (rdev->ddev->pci_device == 0x9443) || \
+ (rdev->ddev->pci_device == 0x944B) || \
+ (rdev->ddev->pci_device == 0x9506) || \
+ (rdev->ddev->pci_device == 0x9509) || \
+ (rdev->ddev->pci_device == 0x950F) || \
+ (rdev->ddev->pci_device == 0x689C) || \
+ (rdev->ddev->pci_device == 0x689D))
#define ASIC_IS_AVIVO(rdev) ((rdev->family >= CHIP_RS600))
#define ASIC_IS_DCE2(rdev) ((rdev->family == CHIP_RS600) || \
(rdev->family == CHIP_RS690) || \
diff --git a/sys/dev/pci/drm/radeon/radeon_agp.c b/sys/dev/pci/drm/radeon/radeon_agp.c
index 8cff05172a5..20790cad5a9 100644
--- a/sys/dev/pci/drm/radeon/radeon_agp.c
+++ b/sys/dev/pci/drm/radeon/radeon_agp.c
@@ -132,7 +132,6 @@ int radeon_agp_init(struct radeon_device *rdev)
printf("%s stub\n", __func__);
return -ENOSYS;
#ifdef notyet
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
struct radeon_agpmode_quirk *p = radeon_agpmode_quirk_list;
struct drm_agp_mode mode;
struct drm_agp_info info;
@@ -142,22 +141,22 @@ int radeon_agp_init(struct radeon_device *rdev)
int ret;
/* Acquire AGP. */
- ret = drm_agp_acquire(ddev);
+ ret = drm_agp_acquire(rdev->ddev);
if (ret) {
DRM_ERROR("Unable to acquire AGP: %d\n", ret);
return ret;
}
- ret = drm_agp_info(ddev, &info);
+ ret = drm_agp_info(rdev->ddev, &info);
if (ret) {
- drm_agp_release(ddev);
+ drm_agp_release(rdev->ddev);
DRM_ERROR("Unable to get AGP info: %d\n", ret);
return ret;
}
#ifdef notyet
if (ddev->agp->agp_info.aper_size < 32) {
- drm_agp_release(ddev);
+ drm_agp_release(rdev->ddev);
dev_warn(rdev->dev, "AGP aperture too small (%zuM) "
"need at least 32M, disabling AGP\n",
ddev->agp->agp_info.aper_size);
@@ -282,10 +281,8 @@ void radeon_agp_resume(struct radeon_device *rdev)
void radeon_agp_fini(struct radeon_device *rdev)
{
#if __OS_HAS_AGP
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
-
- if (ddev->agp && ddev->agp->acquired) {
- drm_agp_release(ddev);
+ if (rdev->ddev->agp && rdev->ddev->agp->acquired) {
+ drm_agp_release(rdev->ddev);
}
#endif
}
diff --git a/sys/dev/pci/drm/radeon/radeon_atombios.c b/sys/dev/pci/drm/radeon/radeon_atombios.c
index 8c9a88ebf1c..045a0d2b90a 100644
--- a/sys/dev/pci/drm/radeon/radeon_atombios.c
+++ b/sys/dev/pci/drm/radeon/radeon_atombios.c
@@ -192,7 +192,6 @@ static struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_device *rd
void radeon_atombios_i2c_init(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
struct atom_context *ctx = rdev->mode_info.atom_context;
ATOM_GPIO_I2C_ASSIGMENT *gpio;
struct radeon_i2c_bus_rec i2c;
@@ -217,7 +216,7 @@ void radeon_atombios_i2c_init(struct radeon_device *rdev)
if (i2c.valid) {
snprintf(stmp, sizeof(stmp), "0x%x", i2c.i2c_id);
- rdev->i2c_bus[i] = radeon_i2c_create(ddev, &i2c, stmp);
+ rdev->i2c_bus[i] = radeon_i2c_create(rdev->ddev, &i2c, stmp);
}
}
}
diff --git a/sys/dev/pci/drm/radeon/radeon_bios.c b/sys/dev/pci/drm/radeon/radeon_bios.c
index d4d07e311cc..3898d2609d6 100644
--- a/sys/dev/pci/drm/radeon/radeon_bios.c
+++ b/sys/dev/pci/drm/radeon/radeon_bios.c
@@ -470,7 +470,6 @@ static bool avivo_read_disabled_bios(struct radeon_device *rdev)
static bool legacy_read_disabled_bios(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
uint32_t seprom_cntl1;
uint32_t viph_control;
uint32_t bus_cntl;
@@ -491,7 +490,7 @@ static bool legacy_read_disabled_bios(struct radeon_device *rdev)
crtc_ext_cntl = RREG32(RADEON_CRTC_EXT_CNTL);
fp2_gen_cntl = 0;
- if (ddev->pci_device == PCI_PRODUCT_ATI_RADEON_QY) {
+ if (rdev->ddev->pci_device == PCI_PRODUCT_ATI_RADEON_QY) {
fp2_gen_cntl = RREG32(RADEON_FP2_GEN_CNTL);
}
@@ -528,7 +527,7 @@ static bool legacy_read_disabled_bios(struct radeon_device *rdev)
(RADEON_CRTC_SYNC_TRISTAT |
RADEON_CRTC_DISPLAY_DIS)));
- if (ddev->pci_device == PCI_PRODUCT_ATI_RADEON_QY) {
+ if (rdev->ddev->pci_device == PCI_PRODUCT_ATI_RADEON_QY) {
WREG32(RADEON_FP2_GEN_CNTL, (fp2_gen_cntl & ~RADEON_FP2_ON));
}
@@ -546,7 +545,7 @@ static bool legacy_read_disabled_bios(struct radeon_device *rdev)
WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl);
}
WREG32(RADEON_CRTC_EXT_CNTL, crtc_ext_cntl);
- if (ddev->pci_device == PCI_PRODUCT_ATI_RADEON_QY) {
+ if (rdev->ddev->pci_device == PCI_PRODUCT_ATI_RADEON_QY) {
WREG32(RADEON_FP2_GEN_CNTL, fp2_gen_cntl);
}
return r;
diff --git a/sys/dev/pci/drm/radeon/radeon_combios.c b/sys/dev/pci/drm/radeon/radeon_combios.c
index 028309b94f6..e87d00bcb03 100644
--- a/sys/dev/pci/drm/radeon/radeon_combios.c
+++ b/sys/dev/pci/drm/radeon/radeon_combios.c
@@ -445,11 +445,10 @@ static uint16_t combios_get_table_offset(struct drm_device *dev,
bool radeon_combios_check_hardcoded_edid(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
int edid_info, size;
struct edid *edid;
unsigned char *raw;
- edid_info = combios_get_table_offset(ddev, COMBIOS_HARDCODED_EDID_TABLE);
+ edid_info = combios_get_table_offset(rdev->ddev, COMBIOS_HARDCODED_EDID_TABLE);
if (!edid_info)
return false;
@@ -719,7 +718,7 @@ static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rde
static struct radeon_i2c_bus_rec radeon_combios_get_i2c_info_from_table(struct radeon_device *rdev)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
+ struct drm_device *dev = rdev->ddev;
struct radeon_i2c_bus_rec i2c;
u16 offset;
u8 id, blocks, clk, data;
@@ -747,7 +746,7 @@ static struct radeon_i2c_bus_rec radeon_combios_get_i2c_info_from_table(struct r
void radeon_combios_i2c_init(struct radeon_device *rdev)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
+ struct drm_device *dev = rdev->ddev;
struct radeon_i2c_bus_rec i2c;
/* actual hw pads
@@ -889,7 +888,7 @@ bool radeon_combios_get_clock_info(struct drm_device *dev)
bool radeon_combios_sideport_present(struct radeon_device *rdev)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
+ struct drm_device *dev = rdev->ddev;
u16 igp_info;
/* sideport is AMD only */
@@ -986,7 +985,7 @@ struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct
enum radeon_tv_std
radeon_combios_get_tv_info(struct radeon_device *rdev)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
+ struct drm_device *dev = rdev->ddev;
uint16_t tv_info;
enum radeon_tv_std tv_std = TV_STD_NTSC;
@@ -2703,7 +2702,7 @@ static const char *thermal_controller_names[] = {
void radeon_combios_get_power_modes(struct radeon_device *rdev)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
+ struct drm_device *dev = rdev->ddev;
u16 offset, misc, misc2 = 0;
u8 rev, blocks, tmp;
int state_index = 0;
@@ -3351,7 +3350,7 @@ static void combios_write_ram_size(struct drm_device *dev)
mem_cntl = RBIOS32(offset + 1);
mem_size = RBIOS16(offset + 5);
if ((rdev->family < CHIP_R200) &&
- !ASIC_IS_RN50(dev))
+ !ASIC_IS_RN50(rdev))
WREG32(RADEON_MEM_CNTL, mem_cntl);
}
}
@@ -3363,7 +3362,7 @@ static void combios_write_ram_size(struct drm_device *dev)
rev = RBIOS8(offset - 1);
if (rev < 1) {
if ((rdev->family < CHIP_R200)
- && !ASIC_IS_RN50(dev)) {
+ && !ASIC_IS_RN50(rdev)) {
int ram = 0;
int mem_addr_mapping = 0;
diff --git a/sys/dev/pci/drm/radeon/radeon_cs.c b/sys/dev/pci/drm/radeon/radeon_cs.c
index 0407c0351cf..fd4ea45dd21 100644
--- a/sys/dev/pci/drm/radeon/radeon_cs.c
+++ b/sys/dev/pci/drm/radeon/radeon_cs.c
@@ -34,7 +34,7 @@ void r100_cs_dump_packet(struct radeon_cs_parser *p,
static int radeon_cs_parser_relocs(struct radeon_cs_parser *p)
{
- struct drm_device *ddev = (struct drm_device *)p->rdev->drmdev;
+ struct drm_device *ddev = p->rdev->ddev;
struct radeon_cs_chunk *chunk;
unsigned i, j;
bool duplicate;
diff --git a/sys/dev/pci/drm/radeon/radeon_device.c b/sys/dev/pci/drm/radeon/radeon_device.c
index 05e5d9e724a..91d3f6a3628 100644
--- a/sys/dev/pci/drm/radeon/radeon_device.c
+++ b/sys/dev/pci/drm/radeon/radeon_device.c
@@ -523,8 +523,6 @@ void radeon_update_bandwidth_info(struct radeon_device *rdev)
*/
bool radeon_boot_test_post_card(struct radeon_device *rdev)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
-
if (radeon_card_posted(rdev))
return true;
@@ -533,7 +531,7 @@ bool radeon_boot_test_post_card(struct radeon_device *rdev)
if (rdev->is_atom_bios)
atom_asic_init(rdev->mode_info.atom_context);
else
- radeon_combios_asic_init(dev);
+ radeon_combios_asic_init(rdev->ddev);
return true;
} else {
dev_err(rdev->dev, "Card not posted and no BIOS - ignoring\n");
@@ -553,11 +551,9 @@ bool radeon_boot_test_post_card(struct radeon_device *rdev)
*/
int radeon_dummy_page_init(struct radeon_device *rdev)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
-
if (rdev->dummy_page.dmah)
return 0;
- rdev->dummy_page.dmah = drm_dmamem_alloc(dev->dmat, PAGE_SIZE, PAGE_SIZE, 1,
+ rdev->dummy_page.dmah = drm_dmamem_alloc(rdev->dmat, PAGE_SIZE, PAGE_SIZE, 1,
PAGE_SIZE, 0, BUS_DMA_WAITOK);
if (!rdev->dummy_page.dmah)
return -ENOMEM;
@@ -574,12 +570,10 @@ int radeon_dummy_page_init(struct radeon_device *rdev)
*/
void radeon_dummy_page_fini(struct radeon_device *rdev)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
-
if (rdev->dummy_page.dmah == NULL)
return;
- drm_dmamem_free(dev->dmat, rdev->dummy_page.dmah);
+ drm_dmamem_free(rdev->dmat, rdev->dummy_page.dmah);
rdev->dummy_page.dmah = NULL;
rdev->dummy_page.addr = 0;
}
@@ -750,7 +744,6 @@ cail_ioreg_read(struct card_info *info, uint32_t reg)
*/
int radeon_atombios_init(struct radeon_device *rdev)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
struct card_info *atom_card_info =
malloc(sizeof(struct card_info), M_DRM, M_WAITOK | M_ZERO);
@@ -758,7 +751,7 @@ int radeon_atombios_init(struct radeon_device *rdev)
return -ENOMEM;
rdev->mode_info.atom_card_info = atom_card_info;
- atom_card_info->dev = dev;
+ atom_card_info->dev = rdev->ddev;
atom_card_info->reg_read = cail_reg_read;
atom_card_info->reg_write = cail_reg_write;
/* needed for iio ops */
@@ -777,7 +770,7 @@ int radeon_atombios_init(struct radeon_device *rdev)
rdev->mode_info.atom_context = atom_parse(atom_card_info, rdev->bios);
rw_init(&rdev->mode_info.atom_context->rwlock, "atomcon");
- radeon_atom_initialize_bios_scratch_regs(dev);
+ radeon_atom_initialize_bios_scratch_regs(rdev->ddev);
atom_allocate_fb_scratch(rdev->mode_info.atom_context);
return 0;
}
@@ -818,8 +811,7 @@ void radeon_atombios_fini(struct radeon_device *rdev)
*/
int radeon_combios_init(struct radeon_device *rdev)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
- radeon_combios_initialize_bios_scratch_regs(dev);
+ radeon_combios_initialize_bios_scratch_regs(rdev->ddev);
return 0;
}
diff --git a/sys/dev/pci/drm/radeon/radeon_display.c b/sys/dev/pci/drm/radeon/radeon_display.c
index 076458c546f..cf6833eeefa 100644
--- a/sys/dev/pci/drm/radeon/radeon_display.c
+++ b/sys/dev/pci/drm/radeon/radeon_display.c
@@ -270,7 +270,6 @@ static void radeon_unpin_work_func(struct work_struct *__work)
void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc_id];
struct radeon_unpin_work *work;
#ifdef notyet
@@ -280,11 +279,11 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id)
u32 update_pending;
int vpos, hpos;
- mtx_enter(&ddev->event_lock);
+ mtx_enter(&rdev->ddev->event_lock);
work = radeon_crtc->unpin_work;
if (work == NULL ||
(work->fence && !radeon_fence_signaled(work->fence))) {
- mtx_leave(&ddev->event_lock);
+ mtx_leave(&rdev->ddev->event_lock);
return;
}
/* New pageflip, or just completion of a previous one? */
@@ -304,7 +303,7 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id)
* to complete in this vblank?
*/
if (update_pending &&
- (DRM_SCANOUTPOS_VALID & radeon_get_crtc_scanoutpos(ddev, crtc_id,
+ (DRM_SCANOUTPOS_VALID & radeon_get_crtc_scanoutpos(rdev->ddev, crtc_id,
&vpos, &hpos)) &&
((vpos >= (99 * rdev->mode_info.crtcs[crtc_id]->base.hwmode.crtc_vdisplay)/100) ||
(vpos < 0 && !ASIC_IS_AVIVO(rdev)))) {
@@ -323,7 +322,7 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id)
* next vblank irq.
*/
radeon_crtc->deferred_flip_completion = 1;
- mtx_leave(&ddev->event_lock);
+ mtx_leave(&rdev->ddev->event_lock);
return;
}
@@ -334,16 +333,16 @@ void radeon_crtc_handle_flip(struct radeon_device *rdev, int crtc_id)
#ifdef notyet
if (work->event) {
e = work->event;
- e->event.sequence = drm_vblank_count_and_time(ddev, crtc_id, &now);
+ e->event.sequence = drm_vblank_count_and_time(rdev->ddev, crtc_id, &now);
e->event.tv_sec = now.tv_sec;
e->event.tv_usec = now.tv_usec;
list_add_tail(&e->base.link, &e->base.file_priv->event_list);
wake_up_interruptible(&e->base.file_priv->event_wait);
}
#endif
- mtx_leave(&ddev->event_lock);
+ mtx_leave(&rdev->ddev->event_lock);
- drm_vblank_put(ddev, radeon_crtc->crtc_id);
+ drm_vblank_put(rdev->ddev, radeon_crtc->crtc_id);
radeon_fence_unref(&work->fence);
radeon_post_page_flip(work->rdev, work->crtc_id);
#ifdef notyet
@@ -1175,12 +1174,11 @@ static struct drm_prop_enum_list radeon_underscan_enum_list[] =
static int radeon_modeset_create_props(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
int sz;
if (rdev->is_atom_bios) {
rdev->mode_info.coherent_mode_property =
- drm_property_create_range(ddev, 0 , "coherent", 0, 1);
+ drm_property_create_range(rdev->ddev, 0 , "coherent", 0, 1);
if (!rdev->mode_info.coherent_mode_property)
return -ENOMEM;
}
@@ -1188,38 +1186,38 @@ static int radeon_modeset_create_props(struct radeon_device *rdev)
if (!ASIC_IS_AVIVO(rdev)) {
sz = ARRAY_SIZE(radeon_tmds_pll_enum_list);
rdev->mode_info.tmds_pll_property =
- drm_property_create_enum(ddev, 0,
+ drm_property_create_enum(rdev->ddev, 0,
"tmds_pll",
radeon_tmds_pll_enum_list, sz);
}
rdev->mode_info.load_detect_property =
- drm_property_create_range(ddev, 0, "load detection", 0, 1);
+ drm_property_create_range(rdev->ddev, 0, "load detection", 0, 1);
if (!rdev->mode_info.load_detect_property)
return -ENOMEM;
- drm_mode_create_scaling_mode_property(ddev);
+ drm_mode_create_scaling_mode_property(rdev->ddev);
sz = ARRAY_SIZE(radeon_tv_std_enum_list);
rdev->mode_info.tv_std_property =
- drm_property_create_enum(ddev, 0,
+ drm_property_create_enum(rdev->ddev, 0,
"tv standard",
radeon_tv_std_enum_list, sz);
sz = ARRAY_SIZE(radeon_underscan_enum_list);
rdev->mode_info.underscan_property =
- drm_property_create_enum(ddev, 0,
+ drm_property_create_enum(rdev->ddev, 0,
"underscan",
radeon_underscan_enum_list, sz);
rdev->mode_info.underscan_hborder_property =
- drm_property_create_range(ddev, 0,
+ drm_property_create_range(rdev->ddev, 0,
"underscan hborder", 0, 128);
if (!rdev->mode_info.underscan_hborder_property)
return -ENOMEM;
rdev->mode_info.underscan_vborder_property =
- drm_property_create_range(ddev, 0,
+ drm_property_create_range(rdev->ddev, 0,
"underscan vborder", 0, 128);
if (!rdev->mode_info.underscan_vborder_property)
return -ENOMEM;
@@ -1346,30 +1344,29 @@ static void radeon_afmt_fini(struct radeon_device *rdev)
int radeon_modeset_init(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
int i;
int ret;
- drm_mode_config_init(ddev);
+ drm_mode_config_init(rdev->ddev);
rdev->mode_info.mode_config_initialized = true;
- ddev->mode_config.funcs = &radeon_mode_funcs;
+ rdev->ddev->mode_config.funcs = &radeon_mode_funcs;
if (ASIC_IS_DCE5(rdev)) {
- ddev->mode_config.max_width = 16384;
- ddev->mode_config.max_height = 16384;
+ rdev->ddev->mode_config.max_width = 16384;
+ rdev->ddev->mode_config.max_height = 16384;
} else if (ASIC_IS_AVIVO(rdev)) {
- ddev->mode_config.max_width = 8192;
- ddev->mode_config.max_height = 8192;
+ rdev->ddev->mode_config.max_width = 8192;
+ rdev->ddev->mode_config.max_height = 8192;
} else {
- ddev->mode_config.max_width = 4096;
- ddev->mode_config.max_height = 4096;
+ rdev->ddev->mode_config.max_width = 4096;
+ rdev->ddev->mode_config.max_height = 4096;
}
- ddev->mode_config.preferred_depth = 24;
- ddev->mode_config.prefer_shadow = 1;
+ rdev->ddev->mode_config.preferred_depth = 24;
+ rdev->ddev->mode_config.prefer_shadow = 1;
- ddev->mode_config.fb_base = rdev->mc.aper_base;
+ rdev->ddev->mode_config.fb_base = rdev->mc.aper_base;
ret = radeon_modeset_create_props(rdev);
if (ret) {
@@ -1387,11 +1384,11 @@ int radeon_modeset_init(struct radeon_device *rdev)
/* allocate crtcs */
for (i = 0; i < rdev->num_crtc; i++) {
- radeon_crtc_init(ddev, i);
+ radeon_crtc_init(rdev->ddev, i);
}
/* okay we should have all the bios connectors */
- ret = radeon_setup_enc_conn(ddev);
+ ret = radeon_setup_enc_conn(rdev->ddev);
if (!ret) {
return ret;
}
@@ -1412,23 +1409,22 @@ int radeon_modeset_init(struct radeon_device *rdev)
radeon_pm_init(rdev);
radeon_fbdev_init(rdev);
- drm_kms_helper_poll_init(ddev);
+ drm_kms_helper_poll_init(rdev->ddev);
return 0;
}
void radeon_modeset_fini(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
radeon_fbdev_fini(rdev);
free(rdev->mode_info.bios_hardcoded_edid, M_DRM);
radeon_pm_fini(rdev);
if (rdev->mode_info.mode_config_initialized) {
radeon_afmt_fini(rdev);
- drm_kms_helper_poll_fini(ddev);
+ drm_kms_helper_poll_fini(rdev->ddev);
radeon_hpd_fini(rdev);
- drm_mode_config_cleanup(ddev);
+ drm_mode_config_cleanup(rdev->ddev);
rdev->mode_info.mode_config_initialized = false;
}
/* free i2c buses */
diff --git a/sys/dev/pci/drm/radeon/radeon_fb.c b/sys/dev/pci/drm/radeon/radeon_fb.c
index c0919a6489f..2964977650d 100644
--- a/sys/dev/pci/drm/radeon/radeon_fb.c
+++ b/sys/dev/pci/drm/radeon/radeon_fb.c
@@ -361,13 +361,12 @@ static struct drm_fb_helper_funcs radeon_fb_helper_funcs = {
int radeon_fbdev_init(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
struct radeon_fbdev *rfbdev;
int bpp_sel = 32;
int ret;
/* select 8 bpp console on RN50 or 16MB cards */
- if (ASIC_IS_RN50(ddev) || rdev->mc.real_vram_size <= (32*1024*1024))
+ if (ASIC_IS_RN50(rdev) || rdev->mc.real_vram_size <= (32*1024*1024))
bpp_sel = 8;
rfbdev = malloc(sizeof(struct radeon_fbdev), M_DRM, M_WAITOK | M_ZERO);
@@ -378,7 +377,7 @@ int radeon_fbdev_init(struct radeon_device *rdev)
rdev->mode_info.rfbdev = rfbdev;
rfbdev->helper.funcs = &radeon_fb_helper_funcs;
- ret = drm_fb_helper_init(ddev, &rfbdev->helper,
+ ret = drm_fb_helper_init(rdev->ddev, &rfbdev->helper,
rdev->num_crtc,
RADEONFB_CONN_LIMIT);
if (ret) {
@@ -393,12 +392,10 @@ int radeon_fbdev_init(struct radeon_device *rdev)
void radeon_fbdev_fini(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
-
if (!rdev->mode_info.rfbdev)
return;
- radeon_fbdev_destroy(ddev, rdev->mode_info.rfbdev);
+ radeon_fbdev_destroy(rdev->ddev, rdev->mode_info.rfbdev);
free(rdev->mode_info.rfbdev, M_DRM);
rdev->mode_info.rfbdev = NULL;
}
diff --git a/sys/dev/pci/drm/radeon/radeon_i2c.c b/sys/dev/pci/drm/radeon/radeon_i2c.c
index b861760928a..6e3e42ed888 100644
--- a/sys/dev/pci/drm/radeon/radeon_i2c.c
+++ b/sys/dev/pci/drm/radeon/radeon_i2c.c
@@ -1169,7 +1169,7 @@ void radeon_i2c_add(struct radeon_device *rdev,
struct radeon_i2c_bus_rec *rec,
const char *name)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
+ struct drm_device *dev = rdev->ddev;
int i;
for (i = 0; i < RADEON_MAX_I2C_BUS; i++) {
diff --git a/sys/dev/pci/drm/radeon/radeon_irq_kms.c b/sys/dev/pci/drm/radeon/radeon_irq_kms.c
index f8d7ba90e27..61311071c26 100644
--- a/sys/dev/pci/drm/radeon/radeon_irq_kms.c
+++ b/sys/dev/pci/drm/radeon/radeon_irq_kms.c
@@ -177,8 +177,6 @@ void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
bool
radeon_msi_ok(struct radeon_device *rdev)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
-
/* RV370/RV380 was first asic with MSI support */
if (rdev->family < CHIP_RV380)
return false;
@@ -195,27 +193,27 @@ radeon_msi_ok(struct radeon_device *rdev)
/* Quirks */
/* HP RS690 only seems to work with MSIs. */
- if ((dev->pci_device == 0x791f) &&
- (dev->pci_subvendor == 0x103c) &&
- (dev->pci_subdevice == 0x30c2))
+ if ((rdev->ddev->pci_device == 0x791f) &&
+ (rdev->ddev->pci_subvendor == 0x103c) &&
+ (rdev->ddev->pci_subdevice == 0x30c2))
return true;
/* Dell RS690 only seems to work with MSIs. */
- if ((dev->pci_device == 0x791f) &&
- (dev->pci_subvendor == 0x1028) &&
- (dev->pci_subdevice == 0x01fc))
+ if ((rdev->ddev->pci_device == 0x791f) &&
+ (rdev->ddev->pci_subvendor == 0x1028) &&
+ (rdev->ddev->pci_subdevice == 0x01fc))
return true;
/* Dell RS690 only seems to work with MSIs. */
- if ((dev->pci_device == 0x791f) &&
- (dev->pci_subvendor == 0x1028) &&
- (dev->pci_subdevice == 0x01fd))
+ if ((rdev->ddev->pci_device == 0x791f) &&
+ (rdev->ddev->pci_subvendor == 0x1028) &&
+ (rdev->ddev->pci_subdevice == 0x01fd))
return true;
/* Gateway RS690 only seems to work with MSIs. */
- if ((dev->pci_device == 0x791f) &&
- (dev->pci_subvendor == 0x107b) &&
- (dev->pci_subdevice == 0x0185))
+ if ((rdev->ddev->pci_device == 0x791f) &&
+ (rdev->ddev->pci_subvendor == 0x107b) &&
+ (rdev->ddev->pci_subdevice == 0x0185))
return true;
/* try and enable MSIs by default on all RS690s */
@@ -249,7 +247,6 @@ radeon_msi_ok(struct radeon_device *rdev)
*/
int radeon_irq_kms_init(struct radeon_device *rdev)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
int r = 0;
#ifdef notyet
@@ -258,7 +255,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
#endif
mtx_init(&rdev->irq.lock, IPL_NONE);
- r = drm_vblank_init(dev, rdev->num_crtc);
+ r = drm_vblank_init(rdev->ddev, rdev->num_crtc);
if (r) {
return r;
}
@@ -270,12 +267,12 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
int ret = pci_enable_msi(rdev->pdev);
if (!ret) {
rdev->msi_enabled = 1;
- dev_info(rdev->dev, "radeon: using MSI.\n");
+ dev_info(rdev->ddev, "radeon: using MSI.\n");
}
}
#endif
rdev->irq.installed = true;
- r = drm_irq_install(dev);
+ r = drm_irq_install(rdev->ddev);
if (r) {
rdev->irq.installed = false;
return r;
@@ -293,10 +290,9 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
*/
void radeon_irq_kms_fini(struct radeon_device *rdev)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
- drm_vblank_cleanup(dev);
+ drm_vblank_cleanup(rdev->ddev);
if (rdev->irq.installed) {
- drm_irq_uninstall(dev);
+ drm_irq_uninstall(rdev->ddev);
rdev->irq.installed = false;
#ifdef notyet
if (rdev->msi_enabled)
@@ -320,9 +316,7 @@ void radeon_irq_kms_fini(struct radeon_device *rdev)
*/
void radeon_irq_kms_sw_irq_get(struct radeon_device *rdev, int ring)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
-
- if (!dev->irq_enabled)
+ if (!rdev->ddev->irq_enabled)
return;
if (atomic_inc_return(&rdev->irq.ring_int[ring]) == 1) {
@@ -344,9 +338,7 @@ void radeon_irq_kms_sw_irq_get(struct radeon_device *rdev, int ring)
*/
void radeon_irq_kms_sw_irq_put(struct radeon_device *rdev, int ring)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
-
- if (!dev->irq_enabled)
+ if (!rdev->ddev->irq_enabled)
return;
if (atomic_dec_and_test(&rdev->irq.ring_int[ring])) {
@@ -367,12 +359,10 @@ void radeon_irq_kms_sw_irq_put(struct radeon_device *rdev, int ring)
*/
void radeon_irq_kms_pflip_irq_get(struct radeon_device *rdev, int crtc)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
-
if (crtc < 0 || crtc >= rdev->num_crtc)
return;
- if (!dev->irq_enabled)
+ if (!rdev->ddev->irq_enabled)
return;
if (atomic_inc_return(&rdev->irq.pflip[crtc]) == 1) {
@@ -393,12 +383,10 @@ void radeon_irq_kms_pflip_irq_get(struct radeon_device *rdev, int crtc)
*/
void radeon_irq_kms_pflip_irq_put(struct radeon_device *rdev, int crtc)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
-
if (crtc < 0 || crtc >= rdev->num_crtc)
return;
- if (!dev->irq_enabled)
+ if (!rdev->ddev->irq_enabled)
return;
if (atomic_dec_and_test(&rdev->irq.pflip[crtc])) {
@@ -418,9 +406,7 @@ void radeon_irq_kms_pflip_irq_put(struct radeon_device *rdev, int crtc)
*/
void radeon_irq_kms_enable_afmt(struct radeon_device *rdev, int block)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
-
- if (!dev->irq_enabled)
+ if (!rdev->ddev->irq_enabled)
return;
mtx_enter(&rdev->irq.lock);
@@ -440,9 +426,7 @@ void radeon_irq_kms_enable_afmt(struct radeon_device *rdev, int block)
*/
void radeon_irq_kms_disable_afmt(struct radeon_device *rdev, int block)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
-
- if (!dev->irq_enabled)
+ if (!rdev->ddev->irq_enabled)
return;
mtx_enter(&rdev->irq.lock);
@@ -461,10 +445,9 @@ void radeon_irq_kms_disable_afmt(struct radeon_device *rdev, int block)
*/
void radeon_irq_kms_enable_hpd(struct radeon_device *rdev, unsigned hpd_mask)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
int i;
- if (!dev->irq_enabled)
+ if (!rdev->ddev->irq_enabled)
return;
mtx_enter(&rdev->irq.lock);
@@ -484,10 +467,9 @@ void radeon_irq_kms_enable_hpd(struct radeon_device *rdev, unsigned hpd_mask)
*/
void radeon_irq_kms_disable_hpd(struct radeon_device *rdev, unsigned hpd_mask)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
int i;
- if (!dev->irq_enabled)
+ if (!rdev->ddev->irq_enabled)
return;
mtx_enter(&rdev->irq.lock);
diff --git a/sys/dev/pci/drm/radeon/radeon_kms.c b/sys/dev/pci/drm/radeon/radeon_kms.c
index 61fba71dd3b..5da7013910c 100644
--- a/sys/dev/pci/drm/radeon/radeon_kms.c
+++ b/sys/dev/pci/drm/radeon/radeon_kms.c
@@ -889,9 +889,9 @@ radeondrm_detach_kms(struct device *self, int flags)
radeon_modeset_fini(rdev);
radeon_device_fini(rdev);
- if (rdev->drmdev != NULL) {
- config_detach(rdev->drmdev, flags);
- rdev->drmdev = NULL;
+ if (rdev->ddev != NULL) {
+ config_detach((struct device *)rdev->ddev, flags);
+ rdev->ddev = NULL;
}
if (rdev->regs != NULL)
@@ -980,8 +980,8 @@ radeondrm_attach_kms(struct device *parent, struct device *self, void *aux)
is_agp = pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_AGP,
NULL, NULL);
- rdev->drmdev = drm_attach_pci(&kms_driver, pa, is_agp, self);
- dev = (struct drm_device *)rdev->drmdev;
+ dev = (struct drm_device *)drm_attach_pci(&kms_driver, pa, is_agp, self);
+ rdev->ddev = dev;
/* radeon_device_init should report only fatal error
* like memory allocation failure or iomapping failure,
diff --git a/sys/dev/pci/drm/radeon/radeon_legacy_encoders.c b/sys/dev/pci/drm/radeon/radeon_legacy_encoders.c
index b27bc1d2a3b..13d25af467a 100644
--- a/sys/dev/pci/drm/radeon/radeon_legacy_encoders.c
+++ b/sys/dev/pci/drm/radeon/radeon_legacy_encoders.c
@@ -645,7 +645,7 @@ static enum drm_connector_status radeon_legacy_primary_dac_detect(struct drm_enc
* console hw and often we get failure to load detect those. So to make
* everyone happy report the encoder as always connected.
*/
- if (ASIC_IS_RN50(dev)) {
+ if (ASIC_IS_RN50(rdev)) {
return connector_status_connected;
}
diff --git a/sys/dev/pci/drm/radeon/radeon_object.c b/sys/dev/pci/drm/radeon/radeon_object.c
index 6279992533e..c82ff13388f 100644
--- a/sys/dev/pci/drm/radeon/radeon_object.c
+++ b/sys/dev/pci/drm/radeon/radeon_object.c
@@ -116,7 +116,6 @@ int radeon_bo_create(struct radeon_device *rdev,
unsigned long size, int byte_align, bool kernel, u32 domain,
struct sg_table *sg, struct radeon_bo **bo_ptr)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
struct radeon_bo *bo;
struct drm_obj *drm_bo;
enum ttm_bo_type type;
@@ -141,7 +140,7 @@ int radeon_bo_create(struct radeon_device *rdev,
acc_size = ttm_bo_dma_acc_size(&rdev->mman.bdev, size,
sizeof(struct radeon_bo));
- drm_bo = drm_gem_object_alloc(ddev, size);
+ drm_bo = drm_gem_object_alloc(rdev->ddev, size);
if (drm_bo == NULL)
return -ENOMEM;
bo = gem_to_radeon_bo(drm_bo);
@@ -305,8 +304,8 @@ int radeon_bo_evict_vram(struct radeon_device *rdev)
void radeon_bo_force_delete(struct radeon_device *rdev)
{
+ struct drm_device *dev = rdev->ddev;
struct radeon_bo *bo, *n;
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
if (list_empty(&rdev->gem.objects)) {
return;
@@ -330,11 +329,10 @@ void radeon_bo_force_delete(struct radeon_device *rdev)
int radeon_bo_init(struct radeon_device *rdev)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
struct drm_local_map *map;
/* Add an MTRR for the VRAM */
- drm_addmap(dev, rdev->mc.aper_base, rdev->mc.aper_size,
+ drm_addmap(rdev->ddev, rdev->mc.aper_base, rdev->mc.aper_size,
_DRM_FRAME_BUFFER, _DRM_WRITE_COMBINING, &map);
/* fake a 'cookie', seems to be unused? */
rdev->mc.vram_mtrr = 1;
diff --git a/sys/dev/pci/drm/radeon/radeon_pm.c b/sys/dev/pci/drm/radeon/radeon_pm.c
index ce547f7fdd4..a23e7bd836e 100644
--- a/sys/dev/pci/drm/radeon/radeon_pm.c
+++ b/sys/dev/pci/drm/radeon/radeon_pm.c
@@ -247,8 +247,7 @@ static void radeon_set_power_state(struct radeon_device *rdev)
static void radeon_pm_set_clocks(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
- struct drm_device *dev = ddev;
+ struct drm_device *dev = rdev->ddev;
int i, r;
/* no need to take locks, etc. if nothing's going to change */
@@ -282,7 +281,7 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev)
for (i = 0; i < rdev->num_crtc; i++) {
if (rdev->pm.active_crtcs & (1 << i)) {
rdev->pm.req_vblank |= (1 << i);
- drm_vblank_get(ddev, i);
+ drm_vblank_get(rdev->ddev, i);
}
}
}
@@ -293,7 +292,7 @@ static void radeon_pm_set_clocks(struct radeon_device *rdev)
for (i = 0; i < rdev->num_crtc; i++) {
if (rdev->pm.req_vblank & (1 << i)) {
rdev->pm.req_vblank &= ~(1 << i);
- drm_vblank_put(ddev, i);
+ drm_vblank_put(rdev->ddev, i);
}
}
}
@@ -726,7 +725,7 @@ void radeon_pm_fini(struct radeon_device *rdev)
void radeon_pm_compute_clocks(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
+ struct drm_device *ddev = rdev->ddev;
struct drm_crtc *crtc;
struct radeon_crtc *radeon_crtc;
@@ -805,7 +804,6 @@ void radeon_pm_compute_clocks(struct radeon_device *rdev)
static bool radeon_pm_in_vbl(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
int crtc, vpos, hpos, vbl_status;
bool in_vbl = true;
@@ -814,7 +812,7 @@ static bool radeon_pm_in_vbl(struct radeon_device *rdev)
*/
for (crtc = 0; (crtc < rdev->num_crtc) && in_vbl; crtc++) {
if (rdev->pm.active_crtcs & (1 << crtc)) {
- vbl_status = radeon_get_crtc_scanoutpos(ddev, crtc, &vpos, &hpos);
+ vbl_status = radeon_get_crtc_scanoutpos(rdev->ddev, crtc, &vpos, &hpos);
if ((vbl_status & DRM_SCANOUTPOS_VALID) &&
!(vbl_status & DRM_SCANOUTPOS_INVBL))
in_vbl = false;
diff --git a/sys/dev/pci/drm/radeon/radeon_ttm.c b/sys/dev/pci/drm/radeon/radeon_ttm.c
index 9d411380c13..d572909c052 100644
--- a/sys/dev/pci/drm/radeon/radeon_ttm.c
+++ b/sys/dev/pci/drm/radeon/radeon_ttm.c
@@ -155,10 +155,8 @@ radeon_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
struct ttm_mem_type_manager *man)
{
struct radeon_device *rdev;
- struct drm_device *ddev;
rdev = radeon_get_rdev(bdev);
- ddev = (struct drm_device *)rdev->drmdev;
switch (type) {
case TTM_PL_SYSTEM:
@@ -176,13 +174,13 @@ radeon_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
#if __OS_HAS_AGP
if (rdev->flags & RADEON_IS_AGP) {
#ifdef notyet
- if (!(drm_core_has_AGP(ddev) && ddev->agp)) {
+ if (!(drm_core_has_AGP(rdev->ddev) && rdev->ddev->agp)) {
DRM_ERROR("AGP is not enabled for memory type %u\n",
(unsigned)type);
return -EINVAL;
}
#endif
- if (!ddev->agp->cant_use_aperture)
+ if (!rdev->ddev->agp->cant_use_aperture)
man->flags = TTM_MEMTYPE_FLAG_MAPPABLE;
man->available_caching = TTM_PL_FLAG_UNCACHED |
TTM_PL_FLAG_WC;
@@ -451,7 +449,6 @@ radeon_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem)
{
struct ttm_mem_type_manager *man = &bdev->man[mem->mem_type];
struct radeon_device *rdev = radeon_get_rdev(bdev);
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
mem->bus.addr = NULL;
mem->bus.offset = 0;
@@ -460,7 +457,7 @@ radeon_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem)
mem->bus.is_iomem = false;
mem->bus.iot = rdev->iot;
mem->bus.memt = rdev->memt;
- mem->bus.dmat = ddev->dmat;
+ mem->bus.dmat = rdev->dmat;
if (!(man->flags & TTM_MEMTYPE_FLAG_MAPPABLE))
return -EINVAL;
switch (mem->mem_type) {
@@ -473,7 +470,7 @@ radeon_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_reg *mem)
/* RADEON_IS_AGP is set only if AGP is active */
mem->bus.offset = mem->start << PAGE_SHIFT;
mem->bus.base = rdev->mc.agp_base;
- mem->bus.is_iomem = !ddev->agp->cant_use_aperture;
+ mem->bus.is_iomem = !rdev->ddev->agp->cant_use_aperture;
}
#endif
break;
diff --git a/sys/dev/pci/drm/radeon/rs400.c b/sys/dev/pci/drm/radeon/rs400.c
index 37ec425aeba..73398f76722 100644
--- a/sys/dev/pci/drm/radeon/rs400.c
+++ b/sys/dev/pci/drm/radeon/rs400.c
@@ -435,7 +435,6 @@ static int rs400_startup(struct radeon_device *rdev)
int rs400_resume(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
int r;
/* Make sur GART are not working */
@@ -451,7 +450,7 @@ int rs400_resume(struct radeon_device *rdev)
RREG32(R_0007C0_CP_STAT));
}
/* post */
- radeon_combios_asic_init(ddev);
+ radeon_combios_asic_init(rdev->ddev);
/* Resume clock after posting */
r300_clock_startup(rdev);
/* Initialize surface registers */
@@ -491,7 +490,6 @@ void rs400_fini(struct radeon_device *rdev)
int rs400_init(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
int r;
/* Disable VGA */
@@ -528,7 +526,7 @@ int rs400_init(struct radeon_device *rdev)
return -EINVAL;
/* Initialize clocks */
- radeon_get_clock_info(ddev);
+ radeon_get_clock_info(rdev->ddev);
/* initialize memory controller */
rs400_mc_init(rdev);
/* Fence driver */
diff --git a/sys/dev/pci/drm/radeon/rs600.c b/sys/dev/pci/drm/radeon/rs600.c
index d2642aee085..7ec471296c1 100644
--- a/sys/dev/pci/drm/radeon/rs600.c
+++ b/sys/dev/pci/drm/radeon/rs600.c
@@ -213,7 +213,7 @@ void rs600_pm_misc(struct radeon_device *rdev)
void rs600_pm_prepare(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
+ struct drm_device *ddev = rdev->ddev;
struct drm_crtc *crtc;
struct radeon_crtc *radeon_crtc;
u32 tmp;
@@ -231,7 +231,7 @@ void rs600_pm_prepare(struct radeon_device *rdev)
void rs600_pm_finish(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
+ struct drm_device *ddev = rdev->ddev;
struct drm_crtc *crtc;
struct radeon_crtc *radeon_crtc;
u32 tmp;
@@ -300,7 +300,7 @@ void rs600_hpd_set_polarity(struct radeon_device *rdev,
void rs600_hpd_init(struct radeon_device *rdev)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
+ struct drm_device *dev = rdev->ddev;
struct drm_connector *connector;
unsigned enable = 0;
@@ -326,7 +326,7 @@ void rs600_hpd_init(struct radeon_device *rdev)
void rs600_hpd_fini(struct radeon_device *rdev)
{
- struct drm_device *dev = (struct drm_device *)rdev->drmdev;
+ struct drm_device *dev = rdev->ddev;
struct drm_connector *connector;
unsigned disable = 0;
@@ -670,7 +670,6 @@ void rs600_irq_disable(struct radeon_device *rdev)
int rs600_irq_process(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
u32 status, msi_rearm;
bool queue_hotplug = false;
bool queue_hdmi = false;
@@ -691,7 +690,7 @@ int rs600_irq_process(struct radeon_device *rdev)
/* Vertical blank interrupts */
if (G_007EDC_LB_D1_VBLANK_INTERRUPT(rdev->irq.stat_regs.r500.disp_int)) {
if (rdev->irq.crtc_vblank_int[0]) {
- drm_handle_vblank(ddev, 0);
+ drm_handle_vblank(rdev->ddev, 0);
rdev->pm.vblank_sync = true;
wakeup(&rdev->irq.vblank_queue);
}
@@ -700,7 +699,7 @@ int rs600_irq_process(struct radeon_device *rdev)
}
if (G_007EDC_LB_D2_VBLANK_INTERRUPT(rdev->irq.stat_regs.r500.disp_int)) {
if (rdev->irq.crtc_vblank_int[1]) {
- drm_handle_vblank(ddev, 1);
+ drm_handle_vblank(rdev->ddev, 1);
rdev->pm.vblank_sync = true;
wakeup(&rdev->irq.vblank_queue);
}
@@ -979,7 +978,6 @@ void rs600_fini(struct radeon_device *rdev)
int rs600_init(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
int r;
/* Disable VGA */
@@ -1015,7 +1013,7 @@ int rs600_init(struct radeon_device *rdev)
return -EINVAL;
/* Initialize clocks */
- radeon_get_clock_info(ddev);
+ radeon_get_clock_info(rdev->ddev);
/* initialize memory controller */
rs600_mc_init(rdev);
rs600_debugfs(rdev);
diff --git a/sys/dev/pci/drm/radeon/rs690.c b/sys/dev/pci/drm/radeon/rs690.c
index 06a4e224eaf..e1f9f5b7fae 100644
--- a/sys/dev/pci/drm/radeon/rs690.c
+++ b/sys/dev/pci/drm/radeon/rs690.c
@@ -709,7 +709,6 @@ void rs690_fini(struct radeon_device *rdev)
int rs690_init(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
int r;
/* Disable VGA */
@@ -746,7 +745,7 @@ int rs690_init(struct radeon_device *rdev)
return -EINVAL;
/* Initialize clocks */
- radeon_get_clock_info(ddev);
+ radeon_get_clock_info(rdev->ddev);
/* initialize memory controller */
rs690_mc_init(rdev);
rv515_debugfs(rdev);
diff --git a/sys/dev/pci/drm/radeon/rv515.c b/sys/dev/pci/drm/radeon/rv515.c
index ab13bae6440..f27376d18ed 100644
--- a/sys/dev/pci/drm/radeon/rv515.c
+++ b/sys/dev/pci/drm/radeon/rv515.c
@@ -558,7 +558,6 @@ void rv515_fini(struct radeon_device *rdev)
int rv515_init(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
int r;
/* Initialize scratch registers */
@@ -592,7 +591,7 @@ int rv515_init(struct radeon_device *rdev)
if (radeon_boot_test_post_card(rdev) == false)
return -EINVAL;
/* Initialize clocks */
- radeon_get_clock_info(ddev);
+ radeon_get_clock_info(rdev->ddev);
/* initialize AGP */
if (rdev->flags & RADEON_IS_AGP) {
r = radeon_agp_init(rdev);
diff --git a/sys/dev/pci/drm/radeon/rv770.c b/sys/dev/pci/drm/radeon/rv770.c
index 1a3b1f39386..b1de88dfb3e 100644
--- a/sys/dev/pci/drm/radeon/rv770.c
+++ b/sys/dev/pci/drm/radeon/rv770.c
@@ -1108,7 +1108,6 @@ int rv770_suspend(struct radeon_device *rdev)
*/
int rv770_init(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
int r;
/* Read BIOS */
@@ -1138,7 +1137,7 @@ int rv770_init(struct radeon_device *rdev)
/* Initialize surface registers */
radeon_surface_init(rdev);
/* Initialize clocks */
- radeon_get_clock_info(ddev);
+ radeon_get_clock_info(rdev->ddev);
/* Fence driver */
r = radeon_fence_driver_init(rdev);
if (r)
diff --git a/sys/dev/pci/drm/radeon/si.c b/sys/dev/pci/drm/radeon/si.c
index 2ff85131958..a3a37725499 100644
--- a/sys/dev/pci/drm/radeon/si.c
+++ b/sys/dev/pci/drm/radeon/si.c
@@ -3694,7 +3694,6 @@ static inline u32 si_get_ih_wptr(struct radeon_device *rdev)
*/
int si_irq_process(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
u32 wptr;
u32 rptr;
u32 src_id, src_data, ring_id;
@@ -3733,7 +3732,7 @@ restart_ih:
case 0: /* D1 vblank */
if (rdev->irq.stat_regs.evergreen.disp_int & LB_D1_VBLANK_INTERRUPT) {
if (rdev->irq.crtc_vblank_int[0]) {
- drm_handle_vblank(ddev, 0);
+ drm_handle_vblank(rdev->ddev, 0);
rdev->pm.vblank_sync = true;
wakeup(&rdev->irq.vblank_queue);
}
@@ -3759,7 +3758,7 @@ restart_ih:
case 0: /* D2 vblank */
if (rdev->irq.stat_regs.evergreen.disp_int_cont & LB_D2_VBLANK_INTERRUPT) {
if (rdev->irq.crtc_vblank_int[1]) {
- drm_handle_vblank(ddev, 1);
+ drm_handle_vblank(rdev->ddev, 1);
rdev->pm.vblank_sync = true;
wakeup(&rdev->irq.vblank_queue);
}
@@ -3785,7 +3784,7 @@ restart_ih:
case 0: /* D3 vblank */
if (rdev->irq.stat_regs.evergreen.disp_int_cont2 & LB_D3_VBLANK_INTERRUPT) {
if (rdev->irq.crtc_vblank_int[2]) {
- drm_handle_vblank(ddev, 2);
+ drm_handle_vblank(rdev->ddev, 2);
rdev->pm.vblank_sync = true;
wakeup(&rdev->irq.vblank_queue);
}
@@ -3811,7 +3810,7 @@ restart_ih:
case 0: /* D4 vblank */
if (rdev->irq.stat_regs.evergreen.disp_int_cont3 & LB_D4_VBLANK_INTERRUPT) {
if (rdev->irq.crtc_vblank_int[3]) {
- drm_handle_vblank(ddev, 3);
+ drm_handle_vblank(rdev->ddev, 3);
rdev->pm.vblank_sync = true;
wakeup(&rdev->irq.vblank_queue);
}
@@ -3837,7 +3836,7 @@ restart_ih:
case 0: /* D5 vblank */
if (rdev->irq.stat_regs.evergreen.disp_int_cont4 & LB_D5_VBLANK_INTERRUPT) {
if (rdev->irq.crtc_vblank_int[4]) {
- drm_handle_vblank(ddev, 4);
+ drm_handle_vblank(rdev->ddev, 4);
rdev->pm.vblank_sync = true;
wakeup(&rdev->irq.vblank_queue);
}
@@ -3863,7 +3862,7 @@ restart_ih:
case 0: /* D6 vblank */
if (rdev->irq.stat_regs.evergreen.disp_int_cont5 & LB_D6_VBLANK_INTERRUPT) {
if (rdev->irq.crtc_vblank_int[5]) {
- drm_handle_vblank(ddev, 5);
+ drm_handle_vblank(rdev->ddev, 5);
rdev->pm.vblank_sync = true;
wakeup(&rdev->irq.vblank_queue);
}
@@ -4273,7 +4272,6 @@ int si_suspend(struct radeon_device *rdev)
*/
int si_init(struct radeon_device *rdev)
{
- struct drm_device *ddev = (struct drm_device *)rdev->drmdev;
struct radeon_ring *ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX];
int r;
@@ -4305,7 +4303,7 @@ int si_init(struct radeon_device *rdev)
/* Initialize surface registers */
radeon_surface_init(rdev);
/* Initialize clocks */
- radeon_get_clock_info(ddev);
+ radeon_get_clock_info(rdev->ddev);
/* Fence driver */
r = radeon_fence_driver_init(rdev);