coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
tpm.c File Reference
#include <timer.h>
#include <console/console.h>
#include <device/mmio.h>
#include <string.h>
#include <soc/pci_devs.h>
#include <device/pci_ops.h>
#include "tpm.h"
Include dependency graph for tpm.c:

Go to the source code of this file.

Data Structures

struct  control_area
 

Functions

static void crb_readControlArea (void)
 
static int crb_wait_for_reg32 (const void *addr, uint32_t timeoutMs, uint32_t mask, uint32_t expectedValue)
 
static int crb_probe (void)
 
static uint8_t crb_activate_locality (void)
 
static int crb_switch_to_ready (void)
 
int tpm2_init (void)
 
size_t tpm2_process_command (const void *tpm2_command, size_t command_size, void *tpm2_response, size_t max_response)
 
void tpm2_get_info (struct tpm2_info *tpm2_info)
 

Variables

static struct control_area control_area
 
static uint8_t cur_loc = 0
 

Function Documentation

◆ crb_activate_locality()

static uint8_t crb_activate_locality ( void  )
static

Definition at line 111 of file tpm.c.

References BIOS_ERR, BIOS_SPEW, CRB_REG, CRB_REG_LOC_CTRL, CRB_REG_LOC_STATE, crb_wait_for_reg32(), LOC_CTRL_REQ_ACCESS, LOC_STATE_LOC_ASSIGN, LOC_STATE_REG_VALID_STS, printk, read8(), and write8().

Referenced by tpm2_process_command().

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

◆ crb_probe()

static int crb_probe ( void  )
static

Definition at line 83 of file tpm.c.

References BIOS_DEBUG, BIOS_SPEW, CRB_INTF_REG_CAP_CRB, CRB_INTF_REG_INTF_LOCK, CRB_INTF_REG_INTF_SEL, CRB_REG, CRB_REG_INTF_ID, cur_loc, printk, read64(), and write32().

Referenced by tpm2_init().

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

◆ crb_readControlArea()

◆ crb_switch_to_ready()

static int crb_switch_to_ready ( void  )
static

Definition at line 144 of file tpm.c.

References BIOS_ERR, CRB_REG, CRB_REG_REQUEST, CRB_REG_REQUEST_CMD_RDY, CRB_REG_STATUS, CRB_REG_STATUS_ERROR, crb_wait_for_reg32(), cur_loc, printk, and write8().

Referenced by tpm2_process_command().

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

◆ crb_wait_for_reg32()

static int crb_wait_for_reg32 ( const void addr,
uint32_t  timeoutMs,
uint32_t  mask,
uint32_t  expectedValue 
)
static

Definition at line 54 of file tpm.c.

References addr, BIOS_ERR, mask, printk, read32(), stopwatch_expired(), and stopwatch_init_msecs_expire().

Referenced by crb_activate_locality(), crb_switch_to_ready(), and tpm2_process_command().

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

◆ tpm2_get_info()

void tpm2_get_info ( struct tpm2_info tpm2_info)

Definition at line 266 of file tpm.c.

References CRB_REG, CRB_REG_INTF_ID, cur_loc, tpm2_info::device_id, read64(), tpm2_info::revision, and tpm2_info::vendor_id.

Referenced by tis_init().

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

◆ tpm2_init()

int tpm2_init ( void  )

Definition at line 175 of file tpm.c.

References BIOS_ERR, BIOS_SPEW, crb_probe(), crb_readControlArea(), and printk.

Referenced by tis_init().

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

◆ tpm2_process_command()

size_t tpm2_process_command ( const void tpm2_command,
size_t  command_size,
void tpm2_response,
size_t  max_response 
)

Variable Documentation

◆ control_area

struct control_area control_area
static

◆ cur_loc

uint8_t cur_loc = 0
static