aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2012-07-22 01:03:09 -0400
committerBen Skeggs <bskeggs@redhat.com>2012-10-02 23:12:56 -0400
commit08c770969a45361277d556f9fd3e2d70da42be65 (patch)
treeb4bfae82cf944404e60bfe7a5d36cf8796433bb5 /drivers/gpu/drm/nouveau
parentebb945a94bba2ce8dff7b0942ff2b3f2a52a0a69 (diff)
drm/nouveau: start culling unused code
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drv.c7
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_drv.h135
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_hw.c8
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_hw.h25
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_irq.c1
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_mem.c23
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_state.c32
-rw-r--r--drivers/gpu/drm/nouveau/nvd0_display.c12
8 files changed, 4 insertions, 239 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.c b/drivers/gpu/drm/nouveau/nouveau_drv.c
index 2294cb8848f7..666c178c6022 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.c
@@ -87,13 +87,6 @@ MODULE_PARM_DESC(tv_norm, "Default TV norm.\n"
87char *nouveau_tv_norm; 87char *nouveau_tv_norm;
88module_param_named(tv_norm, nouveau_tv_norm, charp, 0400); 88module_param_named(tv_norm, nouveau_tv_norm, charp, 0400);
89 89
90MODULE_PARM_DESC(reg_debug, "Register access debug bitmask:\n"
91 "\t\t0x1 mc, 0x2 video, 0x4 fb, 0x8 extdev,\n"
92 "\t\t0x10 crtc, 0x20 ramdac, 0x40 vgacrtc, 0x80 rmvio,\n"
93 "\t\t0x100 vgaattr, 0x200 EVO (G80+)");
94int nouveau_reg_debug;
95module_param_named(reg_debug, nouveau_reg_debug, int, 0600);
96
97MODULE_PARM_DESC(perflvl, "Performance level (default: boot)"); 90MODULE_PARM_DESC(perflvl, "Performance level (default: boot)");
98char *nouveau_perflvl; 91char *nouveau_perflvl;
99module_param_named(perflvl, nouveau_perflvl, charp, 0400); 92module_param_named(perflvl, nouveau_perflvl, charp, 0400);
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
index f1cce652a2a9..16b7bb6951cc 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -64,15 +64,10 @@ enum blah {
64 NV_MEM_TYPE_GDDR5 64 NV_MEM_TYPE_GDDR5
65}; 65};
66 66
67#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
68
69#include <nouveau_drm.h> 67#include <nouveau_drm.h>
70#include "nouveau_reg.h" 68#include "nouveau_reg.h"
71#include <nouveau_bios.h> 69#include <nouveau_bios.h>
72 70
73struct nouveau_grctx;
74struct nouveau_mem;
75
76#include <subdev/bios/pll.h> 71#include <subdev/bios/pll.h>
77#include "nouveau_compat.h" 72#include "nouveau_compat.h"
78 73
@@ -85,18 +80,9 @@ struct nouveau_mem;
85#define nv50_vm_flush_engine(d,e) \ 80#define nv50_vm_flush_engine(d,e) \
86 _nv50_vm_flush_engine((d), (e)) 81 _nv50_vm_flush_engine((d), (e))
87 82
88#define MAX_NUM_DCB_ENTRIES 16
89
90#define NOUVEAU_MAX_CHANNEL_NR 4096
91
92#include "nouveau_bo.h" 83#include "nouveau_bo.h"
93#include "nouveau_gem.h" 84#include "nouveau_gem.h"
94 85
95enum nouveau_flags {
96 NV_NFORCE = 0x10000000,
97 NV_NFORCE2 = 0x20000000
98};
99
100struct nouveau_page_flip_state { 86struct nouveau_page_flip_state {
101 struct list_head head; 87 struct list_head head;
102 struct drm_pending_vblank_event *event; 88 struct drm_pending_vblank_event *event;
@@ -104,11 +90,6 @@ struct nouveau_page_flip_state {
104 uint64_t offset; 90 uint64_t offset;
105}; 91};
106 92
107enum nouveau_channel_mutex_class {
108 NOUVEAU_UCHANNEL_MUTEX,
109 NOUVEAU_KCHANNEL_MUTEX
110};
111
112struct nouveau_display_engine { 93struct nouveau_display_engine {
113 void *priv; 94 void *priv;
114 int (*early_init)(struct drm_device *); 95 int (*early_init)(struct drm_device *);
@@ -306,11 +287,8 @@ enum nouveau_card_type {
306 NV_E0 = 0xe0, 287 NV_E0 = 0xe0,
307}; 288};
308 289
309struct nouveau_channel;
310
311struct drm_nouveau_private { 290struct drm_nouveau_private {
312 struct drm_device *dev; 291 struct drm_device *dev;
313 bool noaccel;
314 292
315 void *newpriv; 293 void *newpriv;
316 294
@@ -318,11 +296,8 @@ struct drm_nouveau_private {
318 enum nouveau_card_type card_type; 296 enum nouveau_card_type card_type;
319 /* exact chipset, derived from NV_PMC_BOOT_0 */ 297 /* exact chipset, derived from NV_PMC_BOOT_0 */
320 int chipset; 298 int chipset;
321 int flags;
322 u32 crystal; 299 u32 crystal;
323 300
324 struct nouveau_bo *vga_ram;
325
326 /* interrupt handling */ 301 /* interrupt handling */
327 void (*irq_handler[32])(struct drm_device *); 302 void (*irq_handler[32])(struct drm_device *);
328 bool msi_enabled; 303 bool msi_enabled;
@@ -332,16 +307,8 @@ struct drm_nouveau_private {
332 /* For PFIFO and PGRAPH. */ 307 /* For PFIFO and PGRAPH. */
333 spinlock_t context_switch_lock; 308 spinlock_t context_switch_lock;
334 309
335 /* RAMIN configuration, RAMFC, RAMHT and RAMRO offsets */
336 struct nouveau_ramht *ramht;
337
338 uint64_t fb_available_size;
339 uint64_t fb_mappable_pages;
340 int fb_mtrr;
341
342 struct nvbios vbios; 310 struct nvbios vbios;
343 u8 *mxms; 311 u8 *mxms;
344 struct list_head i2c_ports;
345 312
346 struct backlight_device *backlight; 313 struct backlight_device *backlight;
347}; 314};
@@ -363,9 +330,7 @@ extern char *nouveau_vram_type;
363extern int nouveau_fbpercrtc; 330extern int nouveau_fbpercrtc;
364extern int nouveau_tv_disable; 331extern int nouveau_tv_disable;
365extern char *nouveau_tv_norm; 332extern char *nouveau_tv_norm;
366extern int nouveau_reg_debug;
367extern int nouveau_ignorelid; 333extern int nouveau_ignorelid;
368extern int nouveau_noaccel;
369extern int nouveau_force_post; 334extern int nouveau_force_post;
370extern int nouveau_override_conntype; 335extern int nouveau_override_conntype;
371extern char *nouveau_perflvl; 336extern char *nouveau_perflvl;
@@ -382,34 +347,13 @@ extern int nouveau_load(struct drm_device *, unsigned long flags);
382extern int nouveau_firstopen(struct drm_device *); 347extern int nouveau_firstopen(struct drm_device *);
383extern void nouveau_lastclose(struct drm_device *); 348extern void nouveau_lastclose(struct drm_device *);
384extern int nouveau_unload(struct drm_device *); 349extern int nouveau_unload(struct drm_device *);
385extern bool nouveau_wait_for_idle(struct drm_device *);
386extern int nouveau_card_init(struct drm_device *); 350extern int nouveau_card_init(struct drm_device *);
387 351
388/* nouveau_mem.c */ 352/* nouveau_mem.c */
389extern int nouveau_mem_vram_init(struct drm_device *);
390extern void nouveau_mem_vram_fini(struct drm_device *);
391extern int nouveau_mem_gart_init(struct drm_device *);
392extern void nouveau_mem_gart_fini(struct drm_device *);
393extern void nouveau_mem_close(struct drm_device *);
394extern bool nouveau_mem_flags_valid(struct drm_device *, u32 tile_flags);
395extern int nouveau_mem_timing_calc(struct drm_device *, u32 freq, 353extern int nouveau_mem_timing_calc(struct drm_device *, u32 freq,
396 struct nouveau_pm_memtiming *); 354 struct nouveau_pm_memtiming *);
397extern void nouveau_mem_timing_read(struct drm_device *, 355extern void nouveau_mem_timing_read(struct drm_device *,
398 struct nouveau_pm_memtiming *); 356 struct nouveau_pm_memtiming *);
399extern int nouveau_mem_vbios_type(struct drm_device *);
400extern struct nouveau_tile_reg *nv10_mem_set_tiling(
401 struct drm_device *dev, uint32_t addr, uint32_t size,
402 uint32_t pitch, uint32_t flags);
403extern void nv10_mem_put_tile_region(struct drm_device *dev,
404 struct nouveau_tile_reg *tile,
405 struct nouveau_fence *fence);
406
407extern int nouveau_channel_idle(struct nouveau_channel *chan);
408
409/* nouveau_gpuobj.c */
410int nouveau_gpuobj_map_vm(struct nouveau_gpuobj *gpuobj, struct nouveau_vm *vm,
411 u32 flags, struct nouveau_vma *vma);
412void nouveau_gpuobj_unmap(struct nouveau_vma *vma);
413 357
414/* nouveau_irq.c */ 358/* nouveau_irq.c */
415extern int nouveau_irq_init(struct drm_device *); 359extern int nouveau_irq_init(struct drm_device *);
@@ -586,26 +530,6 @@ int nouveau_display_dumb_destroy(struct drm_file *, struct drm_device *,
586 } \ 530 } \
587} while(0) 531} while(0)
588 532
589/* nouveau_reg_debug bitmask */
590enum {
591 NOUVEAU_REG_DEBUG_MC = 0x1,
592 NOUVEAU_REG_DEBUG_VIDEO = 0x2,
593 NOUVEAU_REG_DEBUG_FB = 0x4,
594 NOUVEAU_REG_DEBUG_EXTDEV = 0x8,
595 NOUVEAU_REG_DEBUG_CRTC = 0x10,
596 NOUVEAU_REG_DEBUG_RAMDAC = 0x20,
597 NOUVEAU_REG_DEBUG_VGACRTC = 0x40,
598 NOUVEAU_REG_DEBUG_RMVIO = 0x80,
599 NOUVEAU_REG_DEBUG_VGAATTR = 0x100,
600 NOUVEAU_REG_DEBUG_EVO = 0x200,
601 NOUVEAU_REG_DEBUG_AUXCH = 0x400
602};
603
604#define NV_REG_DEBUG(type, dev, fmt, arg...) do { \
605 if (nouveau_reg_debug & NOUVEAU_REG_DEBUG_##type) \
606 NV_PRINTK(KERN_DEBUG, dev, "%s: " fmt, __func__, ##arg); \
607} while (0)
608
609static inline bool 533static inline bool
610nv_two_heads(struct drm_device *dev) 534nv_two_heads(struct drm_device *dev)
611{ 535{
@@ -645,63 +569,4 @@ nv_match_device(struct drm_device *dev, unsigned device,
645 dev->pdev->subsystem_device == sub_device; 569 dev->pdev->subsystem_device == sub_device;
646} 570}
647 571
648/* returns 1 if device is one of the nv4x using the 0x4497 object class,
649 * helpful to determine a number of other hardware features
650 */
651static inline int
652nv44_graph_class(struct drm_device *dev)
653{
654 struct drm_nouveau_private *dev_priv = dev->dev_private;
655
656 if ((dev_priv->chipset & 0xf0) == 0x60)
657 return 1;
658
659 return !(0x0baf & (1 << (dev_priv->chipset & 0x0f)));
660}
661
662/* memory type/access flags, do not match hardware values */
663#define NV_MEM_ACCESS_RO 1
664#define NV_MEM_ACCESS_WO 2
665#define NV_MEM_ACCESS_RW (NV_MEM_ACCESS_RO | NV_MEM_ACCESS_WO)
666#define NV_MEM_ACCESS_SYS 4
667#define NV_MEM_ACCESS_VM 8
668#define NV_MEM_ACCESS_NOSNOOP 16
669
670#define NV_MEM_TARGET_VRAM 0
671#define NV_MEM_TARGET_PCI 1
672#define NV_MEM_TARGET_PCI_NOSNOOP 2
673#define NV_MEM_TARGET_VM 3
674#define NV_MEM_TARGET_GART 4
675
676#define NV_MEM_TYPE_VM 0x7f
677#define NV_MEM_COMP_VM 0x03
678
679/* FIFO methods */
680#define NV01_SUBCHAN_OBJECT 0x00000000
681#define NV84_SUBCHAN_SEMAPHORE_ADDRESS_HIGH 0x00000010
682#define NV84_SUBCHAN_SEMAPHORE_ADDRESS_LOW 0x00000014
683#define NV84_SUBCHAN_SEMAPHORE_SEQUENCE 0x00000018
684#define NV84_SUBCHAN_SEMAPHORE_TRIGGER 0x0000001c
685#define NV84_SUBCHAN_SEMAPHORE_TRIGGER_ACQUIRE_EQUAL 0x00000001
686#define NV84_SUBCHAN_SEMAPHORE_TRIGGER_WRITE_LONG 0x00000002
687#define NV84_SUBCHAN_SEMAPHORE_TRIGGER_ACQUIRE_GEQUAL 0x00000004
688#define NVC0_SUBCHAN_SEMAPHORE_TRIGGER_YIELD 0x00001000
689#define NV84_SUBCHAN_NOTIFY_INTR 0x00000020
690#define NV84_SUBCHAN_WRCACHE_FLUSH 0x00000024
691#define NV10_SUBCHAN_REF_CNT 0x00000050
692#define NVSW_SUBCHAN_PAGE_FLIP 0x00000054
693#define NV11_SUBCHAN_DMA_SEMAPHORE 0x00000060
694#define NV11_SUBCHAN_SEMAPHORE_OFFSET 0x00000064
695#define NV11_SUBCHAN_SEMAPHORE_ACQUIRE 0x00000068
696#define NV11_SUBCHAN_SEMAPHORE_RELEASE 0x0000006c
697#define NV40_SUBCHAN_YIELD 0x00000080
698
699/* NV_SW object class */
700#define NV_SW 0x0000506e
701#define NV_SW_DMA_VBLSEM 0x0000018c
702#define NV_SW_VBLSEM_OFFSET 0x00000400
703#define NV_SW_VBLSEM_RELEASE_VALUE 0x00000404
704#define NV_SW_VBLSEM_RELEASE 0x00000408
705#define NV_SW_PAGE_FLIP 0x00000500
706
707#endif /* __NOUVEAU_DRV_H__ */ 572#endif /* __NOUVEAU_DRV_H__ */
diff --git a/drivers/gpu/drm/nouveau/nouveau_hw.c b/drivers/gpu/drm/nouveau/nouveau_hw.c
index 9cae3eb508c4..900bfb0c6e9a 100644
--- a/drivers/gpu/drm/nouveau/nouveau_hw.c
+++ b/drivers/gpu/drm/nouveau/nouveau_hw.c
@@ -674,10 +674,10 @@ nv_load_state_ext(struct drm_device *dev, int head,
674 nvWriteVIDEO(dev, NV_PVIDEO_INTR_EN, 0); 674 nvWriteVIDEO(dev, NV_PVIDEO_INTR_EN, 0);
675 nvWriteVIDEO(dev, NV_PVIDEO_OFFSET_BUFF(0), 0); 675 nvWriteVIDEO(dev, NV_PVIDEO_OFFSET_BUFF(0), 0);
676 nvWriteVIDEO(dev, NV_PVIDEO_OFFSET_BUFF(1), 0); 676 nvWriteVIDEO(dev, NV_PVIDEO_OFFSET_BUFF(1), 0);
677 nvWriteVIDEO(dev, NV_PVIDEO_LIMIT(0), dev_priv->fb_available_size - 1); 677 nvWriteVIDEO(dev, NV_PVIDEO_LIMIT(0), 0); //dev_priv->fb_available_size - 1);
678 nvWriteVIDEO(dev, NV_PVIDEO_LIMIT(1), dev_priv->fb_available_size - 1); 678 nvWriteVIDEO(dev, NV_PVIDEO_LIMIT(1), 0); //dev_priv->fb_available_size - 1);
679 nvWriteVIDEO(dev, NV_PVIDEO_UVPLANE_LIMIT(0), dev_priv->fb_available_size - 1); 679 nvWriteVIDEO(dev, NV_PVIDEO_UVPLANE_LIMIT(0), 0); //dev_priv->fb_available_size - 1);
680 nvWriteVIDEO(dev, NV_PVIDEO_UVPLANE_LIMIT(1), dev_priv->fb_available_size - 1); 680 nvWriteVIDEO(dev, NV_PVIDEO_UVPLANE_LIMIT(1), 0); //dev_priv->fb_available_size - 1);
681 nvWriteMC(dev, NV_PBUS_POWERCTRL_2, 0); 681 nvWriteMC(dev, NV_PBUS_POWERCTRL_2, 0);
682 682
683 NVWriteCRTC(dev, head, NV_PCRTC_CURSOR_CONFIG, regp->cursor_cfg); 683 NVWriteCRTC(dev, head, NV_PCRTC_CURSOR_CONFIG, regp->cursor_cfg);
diff --git a/drivers/gpu/drm/nouveau/nouveau_hw.h b/drivers/gpu/drm/nouveau/nouveau_hw.h
index feb2a2f7bd42..3febf19a8883 100644
--- a/drivers/gpu/drm/nouveau/nouveau_hw.h
+++ b/drivers/gpu/drm/nouveau/nouveau_hw.h
@@ -61,14 +61,12 @@ static inline uint32_t
61nvReadMC(struct drm_device *dev, uint32_t reg) 61nvReadMC(struct drm_device *dev, uint32_t reg)
62{ 62{
63 uint32_t val = nv_rd32(dev, reg); 63 uint32_t val = nv_rd32(dev, reg);
64 NV_REG_DEBUG(MC, dev, "reg %08x val %08x\n", reg, val);
65 return val; 64 return val;
66} 65}
67 66
68static inline void 67static inline void
69nvWriteMC(struct drm_device *dev, uint32_t reg, uint32_t val) 68nvWriteMC(struct drm_device *dev, uint32_t reg, uint32_t val)
70{ 69{
71 NV_REG_DEBUG(MC, dev, "reg %08x val %08x\n", reg, val);
72 nv_wr32(dev, reg, val); 70 nv_wr32(dev, reg, val);
73} 71}
74 72
@@ -76,14 +74,12 @@ static inline uint32_t
76nvReadVIDEO(struct drm_device *dev, uint32_t reg) 74nvReadVIDEO(struct drm_device *dev, uint32_t reg)
77{ 75{
78 uint32_t val = nv_rd32(dev, reg); 76 uint32_t val = nv_rd32(dev, reg);
79 NV_REG_DEBUG(VIDEO, dev, "reg %08x val %08x\n", reg, val);
80 return val; 77 return val;
81} 78}
82 79
83static inline void 80static inline void
84nvWriteVIDEO(struct drm_device *dev, uint32_t reg, uint32_t val) 81nvWriteVIDEO(struct drm_device *dev, uint32_t reg, uint32_t val)
85{ 82{
86 NV_REG_DEBUG(VIDEO, dev, "reg %08x val %08x\n", reg, val);
87 nv_wr32(dev, reg, val); 83 nv_wr32(dev, reg, val);
88} 84}
89 85
@@ -91,14 +87,12 @@ static inline uint32_t
91nvReadFB(struct drm_device *dev, uint32_t reg) 87nvReadFB(struct drm_device *dev, uint32_t reg)
92{ 88{
93 uint32_t val = nv_rd32(dev, reg); 89 uint32_t val = nv_rd32(dev, reg);
94 NV_REG_DEBUG(FB, dev, "reg %08x val %08x\n", reg, val);
95 return val; 90 return val;
96} 91}
97 92
98static inline void 93static inline void
99nvWriteFB(struct drm_device *dev, uint32_t reg, uint32_t val) 94nvWriteFB(struct drm_device *dev, uint32_t reg, uint32_t val)
100{ 95{
101 NV_REG_DEBUG(FB, dev, "reg %08x val %08x\n", reg, val);
102 nv_wr32(dev, reg, val); 96 nv_wr32(dev, reg, val);
103} 97}
104 98
@@ -106,14 +100,12 @@ static inline uint32_t
106nvReadEXTDEV(struct drm_device *dev, uint32_t reg) 100nvReadEXTDEV(struct drm_device *dev, uint32_t reg)
107{ 101{
108 uint32_t val = nv_rd32(dev, reg); 102 uint32_t val = nv_rd32(dev, reg);
109 NV_REG_DEBUG(EXTDEV, dev, "reg %08x val %08x\n", reg, val);
110 return val; 103 return val;
111} 104}
112 105
113static inline void 106static inline void
114nvWriteEXTDEV(struct drm_device *dev, uint32_t reg, uint32_t val) 107nvWriteEXTDEV(struct drm_device *dev, uint32_t reg, uint32_t val)
115{ 108{
116 NV_REG_DEBUG(EXTDEV, dev, "reg %08x val %08x\n", reg, val);
117 nv_wr32(dev, reg, val); 109 nv_wr32(dev, reg, val);
118} 110}
119 111
@@ -124,7 +116,6 @@ static inline uint32_t NVReadCRTC(struct drm_device *dev,
124 if (head) 116 if (head)
125 reg += NV_PCRTC0_SIZE; 117 reg += NV_PCRTC0_SIZE;
126 val = nv_rd32(dev, reg); 118 val = nv_rd32(dev, reg);
127 NV_REG_DEBUG(CRTC, dev, "head %d reg %08x val %08x\n", head, reg, val);
128 return val; 119 return val;
129} 120}
130 121
@@ -133,7 +124,6 @@ static inline void NVWriteCRTC(struct drm_device *dev,
133{ 124{
134 if (head) 125 if (head)
135 reg += NV_PCRTC0_SIZE; 126 reg += NV_PCRTC0_SIZE;
136 NV_REG_DEBUG(CRTC, dev, "head %d reg %08x val %08x\n", head, reg, val);
137 nv_wr32(dev, reg, val); 127 nv_wr32(dev, reg, val);
138} 128}
139 129
@@ -144,8 +134,6 @@ static inline uint32_t NVReadRAMDAC(struct drm_device *dev,
144 if (head) 134 if (head)
145 reg += NV_PRAMDAC0_SIZE; 135 reg += NV_PRAMDAC0_SIZE;
146 val = nv_rd32(dev, reg); 136 val = nv_rd32(dev, reg);
147 NV_REG_DEBUG(RAMDAC, dev, "head %d reg %08x val %08x\n",
148 head, reg, val);
149 return val; 137 return val;
150} 138}
151 139
@@ -154,8 +142,6 @@ static inline void NVWriteRAMDAC(struct drm_device *dev,
154{ 142{
155 if (head) 143 if (head)
156 reg += NV_PRAMDAC0_SIZE; 144 reg += NV_PRAMDAC0_SIZE;
157 NV_REG_DEBUG(RAMDAC, dev, "head %d reg %08x val %08x\n",
158 head, reg, val);
159 nv_wr32(dev, reg, val); 145 nv_wr32(dev, reg, val);
160} 146}
161 147
@@ -182,8 +168,6 @@ static inline void nv_write_tmds(struct drm_device *dev,
182static inline void NVWriteVgaCrtc(struct drm_device *dev, 168static inline void NVWriteVgaCrtc(struct drm_device *dev,
183 int head, uint8_t index, uint8_t value) 169 int head, uint8_t index, uint8_t value)
184{ 170{
185 NV_REG_DEBUG(VGACRTC, dev, "head %d index 0x%02x data 0x%02x\n",
186 head, index, value);
187 nv_wr08(dev, NV_PRMCIO_CRX__COLOR + head * NV_PRMCIO_SIZE, index); 171 nv_wr08(dev, NV_PRMCIO_CRX__COLOR + head * NV_PRMCIO_SIZE, index);
188 nv_wr08(dev, NV_PRMCIO_CR__COLOR + head * NV_PRMCIO_SIZE, value); 172 nv_wr08(dev, NV_PRMCIO_CR__COLOR + head * NV_PRMCIO_SIZE, value);
189} 173}
@@ -194,8 +178,6 @@ static inline uint8_t NVReadVgaCrtc(struct drm_device *dev,
194 uint8_t val; 178 uint8_t val;
195 nv_wr08(dev, NV_PRMCIO_CRX__COLOR + head * NV_PRMCIO_SIZE, index); 179 nv_wr08(dev, NV_PRMCIO_CRX__COLOR + head * NV_PRMCIO_SIZE, index);
196 val = nv_rd08(dev, NV_PRMCIO_CR__COLOR + head * NV_PRMCIO_SIZE); 180 val = nv_rd08(dev, NV_PRMCIO_CR__COLOR + head * NV_PRMCIO_SIZE);
197 NV_REG_DEBUG(VGACRTC, dev, "head %d index 0x%02x data 0x%02x\n",
198 head, index, val);
199 return val; 181 return val;
200} 182}
201 183
@@ -238,7 +220,6 @@ static inline uint8_t NVReadPRMVIO(struct drm_device *dev,
238 reg += NV_PRMVIO_SIZE; 220 reg += NV_PRMVIO_SIZE;
239 221
240 val = nv_rd08(dev, reg); 222 val = nv_rd08(dev, reg);
241 NV_REG_DEBUG(RMVIO, dev, "head %d reg %08x val %02x\n", head, reg, val);
242 return val; 223 return val;
243} 224}
244 225
@@ -252,8 +233,6 @@ static inline void NVWritePRMVIO(struct drm_device *dev,
252 if (head && dev_priv->card_type == NV_40) 233 if (head && dev_priv->card_type == NV_40)
253 reg += NV_PRMVIO_SIZE; 234 reg += NV_PRMVIO_SIZE;
254 235
255 NV_REG_DEBUG(RMVIO, dev, "head %d reg %08x val %02x\n",
256 head, reg, value);
257 nv_wr08(dev, reg, value); 236 nv_wr08(dev, reg, value);
258} 237}
259 238
@@ -278,8 +257,6 @@ static inline void NVWriteVgaAttr(struct drm_device *dev,
278 index |= 0x20; 257 index |= 0x20;
279 258
280 nv_rd08(dev, NV_PRMCIO_INP0__COLOR + head * NV_PRMCIO_SIZE); 259 nv_rd08(dev, NV_PRMCIO_INP0__COLOR + head * NV_PRMCIO_SIZE);
281 NV_REG_DEBUG(VGAATTR, dev, "head %d index 0x%02x data 0x%02x\n",
282 head, index, value);
283 nv_wr08(dev, NV_PRMCIO_ARX + head * NV_PRMCIO_SIZE, index); 260 nv_wr08(dev, NV_PRMCIO_ARX + head * NV_PRMCIO_SIZE, index);
284 nv_wr08(dev, NV_PRMCIO_AR__WRITE + head * NV_PRMCIO_SIZE, value); 261 nv_wr08(dev, NV_PRMCIO_AR__WRITE + head * NV_PRMCIO_SIZE, value);
285} 262}
@@ -296,8 +273,6 @@ static inline uint8_t NVReadVgaAttr(struct drm_device *dev,
296 nv_rd08(dev, NV_PRMCIO_INP0__COLOR + head * NV_PRMCIO_SIZE); 273 nv_rd08(dev, NV_PRMCIO_INP0__COLOR + head * NV_PRMCIO_SIZE);
297 nv_wr08(dev, NV_PRMCIO_ARX + head * NV_PRMCIO_SIZE, index); 274 nv_wr08(dev, NV_PRMCIO_ARX + head * NV_PRMCIO_SIZE, index);
298 val = nv_rd08(dev, NV_PRMCIO_AR__READ + head * NV_PRMCIO_SIZE); 275 val = nv_rd08(dev, NV_PRMCIO_AR__READ + head * NV_PRMCIO_SIZE);
299 NV_REG_DEBUG(VGAATTR, dev, "head %d index 0x%02x data 0x%02x\n",
300 head, index, val);
301 return val; 276 return val;
302} 277}
303 278
diff --git a/drivers/gpu/drm/nouveau/nouveau_irq.c b/drivers/gpu/drm/nouveau/nouveau_irq.c
index 25e2e63cc53a..d5281499744b 100644
--- a/drivers/gpu/drm/nouveau/nouveau_irq.c
+++ b/drivers/gpu/drm/nouveau/nouveau_irq.c
@@ -35,7 +35,6 @@
35#include <nouveau_drm.h> 35#include <nouveau_drm.h>
36#include "nouveau_drv.h" 36#include "nouveau_drv.h"
37#include "nouveau_reg.h" 37#include "nouveau_reg.h"
38#include <core/ramht.h>
39 38
40void 39void
41nouveau_irq_preinstall(struct drm_device *dev) 40nouveau_irq_preinstall(struct drm_device *dev)
diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c
index 9c35d14fe9d6..220c1a877ff5 100644
--- a/drivers/gpu/drm/nouveau/nouveau_mem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_mem.c
@@ -630,26 +630,3 @@ nouveau_mem_exec(struct nouveau_mem_exec_func *exec,
630 630
631 return 0; 631 return 0;
632} 632}
633
634int
635nouveau_mem_vbios_type(struct drm_device *dev)
636{
637 struct bit_entry M;
638 u8 ramcfg = (nv_rd32(dev, 0x101000) & 0x0000003c) >> 2;
639 if (!bit_table(dev, 'M', &M) || M.version != 2 || M.length < 5) {
640 u8 *table = ROMPTR(dev, M.data[3]);
641 if (table && table[0] == 0x10 && ramcfg < table[3]) {
642 u8 *entry = table + table[1] + (ramcfg * table[2]);
643 switch (entry[0] & 0x0f) {
644 case 0: return NV_MEM_TYPE_DDR2;
645 case 1: return NV_MEM_TYPE_DDR3;
646 case 2: return NV_MEM_TYPE_GDDR3;
647 case 3: return NV_MEM_TYPE_GDDR5;
648 default:
649 break;
650 }
651
652 }
653 }
654 return NV_MEM_TYPE_UNKNOWN;
655}
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c
index 4349b337cfdd..047765299c2c 100644
--- a/drivers/gpu/drm/nouveau/nouveau_state.c
+++ b/drivers/gpu/drm/nouveau/nouveau_state.c
@@ -350,11 +350,6 @@ static void nouveau_card_takedown(struct drm_device *dev)
350 nouveau_backlight_exit(dev); 350 nouveau_backlight_exit(dev);
351 nouveau_display_destroy(dev); 351 nouveau_display_destroy(dev);
352 352
353 if (dev_priv->vga_ram) {
354 nouveau_bo_unpin(dev_priv->vga_ram);
355 nouveau_bo_ref(NULL, &dev_priv->vga_ram);
356 }
357
358 nouveau_bios_takedown(dev); 353 nouveau_bios_takedown(dev);
359 engine->display.late_takedown(dev); 354 engine->display.late_takedown(dev);
360 355
@@ -409,8 +404,6 @@ int nouveau_load(struct drm_device *dev, unsigned long flags)
409 dev->dev_private = dev_priv; 404 dev->dev_private = dev_priv;
410 dev_priv->dev = dev; 405 dev_priv->dev = dev;
411 406
412 dev_priv->flags = flags & NOUVEAU_FLAGS;
413
414 NV_DEBUG(dev, "vendor: 0x%X device: 0x%X class: 0x%X\n", 407 NV_DEBUG(dev, "vendor: 0x%X device: 0x%X class: 0x%X\n",
415 dev->pci_vendor, dev->pci_device, dev->pdev->class); 408 dev->pci_vendor, dev->pci_device, dev->pdev->class);
416 409
@@ -483,12 +476,6 @@ int nouveau_load(struct drm_device *dev, unsigned long flags)
483 476
484 nouveau_OF_copy_vbios_to_ramin(dev); 477 nouveau_OF_copy_vbios_to_ramin(dev);
485 478
486 /* Special flags */
487 if (dev->pci_device == 0x01a0)
488 dev_priv->flags |= NV_NFORCE;
489 else if (dev->pci_device == 0x01f0)
490 dev_priv->flags |= NV_NFORCE2;
491
492 /* For kernel modesetting, init card now and bring up fbcon */ 479 /* For kernel modesetting, init card now and bring up fbcon */
493 ret = nouveau_card_init(dev); 480 ret = nouveau_card_init(dev);
494 if (ret) 481 if (ret)
@@ -518,22 +505,3 @@ int nouveau_unload(struct drm_device *dev)
518 kfree(dev_priv); 505 kfree(dev_priv);
519 return 0; 506 return 0;
520} 507}
521
522/* Waits for PGRAPH to go completely idle */
523bool nouveau_wait_for_idle(struct drm_device *dev)
524{
525 struct drm_nouveau_private *dev_priv = dev->dev_private;
526 uint32_t mask = ~0;
527
528 if (dev_priv->card_type == NV_40)
529 mask &= ~NV40_PGRAPH_STATUS_SYNC_STALL;
530
531 if (!nv_wait(dev, NV04_PGRAPH_STATUS, mask, 0)) {
532 NV_ERROR(dev, "PGRAPH idle timed out with status 0x%08x\n",
533 nv_rd32(dev, NV04_PGRAPH_STATUS));
534 return false;
535 }
536
537 return true;
538}
539
diff --git a/drivers/gpu/drm/nouveau/nvd0_display.c b/drivers/gpu/drm/nouveau/nvd0_display.c
index 37b3f3f071d9..77d5ce365bb2 100644
--- a/drivers/gpu/drm/nouveau/nvd0_display.c
+++ b/drivers/gpu/drm/nouveau/nvd0_display.c
@@ -115,9 +115,6 @@ evo_wait(struct drm_device *dev, int id, int nr)
115 put = 0; 115 put = 0;
116 } 116 }
117 117
118 if (nouveau_reg_debug & NOUVEAU_REG_DEBUG_EVO)
119 NV_INFO(dev, "Evo%d: %p START\n", id, disp->evo[id].ptr + put);
120
121 return disp->evo[id].ptr + put; 118 return disp->evo[id].ptr + put;
122} 119}
123 120
@@ -126,15 +123,6 @@ evo_kick(u32 *push, struct drm_device *dev, int id)
126{ 123{
127 struct nvd0_display *disp = nvd0_display(dev); 124 struct nvd0_display *disp = nvd0_display(dev);
128 125
129 if (nouveau_reg_debug & NOUVEAU_REG_DEBUG_EVO) {
130 u32 curp = nv_rd32(dev, 0x640000 + (id * 0x1000)) >> 2;
131 u32 *cur = disp->evo[id].ptr + curp;
132
133 while (cur < push)
134 NV_INFO(dev, "Evo%d: 0x%08x\n", id, *cur++);
135 NV_INFO(dev, "Evo%d: %p KICK!\n", id, push);
136 }
137
138 nv_wr32(dev, 0x640000 + (id * 0x1000), (push - disp->evo[id].ptr) << 2); 126 nv_wr32(dev, 0x640000 + (id * 0x1000), (push - disp->evo[id].ptr) << 2);
139} 127}
140 128