coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
spm.c File Reference
#include <assert.h>
#include <cbfs.h>
#include <console/console.h>
#include <device/mmio.h>
#include <endian.h>
#include <soc/emi.h>
#include <soc/spm.h>
#include <timer.h>
Include dependency graph for spm.c:

Go to the source code of this file.

Macros

#define BUF_SIZE   (16 * KiB)
 

Functions

static uint8_t spm_bin[BUF_SIZE__aligned (8)
 
static int spm_register_init (void)
 
static int spm_code_swapping (void)
 
static int spm_reset_and_init_pcm (const struct pcm_desc *pcmdesc)
 
static void spm_load_pcm_code (const struct dyna_load_pcm *pcm)
 
static void spm_check_pcm_code (const struct dyna_load_pcm *pcm)
 
static void spm_kick_im_to_fetch (const struct dyna_load_pcm *pcm)
 
static void spm_init_pcm_register (void)
 
static void spm_init_event_vector (const struct pcm_desc *pcmdesc)
 
static int spm_load_firmware (enum dyna_load_pcm_index index, struct dyna_load_pcm *pcm)
 
static void spm_kick_pcm_to_run (void)
 
int spm_init (void)
 

Variables

static const char *const dyna_load_pcm_path []
 

Macro Definition Documentation

◆ BUF_SIZE

#define BUF_SIZE   (16 * KiB)

Definition at line 12 of file spm.c.

Function Documentation

◆ __aligned()

static uint8_t spm_bin [BUF_SIZE] __aligned ( )
static

◆ spm_check_pcm_code()

static void spm_check_pcm_code ( const struct dyna_load_pcm pcm)
static

Definition at line 164 of file spm.c.

References dyna_load_pcm::buf, dyna_load_pcm::desc, mtk_spm, PCM_IM_HOST_EN_LSB, mtk_spm_regs::pcm_im_host_rw_dat, mtk_spm_regs::pcm_im_host_rw_ptr, read32(), pcm_desc::size, spm_load_pcm_code(), and write32().

Referenced by spm_kick_im_to_fetch().

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

◆ spm_code_swapping()

static int spm_code_swapping ( void  )
static

◆ spm_init()

int spm_init ( void  )

Definition at line 298 of file spm.c.

◆ spm_init_event_vector()

static void spm_init_event_vector ( const struct pcm_desc pcmdesc)
static

Definition at line 206 of file spm.c.

References mtk_spm, mtk_spm_regs::pcm_event_vector, PCM_EVENT_VECTOR_NUM, pcm_desc::vector, and write32().

Referenced by spm_init().

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

◆ spm_init_pcm_register()

static void spm_init_pcm_register ( void  )
static

Definition at line 193 of file spm.c.

References mtk_spm, mtk_spm_regs::pcm_pwr_io_en, mtk_spm_regs::pcm_reg_data_ini, PCM_RF_SYNC_R0, PCM_RF_SYNC_R7, read32(), mtk_spm_regs::spm_power_on_val0, mtk_spm_regs::spm_power_on_val1, and write32().

Referenced by spm_init().

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

◆ spm_kick_im_to_fetch()

static void spm_kick_im_to_fetch ( const struct dyna_load_pcm pcm)
static

Definition at line 177 of file spm.c.

References BIOS_DEBUG, dyna_load_pcm::buf, dyna_load_pcm::desc, IM_KICK_L_LSB, mtk_spm, PCM_CK_EN_LSB, mtk_spm_regs::pcm_con0, PCM_KICK_L_LSB, printk, read32(), pcm_desc::size, spm_check_pcm_code(), spm_load_pcm_code(), SPM_REGWR_CFG_KEY, and write32().

Referenced by spm_init().

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

◆ spm_kick_pcm_to_run()

◆ spm_load_firmware()

static int spm_load_firmware ( enum dyna_load_pcm_index  index,
struct dyna_load_pcm pcm 
)
static

Definition at line 217 of file spm.c.

References assert, BIOS_DEBUG, BIOS_ERR, BIOS_INFO, dyna_load_pcm::buf, cbfs_load(), dyna_load_pcm::desc, dyna_load_pcm_path, memcpy(), offset, printk, pcm_desc::size, stopwatch_duration_msecs(), and stopwatch_init().

Referenced by spm_init().

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

◆ spm_load_pcm_code()

static void spm_load_pcm_code ( const struct dyna_load_pcm pcm)
static

◆ spm_register_init()

static int spm_register_init ( void  )
static

◆ spm_reset_and_init_pcm()

Variable Documentation

◆ dyna_load_pcm_path

const char* const dyna_load_pcm_path[]
static
Initial value:
= {
[DYNA_LOAD_PCM_SUSPEND_LP4_3733] = "pcm_allinone_lp4_3733.bin",
[DYNA_LOAD_PCM_SUSPEND_LP4_3200] = "pcm_allinone_lp4_3200.bin",
}
@ DYNA_LOAD_PCM_SUSPEND_LP4_3733
Definition: spm.h:563
@ DYNA_LOAD_PCM_SUSPEND_LP4_3200
Definition: spm.h:564

Definition at line 212 of file spm.c.

Referenced by spm_load_firmware().