33extern UINT8 ProcessorSubClassStrings[];
35#define CACHE_SOCKETED_SHIFT 3
36#define CACHE_LOCATION_SHIFT 5
37#define CACHE_ENABLED_SHIFT 7
38#define CACHE_OPERATION_MODE_SHIFT 8
62 EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION,
68 ProcessorFamilyIndicatorFamily2,
86 ProcessorUpgradeUnknown,
108#define SET_HII_STRING_IF_PCD_NOT_EMPTY(Pcd, StringId) \
111 Str = (CHAR16*)PcdGetPtr (Pcd); \
112 if (StrLen (Str) > 0) { \
113 HiiSetString (mHiiHandle, StringId, Str, NULL); \
126 IN UINT8 ProcessorNumber
129 return (UINT16)(
OemGetCpuFreq (ProcessorNumber) / 1000 / 1000);
145 IN BOOLEAN DataCache,
146 IN BOOLEAN UnifiedCache,
147 OUT CHAR16 *CacheSocketStr
150 UINTN CacheSocketStrLen;
152 if ((CacheLevel == CpuCacheL1) && !DataCache && !UnifiedCache) {
156 L
"L%x Instruction Cache",
159 }
else if ((CacheLevel == CpuCacheL1) && DataCache) {
175 return CacheSocketStrLen;
190 IN BOOLEAN DataCache,
191 IN BOOLEAN UnifiedCache,
200 if (!DataCache && !UnifiedCache) {
201 Type7Record->SystemCacheType = CacheTypeInstruction;
202 }
else if (DataCache) {
203 Type7Record->SystemCacheType = CacheTypeData;
204 }
else if (UnifiedCache) {
205 Type7Record->SystemCacheType = CacheTypeUnified;
225 if (CacheSize64 < MAX_INT16) {
226 CacheSize16 = CacheSize64;
227 CacheSize32 = CacheSize16;
228 }
else if ((CacheSize64 / 64) < MAX_INT16) {
229 CacheSize16 = (1 << 15) | (CacheSize64 / 64);
230 CacheSize32 = (1 << 31) | (CacheSize64 / 64);
232 if ((CacheSize64 / 1024) <= 2047) {
233 CacheSize32 = CacheSize64;
235 CacheSize32 = (1 << 31) | (CacheSize64 / 64);
241 Type7Record->MaximumCacheSize = CacheSize16;
242 Type7Record->InstalledSize = CacheSize16;
243 Type7Record->MaximumCacheSize2 = CacheSize32;
244 Type7Record->InstalledSize2 = CacheSize32;
246 switch (Associativity) {
248 Type7Record->Associativity = CacheAssociativity2Way;
251 Type7Record->Associativity = CacheAssociativity4Way;
254 Type7Record->Associativity = CacheAssociativity8Way;
257 Type7Record->Associativity = CacheAssociativity12Way;
260 Type7Record->Associativity = CacheAssociativity16Way;
263 Type7Record->Associativity = CacheAssociativity20Way;
266 Type7Record->Associativity = CacheAssociativity24Way;
269 Type7Record->Associativity = CacheAssociativity32Way;
272 Type7Record->Associativity = CacheAssociativity48Way;
275 Type7Record->Associativity = CacheAssociativity64Way;
278 Type7Record->Associativity = CacheAssociativityOther;
282 Type7Record->CacheConfiguration = (
CacheModeUnknown << CACHE_OPERATION_MODE_SHIFT) |
283 (1 << CACHE_ENABLED_SHIFT) |
285 (0 << CACHE_SOCKETED_SHIFT) |
300 IN BOOLEAN DataCache,
301 IN BOOLEAN UnifiedCache
305 EFI_STRING CacheSocketStr;
306 UINTN CacheSocketStrLen;
307 UINTN StringBufferSize;
308 CHAR8 *OptionalStrStart;
314 if (CacheSocketStr ==
NULL) {
327 if (Type7Record ==
NULL) {
332 Type7Record->Hdr.Type = EFI_SMBIOS_TYPE_CACHE_INFORMATION;
336 Type7Record->SocketDesignation = 1;
338 Type7Record->SupportedSRAMType.Unknown = 1;
339 Type7Record->CurrentSRAMType.Unknown = 1;
340 Type7Record->CacheSpeed = 0;
343 OptionalStrStart = (CHAR8 *)(Type7Record + 1);
362 OUT EFI_SMBIOS_HANDLE *L1CacheHandle,
363 OUT EFI_SMBIOS_HANDLE *L2CacheHandle,
364 OUT EFI_SMBIOS_HANDLE *L3CacheHandle
369 EFI_SMBIOS_HANDLE SmbiosHandle;
372 BOOLEAN DataCacheType;
373 BOOLEAN SeparateCaches;
382 if (MaxCacheLevel < 1) {
386 for (CacheLevel = 1; CacheLevel <= MaxCacheLevel; CacheLevel++) {
395 for (DataCacheType = 0; DataCacheType <= 1; DataCacheType++) {
397 if ((DataCacheType == 1) && !SeparateCaches) {
406 if (Type7Record ==
NULL) {
431 Status = mSmbios->Add (
437 if (EFI_ERROR (Status)) {
442 switch (CacheLevel) {
444 *L1CacheHandle = SmbiosHandle;
447 *L2CacheHandle = SmbiosHandle;
450 *L3CacheHandle = SmbiosHandle;
474 UINT8 ProcessorIndex,
479 EFI_STRING_ID ProcessorManu;
480 EFI_STRING_ID ProcessorVersion;
481 EFI_STRING_ID SerialNumber;
482 EFI_STRING_ID AssetTag;
483 EFI_STRING_ID PartNumber;
484 EFI_STRING ProcessorStr;
485 EFI_STRING ProcessorManuStr;
486 EFI_STRING ProcessorVersionStr;
487 EFI_STRING SerialNumberStr;
488 EFI_STRING AssetTagStr;
489 EFI_STRING PartNumberStr;
490 CHAR8 *OptionalStrStart;
492 UINTN ProcessorStrLen;
493 UINTN ProcessorManuStrLen;
494 UINTN ProcessorVersionStrLen;
495 UINTN SerialNumberStrLen;
496 UINTN AssetTagStrLen;
497 UINTN PartNumberStrLen;
499 UINTN StringBufferSize;
503 ProcessorManuStr =
NULL;
504 ProcessorVersionStr =
NULL;
505 SerialNumberStr =
NULL;
507 PartNumberStr =
NULL;
509 ProcessorManu =
STRING_TOKEN (STR_PROCESSOR_MANUFACTURE);
510 ProcessorVersion =
STRING_TOKEN (STR_PROCESSOR_VERSION);
511 SerialNumber =
STRING_TOKEN (STR_PROCESSOR_SERIAL_NUMBER);
539 if (ProcessorStr ==
NULL) {
540 return EFI_OUT_OF_RESOURCES;
552 ProcessorManuStrLen =
StrLen (ProcessorManuStr);
556 ProcessorVersionStrLen =
StrLen (ProcessorVersionStr);
560 SerialNumberStrLen =
StrLen (SerialNumberStr);
564 AssetTagStrLen =
StrLen (AssetTagStr);
568 PartNumberStrLen =
StrLen (PartNumberStr);
571 ProcessorStrLen + 1 +
572 ProcessorManuStrLen + 1 +
573 ProcessorVersionStrLen + 1 +
574 SerialNumberStrLen + 1 +
576 PartNumberStrLen + 1 + 1;
579 if (*Type4Record ==
NULL) {
580 Status = EFI_OUT_OF_RESOURCES;
586 OptionalStrStart = (CHAR8 *)(*Type4Record + 1);
593 StrStart = OptionalStrStart + ProcessorStrLen + 1;
597 ProcessorManuStrLen + 1
600 StrStart += ProcessorManuStrLen + 1;
604 ProcessorVersionStrLen + 1
607 StrStart += ProcessorVersionStrLen + 1;
611 SerialNumberStrLen + 1
614 StrStart += SerialNumberStrLen + 1;
621 StrStart += AssetTagStrLen + 1;
652 EFI_SMBIOS_HANDLE SmbiosHandle;
653 EFI_SMBIOS_HANDLE L1CacheHandle;
654 EFI_SMBIOS_HANDLE L2CacheHandle;
655 EFI_SMBIOS_HANDLE L3CacheHandle;
656 UINT8 *LegacyVoltage;
661 BOOLEAN ProcessorPopulated;
671 L1CacheHandle = 0xFFFF;
672 L2CacheHandle = 0xFFFF;
673 L3CacheHandle = 0xFFFF;
682 if (EFI_ERROR (Status)) {
690 &Type4Record->ProcessorCharacteristics,
694 if (ProcessorPopulated) {
703 LegacyVoltage = (UINT8 *)&Type4Record->Voltage;
705 *LegacyVoltage = MiscProcessorData.
Voltage;
706 Type4Record->CurrentSpeed = MiscProcessorData.
CurrentSpeed;
707 Type4Record->MaxSpeed = MiscProcessorData.
MaxSpeed;
708 Type4Record->Status = ProcessorStatus.Data;
709 Type4Record->L1CacheHandle = L1CacheHandle;
710 Type4Record->L2CacheHandle = L2CacheHandle;
711 Type4Record->L3CacheHandle = L3CacheHandle;
712 Type4Record->CoreCount =
MIN (MiscProcessorData.
CoreCount, MAX_UINT8);
713 Type4Record->CoreCount2 = MiscProcessorData.
CoreCount;
714 Type4Record->EnabledCoreCount =
MIN (MiscProcessorData.
CoresEnabled, MAX_UINT8);
715 Type4Record->EnabledCoreCount2 = MiscProcessorData.
CoresEnabled;
716 Type4Record->ThreadCount =
MIN (MiscProcessorData.
ThreadCount, MAX_UINT8);
717 Type4Record->ThreadCount2 = MiscProcessorData.
ThreadCount;
720 Type4Record->ExternalClock =
723 ProcessorId = (UINT64 *)&Type4Record->ProcessorId;
727 Type4Record->ProcessorCharacteristics |= *((UINT64 *)&ProcessorCharacteristics);
733 Status = mSmbios->Add (
740 if (EFI_ERROR (Status)) {
743 "[%a]:[%dL] Smbios Type04 Table Log Failed! %r \n",
772 UINT32 ProcessorIndex;
777 Status =
gBS->LocateProtocol (&gEfiSmbiosProtocolGuid,
NULL, (VOID **)&mSmbios);
778 if (EFI_ERROR (Status)) {
779 DEBUG ((DEBUG_ERROR,
"Could not locate SMBIOS protocol. %r\n", Status));
789 ProcessorSubClassStrings,
793 if (mHiiHandle ==
NULL) {
794 return EFI_OUT_OF_RESOURCES;
802 if (EFI_ERROR (Status)) {
803 DEBUG ((DEBUG_ERROR,
"Add Processor Type Table Failed! %r.\n", Status));
RETURN_STATUS EFIAPI UnicodeStrToAsciiStrS(IN CONST CHAR16 *Source, OUT CHAR8 *Destination, IN UINTN DestMax)
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
EFI_HII_HANDLE EFIAPI HiiAddPackages(IN CONST EFI_GUID *PackageListGuid, IN EFI_HANDLE DeviceHandle OPTIONAL,...)
EFI_STRING EFIAPI HiiGetPackageString(IN CONST EFI_GUID *PackageListGuid, IN EFI_STRING_ID StringId, IN CONST CHAR8 *Language OPTIONAL)
EFI_STRING_ID EFIAPI HiiSetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId OPTIONAL, IN CONST EFI_STRING String, IN CONST CHAR8 *SupportedLanguages OPTIONAL)
#define SMBIOS_STRING_MAX_LENGTH
#define SMBIOS_HANDLE_PI_RESERVED
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
#define DEBUG(Expression)
BOOLEAN EFIAPI OemIsProcessorPresent(IN UINTN ProcessorIndex)
VOID EFIAPI OemUpdateSmbiosInfo(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID TokenToUpdate, IN OEM_MISC_SMBIOS_HII_STRING_FIELD Field)
BOOLEAN EFIAPI OemGetProcessorInformation(IN UINTN ProcessorIndex, IN OUT PROCESSOR_STATUS_DATA *ProcessorStatus, IN OUT PROCESSOR_CHARACTERISTIC_FLAGS *ProcessorCharacteristics, IN OUT OEM_MISC_PROCESSOR_DATA *MiscProcessorData)
UINTN EFIAPI OemGetCpuFreq(IN UINT8 ProcessorIndex)
BOOLEAN EFIAPI OemGetCacheInformation(IN UINT8 ProcessorIndex, IN UINT8 CacheLevel, IN BOOLEAN DataCache, IN BOOLEAN UnifiedCache, IN OUT SMBIOS_TABLE_TYPE7 *SmbiosCacheTable)
UINT8 EFIAPI OemGetMaxProcessors(VOID)
#define FixedPcdGetPtr(TokenName)
#define SET_HII_STRING_IF_PCD_NOT_EMPTY(Pcd, StringId)
SMBIOS_TABLE_TYPE7 * AllocateAndInitCacheInformation(IN UINT8 CacheLevel, IN BOOLEAN DataCache, IN BOOLEAN UnifiedCache)
VOID ConfigureCacheArchitectureInformation(IN UINT8 CacheLevel, IN BOOLEAN DataCache, IN BOOLEAN UnifiedCache, OUT SMBIOS_TABLE_TYPE7 *Type7Record)
VOID AddSmbiosCacheTypeTable(IN UINTN ProcessorIndex, OUT EFI_SMBIOS_HANDLE *L1CacheHandle, OUT EFI_SMBIOS_HANDLE *L2CacheHandle, OUT EFI_SMBIOS_HANDLE *L3CacheHandle)
EFI_STATUS AllocateType4AndSetProcessorInformationStrings(SMBIOS_TABLE_TYPE4 **Type4Record, UINT8 ProcessorIndex, BOOLEAN Populated)
UINT16 GetCpuFrequency(IN UINT8 ProcessorNumber)
@ CacheLocationUnknown
Cache location is unknown.
@ CacheLocationReserved
Reserved.
@ CacheLocationInternal
Cache is internal to the processor.
@ CacheLocationExternal
Cache is external to the processor.
EFI_STATUS AddSmbiosProcessorTypeTable(IN UINTN ProcessorIndex)
@ CacheModeVariesWithAddress
Cache mode varies by address.
@ CacheModeWriteBack
Cache is write-back.
@ CacheModeWriteThrough
Cache is write-through.
@ CacheModeUnknown
Cache mode is unknown.
UINTN GetCacheSocketStr(IN UINT8 CacheLevel, IN BOOLEAN DataCache, IN BOOLEAN UnifiedCache, OUT CHAR16 *CacheSocketStr)
EFI_STATUS EFIAPI ProcessorSubClassEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
UINT64 SmbiosProcessorGetCacheSize(IN UINT8 CacheLevel, IN BOOLEAN DataCache, IN BOOLEAN UnifiedCache)
UINT8 SmbiosProcessorGetMaxCacheLevel(VOID)
UINTN SmbiosGetExternalClockFrequency(VOID)
UINT8 SmbiosGetProcessorFamily(VOID)
BOOLEAN SmbiosProcessorHasSeparateCaches(UINT8 CacheLevel)
UINT16 SmbiosGetProcessorFamily2(VOID)
UINT64 SmbiosGetProcessorId(VOID)
UINT32 SmbiosProcessorGetCacheAssociativity(IN UINT8 CacheLevel, IN BOOLEAN DataCache, IN BOOLEAN UnifiedCache)
PROCESSOR_CHARACTERISTIC_FLAGS SmbiosGetProcessorCharacteristics(VOID)
VOID EFIAPI Exit(IN EFI_STATUS Status)
UINT16 MaxSpeed
Maximum clock speed in MHz.
UINT16 ThreadCount
Number of threads per processor.
UINT8 Voltage
Processor voltage.
UINT16 CurrentSpeed
Current clock speed in MHz.
UINT16 CoreCount
Number of cores available.
UINT16 CoresEnabled
Number of cores enabled.
UINT8 ProcessorFamily
The enumeration value from PROCESSOR_FAMILY_DATA.
UINT8 ErrorCorrectionType
The enumeration value from CACHE_ERROR_TYPE_DATA.