Skip to content

Commit 9f22852

Browse files
author
Willy Liu
committed
[ACCTON][A9817-32] Refine the error messages and add PSU revision for psu driver
Signed-off-by: Willy Liu <willy@accton.com>
1 parent a506a28 commit 9f22852

File tree

2 files changed

+227
-165
lines changed

2 files changed

+227
-165
lines changed

packages/platforms/accton/x86-64/as9817-32/src/modules/accton_ipmi_intf.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,13 @@ static int _ipmi_send_message(struct ipmi_data *ipmi, unsigned char cmd,
141141
unsigned char *rx_data, unsigned short rx_len)
142142
{
143143
int err;
144+
int i, pos;
145+
char raw_cmd[RAW_CMD_BUF_SIZE] = { 0 };
146+
147+
pos = snprintf(raw_cmd, sizeof(raw_cmd), "0x%02x", cmd);
148+
for (i = 0; i < tx_len && pos < sizeof(raw_cmd); i++) {
149+
pos += snprintf(raw_cmd + pos, sizeof(raw_cmd) - pos," 0x%02x", tx_data[i]);
150+
}
144151

145152
// Validate the input parameters
146153
if ((tx_len && !tx_data) || (rx_len && !rx_data)) {
@@ -157,7 +164,7 @@ static int _ipmi_send_message(struct ipmi_data *ipmi, unsigned char cmd,
157164
// Validate the IPMI address
158165
err = ipmi_validate_addr(&ipmi->address, sizeof(ipmi->address));
159166
if (err) {
160-
dev_err(ipmi->dev, "Invalid IPMI address: %x\n", err);
167+
dev_err(ipmi->dev, "Invalid IPMI address: %x raw_cmd=[%s]\n", err, raw_cmd);
161168
return err;
162169
}
163170

@@ -166,14 +173,14 @@ static int _ipmi_send_message(struct ipmi_data *ipmi, unsigned char cmd,
166173
err = ipmi_request_settime(ipmi->user, &ipmi->address, ipmi->tx_msgid,
167174
&ipmi->tx_message, ipmi, 0, 0, 0);
168175
if (err) {
169-
dev_err(ipmi->dev, "IPMI request_settime failed: %x\n", err);
176+
dev_err(ipmi->dev, "IPMI request_settime failed: %x raw_cmd=[%s]\n", err, raw_cmd);
170177
return err;
171178
}
172179

173180
// Wait for the message to complete
174181
err = wait_for_completion_timeout(&ipmi->read_complete, IPMI_TIMEOUT);
175182
if (!err) {
176-
dev_err(ipmi->dev, "IPMI command timeout\n");
183+
dev_err(ipmi->dev, "IPMI command timeout raw_cmd=[%s]\n", raw_cmd);
177184
return -ETIMEDOUT;
178185
}
179186

0 commit comments

Comments
 (0)