Commit Graph

21 Commits

Author SHA1 Message Date
Shawn Nematbakhsh
e3dce49334 cleanup: Use appropriate image geometry CONFIGs
- Use CONFIG_*_MEM when dealing with images in program memory.
- Use CONFIG_*_STORAGE when dealing with images on storage.
- Use CONFIG_WP when dealing with the entire WP RO region.

BUG=chrome-os-partner:39741,chrome-os-partner:23796
TEST=Manual on Cyan with subsequent commit. Verify that FMAP matches
actual layout of image. Verify flashrom succeeds flashing + verifying EC
image using host command interface.
BRANCH=None

Change-Id: Iadc02daa89fe3bf07b083ed0f7be2e60702a1867
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/270269
2015-05-15 06:42:30 +00:00
Shawn Nematbakhsh
39bd18b890 cleanup: Rename image geometry CONFIGs
Rename image geometry configs with a uniform naming scheme to make their
purposes more clear.

CONFIG_RO_MEM_OFF (was CONFIG_FW_RO_OFF) - RO image offset in program memory
CONFIG_RO_STORAGE_OFF (was CONFIG_RO_SPI_OFF) - RO image offset on storage
CONFIG_RO_SIZE (was CONFIG_FW_RO_SIZE) - Size of RO image

CONFIG_RW_MEM_OFF (was CONFIG_FW_RW_OFF) - RW image offset in program memory
CONFIG_RW_STORAGE_OFF (was CONFIG_RW_SPI_OFF) - RW image offset on storage
CONFIG_RW_SIZE (was CONFIG_FW_RW_SIZE) - Size of RW image

CONFIG_WP_OFF (was CONFIG_FW_WP_RO_OFF) - Offset of WP region on storage
CONFIG_WP_SIZE (was CONFIG_FW_WP_RO_SIZE) - Size of WP region on storage

BUG=chrome-os-partner:39741,chrome-os-partner:23796
TEST=Set date / version strings to constants then `make buildall -j`.
Verify that each ec.bin image is identical pre- and post-change.
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I6ea0a4e456dae71c266fa917a309b9f6fa4b50cd
Reviewed-on: https://chromium-review.googlesource.com/270189
Reviewed-by: Anton Staaf <robotboy@chromium.org>
2015-05-12 20:54:37 +00:00
Vic Yang
244e7d3f08 Add test for flash_is_erased()
This test checks:
  - flash_is_erased() returns true when flash is erased.
  - flash_is_erased() returns false when the entire flash except one
    byte is erased.

BUG=chrome-os-partner:30281
TEST=Check this test fails without the fix for flash_is_erased(), but
passes with it.
BRANCH=all (if the fix is cherry-picked)

Change-Id: Id4fe5591381cabcdad9bb16ba820acd48e92ba13
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/206897
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-07-08 02:14:53 +00:00
Vic Yang
1e08d488bd Mock flash erase/write function at physical layer
This moves the mock function from common layer down to physical layer to
complete the test of common layer.

Also disable flash test for hardware tests, as this is only testing
common layer.

BUG=chrome-os-partner:19236
TEST=util/make_all.sh
BRANCH=None

Change-Id: Idd1c2c44591952894486f84d428872cfbf2cfdad
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/170297
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-09-24 21:00:25 +00:00
Vic Yang
6c3be20539 Add multi-step test support
We already have a multi-step test. Let's move it to test_util.c so that
upcoming tests can also use it.

BUG=chrome-os-partner:19235
TEST=Pass all tests
BRANCH=None

Change-Id: I6b7a036297f3b4b2778687488d1dc5b5bb4fe255
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/167950
2013-09-05 07:20:46 +00:00
Randall Spangler
873e4425c5 Remove unneeded direct includes of board.h and config.h
Both of these are included via common.h, which is in turn included by
most other header files.  Directly including board.h or config.h is
redundant and discouraged.

No code changes, just removing #includes.

This is in preparation for making a top-level config.h file, but that
change will be easier to review if it doesn't touch as many files.

BUG=chrome-os-partner:18343
BRANCH=none
TEST=build all platforms

Change-Id: I204bcebe5607c6e6808821eb071cfc31d2a93a7c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62121
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-07-16 12:06:30 -07:00
Vic Yang
62f2a33ff2 Add flash host read command test
This checks the correctness of data returned by flash read host command.

BUG=chrome-os-partner:19236
TEST=Pass all tests.
BRANCH=None

Change-Id: I3b97addb9b14922e9f33a71b865000ae9a8d40a8
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/60963
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-07-11 04:26:10 -07:00
Randall Spangler
177dc398d3 Allow bigger flash write commands
Version 1 of EC_CMD_FLASH_WRITE will use as big a write as possible given
the available command parameter space.  Falls back to 64 byte writes on old
platforms.

BUG=chrome-os-partner:20571
BRANCH=none
TEST=Copy burn_my_ec onto a link and run it.  Write size should be 64 bytes
     for the first half of the update (since the old EC doesn't support ver.1
     of the write command) and 240 bytes for the second half of the update.

Change-Id: I5900de3a5700d7c82a2e0c3cf9921b7ced1c0343
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/60511
2013-07-01 16:14:16 -07:00
Vic Yang
e03efaa475 More flash unit test
BUG=chrome-os-partner:19236
TEST=Pass the test
BRANCH=None

Change-Id: Idfbbdd40948ea4f8468cf9de95eee17e0d0773ed
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/58794
2013-06-17 20:27:27 -07:00
Vic Yang
7de03b0f0e A method to mock host command
This will be used often, so let's move it to test_util.c.

BUG=chrome-os-partner:19235
TEST=Pass flash test.
BRANCH=None

Change-Id: I2f685f657f8742c2b29e3b9c88ba01daacf982f8
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/58793
2013-06-17 20:27:27 -07:00
Vic Yang
80105a9556 Enable flash unit test on emulator
BUG=chrome-os-partner:19236
TEST=Pass all tests
BRANCH=None

Change-Id: I09276292499b94b2d4810830de51e4c63a9b7342
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/56704
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-06-03 14:34:10 -07:00
Randall Spangler
b490e866dc Clean up flash section defines and increase lm4 image size
The firmware defines had two almost-identical sets.  Coalesce into one
consistent set.

Link had 256 KB flash, but only allowed 2 80KB images.  Future
LM4-based platforms (slippy/peppy/falco/etc) will now use the entire
flash, with RO=124KB, pstate=4KB, RW=128KB.  This matches what the
STM32 platforms do, where pstate is contiguous with the RO firmware.

No functional change to STM32-based platforms.

BUG=chrome-os-partner:19176
BRANCH=none
TEST=build all platforms and dump_fmap ec.bin.
  - stm32-based platforms should report RO=61440@0, RW=65536@0x10000
  - link should report RO=81920@0, RW=81920@0x14000
  - slippy should report RO=129024@0, RW=131072@0x20000

Change-Id: I20b1d95c16250d9a5d228ead06eef03d96548823
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/56655
2013-06-03 14:32:38 -07:00
Randall Spangler
a1006865e7 Move write protect GPIO handling to flash module
Write protect signal naming is now consistent across boards.

New CONFIG_WP_ACTIVE_HIGH is present on systems where the write
protect signal is active-high (e.g. Link).  This will be used in the
next CL, which moves flash_get_protect() to flash_common.c

BUG=chrome-os-partner:15613
BRANCH=none
TEST=flashinfo properly reports WP signal status

Change-Id: I502ab033c3eb36661cc3ee97320874b3fbf6fc0d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/56087
Reviewed-by: Vic Yang <victoryang@chromium.org>
2013-05-23 11:08:44 -07:00
Vic Yang
e71f008388 Put test utility macros in header
Several test utility macros have been duplicated across tests. Let's put
them in a single place.

BUG=chrome-os-partner:19236
TEST='make runtests', 'BOARD=spring make tests'
BRANCH=None

Change-Id: Ib0c9f829715425cc23e33b8ef456b17dfadab13c
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50513
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-05-08 18:11:01 -07:00
Vic Yang
8f00a3beee Add more flash test
This adds write protect status check across reboots.

BUG=chrome-os-partner:18598
TEST=Run on Spring
BRANCH=None

Change-Id: Iba0c5d6f906c64af4216aaecac35b87c1392a873
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48752
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-04-21 23:02:03 -07:00
Vic Yang
5b04478423 Add flash write protect test
BUG=chrome-os-partner:18598
TEST=Run on Spring
BRANCH=None

Change-Id: I6488ace5d6b758410c76d7625787413eba37cbe9
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48208
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-04-17 21:07:09 -07:00
Vic Yang
216bb93128 Fix flash tests
This merges flash_overwrite and flash_rw_erase to a single test binary.

BUG=chrome-os-partner:18598
TEST=Run on Spring
BRANCH=None

Change-Id: I1da7577cb5dc196178930dda3a07bb942d959866
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48090
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-04-15 20:40:02 -07:00
Vic Yang
f229fabd8b Fix flash_overwrite unit test
This also moves flash related tests to use new 'hostcmd' console command.

BUG=chrome-os-partner:10262
TEST=Test passed
BRANCH=none

Change-Id: I5616bfa93bcde0beb4cb2baf2d38e8b5d827c275
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/30665
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2012-08-19 09:56:32 -07:00
Vic Yang
dbefb29f02 Fix unit tests
Recently, there have been several changes to LPC and host command modules.
This CL fixes unit tests after these changes.

BUG=none
TEST=All test passed.

Change-Id: I263716899af78a61e324fcd0b2636b948617a264
Reviewed-on: https://gerrit.chromium.org/gerrit/27354
Reviewed-by: Rong Chang <rongchang@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
Commit-Ready: Vic Yang <victoryang@chromium.org>
2012-07-13 02:10:46 -07:00
Vic Yang
1bd6146892 Add a test of flash read/write/erase test
This test checks physical read/write/erase functions are called
correctly.

BUG=chrome-os-partner:10261
TEST=Test passed.

Change-Id: Iff58f352bd732a0da9b7b7fe68c4bf87c84906a8
Reviewed-on: https://gerrit.chromium.org/gerrit/27144
Reviewed-by: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
Tested-by: Vic Yang <victoryang@chromium.org>
Commit-Ready: Vic Yang <victoryang@chromium.org>
2012-07-13 01:13:20 -07:00
Vic Yang
37b295fd6e Add a test of flash overwrite
This test checks we cannot overwrite current running system image.

BUG=chrome-os-partner:10262
TEST=Test passed

Change-Id: I72be277c9de2114e72000a102d8b885e842ef15a
Reviewed-on: https://gerrit.chromium.org/gerrit/27006
Commit-Ready: Vic Yang <victoryang@chromium.org>
Reviewed-by: Vic Yang <victoryang@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
2012-07-10 00:35:58 -07:00