![]() |
TT-System-Firmware APIs 19.15.99
Tenstorrent Firmware
|
#include "reg.h"#include "status_reg.h"#include "telemetry.h"#include "util.h"#include <stdbool.h>#include <string.h>#include <tenstorrent/board_variables.h>#include <tenstorrent/smc_msg.h>#include <tenstorrent/msgqueue.h>#include <tenstorrent/sys_init_defines.h>#include <tenstorrent/tt_boot_fs.h>#include <zephyr/drivers/mspi.h>#include <zephyr/drivers/flash.h>#include <zephyr/logging/log.h>#include <zephyr/init.h>#include <zephyr/kernel.h>
Macros | |
| #define | SPI_PAGE_SIZE 256 |
| #define | SECTOR_SIZE 4096 |
| #define | SPI_BUFFER_SIZE 4096 |
| #define | BYTE_GET(v, b) |
| #define | SSI_RX_DLY_SR_DEPTH 64 |
| #define | SPI_RX_SAMPLE_DELAY_TRAIN_ADDR 0x13FFC |
| #define | SPI_RX_SAMPLE_DELAY_TRAIN_DATA 0xA5A55A5A |
| #define | FLASH_JEDEC_ID_MT25QU512ABB 0x20BB20 |
| #define | FLASH_UNLOCK_ERR_MISSING_VARIABLES 1 |
| FLASH_UNLOCK exit code: the host did not verify every required board variable. The required set is reported in response->data[1]. | |
Variables | |
| static uint8_t | spi_page_buf [4096] |
| static uint8_t | spi_global_buffer [4096] |
| static struct flash_pages_info | page_info |
| static bool | flash_locked = true |
| static const struct device * | flash = DEVICE_DT_GET_OR_NULL(DT_NODELABEL(spi_flash)) |
| #define BYTE_GET | ( | v, | |
| b ) |
| #define FLASH_JEDEC_ID_MT25QU512ABB 0x20BB20 |
| #define FLASH_UNLOCK_ERR_MISSING_VARIABLES 1 |
FLASH_UNLOCK exit code: the host did not verify every required board variable. The required set is reported in response->data[1].
| #define SECTOR_SIZE 4096 |
| #define SPI_BUFFER_SIZE 4096 |
| #define SPI_PAGE_SIZE 256 |
| #define SPI_RX_SAMPLE_DELAY_TRAIN_ADDR 0x13FFC |
| #define SPI_RX_SAMPLE_DELAY_TRAIN_DATA 0xA5A55A5A |
| #define SSI_RX_DLY_SR_DEPTH 64 |
|
static |
Confirms SPI flash operation by echoing challenge data.
Echoes the challenge data from request field back to response data[1] to confirm firmware update completion
|
static |
Locks flash memory to prevent writes.
Sets the global flash_locked flag to true, blocking all subsequent flash write operations until unlocked. The host must prove board compatibility again before the next unlock.
Unlocks flash memory to allow writes.
Clears the global flash_locked flag, enabling flash write operations, but only once the host has declared that it verified every board variable this board requires.
An image is compatible with a board if its board type matches (always verified by SPI writers) and the board variable checks pass. A host that does not know a variable exists cannot have checked it, so it is refused rather than allowed to write an image that the board cannot boot.
We also need a special exception for tt-flash + luwen. luwen unlocks & relocks (with no variable verification bits) in every call to spi_flash, failing if the unlock fails. Thus, if already unlocked, we ignore a no-bit unlock.
The requirement is reported in response->data[1] on success and failure alike, so that a rejected host can name what it must check.
|
static |
| LOG_MODULE_REGISTER | ( | spi_eeprom | , |
| CONFIG_TT_APP_LOG_LEVEL | ) |
| REGISTER_MESSAGE | ( | TT_SMC_MSG_CONFIRM_FLASHED_SPI | , |
| confirm_flashed_spi_handler | ) |
| REGISTER_MESSAGE | ( | TT_SMC_MSG_FLASH_LOCK | , |
| flash_lock_handler | ) |
| REGISTER_MESSAGE | ( | TT_SMC_MSG_FLASH_UNLOCK | , |
| flash_unlock_handler | ) |
| REGISTER_MESSAGE | ( | TT_SMC_MSG_READ_EEPROM | , |
| read_eeprom_handler | ) |
| REGISTER_MESSAGE | ( | TT_SMC_MSG_WRITE_EEPROM | , |
| write_eeprom_handler | ) |
|
static |
The board variables a host must verify before this board may be flashed.
See board_variables.h. Requiring a variable makes the board unflashable by any tool that does not know how to check it, so a variable is only required where getting it wrong would produce an unbootable image.
| SYS_INIT_APP | ( | InitSpiFS | ) |
|
static |
|
static |
|
static |
|
static |