mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-12 03:27:24 +00:00
nm: Separate code from dcmi
Move Node Manager related code to separate ipmi_nm.* files. Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
This commit is contained in:
parent
1724b031b3
commit
75eada4859
@ -52,53 +52,6 @@
|
|||||||
#define GOOD_PWR_GLIMIT_CCODE(ccode) ((ccode = ((ccode == 0x80) ? 0 : ccode)))
|
#define GOOD_PWR_GLIMIT_CCODE(ccode) ((ccode = ((ccode == 0x80) ? 0 : ccode)))
|
||||||
#define GOOD_ASSET_TAG_CCODE(ccode) ((ccode = (((ccode == 0x80) || (ccode == 0x81) || (ccode == 0x82) || (ccode == 0x83)) ? 0 : ccode)))
|
#define GOOD_ASSET_TAG_CCODE(ccode) ((ccode = (((ccode == 0x80) || (ccode == 0x81) || (ccode == 0x82) || (ccode == 0x83)) ? 0 : ccode)))
|
||||||
|
|
||||||
/* External Node Manager Configuration and Control Commands per spec 2.0 */
|
|
||||||
|
|
||||||
#define IPMI_NM_POLICY_CTL 0xC0
|
|
||||||
#define IPMI_NM_SET_POLICY 0xC1
|
|
||||||
#define IPMI_NM_GET_POLICY 0xC2
|
|
||||||
#define IPMI_NM_SET_ALERT_TH 0xC3
|
|
||||||
#define IPMI_NM_GET_ALERT_TH 0xC4
|
|
||||||
#define IPMI_NM_SET_SUSPEND 0xC5
|
|
||||||
#define IPMI_NM_GET_SUSPEND 0xC6
|
|
||||||
#define IPMI_NM_RESET_STATS 0xC7
|
|
||||||
#define IPMI_NM_GET_STATS 0xC8
|
|
||||||
#define IPMI_NM_GET_CAP 0xC9
|
|
||||||
#define IPMI_NM_GET_VERSION 0xCA
|
|
||||||
#define IPMI_NM_SET_POWER 0xCB
|
|
||||||
#define IPMI_NM_SET_ALERT_DS 0xCE
|
|
||||||
#define IPMI_NM_GET_ALERT_DS 0xCF
|
|
||||||
#define IPMI_NM_LIMITING 0xF2
|
|
||||||
|
|
||||||
/* Node Manager Policy Control Flags */
|
|
||||||
#define IPMI_NM_GLOBAL_ENABLE 0x01
|
|
||||||
#define IPMI_NM_DOMAIN_ENABLE 0x02
|
|
||||||
#define IPMI_NM_PER_POLICY_ENABLE 0x04
|
|
||||||
|
|
||||||
/* Node Manager Set Policy Enable */
|
|
||||||
#define IPMI_NM_POLICY_ENABLE 0x10
|
|
||||||
|
|
||||||
/* Node Manager Policy Trigger Codes */
|
|
||||||
#define IPMI_NM_NO_POLICY_TRIG 0x00
|
|
||||||
#define IPMI_NM_TEMP_TRIGGER 0x01
|
|
||||||
#define IPMI_NM_NO_READ_TRIG 0x02
|
|
||||||
#define IPMI_NM_RESET_TRIGGER 0x03
|
|
||||||
#define IPMI_NM_BOOT_TRIGGER 0x04
|
|
||||||
|
|
||||||
/* Policy Exception Actions flags */
|
|
||||||
#define IPMI_NM_POLICY_ALERT 0x01
|
|
||||||
#define IPMI_NM_POLICY_SHUT 0x02
|
|
||||||
|
|
||||||
/* Power Correction codes for Policy action */
|
|
||||||
#define IPMI_NM_PWR_AUTO_CORR 0x00
|
|
||||||
#define IPMI_NM_PWR_SOFT_CORR 0x01
|
|
||||||
#define IPMI_NM_PWR_AGGR_CORR 0x02
|
|
||||||
|
|
||||||
/* Set Threshold message size */
|
|
||||||
#define IPMI_NM_SET_THRESH_LEN 12
|
|
||||||
|
|
||||||
/* Number of Suspend Periods */
|
|
||||||
#define IPMI_NM_SUSPEND_PERIOD_MAX 5
|
|
||||||
|
|
||||||
struct dcmi_cmd {
|
struct dcmi_cmd {
|
||||||
uint16_t val;
|
uint16_t val;
|
||||||
@ -106,6 +59,13 @@ struct dcmi_cmd {
|
|||||||
const char * desc;
|
const char * desc;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is a termination macro for all struct dcmi_cmd arrays,
|
||||||
|
* def argument is the default value returned by str2val2()
|
||||||
|
* when string is not found in the array
|
||||||
|
*/
|
||||||
|
#define DCMI_CMD_END(def) { (def), NULL, NULL }
|
||||||
|
|
||||||
/* make a struct for the return from the get limit command */
|
/* make a struct for the return from the get limit command */
|
||||||
struct power_limit {
|
struct power_limit {
|
||||||
uint8_t grp_id; /* first byte: Group Extension ID */
|
uint8_t grp_id; /* first byte: Group Extension ID */
|
||||||
@ -172,99 +132,11 @@ struct thermal_limit {
|
|||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
int ipmi_dcmi_main(struct ipmi_intf * intf, int argc, char ** argv);
|
int ipmi_dcmi_main(struct ipmi_intf * intf, int argc, char ** argv);
|
||||||
|
uint16_t dcmi_str2val(const char *str, const struct dcmi_cmd *vs);
|
||||||
|
const char *dcmi_val2str(uint16_t val, const struct dcmi_cmd *vs);
|
||||||
|
void dcmi_print_strs(const struct dcmi_cmd * vs,
|
||||||
|
const char * title,
|
||||||
|
int loglevel,
|
||||||
|
int verthorz);
|
||||||
|
|
||||||
/* Node Manager discover command */
|
|
||||||
struct nm_discover {
|
|
||||||
uint8_t intel_id[3]; /* Always returns 000157 */
|
|
||||||
uint8_t nm_version;
|
|
||||||
uint8_t ipmi_version;
|
|
||||||
uint8_t patch_version;
|
|
||||||
uint8_t major_rev;
|
|
||||||
uint8_t minor_rev;
|
|
||||||
} __attribute__ ((packed));
|
|
||||||
|
|
||||||
/* Node Manager get capabilities command */
|
|
||||||
struct nm_capability {
|
|
||||||
uint8_t intel_id[3];
|
|
||||||
uint8_t max_settings;
|
|
||||||
uint16_t max_value; /* max power/thermal/time after reset */
|
|
||||||
uint16_t min_value; /* min "" */
|
|
||||||
uint32_t min_corr; /* min correction time inmillesecs */
|
|
||||||
uint32_t max_corr;
|
|
||||||
uint16_t min_stats;
|
|
||||||
uint16_t max_stats;
|
|
||||||
uint8_t scope;
|
|
||||||
} __attribute__ ((packed));
|
|
||||||
|
|
||||||
/* Node Manager get statistics command */
|
|
||||||
struct nm_statistics {
|
|
||||||
uint8_t intel_id[3];
|
|
||||||
uint16_t curr_value;
|
|
||||||
uint16_t min_value;
|
|
||||||
uint16_t max_value;
|
|
||||||
uint16_t ave_value;
|
|
||||||
uint32_t time_stamp;
|
|
||||||
uint32_t stat_period;
|
|
||||||
uint8_t id_state;
|
|
||||||
} __attribute__ ((packed));
|
|
||||||
|
|
||||||
/* Node Manager set policy */
|
|
||||||
struct nm_policy {
|
|
||||||
uint8_t intel_id[3];
|
|
||||||
uint8_t domain; /* 0:3 are domain, 4 = Policy enabled */
|
|
||||||
uint8_t policy_id;
|
|
||||||
uint8_t policy_type; /* 0:3 trigger type 4 = action 5:6 correction */
|
|
||||||
uint8_t policy_exception; /* exception actions */
|
|
||||||
uint16_t policy_limits;
|
|
||||||
uint32_t corr_time;
|
|
||||||
uint16_t trigger_limit;
|
|
||||||
uint16_t stats_period;
|
|
||||||
} __attribute__ ((packed));
|
|
||||||
|
|
||||||
/* Node Maager get policy */
|
|
||||||
struct nm_get_policy {
|
|
||||||
uint8_t intel_id[3];
|
|
||||||
uint8_t domain; /* 0:3 are domain, 4 = Policy enabled */
|
|
||||||
uint8_t policy_type; /* 0:3 trigger type 4 = action 5:6 correction */
|
|
||||||
uint8_t policy_exception; /* exception actions */
|
|
||||||
uint16_t policy_limits;
|
|
||||||
uint32_t corr_time;
|
|
||||||
uint16_t trigger_limit;
|
|
||||||
uint16_t stats_period;
|
|
||||||
} __attribute__ ((packed));
|
|
||||||
|
|
||||||
/* Node Manager set alert destination */
|
|
||||||
struct nm_set_alert {
|
|
||||||
uint8_t intel_id[3];
|
|
||||||
uint8_t chan; /* 0:3 BMC chan, 4:6 reserved, bit 7=0 register alert receiver =1 invalidate */
|
|
||||||
uint8_t dest; /* lan destination */
|
|
||||||
uint8_t string; /* alert string selector */
|
|
||||||
} __attribute__ ((packed));
|
|
||||||
|
|
||||||
/* Node Manager set alert threshold */
|
|
||||||
struct nm_thresh {
|
|
||||||
uint8_t intel_id[3];
|
|
||||||
uint8_t domain; /* 0:3 are domain, 4 = Policy enabled */
|
|
||||||
uint8_t policy_id;
|
|
||||||
uint8_t count;
|
|
||||||
uint16_t thresholds[3];
|
|
||||||
} __attribute__ ((packed));
|
|
||||||
|
|
||||||
/* Node Manager suspend period struct */
|
|
||||||
struct nm_period {
|
|
||||||
uint8_t start;
|
|
||||||
uint8_t stop;
|
|
||||||
uint8_t repeat;
|
|
||||||
} __attribute__ ((packed));
|
|
||||||
|
|
||||||
/* Node Manager set suspend period */
|
|
||||||
struct nm_suspend {
|
|
||||||
uint8_t intel_id[3];
|
|
||||||
uint8_t domain; /* 0:3 are domain, 4 = Policy enabled */
|
|
||||||
uint8_t policy_id;
|
|
||||||
uint8_t count;
|
|
||||||
struct nm_period period[IPMI_NM_SUSPEND_PERIOD_MAX];
|
|
||||||
} __attribute__ ((packed));
|
|
||||||
|
|
||||||
int ipmi_nm_main(struct ipmi_intf * intf, int argc, char ** argv);
|
|
||||||
#endif /*IPMI_DCMI_H*/
|
#endif /*IPMI_DCMI_H*/
|
||||||
|
171
include/ipmitool/ipmi_nm.h
Normal file
171
include/ipmitool/ipmi_nm.h
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2008 Intel Corporation.
|
||||||
|
* All rights reserved
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <ipmitool/ipmi.h>
|
||||||
|
|
||||||
|
/* Configuration and control commands per
|
||||||
|
* Intel Intelligent Power Node Manager 2.0
|
||||||
|
* External Interface Specification Using IPMI
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define IPMI_NM_POLICY_CTL 0xC0
|
||||||
|
#define IPMI_NM_SET_POLICY 0xC1
|
||||||
|
#define IPMI_NM_GET_POLICY 0xC2
|
||||||
|
#define IPMI_NM_SET_ALERT_TH 0xC3
|
||||||
|
#define IPMI_NM_GET_ALERT_TH 0xC4
|
||||||
|
#define IPMI_NM_SET_SUSPEND 0xC5
|
||||||
|
#define IPMI_NM_GET_SUSPEND 0xC6
|
||||||
|
#define IPMI_NM_RESET_STATS 0xC7
|
||||||
|
#define IPMI_NM_GET_STATS 0xC8
|
||||||
|
#define IPMI_NM_GET_CAP 0xC9
|
||||||
|
#define IPMI_NM_GET_VERSION 0xCA
|
||||||
|
#define IPMI_NM_SET_POWER 0xCB
|
||||||
|
#define IPMI_NM_SET_ALERT_DS 0xCE
|
||||||
|
#define IPMI_NM_GET_ALERT_DS 0xCF
|
||||||
|
#define IPMI_NM_LIMITING 0xF2
|
||||||
|
|
||||||
|
/* Node Manager Policy Control Flags */
|
||||||
|
#define IPMI_NM_GLOBAL_ENABLE 0x01
|
||||||
|
#define IPMI_NM_DOMAIN_ENABLE 0x02
|
||||||
|
#define IPMI_NM_PER_POLICY_ENABLE 0x04
|
||||||
|
|
||||||
|
/* Node Manager Set Policy Enable */
|
||||||
|
#define IPMI_NM_POLICY_ENABLE 0x10
|
||||||
|
|
||||||
|
/* Node Manager Policy Trigger Codes */
|
||||||
|
#define IPMI_NM_NO_POLICY_TRIG 0x00
|
||||||
|
#define IPMI_NM_TEMP_TRIGGER 0x01
|
||||||
|
#define IPMI_NM_NO_READ_TRIG 0x02
|
||||||
|
#define IPMI_NM_RESET_TRIGGER 0x03
|
||||||
|
#define IPMI_NM_BOOT_TRIGGER 0x04
|
||||||
|
|
||||||
|
/* Policy Exception Actions flags */
|
||||||
|
#define IPMI_NM_POLICY_ALERT 0x01
|
||||||
|
#define IPMI_NM_POLICY_SHUT 0x02
|
||||||
|
|
||||||
|
/* Power Correction codes for Policy action */
|
||||||
|
#define IPMI_NM_PWR_AUTO_CORR 0x00
|
||||||
|
#define IPMI_NM_PWR_SOFT_CORR 0x01
|
||||||
|
#define IPMI_NM_PWR_AGGR_CORR 0x02
|
||||||
|
|
||||||
|
/* Set Threshold message size */
|
||||||
|
#define IPMI_NM_SET_THRESH_LEN 12
|
||||||
|
|
||||||
|
/* Number of Suspend Periods */
|
||||||
|
#define IPMI_NM_SUSPEND_PERIOD_MAX 5
|
||||||
|
|
||||||
|
/* Node Manager discover command */
|
||||||
|
struct nm_discover {
|
||||||
|
uint8_t intel_id[3]; /* Always returns 000157 */
|
||||||
|
uint8_t nm_version;
|
||||||
|
uint8_t ipmi_version;
|
||||||
|
uint8_t patch_version;
|
||||||
|
uint8_t major_rev;
|
||||||
|
uint8_t minor_rev;
|
||||||
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
/* Node Manager get capabilities command */
|
||||||
|
struct nm_capability {
|
||||||
|
uint8_t intel_id[3];
|
||||||
|
uint8_t max_settings;
|
||||||
|
uint16_t max_value; /* max power/thermal/time after reset */
|
||||||
|
uint16_t min_value; /* min "" */
|
||||||
|
uint32_t min_corr; /* min correction time inmillesecs */
|
||||||
|
uint32_t max_corr;
|
||||||
|
uint16_t min_stats;
|
||||||
|
uint16_t max_stats;
|
||||||
|
uint8_t scope;
|
||||||
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
/* Node Manager get statistics command */
|
||||||
|
struct nm_statistics {
|
||||||
|
uint8_t intel_id[3];
|
||||||
|
uint16_t curr_value;
|
||||||
|
uint16_t min_value;
|
||||||
|
uint16_t max_value;
|
||||||
|
uint16_t ave_value;
|
||||||
|
uint32_t time_stamp;
|
||||||
|
uint32_t stat_period;
|
||||||
|
uint8_t id_state;
|
||||||
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
/* Node Manager set policy */
|
||||||
|
struct nm_policy {
|
||||||
|
uint8_t intel_id[3];
|
||||||
|
uint8_t domain; /* 0:3 are domain, 4 = Policy enabled */
|
||||||
|
uint8_t policy_id;
|
||||||
|
uint8_t policy_type; /* 0:3 trigger type 4 = action 5:6 correction */
|
||||||
|
uint8_t policy_exception; /* exception actions */
|
||||||
|
uint16_t policy_limits;
|
||||||
|
uint32_t corr_time;
|
||||||
|
uint16_t trigger_limit;
|
||||||
|
uint16_t stats_period;
|
||||||
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
/* Node Maager get policy */
|
||||||
|
struct nm_get_policy {
|
||||||
|
uint8_t intel_id[3];
|
||||||
|
uint8_t domain; /* 0:3 are domain, 4 = Policy enabled */
|
||||||
|
uint8_t policy_type; /* 0:3 trigger type 4 = action 5:6 correction */
|
||||||
|
uint8_t policy_exception; /* exception actions */
|
||||||
|
uint16_t policy_limits;
|
||||||
|
uint32_t corr_time;
|
||||||
|
uint16_t trigger_limit;
|
||||||
|
uint16_t stats_period;
|
||||||
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
/* Node Manager set alert destination */
|
||||||
|
struct nm_set_alert {
|
||||||
|
uint8_t intel_id[3];
|
||||||
|
uint8_t chan; /* 0:3 BMC chan
|
||||||
|
* 4:6 reserved
|
||||||
|
* 7 = 0 register alert receiver
|
||||||
|
* = 1 invalidate
|
||||||
|
*/
|
||||||
|
uint8_t dest; /* LAN destination */
|
||||||
|
uint8_t string; /* alert string selector */
|
||||||
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
/* Node Manager set alert threshold */
|
||||||
|
struct nm_thresh {
|
||||||
|
uint8_t intel_id[3];
|
||||||
|
uint8_t domain; /* 0:3 are domain, 4 = Policy enabled */
|
||||||
|
uint8_t policy_id;
|
||||||
|
uint8_t count;
|
||||||
|
uint16_t thresholds[3];
|
||||||
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
/* Node Manager suspend period struct */
|
||||||
|
struct nm_period {
|
||||||
|
uint8_t start;
|
||||||
|
uint8_t stop;
|
||||||
|
uint8_t repeat;
|
||||||
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
/* Node Manager set suspend period */
|
||||||
|
struct nm_suspend {
|
||||||
|
uint8_t intel_id[3];
|
||||||
|
uint8_t domain; /* 0:3 are domain, 4 = Policy enabled */
|
||||||
|
uint8_t policy_id;
|
||||||
|
uint8_t count;
|
||||||
|
struct nm_period period[IPMI_NM_SUSPEND_PERIOD_MAX];
|
||||||
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
int ipmi_nm_main(struct ipmi_intf *intf, int argc, char **argv);
|
@ -40,7 +40,7 @@ libipmitool_la_SOURCES = helper.c ipmi_sdr.c ipmi_sel.c ipmi_sol.c ipmi_pef.c \
|
|||||||
ipmi_oem.c ipmi_isol.c ipmi_sunoem.c ipmi_fwum.c ipmi_picmg.c \
|
ipmi_oem.c ipmi_isol.c ipmi_sunoem.c ipmi_fwum.c ipmi_picmg.c \
|
||||||
ipmi_main.c ipmi_tsol.c ipmi_firewall.c ipmi_kontronoem.c \
|
ipmi_main.c ipmi_tsol.c ipmi_firewall.c ipmi_kontronoem.c \
|
||||||
ipmi_hpmfwupg.c ipmi_sdradd.c ipmi_ekanalyzer.c ipmi_gendev.c \
|
ipmi_hpmfwupg.c ipmi_sdradd.c ipmi_ekanalyzer.c ipmi_gendev.c \
|
||||||
ipmi_ime.c ipmi_delloem.c ipmi_dcmi.c hpm2.c ipmi_vita.c \
|
ipmi_ime.c ipmi_delloem.c ipmi_dcmi.c ipmi_nm.c hpm2.c ipmi_vita.c \
|
||||||
ipmi_lanp6.c ipmi_cfgp.c ipmi_quantaoem.c ipmi_time.c \
|
ipmi_lanp6.c ipmi_cfgp.c ipmi_quantaoem.c ipmi_time.c \
|
||||||
../src/plugins/lan/md5.c ../src/plugins/lan/md5.h
|
../src/plugins/lan/md5.c ../src/plugins/lan/md5.h
|
||||||
|
|
||||||
|
1852
lib/ipmi_dcmi.c
1852
lib/ipmi_dcmi.c
File diff suppressed because it is too large
Load Diff
1779
lib/ipmi_nm.c
Normal file
1779
lib/ipmi_nm.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -65,6 +65,7 @@
|
|||||||
#include <ipmitool/ipmi_ekanalyzer.h>
|
#include <ipmitool/ipmi_ekanalyzer.h>
|
||||||
#include <ipmitool/ipmi_ime.h>
|
#include <ipmitool/ipmi_ime.h>
|
||||||
#include <ipmitool/ipmi_dcmi.h>
|
#include <ipmitool/ipmi_dcmi.h>
|
||||||
|
#include <ipmitool/ipmi_nm.h>
|
||||||
#include <ipmitool/ipmi_vita.h>
|
#include <ipmitool/ipmi_vita.h>
|
||||||
#include <ipmitool/ipmi_quantaoem.h>
|
#include <ipmitool/ipmi_quantaoem.h>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user