1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /**************************************************************************
3 * Copyright (c) 2007-2008, Intel Corporation.
6 **************************************************************************/
11 #include <drm/drm_gem.h>
13 /* This wants cleaning up with respect to the psb_dev and un-needed stuff */
16 uint32_t mmu_gatt_start
;
18 uint32_t gtt_phys_start
;
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 */
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
,
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
);