1 /*
2  * This file is auto-generated. Modifications will be lost.
3  *
4  * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5  * for more information.
6  */
7 #ifndef _UAPI_ASM_X86_MTRR_H
8 #define _UAPI_ASM_X86_MTRR_H
9 #include <linux/types.h>
10 #include <linux/ioctl.h>
11 #include <linux/errno.h>
12 #define MTRR_IOCTL_BASE 'M'
13 #ifdef __i386__
14 struct mtrr_sentry {
15   unsigned long base;
16   unsigned int size;
17   unsigned int type;
18 };
19 struct mtrr_gentry {
20   unsigned int regnum;
21   unsigned long base;
22   unsigned int size;
23   unsigned int type;
24 };
25 #else
26 struct mtrr_sentry {
27   __u64 base;
28   __u32 size;
29   __u32 type;
30 };
31 struct mtrr_gentry {
32   __u64 base;
33   __u32 size;
34   __u32 regnum;
35   __u32 type;
36   __u32 _pad;
37 };
38 #endif
39 struct mtrr_var_range {
40   __u32 base_lo;
41   __u32 base_hi;
42   __u32 mask_lo;
43   __u32 mask_hi;
44 };
45 typedef __u8 mtrr_type;
46 #define MTRR_NUM_FIXED_RANGES 88
47 #define MTRR_MAX_VAR_RANGES 256
48 #define MTRRphysBase_MSR(reg) (0x200 + 2 * (reg))
49 #define MTRRphysMask_MSR(reg) (0x200 + 2 * (reg) + 1)
50 #define MTRRIOC_ADD_ENTRY _IOW(MTRR_IOCTL_BASE, 0, struct mtrr_sentry)
51 #define MTRRIOC_SET_ENTRY _IOW(MTRR_IOCTL_BASE, 1, struct mtrr_sentry)
52 #define MTRRIOC_DEL_ENTRY _IOW(MTRR_IOCTL_BASE, 2, struct mtrr_sentry)
53 #define MTRRIOC_GET_ENTRY _IOWR(MTRR_IOCTL_BASE, 3, struct mtrr_gentry)
54 #define MTRRIOC_KILL_ENTRY _IOW(MTRR_IOCTL_BASE, 4, struct mtrr_sentry)
55 #define MTRRIOC_ADD_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 5, struct mtrr_sentry)
56 #define MTRRIOC_SET_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 6, struct mtrr_sentry)
57 #define MTRRIOC_DEL_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 7, struct mtrr_sentry)
58 #define MTRRIOC_GET_PAGE_ENTRY _IOWR(MTRR_IOCTL_BASE, 8, struct mtrr_gentry)
59 #define MTRRIOC_KILL_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 9, struct mtrr_sentry)
60 #define MTRR_TYPE_UNCACHABLE 0
61 #define MTRR_TYPE_WRCOMB 1
62 #define MTRR_TYPE_WRTHROUGH 4
63 #define MTRR_TYPE_WRPROT 5
64 #define MTRR_TYPE_WRBACK 6
65 #define MTRR_NUM_TYPES 7
66 #define MTRR_TYPE_INVALID 0xff
67 #endif
68