/* SPDX-License-Identifier: GPL-2.01*2* Copyright 2022 HabanaLabs, Ltd.3* All Rights Reserved.4*5*/67#ifndef DRM_ACCEL_H_8#define DRM_ACCEL_H_910#include <drm/drm_file.h>1112#define ACCEL_MAJOR 26113#define ACCEL_MAX_MINORS 2561415/**16* DRM_ACCEL_FOPS - Default drm accelerators file operations17*18* This macro provides a shorthand for setting the accelerator file ops in the19* &file_operations structure. If all you need are the default ops, use20* DEFINE_DRM_ACCEL_FOPS instead.21*/22#define DRM_ACCEL_FOPS \23.open = accel_open,\24.release = drm_release,\25.unlocked_ioctl = drm_ioctl,\26.compat_ioctl = drm_compat_ioctl,\27.poll = drm_poll,\28.read = drm_read,\29.llseek = noop_llseek, \30.mmap = drm_gem_mmap, \31.fop_flags = FOP_UNSIGNED_OFFSET3233/**34* DEFINE_DRM_ACCEL_FOPS() - macro to generate file operations for accelerators drivers35* @name: name for the generated structure36*37* This macro autogenerates a suitable &struct file_operations for accelerators based38* drivers, which can be assigned to &drm_driver.fops. Note that this structure39* cannot be shared between drivers, because it contains a reference to the40* current module using THIS_MODULE.41*42* Note that the declaration is already marked as static - if you need a43* non-static version of this you're probably doing it wrong and will break the44* THIS_MODULE reference by accident.45*/46#define DEFINE_DRM_ACCEL_FOPS(name) \47static const struct file_operations name = {\48.owner = THIS_MODULE,\49DRM_ACCEL_FOPS,\50}5152#if IS_ENABLED(CONFIG_DRM_ACCEL)5354extern struct xarray accel_minors_xa;5556void accel_core_exit(void);57int accel_core_init(void);58void accel_set_device_instance_params(struct device *kdev, int index);59int accel_open(struct inode *inode, struct file *filp);60void accel_debugfs_register(struct drm_device *dev);6162#else6364static inline void accel_core_exit(void)65{66}6768static inline int __init accel_core_init(void)69{70/* Return 0 to allow drm_core_init to complete successfully */71return 0;72}7374static inline void accel_set_device_instance_params(struct device *kdev, int index)75{76}7778static inline void accel_debugfs_register(struct drm_device *dev)79{80}8182#endif /* IS_ENABLED(CONFIG_DRM_ACCEL) */8384#endif /* DRM_ACCEL_H_ */858687