blob: 9d596ba6d325a986dd836a86c2495505f0ff8509 [file] [log] [blame]
Elliott Hughesabd62612013-11-08 11:45:48 -08001/****************************************************************************
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>
Elliott Hughesabd62612013-11-08 11:45:48 -080023#include <linux/errno.h>
24#define MTRR_IOCTL_BASE 'M'
25#ifdef __i386__
26struct mtrr_sentry {
Tao Baod7db5942015-01-28 10:07:51 -080027 unsigned long base;
28 unsigned int size;
29 unsigned int type;
Elliott Hughesabd62612013-11-08 11:45:48 -080030};
Elliott Hughesabd62612013-11-08 11:45:48 -080031struct mtrr_gentry {
Tao Baod7db5942015-01-28 10:07:51 -080032 unsigned int regnum;
33 unsigned long base;
34 unsigned int size;
Tao Baod7db5942015-01-28 10:07:51 -080035 unsigned int type;
Elliott Hughesabd62612013-11-08 11:45:48 -080036};
37#else
38struct mtrr_sentry {
Tao Baod7db5942015-01-28 10:07:51 -080039 __u64 base;
40 __u32 size;
41 __u32 type;
Elliott Hughesabd62612013-11-08 11:45:48 -080042};
Elliott Hughesabd62612013-11-08 11:45:48 -080043struct mtrr_gentry {
Tao Baod7db5942015-01-28 10:07:51 -080044 __u64 base;
45 __u32 size;
46 __u32 regnum;
Tao Baod7db5942015-01-28 10:07:51 -080047 __u32 type;
48 __u32 _pad;
Elliott Hughesabd62612013-11-08 11:45:48 -080049};
50#endif
Elliott Hughesabd62612013-11-08 11:45:48 -080051struct mtrr_var_range {
Tao Baod7db5942015-01-28 10:07:51 -080052 __u32 base_lo;
53 __u32 base_hi;
54 __u32 mask_lo;
Tao Baod7db5942015-01-28 10:07:51 -080055 __u32 mask_hi;
Elliott Hughesabd62612013-11-08 11:45:48 -080056};
57typedef __u8 mtrr_type;
58#define MTRR_NUM_FIXED_RANGES 88
Elliott Hughesabd62612013-11-08 11:45:48 -080059#define MTRR_MAX_VAR_RANGES 256
Elliott Hughesabd62612013-11-08 11:45:48 -080060#define MTRRphysBase_MSR(reg) (0x200 + 2 * (reg))
61#define MTRRphysMask_MSR(reg) (0x200 + 2 * (reg) + 1)
62#define MTRRIOC_ADD_ENTRY _IOW(MTRR_IOCTL_BASE, 0, struct mtrr_sentry)
63#define MTRRIOC_SET_ENTRY _IOW(MTRR_IOCTL_BASE, 1, struct mtrr_sentry)
Elliott Hughesabd62612013-11-08 11:45:48 -080064#define MTRRIOC_DEL_ENTRY _IOW(MTRR_IOCTL_BASE, 2, struct mtrr_sentry)
65#define MTRRIOC_GET_ENTRY _IOWR(MTRR_IOCTL_BASE, 3, struct mtrr_gentry)
66#define MTRRIOC_KILL_ENTRY _IOW(MTRR_IOCTL_BASE, 4, struct mtrr_sentry)
67#define MTRRIOC_ADD_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 5, struct mtrr_sentry)
Elliott Hughesabd62612013-11-08 11:45:48 -080068#define MTRRIOC_SET_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 6, struct mtrr_sentry)
69#define MTRRIOC_DEL_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 7, struct mtrr_sentry)
70#define MTRRIOC_GET_PAGE_ENTRY _IOWR(MTRR_IOCTL_BASE, 8, struct mtrr_gentry)
71#define MTRRIOC_KILL_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 9, struct mtrr_sentry)
Elliott Hughesabd62612013-11-08 11:45:48 -080072#define MTRR_TYPE_UNCACHABLE 0
73#define MTRR_TYPE_WRCOMB 1
74#define MTRR_TYPE_WRTHROUGH 4
75#define MTRR_TYPE_WRPROT 5
Elliott Hughesabd62612013-11-08 11:45:48 -080076#define MTRR_TYPE_WRBACK 6
77#define MTRR_NUM_TYPES 7
Christopher Ferris05d08e92016-02-04 13:16:38 -080078#define MTRR_TYPE_INVALID 0xff
Elliott Hughesabd62612013-11-08 11:45:48 -080079#endif