summaryrefslogtreecommitdiff
path: root/Intel/eblcr.c
blob: 8650603e4df416c2a3b3f8a6f4b1b5c22538044e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
 *  (C) 2001 Dave Jones.
 *
 *  Licensed under the terms of the GNU GPL License version 2.
 *
 *  Bus speed parsing.
 */

#include <stdio.h>
#include "../x86info.h"

void interpret_eblcr(u32 lo)
{
	const unsigned int buscode[2][4] = {
		{ 6667, 13333, 10000, 0 },
		{ 10000, 13333, 10000, 0 }
	};

	const unsigned int mult[32] = {
		10, 6, 8, 0, 11, 7, 9, 0,
		10, 14, 16, 12, 0, 15, 0, 13,
		0, 0, 0, 0, 0, 0, 17, 0,
		0, 0, 0, 0, 0, 0, 0, 0
	};

	int bus = (lo >> 18) & 3;
	int mul = (lo >> 22) & 15;
	int busclock, cpuclk;

	return;	/* too many bugs right now.. fix for a future release */

	if (!user_is_root || !show_eblcr)
		return;

	/*
	 * FIXME:
	 * 766MHz Celeron. 66MHz x 11.5 Being picked up as 133x5.0
	 * bus:1 mul:0
	 */

/*	printf("bus:%x mul:%x\n", bus, mul);*/

	/* The mobile pIII added bit 27.
	 * This is zero on other intel and on the cyrix III */

	if (lo & (1 >> 27))
		mul += 16;

	busclock = buscode[1][bus]/100;

	if (busclock == 0 || mult[mul] == 0)
		printf("Unknown CPU/BUS multiplier (%d X %dMHz, %x).\n", mul, bus, lo);

	cpuclk = (buscode[1][bus] * mult[mul])/200;
	printf("Bus Speed (%dMHz) x Multiplier (%.1fx) = CPU speed %dMhz\n",
		busclock,
		(float) cpuclk/busclock,
		cpuclk);
}