![]() |
TT-System-Firmware APIs 19.15.99
Tenstorrent Firmware
|
#include <stdbool.h>#include <stdint.h>#include <string.h>#include <stdatomic.h>#include <zephyr/devicetree.h>#include <zephyr/init.h>#include <zephyr/kernel.h>#include <tenstorrent/msgqueue.h>#include <tenstorrent/smc_msg.h>#include <tenstorrent/post_code.h>#include <tenstorrent/sys_init_defines.h>#include "reg.h"
Data Structures |
Macros | |
| #define | MSGQUEUE_INFO_NODE DT_NODELABEL(msgqueue_info) |
| #define | STATUS_MSG_Q_INFO_REG_ADDR (uintptr_t)DT_REG_ADDR(MSGQUEUE_INFO_NODE) |
| #define | MSGQUEUE_HAS_IRQS DT_HAS_COMPAT_STATUS_OKAY(tenstorrent_msgqueue_irqs) |
| #define | MSGQUEUE_HAS_MBOX DT_HAS_COMPAT_STATUS_OKAY(tenstorrent_msgqueue_mbox) |
| #define | MSGQUEUE_MBOX_NODE DT_NODELABEL(msgqueue_mbox) |
| #define | MSGHANDLER_COMPAT_MASK 0x1 |
| #define | MSG_ERROR_REPLY 0xff |
Functions | |
| BUILD_ASSERT (sizeof(union request)<=(sizeof(uint32_t) *REQUEST_MSG_LEN)) | |
| BUILD_ASSERT (DT_NODE_HAS_STATUS(DT_NODELABEL(msgqueue_info), okay), "TT_MSGQUEUE requires msgqueue_info status okay") | |
| BUILD_ASSERT (!(DT_HAS_COMPAT_STATUS_OKAY(tenstorrent_msgqueue_mbox) &&DT_HAS_COMPAT_STATUS_OKAY(tenstorrent_msgqueue_irqs)), "msgqueue_mbox and msgqueue_irqs are mutually exclusive") | |
| __attribute__ ((used)) | |
| static void * | unmask_voidp (void *x, uintptr_t mask) |
| static union request * | request_entry (struct message_queue *queue, uint32_t ptr) |
| static struct response * | response_entry (struct message_queue *queue, uint32_t ptr) |
| int | msgqueue_request_push (uint32_t msgqueue_id, const union request *request) |
| int | msgqueue_request_pop (uint32_t msgqueue_id, union request *request) |
| int | msgqueue_response_push (uint32_t msgqueue_id, const struct response *response) |
| int | msgqueue_response_pop (uint32_t msgqueue_id, struct response *response) |
| static bool | start_next_message (struct message_queue *queue, uint32_t *request_rptr_out, uint32_t *response_wptr_out) |
| static bool | command_writes_serial (const union request *request) |
| static void | advance_serial (struct message_queue *queue, const union request *request) |
| static void | process_l2_message_queue (const union request *request, struct response *response) |
| static void | handle_set_last_serial (struct message_queue *queue, const union request *request) |
| Handler for host request to set the message queue serial number. | |
| static void | handle_test (struct message_queue *queue, const union request *request, struct response *response) |
| Handles the test message request. | |
| static void | report_scratch_only_message (struct response *response) |
| Handler for TT_SMC_MSG_REPORT_SCRATCH_ONLY. | |
| static void | process_queued_message (struct message_queue *queue, const union request *request, struct response *response) |
| static void | process_message_queue (struct message_queue *queue) |
| void | process_message_queues (void) |
| void | msgqueue_register_handler (uint32_t msg_code, msgqueue_request_handler_t handler) |
| static void | prepare_msg_queue (void) |
| static int | register_interrupt_handlers (void) |
| SYS_INIT_APP (register_interrupt_handlers) | |
| int | init_msgqueue (void) |
| SYS_INIT_APP (init_msgqueue) | |
Variables | |
| static struct message_queue | message_queues [NUM_MSG_QUEUES] |
| static void * | message_handlers [CONFIG_TT_MSGQUEUE_NUM_MSG_CODES] |
| #define MSG_ERROR_REPLY 0xff |
| #define MSGHANDLER_COMPAT_MASK 0x1 |
| #define MSGQUEUE_HAS_IRQS DT_HAS_COMPAT_STATUS_OKAY(tenstorrent_msgqueue_irqs) |
| #define MSGQUEUE_HAS_MBOX DT_HAS_COMPAT_STATUS_OKAY(tenstorrent_msgqueue_mbox) |
| #define MSGQUEUE_INFO_NODE DT_NODELABEL(msgqueue_info) |
| #define MSGQUEUE_MBOX_NODE DT_NODELABEL(msgqueue_mbox) |
| #define STATUS_MSG_Q_INFO_REG_ADDR (uintptr_t)DT_REG_ADDR(MSGQUEUE_INFO_NODE) |
| __attribute__ | ( | (used) | ) |
|
static |
| BUILD_ASSERT | ( | ! | DT_HAS_COMPAT_STATUS_OKAY(tenstorrent_msgqueue_mbox) &&DT_HAS_COMPAT_STATUS_OKAY(tenstorrent_msgqueue_irqs), |
| "msgqueue_mbox and msgqueue_irqs are mutually exclusive" | ) |
| BUILD_ASSERT | ( | DT_NODE_HAS_STATUS(DT_NODELABEL(msgqueue_info), okay) | , |
| "TT_MSGQUEUE requires msgqueue_info status okay" | ) |
| BUILD_ASSERT | ( | sizeof(union request)<=(sizeof(uint32_t) *REQUEST_MSG_LEN) | ) |
|
static |
Handler for host request to set the message queue serial number.
| [in] | queue | The message queue whose serial number will be updated |
| [in] | request | The request, of type set_last_serial_rqst, with command code TT_SMC_MSG_SET_LAST_SERIAL. The serial number is taken from data[1]. |
This function allows the host to manually set the serial number for message queue synchronization purposes, bypassing the normal auto-increment behavior.
|
static |
Handles the test message request.
| [in] | queue | The message queue processing this request |
| [in] | request | The request, of type test_rqst, with command code TT_SMC_MSG_TEST |
| [out] | response | The response to the host, containing the incremented test value and serial |
| int init_msgqueue | ( | void | ) |
| void msgqueue_register_handler | ( | uint32_t | msg_code, |
| msgqueue_request_handler_t | handler ) |
|
static |
|
static |
| void process_message_queues | ( | void | ) |
|
static |
|
static |
|
static |
Handler for TT_SMC_MSG_REPORT_SCRATCH_ONLY.
|
static |
|
static |
|
static |
| SYS_INIT_APP | ( | init_msgqueue | ) |
| SYS_INIT_APP | ( | register_interrupt_handlers | ) |
|
inlinestatic |
|
static |
|
static |