If OPAL_RTC_READ is busy and does not return the information on the first run,
as returning OPAL_BUSY_EVENT, the system will crash since ymd and hmsm variable will
contain junk values, as:
panic: invalid bcd 248
cpuid = 15
time = 1533662783
KDB: stack backtrace:
0xe000000075f80f70: at .kdb_backtrace+0x5c
0xe000000075f810a0: at .vpanic+0x1b4
0xe000000075f81160: at .kassert_panic+0xf8
0xe000000075f81200: at .opal_check+0x19d8
0xe000000075f812a0: at .opal_check+0x1b9c
0xe000000075f81380: at .clock_schedule+0x184
0xe000000075f81420: at .inittodr+0x24
0xe000000075f814b0: at .vfs_mountroot+0x1254
0xe000000075f81740: at .sysinit_add+0x3e8
0xe000000075f81850: at .fork_exit+0xd0
0xe000000075f818f0: at .fork_trampoline+0x10
0xe000000075f81920: at -0x4
This is happening because we were not calling OPAL_RTC_READ again after
OPAL_POLL_EVENTS' return, which would finally replace the old/junk hmsm and ymd
values.
The code was also mixing OPAL_RTC_READ and OPAL_POLL_EVENTS return values.
This patch fix this logic and guarantee that we call OPAL_RTC_READ after
OPAL_POLL_EVENTS return, and guarantee the code will only proceed if
OPAL_RTC_READ returns OPAL_SUCCESS.