13cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei/*++
23cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
33cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>
43cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
53cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
63cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  This program and the accompanying materials are licensed and made available under
73cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
83cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  the terms and conditions of the BSD License that accompanies this distribution.
93cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
103cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  The full text of the license may be found at
113cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
123cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  http://opensource.org/licenses/bsd-license.php.
133cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
143cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
153cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
163cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
173cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
183cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
193cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
203cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
213cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
223cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
233cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
243cbfba02fef9dae07a041fdbf2e89611d72d6f90David WeiModule Name:
253cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
263cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  PlatformCpuInfo.h
273cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
283cbfba02fef9dae07a041fdbf2e89611d72d6f90David WeiAbstract:
293cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
303cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  GUID used for Platform CPU Info Data entries in the HOB list.
313cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
323cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei--*/
333cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
343cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei#ifndef _PLATFORM_CPU_INFO_GUID_H_
353cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei#define _PLATFORM_CPU_INFO_GUID_H_
363cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
373cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei#include "CpuType.h"
383cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei#include <Library/CpuIA32.h>
393cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
403cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei#define EFI_PLATFORM_CPU_INFO_GUID \
413cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  {\
423cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei    0xbb9c7ab7, 0xb8d9, 0x4bf3, 0x9c, 0x29, 0x9b, 0xf3, 0x41, 0xe2, 0x17, 0xbc \
433cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  }
443cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
453cbfba02fef9dae07a041fdbf2e89611d72d6f90David Weiextern EFI_GUID gEfiPlatformCpuInfoGuid;
463cbfba02fef9dae07a041fdbf2e89611d72d6f90David Weiextern CHAR16   EfiPlatformCpuInfoVariable[];
473cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
483cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei//
493cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei// Tri-state for feature capabilities and enable/disable.
503cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei// [0] clear=feature isn't capable
513cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei// [0] set  =feature is capable
523cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei// [1] clear=feature is disabled
533cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei// [1] set  =feature is enabled
543cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei//
553cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei#define CPU_FEATURES_CAPABLE      BIT0
563cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei#define CPU_FEATURES_ENABLE       BIT1
573cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
583cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei#define MAX_CACHE_DESCRIPTORS     64
593cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei#define MAXIMUM_CPU_BRAND_STRING_LENGTH 48
603cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
613cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei#pragma pack(1)
623cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
633cbfba02fef9dae07a041fdbf2e89611d72d6f90David Weitypedef struct {
643cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT32              FullCpuId;                // [31:0] & 0x0FFF0FFF
653cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT32              FullFamilyModelId;        // [31:0] & 0x0FFF0FF0
663cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               ExtendedFamilyId;         // [27:20]
673cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               ExtendedModelId;          // [19:16]
683cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               ProcessorType;            // [13:11]
693cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               FamilyId;                 // [11:8]
703cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               Model;                    // [7:4]
713cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               SteppingId;               // [3:0]
723cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei} EFI_CPU_VERSION_INFO; // CPUID.1.EAX
733cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
743cbfba02fef9dae07a041fdbf2e89611d72d6f90David Weitypedef struct {
753cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT32              L1InstructionCacheSize;
763cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT32              L1DataCacheSize;
773cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT32              L2CacheSize;
783cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT32              L3CacheSize;
793cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT32              TraceCacheSize;
803cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               CacheDescriptor[MAX_CACHE_DESCRIPTORS];
813cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei} EFI_CPU_CACHE_INFO; // CPUID.2.EAX
823cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
833cbfba02fef9dae07a041fdbf2e89611d72d6f90David Weitypedef struct {
843cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               PhysicalPackages;
853cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               LogicalProcessorsPerPhysicalPackage;
863cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               CoresPerPhysicalPackage;
873cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               ThreadsPerCore;
883cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei} EFI_CPU_PACKAGE_INFO; // CPUID.4.EAX
893cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
903cbfba02fef9dae07a041fdbf2e89611d72d6f90David Weitypedef struct {
913cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT32              RegEdx;                   // CPUID.5.EAX
923cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               MaxCState;
933cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               C0SubCStatesMwait;        // EDX [3:0]
943cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               C1SubCStatesMwait;        // EDX [7:4]
953cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               C2SubCStatesMwait;        // EDX [11:8]
963cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               C3SubCStatesMwait;        // EDX [15:12]
973cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               C4SubCStatesMwait;        // EDX [19:16]
983cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               C5SubCStatesMwait;        // EDX [23:20]
993cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               C6SubCStatesMwait;        // EDX [27:24]
1003cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               C7SubCStatesMwait;        // EDX [31:28]
1013cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               MonitorMwaitSupport;      // ECX [0]
1023cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               InterruptsBreakMwait;     // ECX [1]
1033cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei} EFI_CPU_CSTATE_INFO; // CPUID.5.EAX
1043cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
1053cbfba02fef9dae07a041fdbf2e89611d72d6f90David Weitypedef struct {
1063cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               Turbo;                    // EAX [1]
1073cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               PECI;                     // EAX [0]
1083cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               NumIntThresholds;         // EBX [3:0]
1093cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               HwCoordinationFeedback;   // ECX [0]
1103cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei} EFI_CPU_POWER_MANAGEMENT; // CPUID.6.EAX
1113cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
1123cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei//
1133cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei// IMPORTANT: Each CPU feature enabling entry is assumed a tri-state variable.
1143cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei//   - Keep the respective feature entry variable as default value (0x00)
1153cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei//     if the CPU is not capable for the feature.
1163cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei//   - Use the specially defined programming convention to update the variable
1173cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei//     to indicate capable, enable or disable.
1183cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei//     ie. F_CAPABLE for feature available
1193cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei//         F_ENABLE for feature enable
1203cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei//         F_DISABLE for feature disable
1213cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei//
1223cbfba02fef9dae07a041fdbf2e89611d72d6f90David Weitypedef struct {
1233cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  EFI_CPUID_REGISTER  Regs;                     // CPUID.1.EAX
1243cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               Xapic;                    // ECX [21]
1253cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               SSE4_2;                   // ECX [20]
1263cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               SSE4_1;                   // ECX [19]
1273cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               Dca;                      // ECX [18]
1283cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               SupSSE3;                  // ECX [9]
1293cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               Tm2;                      // ECX [8]
1303cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               Eist;                     // ECX [7]
1313cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               Lt;                       // ECX [6]
1323cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               Vt;                       // ECX [5]
1333cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               Mwait;                    // ECX [3]
1343cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               SSE3;                     // ECX [0]
1353cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               Tcc;                      // EDX [29]
1363cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               Mt;                       // EDX [28]
1373cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               SSE2;                     // EDX [26]
1383cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               SSE;                      // EDX [25]
1393cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               MMX;                      // EDX [23]
1403cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  EFI_CPUID_REGISTER  ExtRegs;                  // CPUID.80000001.EAX
1413cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               ExtLahfSahf64;            // ECX [0]
1423cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               ExtIntel64;               // EDX [29]
1433cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               ExtXd;                    // EDX [20]
1443cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               ExtSysCallRet64;          // EDX [11]
1453cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT16              Ht;                       // CPUID.0B.EAX EBX [15:0]
1463cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei} EFI_CPU_FEATURES; // CPUID.1.EAX, CPUID.0B.EAX, CPUID.80000001.EAX
1473cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
1483cbfba02fef9dae07a041fdbf2e89611d72d6f90David Weitypedef struct {
1493cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               PhysicalBits;
1503cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               VirtualBits;
1513cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei} EFI_CPU_ADDRESS_BITS; // CPUID.80000008.EAX
1523cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
1533cbfba02fef9dae07a041fdbf2e89611d72d6f90David Weitypedef struct {
1543cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               PlatformID;               // MSR 0x17 [52:50]
1553cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT32              MicrocodeRevision;        // MSR 0x8B [63:32]
1563cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               MaxEfficiencyRatio;       // MSR 0xCE [47:40]
1573cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               DdrRatioUnlockCap;        // MSR 0xCE [30]
1583cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               TdcTdpLimitsTurbo;        // MSR 0xCE [29]
1593cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               RatioLimitsTurbo;         // MSR 0xCE [28]
1603cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               PreProduction;            // MSR 0xCE [27]
1613cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               DcuModeSelect;            // MSR 0xCE [26]
1623cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               MaxNonTurboRatio;         // MSR 0xCE [15:8]
1633cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               Emrr;                     // MSR 0xFE [12]
1643cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               Smrr;                     // MSR 0xFE [11]
1653cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               VariableMtrrCount;        // MSR 0xFE [7:0]
1663cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT16              PState;                   // MSR 0x198 [15:0]
1673cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               TccActivationTemperature; // MSR 0x1A2 [23:16]
1683cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               TemperatureControlOffset; // MSR 0x1A2 [15:8]
1693cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT32              PCIeBar;                  // MSR 0x300 [39:20]
1703cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8               PCIeBarSizeMB;            // MSR 0x300 [3:1]
1713cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei} EFI_MSR_FEATURES;
1723cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei
1733cbfba02fef9dae07a041fdbf2e89611d72d6f90David Weitypedef struct {
1743cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  BOOLEAN                            IsIntelProcessor;
1753cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT8                              BrandString[MAXIMUM_CPU_BRAND_STRING_LENGTH + 1];
1763cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT32                             CpuidMaxInputValue;
1773cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  UINT32                             CpuidMaxExtInputValue;
1783cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  EFI_CPU_UARCH                      CpuUarch;
1793cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  EFI_CPU_FAMILY                     CpuFamily;
1803cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  EFI_CPU_PLATFORM                   CpuPlatform;
1813cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  EFI_CPU_TYPE                       CpuType;
1823cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  EFI_CPU_VERSION_INFO               CpuVersion;
1833cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  EFI_CPU_CACHE_INFO                 CpuCache;
1843cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  EFI_CPU_FEATURES                   CpuFeatures;
1853cbfba02fef9dae07a041fdbf2e89611d72d6f90David Wei  EFI_CPU_CSTATE_INFO                CpuCState;
186  EFI_CPU_PACKAGE_INFO               CpuPackage;
187  EFI_CPU_POWER_MANAGEMENT           CpuPowerManagement;
188  EFI_CPU_ADDRESS_BITS               CpuAddress;
189  EFI_MSR_FEATURES                   Msr;
190} EFI_PLATFORM_CPU_INFO;
191
192#pragma pack()
193
194#endif
195