TianoCore EDK2 master
Loading...
Searching...
No Matches
ProcessorSubClass.c
Go to the documentation of this file.
1
12#include <Uefi.h>
13#include <Protocol/Smbios.h>
17#include <Library/ArmLib.h>
18#include <Library/ArmSmcLib.h>
19#include <Library/BaseLib.h>
21#include <Library/DebugLib.h>
22#include <Library/HiiLib.h>
23#include <Library/IoLib.h>
25#include <Library/OemMiscLib.h>
26#include <Library/PcdLib.h>
27#include <Library/PrintLib.h>
29#include <Library/UefiLib.h>
30
31#include "SmbiosProcessor.h"
32
33extern UINT8 ProcessorSubClassStrings[];
34
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
39
40typedef enum {
45 CacheModeMax
47
48typedef enum {
53 CacheLocationMax
55
56EFI_HII_HANDLE mHiiHandle;
57
58EFI_SMBIOS_PROTOCOL *mSmbios;
59
60SMBIOS_TABLE_TYPE4 mSmbiosProcessorTableTemplate = {
61 { // Hdr
62 EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION, // Type
63 sizeof (SMBIOS_TABLE_TYPE4), // Length
64 0 // Handle
65 },
66 1, // Socket
67 CentralProcessor, // ProcessorType
68 ProcessorFamilyIndicatorFamily2, // ProcessorFamily
69 2, // ProcessorManufacture
70 { // ProcessorId
71 { // Signature
72 0
73 },
74 { // FeatureFlags
75 0
76 }
77 },
78 3, // ProcessorVersion
79 { // Voltage
80 0
81 },
82 0, // ExternalClock
83 0, // MaxSpeed
84 0, // CurrentSpeed
85 0, // Status
86 ProcessorUpgradeUnknown, // ProcessorUpgrade
87 0xFFFF, // L1CacheHandle
88 0xFFFF, // L2CacheHandle
89 0xFFFF, // L3CacheHandle
90 4, // SerialNumber
91 5, // AssetTag
92 6, // PartNumber
93 0, // CoreCount
94 0, // EnabledCoreCount
95 0, // ThreadCount
96 0, // ProcessorCharacteristics
97 ProcessorFamilyARM, // ProcessorFamily2
98 0, // CoreCount2
99 0, // EnabledCoreCount2
100 0 // ThreadCount2
101};
102
108#define SET_HII_STRING_IF_PCD_NOT_EMPTY(Pcd, StringId) \
109 do { \
110 CHAR16 *Str; \
111 Str = (CHAR16*)PcdGetPtr (Pcd); \
112 if (StrLen (Str) > 0) { \
113 HiiSetString (mHiiHandle, StringId, Str, NULL); \
114 } \
115 } while (0)
116
124UINT16
126 IN UINT8 ProcessorNumber
127 )
128{
129 return (UINT16)(OemGetCpuFreq (ProcessorNumber) / 1000 / 1000);
130}
131
142UINTN
144 IN UINT8 CacheLevel,
145 IN BOOLEAN DataCache,
146 IN BOOLEAN UnifiedCache,
147 OUT CHAR16 *CacheSocketStr
148 )
149{
150 UINTN CacheSocketStrLen;
151
152 if ((CacheLevel == CpuCacheL1) && !DataCache && !UnifiedCache) {
153 CacheSocketStrLen = UnicodeSPrint (
154 CacheSocketStr,
156 L"L%x Instruction Cache",
157 CacheLevel
158 );
159 } else if ((CacheLevel == CpuCacheL1) && DataCache) {
160 CacheSocketStrLen = UnicodeSPrint (
161 CacheSocketStr,
163 L"L%x Data Cache",
164 CacheLevel
165 );
166 } else {
167 CacheSocketStrLen = UnicodeSPrint (
168 CacheSocketStr,
170 L"L%x Cache",
171 CacheLevel
172 );
173 }
174
175 return CacheSocketStrLen;
176}
177
187VOID
189 IN UINT8 CacheLevel,
190 IN BOOLEAN DataCache,
191 IN BOOLEAN UnifiedCache,
192 OUT SMBIOS_TABLE_TYPE7 *Type7Record
193 )
194{
195 UINT8 Associativity;
196 UINT32 CacheSize32;
197 UINT16 CacheSize16;
198 UINT64 CacheSize64;
199
200 if (!DataCache && !UnifiedCache) {
201 Type7Record->SystemCacheType = CacheTypeInstruction;
202 } else if (DataCache) {
203 Type7Record->SystemCacheType = CacheTypeData;
204 } else if (UnifiedCache) {
205 Type7Record->SystemCacheType = CacheTypeUnified;
206 } else {
207 ASSERT (FALSE);
208 }
209
210 CacheSize64 = SmbiosProcessorGetCacheSize (
211 CacheLevel,
212 DataCache,
213 UnifiedCache
214 );
215
217 CacheLevel,
218 DataCache,
219 UnifiedCache
220 );
221
222 CacheSize64 /= 1024; // Minimum granularity is 1K
223
224 // Encode the cache size into the format SMBIOS wants
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);
231 } else {
232 if ((CacheSize64 / 1024) <= 2047) {
233 CacheSize32 = CacheSize64;
234 } else {
235 CacheSize32 = (1 << 31) | (CacheSize64 / 64);
236 }
237
238 CacheSize16 = -1;
239 }
240
241 Type7Record->MaximumCacheSize = CacheSize16;
242 Type7Record->InstalledSize = CacheSize16;
243 Type7Record->MaximumCacheSize2 = CacheSize32;
244 Type7Record->InstalledSize2 = CacheSize32;
245
246 switch (Associativity) {
247 case 2:
248 Type7Record->Associativity = CacheAssociativity2Way;
249 break;
250 case 4:
251 Type7Record->Associativity = CacheAssociativity4Way;
252 break;
253 case 8:
254 Type7Record->Associativity = CacheAssociativity8Way;
255 break;
256 case 12:
257 Type7Record->Associativity = CacheAssociativity12Way;
258 break;
259 case 16:
260 Type7Record->Associativity = CacheAssociativity16Way;
261 break;
262 case 20:
263 Type7Record->Associativity = CacheAssociativity20Way;
264 break;
265 case 24:
266 Type7Record->Associativity = CacheAssociativity24Way;
267 break;
268 case 32:
269 Type7Record->Associativity = CacheAssociativity32Way;
270 break;
271 case 48:
272 Type7Record->Associativity = CacheAssociativity48Way;
273 break;
274 case 64:
275 Type7Record->Associativity = CacheAssociativity64Way;
276 break;
277 default:
278 Type7Record->Associativity = CacheAssociativityOther;
279 break;
280 }
281
282 Type7Record->CacheConfiguration = (CacheModeUnknown << CACHE_OPERATION_MODE_SHIFT) |
283 (1 << CACHE_ENABLED_SHIFT) |
284 (CacheLocationUnknown << CACHE_LOCATION_SHIFT) |
285 (0 << CACHE_SOCKETED_SHIFT) |
286 (CacheLevel - 1);
287}
288
299 IN UINT8 CacheLevel,
300 IN BOOLEAN DataCache,
301 IN BOOLEAN UnifiedCache
302 )
303{
304 SMBIOS_TABLE_TYPE7 *Type7Record;
305 EFI_STRING CacheSocketStr;
306 UINTN CacheSocketStrLen;
307 UINTN StringBufferSize;
308 CHAR8 *OptionalStrStart;
309 UINTN TableSize;
310
311 // Allocate and fetch the cache description
312 StringBufferSize = sizeof (CHAR16) * SMBIOS_STRING_MAX_LENGTH;
313 CacheSocketStr = AllocateZeroPool (StringBufferSize);
314 if (CacheSocketStr == NULL) {
315 return NULL;
316 }
317
318 CacheSocketStrLen = GetCacheSocketStr (
319 CacheLevel,
320 DataCache,
321 UnifiedCache,
322 CacheSocketStr
323 );
324
325 TableSize = sizeof (SMBIOS_TABLE_TYPE7) + CacheSocketStrLen + 1 + 1;
326 Type7Record = AllocateZeroPool (TableSize);
327 if (Type7Record == NULL) {
328 FreePool (CacheSocketStr);
329 return NULL;
330 }
331
332 Type7Record->Hdr.Type = EFI_SMBIOS_TYPE_CACHE_INFORMATION;
333 Type7Record->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE7);
334 Type7Record->Hdr.Handle = SMBIOS_HANDLE_PI_RESERVED;
335
336 Type7Record->SocketDesignation = 1;
337
338 Type7Record->SupportedSRAMType.Unknown = 1;
339 Type7Record->CurrentSRAMType.Unknown = 1;
340 Type7Record->CacheSpeed = 0;
341 Type7Record->ErrorCorrectionType = CacheErrorUnknown;
342
343 OptionalStrStart = (CHAR8 *)(Type7Record + 1);
344 UnicodeStrToAsciiStrS (CacheSocketStr, OptionalStrStart, CacheSocketStrLen + 1);
345 FreePool (CacheSocketStr);
346
347 return Type7Record;
348}
349
359VOID
361 IN UINTN ProcessorIndex,
362 OUT EFI_SMBIOS_HANDLE *L1CacheHandle,
363 OUT EFI_SMBIOS_HANDLE *L2CacheHandle,
364 OUT EFI_SMBIOS_HANDLE *L3CacheHandle
365 )
366{
367 EFI_STATUS Status;
368 SMBIOS_TABLE_TYPE7 *Type7Record;
369 EFI_SMBIOS_HANDLE SmbiosHandle;
370 UINT8 CacheLevel;
371 UINT8 MaxCacheLevel;
372 BOOLEAN DataCacheType;
373 BOOLEAN SeparateCaches;
374
375 Status = EFI_SUCCESS;
376
377 MaxCacheLevel = 0;
378
379 // See if there's an L1 cache present.
380 MaxCacheLevel = SmbiosProcessorGetMaxCacheLevel ();
381
382 if (MaxCacheLevel < 1) {
383 return;
384 }
385
386 for (CacheLevel = 1; CacheLevel <= MaxCacheLevel; CacheLevel++) {
387 Type7Record = NULL;
388
389 SeparateCaches = SmbiosProcessorHasSeparateCaches (CacheLevel);
390
391 // At each level of cache, we can have a single type (unified, instruction or data),
392 // or two types - separate data and instruction caches. If we have separate
393 // instruction and data caches, then on the first iteration (CacheSubLevel = 0)
394 // process the instruction cache.
395 for (DataCacheType = 0; DataCacheType <= 1; DataCacheType++) {
396 // If there's no separate data/instruction cache, skip the second iteration
397 if ((DataCacheType == 1) && !SeparateCaches) {
398 continue;
399 }
400
401 Type7Record = AllocateAndInitCacheInformation (
402 CacheLevel,
403 DataCacheType,
404 !SeparateCaches
405 );
406 if (Type7Record == NULL) {
407 continue;
408 }
409
411 CacheLevel,
412 DataCacheType,
413 !SeparateCaches,
414 Type7Record
415 );
416
417 // Allow the platform to fill in other information such as speed, SRAM type etc.
419 ProcessorIndex,
420 CacheLevel,
421 DataCacheType,
422 !SeparateCaches,
423 Type7Record
424 ))
425 {
426 continue;
427 }
428
429 SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
430 // Finally, install the table
431 Status = mSmbios->Add (
432 mSmbios,
433 NULL,
434 &SmbiosHandle,
435 (EFI_SMBIOS_TABLE_HEADER *)Type7Record
436 );
437 if (EFI_ERROR (Status)) {
438 continue;
439 }
440
441 // Config L1/L2/L3 Cache Handle
442 switch (CacheLevel) {
443 case CpuCacheL1:
444 *L1CacheHandle = SmbiosHandle;
445 break;
446 case CpuCacheL2:
447 *L2CacheHandle = SmbiosHandle;
448 break;
449 case CpuCacheL3:
450 *L3CacheHandle = SmbiosHandle;
451 break;
452 default:
453 break;
454 }
455 }
456 }
457}
458
473 SMBIOS_TABLE_TYPE4 **Type4Record,
474 UINT8 ProcessorIndex,
475 BOOLEAN Populated
476 )
477{
478 EFI_STATUS Status;
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;
491 CHAR8 *StrStart;
492 UINTN ProcessorStrLen;
493 UINTN ProcessorManuStrLen;
494 UINTN ProcessorVersionStrLen;
495 UINTN SerialNumberStrLen;
496 UINTN AssetTagStrLen;
497 UINTN PartNumberStrLen;
498 UINTN TotalSize;
499 UINTN StringBufferSize;
500
501 Status = EFI_SUCCESS;
502
503 ProcessorManuStr = NULL;
504 ProcessorVersionStr = NULL;
505 SerialNumberStr = NULL;
506 AssetTagStr = NULL;
507 PartNumberStr = NULL;
508
509 ProcessorManu = STRING_TOKEN (STR_PROCESSOR_MANUFACTURE);
510 ProcessorVersion = STRING_TOKEN (STR_PROCESSOR_VERSION);
511 SerialNumber = STRING_TOKEN (STR_PROCESSOR_SERIAL_NUMBER);
512 AssetTag = STRING_TOKEN (STR_PROCESSOR_ASSET_TAG);
513 PartNumber = STRING_TOKEN (STR_PROCESSOR_PART_NUMBER);
514
515 SET_HII_STRING_IF_PCD_NOT_EMPTY (PcdProcessorManufacturer, ProcessorManu);
516 SET_HII_STRING_IF_PCD_NOT_EMPTY (PcdProcessorAssetTag, AssetTag);
517
518 if (StrLen ((CHAR16 *)FixedPcdGetPtr (PcdProcessorSerialNumber)) > 0) {
519 HiiSetString (mHiiHandle, SerialNumber, (CHAR16 *)FixedPcdGetPtr (PcdProcessorSerialNumber), NULL);
520 } else {
521 OemUpdateSmbiosInfo (mHiiHandle, SerialNumber, ProcessorSerialNumType04);
522 }
523
524 if (StrLen ((CHAR16 *)FixedPcdGetPtr (PcdProcessorPartNumber)) > 0) {
525 HiiSetString (mHiiHandle, PartNumber, (CHAR16 *)FixedPcdGetPtr (PcdProcessorPartNumber), NULL);
526 } else {
527 OemUpdateSmbiosInfo (mHiiHandle, PartNumber, ProcessorPartNumType04);
528 }
529
530 if (StrLen ((CHAR16 *)FixedPcdGetPtr (PcdProcessorVersion)) > 0) {
531 HiiSetString (mHiiHandle, ProcessorVersion, (CHAR16 *)FixedPcdGetPtr (PcdProcessorVersion), NULL);
532 } else {
533 OemUpdateSmbiosInfo (mHiiHandle, ProcessorVersion, ProcessorVersionType04);
534 }
535
536 // Processor Designation
537 StringBufferSize = sizeof (CHAR16) * SMBIOS_STRING_MAX_LENGTH;
538 ProcessorStr = AllocateZeroPool (StringBufferSize);
539 if (ProcessorStr == NULL) {
540 return EFI_OUT_OF_RESOURCES;
541 }
542
543 ProcessorStrLen = UnicodeSPrint (
544 ProcessorStr,
545 StringBufferSize,
546 L"CPU%02d",
547 ProcessorIndex + 1
548 );
549
550 // Processor Manufacture
551 ProcessorManuStr = HiiGetPackageString (&gEfiCallerIdGuid, ProcessorManu, NULL);
552 ProcessorManuStrLen = StrLen (ProcessorManuStr);
553
554 // Processor Version
555 ProcessorVersionStr = HiiGetPackageString (&gEfiCallerIdGuid, ProcessorVersion, NULL);
556 ProcessorVersionStrLen = StrLen (ProcessorVersionStr);
557
558 // Serial Number
559 SerialNumberStr = HiiGetPackageString (&gEfiCallerIdGuid, SerialNumber, NULL);
560 SerialNumberStrLen = StrLen (SerialNumberStr);
561
562 // Asset Tag
563 AssetTagStr = HiiGetPackageString (&gEfiCallerIdGuid, AssetTag, NULL);
564 AssetTagStrLen = StrLen (AssetTagStr);
565
566 // Part Number
567 PartNumberStr = HiiGetPackageString (&gEfiCallerIdGuid, PartNumber, NULL);
568 PartNumberStrLen = StrLen (PartNumberStr);
569
570 TotalSize = sizeof (SMBIOS_TABLE_TYPE4) +
571 ProcessorStrLen + 1 +
572 ProcessorManuStrLen + 1 +
573 ProcessorVersionStrLen + 1 +
574 SerialNumberStrLen + 1 +
575 AssetTagStrLen + 1 +
576 PartNumberStrLen + 1 + 1;
577
578 *Type4Record = AllocateZeroPool (TotalSize);
579 if (*Type4Record == NULL) {
580 Status = EFI_OUT_OF_RESOURCES;
581 goto Exit;
582 }
583
584 CopyMem (*Type4Record, &mSmbiosProcessorTableTemplate, sizeof (SMBIOS_TABLE_TYPE4));
585
586 OptionalStrStart = (CHAR8 *)(*Type4Record + 1);
588 ProcessorStr,
589 OptionalStrStart,
590 ProcessorStrLen + 1
591 );
592
593 StrStart = OptionalStrStart + ProcessorStrLen + 1;
595 ProcessorManuStr,
596 StrStart,
597 ProcessorManuStrLen + 1
598 );
599
600 StrStart += ProcessorManuStrLen + 1;
602 ProcessorVersionStr,
603 StrStart,
604 ProcessorVersionStrLen + 1
605 );
606
607 StrStart += ProcessorVersionStrLen + 1;
609 SerialNumberStr,
610 StrStart,
611 SerialNumberStrLen + 1
612 );
613
614 StrStart += SerialNumberStrLen + 1;
616 AssetTagStr,
617 StrStart,
618 AssetTagStrLen + 1
619 );
620
621 StrStart += AssetTagStrLen + 1;
623 PartNumberStr,
624 StrStart,
625 PartNumberStrLen + 1
626 );
627
628Exit:
629 FreePool (ProcessorStr);
630 FreePool (ProcessorManuStr);
631 FreePool (ProcessorVersionStr);
632 FreePool (SerialNumberStr);
633 FreePool (AssetTagStr);
634 FreePool (PartNumberStr);
635
636 return Status;
637}
638
647 IN UINTN ProcessorIndex
648 )
649{
650 EFI_STATUS Status;
651 SMBIOS_TABLE_TYPE4 *Type4Record;
652 EFI_SMBIOS_HANDLE SmbiosHandle;
653 EFI_SMBIOS_HANDLE L1CacheHandle;
654 EFI_SMBIOS_HANDLE L2CacheHandle;
655 EFI_SMBIOS_HANDLE L3CacheHandle;
656 UINT8 *LegacyVoltage;
657 PROCESSOR_STATUS_DATA ProcessorStatus;
658 UINT64 *ProcessorId;
659 PROCESSOR_CHARACTERISTIC_FLAGS ProcessorCharacteristics;
660 OEM_MISC_PROCESSOR_DATA MiscProcessorData;
661 BOOLEAN ProcessorPopulated;
662
663 Type4Record = NULL;
664
665 MiscProcessorData.Voltage = 0;
666 MiscProcessorData.CurrentSpeed = 0;
667 MiscProcessorData.CoreCount = 0;
668 MiscProcessorData.CoresEnabled = 0;
669 MiscProcessorData.ThreadCount = 0;
670 MiscProcessorData.MaxSpeed = 0;
671 L1CacheHandle = 0xFFFF;
672 L2CacheHandle = 0xFFFF;
673 L3CacheHandle = 0xFFFF;
674
675 ProcessorPopulated = OemIsProcessorPresent (ProcessorIndex);
676
678 &Type4Record,
679 ProcessorIndex,
680 ProcessorPopulated
681 );
682 if (EFI_ERROR (Status)) {
683 return Status;
684 }
685
687 ProcessorIndex,
688 &ProcessorStatus,
690 &Type4Record->ProcessorCharacteristics,
691 &MiscProcessorData
692 );
693
694 if (ProcessorPopulated) {
696 ProcessorIndex,
697 &L1CacheHandle,
698 &L2CacheHandle,
699 &L3CacheHandle
700 );
701 }
702
703 LegacyVoltage = (UINT8 *)&Type4Record->Voltage;
704
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;
718
719 Type4Record->CurrentSpeed = GetCpuFrequency (ProcessorIndex);
720 Type4Record->ExternalClock =
721 (UINT16)(SmbiosGetExternalClockFrequency () / 1000 / 1000);
722
723 ProcessorId = (UINT64 *)&Type4Record->ProcessorId;
724 *ProcessorId = SmbiosGetProcessorId ();
725
726 ProcessorCharacteristics = SmbiosGetProcessorCharacteristics ();
727 Type4Record->ProcessorCharacteristics |= *((UINT64 *)&ProcessorCharacteristics);
728
730 Type4Record->ProcessorFamily2 = SmbiosGetProcessorFamily2 ();
731
732 SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
733 Status = mSmbios->Add (
734 mSmbios,
735 NULL,
736 &SmbiosHandle,
737 (EFI_SMBIOS_TABLE_HEADER *)Type4Record
738 );
739
740 if (EFI_ERROR (Status)) {
741 DEBUG ((
742 DEBUG_ERROR,
743 "[%a]:[%dL] Smbios Type04 Table Log Failed! %r \n",
744 __func__,
745 DEBUG_LINE_NUMBER,
746 Status
747 ));
748 }
749
750 FreePool (Type4Record);
751
752 return Status;
753}
754
765EFIAPI
767 IN EFI_HANDLE ImageHandle,
768 IN EFI_SYSTEM_TABLE *SystemTable
769 )
770{
771 EFI_STATUS Status;
772 UINT32 ProcessorIndex;
773
774 //
775 // Locate dependent protocols
776 //
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));
780 return Status;
781 }
782
783 //
784 // Add our default strings to the HII database. They will be modified later.
785 //
786 mHiiHandle = HiiAddPackages (
787 &gEfiCallerIdGuid,
788 NULL,
789 ProcessorSubClassStrings,
790 NULL,
791 NULL
792 );
793 if (mHiiHandle == NULL) {
794 return EFI_OUT_OF_RESOURCES;
795 }
796
797 //
798 // Add SMBIOS tables for populated sockets.
799 //
800 for (ProcessorIndex = 0; ProcessorIndex < OemGetMaxProcessors (); ProcessorIndex++) {
801 Status = AddSmbiosProcessorTypeTable (ProcessorIndex);
802 if (EFI_ERROR (Status)) {
803 DEBUG ((DEBUG_ERROR, "Add Processor Type Table Failed! %r.\n", Status));
804 return Status;
805 }
806 }
807
808 return Status;
809}
UINT64 UINTN
RETURN_STATUS EFIAPI UnicodeStrToAsciiStrS(IN CONST CHAR16 *Source, OUT CHAR8 *Destination, IN UINTN DestMax)
Definition: SafeString.c:2650
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
Definition: String.c:30
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,...)
Definition: HiiLib.c:141
EFI_STRING EFIAPI HiiGetPackageString(IN CONST EFI_GUID *PackageListGuid, IN EFI_STRING_ID StringId, IN CONST CHAR8 *Language OPTIONAL)
Definition: HiiString.c:171
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)
Definition: HiiString.c:52
#define SMBIOS_STRING_MAX_LENGTH
Definition: SmBios.h:37
#define SMBIOS_HANDLE_PI_RESERVED
Definition: SmBios.h:29
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
Definition: PrintLib.c:408
#define NULL
Definition: Base.h:319
#define MIN(a, b)
Definition: Base.h:1007
#define FALSE
Definition: Base.h:307
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define DEBUG(Expression)
Definition: DebugLib.h:434
BOOLEAN EFIAPI OemIsProcessorPresent(IN UINTN ProcessorIndex)
Definition: OemMiscLib.c:120
VOID EFIAPI OemUpdateSmbiosInfo(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID TokenToUpdate, IN OEM_MISC_SMBIOS_HII_STRING_FIELD Field)
Definition: OemMiscLib.c:136
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)
Definition: OemMiscLib.c:49
UINTN EFIAPI OemGetCpuFreq(IN UINT8 ProcessorIndex)
Definition: OemMiscLib.c:29
BOOLEAN EFIAPI OemGetCacheInformation(IN UINT8 ProcessorIndex, IN UINT8 CacheLevel, IN BOOLEAN DataCache, IN BOOLEAN UnifiedCache, IN OUT SMBIOS_TABLE_TYPE7 *SmbiosCacheTable)
Definition: OemMiscLib.c:72
UINT8 EFIAPI OemGetMaxProcessors(VOID)
Definition: OemMiscLib.c:90
#define FixedPcdGetPtr(TokenName)
Definition: PcdLib.h:134
#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)
CACHE_LOCATION
@ 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)
CACHE_OPERATION_MODE
@ 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)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_BOOT_SERVICES * gBS
#define STRING_TOKEN(t)
VOID * EFI_HII_HANDLE
UINT16 MaxSpeed
Maximum clock speed in MHz.
Definition: OemMiscLib.h:32
UINT16 ThreadCount
Number of threads per processor.
Definition: OemMiscLib.h:36
UINT8 Voltage
Processor voltage.
Definition: OemMiscLib.h:30
UINT16 CurrentSpeed
Current clock speed in MHz.
Definition: OemMiscLib.h:31
UINT16 CoreCount
Number of cores available.
Definition: OemMiscLib.h:34
UINT16 CoresEnabled
Number of cores enabled.
Definition: OemMiscLib.h:35
UINT8 ProcessorFamily
The enumeration value from PROCESSOR_FAMILY_DATA.
Definition: SmBios.h:988
UINT8 ErrorCorrectionType
The enumeration value from CACHE_ERROR_TYPE_DATA.
Definition: SmBios.h:1231