TT Zephyr Platforms 19.5.0-rc1
Tenstorrent Firmware
Loading...
Searching...
No Matches
msgqueue.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 Tenstorrent AI ULC
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef TENSTORRENT_MSGQUEUE_H_
8#define TENSTORRENT_MSGQUEUE_H_
9
10#include <stdint.h>
11
13
14#define NUM_MSG_QUEUES 4
15#define MSG_QUEUE_SIZE 4
16#define MSG_QUEUE_POINTER_WRAP (2 * MSG_QUEUE_SIZE)
17#define REQUEST_MSG_LEN 8
18#define RESPONSE_MSG_LEN 8
19
20#define MSG_TYPE_INDEX 0
21#define MSG_TYPE_MASK 0xFF
22#define MSG_TYPE_SHIFT 0
23
24#define MESSAGE_QUEUE_STATUS_MESSAGE_RECOGNIZED 0xff
25#define MESSAGE_QUEUE_STATUS_SCRATCH_ONLY 0xfe
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
44
57
69
82
130
147
161
175
189
203
217
248
262
279
305
319
333
345
404
406
410
411typedef uint8_t (*msgqueue_request_handler_t)(const union request *req, struct response *rsp);
412
417
418#define REGISTER_MESSAGE(msg, func) \
419 const STRUCT_SECTION_ITERABLE(msgqueue_handler, registration_for_##msg) = { \
420 .msg_type = msg, \
421 .handler = func, \
422 }
423
424void process_message_queues(void);
426
427int msgqueue_request_push(uint32_t msgqueue_id, const union request *request);
428int msgqueue_request_pop(uint32_t msgqueue_id, union request *request);
429int msgqueue_response_push(uint32_t msgqueue_id, const struct response *response);
430int msgqueue_response_pop(uint32_t msgqueue_id, struct response *response);
431void init_msgqueue(void);
432
433#ifdef __cplusplus
434}
435#endif
436
437#endif
void process_message_queues(void)
Definition msgqueue.c:340
uint8_t(* msgqueue_request_handler_t)(const union request *req, struct response *rsp)
Definition msgqueue.h:411
int msgqueue_request_push(uint32_t msgqueue_id, const union request *request)
Definition msgqueue.c:124
int msgqueue_response_push(uint32_t msgqueue_id, const struct response *response)
Definition msgqueue.c:164
int msgqueue_request_pop(uint32_t msgqueue_id, union request *request)
Definition msgqueue.c:144
void init_msgqueue(void)
Definition msgqueue.c:444
void msgqueue_register_handler(uint32_t msg_code, msgqueue_request_handler_t handler)
Definition msgqueue.c:350
#define REQUEST_MSG_LEN
Definition msgqueue.h:17
int msgqueue_response_pop(uint32_t msgqueue_id, struct response *response)
Definition msgqueue.c:184
#define RESPONSE_MSG_LEN
Definition msgqueue.h:18
__UINT32_TYPE__ uint32_t
__UINT8_TYPE__ uint8_t
__UINT16_TYPE__ uint16_t
Host request to adjust the AICLK speed.
Definition msgqueue.h:73
uint8_t pad[3]
Three bytes of padding.
Definition msgqueue.h:80
uint8_t command_code
The command code corresponding to TT_SMC_MSG_AICLK_GO_BUSY or TT_SMC_MSG_AICLK_GO_LONG_IDLE.
Definition msgqueue.h:77
Host request to change ASIC state.
Definition msgqueue.h:337
uint8_t command_code
The command code corresponding to TT_SMC_MSG_ASIC_STATE0 or TT_SMC_MSG_ASIC_STATE3.
Definition msgqueue.h:343
Host request for debug NOC translation.
Definition msgqueue.h:221
uint8_t pcie_instance_override
Set to 1 to use pcie instance from the pcie_instance field, or 0 to get the pcie instance from FW tab...
Definition msgqueue.h:234
uint16_t bad_tensix_cols
Bitmask of bad tensix columns.
Definition msgqueue.h:237
uint8_t skip_eth_hi
hi byte of skip_eth field
Definition msgqueue.h:246
uint8_t enable_translation
Enable or disable NOC translation.
Definition msgqueue.h:226
uint8_t command_code
The command code corresponding to TT_SMC_MSG_DEBUG_NOC_TRANSLATION.
Definition msgqueue.h:223
uint8_t bad_gddr
Instance number of the bad GDDR. 0xFF if all GDDR are good.
Definition msgqueue.h:240
uint8_t pcie_instance
The PCIE instance.
Definition msgqueue.h:229
uint8_t skip_eth_low
low byte of skip_eth field
Definition msgqueue.h:243
Host request to ping DMC.
Definition msgqueue.h:252
uint8_t command_code
The command code corresponding to TT_SMC_MSG_PING_DM.
Definition msgqueue.h:254
uint8_t pad[3]
Three bytes of padding.
Definition msgqueue.h:257
bool legacy_ping
Use legacy ping mode.
Definition msgqueue.h:260
Host request to force the fan speed.
Definition msgqueue.h:59
uint8_t pad[3]
Three bytes of padding.
Definition msgqueue.h:64
uint8_t command_code
The command code corresponding to TT_SMC_MSG_FORCE_FAN_SPEED.
Definition msgqueue.h:61
uint32_t raw_speed
The raw speed of the fan to set, as a percentage from 0 to 100.
Definition msgqueue.h:67
Host request to get frequency curve from voltage.
Definition msgqueue.h:193
uint8_t command_code
The command code corresponding to TT_SMC_MSG_GET_FREQ_CURVE_FROM_VOLTAGE.
Definition msgqueue.h:195
uint32_t input_voltage_mv
The input voltage in mV.
Definition msgqueue.h:201
uint8_t pad[3]
Three bytes of padding.
Definition msgqueue.h:198
Host request to get voltage curve from frequency.
Definition msgqueue.h:207
uint8_t command_code
The command code corresponding to TT_SMC_MSG_GET_VOLTAGE_CURVE_FROM_FREQ.
Definition msgqueue.h:209
uint8_t pad[3]
Three bytes of padding.
Definition msgqueue.h:212
uint32_t input_freq_mhz
The input frequency in MHz.
Definition msgqueue.h:215
Host request to get voltage.
Definition msgqueue.h:151
uint8_t command_code
The command code corresponding to TT_SMC_MSG_GET_VOLTAGE.
Definition msgqueue.h:153
uint8_t pad[3]
Three bytes of padding.
Definition msgqueue.h:156
uint32_t slave_addr
I2C slave address (P0V8_VCORE_ADDR or P0V8_VCOREM_ADDR)
Definition msgqueue.h:159
Host request for I2C message transaction.
Definition msgqueue.h:283
uint8_t num_read_bytes
Number of bytes to read.
Definition msgqueue.h:297
uint8_t write_data[24]
Write data buffer (up to 24 bytes)
Definition msgqueue.h:303
uint8_t i2c_mst_id
I2C master ID.
Definition msgqueue.h:288
uint8_t i2c_slave_address
I2C slave address (7-bit)
Definition msgqueue.h:291
uint8_t num_write_bytes
Number of bytes to write.
Definition msgqueue.h:294
uint8_t command_code
The command code corresponding to TT_SMC_MSG_I2C_MESSAGE.
Definition msgqueue.h:285
uint8_t pad[3]
Three bytes of padding.
Definition msgqueue.h:300
Definition msgqueue.h:31
uint32_t response_queue_wptr
Definition msgqueue.h:40
uint32_t request_queue_rptr
Definition msgqueue.h:39
uint32_t last_serial
Definition msgqueue.h:41
uint32_t unused_2
Definition msgqueue.h:36
uint32_t unused_1
Definition msgqueue.h:35
uint32_t unused_3
Definition msgqueue.h:42
uint32_t request_queue_wptr
Definition msgqueue.h:33
uint32_t response_queue_rptr
Definition msgqueue.h:34
Definition msgqueue.h:413
msgqueue_request_handler_t handler
Definition msgqueue.h:415
uint32_t msg_type
Definition msgqueue.h:414
Host request to adjust the power settings.
Definition msgqueue.h:86
uint16_t reserved
Reserved.
Definition msgqueue.h:122
struct power_setting_rqst::@364260271035044055320364336346370330326342300150 power_settings_array
uint8_t power_flags_valid
The number of bits in the power_flags_bitfield that are valid.
Definition msgqueue.h:91
uint16_t future_use
Future use flags currently not supported.
Definition msgqueue.h:119
uint8_t power_settings_valid
The number of fields that are valid in the power_settings_array.
Definition msgqueue.h:94
uint16_t l2cpu_enable
1 - Enable L2CPU cores 0 - Disable L2CPU cores
Definition msgqueue.h:116
uint8_t command_code
The command code corresponding to TT_SMC_MSG_POWER_SETTING.
Definition msgqueue.h:88
uint16_t tensix_enable
1 - Enable Tensix cores 0 - Disable Tensix cores
Definition msgqueue.h:111
struct power_setting_rqst::@140120167246117267343245340300140063053015126121 power_flags_bitfield
The list of On/Off style power flags SMC supports toggling.
uint16_t mrisc_phy_power
1 - Set MRISC power setting to Phy wakeup 0 - Set MRISC power setting to Phy Powerdown
Definition msgqueue.h:106
uint16_t max_ai_clk
1 - Set AICLK to Busy 0 - Set AICLK to Idle
Definition msgqueue.h:101
Definition msgqueue.h:407
uint32_t data[8]
Definition msgqueue.h:408
Host request to send PCIE MSI.
Definition msgqueue.h:266
uint8_t pad[2]
2 bytes of padding
Definition msgqueue.h:274
uint8_t command_code
The command code corresponding to TT_SMC_MSG_SEND_PCIE_MSI.
Definition msgqueue.h:268
uint8_t pcie_inst
The PCIE instance 0 or 1.
Definition msgqueue.h:271
uint32_t vector_id
MSI vector ID.
Definition msgqueue.h:277
Host request to set voltage.
Definition msgqueue.h:134
uint32_t slave_addr
I2C slave address (P0V8_VCORE_ADDR or P0V8_VCOREM_ADDR)
Definition msgqueue.h:142
uint32_t voltage_in_mv
Voltage to set in millivolts.
Definition msgqueue.h:145
uint8_t pad[3]
Three bytes of padding.
Definition msgqueue.h:139
uint8_t command_code
The command code corresponding to TT_SMC_MSG_SET_VOLTAGE.
Definition msgqueue.h:136
Host request to switch clock scheme.
Definition msgqueue.h:179
uint8_t command_code
The command code corresponding to TT_SMC_MSG_SWITCH_CLK_SCHEME.
Definition msgqueue.h:181
uint32_t scheme
Clock scheme to switch to
Definition msgqueue.h:187
uint8_t pad[3]
Three bytes of padding.
Definition msgqueue.h:184
Host request to switch VOUT control.
Definition msgqueue.h:165
uint8_t pad[3]
Three bytes of padding.
Definition msgqueue.h:170
uint32_t source
VOUT control source.
Definition msgqueue.h:173
uint8_t command_code
The command code corresponding to TT_SMC_MSG_SWITCH_VOUT_CONTROL.
Definition msgqueue.h:167
Host request for test message.
Definition msgqueue.h:323
uint32_t test_value
Test input value that will be incremented in the response.
Definition msgqueue.h:331
uint8_t pad[3]
Three bytes of padding.
Definition msgqueue.h:328
uint8_t command_code
The command code corresponding to TT_SMC_MSG_TEST.
Definition msgqueue.h:325
A tenstorrent host request.
Definition msgqueue.h:347
struct get_freq_curve_from_voltage_rqst get_freq_curve_from_voltage
A get frequency curve from voltage request.
Definition msgqueue.h:378
struct set_voltage_rqst set_voltage
A set voltage request.
Definition msgqueue.h:366
struct test_rqst test
A test request.
Definition msgqueue.h:399
struct dmc_ping_rqst dmc_ping
A dmc ping request.
Definition msgqueue.h:387
struct get_voltage_rqst get_voltage
A get voltage request.
Definition msgqueue.h:369
struct get_voltage_curve_from_freq_rqst get_voltage_curve_from_freq
A get voltage curve from frequency request.
Definition msgqueue.h:381
struct asic_state_rqst asic_state
An ASIC state transition request.
Definition msgqueue.h:402
struct switch_clk_scheme_rqst switch_clk_scheme
A switch clock scheme request.
Definition msgqueue.h:375
struct force_fan_speed_rqst force_fan_speed
A force fan speed request.
Definition msgqueue.h:357
uint32_t data[8]
The interpretation of the request as an array of uint32_t entries.
Definition msgqueue.h:349
struct switch_vout_control_rqst switch_vout_control
A switch VOUT control request.
Definition msgqueue.h:372
struct i2c_message_rqst i2c_message
An I2C message request.
Definition msgqueue.h:393
struct aiclk_set_speed_rqst aiclk_set_speed
An AICLK set speed request.
Definition msgqueue.h:360
uint8_t command_code
The interpretation of the request as just the first byte representing command code.
Definition msgqueue.h:354
struct debug_noc_translation_rqst debug_noc_translation
A debug NOC translation request.
Definition msgqueue.h:384
struct power_setting_rqst power_setting
A power setting request.
Definition msgqueue.h:363
struct led_blink_rqst blink
The led blinking request.
Definition msgqueue.h:396
struct send_pcie_msi_rqst send_pci_msi
A Send PCIE MSI request.
Definition msgqueue.h:390