summaryrefslogtreecommitdiffstats
path: root/include/drm/ttm
diff options
context:
space:
mode:
authorHuang Rui <ray.huang@amd.com>2018-07-26 04:32:08 -0400
committerAlex Deucher <alexander.deucher@amd.com>2018-07-27 15:59:52 -0400
commit2ac305b7c8d7f93a6ef0018391e9865ea4ac0d65 (patch)
tree660a640244b629334f300c8f36be83bc177624ad /include/drm/ttm
parentf1e582ebfd703ea01dc4caf4d339b7c84ec3ff29 (diff)
drm/ttm: add ttm_set_memory header (v2)
This patch moves all non-x86 abstraction to the ttm_set_memory header. It is to make function calling more clearly. (v2): add ttm_ prefix. Suggested-by: Christian König <christian.koenig@amd.com> Signed-off-by: Huang Rui <ray.huang@amd.com> Reviewed-by: Bas Nieuwenhuizen <basni@chromium.org> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'include/drm/ttm')
-rw-r--r--include/drm/ttm/ttm_set_memory.h128
1 files changed, 128 insertions, 0 deletions
diff --git a/include/drm/ttm/ttm_set_memory.h b/include/drm/ttm/ttm_set_memory.h
new file mode 100644
index 000000000000..a70723cf208b
--- /dev/null
+++ b/include/drm/ttm/ttm_set_memory.h
@@ -0,0 +1,128 @@
1/**************************************************************************
2 *
3 * Copyright (c) 2018 Advanced Micro Devices, Inc.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24 * USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27/*
28 * Authors: Huang Rui <ray.huang@amd.com>
29 */
30
31#ifndef TTM_SET_MEMORY
32#define TTM_SET_MEMORY
33
34#include <linux/mm.h>
35
36#ifdef CONFIG_X86
37
38#include <asm/set_memory.h>
39
40static inline int ttm_set_pages_array_wb(struct page **pages, int addrinarray)
41{
42 return set_pages_array_wb(pages, addrinarray);
43}
44
45static inline int ttm_set_pages_array_wc(struct page **pages, int addrinarray)
46{
47 return set_pages_array_wc(pages, addrinarray);
48}
49
50static inline int ttm_set_pages_array_uc(struct page **pages, int addrinarray)
51{
52 return set_pages_array_uc(pages, addrinarray);
53}
54
55static inline int ttm_set_pages_wb(struct page *page, int numpages)
56{
57 return set_pages_wb(page, numpages);
58}
59
60#else /* for CONFIG_X86 */
61
62#if IS_ENABLED(CONFIG_AGP)
63
64#include <asm/agp.h>
65
66static inline int ttm_set_pages_array_wb(struct page **pages, int addrinarray)
67{
68 int i;
69
70 for (i = 0; i < addrinarray; i++)
71 unmap_page_from_agp(pages[i]);
72 return 0;
73}
74
75static inline int ttm_set_pages_array_wc(struct page **pages, int addrinarray)
76{
77 int i;
78
79 for (i = 0; i < addrinarray; i++)
80 map_page_into_agp(pages[i]);
81 return 0;
82}
83
84static inline int ttm_set_pages_array_uc(struct page **pages, int addrinarray)
85{
86 int i;
87
88 for (i = 0; i < addrinarray; i++)
89 map_page_into_agp(pages[i]);
90 return 0;
91}
92
93static inline int ttm_set_pages_wb(struct page *page, int numpages)
94{
95 int i;
96
97 for (i = 0; i < numpages; i++)
98 unmap_page_from_agp(page++);
99 return 0;
100}
101
102#else /* for CONFIG_AGP */
103
104static inline int ttm_set_pages_array_wb(struct page **pages, int addrinarray)
105{
106 return 0;
107}
108
109static inline int ttm_set_pages_array_wc(struct page **pages, int addrinarray)
110{
111 return 0;
112}
113
114static inline int ttm_set_pages_array_uc(struct page **pages, int addrinarray)
115{
116 return 0;
117}
118
119static inline int ttm_set_pages_wb(struct page *page, int numpages)
120{
121 return 0;
122}
123
124#endif /* for CONFIG_AGP */
125
126#endif /* for CONFIG_X86 */
127
128#endif