coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
psp_gen1.c File Reference
#include <cpu/amd/msr.h>
#include <cpu/x86/msr.h>
#include <device/mmio.h>
#include <device/pci_ops.h>
#include <device/pci_def.h>
#include <cbfs.h>
#include <region_file.h>
#include <timer.h>
#include <console/console.h>
#include <amdblocks/psp.h>
#include <soc/iomap.h>
#include <soc/northbridge.h>
#include <soc/pci_devs.h>
#include <soc/southbridge.h>
#include "psp_def.h"
Include dependency graph for psp_gen1.c:

Go to the source code of this file.

Data Structures

struct  pspv1_mbox
 

Macros

#define PSP_MAILBOX_OFFSET   0x70
 
#define PSPV1_STATUS_INITIALIZED   BIT(0)
 
#define PSPV1_STATUS_ERROR   BIT(1)
 
#define PSPV1_STATUS_TERMINATED   BIT(2)
 
#define PSPV1_STATUS_HALT   BIT(3)
 
#define PSPV1_STATUS_RECOVERY   BIT(4)
 

Functions

static voidsoc_get_mbox_address (void)
 
static u32 rd_mbox_sts (struct pspv1_mbox *mbox)
 
static void wr_mbox_cmd (struct pspv1_mbox *mbox, u32 cmd)
 
static u32 rd_mbox_cmd (struct pspv1_mbox *mbox)
 
static void wr_mbox_cmd_resp (struct pspv1_mbox *mbox, void *buffer)
 
static int wait_initialized (struct pspv1_mbox *mbox)
 
static int wait_command (struct pspv1_mbox *mbox)
 
int send_psp_command (u32 command, void *buffer)
 
int psp_load_named_blob (enum psp_blob_type type, const char *name)
 
int psp_notify_dram (void)
 

Variables

struct pspv1_mbox __packed
 

Macro Definition Documentation

◆ PSP_MAILBOX_OFFSET

#define PSP_MAILBOX_OFFSET   0x70

Definition at line 19 of file psp_gen1.c.

◆ PSPV1_STATUS_ERROR

#define PSPV1_STATUS_ERROR   BIT(1)

Definition at line 23 of file psp_gen1.c.

◆ PSPV1_STATUS_HALT

#define PSPV1_STATUS_HALT   BIT(3)

Definition at line 25 of file psp_gen1.c.

◆ PSPV1_STATUS_INITIALIZED

#define PSPV1_STATUS_INITIALIZED   BIT(0)

Definition at line 22 of file psp_gen1.c.

◆ PSPV1_STATUS_RECOVERY

#define PSPV1_STATUS_RECOVERY   BIT(4)

Definition at line 26 of file psp_gen1.c.

◆ PSPV1_STATUS_TERMINATED

#define PSPV1_STATUS_TERMINATED   BIT(2)

Definition at line 24 of file psp_gen1.c.

Function Documentation

◆ psp_load_named_blob()

int psp_load_named_blob ( enum psp_blob_type  type,
const char *  name 
)

Definition at line 153 of file psp_gen1.c.

References BIOS_DEBUG, BIOS_ERR, BLOB_SMU_FW, BLOB_SMU_FW2, cbfs_map(), cbfs_unmap(), CONFIG, MBOX_BIOS_CMD_SMU_FW, MBOX_BIOS_CMD_SMU_FW2, name, NULL, printk, psp_print_cmd_status(), PSPSTS_INVALID_BLOB, PSPSTS_INVALID_NAME, PSPSTS_UNSUPPORTED, send_psp_command(), and type.

Referenced by car_stage_entry(), and earliest_ramstage().

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

◆ psp_notify_dram()

int psp_notify_dram ( void  )

Definition at line 197 of file psp_gen1.c.

References BIOS_DEBUG, buffer, MBOX_BIOS_CMD_DRAM_INFO, printk, psp_print_cmd_status(), and send_psp_command().

Referenced by car_stage_entry().

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

◆ rd_mbox_cmd()

static u32 rd_mbox_cmd ( struct pspv1_mbox mbox)
static

Definition at line 77 of file psp_gen1.c.

References pspv1_mbox::mbox_command, and read32().

Referenced by wait_command().

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

◆ rd_mbox_sts()

static u32 rd_mbox_sts ( struct pspv1_mbox mbox)
static

Definition at line 67 of file psp_gen1.c.

References pspv1_mbox::mbox_status, and read32().

Referenced by send_psp_command(), and wait_initialized().

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

◆ send_psp_command()

int send_psp_command ( u32  command,
void buffer 
)

Definition at line 115 of file psp_gen1.c.

Referenced by psp_load_named_blob(), and psp_notify_dram().

Here is the caller graph for this function:

◆ soc_get_mbox_address()

static void* soc_get_mbox_address ( void  )
static

Definition at line 40 of file psp_gen1.c.

References BAR3HIDE, BIOS_WARNING, msr_struct::lo, PCI_BASE_ADDRESS_MEM_ATTR_MASK, pci_read_config32(), PCI_VENDOR_ID, printk, PSP_ADDR_MSR, PSP_BAR_ENABLES, PSP_DEV, PSP_FUNC, PSP_MAILBOX_BAR, PSP_MAILBOX_OFFSET, rdmsr(), and SOC_PSP_DEV.

Referenced by send_psp_command().

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

◆ wait_command()

static int wait_command ( struct pspv1_mbox mbox)
static

Definition at line 101 of file psp_gen1.c.

References PSP_CMD_TIMEOUT, PSPSTS_CMD_TIMEOUT, rd_mbox_cmd(), stopwatch_expired(), and stopwatch_init_msecs_expire().

Referenced by send_psp_command().

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

◆ wait_initialized()

static int wait_initialized ( struct pspv1_mbox mbox)
static

Definition at line 87 of file psp_gen1.c.

References PSP_INIT_TIMEOUT, PSPSTS_INIT_TIMEOUT, PSPV1_STATUS_INITIALIZED, rd_mbox_sts(), stopwatch_expired(), and stopwatch_init_msecs_expire().

Referenced by send_psp_command().

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

◆ wr_mbox_cmd()

static void wr_mbox_cmd ( struct pspv1_mbox mbox,
u32  cmd 
)
static

Definition at line 72 of file psp_gen1.c.

References pspv1_mbox::mbox_command, and write32().

Referenced by send_psp_command().

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

◆ wr_mbox_cmd_resp()

static void wr_mbox_cmd_resp ( struct pspv1_mbox mbox,
void buffer 
)
static

Definition at line 82 of file psp_gen1.c.

References buffer, pspv1_mbox::cmd_response, and write64().

Referenced by send_psp_command().

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

Variable Documentation

◆ __packed