1 /**************************************************************************** 2 **************************************************************************** 3 *** 4 *** This header was automatically generated from a Linux kernel header 5 *** of the same name, to make information necessary for userspace to 6 *** call into the kernel available to libc. It contains only constants, 7 *** structures, and macros generated from the original header, and thus, 8 *** contains no copyrightable information. 9 *** 10 *** To edit the content of this header, modify the corresponding 11 *** source file (e.g. under external/kernel-headers/original/) then 12 *** run bionic/libc/kernel/tools/update_all.py 13 *** 14 *** Any manual change here will be lost the next time this script will 15 *** be run. You've been warned! 16 *** 17 **************************************************************************** 18 ****************************************************************************/ 19 #ifndef _UAPI_ASM_X86_MTRR_H 20 #define _UAPI_ASM_X86_MTRR_H 21 #include <linux/types.h> 22 #include <linux/ioctl.h> 23 #include <linux/errno.h> 24 #define MTRR_IOCTL_BASE 'M' 25 #ifdef __i386__ 26 struct mtrr_sentry { 27 unsigned long base; 28 unsigned int size; 29 unsigned int type; 30 }; 31 struct mtrr_gentry { 32 unsigned int regnum; 33 unsigned long base; 34 unsigned int size; 35 unsigned int type; 36 }; 37 #else 38 struct mtrr_sentry { 39 __u64 base; 40 __u32 size; 41 __u32 type; 42 }; 43 struct mtrr_gentry { 44 __u64 base; 45 __u32 size; 46 __u32 regnum; 47 __u32 type; 48 __u32 _pad; 49 }; 50 #endif 51 struct mtrr_var_range { 52 __u32 base_lo; 53 __u32 base_hi; 54 __u32 mask_lo; 55 __u32 mask_hi; 56 }; 57 typedef __u8 mtrr_type; 58 #define MTRR_NUM_FIXED_RANGES 88 59 #define MTRR_MAX_VAR_RANGES 256 60 struct mtrr_state_type { 61 struct mtrr_var_range var_ranges[MTRR_MAX_VAR_RANGES]; 62 mtrr_type fixed_ranges[MTRR_NUM_FIXED_RANGES]; 63 unsigned char enabled; 64 unsigned char have_fixed; 65 mtrr_type def_type; 66 }; 67 #define MTRRphysBase_MSR(reg) (0x200 + 2 * (reg)) 68 #define MTRRphysMask_MSR(reg) (0x200 + 2 * (reg) + 1) 69 #define MTRRIOC_ADD_ENTRY _IOW(MTRR_IOCTL_BASE, 0, struct mtrr_sentry) 70 #define MTRRIOC_SET_ENTRY _IOW(MTRR_IOCTL_BASE, 1, struct mtrr_sentry) 71 #define MTRRIOC_DEL_ENTRY _IOW(MTRR_IOCTL_BASE, 2, struct mtrr_sentry) 72 #define MTRRIOC_GET_ENTRY _IOWR(MTRR_IOCTL_BASE, 3, struct mtrr_gentry) 73 #define MTRRIOC_KILL_ENTRY _IOW(MTRR_IOCTL_BASE, 4, struct mtrr_sentry) 74 #define MTRRIOC_ADD_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 5, struct mtrr_sentry) 75 #define MTRRIOC_SET_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 6, struct mtrr_sentry) 76 #define MTRRIOC_DEL_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 7, struct mtrr_sentry) 77 #define MTRRIOC_GET_PAGE_ENTRY _IOWR(MTRR_IOCTL_BASE, 8, struct mtrr_gentry) 78 #define MTRRIOC_KILL_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 9, struct mtrr_sentry) 79 #define MTRR_TYPE_UNCACHABLE 0 80 #define MTRR_TYPE_WRCOMB 1 81 #define MTRR_TYPE_WRTHROUGH 4 82 #define MTRR_TYPE_WRPROT 5 83 #define MTRR_TYPE_WRBACK 6 84 #define MTRR_NUM_TYPES 7 85 #define MTRR_TYPE_INVALID 0xff 86 #endif 87