mirror of
https://github.com/ipmitool/ipmitool.git
synced 2026-06-19 20:11:35 +00:00
nm: Refactor to reduce code duplication
Add nm_set_id() and nm_check_id() functions, use them and the existing htoipmi24() to reduce code duplication. Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <ipmitool/ipmi.h>
|
||||
#include <ipmitool/helper.h>
|
||||
|
||||
/* Configuration and control commands per
|
||||
* Intel Intelligent Power Node Manager 2.0
|
||||
@@ -41,6 +42,9 @@
|
||||
#define IPMI_NM_GET_ALERT_DS 0xCF
|
||||
#define IPMI_NM_LIMITING 0xF2
|
||||
|
||||
/* Node Manager identification */
|
||||
#define IPMI_NM_ID 0x000157 /* Three bytes */
|
||||
|
||||
/* Node Manager Policy Control Flags */
|
||||
#define IPMI_NM_GLOBAL_ENABLE 0x01
|
||||
#define IPMI_NM_DOMAIN_ENABLE 0x02
|
||||
@@ -169,3 +173,13 @@ struct nm_suspend {
|
||||
} __attribute__ ((packed));
|
||||
|
||||
int ipmi_nm_main(struct ipmi_intf *intf, int argc, char **argv);
|
||||
|
||||
static inline void nm_set_id(void *buf)
|
||||
{
|
||||
htoipmi24(IPMI_NM_ID, buf);
|
||||
}
|
||||
|
||||
static inline bool nm_check_id(void *buf)
|
||||
{
|
||||
return IPMI_NM_ID == ipmi24toh(buf);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user