CHROMIUM: ramoops: Copy the entire buffer to deal with bit rot
If unclean shutdown is done by yanking power rails, the RAM may be in a
state where it is not getting refreshed for a short period of time. This
can cause bit rotting in RAM and throw off the wraparound and buffer
size calculation logic. To get around this, copy the entire console
buffer. Note that this, of course, won't do anything to fix the bit
rotting but the intent here is that some logs are better than none.
Also squeezed in a minor cleanup of renaming headp to tailp since it
really tracks the tail, not head.
BUG=chrome-os-partner:13249
TEST=on a snow system do a warm reboot by either issuing the
"warm_reboot" command from servo ec console or by pressing
alt-volume_up-r keys together. The system should reboot. Upon bootup,
check contents of "/dev/pstore/console-ramoops" and ensure they are from
dmesg of the previous boot.
Change-Id: I999e95bf854fff26265404a680255f25cc2f7fe6
Signed-off-by: Sameer Nanda <snanda@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/31909
Reviewed-by: Mandeep Singh Baines <msb@chromium.org>