vfs: Make __vfs_write() static
[linux/fpc-iii.git] / include / drm / ttm / ttm_set_memory.h
blob7c492b49e38cd93d46d567e95583d8555a79ec81
1 /**************************************************************************
3 * Copyright (c) 2018 Advanced Micro Devices, Inc.
4 * All Rights Reserved.
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:
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.
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.
26 **************************************************************************/
28 * Authors: Huang Rui <ray.huang@amd.com>
31 #ifndef TTM_SET_MEMORY
32 #define TTM_SET_MEMORY
34 #include <linux/mm.h>
36 #ifdef CONFIG_X86
38 #include <asm/set_memory.h>
40 static inline int ttm_set_pages_array_wb(struct page **pages, int addrinarray)
42 return set_pages_array_wb(pages, addrinarray);
45 static inline int ttm_set_pages_array_wc(struct page **pages, int addrinarray)
47 return set_pages_array_wc(pages, addrinarray);
50 static inline int ttm_set_pages_array_uc(struct page **pages, int addrinarray)
52 return set_pages_array_uc(pages, addrinarray);
55 static inline int ttm_set_pages_wb(struct page *page, int numpages)
57 return set_pages_wb(page, numpages);
60 static inline int ttm_set_pages_wc(struct page *page, int numpages)
62 unsigned long addr = (unsigned long)page_address(page);
64 return set_memory_wc(addr, numpages);
67 static inline int ttm_set_pages_uc(struct page *page, int numpages)
69 return set_pages_uc(page, numpages);
72 #else /* for CONFIG_X86 */
74 #if IS_ENABLED(CONFIG_AGP)
76 #include <asm/agp.h>
78 static inline int ttm_set_pages_array_wb(struct page **pages, int addrinarray)
80 int i;
82 for (i = 0; i < addrinarray; i++)
83 unmap_page_from_agp(pages[i]);
84 return 0;
87 static inline int ttm_set_pages_array_wc(struct page **pages, int addrinarray)
89 int i;
91 for (i = 0; i < addrinarray; i++)
92 map_page_into_agp(pages[i]);
93 return 0;
96 static inline int ttm_set_pages_array_uc(struct page **pages, int addrinarray)
98 int i;
100 for (i = 0; i < addrinarray; i++)
101 map_page_into_agp(pages[i]);
102 return 0;
105 static inline int ttm_set_pages_wb(struct page *page, int numpages)
107 int i;
109 for (i = 0; i < numpages; i++)
110 unmap_page_from_agp(page++);
111 return 0;
114 #else /* for CONFIG_AGP */
116 static inline int ttm_set_pages_array_wb(struct page **pages, int addrinarray)
118 return 0;
121 static inline int ttm_set_pages_array_wc(struct page **pages, int addrinarray)
123 return 0;
126 static inline int ttm_set_pages_array_uc(struct page **pages, int addrinarray)
128 return 0;
131 static inline int ttm_set_pages_wb(struct page *page, int numpages)
133 return 0;
136 #endif /* for CONFIG_AGP */
138 static inline int ttm_set_pages_wc(struct page *page, int numpages)
140 return 0;
143 static inline int ttm_set_pages_uc(struct page *page, int numpages)
145 return 0;
148 #endif /* for CONFIG_X86 */
150 #endif