mtrr.h
001: 
002: 
003: 
004: 
005: 
006: 
007: 
008: 
009: 
010: 
011: 
012: 
013: 
014: 
015: 
016: 
017: 
018: 
019: rgooch@atnf.csiro.au
020: 
021: 
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;    
034:     unsigned int size;    
035:     unsigned int type;     
036: };
037: 
038: 
039: 
040: 
041: 
042: 
043: #ifdef __i386__
044: struct mtrr_gentry {
045:     unsigned int regnum;   
046:     unsigned long base;    
047:     unsigned int size;    
048:     unsigned int type;     
049: };
050: 
051: #else 
052: 
053: struct mtrr_gentry {
054:     unsigned long base;    
055:     unsigned int size;    
056:     unsigned int regnum;   
057:     unsigned int type;     
058: };
059: #endif 
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: 
069: 
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: 
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: 
099: #define MTRR_TYPE_UNCACHABLE 0
100: #define MTRR_TYPE_WRCOMB     1
101: 
102: 
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 
110: 
      
      
      
      
   
      
      
         
            
            © Andrew Scott 2006 -
            2025, 
            All Rights Reserved