TT Zephyr Platforms 18.11.99
Tenstorrent Firmware
Loading...
Searching...
No Matches
fwupdate.h File Reference

Tenstorrent firmware update API. More...

#include <stdbool.h>
#include <zephyr/device.h>
#include <zephyr/drivers/gpio.h>
#include <tenstorrent/tt_boot_fs.h>

Go to the source code of this file.

Functions

int tt_fwupdate_init (const struct device *dev, struct gpio_dt_spec mux)
 Set the external flash device and set the passed spi mux (if not null) to allow communication with the spi.
int tt_fwupdate_complete (void)
 Called on the completion of the fwupdate operation, disables the spi mux if initialized in tt_fwupdate_init
int tt_fwupdate (const char *tag, bool dry_run, bool reboot)
 Search for, verify, and apply firmware updates.
int tt_fwupdate_confirm (void)
 Confirm that the current firmware has booted successfully.
int tt_fwupdate_flash_image (const tt_boot_fs_fd *fd)
 Flash the image described by the provided boot filesystem file descriptor.
int tt_fwupdate_is_confirmed (void)
 Check if the currently running firmware has been confirmed.
int tt_fwupdate_validate_fd (const tt_boot_fs_fd *fd)
 Validate the provided boot filesystem file descriptor.
int tt_fwupdate_validate_image (const tt_boot_fs_fd *fd)
 Validate the image described by the provided boot filesystem file descriptor.

Detailed Description

Tenstorrent firmware update API.

Function Documentation

◆ tt_fwupdate()

int tt_fwupdate ( const char * tag,
bool dry_run,
bool reboot )

Search for, verify, and apply firmware updates.

Note
if a firmware update is applied successfully and reboot is true, then this function does not return.
Parameters
tagThe tag (name) of the update image in the flash filesystem.
dry_runOnly verify data and operations. Do not write to flash or reboot.
rebootIf true, reboot after the update has been successfully written.
Return values
0on success, if no firmware update is needed.
1on success, if a firmware update was applied and a reboot is required.
-EINVALif an argument is invalid.
-EIOif an I/O error occurs.
-ENOENTif the image is invalid an image named tag cannot be found.
-ENODEVif the current slot cannot be determined or a device is not ready.

◆ tt_fwupdate_complete()

int tt_fwupdate_complete ( void )

Called on the completion of the fwupdate operation, disables the spi mux if initialized in tt_fwupdate_init

Return values
0on success, if the spi mux was able to be set

◆ tt_fwupdate_confirm()

int tt_fwupdate_confirm ( void )

Confirm that the current firmware has booted successfully.

Return values
0on success.
-EIOif an I/O erorr occurs.

◆ tt_fwupdate_flash_image()

int tt_fwupdate_flash_image ( const tt_boot_fs_fd * fd)

Flash the image described by the provided boot filesystem file descriptor.

Note
This function does not validate the image. Please use tt_fwupdate_validate_image first.
Parameters
fdA pointer to the file descriptor for the desired image.
Returns
0 if the image described by fd is valid.
Return values
-EINVALif fd is NULL.
-ENOENTif the image is invalid.
-EIOif an I/O error occurs.
-EFBIGif the image is too large to fit in the slot.

◆ tt_fwupdate_init()

int tt_fwupdate_init ( const struct device * dev,
struct gpio_dt_spec mux )

Set the external flash device and set the passed spi mux (if not null) to allow communication with the spi.

Parameters
devThe pointer to the external flash device to use.
muxThe spi mux to set and disable on start and completion of the fw update operations.
Return values
0on success, if the spi mux was able to be set

◆ tt_fwupdate_is_confirmed()

int tt_fwupdate_is_confirmed ( void )

Check if the currently running firmware has been confirmed.

Return values
0if the currently running firmware has not been confirmed.
1if the currently running firmware has been confirmed.
-EIOif an I/O erorr occurs.

◆ tt_fwupdate_validate_fd()

int tt_fwupdate_validate_fd ( const tt_boot_fs_fd * fd)

Validate the provided boot filesystem file descriptor.

Parameters
fdA pointer to the file descriptor to validate.
Return values
0if fd is valid.
-EINVALif fd is NULL.
-ENOENTif fd is invalid.
-EIOif an I/O error occurs.

◆ tt_fwupdate_validate_image()

int tt_fwupdate_validate_image ( const tt_boot_fs_fd * fd)

Validate the image described by the provided boot filesystem file descriptor.

Parameters
fdA pointer to the file descriptor for the desired image.
Returns
0 if the image described by fd is valid.
Return values
-EINVALif fd is NULL.
-ENOENTif the image is invalid.
-EIOif an I/O error occurs.