nm: Refactor error checking

Make chk_nm_rsp() search for the codes really defined in the
NM dictionary and not just check some arbitrary completion codes
range. For all codes not defined in NM dictionary, print strings
from the generic IPMI completion codes dictionary.

Rename chk_nm_rsp() to is_nm_err() to better reflect the purpose
of the function. Make it 'bool'. Use centralized exiting for the
function.

Also fix wording for invalid NM ID.

End-user-impact: On invalid responses from the NM, instead of
                 "A valid NM command was not returned!" accompanied
                 by a single byte of data, the following message
                 with full 3 bytes of data will now be printed:
                 "No valid NM ID in response!"
Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
This commit is contained in:
Alexander Amelkin
2019-02-25 18:49:23 +03:00
parent 7469522fbb
commit 67928205e7
2 changed files with 43 additions and 35 deletions

View File

@@ -72,6 +72,7 @@
#define IPMI_NM_CC_POLICY_STATS_RANGE 0x89
#define IPMI_NM_CC_POLICY_LIMIT_NONE 0xA1
#define IPMI_NM_CC_POLICY_PARAM_BUSY 0xD5
#define IPMI_NM_CC_POLICY_DOMAIN_ERR 0xD6
#define IPMI_NM_CC_POLICY_VALUE_INVALID 0x8B
#define IPMI_NM_CC_STATS_MODE_INVALID 0x88
#define IPMI_NM_CC_POWER_LIMIT_RANGE 0x84