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