| 1 |
|
| 2 |
|
| 3 |
#define __SIMPLE_DEVICE__ |
| 4 |
#include <console/console.h> |
| 5 |
#include <device/pci_ops.h> |
| 6 |
#include <static_devices.h> |
| 7 |
#include <delay.h> |
| 8 |
|
| 9 |
static unsigned int read_timer_fsb(void) |
| 10 |
{ |
| 11 |
|
| 12 |
pci_write_config8(_sdev_host_ctrl, 0x4f, 0x01); |
| 13 |
|
| 14 |
const u8 misc_1 = pci_read_config8(_sdev_host_if, 0x54); |
| 15 |
switch (misc_1 >> 5) { |
| 16 |
case 0: |
| 17 |
return 100; |
| 18 |
case 1: |
| 19 |
return 133; |
| 20 |
case 2: |
| 21 |
return 166; |
| 22 |
case 3: |
| 23 |
return 200; |
| 24 |
default: |
| 25 |
printk(BIOS_WARNING, "Unknown FSB frequency encoding: 0x%x\n", misc_1 >> 5); |
| 26 |
return 200; |
| 27 |
} |
| 28 |
} |
| 29 |
|
| 30 |
u32 get_timer_fsb(void) |
| 31 |
{ |
| 32 |
static unsigned int fsb_mhz; |
| 33 |
|
| 34 |
if (!fsb_mhz) |
| 35 |
fsb_mhz = read_timer_fsb(); |
| 36 |
|
| 37 |
return fsb_mhz; |
| 38 |
} |