TT-System-Firmware APIs 19.15.99
Tenstorrent Firmware
Loading...
Searching...
No Matches
reset.c File Reference
#include "chip_info.h"
#include "cm2dm_msg.h"
#include "eth.h"
#include "gddr.h"
#include "harvesting.h"
#include "init.h"
#include "irqnum.h"
#include "noc.h"
#include "noc_init.h"
#include "noc2axi.h"
#include "reg.h"
#include "status_reg.h"
#include "tensix.h"
#include "tensix_init.h"
#include "aiclk_ppm.h"
#include "bh_reset.h"
#include <tenstorrent/bh_power.h>
#include <stdint.h>
#include <tenstorrent/msgqueue.h>
#include <tenstorrent/smc_msg.h>
#include <tenstorrent/post_code.h>
#include <tenstorrent/sys_init_defines.h>
#include <zephyr/init.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
#include <zephyr/sys/util.h>
#include <zephyr/toolchain.h>
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
#include <zephyr/drivers/clock_control/clock_control_tt_bh.h>
#include <zephyr/drivers/clock_control.h>
#include <zephyr/drivers/reset/reset_tt_bh.h>
#include <zephyr/dt-bindings/reset/tt-bh-reset.h>
Include dependency graph for reset.c:

Macros

#define DT_DRV_COMPAT   tenstorrent_bh_clock_control
#define PLL_DEVICE_INIT(inst)
#define TENSIX_NUM_RESET_BANKS   TT_BH_RESET_NUM_BANKS(DT_NODELABEL(tensix_reset))
#define TT_BH_GLOBAL_RESET_MASK
#define TT_BH_ETH_TILE_MASK   GENMASK(13, 0)
#define TT_BH_ETH_RISC_MASK   GENMASK(29, 16)
#define TT_BH_DDR_TILE_MASK   GENMASK(7, 0)
#define TT_BH_DDR_RISC_MASK   GENMASK(31, 8)
#define TT_BH_L2CPU_TILE_MASK   GENMASK(3, 0)

Functions

 BUILD_ASSERT (TT_BH_RESET_NUM_BANKS(DT_NODELABEL(tensix_reset))==TT_BH_RESET_NUM_BANKS(DT_NODELABEL(tensix_risc_reset)), "tensix tile and RISC reset bank counts must match")
 LOG_MODULE_REGISTER (InitHW, CONFIG_TT_APP_LOG_LEVEL)
void record_init_failure (enum init_stage_id stage)
 Record a failure from an init function.
bool is_cable_fault_mode (void)
 Check if the system is in cable fault mode.
void bh_soft_reset_all_tensix (void)
static int AssertSoftResets (void)
 SYS_INIT_APP (AssertSoftResets)
static int DeassertRiscvResets (void)
 SYS_INIT_APP (DeassertRiscvResets)
static __maybe_unused uint8_t ToggleTensixReset (const union request *req, struct response *rsp)
 Handler for TT_SMC_MSG_TOGGLE_TENSIX_RESET.
 REGISTER_MESSAGE (TT_SMC_MSG_TOGGLE_TENSIX_RESET, ToggleTensixReset)
static __maybe_unused uint8_t ToggleSingleTensixReset (const union request *req, struct response *rsp)
 REGISTER_MESSAGE (TT_SMC_MSG_TOGGLE_SINGLE_TENSIX_RESET, ToggleSingleTensixReset)
static __maybe_unused uint8_t ReinitTensix (const union request *req, struct response *rsp)
 Handler for TT_SMC_MSG_REINIT_TENSIX.
 REGISTER_MESSAGE (TT_SMC_MSG_REINIT_TENSIX, ReinitTensix)
static int DeassertTileResets (void)
 SYS_INIT_APP (DeassertTileResets)

Variables

static const struct device *const pll_devs [] = {DT_INST_FOREACH_STATUS_OKAY(PLL_DEVICE_INIT)}
static const struct device *const global_reset_dev = DEVICE_DT_GET(DT_NODELABEL(global_reset))
static const struct device *const eth_reset_dev = DEVICE_DT_GET(DT_NODELABEL(eth_reset))
static const struct device *const ddr_reset_dev = DEVICE_DT_GET(DT_NODELABEL(ddr_reset))
static const struct device *const l2cpu_reset_dev = DEVICE_DT_GET(DT_NODELABEL(l2cpu_reset))
static const struct device *const tensix_reset_dev = DEVICE_DT_GET(DT_NODELABEL(tensix_reset))
static const struct device *const tensix_risc_reset_dev
uint32_t error_status0
static bool cable_fault_mode
static const uint8_t kNocRing
static const uint8_t kNocTlb
static const uint32_t kSoftReset0Addr = 0xFFB121B0
static const uint32_t kAllRiscSoftReset = 0x47800

Macro Definition Documentation

◆ DT_DRV_COMPAT

#define DT_DRV_COMPAT   tenstorrent_bh_clock_control

◆ PLL_DEVICE_INIT

#define PLL_DEVICE_INIT ( inst)
Value:
#define DEVICE_DT_INST_GET(inst)

◆ TENSIX_NUM_RESET_BANKS

#define TENSIX_NUM_RESET_BANKS   TT_BH_RESET_NUM_BANKS(DT_NODELABEL(tensix_reset))

◆ TT_BH_DDR_RISC_MASK

#define TT_BH_DDR_RISC_MASK   GENMASK(31, 8)

◆ TT_BH_DDR_TILE_MASK

#define TT_BH_DDR_TILE_MASK   GENMASK(7, 0)

◆ TT_BH_ETH_RISC_MASK

#define TT_BH_ETH_RISC_MASK   GENMASK(29, 16)

◆ TT_BH_ETH_TILE_MASK

#define TT_BH_ETH_TILE_MASK   GENMASK(13, 0)

◆ TT_BH_GLOBAL_RESET_MASK

#define TT_BH_GLOBAL_RESET_MASK
Value:
#define BIT(n)
#define TT_BH_GLOBAL_PTP_RESET_ID
Definition tt-bh-reset.h:36
#define TT_BH_GLOBAL_PCIE1_RESET_ID
Definition tt-bh-reset.h:35
#define TT_BH_GLOBAL_NOC_RESET_ID
Definition tt-bh-reset.h:32
#define TT_BH_GLOBAL_REFCLK_CNT_EN_ID
Definition tt-bh-reset.h:33
#define TT_BH_GLOBAL_PCIE0_RESET_ID
Definition tt-bh-reset.h:34
#define TT_BH_GLOBAL_SYSTEM_RESET_ID
Definition tt-bh-reset.h:31

◆ TT_BH_L2CPU_TILE_MASK

#define TT_BH_L2CPU_TILE_MASK   GENMASK(3, 0)

Function Documentation

◆ AssertSoftResets()

int AssertSoftResets ( void )
static

◆ bh_soft_reset_all_tensix()

void bh_soft_reset_all_tensix ( void )

◆ BUILD_ASSERT()

BUILD_ASSERT ( TT_BH_RESET_NUM_BANKS(DT_NODELABEL(tensix_reset)) = =TT_BH_RESET_NUM_BANKS(DT_NODELABEL(tensix_risc_reset)),
"tensix tile and RISC reset bank counts must match"  )

◆ DeassertRiscvResets()

int DeassertRiscvResets ( void )
static

◆ DeassertTileResets()

int DeassertTileResets ( void )
static

◆ is_cable_fault_mode()

bool is_cable_fault_mode ( void )

Check if the system is in cable fault mode.

Cable fault mode is entered when DMC reports 0W power limit (no cable or improper installation). In this mode, all tiles except column 15 are clock-gated via NIU_CFG_0 TILE_CLK_OFF to minimize power draw while the full NOC mesh and ARC-PCIe path remain available for host communication.

Returns
true if cable fault mode is active, false otherwise

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( InitHW ,
CONFIG_TT_APP_LOG_LEVEL  )

◆ record_init_failure()

void record_init_failure ( enum init_stage_id stage)

Record a failure from an init function.

Sets bit stage in STATUS_ERROR_STATUS0 and writes the shadow value through to scratch RAM immediately so the host can read it even if init hangs after this call. Safe to call multiple times; the bitmap accumulates.

◆ REGISTER_MESSAGE() [1/3]

REGISTER_MESSAGE ( TT_SMC_MSG_REINIT_TENSIX ,
ReinitTensix  )

◆ REGISTER_MESSAGE() [2/3]

◆ REGISTER_MESSAGE() [3/3]

◆ ReinitTensix()

__maybe_unused uint8_t ReinitTensix ( const union request * req,
struct response * rsp )
static

Handler for TT_SMC_MSG_REINIT_TENSIX.

See also
reinit_tensix_rqst

Redo Tensix init that gets cleared on Tensix reset. This includes all NOC programming and any programming within the tile.

◆ SYS_INIT_APP() [1/3]

SYS_INIT_APP ( AssertSoftResets )

◆ SYS_INIT_APP() [2/3]

SYS_INIT_APP ( DeassertRiscvResets )

◆ SYS_INIT_APP() [3/3]

SYS_INIT_APP ( DeassertTileResets )

◆ ToggleSingleTensixReset()

__maybe_unused uint8_t ToggleSingleTensixReset ( const union request * req,
struct response * rsp )
static

◆ ToggleTensixReset()

__maybe_unused uint8_t ToggleTensixReset ( const union request * req,
struct response * rsp )
static

Variable Documentation

◆ cable_fault_mode

bool cable_fault_mode
static

◆ ddr_reset_dev

const struct device* const ddr_reset_dev = DEVICE_DT_GET(DT_NODELABEL(ddr_reset))
static

◆ error_status0

uint32_t error_status0

◆ eth_reset_dev

const struct device* const eth_reset_dev = DEVICE_DT_GET(DT_NODELABEL(eth_reset))
static

◆ global_reset_dev

const struct device* const global_reset_dev = DEVICE_DT_GET(DT_NODELABEL(global_reset))
static

◆ kAllRiscSoftReset

const uint32_t kAllRiscSoftReset = 0x47800
static

◆ kNocRing

const uint8_t kNocRing
static

◆ kNocTlb

const uint8_t kNocTlb
static

◆ kSoftReset0Addr

const uint32_t kSoftReset0Addr = 0xFFB121B0
static

◆ l2cpu_reset_dev

const struct device* const l2cpu_reset_dev = DEVICE_DT_GET(DT_NODELABEL(l2cpu_reset))
static

◆ pll_devs

const struct device* const pll_devs[] = {DT_INST_FOREACH_STATUS_OKAY(PLL_DEVICE_INIT)}
static

◆ tensix_reset_dev

const struct device* const tensix_reset_dev = DEVICE_DT_GET(DT_NODELABEL(tensix_reset))
static

◆ tensix_risc_reset_dev

const struct device* const tensix_risc_reset_dev
static
Initial value:
=
DEVICE_DT_GET(DT_NODELABEL(tensix_risc_reset))
#define DEVICE_DT_GET(node_id)
#define DT_NODELABEL(label)