elog: Do not compare elog size in read path

Linux can request for lesser bytes than actual elog size.

Also make sure Linux is not requesting more than elog size.

Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Add cpu_relax to stop cores spinning hard

Ensure a thread is not stopping its siblings from making forward
progress when we are busy-waiting on older DD1.x CPU revisions where
SMT priorities are somewhat broken.

Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
fsp/tpo: Enable Timed power on (TPO) support

This patch enabled TPO sequence handling in Sapphire.
Timed power on notification comes from the user through
set_poweron_time tool. After receiving a valid TPO from user,
Sapphire sends a request to FSP through maibox command to set TPO.
FSP will set TPO and power on the system as per the TPO set by the user.

[ Removed global read_data, removed writing to NULL pointers,
  fixed a couple of memory leaks ... --BenH
]

Signed-off-by: Mamatha Inamdar <mamatha4@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
fsp/rtc: Change properties used to advertize TPO

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
attn: Dump backtrace to buffer

Existing backtrace will dump the backtrace to stderr.
__backtrace will dump the backtrace to buffer. backtrace()
will call __backtrace internally and dump it to stderr.

Signed-off-by Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com>

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
attn: Add default attn src in the src section

Generating src dynamically results in:
1. Difficulty in documenting and for field people to understand.
2. It might also conflict with existing srcs.

Hence add default SRC in SRC section.
Assert function call address in hex word 2.

errl -d <elog-entry-id>:
..

| Reference Code           : BB821410                                          |
| Hex Words 2 - 5          : 30017610 00000000 00000000 00000000               |
..

Signed-off-by: Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
attn: Add git version and backtrace details to user data

For better debugability, the patch adds git version and backtrace
details to user data section (along with file info which was already
present).

After adding required details TermImmedData looks like:

                                TermImmedData                                 |
|   00000000     63386631  6639322D  64697274  793A0000     c8f1f92-dirty:..   |
|   00000010     00000000  00000000  00000000  00000000     ................   |
|   00000020     00000000  00000000  43505520  30303030     ........CPU 0000   |
|   00000030     30303264  20426163  6B747261  63653A0A     002d Backtrace:.   |
|   00000040     20533A20  30303030  30303030  33316162      S: 0000000031ab   |
|   00000050     36626130  20523A20  30303030  30303030     6ba0 R: 00000000   |
|   00000060     33303031  33306238  0A20533A  20303030     300130b8. S: 000   |
|   00000070     30303030  30333161  62366334  3020523A     0000031ab6c40 R:   |
|   00000080     20303030  30303030  30333030  34623738      000000003004b78   |
|   00000090     380A2053  3A203030  30303030  30303331     8. S: 0000000031   |
|   000000A0     61623663  63302052  3A203030  30303030     ab6cc0 R: 000000   |
|   000000B0     30303330  30313736  31300A20  533A2030     0030017610. S: 0   |
|   000000C0     30303030  30303033  31616236  64343020     000000031ab6d40    |
|   000000D0     523A2030  30303030  30303033  30303035     R: 0000000030005   |
|   000000E0     3133340A  20533A20  30303030  30303030     134. S: 00000000   |
|   000000F0     33316162  36663030  20523A20  30303030     31ab6f00 R: 0000   |
|   00000100     30303030  33303030  32353534  0A000000     000030002554....   |
|   00000110     00000000  00000000  00000000  00000000     ................   |
|   00000120     00000000  00000000  00000000  00000000     ................   |
|   00000130     00000000  00000000  00000000  00000000     ................   |
|   00000140     00000000  00000000  00000000  00000000     ................   |
|   00000150     00000000  00000000  00000000  00000000     ................   |
|   00000160     00000000  00000000  00000000  00000000     ................   |
|   00000170     00000000  00000000  00000000  00000000     ................   |
|   00000180     00000000  00000000  00000000  00000000     ................   |
|   00000190     00000000  00000000  00000000  00000000     ................   |
|   000001A0     00000000  00000000  00000000  00000000     ................   |
|   000001B0     00000000  00000000  00000000  00000000     ................   |
|   000001C0     00000000  00000000  00000000  636F7265     ............core   |
|   000001D0     2F6F7061  6C2E633A  3233383A  30000000     /opal.c:238:0...   |
|------------------------------------------------------------------------------|

Signed-off-by: Aruna Balakrishnaiah <aruna@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>