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