aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/drm_proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/drm/drm_proc.c')
-rw-r--r--drivers/char/drm/drm_proc.c272
1 files changed, 140 insertions, 132 deletions
diff --git a/drivers/char/drm/drm_proc.c b/drivers/char/drm/drm_proc.c
index 32d2bb99462c..8ec2156b97a9 100644
--- a/drivers/char/drm/drm_proc.c
+++ b/drivers/char/drm/drm_proc.c
@@ -1,5 +1,5 @@
1/** 1/**
2 * \file drm_proc.h 2 * \file drm_proc.c
3 * /proc support for DRM 3 * /proc support for DRM
4 * 4 *
5 * \author Rickard E. (Rik) Faith <faith@valinux.com> 5 * \author Rickard E. (Rik) Faith <faith@valinux.com>
@@ -39,19 +39,19 @@
39 39
40#include "drmP.h" 40#include "drmP.h"
41 41
42static int drm_name_info(char *buf, char **start, off_t offset, 42static int drm_name_info(char *buf, char **start, off_t offset,
43 int request, int *eof, void *data); 43 int request, int *eof, void *data);
44static int drm_vm_info(char *buf, char **start, off_t offset, 44static int drm_vm_info(char *buf, char **start, off_t offset,
45 int request, int *eof, void *data); 45 int request, int *eof, void *data);
46static int drm_clients_info(char *buf, char **start, off_t offset, 46static int drm_clients_info(char *buf, char **start, off_t offset,
47 int request, int *eof, void *data); 47 int request, int *eof, void *data);
48static int drm_queues_info(char *buf, char **start, off_t offset, 48static int drm_queues_info(char *buf, char **start, off_t offset,
49 int request, int *eof, void *data); 49 int request, int *eof, void *data);
50static int drm_bufs_info(char *buf, char **start, off_t offset, 50static int drm_bufs_info(char *buf, char **start, off_t offset,
51 int request, int *eof, void *data); 51 int request, int *eof, void *data);
52#if DRM_DEBUG_CODE 52#if DRM_DEBUG_CODE
53static int drm_vma_info(char *buf, char **start, off_t offset, 53static int drm_vma_info(char *buf, char **start, off_t offset,
54 int request, int *eof, void *data); 54 int request, int *eof, void *data);
55#endif 55#endif
56 56
57/** 57/**
@@ -59,18 +59,21 @@ static int drm_vma_info(char *buf, char **start, off_t offset,
59 */ 59 */
60static struct drm_proc_list { 60static struct drm_proc_list {
61 const char *name; /**< file name */ 61 const char *name; /**< file name */
62 int (*f)(char *, char **, off_t, int, int *, void *); /**< proc callback*/ 62 int (*f) (char *, char **, off_t, int, int *, void *); /**< proc callback*/
63} drm_proc_list[] = { 63} drm_proc_list[] = {
64 { "name", drm_name_info }, 64 {
65 { "mem", drm_mem_info }, 65 "name", drm_name_info}, {
66 { "vm", drm_vm_info }, 66 "mem", drm_mem_info}, {
67 { "clients", drm_clients_info }, 67 "vm", drm_vm_info}, {
68 { "queues", drm_queues_info }, 68 "clients", drm_clients_info}, {
69 { "bufs", drm_bufs_info }, 69 "queues", drm_queues_info}, {
70 "bufs", drm_bufs_info},
70#if DRM_DEBUG_CODE 71#if DRM_DEBUG_CODE
71 { "vma", drm_vma_info }, 72 {
73 "vma", drm_vma_info},
72#endif 74#endif
73}; 75};
76
74#define DRM_PROC_ENTRIES (sizeof(drm_proc_list)/sizeof(drm_proc_list[0])) 77#define DRM_PROC_ENTRIES (sizeof(drm_proc_list)/sizeof(drm_proc_list[0]))
75 78
76/** 79/**
@@ -81,18 +84,17 @@ static struct drm_proc_list {
81 * \param root DRI proc dir entry. 84 * \param root DRI proc dir entry.
82 * \param dev_root resulting DRI device proc dir entry. 85 * \param dev_root resulting DRI device proc dir entry.
83 * \return root entry pointer on success, or NULL on failure. 86 * \return root entry pointer on success, or NULL on failure.
84 * 87 *
85 * Create the DRI proc root entry "/proc/dri", the device proc root entry 88 * Create the DRI proc root entry "/proc/dri", the device proc root entry
86 * "/proc/dri/%minor%/", and each entry in proc_list as 89 * "/proc/dri/%minor%/", and each entry in proc_list as
87 * "/proc/dri/%minor%/%name%". 90 * "/proc/dri/%minor%/%name%".
88 */ 91 */
89int drm_proc_init(drm_device_t *dev, int minor, 92int drm_proc_init(drm_device_t * dev, int minor,
90 struct proc_dir_entry *root, 93 struct proc_dir_entry *root, struct proc_dir_entry **dev_root)
91 struct proc_dir_entry **dev_root)
92{ 94{
93 struct proc_dir_entry *ent; 95 struct proc_dir_entry *ent;
94 int i, j; 96 int i, j;
95 char name[64]; 97 char name[64];
96 98
97 sprintf(name, "%d", minor); 99 sprintf(name, "%d", minor);
98 *dev_root = create_proc_entry(name, S_IFDIR, root); 100 *dev_root = create_proc_entry(name, S_IFDIR, root);
@@ -103,7 +105,7 @@ int drm_proc_init(drm_device_t *dev, int minor,
103 105
104 for (i = 0; i < DRM_PROC_ENTRIES; i++) { 106 for (i = 0; i < DRM_PROC_ENTRIES; i++) {
105 ent = create_proc_entry(drm_proc_list[i].name, 107 ent = create_proc_entry(drm_proc_list[i].name,
106 S_IFREG|S_IRUGO, *dev_root); 108 S_IFREG | S_IRUGO, *dev_root);
107 if (!ent) { 109 if (!ent) {
108 DRM_ERROR("Cannot create /proc/dri/%s/%s\n", 110 DRM_ERROR("Cannot create /proc/dri/%s/%s\n",
109 name, drm_proc_list[i].name); 111 name, drm_proc_list[i].name);
@@ -114,13 +116,12 @@ int drm_proc_init(drm_device_t *dev, int minor,
114 return -1; 116 return -1;
115 } 117 }
116 ent->read_proc = drm_proc_list[i].f; 118 ent->read_proc = drm_proc_list[i].f;
117 ent->data = dev; 119 ent->data = dev;
118 } 120 }
119 121
120 return 0; 122 return 0;
121} 123}
122 124
123
124/** 125/**
125 * Cleanup the proc filesystem resources. 126 * Cleanup the proc filesystem resources.
126 * 127 *
@@ -132,12 +133,13 @@ int drm_proc_init(drm_device_t *dev, int minor,
132 * Remove all proc entries created by proc_init(). 133 * Remove all proc entries created by proc_init().
133 */ 134 */
134int drm_proc_cleanup(int minor, struct proc_dir_entry *root, 135int drm_proc_cleanup(int minor, struct proc_dir_entry *root,
135 struct proc_dir_entry *dev_root) 136 struct proc_dir_entry *dev_root)
136{ 137{
137 int i; 138 int i;
138 char name[64]; 139 char name[64];
139 140
140 if (!root || !dev_root) return 0; 141 if (!root || !dev_root)
142 return 0;
141 143
142 for (i = 0; i < DRM_PROC_ENTRIES; i++) 144 for (i = 0; i < DRM_PROC_ENTRIES; i++)
143 remove_proc_entry(drm_proc_list[i].name, dev_root); 145 remove_proc_entry(drm_proc_list[i].name, dev_root);
@@ -149,7 +151,7 @@ int drm_proc_cleanup(int minor, struct proc_dir_entry *root,
149 151
150/** 152/**
151 * Called when "/proc/dri/.../name" is read. 153 * Called when "/proc/dri/.../name" is read.
152 * 154 *
153 * \param buf output buffer. 155 * \param buf output buffer.
154 * \param start start of output data. 156 * \param start start of output data.
155 * \param offset requested start offset. 157 * \param offset requested start offset.
@@ -157,14 +159,14 @@ int drm_proc_cleanup(int minor, struct proc_dir_entry *root,
157 * \param eof whether there is no more data to return. 159 * \param eof whether there is no more data to return.
158 * \param data private data. 160 * \param data private data.
159 * \return number of written bytes. 161 * \return number of written bytes.
160 * 162 *
161 * Prints the device name together with the bus id if available. 163 * Prints the device name together with the bus id if available.
162 */ 164 */
163static int drm_name_info(char *buf, char **start, off_t offset, int request, 165static int drm_name_info(char *buf, char **start, off_t offset, int request,
164 int *eof, void *data) 166 int *eof, void *data)
165{ 167{
166 drm_device_t *dev = (drm_device_t *)data; 168 drm_device_t *dev = (drm_device_t *) data;
167 int len = 0; 169 int len = 0;
168 170
169 if (offset > DRM_PROC_LIMIT) { 171 if (offset > DRM_PROC_LIMIT) {
170 *eof = 1; 172 *eof = 1;
@@ -172,23 +174,26 @@ static int drm_name_info(char *buf, char **start, off_t offset, int request,
172 } 174 }
173 175
174 *start = &buf[offset]; 176 *start = &buf[offset];
175 *eof = 0; 177 *eof = 0;
176 178
177 if (dev->unique) { 179 if (dev->unique) {
178 DRM_PROC_PRINT("%s %s %s\n", 180 DRM_PROC_PRINT("%s %s %s\n",
179 dev->driver->pci_driver.name, pci_name(dev->pdev), dev->unique); 181 dev->driver->pci_driver.name,
182 pci_name(dev->pdev), dev->unique);
180 } else { 183 } else {
181 DRM_PROC_PRINT("%s %s\n", dev->driver->pci_driver.name, pci_name(dev->pdev)); 184 DRM_PROC_PRINT("%s %s\n", dev->driver->pci_driver.name,
185 pci_name(dev->pdev));
182 } 186 }
183 187
184 if (len > request + offset) return request; 188 if (len > request + offset)
189 return request;
185 *eof = 1; 190 *eof = 1;
186 return len - offset; 191 return len - offset;
187} 192}
188 193
189/** 194/**
190 * Called when "/proc/dri/.../vm" is read. 195 * Called when "/proc/dri/.../vm" is read.
191 * 196 *
192 * \param buf output buffer. 197 * \param buf output buffer.
193 * \param start start of output data. 198 * \param start start of output data.
194 * \param offset requested start offset. 199 * \param offset requested start offset.
@@ -196,24 +201,24 @@ static int drm_name_info(char *buf, char **start, off_t offset, int request,
196 * \param eof whether there is no more data to return. 201 * \param eof whether there is no more data to return.
197 * \param data private data. 202 * \param data private data.
198 * \return number of written bytes. 203 * \return number of written bytes.
199 * 204 *
200 * Prints information about all mappings in drm_device::maplist. 205 * Prints information about all mappings in drm_device::maplist.
201 */ 206 */
202static int drm__vm_info(char *buf, char **start, off_t offset, int request, 207static int drm__vm_info(char *buf, char **start, off_t offset, int request,
203 int *eof, void *data) 208 int *eof, void *data)
204{ 209{
205 drm_device_t *dev = (drm_device_t *)data; 210 drm_device_t *dev = (drm_device_t *) data;
206 int len = 0; 211 int len = 0;
207 drm_map_t *map; 212 drm_map_t *map;
208 drm_map_list_t *r_list; 213 drm_map_list_t *r_list;
209 struct list_head *list; 214 struct list_head *list;
210 215
211 /* Hardcoded from _DRM_FRAME_BUFFER, 216 /* Hardcoded from _DRM_FRAME_BUFFER,
212 _DRM_REGISTERS, _DRM_SHM, _DRM_AGP, and 217 _DRM_REGISTERS, _DRM_SHM, _DRM_AGP, and
213 _DRM_SCATTER_GATHER and _DRM_CONSISTENT */ 218 _DRM_SCATTER_GATHER and _DRM_CONSISTENT */
214 const char *types[] = { "FB", "REG", "SHM", "AGP", "SG", "PCI" }; 219 const char *types[] = { "FB", "REG", "SHM", "AGP", "SG", "PCI" };
215 const char *type; 220 const char *type;
216 int i; 221 int i;
217 222
218 if (offset > DRM_PROC_LIMIT) { 223 if (offset > DRM_PROC_LIMIT) {
219 *eof = 1; 224 *eof = 1;
@@ -221,36 +226,35 @@ static int drm__vm_info(char *buf, char **start, off_t offset, int request,
221 } 226 }
222 227
223 *start = &buf[offset]; 228 *start = &buf[offset];
224 *eof = 0; 229 *eof = 0;
225 230
226 DRM_PROC_PRINT("slot offset size type flags " 231 DRM_PROC_PRINT("slot offset size type flags "
227 "address mtrr\n\n"); 232 "address mtrr\n\n");
228 i = 0; 233 i = 0;
229 if (dev->maplist != NULL) list_for_each(list, &dev->maplist->head) { 234 if (dev->maplist != NULL)
235 list_for_each(list, &dev->maplist->head) {
230 r_list = list_entry(list, drm_map_list_t, head); 236 r_list = list_entry(list, drm_map_list_t, head);
231 map = r_list->map; 237 map = r_list->map;
232 if(!map) 238 if (!map)
233 continue; 239 continue;
234 if (map->type < 0 || map->type > 5) 240 if (map->type < 0 || map->type > 5)
235 type = "??"; 241 type = "??";
236 else 242 else
237 type = types[map->type]; 243 type = types[map->type];
238 DRM_PROC_PRINT("%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08x ", 244 DRM_PROC_PRINT("%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08x ",
239 i, 245 i,
240 map->offset, 246 map->offset,
241 map->size, 247 map->size, type, map->flags, r_list->user_token);
242 type,
243 map->flags,
244 r_list->user_token);
245 if (map->mtrr < 0) { 248 if (map->mtrr < 0) {
246 DRM_PROC_PRINT("none\n"); 249 DRM_PROC_PRINT("none\n");
247 } else { 250 } else {
248 DRM_PROC_PRINT("%4d\n", map->mtrr); 251 DRM_PROC_PRINT("%4d\n", map->mtrr);
249 } 252 }
250 i++; 253 i++;
251 } 254 }
252 255
253 if (len > request + offset) return request; 256 if (len > request + offset)
257 return request;
254 *eof = 1; 258 *eof = 1;
255 return len - offset; 259 return len - offset;
256} 260}
@@ -259,10 +263,10 @@ static int drm__vm_info(char *buf, char **start, off_t offset, int request,
259 * Simply calls _vm_info() while holding the drm_device::struct_sem lock. 263 * Simply calls _vm_info() while holding the drm_device::struct_sem lock.
260 */ 264 */
261static int drm_vm_info(char *buf, char **start, off_t offset, int request, 265static int drm_vm_info(char *buf, char **start, off_t offset, int request,
262 int *eof, void *data) 266 int *eof, void *data)
263{ 267{
264 drm_device_t *dev = (drm_device_t *)data; 268 drm_device_t *dev = (drm_device_t *) data;
265 int ret; 269 int ret;
266 270
267 down(&dev->struct_sem); 271 down(&dev->struct_sem);
268 ret = drm__vm_info(buf, start, offset, request, eof, data); 272 ret = drm__vm_info(buf, start, offset, request, eof, data);
@@ -272,7 +276,7 @@ static int drm_vm_info(char *buf, char **start, off_t offset, int request,
272 276
273/** 277/**
274 * Called when "/proc/dri/.../queues" is read. 278 * Called when "/proc/dri/.../queues" is read.
275 * 279 *
276 * \param buf output buffer. 280 * \param buf output buffer.
277 * \param start start of output data. 281 * \param start start of output data.
278 * \param offset requested start offset. 282 * \param offset requested start offset.
@@ -282,12 +286,12 @@ static int drm_vm_info(char *buf, char **start, off_t offset, int request,
282 * \return number of written bytes. 286 * \return number of written bytes.
283 */ 287 */
284static int drm__queues_info(char *buf, char **start, off_t offset, 288static int drm__queues_info(char *buf, char **start, off_t offset,
285 int request, int *eof, void *data) 289 int request, int *eof, void *data)
286{ 290{
287 drm_device_t *dev = (drm_device_t *)data; 291 drm_device_t *dev = (drm_device_t *) data;
288 int len = 0; 292 int len = 0;
289 int i; 293 int i;
290 drm_queue_t *q; 294 drm_queue_t *q;
291 295
292 if (offset > DRM_PROC_LIMIT) { 296 if (offset > DRM_PROC_LIMIT) {
293 *eof = 1; 297 *eof = 1;
@@ -295,7 +299,7 @@ static int drm__queues_info(char *buf, char **start, off_t offset,
295 } 299 }
296 300
297 *start = &buf[offset]; 301 *start = &buf[offset];
298 *eof = 0; 302 *eof = 0;
299 303
300 DRM_PROC_PRINT(" ctx/flags use fin" 304 DRM_PROC_PRINT(" ctx/flags use fin"
301 " blk/rw/rwf wait flushed queued" 305 " blk/rw/rwf wait flushed queued"
@@ -313,14 +317,17 @@ static int drm__queues_info(char *buf, char **start, off_t offset,
313 atomic_read(&q->block_count), 317 atomic_read(&q->block_count),
314 atomic_read(&q->block_read) ? 'r' : '-', 318 atomic_read(&q->block_read) ? 'r' : '-',
315 atomic_read(&q->block_write) ? 'w' : '-', 319 atomic_read(&q->block_write) ? 'w' : '-',
316 waitqueue_active(&q->read_queue) ? 'r':'-', 320 waitqueue_active(&q->read_queue) ? 'r' : '-',
317 waitqueue_active(&q->write_queue) ? 'w':'-', 321 waitqueue_active(&q->
318 waitqueue_active(&q->flush_queue) ? 'f':'-', 322 write_queue) ? 'w' : '-',
323 waitqueue_active(&q->
324 flush_queue) ? 'f' : '-',
319 DRM_BUFCOUNT(&q->waitlist)); 325 DRM_BUFCOUNT(&q->waitlist));
320 atomic_dec(&q->use_count); 326 atomic_dec(&q->use_count);
321 } 327 }
322 328
323 if (len > request + offset) return request; 329 if (len > request + offset)
330 return request;
324 *eof = 1; 331 *eof = 1;
325 return len - offset; 332 return len - offset;
326} 333}
@@ -329,10 +336,10 @@ static int drm__queues_info(char *buf, char **start, off_t offset,
329 * Simply calls _queues_info() while holding the drm_device::struct_sem lock. 336 * Simply calls _queues_info() while holding the drm_device::struct_sem lock.
330 */ 337 */
331static int drm_queues_info(char *buf, char **start, off_t offset, int request, 338static int drm_queues_info(char *buf, char **start, off_t offset, int request,
332 int *eof, void *data) 339 int *eof, void *data)
333{ 340{
334 drm_device_t *dev = (drm_device_t *)data; 341 drm_device_t *dev = (drm_device_t *) data;
335 int ret; 342 int ret;
336 343
337 down(&dev->struct_sem); 344 down(&dev->struct_sem);
338 ret = drm__queues_info(buf, start, offset, request, eof, data); 345 ret = drm__queues_info(buf, start, offset, request, eof, data);
@@ -342,7 +349,7 @@ static int drm_queues_info(char *buf, char **start, off_t offset, int request,
342 349
343/** 350/**
344 * Called when "/proc/dri/.../bufs" is read. 351 * Called when "/proc/dri/.../bufs" is read.
345 * 352 *
346 * \param buf output buffer. 353 * \param buf output buffer.
347 * \param start start of output data. 354 * \param start start of output data.
348 * \param offset requested start offset. 355 * \param offset requested start offset.
@@ -352,12 +359,12 @@ static int drm_queues_info(char *buf, char **start, off_t offset, int request,
352 * \return number of written bytes. 359 * \return number of written bytes.
353 */ 360 */
354static int drm__bufs_info(char *buf, char **start, off_t offset, int request, 361static int drm__bufs_info(char *buf, char **start, off_t offset, int request,
355 int *eof, void *data) 362 int *eof, void *data)
356{ 363{
357 drm_device_t *dev = (drm_device_t *)data; 364 drm_device_t *dev = (drm_device_t *) data;
358 int len = 0; 365 int len = 0;
359 drm_device_dma_t *dma = dev->dma; 366 drm_device_dma_t *dma = dev->dma;
360 int i; 367 int i;
361 368
362 if (!dma || offset > DRM_PROC_LIMIT) { 369 if (!dma || offset > DRM_PROC_LIMIT) {
363 *eof = 1; 370 *eof = 1;
@@ -365,7 +372,7 @@ static int drm__bufs_info(char *buf, char **start, off_t offset, int request,
365 } 372 }
366 373
367 *start = &buf[offset]; 374 *start = &buf[offset];
368 *eof = 0; 375 *eof = 0;
369 376
370 DRM_PROC_PRINT(" o size count free segs pages kB\n\n"); 377 DRM_PROC_PRINT(" o size count free segs pages kB\n\n");
371 for (i = 0; i <= DRM_MAX_ORDER; i++) { 378 for (i = 0; i <= DRM_MAX_ORDER; i++) {
@@ -378,19 +385,21 @@ static int drm__bufs_info(char *buf, char **start, off_t offset, int request,
378 .freelist.count), 385 .freelist.count),
379 dma->bufs[i].seg_count, 386 dma->bufs[i].seg_count,
380 dma->bufs[i].seg_count 387 dma->bufs[i].seg_count
381 *(1 << dma->bufs[i].page_order), 388 * (1 << dma->bufs[i].page_order),
382 (dma->bufs[i].seg_count 389 (dma->bufs[i].seg_count
383 * (1 << dma->bufs[i].page_order)) 390 * (1 << dma->bufs[i].page_order))
384 * PAGE_SIZE / 1024); 391 * PAGE_SIZE / 1024);
385 } 392 }
386 DRM_PROC_PRINT("\n"); 393 DRM_PROC_PRINT("\n");
387 for (i = 0; i < dma->buf_count; i++) { 394 for (i = 0; i < dma->buf_count; i++) {
388 if (i && !(i%32)) DRM_PROC_PRINT("\n"); 395 if (i && !(i % 32))
396 DRM_PROC_PRINT("\n");
389 DRM_PROC_PRINT(" %d", dma->buflist[i]->list); 397 DRM_PROC_PRINT(" %d", dma->buflist[i]->list);
390 } 398 }
391 DRM_PROC_PRINT("\n"); 399 DRM_PROC_PRINT("\n");
392 400
393 if (len > request + offset) return request; 401 if (len > request + offset)
402 return request;
394 *eof = 1; 403 *eof = 1;
395 return len - offset; 404 return len - offset;
396} 405}
@@ -399,10 +408,10 @@ static int drm__bufs_info(char *buf, char **start, off_t offset, int request,
399 * Simply calls _bufs_info() while holding the drm_device::struct_sem lock. 408 * Simply calls _bufs_info() while holding the drm_device::struct_sem lock.
400 */ 409 */
401static int drm_bufs_info(char *buf, char **start, off_t offset, int request, 410static int drm_bufs_info(char *buf, char **start, off_t offset, int request,
402 int *eof, void *data) 411 int *eof, void *data)
403{ 412{
404 drm_device_t *dev = (drm_device_t *)data; 413 drm_device_t *dev = (drm_device_t *) data;
405 int ret; 414 int ret;
406 415
407 down(&dev->struct_sem); 416 down(&dev->struct_sem);
408 ret = drm__bufs_info(buf, start, offset, request, eof, data); 417 ret = drm__bufs_info(buf, start, offset, request, eof, data);
@@ -412,7 +421,7 @@ static int drm_bufs_info(char *buf, char **start, off_t offset, int request,
412 421
413/** 422/**
414 * Called when "/proc/dri/.../clients" is read. 423 * Called when "/proc/dri/.../clients" is read.
415 * 424 *
416 * \param buf output buffer. 425 * \param buf output buffer.
417 * \param start start of output data. 426 * \param start start of output data.
418 * \param offset requested start offset. 427 * \param offset requested start offset.
@@ -422,11 +431,11 @@ static int drm_bufs_info(char *buf, char **start, off_t offset, int request,
422 * \return number of written bytes. 431 * \return number of written bytes.
423 */ 432 */
424static int drm__clients_info(char *buf, char **start, off_t offset, 433static int drm__clients_info(char *buf, char **start, off_t offset,
425 int request, int *eof, void *data) 434 int request, int *eof, void *data)
426{ 435{
427 drm_device_t *dev = (drm_device_t *)data; 436 drm_device_t *dev = (drm_device_t *) data;
428 int len = 0; 437 int len = 0;
429 drm_file_t *priv; 438 drm_file_t *priv;
430 439
431 if (offset > DRM_PROC_LIMIT) { 440 if (offset > DRM_PROC_LIMIT) {
432 *eof = 1; 441 *eof = 1;
@@ -434,7 +443,7 @@ static int drm__clients_info(char *buf, char **start, off_t offset,
434 } 443 }
435 444
436 *start = &buf[offset]; 445 *start = &buf[offset];
437 *eof = 0; 446 *eof = 0;
438 447
439 DRM_PROC_PRINT("a dev pid uid magic ioctls\n\n"); 448 DRM_PROC_PRINT("a dev pid uid magic ioctls\n\n");
440 for (priv = dev->file_first; priv; priv = priv->next) { 449 for (priv = dev->file_first; priv; priv = priv->next) {
@@ -442,12 +451,11 @@ static int drm__clients_info(char *buf, char **start, off_t offset,
442 priv->authenticated ? 'y' : 'n', 451 priv->authenticated ? 'y' : 'n',
443 priv->minor, 452 priv->minor,
444 priv->pid, 453 priv->pid,
445 priv->uid, 454 priv->uid, priv->magic, priv->ioctl_count);
446 priv->magic,
447 priv->ioctl_count);
448 } 455 }
449 456
450 if (len > request + offset) return request; 457 if (len > request + offset)
458 return request;
451 *eof = 1; 459 *eof = 1;
452 return len - offset; 460 return len - offset;
453} 461}
@@ -456,10 +464,10 @@ static int drm__clients_info(char *buf, char **start, off_t offset,
456 * Simply calls _clients_info() while holding the drm_device::struct_sem lock. 464 * Simply calls _clients_info() while holding the drm_device::struct_sem lock.
457 */ 465 */
458static int drm_clients_info(char *buf, char **start, off_t offset, 466static int drm_clients_info(char *buf, char **start, off_t offset,
459 int request, int *eof, void *data) 467 int request, int *eof, void *data)
460{ 468{
461 drm_device_t *dev = (drm_device_t *)data; 469 drm_device_t *dev = (drm_device_t *) data;
462 int ret; 470 int ret;
463 471
464 down(&dev->struct_sem); 472 down(&dev->struct_sem);
465 ret = drm__clients_info(buf, start, offset, request, eof, data); 473 ret = drm__clients_info(buf, start, offset, request, eof, data);
@@ -470,14 +478,14 @@ static int drm_clients_info(char *buf, char **start, off_t offset,
470#if DRM_DEBUG_CODE 478#if DRM_DEBUG_CODE
471 479
472static int drm__vma_info(char *buf, char **start, off_t offset, int request, 480static int drm__vma_info(char *buf, char **start, off_t offset, int request,
473 int *eof, void *data) 481 int *eof, void *data)
474{ 482{
475 drm_device_t *dev = (drm_device_t *)data; 483 drm_device_t *dev = (drm_device_t *) data;
476 int len = 0; 484 int len = 0;
477 drm_vma_entry_t *pt; 485 drm_vma_entry_t *pt;
478 struct vm_area_struct *vma; 486 struct vm_area_struct *vma;
479#if defined(__i386__) 487#if defined(__i386__)
480 unsigned int pgprot; 488 unsigned int pgprot;
481#endif 489#endif
482 490
483 if (offset > DRM_PROC_LIMIT) { 491 if (offset > DRM_PROC_LIMIT) {
@@ -486,51 +494,53 @@ static int drm__vma_info(char *buf, char **start, off_t offset, int request,
486 } 494 }
487 495
488 *start = &buf[offset]; 496 *start = &buf[offset];
489 *eof = 0; 497 *eof = 0;
490 498
491 DRM_PROC_PRINT("vma use count: %d, high_memory = %p, 0x%08lx\n", 499 DRM_PROC_PRINT("vma use count: %d, high_memory = %p, 0x%08lx\n",
492 atomic_read(&dev->vma_count), 500 atomic_read(&dev->vma_count),
493 high_memory, virt_to_phys(high_memory)); 501 high_memory, virt_to_phys(high_memory));
494 for (pt = dev->vmalist; pt; pt = pt->next) { 502 for (pt = dev->vmalist; pt; pt = pt->next) {
495 if (!(vma = pt->vma)) continue; 503 if (!(vma = pt->vma))
504 continue;
496 DRM_PROC_PRINT("\n%5d 0x%08lx-0x%08lx %c%c%c%c%c%c 0x%08lx", 505 DRM_PROC_PRINT("\n%5d 0x%08lx-0x%08lx %c%c%c%c%c%c 0x%08lx",
497 pt->pid, 506 pt->pid,
498 vma->vm_start, 507 vma->vm_start,
499 vma->vm_end, 508 vma->vm_end,
500 vma->vm_flags & VM_READ ? 'r' : '-', 509 vma->vm_flags & VM_READ ? 'r' : '-',
501 vma->vm_flags & VM_WRITE ? 'w' : '-', 510 vma->vm_flags & VM_WRITE ? 'w' : '-',
502 vma->vm_flags & VM_EXEC ? 'x' : '-', 511 vma->vm_flags & VM_EXEC ? 'x' : '-',
503 vma->vm_flags & VM_MAYSHARE ? 's' : 'p', 512 vma->vm_flags & VM_MAYSHARE ? 's' : 'p',
504 vma->vm_flags & VM_LOCKED ? 'l' : '-', 513 vma->vm_flags & VM_LOCKED ? 'l' : '-',
505 vma->vm_flags & VM_IO ? 'i' : '-', 514 vma->vm_flags & VM_IO ? 'i' : '-',
506 VM_OFFSET(vma)); 515 VM_OFFSET(vma));
507 516
508#if defined(__i386__) 517#if defined(__i386__)
509 pgprot = pgprot_val(vma->vm_page_prot); 518 pgprot = pgprot_val(vma->vm_page_prot);
510 DRM_PROC_PRINT(" %c%c%c%c%c%c%c%c%c", 519 DRM_PROC_PRINT(" %c%c%c%c%c%c%c%c%c",
511 pgprot & _PAGE_PRESENT ? 'p' : '-', 520 pgprot & _PAGE_PRESENT ? 'p' : '-',
512 pgprot & _PAGE_RW ? 'w' : 'r', 521 pgprot & _PAGE_RW ? 'w' : 'r',
513 pgprot & _PAGE_USER ? 'u' : 's', 522 pgprot & _PAGE_USER ? 'u' : 's',
514 pgprot & _PAGE_PWT ? 't' : 'b', 523 pgprot & _PAGE_PWT ? 't' : 'b',
515 pgprot & _PAGE_PCD ? 'u' : 'c', 524 pgprot & _PAGE_PCD ? 'u' : 'c',
516 pgprot & _PAGE_ACCESSED ? 'a' : '-', 525 pgprot & _PAGE_ACCESSED ? 'a' : '-',
517 pgprot & _PAGE_DIRTY ? 'd' : '-', 526 pgprot & _PAGE_DIRTY ? 'd' : '-',
518 pgprot & _PAGE_PSE ? 'm' : 'k', 527 pgprot & _PAGE_PSE ? 'm' : 'k',
519 pgprot & _PAGE_GLOBAL ? 'g' : 'l' ); 528 pgprot & _PAGE_GLOBAL ? 'g' : 'l');
520#endif 529#endif
521 DRM_PROC_PRINT("\n"); 530 DRM_PROC_PRINT("\n");
522 } 531 }
523 532
524 if (len > request + offset) return request; 533 if (len > request + offset)
534 return request;
525 *eof = 1; 535 *eof = 1;
526 return len - offset; 536 return len - offset;
527} 537}
528 538
529static int drm_vma_info(char *buf, char **start, off_t offset, int request, 539static int drm_vma_info(char *buf, char **start, off_t offset, int request,
530 int *eof, void *data) 540 int *eof, void *data)
531{ 541{
532 drm_device_t *dev = (drm_device_t *)data; 542 drm_device_t *dev = (drm_device_t *) data;
533 int ret; 543 int ret;
534 544
535 down(&dev->struct_sem); 545 down(&dev->struct_sem);
536 ret = drm__vma_info(buf, start, offset, request, eof, data); 546 ret = drm__vma_info(buf, start, offset, request, eof, data);
@@ -538,5 +548,3 @@ static int drm_vma_info(char *buf, char **start, off_t offset, int request,
538 return ret; 548 return ret;
539} 549}
540#endif 550#endif
541
542