Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update bmvid to LTS SP3 #21

Open
wants to merge 13 commits into
base: v23.09-LTS
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
551 changes: 551 additions & 0 deletions 3rdparty/loongarch/include/zconf.h

Large diffs are not rendered by default.

1,938 changes: 1,938 additions & 0 deletions 3rdparty/loongarch/include/zlib.h

Large diffs are not rendered by default.

Binary file added 3rdparty/loongarch/lib/libz.so
Binary file not shown.
551 changes: 551 additions & 0 deletions 3rdparty/soc/include/zconf.h

Large diffs are not rendered by default.

1,938 changes: 1,938 additions & 0 deletions 3rdparty/soc/include/zlib.h

Large diffs are not rendered by default.

Binary file added 3rdparty/soc/lib/libz.so
Binary file not shown.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.6)
cmake_policy(SET CMP0048 NEW)

project("libsophon"
VERSION 0.5.0)
VERSION 0.5.1)

set(CMAKE_CXX_STANDARD 11)

Expand Down
2 changes: 1 addition & 1 deletion bm-smi/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.6)
cmake_policy(SET CMP0046 NEW)
cmake_policy(SET CMP0048 NEW)

Expand Down
20 changes: 10 additions & 10 deletions bm-smi/src/bm_smi_cmdline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ DECLARE_bool(helpshort);
bm_smi_cmdline::bm_smi_cmdline(int argc, char *argv[]) {
#ifndef SOC_MODE
/* get and validate flags*/
gflags::SetUsageMessage("command line brew\n"
gflags::SetUsageMessage("command line prompt\n"
"usage: bm-smi [--ecc=on/off] [--file=/xx/yy.txt] [--dev=0/1...]"
"[--start_dev=x] [--last_dev=y] [--text_format]"
" [--lms=500] [--recovery] [-loop] [--led=on/off/blink]\n"
" [--lms=500] [--recovery] [--loop] [--led=on/off/blink]\n"
"ecc:\n"
" set ecc status, default is off\n"
"file:\n"
Expand All @@ -39,19 +39,19 @@ bm_smi_cmdline::bm_smi_cmdline(int argc, char *argv[]) {
"lms:\n"
" how many ms of the sample interval, default is 500.\n"
"loop:\n"
" if -loop (default): smi sample device every lms ms.\n"
" if -noloop: smi sample device only once.\n"
" if --loop (default): smi sample device every lms ms.\n"
" if --noloop: smi sample device only once.\n"
"recovery:\n"
" recovery dev from fault to active status.\n"
"text_format:\n"
" if true only display attr value from start_dev to last_dev.\n"
"led:\n"
" pcie card LED status: on/off/blink.\n"
" PCIE card LED status: on/off/blink.\n"
"\n"
"New usage: bm-smi [--opmode=display/ecc/led/recovery...]"
"[--opval=on/off/...] [--file=/xx/yy.txt]"
"[--dev=0/1...] [--start_dev=x] [--last_dev=y] [--text_format]"
"[--lms=500] [-loop]\n"
"[--lms=500] [--loop]\n"
"opmode(default null):\n"
" choose different mode,example:display, ecc, led, recovery\n"
" display: means open bm-smi window and check info, use like ./bm-smi\n"
Expand All @@ -69,18 +69,18 @@ bm_smi_cmdline::bm_smi_cmdline(int argc, char *argv[]) {
"other flags have same usage, Both usage can be used!\n");

#else
gflags::SetUsageMessage("command line brew\n"
gflags::SetUsageMessage("command line prompt\n"
"usage: bm-smi [--opmode=display] [--file=/xx/yy.txt]"
" [--lms=500] [-loop]\n"
" [--lms=500] [--loop]\n"
"opmode:\n"
" SOC mode just only use display.\n"
"file:\n"
" the target file to save smi log, default is empty.\n"
"lms:\n"
" how many ms of the sample interval, default is 500.\n"
"loop:\n"
" if -loop (default): smi sample device every lms ms.\n"
" if -noloop: smi sample device only once.\n");
" if --loop (default): smi sample device every lms ms.\n"
" if --noloop: smi sample device only once.\n");
#endif


Expand Down
107 changes: 66 additions & 41 deletions bm-smi/src/bm_smi_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,27 +188,15 @@ static void bm_smi_display_format(std::ofstream &file, bool save_file) {
"----------------------------------------------+\n");
break;
case 2:
if ((g_driver_version >> 24) == 0x6) {
snprintf(
line_str,
BUFFER_LEN,
"| SDK Version:%9s LTS Driver Version: "
"%1d.%1d.%1d LTS |\n",
bm_smi_version,
(g_driver_version >> 16) & 0xff,
(g_driver_version >> 8) & 0xff,
g_driver_version & 0xff);
} else {
snprintf(
line_str,
BUFFER_LEN,
"| SDK Version:%9s LTS Driver Version: "
"%1d.%1d.%1d |\n",
bm_smi_version,
(g_driver_version >> 16) & 0xff,
(g_driver_version >> 8) & 0xff,
g_driver_version & 0xff);
}
snprintf(
line_str,
BUFFER_LEN,
"| Lib Version:%9s Driver Version: "
"%1d.%1d.%1d |\n",
bm_smi_version,
g_driver_version >> 16,
(g_driver_version >> 8) & 0xff,
g_driver_version & 0xff);
break;
case 3:
snprintf(line_str,
Expand Down Expand Up @@ -329,7 +317,7 @@ static void bm_smi_tpuv_to_str(int dev_id, char *s) {
} else if (g_attr[dev_id].vdd_tpu_volt < 0) {
snprintf(s, 5, "%s", " F ");
} else {
snprintf(s, 7, "%dmV", g_attr[dev_id].vdd_tpu_volt);
snprintf(s, 13, "%dmV", g_attr[dev_id].vdd_tpu_volt);
}
}

Expand Down Expand Up @@ -379,7 +367,12 @@ static void bm_smi_sn_to_str(int dev_id, char *s) {

/* convert board type to string*/
static void bm_smi_board_type_to_str(int dev_id, char *s) {
snprintf(s, 6, "%s", g_attr[dev_id].board_type);
int length = strlen(g_attr[dev_id].board_type);
if (g_attr[dev_id].chip_mode == 0 && length < 5){
snprintf(s, 10, "%s%s", " ",g_attr[dev_id].board_type);
} else {
snprintf(s, 10, "%s", g_attr[dev_id].board_type);
}
}

/*
Expand Down Expand Up @@ -538,7 +531,7 @@ static void bm_smi_display_attr(int dev_id,
char chipt_s[5];
char boardp_s[5];
char tpup_s[6];
char tpuv_s[7];
char tpuv_s[13];
char c12v_s[7];
char ecc_s[4];
char cnum_s[5];
Expand All @@ -552,7 +545,7 @@ static void bm_smi_display_attr(int dev_id,
char tpuc_s[6];
char fan_s[4];
char tpu_util_s[6];
char board_type_s[7];
char board_type_s[10];

bm_smi_chipid_to_str(dev_id, chip_id_s);
bm_smi_card_index_to_str(dev_id, card_index_s);
Expand Down Expand Up @@ -585,17 +578,30 @@ static void bm_smi_display_attr(int dev_id,
switch (i) {
case 0: {
if (g_attr[dev_id].board_attr) {
snprintf(line_str,
BUFFER_LEN,
"|%2s %5s-%-5s %5s %17s |%2d %4s %4s",
card_index_s,
chip_id_s,
board_type_s,
mode_s,
sn_s,
dev_id,
boardt_s,
chipt_s);
if (g_attr[dev_id].chip_mode == 0){
snprintf(line_str,
BUFFER_LEN,
"|%2s %-10s %5s %17s |%2d %4s %4s",
card_index_s,
board_type_s,
mode_s,
sn_s,
dev_id,
boardt_s,
chipt_s);
} else {
snprintf(line_str,
BUFFER_LEN,
"|%2s %5s-%-5s %5s %17s |%2d %4s %4s",
card_index_s,
chip_id_s,
board_type_s,
mode_s,
sn_s,
dev_id,
boardt_s,
chipt_s);
}
str_length = snprintf(color_str, BUFFER_LEN, " ");
snprintf(after_color_str,
BUFFER_LEN,
Expand All @@ -607,10 +613,9 @@ static void bm_smi_display_attr(int dev_id,
tpu_util_s);
snprintf(whole_str,
BUFFER_LEN,
"|%2s %5s-%-5s %5s %17s |%2d %4s %4s %5s "
"|%2s %-10s %5s %17s |%2d %4s %4s %5s "
" %5s %3s %3s %5s |\n",
card_index_s,
chip_id_s,
board_type_s,
mode_s,
sn_s,
Expand Down Expand Up @@ -1008,6 +1013,19 @@ static void bm_smi_fetch_all(bm_handle_t handle,
bm_smi_get_attr(bmctl_device, i);
bm_smi_get_proc_gmem(bmctl_device, i);
#endif

char *sg_env;

sg_env = getenv("SOPHONVM");
if (sg_env != NULL && (*sg_env) == 'y') {
g_attr[i].card_index = i/3;
g_attr[i].board_power = (g_attr[i].board_power)/2;
g_attr[i].atx12v_curr = (g_attr[i].atx12v_curr)/2;
} else if (sg_env != NULL && !strncmp(sg_env, "SOPHONVM", 8)) {
g_attr[i].board_power = (g_attr[i].board_power)/2;
g_attr[i].atx12v_curr = (g_attr[i].atx12v_curr)/2;
}

if (dev_cnt == 1) {
g_attr[i].board_endline = 1;
g_attr[i].board_attr = 1;
Expand Down Expand Up @@ -1074,7 +1092,7 @@ static void bm_smi_print_text_info(HANDLE bmctl_device, int start_dev, int last_
char boardt_s[5];
char chipt_s[5];
char tpup_s[6];
char tpuv_s[7];
char tpuv_s[13];
char ecc_s[4];
char cnum_s[5];
char busid_s[12];
Expand All @@ -1084,7 +1102,7 @@ static void bm_smi_print_text_info(HANDLE bmctl_device, int start_dev, int last_
char currclk_s[6];
char tpuc_s[6];
char tpu_util_s[6];
char board_type_s[7];
char board_type_s[10];

#ifdef __linux__
bm_smi_fetch_all(fd, last_dev - start_dev + 1, start_dev);
Expand Down Expand Up @@ -1116,7 +1134,7 @@ static void bm_smi_print_text_info(HANDLE bmctl_device, int start_dev, int last_
bm_smi_tpu_util_to_str(i, tpu_util_s);
bm_smi_board_type_to_str(i, board_type_s);

printf("%s-%s ", chip_id_s, board_type_s);
printf("%s ", board_type_s);
printf("%s ", mode_s);
printf("chip%d: %d ", i - start_dev, g_attr[i].dev_id);
printf("%s ", busid_s);
Expand Down Expand Up @@ -1210,6 +1228,13 @@ int bm_smi_display::validate_input_para() {
dev_cnt = g_cmdline.m_last_dev - g_cmdline.m_start_dev + 1;
}
#endif
char *sg_env;

sg_env = getenv("SOPHONVM");
if (sg_env != NULL && strlen(sg_env) != 8 && !strncmp(sg_env, "SOPHONVM", 8)) {
start_dev = atoi(sg_env + 8) * 3;
dev_cnt = 3;
}

/* check lms value */
if (g_cmdline.m_lms < 300) {
Expand Down
Loading