summaryrefslogtreecommitdiff
path: root/Intel/info.c
blob: 166ccbf213be97c1a46b853f7629986a83f9ac85 (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/*
 *  (C) 2001 Dave Jones.
 *
 *  Licensed under the terms of the GNU GPL License version 2.
 *
 * Intel specific parts
 *
 * References:
 *	http://developer.intel.com/
 *	http://microcodes.sourceforge.net/CPUID.htm
 */

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

/* Decode Pentium III CPU serial number */
void decode_serial_number(struct cpudata *cpu)
{
	char *p = cpu->serialno;
	unsigned int eax, ebx, ecx, edx;
	unsigned int signature;

	if (cpu->cpuid_level < 3)
		return;

	cpuid(cpu->number, 1, &eax, NULL, NULL, NULL);
	signature = eax;

	cpuid(cpu->number, 3, &eax, &ebx, &ecx, &edx);
	p += sprintf(p, "%04X", signature >> 16);
	p += sprintf(p, "-%04X", signature & 0xffff);
	p += sprintf(p, "-%04X", edx >> 16);
	p += sprintf(p, "-%04X", edx & 0xffff);
	p += sprintf(p, "-%04X", ecx >> 16);
	p += sprintf(p, "-%04X\n", ecx & 0xffff);

	printf("Processor serial: %s\n", cpu->serialno);
}

static void decode_brand(struct cpudata *cpu)
{
	printf(")\tBrand: %u (", cpu->brand);
	switch (cpu->brand) {
	case 1:
	case 0xA:
	case 0x14:	printf("Intel® Celeron® processor");
			break;
	case 2:
	case 4:		printf("Intel® Pentium® III processor");
			break;
	case 3:		if (tuple(cpu) == 0x6b1)
				printf("Intel® Celeron® processor");
			else
				printf("Intel® Pentium® III Xeon processor");
			break;
	case 6:		printf("Mobile Intel® Pentium® III processor");
			break;
	case 7:
	case 0xF:
	case 0x17:	printf("Mobile Intel® Celeron® processor");
			break;
	case 8:		if (tuple(cpu) >= 0xf13)
				printf("Intel® genuine processor");
			else
			printf("Intel® Pentium® 4 processor");
			break;
	case 9:		printf("Intel® Pentium® 4 processor");
			break;

	case 0xb:	if (tuple(cpu) <0xf13)
				printf("Intel® Xeon processor MP");
			else
				printf("Intel® Xeon processor");
			break;
	case 0xc:	printf("Intel® Xeon processor");
			break;
	case 0xe:	if (tuple(cpu) <0xf13)
				printf("Intel® Xeon processor");
			else
				printf("Mobile Intel® Pentium® 4 processor-M");
			break;
	case 0x11:
	case 0x15:	printf("Mobile Genuine Intel® processor");
			break;
	case 0x12:	printf("Intel® Celeron® M processor");
			break;
	case 0x13:	printf("Mobile Intel® Celeron® processor");
			break;
	case 0x16:	printf("Intel® Pentium® M processor");
			break;
	default:	printf("unknown");
			break;
	}
	printf(")\n");
}

void display_Intel_info(struct cpudata *cpu)
{
	printf("Type: %u (", cpu->type);
	switch (cpu->type) {
	case 0:	printf("Original OEM");
		break;
	case 1:	printf("Overdrive");
		break;
	case 2:	printf("Dual-capable");
		break;
	case 3:	printf("Reserved");
		break;
	}

	if (cpu->brand > 0)
		decode_brand(cpu);

	if (show_msr) {
		if (cpu->family == 0xf)
			dump_p4_MSRs(cpu);
		if (cpu->family == 0x6 && (cpu->model == 9 || model(cpu) >= 13))
			dump_centrino_MSRs(cpu);
	}

	if (show_eblcr) {
		if (cpu->family == 6 && cpu->model >= 3) {
			unsigned long long eblcr;
			read_msr(cpu->number, 0x2A, &eblcr);
			interpret_eblcr(eblcr);
		}
	}

	/* FIXME: Bit test for MCA here!*/
	if (show_bluesmoke)
		decode_Intel_bluesmoke(cpu->number, cpu->family);

	if (show_microcode)
		decode_microcode(cpu);

	show_intel_topology(cpu);
}