diff options
author | Randall Spangler <rspangler@chromium.org> | 2012-04-19 16:10:11 -0700 |
---|---|---|
committer | Randall Spangler <rspangler@chromium.org> | 2012-04-19 18:15:18 -0700 |
commit | 13ad1c007bef3922e0aae8c7e2ef067a05eb0c06 (patch) | |
tree | ccba49c2460301a85e0abe050a27c734fde1acdb /common/hooks.c | |
parent | 24dafefb3a63c9e2111ff87c4595ceaff7182d20 (diff) | |
download | chrome-ec-13ad1c007bef3922e0aae8c7e2ef067a05eb0c06.tar.gz |
Implement HOOK_SYSJUMP and use it to preserve LPC host event mask
This also changes shared_mem to use all the remaining RAM, instead of
reserving a fixed-size buffer.
Signed-off-by: Randall Spangler <rspangler@chromium.org>
BUG=chrome-os-partner:9161
TEST=manual
hostevent --> all masks should be 0
hostevent smi 0x12300000
hostevent --> should confirm SMI mask was set
sysjump b
hostevent --> should confirm SMI mask is still set
reboot
hostevent --> should confirm SMI mask is back to 0
Change-Id: Iccb6da6ccc93ee5036a3f478d24b717a462d9150
Diffstat (limited to 'common/hooks.c')
-rw-r--r-- | common/hooks.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/common/hooks.c b/common/hooks.c index 81bc2ac212..e8a64ebeb7 100644 --- a/common/hooks.c +++ b/common/hooks.c @@ -10,6 +10,20 @@ #include "uart.h" #include "util.h" +struct hook_ptrs { + const struct hook_data *start; + const struct hook_data *end; +}; + +/* Hook data start and end pointers for each type of hook. Must be in same + * order as enum hook_type. */ +static const struct hook_ptrs hook_list[] = { + {__hooks_init, __hooks_init_end}, + {__hooks_freq_change, __hooks_freq_change_end}, + {__hooks_sysjump, __hooks_sysjump_end}, +}; + + int hook_notify(enum hook_type type, int stop_on_error) { const struct hook_data *start, *end, *p; @@ -17,21 +31,8 @@ int hook_notify(enum hook_type type, int stop_on_error) int last_prio = HOOK_PRIO_FIRST - 1, prio; int rv_error = EC_SUCCESS, rv; - /* Get the start and end pointers for the hook type */ - switch (type) { - case HOOK_INIT: - start = __hooks_init; - end = __hooks_init_end; - break; - case HOOK_FREQ_CHANGE: - start = __hooks_freq_change; - end = __hooks_freq_change_end; - break; - default: - /* Unhandled hook type */ - return EC_ERROR_UNKNOWN; - } - + start = hook_list[type].start; + end = hook_list[type].end; count = ((uint32_t)end - (uint32_t)start) / sizeof(struct hook_data); /* Call all the hooks in priority order */ |