···11+/* Generic MTRR (Memory Type Range Register) ioctls.22+33+ Copyright (C) 1997-1999 Richard Gooch44+55+ This library is free software; you can redistribute it and/or66+ modify it under the terms of the GNU Library General Public77+ License as published by the Free Software Foundation; either88+ version 2 of the License, or (at your option) any later version.99+1010+ This library is distributed in the hope that it will be useful,1111+ but WITHOUT ANY WARRANTY; without even the implied warranty of1212+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU1313+ Library General Public License for more details.1414+1515+ You should have received a copy of the GNU Library General Public1616+ License along with this library; if not, write to the Free1717+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.1818+1919+ Richard Gooch may be reached by email at rgooch@atnf.csiro.au2020+ The postal address is:2121+ Richard Gooch, c/o ATNF, P. O. Box 76, Epping, N.S.W., 2121, Australia.2222+*/2323+#ifndef _ASM_X86_MTRR_H2424+#define _ASM_X86_MTRR_H2525+2626+#include <linux/ioctl.h>2727+#include <linux/errno.h>2828+2929+#define MTRR_IOCTL_BASE 'M'3030+3131+struct mtrr_sentry3232+{3333+ unsigned long base; /* Base address */3434+ unsigned int size; /* Size of region */3535+ unsigned int type; /* Type of region */3636+};3737+3838+/* Warning: this structure has a different order from i3863939+ on x86-64. The 32bit emulation code takes care of that.4040+ But you need to use this for 64bit, otherwise your X server4141+ will break. */4242+4343+#ifdef __i386__4444+struct mtrr_gentry4545+{4646+ unsigned int regnum; /* Register number */4747+ unsigned long base; /* Base address */4848+ unsigned int size; /* Size of region */4949+ unsigned int type; /* Type of region */5050+};5151+5252+#else /* __i386__ */5353+5454+struct mtrr_gentry5555+{5656+ unsigned long base; /* Base address */5757+ unsigned int size; /* Size of region */5858+ unsigned int regnum; /* Register number */5959+ unsigned int type; /* Type of region */6060+};6161+#endif /* !__i386__ */6262+6363+/* These are the various ioctls */6464+#define MTRRIOC_ADD_ENTRY _IOW(MTRR_IOCTL_BASE, 0, struct mtrr_sentry)6565+#define MTRRIOC_SET_ENTRY _IOW(MTRR_IOCTL_BASE, 1, struct mtrr_sentry)6666+#define MTRRIOC_DEL_ENTRY _IOW(MTRR_IOCTL_BASE, 2, struct mtrr_sentry)6767+#define MTRRIOC_GET_ENTRY _IOWR(MTRR_IOCTL_BASE, 3, struct mtrr_gentry)6868+#define MTRRIOC_KILL_ENTRY _IOW(MTRR_IOCTL_BASE, 4, struct mtrr_sentry)6969+#define MTRRIOC_ADD_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 5, struct mtrr_sentry)7070+#define MTRRIOC_SET_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 6, struct mtrr_sentry)7171+#define MTRRIOC_DEL_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 7, struct mtrr_sentry)7272+#define MTRRIOC_GET_PAGE_ENTRY _IOWR(MTRR_IOCTL_BASE, 8, struct mtrr_gentry)7373+#define MTRRIOC_KILL_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 9, struct mtrr_sentry)7474+7575+/* These are the region types */7676+#define MTRR_TYPE_UNCACHABLE 07777+#define MTRR_TYPE_WRCOMB 17878+/*#define MTRR_TYPE_ 2*/7979+/*#define MTRR_TYPE_ 3*/8080+#define MTRR_TYPE_WRTHROUGH 48181+#define MTRR_TYPE_WRPROT 58282+#define MTRR_TYPE_WRBACK 68383+#define MTRR_NUM_TYPES 78484+185#ifdef __KERNEL__22-# ifdef CONFIG_X86_3233-# include "mtrr_32.h"44-# else55-# include "mtrr_64.h"66-# endif77-#else88-# ifdef __i386__99-# include "mtrr_32.h"1010-# else1111-# include "mtrr_64.h"1212-# endif1313-#endif8686+8787+/* The following functions are for use by other drivers */8888+# ifdef CONFIG_MTRR8989+extern void mtrr_save_fixed_ranges(void *);9090+extern void mtrr_save_state(void);9191+extern int mtrr_add (unsigned long base, unsigned long size,9292+ unsigned int type, char increment);9393+extern int mtrr_add_page (unsigned long base, unsigned long size,9494+ unsigned int type, char increment);9595+extern int mtrr_del (int reg, unsigned long base, unsigned long size);9696+extern int mtrr_del_page (int reg, unsigned long base, unsigned long size);9797+extern void mtrr_centaur_report_mcr(int mcr, u32 lo, u32 hi);9898+extern void mtrr_ap_init(void);9999+extern void mtrr_bp_init(void);100100+# else101101+#define mtrr_save_fixed_ranges(arg) do {} while (0)102102+#define mtrr_save_state() do {} while (0)103103+static __inline__ int mtrr_add (unsigned long base, unsigned long size,104104+ unsigned int type, char increment)105105+{106106+ return -ENODEV;107107+}108108+static __inline__ int mtrr_add_page (unsigned long base, unsigned long size,109109+ unsigned int type, char increment)110110+{111111+ return -ENODEV;112112+}113113+static __inline__ int mtrr_del (int reg, unsigned long base,114114+ unsigned long size)115115+{116116+ return -ENODEV;117117+}118118+static __inline__ int mtrr_del_page (int reg, unsigned long base,119119+ unsigned long size)120120+{121121+ return -ENODEV;122122+}123123+124124+static __inline__ void mtrr_centaur_report_mcr(int mcr, u32 lo, u32 hi) {;}125125+126126+#define mtrr_ap_init() do {} while (0)127127+#define mtrr_bp_init() do {} while (0)128128+# endif129129+130130+#ifdef CONFIG_COMPAT131131+#include <linux/compat.h>132132+133133+struct mtrr_sentry32134134+{135135+ compat_ulong_t base; /* Base address */136136+ compat_uint_t size; /* Size of region */137137+ compat_uint_t type; /* Type of region */138138+};139139+140140+struct mtrr_gentry32141141+{142142+ compat_ulong_t regnum; /* Register number */143143+ compat_uint_t base; /* Base address */144144+ compat_uint_t size; /* Size of region */145145+ compat_uint_t type; /* Type of region */146146+};147147+148148+#define MTRR_IOCTL_BASE 'M'149149+150150+#define MTRRIOC32_ADD_ENTRY _IOW(MTRR_IOCTL_BASE, 0, struct mtrr_sentry32)151151+#define MTRRIOC32_SET_ENTRY _IOW(MTRR_IOCTL_BASE, 1, struct mtrr_sentry32)152152+#define MTRRIOC32_DEL_ENTRY _IOW(MTRR_IOCTL_BASE, 2, struct mtrr_sentry32)153153+#define MTRRIOC32_GET_ENTRY _IOWR(MTRR_IOCTL_BASE, 3, struct mtrr_gentry32)154154+#define MTRRIOC32_KILL_ENTRY _IOW(MTRR_IOCTL_BASE, 4, struct mtrr_sentry32)155155+#define MTRRIOC32_ADD_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 5, struct mtrr_sentry32)156156+#define MTRRIOC32_SET_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 6, struct mtrr_sentry32)157157+#define MTRRIOC32_DEL_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 7, struct mtrr_sentry32)158158+#define MTRRIOC32_GET_PAGE_ENTRY _IOWR(MTRR_IOCTL_BASE, 8, struct mtrr_gentry32)159159+#define MTRRIOC32_KILL_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 9, struct mtrr_sentry32)160160+#endif /* CONFIG_COMPAT */161161+162162+#endif /* __KERNEL__ */163163+164164+#endif /* _ASM_X86_MTRR_H */
-115
include/asm-x86/mtrr_32.h
···11-/* Generic MTRR (Memory Type Range Register) ioctls.22-33- Copyright (C) 1997-1999 Richard Gooch44-55- This library is free software; you can redistribute it and/or66- modify it under the terms of the GNU Library General Public77- License as published by the Free Software Foundation; either88- version 2 of the License, or (at your option) any later version.99-1010- This library is distributed in the hope that it will be useful,1111- but WITHOUT ANY WARRANTY; without even the implied warranty of1212- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU1313- Library General Public License for more details.1414-1515- You should have received a copy of the GNU Library General Public1616- License along with this library; if not, write to the Free1717- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.1818-1919- Richard Gooch may be reached by email at rgooch@atnf.csiro.au2020- The postal address is:2121- Richard Gooch, c/o ATNF, P. O. Box 76, Epping, N.S.W., 2121, Australia.2222-*/2323-#ifndef _LINUX_MTRR_H2424-#define _LINUX_MTRR_H2525-2626-#include <linux/ioctl.h>2727-#include <linux/errno.h>2828-2929-#define MTRR_IOCTL_BASE 'M'3030-3131-struct mtrr_sentry3232-{3333- unsigned long base; /* Base address */3434- unsigned int size; /* Size of region */3535- unsigned int type; /* Type of region */3636-};3737-3838-struct mtrr_gentry3939-{4040- unsigned int regnum; /* Register number */4141- unsigned long base; /* Base address */4242- unsigned int size; /* Size of region */4343- unsigned int type; /* Type of region */4444-};4545-4646-/* These are the various ioctls */4747-#define MTRRIOC_ADD_ENTRY _IOW(MTRR_IOCTL_BASE, 0, struct mtrr_sentry)4848-#define MTRRIOC_SET_ENTRY _IOW(MTRR_IOCTL_BASE, 1, struct mtrr_sentry)4949-#define MTRRIOC_DEL_ENTRY _IOW(MTRR_IOCTL_BASE, 2, struct mtrr_sentry)5050-#define MTRRIOC_GET_ENTRY _IOWR(MTRR_IOCTL_BASE, 3, struct mtrr_gentry)5151-#define MTRRIOC_KILL_ENTRY _IOW(MTRR_IOCTL_BASE, 4, struct mtrr_sentry)5252-#define MTRRIOC_ADD_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 5, struct mtrr_sentry)5353-#define MTRRIOC_SET_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 6, struct mtrr_sentry)5454-#define MTRRIOC_DEL_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 7, struct mtrr_sentry)5555-#define MTRRIOC_GET_PAGE_ENTRY _IOWR(MTRR_IOCTL_BASE, 8, struct mtrr_gentry)5656-#define MTRRIOC_KILL_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 9, struct mtrr_sentry)5757-5858-/* These are the region types */5959-#define MTRR_TYPE_UNCACHABLE 06060-#define MTRR_TYPE_WRCOMB 16161-/*#define MTRR_TYPE_ 2*/6262-/*#define MTRR_TYPE_ 3*/6363-#define MTRR_TYPE_WRTHROUGH 46464-#define MTRR_TYPE_WRPROT 56565-#define MTRR_TYPE_WRBACK 66666-#define MTRR_NUM_TYPES 76767-6868-#ifdef __KERNEL__6969-7070-/* The following functions are for use by other drivers */7171-# ifdef CONFIG_MTRR7272-extern void mtrr_save_fixed_ranges(void *);7373-extern void mtrr_save_state(void);7474-extern int mtrr_add (unsigned long base, unsigned long size,7575- unsigned int type, char increment);7676-extern int mtrr_add_page (unsigned long base, unsigned long size,7777- unsigned int type, char increment);7878-extern int mtrr_del (int reg, unsigned long base, unsigned long size);7979-extern int mtrr_del_page (int reg, unsigned long base, unsigned long size);8080-extern void mtrr_centaur_report_mcr(int mcr, u32 lo, u32 hi);8181-extern void mtrr_ap_init(void);8282-extern void mtrr_bp_init(void);8383-# else8484-#define mtrr_save_fixed_ranges(arg) do {} while (0)8585-#define mtrr_save_state() do {} while (0)8686-static __inline__ int mtrr_add (unsigned long base, unsigned long size,8787- unsigned int type, char increment)8888-{8989- return -ENODEV;9090-}9191-static __inline__ int mtrr_add_page (unsigned long base, unsigned long size,9292- unsigned int type, char increment)9393-{9494- return -ENODEV;9595-}9696-static __inline__ int mtrr_del (int reg, unsigned long base,9797- unsigned long size)9898-{9999- return -ENODEV;100100-}101101-static __inline__ int mtrr_del_page (int reg, unsigned long base,102102- unsigned long size)103103-{104104- return -ENODEV;105105-}106106-107107-static __inline__ void mtrr_centaur_report_mcr(int mcr, u32 lo, u32 hi) {;}108108-109109-#define mtrr_ap_init() do {} while (0)110110-#define mtrr_bp_init() do {} while (0)111111-# endif112112-113113-#endif114114-115115-#endif /* _LINUX_MTRR_H */
-152
include/asm-x86/mtrr_64.h
···11-/* Generic MTRR (Memory Type Range Register) ioctls.22-33- Copyright (C) 1997-1999 Richard Gooch44-55- This library is free software; you can redistribute it and/or66- modify it under the terms of the GNU Library General Public77- License as published by the Free Software Foundation; either88- version 2 of the License, or (at your option) any later version.99-1010- This library is distributed in the hope that it will be useful,1111- but WITHOUT ANY WARRANTY; without even the implied warranty of1212- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU1313- Library General Public License for more details.1414-1515- You should have received a copy of the GNU Library General Public1616- License along with this library; if not, write to the Free1717- Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.1818-1919- Richard Gooch may be reached by email at rgooch@atnf.csiro.au2020- The postal address is:2121- Richard Gooch, c/o ATNF, P. O. Box 76, Epping, N.S.W., 2121, Australia.2222-*/2323-#ifndef _LINUX_MTRR_H2424-#define _LINUX_MTRR_H2525-2626-#include <linux/ioctl.h>2727-2828-#define MTRR_IOCTL_BASE 'M'2929-3030-struct mtrr_sentry3131-{3232- unsigned long base; /* Base address */3333- unsigned int size; /* Size of region */3434- unsigned int type; /* Type of region */3535-};3636-3737-/* Warning: this structure has a different order from i3863838- on x86-64. The 32bit emulation code takes care of that.3939- But you need to use this for 64bit, otherwise your X server4040- will break. */4141-struct mtrr_gentry4242-{4343- unsigned long base; /* Base address */4444- unsigned int size; /* Size of region */4545- unsigned int regnum; /* Register number */4646- unsigned int type; /* Type of region */4747-};4848-4949-/* These are the various ioctls */5050-#define MTRRIOC_ADD_ENTRY _IOW(MTRR_IOCTL_BASE, 0, struct mtrr_sentry)5151-#define MTRRIOC_SET_ENTRY _IOW(MTRR_IOCTL_BASE, 1, struct mtrr_sentry)5252-#define MTRRIOC_DEL_ENTRY _IOW(MTRR_IOCTL_BASE, 2, struct mtrr_sentry)5353-#define MTRRIOC_GET_ENTRY _IOWR(MTRR_IOCTL_BASE, 3, struct mtrr_gentry)5454-#define MTRRIOC_KILL_ENTRY _IOW(MTRR_IOCTL_BASE, 4, struct mtrr_sentry)5555-#define MTRRIOC_ADD_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 5, struct mtrr_sentry)5656-#define MTRRIOC_SET_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 6, struct mtrr_sentry)5757-#define MTRRIOC_DEL_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 7, struct mtrr_sentry)5858-#define MTRRIOC_GET_PAGE_ENTRY _IOWR(MTRR_IOCTL_BASE, 8, struct mtrr_gentry)5959-#define MTRRIOC_KILL_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 9, struct mtrr_sentry)6060-6161-/* These are the region types */6262-#define MTRR_TYPE_UNCACHABLE 06363-#define MTRR_TYPE_WRCOMB 16464-/*#define MTRR_TYPE_ 2*/6565-/*#define MTRR_TYPE_ 3*/6666-#define MTRR_TYPE_WRTHROUGH 46767-#define MTRR_TYPE_WRPROT 56868-#define MTRR_TYPE_WRBACK 66969-#define MTRR_NUM_TYPES 77070-7171-#ifdef __KERNEL__7272-7373-/* The following functions are for use by other drivers */7474-# ifdef CONFIG_MTRR7575-extern int mtrr_add (unsigned long base, unsigned long size,7676- unsigned int type, char increment);7777-extern int mtrr_add_page (unsigned long base, unsigned long size,7878- unsigned int type, char increment);7979-extern int mtrr_del (int reg, unsigned long base, unsigned long size);8080-extern int mtrr_del_page (int reg, unsigned long base, unsigned long size);8181-# else8282-static __inline__ int mtrr_add (unsigned long base, unsigned long size,8383- unsigned int type, char increment)8484-{8585- return -ENODEV;8686-}8787-static __inline__ int mtrr_add_page (unsigned long base, unsigned long size,8888- unsigned int type, char increment)8989-{9090- return -ENODEV;9191-}9292-static __inline__ int mtrr_del (int reg, unsigned long base,9393- unsigned long size)9494-{9595- return -ENODEV;9696-}9797-static __inline__ int mtrr_del_page (int reg, unsigned long base,9898- unsigned long size)9999-{100100- return -ENODEV;101101-}102102-103103-#endif /* CONFIG_MTRR */104104-105105-#ifdef CONFIG_COMPAT106106-#include <linux/compat.h>107107-108108-struct mtrr_sentry32109109-{110110- compat_ulong_t base; /* Base address */111111- compat_uint_t size; /* Size of region */112112- compat_uint_t type; /* Type of region */113113-};114114-115115-struct mtrr_gentry32116116-{117117- compat_ulong_t regnum; /* Register number */118118- compat_uint_t base; /* Base address */119119- compat_uint_t size; /* Size of region */120120- compat_uint_t type; /* Type of region */121121-};122122-123123-#define MTRR_IOCTL_BASE 'M'124124-125125-#define MTRRIOC32_ADD_ENTRY _IOW(MTRR_IOCTL_BASE, 0, struct mtrr_sentry32)126126-#define MTRRIOC32_SET_ENTRY _IOW(MTRR_IOCTL_BASE, 1, struct mtrr_sentry32)127127-#define MTRRIOC32_DEL_ENTRY _IOW(MTRR_IOCTL_BASE, 2, struct mtrr_sentry32)128128-#define MTRRIOC32_GET_ENTRY _IOWR(MTRR_IOCTL_BASE, 3, struct mtrr_gentry32)129129-#define MTRRIOC32_KILL_ENTRY _IOW(MTRR_IOCTL_BASE, 4, struct mtrr_sentry32)130130-#define MTRRIOC32_ADD_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 5, struct mtrr_sentry32)131131-#define MTRRIOC32_SET_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 6, struct mtrr_sentry32)132132-#define MTRRIOC32_DEL_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 7, struct mtrr_sentry32)133133-#define MTRRIOC32_GET_PAGE_ENTRY _IOWR(MTRR_IOCTL_BASE, 8, struct mtrr_gentry32)134134-#define MTRRIOC32_KILL_PAGE_ENTRY _IOW(MTRR_IOCTL_BASE, 9, struct mtrr_sentry32)135135-136136-#endif /* CONFIG_COMPAT */137137-138138-#ifdef CONFIG_MTRR139139-extern void mtrr_ap_init(void);140140-extern void mtrr_bp_init(void);141141-extern void mtrr_save_fixed_ranges(void *);142142-extern void mtrr_save_state(void);143143-#else144144-#define mtrr_ap_init() do {} while (0)145145-#define mtrr_bp_init() do {} while (0)146146-#define mtrr_save_fixed_ranges(arg) do {} while (0)147147-#define mtrr_save_state() do {} while (0)148148-#endif149149-150150-#endif /* __KERNEL__ */151151-152152-#endif /* _LINUX_MTRR_H */