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

Go to the source code of this file.

Data Structures

struct  SMBIOS_FILTER_TABLE
 
struct  SMBIOS_FILTER_STRUCT
 
struct  SMBIOS_HANDOFF_TABLE_POINTERS2
 

Macros

#define FIELD_SIZE_OF(TYPE, Field)   ((UINTN)sizeof(((TYPE *)0)->Field))
 
#define SMBIOS_FILTER_TABLE_FLAG_IS_STRING   BIT0
 
#define SMBIOS_HANDOFF_TABLE_DESC   "SmbiosTable"
 
#define COLUME_SIZE   (16 * 2)
 

Functions

VOID InternalDumpData (IN UINT8 *Data, IN UINTN Size)
 
VOID InternalDumpHex (IN UINT8 *Data, IN UINTN Size)
 
SMBIOS_FILTER_STRUCTGetFilterStructByType (IN UINT8 Type)
 
CHAR8 * GetSmbiosStringById (IN EFI_SMBIOS_TABLE_HEADER *Head, IN SMBIOS_TABLE_STRING StringId, OUT UINTN *StringLen)
 
VOID FilterSmbiosEntry (IN OUT VOID *TableEntry, IN UINTN TableEntrySize)
 
UINTN GetSmbiosStructureSize (IN EFI_SMBIOS_TABLE_HEADER *Head, OUT UINTN *NumberOfStrings)
 
UINTN GetSmbiosTableLength (IN VOID *TableAddress, IN UINTN TableMaximumSize)
 
VOID FilterSmbiosTable (IN OUT VOID *TableAddress, IN UINTN TableLength)
 
VOID EFIAPI MeasureSmbiosTable (IN EFI_EVENT Event, IN VOID *Context)
 
EFI_STATUS EFIAPI SmbiosMeasurementDriverEntryPoint (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Variables

SMBIOS_FILTER_TABLE mSmbiosFilterType1BlackList []
 
SMBIOS_FILTER_TABLE mSmbiosFilterType2BlackList []
 
SMBIOS_FILTER_TABLE mSmbiosFilterType3BlackList []
 
SMBIOS_FILTER_TABLE mSmbiosFilterType4BlackList []
 
SMBIOS_FILTER_TABLE mSmbiosFilterType17BlackList []
 
SMBIOS_FILTER_TABLE mSmbiosFilterType22BlackList []
 
SMBIOS_FILTER_TABLE mSmbiosFilterType23BlackList []
 
SMBIOS_FILTER_TABLE mSmbiosFilterType27BlackList []
 
SMBIOS_FILTER_TABLE mSmbiosFilterType39BlackList []
 
SMBIOS_FILTER_STRUCT mSmbiosFilterStandardTableBlackList []
 
EFI_SMBIOS_PROTOCOLmSmbios
 
UINTN mMaxLen
 

Detailed Description

This driver measures SMBIOS table to TPM.

Copyright (c) 2015 - 2022, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file SmbiosMeasurementDxe.c.

Macro Definition Documentation

◆ FIELD_SIZE_OF

#define FIELD_SIZE_OF (   TYPE,
  Field 
)    ((UINTN)sizeof(((TYPE *)0)->Field))

Definition at line 26 of file SmbiosMeasurementDxe.c.

◆ SMBIOS_FILTER_TABLE_FLAG_IS_STRING

#define SMBIOS_FILTER_TABLE_FLAG_IS_STRING   BIT0

Definition at line 34 of file SmbiosMeasurementDxe.c.

◆ SMBIOS_HANDOFF_TABLE_DESC

#define SMBIOS_HANDOFF_TABLE_DESC   "SmbiosTable"

Definition at line 115 of file SmbiosMeasurementDxe.c.

Function Documentation

◆ FilterSmbiosEntry()

VOID FilterSmbiosEntry ( IN OUT VOID *  TableEntry,
IN UINTN  TableEntrySize 
)

This function update SMBIOS table based on policy.

Parameters
TableEntrySMBIOS table
TableEntrySizeSMBIOS table size

Definition at line 278 of file SmbiosMeasurementDxe.c.

◆ FilterSmbiosTable()

VOID FilterSmbiosTable ( IN OUT VOID *  TableAddress,
IN UINTN  TableLength 
)

This function updatess full SMBIOS table length.

Parameters
TableAddressSMBIOS table based address
TableLengthSMBIOS table length

Definition at line 450 of file SmbiosMeasurementDxe.c.

◆ GetFilterStructByType()

SMBIOS_FILTER_STRUCT * GetFilterStructByType ( IN UINT8  Type)

This function get filter structure by SMBIOS type.

Parameters
TypeSMBIOS type

Definition at line 189 of file SmbiosMeasurementDxe.c.

◆ GetSmbiosStringById()

CHAR8 * GetSmbiosStringById ( IN EFI_SMBIOS_TABLE_HEADER Head,
IN SMBIOS_TABLE_STRING  StringId,
OUT UINTN StringLen 
)

This function get SMBIOS string in SMBIOS table.

Parameters
HeadSMBIOS table head
StringIdSMBIOS string ID
StringLenlength of SMBIOS string
Returns
SMBIOS string data

Definition at line 215 of file SmbiosMeasurementDxe.c.

◆ GetSmbiosStructureSize()

UINTN GetSmbiosStructureSize ( IN EFI_SMBIOS_TABLE_HEADER Head,
OUT UINTN NumberOfStrings 
)

Get the full size of SMBIOS structure including optional strings that follow the formatted structure.

Parameters
HeadPointer to the beginning of SMBIOS structure.
NumberOfStringsThe returned number of optional strings that follow the formatted structure.
Returns
Size The returned size.

Definition at line 349 of file SmbiosMeasurementDxe.c.

◆ GetSmbiosTableLength()

UINTN GetSmbiosTableLength ( IN VOID *  TableAddress,
IN UINTN  TableMaximumSize 
)

This function returns full SMBIOS table length.

Parameters
TableAddressSMBIOS table based address
TableMaximumSizeMaximum size of SMBIOS table
Returns
SMBIOS table length

Definition at line 413 of file SmbiosMeasurementDxe.c.

◆ InternalDumpData()

VOID InternalDumpData ( IN UINT8 *  Data,
IN UINTN  Size 
)

This function dump raw data.

Parameters
Dataraw data
Sizeraw data size

Definition at line 134 of file SmbiosMeasurementDxe.c.

◆ InternalDumpHex()

VOID InternalDumpHex ( IN UINT8 *  Data,
IN UINTN  Size 
)

This function dump raw data with colume format.

Parameters
Dataraw data
Sizeraw data size

Definition at line 155 of file SmbiosMeasurementDxe.c.

◆ MeasureSmbiosTable()

VOID EFIAPI MeasureSmbiosTable ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Measure SMBIOS with EV_EFI_HANDOFF_TABLES to PCR[1].

Parameters
[in]EventEvent whose notification function is being invoked.
[in]ContextPointer to the notification function's context.

Definition at line 482 of file SmbiosMeasurementDxe.c.

◆ SmbiosMeasurementDriverEntryPoint()

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

Driver to produce Smbios measurement.

Parameters
ImageHandleModule's image handle
SystemTablePointer of EFI_SYSTEM_TABLE
Returns
Status returned from EfiCreateEventReadyToBootEx().

Definition at line 657 of file SmbiosMeasurementDxe.c.

Variable Documentation

◆ mMaxLen

UINTN mMaxLen

Definition at line 111 of file SmbiosMeasurementDxe.c.

◆ mSmbios

Definition at line 110 of file SmbiosMeasurementDxe.c.

◆ mSmbiosFilterStandardTableBlackList

SMBIOS_FILTER_STRUCT mSmbiosFilterStandardTableBlackList[]
Initial value:
= {
{ 0x01, mSmbiosFilterType1BlackList, sizeof (mSmbiosFilterType1BlackList)/sizeof (mSmbiosFilterType1BlackList[0]) },
{ 0x02, mSmbiosFilterType2BlackList, sizeof (mSmbiosFilterType2BlackList)/sizeof (mSmbiosFilterType2BlackList[0]) },
{ 0x03, mSmbiosFilterType3BlackList, sizeof (mSmbiosFilterType3BlackList)/sizeof (mSmbiosFilterType3BlackList[0]) },
{ 0x04, mSmbiosFilterType4BlackList, sizeof (mSmbiosFilterType4BlackList)/sizeof (mSmbiosFilterType4BlackList[0]) },
{ 0x0B, NULL, 0 },
{ 0x0F, NULL, 0 },
{ 0x11, mSmbiosFilterType17BlackList, sizeof (mSmbiosFilterType17BlackList)/sizeof (mSmbiosFilterType17BlackList[0]) },
{ 0x12, NULL, 0 },
{ 0x16, mSmbiosFilterType22BlackList, sizeof (mSmbiosFilterType22BlackList)/sizeof (mSmbiosFilterType22BlackList[0]) },
{ 0x17, mSmbiosFilterType23BlackList, sizeof (mSmbiosFilterType23BlackList)/sizeof (mSmbiosFilterType23BlackList[0]) },
{ 0x1B, mSmbiosFilterType27BlackList, sizeof (mSmbiosFilterType27BlackList)/sizeof (mSmbiosFilterType27BlackList[0]) },
{ 0x1F, NULL, 0 },
{ 0x21, NULL, 0 },
{ 0x27, mSmbiosFilterType39BlackList, sizeof (mSmbiosFilterType39BlackList)/sizeof (mSmbiosFilterType39BlackList[0]) },
}
#define NULL
Definition: Base.h:319

Definition at line 93 of file SmbiosMeasurementDxe.c.

◆ mSmbiosFilterType17BlackList

SMBIOS_FILTER_TABLE mSmbiosFilterType17BlackList[]
Initial value:
= {
{ 0x11, OFFSET_OF (SMBIOS_TABLE_TYPE17, SerialNumber), FIELD_SIZE_OF (SMBIOS_TABLE_TYPE17, SerialNumber), SMBIOS_FILTER_TABLE_FLAG_IS_STRING },
{ 0x11, OFFSET_OF (SMBIOS_TABLE_TYPE17, AssetTag), FIELD_SIZE_OF (SMBIOS_TABLE_TYPE17, AssetTag), SMBIOS_FILTER_TABLE_FLAG_IS_STRING },
{ 0x11, OFFSET_OF (SMBIOS_TABLE_TYPE17, PartNumber), FIELD_SIZE_OF (SMBIOS_TABLE_TYPE17, PartNumber), SMBIOS_FILTER_TABLE_FLAG_IS_STRING },
}
#define OFFSET_OF(TYPE, Field)
Definition: Base.h:758

Definition at line 71 of file SmbiosMeasurementDxe.c.

◆ mSmbiosFilterType1BlackList

SMBIOS_FILTER_TABLE mSmbiosFilterType1BlackList[]
Initial value:
= {
{ 0x01, OFFSET_OF (SMBIOS_TABLE_TYPE1, SerialNumber), FIELD_SIZE_OF (SMBIOS_TABLE_TYPE1, SerialNumber), SMBIOS_FILTER_TABLE_FLAG_IS_STRING },
{ 0x01, OFFSET_OF (SMBIOS_TABLE_TYPE1, Uuid), FIELD_SIZE_OF (SMBIOS_TABLE_TYPE1, Uuid), 0 },
{ 0x01, OFFSET_OF (SMBIOS_TABLE_TYPE1, WakeUpType), FIELD_SIZE_OF (SMBIOS_TABLE_TYPE1, WakeUpType), 0 },
}

Definition at line 45 of file SmbiosMeasurementDxe.c.

◆ mSmbiosFilterType22BlackList

SMBIOS_FILTER_TABLE mSmbiosFilterType22BlackList[]
Initial value:
= {
{ 0x16, OFFSET_OF (SMBIOS_TABLE_TYPE22, SerialNumber), FIELD_SIZE_OF (SMBIOS_TABLE_TYPE22, SerialNumber), SMBIOS_FILTER_TABLE_FLAG_IS_STRING },
{ 0x16, OFFSET_OF (SMBIOS_TABLE_TYPE22, SBDSSerialNumber), FIELD_SIZE_OF (SMBIOS_TABLE_TYPE22, SBDSSerialNumber), 0 },
{ 0x16, OFFSET_OF (SMBIOS_TABLE_TYPE22, SBDSManufactureDate), FIELD_SIZE_OF (SMBIOS_TABLE_TYPE22, SBDSManufactureDate), 0 },
}

Definition at line 76 of file SmbiosMeasurementDxe.c.

◆ mSmbiosFilterType23BlackList

SMBIOS_FILTER_TABLE mSmbiosFilterType23BlackList[]
Initial value:
= {
{ 0x17, OFFSET_OF (SMBIOS_TABLE_TYPE23, ResetCount), FIELD_SIZE_OF (SMBIOS_TABLE_TYPE23, ResetCount), 0 },
}

Definition at line 81 of file SmbiosMeasurementDxe.c.

◆ mSmbiosFilterType27BlackList

SMBIOS_FILTER_TABLE mSmbiosFilterType27BlackList[]
Initial value:
= {
{ 0x1B, OFFSET_OF (SMBIOS_TABLE_TYPE27, NominalSpeed), FIELD_SIZE_OF (SMBIOS_TABLE_TYPE27, NominalSpeed), 0 },
}

Definition at line 84 of file SmbiosMeasurementDxe.c.

◆ mSmbiosFilterType2BlackList

SMBIOS_FILTER_TABLE mSmbiosFilterType2BlackList[]
Initial value:
= {
{ 0x02, OFFSET_OF (SMBIOS_TABLE_TYPE2, SerialNumber), FIELD_SIZE_OF (SMBIOS_TABLE_TYPE2, SerialNumber), SMBIOS_FILTER_TABLE_FLAG_IS_STRING },
{ 0x02, OFFSET_OF (SMBIOS_TABLE_TYPE2, LocationInChassis), FIELD_SIZE_OF (SMBIOS_TABLE_TYPE2, LocationInChassis), SMBIOS_FILTER_TABLE_FLAG_IS_STRING },
}

Definition at line 50 of file SmbiosMeasurementDxe.c.

◆ mSmbiosFilterType39BlackList

SMBIOS_FILTER_TABLE mSmbiosFilterType39BlackList[]
Initial value:
= {
{ 0x27, OFFSET_OF (SMBIOS_TABLE_TYPE39, SerialNumber), FIELD_SIZE_OF (SMBIOS_TABLE_TYPE39, SerialNumber), SMBIOS_FILTER_TABLE_FLAG_IS_STRING },
{ 0x27, OFFSET_OF (SMBIOS_TABLE_TYPE39, AssetTagNumber), FIELD_SIZE_OF (SMBIOS_TABLE_TYPE39, AssetTagNumber), SMBIOS_FILTER_TABLE_FLAG_IS_STRING },
{ 0x27, OFFSET_OF (SMBIOS_TABLE_TYPE39, ModelPartNumber), FIELD_SIZE_OF (SMBIOS_TABLE_TYPE39, ModelPartNumber), SMBIOS_FILTER_TABLE_FLAG_IS_STRING },
}

Definition at line 87 of file SmbiosMeasurementDxe.c.

◆ mSmbiosFilterType3BlackList

SMBIOS_FILTER_TABLE mSmbiosFilterType3BlackList[]
Initial value:
= {
{ 0x03, OFFSET_OF (SMBIOS_TABLE_TYPE3, SerialNumber), FIELD_SIZE_OF (SMBIOS_TABLE_TYPE3, SerialNumber), SMBIOS_FILTER_TABLE_FLAG_IS_STRING },
{ 0x03, OFFSET_OF (SMBIOS_TABLE_TYPE3, AssetTag), FIELD_SIZE_OF (SMBIOS_TABLE_TYPE3, AssetTag), SMBIOS_FILTER_TABLE_FLAG_IS_STRING },
}

Definition at line 54 of file SmbiosMeasurementDxe.c.

◆ mSmbiosFilterType4BlackList

SMBIOS_FILTER_TABLE mSmbiosFilterType4BlackList[]
Initial value:
= {
{ 0x04, OFFSET_OF (SMBIOS_TABLE_TYPE4, SerialNumber), FIELD_SIZE_OF (SMBIOS_TABLE_TYPE4, SerialNumber), SMBIOS_FILTER_TABLE_FLAG_IS_STRING },
{ 0x04, OFFSET_OF (SMBIOS_TABLE_TYPE4, AssetTag), FIELD_SIZE_OF (SMBIOS_TABLE_TYPE4, AssetTag), SMBIOS_FILTER_TABLE_FLAG_IS_STRING },
{ 0x04, OFFSET_OF (SMBIOS_TABLE_TYPE4, PartNumber), FIELD_SIZE_OF (SMBIOS_TABLE_TYPE4, PartNumber), SMBIOS_FILTER_TABLE_FLAG_IS_STRING },
{ 0x04, OFFSET_OF (SMBIOS_TABLE_TYPE4, CoreCount), FIELD_SIZE_OF (SMBIOS_TABLE_TYPE4, CoreCount), 0 },
{ 0x04, OFFSET_OF (SMBIOS_TABLE_TYPE4, EnabledCoreCount), FIELD_SIZE_OF (SMBIOS_TABLE_TYPE4, EnabledCoreCount), 0 },
{ 0x04, OFFSET_OF (SMBIOS_TABLE_TYPE4, ThreadCount), FIELD_SIZE_OF (SMBIOS_TABLE_TYPE4, ThreadCount), 0 },
{ 0x04, OFFSET_OF (SMBIOS_TABLE_TYPE4, CoreCount2), FIELD_SIZE_OF (SMBIOS_TABLE_TYPE4, CoreCount2), 0 },
{ 0x04, OFFSET_OF (SMBIOS_TABLE_TYPE4, EnabledCoreCount2), FIELD_SIZE_OF (SMBIOS_TABLE_TYPE4, EnabledCoreCount2), 0 },
{ 0x04, OFFSET_OF (SMBIOS_TABLE_TYPE4, ThreadCount2), FIELD_SIZE_OF (SMBIOS_TABLE_TYPE4, ThreadCount2), 0 },
{ 0x04, OFFSET_OF (SMBIOS_TABLE_TYPE4, Voltage), FIELD_SIZE_OF (SMBIOS_TABLE_TYPE4, Voltage), 0 },
{ 0x04, OFFSET_OF (SMBIOS_TABLE_TYPE4, CurrentSpeed), FIELD_SIZE_OF (SMBIOS_TABLE_TYPE4, CurrentSpeed), 0 },
}

Definition at line 58 of file SmbiosMeasurementDxe.c.