7#ifndef TENSTORRENT_MSGQUEUE_H_
8#define TENSTORRENT_MSGQUEUE_H_
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
20#define MSG_TYPE_INDEX 0
21#define MSG_TYPE_MASK 0xFF
22#define MSG_TYPE_SHIFT 0
24#define MESSAGE_QUEUE_STATUS_MESSAGE_RECOGNIZED 0xff
25#define MESSAGE_QUEUE_STATUS_SCRATCH_ONLY 0xfe
264#define REGISTER_MESSAGE(msg, func) \
265 const STRUCT_SECTION_ITERABLE(msgqueue_handler, registration_for_##msg) = { \
void process_message_queues(void)
Definition msgqueue.c:335
uint8_t(* msgqueue_request_handler_t)(const union request *req, struct response *rsp)
Definition msgqueue.h:257
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:439
void msgqueue_register_handler(uint32_t msg_code, msgqueue_request_handler_t handler)
Definition msgqueue.c:345
#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
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 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:188
uint8_t command_code
The command code corresponding to TT_SMC_MSG_GET_FREQ_CURVE_FROM_VOLTAGE.
Definition msgqueue.h:190
uint32_t input_voltage_mv
The input voltage in mV.
Definition msgqueue.h:196
uint8_t pad[3]
Three bytes of padding.
Definition msgqueue.h:193
Host request to get voltage curve from frequency.
Definition msgqueue.h:202
uint8_t command_code
The command code corresponding to TT_SMC_MSG_GET_VOLTAGE_CURVE_FROM_FREQ.
Definition msgqueue.h:204
uint8_t pad[3]
Three bytes of padding.
Definition msgqueue.h:207
uint32_t input_freq_mhz
The input frequency in MHz.
Definition msgqueue.h:210
Host request to get voltage.
Definition msgqueue.h:146
uint8_t command_code
The command code corresponding to TT_SMC_MSG_GET_VOLTAGE.
Definition msgqueue.h:148
uint8_t pad[3]
Three bytes of padding.
Definition msgqueue.h:151
uint32_t slave_addr
I2C slave address (P0V8_VCORE_ADDR or P0V8_VCOREM_ADDR)
Definition msgqueue.h:154
Definition msgqueue.h:259
msgqueue_request_handler_t handler
Definition msgqueue.h:261
uint32_t msg_type
Definition msgqueue.h:260
Host request to adjust the power settings.
Definition msgqueue.h:86
uint16_t reserved
Reserved.
Definition msgqueue.h:117
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:114
uint8_t power_settings_valid
The number of fields that are valid in the power_settings_array.
Definition msgqueue.h:94
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:253
uint32_t data[8]
Definition msgqueue.h:254
Host request to set voltage.
Definition msgqueue.h:129
uint32_t slave_addr
I2C slave address (P0V8_VCORE_ADDR or P0V8_VCOREM_ADDR)
Definition msgqueue.h:137
uint32_t voltage_in_mv
Voltage to set in millivolts.
Definition msgqueue.h:140
uint8_t pad[3]
Three bytes of padding.
Definition msgqueue.h:134
uint8_t command_code
The command code corresponding to TT_SMC_MSG_SET_VOLTAGE.
Definition msgqueue.h:131
Host request to switch clock scheme.
Definition msgqueue.h:174
uint8_t command_code
The command code corresponding to TT_SMC_MSG_SWITCH_CLK_SCHEME.
Definition msgqueue.h:176
uint32_t scheme
Clock scheme to switch to
Definition msgqueue.h:182
uint8_t pad[3]
Three bytes of padding.
Definition msgqueue.h:179
Host request to switch VOUT control.
Definition msgqueue.h:160
uint8_t pad[3]
Three bytes of padding.
Definition msgqueue.h:165
uint32_t source
VOUT control source.
Definition msgqueue.h:168
uint8_t command_code
The command code corresponding to TT_SMC_MSG_SWITCH_VOUT_CONTROL.
Definition msgqueue.h:162
A tenstorrent host request.
Definition msgqueue.h:214
struct get_freq_curve_from_voltage_rqst get_freq_curve_from_voltage
A get frequency curve from voltage request.
Definition msgqueue.h:245
struct set_voltage_rqst set_voltage
A set voltage request.
Definition msgqueue.h:233
struct get_voltage_rqst get_voltage
A get voltage request.
Definition msgqueue.h:236
struct get_voltage_curve_from_freq_rqst get_voltage_curve_from_freq
A get voltage curve from frequency request.
Definition msgqueue.h:248
struct switch_clk_scheme_rqst switch_clk_scheme
A switch clock scheme request.
Definition msgqueue.h:242
struct force_fan_speed_rqst force_fan_speed
A force fan speed request.
Definition msgqueue.h:224
uint32_t data[8]
The interpretation of the request as an array of uint32_t entries.
Definition msgqueue.h:216
struct switch_vout_control_rqst switch_vout_control
A switch VOUT control request.
Definition msgqueue.h:239
struct aiclk_set_speed_rqst aiclk_set_speed
An AICLK set speed request.
Definition msgqueue.h:227
uint8_t command_code
The interpretation of the request as just the first byte representing command code.
Definition msgqueue.h:221
struct power_setting_rqst power_setting
A power setting request.
Definition msgqueue.h:230