summaryrefslogtreecommitdiff
path: root/Centaur/powersaver.c
blob: 98127b5332429646e979a15be42cbe296042043d (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
 *  (C) 2001 Dave Jones.
 *
 *  Licensed under the terms of the GNU GPL License version 2.
 *
 *  Powersaver MSR decoding.
 */

#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include "../x86info.h"
#include "centaur.h"
#include "powersaver.h"

void decode_powersaver(struct cpudata *cpu)
{
	union msr_powersaver ps;

	if (!user_is_root)
		return;

	dumpmsr(cpu->number, MSR_POWERSAVER, 64);
	printf("\n");

	if (read_msr(cpu->number, MSR_POWERSAVER, &ps.val) != 1) {
		printf("Something went wrong reading MSR_POWERSAVER\n");
		return;
	}

	printf(" RevisionID: %x : ", ps.bits.RevisionID);
	switch (ps.bits.RevisionID) {
		case 0x0:	printf("Initial revision (Software clock multiplier only, no SoftVID)\n");
					break;
		case 0x1:	printf("SoftVID support\n");
					break;
		default:	printf("Unknown (0x%x).\n", ps.bits.RevisionID);
					break;
	}

	printf(" Software clock multiplier is ");
	if (ps.bits.EnableSoftBusRatio == 0)
		printf("disabled\n");
	else {
		printf("enabled\n");
		printf("\tMaxMHzBR4: %s\n", ps.bits.MaxMHzBR4 ? "1" : "0");
		printf("\tMaxMHzBR: ");
		binary (4, ps.bits.MaxMHzBR);
		printf("\tMinMHzBR4: %s\n", ps.bits.MinMHzBR4 ? "1" : "0");
		printf("\tMinMHzBR: ");
		binary (4, ps.bits.MinMHzBR);
	}

	/* these bits invalid if revision == 0*/
	if (ps.bits.RevisionID != 0) {
		printf(" Software VID is ");
		if (ps.bits.EnableSoftVID == 0)
			printf("disabled\n");
		else {
			printf("enabled\n");
			printf("\tVRM Rev=%s\n",
				ps.bits.VRMRev ? "Mobile VRM" : "VRM 8.5");
			printf("\tMinimumVID: ");
			binary (4, ps.bits.MinimumVID);
			printf("\tMaximumVID: ");
			binary (5, ps.bits.MaximumVID);
		}

		if (ps.bits.EnableSoftBusRatio==1) {
			printf("\tEnableSoftBusRatio=Enabled\n");
			printf("\tMaxMHzFSB: ");
			binary (2, ps.bits.MaxMHzFSB);
			printf("\tMinMHzFSB: ");
			binary (2, ps.bits.MinMHzFSB);
		}

		//if (ps.bits.EnableSoftBSEL==1)
		//	printf("\tEnableSoftBSEL=Enabled\n");

		printf("\tSoftBusRatio4=%s\n", ps.bits.SoftBusRatio4 ? "1" : "0");
		printf("\tSoftBusRatio=");
		binary (4, ps.bits.SoftBusRatio);
	}
}