diff for duplicates of <567f85a6-3259-e011-2e76-62fbbf1fa23e@linux.intel.com> diff --git a/a/1.txt b/N1/1.txt index 36713ae..f531a09 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -1041,8 +1041,4 @@ On 3/13/2018 2:32 AM, Stef van Os wrote: >> +MODULE_DESCRIPTION("PECI hwmon driver"); >> +MODULE_LICENSE("GPL v2"); >> -> --- -To unsubscribe from this list: send the line "unsubscribe linux-doc" in -the body of a message to majordomo@vger.kernel.org -More majordomo info at http://vger.kernel.org/majordomo-info.html +> diff --git a/a/content_digest b/N1/content_digest index 3c9fd6b..ac6fb70 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -1064,10 +1064,6 @@ ">> +MODULE_DESCRIPTION(\"PECI hwmon driver\");\n" ">> +MODULE_LICENSE(\"GPL v2\");\n" ">>\n" - "> \n" - "--\n" - "To unsubscribe from this list: send the line \"unsubscribe linux-doc\" in\n" - "the body of a message to majordomo@vger.kernel.org\n" - More majordomo info at http://vger.kernel.org/majordomo-info.html + > -a3c66011673d3545aba4635ec01383916b8cc89e57db3e7da574d2b5b67071ff +4b573f5c3ec689783c74a544e08c882565a43aa89962c7542cab68f03c4a053a
diff --git a/a/1.txt b/N2/1.txt index 36713ae..8a1857e 100644 --- a/a/1.txt +++ b/N2/1.txt @@ -41,46 +41,46 @@ On 3/13/2018 2:32 AM, Stef van Os wrote: >> >> Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com> >> --- ->> drivers/hwmon/Kconfig | 10 + ->> drivers/hwmon/Makefile | 1 + ->> drivers/hwmon/peci-hwmon.c | 928 +>> ? drivers/hwmon/Kconfig????? |? 10 + +>> ? drivers/hwmon/Makefile???? |?? 1 + +>> ? drivers/hwmon/peci-hwmon.c | 928 >> +++++++++++++++++++++++++++++++++++++++++++++ ->> 3 files changed, 939 insertions(+) ->> create mode 100644 drivers/hwmon/peci-hwmon.c +>> ? 3 files changed, 939 insertions(+) +>> ? create mode 100644 drivers/hwmon/peci-hwmon.c >> >> diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig >> index ef23553ff5cb..f22e0c31f597 100644 >> --- a/drivers/hwmon/Kconfig >> +++ b/drivers/hwmon/Kconfig >> @@ -1246,6 +1246,16 @@ config SENSORS_NCT7904 ->> This driver can also be built as a module. If so, the module ->> will be called nct7904. +>> ??????? This driver can also be built as a module.? If so, the module +>> ??????? will be called nct7904. >> +config SENSORS_PECI_HWMON ->> + tristate "PECI hwmon support" ->> + depends on PECI ->> + help ->> + If you say yes here you get support for the generic PECI hwmon ->> + driver. +>> +??? tristate "PECI hwmon support" +>> +??? depends on PECI +>> +??? help +>> +????? If you say yes here you get support for the generic PECI hwmon +>> +????? driver. >> + ->> + This driver can also be built as a module. If so, the module ->> + will be called peci-hwmon. +>> +????? This driver can also be built as a module.? If so, the module +>> +????? will be called peci-hwmon. >> + ->> config SENSORS_NSA320 ->> tristate "ZyXEL NSA320 and compatible fan speed and temperature +>> ? config SENSORS_NSA320 +>> ????? tristate "ZyXEL NSA320 and compatible fan speed and temperature >> sensors" ->> depends on GPIOLIB && OF +>> ????? depends on GPIOLIB && OF >> diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile >> index f814b4ace138..946f54b168e5 100644 >> --- a/drivers/hwmon/Makefile >> +++ b/drivers/hwmon/Makefile ->> @@ -135,6 +135,7 @@ obj-$(CONFIG_SENSORS_NCT7802) += nct7802.o ->> obj-$(CONFIG_SENSORS_NCT7904) += nct7904.o ->> obj-$(CONFIG_SENSORS_NSA320) += nsa320-hwmon.o ->> obj-$(CONFIG_SENSORS_NTC_THERMISTOR) += ntc_thermistor.o ->> +obj-$(CONFIG_SENSORS_PECI_HWMON) += peci-hwmon.o ->> obj-$(CONFIG_SENSORS_PC87360) += pc87360.o ->> obj-$(CONFIG_SENSORS_PC87427) += pc87427.o ->> obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o +>> @@ -135,6 +135,7 @@ obj-$(CONFIG_SENSORS_NCT7802)??? += nct7802.o +>> ? obj-$(CONFIG_SENSORS_NCT7904)??? += nct7904.o +>> ? obj-$(CONFIG_SENSORS_NSA320)??? += nsa320-hwmon.o +>> ? obj-$(CONFIG_SENSORS_NTC_THERMISTOR)??? += ntc_thermistor.o +>> +obj-$(CONFIG_SENSORS_PECI_HWMON)??? += peci-hwmon.o +>> ? obj-$(CONFIG_SENSORS_PC87360)??? += pc87360.o +>> ? obj-$(CONFIG_SENSORS_PC87427)??? += pc87427.o +>> ? obj-$(CONFIG_SENSORS_PCF8591)??? += pcf8591.o >> diff --git a/drivers/hwmon/peci-hwmon.c b/drivers/hwmon/peci-hwmon.c >> new file mode 100644 >> index 000000000000..edd27744adcb @@ -99,535 +99,535 @@ On 3/13/2018 2:32 AM, Stef van Os wrote: >> +#include <linux/peci.h> >> +#include <linux/workqueue.h> >> + ->> +#define DIMM_SLOT_NUMS_MAX 12 /* Max DIMM numbers (channel ranks +>> +#define DIMM_SLOT_NUMS_MAX??? 12? /* Max DIMM numbers (channel ranks >> x 2) */ ->> +#define CORE_NUMS_MAX 28 /* Max core numbers (max on SKX +>> +#define CORE_NUMS_MAX???????? 28? /* Max core numbers (max on SKX >> Platinum) */ ->> +#define TEMP_TYPE_PECI 6 /* Sensor type 6: Intel PECI */ +>> +#define TEMP_TYPE_PECI??????? 6?? /* Sensor type 6: Intel PECI */ >> + ->> +#define CORE_TEMP_ATTRS 5 ->> +#define DIMM_TEMP_ATTRS 2 ->> +#define ATTR_NAME_LEN 24 +>> +#define CORE_TEMP_ATTRS?????? 5 +>> +#define DIMM_TEMP_ATTRS?????? 2 +>> +#define ATTR_NAME_LEN???????? 24 >> + >> +#define DEFAULT_ATTR_GRP_NUMS 5 >> + ->> +#define UPDATE_INTERVAL_MIN HZ +>> +#define UPDATE_INTERVAL_MIN?? HZ >> +#define DIMM_MASK_CHECK_DELAY msecs_to_jiffies(5000) >> + >> +enum sign { ->> + POS, ->> + NEG +>> +??? POS, +>> +??? NEG >> +}; >> + >> +struct temp_data { ->> + bool valid; ->> + s32 value; ->> + unsigned long last_updated; +>> +??? bool valid; +>> +??? s32? value; +>> +??? unsigned long last_updated; >> +}; >> + >> +struct temp_group { ->> + struct temp_data tjmax; ->> + struct temp_data tcontrol; ->> + struct temp_data tthrottle; ->> + struct temp_data dts_margin; ->> + struct temp_data die; ->> + struct temp_data core[CORE_NUMS_MAX]; ->> + struct temp_data dimm[DIMM_SLOT_NUMS_MAX]; +>> +??? struct temp_data tjmax; +>> +??? struct temp_data tcontrol; +>> +??? struct temp_data tthrottle; +>> +??? struct temp_data dts_margin; +>> +??? struct temp_data die; +>> +??? struct temp_data core[CORE_NUMS_MAX]; +>> +??? struct temp_data dimm[DIMM_SLOT_NUMS_MAX]; >> +}; >> + >> +struct core_temp_group { ->> + struct sensor_device_attribute sd_attrs[CORE_TEMP_ATTRS]; ->> + char attr_name[CORE_TEMP_ATTRS][ATTR_NAME_LEN]; ->> + struct attribute *attrs[CORE_TEMP_ATTRS + 1]; ->> + struct attribute_group attr_group; +>> +??? struct sensor_device_attribute sd_attrs[CORE_TEMP_ATTRS]; +>> +??? char attr_name[CORE_TEMP_ATTRS][ATTR_NAME_LEN]; +>> +??? struct attribute *attrs[CORE_TEMP_ATTRS + 1]; +>> +??? struct attribute_group attr_group; >> +}; >> + >> +struct dimm_temp_group { ->> + struct sensor_device_attribute sd_attrs[DIMM_TEMP_ATTRS]; ->> + char attr_name[DIMM_TEMP_ATTRS][ATTR_NAME_LEN]; ->> + struct attribute *attrs[DIMM_TEMP_ATTRS + 1]; ->> + struct attribute_group attr_group; +>> +??? struct sensor_device_attribute sd_attrs[DIMM_TEMP_ATTRS]; +>> +??? char attr_name[DIMM_TEMP_ATTRS][ATTR_NAME_LEN]; +>> +??? struct attribute *attrs[DIMM_TEMP_ATTRS + 1]; +>> +??? struct attribute_group attr_group; >> +}; >> + >> +struct peci_hwmon { ->> + struct peci_client *client; ->> + struct device *dev; ->> + struct device *hwmon_dev; ->> + struct workqueue_struct *work_queue; ->> + struct delayed_work work_handler; ->> + char name[PECI_NAME_SIZE]; ->> + struct temp_group temp; ->> + u8 addr; ->> + uint cpu_no; ->> + u32 core_mask; ->> + u32 dimm_mask; ->> + const struct attribute_group *core_attr_groups[CORE_NUMS_MAX + 1]; ->> + const struct attribute_group *dimm_attr_groups[DIMM_SLOT_NUMS_MAX +>> +??? struct peci_client *client; +>> +??? struct device *dev; +>> +??? struct device *hwmon_dev; +>> +??? struct workqueue_struct *work_queue; +>> +??? struct delayed_work work_handler; +>> +??? char name[PECI_NAME_SIZE]; +>> +??? struct temp_group temp; +>> +??? u8 addr; +>> +??? uint cpu_no; +>> +??? u32 core_mask; +>> +??? u32 dimm_mask; +>> +??? const struct attribute_group *core_attr_groups[CORE_NUMS_MAX + 1]; +>> +??? const struct attribute_group *dimm_attr_groups[DIMM_SLOT_NUMS_MAX >> + 1]; ->> + uint global_idx; ->> + uint core_idx; ->> + uint dimm_idx; +>> +??? uint global_idx; +>> +??? uint core_idx; +>> +??? uint dimm_idx; >> +}; >> + >> +enum label { ->> + L_DIE, ->> + L_DTS, ->> + L_TCONTROL, ->> + L_TTHROTTLE, ->> + L_TJMAX, ->> + L_MAX +>> +??? L_DIE, +>> +??? L_DTS, +>> +??? L_TCONTROL, +>> +??? L_TTHROTTLE, +>> +??? L_TJMAX, +>> +??? L_MAX >> +}; >> + >> +static const char *peci_label[L_MAX] = { ->> + "Die\n", ->> + "DTS margin to Tcontrol\n", ->> + "Tcontrol\n", ->> + "Tthrottle\n", ->> + "Tjmax\n", +>> +??? "Die\n", +>> +??? "DTS margin to Tcontrol\n", +>> +??? "Tcontrol\n", +>> +??? "Tthrottle\n", +>> +??? "Tjmax\n", >> +}; >> + >> +static int send_peci_cmd(struct peci_hwmon *priv, enum peci_cmd cmd, >> void *msg) >> +{ ->> + return peci_command(priv->client->adapter, cmd, msg); +>> +??? return peci_command(priv->client->adapter, cmd, msg); >> +} >> + >> +static int need_update(struct temp_data *temp) >> +{ ->> + if (temp->valid && ->> + time_before(jiffies, temp->last_updated + UPDATE_INTERVAL_MIN)) ->> + return 0; +>> +??? if (temp->valid && +>> +??????? time_before(jiffies, temp->last_updated + UPDATE_INTERVAL_MIN)) +>> +??????? return 0; >> + ->> + return 1; +>> +??? return 1; >> +} >> + >> +static s32 ten_dot_six_to_millidegree(s32 x) >> +{ ->> + return ((((x) ^ 0x8000) - 0x8000) * 1000 / 64); +>> +??? return ((((x) ^ 0x8000) - 0x8000) * 1000 / 64); >> +} >> + >> +static int get_tjmax(struct peci_hwmon *priv) >> +{ ->> + struct peci_rd_pkg_cfg_msg msg; ->> + int rc; +>> +??? struct peci_rd_pkg_cfg_msg msg; +>> +??? int rc; >> + ->> + if (!priv->temp.tjmax.valid) { ->> + msg.addr = priv->addr; ->> + msg.index = MBX_INDEX_TEMP_TARGET; ->> + msg.param = 0; ->> + msg.rx_len = 4; +>> +??? if (!priv->temp.tjmax.valid) { +>> +??????? msg.addr = priv->addr; +>> +??????? msg.index = MBX_INDEX_TEMP_TARGET; +>> +??????? msg.param = 0; +>> +??????? msg.rx_len = 4; >> + ->> + rc = send_peci_cmd(priv, PECI_CMD_RD_PKG_CFG, (void *)&msg); ->> + if (rc < 0) ->> + return rc; +>> +??????? rc = send_peci_cmd(priv, PECI_CMD_RD_PKG_CFG, (void *)&msg); +>> +??????? if (rc < 0) +>> +??????????? return rc; >> + ->> + priv->temp.tjmax.value = (s32)msg.pkg_config[2] * 1000; ->> + priv->temp.tjmax.valid = true; ->> + } +>> +??????? priv->temp.tjmax.value = (s32)msg.pkg_config[2] * 1000; +>> +??????? priv->temp.tjmax.valid = true; +>> +??? } >> + ->> + return 0; +>> +??? return 0; >> +} >> + >> +static int get_tcontrol(struct peci_hwmon *priv) >> +{ ->> + struct peci_rd_pkg_cfg_msg msg; ->> + s32 tcontrol_margin; ->> + int rc; +>> +??? struct peci_rd_pkg_cfg_msg msg; +>> +??? s32 tcontrol_margin; +>> +??? int rc; >> + ->> + if (!need_update(&priv->temp.tcontrol)) ->> + return 0; +>> +??? if (!need_update(&priv->temp.tcontrol)) +>> +??????? return 0; >> + ->> + rc = get_tjmax(priv); ->> + if (rc < 0) ->> + return rc; +>> +??? rc = get_tjmax(priv); +>> +??? if (rc < 0) +>> +??????? return rc; >> + ->> + msg.addr = priv->addr; ->> + msg.index = MBX_INDEX_TEMP_TARGET; ->> + msg.param = 0; ->> + msg.rx_len = 4; +>> +??? msg.addr = priv->addr; +>> +??? msg.index = MBX_INDEX_TEMP_TARGET; +>> +??? msg.param = 0; +>> +??? msg.rx_len = 4; >> + ->> + rc = send_peci_cmd(priv, PECI_CMD_RD_PKG_CFG, (void *)&msg); ->> + if (rc < 0) ->> + return rc; +>> +??? rc = send_peci_cmd(priv, PECI_CMD_RD_PKG_CFG, (void *)&msg); +>> +??? if (rc < 0) +>> +??????? return rc; >> + ->> + tcontrol_margin = msg.pkg_config[1]; ->> + tcontrol_margin = ((tcontrol_margin ^ 0x80) - 0x80) * 1000; +>> +??? tcontrol_margin = msg.pkg_config[1]; +>> +??? tcontrol_margin = ((tcontrol_margin ^ 0x80) - 0x80) * 1000; >> + ->> + priv->temp.tcontrol.value = priv->temp.tjmax.value - +>> +??? priv->temp.tcontrol.value = priv->temp.tjmax.value - >> tcontrol_margin; >> + ->> + if (!priv->temp.tcontrol.valid) { ->> + priv->temp.tcontrol.last_updated = INITIAL_JIFFIES; ->> + priv->temp.tcontrol.valid = true; ->> + } else { ->> + priv->temp.tcontrol.last_updated = jiffies; ->> + } +>> +??? if (!priv->temp.tcontrol.valid) { +>> +??????? priv->temp.tcontrol.last_updated = INITIAL_JIFFIES; +>> +??????? priv->temp.tcontrol.valid = true; +>> +??? } else { +>> +??????? priv->temp.tcontrol.last_updated = jiffies; +>> +??? } >> + ->> + return 0; +>> +??? return 0; >> +} >> + >> +static int get_tthrottle(struct peci_hwmon *priv) >> +{ ->> + struct peci_rd_pkg_cfg_msg msg; ->> + s32 tthrottle_offset; ->> + int rc; +>> +??? struct peci_rd_pkg_cfg_msg msg; +>> +??? s32 tthrottle_offset; +>> +??? int rc; >> + ->> + if (!need_update(&priv->temp.tthrottle)) ->> + return 0; +>> +??? if (!need_update(&priv->temp.tthrottle)) +>> +??????? return 0; >> + ->> + rc = get_tjmax(priv); ->> + if (rc < 0) ->> + return rc; +>> +??? rc = get_tjmax(priv); +>> +??? if (rc < 0) +>> +??????? return rc; >> + ->> + msg.addr = priv->addr; ->> + msg.index = MBX_INDEX_TEMP_TARGET; ->> + msg.param = 0; ->> + msg.rx_len = 4; +>> +??? msg.addr = priv->addr; +>> +??? msg.index = MBX_INDEX_TEMP_TARGET; +>> +??? msg.param = 0; +>> +??? msg.rx_len = 4; >> + ->> + rc = send_peci_cmd(priv, PECI_CMD_RD_PKG_CFG, (void *)&msg); ->> + if (rc < 0) ->> + return rc; +>> +??? rc = send_peci_cmd(priv, PECI_CMD_RD_PKG_CFG, (void *)&msg); +>> +??? if (rc < 0) +>> +??????? return rc; >> + ->> + tthrottle_offset = (msg.pkg_config[3] & 0x2f) * 1000; ->> + priv->temp.tthrottle.value = priv->temp.tjmax.value - +>> +??? tthrottle_offset = (msg.pkg_config[3] & 0x2f) * 1000; +>> +??? priv->temp.tthrottle.value = priv->temp.tjmax.value - >> tthrottle_offset; >> + ->> + if (!priv->temp.tthrottle.valid) { ->> + priv->temp.tthrottle.last_updated = INITIAL_JIFFIES; ->> + priv->temp.tthrottle.valid = true; ->> + } else { ->> + priv->temp.tthrottle.last_updated = jiffies; ->> + } +>> +??? if (!priv->temp.tthrottle.valid) { +>> +??????? priv->temp.tthrottle.last_updated = INITIAL_JIFFIES; +>> +??????? priv->temp.tthrottle.valid = true; +>> +??? } else { +>> +??????? priv->temp.tthrottle.last_updated = jiffies; +>> +??? } >> + ->> + return 0; +>> +??? return 0; >> +} >> + >> +static int get_die_temp(struct peci_hwmon *priv) >> +{ ->> + struct peci_get_temp_msg msg; ->> + int rc; +>> +??? struct peci_get_temp_msg msg; +>> +??? int rc; >> + ->> + if (!need_update(&priv->temp.die)) ->> + return 0; +>> +??? if (!need_update(&priv->temp.die)) +>> +??????? return 0; >> + ->> + rc = get_tjmax(priv); ->> + if (rc < 0) ->> + return rc; +>> +??? rc = get_tjmax(priv); +>> +??? if (rc < 0) +>> +??????? return rc; >> + ->> + msg.addr = priv->addr; +>> +??? msg.addr = priv->addr; >> + ->> + rc = send_peci_cmd(priv, PECI_CMD_GET_TEMP, (void *)&msg); ->> + if (rc < 0) ->> + return rc; +>> +??? rc = send_peci_cmd(priv, PECI_CMD_GET_TEMP, (void *)&msg); +>> +??? if (rc < 0) +>> +??????? return rc; >> + ->> + priv->temp.die.value = priv->temp.tjmax.value + ->> + ((s32)msg.temp_raw * 1000 / 64); +>> +??? priv->temp.die.value = priv->temp.tjmax.value + +>> +?????????????????? ((s32)msg.temp_raw * 1000 / 64); >> + ->> + if (!priv->temp.die.valid) { ->> + priv->temp.die.last_updated = INITIAL_JIFFIES; ->> + priv->temp.die.valid = true; ->> + } else { ->> + priv->temp.die.last_updated = jiffies; ->> + } +>> +??? if (!priv->temp.die.valid) { +>> +??????? priv->temp.die.last_updated = INITIAL_JIFFIES; +>> +??????? priv->temp.die.valid = true; +>> +??? } else { +>> +??????? priv->temp.die.last_updated = jiffies; +>> +??? } >> + ->> + return 0; +>> +??? return 0; >> +} >> + >> +static int get_dts_margin(struct peci_hwmon *priv) >> +{ ->> + struct peci_rd_pkg_cfg_msg msg; ->> + s32 dts_margin; ->> + int rc; ->> + ->> + if (!need_update(&priv->temp.dts_margin)) ->> + return 0; ->> + ->> + msg.addr = priv->addr; ->> + msg.index = MBX_INDEX_DTS_MARGIN; ->> + msg.param = 0; ->> + msg.rx_len = 4; ->> + ->> + rc = send_peci_cmd(priv, PECI_CMD_RD_PKG_CFG, (void *)&msg); ->> + if (rc < 0) ->> + return rc; ->> + ->> + dts_margin = (msg.pkg_config[1] << 8) | msg.pkg_config[0]; ->> + ->> + /** ->> + * Processors return a value of DTS reading in 10.6 format ->> + * (10 bits signed decimal, 6 bits fractional). ->> + * Error codes: ->> + * 0x8000: General sensor error ->> + * 0x8001: Reserved ->> + * 0x8002: Underflow on reading value ->> + * 0x8003-0x81ff: Reserved ->> + */ ->> + if (dts_margin >= 0x8000 && dts_margin <= 0x81ff) ->> + return -1; ->> + ->> + dts_margin = ten_dot_six_to_millidegree(dts_margin); ->> + ->> + priv->temp.dts_margin.value = dts_margin; ->> + ->> + if (!priv->temp.dts_margin.valid) { ->> + priv->temp.dts_margin.last_updated = INITIAL_JIFFIES; ->> + priv->temp.dts_margin.valid = true; ->> + } else { ->> + priv->temp.dts_margin.last_updated = jiffies; ->> + } ->> + ->> + return 0; +>> +??? struct peci_rd_pkg_cfg_msg msg; +>> +??? s32 dts_margin; +>> +??? int rc; +>> + +>> +??? if (!need_update(&priv->temp.dts_margin)) +>> +??????? return 0; +>> + +>> +??? msg.addr = priv->addr; +>> +??? msg.index = MBX_INDEX_DTS_MARGIN; +>> +??? msg.param = 0; +>> +??? msg.rx_len = 4; +>> + +>> +??? rc = send_peci_cmd(priv, PECI_CMD_RD_PKG_CFG, (void *)&msg); +>> +??? if (rc < 0) +>> +??????? return rc; +>> + +>> +??? dts_margin = (msg.pkg_config[1] << 8) | msg.pkg_config[0]; +>> + +>> +??? /** +>> +???? * Processors return a value of DTS reading in 10.6 format +>> +???? * (10 bits signed decimal, 6 bits fractional). +>> +???? * Error codes: +>> +???? *?? 0x8000: General sensor error +>> +???? *?? 0x8001: Reserved +>> +???? *?? 0x8002: Underflow on reading value +>> +???? *?? 0x8003-0x81ff: Reserved +>> +???? */ +>> +??? if (dts_margin >= 0x8000 && dts_margin <= 0x81ff) +>> +??????? return -1; +>> + +>> +??? dts_margin = ten_dot_six_to_millidegree(dts_margin); +>> + +>> +??? priv->temp.dts_margin.value = dts_margin; +>> + +>> +??? if (!priv->temp.dts_margin.valid) { +>> +??????? priv->temp.dts_margin.last_updated = INITIAL_JIFFIES; +>> +??????? priv->temp.dts_margin.valid = true; +>> +??? } else { +>> +??????? priv->temp.dts_margin.last_updated = jiffies; +>> +??? } +>> + +>> +??? return 0; >> +} >> + >> +static int get_core_temp(struct peci_hwmon *priv, int core_index) >> +{ ->> + struct peci_rd_pkg_cfg_msg msg; ->> + s32 core_dts_margin; ->> + int rc; ->> + ->> + if (!need_update(&priv->temp.core[core_index])) ->> + return 0; ->> + ->> + rc = get_tjmax(priv); ->> + if (rc < 0) ->> + return rc; ->> + ->> + msg.addr = priv->addr; ->> + msg.index = MBX_INDEX_PER_CORE_DTS_TEMP; ->> + msg.param = core_index; ->> + msg.rx_len = 4; ->> + ->> + rc = send_peci_cmd(priv, PECI_CMD_RD_PKG_CFG, (void *)&msg); ->> + if (rc < 0) ->> + return rc; ->> + ->> + core_dts_margin = (msg.pkg_config[1] << 8) | msg.pkg_config[0]; ->> + ->> + /** ->> + * Processors return a value of the core DTS reading in 10.6 format ->> + * (10 bits signed decimal, 6 bits fractional). ->> + * Error codes: ->> + * 0x8000: General sensor error ->> + * 0x8001: Reserved ->> + * 0x8002: Underflow on reading value ->> + * 0x8003-0x81ff: Reserved ->> + */ ->> + if (core_dts_margin >= 0x8000 && core_dts_margin <= 0x81ff) ->> + return -1; ->> + ->> + core_dts_margin = ten_dot_six_to_millidegree(core_dts_margin); ->> + ->> + priv->temp.core[core_index].value = priv->temp.tjmax.value + ->> + core_dts_margin; ->> + ->> + if (!priv->temp.core[core_index].valid) { ->> + priv->temp.core[core_index].last_updated = INITIAL_JIFFIES; ->> + priv->temp.core[core_index].valid = true; ->> + } else { ->> + priv->temp.core[core_index].last_updated = jiffies; ->> + } ->> + ->> + return 0; +>> +??? struct peci_rd_pkg_cfg_msg msg; +>> +??? s32 core_dts_margin; +>> +??? int rc; +>> + +>> +??? if (!need_update(&priv->temp.core[core_index])) +>> +??????? return 0; +>> + +>> +??? rc = get_tjmax(priv); +>> +??? if (rc < 0) +>> +??????? return rc; +>> + +>> +??? msg.addr = priv->addr; +>> +??? msg.index = MBX_INDEX_PER_CORE_DTS_TEMP; +>> +??? msg.param = core_index; +>> +??? msg.rx_len = 4; +>> + +>> +??? rc = send_peci_cmd(priv, PECI_CMD_RD_PKG_CFG, (void *)&msg); +>> +??? if (rc < 0) +>> +??????? return rc; +>> + +>> +??? core_dts_margin = (msg.pkg_config[1] << 8) | msg.pkg_config[0]; +>> + +>> +??? /** +>> +???? * Processors return a value of the core DTS reading in 10.6 format +>> +???? * (10 bits signed decimal, 6 bits fractional). +>> +???? * Error codes: +>> +???? *?? 0x8000: General sensor error +>> +???? *?? 0x8001: Reserved +>> +???? *?? 0x8002: Underflow on reading value +>> +???? *?? 0x8003-0x81ff: Reserved +>> +???? */ +>> +??? if (core_dts_margin >= 0x8000 && core_dts_margin <= 0x81ff) +>> +??????? return -1; +>> + +>> +??? core_dts_margin = ten_dot_six_to_millidegree(core_dts_margin); +>> + +>> +??? priv->temp.core[core_index].value = priv->temp.tjmax.value + +>> +??????????????????????? core_dts_margin; +>> + +>> +??? if (!priv->temp.core[core_index].valid) { +>> +??????? priv->temp.core[core_index].last_updated = INITIAL_JIFFIES; +>> +??????? priv->temp.core[core_index].valid = true; +>> +??? } else { +>> +??????? priv->temp.core[core_index].last_updated = jiffies; +>> +??? } +>> + +>> +??? return 0; >> +} >> + >> +static int get_dimm_temp(struct peci_hwmon *priv, int dimm_index) >> +{ ->> + struct peci_rd_pkg_cfg_msg msg; ->> + int channel = dimm_index / 2; ->> + int dimm_order = dimm_index % 2; ->> + int rc; +>> +??? struct peci_rd_pkg_cfg_msg msg; +>> +??? int channel = dimm_index / 2; +>> +??? int dimm_order = dimm_index % 2; +>> +??? int rc; >> + ->> + if (!need_update(&priv->temp.dimm[dimm_index])) ->> + return 0; +>> +??? if (!need_update(&priv->temp.dimm[dimm_index])) +>> +??????? return 0; >> + ->> + msg.addr = priv->addr; ->> + msg.index = MBX_INDEX_DDR_DIMM_TEMP; ->> + msg.param = channel; ->> + msg.rx_len = 4; +>> +??? msg.addr = priv->addr; +>> +??? msg.index = MBX_INDEX_DDR_DIMM_TEMP; +>> +??? msg.param = channel; +>> +??? msg.rx_len = 4; >> + ->> + rc = send_peci_cmd(priv, PECI_CMD_RD_PKG_CFG, (void *)&msg); ->> + if (rc < 0) ->> + return rc; +>> +??? rc = send_peci_cmd(priv, PECI_CMD_RD_PKG_CFG, (void *)&msg); +>> +??? if (rc < 0) +>> +??????? return rc; >> + ->> + priv->temp.dimm[dimm_index].value = msg.pkg_config[dimm_order] * +>> +??? priv->temp.dimm[dimm_index].value = msg.pkg_config[dimm_order] * >> 1000; >> + ->> + if (!priv->temp.dimm[dimm_index].valid) { ->> + priv->temp.dimm[dimm_index].last_updated = INITIAL_JIFFIES; ->> + priv->temp.dimm[dimm_index].valid = true; ->> + } else { ->> + priv->temp.dimm[dimm_index].last_updated = jiffies; ->> + } +>> +??? if (!priv->temp.dimm[dimm_index].valid) { +>> +??????? priv->temp.dimm[dimm_index].last_updated = INITIAL_JIFFIES; +>> +??????? priv->temp.dimm[dimm_index].valid = true; +>> +??? } else { +>> +??????? priv->temp.dimm[dimm_index].last_updated = jiffies; +>> +??? } >> + ->> + return 0; +>> +??? return 0; >> +} >> + >> +static ssize_t show_tcontrol(struct device *dev, ->> + struct device_attribute *attr, ->> + char *buf) +>> +???????????????? struct device_attribute *attr, +>> +???????????????? char *buf) >> +{ ->> + struct peci_hwmon *priv = dev_get_drvdata(dev); ->> + int rc; +>> +??? struct peci_hwmon *priv = dev_get_drvdata(dev); +>> +??? int rc; >> + ->> + rc = get_tcontrol(priv); ->> + if (rc < 0) ->> + return rc; +>> +??? rc = get_tcontrol(priv); +>> +??? if (rc < 0) +>> +??????? return rc; >> + ->> + return sprintf(buf, "%d\n", priv->temp.tcontrol.value); +>> +??? return sprintf(buf, "%d\n", priv->temp.tcontrol.value); >> +} >> + >> +static ssize_t show_tcontrol_margin(struct device *dev, ->> + struct device_attribute *attr, ->> + char *buf) +>> +??????????????????? struct device_attribute *attr, +>> +??????????????????? char *buf) >> +{ ->> + struct peci_hwmon *priv = dev_get_drvdata(dev); ->> + struct sensor_device_attribute *sensor_attr = +>> +??? struct peci_hwmon *priv = dev_get_drvdata(dev); +>> +??? struct sensor_device_attribute *sensor_attr = >> to_sensor_dev_attr(attr); ->> + int rc; +>> +??? int rc; >> + ->> + rc = get_tcontrol(priv); ->> + if (rc < 0) ->> + return rc; +>> +??? rc = get_tcontrol(priv); +>> +??? if (rc < 0) +>> +??????? return rc; >> + ->> + return sprintf(buf, "%d\n", sensor_attr->index == POS ? ->> + priv->temp.tjmax.value - ->> + priv->temp.tcontrol.value : ->> + priv->temp.tcontrol.value - ->> + priv->temp.tjmax.value); +>> +??? return sprintf(buf, "%d\n", sensor_attr->index == POS ? +>> +??????????????????? priv->temp.tjmax.value - +>> +??????????????????? priv->temp.tcontrol.value : +>> +??????????????????? priv->temp.tcontrol.value - +>> +??????????????????? priv->temp.tjmax.value); >> +} >> + >> +static ssize_t show_tthrottle(struct device *dev, ->> + struct device_attribute *attr, ->> + char *buf) +>> +????????????????? struct device_attribute *attr, +>> +????????????????? char *buf) >> +{ ->> + struct peci_hwmon *priv = dev_get_drvdata(dev); ->> + int rc; +>> +??? struct peci_hwmon *priv = dev_get_drvdata(dev); +>> +??? int rc; >> + ->> + rc = get_tthrottle(priv); ->> + if (rc < 0) ->> + return rc; +>> +??? rc = get_tthrottle(priv); +>> +??? if (rc < 0) +>> +??????? return rc; >> + ->> + return sprintf(buf, "%d\n", priv->temp.tthrottle.value); +>> +??? return sprintf(buf, "%d\n", priv->temp.tthrottle.value); >> +} >> + >> +static ssize_t show_tjmax(struct device *dev, ->> + struct device_attribute *attr, ->> + char *buf) +>> +????????????? struct device_attribute *attr, +>> +????????????? char *buf) >> +{ ->> + struct peci_hwmon *priv = dev_get_drvdata(dev); ->> + int rc; +>> +??? struct peci_hwmon *priv = dev_get_drvdata(dev); +>> +??? int rc; >> + ->> + rc = get_tjmax(priv); ->> + if (rc < 0) ->> + return rc; +>> +??? rc = get_tjmax(priv); +>> +??? if (rc < 0) +>> +??????? return rc; >> + ->> + return sprintf(buf, "%d\n", priv->temp.tjmax.value); +>> +??? return sprintf(buf, "%d\n", priv->temp.tjmax.value); >> +} >> + >> +static ssize_t show_die_temp(struct device *dev, ->> + struct device_attribute *attr, ->> + char *buf) +>> +???????????????? struct device_attribute *attr, +>> +???????????????? char *buf) >> +{ ->> + struct peci_hwmon *priv = dev_get_drvdata(dev); ->> + int rc; +>> +??? struct peci_hwmon *priv = dev_get_drvdata(dev); +>> +??? int rc; >> + ->> + rc = get_die_temp(priv); ->> + if (rc < 0) ->> + return rc; +>> +??? rc = get_die_temp(priv); +>> +??? if (rc < 0) +>> +??????? return rc; >> + ->> + return sprintf(buf, "%d\n", priv->temp.die.value); +>> +??? return sprintf(buf, "%d\n", priv->temp.die.value); >> +} >> + >> +static ssize_t show_dts_margin(struct device *dev, ->> + struct device_attribute *attr, ->> + char *buf) +>> +?????????????????? struct device_attribute *attr, +>> +?????????????????? char *buf) >> +{ ->> + struct peci_hwmon *priv = dev_get_drvdata(dev); ->> + int rc; +>> +??? struct peci_hwmon *priv = dev_get_drvdata(dev); +>> +??? int rc; >> + ->> + rc = get_dts_margin(priv); ->> + if (rc < 0) ->> + return rc; +>> +??? rc = get_dts_margin(priv); +>> +??? if (rc < 0) +>> +??????? return rc; >> + ->> + return sprintf(buf, "%d\n", priv->temp.dts_margin.value); +>> +??? return sprintf(buf, "%d\n", priv->temp.dts_margin.value); >> +} >> + >> +static ssize_t show_core_temp(struct device *dev, ->> + struct device_attribute *attr, ->> + char *buf) +>> +????????????????? struct device_attribute *attr, +>> +????????????????? char *buf) >> +{ ->> + struct peci_hwmon *priv = dev_get_drvdata(dev); ->> + struct sensor_device_attribute *sensor_attr = +>> +??? struct peci_hwmon *priv = dev_get_drvdata(dev); +>> +??? struct sensor_device_attribute *sensor_attr = >> to_sensor_dev_attr(attr); ->> + int core_index = sensor_attr->index; ->> + int rc; +>> +??? int core_index = sensor_attr->index; +>> +??? int rc; >> + ->> + rc = get_core_temp(priv, core_index); ->> + if (rc < 0) ->> + return rc; +>> +??? rc = get_core_temp(priv, core_index); +>> +??? if (rc < 0) +>> +??????? return rc; >> + ->> + return sprintf(buf, "%d\n", priv->temp.core[core_index].value); +>> +??? return sprintf(buf, "%d\n", priv->temp.core[core_index].value); >> +} >> + >> +static ssize_t show_dimm_temp(struct device *dev, ->> + struct device_attribute *attr, ->> + char *buf) +>> +????????????????? struct device_attribute *attr, +>> +????????????????? char *buf) >> +{ ->> + struct peci_hwmon *priv = dev_get_drvdata(dev); ->> + struct sensor_device_attribute *sensor_attr = +>> +??? struct peci_hwmon *priv = dev_get_drvdata(dev); +>> +??? struct sensor_device_attribute *sensor_attr = >> to_sensor_dev_attr(attr); ->> + int dimm_index = sensor_attr->index; ->> + int rc; +>> +??? int dimm_index = sensor_attr->index; +>> +??? int rc; >> + ->> + rc = get_dimm_temp(priv, dimm_index); ->> + if (rc < 0) ->> + return rc; +>> +??? rc = get_dimm_temp(priv, dimm_index); +>> +??? if (rc < 0) +>> +??????? return rc; >> + ->> + return sprintf(buf, "%d\n", priv->temp.dimm[dimm_index].value); +>> +??? return sprintf(buf, "%d\n", priv->temp.dimm[dimm_index].value); >> +} >> + >> +static ssize_t show_value(struct device *dev, ->> + struct device_attribute *attr, ->> + char *buf) +>> +????????????? struct device_attribute *attr, +>> +????????????? char *buf) >> +{ ->> + struct sensor_device_attribute *sensor_attr = +>> +??? struct sensor_device_attribute *sensor_attr = >> to_sensor_dev_attr(attr); >> + ->> + return sprintf(buf, "%d\n", sensor_attr->index); +>> +??? return sprintf(buf, "%d\n", sensor_attr->index); >> +} >> + >> +static ssize_t show_label(struct device *dev, ->> + struct device_attribute *attr, ->> + char *buf) +>> +????????????? struct device_attribute *attr, +>> +????????????? char *buf) >> +{ ->> + struct sensor_device_attribute *sensor_attr = +>> +??? struct sensor_device_attribute *sensor_attr = >> to_sensor_dev_attr(attr); >> + ->> + return sprintf(buf, peci_label[sensor_attr->index]); +>> +??? return sprintf(buf, peci_label[sensor_attr->index]); >> +} >> + >> +static ssize_t show_core_label(struct device *dev, ->> + struct device_attribute *attr, ->> + char *buf) +>> +?????????????????? struct device_attribute *attr, +>> +?????????????????? char *buf) >> +{ ->> + struct sensor_device_attribute *sensor_attr = +>> +??? struct sensor_device_attribute *sensor_attr = >> to_sensor_dev_attr(attr); >> + ->> + return sprintf(buf, "Core %d\n", sensor_attr->index); +>> +??? return sprintf(buf, "Core %d\n", sensor_attr->index); >> +} >> + >> +static ssize_t show_dimm_label(struct device *dev, ->> + struct device_attribute *attr, ->> + char *buf) +>> +?????????????????? struct device_attribute *attr, +>> +?????????????????? char *buf) >> +{ ->> + struct sensor_device_attribute *sensor_attr = +>> +??? struct sensor_device_attribute *sensor_attr = >> to_sensor_dev_attr(attr); >> + ->> + char channel = 'A' + (sensor_attr->index / 2); ->> + int index = sensor_attr->index % 2; +>> +??? char channel = 'A' + (sensor_attr->index / 2); +>> +??? int index = sensor_attr->index % 2; >> + ->> + return sprintf(buf, "DIMM %d (%c%d)\n", ->> + sensor_attr->index, channel, index); +>> +??? return sprintf(buf, "DIMM %d (%c%d)\n", +>> +?????????????? sensor_attr->index, channel, index); >> +} >> + >> +/* Die temperature */ @@ -637,19 +637,19 @@ On 3/13/2018 2:32 AM, Stef van Os wrote: >> +static SENSOR_DEVICE_ATTR(temp1_crit, 0444, show_tjmax, NULL, 0); >> +static SENSOR_DEVICE_ATTR(temp1_crit_hyst, 0444, >> show_tcontrol_margin, NULL, ->> + POS); +>> +????????????? POS); >> + >> +static struct attribute *die_temp_attrs[] = { ->> + &sensor_dev_attr_temp1_label.dev_attr.attr, ->> + &sensor_dev_attr_temp1_input.dev_attr.attr, ->> + &sensor_dev_attr_temp1_max.dev_attr.attr, ->> + &sensor_dev_attr_temp1_crit.dev_attr.attr, ->> + &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr, ->> + NULL +>> +??? &sensor_dev_attr_temp1_label.dev_attr.attr, +>> +??? &sensor_dev_attr_temp1_input.dev_attr.attr, +>> +??? &sensor_dev_attr_temp1_max.dev_attr.attr, +>> +??? &sensor_dev_attr_temp1_crit.dev_attr.attr, +>> +??? &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr, +>> +??? NULL >> +}; >> + >> +static struct attribute_group die_temp_attr_group = { ->> + .attrs = die_temp_attrs, +>> +??? .attrs = die_temp_attrs, >> +}; >> + >> +/* DTS margin temperature */ @@ -660,15 +660,15 @@ On 3/13/2018 2:32 AM, Stef van Os wrote: >> NULL, NEG); >> + >> +static struct attribute *dts_margin_temp_attrs[] = { ->> + &sensor_dev_attr_temp2_label.dev_attr.attr, ->> + &sensor_dev_attr_temp2_input.dev_attr.attr, ->> + &sensor_dev_attr_temp2_min.dev_attr.attr, ->> + &sensor_dev_attr_temp2_lcrit.dev_attr.attr, ->> + NULL +>> +??? &sensor_dev_attr_temp2_label.dev_attr.attr, +>> +??? &sensor_dev_attr_temp2_input.dev_attr.attr, +>> +??? &sensor_dev_attr_temp2_min.dev_attr.attr, +>> +??? &sensor_dev_attr_temp2_lcrit.dev_attr.attr, +>> +??? NULL >> +}; >> + >> +static struct attribute_group dts_margin_temp_attr_group = { ->> + .attrs = dts_margin_temp_attrs, +>> +??? .attrs = dts_margin_temp_attrs, >> +}; >> + >> +/* Tcontrol temperature */ @@ -678,14 +678,14 @@ On 3/13/2018 2:32 AM, Stef van Os wrote: >> +static SENSOR_DEVICE_ATTR(temp3_crit, 0444, show_tjmax, NULL, 0); >> + >> +static struct attribute *tcontrol_temp_attrs[] = { ->> + &sensor_dev_attr_temp3_label.dev_attr.attr, ->> + &sensor_dev_attr_temp3_input.dev_attr.attr, ->> + &sensor_dev_attr_temp3_crit.dev_attr.attr, ->> + NULL +>> +??? &sensor_dev_attr_temp3_label.dev_attr.attr, +>> +??? &sensor_dev_attr_temp3_input.dev_attr.attr, +>> +??? &sensor_dev_attr_temp3_crit.dev_attr.attr, +>> +??? NULL >> +}; >> + >> +static struct attribute_group tcontrol_temp_attr_group = { ->> + .attrs = tcontrol_temp_attrs, +>> +??? .attrs = tcontrol_temp_attrs, >> +}; >> + >> +/* Tthrottle temperature */ @@ -694,13 +694,13 @@ On 3/13/2018 2:32 AM, Stef van Os wrote: >> +static SENSOR_DEVICE_ATTR(temp4_input, 0444, show_tthrottle, NULL, 0); >> + >> +static struct attribute *tthrottle_temp_attrs[] = { ->> + &sensor_dev_attr_temp4_label.dev_attr.attr, ->> + &sensor_dev_attr_temp4_input.dev_attr.attr, ->> + NULL +>> +??? &sensor_dev_attr_temp4_label.dev_attr.attr, +>> +??? &sensor_dev_attr_temp4_input.dev_attr.attr, +>> +??? NULL >> +}; >> + >> +static struct attribute_group tthrottle_temp_attr_group = { ->> + .attrs = tthrottle_temp_attrs, +>> +??? .attrs = tthrottle_temp_attrs, >> +}; >> + >> +/* Tjmax temperature */ @@ -708,332 +708,332 @@ On 3/13/2018 2:32 AM, Stef van Os wrote: >> +static SENSOR_DEVICE_ATTR(temp5_input, 0444, show_tjmax, NULL, 0); >> + >> +static struct attribute *tjmax_temp_attrs[] = { ->> + &sensor_dev_attr_temp5_label.dev_attr.attr, ->> + &sensor_dev_attr_temp5_input.dev_attr.attr, ->> + NULL +>> +??? &sensor_dev_attr_temp5_label.dev_attr.attr, +>> +??? &sensor_dev_attr_temp5_input.dev_attr.attr, +>> +??? NULL >> +}; >> + >> +static struct attribute_group tjmax_temp_attr_group = { ->> + .attrs = tjmax_temp_attrs, +>> +??? .attrs = tjmax_temp_attrs, >> +}; >> + >> +static const struct attribute_group * >> +default_attr_groups[DEFAULT_ATTR_GRP_NUMS + 1] = { ->> + &die_temp_attr_group, ->> + &dts_margin_temp_attr_group, ->> + &tcontrol_temp_attr_group, ->> + &tthrottle_temp_attr_group, ->> + &tjmax_temp_attr_group, ->> + NULL +>> +??? &die_temp_attr_group, +>> +??? &dts_margin_temp_attr_group, +>> +??? &tcontrol_temp_attr_group, +>> +??? &tthrottle_temp_attr_group, +>> +??? &tjmax_temp_attr_group, +>> +??? NULL >> +}; >> + >> +/* Core temperature */ >> +static ssize_t (*const core_show_fn[CORE_TEMP_ATTRS]) (struct device >> *dev, ->> + struct device_attribute *devattr, char *buf) = { ->> + show_core_label, ->> + show_core_temp, ->> + show_tcontrol, ->> + show_tjmax, ->> + show_tcontrol_margin, +>> +??????? struct device_attribute *devattr, char *buf) = { +>> +??? show_core_label, +>> +??? show_core_temp, +>> +??? show_tcontrol, +>> +??? show_tjmax, +>> +??? show_tcontrol_margin, >> +}; >> + >> +static const char *const core_suffix[CORE_TEMP_ATTRS] = { ->> + "label", ->> + "input", ->> + "max", ->> + "crit", ->> + "crit_hyst", +>> +??? "label", +>> +??? "input", +>> +??? "max", +>> +??? "crit", +>> +??? "crit_hyst", >> +}; >> + >> +static int check_resolved_cores(struct peci_hwmon *priv) >> +{ ->> + struct peci_rd_pci_cfg_local_msg msg; ->> + int rc; +>> +??? struct peci_rd_pci_cfg_local_msg msg; +>> +??? int rc; >> + ->> + if (!(priv->client->adapter->cmd_mask & +>> +??? if (!(priv->client->adapter->cmd_mask & >> BIT(PECI_CMD_RD_PCI_CFG_LOCAL))) ->> + return -EINVAL; +>> +??????? return -EINVAL; >> + ->> + /* Get the RESOLVED_CORES register value */ ->> + msg.addr = priv->addr; ->> + msg.bus = 1; ->> + msg.device = 30; ->> + msg.function = 3; ->> + msg.reg = 0xB4; ->> + msg.rx_len = 4; +>> +??? /* Get the RESOLVED_CORES register value */ +>> +??? msg.addr = priv->addr; +>> +??? msg.bus = 1; +>> +??? msg.device = 30; +>> +??? msg.function = 3; +>> +??? msg.reg = 0xB4; +>> +??? msg.rx_len = 4; >> + ->> + rc = send_peci_cmd(priv, PECI_CMD_RD_PCI_CFG_LOCAL, (void *)&msg); ->> + if (rc < 0) ->> + return rc; +>> +??? rc = send_peci_cmd(priv, PECI_CMD_RD_PCI_CFG_LOCAL, (void *)&msg); +>> +??? if (rc < 0) +>> +??????? return rc; >> + ->> + priv->core_mask = msg.pci_config[3] << 24 | ->> + msg.pci_config[2] << 16 | ->> + msg.pci_config[1] << 8 | ->> + msg.pci_config[0]; +>> +??? priv->core_mask = msg.pci_config[3] << 24 | +>> +????????????? msg.pci_config[2] << 16 | +>> +????????????? msg.pci_config[1] << 8 | +>> +????????????? msg.pci_config[0]; >> + ->> + if (!priv->core_mask) ->> + return -EAGAIN; +>> +??? if (!priv->core_mask) +>> +??????? return -EAGAIN; >> + ->> + dev_dbg(priv->dev, "Scanned resolved cores: 0x%x\n", +>> +??? dev_dbg(priv->dev, "Scanned resolved cores: 0x%x\n", >> priv->core_mask); ->> + return 0; +>> +??? return 0; >> +} >> + >> +static int create_core_temp_group(struct peci_hwmon *priv, int core_no) >> +{ ->> + struct core_temp_group *data; ->> + int i; ->> + ->> + data = devm_kzalloc(priv->dev, sizeof(struct core_temp_group), ->> + GFP_KERNEL); ->> + if (!data) ->> + return -ENOMEM; ->> + ->> + for (i = 0; i < CORE_TEMP_ATTRS; i++) { ->> + snprintf(data->attr_name[i], ATTR_NAME_LEN, ->> + "temp%d_%s", priv->global_idx, core_suffix[i]); ->> + sysfs_attr_init(&data->sd_attrs[i].dev_attr.attr); ->> + data->sd_attrs[i].dev_attr.attr.name = data->attr_name[i]; ->> + data->sd_attrs[i].dev_attr.attr.mode = 0444; ->> + data->sd_attrs[i].dev_attr.show = core_show_fn[i]; ->> + if (i == 0 || i == 1) /* label or temp */ ->> + data->sd_attrs[i].index = core_no; ->> + data->attrs[i] = &data->sd_attrs[i].dev_attr.attr; ->> + } ->> + ->> + data->attr_group.attrs = data->attrs; ->> + priv->core_attr_groups[priv->core_idx++] = &data->attr_group; ->> + priv->global_idx++; ->> + ->> + return 0; +>> +??? struct core_temp_group *data; +>> +??? int i; +>> + +>> +??? data = devm_kzalloc(priv->dev, sizeof(struct core_temp_group), +>> +??????????????? GFP_KERNEL); +>> +??? if (!data) +>> +??????? return -ENOMEM; +>> + +>> +??? for (i = 0; i < CORE_TEMP_ATTRS; i++) { +>> +??????? snprintf(data->attr_name[i], ATTR_NAME_LEN, +>> +???????????? "temp%d_%s", priv->global_idx, core_suffix[i]); +>> +??????? sysfs_attr_init(&data->sd_attrs[i].dev_attr.attr); +>> +??????? data->sd_attrs[i].dev_attr.attr.name = data->attr_name[i]; +>> +??????? data->sd_attrs[i].dev_attr.attr.mode = 0444; +>> +??????? data->sd_attrs[i].dev_attr.show = core_show_fn[i]; +>> +??????? if (i == 0 || i == 1) /* label or temp */ +>> +??????????? data->sd_attrs[i].index = core_no; +>> +??????? data->attrs[i] = &data->sd_attrs[i].dev_attr.attr; +>> +??? } +>> + +>> +??? data->attr_group.attrs = data->attrs; +>> +??? priv->core_attr_groups[priv->core_idx++] = &data->attr_group; +>> +??? priv->global_idx++; +>> + +>> +??? return 0; >> +} >> + >> +static int create_core_temp_groups(struct peci_hwmon *priv) >> +{ ->> + int rc, i; ->> + ->> + rc = check_resolved_cores(priv); ->> + if (!rc) { ->> + for (i = 0; i < CORE_NUMS_MAX; i++) { ->> + if (priv->core_mask & BIT(i)) { ->> + rc = create_core_temp_group(priv, i); ->> + if (rc) ->> + return rc; ->> + } ->> + } ->> + ->> + rc = sysfs_create_groups(&priv->hwmon_dev->kobj, ->> + priv->core_attr_groups); ->> + } ->> + ->> + return rc; +>> +??? int rc, i; +>> + +>> +??? rc = check_resolved_cores(priv); +>> +??? if (!rc) { +>> +??????? for (i = 0; i < CORE_NUMS_MAX; i++) { +>> +??????????? if (priv->core_mask & BIT(i)) { +>> +??????????????? rc = create_core_temp_group(priv, i); +>> +??????????????? if (rc) +>> +??????????????????? return rc; +>> +??????????? } +>> +??????? } +>> + +>> +??????? rc = sysfs_create_groups(&priv->hwmon_dev->kobj, +>> +???????????????????? priv->core_attr_groups); +>> +??? } +>> + +>> +??? return rc; >> +} >> + >> +/* DIMM temperature */ >> +static ssize_t (*const dimm_show_fn[DIMM_TEMP_ATTRS]) (struct device >> *dev, ->> + struct device_attribute *devattr, char *buf) = { ->> + show_dimm_label, ->> + show_dimm_temp, +>> +??????? struct device_attribute *devattr, char *buf) = { +>> +??? show_dimm_label, +>> +??? show_dimm_temp, >> +}; >> + >> +static const char *const dimm_suffix[DIMM_TEMP_ATTRS] = { ->> + "label", ->> + "input", +>> +??? "label", +>> +??? "input", >> +}; >> + >> +static int check_populated_dimms(struct peci_hwmon *priv) >> +{ ->> + struct peci_rd_pkg_cfg_msg msg; ->> + int i, rc, pass = 0; +>> +??? struct peci_rd_pkg_cfg_msg msg; +>> +??? int i, rc, pass = 0; >> + >> +do_scan: ->> + for (i = 0; i < (DIMM_SLOT_NUMS_MAX / 2); i++) { ->> + msg.addr = priv->addr; ->> + msg.index = MBX_INDEX_DDR_DIMM_TEMP; ->> + msg.param = i; /* channel */ ->> + msg.rx_len = 4; +>> +??? for (i = 0; i < (DIMM_SLOT_NUMS_MAX / 2); i++) { +>> +??????? msg.addr = priv->addr; +>> +??????? msg.index = MBX_INDEX_DDR_DIMM_TEMP; +>> +??????? msg.param = i; /* channel */ +>> +??????? msg.rx_len = 4; >> + ->> + rc = send_peci_cmd(priv, PECI_CMD_RD_PKG_CFG, (void *)&msg); ->> + if (rc < 0) ->> + return rc; +>> +??????? rc = send_peci_cmd(priv, PECI_CMD_RD_PKG_CFG, (void *)&msg); +>> +??????? if (rc < 0) +>> +??????????? return rc; >> + ->> + if (msg.pkg_config[0]) /* DIMM #0 on the channel */ ->> + priv->dimm_mask |= BIT(i); +>> +??????? if (msg.pkg_config[0]) /* DIMM #0 on the channel */ +>> +??????????? priv->dimm_mask |= BIT(i); >> + ->> + if (msg.pkg_config[1]) /* DIMM #1 on the channel */ ->> + priv->dimm_mask |= BIT(i + 1); ->> + } +>> +??????? if (msg.pkg_config[1]) /* DIMM #1 on the channel */ +>> +??????????? priv->dimm_mask |= BIT(i + 1); +>> +??? } >> + ->> + /* Do 2-pass scanning */ ->> + if (priv->dimm_mask && pass == 0) { ->> + pass++; ->> + goto do_scan; ->> + } +>> +??? /* Do 2-pass scanning */ +>> +??? if (priv->dimm_mask && pass == 0) { +>> +??????? pass++; +>> +??????? goto do_scan; +>> +??? } >> + ->> + if (!priv->dimm_mask) ->> + return -EAGAIN; +>> +??? if (!priv->dimm_mask) +>> +??????? return -EAGAIN; >> + ->> + dev_dbg(priv->dev, "Scanned populated DIMMs: 0x%x\n", +>> +??? dev_dbg(priv->dev, "Scanned populated DIMMs: 0x%x\n", >> priv->dimm_mask); ->> + return 0; +>> +??? return 0; >> +} >> + >> +static int create_dimm_temp_group(struct peci_hwmon *priv, int dimm_no) >> +{ ->> + struct dimm_temp_group *data; ->> + int i; ->> + ->> + data = devm_kzalloc(priv->dev, sizeof(struct dimm_temp_group), ->> + GFP_KERNEL); ->> + if (!data) ->> + return -ENOMEM; ->> + ->> + for (i = 0; i < DIMM_TEMP_ATTRS; i++) { ->> + snprintf(data->attr_name[i], ATTR_NAME_LEN, ->> + "temp%d_%s", priv->global_idx, dimm_suffix[i]); ->> + sysfs_attr_init(&data->sd_attrs[i].dev_attr.attr); ->> + data->sd_attrs[i].dev_attr.attr.name = data->attr_name[i]; ->> + data->sd_attrs[i].dev_attr.attr.mode = 0444; ->> + data->sd_attrs[i].dev_attr.show = dimm_show_fn[i]; ->> + data->sd_attrs[i].index = dimm_no; ->> + data->attrs[i] = &data->sd_attrs[i].dev_attr.attr; ->> + } ->> + ->> + data->attr_group.attrs = data->attrs; ->> + priv->dimm_attr_groups[priv->dimm_idx++] = &data->attr_group; ->> + priv->global_idx++; ->> + ->> + return 0; +>> +??? struct dimm_temp_group *data; +>> +??? int i; +>> + +>> +??? data = devm_kzalloc(priv->dev, sizeof(struct dimm_temp_group), +>> +??????????????? GFP_KERNEL); +>> +??? if (!data) +>> +??????? return -ENOMEM; +>> + +>> +??? for (i = 0; i < DIMM_TEMP_ATTRS; i++) { +>> +??????? snprintf(data->attr_name[i], ATTR_NAME_LEN, +>> +???????????? "temp%d_%s", priv->global_idx, dimm_suffix[i]); +>> +??????? sysfs_attr_init(&data->sd_attrs[i].dev_attr.attr); +>> +??????? data->sd_attrs[i].dev_attr.attr.name = data->attr_name[i]; +>> +??????? data->sd_attrs[i].dev_attr.attr.mode = 0444; +>> +??????? data->sd_attrs[i].dev_attr.show = dimm_show_fn[i]; +>> +??????? data->sd_attrs[i].index = dimm_no; +>> +??????? data->attrs[i] = &data->sd_attrs[i].dev_attr.attr; +>> +??? } +>> + +>> +??? data->attr_group.attrs = data->attrs; +>> +??? priv->dimm_attr_groups[priv->dimm_idx++] = &data->attr_group; +>> +??? priv->global_idx++; +>> + +>> +??? return 0; >> +} >> + >> +static int create_dimm_temp_groups(struct peci_hwmon *priv) >> +{ ->> + int rc, i; ->> + ->> + rc = check_populated_dimms(priv); ->> + if (!rc) { ->> + for (i = 0; i < DIMM_SLOT_NUMS_MAX; i++) { ->> + if (priv->dimm_mask & BIT(i)) { ->> + rc = create_dimm_temp_group(priv, i); ->> + if (rc) ->> + return rc; ->> + } ->> + } ->> + ->> + rc = sysfs_create_groups(&priv->hwmon_dev->kobj, ->> + priv->dimm_attr_groups); ->> + if (!rc) ->> + dev_dbg(priv->dev, "Done DIMM temp group creation\n"); ->> + } else if (rc == -EAGAIN) { ->> + queue_delayed_work(priv->work_queue, &priv->work_handler, ->> + DIMM_MASK_CHECK_DELAY); ->> + dev_dbg(priv->dev, "Diferred DIMM temp group creation\n"); ->> + } ->> + ->> + return rc; +>> +??? int rc, i; +>> + +>> +??? rc = check_populated_dimms(priv); +>> +??? if (!rc) { +>> +??????? for (i = 0; i < DIMM_SLOT_NUMS_MAX; i++) { +>> +??????????? if (priv->dimm_mask & BIT(i)) { +>> +??????????????? rc = create_dimm_temp_group(priv, i); +>> +??????????????? if (rc) +>> +??????????????????? return rc; +>> +??????????? } +>> +??????? } +>> + +>> +??????? rc = sysfs_create_groups(&priv->hwmon_dev->kobj, +>> +???????????????????? priv->dimm_attr_groups); +>> +??????? if (!rc) +>> +??????????? dev_dbg(priv->dev, "Done DIMM temp group creation\n"); +>> +??? } else if (rc == -EAGAIN) { +>> +??????? queue_delayed_work(priv->work_queue, &priv->work_handler, +>> +?????????????????? DIMM_MASK_CHECK_DELAY); +>> +??????? dev_dbg(priv->dev, "Diferred DIMM temp group creation\n"); +>> +??? } +>> + +>> +??? return rc; >> +} >> + >> +static void create_dimm_temp_groups_delayed(struct work_struct *work) >> +{ ->> + struct delayed_work *dwork = to_delayed_work(work); ->> + struct peci_hwmon *priv = container_of(dwork, struct peci_hwmon, ->> + work_handler); ->> + int rc; ->> + ->> + rc = create_dimm_temp_groups(priv); ->> + if (rc && rc != -EAGAIN) ->> + dev_dbg(priv->dev, "Skipped to creat DIMM temp groups\n"); +>> +??? struct delayed_work *dwork = to_delayed_work(work); +>> +??? struct peci_hwmon *priv = container_of(dwork, struct peci_hwmon, +>> +?????????????????????????? work_handler); +>> +??? int rc; +>> + +>> +??? rc = create_dimm_temp_groups(priv); +>> +??? if (rc && rc != -EAGAIN) +>> +??????? dev_dbg(priv->dev, "Skipped to creat DIMM temp groups\n"); >> +} >> + >> +static int peci_hwmon_probe(struct peci_client *client) >> +{ ->> + struct device *dev = &client->dev; ->> + struct peci_hwmon *priv; ->> + int rc; ->> + ->> + if ((client->adapter->cmd_mask & ->> + (BIT(PECI_CMD_GET_TEMP) | BIT(PECI_CMD_RD_PKG_CFG))) != ->> + (BIT(PECI_CMD_GET_TEMP) | BIT(PECI_CMD_RD_PKG_CFG))) { ->> + dev_err(dev, "Client doesn't support temperature monitoring\n"); ->> + return -EINVAL; ->> + } ->> + ->> + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); ->> + if (!priv) ->> + return -ENOMEM; ->> + ->> + dev_set_drvdata(dev, priv); ->> + priv->client = client; ->> + priv->dev = dev; ->> + priv->addr = client->addr; ->> + priv->cpu_no = priv->addr - PECI_BASE_ADDR; ->> + ->> + snprintf(priv->name, PECI_NAME_SIZE, "peci_hwmon.cpu%d", +>> +??? struct device *dev = &client->dev; +>> +??? struct peci_hwmon *priv; +>> +??? int rc; +>> + +>> +??? if ((client->adapter->cmd_mask & +>> +??????? (BIT(PECI_CMD_GET_TEMP) | BIT(PECI_CMD_RD_PKG_CFG))) != +>> +??????? (BIT(PECI_CMD_GET_TEMP) | BIT(PECI_CMD_RD_PKG_CFG))) { +>> +??????? dev_err(dev, "Client doesn't support temperature monitoring\n"); +>> +??????? return -EINVAL; +>> +??? } +>> + +>> +??? priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); +>> +??? if (!priv) +>> +??????? return -ENOMEM; +>> + +>> +??? dev_set_drvdata(dev, priv); +>> +??? priv->client = client; +>> +??? priv->dev = dev; +>> +??? priv->addr = client->addr; +>> +??? priv->cpu_no = priv->addr - PECI_BASE_ADDR; +>> + +>> +??? snprintf(priv->name, PECI_NAME_SIZE, "peci_hwmon.cpu%d", >> priv->cpu_no); >> + ->> + priv->work_queue = create_singlethread_workqueue(priv->name); ->> + if (!priv->work_queue) ->> + return -ENOMEM; +>> +??? priv->work_queue = create_singlethread_workqueue(priv->name); +>> +??? if (!priv->work_queue) +>> +??????? return -ENOMEM; >> + ->> + priv->hwmon_dev = hwmon_device_register_with_groups(priv->dev, ->> + priv->name, ->> + priv, ->> + default_attr_groups); +>> +??? priv->hwmon_dev = hwmon_device_register_with_groups(priv->dev, +>> +??????????????????????????????? priv->name, +>> +??????????????????????????????? priv, +>> +?????????????????????????????? default_attr_groups); >> + ->> + rc = PTR_ERR_OR_ZERO(priv->hwmon_dev); ->> + if (rc) { ->> + dev_err(dev, "Failed to register peci hwmon\n"); ->> + return rc; ->> + } +>> +??? rc = PTR_ERR_OR_ZERO(priv->hwmon_dev); +>> +??? if (rc) { +>> +??????? dev_err(dev, "Failed to register peci hwmon\n"); +>> +??????? return rc; +>> +??? } >> + ->> + priv->global_idx = DEFAULT_ATTR_GRP_NUMS + 1; +>> +??? priv->global_idx = DEFAULT_ATTR_GRP_NUMS + 1; >> + ->> + rc = create_core_temp_groups(priv); ->> + if (rc) { ->> + dev_err(dev, "Failed to create core groups\n"); ->> + return rc; ->> + } +>> +??? rc = create_core_temp_groups(priv); +>> +??? if (rc) { +>> +??????? dev_err(dev, "Failed to create core groups\n"); +>> +??????? return rc; +>> +??? } >> + ->> + INIT_DELAYED_WORK(&priv->work_handler, +>> +??? INIT_DELAYED_WORK(&priv->work_handler, >> create_dimm_temp_groups_delayed); >> + ->> + rc = create_dimm_temp_groups(priv); ->> + if (rc && rc != -EAGAIN) ->> + dev_dbg(dev, "Skipped to creat DIMM temp groups\n"); +>> +??? rc = create_dimm_temp_groups(priv); +>> +??? if (rc && rc != -EAGAIN) +>> +??????? dev_dbg(dev, "Skipped to creat DIMM temp groups\n"); >> + ->> + dev_dbg(dev, "peci hwmon for CPU at 0x%x registered\n", priv->addr); +>> +??? dev_dbg(dev, "peci hwmon for CPU at 0x%x registered\n", priv->addr); >> + ->> + return 0; +>> +??? return 0; >> +} >> + >> +static int peci_hwmon_remove(struct peci_client *client) >> +{ ->> + struct peci_hwmon *priv = dev_get_drvdata(&client->dev); +>> +??? struct peci_hwmon *priv = dev_get_drvdata(&client->dev); >> + ->> + cancel_delayed_work(&priv->work_handler); ->> + destroy_workqueue(priv->work_queue); ->> + sysfs_remove_groups(&priv->hwmon_dev->kobj, priv->core_attr_groups); ->> + sysfs_remove_groups(&priv->hwmon_dev->kobj, priv->dimm_attr_groups); ->> + hwmon_device_unregister(priv->hwmon_dev); +>> +??? cancel_delayed_work(&priv->work_handler); +>> +??? destroy_workqueue(priv->work_queue); +>> +??? sysfs_remove_groups(&priv->hwmon_dev->kobj, priv->core_attr_groups); +>> +??? sysfs_remove_groups(&priv->hwmon_dev->kobj, priv->dimm_attr_groups); +>> +??? hwmon_device_unregister(priv->hwmon_dev); >> + ->> + return 0; +>> +??? return 0; >> +} >> + >> +static const struct of_device_id peci_of_table[] = { ->> + { .compatible = "intel,peci-hwmon", }, ->> + { } +>> +??? { .compatible = "intel,peci-hwmon", }, +>> +??? { } >> +}; >> +MODULE_DEVICE_TABLE(of, peci_of_table); >> + >> +static struct peci_driver peci_hwmon_driver = { ->> + .probe = peci_hwmon_probe, ->> + .remove = peci_hwmon_remove, ->> + .driver = { ->> + .name = "peci-hwmon", ->> + .of_match_table = of_match_ptr(peci_of_table), ->> + }, +>> +??? .probe? = peci_hwmon_probe, +>> +??? .remove = peci_hwmon_remove, +>> +??? .driver = { +>> +??????? .name?????????? = "peci-hwmon", +>> +??????? .of_match_table = of_match_ptr(peci_of_table), +>> +??? }, >> +}; >> +module_peci_driver(peci_hwmon_driver); >> + @@ -1041,8 +1041,4 @@ On 3/13/2018 2:32 AM, Stef van Os wrote: >> +MODULE_DESCRIPTION("PECI hwmon driver"); >> +MODULE_LICENSE("GPL v2"); >> -> --- -To unsubscribe from this list: send the line "unsubscribe linux-doc" in -the body of a message to majordomo@vger.kernel.org -More majordomo info at http://vger.kernel.org/majordomo-info.html +> diff --git a/a/content_digest b/N2/content_digest index 3c9fd6b..fc93957 100644 --- a/a/content_digest +++ b/N2/content_digest @@ -1,24 +1,10 @@ "ref\020180221161606.32247-1-jae.hyun.yoo@linux.intel.com\0" "ref\020180221161606.32247-8-jae.hyun.yoo@linux.intel.com\0" "ref\0d9c3e768-ed57-a233-04fd-a05a64803da3@prodrive-technologies.com\0" - "From\0Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com>\0" - "Subject\0Re: [PATCH v2 7/8] [PATCH 7/8] drivers/hwmon: Add a generic PECI hwmon client driver\0" + "From\0jae.hyun.yoo@linux.intel.com (Jae Hyun Yoo)\0" + "Subject\0[PATCH v2 7/8] [PATCH 7/8] drivers/hwmon: Add a generic PECI hwmon client driver\0" "Date\0Tue, 13 Mar 2018 11:56:00 -0700\0" - "To\0Stef van Os <stef.van.os@prodrive-technologies.com>" - joel@jms.id.au - andrew@aj.id.au - arnd@arndb.de - gregkh@linuxfoundation.org - jdelvare@suse.com - linux@roeck-us.net - benh@kernel.crashing.org - " andrew@lunn.ch\0" - "Cc\0linux-hwmon@vger.kernel.org" - devicetree@vger.kernel.org - linux-doc@vger.kernel.org - openbmc@lists.ozlabs.org - linux-kernel@vger.kernel.org - " linux-arm-kernel@lists.infradead.org\0" + "To\0linux-arm-kernel@lists.infradead.org\0" "\00:1\0" "b\0" "Hi Stef,\n" @@ -64,46 +50,46 @@ ">>\n" ">> Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com>\n" ">> ---\n" - ">> \302\240 drivers/hwmon/Kconfig\302\240\302\240\302\240\302\240\302\240 |\302\240 10 +\n" - ">> \302\240 drivers/hwmon/Makefile\302\240\302\240\302\240\302\240 |\302\240\302\240 1 +\n" - ">> \302\240 drivers/hwmon/peci-hwmon.c | 928 \n" + ">> ? drivers/hwmon/Kconfig????? |? 10 +\n" + ">> ? drivers/hwmon/Makefile???? |?? 1 +\n" + ">> ? drivers/hwmon/peci-hwmon.c | 928 \n" ">> +++++++++++++++++++++++++++++++++++++++++++++\n" - ">> \302\240 3 files changed, 939 insertions(+)\n" - ">> \302\240 create mode 100644 drivers/hwmon/peci-hwmon.c\n" + ">> ? 3 files changed, 939 insertions(+)\n" + ">> ? create mode 100644 drivers/hwmon/peci-hwmon.c\n" ">>\n" ">> diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig\n" ">> index ef23553ff5cb..f22e0c31f597 100644\n" ">> --- a/drivers/hwmon/Kconfig\n" ">> +++ b/drivers/hwmon/Kconfig\n" ">> @@ -1246,6 +1246,16 @@ config SENSORS_NCT7904\n" - ">> \302\240\302\240\302\240\302\240\302\240\302\240\302\240 This driver can also be built as a module.\302\240 If so, the module\n" - ">> \302\240\302\240\302\240\302\240\302\240\302\240\302\240 will be called nct7904.\n" + ">> ??????? This driver can also be built as a module.? If so, the module\n" + ">> ??????? will be called nct7904.\n" ">> +config SENSORS_PECI_HWMON\n" - ">> +\302\240\302\240\302\240 tristate \"PECI hwmon support\"\n" - ">> +\302\240\302\240\302\240 depends on PECI\n" - ">> +\302\240\302\240\302\240 help\n" - ">> +\302\240\302\240\302\240\302\240\302\240 If you say yes here you get support for the generic PECI hwmon\n" - ">> +\302\240\302\240\302\240\302\240\302\240 driver.\n" + ">> +??? tristate \"PECI hwmon support\"\n" + ">> +??? depends on PECI\n" + ">> +??? help\n" + ">> +????? If you say yes here you get support for the generic PECI hwmon\n" + ">> +????? driver.\n" ">> +\n" - ">> +\302\240\302\240\302\240\302\240\302\240 This driver can also be built as a module.\302\240 If so, the module\n" - ">> +\302\240\302\240\302\240\302\240\302\240 will be called peci-hwmon.\n" + ">> +????? This driver can also be built as a module.? If so, the module\n" + ">> +????? will be called peci-hwmon.\n" ">> +\n" - ">> \302\240 config SENSORS_NSA320\n" - ">> \302\240\302\240\302\240\302\240\302\240 tristate \"ZyXEL NSA320 and compatible fan speed and temperature \n" + ">> ? config SENSORS_NSA320\n" + ">> ????? tristate \"ZyXEL NSA320 and compatible fan speed and temperature \n" ">> sensors\"\n" - ">> \302\240\302\240\302\240\302\240\302\240 depends on GPIOLIB && OF\n" + ">> ????? depends on GPIOLIB && OF\n" ">> diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile\n" ">> index f814b4ace138..946f54b168e5 100644\n" ">> --- a/drivers/hwmon/Makefile\n" ">> +++ b/drivers/hwmon/Makefile\n" - ">> @@ -135,6 +135,7 @@ obj-$(CONFIG_SENSORS_NCT7802)\302\240\302\240\302\240 += nct7802.o\n" - ">> \302\240 obj-$(CONFIG_SENSORS_NCT7904)\302\240\302\240\302\240 += nct7904.o\n" - ">> \302\240 obj-$(CONFIG_SENSORS_NSA320)\302\240\302\240\302\240 += nsa320-hwmon.o\n" - ">> \302\240 obj-$(CONFIG_SENSORS_NTC_THERMISTOR)\302\240\302\240\302\240 += ntc_thermistor.o\n" - ">> +obj-$(CONFIG_SENSORS_PECI_HWMON)\302\240\302\240\302\240 += peci-hwmon.o\n" - ">> \302\240 obj-$(CONFIG_SENSORS_PC87360)\302\240\302\240\302\240 += pc87360.o\n" - ">> \302\240 obj-$(CONFIG_SENSORS_PC87427)\302\240\302\240\302\240 += pc87427.o\n" - ">> \302\240 obj-$(CONFIG_SENSORS_PCF8591)\302\240\302\240\302\240 += pcf8591.o\n" + ">> @@ -135,6 +135,7 @@ obj-$(CONFIG_SENSORS_NCT7802)??? += nct7802.o\n" + ">> ? obj-$(CONFIG_SENSORS_NCT7904)??? += nct7904.o\n" + ">> ? obj-$(CONFIG_SENSORS_NSA320)??? += nsa320-hwmon.o\n" + ">> ? obj-$(CONFIG_SENSORS_NTC_THERMISTOR)??? += ntc_thermistor.o\n" + ">> +obj-$(CONFIG_SENSORS_PECI_HWMON)??? += peci-hwmon.o\n" + ">> ? obj-$(CONFIG_SENSORS_PC87360)??? += pc87360.o\n" + ">> ? obj-$(CONFIG_SENSORS_PC87427)??? += pc87427.o\n" + ">> ? obj-$(CONFIG_SENSORS_PCF8591)??? += pcf8591.o\n" ">> diff --git a/drivers/hwmon/peci-hwmon.c b/drivers/hwmon/peci-hwmon.c\n" ">> new file mode 100644\n" ">> index 000000000000..edd27744adcb\n" @@ -122,535 +108,535 @@ ">> +#include <linux/peci.h>\n" ">> +#include <linux/workqueue.h>\n" ">> +\n" - ">> +#define DIMM_SLOT_NUMS_MAX\302\240\302\240\302\240 12\302\240 /* Max DIMM numbers (channel ranks \n" + ">> +#define DIMM_SLOT_NUMS_MAX??? 12? /* Max DIMM numbers (channel ranks \n" ">> x 2) */\n" - ">> +#define CORE_NUMS_MAX\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 28\302\240 /* Max core numbers (max on SKX \n" + ">> +#define CORE_NUMS_MAX???????? 28? /* Max core numbers (max on SKX \n" ">> Platinum) */\n" - ">> +#define TEMP_TYPE_PECI\302\240\302\240\302\240\302\240\302\240\302\240\302\240 6\302\240\302\240 /* Sensor type 6: Intel PECI */\n" + ">> +#define TEMP_TYPE_PECI??????? 6?? /* Sensor type 6: Intel PECI */\n" ">> +\n" - ">> +#define CORE_TEMP_ATTRS\302\240\302\240\302\240\302\240\302\240\302\240 5\n" - ">> +#define DIMM_TEMP_ATTRS\302\240\302\240\302\240\302\240\302\240\302\240 2\n" - ">> +#define ATTR_NAME_LEN\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 24\n" + ">> +#define CORE_TEMP_ATTRS?????? 5\n" + ">> +#define DIMM_TEMP_ATTRS?????? 2\n" + ">> +#define ATTR_NAME_LEN???????? 24\n" ">> +\n" ">> +#define DEFAULT_ATTR_GRP_NUMS 5\n" ">> +\n" - ">> +#define UPDATE_INTERVAL_MIN\302\240\302\240 HZ\n" + ">> +#define UPDATE_INTERVAL_MIN?? HZ\n" ">> +#define DIMM_MASK_CHECK_DELAY msecs_to_jiffies(5000)\n" ">> +\n" ">> +enum sign {\n" - ">> +\302\240\302\240\302\240 POS,\n" - ">> +\302\240\302\240\302\240 NEG\n" + ">> +??? POS,\n" + ">> +??? NEG\n" ">> +};\n" ">> +\n" ">> +struct temp_data {\n" - ">> +\302\240\302\240\302\240 bool valid;\n" - ">> +\302\240\302\240\302\240 s32\302\240 value;\n" - ">> +\302\240\302\240\302\240 unsigned long last_updated;\n" + ">> +??? bool valid;\n" + ">> +??? s32? value;\n" + ">> +??? unsigned long last_updated;\n" ">> +};\n" ">> +\n" ">> +struct temp_group {\n" - ">> +\302\240\302\240\302\240 struct temp_data tjmax;\n" - ">> +\302\240\302\240\302\240 struct temp_data tcontrol;\n" - ">> +\302\240\302\240\302\240 struct temp_data tthrottle;\n" - ">> +\302\240\302\240\302\240 struct temp_data dts_margin;\n" - ">> +\302\240\302\240\302\240 struct temp_data die;\n" - ">> +\302\240\302\240\302\240 struct temp_data core[CORE_NUMS_MAX];\n" - ">> +\302\240\302\240\302\240 struct temp_data dimm[DIMM_SLOT_NUMS_MAX];\n" + ">> +??? struct temp_data tjmax;\n" + ">> +??? struct temp_data tcontrol;\n" + ">> +??? struct temp_data tthrottle;\n" + ">> +??? struct temp_data dts_margin;\n" + ">> +??? struct temp_data die;\n" + ">> +??? struct temp_data core[CORE_NUMS_MAX];\n" + ">> +??? struct temp_data dimm[DIMM_SLOT_NUMS_MAX];\n" ">> +};\n" ">> +\n" ">> +struct core_temp_group {\n" - ">> +\302\240\302\240\302\240 struct sensor_device_attribute sd_attrs[CORE_TEMP_ATTRS];\n" - ">> +\302\240\302\240\302\240 char attr_name[CORE_TEMP_ATTRS][ATTR_NAME_LEN];\n" - ">> +\302\240\302\240\302\240 struct attribute *attrs[CORE_TEMP_ATTRS + 1];\n" - ">> +\302\240\302\240\302\240 struct attribute_group attr_group;\n" + ">> +??? struct sensor_device_attribute sd_attrs[CORE_TEMP_ATTRS];\n" + ">> +??? char attr_name[CORE_TEMP_ATTRS][ATTR_NAME_LEN];\n" + ">> +??? struct attribute *attrs[CORE_TEMP_ATTRS + 1];\n" + ">> +??? struct attribute_group attr_group;\n" ">> +};\n" ">> +\n" ">> +struct dimm_temp_group {\n" - ">> +\302\240\302\240\302\240 struct sensor_device_attribute sd_attrs[DIMM_TEMP_ATTRS];\n" - ">> +\302\240\302\240\302\240 char attr_name[DIMM_TEMP_ATTRS][ATTR_NAME_LEN];\n" - ">> +\302\240\302\240\302\240 struct attribute *attrs[DIMM_TEMP_ATTRS + 1];\n" - ">> +\302\240\302\240\302\240 struct attribute_group attr_group;\n" + ">> +??? struct sensor_device_attribute sd_attrs[DIMM_TEMP_ATTRS];\n" + ">> +??? char attr_name[DIMM_TEMP_ATTRS][ATTR_NAME_LEN];\n" + ">> +??? struct attribute *attrs[DIMM_TEMP_ATTRS + 1];\n" + ">> +??? struct attribute_group attr_group;\n" ">> +};\n" ">> +\n" ">> +struct peci_hwmon {\n" - ">> +\302\240\302\240\302\240 struct peci_client *client;\n" - ">> +\302\240\302\240\302\240 struct device *dev;\n" - ">> +\302\240\302\240\302\240 struct device *hwmon_dev;\n" - ">> +\302\240\302\240\302\240 struct workqueue_struct *work_queue;\n" - ">> +\302\240\302\240\302\240 struct delayed_work work_handler;\n" - ">> +\302\240\302\240\302\240 char name[PECI_NAME_SIZE];\n" - ">> +\302\240\302\240\302\240 struct temp_group temp;\n" - ">> +\302\240\302\240\302\240 u8 addr;\n" - ">> +\302\240\302\240\302\240 uint cpu_no;\n" - ">> +\302\240\302\240\302\240 u32 core_mask;\n" - ">> +\302\240\302\240\302\240 u32 dimm_mask;\n" - ">> +\302\240\302\240\302\240 const struct attribute_group *core_attr_groups[CORE_NUMS_MAX + 1];\n" - ">> +\302\240\302\240\302\240 const struct attribute_group *dimm_attr_groups[DIMM_SLOT_NUMS_MAX \n" + ">> +??? struct peci_client *client;\n" + ">> +??? struct device *dev;\n" + ">> +??? struct device *hwmon_dev;\n" + ">> +??? struct workqueue_struct *work_queue;\n" + ">> +??? struct delayed_work work_handler;\n" + ">> +??? char name[PECI_NAME_SIZE];\n" + ">> +??? struct temp_group temp;\n" + ">> +??? u8 addr;\n" + ">> +??? uint cpu_no;\n" + ">> +??? u32 core_mask;\n" + ">> +??? u32 dimm_mask;\n" + ">> +??? const struct attribute_group *core_attr_groups[CORE_NUMS_MAX + 1];\n" + ">> +??? const struct attribute_group *dimm_attr_groups[DIMM_SLOT_NUMS_MAX \n" ">> + 1];\n" - ">> +\302\240\302\240\302\240 uint global_idx;\n" - ">> +\302\240\302\240\302\240 uint core_idx;\n" - ">> +\302\240\302\240\302\240 uint dimm_idx;\n" + ">> +??? uint global_idx;\n" + ">> +??? uint core_idx;\n" + ">> +??? uint dimm_idx;\n" ">> +};\n" ">> +\n" ">> +enum label {\n" - ">> +\302\240\302\240\302\240 L_DIE,\n" - ">> +\302\240\302\240\302\240 L_DTS,\n" - ">> +\302\240\302\240\302\240 L_TCONTROL,\n" - ">> +\302\240\302\240\302\240 L_TTHROTTLE,\n" - ">> +\302\240\302\240\302\240 L_TJMAX,\n" - ">> +\302\240\302\240\302\240 L_MAX\n" + ">> +??? L_DIE,\n" + ">> +??? L_DTS,\n" + ">> +??? L_TCONTROL,\n" + ">> +??? L_TTHROTTLE,\n" + ">> +??? L_TJMAX,\n" + ">> +??? L_MAX\n" ">> +};\n" ">> +\n" ">> +static const char *peci_label[L_MAX] = {\n" - ">> +\302\240\302\240\302\240 \"Die\\n\",\n" - ">> +\302\240\302\240\302\240 \"DTS margin to Tcontrol\\n\",\n" - ">> +\302\240\302\240\302\240 \"Tcontrol\\n\",\n" - ">> +\302\240\302\240\302\240 \"Tthrottle\\n\",\n" - ">> +\302\240\302\240\302\240 \"Tjmax\\n\",\n" + ">> +??? \"Die\\n\",\n" + ">> +??? \"DTS margin to Tcontrol\\n\",\n" + ">> +??? \"Tcontrol\\n\",\n" + ">> +??? \"Tthrottle\\n\",\n" + ">> +??? \"Tjmax\\n\",\n" ">> +};\n" ">> +\n" ">> +static int send_peci_cmd(struct peci_hwmon *priv, enum peci_cmd cmd, \n" ">> void *msg)\n" ">> +{\n" - ">> +\302\240\302\240\302\240 return peci_command(priv->client->adapter, cmd, msg);\n" + ">> +??? return peci_command(priv->client->adapter, cmd, msg);\n" ">> +}\n" ">> +\n" ">> +static int need_update(struct temp_data *temp)\n" ">> +{\n" - ">> +\302\240\302\240\302\240 if (temp->valid &&\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 time_before(jiffies, temp->last_updated + UPDATE_INTERVAL_MIN))\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return 0;\n" + ">> +??? if (temp->valid &&\n" + ">> +??????? time_before(jiffies, temp->last_updated + UPDATE_INTERVAL_MIN))\n" + ">> +??????? return 0;\n" ">> +\n" - ">> +\302\240\302\240\302\240 return 1;\n" + ">> +??? return 1;\n" ">> +}\n" ">> +\n" ">> +static s32 ten_dot_six_to_millidegree(s32 x)\n" ">> +{\n" - ">> +\302\240\302\240\302\240 return ((((x) ^ 0x8000) - 0x8000) * 1000 / 64);\n" + ">> +??? return ((((x) ^ 0x8000) - 0x8000) * 1000 / 64);\n" ">> +}\n" ">> +\n" ">> +static int get_tjmax(struct peci_hwmon *priv)\n" ">> +{\n" - ">> +\302\240\302\240\302\240 struct peci_rd_pkg_cfg_msg msg;\n" - ">> +\302\240\302\240\302\240 int rc;\n" + ">> +??? struct peci_rd_pkg_cfg_msg msg;\n" + ">> +??? int rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240 if (!priv->temp.tjmax.valid) {\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 msg.addr = priv->addr;\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 msg.index = MBX_INDEX_TEMP_TARGET;\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 msg.param = 0;\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 msg.rx_len = 4;\n" + ">> +??? if (!priv->temp.tjmax.valid) {\n" + ">> +??????? msg.addr = priv->addr;\n" + ">> +??????? msg.index = MBX_INDEX_TEMP_TARGET;\n" + ">> +??????? msg.param = 0;\n" + ">> +??????? msg.rx_len = 4;\n" ">> +\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 rc = send_peci_cmd(priv, PECI_CMD_RD_PKG_CFG, (void *)&msg);\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 if (rc < 0)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return rc;\n" + ">> +??????? rc = send_peci_cmd(priv, PECI_CMD_RD_PKG_CFG, (void *)&msg);\n" + ">> +??????? if (rc < 0)\n" + ">> +??????????? return rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 priv->temp.tjmax.value = (s32)msg.pkg_config[2] * 1000;\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 priv->temp.tjmax.valid = true;\n" - ">> +\302\240\302\240\302\240 }\n" + ">> +??????? priv->temp.tjmax.value = (s32)msg.pkg_config[2] * 1000;\n" + ">> +??????? priv->temp.tjmax.valid = true;\n" + ">> +??? }\n" ">> +\n" - ">> +\302\240\302\240\302\240 return 0;\n" + ">> +??? return 0;\n" ">> +}\n" ">> +\n" ">> +static int get_tcontrol(struct peci_hwmon *priv)\n" ">> +{\n" - ">> +\302\240\302\240\302\240 struct peci_rd_pkg_cfg_msg msg;\n" - ">> +\302\240\302\240\302\240 s32 tcontrol_margin;\n" - ">> +\302\240\302\240\302\240 int rc;\n" + ">> +??? struct peci_rd_pkg_cfg_msg msg;\n" + ">> +??? s32 tcontrol_margin;\n" + ">> +??? int rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240 if (!need_update(&priv->temp.tcontrol))\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return 0;\n" + ">> +??? if (!need_update(&priv->temp.tcontrol))\n" + ">> +??????? return 0;\n" ">> +\n" - ">> +\302\240\302\240\302\240 rc = get_tjmax(priv);\n" - ">> +\302\240\302\240\302\240 if (rc < 0)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return rc;\n" + ">> +??? rc = get_tjmax(priv);\n" + ">> +??? if (rc < 0)\n" + ">> +??????? return rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240 msg.addr = priv->addr;\n" - ">> +\302\240\302\240\302\240 msg.index = MBX_INDEX_TEMP_TARGET;\n" - ">> +\302\240\302\240\302\240 msg.param = 0;\n" - ">> +\302\240\302\240\302\240 msg.rx_len = 4;\n" + ">> +??? msg.addr = priv->addr;\n" + ">> +??? msg.index = MBX_INDEX_TEMP_TARGET;\n" + ">> +??? msg.param = 0;\n" + ">> +??? msg.rx_len = 4;\n" ">> +\n" - ">> +\302\240\302\240\302\240 rc = send_peci_cmd(priv, PECI_CMD_RD_PKG_CFG, (void *)&msg);\n" - ">> +\302\240\302\240\302\240 if (rc < 0)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return rc;\n" + ">> +??? rc = send_peci_cmd(priv, PECI_CMD_RD_PKG_CFG, (void *)&msg);\n" + ">> +??? if (rc < 0)\n" + ">> +??????? return rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240 tcontrol_margin = msg.pkg_config[1];\n" - ">> +\302\240\302\240\302\240 tcontrol_margin = ((tcontrol_margin ^ 0x80) - 0x80) * 1000;\n" + ">> +??? tcontrol_margin = msg.pkg_config[1];\n" + ">> +??? tcontrol_margin = ((tcontrol_margin ^ 0x80) - 0x80) * 1000;\n" ">> +\n" - ">> +\302\240\302\240\302\240 priv->temp.tcontrol.value = priv->temp.tjmax.value - \n" + ">> +??? priv->temp.tcontrol.value = priv->temp.tjmax.value - \n" ">> tcontrol_margin;\n" ">> +\n" - ">> +\302\240\302\240\302\240 if (!priv->temp.tcontrol.valid) {\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 priv->temp.tcontrol.last_updated = INITIAL_JIFFIES;\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 priv->temp.tcontrol.valid = true;\n" - ">> +\302\240\302\240\302\240 } else {\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 priv->temp.tcontrol.last_updated = jiffies;\n" - ">> +\302\240\302\240\302\240 }\n" + ">> +??? if (!priv->temp.tcontrol.valid) {\n" + ">> +??????? priv->temp.tcontrol.last_updated = INITIAL_JIFFIES;\n" + ">> +??????? priv->temp.tcontrol.valid = true;\n" + ">> +??? } else {\n" + ">> +??????? priv->temp.tcontrol.last_updated = jiffies;\n" + ">> +??? }\n" ">> +\n" - ">> +\302\240\302\240\302\240 return 0;\n" + ">> +??? return 0;\n" ">> +}\n" ">> +\n" ">> +static int get_tthrottle(struct peci_hwmon *priv)\n" ">> +{\n" - ">> +\302\240\302\240\302\240 struct peci_rd_pkg_cfg_msg msg;\n" - ">> +\302\240\302\240\302\240 s32 tthrottle_offset;\n" - ">> +\302\240\302\240\302\240 int rc;\n" + ">> +??? struct peci_rd_pkg_cfg_msg msg;\n" + ">> +??? s32 tthrottle_offset;\n" + ">> +??? int rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240 if (!need_update(&priv->temp.tthrottle))\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return 0;\n" + ">> +??? if (!need_update(&priv->temp.tthrottle))\n" + ">> +??????? return 0;\n" ">> +\n" - ">> +\302\240\302\240\302\240 rc = get_tjmax(priv);\n" - ">> +\302\240\302\240\302\240 if (rc < 0)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return rc;\n" + ">> +??? rc = get_tjmax(priv);\n" + ">> +??? if (rc < 0)\n" + ">> +??????? return rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240 msg.addr = priv->addr;\n" - ">> +\302\240\302\240\302\240 msg.index = MBX_INDEX_TEMP_TARGET;\n" - ">> +\302\240\302\240\302\240 msg.param = 0;\n" - ">> +\302\240\302\240\302\240 msg.rx_len = 4;\n" + ">> +??? msg.addr = priv->addr;\n" + ">> +??? msg.index = MBX_INDEX_TEMP_TARGET;\n" + ">> +??? msg.param = 0;\n" + ">> +??? msg.rx_len = 4;\n" ">> +\n" - ">> +\302\240\302\240\302\240 rc = send_peci_cmd(priv, PECI_CMD_RD_PKG_CFG, (void *)&msg);\n" - ">> +\302\240\302\240\302\240 if (rc < 0)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return rc;\n" + ">> +??? rc = send_peci_cmd(priv, PECI_CMD_RD_PKG_CFG, (void *)&msg);\n" + ">> +??? if (rc < 0)\n" + ">> +??????? return rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240 tthrottle_offset = (msg.pkg_config[3] & 0x2f) * 1000;\n" - ">> +\302\240\302\240\302\240 priv->temp.tthrottle.value = priv->temp.tjmax.value - \n" + ">> +??? tthrottle_offset = (msg.pkg_config[3] & 0x2f) * 1000;\n" + ">> +??? priv->temp.tthrottle.value = priv->temp.tjmax.value - \n" ">> tthrottle_offset;\n" ">> +\n" - ">> +\302\240\302\240\302\240 if (!priv->temp.tthrottle.valid) {\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 priv->temp.tthrottle.last_updated = INITIAL_JIFFIES;\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 priv->temp.tthrottle.valid = true;\n" - ">> +\302\240\302\240\302\240 } else {\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 priv->temp.tthrottle.last_updated = jiffies;\n" - ">> +\302\240\302\240\302\240 }\n" + ">> +??? if (!priv->temp.tthrottle.valid) {\n" + ">> +??????? priv->temp.tthrottle.last_updated = INITIAL_JIFFIES;\n" + ">> +??????? priv->temp.tthrottle.valid = true;\n" + ">> +??? } else {\n" + ">> +??????? priv->temp.tthrottle.last_updated = jiffies;\n" + ">> +??? }\n" ">> +\n" - ">> +\302\240\302\240\302\240 return 0;\n" + ">> +??? return 0;\n" ">> +}\n" ">> +\n" ">> +static int get_die_temp(struct peci_hwmon *priv)\n" ">> +{\n" - ">> +\302\240\302\240\302\240 struct peci_get_temp_msg msg;\n" - ">> +\302\240\302\240\302\240 int rc;\n" + ">> +??? struct peci_get_temp_msg msg;\n" + ">> +??? int rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240 if (!need_update(&priv->temp.die))\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return 0;\n" + ">> +??? if (!need_update(&priv->temp.die))\n" + ">> +??????? return 0;\n" ">> +\n" - ">> +\302\240\302\240\302\240 rc = get_tjmax(priv);\n" - ">> +\302\240\302\240\302\240 if (rc < 0)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return rc;\n" + ">> +??? rc = get_tjmax(priv);\n" + ">> +??? if (rc < 0)\n" + ">> +??????? return rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240 msg.addr = priv->addr;\n" + ">> +??? msg.addr = priv->addr;\n" ">> +\n" - ">> +\302\240\302\240\302\240 rc = send_peci_cmd(priv, PECI_CMD_GET_TEMP, (void *)&msg);\n" - ">> +\302\240\302\240\302\240 if (rc < 0)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return rc;\n" + ">> +??? rc = send_peci_cmd(priv, PECI_CMD_GET_TEMP, (void *)&msg);\n" + ">> +??? if (rc < 0)\n" + ">> +??????? return rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240 priv->temp.die.value = priv->temp.tjmax.value +\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 ((s32)msg.temp_raw * 1000 / 64);\n" + ">> +??? priv->temp.die.value = priv->temp.tjmax.value +\n" + ">> +?????????????????? ((s32)msg.temp_raw * 1000 / 64);\n" ">> +\n" - ">> +\302\240\302\240\302\240 if (!priv->temp.die.valid) {\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 priv->temp.die.last_updated = INITIAL_JIFFIES;\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 priv->temp.die.valid = true;\n" - ">> +\302\240\302\240\302\240 } else {\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 priv->temp.die.last_updated = jiffies;\n" - ">> +\302\240\302\240\302\240 }\n" + ">> +??? if (!priv->temp.die.valid) {\n" + ">> +??????? priv->temp.die.last_updated = INITIAL_JIFFIES;\n" + ">> +??????? priv->temp.die.valid = true;\n" + ">> +??? } else {\n" + ">> +??????? priv->temp.die.last_updated = jiffies;\n" + ">> +??? }\n" ">> +\n" - ">> +\302\240\302\240\302\240 return 0;\n" + ">> +??? return 0;\n" ">> +}\n" ">> +\n" ">> +static int get_dts_margin(struct peci_hwmon *priv)\n" ">> +{\n" - ">> +\302\240\302\240\302\240 struct peci_rd_pkg_cfg_msg msg;\n" - ">> +\302\240\302\240\302\240 s32 dts_margin;\n" - ">> +\302\240\302\240\302\240 int rc;\n" - ">> +\n" - ">> +\302\240\302\240\302\240 if (!need_update(&priv->temp.dts_margin))\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return 0;\n" - ">> +\n" - ">> +\302\240\302\240\302\240 msg.addr = priv->addr;\n" - ">> +\302\240\302\240\302\240 msg.index = MBX_INDEX_DTS_MARGIN;\n" - ">> +\302\240\302\240\302\240 msg.param = 0;\n" - ">> +\302\240\302\240\302\240 msg.rx_len = 4;\n" - ">> +\n" - ">> +\302\240\302\240\302\240 rc = send_peci_cmd(priv, PECI_CMD_RD_PKG_CFG, (void *)&msg);\n" - ">> +\302\240\302\240\302\240 if (rc < 0)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return rc;\n" - ">> +\n" - ">> +\302\240\302\240\302\240 dts_margin = (msg.pkg_config[1] << 8) | msg.pkg_config[0];\n" - ">> +\n" - ">> +\302\240\302\240\302\240 /**\n" - ">> +\302\240\302\240\302\240\302\240 * Processors return a value of DTS reading in 10.6 format\n" - ">> +\302\240\302\240\302\240\302\240 * (10 bits signed decimal, 6 bits fractional).\n" - ">> +\302\240\302\240\302\240\302\240 * Error codes:\n" - ">> +\302\240\302\240\302\240\302\240 *\302\240\302\240 0x8000: General sensor error\n" - ">> +\302\240\302\240\302\240\302\240 *\302\240\302\240 0x8001: Reserved\n" - ">> +\302\240\302\240\302\240\302\240 *\302\240\302\240 0x8002: Underflow on reading value\n" - ">> +\302\240\302\240\302\240\302\240 *\302\240\302\240 0x8003-0x81ff: Reserved\n" - ">> +\302\240\302\240\302\240\302\240 */\n" - ">> +\302\240\302\240\302\240 if (dts_margin >= 0x8000 && dts_margin <= 0x81ff)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return -1;\n" - ">> +\n" - ">> +\302\240\302\240\302\240 dts_margin = ten_dot_six_to_millidegree(dts_margin);\n" - ">> +\n" - ">> +\302\240\302\240\302\240 priv->temp.dts_margin.value = dts_margin;\n" - ">> +\n" - ">> +\302\240\302\240\302\240 if (!priv->temp.dts_margin.valid) {\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 priv->temp.dts_margin.last_updated = INITIAL_JIFFIES;\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 priv->temp.dts_margin.valid = true;\n" - ">> +\302\240\302\240\302\240 } else {\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 priv->temp.dts_margin.last_updated = jiffies;\n" - ">> +\302\240\302\240\302\240 }\n" - ">> +\n" - ">> +\302\240\302\240\302\240 return 0;\n" + ">> +??? struct peci_rd_pkg_cfg_msg msg;\n" + ">> +??? s32 dts_margin;\n" + ">> +??? int rc;\n" + ">> +\n" + ">> +??? if (!need_update(&priv->temp.dts_margin))\n" + ">> +??????? return 0;\n" + ">> +\n" + ">> +??? msg.addr = priv->addr;\n" + ">> +??? msg.index = MBX_INDEX_DTS_MARGIN;\n" + ">> +??? msg.param = 0;\n" + ">> +??? msg.rx_len = 4;\n" + ">> +\n" + ">> +??? rc = send_peci_cmd(priv, PECI_CMD_RD_PKG_CFG, (void *)&msg);\n" + ">> +??? if (rc < 0)\n" + ">> +??????? return rc;\n" + ">> +\n" + ">> +??? dts_margin = (msg.pkg_config[1] << 8) | msg.pkg_config[0];\n" + ">> +\n" + ">> +??? /**\n" + ">> +???? * Processors return a value of DTS reading in 10.6 format\n" + ">> +???? * (10 bits signed decimal, 6 bits fractional).\n" + ">> +???? * Error codes:\n" + ">> +???? *?? 0x8000: General sensor error\n" + ">> +???? *?? 0x8001: Reserved\n" + ">> +???? *?? 0x8002: Underflow on reading value\n" + ">> +???? *?? 0x8003-0x81ff: Reserved\n" + ">> +???? */\n" + ">> +??? if (dts_margin >= 0x8000 && dts_margin <= 0x81ff)\n" + ">> +??????? return -1;\n" + ">> +\n" + ">> +??? dts_margin = ten_dot_six_to_millidegree(dts_margin);\n" + ">> +\n" + ">> +??? priv->temp.dts_margin.value = dts_margin;\n" + ">> +\n" + ">> +??? if (!priv->temp.dts_margin.valid) {\n" + ">> +??????? priv->temp.dts_margin.last_updated = INITIAL_JIFFIES;\n" + ">> +??????? priv->temp.dts_margin.valid = true;\n" + ">> +??? } else {\n" + ">> +??????? priv->temp.dts_margin.last_updated = jiffies;\n" + ">> +??? }\n" + ">> +\n" + ">> +??? return 0;\n" ">> +}\n" ">> +\n" ">> +static int get_core_temp(struct peci_hwmon *priv, int core_index)\n" ">> +{\n" - ">> +\302\240\302\240\302\240 struct peci_rd_pkg_cfg_msg msg;\n" - ">> +\302\240\302\240\302\240 s32 core_dts_margin;\n" - ">> +\302\240\302\240\302\240 int rc;\n" - ">> +\n" - ">> +\302\240\302\240\302\240 if (!need_update(&priv->temp.core[core_index]))\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return 0;\n" - ">> +\n" - ">> +\302\240\302\240\302\240 rc = get_tjmax(priv);\n" - ">> +\302\240\302\240\302\240 if (rc < 0)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return rc;\n" - ">> +\n" - ">> +\302\240\302\240\302\240 msg.addr = priv->addr;\n" - ">> +\302\240\302\240\302\240 msg.index = MBX_INDEX_PER_CORE_DTS_TEMP;\n" - ">> +\302\240\302\240\302\240 msg.param = core_index;\n" - ">> +\302\240\302\240\302\240 msg.rx_len = 4;\n" - ">> +\n" - ">> +\302\240\302\240\302\240 rc = send_peci_cmd(priv, PECI_CMD_RD_PKG_CFG, (void *)&msg);\n" - ">> +\302\240\302\240\302\240 if (rc < 0)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return rc;\n" - ">> +\n" - ">> +\302\240\302\240\302\240 core_dts_margin = (msg.pkg_config[1] << 8) | msg.pkg_config[0];\n" - ">> +\n" - ">> +\302\240\302\240\302\240 /**\n" - ">> +\302\240\302\240\302\240\302\240 * Processors return a value of the core DTS reading in 10.6 format\n" - ">> +\302\240\302\240\302\240\302\240 * (10 bits signed decimal, 6 bits fractional).\n" - ">> +\302\240\302\240\302\240\302\240 * Error codes:\n" - ">> +\302\240\302\240\302\240\302\240 *\302\240\302\240 0x8000: General sensor error\n" - ">> +\302\240\302\240\302\240\302\240 *\302\240\302\240 0x8001: Reserved\n" - ">> +\302\240\302\240\302\240\302\240 *\302\240\302\240 0x8002: Underflow on reading value\n" - ">> +\302\240\302\240\302\240\302\240 *\302\240\302\240 0x8003-0x81ff: Reserved\n" - ">> +\302\240\302\240\302\240\302\240 */\n" - ">> +\302\240\302\240\302\240 if (core_dts_margin >= 0x8000 && core_dts_margin <= 0x81ff)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return -1;\n" - ">> +\n" - ">> +\302\240\302\240\302\240 core_dts_margin = ten_dot_six_to_millidegree(core_dts_margin);\n" - ">> +\n" - ">> +\302\240\302\240\302\240 priv->temp.core[core_index].value = priv->temp.tjmax.value +\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 core_dts_margin;\n" - ">> +\n" - ">> +\302\240\302\240\302\240 if (!priv->temp.core[core_index].valid) {\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 priv->temp.core[core_index].last_updated = INITIAL_JIFFIES;\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 priv->temp.core[core_index].valid = true;\n" - ">> +\302\240\302\240\302\240 } else {\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 priv->temp.core[core_index].last_updated = jiffies;\n" - ">> +\302\240\302\240\302\240 }\n" - ">> +\n" - ">> +\302\240\302\240\302\240 return 0;\n" + ">> +??? struct peci_rd_pkg_cfg_msg msg;\n" + ">> +??? s32 core_dts_margin;\n" + ">> +??? int rc;\n" + ">> +\n" + ">> +??? if (!need_update(&priv->temp.core[core_index]))\n" + ">> +??????? return 0;\n" + ">> +\n" + ">> +??? rc = get_tjmax(priv);\n" + ">> +??? if (rc < 0)\n" + ">> +??????? return rc;\n" + ">> +\n" + ">> +??? msg.addr = priv->addr;\n" + ">> +??? msg.index = MBX_INDEX_PER_CORE_DTS_TEMP;\n" + ">> +??? msg.param = core_index;\n" + ">> +??? msg.rx_len = 4;\n" + ">> +\n" + ">> +??? rc = send_peci_cmd(priv, PECI_CMD_RD_PKG_CFG, (void *)&msg);\n" + ">> +??? if (rc < 0)\n" + ">> +??????? return rc;\n" + ">> +\n" + ">> +??? core_dts_margin = (msg.pkg_config[1] << 8) | msg.pkg_config[0];\n" + ">> +\n" + ">> +??? /**\n" + ">> +???? * Processors return a value of the core DTS reading in 10.6 format\n" + ">> +???? * (10 bits signed decimal, 6 bits fractional).\n" + ">> +???? * Error codes:\n" + ">> +???? *?? 0x8000: General sensor error\n" + ">> +???? *?? 0x8001: Reserved\n" + ">> +???? *?? 0x8002: Underflow on reading value\n" + ">> +???? *?? 0x8003-0x81ff: Reserved\n" + ">> +???? */\n" + ">> +??? if (core_dts_margin >= 0x8000 && core_dts_margin <= 0x81ff)\n" + ">> +??????? return -1;\n" + ">> +\n" + ">> +??? core_dts_margin = ten_dot_six_to_millidegree(core_dts_margin);\n" + ">> +\n" + ">> +??? priv->temp.core[core_index].value = priv->temp.tjmax.value +\n" + ">> +??????????????????????? core_dts_margin;\n" + ">> +\n" + ">> +??? if (!priv->temp.core[core_index].valid) {\n" + ">> +??????? priv->temp.core[core_index].last_updated = INITIAL_JIFFIES;\n" + ">> +??????? priv->temp.core[core_index].valid = true;\n" + ">> +??? } else {\n" + ">> +??????? priv->temp.core[core_index].last_updated = jiffies;\n" + ">> +??? }\n" + ">> +\n" + ">> +??? return 0;\n" ">> +}\n" ">> +\n" ">> +static int get_dimm_temp(struct peci_hwmon *priv, int dimm_index)\n" ">> +{\n" - ">> +\302\240\302\240\302\240 struct peci_rd_pkg_cfg_msg msg;\n" - ">> +\302\240\302\240\302\240 int channel = dimm_index / 2;\n" - ">> +\302\240\302\240\302\240 int dimm_order = dimm_index % 2;\n" - ">> +\302\240\302\240\302\240 int rc;\n" + ">> +??? struct peci_rd_pkg_cfg_msg msg;\n" + ">> +??? int channel = dimm_index / 2;\n" + ">> +??? int dimm_order = dimm_index % 2;\n" + ">> +??? int rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240 if (!need_update(&priv->temp.dimm[dimm_index]))\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return 0;\n" + ">> +??? if (!need_update(&priv->temp.dimm[dimm_index]))\n" + ">> +??????? return 0;\n" ">> +\n" - ">> +\302\240\302\240\302\240 msg.addr = priv->addr;\n" - ">> +\302\240\302\240\302\240 msg.index = MBX_INDEX_DDR_DIMM_TEMP;\n" - ">> +\302\240\302\240\302\240 msg.param = channel;\n" - ">> +\302\240\302\240\302\240 msg.rx_len = 4;\n" + ">> +??? msg.addr = priv->addr;\n" + ">> +??? msg.index = MBX_INDEX_DDR_DIMM_TEMP;\n" + ">> +??? msg.param = channel;\n" + ">> +??? msg.rx_len = 4;\n" ">> +\n" - ">> +\302\240\302\240\302\240 rc = send_peci_cmd(priv, PECI_CMD_RD_PKG_CFG, (void *)&msg);\n" - ">> +\302\240\302\240\302\240 if (rc < 0)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return rc;\n" + ">> +??? rc = send_peci_cmd(priv, PECI_CMD_RD_PKG_CFG, (void *)&msg);\n" + ">> +??? if (rc < 0)\n" + ">> +??????? return rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240 priv->temp.dimm[dimm_index].value = msg.pkg_config[dimm_order] * \n" + ">> +??? priv->temp.dimm[dimm_index].value = msg.pkg_config[dimm_order] * \n" ">> 1000;\n" ">> +\n" - ">> +\302\240\302\240\302\240 if (!priv->temp.dimm[dimm_index].valid) {\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 priv->temp.dimm[dimm_index].last_updated = INITIAL_JIFFIES;\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 priv->temp.dimm[dimm_index].valid = true;\n" - ">> +\302\240\302\240\302\240 } else {\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 priv->temp.dimm[dimm_index].last_updated = jiffies;\n" - ">> +\302\240\302\240\302\240 }\n" + ">> +??? if (!priv->temp.dimm[dimm_index].valid) {\n" + ">> +??????? priv->temp.dimm[dimm_index].last_updated = INITIAL_JIFFIES;\n" + ">> +??????? priv->temp.dimm[dimm_index].valid = true;\n" + ">> +??? } else {\n" + ">> +??????? priv->temp.dimm[dimm_index].last_updated = jiffies;\n" + ">> +??? }\n" ">> +\n" - ">> +\302\240\302\240\302\240 return 0;\n" + ">> +??? return 0;\n" ">> +}\n" ">> +\n" ">> +static ssize_t show_tcontrol(struct device *dev,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 struct device_attribute *attr,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 char *buf)\n" + ">> +???????????????? struct device_attribute *attr,\n" + ">> +???????????????? char *buf)\n" ">> +{\n" - ">> +\302\240\302\240\302\240 struct peci_hwmon *priv = dev_get_drvdata(dev);\n" - ">> +\302\240\302\240\302\240 int rc;\n" + ">> +??? struct peci_hwmon *priv = dev_get_drvdata(dev);\n" + ">> +??? int rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240 rc = get_tcontrol(priv);\n" - ">> +\302\240\302\240\302\240 if (rc < 0)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return rc;\n" + ">> +??? rc = get_tcontrol(priv);\n" + ">> +??? if (rc < 0)\n" + ">> +??????? return rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240 return sprintf(buf, \"%d\\n\", priv->temp.tcontrol.value);\n" + ">> +??? return sprintf(buf, \"%d\\n\", priv->temp.tcontrol.value);\n" ">> +}\n" ">> +\n" ">> +static ssize_t show_tcontrol_margin(struct device *dev,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 struct device_attribute *attr,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 char *buf)\n" + ">> +??????????????????? struct device_attribute *attr,\n" + ">> +??????????????????? char *buf)\n" ">> +{\n" - ">> +\302\240\302\240\302\240 struct peci_hwmon *priv = dev_get_drvdata(dev);\n" - ">> +\302\240\302\240\302\240 struct sensor_device_attribute *sensor_attr = \n" + ">> +??? struct peci_hwmon *priv = dev_get_drvdata(dev);\n" + ">> +??? struct sensor_device_attribute *sensor_attr = \n" ">> to_sensor_dev_attr(attr);\n" - ">> +\302\240\302\240\302\240 int rc;\n" + ">> +??? int rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240 rc = get_tcontrol(priv);\n" - ">> +\302\240\302\240\302\240 if (rc < 0)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return rc;\n" + ">> +??? rc = get_tcontrol(priv);\n" + ">> +??? if (rc < 0)\n" + ">> +??????? return rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240 return sprintf(buf, \"%d\\n\", sensor_attr->index == POS ?\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 priv->temp.tjmax.value -\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 priv->temp.tcontrol.value :\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 priv->temp.tcontrol.value -\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 priv->temp.tjmax.value);\n" + ">> +??? return sprintf(buf, \"%d\\n\", sensor_attr->index == POS ?\n" + ">> +??????????????????? priv->temp.tjmax.value -\n" + ">> +??????????????????? priv->temp.tcontrol.value :\n" + ">> +??????????????????? priv->temp.tcontrol.value -\n" + ">> +??????????????????? priv->temp.tjmax.value);\n" ">> +}\n" ">> +\n" ">> +static ssize_t show_tthrottle(struct device *dev,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 struct device_attribute *attr,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 char *buf)\n" + ">> +????????????????? struct device_attribute *attr,\n" + ">> +????????????????? char *buf)\n" ">> +{\n" - ">> +\302\240\302\240\302\240 struct peci_hwmon *priv = dev_get_drvdata(dev);\n" - ">> +\302\240\302\240\302\240 int rc;\n" + ">> +??? struct peci_hwmon *priv = dev_get_drvdata(dev);\n" + ">> +??? int rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240 rc = get_tthrottle(priv);\n" - ">> +\302\240\302\240\302\240 if (rc < 0)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return rc;\n" + ">> +??? rc = get_tthrottle(priv);\n" + ">> +??? if (rc < 0)\n" + ">> +??????? return rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240 return sprintf(buf, \"%d\\n\", priv->temp.tthrottle.value);\n" + ">> +??? return sprintf(buf, \"%d\\n\", priv->temp.tthrottle.value);\n" ">> +}\n" ">> +\n" ">> +static ssize_t show_tjmax(struct device *dev,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 struct device_attribute *attr,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 char *buf)\n" + ">> +????????????? struct device_attribute *attr,\n" + ">> +????????????? char *buf)\n" ">> +{\n" - ">> +\302\240\302\240\302\240 struct peci_hwmon *priv = dev_get_drvdata(dev);\n" - ">> +\302\240\302\240\302\240 int rc;\n" + ">> +??? struct peci_hwmon *priv = dev_get_drvdata(dev);\n" + ">> +??? int rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240 rc = get_tjmax(priv);\n" - ">> +\302\240\302\240\302\240 if (rc < 0)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return rc;\n" + ">> +??? rc = get_tjmax(priv);\n" + ">> +??? if (rc < 0)\n" + ">> +??????? return rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240 return sprintf(buf, \"%d\\n\", priv->temp.tjmax.value);\n" + ">> +??? return sprintf(buf, \"%d\\n\", priv->temp.tjmax.value);\n" ">> +}\n" ">> +\n" ">> +static ssize_t show_die_temp(struct device *dev,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 struct device_attribute *attr,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 char *buf)\n" + ">> +???????????????? struct device_attribute *attr,\n" + ">> +???????????????? char *buf)\n" ">> +{\n" - ">> +\302\240\302\240\302\240 struct peci_hwmon *priv = dev_get_drvdata(dev);\n" - ">> +\302\240\302\240\302\240 int rc;\n" + ">> +??? struct peci_hwmon *priv = dev_get_drvdata(dev);\n" + ">> +??? int rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240 rc = get_die_temp(priv);\n" - ">> +\302\240\302\240\302\240 if (rc < 0)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return rc;\n" + ">> +??? rc = get_die_temp(priv);\n" + ">> +??? if (rc < 0)\n" + ">> +??????? return rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240 return sprintf(buf, \"%d\\n\", priv->temp.die.value);\n" + ">> +??? return sprintf(buf, \"%d\\n\", priv->temp.die.value);\n" ">> +}\n" ">> +\n" ">> +static ssize_t show_dts_margin(struct device *dev,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 struct device_attribute *attr,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 char *buf)\n" + ">> +?????????????????? struct device_attribute *attr,\n" + ">> +?????????????????? char *buf)\n" ">> +{\n" - ">> +\302\240\302\240\302\240 struct peci_hwmon *priv = dev_get_drvdata(dev);\n" - ">> +\302\240\302\240\302\240 int rc;\n" + ">> +??? struct peci_hwmon *priv = dev_get_drvdata(dev);\n" + ">> +??? int rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240 rc = get_dts_margin(priv);\n" - ">> +\302\240\302\240\302\240 if (rc < 0)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return rc;\n" + ">> +??? rc = get_dts_margin(priv);\n" + ">> +??? if (rc < 0)\n" + ">> +??????? return rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240 return sprintf(buf, \"%d\\n\", priv->temp.dts_margin.value);\n" + ">> +??? return sprintf(buf, \"%d\\n\", priv->temp.dts_margin.value);\n" ">> +}\n" ">> +\n" ">> +static ssize_t show_core_temp(struct device *dev,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 struct device_attribute *attr,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 char *buf)\n" + ">> +????????????????? struct device_attribute *attr,\n" + ">> +????????????????? char *buf)\n" ">> +{\n" - ">> +\302\240\302\240\302\240 struct peci_hwmon *priv = dev_get_drvdata(dev);\n" - ">> +\302\240\302\240\302\240 struct sensor_device_attribute *sensor_attr = \n" + ">> +??? struct peci_hwmon *priv = dev_get_drvdata(dev);\n" + ">> +??? struct sensor_device_attribute *sensor_attr = \n" ">> to_sensor_dev_attr(attr);\n" - ">> +\302\240\302\240\302\240 int core_index = sensor_attr->index;\n" - ">> +\302\240\302\240\302\240 int rc;\n" + ">> +??? int core_index = sensor_attr->index;\n" + ">> +??? int rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240 rc = get_core_temp(priv, core_index);\n" - ">> +\302\240\302\240\302\240 if (rc < 0)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return rc;\n" + ">> +??? rc = get_core_temp(priv, core_index);\n" + ">> +??? if (rc < 0)\n" + ">> +??????? return rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240 return sprintf(buf, \"%d\\n\", priv->temp.core[core_index].value);\n" + ">> +??? return sprintf(buf, \"%d\\n\", priv->temp.core[core_index].value);\n" ">> +}\n" ">> +\n" ">> +static ssize_t show_dimm_temp(struct device *dev,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 struct device_attribute *attr,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 char *buf)\n" + ">> +????????????????? struct device_attribute *attr,\n" + ">> +????????????????? char *buf)\n" ">> +{\n" - ">> +\302\240\302\240\302\240 struct peci_hwmon *priv = dev_get_drvdata(dev);\n" - ">> +\302\240\302\240\302\240 struct sensor_device_attribute *sensor_attr = \n" + ">> +??? struct peci_hwmon *priv = dev_get_drvdata(dev);\n" + ">> +??? struct sensor_device_attribute *sensor_attr = \n" ">> to_sensor_dev_attr(attr);\n" - ">> +\302\240\302\240\302\240 int dimm_index = sensor_attr->index;\n" - ">> +\302\240\302\240\302\240 int rc;\n" + ">> +??? int dimm_index = sensor_attr->index;\n" + ">> +??? int rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240 rc = get_dimm_temp(priv, dimm_index);\n" - ">> +\302\240\302\240\302\240 if (rc < 0)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return rc;\n" + ">> +??? rc = get_dimm_temp(priv, dimm_index);\n" + ">> +??? if (rc < 0)\n" + ">> +??????? return rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240 return sprintf(buf, \"%d\\n\", priv->temp.dimm[dimm_index].value);\n" + ">> +??? return sprintf(buf, \"%d\\n\", priv->temp.dimm[dimm_index].value);\n" ">> +}\n" ">> +\n" ">> +static ssize_t show_value(struct device *dev,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 struct device_attribute *attr,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 char *buf)\n" + ">> +????????????? struct device_attribute *attr,\n" + ">> +????????????? char *buf)\n" ">> +{\n" - ">> +\302\240\302\240\302\240 struct sensor_device_attribute *sensor_attr = \n" + ">> +??? struct sensor_device_attribute *sensor_attr = \n" ">> to_sensor_dev_attr(attr);\n" ">> +\n" - ">> +\302\240\302\240\302\240 return sprintf(buf, \"%d\\n\", sensor_attr->index);\n" + ">> +??? return sprintf(buf, \"%d\\n\", sensor_attr->index);\n" ">> +}\n" ">> +\n" ">> +static ssize_t show_label(struct device *dev,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 struct device_attribute *attr,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 char *buf)\n" + ">> +????????????? struct device_attribute *attr,\n" + ">> +????????????? char *buf)\n" ">> +{\n" - ">> +\302\240\302\240\302\240 struct sensor_device_attribute *sensor_attr = \n" + ">> +??? struct sensor_device_attribute *sensor_attr = \n" ">> to_sensor_dev_attr(attr);\n" ">> +\n" - ">> +\302\240\302\240\302\240 return sprintf(buf, peci_label[sensor_attr->index]);\n" + ">> +??? return sprintf(buf, peci_label[sensor_attr->index]);\n" ">> +}\n" ">> +\n" ">> +static ssize_t show_core_label(struct device *dev,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 struct device_attribute *attr,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 char *buf)\n" + ">> +?????????????????? struct device_attribute *attr,\n" + ">> +?????????????????? char *buf)\n" ">> +{\n" - ">> +\302\240\302\240\302\240 struct sensor_device_attribute *sensor_attr = \n" + ">> +??? struct sensor_device_attribute *sensor_attr = \n" ">> to_sensor_dev_attr(attr);\n" ">> +\n" - ">> +\302\240\302\240\302\240 return sprintf(buf, \"Core %d\\n\", sensor_attr->index);\n" + ">> +??? return sprintf(buf, \"Core %d\\n\", sensor_attr->index);\n" ">> +}\n" ">> +\n" ">> +static ssize_t show_dimm_label(struct device *dev,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 struct device_attribute *attr,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 char *buf)\n" + ">> +?????????????????? struct device_attribute *attr,\n" + ">> +?????????????????? char *buf)\n" ">> +{\n" - ">> +\302\240\302\240\302\240 struct sensor_device_attribute *sensor_attr = \n" + ">> +??? struct sensor_device_attribute *sensor_attr = \n" ">> to_sensor_dev_attr(attr);\n" ">> +\n" - ">> +\302\240\302\240\302\240 char channel = 'A' + (sensor_attr->index / 2);\n" - ">> +\302\240\302\240\302\240 int index = sensor_attr->index % 2;\n" + ">> +??? char channel = 'A' + (sensor_attr->index / 2);\n" + ">> +??? int index = sensor_attr->index % 2;\n" ">> +\n" - ">> +\302\240\302\240\302\240 return sprintf(buf, \"DIMM %d (%c%d)\\n\",\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 sensor_attr->index, channel, index);\n" + ">> +??? return sprintf(buf, \"DIMM %d (%c%d)\\n\",\n" + ">> +?????????????? sensor_attr->index, channel, index);\n" ">> +}\n" ">> +\n" ">> +/* Die temperature */\n" @@ -660,19 +646,19 @@ ">> +static SENSOR_DEVICE_ATTR(temp1_crit, 0444, show_tjmax, NULL, 0);\n" ">> +static SENSOR_DEVICE_ATTR(temp1_crit_hyst, 0444, \n" ">> show_tcontrol_margin, NULL,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 POS);\n" + ">> +????????????? POS);\n" ">> +\n" ">> +static struct attribute *die_temp_attrs[] = {\n" - ">> +\302\240\302\240\302\240 &sensor_dev_attr_temp1_label.dev_attr.attr,\n" - ">> +\302\240\302\240\302\240 &sensor_dev_attr_temp1_input.dev_attr.attr,\n" - ">> +\302\240\302\240\302\240 &sensor_dev_attr_temp1_max.dev_attr.attr,\n" - ">> +\302\240\302\240\302\240 &sensor_dev_attr_temp1_crit.dev_attr.attr,\n" - ">> +\302\240\302\240\302\240 &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr,\n" - ">> +\302\240\302\240\302\240 NULL\n" + ">> +??? &sensor_dev_attr_temp1_label.dev_attr.attr,\n" + ">> +??? &sensor_dev_attr_temp1_input.dev_attr.attr,\n" + ">> +??? &sensor_dev_attr_temp1_max.dev_attr.attr,\n" + ">> +??? &sensor_dev_attr_temp1_crit.dev_attr.attr,\n" + ">> +??? &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr,\n" + ">> +??? NULL\n" ">> +};\n" ">> +\n" ">> +static struct attribute_group die_temp_attr_group = {\n" - ">> +\302\240\302\240\302\240 .attrs = die_temp_attrs,\n" + ">> +??? .attrs = die_temp_attrs,\n" ">> +};\n" ">> +\n" ">> +/* DTS margin temperature */\n" @@ -683,15 +669,15 @@ ">> NULL, NEG);\n" ">> +\n" ">> +static struct attribute *dts_margin_temp_attrs[] = {\n" - ">> +\302\240\302\240\302\240 &sensor_dev_attr_temp2_label.dev_attr.attr,\n" - ">> +\302\240\302\240\302\240 &sensor_dev_attr_temp2_input.dev_attr.attr,\n" - ">> +\302\240\302\240\302\240 &sensor_dev_attr_temp2_min.dev_attr.attr,\n" - ">> +\302\240\302\240\302\240 &sensor_dev_attr_temp2_lcrit.dev_attr.attr,\n" - ">> +\302\240\302\240\302\240 NULL\n" + ">> +??? &sensor_dev_attr_temp2_label.dev_attr.attr,\n" + ">> +??? &sensor_dev_attr_temp2_input.dev_attr.attr,\n" + ">> +??? &sensor_dev_attr_temp2_min.dev_attr.attr,\n" + ">> +??? &sensor_dev_attr_temp2_lcrit.dev_attr.attr,\n" + ">> +??? NULL\n" ">> +};\n" ">> +\n" ">> +static struct attribute_group dts_margin_temp_attr_group = {\n" - ">> +\302\240\302\240\302\240 .attrs = dts_margin_temp_attrs,\n" + ">> +??? .attrs = dts_margin_temp_attrs,\n" ">> +};\n" ">> +\n" ">> +/* Tcontrol temperature */\n" @@ -701,14 +687,14 @@ ">> +static SENSOR_DEVICE_ATTR(temp3_crit, 0444, show_tjmax, NULL, 0);\n" ">> +\n" ">> +static struct attribute *tcontrol_temp_attrs[] = {\n" - ">> +\302\240\302\240\302\240 &sensor_dev_attr_temp3_label.dev_attr.attr,\n" - ">> +\302\240\302\240\302\240 &sensor_dev_attr_temp3_input.dev_attr.attr,\n" - ">> +\302\240\302\240\302\240 &sensor_dev_attr_temp3_crit.dev_attr.attr,\n" - ">> +\302\240\302\240\302\240 NULL\n" + ">> +??? &sensor_dev_attr_temp3_label.dev_attr.attr,\n" + ">> +??? &sensor_dev_attr_temp3_input.dev_attr.attr,\n" + ">> +??? &sensor_dev_attr_temp3_crit.dev_attr.attr,\n" + ">> +??? NULL\n" ">> +};\n" ">> +\n" ">> +static struct attribute_group tcontrol_temp_attr_group = {\n" - ">> +\302\240\302\240\302\240 .attrs = tcontrol_temp_attrs,\n" + ">> +??? .attrs = tcontrol_temp_attrs,\n" ">> +};\n" ">> +\n" ">> +/* Tthrottle temperature */\n" @@ -717,13 +703,13 @@ ">> +static SENSOR_DEVICE_ATTR(temp4_input, 0444, show_tthrottle, NULL, 0);\n" ">> +\n" ">> +static struct attribute *tthrottle_temp_attrs[] = {\n" - ">> +\302\240\302\240\302\240 &sensor_dev_attr_temp4_label.dev_attr.attr,\n" - ">> +\302\240\302\240\302\240 &sensor_dev_attr_temp4_input.dev_attr.attr,\n" - ">> +\302\240\302\240\302\240 NULL\n" + ">> +??? &sensor_dev_attr_temp4_label.dev_attr.attr,\n" + ">> +??? &sensor_dev_attr_temp4_input.dev_attr.attr,\n" + ">> +??? NULL\n" ">> +};\n" ">> +\n" ">> +static struct attribute_group tthrottle_temp_attr_group = {\n" - ">> +\302\240\302\240\302\240 .attrs = tthrottle_temp_attrs,\n" + ">> +??? .attrs = tthrottle_temp_attrs,\n" ">> +};\n" ">> +\n" ">> +/* Tjmax temperature */\n" @@ -731,332 +717,332 @@ ">> +static SENSOR_DEVICE_ATTR(temp5_input, 0444, show_tjmax, NULL, 0);\n" ">> +\n" ">> +static struct attribute *tjmax_temp_attrs[] = {\n" - ">> +\302\240\302\240\302\240 &sensor_dev_attr_temp5_label.dev_attr.attr,\n" - ">> +\302\240\302\240\302\240 &sensor_dev_attr_temp5_input.dev_attr.attr,\n" - ">> +\302\240\302\240\302\240 NULL\n" + ">> +??? &sensor_dev_attr_temp5_label.dev_attr.attr,\n" + ">> +??? &sensor_dev_attr_temp5_input.dev_attr.attr,\n" + ">> +??? NULL\n" ">> +};\n" ">> +\n" ">> +static struct attribute_group tjmax_temp_attr_group = {\n" - ">> +\302\240\302\240\302\240 .attrs = tjmax_temp_attrs,\n" + ">> +??? .attrs = tjmax_temp_attrs,\n" ">> +};\n" ">> +\n" ">> +static const struct attribute_group *\n" ">> +default_attr_groups[DEFAULT_ATTR_GRP_NUMS + 1] = {\n" - ">> +\302\240\302\240\302\240 &die_temp_attr_group,\n" - ">> +\302\240\302\240\302\240 &dts_margin_temp_attr_group,\n" - ">> +\302\240\302\240\302\240 &tcontrol_temp_attr_group,\n" - ">> +\302\240\302\240\302\240 &tthrottle_temp_attr_group,\n" - ">> +\302\240\302\240\302\240 &tjmax_temp_attr_group,\n" - ">> +\302\240\302\240\302\240 NULL\n" + ">> +??? &die_temp_attr_group,\n" + ">> +??? &dts_margin_temp_attr_group,\n" + ">> +??? &tcontrol_temp_attr_group,\n" + ">> +??? &tthrottle_temp_attr_group,\n" + ">> +??? &tjmax_temp_attr_group,\n" + ">> +??? NULL\n" ">> +};\n" ">> +\n" ">> +/* Core temperature */\n" ">> +static ssize_t (*const core_show_fn[CORE_TEMP_ATTRS]) (struct device \n" ">> *dev,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 struct device_attribute *devattr, char *buf) = {\n" - ">> +\302\240\302\240\302\240 show_core_label,\n" - ">> +\302\240\302\240\302\240 show_core_temp,\n" - ">> +\302\240\302\240\302\240 show_tcontrol,\n" - ">> +\302\240\302\240\302\240 show_tjmax,\n" - ">> +\302\240\302\240\302\240 show_tcontrol_margin,\n" + ">> +??????? struct device_attribute *devattr, char *buf) = {\n" + ">> +??? show_core_label,\n" + ">> +??? show_core_temp,\n" + ">> +??? show_tcontrol,\n" + ">> +??? show_tjmax,\n" + ">> +??? show_tcontrol_margin,\n" ">> +};\n" ">> +\n" ">> +static const char *const core_suffix[CORE_TEMP_ATTRS] = {\n" - ">> +\302\240\302\240\302\240 \"label\",\n" - ">> +\302\240\302\240\302\240 \"input\",\n" - ">> +\302\240\302\240\302\240 \"max\",\n" - ">> +\302\240\302\240\302\240 \"crit\",\n" - ">> +\302\240\302\240\302\240 \"crit_hyst\",\n" + ">> +??? \"label\",\n" + ">> +??? \"input\",\n" + ">> +??? \"max\",\n" + ">> +??? \"crit\",\n" + ">> +??? \"crit_hyst\",\n" ">> +};\n" ">> +\n" ">> +static int check_resolved_cores(struct peci_hwmon *priv)\n" ">> +{\n" - ">> +\302\240\302\240\302\240 struct peci_rd_pci_cfg_local_msg msg;\n" - ">> +\302\240\302\240\302\240 int rc;\n" + ">> +??? struct peci_rd_pci_cfg_local_msg msg;\n" + ">> +??? int rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240 if (!(priv->client->adapter->cmd_mask & \n" + ">> +??? if (!(priv->client->adapter->cmd_mask & \n" ">> BIT(PECI_CMD_RD_PCI_CFG_LOCAL)))\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return -EINVAL;\n" + ">> +??????? return -EINVAL;\n" ">> +\n" - ">> +\302\240\302\240\302\240 /* Get the RESOLVED_CORES register value */\n" - ">> +\302\240\302\240\302\240 msg.addr = priv->addr;\n" - ">> +\302\240\302\240\302\240 msg.bus = 1;\n" - ">> +\302\240\302\240\302\240 msg.device = 30;\n" - ">> +\302\240\302\240\302\240 msg.function = 3;\n" - ">> +\302\240\302\240\302\240 msg.reg = 0xB4;\n" - ">> +\302\240\302\240\302\240 msg.rx_len = 4;\n" + ">> +??? /* Get the RESOLVED_CORES register value */\n" + ">> +??? msg.addr = priv->addr;\n" + ">> +??? msg.bus = 1;\n" + ">> +??? msg.device = 30;\n" + ">> +??? msg.function = 3;\n" + ">> +??? msg.reg = 0xB4;\n" + ">> +??? msg.rx_len = 4;\n" ">> +\n" - ">> +\302\240\302\240\302\240 rc = send_peci_cmd(priv, PECI_CMD_RD_PCI_CFG_LOCAL, (void *)&msg);\n" - ">> +\302\240\302\240\302\240 if (rc < 0)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return rc;\n" + ">> +??? rc = send_peci_cmd(priv, PECI_CMD_RD_PCI_CFG_LOCAL, (void *)&msg);\n" + ">> +??? if (rc < 0)\n" + ">> +??????? return rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240 priv->core_mask = msg.pci_config[3] << 24 |\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 msg.pci_config[2] << 16 |\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 msg.pci_config[1] << 8 |\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 msg.pci_config[0];\n" + ">> +??? priv->core_mask = msg.pci_config[3] << 24 |\n" + ">> +????????????? msg.pci_config[2] << 16 |\n" + ">> +????????????? msg.pci_config[1] << 8 |\n" + ">> +????????????? msg.pci_config[0];\n" ">> +\n" - ">> +\302\240\302\240\302\240 if (!priv->core_mask)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return -EAGAIN;\n" + ">> +??? if (!priv->core_mask)\n" + ">> +??????? return -EAGAIN;\n" ">> +\n" - ">> +\302\240\302\240\302\240 dev_dbg(priv->dev, \"Scanned resolved cores: 0x%x\\n\", \n" + ">> +??? dev_dbg(priv->dev, \"Scanned resolved cores: 0x%x\\n\", \n" ">> priv->core_mask);\n" - ">> +\302\240\302\240\302\240 return 0;\n" + ">> +??? return 0;\n" ">> +}\n" ">> +\n" ">> +static int create_core_temp_group(struct peci_hwmon *priv, int core_no)\n" ">> +{\n" - ">> +\302\240\302\240\302\240 struct core_temp_group *data;\n" - ">> +\302\240\302\240\302\240 int i;\n" - ">> +\n" - ">> +\302\240\302\240\302\240 data = devm_kzalloc(priv->dev, sizeof(struct core_temp_group),\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 GFP_KERNEL);\n" - ">> +\302\240\302\240\302\240 if (!data)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return -ENOMEM;\n" - ">> +\n" - ">> +\302\240\302\240\302\240 for (i = 0; i < CORE_TEMP_ATTRS; i++) {\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 snprintf(data->attr_name[i], ATTR_NAME_LEN,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 \"temp%d_%s\", priv->global_idx, core_suffix[i]);\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 sysfs_attr_init(&data->sd_attrs[i].dev_attr.attr);\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 data->sd_attrs[i].dev_attr.attr.name = data->attr_name[i];\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 data->sd_attrs[i].dev_attr.attr.mode = 0444;\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 data->sd_attrs[i].dev_attr.show = core_show_fn[i];\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 if (i == 0 || i == 1) /* label or temp */\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 data->sd_attrs[i].index = core_no;\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 data->attrs[i] = &data->sd_attrs[i].dev_attr.attr;\n" - ">> +\302\240\302\240\302\240 }\n" - ">> +\n" - ">> +\302\240\302\240\302\240 data->attr_group.attrs = data->attrs;\n" - ">> +\302\240\302\240\302\240 priv->core_attr_groups[priv->core_idx++] = &data->attr_group;\n" - ">> +\302\240\302\240\302\240 priv->global_idx++;\n" - ">> +\n" - ">> +\302\240\302\240\302\240 return 0;\n" + ">> +??? struct core_temp_group *data;\n" + ">> +??? int i;\n" + ">> +\n" + ">> +??? data = devm_kzalloc(priv->dev, sizeof(struct core_temp_group),\n" + ">> +??????????????? GFP_KERNEL);\n" + ">> +??? if (!data)\n" + ">> +??????? return -ENOMEM;\n" + ">> +\n" + ">> +??? for (i = 0; i < CORE_TEMP_ATTRS; i++) {\n" + ">> +??????? snprintf(data->attr_name[i], ATTR_NAME_LEN,\n" + ">> +???????????? \"temp%d_%s\", priv->global_idx, core_suffix[i]);\n" + ">> +??????? sysfs_attr_init(&data->sd_attrs[i].dev_attr.attr);\n" + ">> +??????? data->sd_attrs[i].dev_attr.attr.name = data->attr_name[i];\n" + ">> +??????? data->sd_attrs[i].dev_attr.attr.mode = 0444;\n" + ">> +??????? data->sd_attrs[i].dev_attr.show = core_show_fn[i];\n" + ">> +??????? if (i == 0 || i == 1) /* label or temp */\n" + ">> +??????????? data->sd_attrs[i].index = core_no;\n" + ">> +??????? data->attrs[i] = &data->sd_attrs[i].dev_attr.attr;\n" + ">> +??? }\n" + ">> +\n" + ">> +??? data->attr_group.attrs = data->attrs;\n" + ">> +??? priv->core_attr_groups[priv->core_idx++] = &data->attr_group;\n" + ">> +??? priv->global_idx++;\n" + ">> +\n" + ">> +??? return 0;\n" ">> +}\n" ">> +\n" ">> +static int create_core_temp_groups(struct peci_hwmon *priv)\n" ">> +{\n" - ">> +\302\240\302\240\302\240 int rc, i;\n" - ">> +\n" - ">> +\302\240\302\240\302\240 rc = check_resolved_cores(priv);\n" - ">> +\302\240\302\240\302\240 if (!rc) {\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 for (i = 0; i < CORE_NUMS_MAX; i++) {\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 if (priv->core_mask & BIT(i)) {\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 rc = create_core_temp_group(priv, i);\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 if (rc)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return rc;\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 }\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 }\n" - ">> +\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 rc = sysfs_create_groups(&priv->hwmon_dev->kobj,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 priv->core_attr_groups);\n" - ">> +\302\240\302\240\302\240 }\n" - ">> +\n" - ">> +\302\240\302\240\302\240 return rc;\n" + ">> +??? int rc, i;\n" + ">> +\n" + ">> +??? rc = check_resolved_cores(priv);\n" + ">> +??? if (!rc) {\n" + ">> +??????? for (i = 0; i < CORE_NUMS_MAX; i++) {\n" + ">> +??????????? if (priv->core_mask & BIT(i)) {\n" + ">> +??????????????? rc = create_core_temp_group(priv, i);\n" + ">> +??????????????? if (rc)\n" + ">> +??????????????????? return rc;\n" + ">> +??????????? }\n" + ">> +??????? }\n" + ">> +\n" + ">> +??????? rc = sysfs_create_groups(&priv->hwmon_dev->kobj,\n" + ">> +???????????????????? priv->core_attr_groups);\n" + ">> +??? }\n" + ">> +\n" + ">> +??? return rc;\n" ">> +}\n" ">> +\n" ">> +/* DIMM temperature */\n" ">> +static ssize_t (*const dimm_show_fn[DIMM_TEMP_ATTRS]) (struct device \n" ">> *dev,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 struct device_attribute *devattr, char *buf) = {\n" - ">> +\302\240\302\240\302\240 show_dimm_label,\n" - ">> +\302\240\302\240\302\240 show_dimm_temp,\n" + ">> +??????? struct device_attribute *devattr, char *buf) = {\n" + ">> +??? show_dimm_label,\n" + ">> +??? show_dimm_temp,\n" ">> +};\n" ">> +\n" ">> +static const char *const dimm_suffix[DIMM_TEMP_ATTRS] = {\n" - ">> +\302\240\302\240\302\240 \"label\",\n" - ">> +\302\240\302\240\302\240 \"input\",\n" + ">> +??? \"label\",\n" + ">> +??? \"input\",\n" ">> +};\n" ">> +\n" ">> +static int check_populated_dimms(struct peci_hwmon *priv)\n" ">> +{\n" - ">> +\302\240\302\240\302\240 struct peci_rd_pkg_cfg_msg msg;\n" - ">> +\302\240\302\240\302\240 int i, rc, pass = 0;\n" + ">> +??? struct peci_rd_pkg_cfg_msg msg;\n" + ">> +??? int i, rc, pass = 0;\n" ">> +\n" ">> +do_scan:\n" - ">> +\302\240\302\240\302\240 for (i = 0; i < (DIMM_SLOT_NUMS_MAX / 2); i++) {\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 msg.addr = priv->addr;\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 msg.index = MBX_INDEX_DDR_DIMM_TEMP;\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 msg.param = i; /* channel */\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 msg.rx_len = 4;\n" + ">> +??? for (i = 0; i < (DIMM_SLOT_NUMS_MAX / 2); i++) {\n" + ">> +??????? msg.addr = priv->addr;\n" + ">> +??????? msg.index = MBX_INDEX_DDR_DIMM_TEMP;\n" + ">> +??????? msg.param = i; /* channel */\n" + ">> +??????? msg.rx_len = 4;\n" ">> +\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 rc = send_peci_cmd(priv, PECI_CMD_RD_PKG_CFG, (void *)&msg);\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 if (rc < 0)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return rc;\n" + ">> +??????? rc = send_peci_cmd(priv, PECI_CMD_RD_PKG_CFG, (void *)&msg);\n" + ">> +??????? if (rc < 0)\n" + ">> +??????????? return rc;\n" ">> +\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 if (msg.pkg_config[0]) /* DIMM #0 on the channel */\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 priv->dimm_mask |= BIT(i);\n" + ">> +??????? if (msg.pkg_config[0]) /* DIMM #0 on the channel */\n" + ">> +??????????? priv->dimm_mask |= BIT(i);\n" ">> +\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 if (msg.pkg_config[1]) /* DIMM #1 on the channel */\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 priv->dimm_mask |= BIT(i + 1);\n" - ">> +\302\240\302\240\302\240 }\n" + ">> +??????? if (msg.pkg_config[1]) /* DIMM #1 on the channel */\n" + ">> +??????????? priv->dimm_mask |= BIT(i + 1);\n" + ">> +??? }\n" ">> +\n" - ">> +\302\240\302\240\302\240 /* Do 2-pass scanning */\n" - ">> +\302\240\302\240\302\240 if (priv->dimm_mask && pass == 0) {\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 pass++;\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 goto do_scan;\n" - ">> +\302\240\302\240\302\240 }\n" + ">> +??? /* Do 2-pass scanning */\n" + ">> +??? if (priv->dimm_mask && pass == 0) {\n" + ">> +??????? pass++;\n" + ">> +??????? goto do_scan;\n" + ">> +??? }\n" ">> +\n" - ">> +\302\240\302\240\302\240 if (!priv->dimm_mask)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return -EAGAIN;\n" + ">> +??? if (!priv->dimm_mask)\n" + ">> +??????? return -EAGAIN;\n" ">> +\n" - ">> +\302\240\302\240\302\240 dev_dbg(priv->dev, \"Scanned populated DIMMs: 0x%x\\n\", \n" + ">> +??? dev_dbg(priv->dev, \"Scanned populated DIMMs: 0x%x\\n\", \n" ">> priv->dimm_mask);\n" - ">> +\302\240\302\240\302\240 return 0;\n" + ">> +??? return 0;\n" ">> +}\n" ">> +\n" ">> +static int create_dimm_temp_group(struct peci_hwmon *priv, int dimm_no)\n" ">> +{\n" - ">> +\302\240\302\240\302\240 struct dimm_temp_group *data;\n" - ">> +\302\240\302\240\302\240 int i;\n" - ">> +\n" - ">> +\302\240\302\240\302\240 data = devm_kzalloc(priv->dev, sizeof(struct dimm_temp_group),\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 GFP_KERNEL);\n" - ">> +\302\240\302\240\302\240 if (!data)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return -ENOMEM;\n" - ">> +\n" - ">> +\302\240\302\240\302\240 for (i = 0; i < DIMM_TEMP_ATTRS; i++) {\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 snprintf(data->attr_name[i], ATTR_NAME_LEN,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 \"temp%d_%s\", priv->global_idx, dimm_suffix[i]);\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 sysfs_attr_init(&data->sd_attrs[i].dev_attr.attr);\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 data->sd_attrs[i].dev_attr.attr.name = data->attr_name[i];\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 data->sd_attrs[i].dev_attr.attr.mode = 0444;\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 data->sd_attrs[i].dev_attr.show = dimm_show_fn[i];\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 data->sd_attrs[i].index = dimm_no;\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 data->attrs[i] = &data->sd_attrs[i].dev_attr.attr;\n" - ">> +\302\240\302\240\302\240 }\n" - ">> +\n" - ">> +\302\240\302\240\302\240 data->attr_group.attrs = data->attrs;\n" - ">> +\302\240\302\240\302\240 priv->dimm_attr_groups[priv->dimm_idx++] = &data->attr_group;\n" - ">> +\302\240\302\240\302\240 priv->global_idx++;\n" - ">> +\n" - ">> +\302\240\302\240\302\240 return 0;\n" + ">> +??? struct dimm_temp_group *data;\n" + ">> +??? int i;\n" + ">> +\n" + ">> +??? data = devm_kzalloc(priv->dev, sizeof(struct dimm_temp_group),\n" + ">> +??????????????? GFP_KERNEL);\n" + ">> +??? if (!data)\n" + ">> +??????? return -ENOMEM;\n" + ">> +\n" + ">> +??? for (i = 0; i < DIMM_TEMP_ATTRS; i++) {\n" + ">> +??????? snprintf(data->attr_name[i], ATTR_NAME_LEN,\n" + ">> +???????????? \"temp%d_%s\", priv->global_idx, dimm_suffix[i]);\n" + ">> +??????? sysfs_attr_init(&data->sd_attrs[i].dev_attr.attr);\n" + ">> +??????? data->sd_attrs[i].dev_attr.attr.name = data->attr_name[i];\n" + ">> +??????? data->sd_attrs[i].dev_attr.attr.mode = 0444;\n" + ">> +??????? data->sd_attrs[i].dev_attr.show = dimm_show_fn[i];\n" + ">> +??????? data->sd_attrs[i].index = dimm_no;\n" + ">> +??????? data->attrs[i] = &data->sd_attrs[i].dev_attr.attr;\n" + ">> +??? }\n" + ">> +\n" + ">> +??? data->attr_group.attrs = data->attrs;\n" + ">> +??? priv->dimm_attr_groups[priv->dimm_idx++] = &data->attr_group;\n" + ">> +??? priv->global_idx++;\n" + ">> +\n" + ">> +??? return 0;\n" ">> +}\n" ">> +\n" ">> +static int create_dimm_temp_groups(struct peci_hwmon *priv)\n" ">> +{\n" - ">> +\302\240\302\240\302\240 int rc, i;\n" - ">> +\n" - ">> +\302\240\302\240\302\240 rc = check_populated_dimms(priv);\n" - ">> +\302\240\302\240\302\240 if (!rc) {\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 for (i = 0; i < DIMM_SLOT_NUMS_MAX; i++) {\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 if (priv->dimm_mask & BIT(i)) {\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 rc = create_dimm_temp_group(priv, i);\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 if (rc)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return rc;\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 }\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 }\n" - ">> +\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 rc = sysfs_create_groups(&priv->hwmon_dev->kobj,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 priv->dimm_attr_groups);\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 if (!rc)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 dev_dbg(priv->dev, \"Done DIMM temp group creation\\n\");\n" - ">> +\302\240\302\240\302\240 } else if (rc == -EAGAIN) {\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 queue_delayed_work(priv->work_queue, &priv->work_handler,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 DIMM_MASK_CHECK_DELAY);\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 dev_dbg(priv->dev, \"Diferred DIMM temp group creation\\n\");\n" - ">> +\302\240\302\240\302\240 }\n" - ">> +\n" - ">> +\302\240\302\240\302\240 return rc;\n" + ">> +??? int rc, i;\n" + ">> +\n" + ">> +??? rc = check_populated_dimms(priv);\n" + ">> +??? if (!rc) {\n" + ">> +??????? for (i = 0; i < DIMM_SLOT_NUMS_MAX; i++) {\n" + ">> +??????????? if (priv->dimm_mask & BIT(i)) {\n" + ">> +??????????????? rc = create_dimm_temp_group(priv, i);\n" + ">> +??????????????? if (rc)\n" + ">> +??????????????????? return rc;\n" + ">> +??????????? }\n" + ">> +??????? }\n" + ">> +\n" + ">> +??????? rc = sysfs_create_groups(&priv->hwmon_dev->kobj,\n" + ">> +???????????????????? priv->dimm_attr_groups);\n" + ">> +??????? if (!rc)\n" + ">> +??????????? dev_dbg(priv->dev, \"Done DIMM temp group creation\\n\");\n" + ">> +??? } else if (rc == -EAGAIN) {\n" + ">> +??????? queue_delayed_work(priv->work_queue, &priv->work_handler,\n" + ">> +?????????????????? DIMM_MASK_CHECK_DELAY);\n" + ">> +??????? dev_dbg(priv->dev, \"Diferred DIMM temp group creation\\n\");\n" + ">> +??? }\n" + ">> +\n" + ">> +??? return rc;\n" ">> +}\n" ">> +\n" ">> +static void create_dimm_temp_groups_delayed(struct work_struct *work)\n" ">> +{\n" - ">> +\302\240\302\240\302\240 struct delayed_work *dwork = to_delayed_work(work);\n" - ">> +\302\240\302\240\302\240 struct peci_hwmon *priv = container_of(dwork, struct peci_hwmon,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 work_handler);\n" - ">> +\302\240\302\240\302\240 int rc;\n" - ">> +\n" - ">> +\302\240\302\240\302\240 rc = create_dimm_temp_groups(priv);\n" - ">> +\302\240\302\240\302\240 if (rc && rc != -EAGAIN)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 dev_dbg(priv->dev, \"Skipped to creat DIMM temp groups\\n\");\n" + ">> +??? struct delayed_work *dwork = to_delayed_work(work);\n" + ">> +??? struct peci_hwmon *priv = container_of(dwork, struct peci_hwmon,\n" + ">> +?????????????????????????? work_handler);\n" + ">> +??? int rc;\n" + ">> +\n" + ">> +??? rc = create_dimm_temp_groups(priv);\n" + ">> +??? if (rc && rc != -EAGAIN)\n" + ">> +??????? dev_dbg(priv->dev, \"Skipped to creat DIMM temp groups\\n\");\n" ">> +}\n" ">> +\n" ">> +static int peci_hwmon_probe(struct peci_client *client)\n" ">> +{\n" - ">> +\302\240\302\240\302\240 struct device *dev = &client->dev;\n" - ">> +\302\240\302\240\302\240 struct peci_hwmon *priv;\n" - ">> +\302\240\302\240\302\240 int rc;\n" - ">> +\n" - ">> +\302\240\302\240\302\240 if ((client->adapter->cmd_mask &\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 (BIT(PECI_CMD_GET_TEMP) | BIT(PECI_CMD_RD_PKG_CFG))) !=\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 (BIT(PECI_CMD_GET_TEMP) | BIT(PECI_CMD_RD_PKG_CFG))) {\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 dev_err(dev, \"Client doesn't support temperature monitoring\\n\");\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return -EINVAL;\n" - ">> +\302\240\302\240\302\240 }\n" - ">> +\n" - ">> +\302\240\302\240\302\240 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);\n" - ">> +\302\240\302\240\302\240 if (!priv)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return -ENOMEM;\n" - ">> +\n" - ">> +\302\240\302\240\302\240 dev_set_drvdata(dev, priv);\n" - ">> +\302\240\302\240\302\240 priv->client = client;\n" - ">> +\302\240\302\240\302\240 priv->dev = dev;\n" - ">> +\302\240\302\240\302\240 priv->addr = client->addr;\n" - ">> +\302\240\302\240\302\240 priv->cpu_no = priv->addr - PECI_BASE_ADDR;\n" - ">> +\n" - ">> +\302\240\302\240\302\240 snprintf(priv->name, PECI_NAME_SIZE, \"peci_hwmon.cpu%d\", \n" + ">> +??? struct device *dev = &client->dev;\n" + ">> +??? struct peci_hwmon *priv;\n" + ">> +??? int rc;\n" + ">> +\n" + ">> +??? if ((client->adapter->cmd_mask &\n" + ">> +??????? (BIT(PECI_CMD_GET_TEMP) | BIT(PECI_CMD_RD_PKG_CFG))) !=\n" + ">> +??????? (BIT(PECI_CMD_GET_TEMP) | BIT(PECI_CMD_RD_PKG_CFG))) {\n" + ">> +??????? dev_err(dev, \"Client doesn't support temperature monitoring\\n\");\n" + ">> +??????? return -EINVAL;\n" + ">> +??? }\n" + ">> +\n" + ">> +??? priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);\n" + ">> +??? if (!priv)\n" + ">> +??????? return -ENOMEM;\n" + ">> +\n" + ">> +??? dev_set_drvdata(dev, priv);\n" + ">> +??? priv->client = client;\n" + ">> +??? priv->dev = dev;\n" + ">> +??? priv->addr = client->addr;\n" + ">> +??? priv->cpu_no = priv->addr - PECI_BASE_ADDR;\n" + ">> +\n" + ">> +??? snprintf(priv->name, PECI_NAME_SIZE, \"peci_hwmon.cpu%d\", \n" ">> priv->cpu_no);\n" ">> +\n" - ">> +\302\240\302\240\302\240 priv->work_queue = create_singlethread_workqueue(priv->name);\n" - ">> +\302\240\302\240\302\240 if (!priv->work_queue)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return -ENOMEM;\n" + ">> +??? priv->work_queue = create_singlethread_workqueue(priv->name);\n" + ">> +??? if (!priv->work_queue)\n" + ">> +??????? return -ENOMEM;\n" ">> +\n" - ">> +\302\240\302\240\302\240 priv->hwmon_dev = hwmon_device_register_with_groups(priv->dev,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 priv->name,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 priv,\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 default_attr_groups);\n" + ">> +??? priv->hwmon_dev = hwmon_device_register_with_groups(priv->dev,\n" + ">> +??????????????????????????????? priv->name,\n" + ">> +??????????????????????????????? priv,\n" + ">> +?????????????????????????????? default_attr_groups);\n" ">> +\n" - ">> +\302\240\302\240\302\240 rc = PTR_ERR_OR_ZERO(priv->hwmon_dev);\n" - ">> +\302\240\302\240\302\240 if (rc) {\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 dev_err(dev, \"Failed to register peci hwmon\\n\");\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return rc;\n" - ">> +\302\240\302\240\302\240 }\n" + ">> +??? rc = PTR_ERR_OR_ZERO(priv->hwmon_dev);\n" + ">> +??? if (rc) {\n" + ">> +??????? dev_err(dev, \"Failed to register peci hwmon\\n\");\n" + ">> +??????? return rc;\n" + ">> +??? }\n" ">> +\n" - ">> +\302\240\302\240\302\240 priv->global_idx = DEFAULT_ATTR_GRP_NUMS + 1;\n" + ">> +??? priv->global_idx = DEFAULT_ATTR_GRP_NUMS + 1;\n" ">> +\n" - ">> +\302\240\302\240\302\240 rc = create_core_temp_groups(priv);\n" - ">> +\302\240\302\240\302\240 if (rc) {\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 dev_err(dev, \"Failed to create core groups\\n\");\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 return rc;\n" - ">> +\302\240\302\240\302\240 }\n" + ">> +??? rc = create_core_temp_groups(priv);\n" + ">> +??? if (rc) {\n" + ">> +??????? dev_err(dev, \"Failed to create core groups\\n\");\n" + ">> +??????? return rc;\n" + ">> +??? }\n" ">> +\n" - ">> +\302\240\302\240\302\240 INIT_DELAYED_WORK(&priv->work_handler, \n" + ">> +??? INIT_DELAYED_WORK(&priv->work_handler, \n" ">> create_dimm_temp_groups_delayed);\n" ">> +\n" - ">> +\302\240\302\240\302\240 rc = create_dimm_temp_groups(priv);\n" - ">> +\302\240\302\240\302\240 if (rc && rc != -EAGAIN)\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 dev_dbg(dev, \"Skipped to creat DIMM temp groups\\n\");\n" + ">> +??? rc = create_dimm_temp_groups(priv);\n" + ">> +??? if (rc && rc != -EAGAIN)\n" + ">> +??????? dev_dbg(dev, \"Skipped to creat DIMM temp groups\\n\");\n" ">> +\n" - ">> +\302\240\302\240\302\240 dev_dbg(dev, \"peci hwmon for CPU at 0x%x registered\\n\", priv->addr);\n" + ">> +??? dev_dbg(dev, \"peci hwmon for CPU at 0x%x registered\\n\", priv->addr);\n" ">> +\n" - ">> +\302\240\302\240\302\240 return 0;\n" + ">> +??? return 0;\n" ">> +}\n" ">> +\n" ">> +static int peci_hwmon_remove(struct peci_client *client)\n" ">> +{\n" - ">> +\302\240\302\240\302\240 struct peci_hwmon *priv = dev_get_drvdata(&client->dev);\n" + ">> +??? struct peci_hwmon *priv = dev_get_drvdata(&client->dev);\n" ">> +\n" - ">> +\302\240\302\240\302\240 cancel_delayed_work(&priv->work_handler);\n" - ">> +\302\240\302\240\302\240 destroy_workqueue(priv->work_queue);\n" - ">> +\302\240\302\240\302\240 sysfs_remove_groups(&priv->hwmon_dev->kobj, priv->core_attr_groups);\n" - ">> +\302\240\302\240\302\240 sysfs_remove_groups(&priv->hwmon_dev->kobj, priv->dimm_attr_groups);\n" - ">> +\302\240\302\240\302\240 hwmon_device_unregister(priv->hwmon_dev);\n" + ">> +??? cancel_delayed_work(&priv->work_handler);\n" + ">> +??? destroy_workqueue(priv->work_queue);\n" + ">> +??? sysfs_remove_groups(&priv->hwmon_dev->kobj, priv->core_attr_groups);\n" + ">> +??? sysfs_remove_groups(&priv->hwmon_dev->kobj, priv->dimm_attr_groups);\n" + ">> +??? hwmon_device_unregister(priv->hwmon_dev);\n" ">> +\n" - ">> +\302\240\302\240\302\240 return 0;\n" + ">> +??? return 0;\n" ">> +}\n" ">> +\n" ">> +static const struct of_device_id peci_of_table[] = {\n" - ">> +\302\240\302\240\302\240 { .compatible = \"intel,peci-hwmon\", },\n" - ">> +\302\240\302\240\302\240 { }\n" + ">> +??? { .compatible = \"intel,peci-hwmon\", },\n" + ">> +??? { }\n" ">> +};\n" ">> +MODULE_DEVICE_TABLE(of, peci_of_table);\n" ">> +\n" ">> +static struct peci_driver peci_hwmon_driver = {\n" - ">> +\302\240\302\240\302\240 .probe\302\240 = peci_hwmon_probe,\n" - ">> +\302\240\302\240\302\240 .remove = peci_hwmon_remove,\n" - ">> +\302\240\302\240\302\240 .driver = {\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 .name\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240 = \"peci-hwmon\",\n" - ">> +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 .of_match_table = of_match_ptr(peci_of_table),\n" - ">> +\302\240\302\240\302\240 },\n" + ">> +??? .probe? = peci_hwmon_probe,\n" + ">> +??? .remove = peci_hwmon_remove,\n" + ">> +??? .driver = {\n" + ">> +??????? .name?????????? = \"peci-hwmon\",\n" + ">> +??????? .of_match_table = of_match_ptr(peci_of_table),\n" + ">> +??? },\n" ">> +};\n" ">> +module_peci_driver(peci_hwmon_driver);\n" ">> +\n" @@ -1064,10 +1050,6 @@ ">> +MODULE_DESCRIPTION(\"PECI hwmon driver\");\n" ">> +MODULE_LICENSE(\"GPL v2\");\n" ">>\n" - "> \n" - "--\n" - "To unsubscribe from this list: send the line \"unsubscribe linux-doc\" in\n" - "the body of a message to majordomo@vger.kernel.org\n" - More majordomo info at http://vger.kernel.org/majordomo-info.html + > -a3c66011673d3545aba4635ec01383916b8cc89e57db3e7da574d2b5b67071ff +f5a1800a51ea6d592ee11a4d965241151707bb082b2ff22b3aee183dd014c2de
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.