diff options
author | Diana Z <dzigterman@chromium.org> | 2020-09-16 15:44:48 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-03-18 23:18:33 +0000 |
commit | 4a1591bb8a08b65baf394c96d6860a1c0561f729 (patch) | |
tree | eb72f63cfde298575d18ddb74acae46c3ca27b4c | |
parent | 3f940a5e45a8db587efff0721d4038c59cb702e3 (diff) | |
download | chrome-ec-4a1591bb8a08b65baf394c96d6860a1c0561f729.tar.gz |
Hooks: Add HOOK_CHIPSET_HARD_OFF
Add a new hook called HOOK_CHIPSET_HARD_OFF which is called upon entry
to the G3 power state.
BRANCH=None
BUG=b:166787955,b:167996216,chromium:1045209
TEST=make -j buildall, runs on waddledee with no linking errors
Signed-off-by: Diana Z <dzigterman@chromium.org>
Change-Id: If260207910d882d17aeb766c9e99a7a6099006c7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2415171
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r-- | common/hooks.c | 1 | ||||
-rw-r--r-- | core/cortex-m/ec.lds.S | 4 | ||||
-rw-r--r-- | core/cortex-m0/ec.lds.S | 4 | ||||
-rw-r--r-- | core/host/host_exe.lds | 4 | ||||
-rw-r--r-- | core/minute-ia/ec.lds.S | 4 | ||||
-rw-r--r-- | core/nds32/ec.lds.S | 4 | ||||
-rw-r--r-- | core/riscv-rv32i/ec.lds.S | 4 | ||||
-rw-r--r-- | include/hooks.h | 7 | ||||
-rw-r--r-- | include/link_defs.h | 2 | ||||
-rw-r--r-- | power/common.c | 4 |
10 files changed, 38 insertions, 0 deletions
diff --git a/common/hooks.c b/common/hooks.c index 4c2a4e48c6..1ed448484c 100644 --- a/common/hooks.c +++ b/common/hooks.c @@ -48,6 +48,7 @@ static const struct hook_ptrs hook_list[] = { {__hooks_chipset_shutdown, __hooks_chipset_shutdown_end}, {__hooks_chipset_shutdown_complete, __hooks_chipset_shutdown_complete_end}, + {__hooks_chipset_hard_off, __hooks_chipset_hard_off_end}, {__hooks_chipset_reset, __hooks_chipset_reset_end}, {__hooks_ac_change, __hooks_ac_change_end}, {__hooks_lid_change, __hooks_lid_change_end}, diff --git a/core/cortex-m/ec.lds.S b/core/cortex-m/ec.lds.S index 9a23a419f6..85bc9ea5cb 100644 --- a/core/cortex-m/ec.lds.S +++ b/core/cortex-m/ec.lds.S @@ -261,6 +261,10 @@ SECTIONS KEEP(*(.rodata.HOOK_CHIPSET_SHUTDOWN_COMPLETE)) __hooks_chipset_shutdown_complete_end = .; + __hooks_chipset_hard_off = .; + KEEP(*(.rodata.HOOK_CHIPSET_HARD_OFF)) + __hooks_chipset_hard_off_end = .; + __hooks_chipset_reset = .; KEEP(*(.rodata.HOOK_CHIPSET_RESET)) __hooks_chipset_reset_end = .; diff --git a/core/cortex-m0/ec.lds.S b/core/cortex-m0/ec.lds.S index 1241638361..f6023aa322 100644 --- a/core/cortex-m0/ec.lds.S +++ b/core/cortex-m0/ec.lds.S @@ -135,6 +135,10 @@ SECTIONS KEEP(*(.rodata.HOOK_CHIPSET_SHUTDOWN_COMPLETE)) __hooks_chipset_shutdown_complete_end = .; + __hooks_chipset_hard_off = .; + KEEP(*(.rodata.HOOK_CHIPSET_HARD_OFF)) + __hooks_chipset_hard_off_end = .; + __hooks_chipset_reset = .; KEEP(*(.rodata.HOOK_CHIPSET_RESET)) __hooks_chipset_reset_end = .; diff --git a/core/host/host_exe.lds b/core/host/host_exe.lds index fbf7b56351..ab8d352ecc 100644 --- a/core/host/host_exe.lds +++ b/core/host/host_exe.lds @@ -65,6 +65,10 @@ SECTIONS { *(.rodata.HOOK_CHIPSET_SHUTDOWN_COMPLETE) __hooks_chipset_shutdown_complete_end = .; + __hooks_chipset_hard_off = .; + KEEP(*(.rodata.HOOK_CHIPSET_HARD_OFF)) + __hooks_chipset_hard_off_end = .; + __hooks_chipset_reset = .; *(.rodata.HOOK_CHIPSET_RESET) __hooks_chipset_reset_end = .; diff --git a/core/minute-ia/ec.lds.S b/core/minute-ia/ec.lds.S index 2463c6d397..dc61699fed 100644 --- a/core/minute-ia/ec.lds.S +++ b/core/minute-ia/ec.lds.S @@ -102,6 +102,10 @@ SECTIONS KEEP(*(.rodata.HOOK_CHIPSET_SHUTDOWN_COMPLETE)) __hooks_chipset_shutdown_complete_end = .; + __hooks_chipset_hard_off = .; + KEEP(*(.rodata.HOOK_CHIPSET_HARD_OFF)) + __hooks_chipset_hard_off_end = .; + __hooks_chipset_reset = .; KEEP(*(.rodata.HOOK_CHIPSET_RESET)) __hooks_chipset_reset_end = .; diff --git a/core/nds32/ec.lds.S b/core/nds32/ec.lds.S index 1d35041fea..c10e3e82f7 100644 --- a/core/nds32/ec.lds.S +++ b/core/nds32/ec.lds.S @@ -131,6 +131,10 @@ SECTIONS KEEP(*(.rodata.HOOK_CHIPSET_SHUTDOWN_COMPLETE)) __hooks_chipset_shutdown_complete_end = .; + __hooks_chipset_hard_off = .; + KEEP(*(.rodata.HOOK_CHIPSET_HARD_OFF)) + __hooks_chipset_hard_off_end = .; + __hooks_chipset_reset = .; KEEP(*(.rodata.HOOK_CHIPSET_RESET)) __hooks_chipset_reset_end = .; diff --git a/core/riscv-rv32i/ec.lds.S b/core/riscv-rv32i/ec.lds.S index d2bb3ba353..109fe7c579 100644 --- a/core/riscv-rv32i/ec.lds.S +++ b/core/riscv-rv32i/ec.lds.S @@ -178,6 +178,10 @@ SECTIONS KEEP(*(.rodata.HOOK_CHIPSET_SHUTDOWN_COMPLETE)) __hooks_chipset_shutdown_complete_end = .; + __hooks_chipset_hard_off = .; + KEEP(*(.rodata.HOOK_CHIPSET_HARD_OFF)) + __hooks_chipset_hard_off_end = .; + __hooks_chipset_reset = .; KEEP(*(.rodata.HOOK_CHIPSET_RESET)) __hooks_chipset_reset_end = .; diff --git a/include/hooks.h b/include/hooks.h index 400713e794..5210b462df 100644 --- a/include/hooks.h +++ b/include/hooks.h @@ -152,6 +152,13 @@ enum hook_type { HOOK_CHIPSET_SHUTDOWN_COMPLETE, /* + * System is in G3. All power rails are now turned off. + * + * Hook routines are called from the chipset task. + */ + HOOK_CHIPSET_HARD_OFF, + + /* * System reset in S0. All rails are still up. * * Hook routines are called from the chipset task. diff --git a/include/link_defs.h b/include/link_defs.h index 360516eac1..f18c52a45c 100644 --- a/include/link_defs.h +++ b/include/link_defs.h @@ -54,6 +54,8 @@ extern const struct hook_data __hooks_chipset_shutdown[]; extern const struct hook_data __hooks_chipset_shutdown_end[]; extern const struct hook_data __hooks_chipset_shutdown_complete[]; extern const struct hook_data __hooks_chipset_shutdown_complete_end[]; +extern const struct hook_data __hooks_chipset_hard_off[]; +extern const struct hook_data __hooks_chipset_hard_off_end[]; extern const struct hook_data __hooks_chipset_reset[]; extern const struct hook_data __hooks_chipset_reset_end[]; extern const struct hook_data __hooks_ac_change[]; diff --git a/power/common.c b/power/common.c index ea6190d523..1ea6439563 100644 --- a/power/common.c +++ b/power/common.c @@ -693,6 +693,10 @@ void chipset_task(void *u) if (new_state != state) { power_set_state(new_state); power_set_active_wake_mask(); + + /* Call hooks before we enter G3 */ + if (new_state == POWER_G3) + hook_notify(HOOK_CHIPSET_HARD_OFF); } } } |