summaryrefslogtreecommitdiff
path: root/common/panic_output.c
Commit message (Collapse)AuthorAgeFilesLines
* panic_output: undefined behaviour elicits abort() callsPatrick Georgi2018-07-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | Explicitly coding x/0 doesn't result in a div-by-zero fault, but in an abort() call, which breaks the build as abort doesn't exist. By marking zero as volatile, the compiler must not assume that the value is still the same, so can't do constant subexpression elimination and determine that this expression leads to UB. Hat tip to shawnn@ for this unexpectedly elegant approach (compared to all other approaches). BUG=none BRANCH=none TEST=buildall works with gcc8.1 Change-Id: Idd34e3b4119d0d6a5231576e768ee285c621d229 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/1126318 Commit-Ready: Patrick Georgi <pgeorgi@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
* panic: Set EC_HOST_EVENT_PANIC on chipset resetFurquan Shaikh2017-11-301-1/+2
| | | | | | | | | | | | | | | | | | | | | | Add a hook for CHIPSET_RESET to allow the EC to indicate if there is any new panic info present. This helps coreboot to log EC panic info in eventlog. Also, update the hook priority for CHIPSET_RESET and HOOK_INIT to HOOK_PRIO_LAST to allow the EC to first log any software panic before it is checked. BUG=b:65732924,b:69334392 BRANCH=None TEST=Verified following: 1. Force panic_set_reason in EC on CHIPSET_RESET 2. reboot on AP console 3. mosys eventlog list shows "EC Event | Panic Reset in previous boot" Change-Id: I77b49cd0b3bf05b10efc708e3d81af9ed0e3aa49 Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/797911 Reviewed-by: Shawn N <shawnn@chromium.org>
* Cr50: The panicinfo command is not safeBill Richardson2016-10-011-3/+3
| | | | | | | | | | | | | It's possible the register values could be sensitive. BUG=chrome-os-partner:57408 BRANCH=none TEST=make buildall; try on Gru with and without CR50_DEV=1 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: Id3d4df3aaca116a638332f092d4727accd0cbbcd Reviewed-on: https://chromium-review.googlesource.com/391612 Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* panic: Fix unaligned memory access panicKito Cheng2016-09-011-1/+2
| | | | | | | | | | | | | | | | Some target's gcc will detect the address is unaligned and then expand to byte load sequence, make the address to volatile can prevent gcc optimize it. BUG=none BRANCH=none TEST=make buildall; Verified that "crash unaligned" causes a panic on it83xx. Change-Id: Ieb4f5f8fc65854aefe307fa675fe87d7581452ed Signed-off-by: Kito Cheng <kito.cheng@gmail.com> Reviewed-on: https://chromium-review.googlesource.com/374281 Reviewed-by: Shawn N <shawnn@chromium.org>
* Cr50: Mark several console commands as safeBill Richardson2016-08-311-3/+3
| | | | | | | | | | | | | | | | | | | Even when CONFIG_RESTRICTED_CONSOLE_COMMANDS is enabled, there are many commands that can't do anything dangerous. This marks some of those commands as safe to use, even when restrictions are enforced. I'm only marking commands that are used by the Cr50, since that's the only board that has restrictions. BUG=chrome-os-partner:55322 BRANCH=none TEST=make buildall, test on Cr50 hardware Change-Id: I6289d332830175b6adcb6b20cb4c21d01d27a25e Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/376188 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* cleanup: DECLARE_CONSOLE_COMMAND only needs 4 argsBill Richardson2016-08-241-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Since pretty much always, we've declared console commands to take a "longhelp" argument with detailed explanations of what the command does. But since almost as long, we've never actually used that argument for anything - we just silently throw it away in the macro. There's only one command (usbchargemode) that even thinks it defines that argument. We're never going to use this, let's just get rid of it. BUG=none BRANCH=none CQ-DEPEND=CL:*279060 CQ-DEPEND=CL:*279158 CQ-DEPEND=CL:*279037 TEST=make buildall; tested on Cr50 hardware Everything builds. Since we never used this arg anyway, there had better not be any difference in the result. Change-Id: Id3f71a53d02e3dc625cfcc12aa71ecb50e35eb9f Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/374163 Reviewed-by: Myles Watson <mylesgw@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add new "hang" option to crash commandBill Richardson2016-08-051-5/+15
| | | | | | | | | | | | | | | | | | | | | The crash command is used to intentionally invoke various failure modes in a running system. This adds one more (and cleans up the command slightly). The "crash hang" command does the same thing as "crash watchdog", except that it disables interrupts first. Some SoCs may require special handling to recover from that case. BUG=none BRANCH=none TEST=make buildall; run on Cr50 hardware Invoked all the options to the crash command, observed that the appropriate response occurred in each case (a stack trace if possible, followed by a reboot). Change-Id: I18897cfc04726e6aeda59f4c6e742d7a0037cf80 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/366127 Reviewed-by: Vadim Bendebury <vbendeb@google.com>
* Kunimitsu: remove console commands for code sizeKyoung Kim2016-04-141-1/+2
| | | | | | | | | | | | | | | | | | | | | Remove following EC console commands to reduce code size: - battfake - apthrottle And none of commands above are used in 'auto test'. This is a squash of - https://chromium-review.googlesource.com/337657 - https://chromium-review.googlesource.com/338018 BUG=none BRANCH=firmware-glados-7820.B TEST=make -j buildall Change-Id: I11d2c5514f2714f0a46416feec2b2c47666fb462 Signed-off-by: Kyoung Kim <kyoung.il.kim@intel.com> Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com> Reviewed-on: https://chromium-review.googlesource.com/338893 Reviewed-by: Shawn N <shawnn@chromium.org>
* stm32: add synchronous debug printfAlec Berg2015-10-191-0/+2
| | | | | | | | | | | | | | | | | | Allow use of a synchronous debug printf instead of using the full console task to save space. This can be turned on with CONFIG_DEBUG_PRINTF, and will provide essentially a one-way console for debugging. This is essentially expanding upon the debug_printf work done for zinger. BUG=chrome-os-partner:41959 BRANCH=none TEST=tested with following CLs on glados_pd by verifying we get a one-way console. Change-Id: If028b5d873261890de5b270bbc00e06bdcaa7431 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/306782 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* panic: Fix unaligned memory access panicli feng2015-04-141-1/+1
| | | | | | | | | | | | | | | Unaligned memory access would not cause reboot on some processors. Additional condition was needed. BUG=none TEST=Verified that "crash unaligned" causes a panic on mec1322. BRANCH=none Change-Id: Icdc1b5e11634b14890755301346183e0dba723c9 Signed-off-by: li feng <li1.feng@intel.com> Signed-off-by: Divya Jyothi <divya.jyothi@intel.com> Reviewed-on: https://chromium-review.googlesource.com/263949 Reviewed-by: Shawn N <shawnn@chromium.org>
* panic: Send host event on panic detectShawn Nematbakhsh2015-02-241-0/+14
| | | | | | | | | | | | | | | If a panic caused us to reboot, send a host event to notify the AP. BUG=chrome-os-partner:36985 TEST=Manual on Samus. Trigger EC panic, verify that "Panic Reset in previous boot" is seen in /var/log/eventlog. BRANCH=Samus Change-Id: Icf0d00a8cfc7aa788f3ceadd65fe3139f40df503 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/252410 Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
* panic: fix logging of watchdog in panic dataAlec Berg2015-02-201-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix bug with the new CONFIG_SOFTWARE_PANIC where a watchdog panic will write panic data after jump_data pointer is calculated. Since jump data uses the same RAM location as panic data (the end of RAM), we rely on panic data being written BEFORE jump data pointer is calculated so that we don't use the same RAM space. BUG=chrome-os-partner:36871 BRANCH=samus TEST=without this CL, can reproduce problem where jump data is corrupted using samus with following steps: 1) hibernate 1 (this will clear panicinfo) 2) waitms 3000 (this will cause a watchdog reset) 3) let system boot to S0 4) sysjump rw On sysjump to RW, the jump data will be corrupt because while we were in RO panic data was added where there wasn't any before. This means the jump_data pointer in RW will differ from the jump_data pointer that was used in RO and we will fail to find the magic jump data. Most visible consequence of this is that the USB ports will be disabled after these steps because we use jump data to store last state of USB port enables. With this CL, following the steps above, the USB ports are restored to the pre-sysjump state, which is enabled. Change-Id: Ia129419db7400eddb54bcf57b4d4aed63d5c52ef Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/251110 Reviewed-by: Shawn N <shawnn@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* cortex-m*: Save panicinfo on non-exception panicsShawn Nematbakhsh2015-02-181-8/+58
| | | | | | | | | | | | | | | | | | Make non-exception "software" panics such as stack overflow and assert failure save a panic log. Log the panic type in r4, and misc. panic data in r5 so that panic reasons can be distinguished. BUG=chrome-os-partner:36744 TEST=Manual on samus_pd. Run 'crash divzero' then 'panicinfo' after reboot. Verify that panic info is printed with "r4 :dead6660". Trigger stack overflow, verify that panic info is printed with "r4 :dead6661". BRANCH=Samus Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I5f7a8eb0a5c2ac5799d29bb241deb24fabf38f68 Reviewed-on: https://chromium-review.googlesource.com/249912 Tested-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
* ryu: Use brief assertion failure messageVic Yang2014-10-011-0/+9
| | | | | | | | | | | | | | | | | | | | | Currently, when an assertion fails, the error message is like: ASSERTION FAILURE '1 + 1 == 3' in command_apreset() at common/chipset.c:24 To save flash space, let's add an option to remove the failed expression and function name. The error message becomes: ASSERTION FAILURE at common/chipset.c:24 BUG=chrome-os-partner:32203 TEST=make buildall TEST=Add an assertion and triggers it. Check error message. BRANCH=None Change-Id: Ie323d5b43cbff2cd8f6cd5bb46c1f34ecd16bd5e Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/219670 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* extract common core codeVincent Palatin2013-12-051-0/+169
Move the non-core dependent code out of core/$(CORE) directory to common/ directory. Put all panic printing code in common/panic_output.c Put timer management code in common/timer.c Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:23574 TEST=./util/make_all.sh use "crash divzero" and "panicinfo" on Link. Change-Id: Ia4e1ebc74cd53da55fe24f69e96f39f512b9336d Reviewed-on: https://chromium-review.googlesource.com/178871 Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Jeremy Thorpe <jeremyt@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>