diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2014-09-01 14:19:21 +1000 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2014-09-01 14:21:11 +1000 |
commit | 187af5025e5a8517d4d801248a89420ff23c9f4b (patch) | |
tree | a39a7d3e1b08910812695fa25828694c2dee2f27 /core | |
parent | 05f52a8dd7c7e402896e049fd24f83d56b70aff4 (diff) | |
download | skiboot-187af5025e5a8517d4d801248a89420ff23c9f4b.zip skiboot-187af5025e5a8517d4d801248a89420ff23c9f4b.tar.gz skiboot-187af5025e5a8517d4d801248a89420ff23c9f4b.tar.bz2 |
ipmi: Improve RTC support
Create a device-node which will be used by Linux for matching
and use a saner default time if IPMI doesn't work.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'core')
-rw-r--r-- | core/ipmi.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/core/ipmi.c b/core/ipmi.c index 1278c09..30ea78a 100644 --- a/core/ipmi.c +++ b/core/ipmi.c @@ -18,10 +18,12 @@ #include <bt.h> #include <ipmi.h> #include <opal.h> +#include <device.h> #include <time.h> #include <time-utils.h> -static time_t time = 0; +/* Sane default (2014/01/01) */ +static time_t time = 1388494800; static void ipmi_process_storage_resp(struct ipmi_msg *msg) { @@ -111,6 +113,15 @@ static int64_t ipmi_opal_rtc_write(uint32_t year_month_day, return OPAL_SUCCESS; } +static void ipmi_rtc_init(void) +{ + struct dt_node *np = dt_new(opal_node, "rtc"); + dt_add_property_strings(np, "compatible", "ibm,opal-rtc"); + + opal_register(OPAL_RTC_READ, ipmi_opal_rtc_read, 2); + opal_register(OPAL_RTC_WRITE, ipmi_opal_rtc_write, 2); +} + static void ipmi_cmd_done(struct ipmi_msg *msg) { if (msg->cc != IPMI_CC_NO_ERROR) { @@ -162,6 +173,6 @@ int64_t ipmi_opal_chassis_control(uint64_t request) void ipmi_init(void) { bt_init(ipmi_cmd_done); - opal_register(OPAL_RTC_READ, ipmi_opal_rtc_read, 2); - opal_register(OPAL_RTC_WRITE, ipmi_opal_rtc_write, 2); + + ipmi_rtc_init(); } |