summaryrefslogtreecommitdiffstats
path: root/hw/ipmi
diff options
context:
space:
mode:
authorJoel Stanley <joel@jms.id.au>2015-02-27 16:12:01 +1030
committerJeremy Kerr <jk@ozlabs.org>2015-03-04 16:02:20 +0800
commita736f60aaed6bb33047646949df7ab08697a896c (patch)
tree8be60781340c7a0d64e4d7f91491f356325ff731 /hw/ipmi
parent573d0a9af9e46afbefc34cf95510f3d91bc778f6 (diff)
downloadtalos-skiboot-a736f60aaed6bb33047646949df7ab08697a896c.tar.gz
talos-skiboot-a736f60aaed6bb33047646949df7ab08697a896c.zip
hw/ipmi: Set boot count sensor
The boot count sensor is a discrete sensor that is set once the system is up and running. On successful boot, the BMC expects the sensor to be set to 2. Signed-off-by: Joel Stanley <joel@jms.id.au>
Diffstat (limited to 'hw/ipmi')
-rw-r--r--hw/ipmi/ipmi-sensor.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/hw/ipmi/ipmi-sensor.c b/hw/ipmi/ipmi-sensor.c
index 9b08d306..cdaf5fb4 100644
--- a/hw/ipmi/ipmi-sensor.c
+++ b/hw/ipmi/ipmi-sensor.c
@@ -20,11 +20,12 @@
#include <skiboot.h>
#include <string.h>
-/* This field controls whether the sensor reading byte is written or left
- * unchanged according to the sensor */
-#define IPMI_WRITE_SENSOR 0x01
+#define IPMI_WRITE_SENSOR (1 << 1)
+#define IPMI_SET_ASSERTION (1 << 5)
+#define IPMI_ASSERTION_STATE(state) (1 << state)
-#define FW_PROGRESS_SENSOR 0x0F
+#define FW_PROGRESS_SENSOR 0x0F
+#define BOOT_COUNT_SENSOR 0xAA
/* Ghetto. TODO: Do something smarter */
int16_t sensors[255];
@@ -35,6 +36,27 @@ struct set_sensor_req {
u8 reading[8];
};
+int ipmi_set_boot_count(void)
+{
+ struct set_sensor_req req;
+ struct ipmi_msg *msg;
+
+ memset(&req, 0, sizeof(req));
+
+ req.sensor = BOOT_COUNT_SENSOR;
+ /* Set assertion bit */
+ req.operation = IPMI_SET_ASSERTION;
+ /* Set state 2 */
+ req.reading[1] = IPMI_ASSERTION_STATE(2);
+
+ /* We just need the first 4 bytes */
+ msg = ipmi_mkmsg_simple(IPMI_SET_SENSOR_READING, &req, 4);
+ if (!msg)
+ return OPAL_HARDWARE;
+
+ return ipmi_queue_msg(msg);
+}
+
int ipmi_set_fw_progress_sensor(uint8_t state)
{
int fw_sensor_id = sensors[FW_PROGRESS_SENSOR];
OpenPOWER on IntegriCloud