diff options
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_drv.h')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_drv.h | 253 |
1 files changed, 162 insertions, 91 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index b1be617373b6..3a07e580d27a 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h | |||
@@ -133,22 +133,24 @@ enum nouveau_flags { | |||
133 | #define NVOBJ_ENGINE_DISPLAY 2 | 133 | #define NVOBJ_ENGINE_DISPLAY 2 |
134 | #define NVOBJ_ENGINE_INT 0xdeadbeef | 134 | #define NVOBJ_ENGINE_INT 0xdeadbeef |
135 | 135 | ||
136 | #define NVOBJ_FLAG_ALLOW_NO_REFS (1 << 0) | ||
137 | #define NVOBJ_FLAG_ZERO_ALLOC (1 << 1) | 136 | #define NVOBJ_FLAG_ZERO_ALLOC (1 << 1) |
138 | #define NVOBJ_FLAG_ZERO_FREE (1 << 2) | 137 | #define NVOBJ_FLAG_ZERO_FREE (1 << 2) |
139 | #define NVOBJ_FLAG_FAKE (1 << 3) | ||
140 | struct nouveau_gpuobj { | 138 | struct nouveau_gpuobj { |
139 | struct drm_device *dev; | ||
140 | struct kref refcount; | ||
141 | struct list_head list; | 141 | struct list_head list; |
142 | 142 | ||
143 | struct nouveau_channel *im_channel; | ||
144 | struct drm_mm_node *im_pramin; | 143 | struct drm_mm_node *im_pramin; |
145 | struct nouveau_bo *im_backing; | 144 | struct nouveau_bo *im_backing; |
146 | uint32_t im_backing_start; | ||
147 | uint32_t *im_backing_suspend; | 145 | uint32_t *im_backing_suspend; |
148 | int im_bound; | 146 | int im_bound; |
149 | 147 | ||
150 | uint32_t flags; | 148 | uint32_t flags; |
151 | int refcount; | 149 | |
150 | u32 size; | ||
151 | u32 pinst; | ||
152 | u32 cinst; | ||
153 | u64 vinst; | ||
152 | 154 | ||
153 | uint32_t engine; | 155 | uint32_t engine; |
154 | uint32_t class; | 156 | uint32_t class; |
@@ -157,16 +159,6 @@ struct nouveau_gpuobj { | |||
157 | void *priv; | 159 | void *priv; |
158 | }; | 160 | }; |
159 | 161 | ||
160 | struct nouveau_gpuobj_ref { | ||
161 | struct list_head list; | ||
162 | |||
163 | struct nouveau_gpuobj *gpuobj; | ||
164 | uint32_t instance; | ||
165 | |||
166 | struct nouveau_channel *channel; | ||
167 | int handle; | ||
168 | }; | ||
169 | |||
170 | struct nouveau_channel { | 162 | struct nouveau_channel { |
171 | struct drm_device *dev; | 163 | struct drm_device *dev; |
172 | int id; | 164 | int id; |
@@ -192,33 +184,32 @@ struct nouveau_channel { | |||
192 | } fence; | 184 | } fence; |
193 | 185 | ||
194 | /* DMA push buffer */ | 186 | /* DMA push buffer */ |
195 | struct nouveau_gpuobj_ref *pushbuf; | 187 | struct nouveau_gpuobj *pushbuf; |
196 | struct nouveau_bo *pushbuf_bo; | 188 | struct nouveau_bo *pushbuf_bo; |
197 | uint32_t pushbuf_base; | 189 | uint32_t pushbuf_base; |
198 | 190 | ||
199 | /* Notifier memory */ | 191 | /* Notifier memory */ |
200 | struct nouveau_bo *notifier_bo; | 192 | struct nouveau_bo *notifier_bo; |
201 | struct drm_mm notifier_heap; | 193 | struct drm_mm notifier_heap; |
202 | 194 | ||
203 | /* PFIFO context */ | 195 | /* PFIFO context */ |
204 | struct nouveau_gpuobj_ref *ramfc; | 196 | struct nouveau_gpuobj *ramfc; |
205 | struct nouveau_gpuobj_ref *cache; | 197 | struct nouveau_gpuobj *cache; |
206 | 198 | ||
207 | /* PGRAPH context */ | 199 | /* PGRAPH context */ |
208 | /* XXX may be merge 2 pointers as private data ??? */ | 200 | /* XXX may be merge 2 pointers as private data ??? */ |
209 | struct nouveau_gpuobj_ref *ramin_grctx; | 201 | struct nouveau_gpuobj *ramin_grctx; |
210 | void *pgraph_ctx; | 202 | void *pgraph_ctx; |
211 | 203 | ||
212 | /* NV50 VM */ | 204 | /* NV50 VM */ |
213 | struct nouveau_gpuobj *vm_pd; | 205 | struct nouveau_gpuobj *vm_pd; |
214 | struct nouveau_gpuobj_ref *vm_gart_pt; | 206 | struct nouveau_gpuobj *vm_gart_pt; |
215 | struct nouveau_gpuobj_ref *vm_vram_pt[NV50_VM_VRAM_NR]; | 207 | struct nouveau_gpuobj *vm_vram_pt[NV50_VM_VRAM_NR]; |
216 | 208 | ||
217 | /* Objects */ | 209 | /* Objects */ |
218 | struct nouveau_gpuobj_ref *ramin; /* Private instmem */ | 210 | struct nouveau_gpuobj *ramin; /* Private instmem */ |
219 | struct drm_mm ramin_heap; /* Private PRAMIN heap */ | 211 | struct drm_mm ramin_heap; /* Private PRAMIN heap */ |
220 | struct nouveau_gpuobj_ref *ramht; /* Hash table */ | 212 | struct nouveau_ramht *ramht; /* Hash table */ |
221 | struct list_head ramht_refs; /* Objects referenced by RAMHT */ | ||
222 | 213 | ||
223 | /* GPU object info for stuff used in-kernel (mm_enabled) */ | 214 | /* GPU object info for stuff used in-kernel (mm_enabled) */ |
224 | uint32_t m2mf_ntfy; | 215 | uint32_t m2mf_ntfy; |
@@ -296,7 +287,7 @@ struct nouveau_fb_engine { | |||
296 | struct nouveau_fifo_engine { | 287 | struct nouveau_fifo_engine { |
297 | int channels; | 288 | int channels; |
298 | 289 | ||
299 | struct nouveau_gpuobj_ref *playlist[2]; | 290 | struct nouveau_gpuobj *playlist[2]; |
300 | int cur_playlist; | 291 | int cur_playlist; |
301 | 292 | ||
302 | int (*init)(struct drm_device *); | 293 | int (*init)(struct drm_device *); |
@@ -305,7 +296,6 @@ struct nouveau_fifo_engine { | |||
305 | void (*disable)(struct drm_device *); | 296 | void (*disable)(struct drm_device *); |
306 | void (*enable)(struct drm_device *); | 297 | void (*enable)(struct drm_device *); |
307 | bool (*reassign)(struct drm_device *, bool enable); | 298 | bool (*reassign)(struct drm_device *, bool enable); |
308 | bool (*cache_flush)(struct drm_device *dev); | ||
309 | bool (*cache_pull)(struct drm_device *dev, bool enable); | 299 | bool (*cache_pull)(struct drm_device *dev, bool enable); |
310 | 300 | ||
311 | int (*channel_id)(struct drm_device *); | 301 | int (*channel_id)(struct drm_device *); |
@@ -334,7 +324,7 @@ struct nouveau_pgraph_engine { | |||
334 | int grctx_size; | 324 | int grctx_size; |
335 | 325 | ||
336 | /* NV2x/NV3x context table (0x400780) */ | 326 | /* NV2x/NV3x context table (0x400780) */ |
337 | struct nouveau_gpuobj_ref *ctx_table; | 327 | struct nouveau_gpuobj *ctx_table; |
338 | 328 | ||
339 | int (*init)(struct drm_device *); | 329 | int (*init)(struct drm_device *); |
340 | void (*takedown)(struct drm_device *); | 330 | void (*takedown)(struct drm_device *); |
@@ -369,6 +359,91 @@ struct nouveau_gpio_engine { | |||
369 | void (*irq_enable)(struct drm_device *, enum dcb_gpio_tag, bool on); | 359 | void (*irq_enable)(struct drm_device *, enum dcb_gpio_tag, bool on); |
370 | }; | 360 | }; |
371 | 361 | ||
362 | struct nouveau_pm_voltage_level { | ||
363 | u8 voltage; | ||
364 | u8 vid; | ||
365 | }; | ||
366 | |||
367 | struct nouveau_pm_voltage { | ||
368 | bool supported; | ||
369 | u8 vid_mask; | ||
370 | |||
371 | struct nouveau_pm_voltage_level *level; | ||
372 | int nr_level; | ||
373 | }; | ||
374 | |||
375 | #define NOUVEAU_PM_MAX_LEVEL 8 | ||
376 | struct nouveau_pm_level { | ||
377 | struct device_attribute dev_attr; | ||
378 | char name[32]; | ||
379 | int id; | ||
380 | |||
381 | u32 core; | ||
382 | u32 memory; | ||
383 | u32 shader; | ||
384 | u32 unk05; | ||
385 | |||
386 | u8 voltage; | ||
387 | u8 fanspeed; | ||
388 | |||
389 | u16 memscript; | ||
390 | }; | ||
391 | |||
392 | struct nouveau_pm_temp_sensor_constants { | ||
393 | u16 offset_constant; | ||
394 | s16 offset_mult; | ||
395 | u16 offset_div; | ||
396 | u16 slope_mult; | ||
397 | u16 slope_div; | ||
398 | }; | ||
399 | |||
400 | struct nouveau_pm_threshold_temp { | ||
401 | s16 critical; | ||
402 | s16 down_clock; | ||
403 | s16 fan_boost; | ||
404 | }; | ||
405 | |||
406 | struct nouveau_pm_memtiming { | ||
407 | u32 reg_100220; | ||
408 | u32 reg_100224; | ||
409 | u32 reg_100228; | ||
410 | u32 reg_10022c; | ||
411 | u32 reg_100230; | ||
412 | u32 reg_100234; | ||
413 | u32 reg_100238; | ||
414 | u32 reg_10023c; | ||
415 | }; | ||
416 | |||
417 | struct nouveau_pm_memtimings { | ||
418 | bool supported; | ||
419 | struct nouveau_pm_memtiming *timing; | ||
420 | int nr_timing; | ||
421 | }; | ||
422 | |||
423 | struct nouveau_pm_engine { | ||
424 | struct nouveau_pm_voltage voltage; | ||
425 | struct nouveau_pm_level perflvl[NOUVEAU_PM_MAX_LEVEL]; | ||
426 | int nr_perflvl; | ||
427 | struct nouveau_pm_memtimings memtimings; | ||
428 | struct nouveau_pm_temp_sensor_constants sensor_constants; | ||
429 | struct nouveau_pm_threshold_temp threshold_temp; | ||
430 | |||
431 | struct nouveau_pm_level boot; | ||
432 | struct nouveau_pm_level *cur; | ||
433 | |||
434 | struct device *hwmon; | ||
435 | |||
436 | int (*clock_get)(struct drm_device *, u32 id); | ||
437 | void *(*clock_pre)(struct drm_device *, struct nouveau_pm_level *, | ||
438 | u32 id, int khz); | ||
439 | void (*clock_set)(struct drm_device *, void *); | ||
440 | int (*voltage_get)(struct drm_device *); | ||
441 | int (*voltage_set)(struct drm_device *, int voltage); | ||
442 | int (*fanspeed_get)(struct drm_device *); | ||
443 | int (*fanspeed_set)(struct drm_device *, int fanspeed); | ||
444 | int (*temp_get)(struct drm_device *); | ||
445 | }; | ||
446 | |||
372 | struct nouveau_engine { | 447 | struct nouveau_engine { |
373 | struct nouveau_instmem_engine instmem; | 448 | struct nouveau_instmem_engine instmem; |
374 | struct nouveau_mc_engine mc; | 449 | struct nouveau_mc_engine mc; |
@@ -378,6 +453,7 @@ struct nouveau_engine { | |||
378 | struct nouveau_fifo_engine fifo; | 453 | struct nouveau_fifo_engine fifo; |
379 | struct nouveau_display_engine display; | 454 | struct nouveau_display_engine display; |
380 | struct nouveau_gpio_engine gpio; | 455 | struct nouveau_gpio_engine gpio; |
456 | struct nouveau_pm_engine pm; | ||
381 | }; | 457 | }; |
382 | 458 | ||
383 | struct nouveau_pll_vals { | 459 | struct nouveau_pll_vals { |
@@ -522,8 +598,14 @@ struct drm_nouveau_private { | |||
522 | int flags; | 598 | int flags; |
523 | 599 | ||
524 | void __iomem *mmio; | 600 | void __iomem *mmio; |
601 | |||
602 | spinlock_t ramin_lock; | ||
525 | void __iomem *ramin; | 603 | void __iomem *ramin; |
526 | uint32_t ramin_size; | 604 | u32 ramin_size; |
605 | u32 ramin_base; | ||
606 | bool ramin_available; | ||
607 | struct drm_mm ramin_heap; | ||
608 | struct list_head gpuobj_list; | ||
527 | 609 | ||
528 | struct nouveau_bo *vga_ram; | 610 | struct nouveau_bo *vga_ram; |
529 | 611 | ||
@@ -540,6 +622,12 @@ struct drm_nouveau_private { | |||
540 | atomic_t validate_sequence; | 622 | atomic_t validate_sequence; |
541 | } ttm; | 623 | } ttm; |
542 | 624 | ||
625 | struct { | ||
626 | spinlock_t lock; | ||
627 | struct drm_mm heap; | ||
628 | struct nouveau_bo *bo; | ||
629 | } fence; | ||
630 | |||
543 | int fifo_alloc_count; | 631 | int fifo_alloc_count; |
544 | struct nouveau_channel *fifos[NOUVEAU_MAX_CHANNEL_NR]; | 632 | struct nouveau_channel *fifos[NOUVEAU_MAX_CHANNEL_NR]; |
545 | 633 | ||
@@ -550,15 +638,11 @@ struct drm_nouveau_private { | |||
550 | spinlock_t context_switch_lock; | 638 | spinlock_t context_switch_lock; |
551 | 639 | ||
552 | /* RAMIN configuration, RAMFC, RAMHT and RAMRO offsets */ | 640 | /* RAMIN configuration, RAMFC, RAMHT and RAMRO offsets */ |
553 | struct nouveau_gpuobj *ramht; | 641 | struct nouveau_ramht *ramht; |
642 | struct nouveau_gpuobj *ramfc; | ||
643 | struct nouveau_gpuobj *ramro; | ||
644 | |||
554 | uint32_t ramin_rsvd_vram; | 645 | uint32_t ramin_rsvd_vram; |
555 | uint32_t ramht_offset; | ||
556 | uint32_t ramht_size; | ||
557 | uint32_t ramht_bits; | ||
558 | uint32_t ramfc_offset; | ||
559 | uint32_t ramfc_size; | ||
560 | uint32_t ramro_offset; | ||
561 | uint32_t ramro_size; | ||
562 | 646 | ||
563 | struct { | 647 | struct { |
564 | enum { | 648 | enum { |
@@ -576,14 +660,12 @@ struct drm_nouveau_private { | |||
576 | } gart_info; | 660 | } gart_info; |
577 | 661 | ||
578 | /* nv10-nv40 tiling regions */ | 662 | /* nv10-nv40 tiling regions */ |
579 | struct { | 663 | struct nouveau_tile_reg tile[NOUVEAU_MAX_TILE_NR]; |
580 | struct nouveau_tile_reg reg[NOUVEAU_MAX_TILE_NR]; | ||
581 | spinlock_t lock; | ||
582 | } tile; | ||
583 | 664 | ||
584 | /* VRAM/fb configuration */ | 665 | /* VRAM/fb configuration */ |
585 | uint64_t vram_size; | 666 | uint64_t vram_size; |
586 | uint64_t vram_sys_base; | 667 | uint64_t vram_sys_base; |
668 | u32 vram_rblock_size; | ||
587 | 669 | ||
588 | uint64_t fb_phys; | 670 | uint64_t fb_phys; |
589 | uint64_t fb_available_size; | 671 | uint64_t fb_available_size; |
@@ -600,10 +682,6 @@ struct drm_nouveau_private { | |||
600 | struct nouveau_gpuobj *vm_vram_pt[NV50_VM_VRAM_NR]; | 682 | struct nouveau_gpuobj *vm_vram_pt[NV50_VM_VRAM_NR]; |
601 | int vm_vram_pt_nr; | 683 | int vm_vram_pt_nr; |
602 | 684 | ||
603 | struct drm_mm ramin_heap; | ||
604 | |||
605 | struct list_head gpuobj_list; | ||
606 | |||
607 | struct nvbios vbios; | 685 | struct nvbios vbios; |
608 | 686 | ||
609 | struct nv04_mode_state mode_reg; | 687 | struct nv04_mode_state mode_reg; |
@@ -634,6 +712,12 @@ struct drm_nouveau_private { | |||
634 | }; | 712 | }; |
635 | 713 | ||
636 | static inline struct drm_nouveau_private * | 714 | static inline struct drm_nouveau_private * |
715 | nouveau_private(struct drm_device *dev) | ||
716 | { | ||
717 | return dev->dev_private; | ||
718 | } | ||
719 | |||
720 | static inline struct drm_nouveau_private * | ||
637 | nouveau_bdev(struct ttm_bo_device *bd) | 721 | nouveau_bdev(struct ttm_bo_device *bd) |
638 | { | 722 | { |
639 | return container_of(bd, struct drm_nouveau_private, ttm.bdev); | 723 | return container_of(bd, struct drm_nouveau_private, ttm.bdev); |
@@ -669,7 +753,7 @@ nouveau_bo_ref(struct nouveau_bo *ref, struct nouveau_bo **pnvbo) | |||
669 | } while (0) | 753 | } while (0) |
670 | 754 | ||
671 | /* nouveau_drv.c */ | 755 | /* nouveau_drv.c */ |
672 | extern int nouveau_noagp; | 756 | extern int nouveau_agpmode; |
673 | extern int nouveau_duallink; | 757 | extern int nouveau_duallink; |
674 | extern int nouveau_uscript_lvds; | 758 | extern int nouveau_uscript_lvds; |
675 | extern int nouveau_uscript_tmds; | 759 | extern int nouveau_uscript_tmds; |
@@ -683,7 +767,10 @@ extern char *nouveau_vbios; | |||
683 | extern int nouveau_ignorelid; | 767 | extern int nouveau_ignorelid; |
684 | extern int nouveau_nofbaccel; | 768 | extern int nouveau_nofbaccel; |
685 | extern int nouveau_noaccel; | 769 | extern int nouveau_noaccel; |
770 | extern int nouveau_force_post; | ||
686 | extern int nouveau_override_conntype; | 771 | extern int nouveau_override_conntype; |
772 | extern char *nouveau_perflvl; | ||
773 | extern int nouveau_perflvl_wr; | ||
687 | 774 | ||
688 | extern int nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state); | 775 | extern int nouveau_pci_suspend(struct pci_dev *pdev, pm_message_t pm_state); |
689 | extern int nouveau_pci_resume(struct pci_dev *pdev); | 776 | extern int nouveau_pci_resume(struct pci_dev *pdev); |
@@ -704,8 +791,10 @@ extern bool nouveau_wait_for_idle(struct drm_device *); | |||
704 | extern int nouveau_card_init(struct drm_device *); | 791 | extern int nouveau_card_init(struct drm_device *); |
705 | 792 | ||
706 | /* nouveau_mem.c */ | 793 | /* nouveau_mem.c */ |
707 | extern int nouveau_mem_detect(struct drm_device *dev); | 794 | extern int nouveau_mem_vram_init(struct drm_device *); |
708 | extern int nouveau_mem_init(struct drm_device *); | 795 | extern void nouveau_mem_vram_fini(struct drm_device *); |
796 | extern int nouveau_mem_gart_init(struct drm_device *); | ||
797 | extern void nouveau_mem_gart_fini(struct drm_device *); | ||
709 | extern int nouveau_mem_init_agp(struct drm_device *); | 798 | extern int nouveau_mem_init_agp(struct drm_device *); |
710 | extern int nouveau_mem_reset_agp(struct drm_device *); | 799 | extern int nouveau_mem_reset_agp(struct drm_device *); |
711 | extern void nouveau_mem_close(struct drm_device *); | 800 | extern void nouveau_mem_close(struct drm_device *); |
@@ -749,7 +838,6 @@ extern void nouveau_channel_free(struct nouveau_channel *); | |||
749 | extern int nouveau_gpuobj_early_init(struct drm_device *); | 838 | extern int nouveau_gpuobj_early_init(struct drm_device *); |
750 | extern int nouveau_gpuobj_init(struct drm_device *); | 839 | extern int nouveau_gpuobj_init(struct drm_device *); |
751 | extern void nouveau_gpuobj_takedown(struct drm_device *); | 840 | extern void nouveau_gpuobj_takedown(struct drm_device *); |
752 | extern void nouveau_gpuobj_late_takedown(struct drm_device *); | ||
753 | extern int nouveau_gpuobj_suspend(struct drm_device *dev); | 841 | extern int nouveau_gpuobj_suspend(struct drm_device *dev); |
754 | extern void nouveau_gpuobj_suspend_cleanup(struct drm_device *dev); | 842 | extern void nouveau_gpuobj_suspend_cleanup(struct drm_device *dev); |
755 | extern void nouveau_gpuobj_resume(struct drm_device *dev); | 843 | extern void nouveau_gpuobj_resume(struct drm_device *dev); |
@@ -759,24 +847,11 @@ extern void nouveau_gpuobj_channel_takedown(struct nouveau_channel *); | |||
759 | extern int nouveau_gpuobj_new(struct drm_device *, struct nouveau_channel *, | 847 | extern int nouveau_gpuobj_new(struct drm_device *, struct nouveau_channel *, |
760 | uint32_t size, int align, uint32_t flags, | 848 | uint32_t size, int align, uint32_t flags, |
761 | struct nouveau_gpuobj **); | 849 | struct nouveau_gpuobj **); |
762 | extern int nouveau_gpuobj_del(struct drm_device *, struct nouveau_gpuobj **); | 850 | extern void nouveau_gpuobj_ref(struct nouveau_gpuobj *, |
763 | extern int nouveau_gpuobj_ref_add(struct drm_device *, struct nouveau_channel *, | 851 | struct nouveau_gpuobj **); |
764 | uint32_t handle, struct nouveau_gpuobj *, | 852 | extern int nouveau_gpuobj_new_fake(struct drm_device *, u32 pinst, u64 vinst, |
765 | struct nouveau_gpuobj_ref **); | 853 | u32 size, u32 flags, |
766 | extern int nouveau_gpuobj_ref_del(struct drm_device *, | 854 | struct nouveau_gpuobj **); |
767 | struct nouveau_gpuobj_ref **); | ||
768 | extern int nouveau_gpuobj_ref_find(struct nouveau_channel *, uint32_t handle, | ||
769 | struct nouveau_gpuobj_ref **ref_ret); | ||
770 | extern int nouveau_gpuobj_new_ref(struct drm_device *, | ||
771 | struct nouveau_channel *alloc_chan, | ||
772 | struct nouveau_channel *ref_chan, | ||
773 | uint32_t handle, uint32_t size, int align, | ||
774 | uint32_t flags, struct nouveau_gpuobj_ref **); | ||
775 | extern int nouveau_gpuobj_new_fake(struct drm_device *, | ||
776 | uint32_t p_offset, uint32_t b_offset, | ||
777 | uint32_t size, uint32_t flags, | ||
778 | struct nouveau_gpuobj **, | ||
779 | struct nouveau_gpuobj_ref**); | ||
780 | extern int nouveau_gpuobj_dma_new(struct nouveau_channel *, int class, | 855 | extern int nouveau_gpuobj_dma_new(struct nouveau_channel *, int class, |
781 | uint64_t offset, uint64_t size, int access, | 856 | uint64_t offset, uint64_t size, int access, |
782 | int target, struct nouveau_gpuobj **); | 857 | int target, struct nouveau_gpuobj **); |
@@ -879,6 +954,7 @@ extern struct dcb_gpio_entry *nouveau_bios_gpio_entry(struct drm_device *, | |||
879 | enum dcb_gpio_tag); | 954 | enum dcb_gpio_tag); |
880 | extern struct dcb_connector_table_entry * | 955 | extern struct dcb_connector_table_entry * |
881 | nouveau_bios_connector_entry(struct drm_device *, int index); | 956 | nouveau_bios_connector_entry(struct drm_device *, int index); |
957 | extern u32 get_pll_register(struct drm_device *, enum pll_types); | ||
882 | extern int get_pll_limits(struct drm_device *, uint32_t limit_match, | 958 | extern int get_pll_limits(struct drm_device *, uint32_t limit_match, |
883 | struct pll_lims *); | 959 | struct pll_lims *); |
884 | extern int nouveau_bios_run_display_table(struct drm_device *, | 960 | extern int nouveau_bios_run_display_table(struct drm_device *, |
@@ -925,10 +1001,10 @@ extern int nv40_fb_init(struct drm_device *); | |||
925 | extern void nv40_fb_takedown(struct drm_device *); | 1001 | extern void nv40_fb_takedown(struct drm_device *); |
926 | extern void nv40_fb_set_region_tiling(struct drm_device *, int, uint32_t, | 1002 | extern void nv40_fb_set_region_tiling(struct drm_device *, int, uint32_t, |
927 | uint32_t, uint32_t); | 1003 | uint32_t, uint32_t); |
928 | |||
929 | /* nv50_fb.c */ | 1004 | /* nv50_fb.c */ |
930 | extern int nv50_fb_init(struct drm_device *); | 1005 | extern int nv50_fb_init(struct drm_device *); |
931 | extern void nv50_fb_takedown(struct drm_device *); | 1006 | extern void nv50_fb_takedown(struct drm_device *); |
1007 | extern void nv50_fb_vm_trap(struct drm_device *, int display, const char *); | ||
932 | 1008 | ||
933 | /* nvc0_fb.c */ | 1009 | /* nvc0_fb.c */ |
934 | extern int nvc0_fb_init(struct drm_device *); | 1010 | extern int nvc0_fb_init(struct drm_device *); |
@@ -939,7 +1015,6 @@ extern int nv04_fifo_init(struct drm_device *); | |||
939 | extern void nv04_fifo_disable(struct drm_device *); | 1015 | extern void nv04_fifo_disable(struct drm_device *); |
940 | extern void nv04_fifo_enable(struct drm_device *); | 1016 | extern void nv04_fifo_enable(struct drm_device *); |
941 | extern bool nv04_fifo_reassign(struct drm_device *, bool); | 1017 | extern bool nv04_fifo_reassign(struct drm_device *, bool); |
942 | extern bool nv04_fifo_cache_flush(struct drm_device *); | ||
943 | extern bool nv04_fifo_cache_pull(struct drm_device *, bool); | 1018 | extern bool nv04_fifo_cache_pull(struct drm_device *, bool); |
944 | extern int nv04_fifo_channel_id(struct drm_device *); | 1019 | extern int nv04_fifo_channel_id(struct drm_device *); |
945 | extern int nv04_fifo_create_context(struct nouveau_channel *); | 1020 | extern int nv04_fifo_create_context(struct nouveau_channel *); |
@@ -977,7 +1052,6 @@ extern void nvc0_fifo_takedown(struct drm_device *); | |||
977 | extern void nvc0_fifo_disable(struct drm_device *); | 1052 | extern void nvc0_fifo_disable(struct drm_device *); |
978 | extern void nvc0_fifo_enable(struct drm_device *); | 1053 | extern void nvc0_fifo_enable(struct drm_device *); |
979 | extern bool nvc0_fifo_reassign(struct drm_device *, bool); | 1054 | extern bool nvc0_fifo_reassign(struct drm_device *, bool); |
980 | extern bool nvc0_fifo_cache_flush(struct drm_device *); | ||
981 | extern bool nvc0_fifo_cache_pull(struct drm_device *, bool); | 1055 | extern bool nvc0_fifo_cache_pull(struct drm_device *, bool); |
982 | extern int nvc0_fifo_channel_id(struct drm_device *); | 1056 | extern int nvc0_fifo_channel_id(struct drm_device *); |
983 | extern int nvc0_fifo_create_context(struct nouveau_channel *); | 1057 | extern int nvc0_fifo_create_context(struct nouveau_channel *); |
@@ -1169,15 +1243,21 @@ extern int nouveau_bo_sync_gpu(struct nouveau_bo *, struct nouveau_channel *); | |||
1169 | 1243 | ||
1170 | /* nouveau_fence.c */ | 1244 | /* nouveau_fence.c */ |
1171 | struct nouveau_fence; | 1245 | struct nouveau_fence; |
1172 | extern int nouveau_fence_init(struct nouveau_channel *); | 1246 | extern int nouveau_fence_init(struct drm_device *); |
1173 | extern void nouveau_fence_fini(struct nouveau_channel *); | 1247 | extern void nouveau_fence_fini(struct drm_device *); |
1248 | extern int nouveau_fence_channel_init(struct nouveau_channel *); | ||
1249 | extern void nouveau_fence_channel_fini(struct nouveau_channel *); | ||
1174 | extern void nouveau_fence_update(struct nouveau_channel *); | 1250 | extern void nouveau_fence_update(struct nouveau_channel *); |
1175 | extern int nouveau_fence_new(struct nouveau_channel *, struct nouveau_fence **, | 1251 | extern int nouveau_fence_new(struct nouveau_channel *, struct nouveau_fence **, |
1176 | bool emit); | 1252 | bool emit); |
1177 | extern int nouveau_fence_emit(struct nouveau_fence *); | 1253 | extern int nouveau_fence_emit(struct nouveau_fence *); |
1254 | extern void nouveau_fence_work(struct nouveau_fence *fence, | ||
1255 | void (*work)(void *priv, bool signalled), | ||
1256 | void *priv); | ||
1178 | struct nouveau_channel *nouveau_fence_channel(struct nouveau_fence *); | 1257 | struct nouveau_channel *nouveau_fence_channel(struct nouveau_fence *); |
1179 | extern bool nouveau_fence_signalled(void *obj, void *arg); | 1258 | extern bool nouveau_fence_signalled(void *obj, void *arg); |
1180 | extern int nouveau_fence_wait(void *obj, void *arg, bool lazy, bool intr); | 1259 | extern int nouveau_fence_wait(void *obj, void *arg, bool lazy, bool intr); |
1260 | extern int nouveau_fence_sync(struct nouveau_fence *, struct nouveau_channel *); | ||
1181 | extern int nouveau_fence_flush(void *obj, void *arg); | 1261 | extern int nouveau_fence_flush(void *obj, void *arg); |
1182 | extern void nouveau_fence_unref(void **obj); | 1262 | extern void nouveau_fence_unref(void **obj); |
1183 | extern void *nouveau_fence_ref(void *obj); | 1263 | extern void *nouveau_fence_ref(void *obj); |
@@ -1255,12 +1335,11 @@ static inline void nv_wr32(struct drm_device *dev, unsigned reg, u32 val) | |||
1255 | iowrite32_native(val, dev_priv->mmio + reg); | 1335 | iowrite32_native(val, dev_priv->mmio + reg); |
1256 | } | 1336 | } |
1257 | 1337 | ||
1258 | static inline void nv_mask(struct drm_device *dev, u32 reg, u32 mask, u32 val) | 1338 | static inline u32 nv_mask(struct drm_device *dev, u32 reg, u32 mask, u32 val) |
1259 | { | 1339 | { |
1260 | u32 tmp = nv_rd32(dev, reg); | 1340 | u32 tmp = nv_rd32(dev, reg); |
1261 | tmp &= ~mask; | 1341 | nv_wr32(dev, reg, (tmp & ~mask) | val); |
1262 | tmp |= val; | 1342 | return tmp; |
1263 | nv_wr32(dev, reg, tmp); | ||
1264 | } | 1343 | } |
1265 | 1344 | ||
1266 | static inline u8 nv_rd08(struct drm_device *dev, unsigned reg) | 1345 | static inline u8 nv_rd08(struct drm_device *dev, unsigned reg) |
@@ -1275,7 +1354,7 @@ static inline void nv_wr08(struct drm_device *dev, unsigned reg, u8 val) | |||
1275 | iowrite8(val, dev_priv->mmio + reg); | 1354 | iowrite8(val, dev_priv->mmio + reg); |
1276 | } | 1355 | } |
1277 | 1356 | ||
1278 | #define nv_wait(reg, mask, val) \ | 1357 | #define nv_wait(dev, reg, mask, val) \ |
1279 | nouveau_wait_until(dev, 2000000000ULL, (reg), (mask), (val)) | 1358 | nouveau_wait_until(dev, 2000000000ULL, (reg), (mask), (val)) |
1280 | 1359 | ||
1281 | /* PRAMIN access */ | 1360 | /* PRAMIN access */ |
@@ -1292,17 +1371,8 @@ static inline void nv_wi32(struct drm_device *dev, unsigned offset, u32 val) | |||
1292 | } | 1371 | } |
1293 | 1372 | ||
1294 | /* object access */ | 1373 | /* object access */ |
1295 | static inline u32 nv_ro32(struct drm_device *dev, struct nouveau_gpuobj *obj, | 1374 | extern u32 nv_ro32(struct nouveau_gpuobj *, u32 offset); |
1296 | unsigned index) | 1375 | extern void nv_wo32(struct nouveau_gpuobj *, u32 offset, u32 val); |
1297 | { | ||
1298 | return nv_ri32(dev, obj->im_pramin->start + index * 4); | ||
1299 | } | ||
1300 | |||
1301 | static inline void nv_wo32(struct drm_device *dev, struct nouveau_gpuobj *obj, | ||
1302 | unsigned index, u32 val) | ||
1303 | { | ||
1304 | nv_wi32(dev, obj->im_pramin->start + index * 4, val); | ||
1305 | } | ||
1306 | 1376 | ||
1307 | /* | 1377 | /* |
1308 | * Logging | 1378 | * Logging |
@@ -1403,6 +1473,7 @@ nv_match_device(struct drm_device *dev, unsigned device, | |||
1403 | #define NV_SW_SEMAPHORE_OFFSET 0x00000064 | 1473 | #define NV_SW_SEMAPHORE_OFFSET 0x00000064 |
1404 | #define NV_SW_SEMAPHORE_ACQUIRE 0x00000068 | 1474 | #define NV_SW_SEMAPHORE_ACQUIRE 0x00000068 |
1405 | #define NV_SW_SEMAPHORE_RELEASE 0x0000006c | 1475 | #define NV_SW_SEMAPHORE_RELEASE 0x0000006c |
1476 | #define NV_SW_YIELD 0x00000080 | ||
1406 | #define NV_SW_DMA_VBLSEM 0x0000018c | 1477 | #define NV_SW_DMA_VBLSEM 0x0000018c |
1407 | #define NV_SW_VBLSEM_OFFSET 0x00000400 | 1478 | #define NV_SW_VBLSEM_OFFSET 0x00000400 |
1408 | #define NV_SW_VBLSEM_RELEASE_VALUE 0x00000404 | 1479 | #define NV_SW_VBLSEM_RELEASE_VALUE 0x00000404 |