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