blob: 5561b521c8d38f6a339f2c37f01bc46830584fd9 [file] [log] [blame]
Elliott Hughes180edef2023-11-02 00:08:05 +00001/*
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 Hughesabd62612013-11-08 11:45:48 -08007#ifndef _UAPI_ASM_X86_MTRR_H
8#define _UAPI_ASM_X86_MTRR_H
9#include <linux/types.h>
10#include <linux/ioctl.h>
Elliott Hughesabd62612013-11-08 11:45:48 -080011#include <linux/errno.h>
12#define MTRR_IOCTL_BASE 'M'
13#ifdef __i386__
14struct mtrr_sentry {
Tao Baod7db5942015-01-28 10:07:51 -080015 unsigned long base;
16 unsigned int size;
17 unsigned int type;
Elliott Hughesabd62612013-11-08 11:45:48 -080018};
Elliott Hughesabd62612013-11-08 11:45:48 -080019struct mtrr_gentry {
Tao Baod7db5942015-01-28 10:07:51 -080020 unsigned int regnum;
21 unsigned long base;
22 unsigned int size;
Tao Baod7db5942015-01-28 10:07:51 -080023 unsigned int type;
Elliott Hughesabd62612013-11-08 11:45:48 -080024};
25#else
26struct mtrr_sentry {
Tao Baod7db5942015-01-28 10:07:51 -080027 __u64 base;
28 __u32 size;
29 __u32 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 __u64 base;
33 __u32 size;
34 __u32 regnum;
Tao Baod7db5942015-01-28 10:07:51 -080035 __u32 type;
36 __u32 _pad;
Elliott Hughesabd62612013-11-08 11:45:48 -080037};
38#endif
Elliott Hughesabd62612013-11-08 11:45:48 -080039struct mtrr_var_range {
Tao Baod7db5942015-01-28 10:07:51 -080040 __u32 base_lo;
41 __u32 base_hi;
42 __u32 mask_lo;
Tao Baod7db5942015-01-28 10:07:51 -080043 __u32 mask_hi;
Elliott Hughesabd62612013-11-08 11:45:48 -080044};
45typedef __u8 mtrr_type;
46#define MTRR_NUM_FIXED_RANGES 88
Elliott Hughesabd62612013-11-08 11:45:48 -080047#define MTRR_MAX_VAR_RANGES 256
Elliott Hughesabd62612013-11-08 11:45:48 -080048#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 Hughesabd62612013-11-08 11:45:48 -080052#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 Hughesabd62612013-11-08 11:45:48 -080056#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 Hughesabd62612013-11-08 11:45:48 -080060#define MTRR_TYPE_UNCACHABLE 0
61#define MTRR_TYPE_WRCOMB 1
62#define MTRR_TYPE_WRTHROUGH 4
63#define MTRR_TYPE_WRPROT 5
Elliott Hughesabd62612013-11-08 11:45:48 -080064#define MTRR_TYPE_WRBACK 6
65#define MTRR_NUM_TYPES 7
Christopher Ferris05d08e92016-02-04 13:16:38 -080066#define MTRR_TYPE_INVALID 0xff
Elliott Hughesabd62612013-11-08 11:45:48 -080067#endif