Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
msr.cpp
Go to the documentation of this file.
1 /* Copyright (c) 2010 Wildfire Games
2  *
3  * Permission is hereby granted, free of charge, to any person obtaining
4  * a copy of this software and associated documentation files (the
5  * "Software"), to deal in the Software without restriction, including
6  * without limitation the rights to use, copy, modify, merge, publish,
7  * distribute, sublicense, and/or sell copies of the Software, and to
8  * permit persons to whom the Software is furnished to do so, subject to
9  * the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included
12  * in all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  */
22 
23 #include "precompiled.h"
25 
28 
29 
30 namespace MSR {
31 
33 {
35  return false;
36 
37  // only read/writable from ring 0, so we need the driver.
38  if(mahaf_Init() < 0)
39  return false;
40 
41  return true;
42 }
43 
44 
46 {
47 #if 1
48  // the documentation is unclear. until it improves, disable
49  // this, lest we provoke a GPF.
50  return false;
51 #else
53  return false;
54 
55  if(x86_x64::Family() < 6)
56  return false;
57 
58  if(x86_x64::Model() < 0xE)
59  return false;
60 
61  return true;
62 #endif
63 }
64 
65 
67 {
69  return false;
70 
71  if(x86_x64::Family() != 6)
72  return false;
73 
74  switch(x86_x64::Model())
75  {
76  // section 34.4 in 253665-041US
81  return true;
82 
83  // section 34.5
86  return true;
87 
88  // section 34.6
90  return true;
91 
92  // section 34.7
95  return true;
96 
97  default:
98  return false;
99  }
100 }
101 
102 
103 bool HasUncore()
104 {
106  return false;
107 
108  if(x86_x64::Family() != 6)
109  return false;
110 
111  switch(x86_x64::Model())
112  {
113  // Xeon 5500 / i7 (section B.4.1 in 253669-037US)
114  case 0x1A: // Bloomfield, Gainstown
115  case 0x1E: // Clarksfield, Lynnfield, Jasper Forest
116  case 0x1F:
117  return true;
118 
119  // Xeon 5600 / Westmere (section B.5)
120  case 0x25: // Clarkdale, Arrandale
121  case 0x2C: // Gulftown
122  return true;
123 
124  default:
125  return false;
126  }
127 }
128 
129 
131 {
133 }
134 
135 
136 void Write(u64 reg, u64 value)
137 {
139 }
140 
141 } // namespace MSR
Status mahaf_Init()
Definition: mahaf.cpp:390
bool HasUncore()
Definition: msr.cpp:103
bool IsAccessible()
Definition: msr.cpp:32
Vendors Vendor()
Definition: x86_x64.cpp:200
void mahaf_WriteModelSpecificRegister(u64 reg, u64 value)
Definition: mahaf.cpp:181
u64 mahaf_ReadModelSpecificRegister(u64 reg)
Definition: mahaf.cpp:171
bool HasPlatformInfo()
Definition: msr.cpp:66
#define u64
Definition: types.h:42
bool Cap(Caps cap)
Definition: x86_x64.cpp:142
bool HasEnergyPerfBias()
Definition: msr.cpp:45
u64 Read(u64 reg)
Definition: msr.cpp:130
size_t Family()
Definition: x86_x64.cpp:238
void Write(u64 reg, u64 value)
Definition: msr.cpp:136
size_t Model()
Definition: x86_x64.cpp:232