Elliott Hughes | 180edef | 2023-11-02 00:08:05 +0000 | [diff] [blame] | 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 | */ |
Elliott Hughes | abd6261 | 2013-11-08 11:45:48 -0800 | [diff] [blame] | 7 | #ifndef _UAPI_ASM_X86_MTRR_H |
| 8 | #define _UAPI_ASM_X86_MTRR_H |
| 9 | #include <linux/types.h> |
| 10 | #include <linux/ioctl.h> |
Elliott Hughes | abd6261 | 2013-11-08 11:45:48 -0800 | [diff] [blame] | 11 | #include <linux/errno.h> |
| 12 | #define MTRR_IOCTL_BASE 'M' |
| 13 | #ifdef __i386__ |
| 14 | struct mtrr_sentry { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 15 | unsigned long base; |
| 16 | unsigned int size; |
| 17 | unsigned int type; |
Elliott Hughes | abd6261 | 2013-11-08 11:45:48 -0800 | [diff] [blame] | 18 | }; |
Elliott Hughes | abd6261 | 2013-11-08 11:45:48 -0800 | [diff] [blame] | 19 | struct mtrr_gentry { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 20 | unsigned int regnum; |
| 21 | unsigned long base; |
| 22 | unsigned int size; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 23 | unsigned int type; |
Elliott Hughes | abd6261 | 2013-11-08 11:45:48 -0800 | [diff] [blame] | 24 | }; |
| 25 | #else |
| 26 | struct mtrr_sentry { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 27 | __u64 base; |
| 28 | __u32 size; |
| 29 | __u32 type; |
Elliott Hughes | abd6261 | 2013-11-08 11:45:48 -0800 | [diff] [blame] | 30 | }; |
Elliott Hughes | abd6261 | 2013-11-08 11:45:48 -0800 | [diff] [blame] | 31 | struct mtrr_gentry { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 32 | __u64 base; |
| 33 | __u32 size; |
| 34 | __u32 regnum; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 35 | __u32 type; |
| 36 | __u32 _pad; |
Elliott Hughes | abd6261 | 2013-11-08 11:45:48 -0800 | [diff] [blame] | 37 | }; |
| 38 | #endif |
Elliott Hughes | abd6261 | 2013-11-08 11:45:48 -0800 | [diff] [blame] | 39 | struct mtrr_var_range { |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 40 | __u32 base_lo; |
| 41 | __u32 base_hi; |
| 42 | __u32 mask_lo; |
Tao Bao | d7db594 | 2015-01-28 10:07:51 -0800 | [diff] [blame] | 43 | __u32 mask_hi; |
Elliott Hughes | abd6261 | 2013-11-08 11:45:48 -0800 | [diff] [blame] | 44 | }; |
| 45 | typedef __u8 mtrr_type; |
| 46 | #define MTRR_NUM_FIXED_RANGES 88 |
Elliott Hughes | abd6261 | 2013-11-08 11:45:48 -0800 | [diff] [blame] | 47 | #define MTRR_MAX_VAR_RANGES 256 |
Elliott Hughes | abd6261 | 2013-11-08 11:45:48 -0800 | [diff] [blame] | 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) |
Elliott Hughes | abd6261 | 2013-11-08 11:45:48 -0800 | [diff] [blame] | 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) |
Elliott Hughes | abd6261 | 2013-11-08 11:45:48 -0800 | [diff] [blame] | 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) |
Elliott Hughes | abd6261 | 2013-11-08 11:45:48 -0800 | [diff] [blame] | 60 | #define MTRR_TYPE_UNCACHABLE 0 |
| 61 | #define MTRR_TYPE_WRCOMB 1 |
| 62 | #define MTRR_TYPE_WRTHROUGH 4 |
| 63 | #define MTRR_TYPE_WRPROT 5 |
Elliott Hughes | abd6261 | 2013-11-08 11:45:48 -0800 | [diff] [blame] | 64 | #define MTRR_TYPE_WRBACK 6 |
| 65 | #define MTRR_NUM_TYPES 7 |
Christopher Ferris | 05d08e9 | 2016-02-04 13:16:38 -0800 | [diff] [blame] | 66 | #define MTRR_TYPE_INVALID 0xff |
Elliott Hughes | abd6261 | 2013-11-08 11:45:48 -0800 | [diff] [blame] | 67 | #endif |