|
TT Zephyr Platforms 19.6.99
Tenstorrent Firmware
|
#include "noc2axi.h"#include "noc_init.h"#include "harvesting.h"#include <stdint.h>#include <string.h>#include <tenstorrent/post_code.h>#include <tenstorrent/spi_flash_buf.h>#include <tenstorrent/sys_init_defines.h>#include <tenstorrent/tt_boot_fs.h>#include <zephyr/device.h>#include <zephyr/drivers/flash.h>#include <zephyr/drivers/misc/bh_fwtable.h>#include <zephyr/drivers/dma.h>#include <zephyr/drivers/dma/dma_tt_bh_noc.h>#include <zephyr/init.h>#include <zephyr/kernel.h>#include <zephyr/logging/log.h>#include <zephyr/sys/util.h>Macros | |
| #define | ARC_NOC0_X 8 |
| #define | ARC_NOC0_Y 0 |
| #define | TENSIX_X_START 2 |
| #define | TENSIX_Y_START 2 |
| #define | TENSIX_X_END 1 |
| #define | TENSIX_Y_END 11 |
| #define | TENSIX_L1_SIZE (1536 * 1024) |
| #define | TRISC0_RESET_PC 0xFFB12228 |
| #define | TRISC_RESET_PC_OVERRIDE 0xFFB12234 |
| #define | SOFT_RESET_0 0xFFB121B0 |
| #define | ALL_RISC_SOFT_RESET 0x47800 |
| #define | TRISC_WIPE_FW_TAG "destwipe" |
| #define | TRISC_WIPE_FW_LOAD_ADDR 0x6000 /* TRISC0_CODE region start */ |
| #define | SCRATCHPAD_SIZE CONFIG_TT_BH_ARC_SCRATCHPAD_SIZE |
| #define | COUNTER_TENSIX_X 1 |
| #define | COUNTER_TENSIX_Y 2 |
| #define | COUNTER_L1_ADDR 0x110000 /* Must match firmware hardcoded value */ |
| #define | NUM_TENSIX_ROWS 10 |
| #define | WIPE_DEST_TIMEOUT_US 10000 /* 10ms timeout */ |
Functions | |
| LOG_MODULE_REGISTER (tensix_init, CONFIG_TT_APP_LOG_LEVEL) | |
| static void | EnableTensixCG (void) |
| static void | wipe_l1 (void) |
| Zeros the l1 of every non-harvested tensix core. | |
| static int | global_sync (uint8_t ring, uint8_t noc_tlb, uint32_t expected_count) |
| Global synchronization for wipe_dest. | |
| static int | noc2axi_write32_fw (const uint8_t *src, uint8_t *dst, size_t len) |
| Helper function to write 32-bit words to NOC. | |
| static void | setup_tensix_mcast_tlb (uint8_t ring, uint8_t noc_tlb, uint32_t addr) |
| Setup the multicast TLB for the unharvested tensix cores. | |
| static int | wipe_dest (void) |
| Zeros the DEST register of every non-harvested tensix core. | |
| void | TensixInit (void) |
| static int | tensix_init (void) |
| SYS_INIT_APP (tensix_init) | |
Variables | |
| static const struct device *const | fwtable_dev = DEVICE_DT_GET(DT_NODELABEL(fwtable)) |
| static const struct device *const | dma_noc = DEVICE_DT_GET(DT_NODELABEL(dma1)) |
| static const struct device *const | flash = DEVICE_DT_GET_OR_NULL(DT_NODELABEL(spi_flash)) |
| #define ALL_RISC_SOFT_RESET 0x47800 |
| #define ARC_NOC0_X 8 |
| #define ARC_NOC0_Y 0 |
| #define COUNTER_L1_ADDR 0x110000 /* Must match firmware hardcoded value */ |
| #define COUNTER_TENSIX_X 1 |
| #define COUNTER_TENSIX_Y 2 |
| #define NUM_TENSIX_ROWS 10 |
| #define SCRATCHPAD_SIZE CONFIG_TT_BH_ARC_SCRATCHPAD_SIZE |
| #define SOFT_RESET_0 0xFFB121B0 |
| #define TENSIX_L1_SIZE (1536 * 1024) |
| #define TENSIX_X_END 1 |
| #define TENSIX_X_START 2 |
| #define TENSIX_Y_END 11 |
| #define TENSIX_Y_START 2 |
| #define TRISC0_RESET_PC 0xFFB12228 |
| #define TRISC_RESET_PC_OVERRIDE 0xFFB12234 |
| #define TRISC_WIPE_FW_LOAD_ADDR 0x6000 /* TRISC0_CODE region start */ |
| #define TRISC_WIPE_FW_TAG "destwipe" |
| #define WIPE_DEST_TIMEOUT_US 10000 /* 10ms timeout */ |
|
static |
Global synchronization for wipe_dest.
This function is used to synchronize the wipe_dest operation across all tensix cores. It reads the counter from the chosen tensix core and waits for it to reach the expected count. It returns 0 if the counter reached the expected count, -ETIMEDOUT otherwise.
| LOG_MODULE_REGISTER | ( | tensix_init | , |
| CONFIG_TT_APP_LOG_LEVEL | ) |
Helper function to write 32-bit words to NOC.
This function is used to write 32-bit words to NOC using DMA.
Setup the multicast TLB for the unharvested tensix cores.
| ring | The ring to use for the multicast TLB |
| noc_tlb | The TLB number to use for the multicast TLB |
| addr | The address to load the firmware to |
| SYS_INIT_APP | ( | tensix_init | ) |
|
static |
| void TensixInit | ( | void | ) |
|
static |
Zeros the DEST register of every non-harvested tensix core.
The DEST register can only be written by code running on the local TRISC. This function loads a wipe firmware from SPI flash to each Tensix's L1, runs it on TRISC 0 to clear DEST using 32-bit stores, then puts TRISC 0 back in reset.
|
static |
Zeros the l1 of every non-harvested tensix core.
First zero the l1 of an arbitrary non-harvested tensix core, then broadcasts the zero'd l1 to all other non-harvested tensix cores. This approach is faster than iterating over all tensix cores sequentially to clear each l1.
|
static |
|
static |
|
static |