0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #ifndef _UAPI_ASM_X86_MTRR_H
0025 #define _UAPI_ASM_X86_MTRR_H
0026
0027 #include <linux/types.h>
0028 #include <linux/ioctl.h>
0029 #include <linux/errno.h>
0030
0031 #define MTRR_IOCTL_BASE 'M'
0032
0033
0034
0035
0036
0037
0038 #ifdef __i386__
0039 struct mtrr_sentry {
0040 unsigned long base;
0041 unsigned int size;
0042 unsigned int type;
0043 };
0044
0045 struct mtrr_gentry {
0046 unsigned int regnum;
0047 unsigned long base;
0048 unsigned int size;
0049 unsigned int type;
0050 };
0051
0052 #else
0053
0054 struct mtrr_sentry {
0055 __u64 base;
0056 __u32 size;
0057 __u32 type;
0058 };
0059
0060 struct mtrr_gentry {
0061 __u64 base;
0062 __u32 size;
0063 __u32 regnum;
0064 __u32 type;
0065 __u32 _pad;
0066 };
0067
0068 #endif
0069
0070 struct mtrr_var_range {
0071 __u32 base_lo;
0072 __u32 base_hi;
0073 __u32 mask_lo;
0074 __u32 mask_hi;
0075 };
0076
0077
0078
0079 typedef __u8 mtrr_type;
0080
0081 #define MTRR_NUM_FIXED_RANGES 88
0082 #define MTRR_MAX_VAR_RANGES 256
0083
0084 struct mtrr_state_type {
0085 struct mtrr_var_range var_ranges[MTRR_MAX_VAR_RANGES];
0086 mtrr_type fixed_ranges[MTRR_NUM_FIXED_RANGES];
0087 unsigned char enabled;
0088 unsigned char have_fixed;
0089 mtrr_type def_type;
0090 };
0091
0092 #define MTRRphysBase_MSR(reg) (0x200 + 2 * (reg))
0093 #define MTRRphysMask_MSR(reg) (0x200 + 2 * (reg) + 1)
0094
0095
0096 #define MTRRIOC_ADD_ENTRY _IOW(MTRR_IOCTL_BASE, 0, struct mtrr_sentry)
0097 #define MTRRIOC_SET_ENTRY _IOW(MTRR_IOCTL_BASE, 1, struct mtrr_sentry)
0098 #define MTRRIOC_DEL_ENTRY _IOW(MTRR_IOCTL_BASE, 2, struct mtrr_sentry)
0099 #define MTRRIOC_GET_ENTRY _IOWR(MTRR_IOCTL_BASE, 3, struct mtrr_gentry)
0100 #define MTRRIOC_KILL_ENTRY _IOW(MTRR_IOCTL_BASE, 4, struct mtrr_sentry)
0101 #define MTRRIOC_ADD_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 5, struct mtrr_sentry)
0102 #define MTRRIOC_SET_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 6, struct mtrr_sentry)
0103 #define MTRRIOC_DEL_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 7, struct mtrr_sentry)
0104 #define MTRRIOC_GET_PAGE_ENTRY _IOWR(MTRR_IOCTL_BASE, 8, struct mtrr_gentry)
0105 #define MTRRIOC_KILL_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 9, struct mtrr_sentry)
0106
0107
0108 #define MTRR_TYPE_UNCACHABLE 0
0109 #define MTRR_TYPE_WRCOMB 1
0110
0111
0112 #define MTRR_TYPE_WRTHROUGH 4
0113 #define MTRR_TYPE_WRPROT 5
0114 #define MTRR_TYPE_WRBACK 6
0115 #define MTRR_NUM_TYPES 7
0116
0117
0118
0119
0120
0121
0122 #define MTRR_TYPE_INVALID 0xff
0123
0124 #endif