diff options
author | Caveh Jalali <caveh@chromium.org> | 2019-10-10 19:32:14 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-10-23 02:11:54 +0000 |
commit | 7b7f7b136e58429a8afd6f41ee11cd105baefeba (patch) | |
tree | d898ca433050881fad21293bdea8d3fa5acc37ae | |
parent | 107327421daf5810066b9a9751e70d2269e1ac82 (diff) | |
download | chrome-ec-7b7f7b136e58429a8afd6f41ee11cd105baefeba.tar.gz |
system.c: move jump_data declarations into sysjump.h
this moves the jump_data related declarations out of system.c into a
dedicated sysjump_impl.h header file. this will make it possible to
implement unit tests for sysjump.
BRANCH=none
BUG=b:142031466
TEST=make buildall passes
Change-Id: I7df3d24e1f9c0f203656ee8dddc234b64e2dc8c3
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1855647
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r-- | common/system.c | 30 | ||||
-rw-r--r-- | include/sysjump.h | 46 |
2 files changed, 47 insertions, 29 deletions
diff --git a/common/system.c b/common/system.c index 88475c3a68..e1b8d0b396 100644 --- a/common/system.c +++ b/common/system.c @@ -27,6 +27,7 @@ #include "mpu.h" #endif #include "panic.h" +#include "sysjump.h" #include "system.h" #include "task.h" #include "timer.h" @@ -54,35 +55,6 @@ struct jump_tag { /* Followed by data_size bytes of data */ }; -/* - * Data passed between the current image and the next one when jumping between - * images. - */ -#define JUMP_DATA_MAGIC 0x706d754a /* "Jump" */ -#define JUMP_DATA_VERSION 3 -#define JUMP_DATA_SIZE_V2 16 /* Size of version 2 jump data struct */ -struct jump_data { - /* - * Add new fields to the _start_ of the struct, since we copy it to the - * _end_ of RAM between images. This way, the magic number will always - * be the last word in RAM regardless of how many fields are added. - */ - - /* Fields from version 3 */ - uint8_t reserved0; /* (used in proto1 to signal recovery mode) */ - int struct_size; /* Size of struct jump_data */ - - /* Fields from version 2 */ - int jump_tag_total; /* Total size of all jump tags */ - - /* Fields from version 1 */ - uint32_t reset_flags; /* Reset flags from the previous boot */ - int version; /* Version (JUMP_DATA_VERSION) */ - int magic; /* Magic number (JUMP_DATA_MAGIC). If this - * doesn't match at pre-init time, assume no valid - * data from the previous image. */ -}; - /* Jump data (at end of RAM, or preceding panic data) */ static struct jump_data *jdata; diff --git a/include/sysjump.h b/include/sysjump.h new file mode 100644 index 0000000000..a75351a016 --- /dev/null +++ b/include/sysjump.h @@ -0,0 +1,46 @@ +/* + * Copyright 2019 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* sysjump implementation-specific structures */ + +#ifndef __CROS_EC_SYSJUMP_IMPL_H +#define __CROS_EC_SYSJUMP_IMPL_H + +#include <inttypes.h> + +/* + * Data passed between the current image and the next one when jumping between + * images. + */ + +#define JUMP_DATA_MAGIC 0x706d754a /* "Jump" */ +#define JUMP_DATA_VERSION 3 +#define JUMP_DATA_SIZE_V2 16 /* Size of version 2 jump data struct */ + +struct jump_data { + /* + * Add new fields to the _start_ of the struct, since we copy it to the + * _end_ of RAM between images. This way, the magic number will always + * be the last word in RAM regardless of how many fields are added. + */ + + /* Fields from version 3 */ + uint8_t reserved0; /* (used in proto1 to signal recovery mode) */ + int struct_size; /* Size of struct jump_data */ + + /* Fields from version 2 */ + int jump_tag_total; /* Total size of all jump tags */ + + /* Fields from version 1 */ + uint32_t reset_flags; /* Reset flags from the previous boot */ + int version; /* Version (JUMP_DATA_VERSION) */ + int magic; /* Magic number (JUMP_DATA_MAGIC). If this + * doesn't match at pre-init time, assume no valid + * data from the previous image. + */ +}; + +#endif /* __CROS_EC_SYSJUMP_IMPL_H */ |