drm/nouveau: fix some usages of the wrong print function
[linux-2.6-block.git] / drivers / gpu / drm / nouveau / nouveau_drm.h
CommitLineData
94580299
BS
1#ifndef __NOUVEAU_DRMCLI_H__
2#define __NOUVEAU_DRMCLI_H__
3
77145f1c
BS
4#define DRIVER_AUTHOR "Nouveau Project"
5#define DRIVER_EMAIL "nouveau@lists.freedesktop.org"
6
7#define DRIVER_NAME "nouveau"
8#define DRIVER_DESC "nVidia Riva/TNT/GeForce/Quadro/Tesla"
9#define DRIVER_DATE "20120801"
10
11#define DRIVER_MAJOR 1
12#define DRIVER_MINOR 1
7820e5ee 13#define DRIVER_PATCHLEVEL 2
142c21b8
CB
14
15/*
16 * 1.1.1:
17 * - added support for tiled system memory buffer objects
18 * - added support for NOUVEAU_GETPARAM_GRAPH_UNITS on [nvc0,nve0].
19 * - added support for compressed memory storage types on [nvc0,nve0].
20 * - added support for software methods 0x600,0x644,0x6ac on nvc0
21 * to control registers on the MPs to enable performance counters,
22 * and to control the warp error enable mask (OpenGL requires out of
23 * bounds access to local memory to be silently ignored / return 0).
7820e5ee
MK
24 * 1.1.2:
25 * - fixes multiple bugs in flip completion events and timestamping
142c21b8 26 */
77145f1c 27
94580299 28#include <core/client.h>
1d7c71a3 29#include <core/event.h>
94580299 30
ebb945a9
BS
31#include <subdev/vm.h>
32
94580299
BS
33#include <drmP.h>
34#include <drm/nouveau_drm.h>
35
612a9aab
LT
36#include <drm/ttm/ttm_bo_api.h>
37#include <drm/ttm/ttm_bo_driver.h>
38#include <drm/ttm/ttm_placement.h>
39#include <drm/ttm/ttm_memory.h>
40#include <drm/ttm/ttm_module.h>
41#include <drm/ttm/ttm_page_alloc.h>
ebb945a9
BS
42
43struct nouveau_channel;
8ba9ff11 44struct platform_device;
ebb945a9
BS
45
46#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
47
ebb945a9 48#include "nouveau_fence.h"
77145f1c 49#include "nouveau_bios.h"
ebb945a9
BS
50
51struct nouveau_drm_tile {
52 struct nouveau_fence *fence;
53 bool used;
54};
55
94580299 56enum nouveau_drm_handle {
26fdd78c
BS
57 NVDRM_CLIENT = 0xffffffff,
58 NVDRM_DEVICE = 0xdddddddd,
59 NVDRM_CONTROL = 0xdddddddc,
2332b311 60 NVDRM_DISPLAY = 0xd1500000,
26fdd78c
BS
61 NVDRM_PUSH = 0xbbbb0000, /* |= client chid */
62 NVDRM_CHAN = 0xcccc0000, /* |= client chid */
69a6146d 63 NVDRM_NVSW = 0x55550000,
94580299
BS
64};
65
66struct nouveau_cli {
67 struct nouveau_client base;
3ee6f5b5 68 struct nouveau_vm *vm; /*XXX*/
94580299
BS
69 struct list_head head;
70 struct mutex mutex;
ebb945a9 71 void *abi16;
94580299
BS
72};
73
ebb945a9
BS
74static inline struct nouveau_cli *
75nouveau_cli(struct drm_file *fpriv)
76{
77 return fpriv ? fpriv->driver_priv : NULL;
78}
79
5addcf0a
DA
80extern int nouveau_runtime_pm;
81
94580299
BS
82struct nouveau_drm {
83 struct nouveau_cli client;
84 struct drm_device *dev;
85
86 struct nouveau_object *device;
87 struct list_head clients;
cb75d97e
BS
88
89 struct {
90 enum {
91 UNKNOWN = 0,
92 DISABLE = 1,
93 ENABLED = 2
94 } stat;
95 u32 base;
96 u32 size;
97 } agp;
ebb945a9
BS
98
99 /* TTM interface support */
100 struct {
101 struct drm_global_reference mem_global_ref;
102 struct ttm_bo_global_ref bo_global_ref;
103 struct ttm_bo_device bdev;
104 atomic_t validate_sequence;
105 int (*move)(struct nouveau_channel *,
106 struct ttm_buffer_object *,
107 struct ttm_mem_reg *, struct ttm_mem_reg *);
1bb3f6a2 108 struct nouveau_channel *chan;
ebb945a9
BS
109 int mtrr;
110 } ttm;
111
112 /* GEM interface support */
113 struct {
114 u64 vram_available;
115 u64 gart_available;
116 } gem;
117
118 /* synchronisation */
119 void *fence;
120
121 /* context for accelerated drm-internal operations */
49981046 122 struct nouveau_channel *cechan;
ebb945a9
BS
123 struct nouveau_channel *channel;
124 struct nouveau_gpuobj *notify;
125 struct nouveau_fbdev *fbcon;
126
127 /* nv10-nv40 tiling regions */
128 struct {
129 struct nouveau_drm_tile reg[15];
130 spinlock_t lock;
131 } tile;
51a3d342 132
77145f1c
BS
133 /* modesetting */
134 struct nvbios vbios;
135 struct nouveau_display *display;
51a3d342 136 struct backlight_device *backlight;
77145f1c
BS
137
138 /* power management */
b9ed919f 139 struct nouveau_hwmon *hwmon;
26fdd78c 140 struct nouveau_sysfs *sysfs;
5addcf0a
DA
141
142 /* display power reference */
143 bool have_disp_power_ref;
144
145 struct dev_pm_domain vga_pm_domain;
146 struct pci_dev *hdmi_device;
94580299
BS
147};
148
ebb945a9
BS
149static inline struct nouveau_drm *
150nouveau_drm(struct drm_device *dev)
151{
77145f1c
BS
152 return dev->dev_private;
153}
154
155static inline struct nouveau_device *
156nouveau_dev(struct drm_device *dev)
157{
158 return nv_device(nouveau_drm(dev)->device);
ebb945a9
BS
159}
160
2d8b9ccb
DA
161int nouveau_pmops_suspend(struct device *);
162int nouveau_pmops_resume(struct device *);
94580299 163
8ba9ff11
AC
164#define nouveau_platform_device_create(p, u) \
165 nouveau_platform_device_create_(p, sizeof(**u), (void **)u)
166struct drm_device *
167nouveau_platform_device_create_(struct platform_device *pdev,
168 int size, void **pobject);
169void nouveau_drm_device_remove(struct drm_device *dev);
170
fa2bade9
BS
171#define NV_PRINTK(l,c,f,a...) do { \
172 struct nouveau_cli *_cli = (c); \
173 nv_##l(_cli, f, ##a); \
174} while(0)
175#define NV_FATAL(drm,f,a...) NV_PRINTK(fatal, &(drm)->client, f, ##a)
176#define NV_ERROR(drm,f,a...) NV_PRINTK(error, &(drm)->client, f, ##a)
177#define NV_WARN(drm,f,a...) NV_PRINTK(warn, &(drm)->client, f, ##a)
178#define NV_INFO(drm,f,a...) NV_PRINTK(info, &(drm)->client, f, ##a)
179#define NV_DEBUG(drm,f,a...) NV_PRINTK(debug, &(drm)->client, f, ##a)
94580299 180
9430738d
BS
181extern int nouveau_modeset;
182
94580299 183#endif