OpenBIC
OpenSource Bridge-IC
util_spi.c File Reference
#include <zephyr.h>
#include <logging/log.h>
#include <shell/shell.h>
#include <drivers/flash.h>
#include <device.h>
#include <soc.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <sys/util.h>
#include "cmsis_os2.h"
#include "util_spi.h"
#include "util_sys.h"
#include "libutil.h"
#include "ipmi.h"
#include <crypto/hash.h>
#include "plat_def.h"
Include dependency graph for util_spi.c:

Macros

#define FW_UPDATE_RETRY_MAX_COUNT   0
 
#define IS25WP256D_ID   0x9D7019
 
#define BIOS_MAX_SIZE_BYTES   (64 * 1024 * 1024UL)
 

Functions

 LOG_MODULE_REGISTER (util_spi)
 
int ckeck_flash_device_isinit (const struct device *flash_device, uint8_t flash_position)
 
char * get_flash_device_string_by_index (uint8_t flash_index)
 
int do_update (const struct device *flash_device, off_t offset, uint8_t *buf, size_t len)
 
uint8_t fw_update (uint32_t offset, uint16_t msg_len, uint8_t *msg_buf, uint8_t flag, uint8_t flash_position)
 
int read_fw_image (uint32_t offset, uint8_t msg_len, uint8_t *msg_buf, uint8_t flash_position)
 
void set_default_retry_count (int count)
 
__weak uint8_t fw_update_cxl (uint32_t offset, uint16_t msg_len, uint8_t *msg_buf, bool sector_end)
 
__weak int pal_get_bios_flash_position ()
 
__weak int pal_get_prot_flash_position ()
 
__weak int pal_get_pcie_switch_flash_position ()
 
__weak bool pal_switch_bios_spi_mux (int gpio_status)
 
__weak bool pal_switch_pcie_switch_spi_mux (int gpio_status)
 
int erase_entire_flash (const struct device *flash_dev)
 
int cmd_erase_bios (int platform_id)
 

Variables

volatile uint8_t bios_erase_progress = 0
 

Macro Definition Documentation

◆ BIOS_MAX_SIZE_BYTES

#define BIOS_MAX_SIZE_BYTES   (64 * 1024 * 1024UL)

◆ FW_UPDATE_RETRY_MAX_COUNT

#define FW_UPDATE_RETRY_MAX_COUNT   0

◆ IS25WP256D_ID

#define IS25WP256D_ID   0x9D7019

Function Documentation

◆ ckeck_flash_device_isinit()

int ckeck_flash_device_isinit ( const struct device *  flash_device,
uint8_t  flash_position 
)

◆ cmd_erase_bios()

int cmd_erase_bios ( int  platform_id)
Here is the call graph for this function:

◆ do_update()

int do_update ( const struct device *  flash_device,
off_t  offset,
uint8_t *  buf,
size_t  len 
)

◆ erase_entire_flash()

int erase_entire_flash ( const struct device *  flash_dev)

◆ fw_update()

uint8_t fw_update ( uint32_t  offset,
uint16_t  msg_len,
uint8_t *  msg_buf,
uint8_t  flag,
uint8_t  flash_position 
)

◆ fw_update_cxl()

__weak uint8_t fw_update_cxl ( uint32_t  offset,
uint16_t  msg_len,
uint8_t *  msg_buf,
bool  sector_end 
)

◆ get_flash_device_string_by_index()

char * get_flash_device_string_by_index ( uint8_t  flash_index)

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( util_spi  )

◆ pal_get_bios_flash_position()

__weak int pal_get_bios_flash_position ( )

◆ pal_get_pcie_switch_flash_position()

__weak int pal_get_pcie_switch_flash_position ( )

◆ pal_get_prot_flash_position()

__weak int pal_get_prot_flash_position ( )

◆ pal_switch_bios_spi_mux()

__weak bool pal_switch_bios_spi_mux ( int  gpio_status)

◆ pal_switch_pcie_switch_spi_mux()

__weak bool pal_switch_pcie_switch_spi_mux ( int  gpio_status)

◆ read_fw_image()

int read_fw_image ( uint32_t  offset,
uint8_t  msg_len,
uint8_t *  msg_buf,
uint8_t  flash_position 
)

◆ set_default_retry_count()

void set_default_retry_count ( int  count)

Variable Documentation

◆ bios_erase_progress

volatile uint8_t bios_erase_progress = 0

◆ isinit

bool isinit

◆ name

char* name