xref: /linux/drivers/gpu/drm/nouveau/nouveau_debugfs.c (revision ca55b2fef3a9373fcfc30f82fd26bc7fccbda732)
1 /*
2  * Copyright (C) 2009 Red Hat <bskeggs@redhat.com>
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining
5  * a copy of this software and associated documentation files (the
6  * "Software"), to deal in the Software without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sublicense, and/or sell copies of the Software, and to
9  * permit persons to whom the Software is furnished to do so, subject to
10  * the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the
13  * next paragraph) shall be included in all copies or substantial
14  * portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19  * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
20  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  *
24  */
25 
26 /*
27  * Authors:
28  *  Ben Skeggs <bskeggs@redhat.com>
29  */
30 
31 #include "nouveau_debugfs.h"
32 #include "nouveau_drm.h"
33 
34 static int
35 nouveau_debugfs_vbios_image(struct seq_file *m, void *data)
36 {
37 	struct drm_info_node *node = (struct drm_info_node *) m->private;
38 	struct nouveau_drm *drm = nouveau_drm(node->minor->dev);
39 	int i;
40 
41 	for (i = 0; i < drm->vbios.length; i++)
42 		seq_printf(m, "%c", drm->vbios.data[i]);
43 	return 0;
44 }
45 
46 static struct drm_info_list nouveau_debugfs_list[] = {
47 	{ "vbios.rom", nouveau_debugfs_vbios_image, 0, NULL },
48 };
49 #define NOUVEAU_DEBUGFS_ENTRIES ARRAY_SIZE(nouveau_debugfs_list)
50 
51 int
52 nouveau_debugfs_init(struct drm_minor *minor)
53 {
54 	drm_debugfs_create_files(nouveau_debugfs_list, NOUVEAU_DEBUGFS_ENTRIES,
55 				 minor->debugfs_root, minor);
56 	return 0;
57 }
58 
59 void
60 nouveau_debugfs_takedown(struct drm_minor *minor)
61 {
62 	drm_debugfs_remove_files(nouveau_debugfs_list, NOUVEAU_DEBUGFS_ENTRIES,
63 				 minor);
64 }
65