1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#ifndef __AMDGPU_GART_H__
25#define __AMDGPU_GART_H__
26
27#include <linux/types.h>
28
29
30
31
32struct amdgpu_device;
33struct amdgpu_bo;
34
35#define AMDGPU_GPU_PAGE_SIZE 4096
36#define AMDGPU_GPU_PAGE_MASK (AMDGPU_GPU_PAGE_SIZE - 1)
37#define AMDGPU_GPU_PAGE_SHIFT 12
38#define AMDGPU_GPU_PAGE_ALIGN(a) (((a) + AMDGPU_GPU_PAGE_MASK) & ~AMDGPU_GPU_PAGE_MASK)
39
40struct amdgpu_gart {
41 u64 table_addr;
42 struct amdgpu_bo *robj;
43 void *ptr;
44 unsigned num_gpu_pages;
45 unsigned num_cpu_pages;
46 unsigned table_size;
47#ifdef CONFIG_DRM_AMDGPU_GART_DEBUGFS
48 struct page **pages;
49#endif
50 bool ready;
51
52
53 uint64_t gart_pte_flags;
54};
55
56int amdgpu_gart_table_vram_alloc(struct amdgpu_device *adev);
57void amdgpu_gart_table_vram_free(struct amdgpu_device *adev);
58int amdgpu_gart_table_vram_pin(struct amdgpu_device *adev);
59void amdgpu_gart_table_vram_unpin(struct amdgpu_device *adev);
60int amdgpu_gart_init(struct amdgpu_device *adev);
61void amdgpu_gart_fini(struct amdgpu_device *adev);
62int amdgpu_gart_unbind(struct amdgpu_device *adev, uint64_t offset,
63 int pages);
64int amdgpu_gart_map(struct amdgpu_device *adev, uint64_t offset,
65 int pages, dma_addr_t *dma_addr, uint64_t flags,
66 void *dst);
67int amdgpu_gart_bind(struct amdgpu_device *adev, uint64_t offset,
68 int pages, struct page **pagelist,
69 dma_addr_t *dma_addr, uint64_t flags);
70
71#endif
72