TianoCore EDK2 master
Loading...
Searching...
No Matches
ProcessorSubClass.c File Reference

Go to the source code of this file.

Macros

#define CACHE_SOCKETED_SHIFT   3
 
#define CACHE_LOCATION_SHIFT   5
 
#define CACHE_ENABLED_SHIFT   7
 
#define CACHE_OPERATION_MODE_SHIFT   8
 
#define SET_HII_STRING_IF_PCD_NOT_EMPTY(Pcd, StringId)
 

Enumerations

enum  CACHE_OPERATION_MODE {
  CacheModeWriteThrough = 0 , CacheModeWriteBack , CacheModeVariesWithAddress , CacheModeUnknown ,
  CacheModeMax
}
 
enum  CACHE_LOCATION {
  CacheLocationInternal = 0 , CacheLocationExternal , CacheLocationReserved , CacheLocationUnknown ,
  CacheLocationMax
}
 

Functions

UINT16 GetCpuFrequency (IN UINT8 ProcessorNumber)
 
UINTN GetCacheSocketStr (IN UINT8 CacheLevel, IN BOOLEAN DataCache, IN BOOLEAN UnifiedCache, OUT CHAR16 *CacheSocketStr)
 
VOID ConfigureCacheArchitectureInformation (IN UINT8 CacheLevel, IN BOOLEAN DataCache, IN BOOLEAN UnifiedCache, OUT SMBIOS_TABLE_TYPE7 *Type7Record)
 
SMBIOS_TABLE_TYPE7AllocateAndInitCacheInformation (IN UINT8 CacheLevel, IN BOOLEAN DataCache, IN BOOLEAN UnifiedCache)
 
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)
 
EFI_STATUS AddSmbiosProcessorTypeTable (IN UINTN ProcessorIndex)
 
EFI_STATUS EFIAPI ProcessorSubClassEntryPoint (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Variables

UINT8 ProcessorSubClassStrings []
 
EFI_HII_HANDLE mHiiHandle
 
EFI_SMBIOS_PROTOCOLmSmbios
 
SMBIOS_TABLE_TYPE4 mSmbiosProcessorTableTemplate
 

Detailed Description

ProcessorSubClass.c

Copyright (c) 2022, Ampere Computing LLC. All rights reserved. Copyright (c) 2021, NUVIA Inc. All rights reserved.
Copyright (c) 2015, Hisilicon Limited. All rights reserved. Copyright (c) 2015, Linaro Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file ProcessorSubClass.c.

Macro Definition Documentation

◆ CACHE_ENABLED_SHIFT

#define CACHE_ENABLED_SHIFT   7

Definition at line 37 of file ProcessorSubClass.c.

◆ CACHE_LOCATION_SHIFT

#define CACHE_LOCATION_SHIFT   5

Definition at line 36 of file ProcessorSubClass.c.

◆ CACHE_OPERATION_MODE_SHIFT

#define CACHE_OPERATION_MODE_SHIFT   8

Definition at line 38 of file ProcessorSubClass.c.

◆ CACHE_SOCKETED_SHIFT

#define CACHE_SOCKETED_SHIFT   3

Definition at line 35 of file ProcessorSubClass.c.

◆ SET_HII_STRING_IF_PCD_NOT_EMPTY

#define SET_HII_STRING_IF_PCD_NOT_EMPTY (   Pcd,
  StringId 
)
Value:
do { \
CHAR16 *Str; \
Str = (CHAR16*)PcdGetPtr (Pcd); \
if (StrLen (Str) > 0) { \
HiiSetString (mHiiHandle, StringId, Str, NULL); \
} \
} while (0)
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
Definition: String.c:30
#define NULL
Definition: Base.h:319
#define PcdGetPtr(TokenName)
Definition: PcdLib.h:388

Sets the HII variable StringId is Pcd isn't empty.

Parameters
PcdThe FixedAtBuild PCD that contains the string to fetch.
StringIdThe string identifier to set.

Definition at line 108 of file ProcessorSubClass.c.

Enumeration Type Documentation

◆ CACHE_LOCATION

Enumerator
CacheLocationInternal 

Cache is internal to the processor.

CacheLocationExternal 

Cache is external to the processor.

CacheLocationReserved 

Reserved.

CacheLocationUnknown 

Cache location is unknown.

Definition at line 48 of file ProcessorSubClass.c.

◆ CACHE_OPERATION_MODE

Enumerator
CacheModeWriteThrough 

Cache is write-through.

CacheModeWriteBack 

Cache is write-back.

CacheModeVariesWithAddress 

Cache mode varies by address.

CacheModeUnknown 

Cache mode is unknown.

Definition at line 40 of file ProcessorSubClass.c.

Function Documentation

◆ AddSmbiosCacheTypeTable()

VOID AddSmbiosCacheTypeTable ( IN UINTN  ProcessorIndex,
OUT EFI_SMBIOS_HANDLE *  L1CacheHandle,
OUT EFI_SMBIOS_HANDLE *  L2CacheHandle,
OUT EFI_SMBIOS_HANDLE *  L3CacheHandle 
)

Add Type 7 SMBIOS Record for Cache Information.

Parameters
[in]ProcessorIndexProcessor number of specified processor.
[out]L1CacheHandlePointer to the handle of the L1 Cache SMBIOS record.
[out]L2CacheHandlePointer to the handle of the L2 Cache SMBIOS record.
[out]L3CacheHandlePointer to the handle of the L3 Cache SMBIOS record.

Definition at line 360 of file ProcessorSubClass.c.

◆ AddSmbiosProcessorTypeTable()

EFI_STATUS AddSmbiosProcessorTypeTable ( IN UINTN  ProcessorIndex)

Add Type 4 SMBIOS Record for Processor Information.

Parameters
[in]ProcessorIndexProcessor index of specified processor.

Definition at line 646 of file ProcessorSubClass.c.

◆ AllocateAndInitCacheInformation()

SMBIOS_TABLE_TYPE7 * AllocateAndInitCacheInformation ( IN UINT8  CacheLevel,
IN BOOLEAN  DataCache,
IN BOOLEAN  UnifiedCache 
)

Allocates and initializes an SMBIOS_TABLE_TYPE7 structure.

Parameters
[in]CacheLevelThe cache level (L1-L7).
[in]DataCacheCache is a data cache.
[in]UnifiedCacheCache is a unified cache.
Returns
A pointer to the Type 7 structure. Returns NULL on failure.

Definition at line 298 of file ProcessorSubClass.c.

◆ AllocateType4AndSetProcessorInformationStrings()

EFI_STATUS AllocateType4AndSetProcessorInformationStrings ( SMBIOS_TABLE_TYPE4 **  Type4Record,
UINT8  ProcessorIndex,
BOOLEAN  Populated 
)

Allocates a Type 4 Processor Information structure and sets the strings following the data fields.

Parameters
[out]Type4RecordThe Type 4 structure to allocate and initialize
[in]ProcessorIndexThe index of the processor
[in]PopulatedWhether the specified processor is populated.
Return values
EFI_SUCCESSThe Type 4 structure was successfully allocated and the strings initialized.
EFI_OUT_OF_RESOURCESCould not allocate memory needed.

Definition at line 472 of file ProcessorSubClass.c.

◆ ConfigureCacheArchitectureInformation()

VOID ConfigureCacheArchitectureInformation ( IN UINT8  CacheLevel,
IN BOOLEAN  DataCache,
IN BOOLEAN  UnifiedCache,
OUT SMBIOS_TABLE_TYPE7 Type7Record 
)

Fills in the Type 7 record with the cache architecture information read from the CPU registers.

Parameters
[in]CacheLevelCache level (e.g. L1, L2).
[in]DataCacheCache is a data cache.
[in]UnifiedCacheCache is a unified cache.
[out]Type7RecordThe Type 7 record to fill in.

Definition at line 188 of file ProcessorSubClass.c.

◆ GetCacheSocketStr()

UINTN GetCacheSocketStr ( IN UINT8  CacheLevel,
IN BOOLEAN  DataCache,
IN BOOLEAN  UnifiedCache,
OUT CHAR16 *  CacheSocketStr 
)

Gets a description of the specified cache.

Parameters
[in]CacheLevelZero-based cache level (e.g. L1 cache is 0).
[in]DataCacheCache is a data cache.
[in]UnifiedCacheCache is a unified cache.
[out]CacheSocketStrThe description of the specified cache
Returns
The number of Unicode characters in CacheSocketStr not including the terminating NUL.

Definition at line 143 of file ProcessorSubClass.c.

◆ GetCpuFrequency()

UINT16 GetCpuFrequency ( IN UINT8  ProcessorNumber)

Fetches the specified processor's frequency in Hz.

Parameters
ProcessorNumberThe processor number
Returns
The clock frequency in MHz

Definition at line 125 of file ProcessorSubClass.c.

◆ ProcessorSubClassEntryPoint()

EFI_STATUS EFIAPI ProcessorSubClassEntryPoint ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Standard EFI driver point.

Parameters
ImageHandleHandle for the image of this driver
SystemTablePointer to the EFI System Table
Return values
EFI_SUCCESSThe data was successfully stored.

Definition at line 766 of file ProcessorSubClass.c.

Variable Documentation

◆ mHiiHandle

EFI_HII_HANDLE mHiiHandle

Definition at line 56 of file ProcessorSubClass.c.

◆ mSmbios

Definition at line 58 of file ProcessorSubClass.c.

◆ mSmbiosProcessorTableTemplate

SMBIOS_TABLE_TYPE4 mSmbiosProcessorTableTemplate

Definition at line 60 of file ProcessorSubClass.c.