/*1* Internal Header for the Direct Rendering Manager2*3* Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.4* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.5* Copyright (c) 2009-2010, Code Aurora Forum.6* All rights reserved.7*8* Author: Rickard E. (Rik) Faith <[email protected]>9* Author: Gareth Hughes <[email protected]>10*11* Permission is hereby granted, free of charge, to any person obtaining a12* copy of this software and associated documentation files (the "Software"),13* to deal in the Software without restriction, including without limitation14* the rights to use, copy, modify, merge, publish, distribute, sublicense,15* and/or sell copies of the Software, and to permit persons to whom the16* Software is furnished to do so, subject to the following conditions:17*18* The above copyright notice and this permission notice (including the next19* paragraph) shall be included in all copies or substantial portions of the20* Software.21*22* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR23* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,24* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL25* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR26* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,27* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR28* OTHER DEALINGS IN THE SOFTWARE.29*/3031#ifndef _DRM_DEBUGFS_H_32#define _DRM_DEBUGFS_H_3334#include <linux/types.h>35#include <linux/seq_file.h>3637#include <drm/drm_gpuvm.h>3839/**40* DRM_DEBUGFS_GPUVA_INFO - &drm_info_list entry to dump a GPU VA space41* @show: the &drm_info_list's show callback42* @data: driver private data43*44* Drivers should use this macro to define a &drm_info_list entry to provide a45* debugfs file for dumping the GPU VA space regions and mappings.46*47* For each DRM GPU VA space drivers should call drm_debugfs_gpuva_info() from48* their @show callback.49*/50#define DRM_DEBUGFS_GPUVA_INFO(show, data) {"gpuvas", show, DRIVER_GEM_GPUVA, data}5152/**53* struct drm_info_list - debugfs info list entry54*55* This structure represents a debugfs file to be created by the drm56* core.57*/58struct drm_info_list {59/** @name: file name */60const char *name;61/**62* @show:63*64* Show callback. &seq_file->private will be set to the &struct65* drm_info_node corresponding to the instance of this info on a given66* &struct drm_minor.67*/68int (*show)(struct seq_file*, void*);69/** @driver_features: Required driver features for this entry */70u32 driver_features;71/** @data: Driver-private data, should not be device-specific. */72void *data;73};7475/**76* struct drm_info_node - Per-minor debugfs node structure77*78* This structure represents a debugfs file, as an instantiation of a &struct79* drm_info_list on a &struct drm_minor.80*81* FIXME:82*83* No it doesn't make a hole lot of sense that we duplicate debugfs entries for84* both the render and the primary nodes, but that's how this has organically85* grown. It should probably be fixed, with a compatibility link, if needed.86*/87struct drm_info_node {88/** @minor: &struct drm_minor for this node. */89struct drm_minor *minor;90/** @info_ent: template for this node. */91const struct drm_info_list *info_ent;92/* private: */93struct list_head list;94struct dentry *dent;95};9697/**98* struct drm_debugfs_info - debugfs info list entry99*100* This structure represents a debugfs file to be created by the drm101* core.102*/103struct drm_debugfs_info {104/** @name: File name */105const char *name;106107/**108* @show:109*110* Show callback. &seq_file->private will be set to the &struct111* drm_debugfs_entry corresponding to the instance of this info112* on a given &struct drm_device.113*/114int (*show)(struct seq_file*, void*);115116/** @driver_features: Required driver features for this entry. */117u32 driver_features;118119/** @data: Driver-private data, should not be device-specific. */120void *data;121};122123/**124* struct drm_debugfs_entry - Per-device debugfs node structure125*126* This structure represents a debugfs file, as an instantiation of a &struct127* drm_debugfs_info on a &struct drm_device.128*/129struct drm_debugfs_entry {130/** @dev: &struct drm_device for this node. */131struct drm_device *dev;132133/** @file: Template for this node. */134struct drm_debugfs_info file;135136/** @list: Linked list of all device nodes. */137struct list_head list;138};139140#if defined(CONFIG_DEBUG_FS)141void drm_debugfs_create_files(const struct drm_info_list *files,142int count, struct dentry *root,143struct drm_minor *minor);144int drm_debugfs_remove_files(const struct drm_info_list *files, int count,145struct dentry *root, struct drm_minor *minor);146147void drm_debugfs_add_file(struct drm_device *dev, const char *name,148int (*show)(struct seq_file*, void*), void *data);149150void drm_debugfs_add_files(struct drm_device *dev,151const struct drm_debugfs_info *files, int count);152153int drm_debugfs_gpuva_info(struct seq_file *m,154struct drm_gpuvm *gpuvm);155156void drm_debugfs_clients_add(struct drm_file *file);157void drm_debugfs_clients_remove(struct drm_file *file);158#else159static inline void drm_debugfs_create_files(const struct drm_info_list *files,160int count, struct dentry *root,161struct drm_minor *minor)162{}163164static inline int drm_debugfs_remove_files(const struct drm_info_list *files,165int count, struct dentry *root,166struct drm_minor *minor)167{168return 0;169}170171static inline void drm_debugfs_add_file(struct drm_device *dev, const char *name,172int (*show)(struct seq_file*, void*),173void *data)174{}175176static inline void drm_debugfs_add_files(struct drm_device *dev,177const struct drm_debugfs_info *files,178int count)179{}180181static inline int drm_debugfs_gpuva_info(struct seq_file *m,182struct drm_gpuvm *gpuvm)183{184return 0;185}186187static inline void drm_debugfs_clients_add(struct drm_file *file)188{189}190191static inline void drm_debugfs_clients_remove(struct drm_file *file)192{193}194#endif195196#endif /* _DRM_DEBUGFS_H_ */197198199