coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
update_microcode.c File Reference
#include <arch/cpu.h>
#include <stdint.h>
#include <cpu/amd/microcode.h>
#include <commonlib/helpers.h>
#include <console/console.h>
#include <cpu/x86/msr.h>
#include <cpu/amd/msr.h>
#include <cbfs.h>
#include <timestamp.h>
Include dependency graph for update_microcode.c:

Go to the source code of this file.

Data Structures

struct  microcode
 

Macros

#define CPU_MICROCODE_BLOB_NAME   "cpu_microcode_blob.bin"
 
#define MPB_MAX_SIZE   CONFIG_SOC_AMD_COMMON_BLOCK_UCODE_SIZE
 
#define MPB_DATA_OFFSET   32
 

Functions

 _Static_assert (CONFIG_SOC_AMD_COMMON_BLOCK_UCODE_SIZE > 0, "SOC_AMD_COMMON_BLOCK_UCODE_SIZE is not set")
 
 _Static_assert (sizeof(struct microcode)==MPB_MAX_SIZE, "microcode size is invalid")
 
static void apply_microcode_patch (const struct microcode *m)
 
static uint16_t get_equivalent_processor_rev_id (void)
 
static const struct microcodefind_microcode (const struct microcode *ucode, size_t ucode_len)
 
void amd_update_microcode_from_cbfs (void)
 
void preload_microcode (void)
 

Variables

struct microcode __packed
 

Macro Definition Documentation

◆ CPU_MICROCODE_BLOB_NAME

#define CPU_MICROCODE_BLOB_NAME   "cpu_microcode_blob.bin"

Definition at line 13 of file update_microcode.c.

◆ MPB_DATA_OFFSET

#define MPB_DATA_OFFSET   32

Definition at line 19 of file update_microcode.c.

◆ MPB_MAX_SIZE

#define MPB_MAX_SIZE   CONFIG_SOC_AMD_COMMON_BLOCK_UCODE_SIZE

Definition at line 18 of file update_microcode.c.

Function Documentation

◆ _Static_assert() [1/2]

_Static_assert ( CONFIG_SOC_AMD_COMMON_BLOCK_UCODE_SIZE  ,
,
"SOC_AMD_COMMON_BLOCK_UCODE_SIZE is not set"   
)

◆ _Static_assert() [2/2]

_Static_assert ( sizeof(struct microcode = =MPB_MAX_SIZE,
"microcode size is invalid"   
)

◆ amd_update_microcode_from_cbfs()

void amd_update_microcode_from_cbfs ( void  )

◆ apply_microcode_patch()

static void apply_microcode_patch ( const struct microcode m)
static

Definition at line 43 of file update_microcode.c.

References BIOS_DEBUG, BIOS_ERR, BIOS_INFO, msr_struct::hi, IA32_BIOS_SIGN_ID, msr_struct::lo, m, MSR_PATCH_LOADER, printk, rdmsr(), and wrmsr().

Referenced by amd_update_microcode_from_cbfs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_microcode()

static const struct microcode* find_microcode ( const struct microcode ucode,
size_t  ucode_len 
)
static

Definition at line 74 of file update_microcode.c.

References BIOS_WARNING, get_equivalent_processor_rev_id(), m, MPB_MAX_SIZE, NULL, and printk.

Referenced by amd_update_microcode_from_cbfs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_equivalent_processor_rev_id()

static uint16_t get_equivalent_processor_rev_id ( void  )
static

Definition at line 67 of file update_microcode.c.

References cpuid_eax().

Referenced by find_microcode().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ preload_microcode()

void preload_microcode ( void  )

Definition at line 127 of file update_microcode.c.

References BIOS_DEBUG, cbfs_preload(), CONFIG, CPU_MICROCODE_BLOB_NAME, and printk.

Here is the call graph for this function:

Variable Documentation

◆ __packed