drm/nvc0: implement support for copy engines
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / gpu / drm / nouveau / nouveau_drv.h
CommitLineData
6ee73861
BS
1/*
2 * Copyright 2005 Stephane Marchesin.
3 * All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
14 * Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25#ifndef __NOUVEAU_DRV_H__
26#define __NOUVEAU_DRV_H__
27
28#define DRIVER_AUTHOR "Stephane Marchesin"
29#define DRIVER_EMAIL "dri-devel@lists.sourceforge.net"
30
31#define DRIVER_NAME "nouveau"
32#define DRIVER_DESC "nVidia Riva/TNT/GeForce"
33#define DRIVER_DATE "20090420"
34
35#define DRIVER_MAJOR 0
36#define DRIVER_MINOR 0
a1606a95 37#define DRIVER_PATCHLEVEL 16
6ee73861
BS
38
39#define NOUVEAU_FAMILY 0x0000FFFF
40#define NOUVEAU_FLAGS 0xFFFF0000
41
42#include "ttm/ttm_bo_api.h"
43#include "ttm/ttm_bo_driver.h"
44#include "ttm/ttm_placement.h"
45#include "ttm/ttm_memory.h"
46#include "ttm/ttm_module.h"
47
48struct nouveau_fpriv {
49 struct ttm_object_file *tfile;
50};
51
52#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
53
54#include "nouveau_drm.h"
55#include "nouveau_reg.h"
56#include "nouveau_bios.h"
274fec93 57#include "nouveau_util.h"
f869ef88 58
054b93e4 59struct nouveau_grctx;
d5f42394 60struct nouveau_mem;
f869ef88 61#include "nouveau_vm.h"
6ee73861
BS
62
63#define MAX_NUM_DCB_ENTRIES 16
64
65#define NOUVEAU_MAX_CHANNEL_NR 128
a0af9add 66#define NOUVEAU_MAX_TILE_NR 15
6ee73861 67
d5f42394 68struct nouveau_mem {
573a2a37
BS
69 struct drm_device *dev;
70
f869ef88 71 struct nouveau_vma bar_vma;
3425df48 72 struct nouveau_vma tmp_vma;
4c74eb7f 73 u8 page_shift;
f869ef88 74
8f7286f8 75 struct drm_mm_node *tag;
573a2a37 76 struct list_head regions;
26c0c9e3 77 dma_addr_t *pages;
573a2a37
BS
78 u32 memtype;
79 u64 offset;
80 u64 size;
81};
82
a0af9add 83struct nouveau_tile_reg {
a0af9add 84 bool used;
a5cf68b0
FJ
85 uint32_t addr;
86 uint32_t limit;
87 uint32_t pitch;
87a326a3
FJ
88 uint32_t zcomp;
89 struct drm_mm_node *tag_mem;
a5cf68b0 90 struct nouveau_fence *fence;
a0af9add
FJ
91};
92
6ee73861
BS
93struct nouveau_bo {
94 struct ttm_buffer_object bo;
95 struct ttm_placement placement;
db5c8e29 96 u32 valid_domains;
6ee73861 97 u32 placements[3];
78ad0f7b 98 u32 busy_placements[3];
6ee73861
BS
99 struct ttm_bo_kmap_obj kmap;
100 struct list_head head;
101
102 /* protected by ttm_bo_reserve() */
103 struct drm_file *reserved_by;
104 struct list_head entry;
105 int pbbo_index;
a1606a95 106 bool validate_mapped;
6ee73861
BS
107
108 struct nouveau_channel *channel;
109
4c136142 110 struct nouveau_vma vma;
6ee73861
BS
111
112 uint32_t tile_mode;
113 uint32_t tile_flags;
a0af9add 114 struct nouveau_tile_reg *tile;
6ee73861
BS
115
116 struct drm_gem_object *gem;
6ee73861
BS
117 int pin_refcnt;
118};
119
f13b3263
FJ
120#define nouveau_bo_tile_layout(nvbo) \
121 ((nvbo)->tile_flags & NOUVEAU_GEM_TILE_LAYOUT_MASK)
122
6ee73861
BS
123static inline struct nouveau_bo *
124nouveau_bo(struct ttm_buffer_object *bo)
125{
126 return container_of(bo, struct nouveau_bo, bo);
127}
128
129static inline struct nouveau_bo *
130nouveau_gem_object(struct drm_gem_object *gem)
131{
132 return gem ? gem->driver_private : NULL;
133}
134
135/* TODO: submit equivalent to TTM generic API upstream? */
136static inline void __iomem *
137nvbo_kmap_obj_iovirtual(struct nouveau_bo *nvbo)
138{
139 bool is_iomem;
140 void __iomem *ioptr = (void __force __iomem *)ttm_kmap_obj_virtual(
141 &nvbo->kmap, &is_iomem);
142 WARN_ON_ONCE(ioptr && !is_iomem);
143 return ioptr;
144}
145
6ee73861
BS
146enum nouveau_flags {
147 NV_NFORCE = 0x10000000,
148 NV_NFORCE2 = 0x20000000
149};
150
151#define NVOBJ_ENGINE_SW 0
152#define NVOBJ_ENGINE_GR 1
6dfdd7a6 153#define NVOBJ_ENGINE_CRYPT 2
7ff5441e
BS
154#define NVOBJ_ENGINE_COPY0 3
155#define NVOBJ_ENGINE_COPY1 4
6dfdd7a6
BS
156#define NVOBJ_ENGINE_DISPLAY 15
157#define NVOBJ_ENGINE_NR 16
6ee73861 158
a11c3198 159#define NVOBJ_FLAG_DONT_MAP (1 << 0)
6ee73861
BS
160#define NVOBJ_FLAG_ZERO_ALLOC (1 << 1)
161#define NVOBJ_FLAG_ZERO_FREE (1 << 2)
34cf01bc 162#define NVOBJ_FLAG_VM (1 << 3)
c906ca0f 163#define NVOBJ_FLAG_VM_USER (1 << 4)
e41115d0
BS
164
165#define NVOBJ_CINST_GLOBAL 0xdeadbeef
166
6ee73861 167struct nouveau_gpuobj {
b3beb167 168 struct drm_device *dev;
eb9bcbdc 169 struct kref refcount;
6ee73861
BS
170 struct list_head list;
171
e41115d0 172 void *node;
dc1e5c0d 173 u32 *suspend;
6ee73861
BS
174
175 uint32_t flags;
6ee73861 176
43efc9ce 177 u32 size;
de3a6c0a
BS
178 u32 pinst;
179 u32 cinst;
180 u64 vinst;
181
6ee73861
BS
182 uint32_t engine;
183 uint32_t class;
184
185 void (*dtor)(struct drm_device *, struct nouveau_gpuobj *);
186 void *priv;
187};
188
332b242f
FJ
189struct nouveau_page_flip_state {
190 struct list_head head;
191 struct drm_pending_vblank_event *event;
192 int crtc, bpp, pitch, x, y;
193 uint64_t offset;
194};
195
e419cf09
FJ
196enum nouveau_channel_mutex_class {
197 NOUVEAU_UCHANNEL_MUTEX,
198 NOUVEAU_KCHANNEL_MUTEX
199};
200
6ee73861
BS
201struct nouveau_channel {
202 struct drm_device *dev;
203 int id;
204
f091a3d4
FJ
205 /* references to the channel data structure */
206 struct kref ref;
207 /* users of the hardware channel resources, the hardware
208 * context will be kicked off when it reaches zero. */
209 atomic_t users;
6a6b73f2
BS
210 struct mutex mutex;
211
6ee73861
BS
212 /* owner of this fifo */
213 struct drm_file *file_priv;
214 /* mapping of the fifo itself */
215 struct drm_local_map *map;
216
25985edc 217 /* mapping of the regs controlling the fifo */
6ee73861
BS
218 void __iomem *user;
219 uint32_t user_get;
220 uint32_t user_put;
221
222 /* Fencing */
223 struct {
224 /* lock protects the pending list only */
225 spinlock_t lock;
226 struct list_head pending;
227 uint32_t sequence;
228 uint32_t sequence_ack;
047d1d3c 229 atomic_t last_sequence_irq;
6ee73861
BS
230 } fence;
231
232 /* DMA push buffer */
a8eaebc6
BS
233 struct nouveau_gpuobj *pushbuf;
234 struct nouveau_bo *pushbuf_bo;
235 uint32_t pushbuf_base;
6ee73861
BS
236
237 /* Notifier memory */
238 struct nouveau_bo *notifier_bo;
b833ac26 239 struct drm_mm notifier_heap;
6ee73861
BS
240
241 /* PFIFO context */
a8eaebc6
BS
242 struct nouveau_gpuobj *ramfc;
243 struct nouveau_gpuobj *cache;
b2b09938 244 void *fifo_priv;
6ee73861 245
a82dd49f 246 /* Execution engine contexts */
6dfdd7a6 247 void *engctx[NVOBJ_ENGINE_NR];
6ee73861
BS
248
249 /* NV50 VM */
f869ef88 250 struct nouveau_vm *vm;
a8eaebc6 251 struct nouveau_gpuobj *vm_pd;
6ee73861
BS
252
253 /* Objects */
a8eaebc6
BS
254 struct nouveau_gpuobj *ramin; /* Private instmem */
255 struct drm_mm ramin_heap; /* Private PRAMIN heap */
256 struct nouveau_ramht *ramht; /* Hash table */
6ee73861
BS
257
258 /* GPU object info for stuff used in-kernel (mm_enabled) */
259 uint32_t m2mf_ntfy;
260 uint32_t vram_handle;
261 uint32_t gart_handle;
262 bool accel_done;
263
264 /* Push buffer state (only for drm's channel on !mm_enabled) */
265 struct {
266 int max;
267 int free;
268 int cur;
269 int put;
270 /* access via pushbuf_bo */
9a391ad8
BS
271
272 int ib_base;
273 int ib_max;
274 int ib_free;
275 int ib_put;
6ee73861
BS
276 } dma;
277
278 uint32_t sw_subchannel[8];
279
280 struct {
281 struct nouveau_gpuobj *vblsem;
1f6d2de2 282 uint32_t vblsem_head;
6ee73861
BS
283 uint32_t vblsem_offset;
284 uint32_t vblsem_rval;
285 struct list_head vbl_wait;
332b242f 286 struct list_head flip;
6ee73861
BS
287 } nvsw;
288
289 struct {
290 bool active;
291 char name[32];
292 struct drm_info_list info;
293 } debugfs;
294};
295
6dfdd7a6
BS
296struct nouveau_exec_engine {
297 void (*destroy)(struct drm_device *, int engine);
298 int (*init)(struct drm_device *, int engine);
299 int (*fini)(struct drm_device *, int engine);
300 int (*context_new)(struct nouveau_channel *, int engine);
301 void (*context_del)(struct nouveau_channel *, int engine);
302 int (*object_new)(struct nouveau_channel *, int engine,
303 u32 handle, u16 class);
96c50082 304 void (*set_tile_region)(struct drm_device *dev, int i);
6dfdd7a6
BS
305 void (*tlb_flush)(struct drm_device *, int engine);
306};
307
6ee73861
BS
308struct nouveau_instmem_engine {
309 void *priv;
310
311 int (*init)(struct drm_device *dev);
312 void (*takedown)(struct drm_device *dev);
313 int (*suspend)(struct drm_device *dev);
314 void (*resume)(struct drm_device *dev);
315
e41115d0
BS
316 int (*get)(struct nouveau_gpuobj *, u32 size, u32 align);
317 void (*put)(struct nouveau_gpuobj *);
318 int (*map)(struct nouveau_gpuobj *);
319 void (*unmap)(struct nouveau_gpuobj *);
320
f56cb86f 321 void (*flush)(struct drm_device *);
6ee73861
BS
322};
323
324struct nouveau_mc_engine {
325 int (*init)(struct drm_device *dev);
326 void (*takedown)(struct drm_device *dev);
327};
328
329struct nouveau_timer_engine {
330 int (*init)(struct drm_device *dev);
331 void (*takedown)(struct drm_device *dev);
332 uint64_t (*read)(struct drm_device *dev);
333};
334
335struct nouveau_fb_engine {
cb00f7c1 336 int num_tiles;
87a326a3 337 struct drm_mm tag_heap;
20f63afe 338 void *priv;
cb00f7c1 339
6ee73861
BS
340 int (*init)(struct drm_device *dev);
341 void (*takedown)(struct drm_device *dev);
cb00f7c1 342
a5cf68b0
FJ
343 void (*init_tile_region)(struct drm_device *dev, int i,
344 uint32_t addr, uint32_t size,
345 uint32_t pitch, uint32_t flags);
346 void (*set_tile_region)(struct drm_device *dev, int i);
347 void (*free_tile_region)(struct drm_device *dev, int i);
6ee73861
BS
348};
349
350struct nouveau_fifo_engine {
b2b09938 351 void *priv;
6ee73861
BS
352 int channels;
353
a8eaebc6 354 struct nouveau_gpuobj *playlist[2];
ac94a343
BS
355 int cur_playlist;
356
6ee73861
BS
357 int (*init)(struct drm_device *);
358 void (*takedown)(struct drm_device *);
359
360 void (*disable)(struct drm_device *);
361 void (*enable)(struct drm_device *);
362 bool (*reassign)(struct drm_device *, bool enable);
588d7d12 363 bool (*cache_pull)(struct drm_device *dev, bool enable);
6ee73861
BS
364
365 int (*channel_id)(struct drm_device *);
366
367 int (*create_context)(struct nouveau_channel *);
368 void (*destroy_context)(struct nouveau_channel *);
369 int (*load_context)(struct nouveau_channel *);
370 int (*unload_context)(struct drm_device *);
56ac7475 371 void (*tlb_flush)(struct drm_device *dev);
6ee73861
BS
372};
373
c88c2e06 374struct nouveau_display_engine {
ef8389a8 375 void *priv;
c88c2e06
FJ
376 int (*early_init)(struct drm_device *);
377 void (*late_takedown)(struct drm_device *);
378 int (*create)(struct drm_device *);
379 int (*init)(struct drm_device *);
380 void (*destroy)(struct drm_device *);
381};
382
ee2e0131 383struct nouveau_gpio_engine {
fce2bad0
BS
384 void *priv;
385
ee2e0131
BS
386 int (*init)(struct drm_device *);
387 void (*takedown)(struct drm_device *);
388
389 int (*get)(struct drm_device *, enum dcb_gpio_tag);
390 int (*set)(struct drm_device *, enum dcb_gpio_tag, int state);
391
fce2bad0
BS
392 int (*irq_register)(struct drm_device *, enum dcb_gpio_tag,
393 void (*)(void *, int), void *);
394 void (*irq_unregister)(struct drm_device *, enum dcb_gpio_tag,
395 void (*)(void *, int), void *);
396 bool (*irq_enable)(struct drm_device *, enum dcb_gpio_tag, bool on);
ee2e0131
BS
397};
398
330c5988
BS
399struct nouveau_pm_voltage_level {
400 u8 voltage;
401 u8 vid;
402};
403
404struct nouveau_pm_voltage {
405 bool supported;
406 u8 vid_mask;
407
408 struct nouveau_pm_voltage_level *level;
409 int nr_level;
410};
411
412#define NOUVEAU_PM_MAX_LEVEL 8
413struct nouveau_pm_level {
414 struct device_attribute dev_attr;
415 char name[32];
416 int id;
417
418 u32 core;
419 u32 memory;
420 u32 shader;
421 u32 unk05;
422
423 u8 voltage;
424 u8 fanspeed;
aee582de
BS
425
426 u16 memscript;
330c5988
BS
427};
428
34e9d85a
MP
429struct nouveau_pm_temp_sensor_constants {
430 u16 offset_constant;
431 s16 offset_mult;
432 u16 offset_div;
433 u16 slope_mult;
434 u16 slope_div;
435};
436
437struct nouveau_pm_threshold_temp {
438 s16 critical;
439 s16 down_clock;
440 s16 fan_boost;
441};
442
7760fcb0
RS
443struct nouveau_pm_memtiming {
444 u32 reg_100220;
445 u32 reg_100224;
446 u32 reg_100228;
447 u32 reg_10022c;
448 u32 reg_100230;
449 u32 reg_100234;
450 u32 reg_100238;
451 u32 reg_10023c;
50066f81 452 u32 reg_100240;
7760fcb0
RS
453};
454
455struct nouveau_pm_memtimings {
456 bool supported;
457 struct nouveau_pm_memtiming *timing;
458 int nr_timing;
459};
460
330c5988
BS
461struct nouveau_pm_engine {
462 struct nouveau_pm_voltage voltage;
463 struct nouveau_pm_level perflvl[NOUVEAU_PM_MAX_LEVEL];
464 int nr_perflvl;
7760fcb0 465 struct nouveau_pm_memtimings memtimings;
34e9d85a
MP
466 struct nouveau_pm_temp_sensor_constants sensor_constants;
467 struct nouveau_pm_threshold_temp threshold_temp;
330c5988
BS
468
469 struct nouveau_pm_level boot;
470 struct nouveau_pm_level *cur;
471
8155cac4 472 struct device *hwmon;
6032649d 473 struct notifier_block acpi_nb;
8155cac4 474
330c5988 475 int (*clock_get)(struct drm_device *, u32 id);
5c6dc657
BS
476 void *(*clock_pre)(struct drm_device *, struct nouveau_pm_level *,
477 u32 id, int khz);
330c5988
BS
478 void (*clock_set)(struct drm_device *, void *);
479 int (*voltage_get)(struct drm_device *);
480 int (*voltage_set)(struct drm_device *, int voltage);
481 int (*fanspeed_get)(struct drm_device *);
482 int (*fanspeed_set)(struct drm_device *, int fanspeed);
8155cac4 483 int (*temp_get)(struct drm_device *);
330c5988
BS
484};
485
60d2a88a
BS
486struct nouveau_vram_engine {
487 int (*init)(struct drm_device *);
488 int (*get)(struct drm_device *, u64, u32 align, u32 size_nc,
d5f42394
BS
489 u32 type, struct nouveau_mem **);
490 void (*put)(struct drm_device *, struct nouveau_mem **);
60d2a88a
BS
491
492 bool (*flags_valid)(struct drm_device *, u32 tile_flags);
493};
494
6ee73861
BS
495struct nouveau_engine {
496 struct nouveau_instmem_engine instmem;
497 struct nouveau_mc_engine mc;
498 struct nouveau_timer_engine timer;
499 struct nouveau_fb_engine fb;
6ee73861 500 struct nouveau_fifo_engine fifo;
c88c2e06 501 struct nouveau_display_engine display;
ee2e0131 502 struct nouveau_gpio_engine gpio;
330c5988 503 struct nouveau_pm_engine pm;
60d2a88a 504 struct nouveau_vram_engine vram;
6ee73861
BS
505};
506
507struct nouveau_pll_vals {
508 union {
509 struct {
510#ifdef __BIG_ENDIAN
511 uint8_t N1, M1, N2, M2;
512#else
513 uint8_t M1, N1, M2, N2;
514#endif
515 };
516 struct {
517 uint16_t NM1, NM2;
518 } __attribute__((packed));
519 };
520 int log2P;
521
522 int refclk;
523};
524
525enum nv04_fp_display_regs {
526 FP_DISPLAY_END,
527 FP_TOTAL,
528 FP_CRTC,
529 FP_SYNC_START,
530 FP_SYNC_END,
531 FP_VALID_START,
532 FP_VALID_END
533};
534
535struct nv04_crtc_reg {
cbab95db 536 unsigned char MiscOutReg;
4a9f822f 537 uint8_t CRTC[0xa0];
6ee73861
BS
538 uint8_t CR58[0x10];
539 uint8_t Sequencer[5];
540 uint8_t Graphics[9];
541 uint8_t Attribute[21];
cbab95db 542 unsigned char DAC[768];
6ee73861
BS
543
544 /* PCRTC regs */
545 uint32_t fb_start;
546 uint32_t crtc_cfg;
547 uint32_t cursor_cfg;
548 uint32_t gpio_ext;
549 uint32_t crtc_830;
550 uint32_t crtc_834;
551 uint32_t crtc_850;
552 uint32_t crtc_eng_ctrl;
553
554 /* PRAMDAC regs */
555 uint32_t nv10_cursync;
556 struct nouveau_pll_vals pllvals;
557 uint32_t ramdac_gen_ctrl;
558 uint32_t ramdac_630;
559 uint32_t ramdac_634;
560 uint32_t tv_setup;
561 uint32_t tv_vtotal;
562 uint32_t tv_vskew;
563 uint32_t tv_vsync_delay;
564 uint32_t tv_htotal;
565 uint32_t tv_hskew;
566 uint32_t tv_hsync_delay;
567 uint32_t tv_hsync_delay2;
568 uint32_t fp_horiz_regs[7];
569 uint32_t fp_vert_regs[7];
570 uint32_t dither;
571 uint32_t fp_control;
572 uint32_t dither_regs[6];
573 uint32_t fp_debug_0;
574 uint32_t fp_debug_1;
575 uint32_t fp_debug_2;
576 uint32_t fp_margin_color;
577 uint32_t ramdac_8c0;
578 uint32_t ramdac_a20;
579 uint32_t ramdac_a24;
580 uint32_t ramdac_a34;
581 uint32_t ctv_regs[38];
582};
583
584struct nv04_output_reg {
585 uint32_t output;
586 int head;
587};
588
589struct nv04_mode_state {
cbab95db 590 struct nv04_crtc_reg crtc_reg[2];
6ee73861
BS
591 uint32_t pllsel;
592 uint32_t sel_clk;
6ee73861
BS
593};
594
595enum nouveau_card_type {
596 NV_04 = 0x00,
597 NV_10 = 0x10,
598 NV_20 = 0x20,
599 NV_30 = 0x30,
600 NV_40 = 0x40,
601 NV_50 = 0x50,
4b223eef 602 NV_C0 = 0xc0,
6ee73861
BS
603};
604
605struct drm_nouveau_private {
606 struct drm_device *dev;
6ee73861
BS
607
608 /* the card type, takes NV_* as values */
609 enum nouveau_card_type card_type;
610 /* exact chipset, derived from NV_PMC_BOOT_0 */
611 int chipset;
50066f81 612 int stepping;
6ee73861
BS
613 int flags;
614
615 void __iomem *mmio;
5125bfd8 616
e05d7eae 617 spinlock_t ramin_lock;
6ee73861 618 void __iomem *ramin;
5125bfd8
BS
619 u32 ramin_size;
620 u32 ramin_base;
621 bool ramin_available;
e05d7eae 622 struct drm_mm ramin_heap;
6dfdd7a6 623 struct nouveau_exec_engine *eng[NVOBJ_ENGINE_NR];
e05d7eae 624 struct list_head gpuobj_list;
b8c157d3 625 struct list_head classes;
6ee73861 626
ac8fb975
BS
627 struct nouveau_bo *vga_ram;
628
35fa2f2a 629 /* interrupt handling */
8f8a5448 630 void (*irq_handler[32])(struct drm_device *);
35fa2f2a 631 bool msi_enabled;
ab838338 632
6ee73861
BS
633 struct list_head vbl_waiting;
634
635 struct {
ba4420c2 636 struct drm_global_reference mem_global_ref;
6ee73861
BS
637 struct ttm_bo_global_ref bo_global_ref;
638 struct ttm_bo_device bdev;
6ee73861
BS
639 atomic_t validate_sequence;
640 } ttm;
641
0c6c1c2f
FJ
642 struct {
643 spinlock_t lock;
644 struct drm_mm heap;
645 struct nouveau_bo *bo;
646 } fence;
647
cff5c133
BS
648 struct {
649 spinlock_t lock;
650 struct nouveau_channel *ptr[NOUVEAU_MAX_CHANNEL_NR];
651 } channels;
6ee73861
BS
652
653 struct nouveau_engine engine;
654 struct nouveau_channel *channel;
655
ff9e5279
MM
656 /* For PFIFO and PGRAPH. */
657 spinlock_t context_switch_lock;
658
04eb34a4
BS
659 /* VM/PRAMIN flush, legacy PRAMIN aperture */
660 spinlock_t vm_lock;
661
6ee73861 662 /* RAMIN configuration, RAMFC, RAMHT and RAMRO offsets */
e05c5a31
BS
663 struct nouveau_ramht *ramht;
664 struct nouveau_gpuobj *ramfc;
665 struct nouveau_gpuobj *ramro;
666
6ee73861 667 uint32_t ramin_rsvd_vram;
6ee73861 668
6ee73861
BS
669 struct {
670 enum {
671 NOUVEAU_GART_NONE = 0,
58e6c7a9
BS
672 NOUVEAU_GART_AGP, /* AGP */
673 NOUVEAU_GART_PDMA, /* paged dma object */
674 NOUVEAU_GART_HW /* on-chip gart/vm */
6ee73861
BS
675 } type;
676 uint64_t aper_base;
677 uint64_t aper_size;
678 uint64_t aper_free;
679
7948758d
BS
680 struct ttm_backend_func *func;
681
682 struct {
683 struct page *page;
684 dma_addr_t addr;
685 } dummy;
686
6ee73861 687 struct nouveau_gpuobj *sg_ctxdma;
6ee73861
BS
688 } gart_info;
689
a0af9add 690 /* nv10-nv40 tiling regions */
a5cf68b0
FJ
691 struct {
692 struct nouveau_tile_reg reg[NOUVEAU_MAX_TILE_NR];
693 spinlock_t lock;
694 } tile;
a0af9add 695
a76fb4e8
BS
696 /* VRAM/fb configuration */
697 uint64_t vram_size;
698 uint64_t vram_sys_base;
6c3d7ef2 699 u32 vram_rblock_size;
a76fb4e8
BS
700
701 uint64_t fb_phys;
702 uint64_t fb_available_size;
703 uint64_t fb_mappable_pages;
704 uint64_t fb_aper_free;
705 int fb_mtrr;
706
f869ef88
BS
707 /* BAR control (NV50-) */
708 struct nouveau_vm *bar1_vm;
709 struct nouveau_vm *bar3_vm;
710
6ee73861 711 /* G8x/G9x virtual address space */
4c136142 712 struct nouveau_vm *chan_vm;
6ee73861 713
04a39c57 714 struct nvbios vbios;
6ee73861
BS
715
716 struct nv04_mode_state mode_reg;
717 struct nv04_mode_state saved_reg;
718 uint32_t saved_vga_font[4][16384];
719 uint32_t crtc_owner;
720 uint32_t dac_users[4];
721
6ee73861 722 struct backlight_device *backlight;
6ee73861 723
6ee73861
BS
724 struct {
725 struct dentry *channel_root;
726 } debugfs;
38651674 727
8be48d92 728 struct nouveau_fbdev *nfbdev;
06415c56 729 struct apertures_struct *apertures;
6ee73861
BS
730};
731
2730723b
FJ
732static inline struct drm_nouveau_private *
733nouveau_private(struct drm_device *dev)
734{
735 return dev->dev_private;
736}
737
6ee73861
BS
738static inline struct drm_nouveau_private *
739nouveau_bdev(struct ttm_bo_device *bd)
740{
741 return container_of(bd, struct drm_nouveau_private, ttm.bdev);
742}
743
744static inline int
745nouveau_bo_ref(struct nouveau_bo *ref, struct nouveau_bo **pnvbo)
746{
747 struct nouveau_bo *prev;
748
749 if (!pnvbo)
750 return -EINVAL;
751 prev = *pnvbo;
752
753 *pnvbo = ref ? nouveau_bo(ttm_bo_reference(&ref->bo)) : NULL;
754 if (prev) {
755 struct ttm_buffer_object *bo = &prev->bo;
756
757 ttm_bo_unref(&bo);
758 }
759
760 return 0;
761}
762
6ee73861 763/* nouveau_drv.c */
de5899bd 764extern int nouveau_agpmode;
6ee73861
BS
765extern int nouveau_duallink;
766extern int nouveau_uscript_lvds;
767extern int nouveau_uscript_tmds;
768extern int nouveau_vram_pushbuf;
769extern int nouveau_vram_notify;
770extern int nouveau_fbpercrtc;
f4053509 771extern int nouveau_tv_disable;
6ee73861
BS
772extern char *nouveau_tv_norm;
773extern int nouveau_reg_debug;
774extern char *nouveau_vbios;
a1470890 775extern int nouveau_ignorelid;
a32ed69d
MK
776extern int nouveau_nofbaccel;
777extern int nouveau_noaccel;
0cba1b76 778extern int nouveau_force_post;
da647d5b 779extern int nouveau_override_conntype;
6f876986
BS
780extern char *nouveau_perflvl;
781extern int nouveau_perflvl_wr;
35fa2f2a 782extern int nouveau_msi;
6ee73861 783
6a9ee8af
DA
784extern int nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state);
785extern int nouveau_pci_resume(struct pci_dev *pdev);
786
6ee73861
BS
787/* nouveau_state.c */
788extern void nouveau_preclose(struct drm_device *dev, struct drm_file *);
789extern int nouveau_load(struct drm_device *, unsigned long flags);
790extern int nouveau_firstopen(struct drm_device *);
791extern void nouveau_lastclose(struct drm_device *);
792extern int nouveau_unload(struct drm_device *);
793extern int nouveau_ioctl_getparam(struct drm_device *, void *data,
794 struct drm_file *);
795extern int nouveau_ioctl_setparam(struct drm_device *, void *data,
796 struct drm_file *);
12fb9525
BS
797extern bool nouveau_wait_eq(struct drm_device *, uint64_t timeout,
798 uint32_t reg, uint32_t mask, uint32_t val);
799extern bool nouveau_wait_ne(struct drm_device *, uint64_t timeout,
800 uint32_t reg, uint32_t mask, uint32_t val);
6ee73861
BS
801extern bool nouveau_wait_for_idle(struct drm_device *);
802extern int nouveau_card_init(struct drm_device *);
6ee73861
BS
803
804/* nouveau_mem.c */
fbd2895e
BS
805extern int nouveau_mem_vram_init(struct drm_device *);
806extern void nouveau_mem_vram_fini(struct drm_device *);
807extern int nouveau_mem_gart_init(struct drm_device *);
808extern void nouveau_mem_gart_fini(struct drm_device *);
6ee73861 809extern int nouveau_mem_init_agp(struct drm_device *);
e04d8e82 810extern int nouveau_mem_reset_agp(struct drm_device *);
6ee73861 811extern void nouveau_mem_close(struct drm_device *);
60d2a88a
BS
812extern int nouveau_mem_detect(struct drm_device *);
813extern bool nouveau_mem_flags_valid(struct drm_device *, u32 tile_flags);
a5cf68b0
FJ
814extern struct nouveau_tile_reg *nv10_mem_set_tiling(
815 struct drm_device *dev, uint32_t addr, uint32_t size,
816 uint32_t pitch, uint32_t flags);
817extern void nv10_mem_put_tile_region(struct drm_device *dev,
818 struct nouveau_tile_reg *tile,
819 struct nouveau_fence *fence);
573a2a37 820extern const struct ttm_mem_type_manager_func nouveau_vram_manager;
26c0c9e3 821extern const struct ttm_mem_type_manager_func nouveau_gart_manager;
6ee73861
BS
822
823/* nouveau_notifier.c */
824extern int nouveau_notifier_init_channel(struct nouveau_channel *);
825extern void nouveau_notifier_takedown_channel(struct nouveau_channel *);
826extern int nouveau_notifier_alloc(struct nouveau_channel *, uint32_t handle,
73412c38
BS
827 int cout, uint32_t start, uint32_t end,
828 uint32_t *offset);
6ee73861
BS
829extern int nouveau_notifier_offset(struct nouveau_gpuobj *, uint32_t *);
830extern int nouveau_ioctl_notifier_alloc(struct drm_device *, void *data,
831 struct drm_file *);
832extern int nouveau_ioctl_notifier_free(struct drm_device *, void *data,
833 struct drm_file *);
834
835/* nouveau_channel.c */
836extern struct drm_ioctl_desc nouveau_ioctls[];
837extern int nouveau_max_ioctl;
838extern void nouveau_channel_cleanup(struct drm_device *, struct drm_file *);
6ee73861
BS
839extern int nouveau_channel_alloc(struct drm_device *dev,
840 struct nouveau_channel **chan,
841 struct drm_file *file_priv,
842 uint32_t fb_ctxdma, uint32_t tt_ctxdma);
cff5c133 843extern struct nouveau_channel *
feeb0aec
FJ
844nouveau_channel_get_unlocked(struct nouveau_channel *);
845extern struct nouveau_channel *
cff5c133 846nouveau_channel_get(struct drm_device *, struct drm_file *, int id);
feeb0aec 847extern void nouveau_channel_put_unlocked(struct nouveau_channel **);
cff5c133 848extern void nouveau_channel_put(struct nouveau_channel **);
f091a3d4
FJ
849extern void nouveau_channel_ref(struct nouveau_channel *chan,
850 struct nouveau_channel **pchan);
6dccd311 851extern void nouveau_channel_idle(struct nouveau_channel *chan);
6ee73861
BS
852
853/* nouveau_object.c */
6dfdd7a6
BS
854#define NVOBJ_ENGINE_ADD(d, e, p) do { \
855 struct drm_nouveau_private *dev_priv = (d)->dev_private; \
856 dev_priv->eng[NVOBJ_ENGINE_##e] = (p); \
857} while (0)
858
859#define NVOBJ_ENGINE_DEL(d, e) do { \
860 struct drm_nouveau_private *dev_priv = (d)->dev_private; \
861 dev_priv->eng[NVOBJ_ENGINE_##e] = NULL; \
862} while (0)
863
0b89a072 864#define NVOBJ_CLASS(d, c, e) do { \
b8c157d3
BS
865 int ret = nouveau_gpuobj_class_new((d), (c), NVOBJ_ENGINE_##e); \
866 if (ret) \
867 return ret; \
71298e2f 868} while (0)
b8c157d3 869
0b89a072 870#define NVOBJ_MTHD(d, c, m, e) do { \
b8c157d3
BS
871 int ret = nouveau_gpuobj_mthd_new((d), (c), (m), (e)); \
872 if (ret) \
873 return ret; \
71298e2f 874} while (0)
b8c157d3 875
6ee73861
BS
876extern int nouveau_gpuobj_early_init(struct drm_device *);
877extern int nouveau_gpuobj_init(struct drm_device *);
878extern void nouveau_gpuobj_takedown(struct drm_device *);
6ee73861 879extern int nouveau_gpuobj_suspend(struct drm_device *dev);
6ee73861 880extern void nouveau_gpuobj_resume(struct drm_device *dev);
b8c157d3
BS
881extern int nouveau_gpuobj_class_new(struct drm_device *, u32 class, u32 eng);
882extern int nouveau_gpuobj_mthd_new(struct drm_device *, u32 class, u32 mthd,
883 int (*exec)(struct nouveau_channel *,
71298e2f 884 u32 class, u32 mthd, u32 data));
b8c157d3 885extern int nouveau_gpuobj_mthd_call(struct nouveau_channel *, u32, u32, u32);
274fec93 886extern int nouveau_gpuobj_mthd_call2(struct drm_device *, int, u32, u32, u32);
6ee73861
BS
887extern int nouveau_gpuobj_channel_init(struct nouveau_channel *,
888 uint32_t vram_h, uint32_t tt_h);
889extern void nouveau_gpuobj_channel_takedown(struct nouveau_channel *);
890extern int nouveau_gpuobj_new(struct drm_device *, struct nouveau_channel *,
891 uint32_t size, int align, uint32_t flags,
892 struct nouveau_gpuobj **);
a8eaebc6
BS
893extern void nouveau_gpuobj_ref(struct nouveau_gpuobj *,
894 struct nouveau_gpuobj **);
43efc9ce
BS
895extern int nouveau_gpuobj_new_fake(struct drm_device *, u32 pinst, u64 vinst,
896 u32 size, u32 flags,
a8eaebc6 897 struct nouveau_gpuobj **);
6ee73861
BS
898extern int nouveau_gpuobj_dma_new(struct nouveau_channel *, int class,
899 uint64_t offset, uint64_t size, int access,
900 int target, struct nouveau_gpuobj **);
ceac3099 901extern int nouveau_gpuobj_gr_new(struct nouveau_channel *, u32 handle, int class);
7f4a195f
BS
902extern int nv50_gpuobj_dma_new(struct nouveau_channel *, int class, u64 base,
903 u64 size, int target, int access, u32 type,
904 u32 comp, struct nouveau_gpuobj **pobj);
905extern void nv50_gpuobj_dma_init(struct nouveau_gpuobj *, u32 offset,
906 int class, u64 base, u64 size, int target,
907 int access, u32 type, u32 comp);
6ee73861
BS
908extern int nouveau_ioctl_grobj_alloc(struct drm_device *, void *data,
909 struct drm_file *);
910extern int nouveau_ioctl_gpuobj_free(struct drm_device *, void *data,
911 struct drm_file *);
912
913/* nouveau_irq.c */
35fa2f2a
BS
914extern int nouveau_irq_init(struct drm_device *);
915extern void nouveau_irq_fini(struct drm_device *);
6ee73861 916extern irqreturn_t nouveau_irq_handler(DRM_IRQ_ARGS);
8f8a5448
BS
917extern void nouveau_irq_register(struct drm_device *, int status_bit,
918 void (*)(struct drm_device *));
919extern void nouveau_irq_unregister(struct drm_device *, int status_bit);
6ee73861
BS
920extern void nouveau_irq_preinstall(struct drm_device *);
921extern int nouveau_irq_postinstall(struct drm_device *);
922extern void nouveau_irq_uninstall(struct drm_device *);
923
924/* nouveau_sgdma.c */
925extern int nouveau_sgdma_init(struct drm_device *);
926extern void nouveau_sgdma_takedown(struct drm_device *);
fd70b6cd
FJ
927extern uint32_t nouveau_sgdma_get_physical(struct drm_device *,
928 uint32_t offset);
6ee73861
BS
929extern struct ttm_backend *nouveau_sgdma_init_ttm(struct drm_device *);
930
931/* nouveau_debugfs.c */
932#if defined(CONFIG_DRM_NOUVEAU_DEBUG)
933extern int nouveau_debugfs_init(struct drm_minor *);
934extern void nouveau_debugfs_takedown(struct drm_minor *);
935extern int nouveau_debugfs_channel_init(struct nouveau_channel *);
936extern void nouveau_debugfs_channel_fini(struct nouveau_channel *);
937#else
938static inline int
939nouveau_debugfs_init(struct drm_minor *minor)
940{
941 return 0;
942}
943
944static inline void nouveau_debugfs_takedown(struct drm_minor *minor)
945{
946}
947
948static inline int
949nouveau_debugfs_channel_init(struct nouveau_channel *chan)
950{
951 return 0;
952}
953
954static inline void
955nouveau_debugfs_channel_fini(struct nouveau_channel *chan)
956{
957}
958#endif
959
960/* nouveau_dma.c */
75c99da6 961extern void nouveau_dma_pre_init(struct nouveau_channel *);
6ee73861 962extern int nouveau_dma_init(struct nouveau_channel *);
9a391ad8 963extern int nouveau_dma_wait(struct nouveau_channel *, int slots, int size);
6ee73861
BS
964
965/* nouveau_acpi.c */
afeb3e11 966#define ROM_BIOS_PAGE 4096
2f41a7f1 967#if defined(CONFIG_ACPI)
6a9ee8af
DA
968void nouveau_register_dsm_handler(void);
969void nouveau_unregister_dsm_handler(void);
afeb3e11
DA
970int nouveau_acpi_get_bios_chunk(uint8_t *bios, int offset, int len);
971bool nouveau_acpi_rom_supported(struct pci_dev *pdev);
a6ed76d7 972int nouveau_acpi_edid(struct drm_device *, struct drm_connector *);
8edb381d
DA
973#else
974static inline void nouveau_register_dsm_handler(void) {}
975static inline void nouveau_unregister_dsm_handler(void) {}
afeb3e11
DA
976static inline bool nouveau_acpi_rom_supported(struct pci_dev *pdev) { return false; }
977static inline int nouveau_acpi_get_bios_chunk(uint8_t *bios, int offset, int len) { return -EINVAL; }
5620ba46 978static inline int nouveau_acpi_edid(struct drm_device *dev, struct drm_connector *connector) { return -EINVAL; }
8edb381d 979#endif
6ee73861
BS
980
981/* nouveau_backlight.c */
982#ifdef CONFIG_DRM_NOUVEAU_BACKLIGHT
7eae3efa
MG
983extern int nouveau_backlight_init(struct drm_connector *);
984extern void nouveau_backlight_exit(struct drm_connector *);
6ee73861 985#else
7eae3efa 986static inline int nouveau_backlight_init(struct drm_connector *dev)
6ee73861
BS
987{
988 return 0;
989}
990
7eae3efa 991static inline void nouveau_backlight_exit(struct drm_connector *dev) { }
6ee73861
BS
992#endif
993
994/* nouveau_bios.c */
995extern int nouveau_bios_init(struct drm_device *);
996extern void nouveau_bios_takedown(struct drm_device *dev);
997extern int nouveau_run_vbios_init(struct drm_device *);
998extern void nouveau_bios_run_init_table(struct drm_device *, uint16_t table,
999 struct dcb_entry *);
1000extern struct dcb_gpio_entry *nouveau_bios_gpio_entry(struct drm_device *,
1001 enum dcb_gpio_tag);
1002extern struct dcb_connector_table_entry *
1003nouveau_bios_connector_entry(struct drm_device *, int index);
855a95e4 1004extern u32 get_pll_register(struct drm_device *, enum pll_types);
6ee73861
BS
1005extern int get_pll_limits(struct drm_device *, uint32_t limit_match,
1006 struct pll_lims *);
1007extern int nouveau_bios_run_display_table(struct drm_device *,
1008 struct dcb_entry *,
1009 uint32_t script, int pxclk);
1010extern void *nouveau_bios_dp_table(struct drm_device *, struct dcb_entry *,
1011 int *length);
1012extern bool nouveau_bios_fp_mode(struct drm_device *, struct drm_display_mode *);
1013extern uint8_t *nouveau_bios_embedded_edid(struct drm_device *);
1014extern int nouveau_bios_parse_lvds_table(struct drm_device *, int pxclk,
1015 bool *dl, bool *if_is_24bit);
1016extern int run_tmds_table(struct drm_device *, struct dcb_entry *,
1017 int head, int pxclk);
1018extern int call_lvds_script(struct drm_device *, struct dcb_entry *, int head,
1019 enum LVDS_script, int pxclk);
1020
1021/* nouveau_ttm.c */
1022int nouveau_ttm_global_init(struct drm_nouveau_private *);
1023void nouveau_ttm_global_release(struct drm_nouveau_private *);
1024int nouveau_ttm_mmap(struct file *, struct vm_area_struct *);
1025
1026/* nouveau_dp.c */
1027int nouveau_dp_auxch(struct nouveau_i2c_chan *auxch, int cmd, int addr,
1028 uint8_t *data, int data_nr);
1029bool nouveau_dp_detect(struct drm_encoder *);
1030bool nouveau_dp_link_train(struct drm_encoder *);
1031
1032/* nv04_fb.c */
1033extern int nv04_fb_init(struct drm_device *);
1034extern void nv04_fb_takedown(struct drm_device *);
1035
1036/* nv10_fb.c */
1037extern int nv10_fb_init(struct drm_device *);
1038extern void nv10_fb_takedown(struct drm_device *);
a5cf68b0
FJ
1039extern void nv10_fb_init_tile_region(struct drm_device *dev, int i,
1040 uint32_t addr, uint32_t size,
1041 uint32_t pitch, uint32_t flags);
1042extern void nv10_fb_set_tile_region(struct drm_device *dev, int i);
1043extern void nv10_fb_free_tile_region(struct drm_device *dev, int i);
6ee73861 1044
8bded189
FJ
1045/* nv30_fb.c */
1046extern int nv30_fb_init(struct drm_device *);
1047extern void nv30_fb_takedown(struct drm_device *);
a5cf68b0
FJ
1048extern void nv30_fb_init_tile_region(struct drm_device *dev, int i,
1049 uint32_t addr, uint32_t size,
1050 uint32_t pitch, uint32_t flags);
1051extern void nv30_fb_free_tile_region(struct drm_device *dev, int i);
8bded189 1052
6ee73861
BS
1053/* nv40_fb.c */
1054extern int nv40_fb_init(struct drm_device *);
1055extern void nv40_fb_takedown(struct drm_device *);
a5cf68b0
FJ
1056extern void nv40_fb_set_tile_region(struct drm_device *dev, int i);
1057
304424e1
MK
1058/* nv50_fb.c */
1059extern int nv50_fb_init(struct drm_device *);
1060extern void nv50_fb_takedown(struct drm_device *);
6fdb383e 1061extern void nv50_fb_vm_trap(struct drm_device *, int display);
304424e1 1062
4b223eef
BS
1063/* nvc0_fb.c */
1064extern int nvc0_fb_init(struct drm_device *);
1065extern void nvc0_fb_takedown(struct drm_device *);
1066
6ee73861
BS
1067/* nv04_fifo.c */
1068extern int nv04_fifo_init(struct drm_device *);
5178d40d 1069extern void nv04_fifo_fini(struct drm_device *);
6ee73861
BS
1070extern void nv04_fifo_disable(struct drm_device *);
1071extern void nv04_fifo_enable(struct drm_device *);
1072extern bool nv04_fifo_reassign(struct drm_device *, bool);
588d7d12 1073extern bool nv04_fifo_cache_pull(struct drm_device *, bool);
6ee73861
BS
1074extern int nv04_fifo_channel_id(struct drm_device *);
1075extern int nv04_fifo_create_context(struct nouveau_channel *);
1076extern void nv04_fifo_destroy_context(struct nouveau_channel *);
1077extern int nv04_fifo_load_context(struct nouveau_channel *);
1078extern int nv04_fifo_unload_context(struct drm_device *);
5178d40d 1079extern void nv04_fifo_isr(struct drm_device *);
6ee73861
BS
1080
1081/* nv10_fifo.c */
1082extern int nv10_fifo_init(struct drm_device *);
1083extern int nv10_fifo_channel_id(struct drm_device *);
1084extern int nv10_fifo_create_context(struct nouveau_channel *);
6ee73861
BS
1085extern int nv10_fifo_load_context(struct nouveau_channel *);
1086extern int nv10_fifo_unload_context(struct drm_device *);
1087
1088/* nv40_fifo.c */
1089extern int nv40_fifo_init(struct drm_device *);
1090extern int nv40_fifo_create_context(struct nouveau_channel *);
6ee73861
BS
1091extern int nv40_fifo_load_context(struct nouveau_channel *);
1092extern int nv40_fifo_unload_context(struct drm_device *);
1093
1094/* nv50_fifo.c */
1095extern int nv50_fifo_init(struct drm_device *);
1096extern void nv50_fifo_takedown(struct drm_device *);
1097extern int nv50_fifo_channel_id(struct drm_device *);
1098extern int nv50_fifo_create_context(struct nouveau_channel *);
1099extern void nv50_fifo_destroy_context(struct nouveau_channel *);
1100extern int nv50_fifo_load_context(struct nouveau_channel *);
1101extern int nv50_fifo_unload_context(struct drm_device *);
56ac7475 1102extern void nv50_fifo_tlb_flush(struct drm_device *dev);
6ee73861 1103
4b223eef
BS
1104/* nvc0_fifo.c */
1105extern int nvc0_fifo_init(struct drm_device *);
1106extern void nvc0_fifo_takedown(struct drm_device *);
1107extern void nvc0_fifo_disable(struct drm_device *);
1108extern void nvc0_fifo_enable(struct drm_device *);
1109extern bool nvc0_fifo_reassign(struct drm_device *, bool);
4b223eef
BS
1110extern bool nvc0_fifo_cache_pull(struct drm_device *, bool);
1111extern int nvc0_fifo_channel_id(struct drm_device *);
1112extern int nvc0_fifo_create_context(struct nouveau_channel *);
1113extern void nvc0_fifo_destroy_context(struct nouveau_channel *);
1114extern int nvc0_fifo_load_context(struct nouveau_channel *);
1115extern int nvc0_fifo_unload_context(struct drm_device *);
1116
6ee73861 1117/* nv04_graph.c */
4976986b 1118extern int nv04_graph_create(struct drm_device *);
6ee73861 1119extern void nv04_graph_fifo_access(struct drm_device *, bool);
4976986b 1120extern int nv04_graph_object_new(struct nouveau_channel *, int, u32, u16);
332b242f
FJ
1121extern int nv04_graph_mthd_page_flip(struct nouveau_channel *chan,
1122 u32 class, u32 mthd, u32 data);
274fec93 1123extern struct nouveau_bitfield nv04_graph_nsource[];
6ee73861
BS
1124
1125/* nv10_graph.c */
d11db279 1126extern int nv10_graph_create(struct drm_device *);
6ee73861 1127extern struct nouveau_channel *nv10_graph_channel(struct drm_device *);
274fec93
BS
1128extern struct nouveau_bitfield nv10_graph_intr[];
1129extern struct nouveau_bitfield nv10_graph_nstatus[];
6ee73861
BS
1130
1131/* nv20_graph.c */
a0b1de84 1132extern int nv20_graph_create(struct drm_device *);
6ee73861
BS
1133
1134/* nv40_graph.c */
39c8d368 1135extern int nv40_graph_create(struct drm_device *);
054b93e4 1136extern void nv40_grctx_init(struct nouveau_grctx *);
6ee73861
BS
1137
1138/* nv50_graph.c */
2703c21a 1139extern int nv50_graph_create(struct drm_device *);
d5f3c90d 1140extern int nv50_grctx_init(struct nouveau_grctx *);
6effe393 1141extern struct nouveau_enum nv50_data_error_names[];
7ff5441e 1142extern int nv50_graph_isr_chid(struct drm_device *dev, u64 inst);
6ee73861 1143
4b223eef 1144/* nvc0_graph.c */
7a45cd19 1145extern int nvc0_graph_create(struct drm_device *);
d5a27370 1146extern int nvc0_graph_isr_chid(struct drm_device *dev, u64 inst);
4b223eef 1147
bd2e597d 1148/* nv84_crypt.c */
6dfdd7a6 1149extern int nv84_crypt_create(struct drm_device *);
bd2e597d 1150
7ff5441e
BS
1151/* nva3_copy.c */
1152extern int nva3_copy_create(struct drm_device *dev);
1153
1154/* nvc0_copy.c */
1155extern int nvc0_copy_create(struct drm_device *dev, int engine);
1156
6ee73861
BS
1157/* nv04_instmem.c */
1158extern int nv04_instmem_init(struct drm_device *);
1159extern void nv04_instmem_takedown(struct drm_device *);
1160extern int nv04_instmem_suspend(struct drm_device *);
1161extern void nv04_instmem_resume(struct drm_device *);
e41115d0
BS
1162extern int nv04_instmem_get(struct nouveau_gpuobj *, u32 size, u32 align);
1163extern void nv04_instmem_put(struct nouveau_gpuobj *);
1164extern int nv04_instmem_map(struct nouveau_gpuobj *);
1165extern void nv04_instmem_unmap(struct nouveau_gpuobj *);
f56cb86f 1166extern void nv04_instmem_flush(struct drm_device *);
6ee73861
BS
1167
1168/* nv50_instmem.c */
1169extern int nv50_instmem_init(struct drm_device *);
1170extern void nv50_instmem_takedown(struct drm_device *);
1171extern int nv50_instmem_suspend(struct drm_device *);
1172extern void nv50_instmem_resume(struct drm_device *);
e41115d0
BS
1173extern int nv50_instmem_get(struct nouveau_gpuobj *, u32 size, u32 align);
1174extern void nv50_instmem_put(struct nouveau_gpuobj *);
1175extern int nv50_instmem_map(struct nouveau_gpuobj *);
1176extern void nv50_instmem_unmap(struct nouveau_gpuobj *);
f56cb86f 1177extern void nv50_instmem_flush(struct drm_device *);
734ee835 1178extern void nv84_instmem_flush(struct drm_device *);
6ee73861 1179
4b223eef
BS
1180/* nvc0_instmem.c */
1181extern int nvc0_instmem_init(struct drm_device *);
1182extern void nvc0_instmem_takedown(struct drm_device *);
1183extern int nvc0_instmem_suspend(struct drm_device *);
1184extern void nvc0_instmem_resume(struct drm_device *);
4b223eef 1185
6ee73861
BS
1186/* nv04_mc.c */
1187extern int nv04_mc_init(struct drm_device *);
1188extern void nv04_mc_takedown(struct drm_device *);
1189
1190/* nv40_mc.c */
1191extern int nv40_mc_init(struct drm_device *);
1192extern void nv40_mc_takedown(struct drm_device *);
1193
1194/* nv50_mc.c */
1195extern int nv50_mc_init(struct drm_device *);
1196extern void nv50_mc_takedown(struct drm_device *);
1197
1198/* nv04_timer.c */
1199extern int nv04_timer_init(struct drm_device *);
1200extern uint64_t nv04_timer_read(struct drm_device *);
1201extern void nv04_timer_takedown(struct drm_device *);
1202
1203extern long nouveau_compat_ioctl(struct file *file, unsigned int cmd,
1204 unsigned long arg);
1205
1206/* nv04_dac.c */
8f1a6086 1207extern int nv04_dac_create(struct drm_connector *, struct dcb_entry *);
11d6eb2a 1208extern uint32_t nv17_dac_sample_load(struct drm_encoder *encoder);
6ee73861
BS
1209extern int nv04_dac_output_offset(struct drm_encoder *encoder);
1210extern void nv04_dac_update_dacclk(struct drm_encoder *encoder, bool enable);
8ccfe9e0 1211extern bool nv04_dac_in_use(struct drm_encoder *encoder);
6ee73861
BS
1212
1213/* nv04_dfp.c */
8f1a6086 1214extern int nv04_dfp_create(struct drm_connector *, struct dcb_entry *);
6ee73861
BS
1215extern int nv04_dfp_get_bound_head(struct drm_device *dev, struct dcb_entry *dcbent);
1216extern void nv04_dfp_bind_head(struct drm_device *dev, struct dcb_entry *dcbent,
1217 int head, bool dl);
1218extern void nv04_dfp_disable(struct drm_device *dev, int head);
1219extern void nv04_dfp_update_fp_control(struct drm_encoder *encoder, int mode);
1220
1221/* nv04_tv.c */
1222extern int nv04_tv_identify(struct drm_device *dev, int i2c_index);
8f1a6086 1223extern int nv04_tv_create(struct drm_connector *, struct dcb_entry *);
6ee73861
BS
1224
1225/* nv17_tv.c */
8f1a6086 1226extern int nv17_tv_create(struct drm_connector *, struct dcb_entry *);
6ee73861
BS
1227
1228/* nv04_display.c */
c88c2e06
FJ
1229extern int nv04_display_early_init(struct drm_device *);
1230extern void nv04_display_late_takedown(struct drm_device *);
6ee73861 1231extern int nv04_display_create(struct drm_device *);
c88c2e06 1232extern int nv04_display_init(struct drm_device *);
6ee73861 1233extern void nv04_display_destroy(struct drm_device *);
6ee73861
BS
1234
1235/* nv04_crtc.c */
1236extern int nv04_crtc_create(struct drm_device *, int index);
1237
1238/* nouveau_bo.c */
1239extern struct ttm_bo_driver nouveau_bo_driver;
1240extern int nouveau_bo_new(struct drm_device *, struct nouveau_channel *,
1241 int size, int align, uint32_t flags,
1242 uint32_t tile_mode, uint32_t tile_flags,
d550c41e 1243 struct nouveau_bo **);
6ee73861
BS
1244extern int nouveau_bo_pin(struct nouveau_bo *, uint32_t flags);
1245extern int nouveau_bo_unpin(struct nouveau_bo *);
1246extern int nouveau_bo_map(struct nouveau_bo *);
1247extern void nouveau_bo_unmap(struct nouveau_bo *);
78ad0f7b
FJ
1248extern void nouveau_bo_placement_set(struct nouveau_bo *, uint32_t type,
1249 uint32_t busy);
6ee73861
BS
1250extern u16 nouveau_bo_rd16(struct nouveau_bo *nvbo, unsigned index);
1251extern void nouveau_bo_wr16(struct nouveau_bo *nvbo, unsigned index, u16 val);
1252extern u32 nouveau_bo_rd32(struct nouveau_bo *nvbo, unsigned index);
1253extern void nouveau_bo_wr32(struct nouveau_bo *nvbo, unsigned index, u32 val);
332b242f 1254extern void nouveau_bo_fence(struct nouveau_bo *, struct nouveau_fence *);
7a45d764
BS
1255extern int nouveau_bo_validate(struct nouveau_bo *, bool interruptible,
1256 bool no_wait_reserve, bool no_wait_gpu);
6ee73861
BS
1257
1258/* nouveau_fence.c */
1259struct nouveau_fence;
0c6c1c2f
FJ
1260extern int nouveau_fence_init(struct drm_device *);
1261extern void nouveau_fence_fini(struct drm_device *);
2730723b
FJ
1262extern int nouveau_fence_channel_init(struct nouveau_channel *);
1263extern void nouveau_fence_channel_fini(struct nouveau_channel *);
6ee73861
BS
1264extern void nouveau_fence_update(struct nouveau_channel *);
1265extern int nouveau_fence_new(struct nouveau_channel *, struct nouveau_fence **,
1266 bool emit);
1267extern int nouveau_fence_emit(struct nouveau_fence *);
8ac3891b
FJ
1268extern void nouveau_fence_work(struct nouveau_fence *fence,
1269 void (*work)(void *priv, bool signalled),
1270 void *priv);
6ee73861 1271struct nouveau_channel *nouveau_fence_channel(struct nouveau_fence *);
382d62e5
MS
1272
1273extern bool __nouveau_fence_signalled(void *obj, void *arg);
1274extern int __nouveau_fence_wait(void *obj, void *arg, bool lazy, bool intr);
1275extern int __nouveau_fence_flush(void *obj, void *arg);
1276extern void __nouveau_fence_unref(void **obj);
1277extern void *__nouveau_fence_ref(void *obj);
1278
1279static inline bool nouveau_fence_signalled(struct nouveau_fence *obj)
1280{
1281 return __nouveau_fence_signalled(obj, NULL);
1282}
1283static inline int
1284nouveau_fence_wait(struct nouveau_fence *obj, bool lazy, bool intr)
1285{
1286 return __nouveau_fence_wait(obj, NULL, lazy, intr);
1287}
2730723b 1288extern int nouveau_fence_sync(struct nouveau_fence *, struct nouveau_channel *);
382d62e5
MS
1289static inline int nouveau_fence_flush(struct nouveau_fence *obj)
1290{
1291 return __nouveau_fence_flush(obj, NULL);
1292}
1293static inline void nouveau_fence_unref(struct nouveau_fence **obj)
1294{
1295 __nouveau_fence_unref((void **)obj);
1296}
1297static inline struct nouveau_fence *nouveau_fence_ref(struct nouveau_fence *obj)
1298{
1299 return __nouveau_fence_ref(obj);
1300}
6ee73861
BS
1301
1302/* nouveau_gem.c */
1303extern int nouveau_gem_new(struct drm_device *, struct nouveau_channel *,
6ba9a683 1304 int size, int align, uint32_t domain,
6ee73861 1305 uint32_t tile_mode, uint32_t tile_flags,
d550c41e 1306 struct nouveau_bo **);
6ee73861
BS
1307extern int nouveau_gem_object_new(struct drm_gem_object *);
1308extern void nouveau_gem_object_del(struct drm_gem_object *);
1309extern int nouveau_gem_ioctl_new(struct drm_device *, void *,
1310 struct drm_file *);
1311extern int nouveau_gem_ioctl_pushbuf(struct drm_device *, void *,
1312 struct drm_file *);
6ee73861
BS
1313extern int nouveau_gem_ioctl_cpu_prep(struct drm_device *, void *,
1314 struct drm_file *);
1315extern int nouveau_gem_ioctl_cpu_fini(struct drm_device *, void *,
1316 struct drm_file *);
1317extern int nouveau_gem_ioctl_info(struct drm_device *, void *,
1318 struct drm_file *);
1319
042206c0
FJ
1320/* nouveau_display.c */
1321int nouveau_vblank_enable(struct drm_device *dev, int crtc);
1322void nouveau_vblank_disable(struct drm_device *dev, int crtc);
332b242f
FJ
1323int nouveau_crtc_page_flip(struct drm_crtc *crtc, struct drm_framebuffer *fb,
1324 struct drm_pending_vblank_event *event);
1325int nouveau_finish_page_flip(struct nouveau_channel *,
1326 struct nouveau_page_flip_state *);
042206c0 1327
ee2e0131
BS
1328/* nv10_gpio.c */
1329int nv10_gpio_get(struct drm_device *dev, enum dcb_gpio_tag tag);
1330int nv10_gpio_set(struct drm_device *dev, enum dcb_gpio_tag tag, int state);
6ee73861 1331
45284162 1332/* nv50_gpio.c */
ee2e0131 1333int nv50_gpio_init(struct drm_device *dev);
2cbd4c81 1334void nv50_gpio_fini(struct drm_device *dev);
45284162
BS
1335int nv50_gpio_get(struct drm_device *dev, enum dcb_gpio_tag tag);
1336int nv50_gpio_set(struct drm_device *dev, enum dcb_gpio_tag tag, int state);
fce2bad0
BS
1337int nv50_gpio_irq_register(struct drm_device *, enum dcb_gpio_tag,
1338 void (*)(void *, int), void *);
1339void nv50_gpio_irq_unregister(struct drm_device *, enum dcb_gpio_tag,
1340 void (*)(void *, int), void *);
1341bool nv50_gpio_irq_enable(struct drm_device *, enum dcb_gpio_tag, bool on);
45284162 1342
e9ebb68b
BS
1343/* nv50_calc. */
1344int nv50_calc_pll(struct drm_device *, struct pll_lims *, int clk,
1345 int *N1, int *M1, int *N2, int *M2, int *P);
1346int nv50_calc_pll2(struct drm_device *, struct pll_lims *,
1347 int clk, int *N, int *fN, int *M, int *P);
1348
6ee73861
BS
1349#ifndef ioread32_native
1350#ifdef __BIG_ENDIAN
1351#define ioread16_native ioread16be
1352#define iowrite16_native iowrite16be
1353#define ioread32_native ioread32be
1354#define iowrite32_native iowrite32be
1355#else /* def __BIG_ENDIAN */
1356#define ioread16_native ioread16
1357#define iowrite16_native iowrite16
1358#define ioread32_native ioread32
1359#define iowrite32_native iowrite32
1360#endif /* def __BIG_ENDIAN else */
1361#endif /* !ioread32_native */
1362
1363/* channel control reg access */
1364static inline u32 nvchan_rd32(struct nouveau_channel *chan, unsigned reg)
1365{
1366 return ioread32_native(chan->user + reg);
1367}
1368
1369static inline void nvchan_wr32(struct nouveau_channel *chan,
1370 unsigned reg, u32 val)
1371{
1372 iowrite32_native(val, chan->user + reg);
1373}
1374
1375/* register access */
1376static inline u32 nv_rd32(struct drm_device *dev, unsigned reg)
1377{
1378 struct drm_nouveau_private *dev_priv = dev->dev_private;
1379 return ioread32_native(dev_priv->mmio + reg);
1380}
1381
1382static inline void nv_wr32(struct drm_device *dev, unsigned reg, u32 val)
1383{
1384 struct drm_nouveau_private *dev_priv = dev->dev_private;
1385 iowrite32_native(val, dev_priv->mmio + reg);
1386}
1387
2a7fdb2b 1388static inline u32 nv_mask(struct drm_device *dev, u32 reg, u32 mask, u32 val)
49eed80a
BS
1389{
1390 u32 tmp = nv_rd32(dev, reg);
2a7fdb2b
BS
1391 nv_wr32(dev, reg, (tmp & ~mask) | val);
1392 return tmp;
49eed80a
BS
1393}
1394
6ee73861
BS
1395static inline u8 nv_rd08(struct drm_device *dev, unsigned reg)
1396{
1397 struct drm_nouveau_private *dev_priv = dev->dev_private;
1398 return ioread8(dev_priv->mmio + reg);
1399}
1400
1401static inline void nv_wr08(struct drm_device *dev, unsigned reg, u8 val)
1402{
1403 struct drm_nouveau_private *dev_priv = dev->dev_private;
1404 iowrite8(val, dev_priv->mmio + reg);
1405}
1406
4b5c152a 1407#define nv_wait(dev, reg, mask, val) \
12fb9525
BS
1408 nouveau_wait_eq(dev, 2000000000ULL, (reg), (mask), (val))
1409#define nv_wait_ne(dev, reg, mask, val) \
1410 nouveau_wait_ne(dev, 2000000000ULL, (reg), (mask), (val))
6ee73861
BS
1411
1412/* PRAMIN access */
1413static inline u32 nv_ri32(struct drm_device *dev, unsigned offset)
1414{
1415 struct drm_nouveau_private *dev_priv = dev->dev_private;
1416 return ioread32_native(dev_priv->ramin + offset);
1417}
1418
1419static inline void nv_wi32(struct drm_device *dev, unsigned offset, u32 val)
1420{
1421 struct drm_nouveau_private *dev_priv = dev->dev_private;
1422 iowrite32_native(val, dev_priv->ramin + offset);
1423}
1424
1425/* object access */
b3beb167
BS
1426extern u32 nv_ro32(struct nouveau_gpuobj *, u32 offset);
1427extern void nv_wo32(struct nouveau_gpuobj *, u32 offset, u32 val);
6ee73861
BS
1428
1429/*
1430 * Logging
1431 * Argument d is (struct drm_device *).
1432 */
1433#define NV_PRINTK(level, d, fmt, arg...) \
1434 printk(level "[" DRM_NAME "] " DRIVER_NAME " %s: " fmt, \
1435 pci_name(d->pdev), ##arg)
1436#ifndef NV_DEBUG_NOTRACE
1437#define NV_DEBUG(d, fmt, arg...) do { \
ef2bb506
MM
1438 if (drm_debug & DRM_UT_DRIVER) { \
1439 NV_PRINTK(KERN_DEBUG, d, "%s:%d - " fmt, __func__, \
1440 __LINE__, ##arg); \
1441 } \
1442} while (0)
1443#define NV_DEBUG_KMS(d, fmt, arg...) do { \
1444 if (drm_debug & DRM_UT_KMS) { \
6ee73861
BS
1445 NV_PRINTK(KERN_DEBUG, d, "%s:%d - " fmt, __func__, \
1446 __LINE__, ##arg); \
1447 } \
1448} while (0)
1449#else
1450#define NV_DEBUG(d, fmt, arg...) do { \
ef2bb506
MM
1451 if (drm_debug & DRM_UT_DRIVER) \
1452 NV_PRINTK(KERN_DEBUG, d, fmt, ##arg); \
1453} while (0)
1454#define NV_DEBUG_KMS(d, fmt, arg...) do { \
1455 if (drm_debug & DRM_UT_KMS) \
6ee73861
BS
1456 NV_PRINTK(KERN_DEBUG, d, fmt, ##arg); \
1457} while (0)
1458#endif
1459#define NV_ERROR(d, fmt, arg...) NV_PRINTK(KERN_ERR, d, fmt, ##arg)
1460#define NV_INFO(d, fmt, arg...) NV_PRINTK(KERN_INFO, d, fmt, ##arg)
1461#define NV_TRACEWARN(d, fmt, arg...) NV_PRINTK(KERN_NOTICE, d, fmt, ##arg)
1462#define NV_TRACE(d, fmt, arg...) NV_PRINTK(KERN_INFO, d, fmt, ##arg)
1463#define NV_WARN(d, fmt, arg...) NV_PRINTK(KERN_WARNING, d, fmt, ##arg)
1464
1465/* nouveau_reg_debug bitmask */
1466enum {
1467 NOUVEAU_REG_DEBUG_MC = 0x1,
1468 NOUVEAU_REG_DEBUG_VIDEO = 0x2,
1469 NOUVEAU_REG_DEBUG_FB = 0x4,
1470 NOUVEAU_REG_DEBUG_EXTDEV = 0x8,
1471 NOUVEAU_REG_DEBUG_CRTC = 0x10,
1472 NOUVEAU_REG_DEBUG_RAMDAC = 0x20,
1473 NOUVEAU_REG_DEBUG_VGACRTC = 0x40,
1474 NOUVEAU_REG_DEBUG_RMVIO = 0x80,
1475 NOUVEAU_REG_DEBUG_VGAATTR = 0x100,
1476 NOUVEAU_REG_DEBUG_EVO = 0x200,
1477};
1478
1479#define NV_REG_DEBUG(type, dev, fmt, arg...) do { \
1480 if (nouveau_reg_debug & NOUVEAU_REG_DEBUG_##type) \
1481 NV_PRINTK(KERN_DEBUG, dev, "%s: " fmt, __func__, ##arg); \
1482} while (0)
1483
1484static inline bool
1485nv_two_heads(struct drm_device *dev)
1486{
1487 struct drm_nouveau_private *dev_priv = dev->dev_private;
1488 const int impl = dev->pci_device & 0x0ff0;
1489
1490 if (dev_priv->card_type >= NV_10 && impl != 0x0100 &&
1491 impl != 0x0150 && impl != 0x01a0 && impl != 0x0200)
1492 return true;
1493
1494 return false;
1495}
1496
1497static inline bool
1498nv_gf4_disp_arch(struct drm_device *dev)
1499{
1500 return nv_two_heads(dev) && (dev->pci_device & 0x0ff0) != 0x0110;
1501}
1502
1503static inline bool
1504nv_two_reg_pll(struct drm_device *dev)
1505{
1506 struct drm_nouveau_private *dev_priv = dev->dev_private;
1507 const int impl = dev->pci_device & 0x0ff0;
1508
1509 if (impl == 0x0310 || impl == 0x0340 || dev_priv->card_type >= NV_40)
1510 return true;
1511 return false;
1512}
1513
acae116c
FJ
1514static inline bool
1515nv_match_device(struct drm_device *dev, unsigned device,
1516 unsigned sub_vendor, unsigned sub_device)
1517{
1518 return dev->pdev->device == device &&
1519 dev->pdev->subsystem_vendor == sub_vendor &&
1520 dev->pdev->subsystem_device == sub_device;
1521}
1522
6dfdd7a6
BS
1523static inline void *
1524nv_engine(struct drm_device *dev, int engine)
1525{
1526 struct drm_nouveau_private *dev_priv = dev->dev_private;
1527 return (void *)dev_priv->eng[engine];
1528}
1529
c693931d
BS
1530/* returns 1 if device is one of the nv4x using the 0x4497 object class,
1531 * helpful to determine a number of other hardware features
1532 */
1533static inline int
1534nv44_graph_class(struct drm_device *dev)
1535{
1536 struct drm_nouveau_private *dev_priv = dev->dev_private;
1537
1538 if ((dev_priv->chipset & 0xf0) == 0x60)
1539 return 1;
1540
1541 return !(0x0baf & (1 << (dev_priv->chipset & 0x0f)));
1542}
1543
7f4a195f 1544/* memory type/access flags, do not match hardware values */
a11c3198
BS
1545#define NV_MEM_ACCESS_RO 1
1546#define NV_MEM_ACCESS_WO 2
7f4a195f 1547#define NV_MEM_ACCESS_RW (NV_MEM_ACCESS_RO | NV_MEM_ACCESS_WO)
a11c3198
BS
1548#define NV_MEM_ACCESS_SYS 4
1549#define NV_MEM_ACCESS_VM 8
7f4a195f
BS
1550
1551#define NV_MEM_TARGET_VRAM 0
1552#define NV_MEM_TARGET_PCI 1
1553#define NV_MEM_TARGET_PCI_NOSNOOP 2
1554#define NV_MEM_TARGET_VM 3
1555#define NV_MEM_TARGET_GART 4
1556
1557#define NV_MEM_TYPE_VM 0x7f
1558#define NV_MEM_COMP_VM 0x03
1559
1560/* NV_SW object class */
f03a314b
FJ
1561#define NV_SW 0x0000506e
1562#define NV_SW_DMA_SEMAPHORE 0x00000060
1563#define NV_SW_SEMAPHORE_OFFSET 0x00000064
1564#define NV_SW_SEMAPHORE_ACQUIRE 0x00000068
1565#define NV_SW_SEMAPHORE_RELEASE 0x0000006c
8af29ccd 1566#define NV_SW_YIELD 0x00000080
f03a314b
FJ
1567#define NV_SW_DMA_VBLSEM 0x0000018c
1568#define NV_SW_VBLSEM_OFFSET 0x00000400
1569#define NV_SW_VBLSEM_RELEASE_VALUE 0x00000404
1570#define NV_SW_VBLSEM_RELEASE 0x00000408
332b242f 1571#define NV_SW_PAGE_FLIP 0x00000500
6ee73861
BS
1572
1573#endif /* __NOUVEAU_DRV_H__ */