![]() |
TT-System-Firmware APIs 19.13.99
Tenstorrent Firmware
|
#include <zephyr/kernel.h>#include <zephyr/logging/log.h>#include <zephyr/logging/log_backend.h>#include <zephyr/logging/log_output.h>#include <zephyr/logging/log_ctrl.h>#include <zephyr/logging/log_msg.h>#include <string.h>#include <tenstorrent/smc_msg.h>#include <tenstorrent/msgqueue.h>#include <zephyr/logging/log_backend_std.h>#include "chip_info.h"#include "noc2axi.h"
Data Structures | |
| struct | fw_log_entry_header |
| struct | fw_log_buffer_header |
Macros | |
| #define | TT_PCIE_LOG_SUBCMD_SETUP 1 |
| #define | TT_PCIE_LOG_SUBCMD_RELEASE 2 |
| #define | FW_LOG_SOURCE_SMC 0 |
| #define | FW_LOG_SOURCE_DMC 1 |
| #define | FW_LOG_BUFFER_MAGIC 0x544C4F47 /* "TLOG" */ |
| #define | FW_LOG_BUFFER_OWNER_FW 0x0 /* Firmware owns buffer, host has consumed */ |
| #define | FW_LOG_BUFFER_OWNER_HOST 0x1 /* Host owns buffer, firmware has produced data */ |
| #define | FLUSH_THRESHOLD_BYTES (sizeof(struct fw_log_entry_header) + 256) |
| #define | TT_PCIE_LOG_TLB 11 |
| #define | PCIE_X 19 |
| #define | PCIE_Y 24 |
Functions | |
| void | SendPcieMsi (uint8_t x, uint8_t y, uint32_t vector_id) |
| LOG_MODULE_REGISTER (fw_tt_pcie_log_backend, CONFIG_LOG_DEFAULT_LEVEL) | |
| static void | flush_buffer_to_host (void) |
| Flush accumulated framed messages to host. | |
| static void | flush_work_handler (struct k_work *work) |
| Work handler to flush framed buffer to host. | |
| static void | flush_timer_callback (struct k_timer *timer) |
| Timer callback to submit flush work. | |
| static uint8_t | setup_tt_pcie_log_backend (uint32_t buffer_addr_lo, uint32_t buffer_addr_hi, uint32_t buffer_size, uint8_t host_version) |
| Setup host tt_pcie_log by configuring NOC2AXI TLB and transferring local buffer. | |
| static uint8_t | release_tt_pcie_log_backend (void) |
| Release host tt_pcie_log and revert to local buffer only. | |
| static int | putc_in_frame (uint8_t *data, size_t length, void *ctx) |
| Character output function for Zephyr log formatting - writes directly to 4KB buffer. | |
| LOG_OUTPUT_DEFINE (log_output_tt_pcie, putc_in_frame, buf, 1) | |
| static void | backend_process (const struct log_backend *const backend, union log_msg_generic *msg) |
| Zephyr log backend process function - called for each individual log message. | |
| static void | backend_panic (const struct log_backend *const backend) |
| Zephyr log backend panic function - called when system panics. | |
| static void | backend_dropped (const struct log_backend *const backend, uint32_t cnt) |
| Zephyr log backend dropped function - called when messages are dropped. | |
| static void | backend_init (const struct log_backend *const backend) |
| Initialize the Zephyr log backend. | |
| static uint8_t | tt_pcie_log_handler (const union request *request, struct response *response) |
| Handles the request to setup or release FW tt_pcie_log. | |
| REGISTER_MESSAGE (TT_SMC_MSG_TT_PCIE_LOG, tt_pcie_log_handler) | |
| LOG_BACKEND_DEFINE (backend_tt_pcie_log, backend_api, true) | |
Variables | |
| struct fw_log_entry_header | __packed |
| static bool | host_available |
| static uint64_t | log_buffer_iova |
| static uint32_t | log_buffer_size |
| static uint32_t | sequence_number |
| static uint8_t | framed_log_buffer [CONFIG_TT_PCIE_LOG_BACKEND_BUFFER_SIZE] |
| static uint32_t | framed_buffer_pos |
| static struct k_timer | flush_timer |
| static struct k_work | flush_work |
| static struct k_mutex | buffer_mutex |
| static char | buf [1] |
| static struct log_backend_api | backend_api |
| #define FLUSH_THRESHOLD_BYTES (sizeof(struct fw_log_entry_header) + 256) |
| #define FW_LOG_BUFFER_MAGIC 0x544C4F47 /* "TLOG" */ |
| #define FW_LOG_BUFFER_OWNER_FW 0x0 /* Firmware owns buffer, host has consumed */ |
| #define FW_LOG_BUFFER_OWNER_HOST 0x1 /* Host owns buffer, firmware has produced data */ |
| #define FW_LOG_SOURCE_DMC 1 |
| #define FW_LOG_SOURCE_SMC 0 |
| #define PCIE_X 19 |
| #define PCIE_Y 24 |
| #define TT_PCIE_LOG_SUBCMD_RELEASE 2 |
| #define TT_PCIE_LOG_SUBCMD_SETUP 1 |
| #define TT_PCIE_LOG_TLB 11 |
|
static |
Zephyr log backend dropped function - called when messages are dropped.
| backend | The backend instance |
| cnt | Number of dropped messages |
|
static |
Initialize the Zephyr log backend.
| backend | The backend instance |
|
static |
Zephyr log backend panic function - called when system panics.
| backend | The backend instance |
|
static |
Zephyr log backend process function - called for each individual log message.
| backend | The backend instance |
| msg | The log message to process |
|
static |
Flush accumulated framed messages to host.
|
static |
Timer callback to submit flush work.
| timer | Timer object (unused) |
|
static |
Work handler to flush framed buffer to host.
| work | Work item (unused) |
| LOG_BACKEND_DEFINE | ( | backend_tt_pcie_log | , |
| backend_api | , | ||
| true | ) |
| LOG_MODULE_REGISTER | ( | fw_tt_pcie_log_backend | , |
| CONFIG_LOG_DEFAULT_LEVEL | ) |
| LOG_OUTPUT_DEFINE | ( | log_output_tt_pcie | , |
| putc_in_frame | , | ||
| buf | , | ||
| 1 | ) |
|
static |
Character output function for Zephyr log formatting - writes directly to 4KB buffer.
| data | Data to append to framed log buffer |
| length | Length of data |
| ctx | Context (unused) |
| REGISTER_MESSAGE | ( | TT_SMC_MSG_TT_PCIE_LOG | , |
| tt_pcie_log_handler | ) |
|
static |
Release host tt_pcie_log and revert to local buffer only.
|
static |
Setup host tt_pcie_log by configuring NOC2AXI TLB and transferring local buffer.
| buffer_addr_lo | Lower 32 bits of host buffer IOVA |
| buffer_addr_hi | Upper 32 bits of host buffer IOVA |
| buffer_size | Size of buffer in bytes |
| host_version | Host version for tt_pcie_log protocol |
Handles the request to setup or release FW tt_pcie_log.
| [in] | request | The request, of type tt_pcie_log_rqst, with command code TT_SMC_MSG_TT_PCIE_LOG |
| [out] | response | The response to the host |
| struct occp_execute_image_response __packed |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |