From ba80a0dd531a4eebccb1852a65b4b7272a02c06d Mon Sep 17 00:00:00 2001
From: Yihang Li <liyihang9@huawei.com>
Date: Tue, 17 Oct 2023 18:58:27 +0800
Subject: [PATCH] hikptool: Remove the function of querying SAS device
 configurations

Currently, SAS device information cannot be obtained.
Remove the function of querying SAS device configurations

Signed-off-by: Yihang Li <liyihang9@huawei.com>
---
 sas/sas_func/sas_common.h                 |  2 --
 sas/sas_func/sas_read_dev.c               | 21 ---------------------
 sas/user_cmd/cmd_code/sas_cmd_common.c    | 10 ----------
 sas/user_cmd/cmd_code/sas_cmd_dev.c       | 17 -----------------
 sas/user_cmd/cmd_code/sas_tools_include.h |  2 --
 5 files changed, 52 deletions(-)

diff --git a/sas/sas_func/sas_common.h b/sas/sas_func/sas_common.h
index 9464792..1bace0c 100644
--- a/sas/sas_func/sas_common.h
+++ b/sas/sas_func/sas_common.h
@@ -22,7 +22,6 @@
 #define IPTT_ICT_STATUS 29
 #define LINK_SPEED_OFFSET 8
 #define LINK_SPEED_WIDTH 4
-#define MAX_DEVICE_NUM 2048
 
 #define DWS_LOST 0
 #define RESET_PROB 1
@@ -73,7 +72,6 @@ enum sas_errcode_cmd_type {
 
 enum sas_dev_cmd_type {
 	DEV_LINK,
-	DEV_INFO,
 	DEV_UNKNOWN_TYPE,
 };
 
diff --git a/sas/sas_func/sas_read_dev.c b/sas/sas_func/sas_read_dev.c
index 8b9b58d..3a3db07 100644
--- a/sas/sas_func/sas_read_dev.c
+++ b/sas/sas_func/sas_read_dev.c
@@ -76,24 +76,6 @@ static void print_dev_link(const uint32_t *reg_save, uint32_t reg_num)
 	}
 }
 
-static void print_dev_info(const void *reg_save, uint32_t reg_num)
-{
-	volatile struct hikp_sas_itct *itct = (volatile struct hikp_sas_itct *)reg_save;
-
-	printf("The device information as below:\n");
-	printf("dev_type: %d\n", itct->dw0.dev_type);
-	printf("dev_valid: %d\n", itct->dw0.dev_valid);
-	printf("break_reply_en: %d\n", itct->dw0.break_reply_en);
-	printf("smp_timeout: %d\n", itct->dw0.smp_timeout);
-	printf("tlr_en: %d\n", itct->dw0.tlr_en);
-	printf("awt_continue: %d\n", itct->dw0.awt_continue);
-	printf("sas_addr: 0x%llx\n", itct->sas_addr);
-	printf("I_T_nexus_loss: %d\n", itct->dw2.I_T_nexus_loss);
-	printf("awt_initial_value: %d\n", itct->dw2.awt_initial_value);
-	printf("maximum_connect_time: %d\n", itct->dw2.maximum_connect_time);
-	printf("reject_to_open_limit: %d\n", itct->dw2.reject_to_open_limit);
-}
-
 static void sas_print_dev(const uint32_t *reg_save, uint32_t reg_num, uint32_t cmd_type)
 {
 	uint32_t i;
@@ -106,9 +88,6 @@ static void sas_print_dev(const uint32_t *reg_save, uint32_t reg_num, uint32_t c
 	case DEV_LINK:
 		print_dev_link(reg_save, reg_num);
 		break;
-	case DEV_INFO:
-		print_dev_info(reg_save, reg_num);
-		break;
 	default:
 		printf("cmd_type is error\n");
 	}
diff --git a/sas/user_cmd/cmd_code/sas_cmd_common.c b/sas/user_cmd/cmd_code/sas_cmd_common.c
index 9dca63f..358cf39 100644
--- a/sas/user_cmd/cmd_code/sas_cmd_common.c
+++ b/sas/user_cmd/cmd_code/sas_cmd_common.c
@@ -54,11 +54,6 @@ int sas_get_phy_id(void)
 	return g_sas_cmd.phy_id;
 }
 
-int sas_get_dev_id(void)
-{
-	return g_sas_cmd.dev_id;
-}
-
 int sas_get_que_id(void)
 {
 	return g_sas_cmd.que_id;
@@ -84,11 +79,6 @@ int sas_set_die_id(struct major_cmd_ctrl *self, const char *argv)
 	return sas_set_id(self, argv, &g_sas_cmd.die_id);
 }
 
-int sas_set_dev_id(struct major_cmd_ctrl *self, const char *argv)
-{
-	return sas_set_id(self, argv, &g_sas_cmd.dev_id);
-}
-
 int sas_set_que_id(struct major_cmd_ctrl *self, const char *argv)
 {
 	return sas_set_id(self, argv, &g_sas_cmd.que_id);
diff --git a/sas/user_cmd/cmd_code/sas_cmd_dev.c b/sas/user_cmd/cmd_code/sas_cmd_dev.c
index c95006b..6a5eae0 100644
--- a/sas/user_cmd/cmd_code/sas_cmd_dev.c
+++ b/sas/user_cmd/cmd_code/sas_cmd_dev.c
@@ -26,7 +26,6 @@ static int sas_dev_help(struct major_cmd_ctrl *self, const char *argv)
 	printf("\n  Options:\n\n");
 	printf("    %s, %-25s %s\n", "-h", "--help", "display this help and exit\n");
 	printf("    %s, %-25s %s\n", "-l", "--link", "dispaly device type and speed\n");
-	printf("    %s, %-25s %s\n", "-i", "--info", "dispaly the device detail information\n");
 	printf("\n");
 
 	return 0;
@@ -37,19 +36,6 @@ static int sas_dev_link(struct major_cmd_ctrl *self, const char *argv)
 	return sas_set_cmd_type(DEV_LINK);
 }
 
-static int sas_dev_info(struct major_cmd_ctrl *self, const char *argv)
-{
-	int ret;
-
-	(void)sas_set_cmd_type(DEV_INFO);
-	ret = sas_set_dev_id(self, argv);
-	if (ret || sas_get_dev_id() >= MAX_DEVICE_NUM) {
-		printf("device id is too large(>=%d)\n", MAX_DEVICE_NUM);
-		return -EINVAL;
-	}
-	return ret;
-}
-
 static int sas_dev_excute_funs_call(uint32_t cmd_type)
 {
 	if (cmd_type != SAS_UNKNOW_CMD)
@@ -63,11 +49,9 @@ static void sas_dev_execute(struct major_cmd_ctrl *self)
 	int ret, cmd;
 	const char *suc_msg[] = {
 		"sas_dev_link success.",
-		"sas_dev_info success.",
 	};
 	const char *err_msg[] = {
 		"sas_dev_link error.",
-		"sas_dev_info error.",
 		"sas_dev failed, unknown type",
 	};
 
@@ -95,7 +79,6 @@ static void cmd_sas_dev_init(void)
 	cmd_option_register("-d", "--dieid", true, sas_set_die_id);
 	cmd_option_register("-h", "--help", false, sas_dev_help);
 	cmd_option_register("-l", "--link", false, sas_dev_link);
-	cmd_option_register("-i", "--info", true, sas_dev_info);
 }
 
 HIKP_CMD_DECLARE("sas_dev", "sas device information ", cmd_sas_dev_init);
diff --git a/sas/user_cmd/cmd_code/sas_tools_include.h b/sas/user_cmd/cmd_code/sas_tools_include.h
index a71e614..0aa7703 100644
--- a/sas/user_cmd/cmd_code/sas_tools_include.h
+++ b/sas/user_cmd/cmd_code/sas_tools_include.h
@@ -34,13 +34,11 @@ struct tool_sas_cmd {
 int sas_set_cmd_type(int cmd_type);
 int sas_get_cmd_type(void);
 int sas_get_phy_id(void);
-int sas_get_dev_id(void);
 int sas_get_que_id(void);
 struct tool_sas_cmd *sas_get_cmd_p(void);
 int sas_set_chip_id(struct major_cmd_ctrl *self, const char *argv);
 int sas_set_phy_id(struct major_cmd_ctrl *self, const char *argv);
 int sas_set_die_id(struct major_cmd_ctrl *self, const char *argv);
-int sas_set_dev_id(struct major_cmd_ctrl *self, const char *argv);
 int sas_set_que_id(struct major_cmd_ctrl *self, const char *argv);
 int sas_set_dqe_id(struct major_cmd_ctrl *self, const char *argv);
 
--
2.33.0
