23#include <drivers/spi_nor.h>
26#define SECTOR_SZ_64K 0x10000
27#define SECTOR_SZ_32K 0x08000
28#define SECTOR_SZ_16K 0x04000
29#define SECTOR_SZ_4K 0x01000
30#define SECTOR_SZ_1K 0x00400
31#define SECTOR_SZ_256 0x00100
33#define SHA256_DIGEST_SIZE 32
35#define SECTOR_END_FLAG BIT(7)
36#define NO_RESET_FLAG BIT(0)
47uint8_t
fw_update(uint32_t
offset, uint16_t msg_len, uint8_t *msg_buf, uint8_t flag,
48 uint8_t flash_position);
49int read_fw_image(uint32_t
offset, uint8_t msg_len, uint8_t *msg_buf, uint8_t flash_position);
58int do_update(
const struct device *flash_device, off_t
offset, uint8_t *buf,
size_t len);
73#if DT_NODE_HAS_STATUS(DT_PATH(soc, spi_7e620000), okay)
77#if DT_NODE_HAS_STATUS(DT_PATH(soc, spi_7e630000), okay)
81#if DT_NODE_HAS_STATUS(DT_PATH(soc, spi_7e640000), okay)
uint32_t offset
Definition: pldm_firmware_update.h:0
uint32_t length
Definition: pldm_firmware_update.h:1
uint8_t fw_update_cxl(uint32_t offset, uint16_t msg_len, uint8_t *msg_buf, bool sector_end)
Definition: util_spi.c:479
uint8_t fw_update(uint32_t offset, uint16_t msg_len, uint8_t *msg_buf, uint8_t flag, uint8_t flash_position)
Definition: util_spi.c:319
int pal_get_bios_flash_position()
Definition: util_spi.c:484
bool pal_switch_bios_spi_mux(int gpio_status)
Definition: util_spi.c:494
int do_update(const struct device *flash_device, off_t offset, uint8_t *buf, size_t len)
Definition: util_spi.c:132
int ckeck_flash_device_isinit(const struct device *flash_device, uint8_t flash_position)
Definition: util_spi.c:111
int pal_get_cxl_flash_position()
DEVICE_POSITIONS
Definition: util_spi.h:38
@ DEVSPI_SPI1_CS0
Definition: util_spi.h:41
@ DEVSPI_SPI1_CS1
Definition: util_spi.h:42
@ DEVSPI_SPI2_CS0
Definition: util_spi.h:43
@ DEVSPI_FMC_CS0
Definition: util_spi.h:39
@ DEVSPI_FMC_CS1
Definition: util_spi.h:40
@ DEVSPI_SPI2_CS1
Definition: util_spi.h:44
uint8_t get_fw_sha256(uint8_t *msg_buf, uint32_t offset, uint32_t length, uint8_t flash_position)
int read_fw_image(uint32_t offset, uint8_t msg_len, uint8_t *msg_buf, uint8_t flash_position)
Definition: util_spi.c:447
void set_default_retry_count(int count)
Definition: util_spi.c:474
char * get_flash_device_string_by_index(uint8_t flash_index)
Definition: util_spi.c:127
int pal_get_prot_flash_position()
Definition: util_spi.c:489
FIRMWARE_UPDATE_RETURN_CODE
Definition: util_spi.h:63
@ FWUPDATE_NOT_SUPPORT
Definition: util_spi.h:70
@ FWUPDATE_OUT_OF_HEAP
Definition: util_spi.h:65
@ FWUPDATE_REPEATED_UPDATED
Definition: util_spi.h:67
@ FWUPDATE_OVER_LENGTH
Definition: util_spi.h:66
@ FWUPDATE_ERROR_OFFSET
Definition: util_spi.h:69
@ FWUPDATE_UPDATE_FAIL
Definition: util_spi.h:68
@ FWUPDATE_SUCCESS
Definition: util_spi.h:64