TT-System-Firmware APIs 19.15.99
Tenstorrent Firmware
Loading...
Searching...
No Matches
cat.c File Reference
Include dependency graph for cat.c:

Data Structures

struct  RESET_UNIT_CATMON_THERM_TRIP_CNTL_reg_t
union  RESET_UNIT_CATMON_THERM_TRIP_CNTL_reg_u

Macros

#define RESET_UNIT_CATMON_THERM_TRIP_STATUS_REG_ADDR   0x80030164
#define RESET_UNIT_CATMON_THERM_TRIP_CNTL_REG_ADDR   0x80030168
#define RESET_UNIT_CATMON_THERM_TRIP_CNTL_REG_DEFAULT   0x00000318
#define CAT_EARLY_TRIP_TEMP   100
#define DEFAULT_CALIBRATION   (CAT_EARLY_TRIP_TEMP - T_J_SHUTDOWN)
#define TRIM_CODE_BITS   6
#define GDDR_THERM_TRIP_DMC_NOTIFY_MS   50

Functions

 LOG_MODULE_REGISTER (cat)
 SENSOR_DT_READ_IODEV (cat_ts_avg_iodev, DT_NODELABEL(pvt), {SENSOR_CHAN_PVT_TT_BH_TS_AVG, 0})
 RTIO_DEFINE (cat_ts_avg_ctx, 1, 1)
static uint8_t TempToTrimCode (float temp)
static float TrimCodeToTemp (int32_t trim_code)
static void WaitCATUpdate (void)
static void EnableCAT (uint8_t trim_code, bool shutdown_on_trip)
static int CATEarlyInit (void)
 SYS_INIT_APP (CATEarlyInit)
static float CalibrateCAT (void)
static int CATInit (void)
 SYS_INIT_APP (CATInit)
int EvaluateGddrThermTrip (int64_t now, int max_temp, int trip_temp, int critical_temp, int64_t duration_ms)
 Evaluate the GDDR thermal-trip state machine for one sample against the supplied thresholds.
static int MonitorGddrThermTrip (int64_t now, int max_temp)
static void TriggerThermTrip (void)
static void gddr_therm_trip_trigger_handler (struct k_work *work)
static K_WORK_DELAYABLE_DEFINE (gddr_therm_trip_trigger_work, gddr_therm_trip_trigger_handler)
uint8_t CatSetGddrThermTripEnabled (bool enabled)
 Enable or disable the GDDR thermal-trip action at runtime.
static void gddr_therm_trip_work_handler (struct k_work *work)
static K_WORK_DEFINE (gddr_therm_trip_worker, gddr_therm_trip_work_handler)
static void gddr_therm_trip_timer_handler (struct k_timer *timer)
static K_TIMER_DEFINE (gddr_therm_trip_timer, gddr_therm_trip_timer_handler, NULL)
int StartGddrThermTripMonitor (void)
 SYS_INIT_APP (StartGddrThermTripMonitor)

Variables

static const int gddr_therm_trip_interval = 100
static int gddr_therm_trip_temp
static int gddr_therm_trip_critical_temp
static int64_t gddr_therm_trip_duration_ms
static const struct device *const fwtable_dev = DEVICE_DT_GET(DT_NODELABEL(fwtable))
static const struct device *const pvt = DEVICE_DT_GET(DT_NODELABEL(pvt))
static uint8_t cat_ts_avg_buf [sizeof(struct pvt_tt_bh_rtio_data)]
static const struct devicegpio1 = DEVICE_DT_GET_OR_NULL(DT_NODELABEL(gpio1))

Macro Definition Documentation

◆ CAT_EARLY_TRIP_TEMP

#define CAT_EARLY_TRIP_TEMP   100

◆ DEFAULT_CALIBRATION

#define DEFAULT_CALIBRATION   (CAT_EARLY_TRIP_TEMP - T_J_SHUTDOWN)

◆ GDDR_THERM_TRIP_DMC_NOTIFY_MS

#define GDDR_THERM_TRIP_DMC_NOTIFY_MS   50

◆ RESET_UNIT_CATMON_THERM_TRIP_CNTL_REG_ADDR

#define RESET_UNIT_CATMON_THERM_TRIP_CNTL_REG_ADDR   0x80030168

◆ RESET_UNIT_CATMON_THERM_TRIP_CNTL_REG_DEFAULT

#define RESET_UNIT_CATMON_THERM_TRIP_CNTL_REG_DEFAULT   0x00000318

◆ RESET_UNIT_CATMON_THERM_TRIP_STATUS_REG_ADDR

#define RESET_UNIT_CATMON_THERM_TRIP_STATUS_REG_ADDR   0x80030164

◆ TRIM_CODE_BITS

#define TRIM_CODE_BITS   6

Function Documentation

◆ CalibrateCAT()

float CalibrateCAT ( void )
static

◆ CATEarlyInit()

int CATEarlyInit ( void )
static

◆ CATInit()

int CATInit ( void )
static

◆ CatSetGddrThermTripEnabled()

uint8_t CatSetGddrThermTripEnabled ( bool enabled)

Enable or disable the GDDR thermal-trip action at runtime.

Parameters
enabledfalse to disable, true to enable.
Returns
0 on success.

◆ EnableCAT()

void EnableCAT ( uint8_t trim_code,
bool shutdown_on_trip )
static

◆ EvaluateGddrThermTrip()

int EvaluateGddrThermTrip ( int64_t now,
int max_temp,
int trip_temp,
int critical_temp,
int64_t duration_ms )

Evaluate the GDDR thermal-trip state machine for one sample against the supplied thresholds.

Production code uses the internal MonitorGddrThermTrip wrapper, which supplies the thresholds seeded from the firmware table at init.

Parameters
nowCurrent uptime in milliseconds.
max_tempHighest observed GDDR temperature in degrees Celsius.
trip_tempSustained over-temp threshold in degrees Celsius.
critical_tempInstantaneous (no-dwell) trip threshold in degrees Celsius.
duration_msSustained dwell time before tripping, in milliseconds.
Returns
The tripping temperature (non-zero) when a trip fires, otherwise 0.

◆ gddr_therm_trip_timer_handler()

void gddr_therm_trip_timer_handler ( struct k_timer * timer)
static

◆ gddr_therm_trip_trigger_handler()

void gddr_therm_trip_trigger_handler ( struct k_work * work)
static

◆ gddr_therm_trip_work_handler()

void gddr_therm_trip_work_handler ( struct k_work * work)
static

◆ K_TIMER_DEFINE()

K_TIMER_DEFINE ( gddr_therm_trip_timer ,
gddr_therm_trip_timer_handler ,
NULL  )
static

◆ K_WORK_DEFINE()

K_WORK_DEFINE ( gddr_therm_trip_worker ,
gddr_therm_trip_work_handler  )
static

◆ K_WORK_DELAYABLE_DEFINE()

K_WORK_DELAYABLE_DEFINE ( gddr_therm_trip_trigger_work ,
gddr_therm_trip_trigger_handler  )
static

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( cat )

◆ MonitorGddrThermTrip()

int MonitorGddrThermTrip ( int64_t now,
int max_temp )
static

◆ RTIO_DEFINE()

RTIO_DEFINE ( cat_ts_avg_ctx ,
1 ,
1  )

◆ SENSOR_DT_READ_IODEV()

SENSOR_DT_READ_IODEV ( cat_ts_avg_iodev ,
DT_NODELABEL(pvt) ,
{SENSOR_CHAN_PVT_TT_BH_TS_AVG, 0}  )

◆ StartGddrThermTripMonitor()

int StartGddrThermTripMonitor ( void )

◆ SYS_INIT_APP() [1/3]

SYS_INIT_APP ( CATEarlyInit )

◆ SYS_INIT_APP() [2/3]

SYS_INIT_APP ( CATInit )

◆ SYS_INIT_APP() [3/3]

SYS_INIT_APP ( StartGddrThermTripMonitor )

◆ TempToTrimCode()

uint8_t TempToTrimCode ( float temp)
static

◆ TriggerThermTrip()

void TriggerThermTrip ( void )
static

◆ TrimCodeToTemp()

float TrimCodeToTemp ( int32_t trim_code)
static

◆ WaitCATUpdate()

void WaitCATUpdate ( void )
static

Variable Documentation

◆ cat_ts_avg_buf

uint8_t cat_ts_avg_buf[sizeof(struct pvt_tt_bh_rtio_data)]
static

◆ fwtable_dev

const struct device* const fwtable_dev = DEVICE_DT_GET(DT_NODELABEL(fwtable))
static

◆ gddr_therm_trip_critical_temp

int gddr_therm_trip_critical_temp
static

◆ gddr_therm_trip_duration_ms

int64_t gddr_therm_trip_duration_ms
static

◆ gddr_therm_trip_interval

const int gddr_therm_trip_interval = 100
static

◆ gddr_therm_trip_temp

int gddr_therm_trip_temp
static

◆ gpio1

const struct device* gpio1 = DEVICE_DT_GET_OR_NULL(DT_NODELABEL(gpio1))
static

◆ pvt

const struct device* const pvt = DEVICE_DT_GET(DT_NODELABEL(pvt))
static