xref: /openbsd-src/sys/dev/pci/drm/include/asm/pgtable.h (revision 99fd087599a8791921855f21bd7e36130f39aadc)
1 /* Public domain. */
2 
3 #ifndef _ASM_PGTABLE_H
4 #define _ASM_PGTABLE_H
5 
6 #include <machine/pmap.h>
7 #include <machine/pte.h>
8 #include <linux/types.h>
9 
10 #define pgprot_val(v)	(v)
11 #define PAGE_KERNEL	0
12 #define PAGE_KERNEL_IO	0
13 
14 static inline pgprot_t
15 pgprot_writecombine(pgprot_t prot)
16 {
17 #if PMAP_WC != 0
18 	return prot | PMAP_WC;
19 #else
20 	return prot | PMAP_NOCACHE;
21 #endif
22 }
23 
24 static inline pgprot_t
25 pgprot_noncached(pgprot_t prot)
26 {
27 #if PMAP_DEVICE != 0
28 	return prot | PMAP_DEVICE;
29 #else
30 	return prot | PMAP_NOCACHE;
31 #endif
32 }
33 
34 #if defined(__i386__) || defined(__amd64__)
35 #define _PAGE_PRESENT	PG_V
36 #define _PAGE_RW	PG_RW
37 #define _PAGE_PAT	PG_PAT
38 #define _PAGE_PWT	PG_WT
39 #define _PAGE_PCD	PG_N
40 #endif
41 
42 #endif
43