Commit Graph

271 Commits

Author SHA1 Message Date
Vadim Bendebury
b3a9852122 Revert "ec: Improve efficiency of host command dispatcher"
This reverts commit c459c8278e 
as the fix is not straightforwad, some host command codes in 
private repos are expressed using C preprecessor which 
breaks the assumption of this patch that all host commands 
are expressed as four digit hex numbers.

Change-Id: I922de9ae8dbab6eef048463c5c09b1f338152083
Reviewed-on: https://chromium-review.googlesource.com/414492
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
2016-11-26 01:29:24 +00:00
Sam Hurst
c459c8278e ec: Improve efficiency of host command dispatcher
Use binary search in host command lookup dispatcher

BUG=chrome-os-partner:570895
TEST=manual testing on kevin
      - Kevin boots
      - ectool hello
      make buildall -j
      Verify *.smap hcmds section is sorted:
         100bca94 R __hcmds
         100bca94 R __host_cmd_0x0000
         100bcaa0 R __host_cmd_0x0001
         100bcaac R __host_cmd_0x0002
         100bcab8 R __host_cmd_0x0003
         100bcac4 R __host_cmd_0x0004
         100bcad0 R __host_cmd_0x0005
         100bcadc R __host_cmd_0x0006
         100bcae8 R __host_cmd_0x0007
         100bcaf4 R __host_cmd_0x0008
         100bcb00 R __host_cmd_0x0009
         100bcb0c R __host_cmd_0x000a
         100bcb18 R __host_cmd_0x000b
         100bcb24 R __host_cmd_0x000d
         100bcb30 R __host_cmd_0x0010
         100bcb3c R __host_cmd_0x0011
         100bcb48 R __host_cmd_0x0012
         100bcb54 R __host_cmd_0x0013
         100bcb60 R __host_cmd_0x0015
         100bcb6c R __host_cmd_0x0016
         100bcb78 R __host_cmd_0x0017
         100bcb84 R __host_cmd_0x0025
         100bcb90 R __host_cmd_0x0026
         100bcb9c R __host_cmd_0x0029
         100bcba8 R __host_cmd_0x002a
         100bcbb4 R __host_cmd_0x002b
         100bcbc0 R __host_cmd_0x002c
         100bcbcc R __host_cmd_0x0044
         100bcbd8 R __host_cmd_0x0045
         100bcbe4 R __host_cmd_0x0046
         100bcbf0 R __host_cmd_0x0047
         100bcbfc R __host_cmd_0x0061
         100bcc08 R __host_cmd_0x0062
         100bcc14 R __host_cmd_0x0064
         100bcc20 R __host_cmd_0x0065
         100bcc2c R __host_cmd_0x0067
         100bcc38 R __host_cmd_0x0087
         100bcc44 R __host_cmd_0x008c
         100bcc50 R __host_cmd_0x008d
         100bcc5c R __host_cmd_0x008f
         100bcc68 R __host_cmd_0x0092
         100bcc74 R __host_cmd_0x0093
         100bcc80 R __host_cmd_0x0096
         100bcc8c R __host_cmd_0x0097
         100bcc98 R __host_cmd_0x0098
         100bcca4 R __host_cmd_0x0099
         100bccb0 R __host_cmd_0x009e
         100bccbc R __host_cmd_0x00a0
         100bccc8 R __host_cmd_0x00a1
         100bccd4 R __host_cmd_0x00a8
         100bcce0 R __host_cmd_0x00a9
         100bccec R __host_cmd_0x00b6
         100bccf8 R __host_cmd_0x00b7
         100bcd04 R __host_cmd_0x00d2
         100bcd10 R __host_cmd_0x00d3
         100bcd1c R __host_cmd_0x00db
         100bcd28 R __host_cmd_0x0101
         100bcd34 R __host_cmd_0x0102
         100bcd40 R __host_cmd_0x0103
         100bcd4c R __host_cmd_0x0104
         100bcd58 R __host_cmd_0x0110
         100bcd64 R __host_cmd_0x0111
         100bcd70 R __host_cmd_0x0112
         100bcd7c R __host_cmd_0x0113
         100bcd88 R __host_cmd_0x0114
         100bcd94 R __host_cmd_0x0115
         100bcda0 R __host_cmd_0x0116
         100bcdac R __host_cmd_0x0117
         100bcdb8 R __host_cmd_0x0118
         100bcdc4 R __host_cmd_0x011a
         100bcdd0 R __evt_src_EC_MKBP_EVENT_KEY_MATRIX
         100bcdd0 R __hcmds_end
BRANCH=none

Change-Id: Ideb9951b318763f71915e2c4e5052f4b4bfab173
Reviewed-on: https://chromium-review.googlesource.com/405528
Commit-Ready: Sam Hurst <shurst@google.com>
Tested-by: Sam Hurst <shurst@google.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-11-23 15:36:00 -08:00
li feng
20ca52a9ee ISH: set toolchain in core/minute-ia
When "make buildall" has board which uses core/minute-ia,
CROSS_COMPILE?=i686-pc-linux-gnu- doesn't get set unless
CROSS_COMPILE is not defined; however, it's defined before
this line, and wrong toolchain is used.
Remove "?" to set correct CROSS_COMPILE.

BUG=none
BRANCH=none
TEST='make buildall -j' passed

Change-Id: Ied4a9f93a4d44714c012d3a3e50e4a34f41a7c1f
Signed-off-by: li feng <li1.feng@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/410402
Commit-Ready: Li1 Feng <li1.feng@intel.com>
Tested-by: Li1 Feng <li1.feng@intel.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-11-21 18:23:03 -08:00
Martin Roth
897ce78bdd Fix various misspellings in comments
No functional changes.

BUG=none
BRANCH=none
TEST=make buildall passes

Change-Id: Ie852feb8e3951975d99dce5a49c17f5f0e8bc791
Signed-off-by: Martin Roth <martinroth@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/403417
Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
2016-11-15 17:41:53 -08:00
Jaiber John
a750b1d6b1 minute-ia: Revise macros to be version independent
A few macros that were defined for ISH3.0 were renamed to be generic for
all ISH generations - e.g, ISH30_I2C0_IRQ -> ISH_I2C0_IRQ. Similarly
macros representing base addresses were revised to add ISH_ prefix.

BUG=chrome-os-partner:51851
BRANCH=None
TEST=`make buildall -j`

Change-Id: Idf6657a112b9bd0f73a77f13d02e327c10a9a272
Signed-off-by: Jaiber John <jaiber.j.john@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/403550
Commit-Ready: Raj Mojumder <raj.mojumder@intel.com>
Tested-by: Jaiber J John <jaiber.j.john@intel.com>
Tested-by: Kyoung Il Kim <kyoung.il.kim@intel.com>
Reviewed-by: Jaiber J John <jaiber.j.john@intel.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-11-04 18:31:30 -07:00
Marius Schilder
d4bff62d36 Fix bugs.
L_fallback_32bits: section did not compute remainder correctly.
L_sub_loop1: section did not track r6 correctly.

Also correctly annotate which instructions need to set the flags.

BRANCH=none
BUG=none
TEST=now passes the tests in
http://www.hackersdelight.org/hdcodetxt/divmnu64.c.txt
Change-Id: Ib55a3bbbcee35c7f21dc67f51038783ea1d26f6c
Reviewed-on: https://chromium-review.googlesource.com/396397
Commit-Ready: Marius Schilder <mschilder@chromium.org>
Tested-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Marius Schilder <mschilder@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-11-02 09:20:18 -07:00
Shawn Nematbakhsh
907c09ee38 task: Don't propagate TASK_EVENT_TIMER between between waits
In __wait_evt(), if a timer expiration occurs after we read event
status, before the timer is canceled, then TASK_EVENT_TIMER will be
propagated to the next task wait, likely leading to premature timeout.
Prevent this by clearing TASK_EVENT_TIMER after canceling our timer.

BUG=chrome-os-partner:58658
BRANCH=gru
TEST=Manual on gru, run 'pd # hard' for 12 hours with charger attached,
verify no TCPC I2C read errors occur.

Change-Id: Iac2f05a768b4ef29f82e7c3eb899f4c7dd5c3744
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/400968
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-10-26 01:45:25 -07:00
Bill Richardson
4250da3ba9 Cr50: Add mostly-synchronous tpm_reset() function.
To reset the TPM task, we send it an event so that it will reset
only when it's not busy doing actual TPM stuff that might fiddle
with the stack or shared memory. But that means that we can't
always know when the task finally gets around to resetting
itself.

This CL adds a tpm_reset() function that blocks until the reset
actually occurs. Obviously it can't do that if it's being called
in interrupt context or from the TPM task itself, but otherwise
it does.

BUG=chrome-os-partner:52366
BRANCH=none
CQ-DEPEND=CL:361680
TEST=make buildall, test on Gru, manual tests

In addition to the normal rebooting, logging in/out, and so
forth. I added a temporary console command to call tpm_reset()
and scattered a bunch of ccprintfs around it. When called due to
SYS_RST_L, it didn't block. When invoked with the console
command, it did.

Change-Id: I51e8b1299dbdcd1a12273cf48a890e93ed32a8c8
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/388125
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-09-24 16:22:14 -07:00
Randall Spangler
b94747d501 cr50: reset only the TPM state on SYS_RST_L
Rather than doing a full cr50 reset when the system reset SYS_RST_L is
asserted, just reset the state of the TPM task and library.  Re-clear
.bss for those modules, then re-initialize.

BRANCH=none
BUG=chrome-os-partner:52366
CQ-DEPEND=CL:366792
TEST=make buildall; test on Gru

Trigger a SYS_RST_L by using the AP's reboot command, power
off/on, log in/out/in.

See that the Cr50 does not reboot and the firmware and userspace
are still happy about the TPM.

Change-Id: I32cd2bb72316f68c74db77a20a8d09112b402d4b
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/361680
2016-09-24 13:53:26 -07:00
Mulin Chao
a4c2b141f8 npcx: Fixed bug that api utility in ROM doesn't enable burst mode.
We found the api utility in ROM doesn't enable burst mode of GDMA. It
influences the performance of FW download a lot. The CL modified GDMA
for moving the code of the other region from flash to ram. And move a
function that kicks off GMDA transactions to suspend ram in case this
utility is erased by itself. This issue will be fixed in our next
generation.

Modified sources:
1. system.c: Implement GDMA bypass.
2. system_chip.h: Import flash addresses for GDMA bypass code.
3. registers.h: Add GDMA register definitions.
4. cortex-m/ec.lds.S: Add lowpower_ram2 section in linker script.

BRANCH=none
BUG=chrome-os-partner:56794
TEST=make BOARD=npcx_evb; test sysjump and measure download time

Change-Id: I8490f8f2e5a8cdcb6fd10511878c4a4af8073bbf
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/381779
Commit-Ready: Shawn N <shawnn@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-09-15 16:16:22 -07:00
Gwendal Grignou
4848d7e8fa common: Add TABLET_MODE hook.
Add a hook to act when the a device is going in tablet mode and back.

BUG=chromium:606718
BRANCH=kevin
TEST=Test with evtest that an event is sent to the AP.

Change-Id: Ic9c3b158f1178504af41abff18b28de8e07fc7a7
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/380412
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-09-07 14:01:18 -07:00
Bill Richardson
8c4421759d Cr50: Mark several console commands as safe
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>
2016-08-31 17:20:26 +00:00
Bill Richardson
bb15561db5 cleanup: DECLARE_CONSOLE_COMMAND only needs 4 args
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>
2016-08-24 16:30:10 +00:00
Jaiber John
a625b710c3 minute-ia: Enable x86 core for Intel ISH
Add intial minute-IA (x86) core to to enable the FW
to boot on Intel Integrated Sensor Hub (ISH).

BUG=chrome-os-partner:51851
BRANCH=None
TEST=`make buildall -j`

Change-Id: I4dcf841766f216cd00fb1d4214fae19ba5de5603
Signed-off-by: Jaiber John <jaiber.j.john@intel.com>
Signed-off-by: Alex Brill <alexander.brill@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/336443
Commit-Ready: Raj Mojumder <raj.mojumder@intel.com>
Tested-by: Raj Mojumder <raj.mojumder@intel.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2016-08-10 20:07:36 -07:00
Shawn Nematbakhsh
1fac917071 core: Don't discard irqprio table entries due to LTO
Add __keep attribute to irqprio entries to ensure they are not dropped
when CONFIG_LTO is enabled.

BUG=chrome-os-partner:55920
BRANCH=None
TEST=Manual on kevin. Check build/RO/ec.RO.map, verify that
.rodata.irqprio section is not empty.

Change-Id: I51ae23556d6f46b2cd7ba098f0e7a785292b2853
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/366571
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-08-07 21:43:53 -07:00
Aseda Aboagye
87a071941b mkbp: Add support for buttons and switches.
Currently, the matrix keyboard protocol does not have support for
handling non-matrixed keys.  This commit adds support for buttons which
do not appear in the keyboard matrix as well as switches.

Additionally, the keyboard FIFO is now just a general MKBP events FIFO
which MKBP events are free to use. Now, buttons and switches wil join
the key matrix event.

BUG=chrome-os-partner:54988
BUG=chrome-os-partner:54976
BUG=chromium:626863
BRANCH=None
TEST=Flash kevin, and verify that keyboard is still functional.
TEST=make -j buildall

CQ-DEPEND=CL:358926

Change-Id: If4ada904cbd5d77823a0710d4671484b198c9d91
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/358633
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-07-19 18:33:36 -07:00
Daisuke Nojiri
afa53e3950 Add cts.tasklist
cts.tasklist contains tasks run only for CTS. These tasks are added to the
tasks registered in ec.tasklist with higher priority. This design allows
board directories to be free from CTS stuff.

cts.tasklist can be placed in each suite directory (cts/suite/cts.tasklist).
If a suite does not define its own cts.tasklist, the common list is used
(i.e. cts/cts.tasklist).

BUG=chromium:624520
BRANCH=none
TEST=Ran the followings:
make buildall
make CTS_MODULE=gpio BOARD=nucleo-f072rb
make CTS_MODULE=gpio BOARD=stm32l476g-eval

Change-Id: Ibb242297ee10a397a8fcb6ff73d8cbc560daa885
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/359445
Reviewed-by: Chris Chen <twothreecc@google.com>
2016-07-11 21:27:46 -07:00
Dino Li
43552fb3f5 it83xx: Support different PLL frequencies setting (24/48/96 MHz)
Default setting is at 48MHz.

For PLL frequency at 24MHz:
1. USB module can't work, it requires 48MHz to work.
2. SSPI clock frequency is divide by two.

Signed-off-by: Dino Li <dino.li@ite.com.tw>

BRANCH=none
BUG=none
TEST=1. uart, i2c, timer, and pd modules are function normally
        at different PLL frequency settings.
     2. use 'flashrom' utility to flash EC binary with different
        PLL settings.

Change-Id: Iabce4726baff493a6136136af18732b58df45d7f
Reviewed-on: https://chromium-review.googlesource.com/347551
Commit-Ready: Dino Li <Dino.Li@ite.com.tw>
Tested-by: Dino Li <Dino.Li@ite.com.tw>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-06-14 22:00:58 -07:00
Shawn Nematbakhsh
0e532c6044 cleanup: Remove SHIFT_CODE_FOR_TEST handling
SHIFT_CODE_FOR_TEST images were used for an old FAFT test but is no
longer in use today.

BUG=chromium:616806
BRANCH=None
TEST=`make buildall -j`
CQ-DEPEND=CL:349281

Change-Id: I1b4e8c2560e2a7ff507cf2275dbbbdabf435866b
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/349272
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Tom Tam <waihong@google.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2016-06-03 03:00:08 -07:00
Stefan Reinauer
b5c56aba6f core: cortex-m0: Fix task routine prototypes
The task routines are void func(void), not int func(void *).

BUG=none
BRANCH=none
TEST=compile tested on chell
Signed-off-by: Stefan Reinauer <reinauer@chromium.org>

Change-Id: I599ff2433d821bfb446fbb4f84a803c6feffa0b3
Reviewed-on: https://chromium-review.googlesource.com/343213
Commit-Ready: Stefan Reinauer <reinauer@chromium.org>
Tested-by: Stefan Reinauer <reinauer@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-06-03 03:00:06 -07:00
Dino Li
f817140c3e chip: it83xx: Optimize interrupt usage of LPC access
LPC access interrupt only enabled when EC entering deep doze mode. This
will reduce interrupt of LPC access. Also, this interrupt is always
enabled for LPC platform to support "CONFIG_LOW_POWER_S0".

Signed-off-by: Dino Li <dino.li@ite.com.tw>

BRANCH=none
BUG=none
TEST=Tested ectool command 'version' x 10000.

Change-Id: I9053c4018b38a8a852c3c6254e1fcde625f3fa3a
Reviewed-on: https://chromium-review.googlesource.com/336112
Commit-Ready: Dino Li <dino0303@gmail.com>
Tested-by: Dino Li <dino0303@gmail.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-05-18 19:44:09 -07:00
Anton Staaf
95858f385c Deferred: Remove hard coded number of deferreds
Previously the maximum number of deferred routines was specified by the
the default maximum number of deferred routines you had to override
this, and if you wanted fewer, you still payed the price of having the
defer_until array statically allocated to be the maximum size.

This change removes that define and instead creates the RAM state of
the deferred routine (the time to wait until to call the deferred) when
the deferred is declared.

Signed-off-by: Anton Staaf <robotboy@chromium.org>

BRANCH=None
BUG=None
TEST=make buildall -j
     manually test on discovery-stm32f072

Change-Id: Id3db84ee1795226b7818c57f68c1f637567831dc
Reviewed-on: https://chromium-review.googlesource.com/335597
Commit-Ready: Anton Staaf <robotboy@chromium.org>
Tested-by: Anton Staaf <robotboy@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2016-04-19 12:23:52 -07:00
Kevin K Wong
1102e46ecf core: fix unaligned access
without this, there could be unaligned access of __flash_lpfw_start
variable in system_hibernate function which causes exception.

BUG=none
BRANCH=none
TEST=make buildall, able to enter/exit EC hibernate

Change-Id: I6c0400fd88f3b815a42a70c2983a8f8ecd79b398
Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com>
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/331653
Reviewed-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-03-11 15:17:28 -08:00
Patrick Georgi
e7b5e7b050 core/*/ec.lds.S: quote paths containing OUTDIR
If OUTDIR brings in a "@", the build breaks because that delimits the
path, leading to invalid file names.
This can happen (and happened) when building on a Jenkins CI instance
which uses jobname@number as path for parallel checkouts on a
single build node.

BRANCH=none
BUG=none
TEST=build with make out=foo@bar ... failed and works now.

Change-Id: Id0594f0d7312419110091443755ec11b5f8ee2d8
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://chromium-review.googlesource.com/327110
Commit-Ready: Patrick Georgi <pgeorgi@chromium.org>
Tested-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-by: Martin Roth <martinroth@chromium.org>
2016-02-10 12:44:15 -08:00
Mulin Chao
f700e3bb0e nuc: Add support for CONFIG_LOW_POWER_S0.
To get better power consumption in S0, we add FW support for
CONFIG_LOW_POWER_S0.

Before entering deep idle in S0, we must enable Host interrupt to wake up
EC if it needs to service LPC bus.

This version also add a new bit of sleep_mask (SLEEP_MASK_FAN) in system.h
to prevent EC enter deep idle if fan's duty isn't zero. Normally, the freq of
PWM fan is 25 kHz. It means we must select apb2 clock as the source clock of
PWM fan. Or fan would stop when ec enters deep idle because of no PWM signal.

In hwtimer.c, we reset the preload counter to maximum value in ITEI32's ISR
since preload counter is changed by __hw_clock_source_set all the time.
We also found there're no event set if it's deadline is over 32 bits but
current source clock isn't. To prevent ec doesn't wake-up in deep-idle even if
ITIM32 expires, FW set an event for ITIM32 after process_timers().

Modified sources:
1. wheatley/board.h: Add CONFIG_LOW_POWER_S0 definition.
2. clock.c: Enable Host interrupt for LPC.
3. clock.c: Disable LP_WK_CTL for better power consumption.
4. gpio.c: Add ISR for Host interrupt.
5. uart.c: Introduce bit 6 of USTAT to make sure transmitting is completed.
6. register.h: Add uart_clear_pending_wakeup function.
7. hwtimer.c: Fixed watchdog issue when ITIM32 is closed to overflow.
8. fan.c: Enable deep sleep if duty cycle is zero.
9. include/system.h: Add SLEEP_MASK_FAN for fan control loop.
10. core/cortex-m/task.c: Add "isb" to flash the garbage data in the
    instruction pipeline.

BUG=chrome-os-partner:34346
TEST=make buildall -j; test nuvoton IC specific drivers
BRANCH=none

Change-Id: Ibe3630d0d68cf3f32206adb2afa1b5958916a2be
Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/324651
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-02-06 01:57:58 -08:00
Dino Li
a313fc9b1a chip: it83xx: fix EC interrupt vector registers issue
We have a limitation for EC interrupt vector registers.
System may read incorrect interrupt number in ISR so we need to add
a workaround to prevent it.

The following is a example that got incorrect interrupt number:
1. REG IVCTx = 0x10. (no interrupt pending)
2. EC INT6 interrupt occurs (IVCTx = 0x16) and jump to ISR.
3. Read interrupt vector register to determine interrupt number.
4. Higher priority interrupt of same interrupt group occurs
   (for example: INT134, IVCTx = 0x96) while the system is reading the
   interrupt vector register for EC INT6, we may end up with an incorrect
   interrupt number between 0x16 and 0x96.

Signed-off-by: Dino Li <dino.li@ite.com.tw>

BRANCH=none
BUG=none
TEST=1. EC interrupts work normally: WUI (GPIO interrupt), timer, uart,
        LPC, I2C, and PECI.
     2. Console command 'taskinfo'.

Change-Id: I54e61f417ad506eb3b4cd5d0652f64eed9a28a17
Reviewed-on: https://chromium-review.googlesource.com/322097
Commit-Ready: Dino Li <dino.li@ite.com.tw>
Tested-by: Dino Li <dino.li@ite.com.tw>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-01-28 00:02:03 -08:00
Duncan Laurie
97713dba84 ec: Add a chipset reset hook
There are hooks for chipset power sequencing but not one to indicate
that the system has reset at runtime.  Add a hook for this and
implement for lm4 and mec1322.  The hook is notified on any platform
reset, including those that happen on the way into S3/S5 state.

There is a new config variable added because the hook is notified in
the interrupt handler and needs a deferrable function that needs to
be added to every board.

BUG=chrome-os-partner:46049
BRANCH=none
TEST=tested on glados and samus

Change-Id: I3be639414e18586344e0ec84632a50dfc1df586b
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/315221
Commit-Ready: Aaron Durbin <adurbin@chromium.org>
Tested-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2016-01-25 21:46:48 -08:00
Dino Li
0c8a1b8d39 core: nds32: add task_wait_event_mask() function to nds32 core
[task]
1. Copy task_wait_event_mask() function of cortex-m0.
[system]
2. Include host_command.h for host_command_pd_request_hibernate().
[i2c]
3. Update i2c handler to use task_wait_event_mask.

Signed-off-by: Dino Li <dino.li@ite.com.tw>

BRANCH=none
BUG=chromium:435611,chromium:435612
TEST=1. console commands: i2cscan, i2cxfer, and battery.

Change-Id: If5bb4407460d28c0b021ab133ca4b635ff7bc3c9
Reviewed-on: https://chromium-review.googlesource.com/320440
Commit-Ready: Dino Li <dino.li@ite.com.tw>
Tested-by: Dino Li <dino.li@ite.com.tw>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-01-05 23:39:11 -08:00
Icarus Sparry
077e545662 cortex-m: proper handling of input parameters to SVC handler
According to section 2.7 of Cortex-M3 Application Note 179: A Cortex-M3
processor can get a "late arriving exception" and this will corrupt the
values of the r0, r1, r2 and r3 registers passed in an svc call.

http://infocenter.arm.com/help/topic/com.arm.doc.dai0179b/AppsNote179.pdf

The fix is to reload the two registers we care about, r0 and r1, from
the stack to ensure the input parameters to SVC handler, desched (r0)
and resched (r1), are valid.

BUG=chrome-os-partner:48499
BRANCH=none
TEST=Used assert to verify resched is a valid TASK ID.

Change-Id: Ie2229472e709febe16eee3c2cd986e3815fda076
Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/319849
Commit-Ready: Icarus W Sparry <icarus.w.sparry@intel.com>
Tested-by: Icarus W Sparry <icarus.w.sparry@intel.com>
Reviewed-by: Icarus W Sparry <icarus.w.sparry@intel.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-01-05 17:26:10 -08:00
Dino Li
11c2c92236 nds32: start_irq_handler() use system stack
[symptom]
The 'vboot_hash_start()' always return busy error and variable 'in_progress'
got a strange value(should be 0 or 1).

'start_irq_handler()' causes scratchpad overflow in first context switch.
It must be called after SP switch to system stack in ISR.

NOTE:
The scratchpad is still also need more size even if
'start_irq_handler()' is using system stack. following is detail:

1. uint32_t scratchpad[19] 0x81d34 ~ 0x81d7f
[__task_start:]
2. /* put the dummy stack pointer at the top of the stack in scratchpad */
   addi $sp, $r3, 4 * 18
   -> SP 0x81d7c
3. syscall push return address (-4)
   -> SP 0x81d78
[ISR:]
4. push r15, fp, lp, and sp (-0x10)
   -> SP 0x81d68
5. push r0 ~ r5 (-0x18)
   -> SP 0x81d50
[__switch_task:]
6. /* save ipsw, ipc, r6, r7, r8, r9, r10 on the current process stack */ (-0x1C)
-> SP 0x81d34

Signed-off-by: Dino Li <dino.li@ite.com.tw>

BRANCH=none
BUG=none
TEST=1. hash done.
     2. console command 'taskinfo'.
     3. the scratchpad does not overflow after first context switch.

Change-Id: If5d89ff5c945a777010492fcfb54bf41f434ed69
Reviewed-on: https://chromium-review.googlesource.com/317468
Commit-Ready: Dino Li <dino.li@ite.com.tw>
Tested-by: Dino Li <dino.li@ite.com.tw>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-12-16 21:49:34 -08:00
Vadim Bendebury
432ea75d92 cr50: add ability to include two identical RW sections in the EC image
A typical EC image includes two similar in their functionality
subsections, RO and RW. CR50 has a small RO subsection, all it does -
detects a proper RW image to run and starts it up. To provide for
reliable firmware updates, the CR50 image needs to include two RW
sections, while the code is running from one RW subsection, the other
one can be upgraded.

This patch adds the ability to generate two identical RW sections,
mapped half flash size apart, and include them into the resulting EC
image.

To keep things simple the previously existing RW section's name is not
being changed, while the new (identical) RW section is named RW_B.

Two configuration options need to be defined to enable building of the
new image type: CONFIG_RW_B to enable the feature and
CONFIG_RW_B_MEM_OFF to define where RW_B should be mapped into the
flash.

A new rule added to Makefile.rules allows to generate a different lds
file from the same source (core/cortex-m/ec.lds.S) by defining a
compile time variable to pick a different base address for the
rewritable section, when RW_B is built.

BRANCH=none
BUG=chromium:43025
TEST=as follows:
    - make buildall -j still succeeds
    - verified that regular CR50 image starts successfully

    - modified chip/g/loader/main.c to launch RW_B first, re-built and
      re-run the image, observed on the console:

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
  cr50 bootloader, 20151118_11218@80881, no USB, full crypto
  Valid image found at 0x00084000, jumping

  --- UART initialized after reboot ---
  [Reset cause: power-on]
  [Image: unknown, cr50_v1.1.4160-4c8a789-dirty 2015-12-07 18:54:27 vbendeb@eskimo.mtv.corp.google.com]
  [0.001148 Inits done]
  This FPGA image has no USB support
  Console is enabled; type HELP for help.
  > [0.002212 task 2 waiting for events...]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    (note that the image base address is 0x840000, which is RW_B).

Change-Id: Ia2f90d5e5b7a9f252ea3ecf3ff5babfad8a97444
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/316703
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-12-09 06:36:22 -08:00
Shawn Nematbakhsh
6e4848c200 task: Don't discard events on mutex contention
On mutex contention, call task_wait_event_mask(), which will wait for
a mutex event without clearing other pending events.

BUG=chrome-os-partner:47918,chromium:435611,chromium:435612
BRANCH=None
TEST=Manual on snoball. Verify samus can successfully negotiate PD power
contract when attached to snoball.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I85cd32f2670246da9e4787025390aba2c93f9c36
Reviewed-on: https://chromium-review.googlesource.com/314492
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2015-11-30 12:27:58 -08:00
Vadim Bendebury
a8f2e3625e add the 'extension' command framework
This patch introduces a facility which would allow to compile in
callbacks for arbitrary commands passed over various communication
protocols.

Typically this will be used for testing, when various test commands
are multiplexed over an existing protocol.

The callbacks are associated with 16 bit command codes. On input the
callback receives a buffer, containing the command's argument, the
size of the command argument and the maximum size of the buffer. On
output the callback stores processing result in the same buffer and
updates the size to the actual amount of returned data.

Callback descriptors are stored in a dedicated read only section which
is scanned by extension_route_command() to find a callback associated
with a certain command code.

A console channel is also being introduced to allow controlling
console output generated by extension commands handlers.

BRANCH=none
BUG=chrome-os-partner:47524
TEST=none yet

Change-Id: I8ae16a78ca7d72176a5e7f74dd7a232078e7c06c
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/312586
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-11-17 14:40:26 -08:00
Dino Li
21c0f8e69c nds32: fix lds
symptom:
.bss.slow won't be cleared during initialization.

Signed-off-by: Dino Li <dino.li@ite.com.tw>

BRANCH=none
BUG=none
TEST=.bss.slow = 0.

Change-Id: I6a8b84807b36a64f29732f09f56947e17d5ba898
Reviewed-on: https://chromium-review.googlesource.com/312155
Commit-Ready: Dino Li <dino.li@ite.com.tw>
Tested-by: Dino Li <dino.li@ite.com.tw>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-11-12 17:55:02 -08:00
Aseda Aboagye
fe3189a56f cortex-m0: Ensure .bss.slow section is cleared.
The .bss.slow input section needs to be included before __bss_end,
otherwise it won't get cleared to zero.

BUG=None
BRANCH=None
TEST=Build jerry.  Verify that __bss_end is at the end of the .bss.slow
section.
TEST=make -j buildall tests

Change-Id: I41d028ee166d05b34a889499cdcb0254341be1b6
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/312404
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-11-12 16:13:51 -08:00
Shawn Nematbakhsh
1ade79a8e6 cleanup: Fix gcc 5.2.1 compile errors
BUG=chromium:552006
BRANCH=None
TEST=`make buildall -j` and also verify panic reporting works on
glados_pd.

Change-Id: Ic9f1ec6b5297389df0d46bb38a67c156901ed956
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/311253
Commit-Ready: Shawn N <shawnn@gmail.com>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2015-11-11 11:00:56 -08:00
Vadim Bendebury
b895b9e933 cr50: allocate signature headers in both RO and RW images
With the proper RO in place, RW must be signed in the same manner, as
RO. This patch makes sure that there is room in the RW header for the
signature.

BRANCH=none
BUG=chrome-os-partner:43025
TEST=with the rest of the patches applies the RO successfully boots up
     the RW.

Change-Id: I1538195e0181c23c874ddd300887cf5da8c5a867
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/311421
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2015-11-10 06:54:43 -08:00
Aseda Aboagye
260e85cd07 system: Copy the loader lastly before jumping.
The point at which we reloaded the loader was too early.  When items are
placed into .bss.slow via CONFIG_REPLACE_LOADER_WITH_BSS_SLOW, other
tasks could still access their variables that may have been in that
region after we had replaced those contents with the loader.  This
commit moves the reloading of the loader to as late as possible once all
tasks have done their HOOK_SYSJUMP work.

Also, fixed a bug with the .bss.slow section.  If a board is not using
the config option but items are placed in that section, that part of RAM
would not be cleared out.

BUG=chrome-os-partner:46056
BRANCH=None
TEST=Enable config option on GLaDOS and add a few variables to the
.bss.slow section.  'sysjump' between RO and RW and verify that no data
bus error is encountered.
TEST=make -j buildall tests

Change-Id: I3084700b9d5c144e86e2e408b72d2e3075a67413
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/306173
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-11-08 07:59:39 -08:00
Dino Li
032846bc32 it8380dev: modify hwtimer and LPC wake up
1. In combinational mode and clock source is 8MHz,
   if timer 3 counter register always equals to 7, then timer 4 will be a
   32-bit MHz free-running counter.
2. Fix TIMER_32P768K_CNT_TO_US(), each count should be 30.5175 us,
   not 32.768us.
3. Fix TIMER_CNT_8M_32P768K().
4. Make sure LPC wake up interrupt is enabled before entering doze /
   deep doze mode.

Signed-off-by: Dino Li <dino.li@ite.com.tw>

BRANCH=none
BUG=none
TEST=1. Console commands: 'gettime', 'timerinfo', 'waitms', and 'forcetime'.
     2. Enabled Hook debug, no warning message received (48hrs).
     3. Tested ectool command 'version' x 2000.

Change-Id: I796d985361d3c18bc5813c58705b41923e28c5b1
Reviewed-on: https://chromium-review.googlesource.com/310039
Commit-Ready: Dino Li <dino.li@ite.com.tw>
Tested-by: Dino Li <dino.li@ite.com.tw>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-11-05 11:10:30 -08:00
Dino Li
2ea7b194d9 nds32: fix interrupt
1. To enable INT_PRI (hardware interrupt priority level 0~3)
   register, bit0@INT_CTRL = 0.
2. GIE need to be enabled before UART is initialized.
   [symptom]
   To define CONFIG_RWSIG / CONFIG_RSA / CONFIG_SHA256, then power on:
   after RW image is verified, firmware stuck in uart_flush_output().

Signed-off-by: Dino Li <dino.li@ite.com.tw>

BRANCH=none
BUG=none
TEST=1. bit0@INT_CTRL = 0.
     2. The RW image is verified and jump to image RW.

Change-Id: I393a3d5f87ea257885b872c91bfce43aecbaea8b
Reviewed-on: https://chromium-review.googlesource.com/309400
Commit-Ready: Dino Li <dino.li@ite.com.tw>
Tested-by: Dino Li <dino.li@ite.com.tw>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-11-01 19:45:58 -08:00
Dino Li
ad1d33778f it8380dev: Increase DLM size
1. Total DLM size is 48KB.

Signed-off-by: Dino Li <dino.li@ite.com.tw>

BRANCH=none
BUG=none
TEST=DLM 0x84000 ~ 0x8BFFF read/write OK.

Change-Id: I2340aeefca60ad59062254ddd363c703c30cfd24
Reviewed-on: https://chromium-review.googlesource.com/307006
Commit-Ready: Dino Li <dino.li@ite.com.tw>
Tested-by: Dino Li <dino.li@ite.com.tw>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-10-25 07:40:31 -07:00
Dino Li
19c1e9905d it8380dev: fix clock module
1. Implement deep doze mode for CONFIG_LOW_POWER_IDLE.

Signed-off-by: Dino Li <dino.li@ite.com.tw>

BRANCH=none
BUG=none
TEST=test the following items in deep doze mode.
     1. WUI interrupts wake-up OK. (For example, power button, lid,
        uart rx, keyboard ksi, and so on)
     2. LPC access interrupt wake-up OK.
     3. Enabled Hook debug, no warning message received (48hrs).

Change-Id: I8702a112632cb6c1c0fa75d682badf272130a7d4
Reviewed-on: https://chromium-review.googlesource.com/307060
Commit-Ready: Dino Li <dino.li@ite.com.tw>
Tested-by: Dino Li <dino.li@ite.com.tw>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-10-25 04:34:36 -07:00
Aseda Aboagye
9ed620f04b system: Add support to reclaim space from loader.
Certain ECs which cannot load both the RO and RW images into memory
simultaneously have a little firmware (LFW) loader that is loaded into
the beginning of the program memory.  This loader is responsible for
loading the RO/RW images, however once we begin executing code from
main(), the loader has already completed it's purpose.  We can reuse
this space by allocating portions of the .bss section here.  This
currently saves us 3k for mec1322.  This section is .bss.slow.

To use this feature simply define the following config option in
board.h.

  #define CONFIG_REPLACE_LOADER_WITH_BSS_SLOW

In some cases, such as the mec1322, this region of RAM is optimized for
code and not data.  Therefore, ideally infrequently used data should go
into this region.

BUG=chrome-os-partner:46056
BUG=chrome-os-partner:46063
BRANCH=None
TEST=Flash GLaDOS; sysjump rw; Verify that we are in rw; sysjump ro;
Verify we are back in ro.
TEST=Build GLaDOS, check output memory map for LDR_REGION and .bss.slow
section.
TEST=make -j buildall tests

Change-Id: I5b95cacc211278cf780a857b5a2ecfc1a0a28c45
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/305254
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Andrey Petrov <andrey.petrov@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-10-13 21:58:01 -07:00
Gwendal Grignou
828b55a735 common: Add magnetometer online calibration.
Code for hard iron calibration: Every seconds (or faster if enough
samples), find a sphere that fit the compass data.

Based on Android code.

BRANCH=smaug
BUG=chrome-os-partner:39900
TEST=Check hard-iron bias is removed. Works better outside.

Change-Id: Iab479d5113b6560b4f01b0fd87373d2eecdb9b54
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/299583
Reviewed-by: Anton Staaf <robotboy@chromium.org>
2015-10-13 05:28:54 -07:00
Dino Li
4bb7c3e2f1 nds32: fix panic
Support saving panic data for nds32 core.

Signed-off-by: Dino Li <dino.li@ite.com.tw>

BRANCH=none
BUG=none
TEST=1. console commands 'crash' and 'panicinfo'.
     2. ectool command 'panicinfo'

crash assert

ASSERTION FAILURE '0' in command_crash() at common/panic_output.c:162
=== EXCEP: ITYPE=1 ===
R0  00000000 R1  000000a2 R2  00000060 R3  00000000
R4  00080c40 R5  00000000 R6  dead6663 R7  000000a2
R8  00000002 R9  00000000 R10 00081960 R15 00000000
FP  00000000 GP  000818d8 LP  0000079a SP  00080c60
IPC 000007a2 IPSW   70009
SWID of ITYPE: 0
Software panic reason PANIC_SW_ASSERT
Software panic info 0xa2

Rebooting...

panicinfo
Saved panic data: (NEW)
=== EXCEP: ITYPE=1 ===
R0  00000000 R1  000000a2 R2  00000060 R3  00000000
R4  00080c40 R5  00000000 R6  dead6663 R7  000000a2
R8  00000002 R9  00000000 R10 00081960 R15 00000000
FP  00000000 GP  000818d8 LP  0000079a SP  00080c60
IPC 000007a2 IPSW   70009
SWID of ITYPE: 0
Software panic reason PANIC_SW_ASSERT
Software panic info 0xa2

> crash divzero
=== EXCEP: ITYPE=10003 ===
R0  00000000 R1  00f02705 R2  00000060 R3  00081a09
R4  00000000 R5  00000000 R6  00000001 R7  00080cc0
R8  00000002 R9  00000000 R10 00081961 R15 00000000
FP  00000000 GP  000818d8 LP  00009bce SP  00080c90
IPC 00009bee IPSW   70009
SWID of ITYPE: 1
Exception type: General exception [Arithmetic]
Exception is caused by a data memory access

Rebooting...

panicinfo
Saved panic data: (NEW)
=== EXCEP: ITYPE=10003 ===
R0  00000000 R1  00f02705 R2  00000060 R3  00081a09
R4  00000000 R5  00000000 R6  00000001 R7  00080cc0
R8  00000002 R9  00000000 R10 00081961 R15 00000000
FP  00000000 GP  000818d8 LP  00009bce SP  00080c90
IPC 00009bee IPSW   70009
SWID of ITYPE: 1
Exception type: General exception [Arithmetic]
Exception is caused by a data memory access

> crash stack
+1+2+3+4+5+6+7+8+9+10+11+12+13+14+15+16+17

Stack overflow in CONSOLE task!
=== EXCEP: ITYPE=8 ===
R0  00000002 R1  00000002 R2  00000060 R3  00080458
R4  0000ebdd R5  00000000 R6  dead6661 R7  00000002
R8  00000bc8 R9  00000002 R10 00000000 R15 00000000
FP  00000000 GP  000818d8 LP  0000079a SP  00080448
IPC 00000a92 IPSW   70009
SWID of ITYPE: 0
Software panic reason PANIC_SW_STACK_OVERFLOW
Software panic info 0x2

Rebooting...

panicinfo
Saved panic data: (NEW)
=== EXCEP: ITYPE=8 ===
R0  00000002 R1  00000002 R2  00000060 R3  00080458
R4  0000ebdd R5  00000000 R6  dead6661 R7  00000002
R8  00000bc8 R9  00000002 R10 00000000 R15 00000000
FP  00000000 GP  000818d8 LP  0000079a SP  00080448
IPC 00000a92 IPSW   70009
SWID of ITYPE: 0
Software panic reason PANIC_SW_STACK_OVERFLOW
Software panic info 0x2

> crash watchdog
Pre-watchdog warning! IPC: 00009c6c

panicinfo
Saved panic data: (NEW)
=== EXCEP: ITYPE=0 ===
R0  00000000 R1  00000000 R2  00000000 R3  00000000
R4  00000000 R5  00000000 R6  dead6664 R7  00000000
R8  00000000 R9  00000000 R10 00000000 R15 00000000
FP  00000000 GP  00000000 LP  00000000 SP  00000000
IPC 00009c6c IPSW   00000
SWID of ITYPE: 0
Software panic reason PANIC_SW_WATCHDOG
Software panic info 0x0
>

Change-Id: I3d491ecd0789335db4633f9bf2ca09cf85503ed9
Reviewed-on: https://chromium-review.googlesource.com/303286
Commit-Ready: Dino Li <dino.li@ite.com.tw>
Tested-by: Dino Li <dino.li@ite.com.tw>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-10-07 17:51:36 -07:00
Dino Li
692428e1a6 it8380dev: fix hw timer and related function.
[chip config]
    1. No hardware specific udelay().
    2. Enable watchdog.
[watchdog]
    3. Watchdog period is "CONFIG_WATCHDOG_PERIOD_MS" of config.h.
    4. Watchdog auxiliary timer period is "CONFIG_AUX_TIMER_PERIOD_MS".
[task and irq]
    5. Write 1 to clear interrupt pending status, no |.
    6. A global variable for store interrupt number of software interrupt.
[uart]
    7. Always reset UART module before config it.
[hwtimer]
    8. Use more external timers for HW timer module.
[task]
    9. Fix task profiling.

Signed-off-by: Dino Li <dino.li@ite.com.tw>

BRANCH=none
BUG=none
TEST=[watchdog]
        1. console "waitms 1100", only pre-watchdog warning message.
        2. console "waitms 1600", warning message and watchdog reset.
     [hwtimer]
        3. console commands "gettime", "timerinfo", and "forcetime".
        4. enable hook debug and there is no delayed by more than 10%
           warning message over 48 hours.
        5. There is no watchdog reset too.
     [task]
        6. console 'taskinfo'
Task Ready Name         Events      Time (s)  StkUsed
   0 R << idle >>       00000000   32.927724  308/512
   1   HOOKS            00000000    0.034267  372/768
   2 R CONSOLE          00000000    0.116763  468/768
   3   HOSTCMD          00000000    0.000641  372/512
   4   KEYPROTO         00000000    0.000042  212/512
   5   KEYSCAN          00000000    0.000908  356/512
IRQ counts by type:
  38     2932
 155        1
 158      261
 160       67
Service calls:                   87
Total exceptions:              3348
Task switches:                  167
Task switching started:    0.001999 s
Time in tasks:            33.282819 s
Time in exceptions:        0.164717 s

Change-Id: I234085cec231cd855d2a5e639ea1b0966c61d796
Reviewed-on: https://chromium-review.googlesource.com/296939
Commit-Ready: Dino Li <dino.li@ite.com.tw>
Tested-by: Dino Li <dino.li@ite.com.tw>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-10-01 01:55:26 -07:00
Bill Richardson
094a81f5de cleanup: Handle signed RW images a bit cleaner
For signed EC RW images (CONFIG_RWSIG), there's no point in
embedding the public key or signature into the image itself since
it will just be replaced by the signer (either as the next step
in the build process, or after the fact for MP releases). This
takes that out and just points to where the pubkey and signature
will be placed.

BUG=none
BRANCH=none
TEST=make buildall

I also checked the signatures with

  futility show -t build/*/ec.bin

They still look good, and the one signed image I booted (Cr50)
works as before.

Change-Id: Ib39b7c508914851f81a1bebb2450e08ef0def76c
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/302630
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-09-25 19:36:37 -07:00
Shawn Nematbakhsh
854d5a6e7f cleanup: Remove CONFIG_FW_IMAGE_SIZE
Since CONFIG_RO_SIZE and CONFIG_RW_SIZE now exist (which may
theoretically be different sizes), it is no longer useful to globally
define the size of an image.

BUG=chromium:535027
BRANCH=None
TEST=`make buildall -j`. Also, verify glados / glados_pd continue to
function as expected.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ie29959923bc5d02b4d7d6d507ff2191bcb7d24c8
Reviewed-on: https://chromium-review.googlesource.com/301743
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2015-09-24 18:07:01 -07:00
Bill Richardson
4ae115e145 Fix typo when building with CONFIG_SHAREDLIB
The board-specific board.h defines things like this:

  #define CONFIG_RO_SIZE 1000
  #define CONFIG_RW_SIZE 1000
  #define CONFIG_SHAREDLIB_SIZE 200

And in the linker scripts we define some preprocessor macros like
so:

  #define FW_SIZE_(section) CONFIG_##section##_SIZE
  #define FW_SIZE(section) FW_SIZE_(section)

So that we can say things like this:

    FLASH (rx) : ORIGIN = FW_OFF(SECTION), LENGTH = FW_SIZE(SECTION)

Note that we have to use FW_SIZE, not FW_SIZE_

The difference is only noticeable when SECTION is #defined. If
${CFLAGS} has

  -DSECTION=RW

Then the expansion is this:

  FW_SIZE_(SECTION)    =>   CONFIG_SECTION_SIZE
  FW_SIZE_(RW)         =>   1000

There's no difference in the output for this particular CL, but
we should use the correct macro anyway to avoid confusion.

BUG=none
BRANCH=none
TEST=make buildall

Change-Id: I61edc76a1aaeb1c675b384371700f37dda39ed47
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/302150
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2015-09-23 21:26:21 -07:00
Mulin Chao
95ea672601 nuc: Fixed flash layout issue for npcx
Fixed flash layout issue for npcx

Modified drivers:
1. config_flash_layout.h: Fixed layout issue for npcx
2. flash_ec: add flashrom support for boards without JTAG in servo
connector

BUG=chrome-os-partner:34346
TEST=make buildall -j; test nuvoton IC specific drivers
BRANCH=none

Change-Id: I0b9b679c52b8a8e2a26c278b5024d0350fb77338
Reviewed-on: https://chromium-review.googlesource.com/300392
Commit-Ready: Mulin Chao <mlchao@nuvoton.com>
Tested-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-by: Mulin Chao <mlchao@nuvoton.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2015-09-21 20:50:56 -07:00