OpenBIC
OpenSource Bridge-IC
plat_athena_shell.c File Reference
#include <stdlib.h>
#include <shell/shell.h>
#include <string.h>
#include <limits.h>
#include <stdio.h>
#include "hal_i2c.h"
#include "plat_i2c.h"
#include "sideband_commands_athena_open.h"
Include dependency graph for plat_athena_shell.c:

Classes

struct  efuse_target_offsets_t
 
struct  vtmon_data
 VTMON data structure containing all monitoring values. More...
 
struct  temp_monitor_data
 Temperature monitoring data structure. More...
 
struct  hbm_temp_data
 HBM temperature data structure. More...
 
struct  efuse_data
 Efuse data structure containing all efuse information. More...
 

Macros

#define HBM0_DATA_OFFSET   BRCMLIB__MONITORING_DETAILS_HBM__0_THERMAL_HBM_SEL_TWO_REG__OFFSET
 
#define HBM1_DATA_OFFSET   BRCMLIB__MONITORING_DETAILS_HBM__1_THERMAL_HBM_SEL_TWO_REG__OFFSET
 
#define HBM2_DATA_OFFSET   BRCMLIB__MONITORING_DETAILS_HBM__2_THERMAL_HBM_SEL_TWO_REG__OFFSET
 
#define HBM3_DATA_OFFSET   BRCMLIB__MONITORING_DETAILS_HBM__3_THERMAL_HBM_SEL_TWO_REG__OFFSET
 
#define HBM4_DATA_OFFSET   BRCMLIB__MONITORING_DETAILS_HBM__4_THERMAL_HBM_SEL_TWO_REG__OFFSET
 
#define HBM5_DATA_OFFSET   BRCMLIB__MONITORING_DETAILS_HBM__5_THERMAL_HBM_SEL_TWO_REG__OFFSET
 
#define HBM_CHANNEL_DATA_SIZE   8
 
#define HBM_MAX_CHANNELS   16
 
#define HBM_MAX_HBMS   6
 
#define OWL_MAX_COUNT   2
 
#define VTMON_MAX_COUNT   2
 
#define HBM_TEMP_MAX_COUNT   6
 
#define EFUSE_MAX_TARGETS   3
 
#define CMD_STATUS_FLAGS_NOT_READY_OFFSET   BRCMLIB_SB_STATUS_FLAGS_W_OFF
 
#define CMD_STATUS_FLAGS_NOT_READY_BIT   6
 
#define TEMP_VAL_MIN   0x00
 
#define TEMP_VAL_MAX   0x7E
 
#define TEMP_VAL_OVER127   0x7F
 
#define TEMP_VAL_NO_DATA   0x80
 
#define TEMP_VAL_SENSOR_FAIL   0x81
 
#define TEMP_VAL_RESERVED_START   0x82
 
#define TEMP_VAL_RESERVED_END   0xC3
 
#define TEMP_VAL_BELOW_MINUS60   0xC4
 
#define TEMP_VAL_TWOS_COMPLEMENT   0xC5
 
#define TEMP_VAL_TWOS_COMPLEMENT_END   0xFF
 
#define MONITORING_DETAILS_BASE_OFFSET   0xD07C4000
 
#define ATHENA_NVME_MI_INDIRECT_ACCESS_SETTING_OFFSET   0xD3
 
#define ATHENA_INDIRECT_ACCESS_ALL_REGION   0xFF
 
#define ATHENA_INDIRECT_ACCESS_MONITORING_REGION   0x03
 
#define ATHENA_INDIRECT_ACCESS_SETTING_LENGTH   0x06
 
#define ATHENA_INDIRECT_ACCESS_SETTING_FLUSH_NO_INCR   0x10
 
#define ATHENA_INDIRECT_ACCESS_SETTING_PEC_BYTE   0xFF
 
#define ATHENA_I2C_BUS   I2C_BUS6
 
#define ATHENA_I2C_ADDR_WRITE   0x6A
 
#define ATHENA_I2C_ADDR_READ   0x6C
 
#define ATHENA_MAX_READ_LENGTH   0xFF
 

Functions

int read_efuse_data (int target_idx, struct efuse_data *efuse_data)
 Read efuse data from specified target. More...
 
void print_efuse_field (const struct shell *shell, const char *field_name, const void *raw_data, size_t size, char format_type, uint64_t value)
 Print efuse field with raw hex and interpreted value. More...
 
void print_efuse_data (const struct shell *shell, const char *target_name, const struct efuse_data *efuse_data)
 Print efuse data with formatted output. More...
 
void athena_read_cmd (const struct shell *shell, size_t argc, char **argv)
 
void athena_owl_vtmon_cmd (const struct shell *shell, size_t argc, char **argv)
 
void athena_temp_monitor_cmd (const struct shell *shell, size_t argc, char **argv)
 
void athena_hbm_temp_cmd (const struct shell *shell, size_t argc, char **argv)
 
void athena_boot_status_cmd (const struct shell *shell, size_t argc, char **argv)
 
void athena_efuse_cmd (const struct shell *shell, size_t argc, char **argv)
 
void athena_version_cmd (const struct shell *shell, size_t argc, char **argv)
 
void athena_current_temp_cmd (const struct shell *shell, size_t argc, char **argv)
 
void athena_max_asic_temp_cmd (const struct shell *shell, size_t argc, char **argv)
 
void athena_read_all_cmd (const struct shell *shell, size_t argc, char **argv)
 
void athena_help_cmd (const struct shell *shell, size_t argc, char **argv)
 Display help information for all Athena commands. More...
 
 SHELL_STATIC_SUBCMD_SET_CREATE (sub_athena_cmds, SHELL_CMD(read, NULL, "low-level read command", athena_read_cmd), SHELL_CMD(owl_vtmon, NULL, "read OWL VTMON data command", athena_owl_vtmon_cmd), SHELL_CMD(temp_monitor, NULL, "read temperature monitoring data", athena_temp_monitor_cmd), SHELL_CMD(hbm_temp, NULL, "read HBM temperature data", athena_hbm_temp_cmd), SHELL_CMD(boot_status, NULL, "check Athena boot status", athena_boot_status_cmd), SHELL_CMD(efuse, NULL, "read efuse data", athena_efuse_cmd), SHELL_CMD(version, NULL, "read Athena version data", athena_version_cmd), SHELL_CMD(current_temp, NULL, "read Athena current temperature", athena_current_temp_cmd), SHELL_CMD(max_asic_temp, NULL, "read Athena max ASIC temperature", athena_max_asic_temp_cmd), SHELL_CMD(read_all, NULL, "read all Athena system data", athena_read_all_cmd), SHELL_CMD(help, NULL, "display help information for Athena commands", athena_help_cmd), SHELL_SUBCMD_SET_END)
 
 SHELL_CMD_REGISTER (athena, &sub_athena_cmds, "athena low-level commands", NULL)
 

Macro Definition Documentation

◆ ATHENA_I2C_ADDR_READ

#define ATHENA_I2C_ADDR_READ   0x6C

◆ ATHENA_I2C_ADDR_WRITE

#define ATHENA_I2C_ADDR_WRITE   0x6A

◆ ATHENA_I2C_BUS

#define ATHENA_I2C_BUS   I2C_BUS6

◆ ATHENA_INDIRECT_ACCESS_ALL_REGION

#define ATHENA_INDIRECT_ACCESS_ALL_REGION   0xFF

◆ ATHENA_INDIRECT_ACCESS_MONITORING_REGION

#define ATHENA_INDIRECT_ACCESS_MONITORING_REGION   0x03

◆ ATHENA_INDIRECT_ACCESS_SETTING_FLUSH_NO_INCR

#define ATHENA_INDIRECT_ACCESS_SETTING_FLUSH_NO_INCR   0x10

◆ ATHENA_INDIRECT_ACCESS_SETTING_LENGTH

#define ATHENA_INDIRECT_ACCESS_SETTING_LENGTH   0x06

◆ ATHENA_INDIRECT_ACCESS_SETTING_PEC_BYTE

#define ATHENA_INDIRECT_ACCESS_SETTING_PEC_BYTE   0xFF

◆ ATHENA_MAX_READ_LENGTH

#define ATHENA_MAX_READ_LENGTH   0xFF

◆ ATHENA_NVME_MI_INDIRECT_ACCESS_SETTING_OFFSET

#define ATHENA_NVME_MI_INDIRECT_ACCESS_SETTING_OFFSET   0xD3

◆ CMD_STATUS_FLAGS_NOT_READY_BIT

#define CMD_STATUS_FLAGS_NOT_READY_BIT   6

◆ CMD_STATUS_FLAGS_NOT_READY_OFFSET

#define CMD_STATUS_FLAGS_NOT_READY_OFFSET   BRCMLIB_SB_STATUS_FLAGS_W_OFF

◆ EFUSE_MAX_TARGETS

#define EFUSE_MAX_TARGETS   3

◆ HBM0_DATA_OFFSET

◆ HBM1_DATA_OFFSET

◆ HBM2_DATA_OFFSET

◆ HBM3_DATA_OFFSET

◆ HBM4_DATA_OFFSET

◆ HBM5_DATA_OFFSET

◆ HBM_CHANNEL_DATA_SIZE

#define HBM_CHANNEL_DATA_SIZE   8

◆ HBM_MAX_CHANNELS

#define HBM_MAX_CHANNELS   16

◆ HBM_MAX_HBMS

#define HBM_MAX_HBMS   6

◆ HBM_TEMP_MAX_COUNT

#define HBM_TEMP_MAX_COUNT   6

◆ MONITORING_DETAILS_BASE_OFFSET

#define MONITORING_DETAILS_BASE_OFFSET   0xD07C4000

◆ OWL_MAX_COUNT

#define OWL_MAX_COUNT   2

◆ TEMP_VAL_BELOW_MINUS60

#define TEMP_VAL_BELOW_MINUS60   0xC4

◆ TEMP_VAL_MAX

#define TEMP_VAL_MAX   0x7E

◆ TEMP_VAL_MIN

#define TEMP_VAL_MIN   0x00

◆ TEMP_VAL_NO_DATA

#define TEMP_VAL_NO_DATA   0x80

◆ TEMP_VAL_OVER127

#define TEMP_VAL_OVER127   0x7F

◆ TEMP_VAL_RESERVED_END

#define TEMP_VAL_RESERVED_END   0xC3

◆ TEMP_VAL_RESERVED_START

#define TEMP_VAL_RESERVED_START   0x82

◆ TEMP_VAL_SENSOR_FAIL

#define TEMP_VAL_SENSOR_FAIL   0x81

◆ TEMP_VAL_TWOS_COMPLEMENT

#define TEMP_VAL_TWOS_COMPLEMENT   0xC5

◆ TEMP_VAL_TWOS_COMPLEMENT_END

#define TEMP_VAL_TWOS_COMPLEMENT_END   0xFF

◆ VTMON_MAX_COUNT

#define VTMON_MAX_COUNT   2

Function Documentation

◆ athena_boot_status_cmd()

void athena_boot_status_cmd ( const struct shell *  shell,
size_t  argc,
char **  argv 
)

◆ athena_current_temp_cmd()

void athena_current_temp_cmd ( const struct shell *  shell,
size_t  argc,
char **  argv 
)

◆ athena_efuse_cmd()

void athena_efuse_cmd ( const struct shell *  shell,
size_t  argc,
char **  argv 
)
Here is the call graph for this function:

◆ athena_hbm_temp_cmd()

void athena_hbm_temp_cmd ( const struct shell *  shell,
size_t  argc,
char **  argv 
)

◆ athena_help_cmd()

void athena_help_cmd ( const struct shell *  shell,
size_t  argc,
char **  argv 
)

Display help information for all Athena commands.

Parameters
shellShell instance
argcArgument count
argvArgument values

◆ athena_max_asic_temp_cmd()

void athena_max_asic_temp_cmd ( const struct shell *  shell,
size_t  argc,
char **  argv 
)

◆ athena_owl_vtmon_cmd()

void athena_owl_vtmon_cmd ( const struct shell *  shell,
size_t  argc,
char **  argv 
)

◆ athena_read_all_cmd()

void athena_read_all_cmd ( const struct shell *  shell,
size_t  argc,
char **  argv 
)
Here is the call graph for this function:

◆ athena_read_cmd()

void athena_read_cmd ( const struct shell *  shell,
size_t  argc,
char **  argv 
)

◆ athena_temp_monitor_cmd()

void athena_temp_monitor_cmd ( const struct shell *  shell,
size_t  argc,
char **  argv 
)

◆ athena_version_cmd()

void athena_version_cmd ( const struct shell *  shell,
size_t  argc,
char **  argv 
)

◆ print_efuse_data()

void print_efuse_data ( const struct shell *  shell,
const char *  target_name,
const struct efuse_data efuse_data 
)

Print efuse data with formatted output.

Parameters
shellShell instance
target_nameTarget name
efuse_dataEfuse data structure
Here is the call graph for this function:

◆ print_efuse_field()

void print_efuse_field ( const struct shell *  shell,
const char *  field_name,
const void *  raw_data,
size_t  size,
char  format_type,
uint64_t  value 
)

Print efuse field with raw hex and interpreted value.

Parameters
shellShell instance
field_nameField name to display
raw_dataPointer to raw data
sizeSize of raw data in bytes
format_typeType of formatting: 'c' for ASCII char, 's' for ASCII string, 'd' for decimal, 'M' for MHz
valueOptional decimal value for non-ASCII fields

◆ read_efuse_data()

int read_efuse_data ( int  target_idx,
struct efuse_data efuse_data 
)

Read efuse data from specified target.

Parameters
target_idxTarget index (0=athena, 1=owl_0, 2=owl_1)
efuse_dataPointer to efuse data structure
Returns
0 on success, negative error code on failure

◆ SHELL_CMD_REGISTER()

SHELL_CMD_REGISTER ( athena  ,
sub_athena_cmds,
"athena low-level commands"  ,
NULL   
)

◆ SHELL_STATIC_SUBCMD_SET_CREATE()

SHELL_STATIC_SUBCMD_SET_CREATE ( sub_athena_cmds  ,
SHELL_CMD(read, NULL, "low-level read command", athena_read_cmd)  ,
SHELL_CMD(owl_vtmon, NULL, "read OWL VTMON data command", athena_owl_vtmon_cmd)  ,
SHELL_CMD(temp_monitor, NULL, "read temperature monitoring data", athena_temp_monitor_cmd)  ,
SHELL_CMD(hbm_temp, NULL, "read HBM temperature data", athena_hbm_temp_cmd)  ,
SHELL_CMD(boot_status, NULL, "check Athena boot status", athena_boot_status_cmd)  ,
SHELL_CMD(efuse, NULL, "read efuse data", athena_efuse_cmd)  ,
SHELL_CMD(version, NULL, "read Athena version data", athena_version_cmd)  ,
SHELL_CMD(current_temp, NULL, "read Athena current temperature", athena_current_temp_cmd)  ,
SHELL_CMD(max_asic_temp, NULL, "read Athena max ASIC temperature", athena_max_asic_temp_cmd)  ,
SHELL_CMD(read_all, NULL, "read all Athena system data", athena_read_all_cmd)  ,
SHELL_CMD(help, NULL, "display help information for Athena commands", athena_help_cmd)  ,
SHELL_SUBCMD_SET_END   
)