blob: ac0f75df1ac9cc0f45ec02d5dca2dc06c7718e56 [file] [log] [blame]
Daniel Vetter48344422017-03-22 21:53:36 +01001/*
2 * Internal Header for the Direct Rendering Manager
3 *
4 * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
5 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
6 * Copyright (c) 2009-2010, Code Aurora Forum.
7 * All rights reserved.
8 *
9 * Author: Rickard E. (Rik) Faith <faith@valinux.com>
10 * Author: Gareth Hughes <gareth@valinux.com>
11 *
12 * Permission is hereby granted, free of charge, to any person obtaining a
13 * copy of this software and associated documentation files (the "Software"),
14 * to deal in the Software without restriction, including without limitation
15 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16 * and/or sell copies of the Software, and to permit persons to whom the
17 * Software is furnished to do so, subject to the following conditions:
18 *
19 * The above copyright notice and this permission notice (including the next
20 * paragraph) shall be included in all copies or substantial portions of the
21 * Software.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
27 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
28 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
29 * OTHER DEALINGS IN THE SOFTWARE.
30 */
31
32#ifndef _DRM_DEBUGFS_H_
33#define _DRM_DEBUGFS_H_
34
35/**
Daniel Vetter0cad7f72017-03-22 21:54:01 +010036 * struct drm_info_list - debugfs info list entry
37 *
38 * This structure represents a debugfs file to be created by the drm
39 * core.
Daniel Vetter48344422017-03-22 21:53:36 +010040 */
41struct drm_info_list {
Daniel Vetter0cad7f72017-03-22 21:54:01 +010042 /** @name: file name */
43 const char *name;
44 /**
45 * @show:
46 *
47 * Show callback. &seq_file->private will be set to the &struct
48 * drm_info_node corresponding to the instance of this info on a given
49 * &struct drm_minor.
50 */
51 int (*show)(struct seq_file*, void*);
52 /** @driver_features: Required driver features for this entry */
53 u32 driver_features;
54 /** @data: Driver-private data, should not be device-specific. */
Daniel Vetter48344422017-03-22 21:53:36 +010055 void *data;
56};
57
58/**
Daniel Vetter0cad7f72017-03-22 21:54:01 +010059 * struct drm_info_node - Per-minor debugfs node structure
60 *
61 * This structure represents a debugfs file, as an instantiation of a &struct
62 * drm_info_list on a &struct drm_minor.
63 *
64 * FIXME:
65 *
66 * No it doesn't make a hole lot of sense that we duplicate debugfs entries for
67 * both the render and the primary nodes, but that's how this has organically
68 * grown. It should probably be fixed, with a compatibility link, if needed.
Daniel Vetter48344422017-03-22 21:53:36 +010069 */
70struct drm_info_node {
Daniel Vetter0cad7f72017-03-22 21:54:01 +010071 /** @minor: &struct drm_minor for this node. */
Daniel Vetter48344422017-03-22 21:53:36 +010072 struct drm_minor *minor;
Daniel Vetter0cad7f72017-03-22 21:54:01 +010073 /** @info_ent: template for this node. */
Daniel Vetter48344422017-03-22 21:53:36 +010074 const struct drm_info_list *info_ent;
Daniel Vetter0cad7f72017-03-22 21:54:01 +010075 /* private: */
76 struct list_head list;
Daniel Vetter48344422017-03-22 21:53:36 +010077 struct dentry *dent;
78};
79
80#if defined(CONFIG_DEBUG_FS)
81int drm_debugfs_create_files(const struct drm_info_list *files,
82 int count, struct dentry *root,
83 struct drm_minor *minor);
84int drm_debugfs_remove_files(const struct drm_info_list *files,
85 int count, struct drm_minor *minor);
86#else
87static inline int drm_debugfs_create_files(const struct drm_info_list *files,
88 int count, struct dentry *root,
89 struct drm_minor *minor)
90{
91 return 0;
92}
93
94static inline int drm_debugfs_remove_files(const struct drm_info_list *files,
95 int count, struct drm_minor *minor)
96{
97 return 0;
98}
99#endif
100
101#endif /* _DRM_DEBUGFS_H_ */