Commit Graph

21 Commits

Author SHA1 Message Date
Randall Spangler
6ab8e91658 cleanup: Remove checkpatch warnings
This make minor syntactic changes and renames some camel-cased symbols
to keep checkpatch from complaining.  The goal is to reduce the
temptation to use 'repo upload --no-verify'.

This is a big furball of find/replace, but no functional changes.

BUG=chromium:322144
BRANCH=none
TEST=build all boards; pass unit tests

Change-Id: I0269b7dd95836ef9a6e33f88c003ab0f24f842a0
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/180495
2013-12-19 00:12:28 +00: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
388a42cb3d Clean up fmap.c
No functional changes; just reformatting.

BUG=chrome-os-partner:15579
BRANCH=none
TEST=compile code

Change-Id: I6b775c835a935be845bc8aea3dd742af91ab2af7
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36455
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-10-24 19:07:20 -07:00
Louis Yung-Chieh Lo
9d872b724f Snow: WP_RO should be 0x10000 (including pstate).
To reflect the CL 00799d5 that moves the pstate to 0xf000.

BUG=chrome-os-partner:12799
TEST=Build in chroot.
snow:  WP_RO is changed from 0:0xf000 --> 0:0x10000.
daisy: WP_RO is unchanged.
link: WP_RO is unchanged.

Change-Id: I572bae3f624744e60d13a762875211beffc6c516
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/30670
Reviewed-by: Vic Yang <victoryang@chromium.org>
2012-08-17 01:48:30 -07:00
Randall Spangler
45cd8463a3 Remove signature-based vboot support
Superseded by EC software sync (hash-based).

Sig-based vboot was correctly implemented, but ended up being too slow
to be useful given the limited processing power of the EC chips, and
we also couldn't come up with a manageable way to handle A/B
autoupdate of signed EC firmware.

This change and an associated vboot_reference change shrinks the EC
binary by ~2KB.

BUG=chrome-os-partner:11232
TEST=build link,snow; boot link and check that 'hash' command still works.

Change-Id: I3f03ae2d0a4030977826980d6ec5613181e154c2
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/29496
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-08-07 19:06:33 -07:00
Louis Yung-Chieh Lo
d0d50b6da7 Change some FMAP area_offset to be related to the start of flash.
The area_offset of following area are wrong which is related to the CPU
view in the STM32 chip:

  FMAP
  RO_FRID
  RW_FWID

Add a macro RELATIVE() to calculate the real offset in flash.

BUG=chrome-os-partner:11269
TEST=build in chroot for link and snow.
Those fmap afddress are related to the start of flash.

Change-Id: I691814e2f53b1de0ecf9fd385bed8d5c598373a7
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28388
Commit-Ready: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
Reviewed-by: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
Tested-by: Yung-Chieh Lo <yjlou%chromium.org@gtempaccount.com>
2012-07-25 21:52:04 -07:00
Hung-Te Lin
7693bbd2e4 ec: Remove "_A" suffix in FMAP RW firmware areas.
Since we only have one RW firmware, let's remove _A to prevent confusion.
Also change "BOOT_STUB" to FR_MAIN to reflect the fact that it's not just
bootstub - it's a full firmware area just like FW_MAIN.

BUG=chrome-os-partner:11360
TEST=emerge-link chromeos-ec; dump_fmap -x /build/link/firmware/ec.bin

Change-Id: Ia84062ada5959164b2b4e0f9cc5fcc032ca6f71e
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27971
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2012-07-23 03:38:52 -07:00
Hung-Te Lin
7a7d7b7c86 chromeos-ec: Refine FMAP.
Make EC FMAP more compliant to existing devices (EC_RO, EC_RW, RW_FWID),
eliminating unnecessary areas (RO_SETION, EC_IMAGE), and add more detailed
comments to each area.

BUG=chrome-os-partner:11360
TEST=emerge-link chromeos-ec; dump_fmap -x ec.bin

Change-Id: I3d30d6fe0d3cee2e944009dccef488f7215b6395
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27739
2012-07-18 20:27:42 -07:00
Randall Spangler
c89edce83f Don't waste space on vblock and root key if not doing sig-based EC vboot
BUG=chrome-os-partner:11455
TEST=dump_fmap build/link/ec.bin; shouldn't see VBLOCK or ROOT_KEY sections

Change-Id: I8c1309936d86772fdf9aecdc8d95f0578ef0f65b
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27661
2012-07-17 14:41:00 -07:00
Randall Spangler
fc7b64e186 Remove firmware B
BUG=chrome-os-partner:11449
TEST=build link, snow, bds; ectool reboot_ec cold to make sure enums line up

Change-Id: Ie09db2080a00f1a7e2c05579b9b41ea5137c1af0
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27658
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-17 13:11:44 -07:00
Randall Spangler
c44c17890c Rename A and B images to RW and RW_B, part 1
All of our current EC configs have RO and a single RW image.  Calling
that image 'A' is confusing, particularly when combined with EC
software sync (where the RW image is updated from either the A or B AP
RW firmware).  So, rename it.

This changes all the build artifacts and constants.  Internal EC
commands and host commands still refer to A/B; that will be fixed in
part 2.

BUG=none
TEST=build link, snow, bds

Change-Id: Icfed4914745f0799bb71befb6a6563cfd8bc90ab
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27649
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2012-07-17 10:50:30 -07:00
Randall Spangler
2e0ae57990 Use __packed instead of __attribute__((packed))
The presubmit script for linux kernel style prefers the former.

BUG=none
TEST=none

Change-Id: I0a0a1eb039f45975ada075c1302d868071a7cfb1
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/26361
2012-06-28 17:40:39 -07:00
Randall Spangler
fb123b4838 Only one RW image is now the default
And if RW B isn't enabled, it's not even linked.

BUG=chrome-os-partner:10881
TEST=on link, should be no B image, and 'sysjump B' should fail
On BDS, still should be A and B images

Signed-off-by: Randall Spangler <rspangler@chromium.org>
Change-Id: Icb2af07881cc7e28b9b877f45824486a22fde8d7
Reviewed-on: https://gerrit.chromium.org/gerrit/26116
2012-06-26 13:58:54 -07:00
Bill Richardson
12eecc012b Put correct RO_FRID, RW_FWID_A, RW_FWID_B entries in FMAP
BUG=chrome-os-partner:9495
TEST=manual

Build image, run dump_fmap. Look for those entries.

Change-Id: I6dfc38e00ce1e11ea24c8392d1691fab32a59d1f
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/24696
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
2012-06-07 01:20:16 -07:00
Vincent Palatin
5e1f87ce56 do not advertise RW-B in FMAP if it doesn't exist
The Snow board has currently the second RW partition de-activated due to
flash space constraints, we don't want to send false information to the
tools.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BUG=chrome-os-partner:8865
TEST=on Snow, flashrom -p internal:bus=lpc -i EC_RW -w ec.bin

Change-Id: I6da60028aa69aeb476d5c2d98df5a03ece961891
2012-05-22 19:48:30 +00:00
Bill Richardson
add419009f Clean up linker scripts; detect out-of-flash problem.
The VMA of the .data segment is in RAM, but we actually put it into FLASH.
The linker doesn't notice if it runs out of flash, so it creates an invalid
image.

This adds an explicit check to be sure it all fits. It also refactors the
region declarations to be more explicit. For vboot-enabled configurations,

  CONFIG_SECTION_*      - describes the extent of flash for one entire image
  CONFIG_FW_*           - the region within the SECTION for the firmware only
  CONFIG_VBLOCK_*       - the region within the RW SECTIONs for the vblocks
  CONFIG_VBOOT_ROOTKEY  - the region within the RO SECTION for the root key

Look at chip/lm4/config.h for the best example.

BUG=chrome-os-partner:9839
TEST=manual

Build it, run it.

Change-Id: I3c652e82d58a5328115cc750c80ecba6a3fd99a3
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
2012-05-21 14:20:02 -07:00
Bill Richardson
8101b71316 Enable verified boot for EC firmware
BUG=chrome-os-partner:7459
TEST=manual

In the chroot:

  cd src/platform/ec
  make BOARD=link

The firmware image (build/link/ec.bin) is signed with dev-keys. Reflash the
EC and try it, and it should verify and reboot into RW A.

Additional tests (setting USE_RO_NORMAL, poking random values into VBLOCK_A
or FW_MAIN_A to force RW B to run, etc.) are left as an exercise for the
reader. I've done them and they work, though.

Change-Id: I29a23ea69aef02a11aebd4af3b043f6864723523
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
2012-05-10 17:27:36 -07:00
Louis Yung-Chieh Lo
468e34d51d Add EC_RO/EC_RW and WP_RO FMAP area for fw_updater and factory.
EC_RO and WP_RO area are identical and should cover whole range needed to
be write-protected. While EC_RO is for legacy firmware updater, the WP_RO
is for future factory finalize test.

EC_RW is for fw_updater to update both A/B at once.

Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>

BUG=chrome-os-partner:9536
TEST=build in chroot and dump_fmap build/link/ec.bin
opened build/link/ec.bin
hit at 0x00013800
fmap_signature   __FMAP__
fmap_version:    1.0
fmap_base:       0x0
fmap_size:       0x0003f800 (260096)
fmap_name:       EC_FMAP
fmap_nareas:     16
area:            1
area_offset:     0x00000000
area_size:       0x00014000 (81920)
area_name:       RO_SECTION
area:            2
area_offset:     0x00000000
area_size:       0x00013000 (77824)
area_name:       BOOT_STUB
area:            5
area_offset:     0x00013800
area_size:       0x00000302 (770)
area_name:       FMAP
area:            7                    <----
area_offset:     0x00000000           <----
area_size:       0x00014000 (81920)   <----
area_name:       EC_RO                <----
area:            8                    <----
area_offset:     0x00014000           <----
area_size:       0x00028000 (163840)  <----
area_name:       EC_RW                <----
area:            9                    <----
area_offset:     0x00000000           <----
area_size:       0x00014000 (81920)   <----
area_name:       WP_RO                <----
area:            10
area_offset:     0x00014000
area_size:       0x00014000 (81920)
area_name:       RW_SECTION_A
area:            14
area_offset:     0x00028000
area_size:       0x00014000 (81920)
area_name:       RW_SECTION_B

Change-Id: I11b9450f87e26ef1cd0ac65ecd059e13d8489e26
2012-05-08 14:51:34 +08:00
Bill Richardson
3b361af2a7 Update EC config and FMAP to reserve room for vboot signatures
This just reserves room. It doesn't actually perform any verification yet.

BUG=chrome-os-partner:7459
TEST=manual

  make BOARD=link
  dump_fmap build/link/ec.bin

Change-Id: I424db1d601a614be3dfe5abb200e24e8bc62e47e
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
2012-05-04 14:42:58 -07:00
Louis Yung-Chieh Lo
f1467b61b7 Refine the EC flash size in FMAP structure.
BUG=none
TEST=make and dump:
% dump_fmap build/link/ec.bin
...
fmap_size:       0x0003f800 (260096)
...

Change-Id: I9e5a5d1a1d2c9d3e6660a13d5b2fff438517af7e
2012-05-02 15:29:07 +08:00
Bill Richardson
8d921af0bb Add basic FMAP to EC firmware image.
This is very basic, so you can only rely on RO_SECTION, RW_SECTION_A, and
RW_SECTION_B for now. We'll fill in more regions as we add vboot stuff.

Still, you should be able to do things like this:

  flashrom -p internal:bus=lpc -r ec.bin

  flashrom -p internal:bus=lpc -w ec.bin -i RW_SECTION:ec.B.flat

BUG=chrome-os-partner:8198
TEST=manual

Build the image, look for the FMAP in it.

  cd src/platform/ec
  make BOARD=link
  dump_fmap ./build/link/ec.bin

Change-Id: I0adbbfb8e975faae805bda271873fcef46590cf4
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
2012-05-01 15:54:39 -07:00