1 | /*␊ |
2 | * Copyright 2008 Islam Ahmed Zaid. All rights reserved. <azismed@gmail.com>␊ |
3 | * AsereBLN: 2009: cleanup and bugfix␊ |
4 | */␊ |
5 | ␊ |
6 | #ifndef __LIBSAIO_CPU_H␊ |
7 | #define __LIBSAIO_CPU_H␊ |
8 | ␊ |
9 | #include "libsaio.h"␊ |
10 | extern void scan_cpu(PlatformInfo_t *);␊ |
11 | ␊ |
12 | #define bit(n)␉␉␉(1UL << (n))␊ |
13 | #define bitmask(h,l)␉␉((bit(h)|(bit(h)-1)) & ~(bit(l)-1))␊ |
14 | #define bitfield(x,h,l)␉␉(((x) & bitmask(h,l)) >> l)␊ |
15 | ␊ |
16 | #define MSR_FSB_FREQ␉␉␉0x000000cd␊ |
17 | #define MSR_IA32_PLATFORM_ID␉0x00000017␊ |
18 | #define␉IA32_PERF_STATUS␉␉0x198␊ |
19 | #define MSR_FLEX_RATIO␉␉␉0x194␊ |
20 | #define␉MSR_PLATFORM_INFO␉␉0xCE␊ |
21 | #define K8_FIDVID_STATUS␉␉0xC0010042␊ |
22 | #define K10_COFVID_STATUS␉␉0xC0010071␊ |
23 | ␊ |
24 | #define DEFAULT_FSB␉␉100000 /* for now, hardcoding 100MHz for old CPUs */␊ |
25 | ␊ |
26 | // DFE: This constant comes from older xnu:␊ |
27 | #define CLKNUM␉␉␉1193182␉␉/* formerly 1193167 */␊ |
28 | ␊ |
29 | // DFE: These two constants come from Linux except CLOCK_TICK_RATE replaced with CLKNUM␊ |
30 | #define CALIBRATE_TIME_MSEC␉30␉␉/* 30 msecs */␊ |
31 | #define CALIBRATE_LATCH␉␉((CLKNUM * CALIBRATE_TIME_MSEC + 1000/2)/1000)␊ |
32 | ␊ |
33 | #endif /* !__LIBSAIO_CPU_H */␊ |
34 | |