Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 1 2 3 4 5 6


mtrr.h
001: /*  Generic MTRR (Memory Type Range Register) ioctls.
002: 
003:     Copyright (C) 1997-1999  Richard Gooch
004: 
005:     This library is free software; you can redistribute it and/or
006:     modify it under the terms of the GNU Library General Public
007:     License as published by the Free Software Foundation; either
008:     version 2 of the License, or (at your option) any later version.
009: 
010:     This library is distributed in the hope that it will be useful,
011:     but WITHOUT ANY WARRANTY; without even the implied warranty of
012:     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013:     Library General Public License for more details.
014: 
015:     You should have received a copy of the GNU Library General Public
016:     License along with this library; if not, write to the Free
017:     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
018: 
019:     Richard Gooch may be reached by email at  rgooch@atnf.csiro.au
020:     The postal address is:
021:       Richard Gooch, c/o ATNF, P. O. Box 76, Epping, N.S.W., 2121, Australia.
022: */
023: #ifndef _ASM_X86_MTRR_H
024: #define _ASM_X86_MTRR_H
025: 
026: #include <linux/types.h>
027: #include <linux/ioctl.h>
028: #include <linux/errno.h>
029: 
030: #define MTRR_IOCTL_BASE 'M'
031: 
032: struct mtrr_sentry {
033:     unsigned long base;    /*  Base address     */
034:     unsigned int size;    /*  Size of region   */
035:     unsigned int type;     /*  Type of region   */
036: };
037: 
038: /* Warning: this structure has a different order from i386
039:    on x86-64. The 32bit emulation code takes care of that.
040:    But you need to use this for 64bit, otherwise your X server
041:    will break. */
042: 
043: #ifdef __i386__
044: struct mtrr_gentry {
045:     unsigned int regnum;   /*  Register number  */
046:     unsigned long base;    /*  Base address     */
047:     unsigned int size;    /*  Size of region   */
048:     unsigned int type;     /*  Type of region   */
049: };
050: 
051: #else /* __i386__ */
052: 
053: struct mtrr_gentry {
054:     unsigned long base;    /*  Base address     */
055:     unsigned int size;    /*  Size of region   */
056:     unsigned int regnum;   /*  Register number  */
057:     unsigned int type;     /*  Type of region   */
058: };
059: #endif /* !__i386__ */
060: 
061: struct mtrr_var_range {
062:         __u32 base_lo;
063:         __u32 base_hi;
064:         __u32 mask_lo;
065:         __u32 mask_hi;
066: };
067: 
068: /* In the Intel processor's MTRR interface, the MTRR type is always held in
069:    an 8 bit field: */
070: typedef __u8 mtrr_type;
071: 
072: #define MTRR_NUM_FIXED_RANGES 88
073: #define MTRR_MAX_VAR_RANGES 256
074: 
075: struct mtrr_state_type {
076:         struct mtrr_var_range var_ranges[MTRR_MAX_VAR_RANGES];
077:         mtrr_type fixed_ranges[MTRR_NUM_FIXED_RANGES];
078:         unsigned char enabled;
079:         unsigned char have_fixed;
080:         mtrr_type def_type;
081: };
082: 
083: #define MTRRphysBase_MSR(reg) (0x200 + 2 * (reg))
084: #define MTRRphysMask_MSR(reg) (0x200 + 2 * (reg) + 1)
085: 
086: /*  These are the various ioctls  */
087: #define MTRRIOC_ADD_ENTRY        _IOW(MTRR_IOCTL_BASE,  0, struct mtrr_sentry)
088: #define MTRRIOC_SET_ENTRY        _IOW(MTRR_IOCTL_BASE,  1, struct mtrr_sentry)
089: #define MTRRIOC_DEL_ENTRY        _IOW(MTRR_IOCTL_BASE,  2, struct mtrr_sentry)
090: #define MTRRIOC_GET_ENTRY        _IOWR(MTRR_IOCTL_BASE, 3, struct mtrr_gentry)
091: #define MTRRIOC_KILL_ENTRY       _IOW(MTRR_IOCTL_BASE,  4, struct mtrr_sentry)
092: #define MTRRIOC_ADD_PAGE_ENTRY   _IOW(MTRR_IOCTL_BASE,  5, struct mtrr_sentry)
093: #define MTRRIOC_SET_PAGE_ENTRY   _IOW(MTRR_IOCTL_BASE,  6, struct mtrr_sentry)
094: #define MTRRIOC_DEL_PAGE_ENTRY   _IOW(MTRR_IOCTL_BASE,  7, struct mtrr_sentry)
095: #define MTRRIOC_GET_PAGE_ENTRY   _IOWR(MTRR_IOCTL_BASE, 8, struct mtrr_gentry)
096: #define MTRRIOC_KILL_PAGE_ENTRY  _IOW(MTRR_IOCTL_BASE,  9, struct mtrr_sentry)
097: 
098: /*  These are the region types  */
099: #define MTRR_TYPE_UNCACHABLE 0
100: #define MTRR_TYPE_WRCOMB     1
101: /*#define MTRR_TYPE_         2*/
102: /*#define MTRR_TYPE_         3*/
103: #define MTRR_TYPE_WRTHROUGH  4
104: #define MTRR_TYPE_WRPROT     5
105: #define MTRR_TYPE_WRBACK     6
106: #define MTRR_NUM_TYPES       7
107: 
108: 
109: #endif /* _ASM_X86_MTRR_H */
110: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/