18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Internal Header for the Direct Rendering Manager
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas.
58c2ecf20Sopenharmony_ci * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
68c2ecf20Sopenharmony_ci * Copyright (c) 2009-2010, Code Aurora Forum.
78c2ecf20Sopenharmony_ci * All rights reserved.
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * Author: Rickard E. (Rik) Faith <faith@valinux.com>
108c2ecf20Sopenharmony_ci * Author: Gareth Hughes <gareth@valinux.com>
118c2ecf20Sopenharmony_ci *
128c2ecf20Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
138c2ecf20Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
148c2ecf20Sopenharmony_ci * to deal in the Software without restriction, including without limitation
158c2ecf20Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
168c2ecf20Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
178c2ecf20Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
188c2ecf20Sopenharmony_ci *
198c2ecf20Sopenharmony_ci * The above copyright notice and this permission notice (including the next
208c2ecf20Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the
218c2ecf20Sopenharmony_ci * Software.
228c2ecf20Sopenharmony_ci *
238c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
248c2ecf20Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
258c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
268c2ecf20Sopenharmony_ci * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
278c2ecf20Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
288c2ecf20Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
298c2ecf20Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE.
308c2ecf20Sopenharmony_ci */
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#ifndef _DRM_DEBUGFS_H_
338c2ecf20Sopenharmony_ci#define _DRM_DEBUGFS_H_
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#include <linux/types.h>
368c2ecf20Sopenharmony_ci#include <linux/seq_file.h>
378c2ecf20Sopenharmony_ci/**
388c2ecf20Sopenharmony_ci * struct drm_info_list - debugfs info list entry
398c2ecf20Sopenharmony_ci *
408c2ecf20Sopenharmony_ci * This structure represents a debugfs file to be created by the drm
418c2ecf20Sopenharmony_ci * core.
428c2ecf20Sopenharmony_ci */
438c2ecf20Sopenharmony_cistruct drm_info_list {
448c2ecf20Sopenharmony_ci	/** @name: file name */
458c2ecf20Sopenharmony_ci	const char *name;
468c2ecf20Sopenharmony_ci	/**
478c2ecf20Sopenharmony_ci	 * @show:
488c2ecf20Sopenharmony_ci	 *
498c2ecf20Sopenharmony_ci	 * Show callback. &seq_file->private will be set to the &struct
508c2ecf20Sopenharmony_ci	 * drm_info_node corresponding to the instance of this info on a given
518c2ecf20Sopenharmony_ci	 * &struct drm_minor.
528c2ecf20Sopenharmony_ci	 */
538c2ecf20Sopenharmony_ci	int (*show)(struct seq_file*, void*);
548c2ecf20Sopenharmony_ci	/** @driver_features: Required driver features for this entry */
558c2ecf20Sopenharmony_ci	u32 driver_features;
568c2ecf20Sopenharmony_ci	/** @data: Driver-private data, should not be device-specific. */
578c2ecf20Sopenharmony_ci	void *data;
588c2ecf20Sopenharmony_ci};
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci/**
618c2ecf20Sopenharmony_ci * struct drm_info_node - Per-minor debugfs node structure
628c2ecf20Sopenharmony_ci *
638c2ecf20Sopenharmony_ci * This structure represents a debugfs file, as an instantiation of a &struct
648c2ecf20Sopenharmony_ci * drm_info_list on a &struct drm_minor.
658c2ecf20Sopenharmony_ci *
668c2ecf20Sopenharmony_ci * FIXME:
678c2ecf20Sopenharmony_ci *
688c2ecf20Sopenharmony_ci * No it doesn't make a hole lot of sense that we duplicate debugfs entries for
698c2ecf20Sopenharmony_ci * both the render and the primary nodes, but that's how this has organically
708c2ecf20Sopenharmony_ci * grown. It should probably be fixed, with a compatibility link, if needed.
718c2ecf20Sopenharmony_ci */
728c2ecf20Sopenharmony_cistruct drm_info_node {
738c2ecf20Sopenharmony_ci	/** @minor: &struct drm_minor for this node. */
748c2ecf20Sopenharmony_ci	struct drm_minor *minor;
758c2ecf20Sopenharmony_ci	/** @info_ent: template for this node. */
768c2ecf20Sopenharmony_ci	const struct drm_info_list *info_ent;
778c2ecf20Sopenharmony_ci	/* private: */
788c2ecf20Sopenharmony_ci	struct list_head list;
798c2ecf20Sopenharmony_ci	struct dentry *dent;
808c2ecf20Sopenharmony_ci};
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci#if defined(CONFIG_DEBUG_FS)
838c2ecf20Sopenharmony_civoid drm_debugfs_create_files(const struct drm_info_list *files,
848c2ecf20Sopenharmony_ci			      int count, struct dentry *root,
858c2ecf20Sopenharmony_ci			      struct drm_minor *minor);
868c2ecf20Sopenharmony_ciint drm_debugfs_remove_files(const struct drm_info_list *files,
878c2ecf20Sopenharmony_ci			     int count, struct drm_minor *minor);
888c2ecf20Sopenharmony_ci#else
898c2ecf20Sopenharmony_cistatic inline void drm_debugfs_create_files(const struct drm_info_list *files,
908c2ecf20Sopenharmony_ci					    int count, struct dentry *root,
918c2ecf20Sopenharmony_ci					    struct drm_minor *minor)
928c2ecf20Sopenharmony_ci{}
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_cistatic inline int drm_debugfs_remove_files(const struct drm_info_list *files,
958c2ecf20Sopenharmony_ci					   int count, struct drm_minor *minor)
968c2ecf20Sopenharmony_ci{
978c2ecf20Sopenharmony_ci	return 0;
988c2ecf20Sopenharmony_ci}
998c2ecf20Sopenharmony_ci#endif
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci#endif /* _DRM_DEBUGFS_H_ */
102