@@ -119,7 +119,7 @@ cpuidhz_hypervisor()
119
119
static int64_t
120
120
cpuidhz (uint32_t * info0 , uint32_t * info1 , CpuHypervisor hypervisor )
121
121
{
122
- int f , r ;
122
+ int f = -1 , r ;
123
123
int64_t hz ;
124
124
uint64_t msr ;
125
125
char * vendorid ;
@@ -191,6 +191,14 @@ cpuidhz(uint32_t *info0, uint32_t *info1, CpuHypervisor hypervisor)
191
191
hz = ((rdmsr (0x2a )>>22 ) & 0x1f )* 100 * 1000000ll ;
192
192
//print("msr 2a is 0x%x >> 22 0x%x\n", rdmsr(0x2a), rdmsr(0x2a)>>22);
193
193
break ;
194
+ case 0x000306a0 : /* i7,5,3 3xxx */
195
+ // reading msr 0xcd gets a GPF on this CPU.
196
+ // per the coreboot irc:
197
+ // <icon[m]> rminnich: if you need the base for the core's clock multiplier, it's 100MHz since sandybridge
198
+ // Which, going by the Good Book (35-46 volume 3C) is index 5.
199
+ f = 5 ;
200
+ // This will likely be true of many of the CPUs below. FSB did a *long* time ago.
201
+ // fallthrough
194
202
case 0x000006e0 : /* Core Duo */
195
203
case 0x000006f0 : /* Core 2 Duo/Quad/Extreme */
196
204
case 0x00000660 : /* kvm over i5 */
@@ -203,7 +211,6 @@ cpuidhz(uint32_t *info0, uint32_t *info1, CpuHypervisor hypervisor)
203
211
case 0x000106e0 : /* i7,5,3 8xx */
204
212
case 0x000206a0 : /* i7,5,3 2xxx */
205
213
case 0x000206c0 : /* i7,5,3 4xxx */
206
- case 0x000306a0 : /* i7,5,3 3xxx */
207
214
case 0x000306f0 : /* i7,5,3 5xxx */
208
215
case 0x000506e0 : /* i7,5,3 6xxx */
209
216
case 0x00050650 : /* i9 7900X */
@@ -221,7 +228,8 @@ cpuidhz(uint32_t *info0, uint32_t *info1, CpuHypervisor hypervisor)
221
228
msr = 0 ;
222
229
r = rdmsr (0x2a ) & 0x1f ;
223
230
}
224
- f = rdmsr (0xcd ) & 0x07 ;
231
+ if (f < 0 )
232
+ f = rdmsr (0xcd ) & 0x07 ;
225
233
//iprint("rdmsr Intel: %d\n", rdmsr(0x2a));
226
234
//iprint("Intel msr.lo %d\n", r);
227
235
//iprint("Intel msr.hi %d\n", f);
0 commit comments