diff options
author | Jack Rosenthal <jrosenth@chromium.org> | 2021-11-04 12:11:58 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-11-05 04:22:34 +0000 |
commit | 252457d4b21f46889eebad61d4c0a65331919cec (patch) | |
tree | 01856c4d31d710b20e85a74c8d7b5836e35c3b98 /zephyr/shim/src/panic.c | |
parent | 08f5a1e6fc2c9467230444ac9b582dcf4d9f0068 (diff) | |
download | chrome-ec-stabilize-14526.73.B-ish.tar.gz |
ish: Trim down the release branchstabilize-wristpin-14469.59.B-ishstabilize-voshyr-14637.B-ishstabilize-quickfix-14695.187.B-ishstabilize-quickfix-14695.124.B-ishstabilize-quickfix-14526.91.B-ishstabilize-14695.85.B-ishstabilize-14695.107.B-ishstabilize-14682.B-ishstabilize-14633.B-ishstabilize-14616.B-ishstabilize-14589.B-ishstabilize-14588.98.B-ishstabilize-14588.14.B-ishstabilize-14588.123.B-ishstabilize-14536.B-ishstabilize-14532.B-ishstabilize-14528.B-ishstabilize-14526.89.B-ishstabilize-14526.84.B-ishstabilize-14526.73.B-ishstabilize-14526.67.B-ishstabilize-14526.57.B-ishstabilize-14498.B-ishstabilize-14496.B-ishstabilize-14477.B-ishstabilize-14469.9.B-ishstabilize-14469.8.B-ishstabilize-14469.58.B-ishstabilize-14469.41.B-ishstabilize-14442.B-ishstabilize-14438.B-ishstabilize-14411.B-ishstabilize-14396.B-ishstabilize-14395.B-ishstabilize-14388.62.B-ishstabilize-14388.61.B-ishstabilize-14388.52.B-ishstabilize-14385.B-ishstabilize-14345.B-ishstabilize-14336.B-ishstabilize-14333.B-ishrelease-R99-14469.B-ishrelease-R98-14388.B-ishrelease-R102-14695.B-ishrelease-R101-14588.B-ishrelease-R100-14526.B-ishfirmware-cherry-14454.B-ishfirmware-brya-14505.B-ishfirmware-brya-14505.71.B-ishfactory-kukui-14374.B-ishfactory-guybrush-14600.B-ishfactory-cherry-14455.B-ishfactory-brya-14517.B-ish
In the interest of making long-term branch maintenance incur as little
technical debt on us as possible, we should not maintain any files on
the branch we are not actually using.
This has the added effect of making it extremely clear when merging CLs
from the main branch when changes have the possibility to affect us.
The follow-on CL adds a convenience script to actually pull updates from
the main branch and generate a CL for the update.
BUG=b:204206272
BRANCH=ish
TEST=make BOARD=arcada_ish && make BOARD=drallion_ish
Signed-off-by: Jack Rosenthal <jrosenth@chromium.org>
Change-Id: I17e4694c38219b5a0823e0a3e55a28d1348f4b18
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262038
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Diffstat (limited to 'zephyr/shim/src/panic.c')
-rw-r--r-- | zephyr/shim/src/panic.c | 160 |
1 files changed, 0 insertions, 160 deletions
diff --git a/zephyr/shim/src/panic.c b/zephyr/shim/src/panic.c deleted file mode 100644 index 22322cc4ee..0000000000 --- a/zephyr/shim/src/panic.c +++ /dev/null @@ -1,160 +0,0 @@ -/* Copyright 2021 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. - */ - -#include <arch/cpu.h> -#include <fatal.h> -#include <logging/log.h> -#include <logging/log_ctrl.h> -#include <zephyr.h> - -#include "common.h" -#include "panic.h" - -/* - * Arch-specific configuration - * - * For each architecture, define: - * - PANIC_ARCH, which should be the corresponding arch field of the - * panic_data struct. - * - PANIC_REG_LIST, which is a macro that takes a parameter M, and - * applies M to 3-tuples of: - * - zephyr esf field name - * - panic_data struct field name - * - human readable name - */ - -#if defined(CONFIG_ARM) -#define PANIC_ARCH PANIC_ARCH_CORTEX_M -#define PANIC_REG_LIST(M) \ - M(basic.r0, cm.frame[0], a1) \ - M(basic.r1, cm.frame[1], a2) \ - M(basic.r2, cm.frame[2], a3) \ - M(basic.r3, cm.frame[3], a4) \ - M(basic.r12, cm.frame[4], ip) \ - M(basic.lr, cm.frame[5], lr) \ - M(basic.pc, cm.frame[6], pc) \ - M(basic.xpsr, cm.frame[7], xpsr) -#define PANIC_REG_EXCEPTION(pdata) pdata->cm.regs[1] -#define PANIC_REG_REASON(pdata) pdata->cm.regs[3] -#define PANIC_REG_INFO(pdata) pdata->cm.regs[4] -#elif defined(CONFIG_RISCV) && !defined(CONFIG_64BIT) -#define PANIC_ARCH PANIC_ARCH_RISCV_RV32I -#define PANIC_REG_LIST(M) \ - M(ra, riscv.regs[1], ra) \ - M(tp, riscv.regs[3], tp) \ - M(a0, riscv.regs[4], a0) \ - M(a1, riscv.regs[5], a1) \ - M(a2, riscv.regs[6], a2) \ - M(a3, riscv.regs[7], a3) \ - M(a4, riscv.regs[8], a4) \ - M(a5, riscv.regs[9], a5) \ - M(a6, riscv.regs[10], a6) \ - M(a7, riscv.regs[11], a7) \ - M(t0, riscv.regs[12], t0) \ - M(t1, riscv.regs[13], t1) \ - M(t2, riscv.regs[14], t2) \ - M(t3, riscv.regs[15], t3) \ - M(t4, riscv.regs[16], t4) \ - M(t5, riscv.regs[17], t5) \ - M(t6, riscv.regs[18], t6) \ - M(mepc, riscv.mepc, mepc) \ - M(mstatus, riscv.mcause, mstatus) -#define PANIC_REG_EXCEPTION(pdata) (pdata->riscv.mcause) -#define PANIC_REG_REASON(pdata) (pdata->riscv.regs[11]) -#define PANIC_REG_INFO(pdata) (pdata->riscv.regs[10]) -#else -/* Not implemented for this arch */ -#define PANIC_ARCH 0 -#define PANIC_REG_LIST(M) -#ifdef CONFIG_PLATFORM_EC_SOFTWARE_PANIC -static uint8_t placeholder_exception_reg; -static uint32_t placeholder_reason_reg; -static uint32_t placeholder_info_reg; -#define PANIC_REG_EXCEPTION(unused) placeholder_exception_reg -#define PANIC_REG_REASON(unused) placeholder_reason_reg -#define PANIC_REG_INFO(unused) placeholder_info_reg -#endif /* CONFIG_PLATFORM_EC_SOFTWARE_PANIC */ -#endif - -/* Macros to be applied to PANIC_REG_LIST as M */ -#define PANIC_COPY_REGS(esf_field, pdata_field, human_name) \ - pdata->pdata_field = esf->esf_field; -#define PANIC_PRINT_REGS(esf_field, pdata_field, human_name) \ - panic_printf(" %-8s = 0x%08X\n", #human_name, pdata->pdata_field); - -void panic_data_print(const struct panic_data *pdata) -{ - PANIC_REG_LIST(PANIC_PRINT_REGS); -} - -#ifndef CONFIG_LOG -static void copy_esf_to_panic_data(const z_arch_esf_t *esf, - struct panic_data *pdata) -{ - pdata->arch = PANIC_ARCH; - pdata->struct_version = 2; - pdata->flags = 0; - pdata->reserved = 0; - pdata->struct_size = sizeof(*pdata); - pdata->magic = PANIC_DATA_MAGIC; - - PANIC_REG_LIST(PANIC_COPY_REGS); -} - -void k_sys_fatal_error_handler(unsigned int reason, const z_arch_esf_t *esf) -{ - panic_printf("Fatal error: %u\n", reason); - - if (PANIC_ARCH && esf) { - copy_esf_to_panic_data(esf, get_panic_data_write()); - panic_data_print(panic_get_data()); - } - - LOG_PANIC(); - k_fatal_halt(reason); - CODE_UNREACHABLE; -} -#endif /* CONFIG_LOG */ - -#ifdef CONFIG_PLATFORM_EC_SOFTWARE_PANIC -void panic_set_reason(uint32_t reason, uint32_t info, uint8_t exception) -{ - struct panic_data * const pdata = get_panic_data_write(); - - /* Setup panic data structure */ - memset(pdata, 0, CONFIG_PANIC_DATA_SIZE); - pdata->magic = PANIC_DATA_MAGIC; - pdata->struct_size = CONFIG_PANIC_DATA_SIZE; - pdata->struct_version = 2; - pdata->arch = PANIC_ARCH; - - /* Log panic cause */ - PANIC_REG_EXCEPTION(pdata) = exception; - PANIC_REG_REASON(pdata) = reason; - PANIC_REG_INFO(pdata) = info; - - /* Allow architecture specific logic */ - arch_panic_set_reason(reason, info, exception); -} - -void panic_get_reason(uint32_t *reason, uint32_t *info, uint8_t *exception) -{ - struct panic_data * const pdata = panic_get_data(); - - if (pdata && pdata->struct_version == 2) { - *exception = PANIC_REG_EXCEPTION(pdata); - *reason = PANIC_REG_REASON(pdata); - *info = PANIC_REG_INFO(pdata); - } else { - *exception = *reason = *info = 0; - } -} - -__overridable void arch_panic_set_reason(uint32_t reason, uint32_t info, - uint8_t exception) -{ - /* Default implementation, do nothing. */ -} -#endif /* CONFIG_PLATFORM_EC_SOFTWARE_PANIC */ |