]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Foundation/Cpu/Pentium/CpuIA32Lib/EfiCpuVersion.c
Update the copyright notice format
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Cpu / Pentium / CpuIA32Lib / EfiCpuVersion.c
1 /*++
2
3 Copyright (c) 2004 - 2006, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 EfiCpuVersion.c
15
16 Abstract:
17
18 Provide cpu version extract considering extended family & model ID.
19 --*/
20
21 #include "CpuIA32.h"
22
23 VOID
24 EfiCpuVersion (
25 IN OUT UINT16 *FamilyId, OPTIONAL
26 IN OUT UINT8 *Model, OPTIONAL
27 IN OUT UINT8 *SteppingId, OPTIONAL
28 IN OUT UINT8 *Processor OPTIONAL
29 )
30 /*++
31
32 Routine Description:
33 Extract CPU detail version infomation
34
35 Arguments:
36 FamilyId - FamilyId, including ExtendedFamilyId
37 Model - Model, including ExtendedModel
38 SteppingId - SteppingId
39 Processor - Processor
40
41 --*/
42 {
43 EFI_CPUID_REGISTER Register;
44 UINT8 TempFamilyId;
45
46 EfiCpuid (EFI_CPUID_VERSION_INFO, &Register);
47
48 if (SteppingId != NULL) {
49 *SteppingId = (UINT8) (Register.RegEax & 0xF);
50 }
51
52 if (Processor != NULL) {
53 *Processor = (UINT8) ((Register.RegEax >> 12) & 0x3);
54 }
55
56 if (Model != NULL || FamilyId != NULL) {
57 TempFamilyId = (UINT8) ((Register.RegEax >> 8) & 0xF);
58
59 if (Model != NULL) {
60 *Model = (UINT8) ((Register.RegEax >> 4) & 0xF);
61 if (TempFamilyId == 0x6 || TempFamilyId == 0xF) {
62 *Model = (UINT8) (*Model | ((Register.RegEax >> 12) & 0xF0));
63 }
64 }
65
66 if (FamilyId != NULL) {
67 *FamilyId = TempFamilyId;
68 if (TempFamilyId == 0xF) {
69 *FamilyId = (UINT8 ) (*FamilyId + (UINT16) ((Register.RegEax >> 20) & 0xFF));
70 }
71 }
72 }
73 }