dcmi: Refactor macro names

Make DCMI command macros more relevant and easy to read.

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
This commit is contained in:
Alexander Amelkin 2019-02-25 15:36:05 +03:00
parent be9f1660fb
commit 5372a57297
No known key found for this signature in database
GPG Key ID: E893587B5B74178D
2 changed files with 32 additions and 33 deletions

View File

@ -24,23 +24,22 @@
/* DCMI commands per DCMI 1.5 SPEC */ /* DCMI commands per DCMI 1.5 SPEC */
#define IPMI_DCMI 0xDC /* Group Extension Identification */ #define IPMI_DCMI 0xDC /* Group Extension Identification */
#define IPMI_DCMI_COMPAT 0x01 #define IPMI_DCMI_GET_CAPS 0x01 /* Get Capabilities */
#define IPMI_DCMI_GETRED 0x02 #define IPMI_DCMI_GET_PWR_READING 0x02 /* Get Power Reading */
#define IPMI_DCMI_GETLMT 0x03 #define IPMI_DCMI_GET_PWR_LIM 0x03 /* Get Power Limit */
#define IPMI_DCMI_SETLMT 0x04 #define IPMI_DCMI_SET_PWR_LIM 0x04 /* Set Power Limit */
#define IPMI_DCMI_PWRACT 0x05 #define IPMI_DCMI_ACT_PWR_LIM 0x05 /* Activate/Deactivate Power Limit */
#define IPMI_DCMI_GETASSET 0x06 #define IPMI_DCMI_GET_ASSET_TAG 0x06 /* Get Asset Tag */
#define IPMI_DCMI_SETASSET 0x08 #define IPMI_DCMI_SET_ASSET_TAG 0x08 /* Set Asset Tag */
#define IPMI_DCMI_GETMNGCTRLIDS 0x09 #define IPMI_DCMI_GET_MC_ID 0x09 /* Get Management Controller ID String */
#define IPMI_DCMI_SETMNGCTRLIDS 0x0A #define IPMI_DCMI_SET_MC_ID 0x0A /* Set Management Controller ID String */
#define IPMI_DCMI_SETTERMALLIMIT 0x0B #define IPMI_DCMI_SET_THERM_LIM 0x0B /* Set Thermal Limit */
#define IPMI_DCMI_GETTERMALLIMIT 0x0C #define IPMI_DCMI_GET_THERM_LIM 0x0C /* Get Thermal Limit */
#define IPMI_DCMI_GETSNSR 0x07 #define IPMI_DCMI_GET_SENSOR_INFO 0x07 /* Get DCMI Sensor Info */
#define IPMI_DCMI_PWRMGT 0x08 #define IPMI_DCMI_GET_TEMP 0x10 /* Get Temperature Readings */
#define IPMI_DCMI_GETTEMPRED 0x10 #define IPMI_DCMI_SET_CONF_PARAM 0x12 /* Set DCMI Configuration Parameters */
#define IPMI_DCMI_SETCONFPARAM 0x12 #define IPMI_DCMI_GET_CONF_PARAM 0x13 /* Get DCMI Configuration Parameters */
#define IPMI_DCMI_GETCONFPARAM 0x13
#define IPMI_DCMI_CONFORM 0x0001 #define IPMI_DCMI_CONFORM 0x0001
#define IPMI_DCMI_1_1_CONFORM 0x0101 #define IPMI_DCMI_1_1_CONFORM 0x0101

View File

@ -493,7 +493,7 @@ ipmi_dcmi_getcapabilities(struct ipmi_intf * intf, uint8_t selector)
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_DCGRP; /* 0x2C per 1.0 spec */ req.msg.netfn = IPMI_NETFN_DCGRP; /* 0x2C per 1.0 spec */
req.msg.cmd = IPMI_DCMI_COMPAT; /* 0x01 per 1.0 spec */ req.msg.cmd = IPMI_DCMI_GET_CAPS; /* 0x01 per 1.0 spec */
req.msg.data = msg_data; /* 0xDC 0x01 or the msg_data above */ req.msg.data = msg_data; /* 0xDC 0x01 or the msg_data above */
req.msg.data_len = 2; /* How many times does req.msg.data need to read */ req.msg.data_len = 2; /* How many times does req.msg.data need to read */
@ -753,7 +753,7 @@ ipmi_dcmi_getassettag(struct ipmi_intf * intf, uint8_t offset, uint8_t length)
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_DCGRP; /* 0x2C per 1.1 spec */ req.msg.netfn = IPMI_NETFN_DCGRP; /* 0x2C per 1.1 spec */
req.msg.cmd = IPMI_DCMI_GETASSET; /* 0x01 per 1.1 spec */ req.msg.cmd = IPMI_DCMI_GET_ASSET_TAG; /* 0x01 per 1.1 spec */
req.msg.data = msg_data; /* msg_data above */ req.msg.data = msg_data; /* msg_data above */
req.msg.data_len = 3; /* How many times does req.msg.data need to read */ req.msg.data_len = 3; /* How many times does req.msg.data need to read */
return intf->sendrecv(intf, &req); return intf->sendrecv(intf, &req);
@ -832,7 +832,7 @@ ipmi_dcmi_setassettag(struct ipmi_intf * intf, uint8_t offset, uint8_t length,
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_DCGRP; /* 0x2C per 1.1 spec */ req.msg.netfn = IPMI_NETFN_DCGRP; /* 0x2C per 1.1 spec */
req.msg.cmd = IPMI_DCMI_SETASSET; /* 0x08 per 1.1 spec */ req.msg.cmd = IPMI_DCMI_SET_ASSET_TAG; /* 0x08 per 1.1 spec */
req.msg.data = msg_data; /* msg_data above */ req.msg.data = msg_data; /* msg_data above */
/* How many times does req.msg.data need to read */ /* How many times does req.msg.data need to read */
req.msg.data_len = length + 3; req.msg.data_len = length + 3;
@ -898,7 +898,7 @@ ipmi_dcmi_getmngctrlids(struct ipmi_intf * intf, uint8_t offset, uint8_t length)
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_DCGRP; /* 0x2C per 1.1 spec */ req.msg.netfn = IPMI_NETFN_DCGRP; /* 0x2C per 1.1 spec */
req.msg.cmd = IPMI_DCMI_GETMNGCTRLIDS; /* 0x09 per 1.1 spec */ req.msg.cmd = IPMI_DCMI_GET_MC_ID; /* 0x09 per 1.1 spec */
req.msg.data = msg_data; /* msg_data above */ req.msg.data = msg_data; /* msg_data above */
/* How many times does req.msg.data need to read */ /* How many times does req.msg.data need to read */
req.msg.data_len = 3; req.msg.data_len = 3;
@ -966,7 +966,7 @@ ipmi_dcmi_setmngctrlids(struct ipmi_intf * intf, uint8_t offset, uint8_t length,
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_DCGRP; /* 0x2C per 1.1 spec */ req.msg.netfn = IPMI_NETFN_DCGRP; /* 0x2C per 1.1 spec */
req.msg.cmd = IPMI_DCMI_SETMNGCTRLIDS; /* 0x0A per 1.1 spec */ req.msg.cmd = IPMI_DCMI_SET_MC_ID; /* 0x0A per 1.1 spec */
req.msg.data = msg_data; /* msg_data above */ req.msg.data = msg_data; /* msg_data above */
/* How many times does req.msg.data need to read */ /* How many times does req.msg.data need to read */
req.msg.data_len = 3 + length; req.msg.data_len = 3 + length;
@ -1049,7 +1049,7 @@ ipmi_dcmi_discvry_snsr(struct ipmi_intf * intf, uint8_t isnsr, uint8_t offset)
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_DCGRP; req.msg.netfn = IPMI_NETFN_DCGRP;
req.msg.cmd = IPMI_DCMI_GETSNSR; req.msg.cmd = IPMI_DCMI_GET_SENSOR_INFO;
req.msg.data = msg_data; /* Contents above */ req.msg.data = msg_data; /* Contents above */
req.msg.data_len = 5; /* how many times does req.msg.data need to read */ req.msg.data_len = 5; /* how many times does req.msg.data need to read */
@ -1130,7 +1130,7 @@ ipmi_dcmi_pwr_rd(struct ipmi_intf * intf, uint8_t sample_time)
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_DCGRP; req.msg.netfn = IPMI_NETFN_DCGRP;
req.msg.cmd = IPMI_DCMI_GETRED; /* Get power reading */ req.msg.cmd = IPMI_DCMI_GET_PWR_READING; /* Get power reading */
req.msg.data = msg_data; /* msg_data above */ req.msg.data = msg_data; /* msg_data above */
req.msg.data_len = 4; /* how many times does req.msg.data need to read */ req.msg.data_len = 4; /* how many times does req.msg.data need to read */
@ -1190,7 +1190,7 @@ ipmi_dcmi_getthermalpolicy(struct ipmi_intf * intf, uint8_t entityID,
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_DCGRP; req.msg.netfn = IPMI_NETFN_DCGRP;
req.msg.cmd = IPMI_DCMI_GETTERMALLIMIT; /* Get thermal policy reading */ req.msg.cmd = IPMI_DCMI_GET_THERM_LIM; /* Get thermal policy reading */
req.msg.data = msg_data; /* msg_data above */ req.msg.data = msg_data; /* msg_data above */
req.msg.data_len = 3; /* how many times does req.msg.data need to read */ req.msg.data_len = 3; /* how many times does req.msg.data need to read */
@ -1250,7 +1250,7 @@ ipmi_dcmi_setthermalpolicy(struct ipmi_intf * intf,
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_DCGRP; req.msg.netfn = IPMI_NETFN_DCGRP;
/* Get thermal policy reading */ /* Get thermal policy reading */
req.msg.cmd = IPMI_DCMI_SETTERMALLIMIT; req.msg.cmd = IPMI_DCMI_SET_THERM_LIM;
req.msg.data = msg_data; /* msg_data above */ req.msg.data = msg_data; /* msg_data above */
/* how many times does req.msg.data need to read */ /* how many times does req.msg.data need to read */
req.msg.data_len = 7; req.msg.data_len = 7;
@ -1288,7 +1288,7 @@ ipmi_dcmi_get_temp_readings(struct ipmi_intf * intf,
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_DCGRP; req.msg.netfn = IPMI_NETFN_DCGRP;
req.msg.cmd = IPMI_DCMI_GETTEMPRED; /* Get thermal policy reading */ req.msg.cmd = IPMI_DCMI_GET_TEMP;
req.msg.data = msg_data; /* msg_data above */ req.msg.data = msg_data; /* msg_data above */
/* how many times does req.msg.data need to read */ /* how many times does req.msg.data need to read */
req.msg.data_len = 5; req.msg.data_len = 5;
@ -1362,7 +1362,7 @@ ipmi_dcmi_getconfparam(struct ipmi_intf * intf, int param_selector)
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_DCGRP; req.msg.netfn = IPMI_NETFN_DCGRP;
req.msg.cmd = IPMI_DCMI_GETCONFPARAM; /* Get DCMI Config Parameters */ req.msg.cmd = IPMI_DCMI_GET_CONF_PARAM;
req.msg.data = msg_data; /* Contents above */ req.msg.data = msg_data; /* Contents above */
/* how many times does req.msg.data need to read */ /* how many times does req.msg.data need to read */
req.msg.data_len = 3; req.msg.data_len = 3;
@ -1443,7 +1443,7 @@ ipmi_dcmi_setconfparam(struct ipmi_intf * intf, uint8_t param_selector,
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_DCGRP; req.msg.netfn = IPMI_NETFN_DCGRP;
req.msg.cmd = IPMI_DCMI_SETCONFPARAM; /* Set DCMI Config Parameters */ req.msg.cmd = IPMI_DCMI_SET_CONF_PARAM;
req.msg.data = msg_data; /* Contents above */ req.msg.data = msg_data; /* Contents above */
if (param_selector > 3) { if (param_selector > 3) {
/* One bite more */ /* One bite more */
@ -1478,7 +1478,7 @@ struct ipmi_rs * ipmi_dcmi_pwr_glimit(struct ipmi_intf * intf)
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_DCGRP; req.msg.netfn = IPMI_NETFN_DCGRP;
req.msg.cmd = IPMI_DCMI_GETLMT; /* Get power limit */ req.msg.cmd = IPMI_DCMI_GET_PWR_LIM; /* Get power limit */
req.msg.data = msg_data; /* Contents above */ req.msg.data = msg_data; /* Contents above */
/* how many times does req.msg.data need to read */ /* how many times does req.msg.data need to read */
req.msg.data_len = 3; req.msg.data_len = 3;
@ -1722,7 +1722,7 @@ ipmi_dcmi_pwr_slimit(struct ipmi_intf * intf, const char * option,
/* msg_data[13] = 0x03; */ /* msg_data[13] = 0x03; */
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_DCGRP; req.msg.netfn = IPMI_NETFN_DCGRP;
req.msg.cmd = IPMI_DCMI_SETLMT; /* Set power limit */ req.msg.cmd = IPMI_DCMI_SET_PWR_LIM; /* Set power limit */
req.msg.data = msg_data; /* Contents above */ req.msg.data = msg_data; /* Contents above */
/* how many times does req.msg.data need to read */ /* how many times does req.msg.data need to read */
req.msg.data_len = 15; req.msg.data_len = 15;
@ -1755,7 +1755,7 @@ ipmi_dcmi_pwr_actdeact(struct ipmi_intf * intf, uint8_t option)
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
req.msg.netfn = IPMI_NETFN_DCGRP; req.msg.netfn = IPMI_NETFN_DCGRP;
req.msg.cmd = IPMI_DCMI_PWRACT; /* Act-deactivate power limit */ req.msg.cmd = IPMI_DCMI_ACT_PWR_LIM; /* Act-deactivate power limit */
req.msg.data = msg_data; /* Contents above */ req.msg.data = msg_data; /* Contents above */
req.msg.data_len = 4; /* how mant times does req.msg.data need to read */ req.msg.data_len = 4; /* how mant times does req.msg.data need to read */
@ -1793,7 +1793,7 @@ ipmi_dcmi_set_limit(struct ipmi_intf * intf, int argc, char **argv)
req.msg.netfn = IPMI_NETFN_DCGRP; req.msg.netfn = IPMI_NETFN_DCGRP;
req.msg.lun = 0x00; req.msg.lun = 0x00;
req.msg.cmd = IPMI_DCMI_SETLMT; /* Set power limit */ req.msg.cmd = IPMI_DCMI_SET_PWR_LIM; /* Set power limit */
req.msg.data = data; /* Contents above */ req.msg.data = data; /* Contents above */
req.msg.data_len = 15; req.msg.data_len = 15;