Subversion Repositories Kolibri OS

Rev

Rev 2175 | Rev 3192 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2175 Rev 2997
Line 59... Line 59...
59
 *                          memory controller (only MC setup failure
59
 *                          memory controller (only MC setup failure
60
 *                          are considered as fatal)
60
 *                          are considered as fatal)
61
 */
61
 */
Line 62... Line 62...
62
 
62
 
63
#include 
-
 
-
 
63
#include 
64
 
64
#include 
65
#include 
65
#include 
-
 
66
#include 
Line 66... Line 67...
66
#include 
67
#include 
67
 
68
 
68
#include 
69
#include 
69
#include 
70
#include 
Line 70... Line 71...
70
#include 
71
#include 
71
#include 
72
#include 
Line 72... Line 73...
72
 
73
 
73
#include 
-
 
Line 74... Line 74...
74
#include 
74
#include 
75
 
75
#include 
76
#include 
76
 
Line 77... Line 77...
77
#include "drm_edid.h"
77
#include 
Line 78... Line -...
78
 
-
 
79
#include "radeon_family.h"
-
 
80
#include "radeon_mode.h"
78
 
81
#include "radeon_reg.h"
79
#include "radeon_family.h"
82
 
80
#include "radeon_mode.h"
83
#include 
81
#include "radeon_reg.h"
84
 
82
 
Line 100... Line 98...
100
extern int radeon_tv;
98
extern int radeon_tv;
101
extern int radeon_audio;
99
extern int radeon_audio;
102
extern int radeon_disp_priority;
100
extern int radeon_disp_priority;
103
extern int radeon_hw_i2c;
101
extern int radeon_hw_i2c;
104
extern int radeon_pcie_gen2;
102
extern int radeon_pcie_gen2;
-
 
103
extern int radeon_msi;
-
 
104
extern int radeon_lockup_timeout;
-
 
105
 
-
 
106
 
-
 
107
 
105
typedef struct pm_message {
108
typedef struct pm_message {
106
    int event;
109
    int event;
107
} pm_message_t;
110
} pm_message_t;
Line 108... Line 111...
108
 
111
 
Line 112... Line 115...
112
  int height;
115
  int height;
113
  int bpp;
116
  int bpp;
114
  int freq;
117
  int freq;
115
}videomode_t;
118
}videomode_t;
Line 116... Line -...
116
 
-
 
117
static inline uint8_t __raw_readb(const volatile void __iomem *addr)
-
 
118
{
-
 
119
    return *(const volatile uint8_t __force *) addr;
-
 
120
}
-
 
121
 
-
 
122
static inline uint16_t __raw_readw(const volatile void __iomem *addr)
-
 
123
{
-
 
124
    return *(const volatile uint16_t __force *) addr;
-
 
125
}
-
 
126
 
-
 
127
static inline uint32_t __raw_readl(const volatile void __iomem *addr)
-
 
128
{
-
 
129
    return *(const volatile uint32_t __force *) addr;
-
 
130
}
-
 
131
 
-
 
132
#define readb __raw_readb
-
 
133
#define readw __raw_readw
-
 
134
#define readl __raw_readl
-
 
135
 
-
 
136
 
-
 
137
 
-
 
138
static inline void __raw_writeb(uint8_t b, volatile void __iomem *addr)
-
 
139
{
-
 
140
    *(volatile uint8_t __force *) addr = b;
-
 
141
}
-
 
142
 
-
 
143
static inline void __raw_writew(uint16_t b, volatile void __iomem *addr)
-
 
144
{
-
 
145
    *(volatile uint16_t __force *) addr = b;
-
 
146
}
-
 
147
 
-
 
148
static inline void __raw_writel(uint32_t b, volatile void __iomem *addr)
-
 
149
{
-
 
150
    *(volatile uint32_t __force *) addr = b;
-
 
151
}
-
 
152
 
-
 
153
static inline void __raw_writeq(__u64 b, volatile void __iomem *addr)
-
 
154
{
-
 
155
        *(volatile __u64 *)addr = b;
-
 
156
}
-
 
157
 
-
 
158
#define writeb __raw_writeb
-
 
159
#define writew __raw_writew
-
 
160
#define writel __raw_writel
-
 
Line 161... Line 119...
161
#define writeq __raw_writeq
119
 
162
 
120
 
163
 
121
 
Line 169... Line 127...
169
static inline void iowrite32(uint32_t b, volatile void __iomem *addr)
127
static inline void iowrite32(uint32_t b, volatile void __iomem *addr)
170
{
128
{
171
    out32((u32)addr, b);
129
    out32((u32)addr, b);
172
}
130
}
Line 173... Line 131...
173
 
131
 
174
struct __wait_queue_head {
132
//struct __wait_queue_head {
175
        spinlock_t lock;
133
//        spinlock_t lock;
176
        struct list_head task_list;
134
//        struct list_head task_list;
177
};
135
//};
Line 178... Line 136...
178
typedef struct __wait_queue_head wait_queue_head_t;
136
//typedef struct __wait_queue_head wait_queue_head_t;
179
 
137
 
180
 
138
 
181
/*
139
/*
182
 * Copy from radeon_drv.h so we don't have to include both and have conflicting
140
 * Copy from radeon_drv.h so we don't have to include both and have conflicting
183
 * symbol;
141
 * symbol;
184
 */
142
 */
185
#define RADEON_MAX_USEC_TIMEOUT         100000  /* 100 ms */
143
#define RADEON_MAX_USEC_TIMEOUT         100000  /* 100 ms */
186
#define RADEON_FENCE_JIFFIES_TIMEOUT	(HZ / 2)
144
#define RADEON_FENCE_JIFFIES_TIMEOUT	(HZ / 2)
187
/* RADEON_IB_POOL_SIZE must be a power of 2 */
145
/* RADEON_IB_POOL_SIZE must be a power of 2 */
188
#define RADEON_IB_POOL_SIZE             16
146
#define RADEON_IB_POOL_SIZE             16
Line -... Line 147...
-
 
147
#define RADEON_DEBUGFS_MAX_COMPONENTS	32
-
 
148
#define RADEONFB_CONN_LIMIT             4
-
 
149
#define RADEON_BIOS_NUM_SCRATCH		8
-
 
150
 
-
 
151
/* max number of rings */
-
 
152
#define RADEON_NUM_RINGS 3
-
 
153
 
-
 
154
/* fence seq are set to this number when signaled */
-
 
155
#define RADEON_FENCE_SIGNALED_SEQ		0LL
-
 
156
 
-
 
157
/* internal ring indices */
-
 
158
/* r1xx+ has gfx CP ring */
-
 
159
#define RADEON_RING_TYPE_GFX_INDEX  0
-
 
160
 
-
 
161
/* cayman has 2 compute CP rings */
-
 
162
#define CAYMAN_RING_TYPE_CP1_INDEX 1
-
 
163
#define CAYMAN_RING_TYPE_CP2_INDEX 2
-
 
164
 
-
 
165
/* hardcode those limit for now */
189
#define RADEON_DEBUGFS_MAX_NUM_FILES	32
166
#define RADEON_VA_IB_OFFSET			(1 << 20)
190
#define RADEONFB_CONN_LIMIT             4
167
#define RADEON_VA_RESERVED_SIZE		(8 << 20)
191
#define RADEON_BIOS_NUM_SCRATCH		8
168
#define RADEON_IB_VM_MAX_SIZE		(64 << 10)
192
 
169
 
193
/*
170
/*
Line 204... Line 181...
204
 
181
 
205
 
182
 
206
/*
183
/*
207
 * BIOS.
-
 
208
 */
-
 
209
#define ATRM_BIOS_PAGE 4096
-
 
210
 
-
 
211
#if defined(CONFIG_VGA_SWITCHEROO)
-
 
212
bool radeon_atrm_supported(struct pci_dev *pdev);
-
 
213
int radeon_atrm_get_bios_chunk(uint8_t *bios, int offset, int len);
-
 
214
#else
-
 
215
static inline bool radeon_atrm_supported(struct pci_dev *pdev)
-
 
216
{
-
 
217
	return false;
-
 
218
}
-
 
219
 
-
 
220
static inline int radeon_atrm_get_bios_chunk(uint8_t *bios, int offset, int len){
-
 
221
	return -EINVAL;
-
 
222
}
184
 * BIOS.
Line 223... Line -...
223
#endif
-
 
224
bool radeon_get_bios(struct radeon_device *rdev);
185
 */
225
 
186
bool radeon_get_bios(struct radeon_device *rdev);
226
 
187
 
227
/*
188
/*
228
 * Dummy page
189
 * Dummy page
Line 261... Line 222...
261
void radeon_pm_suspend(struct radeon_device *rdev);
222
void radeon_pm_suspend(struct radeon_device *rdev);
262
void radeon_pm_resume(struct radeon_device *rdev);
223
void radeon_pm_resume(struct radeon_device *rdev);
263
void radeon_combios_get_power_modes(struct radeon_device *rdev);
224
void radeon_combios_get_power_modes(struct radeon_device *rdev);
264
void radeon_atombios_get_power_modes(struct radeon_device *rdev);
225
void radeon_atombios_get_power_modes(struct radeon_device *rdev);
265
void radeon_atom_set_voltage(struct radeon_device *rdev, u16 voltage_level, u8 voltage_type);
226
void radeon_atom_set_voltage(struct radeon_device *rdev, u16 voltage_level, u8 voltage_type);
266
int radeon_atom_get_max_vddc(struct radeon_device *rdev, u16 *voltage);
-
 
267
void rs690_pm_info(struct radeon_device *rdev);
227
void rs690_pm_info(struct radeon_device *rdev);
268
extern int rv6xx_get_temp(struct radeon_device *rdev);
228
extern int rv6xx_get_temp(struct radeon_device *rdev);
269
extern int rv770_get_temp(struct radeon_device *rdev);
229
extern int rv770_get_temp(struct radeon_device *rdev);
270
extern int evergreen_get_temp(struct radeon_device *rdev);
230
extern int evergreen_get_temp(struct radeon_device *rdev);
271
extern int sumo_get_temp(struct radeon_device *rdev);
231
extern int sumo_get_temp(struct radeon_device *rdev);
-
 
232
extern int si_get_temp(struct radeon_device *rdev);
-
 
233
extern void evergreen_tiling_fields(unsigned tiling_flags, unsigned *bankw,
-
 
234
				    unsigned *bankh, unsigned *mtaspect,
-
 
235
				    unsigned *tile_split);
Line 272... Line 236...
272
 
236
 
273
/*
237
/*
274
 * Fences.
238
 * Fences.
275
 */
239
 */
276
struct radeon_fence_driver {
240
struct radeon_fence_driver {
277
	uint32_t			scratch_reg;
-
 
278
	atomic_t			seq;
241
	uint32_t			scratch_reg;
279
	uint32_t			last_seq;
242
	uint64_t			gpu_addr;
280
	unsigned long			last_jiffies;
243
	volatile uint32_t		*cpu_addr;
281
	unsigned long			last_timeout;
244
	/* sync_seq is protected by ring emission lock */
282
	wait_queue_head_t		queue;
245
	uint64_t			sync_seq[RADEON_NUM_RINGS];
283
	rwlock_t			lock;
246
	atomic64_t			last_seq;
284
	struct list_head		created;
-
 
285
	struct list_head		emited;
-
 
286
	struct list_head		signaled;
247
	unsigned long			last_activity;
287
	bool				initialized;
248
	bool				initialized;
Line 288... Line 249...
288
};
249
};
289
 
250
 
290
struct radeon_fence {
251
struct radeon_fence {
291
	struct radeon_device		*rdev;
-
 
292
	struct kref			kref;
252
    struct radeon_device   *rdev;
293
	struct list_head		list;
253
    struct kref             kref;
294
	/* protected by radeon_fence.lock */
254
	/* protected by radeon_fence.lock */
295
	uint32_t			seq;
255
	uint64_t			seq;
296
	bool				emited;
-
 
297
	bool				signaled;
256
	/* RB, DMA, etc. */
Line -... Line 257...
-
 
257
	unsigned			ring;
298
    evhandle_t              evnt;
258
};
299
};
259
 
300
 
-
 
301
int radeon_fence_driver_init(struct radeon_device *rdev);
260
int radeon_fence_driver_start_ring(struct radeon_device *rdev, int ring);
302
void radeon_fence_driver_fini(struct radeon_device *rdev);
261
int radeon_fence_driver_init(struct radeon_device *rdev);
303
int radeon_fence_create(struct radeon_device *rdev, struct radeon_fence **fence);
262
void radeon_fence_driver_fini(struct radeon_device *rdev);
304
int radeon_fence_emit(struct radeon_device *rdev, struct radeon_fence *fence);
263
int radeon_fence_emit(struct radeon_device *rdev, struct radeon_fence **fence, int ring);
305
void radeon_fence_process(struct radeon_device *rdev);
264
void radeon_fence_process(struct radeon_device *rdev, int ring);
-
 
265
bool radeon_fence_signaled(struct radeon_fence *fence);
306
bool radeon_fence_signaled(struct radeon_fence *fence);
266
int radeon_fence_wait(struct radeon_fence *fence, bool interruptible);
-
 
267
int radeon_fence_wait_next_locked(struct radeon_device *rdev, int ring);
-
 
268
void radeon_fence_wait_empty_locked(struct radeon_device *rdev, int ring);
307
int radeon_fence_wait(struct radeon_fence *fence, bool interruptible);
269
int radeon_fence_wait_any(struct radeon_device *rdev,
308
int radeon_fence_wait_next(struct radeon_device *rdev);
270
			  struct radeon_fence **fences,
-
 
271
			  bool intr);
-
 
272
struct radeon_fence *radeon_fence_ref(struct radeon_fence *fence);
-
 
273
void radeon_fence_unref(struct radeon_fence **fence);
-
 
274
unsigned radeon_fence_count_emitted(struct radeon_device *rdev, int ring);
-
 
275
bool radeon_fence_need_sync(struct radeon_fence *fence, int ring);
-
 
276
void radeon_fence_note_sync(struct radeon_fence *fence, int ring);
-
 
277
static inline struct radeon_fence *radeon_fence_later(struct radeon_fence *a,
-
 
278
						      struct radeon_fence *b)
-
 
279
{
-
 
280
	if (!a) {
-
 
281
		return b;
-
 
282
	}
-
 
283
 
-
 
284
	if (!b) {
-
 
285
		return a;
-
 
286
	}
-
 
287
 
-
 
288
	BUG_ON(a->ring != b->ring);
-
 
289
 
-
 
290
	if (a->seq > b->seq) {
-
 
291
		return a;
-
 
292
	} else {
-
 
293
		return b;
-
 
294
	}
-
 
295
}
-
 
296
 
-
 
297
static inline bool radeon_fence_is_earlier(struct radeon_fence *a,
-
 
298
					   struct radeon_fence *b)
-
 
299
{
-
 
300
	if (!a) {
-
 
301
		return false;
-
 
302
	}
-
 
303
 
-
 
304
	if (!b) {
-
 
305
		return true;
-
 
306
	}
-
 
307
 
-
 
308
	BUG_ON(a->ring != b->ring);
Line 309... Line 309...
309
int radeon_fence_wait_last(struct radeon_device *rdev);
309
 
310
struct radeon_fence *radeon_fence_ref(struct radeon_fence *fence);
310
	return a->seq < b->seq;
311
void radeon_fence_unref(struct radeon_fence **fence);
311
}
312
 
312
 
Line 328... Line 328...
328
	struct ttm_bo_device		bdev;
328
	struct ttm_bo_device		bdev;
329
	bool				mem_global_referenced;
329
	bool				mem_global_referenced;
330
	bool				initialized;
330
	bool				initialized;
331
};
331
};
Line -... Line 332...
-
 
332
 
-
 
333
/* bo virtual address in a specific vm */
-
 
334
struct radeon_bo_va {
-
 
335
	/* protected by bo being reserved */
-
 
336
	struct list_head		bo_list;
-
 
337
	uint64_t			soffset;
-
 
338
	uint64_t			eoffset;
-
 
339
	uint32_t			flags;
-
 
340
	bool				valid;
-
 
341
	unsigned			ref_count;
-
 
342
 
-
 
343
	/* protected by vm mutex */
-
 
344
	struct list_head		vm_list;
-
 
345
 
-
 
346
	/* constant after initialization */
-
 
347
	struct radeon_vm		*vm;
-
 
348
	struct radeon_bo		*bo;
-
 
349
};
332
 
350
 
333
struct radeon_bo {
351
struct radeon_bo {
334
	/* Protected by gem.mutex */
352
	/* Protected by gem.mutex */
335
	struct list_head		list;
353
	struct list_head		list;
336
	/* Protected by tbo.reserved */
354
	/* Protected by tbo.reserved */
Line 343... Line 361...
343
    void                       *uptr;
361
    void                       *uptr;
344
    u32                         cpu_addr;
362
    u32                         cpu_addr;
345
    u32                         tiling_flags;
363
    u32                         tiling_flags;
346
    u32                         pitch;
364
    u32                         pitch;
347
    int                         surface_reg;
365
    int                         surface_reg;
-
 
366
	/* list of all virtual address to which this bo
-
 
367
	 * is associated to
-
 
368
	 */
-
 
369
	struct list_head		va;
348
	/* Constant after initialization */
370
	/* Constant after initialization */
349
	struct radeon_device		*rdev;
371
	struct radeon_device		*rdev;
350
	struct drm_gem_object		gem_base;
372
	struct drm_gem_object		gem_base;
351
    u32                          domain;
373
    u32                          domain;
-
 
374
	int vmapping_count;
352
};
375
};
353
#define gem_to_radeon_bo(gobj) container_of((gobj), struct radeon_bo, gem_base)
376
#define gem_to_radeon_bo(gobj) container_of((gobj), struct radeon_bo, gem_base)
Line 354... Line 377...
354
 
377
 
355
struct radeon_bo_list {
378
struct radeon_bo_list {
Line 358... Line 381...
358
	unsigned		rdomain;
381
	unsigned		rdomain;
359
	unsigned		wdomain;
382
	unsigned		wdomain;
360
	u32			tiling_flags;
383
	u32			tiling_flags;
361
};
384
};
Line -... Line 385...
-
 
385
 
-
 
386
/* sub-allocation manager, it has to be protected by another lock.
-
 
387
 * By conception this is an helper for other part of the driver
-
 
388
 * like the indirect buffer or semaphore, which both have their
-
 
389
 * locking.
-
 
390
 *
-
 
391
 * Principe is simple, we keep a list of sub allocation in offset
-
 
392
 * order (first entry has offset == 0, last entry has the highest
-
 
393
 * offset).
-
 
394
 *
-
 
395
 * When allocating new object we first check if there is room at
-
 
396
 * the end total_size - (last_object_offset + last_object_size) >=
-
 
397
 * alloc_size. If so we allocate new object there.
-
 
398
 *
-
 
399
 * When there is not enough room at the end, we start waiting for
-
 
400
 * each sub object until we reach object_offset+object_size >=
-
 
401
 * alloc_size, this object then become the sub object we return.
-
 
402
 *
-
 
403
 * Alignment can't be bigger than page size.
-
 
404
 *
-
 
405
 * Hole are not considered for allocation to keep things simple.
-
 
406
 * Assumption is that there won't be hole (all object on same
-
 
407
 * alignment).
-
 
408
 */
-
 
409
struct radeon_sa_manager {
-
 
410
	wait_queue_head_t	wq;
-
 
411
	struct radeon_bo	*bo;
-
 
412
	struct list_head	*hole;
-
 
413
	struct list_head	flist[RADEON_NUM_RINGS];
-
 
414
	struct list_head	olist;
-
 
415
	unsigned		size;
-
 
416
	uint64_t		gpu_addr;
-
 
417
	void			*cpu_ptr;
-
 
418
	uint32_t		domain;
-
 
419
};
-
 
420
 
-
 
421
struct radeon_sa_bo;
-
 
422
 
-
 
423
/* sub-allocation buffer */
-
 
424
struct radeon_sa_bo {
-
 
425
	struct list_head		olist;
-
 
426
	struct list_head		flist;
-
 
427
	struct radeon_sa_manager	*manager;
-
 
428
	unsigned			soffset;
-
 
429
	unsigned			eoffset;
-
 
430
	struct radeon_fence		*fence;
-
 
431
};
362
 
432
 
363
/*
433
/*
364
 * GEM objects.
434
 * GEM objects.
365
 */
435
 */
366
struct radeon_gem {
436
struct radeon_gem {
Line 372... Line 442...
372
void radeon_gem_fini(struct radeon_device *rdev);
442
void radeon_gem_fini(struct radeon_device *rdev);
373
int radeon_gem_object_create(struct radeon_device *rdev, int size,
443
int radeon_gem_object_create(struct radeon_device *rdev, int size,
374
			     int alignment, int initial_domain,
444
			     int alignment, int initial_domain,
375
			     bool discardable, bool kernel,
445
			     bool discardable, bool kernel,
376
			     struct drm_gem_object **obj);
446
			     struct drm_gem_object **obj);
377
int radeon_gem_object_pin(struct drm_gem_object *obj, uint32_t pin_domain,
-
 
378
			  uint64_t *gpu_addr);
-
 
379
void radeon_gem_object_unpin(struct drm_gem_object *obj);
-
 
Line 380... Line 447...
380
 
447
 
381
int radeon_mode_dumb_create(struct drm_file *file_priv,
448
int radeon_mode_dumb_create(struct drm_file *file_priv,
382
			    struct drm_device *dev,
449
			    struct drm_device *dev,
383
			    struct drm_mode_create_dumb *args);
450
			    struct drm_mode_create_dumb *args);
Line 387... Line 454...
387
int radeon_mode_dumb_destroy(struct drm_file *file_priv,
454
int radeon_mode_dumb_destroy(struct drm_file *file_priv,
388
			     struct drm_device *dev,
455
			     struct drm_device *dev,
389
			     uint32_t handle);
456
			     uint32_t handle);
Line 390... Line 457...
390
 
457
 
391
/*
458
/*
392
 * GART structures, functions & helpers
459
 * Semaphores.
-
 
460
 */
393
 */
461
/* everything here is constant */
394
struct radeon_mc;
-
 
395
 
462
struct radeon_semaphore {
-
 
463
	struct radeon_sa_bo		*sa_bo;
396
struct radeon_gart_table_ram {
464
	signed				waiters;
397
    volatile uint32_t       *ptr;
465
	uint64_t			gpu_addr;
Line -... Line 466...
-
 
466
};
-
 
467
 
-
 
468
int radeon_semaphore_create(struct radeon_device *rdev,
-
 
469
			    struct radeon_semaphore **semaphore);
-
 
470
void radeon_semaphore_emit_signal(struct radeon_device *rdev, int ring,
398
};
471
				  struct radeon_semaphore *semaphore);
-
 
472
void radeon_semaphore_emit_wait(struct radeon_device *rdev, int ring,
399
 
473
				struct radeon_semaphore *semaphore);
400
struct radeon_gart_table_vram {
474
int radeon_semaphore_sync_rings(struct radeon_device *rdev,
401
	struct radeon_bo		*robj;
-
 
-
 
475
				struct radeon_semaphore *semaphore,
-
 
476
				int signaler, int waiter);
-
 
477
void radeon_semaphore_free(struct radeon_device *rdev,
Line 402... Line -...
402
    volatile uint32_t       *ptr;
-
 
-
 
478
			   struct radeon_semaphore **semaphore,
403
};
479
			   struct radeon_fence *fence);
404
 
-
 
405
union radeon_gart_table {
480
 
-
 
481
/*
Line 406... Line 482...
406
    struct radeon_gart_table_ram    ram;
482
 * GART structures, functions & helpers
407
    struct radeon_gart_table_vram   vram;
483
 */
-
 
484
struct radeon_mc;
-
 
485
 
Line 408... Line 486...
408
};
486
#define RADEON_GPU_PAGE_SIZE 4096
409
 
487
#define RADEON_GPU_PAGE_MASK (RADEON_GPU_PAGE_SIZE - 1)
-
 
488
#define RADEON_GPU_PAGE_SHIFT 12
-
 
489
#define RADEON_GPU_PAGE_ALIGN(a) (((a) + RADEON_GPU_PAGE_MASK) & ~RADEON_GPU_PAGE_MASK)
410
#define RADEON_GPU_PAGE_SIZE 4096
490
 
411
#define RADEON_GPU_PAGE_MASK (RADEON_GPU_PAGE_SIZE - 1)
491
struct radeon_gart {
412
 
492
    dma_addr_t          table_addr;
413
struct radeon_gart {
-
 
414
    dma_addr_t          table_addr;
493
	struct radeon_bo		*robj;
415
    unsigned            num_gpu_pages;
494
	void				*ptr;
416
    unsigned            num_cpu_pages;
-
 
417
    unsigned            table_size;
495
    unsigned            num_gpu_pages;
418
    union radeon_gart_table     table;
496
    unsigned            num_cpu_pages;
Line 419... Line 497...
419
    struct page         **pages;
497
    unsigned            table_size;
420
    dma_addr_t          *pages_addr;
498
    struct page         **pages;
421
	bool				*ttm_alloced;
499
    dma_addr_t          *pages_addr;
422
    bool                ready;
500
    bool                ready;
-
 
501
};
-
 
502
 
423
};
503
int radeon_gart_table_ram_alloc(struct radeon_device *rdev);
424
 
504
void radeon_gart_table_ram_free(struct radeon_device *rdev);
425
int radeon_gart_table_ram_alloc(struct radeon_device *rdev);
505
int radeon_gart_table_vram_alloc(struct radeon_device *rdev);
426
void radeon_gart_table_ram_free(struct radeon_device *rdev);
506
void radeon_gart_table_vram_free(struct radeon_device *rdev);
427
int radeon_gart_table_vram_alloc(struct radeon_device *rdev);
507
int radeon_gart_table_vram_pin(struct radeon_device *rdev);
428
void radeon_gart_table_vram_free(struct radeon_device *rdev);
508
void radeon_gart_table_vram_unpin(struct radeon_device *rdev);
-
 
509
int radeon_gart_init(struct radeon_device *rdev);
-
 
510
void radeon_gart_fini(struct radeon_device *rdev);
Line 429... Line 511...
429
int radeon_gart_init(struct radeon_device *rdev);
511
void radeon_gart_unbind(struct radeon_device *rdev, unsigned offset,
430
void radeon_gart_fini(struct radeon_device *rdev);
512
			int pages);
431
void radeon_gart_unbind(struct radeon_device *rdev, unsigned offset,
513
int radeon_gart_bind(struct radeon_device *rdev, unsigned offset,
Line 478... Line 560...
478
/*
560
/*
479
 * IRQS.
561
 * IRQS.
480
 */
562
 */
481
struct r500_irq_stat_regs {
563
struct r500_irq_stat_regs {
482
	u32 disp_int;
564
	u32 disp_int;
-
 
565
	u32 hdmi0_status;
483
};
566
};
Line 484... Line 567...
484
 
567
 
485
struct r600_irq_stat_regs {
568
struct r600_irq_stat_regs {
486
	u32 disp_int;
569
	u32 disp_int;
487
	u32 disp_int_cont;
570
	u32 disp_int_cont;
488
	u32 disp_int_cont2;
571
	u32 disp_int_cont2;
489
	u32 d1grph_int;
572
	u32 d1grph_int;
-
 
573
	u32 d2grph_int;
-
 
574
	u32 hdmi0_status;
490
	u32 d2grph_int;
575
	u32 hdmi1_status;
Line 491... Line 576...
491
};
576
};
492
 
577
 
493
struct evergreen_irq_stat_regs {
578
struct evergreen_irq_stat_regs {
Line 501... Line 586...
501
	u32 d2grph_int;
586
	u32 d2grph_int;
502
	u32 d3grph_int;
587
	u32 d3grph_int;
503
	u32 d4grph_int;
588
	u32 d4grph_int;
504
	u32 d5grph_int;
589
	u32 d5grph_int;
505
	u32 d6grph_int;
590
	u32 d6grph_int;
-
 
591
	u32 afmt_status1;
-
 
592
	u32 afmt_status2;
-
 
593
	u32 afmt_status3;
-
 
594
	u32 afmt_status4;
-
 
595
	u32 afmt_status5;
-
 
596
	u32 afmt_status6;
506
};
597
};
Line 507... Line 598...
507
 
598
 
508
union radeon_irq_stat_regs {
599
union radeon_irq_stat_regs {
509
	struct r500_irq_stat_regs r500;
600
	struct r500_irq_stat_regs r500;
510
	struct r600_irq_stat_regs r600;
601
	struct r600_irq_stat_regs r600;
511
	struct evergreen_irq_stat_regs evergreen;
602
	struct evergreen_irq_stat_regs evergreen;
Line -... Line 603...
-
 
603
};
-
 
604
 
-
 
605
#define RADEON_MAX_HPD_PINS 6
-
 
606
#define RADEON_MAX_CRTCS 6
512
};
607
#define RADEON_MAX_AFMT_BLOCKS 6
513
 
608
 
514
struct radeon_irq {
609
struct radeon_irq {
515
	bool		installed;
610
	bool		installed;
516
	bool		sw_int;
611
	spinlock_t			lock;
517
	/* FIXME: use a define max crtc rather than hardcode it */
612
	atomic_t			ring_int[RADEON_NUM_RINGS];
518
	bool		crtc_vblank_int[6];
613
	bool				crtc_vblank_int[RADEON_MAX_CRTCS];
519
	bool		pflip[6];
-
 
520
    wait_queue_head_t   vblank_queue;
-
 
521
	/* FIXME: use defines for max hpd/dacs */
614
	atomic_t			pflip[RADEON_MAX_CRTCS];
522
	bool            hpd[6];
615
    wait_queue_head_t   vblank_queue;
523
	bool            gui_idle;
-
 
524
	bool            gui_idle_acked;
-
 
525
   wait_queue_head_t   idle_queue;
-
 
526
	/* FIXME: use defines for max HDMI blocks */
-
 
527
	bool		hdmi[2];
-
 
528
    spinlock_t  sw_lock;
616
	bool				hpd[RADEON_MAX_HPD_PINS];
529
	int sw_refcount;
-
 
530
	union radeon_irq_stat_regs stat_regs;
-
 
531
	spinlock_t pflip_lock[6];
617
	bool				afmt[RADEON_MAX_AFMT_BLOCKS];
Line 532... Line 618...
532
	int pflip_refcount[6];
618
	union radeon_irq_stat_regs stat_regs;
533
};
619
};
534
 
620
 
535
int radeon_irq_kms_init(struct radeon_device *rdev);
621
int radeon_irq_kms_init(struct radeon_device *rdev);
536
void radeon_irq_kms_fini(struct radeon_device *rdev);
622
void radeon_irq_kms_fini(struct radeon_device *rdev);
537
void radeon_irq_kms_sw_irq_get(struct radeon_device *rdev);
623
void radeon_irq_kms_sw_irq_get(struct radeon_device *rdev, int ring);
-
 
624
void radeon_irq_kms_sw_irq_put(struct radeon_device *rdev, int ring);
-
 
625
void radeon_irq_kms_pflip_irq_get(struct radeon_device *rdev, int crtc);
-
 
626
void radeon_irq_kms_pflip_irq_put(struct radeon_device *rdev, int crtc);
-
 
627
void radeon_irq_kms_enable_afmt(struct radeon_device *rdev, int block);
Line 538... Line 628...
538
void radeon_irq_kms_sw_irq_put(struct radeon_device *rdev);
628
void radeon_irq_kms_disable_afmt(struct radeon_device *rdev, int block);
539
void radeon_irq_kms_pflip_irq_get(struct radeon_device *rdev, int crtc);
629
void radeon_irq_kms_enable_hpd(struct radeon_device *rdev, unsigned hpd_mask);
540
void radeon_irq_kms_pflip_irq_put(struct radeon_device *rdev, int crtc);
630
void radeon_irq_kms_disable_hpd(struct radeon_device *rdev, unsigned hpd_mask);
-
 
631
 
541
 
632
/*
542
/*
633
 * CP & rings.
543
 * CP & ring.
634
 */
544
 */
635
 
545
struct radeon_ib {
-
 
546
    struct list_head    list;
636
struct radeon_ib {
547
	unsigned		idx;
-
 
548
    uint64_t            gpu_addr;
637
	struct radeon_sa_bo		*sa_bo;
549
	struct radeon_fence	*fence;
-
 
550
    uint32_t            *ptr;
-
 
551
    uint32_t            length_dw;
-
 
552
	bool			free;
-
 
553
};
-
 
554
 
-
 
555
/*
638
	uint32_t		length_dw;
556
 * locking -
-
 
557
 * mutex protects scheduled_ibs, ready, alloc_bm
639
    uint64_t            gpu_addr;
558
 */
640
	uint32_t		*ptr;
559
struct radeon_ib_pool {
641
	int				ring;
560
	struct mutex		mutex;
-
 
561
	struct radeon_bo	*robj;
642
	struct radeon_fence	*fence;
562
	struct list_head	bogus_ib;
643
	struct radeon_vm		*vm;
Line 563... Line 644...
563
	struct radeon_ib	ibs[RADEON_IB_POOL_SIZE];
644
	bool			is_const_ib;
564
    bool                ready;
645
	struct radeon_fence		*sync_to[RADEON_NUM_RINGS];
565
	unsigned		head_id;
646
	struct radeon_semaphore		*semaphore;
566
};
647
};
-
 
648
 
-
 
649
struct radeon_ring {
-
 
650
	struct radeon_bo	*ring_obj;
-
 
651
	volatile uint32_t	*ring;
-
 
652
    unsigned            rptr;
567
 
653
	unsigned		rptr_offs;
568
struct radeon_cp {
654
	unsigned		rptr_reg;
-
 
655
	unsigned		rptr_save_reg;
569
	struct radeon_bo	*ring_obj;
656
	u64			next_rptr_gpu_addr;
570
	volatile uint32_t	*ring;
657
	volatile u32		*next_rptr_cpu_addr;
571
    unsigned            rptr;
658
    unsigned            wptr;
-
 
659
    unsigned            wptr_old;
-
 
660
	unsigned		wptr_reg;
572
    unsigned            wptr;
661
    unsigned            ring_size;
573
    unsigned            wptr_old;
662
    unsigned            ring_free_dw;
574
    unsigned            ring_size;
663
    int                 count_dw;
575
    unsigned            ring_free_dw;
-
 
576
    int                 count_dw;
664
	unsigned long		last_activity;
-
 
665
	unsigned		last_rptr;
-
 
666
    uint64_t            gpu_addr;
-
 
667
    uint32_t            align_mask;
-
 
668
    uint32_t            ptr_mask;
-
 
669
    bool                ready;
-
 
670
	u32			ptr_reg_shift;
-
 
671
	u32			ptr_reg_mask;
-
 
672
	u32			nop;
-
 
673
	u32			idx;
-
 
674
};
-
 
675
 
-
 
676
/*
-
 
677
 * VM
-
 
678
 */
-
 
679
 
-
 
680
/* maximum number of VMIDs */
-
 
681
#define RADEON_NUM_VM	16
-
 
682
 
-
 
683
/* defines number of bits in page table versus page directory,
-
 
684
 * a page is 4KB so we have 12 bits offset, 9 bits in the page
-
 
685
 * table and the remaining 19 bits are in the page directory */
-
 
686
#define RADEON_VM_BLOCK_SIZE   9
-
 
687
 
-
 
688
/* number of entries in page table */
-
 
689
#define RADEON_VM_PTE_COUNT (1 << RADEON_VM_BLOCK_SIZE)
-
 
690
 
-
 
691
struct radeon_vm {
-
 
692
	struct list_head		list;
-
 
693
	struct list_head		va;
-
 
694
	unsigned			id;
-
 
695
 
-
 
696
	/* contains the page directory */
-
 
697
	struct radeon_sa_bo		*page_directory;
-
 
698
	uint64_t			pd_gpu_addr;
-
 
699
 
-
 
700
	/* array of page tables, one for each page directory entry */
-
 
701
	struct radeon_sa_bo		**page_tables;
-
 
702
 
-
 
703
	struct mutex			mutex;
-
 
704
	/* last fence for cs using this vm */
-
 
705
	struct radeon_fence		*fence;
-
 
706
	/* last flush or NULL if we still need to flush */
-
 
707
	struct radeon_fence		*last_flush;
-
 
708
};
-
 
709
 
-
 
710
struct radeon_vm_manager {
-
 
711
	struct mutex			lock;
-
 
712
	struct list_head		lru_vm;
-
 
713
	struct radeon_fence		*active[RADEON_NUM_VM];
-
 
714
	struct radeon_sa_manager	sa_manager;
-
 
715
	uint32_t			max_pfn;
-
 
716
	/* number of VMIDs */
-
 
717
	unsigned			nvm;
-
 
718
	/* vram base address for page table entry  */
-
 
719
	u64				vram_base_offset;
-
 
720
	/* is vm enabled? */
-
 
721
	bool				enabled;
-
 
722
};
-
 
723
 
577
    uint64_t            gpu_addr;
724
/*
Line 578... Line 725...
578
    uint32_t            align_mask;
725
 * file private structure
579
    uint32_t            ptr_mask;
726
 */
580
	struct mutex		mutex;
727
struct radeon_fpriv {
581
    bool                ready;
728
	struct radeon_vm		vm;
582
};
729
};
583
 
730
 
584
/*
731
/*
585
 * R6xx+ IH ring
-
 
586
 */
-
 
587
struct r600_ih {
732
 * R6xx+ IH ring
588
	struct radeon_bo	*ring_obj;
733
 */
589
	volatile uint32_t	*ring;
734
struct r600_ih {
590
    unsigned            rptr;
735
	struct radeon_bo	*ring_obj;
591
    unsigned            wptr;
736
	volatile uint32_t	*ring;
592
    unsigned            wptr_old;
737
    unsigned            rptr;
Line -... Line 738...
-
 
738
    unsigned            ring_size;
-
 
739
    uint64_t            gpu_addr;
-
 
740
    uint32_t            ptr_mask;
-
 
741
	atomic_t		lock;
-
 
742
    bool                enabled;
-
 
743
};
-
 
744
 
-
 
745
struct r600_blit_cp_primitives {
-
 
746
	void (*set_render_target)(struct radeon_device *rdev, int format,
-
 
747
				  int w, int h, u64 gpu_addr);
-
 
748
	void (*cp_set_surface_sync)(struct radeon_device *rdev,
-
 
749
				    u32 sync_type, u32 size,
-
 
750
				    u64 mc_addr);
-
 
751
	void (*set_shaders)(struct radeon_device *rdev);
-
 
752
	void (*set_vtx_resource)(struct radeon_device *rdev, u64 gpu_addr);
-
 
753
	void (*set_tex_resource)(struct radeon_device *rdev,
-
 
754
				 int format, int w, int h, int pitch,
593
    unsigned            ring_size;
755
				 u64 gpu_addr, u32 size);
594
    uint64_t            gpu_addr;
-
 
595
    uint32_t            ptr_mask;
756
	void (*set_scissors)(struct radeon_device *rdev, int x1, int y1,
-
 
757
			     int x2, int y2);
-
 
758
	void (*draw_auto)(struct radeon_device *rdev);
-
 
759
	void (*set_default_state)(struct radeon_device *rdev);
-
 
760
};
596
    spinlock_t              lock;
761
 
597
    bool                enabled;
762
struct r600_blit {
598
};
763
	struct radeon_bo	*shader_obj;
599
 
764
	struct r600_blit_cp_primitives primitives;
600
struct r600_blit {
-
 
601
	struct mutex		mutex;
-
 
602
	struct radeon_bo	*shader_obj;
765
	int max_dim;
Line -... Line 766...
-
 
766
	int ring_size_common;
-
 
767
	int ring_size_per_loop;
-
 
768
	u64 shader_gpu_addr;
-
 
769
	u32 vs_offset, ps_offset;
-
 
770
	u32 state_offset;
-
 
771
	u32 state_len;
-
 
772
};
-
 
773
 
-
 
774
/*
-
 
775
 * SI RLC stuff
-
 
776
 */
-
 
777
struct si_rlc {
603
	u64 shader_gpu_addr;
778
	/* for power gating */
-
 
779
	struct radeon_bo	*save_restore_obj;
-
 
780
	uint64_t		save_restore_gpu_addr;
604
	u32 vs_offset, ps_offset;
781
	/* for clear state */
605
	u32 state_offset;
782
	struct radeon_bo	*clear_state_obj;
-
 
783
	uint64_t		clear_state_gpu_addr;
606
	u32 state_len;
784
};
607
	u32 vb_used, vb_total;
785
 
608
	struct radeon_ib *vb_ib;
786
int radeon_ib_get(struct radeon_device *rdev, int ring,
609
};
-
 
610
 
787
		  struct radeon_ib *ib, struct radeon_vm *vm,
611
int radeon_ib_get(struct radeon_device *rdev, struct radeon_ib **ib);
788
		  unsigned size);
-
 
789
void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib *ib);
-
 
790
int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib,
612
void radeon_ib_free(struct radeon_device *rdev, struct radeon_ib **ib);
791
		       struct radeon_ib *const_ib);
613
int radeon_ib_schedule(struct radeon_device *rdev, struct radeon_ib *ib);
792
int radeon_ib_pool_init(struct radeon_device *rdev);
614
int radeon_ib_pool_init(struct radeon_device *rdev);
793
void radeon_ib_pool_fini(struct radeon_device *rdev);
615
void radeon_ib_pool_fini(struct radeon_device *rdev);
794
int radeon_ib_ring_tests(struct radeon_device *rdev);
616
int radeon_ib_test(struct radeon_device *rdev);
795
/* Ring access between begin & end cannot sleep */
-
 
796
bool radeon_ring_supports_scratch_reg(struct radeon_device *rdev,
617
extern void radeon_ib_bogus_add(struct radeon_device *rdev, struct radeon_ib *ib);
797
				      struct radeon_ring *ring);
-
 
798
void radeon_ring_free_size(struct radeon_device *rdev, struct radeon_ring *cp);
-
 
799
int radeon_ring_alloc(struct radeon_device *rdev, struct radeon_ring *cp, unsigned ndw);
-
 
800
int radeon_ring_lock(struct radeon_device *rdev, struct radeon_ring *cp, unsigned ndw);
-
 
801
void radeon_ring_commit(struct radeon_device *rdev, struct radeon_ring *cp);
-
 
802
void radeon_ring_unlock_commit(struct radeon_device *rdev, struct radeon_ring *cp);
-
 
803
void radeon_ring_undo(struct radeon_ring *ring);
-
 
804
void radeon_ring_unlock_undo(struct radeon_device *rdev, struct radeon_ring *cp);
618
/* Ring access between begin & end cannot sleep */
805
int radeon_ring_test(struct radeon_device *rdev, struct radeon_ring *cp);
-
 
806
void radeon_ring_force_activity(struct radeon_device *rdev, struct radeon_ring *ring);
-
 
807
void radeon_ring_lockup_update(struct radeon_ring *ring);
619
void radeon_ring_free_size(struct radeon_device *rdev);
808
bool radeon_ring_test_lockup(struct radeon_device *rdev, struct radeon_ring *ring);
Line 620... Line 809...
620
int radeon_ring_alloc(struct radeon_device *rdev, unsigned ndw);
809
unsigned radeon_ring_backup(struct radeon_device *rdev, struct radeon_ring *ring,
621
int radeon_ring_lock(struct radeon_device *rdev, unsigned ndw);
810
			    uint32_t **data);
622
void radeon_ring_commit(struct radeon_device *rdev);
811
int radeon_ring_restore(struct radeon_device *rdev, struct radeon_ring *ring,
Line 665... Line 854...
665
	struct radeon_cs_reloc	**relocs_ptr;
854
	struct radeon_cs_reloc	**relocs_ptr;
666
	struct list_head	validated;
855
	struct list_head	validated;
667
	/* indices of various chunks */
856
	/* indices of various chunks */
668
	int			chunk_ib_idx;
857
	int			chunk_ib_idx;
669
	int			chunk_relocs_idx;
858
	int			chunk_relocs_idx;
-
 
859
	int			chunk_flags_idx;
-
 
860
	int			chunk_const_ib_idx;
670
	struct radeon_ib	*ib;
861
	struct radeon_ib	ib;
-
 
862
	struct radeon_ib	const_ib;
671
	void			*track;
863
	void			*track;
672
	unsigned		family;
864
	unsigned		family;
673
	int parser_error;
865
	int parser_error;
-
 
866
	u32			cs_flags;
-
 
867
	u32			ring;
-
 
868
	s32			priority;
674
};
869
};
Line 675... Line -...
675
 
-
 
676
extern int radeon_cs_update_pages(struct radeon_cs_parser *p, int pg_idx);
870
 
677
extern int radeon_cs_finish_pages(struct radeon_cs_parser *p);
-
 
678
 
-
 
679
 
871
extern int radeon_cs_finish_pages(struct radeon_cs_parser *p);
680
static inline u32 radeon_get_ib_value(struct radeon_cs_parser *p, int idx)
-
 
681
{
-
 
682
	struct radeon_cs_chunk *ibc = &p->chunks[p->chunk_ib_idx];
-
 
683
	u32 pg_idx, pg_offset;
-
 
684
	u32 idx_value = 0;
-
 
685
	int new_page;
-
 
686
 
-
 
687
	pg_idx = (idx * 4) / PAGE_SIZE;
-
 
688
	pg_offset = (idx * 4) % PAGE_SIZE;
-
 
689
 
-
 
690
	if (ibc->kpage_idx[0] == pg_idx)
-
 
691
		return ibc->kpage[0][pg_offset/4];
-
 
692
	if (ibc->kpage_idx[1] == pg_idx)
-
 
693
		return ibc->kpage[1][pg_offset/4];
-
 
694
 
-
 
695
	new_page = radeon_cs_update_pages(p, pg_idx);
-
 
696
	if (new_page < 0) {
-
 
697
		p->parser_error = new_page;
-
 
698
		return 0;
-
 
699
	}
-
 
700
 
-
 
701
	idx_value = ibc->kpage[new_page][pg_offset/4];
-
 
702
	return idx_value;
-
 
Line 703... Line 872...
703
}
872
extern u32 radeon_get_ib_value(struct radeon_cs_parser *p, int idx);
704
 
873
 
705
struct radeon_cs_packet {
874
struct radeon_cs_packet {
706
	unsigned	idx;
875
	unsigned	idx;
Line 737... Line 906...
737
	bool                    enabled;
906
	bool                    enabled;
738
	bool                    use_event;
907
	bool                    use_event;
739
};
908
};
Line 740... Line 909...
740
 
909
 
-
 
910
#define RADEON_WB_SCRATCH_OFFSET 0
741
#define RADEON_WB_SCRATCH_OFFSET 0
911
#define RADEON_WB_RING0_NEXT_RPTR 256
742
#define RADEON_WB_CP_RPTR_OFFSET 1024
912
#define RADEON_WB_CP_RPTR_OFFSET 1024
743
#define RADEON_WB_CP1_RPTR_OFFSET 1280
913
#define RADEON_WB_CP1_RPTR_OFFSET 1280
744
#define RADEON_WB_CP2_RPTR_OFFSET 1536
914
#define RADEON_WB_CP2_RPTR_OFFSET 1536
745
#define R600_WB_IH_WPTR_OFFSET   2048
915
#define R600_WB_IH_WPTR_OFFSET   2048
Line 829... Line 999...
829
	THERMAL_TYPE_RV6XX,
999
	THERMAL_TYPE_RV6XX,
830
	THERMAL_TYPE_RV770,
1000
	THERMAL_TYPE_RV770,
831
	THERMAL_TYPE_EVERGREEN,
1001
	THERMAL_TYPE_EVERGREEN,
832
	THERMAL_TYPE_SUMO,
1002
	THERMAL_TYPE_SUMO,
833
	THERMAL_TYPE_NI,
1003
	THERMAL_TYPE_NI,
-
 
1004
	THERMAL_TYPE_SI,
834
};
1005
};
Line 835... Line 1006...
835
 
1006
 
836
struct radeon_voltage {
1007
struct radeon_voltage {
837
	enum radeon_voltage_type type;
1008
	enum radeon_voltage_type type;
Line 866... Line 1037...
866
/* state flags */
1037
/* state flags */
867
#define RADEON_PM_STATE_SINGLE_DISPLAY_ONLY (1 << 0)
1038
#define RADEON_PM_STATE_SINGLE_DISPLAY_ONLY (1 << 0)
Line 868... Line 1039...
868
 
1039
 
869
struct radeon_power_state {
1040
struct radeon_power_state {
870
	enum radeon_pm_state_type type;
-
 
871
	/* XXX: use a define for num clock modes */
1041
	enum radeon_pm_state_type type;
872
	struct radeon_pm_clock_info clock_info[8];
1042
	struct radeon_pm_clock_info *clock_info;
873
	/* number of valid clock modes in this power state */
1043
	/* number of valid clock modes in this power state */
874
	int num_clock_modes;
1044
	int num_clock_modes;
875
	struct radeon_pm_clock_info *default_clock_mode;
1045
	struct radeon_pm_clock_info *default_clock_mode;
876
	/* standardized state flags */
1046
	/* standardized state flags */
Line 885... Line 1055...
885
 */
1055
 */
886
#define RADEON_MODE_OVERCLOCK_MARGIN 500 /* 5 MHz */
1056
#define RADEON_MODE_OVERCLOCK_MARGIN 500 /* 5 MHz */
Line 887... Line 1057...
887
 
1057
 
888
struct radeon_pm {
1058
struct radeon_pm {
-
 
1059
	struct mutex		mutex;
-
 
1060
	/* write locked while reprogramming mclk */
889
	struct mutex		mutex;
1061
	struct rw_semaphore	mclk_lock;
890
	u32			active_crtcs;
1062
	u32			active_crtcs;
891
	int			active_crtc_count;
1063
	int			active_crtc_count;
892
	int			req_vblank;
1064
	int			req_vblank;
893
	bool			vblank_sync;
-
 
894
	bool			gui_idle;
1065
	bool			vblank_sync;
895
	fixed20_12		max_bandwidth;
1066
	fixed20_12		max_bandwidth;
896
	fixed20_12		igp_sideport_mclk;
1067
	fixed20_12		igp_sideport_mclk;
897
	fixed20_12		igp_system_mclk;
1068
	fixed20_12		igp_system_mclk;
898
	fixed20_12		igp_ht_link_clk;
1069
	fixed20_12		igp_ht_link_clk;
Line 937... Line 1108...
937
	/* internal thermal controller on rv6xx+ */
1108
	/* internal thermal controller on rv6xx+ */
938
	enum radeon_int_thermal_type int_thermal_type;
1109
	enum radeon_int_thermal_type int_thermal_type;
939
	struct device	        *int_hwmon_dev;
1110
	struct device	        *int_hwmon_dev;
940
};
1111
};
Line -... Line 1112...
-
 
1112
 
-
 
1113
int radeon_pm_get_type_index(struct radeon_device *rdev,
-
 
1114
			     enum radeon_pm_state_type ps_type,
-
 
1115
			     int instance);
-
 
1116
 
-
 
1117
struct r600_audio {
-
 
1118
	int			channels;
-
 
1119
	int			rate;
-
 
1120
	int			bits_per_sample;
-
 
1121
	u8			status_bits;
-
 
1122
	u8			category_code;
941
 
1123
};
942
/*
1124
/*
943
 * ASIC specific functions.
1125
 * ASIC specific functions.
944
 */
1126
 */
945
struct radeon_asic {
1127
struct radeon_asic {
946
	int (*init)(struct radeon_device *rdev);
1128
	int (*init)(struct radeon_device *rdev);
947
	void (*fini)(struct radeon_device *rdev);
1129
	void (*fini)(struct radeon_device *rdev);
948
	int (*resume)(struct radeon_device *rdev);
1130
	int (*resume)(struct radeon_device *rdev);
949
	int (*suspend)(struct radeon_device *rdev);
1131
	int (*suspend)(struct radeon_device *rdev);
950
	void (*vga_set_state)(struct radeon_device *rdev, bool state);
-
 
951
	bool (*gpu_is_lockup)(struct radeon_device *rdev);
1132
	void (*vga_set_state)(struct radeon_device *rdev, bool state);
-
 
1133
	int (*asic_reset)(struct radeon_device *rdev);
952
	int (*asic_reset)(struct radeon_device *rdev);
1134
	/* ioctl hw specific callback. Some hw might want to perform special
953
	void (*gart_tlb_flush)(struct radeon_device *rdev);
1135
	 * operation on specific ioctl. For instance on wait idle some hw
-
 
1136
	 * might want to perform and HDP flush through MMIO as it seems that
-
 
1137
	 * some R6XX/R7XX hw doesn't take HDP flush into account if programmed
-
 
1138
	 * through ring.
954
	int (*gart_set_page)(struct radeon_device *rdev, int i, uint64_t addr);
1139
	 */
-
 
1140
	void (*ioctl_wait_idle)(struct radeon_device *rdev, struct radeon_bo *bo);
955
	int (*cp_init)(struct radeon_device *rdev, unsigned ring_size);
1141
	/* check if 3D engine is idle */
-
 
1142
	bool (*gui_idle)(struct radeon_device *rdev);
956
	void (*cp_fini)(struct radeon_device *rdev);
1143
	/* wait for mc_idle */
-
 
1144
	int (*mc_wait_for_idle)(struct radeon_device *rdev);
-
 
1145
	/* gart */
957
	void (*cp_disable)(struct radeon_device *rdev);
1146
	struct {
-
 
1147
		void (*tlb_flush)(struct radeon_device *rdev);
-
 
1148
		int (*set_page)(struct radeon_device *rdev, int i, uint64_t addr);
-
 
1149
	} gart;
958
	void (*cp_commit)(struct radeon_device *rdev);
1150
	struct {
959
	void (*ring_start)(struct radeon_device *rdev);
1151
		int (*init)(struct radeon_device *rdev);
-
 
1152
		void (*fini)(struct radeon_device *rdev);
-
 
1153
 
960
	int (*ring_test)(struct radeon_device *rdev);
1154
		u32 pt_ring_index;
-
 
1155
		void (*set_page)(struct radeon_device *rdev, uint64_t pe,
-
 
1156
				 uint64_t addr, unsigned count,
-
 
1157
				 uint32_t incr, uint32_t flags);
-
 
1158
	} vm;
-
 
1159
	/* ring specific callbacks */
961
	void (*ring_ib_execute)(struct radeon_device *rdev, struct radeon_ib *ib);
1160
	struct {
962
	int (*irq_set)(struct radeon_device *rdev);
1161
		void (*ib_execute)(struct radeon_device *rdev, struct radeon_ib *ib);
963
	int (*irq_process)(struct radeon_device *rdev);
1162
		int (*ib_parse)(struct radeon_device *rdev, struct radeon_ib *ib);
964
	u32 (*get_vblank_counter)(struct radeon_device *rdev, int crtc);
1163
		void (*emit_fence)(struct radeon_device *rdev, struct radeon_fence *fence);
-
 
1164
		void (*emit_semaphore)(struct radeon_device *rdev, struct radeon_ring *cp,
965
	void (*fence_ring_emit)(struct radeon_device *rdev, struct radeon_fence *fence);
1165
				       struct radeon_semaphore *semaphore, bool emit_wait);
-
 
1166
		int (*cs_parse)(struct radeon_cs_parser *p);
-
 
1167
		void (*ring_start)(struct radeon_device *rdev, struct radeon_ring *cp);
-
 
1168
		int (*ring_test)(struct radeon_device *rdev, struct radeon_ring *cp);
-
 
1169
		int (*ib_test)(struct radeon_device *rdev, struct radeon_ring *cp);
-
 
1170
		bool (*is_lockup)(struct radeon_device *rdev, struct radeon_ring *cp);
-
 
1171
		void (*vm_flush)(struct radeon_device *rdev, int ridx, struct radeon_vm *vm);
-
 
1172
	} ring[RADEON_NUM_RINGS];
-
 
1173
	/* irqs */
-
 
1174
	struct {
-
 
1175
		int (*set)(struct radeon_device *rdev);
-
 
1176
		int (*process)(struct radeon_device *rdev);
-
 
1177
	} irq;
-
 
1178
	/* displays */
-
 
1179
	struct {
-
 
1180
		/* display watermarks */
-
 
1181
		void (*bandwidth_update)(struct radeon_device *rdev);
-
 
1182
		/* get frame count */
-
 
1183
	u32 (*get_vblank_counter)(struct radeon_device *rdev, int crtc);
-
 
1184
		/* wait for vblank */
-
 
1185
		void (*wait_for_vblank)(struct radeon_device *rdev, int crtc);
-
 
1186
		/* set backlight level */
-
 
1187
		void (*set_backlight_level)(struct radeon_encoder *radeon_encoder, u8 level);
-
 
1188
		/* get backlight level */
-
 
1189
		u8 (*get_backlight_level)(struct radeon_encoder *radeon_encoder);
-
 
1190
	} display;
-
 
1191
	/* copy functions for bo handling */
966
	int (*cs_parse)(struct radeon_cs_parser *p);
1192
	struct {
967
	int (*copy_blit)(struct radeon_device *rdev,
1193
		int (*blit)(struct radeon_device *rdev,
968
			 uint64_t src_offset,
1194
			 uint64_t src_offset,
969
			 uint64_t dst_offset,
1195
			 uint64_t dst_offset,
970
			 unsigned num_pages,
1196
			 unsigned num_gpu_pages,
-
 
1197
			    struct radeon_fence **fence);
971
			 struct radeon_fence *fence);
1198
		u32 blit_ring_index;
972
	int (*copy_dma)(struct radeon_device *rdev,
1199
		int (*dma)(struct radeon_device *rdev,
973
			uint64_t src_offset,
1200
			uint64_t src_offset,
974
			uint64_t dst_offset,
1201
			uint64_t dst_offset,
975
			unsigned num_pages,
1202
			unsigned num_gpu_pages,
-
 
1203
			   struct radeon_fence **fence);
-
 
1204
		u32 dma_ring_index;
976
			struct radeon_fence *fence);
1205
		/* method used for bo copy */
977
	int (*copy)(struct radeon_device *rdev,
1206
	int (*copy)(struct radeon_device *rdev,
978
		    uint64_t src_offset,
1207
		    uint64_t src_offset,
979
		    uint64_t dst_offset,
1208
		    uint64_t dst_offset,
980
		    unsigned num_pages,
1209
		    unsigned num_gpu_pages,
-
 
1210
			    struct radeon_fence **fence);
-
 
1211
		/* ring used for bo copies */
-
 
1212
		u32 copy_ring_index;
-
 
1213
	} copy;
-
 
1214
	/* surfaces */
-
 
1215
	struct {
-
 
1216
		int (*set_reg)(struct radeon_device *rdev, int reg,
-
 
1217
				       uint32_t tiling_flags, uint32_t pitch,
-
 
1218
				       uint32_t offset, uint32_t obj_size);
-
 
1219
		void (*clear_reg)(struct radeon_device *rdev, int reg);
-
 
1220
	} surface;
-
 
1221
	/* hotplug detect */
-
 
1222
	struct {
-
 
1223
		void (*init)(struct radeon_device *rdev);
-
 
1224
		void (*fini)(struct radeon_device *rdev);
-
 
1225
		bool (*sense)(struct radeon_device *rdev, enum radeon_hpd_id hpd);
-
 
1226
		void (*set_polarity)(struct radeon_device *rdev, enum radeon_hpd_id hpd);
-
 
1227
	} hpd;
-
 
1228
	/* power management */
-
 
1229
	struct {
-
 
1230
		void (*misc)(struct radeon_device *rdev);
-
 
1231
		void (*prepare)(struct radeon_device *rdev);
-
 
1232
		void (*finish)(struct radeon_device *rdev);
-
 
1233
		void (*init_profile)(struct radeon_device *rdev);
981
		    struct radeon_fence *fence);
1234
		void (*get_dynpm_state)(struct radeon_device *rdev);
982
	uint32_t (*get_engine_clock)(struct radeon_device *rdev);
1235
	uint32_t (*get_engine_clock)(struct radeon_device *rdev);
983
	void (*set_engine_clock)(struct radeon_device *rdev, uint32_t eng_clock);
1236
	void (*set_engine_clock)(struct radeon_device *rdev, uint32_t eng_clock);
984
	uint32_t (*get_memory_clock)(struct radeon_device *rdev);
1237
	uint32_t (*get_memory_clock)(struct radeon_device *rdev);
985
	void (*set_memory_clock)(struct radeon_device *rdev, uint32_t mem_clock);
1238
	void (*set_memory_clock)(struct radeon_device *rdev, uint32_t mem_clock);
986
	int (*get_pcie_lanes)(struct radeon_device *rdev);
1239
	int (*get_pcie_lanes)(struct radeon_device *rdev);
987
	void (*set_pcie_lanes)(struct radeon_device *rdev, int lanes);
1240
	void (*set_pcie_lanes)(struct radeon_device *rdev, int lanes);
988
	void (*set_clock_gating)(struct radeon_device *rdev, int enable);
-
 
989
	int (*set_surface_reg)(struct radeon_device *rdev, int reg,
-
 
990
			       uint32_t tiling_flags, uint32_t pitch,
-
 
991
			       uint32_t offset, uint32_t obj_size);
-
 
992
	void (*clear_surface_reg)(struct radeon_device *rdev, int reg);
-
 
993
	void (*bandwidth_update)(struct radeon_device *rdev);
-
 
994
	void (*hpd_init)(struct radeon_device *rdev);
-
 
995
	void (*hpd_fini)(struct radeon_device *rdev);
-
 
996
	bool (*hpd_sense)(struct radeon_device *rdev, enum radeon_hpd_id hpd);
-
 
997
	void (*hpd_set_polarity)(struct radeon_device *rdev, enum radeon_hpd_id hpd);
-
 
998
	/* ioctl hw specific callback. Some hw might want to perform special
-
 
999
	 * operation on specific ioctl. For instance on wait idle some hw
-
 
1000
	 * might want to perform and HDP flush through MMIO as it seems that
-
 
1001
	 * some R6XX/R7XX hw doesn't take HDP flush into account if programmed
-
 
1002
	 * through ring.
1241
	void (*set_clock_gating)(struct radeon_device *rdev, int enable);
1003
	 */
-
 
1004
	void (*ioctl_wait_idle)(struct radeon_device *rdev, struct radeon_bo *bo);
-
 
1005
	bool (*gui_idle)(struct radeon_device *rdev);
-
 
1006
	/* power management */
-
 
1007
	void (*pm_misc)(struct radeon_device *rdev);
-
 
1008
	void (*pm_prepare)(struct radeon_device *rdev);
-
 
1009
	void (*pm_finish)(struct radeon_device *rdev);
-
 
1010
	void (*pm_init_profile)(struct radeon_device *rdev);
-
 
1011
	void (*pm_get_dynpm_state)(struct radeon_device *rdev);
1242
	} pm;
-
 
1243
	/* pageflipping */
1012
	/* pageflipping */
1244
	struct {
1013
	void (*pre_page_flip)(struct radeon_device *rdev, int crtc);
1245
	void (*pre_page_flip)(struct radeon_device *rdev, int crtc);
1014
	u32 (*page_flip)(struct radeon_device *rdev, int crtc, u64 crtc_base);
1246
	u32 (*page_flip)(struct radeon_device *rdev, int crtc, u64 crtc_base);
-
 
1247
	void (*post_page_flip)(struct radeon_device *rdev, int crtc);
1015
	void (*post_page_flip)(struct radeon_device *rdev, int crtc);
1248
	} pflip;
Line 1016... Line 1249...
1016
};
1249
};
1017
 
1250
 
1018
/*
1251
/*
1019
 * Asic structures
-
 
1020
 */
-
 
1021
struct r100_gpu_lockup {
-
 
1022
	unsigned long	last_jiffies;
-
 
1023
	u32		last_cp_rptr;
-
 
1024
};
1252
 * Asic structures
1025
 
1253
 */
1026
struct r100_asic {
1254
struct r100_asic {
1027
	const unsigned	*reg_safe_bm;
1255
	const unsigned	*reg_safe_bm;
1028
	unsigned	reg_safe_bm_size;
-
 
1029
	u32		hdp_cntl;
1256
	unsigned	reg_safe_bm_size;
Line 1030... Line 1257...
1030
	struct r100_gpu_lockup	lockup;
1257
	u32		hdp_cntl;
1031
};
1258
};
1032
 
1259
 
1033
struct r300_asic {
1260
struct r300_asic {
1034
	const unsigned	*reg_safe_bm;
1261
	const unsigned	*reg_safe_bm;
1035
	unsigned	reg_safe_bm_size;
-
 
1036
	u32		resync_scratch;
1262
	unsigned	reg_safe_bm_size;
Line 1037... Line 1263...
1037
	u32		hdp_cntl;
1263
	u32		resync_scratch;
1038
	struct r100_gpu_lockup	lockup;
1264
	u32		hdp_cntl;
1039
};
1265
};
Line 1055... Line 1281...
1055
	unsigned tiling_nbanks;
1281
	unsigned tiling_nbanks;
1056
	unsigned tiling_npipes;
1282
	unsigned tiling_npipes;
1057
	unsigned tiling_group_size;
1283
	unsigned tiling_group_size;
1058
	unsigned		tile_config;
1284
	unsigned		tile_config;
1059
	unsigned		backend_map;
1285
	unsigned		backend_map;
1060
	struct r100_gpu_lockup	lockup;
-
 
1061
};
1286
};
Line 1062... Line 1287...
1062
 
1287
 
1063
struct rv770_asic {
1288
struct rv770_asic {
1064
	unsigned max_pipes;
1289
	unsigned max_pipes;
Line 1081... Line 1306...
1081
	unsigned tiling_nbanks;
1306
	unsigned tiling_nbanks;
1082
	unsigned tiling_npipes;
1307
	unsigned tiling_npipes;
1083
	unsigned tiling_group_size;
1308
	unsigned tiling_group_size;
1084
	unsigned		tile_config;
1309
	unsigned		tile_config;
1085
	unsigned		backend_map;
1310
	unsigned		backend_map;
1086
	struct r100_gpu_lockup	lockup;
-
 
1087
};
1311
};
Line 1088... Line 1312...
1088
 
1312
 
1089
struct evergreen_asic {
1313
struct evergreen_asic {
1090
	unsigned num_ses;
1314
	unsigned num_ses;
Line 1108... Line 1332...
1108
	unsigned tiling_nbanks;
1332
	unsigned tiling_nbanks;
1109
	unsigned tiling_npipes;
1333
	unsigned tiling_npipes;
1110
	unsigned tiling_group_size;
1334
	unsigned tiling_group_size;
1111
	unsigned tile_config;
1335
	unsigned tile_config;
1112
	unsigned backend_map;
1336
	unsigned backend_map;
1113
	struct r100_gpu_lockup	lockup;
-
 
1114
};
1337
};
Line 1115... Line 1338...
1115
 
1338
 
1116
struct cayman_asic {
1339
struct cayman_asic {
1117
	unsigned max_shader_engines;
1340
	unsigned max_shader_engines;
Line 1147... Line 1370...
1147
	unsigned shader_engine_tile_size;
1370
	unsigned shader_engine_tile_size;
1148
	unsigned num_gpus;
1371
	unsigned num_gpus;
1149
	unsigned multi_gpu_tile_size;
1372
	unsigned multi_gpu_tile_size;
Line 1150... Line 1373...
1150
 
1373
 
-
 
1374
	unsigned tile_config;
-
 
1375
};
-
 
1376
 
-
 
1377
struct si_asic {
-
 
1378
	unsigned max_shader_engines;
-
 
1379
	unsigned max_tile_pipes;
-
 
1380
	unsigned max_cu_per_sh;
-
 
1381
	unsigned max_sh_per_se;
-
 
1382
	unsigned max_backends_per_se;
-
 
1383
	unsigned max_texture_channel_caches;
-
 
1384
	unsigned max_gprs;
-
 
1385
	unsigned max_gs_threads;
-
 
1386
	unsigned max_hw_contexts;
-
 
1387
	unsigned sc_prim_fifo_size_frontend;
-
 
1388
	unsigned sc_prim_fifo_size_backend;
-
 
1389
	unsigned sc_hiz_tile_fifo_size;
-
 
1390
	unsigned sc_earlyz_tile_fifo_size;
-
 
1391
 
-
 
1392
	unsigned num_tile_pipes;
-
 
1393
	unsigned num_backends_per_se;
-
 
1394
	unsigned backend_disable_mask_per_asic;
-
 
1395
	unsigned backend_map;
-
 
1396
	unsigned num_texture_channel_caches;
-
 
1397
	unsigned mem_max_burst_length_bytes;
-
 
1398
	unsigned mem_row_size_in_kb;
-
 
1399
	unsigned shader_engine_tile_size;
1151
	unsigned tile_config;
1400
	unsigned num_gpus;
-
 
1401
	unsigned multi_gpu_tile_size;
-
 
1402
 
1152
	struct r100_gpu_lockup	lockup;
1403
	unsigned tile_config;
Line 1153... Line 1404...
1153
};
1404
};
1154
 
1405
 
1155
union radeon_asic_config {
1406
union radeon_asic_config {
1156
	struct r300_asic	r300;
1407
	struct r300_asic	r300;
1157
	struct r100_asic	r100;
1408
	struct r100_asic	r100;
1158
	struct r600_asic	r600;
1409
	struct r600_asic	r600;
1159
	struct rv770_asic	rv770;
1410
	struct rv770_asic	rv770;
-
 
1411
	struct evergreen_asic	evergreen;
1160
	struct evergreen_asic	evergreen;
1412
	struct cayman_asic	cayman;
Line 1161... Line 1413...
1161
	struct cayman_asic	cayman;
1413
	struct si_asic		si;
1162
};
1414
};
1163
 
1415
 
1164
/*
1416
/*
1165
 * asic initizalization from radeon_asic.c
1417
 * asic initizalization from radeon_asic.c
Line 1166... Line 1418...
1166
 */
1418
 */
1167
void radeon_agp_disable(struct radeon_device *rdev);
1419
void radeon_agp_disable(struct radeon_device *rdev);
1168
int radeon_asic_init(struct radeon_device *rdev);
1420
int radeon_asic_init(struct radeon_device *rdev);
1169
 
1421
 
-
 
1422
 
1170
 
1423
 
Line -... Line 1424...
-
 
1424
/* VRAM scratch page for HDP bug, default vram page */
1171
 
1425
struct r600_vram_scratch {
1172
/* VRAM scratch page for HDP bug */
1426
	struct radeon_bo		*robj;
1173
struct r700_vram_scratch {
1427
	volatile uint32_t		*ptr;
1174
	struct radeon_bo		*robj;
1428
	u64				gpu_addr;
1175
	volatile uint32_t		*ptr;
1429
};
Line 1176... Line 1430...
1176
};
1430
 
1177
 
1431
 
1178
/*
1432
/*
1179
 * Core structure, functions and helpers.
1433
 * Core structure, functions and helpers.
-
 
1434
 */
1180
 */
1435
typedef uint32_t (*radeon_rreg_t)(struct radeon_device*, uint32_t);
1181
typedef uint32_t (*radeon_rreg_t)(struct radeon_device*, uint32_t);
1436
typedef void (*radeon_wreg_t)(struct radeon_device*, uint32_t, uint32_t);
1182
typedef void (*radeon_wreg_t)(struct radeon_device*, uint32_t, uint32_t);
1437
 
1183
 
1438
struct radeon_device {
1184
struct radeon_device {
1439
    struct device              *dev;
Line 1200... Line 1455...
1200
    uint16_t                    bios_header_start;
1455
    uint16_t                    bios_header_start;
1201
	struct radeon_bo		    *stollen_vga_memory;
1456
	struct radeon_bo		    *stollen_vga_memory;
1202
    /* Register mmio */
1457
    /* Register mmio */
1203
	resource_size_t			rmmio_base;
1458
	resource_size_t			rmmio_base;
1204
	resource_size_t			rmmio_size;
1459
	resource_size_t			rmmio_size;
1205
    void                       *rmmio;
1460
	void __iomem			*rmmio;
1206
    radeon_rreg_t               mc_rreg;
1461
    radeon_rreg_t               mc_rreg;
1207
    radeon_wreg_t               mc_wreg;
1462
    radeon_wreg_t               mc_wreg;
1208
    radeon_rreg_t               pll_rreg;
1463
    radeon_rreg_t               pll_rreg;
1209
    radeon_wreg_t               pll_wreg;
1464
    radeon_wreg_t               pll_wreg;
1210
	uint32_t                        pcie_reg_mask;
1465
	uint32_t                        pcie_reg_mask;
Line 1217... Line 1472...
1217
    struct radeon_mc            mc;
1472
    struct radeon_mc            mc;
1218
    struct radeon_gart          gart;
1473
    struct radeon_gart          gart;
1219
	struct radeon_mode_info		mode_info;
1474
	struct radeon_mode_info		mode_info;
1220
    struct radeon_scratch       scratch;
1475
    struct radeon_scratch       scratch;
1221
    struct radeon_mman          mman;
1476
    struct radeon_mman          mman;
1222
	struct radeon_fence_driver	fence_drv;
1477
	struct radeon_fence_driver	fence_drv[RADEON_NUM_RINGS];
1223
    struct radeon_cp            cp;
1478
	wait_queue_head_t		fence_queue;
1224
	/* cayman compute rings */
1479
	struct mutex			ring_lock;
1225
	struct radeon_cp		cp1;
1480
	struct radeon_ring		ring[RADEON_NUM_RINGS];
1226
	struct radeon_cp		cp2;
1481
	bool				ib_pool_ready;
1227
    struct radeon_ib_pool       ib_pool;
1482
	struct radeon_sa_manager	ring_tmp_bo;
1228
    struct radeon_irq       irq;
1483
    struct radeon_irq       irq;
1229
    struct radeon_asic         *asic;
1484
    struct radeon_asic         *asic;
1230
    struct radeon_gem       gem;
1485
    struct radeon_gem       gem;
1231
	struct radeon_pm		pm;
1486
	struct radeon_pm		pm;
1232
	uint32_t			bios_scratch[RADEON_BIOS_NUM_SCRATCH];
1487
	uint32_t			bios_scratch[RADEON_BIOS_NUM_SCRATCH];
1233
	struct mutex			cs_mutex;
-
 
1234
    struct radeon_wb        wb;
1488
    struct radeon_wb        wb;
1235
	struct radeon_dummy_page	dummy_page;
1489
	struct radeon_dummy_page	dummy_page;
1236
    bool                gpu_lockup;
-
 
1237
    bool                shutdown;
1490
    bool                shutdown;
1238
    bool                suspend;
1491
    bool                suspend;
1239
	bool				need_dma32;
1492
	bool				need_dma32;
1240
	bool				accel_working;
1493
	bool				accel_working;
1241
	struct radeon_surface_reg surface_regs[RADEON_GEM_MAX_SURFACES];
1494
	struct radeon_surface_reg surface_regs[RADEON_GEM_MAX_SURFACES];
1242
	const struct firmware *me_fw;	/* all family ME firmware */
1495
	const struct firmware *me_fw;	/* all family ME firmware */
1243
	const struct firmware *pfp_fw;	/* r6/700 PFP firmware */
1496
	const struct firmware *pfp_fw;	/* r6/700 PFP firmware */
1244
	const struct firmware *rlc_fw;	/* r6/700 RLC firmware */
1497
	const struct firmware *rlc_fw;	/* r6/700 RLC firmware */
1245
	const struct firmware *mc_fw;	/* NI MC firmware */
1498
	const struct firmware *mc_fw;	/* NI MC firmware */
-
 
1499
	const struct firmware *ce_fw;	/* SI CE firmware */
1246
	struct r600_blit r600_blit;
1500
	struct r600_blit r600_blit;
1247
    struct r600_blit r600_video;
-
 
1248
	struct r700_vram_scratch vram_scratch;
1501
	struct r600_vram_scratch vram_scratch;
1249
	int msi_enabled; /* msi enabled */
1502
	int msi_enabled; /* msi enabled */
1250
	struct r600_ih ih; /* r6/700 interrupt ring */
1503
	struct r600_ih ih; /* r6/700 interrupt ring */
-
 
1504
	struct si_rlc rlc;
1251
//	struct work_struct hotplug_work;
1505
//	struct work_struct hotplug_work;
-
 
1506
//	struct work_struct audio_work;
1252
	int num_crtc; /* number of crtcs */
1507
	int num_crtc; /* number of crtcs */
1253
	struct mutex dc_hw_i2c_mutex; /* display controller hw i2c mutex */
1508
	struct mutex dc_hw_i2c_mutex; /* display controller hw i2c mutex */
1254
	struct mutex vram_mutex;
-
 
1255
 
-
 
1256
	/* audio stuff */
-
 
1257
	bool			audio_enabled;
1509
	bool			audio_enabled;
1258
//	struct timer_list	audio_timer;
1510
//   struct r600_audio audio_status; /* audio stuff */
1259
	int			audio_channels;
1511
//   struct notifier_block acpi_nb;
1260
	int			audio_rate;
-
 
1261
	int			audio_bits_per_sample;
1512
	/* only one userspace can use Hyperz features or CMASK at a time */
1262
	uint8_t			audio_status_bits;
1513
//	struct drm_file *hyperz_filp;
1263
	uint8_t			audio_category_code;
1514
//	struct drm_file *cmask_filp;
1264
 
-
 
1265
 
-
 
1266
	/* i2c buses */
1515
	/* i2c buses */
1267
	struct radeon_i2c_chan *i2c_bus[RADEON_MAX_I2C_BUS];
1516
	struct radeon_i2c_chan *i2c_bus[RADEON_MAX_I2C_BUS];
-
 
1517
	/* debugfs */
-
 
1518
//	struct radeon_debugfs	debugfs[RADEON_DEBUGFS_MAX_COMPONENTS];
-
 
1519
	unsigned 		debugfs_count;
-
 
1520
	/* virtual memory */
-
 
1521
	struct radeon_vm_manager	vm_manager;
-
 
1522
	struct mutex			gpu_clock_mutex;
-
 
1523
	/* ACPI interface */
-
 
1524
//	struct radeon_atif		atif;
-
 
1525
//	struct radeon_atcs		atcs;
1268
};
1526
};
Line 1269... Line 1527...
1269
 
1527
 
1270
int radeon_device_init(struct radeon_device *rdev,
1528
int radeon_device_init(struct radeon_device *rdev,
1271
		       struct drm_device *ddev,
1529
		       struct drm_device *ddev,
1272
		       struct pci_dev *pdev,
1530
		       struct pci_dev *pdev,
1273
		       uint32_t flags);
1531
		       uint32_t flags);
1274
void radeon_device_fini(struct radeon_device *rdev);
1532
void radeon_device_fini(struct radeon_device *rdev);
Line 1275... Line 1533...
1275
int radeon_gpu_wait_for_idle(struct radeon_device *rdev);
1533
int radeon_gpu_wait_for_idle(struct radeon_device *rdev);
1276
 
-
 
1277
static inline uint32_t r100_mm_rreg(struct radeon_device *rdev, uint32_t reg)
-
 
1278
{
-
 
1279
	if (reg < rdev->rmmio_size)
-
 
1280
		return readl(((void __iomem *)rdev->rmmio) + reg);
-
 
1281
	else {
-
 
1282
		writel(reg, ((void __iomem *)rdev->rmmio) + RADEON_MM_INDEX);
-
 
1283
		return readl(((void __iomem *)rdev->rmmio) + RADEON_MM_DATA);
-
 
1284
	}
-
 
1285
}
1534
 
1286
 
-
 
1287
static inline void r100_mm_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v)
-
 
1288
{
-
 
1289
	if (reg < rdev->rmmio_size)
-
 
1290
		writel(v, ((void __iomem *)rdev->rmmio) + reg);
-
 
1291
	else {
-
 
1292
		writel(reg, ((void __iomem *)rdev->rmmio) + RADEON_MM_INDEX);
-
 
1293
		writel(v, ((void __iomem *)rdev->rmmio) + RADEON_MM_DATA);
-
 
1294
	}
-
 
1295
}
1535
uint32_t r100_mm_rreg(struct radeon_device *rdev, uint32_t reg);
1296
 
-
 
1297
static inline u32 r100_io_rreg(struct radeon_device *rdev, u32 reg)
-
 
1298
{
-
 
1299
	if (reg < rdev->rio_mem_size)
-
 
1300
		return ioread32(rdev->rio_mem + reg);
-
 
1301
	else {
-
 
1302
		iowrite32(reg, rdev->rio_mem + RADEON_MM_INDEX);
-
 
1303
		return ioread32(rdev->rio_mem + RADEON_MM_DATA);
-
 
1304
	}
-
 
1305
}
1536
void r100_mm_wreg(struct radeon_device *rdev, uint32_t reg, uint32_t v);
1306
 
-
 
1307
static inline void r100_io_wreg(struct radeon_device *rdev, u32 reg, u32 v)
-
 
1308
{
-
 
1309
	if (reg < rdev->rio_mem_size)
-
 
1310
		iowrite32(v, rdev->rio_mem + reg);
-
 
1311
	else {
-
 
1312
		iowrite32(reg, rdev->rio_mem + RADEON_MM_INDEX);
-
 
1313
		iowrite32(v, rdev->rio_mem + RADEON_MM_DATA);
-
 
Line 1314... Line 1537...
1314
	}
1537
u32 r100_io_rreg(struct radeon_device *rdev, u32 reg);
1315
}
1538
void r100_io_wreg(struct radeon_device *rdev, u32 reg, u32 v);
1316
 
1539
 
1317
/*
1540
/*
Line 1318... Line 1541...
1318
 * Cast helper
1541
 * Cast helper
1319
 */
1542
 */
1320
#define to_radeon_fence(p) ((struct radeon_fence *)(p))
1543
#define to_radeon_fence(p) ((struct radeon_fence *)(p))
1321
 
1544
 
1322
/*
1545
/*
1323
 * Registers read & write functions.
1546
 * Registers read & write functions.
1324
 */
1547
 */
1325
#define RREG8(reg) readb(((void __iomem *)rdev->rmmio) + (reg))
1548
#define RREG8(reg) readb((rdev->rmmio) + (reg))
1326
#define WREG8(reg, v) writeb(v, ((void __iomem *)rdev->rmmio) + (reg))
1549
#define WREG8(reg, v) writeb(v, (rdev->rmmio) + (reg))
1327
#define RREG16(reg) readw(((void __iomem *)rdev->rmmio) + (reg))
1550
#define RREG16(reg) readw((rdev->rmmio) + (reg))
1328
#define WREG16(reg, v) writew(v, ((void __iomem *)rdev->rmmio) + (reg))
1551
#define WREG16(reg, v) writew(v, (rdev->rmmio) + (reg))
1329
#define RREG32(reg) r100_mm_rreg(rdev, (reg))
1552
#define RREG32(reg) r100_mm_rreg(rdev, (reg))
Line 1415... Line 1638...
1415
#define ASIC_IS_DCE32(rdev) ((rdev->family >= CHIP_RV730))
1638
#define ASIC_IS_DCE32(rdev) ((rdev->family >= CHIP_RV730))
1416
#define ASIC_IS_DCE4(rdev) ((rdev->family >= CHIP_CEDAR))
1639
#define ASIC_IS_DCE4(rdev) ((rdev->family >= CHIP_CEDAR))
1417
#define ASIC_IS_DCE41(rdev) ((rdev->family >= CHIP_PALM) && \
1640
#define ASIC_IS_DCE41(rdev) ((rdev->family >= CHIP_PALM) && \
1418
			     (rdev->flags & RADEON_IS_IGP))
1641
			     (rdev->flags & RADEON_IS_IGP))
1419
#define ASIC_IS_DCE5(rdev) ((rdev->family >= CHIP_BARTS))
1642
#define ASIC_IS_DCE5(rdev) ((rdev->family >= CHIP_BARTS))
-
 
1643
#define ASIC_IS_DCE6(rdev) ((rdev->family >= CHIP_ARUBA))
-
 
1644
#define ASIC_IS_DCE61(rdev) ((rdev->family >= CHIP_ARUBA) && \
-
 
1645
			     (rdev->flags & RADEON_IS_IGP))
Line 1420... Line 1646...
1420
 
1646
 
1421
/*
1647
/*
1422
 * BIOS helpers.
1648
 * BIOS helpers.
1423
 */
1649
 */
Line 1432... Line 1658...
1432
 
1658
 
1433
 
1659
 
1434
/*
1660
/*
-
 
1661
 * RING helpers.
1435
 * RING helpers.
1662
 */
1436
 */
1663
#if DRM_DEBUG_CODE == 0
-
 
1664
static inline void radeon_ring_write(struct radeon_ring *ring, uint32_t v)
1437
static inline void radeon_ring_write(struct radeon_device *rdev, uint32_t v)
1665
{
1438
{
1666
	ring->ring[ring->wptr++] = v;
1439
#if DRM_DEBUG_CODE
1667
	ring->wptr &= ring->ptr_mask;
1440
	if (rdev->cp.count_dw <= 0) {
1668
	ring->count_dw--;
-
 
1669
	ring->ring_free_dw--;
-
 
1670
}
-
 
1671
#else
1441
		DRM_ERROR("radeon: writting more dword to ring than expected !\n");
1672
/* With debugging this is just too big to inline */
1442
	}
-
 
1443
#endif
-
 
1444
	rdev->cp.ring[rdev->cp.wptr++] = v;
-
 
1445
	rdev->cp.wptr &= rdev->cp.ptr_mask;
-
 
1446
	rdev->cp.count_dw--;
-
 
1447
	rdev->cp.ring_free_dw--;
-
 
Line 1448... Line 1673...
1448
}
1673
void radeon_ring_write(struct radeon_ring *ring, uint32_t v);
1449
 
1674
#endif
1450
 
1675
 
1451
/*
1676
/*
1452
 * ASICs macro.
1677
 * ASICs macro.
1453
 */
1678
 */
1454
#define radeon_init(rdev) (rdev)->asic->init((rdev))
1679
#define radeon_init(rdev) (rdev)->asic->init((rdev))
1455
#define radeon_fini(rdev) (rdev)->asic->fini((rdev))
1680
#define radeon_fini(rdev) (rdev)->asic->fini((rdev))
1456
#define radeon_resume(rdev) (rdev)->asic->resume((rdev))
1681
#define radeon_resume(rdev) (rdev)->asic->resume((rdev))
1457
#define radeon_suspend(rdev) (rdev)->asic->suspend((rdev))
-
 
1458
#define radeon_cs_parse(p) rdev->asic->cs_parse((p))
1682
#define radeon_suspend(rdev) (rdev)->asic->suspend((rdev))
1459
#define radeon_vga_set_state(rdev, state) (rdev)->asic->vga_set_state((rdev), (state))
1683
#define radeon_cs_parse(rdev, r, p) (rdev)->asic->ring[(r)].cs_parse((p))
1460
#define radeon_gpu_is_lockup(rdev) (rdev)->asic->gpu_is_lockup((rdev))
1684
#define radeon_vga_set_state(rdev, state) (rdev)->asic->vga_set_state((rdev), (state))
1461
#define radeon_asic_reset(rdev) (rdev)->asic->asic_reset((rdev))
1685
#define radeon_asic_reset(rdev) (rdev)->asic->asic_reset((rdev))
-
 
1686
#define radeon_gart_tlb_flush(rdev) (rdev)->asic->gart.tlb_flush((rdev))
-
 
1687
#define radeon_gart_set_page(rdev, i, p) (rdev)->asic->gart.set_page((rdev), (i), (p))
1462
#define radeon_gart_tlb_flush(rdev) (rdev)->asic->gart_tlb_flush((rdev))
1688
#define radeon_asic_vm_init(rdev) (rdev)->asic->vm.init((rdev))
1463
#define radeon_gart_set_page(rdev, i, p) (rdev)->asic->gart_set_page((rdev), (i), (p))
1689
#define radeon_asic_vm_fini(rdev) (rdev)->asic->vm.fini((rdev))
-
 
1690
#define radeon_asic_vm_set_page(rdev, pe, addr, count, incr, flags) ((rdev)->asic->vm.set_page((rdev), (pe), (addr), (count), (incr), (flags)))
1464
#define radeon_cp_commit(rdev) (rdev)->asic->cp_commit((rdev))
1691
#define radeon_ring_start(rdev, r, cp) (rdev)->asic->ring[(r)].ring_start((rdev), (cp))
-
 
1692
#define radeon_ring_test(rdev, r, cp) (rdev)->asic->ring[(r)].ring_test((rdev), (cp))
-
 
1693
#define radeon_ib_test(rdev, r, cp) (rdev)->asic->ring[(r)].ib_test((rdev), (cp))
-
 
1694
#define radeon_ring_ib_execute(rdev, r, ib) (rdev)->asic->ring[(r)].ib_execute((rdev), (ib))
1465
#define radeon_ring_start(rdev) (rdev)->asic->ring_start((rdev))
1695
#define radeon_ring_ib_parse(rdev, r, ib) (rdev)->asic->ring[(r)].ib_parse((rdev), (ib))
1466
#define radeon_ring_test(rdev) (rdev)->asic->ring_test((rdev))
1696
#define radeon_ring_is_lockup(rdev, r, cp) (rdev)->asic->ring[(r)].is_lockup((rdev), (cp))
1467
#define radeon_ring_ib_execute(rdev, ib) (rdev)->asic->ring_ib_execute((rdev), (ib))
1697
#define radeon_ring_vm_flush(rdev, r, vm) (rdev)->asic->ring[(r)].vm_flush((rdev), (r), (vm))
-
 
1698
#define radeon_irq_set(rdev) (rdev)->asic->irq.set((rdev))
-
 
1699
#define radeon_irq_process(rdev) (rdev)->asic->irq.process((rdev))
1468
#define radeon_irq_set(rdev) (rdev)->asic->irq_set((rdev))
1700
#define radeon_get_vblank_counter(rdev, crtc) (rdev)->asic->display.get_vblank_counter((rdev), (crtc))
-
 
1701
#define radeon_set_backlight_level(rdev, e, l) (rdev)->asic->display.set_backlight_level((e), (l))
1469
#define radeon_irq_process(rdev) (rdev)->asic->irq_process((rdev))
1702
#define radeon_get_backlight_level(rdev, e) (rdev)->asic->display.get_backlight_level((e))
1470
#define radeon_get_vblank_counter(rdev, crtc) (rdev)->asic->get_vblank_counter((rdev), (crtc))
1703
#define radeon_fence_ring_emit(rdev, r, fence) (rdev)->asic->ring[(r)].emit_fence((rdev), (fence))
1471
#define radeon_fence_ring_emit(rdev, fence) (rdev)->asic->fence_ring_emit((rdev), (fence))
1704
#define radeon_semaphore_ring_emit(rdev, r, cp, semaphore, emit_wait) (rdev)->asic->ring[(r)].emit_semaphore((rdev), (cp), (semaphore), (emit_wait))
-
 
1705
#define radeon_copy_blit(rdev, s, d, np, f) (rdev)->asic->copy.blit((rdev), (s), (d), (np), (f))
-
 
1706
#define radeon_copy_dma(rdev, s, d, np, f) (rdev)->asic->copy.dma((rdev), (s), (d), (np), (f))
-
 
1707
#define radeon_copy(rdev, s, d, np, f) (rdev)->asic->copy.copy((rdev), (s), (d), (np), (f))
1472
#define radeon_copy_blit(rdev, s, d, np, f) (rdev)->asic->copy_blit((rdev), (s), (d), (np), (f))
1708
#define radeon_copy_blit_ring_index(rdev) (rdev)->asic->copy.blit_ring_index
1473
#define radeon_copy_dma(rdev, s, d, np, f) (rdev)->asic->copy_dma((rdev), (s), (d), (np), (f))
1709
#define radeon_copy_dma_ring_index(rdev) (rdev)->asic->copy.dma_ring_index
1474
#define radeon_copy(rdev, s, d, np, f) (rdev)->asic->copy((rdev), (s), (d), (np), (f))
1710
#define radeon_copy_ring_index(rdev) (rdev)->asic->copy.copy_ring_index
1475
#define radeon_get_engine_clock(rdev) (rdev)->asic->get_engine_clock((rdev))
1711
#define radeon_get_engine_clock(rdev) (rdev)->asic->pm.get_engine_clock((rdev))
1476
#define radeon_set_engine_clock(rdev, e) (rdev)->asic->set_engine_clock((rdev), (e))
1712
#define radeon_set_engine_clock(rdev, e) (rdev)->asic->pm.set_engine_clock((rdev), (e))
1477
#define radeon_get_memory_clock(rdev) (rdev)->asic->get_memory_clock((rdev))
1713
#define radeon_get_memory_clock(rdev) (rdev)->asic->pm.get_memory_clock((rdev))
1478
#define radeon_set_memory_clock(rdev, e) (rdev)->asic->set_memory_clock((rdev), (e))
1714
#define radeon_set_memory_clock(rdev, e) (rdev)->asic->pm.set_memory_clock((rdev), (e))
1479
#define radeon_get_pcie_lanes(rdev) (rdev)->asic->get_pcie_lanes((rdev))
1715
#define radeon_get_pcie_lanes(rdev) (rdev)->asic->pm.get_pcie_lanes((rdev))
1480
#define radeon_set_pcie_lanes(rdev, l) (rdev)->asic->set_pcie_lanes((rdev), (l))
1716
#define radeon_set_pcie_lanes(rdev, l) (rdev)->asic->pm.set_pcie_lanes((rdev), (l))
1481
#define radeon_set_clock_gating(rdev, e) (rdev)->asic->set_clock_gating((rdev), (e))
1717
#define radeon_set_clock_gating(rdev, e) (rdev)->asic->pm.set_clock_gating((rdev), (e))
1482
#define radeon_set_surface_reg(rdev, r, f, p, o, s) ((rdev)->asic->set_surface_reg((rdev), (r), (f), (p), (o), (s)))
1718
#define radeon_set_surface_reg(rdev, r, f, p, o, s) ((rdev)->asic->surface.set_reg((rdev), (r), (f), (p), (o), (s)))
1483
#define radeon_clear_surface_reg(rdev, r) ((rdev)->asic->clear_surface_reg((rdev), (r)))
1719
#define radeon_clear_surface_reg(rdev, r) ((rdev)->asic->surface.clear_reg((rdev), (r)))
1484
#define radeon_bandwidth_update(rdev) (rdev)->asic->bandwidth_update((rdev))
1720
#define radeon_bandwidth_update(rdev) (rdev)->asic->display.bandwidth_update((rdev))
1485
#define radeon_hpd_init(rdev) (rdev)->asic->hpd_init((rdev))
1721
#define radeon_hpd_init(rdev) (rdev)->asic->hpd.init((rdev))
1486
#define radeon_hpd_fini(rdev) (rdev)->asic->hpd_fini((rdev))
1722
#define radeon_hpd_fini(rdev) (rdev)->asic->hpd.fini((rdev))
1487
#define radeon_hpd_sense(rdev, hpd) (rdev)->asic->hpd_sense((rdev), (hpd))
1723
#define radeon_hpd_sense(rdev, h) (rdev)->asic->hpd.sense((rdev), (h))
1488
#define radeon_hpd_set_polarity(rdev, hpd) (rdev)->asic->hpd_set_polarity((rdev), (hpd))
1724
#define radeon_hpd_set_polarity(rdev, h) (rdev)->asic->hpd.set_polarity((rdev), (h))
1489
#define radeon_gui_idle(rdev) (rdev)->asic->gui_idle((rdev))
1725
#define radeon_gui_idle(rdev) (rdev)->asic->gui_idle((rdev))
1490
#define radeon_pm_misc(rdev) (rdev)->asic->pm_misc((rdev))
1726
#define radeon_pm_misc(rdev) (rdev)->asic->pm.misc((rdev))
1491
#define radeon_pm_prepare(rdev) (rdev)->asic->pm_prepare((rdev))
1727
#define radeon_pm_prepare(rdev) (rdev)->asic->pm.prepare((rdev))
1492
#define radeon_pm_finish(rdev) (rdev)->asic->pm_finish((rdev))
1728
#define radeon_pm_finish(rdev) (rdev)->asic->pm.finish((rdev))
1493
#define radeon_pm_init_profile(rdev) (rdev)->asic->pm_init_profile((rdev))
1729
#define radeon_pm_init_profile(rdev) (rdev)->asic->pm.init_profile((rdev))
1494
#define radeon_pm_get_dynpm_state(rdev) (rdev)->asic->pm_get_dynpm_state((rdev))
1730
#define radeon_pm_get_dynpm_state(rdev) (rdev)->asic->pm.get_dynpm_state((rdev))
-
 
1731
#define radeon_pre_page_flip(rdev, crtc) (rdev)->asic->pflip.pre_page_flip((rdev), (crtc))
-
 
1732
#define radeon_page_flip(rdev, crtc, base) (rdev)->asic->pflip.page_flip((rdev), (crtc), (base))
Line 1495... Line 1733...
1495
#define radeon_pre_page_flip(rdev, crtc) rdev->asic->pre_page_flip((rdev), (crtc))
1733
#define radeon_post_page_flip(rdev, crtc) (rdev)->asic->pflip.post_page_flip((rdev), (crtc))
1496
#define radeon_page_flip(rdev, crtc, base) rdev->asic->page_flip((rdev), (crtc), (base))
1734
#define radeon_wait_for_vblank(rdev, crtc) (rdev)->asic->display.wait_for_vblank((rdev), (crtc))
1497
#define radeon_post_page_flip(rdev, crtc) rdev->asic->post_page_flip((rdev), (crtc))
1735
#define radeon_mc_wait_for_idle(rdev) (rdev)->asic->mc_wait_for_idle((rdev))
1498
 
1736
 
1499
/* Common functions */
-
 
1500
/* AGP */
-
 
1501
extern int radeon_gpu_reset(struct radeon_device *rdev);
1737
/* Common functions */
1502
extern void radeon_agp_disable(struct radeon_device *rdev);
1738
/* AGP */
1503
extern int radeon_gart_table_vram_pin(struct radeon_device *rdev);
1739
extern int radeon_gpu_reset(struct radeon_device *rdev);
1504
extern void radeon_gart_restore(struct radeon_device *rdev);
1740
extern void radeon_agp_disable(struct radeon_device *rdev);
1505
extern int radeon_modeset_init(struct radeon_device *rdev);
1741
extern int radeon_modeset_init(struct radeon_device *rdev);
Line 1523... Line 1759...
1523
extern int radeon_resume_kms(struct drm_device *dev);
1759
extern int radeon_resume_kms(struct drm_device *dev);
1524
extern int radeon_suspend_kms(struct drm_device *dev, pm_message_t state);
1760
extern int radeon_suspend_kms(struct drm_device *dev, pm_message_t state);
1525
extern void radeon_ttm_set_active_vram_size(struct radeon_device *rdev, u64 size);
1761
extern void radeon_ttm_set_active_vram_size(struct radeon_device *rdev, u64 size);
Line 1526... Line 1762...
1526
 
1762
 
-
 
1763
/*
-
 
1764
 * vm
-
 
1765
 */
-
 
1766
int radeon_vm_manager_init(struct radeon_device *rdev);
-
 
1767
void radeon_vm_manager_fini(struct radeon_device *rdev);
-
 
1768
void radeon_vm_init(struct radeon_device *rdev, struct radeon_vm *vm);
-
 
1769
void radeon_vm_fini(struct radeon_device *rdev, struct radeon_vm *vm);
-
 
1770
int radeon_vm_alloc_pt(struct radeon_device *rdev, struct radeon_vm *vm);
-
 
1771
void radeon_vm_add_to_lru(struct radeon_device *rdev, struct radeon_vm *vm);
-
 
1772
struct radeon_fence *radeon_vm_grab_id(struct radeon_device *rdev,
-
 
1773
				       struct radeon_vm *vm, int ring);
-
 
1774
void radeon_vm_fence(struct radeon_device *rdev,
-
 
1775
		     struct radeon_vm *vm,
-
 
1776
		     struct radeon_fence *fence);
-
 
1777
uint64_t radeon_vm_map_gart(struct radeon_device *rdev, uint64_t addr);
-
 
1778
int radeon_vm_bo_update_pte(struct radeon_device *rdev,
-
 
1779
			    struct radeon_vm *vm,
-
 
1780
			    struct radeon_bo *bo,
-
 
1781
			    struct ttm_mem_reg *mem);
-
 
1782
void radeon_vm_bo_invalidate(struct radeon_device *rdev,
-
 
1783
			     struct radeon_bo *bo);
-
 
1784
struct radeon_bo_va *radeon_vm_bo_find(struct radeon_vm *vm,
-
 
1785
				       struct radeon_bo *bo);
-
 
1786
struct radeon_bo_va *radeon_vm_bo_add(struct radeon_device *rdev,
-
 
1787
				      struct radeon_vm *vm,
-
 
1788
				      struct radeon_bo *bo);
-
 
1789
int radeon_vm_bo_set_addr(struct radeon_device *rdev,
-
 
1790
			  struct radeon_bo_va *bo_va,
-
 
1791
			  uint64_t offset,
-
 
1792
			  uint32_t flags);
-
 
1793
int radeon_vm_bo_rmv(struct radeon_device *rdev,
-
 
1794
		     struct radeon_bo_va *bo_va);
-
 
1795
 
-
 
1796
/* audio */
-
 
1797
void r600_audio_update_hdmi(struct work_struct *work);
-
 
1798
 
-
 
1799
/*
-
 
1800
 * R600 vram scratch functions
-
 
1801
 */
-
 
1802
int r600_vram_scratch_init(struct radeon_device *rdev);
-
 
1803
void r600_vram_scratch_fini(struct radeon_device *rdev);
-
 
1804
 
-
 
1805
/*
-
 
1806
 * r600 cs checking helper
-
 
1807
 */
-
 
1808
unsigned r600_mip_minify(unsigned size, unsigned level);
-
 
1809
bool r600_fmt_is_valid_color(u32 format);
-
 
1810
bool r600_fmt_is_valid_texture(u32 format, enum radeon_family family);
-
 
1811
int r600_fmt_get_blocksize(u32 format);
-
 
1812
int r600_fmt_get_nblocksx(u32 format, u32 w);
-
 
1813
int r600_fmt_get_nblocksy(u32 format, u32 h);
-
 
1814
 
1527
/*
1815
/*
1528
 * r600 functions used by radeon_encoder.c
1816
 * r600 functions used by radeon_encoder.c
-
 
1817
 */
-
 
1818
struct radeon_hdmi_acr {
-
 
1819
	u32 clock;
-
 
1820
 
-
 
1821
	int n_32khz;
-
 
1822
	int cts_32khz;
-
 
1823
 
-
 
1824
	int n_44_1khz;
-
 
1825
	int cts_44_1khz;
-
 
1826
 
-
 
1827
	int n_48khz;
-
 
1828
	int cts_48khz;
-
 
1829
 
-
 
1830
};
-
 
1831
 
-
 
1832
extern struct radeon_hdmi_acr r600_hdmi_acr(uint32_t clock);
1529
 */
1833
 
1530
extern void r600_hdmi_enable(struct drm_encoder *encoder);
1834
extern void r600_hdmi_enable(struct drm_encoder *encoder);
1531
extern void r600_hdmi_disable(struct drm_encoder *encoder);
1835
extern void r600_hdmi_disable(struct drm_encoder *encoder);
-
 
1836
extern void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mode);
-
 
1837
extern u32 r6xx_remap_render_backend(struct radeon_device *rdev,
-
 
1838
				     u32 tiling_pipe_num,
-
 
1839
				     u32 max_rb_num,
-
 
1840
				     u32 total_max_rb_num,
-
 
1841
				     u32 enabled_rb_mask);
-
 
1842
 
-
 
1843
/*
-
 
1844
 * evergreen functions used by radeon_encoder.c
-
 
1845
 */
-
 
1846
 
Line 1532... Line 1847...
1532
extern void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mode);
1847
extern void evergreen_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mode);
1533
 
1848
 
Line 1534... Line 1849...
1534
extern int ni_init_microcode(struct radeon_device *rdev);
1849
extern int ni_init_microcode(struct radeon_device *rdev);
1535
extern int ni_mc_load_microcode(struct radeon_device *rdev);
1850
extern int ni_mc_load_microcode(struct radeon_device *rdev);
1536
 
1851
 
-
 
1852
/* radeon_acpi.c */
1537
/* radeon_acpi.c */
1853
#if defined(CONFIG_ACPI)
1538
#if defined(CONFIG_ACPI)
1854
extern int radeon_acpi_init(struct radeon_device *rdev);
-
 
1855
extern void radeon_acpi_fini(struct radeon_device *rdev);
1539
extern int radeon_acpi_init(struct radeon_device *rdev);
1856
#else
Line 1540... Line 1857...
1540
#else
1857
static inline int radeon_acpi_init(struct radeon_device *rdev) { return 0; }
Line 1541... Line 1858...
1541
static inline int radeon_acpi_init(struct radeon_device *rdev) { return 0; }
1858
static inline void radeon_acpi_fini(struct radeon_device *rdev) { }
Line 1553... Line 1870...
1553
bool set_mode(struct drm_device *dev, struct drm_connector *connector,
1870
bool set_mode(struct drm_device *dev, struct drm_connector *connector,
1554
              videomode_t *mode, bool strict);
1871
              videomode_t *mode, bool strict);
Line 1555... Line -...
1555
 
-
 
1556
 
-
 
1557
 
-
 
1558
struct work_struct;
-
 
1559
typedef void (*work_func_t)(struct work_struct *work);
-
 
1560
 
-
 
1561
/*
-
 
1562
 * The first word is the work queue pointer and the flags rolled into
-
 
1563
 * one
-
 
1564
 */
-
 
1565
#define work_data_bits(work) ((unsigned long *)(&(work)->data))
-
 
1566
 
-
 
1567
struct work_struct {
-
 
1568
        atomic_long_t data;
-
 
1569
#define WORK_STRUCT_PENDING 0           /* T if work item pending execution */
-
 
1570
#define WORK_STRUCT_FLAG_MASK (3UL)
-
 
1571
#define WORK_STRUCT_WQ_DATA_MASK (~WORK_STRUCT_FLAG_MASK)
-
 
1572
        struct list_head entry;
-
 
1573
        work_func_t func;
1872