summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2012-08-31 13:10:16 -0700
committerGerrit <chrome-bot@google.com>2012-08-31 15:41:36 -0700
commit96103ab32d9a2c4f6651c83e3993385ed346917a (patch)
tree77d3a17c28f507b746f7e7950d9314a61c9e0ffb /common
parent66d3ad01709e58cd0299147aa6b59d634322a018 (diff)
downloadchrome-ec-96103ab32d9a2c4f6651c83e3993385ed346917a.tar.gz
Save panic data across reboots, and add panicinfo command
Jump data now precedes the panic data, if any, in memory. BUG=chrome-os-partner:7466 BRANCH=all TEST=manual 1. boot system 2. sysjump rw --> display should stay on and keyboard should still work (this verifies jump data is properly read across sysjump still) 3. crash unaligned --> system should reboot 4. panicinfo --> should print the same crash dump as before, with (NEW) 5. panicinfo --> ditto, without (NEW) 6. sysjump rw 7. panicinfo --> ditto, without (NEW) Change-Id: I88285724e82a15553ab25877e3d8ec4c74a4dd5a Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/32051
Diffstat (limited to 'common')
-rw-r--r--common/system_common.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/common/system_common.c b/common/system_common.c
index 6f74013aed..772d932748 100644
--- a/common/system_common.c
+++ b/common/system_common.c
@@ -15,6 +15,7 @@
#include "hooks.h"
#include "host_command.h"
#include "lpc.h"
+#include "panic.h"
#include "system.h"
#include "task.h"
#include "uart.h"
@@ -60,10 +61,8 @@ struct jump_data {
* data from the previous image. */
};
-/* Jump data goes at the end of RAM */
-static struct jump_data * const jdata =
- (struct jump_data *)(CONFIG_RAM_BASE + CONFIG_RAM_SIZE
- - sizeof(struct jump_data));
+/* Jump data (at end of RAM, or preceding panic data) */
+static struct jump_data *jdata;
/*
* Reset flag descriptions. Must be in same order as bits of RESET_FLAG_
@@ -165,7 +164,7 @@ int system_add_jump_tag(uint16_t tag, int version, int size, const void *data)
struct jump_tag *t;
/* Only allowed during a sysjump */
- if (jdata->magic != JUMP_DATA_MAGIC)
+ if (!jdata || jdata->magic != JUMP_DATA_MAGIC)
return EC_ERROR_UNKNOWN;
/* Make room for the new tag */
@@ -188,6 +187,9 @@ const uint8_t *system_get_jump_tag(uint16_t tag, int *version, int *size)
const struct jump_tag *t;
int used = 0;
+ if (!jdata)
+ return NULL;
+
/* Search through tag data for a match */
while (used < jdata->jump_tag_total) {
/* Check the next tag */
@@ -456,6 +458,18 @@ const char *system_get_build_info(void)
int system_common_pre_init(void)
{
+ uint32_t addr;
+
+ /*
+ * Put the jump data before the panic data, or at the end of RAM if
+ * panic data is not present.
+ */
+ addr = (uint32_t)panic_get_data();
+ if (!addr)
+ addr = CONFIG_RAM_BASE + CONFIG_RAM_SIZE;
+
+ jdata = (struct jump_data *)(addr - sizeof(struct jump_data));
+
/*
* Check jump data if this is a jump between images. Jumps all show up
* as an unknown reset reason, because we jumped directly from one