18c2ecf20Sopenharmony_ci#ifndef _DRM_DEVICE_H_
28c2ecf20Sopenharmony_ci#define _DRM_DEVICE_H_
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci#include <linux/list.h>
58c2ecf20Sopenharmony_ci#include <linux/kref.h>
68c2ecf20Sopenharmony_ci#include <linux/mutex.h>
78c2ecf20Sopenharmony_ci#include <linux/idr.h>
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include <drm/drm_hashtab.h>
108c2ecf20Sopenharmony_ci#include <drm/drm_mode_config.h>
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_cistruct drm_driver;
138c2ecf20Sopenharmony_cistruct drm_minor;
148c2ecf20Sopenharmony_cistruct drm_master;
158c2ecf20Sopenharmony_cistruct drm_device_dma;
168c2ecf20Sopenharmony_cistruct drm_vblank_crtc;
178c2ecf20Sopenharmony_cistruct drm_sg_mem;
188c2ecf20Sopenharmony_cistruct drm_local_map;
198c2ecf20Sopenharmony_cistruct drm_vma_offset_manager;
208c2ecf20Sopenharmony_cistruct drm_vram_mm;
218c2ecf20Sopenharmony_cistruct drm_fb_helper;
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_cistruct inode;
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_cistruct pci_dev;
268c2ecf20Sopenharmony_cistruct pci_controller;
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci/**
308c2ecf20Sopenharmony_ci * enum drm_switch_power - power state of drm device
318c2ecf20Sopenharmony_ci */
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_cienum switch_power_state {
348c2ecf20Sopenharmony_ci	/** @DRM_SWITCH_POWER_ON: Power state is ON */
358c2ecf20Sopenharmony_ci	DRM_SWITCH_POWER_ON = 0,
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci	/** @DRM_SWITCH_POWER_OFF: Power state is OFF */
388c2ecf20Sopenharmony_ci	DRM_SWITCH_POWER_OFF = 1,
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci	/** @DRM_SWITCH_POWER_CHANGING: Power state is changing */
418c2ecf20Sopenharmony_ci	DRM_SWITCH_POWER_CHANGING = 2,
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci	/** @DRM_SWITCH_POWER_DYNAMIC_OFF: Suspended */
448c2ecf20Sopenharmony_ci	DRM_SWITCH_POWER_DYNAMIC_OFF = 3,
458c2ecf20Sopenharmony_ci};
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci/**
488c2ecf20Sopenharmony_ci * struct drm_device - DRM device structure
498c2ecf20Sopenharmony_ci *
508c2ecf20Sopenharmony_ci * This structure represent a complete card that
518c2ecf20Sopenharmony_ci * may contain multiple heads.
528c2ecf20Sopenharmony_ci */
538c2ecf20Sopenharmony_cistruct drm_device {
548c2ecf20Sopenharmony_ci	/**
558c2ecf20Sopenharmony_ci	 * @legacy_dev_list:
568c2ecf20Sopenharmony_ci	 *
578c2ecf20Sopenharmony_ci	 * List of devices per driver for stealth attach cleanup
588c2ecf20Sopenharmony_ci	 */
598c2ecf20Sopenharmony_ci	struct list_head legacy_dev_list;
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci	/** @if_version: Highest interface version set */
628c2ecf20Sopenharmony_ci	int if_version;
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci	/** @ref: Object ref-count */
658c2ecf20Sopenharmony_ci	struct kref ref;
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci	/** @dev: Device structure of bus-device */
688c2ecf20Sopenharmony_ci	struct device *dev;
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci	/**
718c2ecf20Sopenharmony_ci	 * @managed:
728c2ecf20Sopenharmony_ci	 *
738c2ecf20Sopenharmony_ci	 * Managed resources linked to the lifetime of this &drm_device as
748c2ecf20Sopenharmony_ci	 * tracked by @ref.
758c2ecf20Sopenharmony_ci	 */
768c2ecf20Sopenharmony_ci	struct {
778c2ecf20Sopenharmony_ci		/** @managed.resources: managed resources list */
788c2ecf20Sopenharmony_ci		struct list_head resources;
798c2ecf20Sopenharmony_ci		/** @managed.final_kfree: pointer for final kfree() call */
808c2ecf20Sopenharmony_ci		void *final_kfree;
818c2ecf20Sopenharmony_ci		/** @managed.lock: protects @managed.resources */
828c2ecf20Sopenharmony_ci		spinlock_t lock;
838c2ecf20Sopenharmony_ci	} managed;
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci	/** @driver: DRM driver managing the device */
868c2ecf20Sopenharmony_ci	struct drm_driver *driver;
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci	/**
898c2ecf20Sopenharmony_ci	 * @dev_private:
908c2ecf20Sopenharmony_ci	 *
918c2ecf20Sopenharmony_ci	 * DRM driver private data. This is deprecated and should be left set to
928c2ecf20Sopenharmony_ci	 * NULL.
938c2ecf20Sopenharmony_ci	 *
948c2ecf20Sopenharmony_ci	 * Instead of using this pointer it is recommended that drivers use
958c2ecf20Sopenharmony_ci	 * devm_drm_dev_alloc() and embed struct &drm_device in their larger
968c2ecf20Sopenharmony_ci	 * per-device structure.
978c2ecf20Sopenharmony_ci	 */
988c2ecf20Sopenharmony_ci	void *dev_private;
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ci	/** @primary: Primary node */
1018c2ecf20Sopenharmony_ci	struct drm_minor *primary;
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci	/** @render: Render node */
1048c2ecf20Sopenharmony_ci	struct drm_minor *render;
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci	/**
1078c2ecf20Sopenharmony_ci	 * @registered:
1088c2ecf20Sopenharmony_ci	 *
1098c2ecf20Sopenharmony_ci	 * Internally used by drm_dev_register() and drm_connector_register().
1108c2ecf20Sopenharmony_ci	 */
1118c2ecf20Sopenharmony_ci	bool registered;
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci	/**
1148c2ecf20Sopenharmony_ci	 * @master:
1158c2ecf20Sopenharmony_ci	 *
1168c2ecf20Sopenharmony_ci	 * Currently active master for this device.
1178c2ecf20Sopenharmony_ci	 * Protected by &master_mutex
1188c2ecf20Sopenharmony_ci	 */
1198c2ecf20Sopenharmony_ci	struct drm_master *master;
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci	/**
1228c2ecf20Sopenharmony_ci	 * @driver_features: per-device driver features
1238c2ecf20Sopenharmony_ci	 *
1248c2ecf20Sopenharmony_ci	 * Drivers can clear specific flags here to disallow
1258c2ecf20Sopenharmony_ci	 * certain features on a per-device basis while still
1268c2ecf20Sopenharmony_ci	 * sharing a single &struct drm_driver instance across
1278c2ecf20Sopenharmony_ci	 * all devices.
1288c2ecf20Sopenharmony_ci	 */
1298c2ecf20Sopenharmony_ci	u32 driver_features;
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ci	/**
1328c2ecf20Sopenharmony_ci	 * @unplugged:
1338c2ecf20Sopenharmony_ci	 *
1348c2ecf20Sopenharmony_ci	 * Flag to tell if the device has been unplugged.
1358c2ecf20Sopenharmony_ci	 * See drm_dev_enter() and drm_dev_is_unplugged().
1368c2ecf20Sopenharmony_ci	 */
1378c2ecf20Sopenharmony_ci	bool unplugged;
1388c2ecf20Sopenharmony_ci
1398c2ecf20Sopenharmony_ci	/** @anon_inode: inode for private address-space */
1408c2ecf20Sopenharmony_ci	struct inode *anon_inode;
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci	/** @unique: Unique name of the device */
1438c2ecf20Sopenharmony_ci	char *unique;
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci	/**
1468c2ecf20Sopenharmony_ci	 * @struct_mutex:
1478c2ecf20Sopenharmony_ci	 *
1488c2ecf20Sopenharmony_ci	 * Lock for others (not &drm_minor.master and &drm_file.is_master)
1498c2ecf20Sopenharmony_ci	 *
1508c2ecf20Sopenharmony_ci	 * WARNING:
1518c2ecf20Sopenharmony_ci	 * Only drivers annotated with DRIVER_LEGACY should be using this.
1528c2ecf20Sopenharmony_ci	 */
1538c2ecf20Sopenharmony_ci	struct mutex struct_mutex;
1548c2ecf20Sopenharmony_ci
1558c2ecf20Sopenharmony_ci	/**
1568c2ecf20Sopenharmony_ci	 * @master_mutex:
1578c2ecf20Sopenharmony_ci	 *
1588c2ecf20Sopenharmony_ci	 * Lock for &drm_minor.master and &drm_file.is_master
1598c2ecf20Sopenharmony_ci	 */
1608c2ecf20Sopenharmony_ci	struct mutex master_mutex;
1618c2ecf20Sopenharmony_ci
1628c2ecf20Sopenharmony_ci	/**
1638c2ecf20Sopenharmony_ci	 * @open_count:
1648c2ecf20Sopenharmony_ci	 *
1658c2ecf20Sopenharmony_ci	 * Usage counter for outstanding files open,
1668c2ecf20Sopenharmony_ci	 * protected by drm_global_mutex
1678c2ecf20Sopenharmony_ci	 */
1688c2ecf20Sopenharmony_ci	atomic_t open_count;
1698c2ecf20Sopenharmony_ci
1708c2ecf20Sopenharmony_ci	/** @filelist_mutex: Protects @filelist. */
1718c2ecf20Sopenharmony_ci	struct mutex filelist_mutex;
1728c2ecf20Sopenharmony_ci	/**
1738c2ecf20Sopenharmony_ci	 * @filelist:
1748c2ecf20Sopenharmony_ci	 *
1758c2ecf20Sopenharmony_ci	 * List of userspace clients, linked through &drm_file.lhead.
1768c2ecf20Sopenharmony_ci	 */
1778c2ecf20Sopenharmony_ci	struct list_head filelist;
1788c2ecf20Sopenharmony_ci
1798c2ecf20Sopenharmony_ci	/**
1808c2ecf20Sopenharmony_ci	 * @filelist_internal:
1818c2ecf20Sopenharmony_ci	 *
1828c2ecf20Sopenharmony_ci	 * List of open DRM files for in-kernel clients.
1838c2ecf20Sopenharmony_ci	 * Protected by &filelist_mutex.
1848c2ecf20Sopenharmony_ci	 */
1858c2ecf20Sopenharmony_ci	struct list_head filelist_internal;
1868c2ecf20Sopenharmony_ci
1878c2ecf20Sopenharmony_ci	/**
1888c2ecf20Sopenharmony_ci	 * @clientlist_mutex:
1898c2ecf20Sopenharmony_ci	 *
1908c2ecf20Sopenharmony_ci	 * Protects &clientlist access.
1918c2ecf20Sopenharmony_ci	 */
1928c2ecf20Sopenharmony_ci	struct mutex clientlist_mutex;
1938c2ecf20Sopenharmony_ci
1948c2ecf20Sopenharmony_ci	/**
1958c2ecf20Sopenharmony_ci	 * @clientlist:
1968c2ecf20Sopenharmony_ci	 *
1978c2ecf20Sopenharmony_ci	 * List of in-kernel clients. Protected by &clientlist_mutex.
1988c2ecf20Sopenharmony_ci	 */
1998c2ecf20Sopenharmony_ci	struct list_head clientlist;
2008c2ecf20Sopenharmony_ci
2018c2ecf20Sopenharmony_ci	/**
2028c2ecf20Sopenharmony_ci	 * @irq_enabled:
2038c2ecf20Sopenharmony_ci	 *
2048c2ecf20Sopenharmony_ci	 * Indicates that interrupt handling is enabled, specifically vblank
2058c2ecf20Sopenharmony_ci	 * handling. Drivers which don't use drm_irq_install() need to set this
2068c2ecf20Sopenharmony_ci	 * to true manually.
2078c2ecf20Sopenharmony_ci	 */
2088c2ecf20Sopenharmony_ci	bool irq_enabled;
2098c2ecf20Sopenharmony_ci
2108c2ecf20Sopenharmony_ci	/**
2118c2ecf20Sopenharmony_ci	 * @irq: Used by the drm_irq_install() and drm_irq_unistall() helpers.
2128c2ecf20Sopenharmony_ci	 */
2138c2ecf20Sopenharmony_ci	int irq;
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_ci	/**
2168c2ecf20Sopenharmony_ci	 * @vblank_disable_immediate:
2178c2ecf20Sopenharmony_ci	 *
2188c2ecf20Sopenharmony_ci	 * If true, vblank interrupt will be disabled immediately when the
2198c2ecf20Sopenharmony_ci	 * refcount drops to zero, as opposed to via the vblank disable
2208c2ecf20Sopenharmony_ci	 * timer.
2218c2ecf20Sopenharmony_ci	 *
2228c2ecf20Sopenharmony_ci	 * This can be set to true it the hardware has a working vblank counter
2238c2ecf20Sopenharmony_ci	 * with high-precision timestamping (otherwise there are races) and the
2248c2ecf20Sopenharmony_ci	 * driver uses drm_crtc_vblank_on() and drm_crtc_vblank_off()
2258c2ecf20Sopenharmony_ci	 * appropriately. See also @max_vblank_count and
2268c2ecf20Sopenharmony_ci	 * &drm_crtc_funcs.get_vblank_counter.
2278c2ecf20Sopenharmony_ci	 */
2288c2ecf20Sopenharmony_ci	bool vblank_disable_immediate;
2298c2ecf20Sopenharmony_ci
2308c2ecf20Sopenharmony_ci	/**
2318c2ecf20Sopenharmony_ci	 * @vblank:
2328c2ecf20Sopenharmony_ci	 *
2338c2ecf20Sopenharmony_ci	 * Array of vblank tracking structures, one per &struct drm_crtc. For
2348c2ecf20Sopenharmony_ci	 * historical reasons (vblank support predates kernel modesetting) this
2358c2ecf20Sopenharmony_ci	 * is free-standing and not part of &struct drm_crtc itself. It must be
2368c2ecf20Sopenharmony_ci	 * initialized explicitly by calling drm_vblank_init().
2378c2ecf20Sopenharmony_ci	 */
2388c2ecf20Sopenharmony_ci	struct drm_vblank_crtc *vblank;
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_ci	/**
2418c2ecf20Sopenharmony_ci	 * @vblank_time_lock:
2428c2ecf20Sopenharmony_ci	 *
2438c2ecf20Sopenharmony_ci	 *  Protects vblank count and time updates during vblank enable/disable
2448c2ecf20Sopenharmony_ci	 */
2458c2ecf20Sopenharmony_ci	spinlock_t vblank_time_lock;
2468c2ecf20Sopenharmony_ci	/**
2478c2ecf20Sopenharmony_ci	 * @vbl_lock: Top-level vblank references lock, wraps the low-level
2488c2ecf20Sopenharmony_ci	 * @vblank_time_lock.
2498c2ecf20Sopenharmony_ci	 */
2508c2ecf20Sopenharmony_ci	spinlock_t vbl_lock;
2518c2ecf20Sopenharmony_ci
2528c2ecf20Sopenharmony_ci	/**
2538c2ecf20Sopenharmony_ci	 * @max_vblank_count:
2548c2ecf20Sopenharmony_ci	 *
2558c2ecf20Sopenharmony_ci	 * Maximum value of the vblank registers. This value +1 will result in a
2568c2ecf20Sopenharmony_ci	 * wrap-around of the vblank register. It is used by the vblank core to
2578c2ecf20Sopenharmony_ci	 * handle wrap-arounds.
2588c2ecf20Sopenharmony_ci	 *
2598c2ecf20Sopenharmony_ci	 * If set to zero the vblank core will try to guess the elapsed vblanks
2608c2ecf20Sopenharmony_ci	 * between times when the vblank interrupt is disabled through
2618c2ecf20Sopenharmony_ci	 * high-precision timestamps. That approach is suffering from small
2628c2ecf20Sopenharmony_ci	 * races and imprecision over longer time periods, hence exposing a
2638c2ecf20Sopenharmony_ci	 * hardware vblank counter is always recommended.
2648c2ecf20Sopenharmony_ci	 *
2658c2ecf20Sopenharmony_ci	 * This is the statically configured device wide maximum. The driver
2668c2ecf20Sopenharmony_ci	 * can instead choose to use a runtime configurable per-crtc value
2678c2ecf20Sopenharmony_ci	 * &drm_vblank_crtc.max_vblank_count, in which case @max_vblank_count
2688c2ecf20Sopenharmony_ci	 * must be left at zero. See drm_crtc_set_max_vblank_count() on how
2698c2ecf20Sopenharmony_ci	 * to use the per-crtc value.
2708c2ecf20Sopenharmony_ci	 *
2718c2ecf20Sopenharmony_ci	 * If non-zero, &drm_crtc_funcs.get_vblank_counter must be set.
2728c2ecf20Sopenharmony_ci	 */
2738c2ecf20Sopenharmony_ci	u32 max_vblank_count;
2748c2ecf20Sopenharmony_ci
2758c2ecf20Sopenharmony_ci	/** @vblank_event_list: List of vblank events */
2768c2ecf20Sopenharmony_ci	struct list_head vblank_event_list;
2778c2ecf20Sopenharmony_ci
2788c2ecf20Sopenharmony_ci	/**
2798c2ecf20Sopenharmony_ci	 * @event_lock:
2808c2ecf20Sopenharmony_ci	 *
2818c2ecf20Sopenharmony_ci	 * Protects @vblank_event_list and event delivery in
2828c2ecf20Sopenharmony_ci	 * general. See drm_send_event() and drm_send_event_locked().
2838c2ecf20Sopenharmony_ci	 */
2848c2ecf20Sopenharmony_ci	spinlock_t event_lock;
2858c2ecf20Sopenharmony_ci
2868c2ecf20Sopenharmony_ci	/** @agp: AGP data */
2878c2ecf20Sopenharmony_ci	struct drm_agp_head *agp;
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_ci	/** @pdev: PCI device structure */
2908c2ecf20Sopenharmony_ci	struct pci_dev *pdev;
2918c2ecf20Sopenharmony_ci
2928c2ecf20Sopenharmony_ci#ifdef __alpha__
2938c2ecf20Sopenharmony_ci	/** @hose: PCI hose, only used on ALPHA platforms. */
2948c2ecf20Sopenharmony_ci	struct pci_controller *hose;
2958c2ecf20Sopenharmony_ci#endif
2968c2ecf20Sopenharmony_ci	/** @num_crtcs: Number of CRTCs on this device */
2978c2ecf20Sopenharmony_ci	unsigned int num_crtcs;
2988c2ecf20Sopenharmony_ci
2998c2ecf20Sopenharmony_ci	/** @mode_config: Current mode config */
3008c2ecf20Sopenharmony_ci	struct drm_mode_config mode_config;
3018c2ecf20Sopenharmony_ci
3028c2ecf20Sopenharmony_ci	/** @object_name_lock: GEM information */
3038c2ecf20Sopenharmony_ci	struct mutex object_name_lock;
3048c2ecf20Sopenharmony_ci
3058c2ecf20Sopenharmony_ci	/** @object_name_idr: GEM information */
3068c2ecf20Sopenharmony_ci	struct idr object_name_idr;
3078c2ecf20Sopenharmony_ci
3088c2ecf20Sopenharmony_ci	/** @vma_offset_manager: GEM information */
3098c2ecf20Sopenharmony_ci	struct drm_vma_offset_manager *vma_offset_manager;
3108c2ecf20Sopenharmony_ci
3118c2ecf20Sopenharmony_ci	/** @vram_mm: VRAM MM memory manager */
3128c2ecf20Sopenharmony_ci	struct drm_vram_mm *vram_mm;
3138c2ecf20Sopenharmony_ci
3148c2ecf20Sopenharmony_ci	/**
3158c2ecf20Sopenharmony_ci	 * @switch_power_state:
3168c2ecf20Sopenharmony_ci	 *
3178c2ecf20Sopenharmony_ci	 * Power state of the client.
3188c2ecf20Sopenharmony_ci	 * Used by drivers supporting the switcheroo driver.
3198c2ecf20Sopenharmony_ci	 * The state is maintained in the
3208c2ecf20Sopenharmony_ci	 * &vga_switcheroo_client_ops.set_gpu_state callback
3218c2ecf20Sopenharmony_ci	 */
3228c2ecf20Sopenharmony_ci	enum switch_power_state switch_power_state;
3238c2ecf20Sopenharmony_ci
3248c2ecf20Sopenharmony_ci	/**
3258c2ecf20Sopenharmony_ci	 * @fb_helper:
3268c2ecf20Sopenharmony_ci	 *
3278c2ecf20Sopenharmony_ci	 * Pointer to the fbdev emulation structure.
3288c2ecf20Sopenharmony_ci	 * Set by drm_fb_helper_init() and cleared by drm_fb_helper_fini().
3298c2ecf20Sopenharmony_ci	 */
3308c2ecf20Sopenharmony_ci	struct drm_fb_helper *fb_helper;
3318c2ecf20Sopenharmony_ci
3328c2ecf20Sopenharmony_ci	/* Everything below here is for legacy driver, never use! */
3338c2ecf20Sopenharmony_ci	/* private: */
3348c2ecf20Sopenharmony_ci#if IS_ENABLED(CONFIG_DRM_LEGACY)
3358c2ecf20Sopenharmony_ci	/* Context handle management - linked list of context handles */
3368c2ecf20Sopenharmony_ci	struct list_head ctxlist;
3378c2ecf20Sopenharmony_ci
3388c2ecf20Sopenharmony_ci	/* Context handle management - mutex for &ctxlist */
3398c2ecf20Sopenharmony_ci	struct mutex ctxlist_mutex;
3408c2ecf20Sopenharmony_ci
3418c2ecf20Sopenharmony_ci	/* Context handle management */
3428c2ecf20Sopenharmony_ci	struct idr ctx_idr;
3438c2ecf20Sopenharmony_ci
3448c2ecf20Sopenharmony_ci	/* Memory management - linked list of regions */
3458c2ecf20Sopenharmony_ci	struct list_head maplist;
3468c2ecf20Sopenharmony_ci
3478c2ecf20Sopenharmony_ci	/* Memory management - user token hash table for maps */
3488c2ecf20Sopenharmony_ci	struct drm_open_hash map_hash;
3498c2ecf20Sopenharmony_ci
3508c2ecf20Sopenharmony_ci	/* Context handle management - list of vmas (for debugging) */
3518c2ecf20Sopenharmony_ci	struct list_head vmalist;
3528c2ecf20Sopenharmony_ci
3538c2ecf20Sopenharmony_ci	/* Optional pointer for DMA support */
3548c2ecf20Sopenharmony_ci	struct drm_device_dma *dma;
3558c2ecf20Sopenharmony_ci
3568c2ecf20Sopenharmony_ci	/* Context swapping flag */
3578c2ecf20Sopenharmony_ci	__volatile__ long context_flag;
3588c2ecf20Sopenharmony_ci
3598c2ecf20Sopenharmony_ci	/* Last current context */
3608c2ecf20Sopenharmony_ci	int last_context;
3618c2ecf20Sopenharmony_ci
3628c2ecf20Sopenharmony_ci	/* Lock for &buf_use and a few other things. */
3638c2ecf20Sopenharmony_ci	spinlock_t buf_lock;
3648c2ecf20Sopenharmony_ci
3658c2ecf20Sopenharmony_ci	/* Usage counter for buffers in use -- cannot alloc */
3668c2ecf20Sopenharmony_ci	int buf_use;
3678c2ecf20Sopenharmony_ci
3688c2ecf20Sopenharmony_ci	/* Buffer allocation in progress */
3698c2ecf20Sopenharmony_ci	atomic_t buf_alloc;
3708c2ecf20Sopenharmony_ci
3718c2ecf20Sopenharmony_ci	struct {
3728c2ecf20Sopenharmony_ci		int context;
3738c2ecf20Sopenharmony_ci		struct drm_hw_lock *lock;
3748c2ecf20Sopenharmony_ci	} sigdata;
3758c2ecf20Sopenharmony_ci
3768c2ecf20Sopenharmony_ci	struct drm_local_map *agp_buffer_map;
3778c2ecf20Sopenharmony_ci	unsigned int agp_buffer_token;
3788c2ecf20Sopenharmony_ci
3798c2ecf20Sopenharmony_ci	/* Scatter gather memory */
3808c2ecf20Sopenharmony_ci	struct drm_sg_mem *sg;
3818c2ecf20Sopenharmony_ci#endif
3828c2ecf20Sopenharmony_ci};
3838c2ecf20Sopenharmony_ci
3848c2ecf20Sopenharmony_ci#endif
385