1 /**************************************************************************
3 * This kernel module is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU General Public License as
5 * published by the Free Software Foundation; either version 2 of the
6 * License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 **************************************************************************/
19 * This code provides access to unexported mm kernel features. It is necessary
20 * to use the new DRM memory manager code with kernels that don't support it
23 * Authors: Thomas Hellstrom <thomas-at-tungstengraphics-dot-com>
24 * Linux kernel mm subsystem authors.
25 * (Most code taken from there).
30 #if defined(CONFIG_X86) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15))
31 int drm_map_page_into_agp(struct page *page)
34 i = change_page_attr(page, 1, PAGE_KERNEL_NOCACHE);
35 /* Caller's responsibility to call global_flush_tlb() for
36 * performance reasons */
40 int drm_unmap_page_from_agp(struct page *page)
43 i = change_page_attr(page, 1, PAGE_KERNEL);
44 /* Caller's responsibility to call global_flush_tlb() for
45 * performance reasons */
51 pgprot_t vm_get_page_prot(unsigned long vm_flags)
54 static pgprot_t drm_protection_map[16] = {
55 __P000, __P001, __P010, __P011, __P100, __P101, __P110, __P111,
56 __S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111
59 return drm_protection_map[vm_flags & 0x0F];
61 extern pgprot_t protection_map[];
62 return protection_map[vm_flags & 0x0F];