epow: Change log message prefix

This patch changes the log message prefix from EPOW to FSPEPOW
as this standard is followed every where in FSP specific code
base. This also changes a bit in the file header.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
dpo: Move the FSP async messagae handling into a separate file

This patch moves the DPO message handling from FSP core code into
a separate file to make it more cleaner and to add OPAL interfaces
in the subsequent patch. It does not change anything functionally.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
dpo: Add OPAL interface to access the DPO timeout

This patch adds a OPAL interface to fetch the DPO timeout. This
functionality is required to synchronously query Sapphire about
how much seconds are remaining for a forced system shutdown which
is useful in cases where the host has missed the OPAL_MSG_DPO for
some reason like system boot, reboot or kexec operations. This
ensures host can still query about the DPO timeout status and act.
This patch also adds helper routine to convert time base into seconds.

Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
ipmi/bt: Fixup BT device tree property

It seems that when we commited the IPMI/BT driver we updated the
device tree compatible property for the iBT interface. Unfortunately
Palmetto still requires a DT fixup for this node and somewhere along
the way there was a typo.

Signed-off-by: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
fsp/surv: Remove tb print on surv error

Now that the log automatically timestamps entries, remove the tb print
in the error paths.

Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
fsp/fsp-rtc: Fix typo in 400-year calculation in tm_add

This chagne fixes a bug found by Alistair Popple: we have a stray '9' in
the count of non-leap-years in 400 years. This will cause an incorrect
result from tm_add if the TOD cache is >400 years old.

Signed-off-by: Jeremy Kerr <jeremy.kerr@au.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
SURV: Trigger HIR on surv sysparam query error

For the case where the survserver on the fsp server is dead (for whatever
reason [1]), even before the first time query via sysparam of the surv
status by sapphire, we get an error response to the sysparam query.

We should apparently trigger a HIR in that case (same as phyp).

[1] survserver has a real bug on a 'fsptelinit --disablerecovery'
followed by a 'kill -9 <survserver_pid>'

Fixes https://bugzilla.linux.ibm.com/show_bug.cgi?id=114646.

Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Signed-off-by: Jeremy Kerr <jeremy.kerr@au.ibm.com>
ipmi: Correct chassis control message

I misread the spec when implementing the chassis control message.
This fixes the message, as well as correcting the naming of the IPMI
fields to better reflect what they represent.

Signed-off-by: Joel Stanley <joel@jms.id.au>
Acked-by: Jeremy Kerr <jeremy.kerr@au.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
ccan/endian: Update endian module

This pulls in a fix for warnings in our tests:

  hdata/test/../spira.c:64:64: warning: suggest parentheses around ‘+’
  in operand of ‘&’ [-Wparentheses]
    .addr = CPU_TO_BE64((unsigned long)&(cpu_ctl_sp_attn_area1) + SKIBOOT_BASE)

Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
{core,hdata}/test: Add prlog to stub

We are missing a prlog for tests. This adds a dumb version that ignores
the log level and uses printf to display all messages.

Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
hdata/test: Fix broken tests

Commit e810dcbc (ATTN: Set up attention area to handle attention) broke
tests, as the familiy of CPU_TO_BEXX macros are not compile time constant.

hdata/test/../spira.c:60:4: error: initializer element is not constant
    .addr = CPU_TO_BE64((unsigned long)&(cpu_ctl_spat_area) + SKIBOOT_BASE)

There is no test coverage of this code, so for now we can comment out
these areas in order to allow the tests to pass.

Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
libc: Add mktime and gmtime_r

Both the FSP RTC and the upcoming IPMI RTC implementation need to
manipulate time in various ways. Rather than re-implementing slightly
different versions of the calculations twice lets implement some
standard library functions (with tests) and use those.

This patch adds mktime and gmtime_r to the libc.

Signed-off-by: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Merge remote-tracking branch 'ltcgit/master'
SURV: Trigger HIR on surv sysparam query error

For the case where the survserver on the fsp server is dead (for whatever
reason [1]), even before the first time query via sysparam of the surv
status by sapphire, we get an error response to the sysparam query.

We should apparently trigger a HIR in that case (same as phyp).

[1] survserver has a real bug on a 'fsptelinit --disablerecovery'
followed by a 'kill -9 <survserver_pid>'

Fixes https://bugzilla.linux.ibm.com/show_bug.cgi?id=114646.

Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Signed-off-by: Jeremy Kerr <jeremy.kerr@au.ibm.com>
fsp/rtc: Use libc time functions

Our libc now has a proper implementation of mktime, which makes adding
tm structures together easy. This patch makes the FSP RTC functions
use the library functions and removes the generic time calculation
code from the FSP RTC driver.

The OPAL<->tm conversion functions are also made public as they will
be useful for the IPMI RTC implementation.

Signed-off-by: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
ipmi: Add an IPMI command to get and set the RTC

Add IPMI GET_SEL_TIME and SET_SEL_TIME commands to the IPMI stack.

Signed-off-by: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Merge remote-tracking branch 'ltcgit/master'