blob: 51f273f266655046aed5bb0cecb7ecc29de322dd [file] [log] [blame]
Artem Senichev67355a82018-03-16 12:35:51 +03001From 7d9fc8ec22199e7fc7eca6079cb42f25554851f7 Mon Sep 17 00:00:00 2001
2From: Artem Senichev <a.senichev@yadro.com>
3Date: Tue, 13 Mar 2018 14:17:00 +0300
4Subject: [PATCH] Add DIMM temperature sensors
5
Artem Senichev18bb8e52018-04-02 11:46:13 +03006Customize/override 0xFF temp_sid based on the different CPU/Cen/DIMM index
7which can be decoded by OpenBMC accordingly.
8See also: hostboot-0005-Fill-empty-sensor-id-to-reserved-id-0xFF.patch.
9
Artem Senichev67355a82018-03-16 12:35:51 +030010Originally created by MSI (S188)
11
12Signed-off-by: Artem Senichev <a.senichev@yadro.com>
13---
14 src/occ/cmdh/cmdh_fsp_cmds.c | 54 ++++++++++++++++++++++++++++++++++++++++++--
15 1 file changed, 52 insertions(+), 2 deletions(-)
16
17diff --git a/src/occ/cmdh/cmdh_fsp_cmds.c b/src/occ/cmdh/cmdh_fsp_cmds.c
18index 74e45da..fb2f72d 100755
19--- a/src/occ/cmdh/cmdh_fsp_cmds.c
20+++ b/src/occ/cmdh/cmdh_fsp_cmds.c
21@@ -355,10 +355,40 @@ ERRL_RC cmdh_poll_v10(cmdh_fsp_rsp_t * o_rsp_ptr)
22 l_sensorHeader.length = sizeof(cmdh_poll_temp_sensor_t);
23 l_sensorHeader.count = 0;
24
25+ uint16_t CpuIpmiId = 0;
26+
27+ //Check the current OCC
28+ if (l_poll_rsp->occ_pres_mask == 0x02)
29+ {
30+ CpuIpmiId = 0x0D; //CPU1
31+ }
32+ else if (l_poll_rsp->occ_pres_mask == 0x04)
33+ {
34+ CpuIpmiId = 0x02; //CPU2
35+ }
36+ else if (l_poll_rsp->occ_pres_mask == 0x08)
37+ {
38+ CpuIpmiId = 0x0A; //CPU3
39+ }
40+ else
41+ {
42+ CpuIpmiId = 0x0B; //CPU0
43+ }
44+
45 //Initialize to max number of possible temperature sensors.
46- cmdh_poll_temp_sensor_t l_tempSensorList[MAX_NUM_CORES + MAX_NUM_MEM_CONTROLLERS + (MAX_NUM_MEM_CONTROLLERS * NUM_DIMMS_PER_CENTAUR)];
47+ cmdh_poll_temp_sensor_t l_tempSensorList[MAX_NUM_CORES + MAX_NUM_MEM_CONTROLLERS + (MAX_NUM_MEM_CONTROLLERS * NUM_DIMMS_PER_CENTAUR) + 2]; //Add two items for peak/average core temperature.
48 memset(l_tempSensorList, 0x00, sizeof(l_tempSensorList));
49
50+ //The average value of core temperature. Currently not used.
51+ l_tempSensorList[l_sensorHeader.count].id = G_amec_sensor_list[TEMP2MSP0]->ipmi_sid;
52+ l_tempSensorList[l_sensorHeader.count].value = G_amec_sensor_list[TEMP2MSP0]->sample;
53+ l_sensorHeader.count++;
54+
55+ //The peak value of core temperature
56+ l_tempSensorList[l_sensorHeader.count].id = CpuIpmiId;
57+ l_tempSensorList[l_sensorHeader.count].value = G_amec_sensor_list[TEMP2MSP0PEAK]->sample;
58+ l_sensorHeader.count++;
59+
60 for (k=0; k<MAX_NUM_CORES; k++)
61 {
62 if(CORE_PRESENT(k))
63@@ -370,6 +400,26 @@ ERRL_RC cmdh_poll_v10(cmdh_fsp_rsp_t * o_rsp_ptr)
64 }
65
66 uint8_t l_cent, l_dimm = 0;
67+ uint16_t CpuId = 0;
68+
69+ //Check the current OCC
70+ if(l_poll_rsp->occ_pres_mask == 0x02)
71+ {
72+ CpuId = 0x0200; //CPU1
73+ }
74+ else if (l_poll_rsp->occ_pres_mask == 0x04)
75+ {
76+ CpuId = 0x0300; //CPU2
77+ }
78+ else if (l_poll_rsp->occ_pres_mask == 0x08)
79+ {
80+ CpuId = 0x0400; //CPU3
81+ }
82+ else
83+ {
84+ CpuId = 0x0100; //CPU0
85+ }
86+
87 for (l_cent=0; l_cent < MAX_NUM_MEM_CONTROLLERS; l_cent++)
88 {
89 if (CENTAUR_PRESENT(l_cent))
90@@ -391,7 +441,7 @@ ERRL_RC cmdh_poll_v10(cmdh_fsp_rsp_t * o_rsp_ptr)
91 {
92 if (g_amec->proc[0].memctl[l_cent].centaur.dimm_temps[l_dimm].temp_sid != 0)
93 {
94- l_tempSensorList[l_sensorHeader.count].id = g_amec->proc[0].memctl[l_cent].centaur.dimm_temps[l_dimm].temp_sid;
95+ l_tempSensorList[l_sensorHeader.count].id = CpuId + (l_cent * 8) + l_dimm; //Add extra temperature IDs for all DIMMs.
96 //If a dimm timed out long enough, we should return 0xFFFF for that sensor.
97 if (G_dimm_temp_expired_bitmap.bytes[l_cent] & (DIMM_SENSOR0 >> l_dimm))
98 {
99--
1002.14.1
101