Merge tag 'block-5.11-2021-01-10' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / drivers / gpu / drm / gma500 / gtt.h
blob2bf165849ebebaa2a97551684f24c47ba58fd647
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /**************************************************************************
3 * Copyright (c) 2007-2008, Intel Corporation.
4 * All Rights Reserved.
6 **************************************************************************/
8 #ifndef _PSB_GTT_H_
9 #define _PSB_GTT_H_
11 #include <drm/drm_gem.h>
13 /* This wants cleaning up with respect to the psb_dev and un-needed stuff */
14 struct psb_gtt {
15 uint32_t gatt_start;
16 uint32_t mmu_gatt_start;
17 uint32_t gtt_start;
18 uint32_t gtt_phys_start;
19 unsigned gtt_pages;
20 unsigned gatt_pages;
21 unsigned long stolen_size;
22 unsigned long vram_stolen_size;
23 struct rw_semaphore sem;
26 /* Exported functions */
27 extern int psb_gtt_init(struct drm_device *dev, int resume);
28 extern void psb_gtt_takedown(struct drm_device *dev);
30 /* Each gtt_range describes an allocation in the GTT area */
31 struct gtt_range {
32 struct resource resource; /* Resource for our allocation */
33 u32 offset; /* GTT offset of our object */
34 struct drm_gem_object gem; /* GEM high level stuff */
35 int in_gart; /* Currently in the GART (ref ct) */
36 bool stolen; /* Backed from stolen RAM */
37 bool mmapping; /* Is mmappable */
38 struct page **pages; /* Backing pages if present */
39 int npage; /* Number of backing pages */
42 #define to_gtt_range(x) container_of(x, struct gtt_range, gem)
44 extern struct gtt_range *psb_gtt_alloc_range(struct drm_device *dev, int len,
45 const char *name, int backed,
46 u32 align);
47 extern void psb_gtt_kref_put(struct gtt_range *gt);
48 extern void psb_gtt_free_range(struct drm_device *dev, struct gtt_range *gt);
49 extern int psb_gtt_pin(struct gtt_range *gt);
50 extern void psb_gtt_unpin(struct gtt_range *gt);
51 extern int psb_gtt_restore(struct drm_device *dev);
52 #endif