Imported Upstream version 1.30
[platform/upstream/x86info.git] / Intel / microcode.c
1 /*
2  *  (C) 2002 Dave Jones.
3  *
4  *  Licensed under the terms of the GNU GPL License version 2.
5  *
6  *  Intel P6 microcode information.
7  */
8
9 #include <stdio.h>
10 #include <unistd.h>
11 #include <sys/types.h>
12 #include "../x86info.h"
13 #include "Intel.h"
14
15 void decode_microcode(struct cpudata *cpu)
16 {
17         unsigned long long val = 0;
18         int ver;
19
20         if (!user_is_root)
21                 return;
22
23         if (cpu->family < 6)
24                 return;
25
26         if (read_msr (cpu->number, MSR_IA32_UCODE_REV, &val) == 1) {
27                 ver = val >>32;
28                 if (ver>0)
29                         printf("Microcode version: 0x%016llx\n", val >>32);
30                 printf("\n");
31         }
32 }