From f8edb8f7f8882aaa68b24d7bb37659f2589c90ca Mon Sep 17 00:00:00 2001
From: Bingquan Mou <moubingquan@huawei.com>
Date: Sat, 12 Oct 2024 17:11:38 +0800
Subject: [PATCH 24/27] hikptool: The macro_num error is rectified, and the
 offset writing is incorrect.

category: feature
bugzilla: NA
CVE: NA

1.It is reasonable that core0 has three macros. Therefore, macro_num == 3 is reasonable.
2.The offset writing is incorrect.

Signed-off-by: Bingquan Mou <moubingquan@huawei.com>
---
 pcie/func_lib/pcie_func/pcie_link_ltssm.c | 2 +-
 pcie/func_lib/pcie_func/pcie_link_ltssm.h | 2 +-
 pcie/func_lib/pcie_func/pcie_statistics.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/pcie/func_lib/pcie_func/pcie_link_ltssm.c b/pcie/func_lib/pcie_func/pcie_link_ltssm.c
index 1bc2edb..d3534f5 100644
--- a/pcie/func_lib/pcie_func/pcie_link_ltssm.c
+++ b/pcie/func_lib/pcie_func/pcie_link_ltssm.c
@@ -211,7 +211,7 @@ static int pcie_print_ltssm_trace(const uint64_t *ltssm_input, uint32_t ltssm_nu
 			(uint32_t)ltssm_val.bits.any_change_pipe_req,
 			(uint32_t)ltssm_val.bits.rxl0s_st,
 			(uint32_t)ltssm_val.bits.train_bit_map1,
-			(((uint32_t)ltssm_val.bits.rxl0s_st) << GEN5_BIT_OFFEST) |
+			(((uint32_t)ltssm_val.bits.rxl0s_st) << GEN5_BIT_OFFSET) |
 			((uint32_t)ltssm_val.bits.mac_rate),
 			(uint32_t)ltssm_val.bits.duration_counter,
 			(uint32_t)ltssm_val.bits.ltssm_state,
diff --git a/pcie/func_lib/pcie_func/pcie_link_ltssm.h b/pcie/func_lib/pcie_func/pcie_link_ltssm.h
index 9986f7a..278f3e4 100644
--- a/pcie/func_lib/pcie_func/pcie_link_ltssm.h
+++ b/pcie/func_lib/pcie_func/pcie_link_ltssm.h
@@ -19,7 +19,7 @@
 #define TRACE_STR_NUM 0x20
 #define TRACER_DEPTH 65
 #define PM_TRACE_STR_NUM 0x28
-#define GEN5_BIT_OFFEST 2
+#define GEN5_BIT_OFFSET 2
 
 struct pcie_ltssm_num_string {
 	int ltssm;
diff --git a/pcie/func_lib/pcie_func/pcie_statistics.c b/pcie/func_lib/pcie_func/pcie_statistics.c
index 54d4edb..be187f2 100644
--- a/pcie/func_lib/pcie_func/pcie_statistics.c
+++ b/pcie/func_lib/pcie_func/pcie_statistics.c
@@ -70,7 +70,7 @@ static int pcie_portid_serdes_relation(const struct pcie_macro_info *macro_info,
 		return -1;
 	}
 
-	if (macro_num >= MAX_MACRO_ONEPORT) {
+	if (macro_num > MAX_MACRO_ONEPORT) {
 		Info("macro_num [%u] exceeds the maximum array length\n", macro_num);
 		return -1;
 	}
-- 
2.45.0.windows.1

