@@ -659,7 +659,7 @@ static void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode
/* adjust pixel clock as needed */
adjusted_clock = atombios_adjust_pll(crtc, mode, pll);
- radeon_compute_pll(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div,
+ radeon_compute_pll(rdev, pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div,
&ref_div, &post_div);
index = GetIndexIntoMasterTable(COMMAND, SetPixelClock);
@@ -500,6 +500,7 @@ int radeon_dp_mode_valid_helper(struct radeon_connector *radeon_connector,
static bool atom_dp_get_link_status(struct radeon_connector *radeon_connector,
u8 link_status[DP_LINK_STATUS_SIZE])
{
+ struct radeon_device *rdev = radeon_connector->base.dev->dev_private;
int ret;
ret = radeon_dp_aux_native_read(radeon_connector, DP_LANE0_1_STATUS, 100,
DP_LINK_STATUS_SIZE, link_status);
@@ -872,6 +872,7 @@ int r100_cs_parse_packet0(struct radeon_cs_parser *p,
void r100_cs_dump_packet(struct radeon_cs_parser *p,
struct radeon_cs_packet *pkt)
{
+ struct radeon_device *rdev = p->rdev;
volatile uint32_t *ib;
unsigned i;
unsigned idx;
@@ -895,6 +896,7 @@ int r100_cs_packet_parse(struct radeon_cs_parser *p,
struct radeon_cs_packet *pkt,
unsigned idx)
{
+ struct radeon_device *rdev = p->rdev;
struct radeon_cs_chunk *ib_chunk = &p->chunks[p->chunk_ib_idx];
uint32_t header;
@@ -946,6 +948,7 @@ int r100_cs_packet_parse(struct radeon_cs_parser *p,
*/
int r100_cs_packet_parse_vline(struct radeon_cs_parser *p)
{
+ struct radeon_device *rdev = p->rdev;
struct drm_mode_object *obj;
struct drm_crtc *crtc;
struct radeon_crtc *radeon_crtc;
@@ -1040,6 +1043,7 @@ out:
int r100_cs_packet_next_reloc(struct radeon_cs_parser *p,
struct radeon_cs_reloc **cs_reloc)
{
+ struct radeon_device *rdev = p->rdev;
struct radeon_cs_chunk *relocs_chunk;
struct radeon_cs_packet p3reloc;
unsigned idx;
@@ -1131,6 +1135,7 @@ static int r100_packet0_check(struct radeon_cs_parser *p,
struct radeon_cs_packet *pkt,
unsigned idx, unsigned reg)
{
+ struct radeon_device *rdev = p->rdev;
struct radeon_cs_reloc *reloc;
struct r100_cs_track *track;
volatile uint32_t *ib;
@@ -1439,6 +1444,7 @@ int r100_cs_track_check_pkt3_indx_buffer(struct radeon_cs_parser *p,
struct radeon_cs_packet *pkt,
struct radeon_bo *robj)
{
+ struct radeon_device *rdev = p->rdev;
unsigned idx;
u32 value;
idx = pkt->idx + 1;
@@ -1456,6 +1462,7 @@ int r100_cs_track_check_pkt3_indx_buffer(struct radeon_cs_parser *p,
static int r100_packet3_check(struct radeon_cs_parser *p,
struct radeon_cs_packet *pkt)
{
+ struct radeon_device *rdev = p->rdev;
struct radeon_cs_reloc *reloc;
struct r100_cs_track *track;
unsigned idx;
@@ -1571,6 +1578,7 @@ static int r100_packet3_check(struct radeon_cs_parser *p,
int r100_cs_parse(struct radeon_cs_parser *p)
{
+ struct radeon_device *rdev = p->rdev;
struct radeon_cs_packet pkt;
struct r100_cs_track *track;
int r;
@@ -2796,7 +2804,7 @@ void r100_bandwidth_update(struct radeon_device *rdev)
}
}
-static inline void r100_cs_track_texture_print(struct r100_cs_track_texture *t)
+static inline void r100_cs_track_texture_print(struct radeon_device *rdev, struct r100_cs_track_texture *t)
{
dev_err(rdev->dev, "pitch %d\n", t->pitch);
dev_err(rdev->dev, "use_pitch %d\n", t->use_pitch);
@@ -2833,7 +2841,7 @@ static int r100_cs_track_cube(struct radeon_device *rdev,
if (size > radeon_bo_size(cube_robj)) {
dev_err(rdev->dev, "Cube texture offset greater than object size %lu %lu\n",
size, radeon_bo_size(cube_robj));
- r100_cs_track_texture_print(&track->textures[idx]);
+ r100_cs_track_texture_print(rdev, &track->textures[idx]);
return -1;
}
}
@@ -2938,7 +2946,7 @@ static int r100_cs_track_texture_check(struct radeon_device *rdev,
if (size > radeon_bo_size(robj)) {
dev_err(rdev->dev, "Texture of unit %u needs %lu bytes but is "
"%lu\n", u, size, radeon_bo_size(robj));
- r100_cs_track_texture_print(&track->textures[u]);
+ r100_cs_track_texture_print(rdev, &track->textures[u]);
return -EINVAL;
}
}
@@ -142,6 +142,7 @@ int r200_packet0_check(struct radeon_cs_parser *p,
struct radeon_cs_packet *pkt,
unsigned idx, unsigned reg)
{
+ struct radeon_device *rdev = p->rdev;
struct radeon_cs_reloc *reloc;
struct r100_cs_track *track;
volatile uint32_t *ib;
@@ -619,6 +619,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
struct radeon_cs_packet *pkt,
unsigned idx, unsigned reg)
{
+ struct radeon_device *rdev = p->rdev;
struct radeon_cs_reloc *reloc;
struct r100_cs_track *track;
volatile uint32_t *ib;
@@ -1052,6 +1053,7 @@ static int r300_packet0_check(struct radeon_cs_parser *p,
static int r300_packet3_check(struct radeon_cs_parser *p,
struct radeon_cs_packet *pkt)
{
+ struct radeon_device *rdev = p->rdev;
struct radeon_cs_reloc *reloc;
struct r100_cs_track *track;
volatile uint32_t *ib;
@@ -1150,6 +1152,7 @@ static int r300_packet3_check(struct radeon_cs_parser *p,
int r300_cs_parse(struct radeon_cs_parser *p)
{
+ struct radeon_device *rdev = p->rdev;
struct radeon_cs_packet pkt;
struct r100_cs_track *track;
int r;
@@ -187,6 +187,7 @@ int r600_audio_init(struct radeon_device *rdev)
int r600_audio_tmds_index(struct drm_encoder *encoder)
{
struct drm_device *dev = encoder->dev;
+ struct radeon_device *rdev = dev->dev_private;
struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
struct drm_encoder *other;
@@ -1421,13 +1421,13 @@ int r600_cs_legacy(struct drm_device *dev, void *data, struct drm_file *filp,
fake_ib.ptr = ib;
r = radeon_cs_parser_init(&parser, data);
if (r) {
- dev_err(p->dev, "Failed to initialize parser !\n");
+ dev_err(parser.dev, "Failed to initialize parser !\n");
r600_cs_parser_fini(&parser, r);
return r;
}
r = r600_cs_parser_relocs_legacy(&parser);
if (r) {
- dev_err(p->dev, "Failed to parse relocation !\n");
+ dev_err(parser.dev, "Failed to parse relocation !\n");
r600_cs_parser_fini(&parser, r);
return r;
}
@@ -1439,13 +1439,13 @@ int r600_cs_legacy(struct drm_device *dev, void *data, struct drm_file *filp,
*l = parser.ib->length_dw;
r = r600_cs_parse(&parser);
if (r) {
- dev_err(p->dev, "Invalid command stream !\n");
+ dev_err(parser.dev, "Invalid command stream !\n");
r600_cs_parser_fini(&parser, r);
return r;
}
r = radeon_cs_finish_pages(&parser);
if (r) {
- dev_err(p->dev, "Invalid command stream !\n");
+ dev_err(parser.dev, "Invalid command stream !\n");
r600_cs_parser_fini(&parser, r);
return r;
}
@@ -161,6 +161,7 @@ radeon_connector_analog_encoder_conflict_solve(struct drm_connector *connector,
bool priority)
{
struct drm_device *dev = connector->dev;
+ struct radeon_device *rdev = dev->dev_private;
struct drm_connector *conflict;
int i;
@@ -369,6 +370,7 @@ int radeon_connector_set_property(struct drm_connector *connector, struct drm_pr
static void radeon_fixup_lvds_native_mode(struct drm_encoder *encoder,
struct drm_connector *connector)
{
+ struct radeon_device *rdev = encoder->dev->dev_private;
struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
struct drm_display_mode *native_mode = &radeon_encoder->native_mode;
@@ -575,6 +577,7 @@ static int radeon_vga_mode_valid(struct drm_connector *connector,
static enum drm_connector_status radeon_vga_detect(struct drm_connector *connector)
{
+ struct radeon_device *rdev = connector->dev->dev_private;
struct radeon_connector *radeon_connector = to_radeon_connector(connector);
struct drm_encoder *encoder;
struct drm_encoder_helper_funcs *encoder_funcs;
@@ -728,6 +731,7 @@ static int radeon_dvi_get_modes(struct drm_connector *connector)
*/
static enum drm_connector_status radeon_dvi_detect(struct drm_connector *connector)
{
+ struct radeon_device *rdev = connector->dev->dev_private;
struct radeon_connector *radeon_connector = to_radeon_connector(connector);
struct drm_encoder *encoder = NULL;
struct drm_encoder_helper_funcs *encoder_funcs;
@@ -35,6 +35,7 @@ void r100_cs_dump_packet(struct radeon_cs_parser *p,
int radeon_cs_parser_relocs(struct radeon_cs_parser *p)
{
struct drm_device *ddev = p->rdev->ddev;
+ struct radeon_device *rdev = p->rdev;
struct radeon_cs_chunk *chunk;
unsigned i, j;
bool duplicate;
@@ -91,6 +92,7 @@ int radeon_cs_parser_relocs(struct radeon_cs_parser *p)
int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data)
{
+ struct radeon_device *rdev = p->rdev;
struct drm_radeon_cs *cs = data;
uint64_t *chunk_array_ptr;
unsigned size, i;
@@ -147,6 +147,7 @@ int radeon_crtc_cursor_set(struct drm_crtc *crtc,
uint32_t width,
uint32_t height)
{
+ struct radeon_device *rdev = crtc->dev->dev_private;
struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
struct drm_gem_object *obj;
uint64_t gpu_addr;
@@ -663,7 +663,7 @@ int radeon_device_init(struct radeon_device *rdev,
int r;
int dma_bits;
- dev_info(rdev->dev, "radeon: Initializing kernel modesetting.\n");
+ dev_info(&pdev->dev, "initializing kernel modesetting.\n");
rdev->shutdown = false;
rdev->dev = &pdev->dev;
rdev->ddev = ddev;
@@ -296,6 +296,7 @@ static const char *hpd_names[7] = {
static void radeon_print_display_setup(struct drm_device *dev)
{
+ struct radeon_device *rdev = dev->dev_private;
struct drm_connector *connector;
struct radeon_connector *radeon_connector;
struct drm_encoder *encoder;
@@ -437,7 +438,8 @@ static inline uint32_t radeon_div(uint64_t n, uint32_t d)
return n;
}
-static void radeon_compute_pll_legacy(struct radeon_pll *pll,
+static void radeon_compute_pll_legacy(struct radeon_device *rdev,
+ struct radeon_pll *pll,
uint64_t freq,
uint32_t *dot_clock_p,
uint32_t *fb_div_p,
@@ -603,7 +605,8 @@ static void radeon_compute_pll_legacy(struct radeon_pll *pll,
*post_div_p = best_post_div;
}
-static void radeon_compute_pll_avivo(struct radeon_pll *pll,
+static void radeon_compute_pll_avivo(struct radeon_device *rdev,
+ struct radeon_pll *pll,
uint64_t freq,
uint32_t *dot_clock_p,
uint32_t *fb_div_p,
@@ -694,7 +697,8 @@ static void radeon_compute_pll_avivo(struct radeon_pll *pll,
DRM_DEBUG("%u %d.%d, %d, %d\n", *dot_clock_p * 10, *fb_div_p, *frac_fb_div_p, *ref_div_p, *post_div_p);
}
-void radeon_compute_pll(struct radeon_pll *pll,
+void radeon_compute_pll(struct radeon_device *rdev,
+ struct radeon_pll *pll,
uint64_t freq,
uint32_t *dot_clock_p,
uint32_t *fb_div_p,
@@ -704,12 +708,12 @@ void radeon_compute_pll(struct radeon_pll *pll,
{
switch (pll->algo) {
case PLL_ALGO_AVIVO:
- radeon_compute_pll_avivo(pll, freq, dot_clock_p, fb_div_p,
+ radeon_compute_pll_avivo(rdev, pll, freq, dot_clock_p, fb_div_p,
frac_fb_div_p, ref_div_p, post_div_p);
break;
case PLL_ALGO_LEGACY:
default:
- radeon_compute_pll_legacy(pll, freq, dot_clock_p, fb_div_p,
+ radeon_compute_pll_legacy(rdev, pll, freq, dot_clock_p, fb_div_p,
frac_fb_div_p, ref_div_p, post_div_p);
break;
}
@@ -933,6 +937,7 @@ bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc,
struct drm_display_mode *adjusted_mode)
{
struct drm_device *dev = crtc->dev;
+ struct radeon_device *rdev = dev->dev_private;
struct drm_encoder *encoder;
struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
struct radeon_encoder *radeon_encoder;
@@ -170,6 +170,7 @@ int radeon_gem_info_ioctl(struct drm_device *dev, void *data,
int radeon_gem_pread_ioctl(struct drm_device *dev, void *data,
struct drm_file *filp)
{
+ struct radeon_device *rdev = dev->dev_private;
/* TODO: implement */
dev_err(rdev->dev, "unimplemented %s\n", __func__);
return -ENOSYS;
@@ -178,6 +179,7 @@ int radeon_gem_pread_ioctl(struct drm_device *dev, void *data,
int radeon_gem_pwrite_ioctl(struct drm_device *dev, void *data,
struct drm_file *filp)
{
+ struct radeon_device *rdev = dev->dev_private;
/* TODO: implement */
dev_err(rdev->dev, "unimplemented %s\n", __func__);
return -ENOSYS;
@@ -871,6 +871,7 @@ struct radeon_i2c_chan *radeon_i2c_create(struct drm_device *dev,
struct radeon_i2c_bus_rec *rec,
const char *name)
{
+ struct radeon_device *rdev = dev->dev_private;
struct radeon_i2c_chan *i2c;
int ret;
@@ -922,6 +923,7 @@ struct radeon_i2c_chan *radeon_i2c_create_dp(struct drm_device *dev,
struct radeon_i2c_bus_rec *rec,
const char *name)
{
+ struct radeon_device *rdev = dev->dev_private;
struct radeon_i2c_chan *i2c;
int ret;
@@ -977,6 +979,7 @@ void radeon_i2c_get_byte(struct radeon_i2c_chan *i2c_bus,
u8 addr,
u8 *val)
{
+ struct radeon_device *rdev = i2c_bus->dev->dev_private;
u8 out_buf[2];
u8 in_buf[2];
struct i2c_msg msgs[] = {
@@ -1011,6 +1014,7 @@ void radeon_i2c_put_byte(struct radeon_i2c_chan *i2c_bus,
u8 addr,
u8 val)
{
+ struct radeon_device *rdev = i2c_bus->dev->dev_private;
uint8_t out_buf[2];
struct i2c_msg msg = {
.addr = slave_addr,
@@ -208,11 +208,12 @@ int radeon_dma_ioctl_kms(struct drm_device *dev, void *data,
return -EINVAL;
}
-#define KMS_INVALID_IOCTL(name) \
+#define KMS_INVALID_IOCTL(name)\
int name(struct drm_device *dev, void *data, struct drm_file *file_priv)\
-{ \
- dev_err(rdev->dev, "invalid ioctl with kms %s\n", __func__); \
- return -EINVAL; \
+{\
+ struct radeon_device *rdev = dev->dev_private;\
+ dev_err(rdev->dev, "invalid ioctl with kms %s\n", __func__);\
+ return -EINVAL;\
}
/*
@@ -743,7 +743,7 @@ static void radeon_set_pll(struct drm_crtc *crtc, struct drm_display_mode *mode)
DRM_DEBUG("\n");
if (!use_bios_divs) {
- radeon_compute_pll(pll, mode->clock,
+ radeon_compute_pll(rdev, pll, mode->clock,
&freq, &feedback_div, &frac_fb_div,
&reference_div, &post_divider);
@@ -965,6 +965,7 @@ static int radeon_crtc_mode_set(struct drm_crtc *crtc,
struct drm_display_mode *adjusted_mode,
int x, int y, struct drm_framebuffer *old_fb)
{
+ struct radeon_device *rdev = crtc->dev->dev_private;
struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
/* TODO TV */
@@ -445,7 +445,8 @@ extern int radeon_ddc_get_modes(struct radeon_connector *radeon_connector);
extern struct drm_encoder *radeon_best_encoder(struct drm_connector *connector);
-extern void radeon_compute_pll(struct radeon_pll *pll,
+extern void radeon_compute_pll(struct radeon_device *rdev,
+ struct radeon_pll *pll,
uint64_t freq,
uint32_t *dot_clock_p,
uint32_t *fb_div_p,
@@ -747,6 +747,8 @@ static void radeon_ttm_backend_clear(struct ttm_backend *backend)
static int radeon_ttm_backend_bind(struct ttm_backend *backend,
struct ttm_mem_reg *bo_mem)
{
+ struct radeon_mman *mman = container_of(backend->bdev, struct radeon_mman, bdev);
+ struct radeon_device *rdev = container_of(mman, struct radeon_device, mman);
struct radeon_ttm_backend *gtt;
int r;