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