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

Go to the source code of this file.

Data Structures

struct  CPU_MICROCODE_MEASUREMENT_EVENT_LOG
 

Macros

#define CPU_MICROCODE_MEASUREMENT_DESCRIPTION   "Microcode Measurement"
 
#define CPU_MICROCODE_MEASUREMENT_EVENT_LOG_DESCRIPTION_LEN   sizeof (CPU_MICROCODE_MEASUREMENT_DESCRIPTION)
 

Functions

INTN EFIAPI MicrocodePatchOffsetCompareFunction (IN CONST VOID *Offset1, IN CONST VOID *Offset2)
 
VOID RemoveDuplicateAndInvalidOffset (IN UINT64 *Offsets, IN OUT UINTN *Count)
 
VOID EFIAPI MeasureMicrocodePatches (IN EFI_EVENT Event, IN VOID *Context)
 
EFI_STATUS EFIAPI MicrocodeMeasurementDriverEntryPoint (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Detailed Description

This driver measures microcode patches to TPM.

This driver consumes gEdkiiMicrocodePatchHobGuid, packs all unique microcode patch found in gEdkiiMicrocodePatchHobGuid to a binary blob, and measures the binary blob to TPM.

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

Definition in file MicrocodeMeasurementDxe.c.

Macro Definition Documentation

◆ CPU_MICROCODE_MEASUREMENT_DESCRIPTION

#define CPU_MICROCODE_MEASUREMENT_DESCRIPTION   "Microcode Measurement"

Definition at line 25 of file MicrocodeMeasurementDxe.c.

◆ CPU_MICROCODE_MEASUREMENT_EVENT_LOG_DESCRIPTION_LEN

#define CPU_MICROCODE_MEASUREMENT_EVENT_LOG_DESCRIPTION_LEN   sizeof (CPU_MICROCODE_MEASUREMENT_DESCRIPTION)

Definition at line 26 of file MicrocodeMeasurementDxe.c.

Function Documentation

◆ MeasureMicrocodePatches()

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

Callback function.

Called after signaling of the Ready to Boot Event. Measure microcode patches binary blob with event type EV_CPU_MICROCODE to PCR[1] in TPM.

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

Definition at line 135 of file MicrocodeMeasurementDxe.c.

◆ MicrocodeMeasurementDriverEntryPoint()

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

Driver to produce microcode measurement.

Driver to produce microcode measurement. Which install a callback function on ready to boot event.

Parameters
ImageHandleModule's image handle
SystemTablePointer of EFI_SYSTEM_TABLE
Returns
EFI_SUCCESS This function always complete successfully.

Definition at line 263 of file MicrocodeMeasurementDxe.c.

◆ MicrocodePatchOffsetCompareFunction()

INTN EFIAPI MicrocodePatchOffsetCompareFunction ( IN CONST VOID *  Offset1,
IN CONST VOID *  Offset2 
)

Helping function.

The function is called by QuickSort to compare the order of offsets of two microcode patches in RAM relative to their base address. Elements will be in ascending order.

Parameters
[in]Offset1The pointer to the offset of first microcode patch.
[in]Offset2The pointer to the offset of second microcode patch.
Return values
1The offset of first microcode patch is bigger than that of the second.
-1The offset of first microcode patch is smaller than that of the second.
0The offset of first microcode patch equals to that of the second.

Definition at line 52 of file MicrocodeMeasurementDxe.c.

◆ RemoveDuplicateAndInvalidOffset()

VOID RemoveDuplicateAndInvalidOffset ( IN UINT64 *  Offsets,
IN OUT UINTN Count 
)

This function remove duplicate and invalid offsets in Offsets.

This function remove duplicate and invalid offsets in Offsets. Invalid offset means MAX_UINT64 in Offsets.

Parameters
[in]OffsetsMicrocode offset list.
[in,out]CountOn call as the count of raw microcode offset list; On return as count of the clean microcode offset list.

Definition at line 75 of file MicrocodeMeasurementDxe.c.