TT-System-Firmware APIs 19.8.99
Tenstorrent Firmware
Loading...
Searching...
No Matches
occp.c File Reference

Open Chiplet Configuration Protocol (OCCP) implementation. More...

#include <tenstorrent/occp.h>
#include "occp_private.h"
#include <zephyr/sys/crc.h>
#include <zephyr/logging/log.h>

Functions

 LOG_MODULE_REGISTER (occp, CONFIG_OCCP_LOG_LEVEL)
static void fill_cmd_header (uint8_t app_id, uint8_t msg_id, uint16_t length, struct occp_header *hdr)
int occp_get_version (const struct occp_backend *backend, uint8_t *major, uint8_t *minor, uint8_t *patch)
 Get OCCP protocol version.
static int occp_tx_rx (const struct occp_backend *backend, uint8_t *cmd, size_t cmd_len, uint8_t *response, size_t response_len)
static int occp_run_transaction (const struct occp_backend *backend, uint8_t retry_cnt, uint8_t *cmd, size_t cmd_len, uint8_t *response, size_t response_len)
 Run an OCCP transaction (send command and read response) Sends an OCCP command, and reads the response. Checks response flags for errors and retries if necessary.
int occp_write_data (const struct occp_backend *backend, uint64_t address, const uint8_t *data, size_t length)
 Write data to OCCP device.
int occp_read_data (const struct occp_backend *backend, uint64_t address, uint8_t *data, size_t length)
 Read data from OCCP device.
int occp_execute_image (const struct occp_backend *backend, uint64_t execution_address, uint8_t cpu_id)
 Execute image at specified address.

Variables

uint8_t occp_rw_buffer [255]

Detailed Description

Open Chiplet Configuration Protocol (OCCP) implementation.

OCCP is a protocol used to communicate with chiplets during early boot. It can support multiple transport layers, implemented as backends within this subsystem.

Function Documentation

◆ fill_cmd_header()

void fill_cmd_header ( uint8_t app_id,
uint8_t msg_id,
uint16_t length,
struct occp_header * hdr )
static

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( occp ,
CONFIG_OCCP_LOG_LEVEL  )

◆ occp_execute_image()

int occp_execute_image ( const struct occp_backend * backend,
uint64_t execution_address,
uint8_t cpu_id )

Execute image at specified address.

Parameters
backendOCCP backend to use
execution_addressAddress to execute image from
cpu_idCPU ID to execute on
Returns
0 on success, negative error code on failure

◆ occp_get_version()

int occp_get_version ( const struct occp_backend * backend,
uint8_t * major,
uint8_t * minor,
uint8_t * patch )

Get OCCP protocol version.

Parameters
backendOCCP backend to use
majorPointer to store major version
minorPointer to store minor version
patchPointer to store patch version
Returns
0 on success, negative error code on failure

◆ occp_read_data()

int occp_read_data ( const struct occp_backend * backend,
uint64_t address,
uint8_t * data,
size_t length )

Read data from OCCP device.

Parameters
backendOCCP backend to use
addressAddress to read from
dataPointer to buffer to store read data
lengthLength of data to read
Returns
0 on success, negative error code on failure

◆ occp_run_transaction()

int occp_run_transaction ( const struct occp_backend * backend,
uint8_t retry_cnt,
uint8_t * cmd,
size_t cmd_len,
uint8_t * response,
size_t response_len )
static

Run an OCCP transaction (send command and read response) Sends an OCCP command, and reads the response. Checks response flags for errors and retries if necessary.

Parameters
backendOCCP backend to use
retry_cntNumber of times to retry on failure
cmdPointer to command structure to send
cmd_lenLength of command structure
responsePointer to response structure to receive
response_lenLength of response structure
Returns
0 on success, negative error code on failure

◆ occp_tx_rx()

int occp_tx_rx ( const struct occp_backend * backend,
uint8_t * cmd,
size_t cmd_len,
uint8_t * response,
size_t response_len )
static

◆ occp_write_data()

int occp_write_data ( const struct occp_backend * backend,
uint64_t address,
const uint8_t * data,
size_t length )

Write data to OCCP device.

Parameters
backendOCCP backend to use
addressAddress to write to
dataPointer to data to write
lengthLength of data to write
Returns
0 on success, negative error code on failure

Variable Documentation

◆ occp_rw_buffer

uint8_t occp_rw_buffer[255]