chromiumos/platform/mosys.git
14 months agoeventlog: pit: Hook up eventlog on pit. 35/65135/2 master release-R30-4537.B
Gabe Black [Thu, 8 Aug 2013 07:06:04 +0000 (00:06 -0700)]
eventlog: pit: Hook up eventlog on pit.

BUG=chrome-os-partner:16132
TEST=Ran mosys eventlog list on pit. Used powerd to run mosys eventlog add on
pit. Ran mosys eventlog clear on pit.
BRANCH=pit

Change-Id: I9cf11c1313660ba80b9d9ad9d5a763ff74ef315c
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/65135
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Stefan Reinauer <reinauer@google.com>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
14 months agoAdd post code for resume failure 19/65319/2
Duncan Laurie [Fri, 9 Aug 2013 16:50:39 +0000 (09:50 -0700)]
Add post code for resume failure

This was recently added to coreboot to help identify the common case
where the firmware is flashed and the sytem is suspended and fails
to resume.  On intel this is due to the MRC cache being erased.

BUG=none
BRANCH=falco,peppy
TEST=manual:

1) boot falco
2) flash firmware
3) suspend and then resume
4) check for post code 0xef in log

0 | 2013-08-08 16:27:47 | Log area cleared | 4096
1 | 2013-08-08 16:27:47 | ACPI Enter | S3
2 | 2013-08-08 16:27:55 | System boot | 48
3 | 2013-08-08 16:27:55 | Last post code in previous boot | 0xef | Resume Failure
4 | 2013-08-08 16:27:55 | System Reset
5 | 2013-08-08 16:27:55 | ACPI Wake | S5

Change-Id: I1b6fb33000f1eec93f1093589b9b844280aaaa54
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/65319
Reviewed-by: David Hendricks <dhendrix@chromium.org>
14 months agospring: update board revision info for pre-PVT/PVT/MP 76/64676/2 stabilize-4512.B
Vincent Palatin [Fri, 7 Jun 2013 16:59:47 +0000 (09:59 -0700)]
spring: update board revision info for pre-PVT/PVT/MP

Including pre-PVT1 / PVT / MP in board revision IDs.

BRANCH=spring
BUG=chrome-os-partner:21666
TEST=on Spring EVT, run "mosys platform version" and
"mosys memory spd print id"

Change-Id: I217f7ef90fe1212bac499413e6928796d00c82c0
Reviewed-on: https://gerrit.chromium.org/gerrit/64676
Reviewed-by: Vic Yang <victoryang@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
14 months agoflashrom: use --fast-verify when writing a specific region 33/63433/2
David Hendricks [Tue, 23 Jul 2013 23:39:38 +0000 (16:39 -0700)]
flashrom: use --fast-verify when writing a specific region

This will make flashrom only verify the region we care about.

BUG=chrome-os-partner:16132
BRANCH=spring
TEST=ran "mosys eventlog clear" on spring

Change-Id: I120c692fcc9a34c8fd57a870ba4bec58b9766e15
Reviewed-on: https://gerrit.chromium.org/gerrit/63433
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Gabe Black <gabeblack@chromium.org>
14 months agoflashrom: don't specify an arg for -w when writing a region 32/63432/2
David Hendricks [Tue, 23 Jul 2013 21:23:35 +0000 (14:23 -0700)]
flashrom: don't specify an arg for -w when writing a region

This makes it so that the flashrom_write_by_name wrapper does not
specify /dev/null as the argument for -w when writing only to a
particular region.

This depends on https://gerrit.chromium.org/gerrit/#/c/60515/

BUG=chrome-os-partner:16132
BRANCH=spring
TEST=ran "mosys eventlog clear" on spring

Change-Id: I793d3ef04dbe20599e9b4f3982bc2e3d84c12fba
Reviewed-on: https://gerrit.chromium.org/gerrit/63432
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Gabe Black <gabeblack@chromium.org>
15 months agospring: Enable the "add" subcommand by installing a callback. 24/62724/5 factory-4455.B factory-pit-4471.B firmware-pit-4482.B
Gabe Black [Mon, 15 Jul 2013 06:43:25 +0000 (23:43 -0700)]
spring: Enable the "add" subcommand by installing a callback.

The callback is the function added in the previous CL.

BUG=chrome-os-partner:16132
TEST=Ran "mosys eventlog add" and then "mosys eventlog list" to and verified
that an event was added. Ran "mosys eventlog add" and "mosys eventlog list" in
a loop and verified that the events were added successfully, and that when the
log filled up enough that it was partially cleared successfully and that a
clear event was added.
BRANCH=spring

Change-Id: Iba3b26c8d3b0e24ab1bb64c65fa9ec2d24024709
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/62724
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>

15 months agoeventlog: Add a function to add events to the log manually. 23/62723/5
Gabe Black [Fri, 12 Jul 2013 11:58:01 +0000 (04:58 -0700)]
eventlog: Add a function to add events to the log manually.

This function reads the event log, figures out if it needs to be shrunk,
shrinks it if required, adds the new event, and then writes it back to the
flash.

BUG=chrome-os-partner:16132
TEST=Ran mosys eventlog add on spring with this callback enabled, then ran
mosys eventlog list and verified that the new event was there.
BRANCH=spring

Change-Id: I340a59997d7695265ef4132d887e1eb224569ced
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/62723
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>

15 months agoeventlog: Change the signature of the "add" callback and subcommand. 22/62722/5
Gabe Black [Fri, 12 Jul 2013 09:40:26 +0000 (02:40 -0700)]
eventlog: Change the signature of the "add" callback and subcommand.

The eventlog subcommand took a single, nebulus "event" parameter, and the
callback took the values argc and argv with no interpretation. Now, the
subcommand takes one or three parameters, first the type of the new event,
and then optionally the size and contents of the data parameter. The type and
size are both text representations of numeric values, and the data is treated
as a binary blob and pasted into the event directly.

BUG=chrome-os-partner:16132
TEST=Built for spring.
BRANCH=spring

Change-Id: I75b9fb4b6b3177273373df25a1293a337c738ab9
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/62722
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>

15 months agospring: Hook up the new writing and clearing event log callbacks on spring. 21/62721/5
Gabe Black [Thu, 11 Jul 2013 05:23:56 +0000 (22:23 -0700)]
spring: Hook up the new writing and clearing event log callbacks on spring.

BUG=chrome-os-partner:16132
TEST=Built for spring.
BRANCH=spring

Change-Id: I71aa20cd8335cc057c6f4357212a05e24c894245
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/62721
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>

15 months agoevent log: Implement a function to clear the log by writing out an empty one. 20/62720/5
Gabe Black [Thu, 11 Jul 2013 05:17:59 +0000 (22:17 -0700)]
event log: Implement a function to clear the log by writing out an empty one.

This is in contrast to, for instance, poking the kernel and having it deliver
an SMI to firmware to have the firmware clear the log for you.

BUG=chrome-os-partner:16132
TEST=Built for spring.
BRANCH=spring

Change-Id: I7900fa930b0c56c090ef9f5fcd56558d760a886f
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/62720
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>

15 months agoAdd a bin2bcd function to math.h. 62/63162/4
Gabe Black [Tue, 23 Jul 2013 22:16:51 +0000 (15:16 -0700)]
Add a bin2bcd function to math.h.

This function takes a binary value from 0 to 99 and returns a BCD
representation of it.

BUG=chrome-os-partner:16132
TEST=Built mosys for spring.
BRANCH=spring

Change-Id: Icd35ff0de37ab2de0be3cb1a8c691ba6154f9063
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/63162
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>

15 months agoelog: Implement a function to write the event log back to flash. 19/62719/2
Gabe Black [Thu, 11 Jul 2013 05:13:19 +0000 (22:13 -0700)]
elog: Implement a function to write the event log back to flash.

This function is similar to the fetching function and shares some code with
it. It relies heavily on callbacks provided by the platform object.

BUG=chrome-os-partner:16132
TEST=Built for spring.
BRANCH=spring

Change-Id: I5fc5a501f6006d7f75d92a172f82923f72b4fcef
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/62719
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
15 months agoeventlog: Eliminate the parameter for the eventlog clear command. 18/62718/2
Gabe Black [Fri, 12 Jul 2013 05:12:43 +0000 (22:12 -0700)]
eventlog: Eliminate the parameter for the eventlog clear command.

The callback had never been implemented, the "status" parameter was not
mentioned in the help text, and on x86 where the clear command could be passed
through to the firmware, the firmware ignores the percentage to clear and just
clears everything.

BUG=chrome-os-partner:16132
TEST=Built for spring.
BRANCH=spring

Change-Id: Icbd1dda59b4e02805ad99f22576216451389a28d
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/62718
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
15 months agoeventlog: Add a callback to write the eventlog to flash. 17/62717/2
Gabe Black [Thu, 11 Jul 2013 05:04:14 +0000 (22:04 -0700)]
eventlog: Add a callback to write the eventlog to flash.

This callback is very similar to the fetch callback, except that it doesn't
do anything with the header offset. Since it's writing back the whole event
log, the location of the header doesn't really matter.

BUG=chrome-os-partner:16132
TEST=Built for spring.
BRANCH=spring

Change-Id: I3689e3213d245439091a6d63a39adfecde1d84f9
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/62717
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
15 months agospring: Hook up a write_by_name function for the host firmware eeprom. 16/62716/2 stabilize-4443.B
Gabe Black [Thu, 11 Jul 2013 04:58:49 +0000 (21:58 -0700)]
spring: Hook up a write_by_name function for the host firmware eeprom.

We'll need to write back the event log region on the host firmware eeprom, so
we need a write_by_name implementation for spring.

BUG=chrome-os-partner:16132
TEST=Built for spring.
BRANCH=spring

Change-Id: I53d54c216a2ddaaaf79912c8c86e1fa0fc7691a1
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/62716
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
15 months agoeeprom: Add a write_by_name callback similar to the existing read_by_name. 15/62715/2
Gabe Black [Thu, 11 Jul 2013 04:28:26 +0000 (21:28 -0700)]
eeprom: Add a write_by_name callback similar to the existing read_by_name.

This is intended to be essentially the same as the read_by_name callback,
except that it writes instead of reads.

BUG=chrome-os-partner:16132
TEST=Built for spring.
BRANCH=spring

Change-Id: Ic2e4399747491c629c834e618f8b74838facd46d
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/62715
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
15 months agoflashrom: Add a function to write one region of flash with flashrom. 14/62714/2
Gabe Black [Thu, 11 Jul 2013 04:17:49 +0000 (21:17 -0700)]
flashrom: Add a function to write one region of flash with flashrom.

This is very similar to the reading function except that it writes.

BUG=chrome-os-partner:16132
TEST=Built for spring.
BRANCH=spring.

Change-Id: Id362689512e1258bb02d800a52ddd22f5f677714
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/62714
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
15 months agoflashrom: Fix the name of a function in a comment in flashrom.h. 13/62713/2
Gabe Black [Thu, 11 Jul 2013 04:13:18 +0000 (21:13 -0700)]
flashrom: Fix the name of a function in a comment in flashrom.h.

BUG=chrome-os-partner:16132
TEST=None
BRANCH=spring

Change-Id: I5ad22db4dc142720b651c1b4575afd47628133a0
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/62713
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
15 months agoUpdate verified boot recovery reason event log types 37/62837/3
Duncan Laurie [Mon, 22 Jul 2013 14:44:15 +0000 (07:44 -0700)]
Update verified boot recovery reason event log types

This was apparently reworked and several new recovery reasons
were defined that do not exist yet in mosys.

BUG=chrome-os-partner:21159
BRANCH=falco
TEST=from a device with bad ssd that would not boot reliably:

160 | 2013-07-22 07:10:55 | ACPI Wake | S5
161 | 2013-07-22 07:10:55 | Wake Source | Power Button | 0
162 | 2013-07-22 07:10:55 | Chrome OS Recovery Mode | No bootable kernel found on disk

Change-Id: I8d27c5a81e9d5d1db84ccdfb239be30d7d830270
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62837
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
15 months agoDo not consider positive ioctl() return values to be errors 07/62407/2
Vadim Bendebury [Wed, 17 Jul 2013 22:19:11 +0000 (15:19 -0700)]
Do not consider positive ioctl() return values to be errors

A recent fix in the cros_ec ioctl() implementation made it return a
positive value on success (the number of transferred bytes). mosys
considers any non-zero value to be an error. Let's fix it.

BUG=chrome-os-partner:21057
TEST=manual
  . crossystem when run with fixed mosys on pit does not report errors anymore

Change-Id: I14a95015462e746e10505bc860c2a6db56092a0e
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/62407
Reviewed-by: David Hendricks <dhendrix@chromium.org>
15 months agodaisy : Add spd information about x16 Memory 50/61550/4
Wonjoon Lee [Thu, 11 Jul 2013 11:52:41 +0000 (20:52 +0900)]
daisy : Add spd information about x16 Memory

Adding K4B4G1646B-HYK0 information

BUG=chrome-os-partner:20617
TEST=manual: Faked SPD index on Daisy check 2GB

localhost ~ # mosys memory spd print all
0 | DDR3 | SO-DIMM
0 | 1-78: Samsung | 00000000 | K4B4G1646B-HYK0
0 | 2048 | 1 | 64
0 | DDR3-800, DDR3-1066, DDR3-1333, DDR3-1600
localhost ~ # mosys memory spd dump 0
00000000  92 11 0b 03 04 19 02 02  03 00 01 08 0a 00 fe 00  |................|
00000010  69 78 68 00 00 00 00 00  00 00 00 00 00 00 00 00  |ixh.............|
00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000030  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000040  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000050  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000060  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000070  00 00 00 00 00 80 ce 00  00 00 00 00 00 00 00 00  |................|
00000080  4b 34 42 34 47 31 36 34  36 42 2d 48 59 4b 30 00  |K4B4G1646B-HYK0.|
00000090  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000000a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000000b0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000000c0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000000d0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000000e0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000000f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

Change-Id: I276b895b225e627a8d27b47a00f986a62abc8de7
Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/61550
Reviewed-by: David Hendricks <dhendrix@chromium.org>
15 months agoelog: Teach mosys about the new ARM/generic event types. 56/61856/2
Gabe Black [Thu, 13 Jun 2013 04:14:27 +0000 (21:14 -0700)]
elog: Teach mosys about the new ARM/generic event types.

Cherry-picked from the spring branch.

These sleep and wake events are separate from the existing ones which are tied
in with ACPI on x86.

BUG=chrome-os-partner:16132
TEST=Suspended and resumed on spring so that a wake event was recorded in the
log. Ran mosys eventlog list and verified that the event was displayed
properly.
BRANCH=spring

Change-Id: I63d5fcce1abcbc14fbbd9b63384d8e1710c57265
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/61856
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
15 months agoUpdate peach_pit platform name to pit 55/61455/2 factory-pit-4390.B firmware-falco_peppy-4389.B firmware-leon-4389.26.B firmware-wolf-4389.24.B
Katie Roberts-Hoffman [Wed, 10 Jul 2013 20:24:48 +0000 (13:24 -0700)]
Update peach_pit platform name to pit

Other platforms, like snow or spring, have a platform name
that is just the variant name. Updating peach_pit to be called
pit so scripts like chromeos-firmwareupdate correctly identify
the platform.

BUG=None
TEST=Run mosys and verify new name change

Change-Id: Ifc0cf8b34243cf7ffe2aca30084bc4bf55bfb1c2
Reviewed-on: https://gerrit.chromium.org/gerrit/61455
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Commit-Queue: Katie Roberts-Hoffman <katierh@chromium.org>
Tested-by: Katie Roberts-Hoffman <katierh@chromium.org>
15 months agoPeppy: Fix handling of 2GB config 89/60789/2
Gediminas Ramanauskas [Tue, 2 Jul 2013 18:16:17 +0000 (11:16 -0700)]
Peppy: Fix handling of 2GB config

Use the most significant bit of spd index to determine dimm count.

BUG=chrome-os-partner:20663
BRANCH=none
TEST=none: need to wait for the new hardware.

Change-Id: I71bb9fc9bc6d416a58fe6114e1f5f86b5d877d0b
Reviewed-on: https://gerrit.chromium.org/gerrit/60789
Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Commit-Queue: Gediminas Ramanauskas <gedis@chromium.org>
Tested-by: Gediminas Ramanauskas <gedis@chromium.org>
16 months agoadd "-s" and "-S" back into help menu 43/60543/2
David Hendricks [Fri, 28 Jun 2013 22:44:28 +0000 (15:44 -0700)]
add "-s" and "-S" back into help menu

Commit bded98 seems to have clobbered some previous changes that had
been made to the help menu.

Since this is a formatting flag, I also moved it up next to the
descriptions for -k and -l so hppefully it's a bit easier for users
to find.

BUG=none
BRANCH=none
TEST=run mosys -h, see that -s and -S both show up

Change-Id: Iaefb82c351693c792f654d4e8ccadfb5a7c047b9
Reviewed-on: https://gerrit.chromium.org/gerrit/60543
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
16 months agofalco: Fix handling of 2GB config 17/60317/2
Duncan Laurie [Fri, 28 Jun 2013 04:06:12 +0000 (21:06 -0700)]
falco: Fix handling of 2GB config

Use the spd index to determine whether there is one or two
channels of memory populated.

BUG=chrome-os-partner:20268
BRANCH=none
TEST=manual: Faked SPD index on Falco to check 2GB vs 4GB

2GB:
localhost ~ # mosys -k memory spd print geometry
dimm="0" size_mb="2048" ranks="1" width="64"

4GB:
localhost ~ # mosys -k memory spd print geometry
dimm="0" size_mb="2048" ranks="1" width="64"
dimm="1" size_mb="2048" ranks="1" width="64"

Change-Id: I45c2dd1b86e1682a12f878c0f235315c34e97f36
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/60317
Reviewed-by: David Hendricks <dhendrix@chromium.org>
16 months agopeach_pit: close EC file destriptor when destroying the platform intf 23/59523/2
David Hendricks [Fri, 21 Jun 2013 05:05:34 +0000 (22:05 -0700)]
peach_pit: close EC file destriptor when destroying the platform intf

This will close the cros_ec device node properly before mosys
exits to hopefully prevent weird issues.

BUG=none
BRANCH=peach_pit
TEST=tested on pit

Change-Id: I8cfd9da014dc6550d78db3a3aa70a64c1380412c
Reviewed-on: https://gerrit.chromium.org/gerrit/59523
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
16 months agogec_dev: add destroy callback to close cros_ec file descriptor 22/59522/2
David Hendricks [Fri, 21 Jun 2013 05:04:41 +0000 (22:04 -0700)]
gec_dev: add destroy callback to close cros_ec file descriptor

BUG=none
BRANCH=peach_pit
TEST=tested on pit in follow-up CL

Change-Id: I384065feac474b0c16263e4e431d4373aa7fb999
Reviewed-on: https://gerrit.chromium.org/gerrit/59522
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
16 months agoadd ec setup/destroy callbacks to ec_cb 21/59521/2
David Hendricks [Fri, 21 Jun 2013 04:59:37 +0000 (21:59 -0700)]
add ec setup/destroy callbacks to ec_cb

Add function pointers to setup/destroy EC callbacks. This can be
used to set up BARs and open/close files.

BUG=none
BRANCH=peach_pit
TEST=tested on pit in follow-up CL

Change-Id: I0bf6efe2abada3af5fe8ae33e49a8cb75441b32b
Reviewed-on: https://gerrit.chromium.org/gerrit/59521
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
16 months agogec_lpc: Add support for versioned host command args 72/59072/2
Duncan Laurie [Tue, 18 Jun 2013 16:34:15 +0000 (09:34 -0700)]
gec_lpc: Add support for versioned host command args

The EC used on haswell boards no longer supports the "old-style"
unversioned commands.

This also works on link, and in theory none of the shipping systems
need the old-style interface but I don't want to break any potential
factory or custom setups.

BUG=chrome-os-partner:20037
BRANCH=none
TEST=manual: tested on falco and link

LINK: mosys -l ec info
vendor               | ti
name                 | lm4fs1gh5bb
fw_version           | link_v1.2.120-1137a99

FALCO: mosys -l ec info
vendor               | ti
name                 | Unknown-10de
fw_version           | falco_v1.1.998-7402388

(note: the Unknown string comes from the EC and not mosys)

Change-Id: Ib7fa49a6f7426b24874148dcf7b02985dc840321
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/59072
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
16 months agoslippy: Add second NVRAM bank and define some fields 53/58253/2 factory-pit-4280.B stabilize-4287.B
Duncan Laurie [Tue, 11 Jun 2013 23:05:23 +0000 (16:05 -0700)]
slippy: Add second NVRAM bank and define some fields

We don't use a lot of CMOS but it is useful for me
to have quick access to some of the debug data that
is stored in there.

BUG=chrome-os-partner:19980
BRANCH=none
TEST=manual: tested on falco

> mosys nvram dump
LPSS0 CMOS Bank 0 (128 bytes)
00000000  31 27 04 23 23 22 90 11  06 13 26 02 50 80 00 00  |1'.##"....&.P...|
00000010  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000030  00 00 00 00 70 00 00 00  00 00 00 00 00 00 00 00  |....p...........|
00000040  00 00 00 20 00 00 00 00  00 00 00 00 00 00 00 00  |... ............|
00000050  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000060  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000070  80 f8 fd 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

LPSS1 CMOS Bank 1 (128 bytes)
00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000010  42 43 05 00 00 00 b8 bc  ff ff ff ff ff ff ff ff  |BC..............|
00000020  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000030  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000040  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000050  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000060  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000070  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|

> mosys nvram list
LPSS0 | Post Code Bank | 0x80
LPSS0 | Post Code Bank 0 | 0xf8
LPSS0 | Post Code Bank 1 | 0xfd
LPSS0 | Post Extra Bank 0 | 0x0
LPSS0 | Post Extra Bank 1 | 0x0
LPSS1 | Boot Count | 0x5

Change-Id: I852c82ccda743c2e219a6c28b9a529be459c77e8
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/58253
Reviewed-by: David Hendricks <dhendrix@chromium.org>
16 months agoelog: Add new events 52/58252/2
Duncan Laurie [Tue, 11 Jun 2013 23:02:30 +0000 (16:02 -0700)]
elog: Add new events

Coreboot was recently extended to keep track of some extra
device info in CMOS similar to how it handles post codes.
Currently this consists of the device path of the device
that coreboot is about to initialize.

This is encapsualted in a new event type that mosys can
decode.

Also, the "EC Shutdown" event type was added in a previous
platform but was never added to mosys.

BUG=chrome-os-partner:19980
BRANCH=none
TEST=manual: interrupted boot with reset button and
gathered the eventlog.  Mosys has been extended to
decode the well-known POST codes:

26 | 2013-06-10 10:32:48 | System boot | 120
27 | 2013-06-10 10:32:48 | Last post code in previous boot | 0x75 | Device Initialize
28 | 2013-06-10 10:32:48 | Extra info from previous boot | PCI | 00:16.0
29 | 2013-06-10 10:32:48 | Reset Button
30 | 2013-06-10 10:32:48 | System Reset

Change-Id: I08f4971b2ced78b56b560b4f2174a99f854000bf
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/58252
Reviewed-by: David Hendricks <dhendrix@chromium.org>
16 months agopeach_pit: enable EC support using devfs interface 26/57426/4 stabilize-4255.B
David Hendricks [Tue, 4 Jun 2013 03:53:56 +0000 (20:53 -0700)]
peach_pit: enable EC support using devfs interface

This enables EC support for peach_pit now that the devfs interface
is working.

BUG=chrome-os-partner:19077
BRANCH=peach_pit
TEST=compiled and run on peach_pit (see below for output)

localhost ~ # mosys -k ec info
vendor="stm" name="stm32l15x" fw_version="pit_v1.1.880-7e24fdb"

Change-Id: I7a94bcdebc067d7a331ae9feef32804f78cdb5fc
Reviewed-on: https://gerrit.chromium.org/gerrit/57426
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>

16 months agoadd devfs driver for CrOS EC 25/57425/3
David Hendricks [Tue, 4 Jun 2013 03:37:29 +0000 (20:37 -0700)]
add devfs driver for CrOS EC

This adds a driver for use with the new CrOS EC devfs interface.

BUG=chrome-os-partner:19077
BRANCH=peach_pit
TEST=compiled and run using follow-up peach_pit patch

Change-Id: Ic973de4ffa0b1a8045c0300db107a85435f26b4c
Reviewed-on: https://gerrit.chromium.org/gerrit/57425
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>

16 months agospring: update board revision info for DVT2 43/57943/3
Vincent Palatin [Fri, 7 Jun 2013 16:59:47 +0000 (09:59 -0700)]
spring: update board revision info for DVT2

Including DVT2 in board revision IDs.

The board revision read from the GPIOs is encoded in ternary
(Z=0, LO=1, HI=2), so use the same encoding in the software and
re-order the id map to follow that ternary order.

BRANCH=spring
BUG=chrome-os-partner:19926
TEST=on Spring EVT, run "mosys platform version" and
"mosys memory spd print id"

Change-Id: Ie65362af85f0ef0623c7916cb5853276a25366d4
Reviewed-on: https://gerrit.chromium.org/gerrit/57943
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
16 months agoslippy: Also support falco and peppy 42/56942/2
Duncan Laurie [Tue, 28 May 2013 16:19:40 +0000 (09:19 -0700)]
slippy: Also support falco and peppy

These are similar enough that it is easier to handle this way
rather than making 3 copies of the code.

The boards can be separated later if needed.

BUG=chrome-os-partner:19035
BRANCH=none
TEST=manual: emerge-slippy mosys && mosys platform name

Change-Id: I664fb9dc11af76fb71726da220432c2bafcdb8b4
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/56942
Reviewed-by: David Hendricks <dhendrix@chromium.org>
17 months agodaisy: make failure to query EC during platform setup fatal 95/51395/2
David Hendricks [Thu, 16 May 2013 00:58:00 +0000 (17:58 -0700)]
daisy: make failure to query EC during platform setup fatal

On second thought, it's probably best to err out instead of
potentially misidentifying the platform if querying the EC fails.
At least that would be more consistent with the previous
behavior of crashing.

BUG=chromium:240463
BRANCH=none
TEST=run on Snow

Change-Id: Id87668c595b0c01504369ea62efebbb498dc34d9
Reviewed-on: https://gerrit.chromium.org/gerrit/51395
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
17 months agoeventlog: Add power button wake source 59/56059/2
Duncan Laurie [Tue, 21 May 2013 17:22:46 +0000 (10:22 -0700)]
eventlog: Add power button wake source

This was added to coreboot for haswell systems and should
be reflected in mosys.

BUG=none
BRANCH=none
TEST=manual: mosys eventlog list

11 | 2013-05-21 10:10:26 | System boot | 22
12 | 2013-05-21 10:10:26 | EC Event | Lid Open
13 | 2013-05-21 10:10:26 | ACPI Wake | S5
14 | 2013-05-21 10:10:26 | Wake Source | Power Button | 0
15 | 2013-05-21 10:10:27 | Chrome OS Developer Mode

Change-Id: If14547cbe9bcb3fb3396007baa885a58c406a90f
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/56059
Reviewed-by: David Hendricks <dhendrix@chromium.org>
17 months agoAdd slippy to list of platforms. 58/56058/2
Duncan Laurie [Tue, 21 May 2013 17:17:46 +0000 (10:17 -0700)]
Add slippy to list of platforms.

BUG=none
BRANCH=none
TEST=manual: run mosys on slippy

Change-Id: Iba59b2a1164e7b7845f2b335bf2661a1b8c120dd
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/56058
Reviewed-by: David Hendricks <dhendrix@chromium.org>
17 months agoexynos5 -> exynos5250 48/51548/3
David Hendricks [Fri, 17 May 2013 03:13:20 +0000 (20:13 -0700)]
exynos5 -> exynos5250

As it turns out, different SoCs in the exynos5 family can be
significantly different. This just renames everything having
to do with exynos5 to exynos5250 since it's not as generic
as originally thought.

BUG=none
BRANCH=none
TEST=tested 'mosys gpio list' on Snow and Spring (exynos5250)

Change-Id: If4dab55f99f0969971f00d2fc164a82fc7490906
Reviewed-on: https://gerrit.chromium.org/gerrit/51548
Tested-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>

17 months agoinitial peach_pit support 47/51547/3
David Hendricks [Wed, 15 May 2013 00:46:13 +0000 (17:46 -0700)]
initial peach_pit support

This adds initial support for peach_pit.

TODO: Still need to sort out EC support.

BUG=chrome-os-partner:19077
BRANCH=none
TEST=ran thru commands on peach_pit

Change-Id: I84a19f1561e3966a13f62b77ecfb55e7b042d915
Reviewed-on: https://gerrit.chromium.org/gerrit/51547
Tested-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>

17 months agoinitial exynos5420 support 46/51546/3
David Hendricks [Fri, 17 May 2013 01:44:22 +0000 (18:44 -0700)]
initial exynos5420 support

This adds some basic framework Exynos5420. It's like Exynos5250,
but different.

For now the only exynos5420-specific stuff we're worried about is
the GPIOs. The logic for manipulating GPIOs is the same as the
exynos5250, but register mapping changed.

BUG=none
BRANCH=none
TEST=tested on peach_pit using follow-up CL

Change-Id: I27e12c804ab393a7835a0f1ca4e96987b9d94ea9
Reviewed-on: https://gerrit.chromium.org/gerrit/51546
Tested-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>

17 months agoexynos5: re-factor GPIO interface parameters 06/55606/2
David Hendricks [Sat, 18 May 2013 00:19:02 +0000 (17:19 -0700)]
exynos5: re-factor GPIO interface parameters

This re-factors the Exynos5 GPIO interface to take a pointer to
banks of GPIO registers rather than an enum specifying the generation.
This allows us to eliminate the get_banks() helper function which
itself has a dependency on SoC-specific GPIO code (the listing of
GPIO banks for each SoC).

BUG=none
BRANCH=none
TEST=tested on snow and spring

Change-Id: Ice6d3940122a176e8cf9d72371757ef5ca890201
Reviewed-on: https://gerrit.chromium.org/gerrit/55606
Tested-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>

17 months agoexynos5: fix bug where EXYNOS5 was hardcoded 45/51545/2
David Hendricks [Fri, 17 May 2013 01:47:48 +0000 (18:47 -0700)]
exynos5: fix bug where EXYNOS5 was hardcoded

This fixes an instance where EXYNOS5 was hardcoded instead of using
the generation passed in by the user.

BUG=none
BRANCH=none
TEST=tested on peach_pit and snow

Change-Id: If5f6ffdf0329c445b60e6ff6bee90c43cae8d16e
Reviewed-on: https://gerrit.chromium.org/gerrit/51545
Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
17 months agospring: revise DRAM representation 90/50890/5
David Hendricks [Fri, 10 May 2013 21:26:59 +0000 (14:26 -0700)]
spring: revise DRAM representation

Spring uses two channels, each with 2 512MByte chips with 16 data
lines to each chip.

This patch makes the representation provided by mosys somewhat more
consistent with how the hardware is actually laid out. The chips on
each channel will be represented as a logical DIMM, with a single
bus (16-bits x 2 = 32) and size (512MByte * 2 = 1GByte).

BUG=chrome-os-partner:18934
BRANCH=spring
TEST=manually tested on Spring by forcing each fake SPD to be used.

Example "mosys -k memory spd print geometry" output:
dimm="0" size_mb="1024" ranks="1" width="32"
dimm="1" size_mb="1024" ranks="1" width="32"

Change-Id: I7678b5335ac66aba2cb9f8ee5b953cb196a001a1
Reviewed-on: https://gerrit.chromium.org/gerrit/50890
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
17 months agodaisy: extra paranoia when probing EC chip ID 36/51036/3
David Hendricks [Mon, 13 May 2013 22:00:12 +0000 (15:00 -0700)]
daisy: extra paranoia when probing EC chip ID

This adds extra paranoia when the EC chip ID is queried as part of
the platform setup to mitigate the possibility of passing NULL into
strncmp().

BUG=chromium:240463
BRANCH=none
TEST=run on Snow

Change-Id: If6f59a1c3b10e9e8488826faa673cb1a999e1873
Reviewed-on: https://gerrit.chromium.org/gerrit/51036
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
17 months agoHACK: fix mosys dram from 4G to 2G 03/49203/2 factory-4128.B
Cheng-Yi Chiang [Thu, 25 Apr 2013 08:37:45 +0000 (16:37 +0800)]
HACK: fix mosys dram from 4G to 2G

BRANCH=spring
BUG=chrome-os-partner:18934
TEST=run hwid test

Change-Id: Ica7b8662eec364032909bbe6bdae22830086a030
Reviewed-on: https://gerrit.chromium.org/gerrit/49160
Reviewed-by: Rong Chang <rongchang@chromium.org>
Tested-by: Rong Chang <rongchang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/49203
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
17 months agoAdd experimental slippy platform. 92/50692/3
Duncan Laurie [Thu, 9 May 2013 19:34:11 +0000 (12:34 -0700)]
Add experimental slippy platform.

BUG=chrome-os-partner:19344
BRANCH=none
TEST=emerge-slippy mosys

Change-Id: I1a7cf4ed01b0bde4bf1cd3d1a18c106cba26636b
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50692
Reviewed-by: David Hendricks <dhendrix@chromium.org>
17 months agoAdd driver for lynxpoint_lp chipset. 91/50691/2
Duncan Laurie [Thu, 9 May 2013 19:32:46 +0000 (12:32 -0700)]
Add driver for lynxpoint_lp chipset.

This is the actual driver for the LynxPoint-LP chipset
which makes use of the generic LPSS functions.

No existing platforms make use of it.

BUG=chrome-os-partner:19344
BRANCH=none
TEST=emerge-slippy mosys

Change-Id: I58308a00e466201cac364a1aea0a734ed6b128c2
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50691
Reviewed-by: David Hendricks <dhendrix@chromium.org>
17 months agoAdd generic functions for LPSS chipsets. 90/50690/2
Duncan Laurie [Thu, 9 May 2013 19:30:53 +0000 (12:30 -0700)]
Add generic functions for LPSS chipsets.

New "Low Power Subsystem" chipsets have different interface
to GPIOs and the BBS field in the GCS register have changed.

Define new generic functions for dealing with this type of
chipset.  These are not used by anything yet.

BUG=chrome-os-partner:19344
BRANCH=none
TEST=emerge-slippy mosys

Change-Id: I2ba55b769a84cb077b49ac461b5c38f18b0df3df
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50690
Reviewed-by: David Hendricks <dhendrix@chromium.org>
17 months agoFix compile warnings 89/50689/2
Duncan Laurie [Thu, 9 May 2013 19:18:23 +0000 (12:18 -0700)]
Fix compile warnings

- zgb/nvram.c: ifdef out the cmos_write function since the function
that calls it is also ifdef'd out
- battery.c: Fix command argument definition

BUG=chrome-os-partner:19344
BRANCH=none
TEST=emerge-slippy mosys (and check for warnings)

Change-Id: I3b68a4804ab0b03e411705e7f20a349910e22ec0
Signed-off-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50689
Reviewed-by: David Hendricks <dhendrix@chromium.org>
17 months agoelog: use platform's region attributes to find elog 23/50023/7
David Hendricks [Fri, 3 May 2013 05:11:00 +0000 (22:11 -0700)]
elog: use platform's region attributes to find elog

This uses the platform's pre-defined region attributes to find
the region using the fmap. The advantage to this approach is that
the eventlog region's name can be specified on a per-platform basis.

BUG=chrome-os-partner:16132
BRANCH=spring
TEST=Used to read the event log on spring with other dependent changes.

Change-Id: I810d5e4e14634cfb140f37849997ed4b4f34ddcb
Reviewed-on: https://gerrit.chromium.org/gerrit/50023
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Gabe Black <gabeblack@chromium.org>
17 months agospring: enable eeprom->device->read_by_name() 27/50427/3
David Hendricks [Wed, 8 May 2013 03:38:10 +0000 (20:38 -0700)]
spring: enable eeprom->device->read_by_name()

This adds a wrapper around flashrom_read_by_name() that callers can
use. Its main purpose is to tell flashrom which bus to use.

BUG=chrome-os-partner:16132
BRANCH=spring
TEST=ran "mosys eventlog list" on Spring with two firmware images,
one with actual eventlog and one without.

Change-Id: I858b85aff784c383c2e39f1074a04a484569871e
Reviewed-on: https://gerrit.chromium.org/gerrit/50427
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Gabe Black <gabeblack@chromium.org>
17 months agoflashrom: add flashrom_read_by_name() 26/50426/3
David Hendricks [Wed, 8 May 2013 03:36:45 +0000 (20:36 -0700)]
flashrom: add flashrom_read_by_name()

This implements the underlying method which will be used to read
specified regions by name.

BUG=chrome-os-partner:16132
BRANCH=spring
TEST=ran "mosys eventlog list" on Spring with two firmware images,
one with actual eventlog and one without.

Change-Id: If4cc5a447cab94241ace4ec702baf96586e4b371
Reviewed-on: https://gerrit.chromium.org/gerrit/50426
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Gabe Black <gabeblack@chromium.org>
17 months agoeeprom: add read_by_name() device method 25/50425/2
David Hendricks [Wed, 8 May 2013 03:31:53 +0000 (20:31 -0700)]
eeprom: add read_by_name() device method

This adds a method to the eeprom device struct which will allow the
caller to specify a named region (in an fmap, for example) to read.
The implementation will find the region and allocate + fill memory.

BUG=chrome-os-partner:16132
BRANCH=spring
TEST=ran "mosys eventlog list" on Spring with two firmware images,
one with actual eventlog and one without.

Change-Id: I58937cd7fcf173dcd563ae69a352980506d5b042
Reviewed-on: https://gerrit.chromium.org/gerrit/50425
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Gabe Black <gabeblack@chromium.org>
17 months agoflashrom: return -1 if flashrom exit code != 0 24/50424/2
David Hendricks [Wed, 8 May 2013 03:54:16 +0000 (20:54 -0700)]
flashrom: return -1 if flashrom exit code != 0

flashrom exits with 1 in case of failure, while system() returns
-1 if it failed to actually run the command. So we should really
test if the returned value is != 0.

BUG=none
BRANCH=none
TEST=used flashrom wrapper with an invalid region specified

Change-Id: I1e2ae965acd81acfd7611c298d885319dddfbf33
Reviewed-on: https://gerrit.chromium.org/gerrit/50424
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Gabe Black <gabeblack@chromium.org>
17 months agoelog: add a missing return statement 71/50371/2
David Hendricks [Tue, 7 May 2013 22:25:02 +0000 (15:25 -0700)]
elog: add a missing return statement

This just adds a missing "return -1" in case the fmap area is not
found.

BUG=none
BRANCH=spring
TEST=tested on a machine without an eventlog

Change-Id: If64fee56886fbf6296d6829b53a3846e939fae1a
Reviewed-on: https://gerrit.chromium.org/gerrit/50371
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
17 months agospring: add eventlog region information 22/50022/3
David Hendricks [Fri, 3 May 2013 05:03:01 +0000 (22:03 -0700)]
spring: add eventlog region information

This adds eventlog region information for Spring and also sets the
EEPROM_FLAG_FMAP to let the elog library know how to find it.

BUG=chrome-os-partner:16132
BRANCH=spring
TEST=Used this information in a later change (also by dhendrix) to read the
event log on spring.

Change-Id: Ic08d442c173de4b64d0276b9025976de8bc9c5f0
Reviewed-on: https://gerrit.chromium.org/gerrit/50022
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>

17 months agoeeprom: add eeprom_region struct 21/50021/4
David Hendricks [Fri, 3 May 2013 04:48:53 +0000 (21:48 -0700)]
eeprom: add eeprom_region struct

This adds a struct which can be used to specify region information
known to exist on a particular platform. It will be used for
programatically finding regions of a given type.

BUG=chrome-os-partner:16132
BRANCH=spring
TEST=Used this structure members in a later change (also by dhendrix) to read
the event log on spring.

Change-Id: Iff098b739f5a4ec822a199db77a4a27fac0eb35d
Reviewed-on: https://gerrit.chromium.org/gerrit/50021
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>

17 months agospring: Enable the eventlog commands. 68/49868/5
Gabe Black [Tue, 23 Apr 2013 10:31:32 +0000 (03:31 -0700)]
spring: Enable the eventlog commands.

This change enables the generic eventlog commands for spring.

BUG=chrome-os-partner:16132
TEST=With this and other changes, ran mosys eventlog list and mosys smbios
info log on spring. On link, ran mosys eventlog list. Built for parrot, stout,
and butterfly.
BRANCH=spring

Change-Id: I83ca4b35064ac1044d589ee573029e14609d13e9
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/49868
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>

17 months agoelog: Add a fetch method which doesn't use SMBIOS. 67/49867/4
Gabe Black [Thu, 2 May 2013 04:49:06 +0000 (21:49 -0700)]
elog: Add a fetch method which doesn't use SMBIOS.

On ARM, there aren't any SMBIOS tables to use to find the event log. Instead,
we look in the flash at a particular region as defined by FMAP. This change
adds a function which implements that mechanism.

This implementation isn't particularly efficient since it reads the entire ROM
more than once, but it's necessary to ensure things work correctly with the
current internal API. Flashrom itself would support a more efficient
implementation which read the right section directly and handled the memory
allocation itself. The calling code wouldn't have to know ahead of time how
much data it was expecting to get.

BUG=chrome-os-partner:16132
TEST=With this and other changes, ran mosys eventlog list and mosys smbios
info log on spring. On link, ran mosys eventlog list. Built for parrot, stout,
and butterfly.
BRANCH=spring

Change-Id: I23be843cd501b83db9e5be059c03746e03457fd4
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/49867
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>

17 months agoelog: Parameterize where the event log comes from. 66/49866/4
Gabe Black [Wed, 1 May 2013 11:06:34 +0000 (04:06 -0700)]
elog: Parameterize where the event log comes from.

You might be able to find the event log through the SMBIOS tables, but you
might find it another way, for instance looking for a specific area of the
flash.

BUG=chrome-os-partner:16132
TEST=With this and other changes, ran mosys eventlog list and mosys smbios
info log on spring. On link, ran mosys eventlog list. Built for parrot, stout,
and butterfly.
BRANCH=spring

Change-Id: I152930402a32c276228a07a1270235ae3487f576
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/49866
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>

17 months agoelog: Explicitly include mosys/platform.h in intf/mmio.h. 65/49865/4
Gabe Black [Wed, 1 May 2013 11:01:20 +0000 (04:01 -0700)]
elog: Explicitly include mosys/platform.h in intf/mmio.h.

The inline functions in intf/mmio.h actually dereference the intf parameter
they take, so there has to be an actual definition for that type, not just a
declaration that it exists.

BUG=chrome-os-partner:16132
TEST=With this and other changes, ran mosys eventlog list and mosys smbios
info log on spring. On link, ran mosys eventlog list. Built for parrot, stout,
and butterfly.
BRANCH=spring

Change-Id: Ibccc18a1035f25eeb893f389fab08c8d33278743
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/49865
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
17 months agoeeprom: add EEPROM_EVENTLOG type and flag 20/50020/3
David Hendricks [Fri, 3 May 2013 04:52:05 +0000 (21:52 -0700)]
eeprom: add EEPROM_EVENTLOG type and flag

This allows us to identify which EEPROMs in a system are expected to
have an eventlog.

BUG=chrome-os-partner:16132
BRANCH=spring
TEST=Used these structure members in a later change (also by dhendrix) to read
the event log on spring.

Change-Id: Ia5c71259841650571050ca9ac0fca85c431542d6
Reviewed-on: https://gerrit.chromium.org/gerrit/50020
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
17 months agoelog: Don't verify the SMBIOS event log table in smbios_eventlog_foreach_event. 64/49864/4
Gabe Black [Wed, 1 May 2013 10:31:28 +0000 (03:31 -0700)]
elog: Don't verify the SMBIOS event log table in smbios_eventlog_foreach_event.

When iterating over the events in the event log, there won't necessarily be an
SMBIOS table to verify, for instance on ARM. That will have to happen in
whatever code finds the event log through the SMBIOS tables.

BUG=chrome-os-partner:16132
TEST=With this and other changes, ran mosys eventlog list and mosys smbios
info log on spring. On link, ran mosys eventlog list. Built for parrot, stout,
and butterfly.
BRANCH=spring

Change-Id: Ibfbd96ed20a2f0c2fc5b18229138c0f8a4900004
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/49864
Reviewed-by: Gabe Black <gabeblack@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
17 months agoelog: Collapse the eventlog info command into the smbios log command. 63/49863/4
Gabe Black [Wed, 1 May 2013 08:25:46 +0000 (01:25 -0700)]
elog: Collapse the eventlog info command into the smbios log command.

The eventlog info command is essentially the same as the smbios log command.
Unlike the other subcommands of eventlog, info depends on their being an
SMBIOS table pointing to the event log, and it prints info about the table
rather than the log itself. To get rid of the dependence on SMBIOS, the job of
eventlog info has been delegated to smbios log.

BUG=chrome-os-partner:16132
TEST=With this and other changes, ran mosys eventlog list and mosys smbios
info log on spring. On link, ran mosys eventlog list. Built for parrot, stout,
and butterfly.
BRANCH=spring

Change-Id: I74937b4b24fde890a02d1fca10529e1b34596dfd
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/49863
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
17 months agoelog: Separate the eventlog code from the SMBIOS code. 62/49862/3
Gabe Black [Wed, 1 May 2013 07:05:50 +0000 (00:05 -0700)]
elog: Separate the eventlog code from the SMBIOS code.

The eventlog data structures originally came from SMBIOS, but it can be used
on its own. The SMBIOS code doesn't call into it so they can be cleanly
separated.

This change doesn't modify any of the code itself, it just moves it to a
different location.

BUG=chrome-os-partner:16132
TEST=With this and other changes, ran mosys eventlog list and mosys smbios
info log on spring. On link, ran mosys eventlog list. Built for parrot, stout,
and butterfly.
BRANCH=spring

Change-Id: I687a8dc1345b35f13521349dd4c1393b39196bef
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/49862
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
18 months agoi2c: Open i2c bus in force mode 60/49660/2
Doug Anderson [Tue, 30 Apr 2013 21:39:43 +0000 (14:39 -0700)]
i2c: Open i2c bus in force mode

We're removing the special i2c 'pass through' bus on snow which means
that we'll now find the EC on its normal bus.  Linux will consider the
device "busy" on this bus.  Tell Linux that we know by opening the bus
in force mode.  This may not be ideal but isn't any different than
what we were doing before by using the pass through bus.

See a similar change for flashrom:
  https://gerrit.chromium.org/gerrit/#/c/49549/

BUG=chrome-os-partner:18941
BRANCH=snow
TEST=On snow with kernel-next and UPSTREAM cros-ec can run
  mosys -l ec info
...and see something like:
  vendor               | stm
  name                 | stm32f100
  fw_version           | snow_v1.3.139-375eb9f

Change-Id: Iaf3341396903b9fd0966120f106b139fcd597ea1
Reviewed-on: https://gerrit.chromium.org/gerrit/49660
Tested-by: Doug Anderson <dianders@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Commit-Queue: Doug Anderson <dianders@chromium.org>

18 months agoButterfly / Stout: Change the return code of 'mosys storage set phy_speed'. 56/47556/5 stabilize-4008.0.B stabilize-4035.0.B stabilize-4068.0.B
bowgotsai [Mon, 8 Apr 2013 10:40:59 +0000 (18:40 +0800)]
Butterfly / Stout: Change the return code of 'mosys storage set phy_speed'.

'mosys storage set phy_speed' is used for SanDisk-U100 PHY tuning.
We add it into factory test but it shows failure for non-SanDisk-U100 SSDs.
Fix the failure by changing the default return code to 0.

TEST=Manual.
     1. "mosys storage set phy_speed SATA3 -vvv" commands on Butterfly.
     2. "echo $?", it should show 0.
BUG=chrome-os-partner:18647
BRANCH=butterfly, stout.

Change-Id: I62f0ab8cd2f18be1de9bd6e52150d06651b8a6a6
Reviewed-on: https://gerrit.chromium.org/gerrit/47556
Tested-by: Bowgo Tsai <bowgotsai@chromium.org>
Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Commit-Queue: Bowgo Tsai <bowgotsai@chromium.org>

18 months agoButterfly: Add alternate SSD model ID. 71/47571/3
Shawn Nematbakhsh [Mon, 8 Apr 2013 18:28:42 +0000 (11:28 -0700)]
Butterfly: Add alternate SSD model ID.

Butterfly U100 SSDs have an alternate model ID due to custom firmware.
Properly identify such devices as U100s.

BUG=chrome-os-partner:18647
TEST=manual. Verify PHY programming of Butterfly SSDs is successful.
BRANCH=butterfly.

Change-Id: Ia7f9088b544611871969826421562ad1934905a7
Reviewed-on: https://gerrit.chromium.org/gerrit/47571
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Tested-by: Shawn Nematbakhsh <shawnn@chromium.org>
Commit-Queue: Bowgo Tsai <bowgotsai@chromium.org>

18 months agospd: add DDR3-1866 and DDR3-2133 to speed LUT 76/47276/3
David Hendricks [Wed, 3 Apr 2013 21:10:19 +0000 (14:10 -0700)]
spd: add DDR3-1866 and DDR3-2133 to speed LUT

This adds support for printing speed info for new 933MHz/1067MHz
modules.

BUG=none
BRANCH=none
TEST=locally compiled, but not tested on real hardware

Change-Id: I8a6d21109463dd9aab237889c83ccaf58d8df237
Reviewed-on: https://gerrit.chromium.org/gerrit/47276
Tested-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>

18 months agospring: add fake SPD data 75/47275/3
David Hendricks [Wed, 3 Apr 2013 21:05:38 +0000 (14:05 -0700)]
spring: add fake SPD data

This adds fake SPD data for the modules which meet Spring's spec.

BRANCH=spring
BUG=chrome-os-partner:17814
TEST=tested on Spring (by forcing usage of a given module)

Change-Id: Iec6933b4655563317589e1584dfc68efbdbdb651
Reviewed-on: https://gerrit.chromium.org/gerrit/47275
Tested-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>

18 months agoButterfly / Stout: Add support for SanDisk U100 SSD storage device. 70/47070/5
Shawn Nematbakhsh [Mon, 1 Apr 2013 23:22:54 +0000 (16:22 -0700)]
Butterfly / Stout: Add support for SanDisk U100 SSD storage device.

Add support for model probe and PHY setting probe / set for SanDisk U100
SSD. This is the SSD used for Stout and Butterfly.

TEST=Manual. Verify "mosys storage print/set phy_speed" commands on
Stout and Butterfly.
BUG=chrome-os-partner:17615
BRANCH=butterfly, stout.

Change-Id: I1d322571f5f4a09368157954cff3cff0171c1ce4
Reviewed-on: https://gerrit.chromium.org/gerrit/47070
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Tested-by: Shawn Nematbakhsh <shawnn@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
18 months agoAdd a 'storage' command. 65/47065/8
Shawn Nematbakhsh [Mon, 1 Apr 2013 22:54:47 +0000 (15:54 -0700)]
Add a 'storage' command.

This adds a 'mosys storage' command along with subcommands to probe and
set various parameters related to storage devices.

BRANCH=none.
BUG=chrome-os-partner:17615
TEST=manual, verify storage commands on Stout platform (future commit).

Change-Id: I15bf12daffc901f9102e9591255774f5104c1cdc
Reviewed-on: https://gerrit.chromium.org/gerrit/47065
Commit-Queue: Shawn Nematbakhsh <shawnn@chromium.org>
Tested-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
18 months agospring: update board revision info 74/47274/3
David Hendricks [Tue, 2 Apr 2013 23:33:45 +0000 (16:33 -0700)]
spring: update board revision info

This updates mappings for board revision and updates names of enums
and GPIOs used to more accurately describe the platform and match
up with the datasheet.

BRANCH=spring
BUG=chrome-os-partner:17814
TEST=tested on Spring

Change-Id: I38f302747d20e14a83f9395b5986e82a6c96746b
Reviewed-on: https://gerrit.chromium.org/gerrit/47274
Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
20 months agoStout: Fall back to ACPI ports on version read failure. 10/44010/4 firmware-spring-3824.4.B firmware-spring-3824.55.B firmware-spring-3833.B release-R27-3912.B stabilize-3881.0.B stabilize-3912.79.B toolchainA
Shawn Nematbakhsh [Tue, 26 Feb 2013 02:31:50 +0000 (18:31 -0800)]
Stout: Fall back to ACPI ports on version read failure.

Sideband ports are not implemented in RO mode on Stout. It creates
problems when trying to read the EC version. Therefore, if version read
fails, assume we are in recovery and attempt to use the regular ACPI ports.

TEST=Manual. "mosys ec info" in recovery / RO mode.
BUG=chrome-os-partner:18004.
BRANCH=Stout.

Change-Id: Iebcf024b9b64823fafefa03a9293a8b1ee9f1188
Reviewed-on: https://gerrit.chromium.org/gerrit/44010
Commit-Queue: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
Tested-by: Shawn Nematbakhsh <shawnn@chromium.org>
20 months agomove butterfly out of experimental 32/43132/3 stabilize-3701.30.0 stabilize-3701.30.0b
David Hendricks [Tue, 12 Feb 2013 22:24:54 +0000 (14:24 -0800)]
move butterfly out of experimental

It's no longer experimental :-)

BRANCH=none
BUG=none
TEST=compiled and ran on butterfly (platform identified correctly)

Change-Id: Ic2f689bb935ff1d570258cc200f00e1edfd76282
Reviewed-on: https://gerrit.chromium.org/gerrit/43132
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
20 months agogive spring it's own directory and implementation 28/43128/3
David Hendricks [Tue, 29 Jan 2013 23:21:55 +0000 (15:21 -0800)]
give spring it's own directory and implementation

This gives Spring its own directory. If you squint it kind of looks
like Snow, but more differences will surface as time goes on.

This patch also moves the Spring IDs from daisy's ID list
so that they don't conflict.

TODOs:
- Fill out the board revision ID table
- Add correct memory timing table

BUG=chrome-os-partner:17782,chrome-os-partner:17212
BRANCH=spring
TEST=tested commands on spring (ec, eeprom gpio, memory, nvram,
and platform) and made sure we didn't interfere with snow detection.

Change-Id: I35a9878d67ec07567908cdaf79ae2ef7de457dda
Reviewed-on: https://gerrit.chromium.org/gerrit/43128
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
20 months agodaisy/snow: remove cmdline parsing 27/43127/2
David Hendricks [Tue, 12 Feb 2013 21:37:02 +0000 (13:37 -0800)]
daisy/snow: remove cmdline parsing

Long ago, the kernel command-line was the only way to distinguish
Daisy and Snow. Now that we have FDT in place this is no longer
needed for platform detection. Also, the command-line contains
"daisy" even for spring, so it can confuse platform detection.

BUG=chrome-os-partner:17212
BRANCH=spring
TEST=tested on snow and spring

Change-Id: Ife60e8718c5350199d7a100e84eff8b7e6fc1cc9
Reviewed-on: https://gerrit.chromium.org/gerrit/43127
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
20 months agoadd basic Spring board support 61/42661/2 stabilize-bluetooth-smart
Vincent Palatin [Tue, 5 Feb 2013 22:55:25 +0000 (14:55 -0800)]
add basic Spring board support

Just alias Spring as a Daisy, so the basic stuffs are working in crossystem
until we have full support.

BRANCH=none
BUG=chrome-os-partner:17212
TEST=on Spring, boot and type "crossystem", do not get errors such as
"Unable to auto-detect platform. Limited functionality only".

Change-Id: I44799bba18270d921d57fba47c2117af50628976
Reviewed-on: https://gerrit.chromium.org/gerrit/42661
Reviewed-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
20 months agomove stout out of platform/experimental/ 55/41855/3 stabilize-3658.0.0
David Hendricks [Wed, 23 Jan 2013 20:55:57 +0000 (12:55 -0800)]
move stout out of platform/experimental/

Stout is no longer experimental :-)

BRANCH=none
BUG=none
TEST=compiled and run on Stout

Change-Id: Ib01ffcbed51a6587073b7dacce1d73e9afcd368a
Reviewed-on: https://gerrit.chromium.org/gerrit/41855
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
21 months agoPropagate command return codes to the shell 07/40707/11
David Hendricks [Tue, 8 Jan 2013 22:51:38 +0000 (14:51 -0800)]
Propagate command return codes to the shell

From the dawn of time, mosys has only ever returned EXIT_SUCCESS
or EXIT_FAILURE. However, for testing and automation purposes it's
useful to have more error codes available, particularly ones like
ENOSYS and EINVAL to filter out commands which are not implemented
for a particular platform or require arguments.

This propagates return codes from whatever command is run to the
shell. If errno gets set, it will be used as the argument to exit().
If a generic error occurred without any specific errno to map to,
mosys will exit with -1 which will appear at the shell as an
undefined error (255).

As always, an exit value of 0 indicates success (EXIT_SUCCESS).

BRANCH=none
BUG=chromium-os:35257
TEST=tested using invalid arguments, filenames, etc. and examining $?

Example 1: Supplying invalid command:
localhost ~ # mosys foobar >/dev/null
Command not found

localhost ~ # echo $?
22 <-- EINVAL

Example 2: Command not implemented for current platform
localhost ~ # mosys eeprom enet info
Command not supported on this platform
localhost ~ # echo $?
38 <-- ENOSYS

Example 3: General error
localhost ~ # mosys eeprom map /tmp/foo.bin
unable to find fmap
could not read flash map
localhost ~ # echo $?
255

Change-Id: I3a2d91ced06eae8fdad645fa9b7c8e07c7877d83
Reviewed-on: https://gerrit.chromium.org/gerrit/40707
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
21 months agoUpdate return codes coming from commands 06/40706/10
David Hendricks [Tue, 15 Jan 2013 20:15:21 +0000 (12:15 -0800)]
Update return codes coming from commands

This updates return codes from commands and the the main intf/sub-
command handlers so that they correspond with values from errno.h.
Depending on the circumstance, the generic "-1" value was replaced
with more specific values from errno.h or -errno.

BRANCH=none
BUG=chromium-os:35257
TEST=tested in follow-up CL

Change-Id: I790de14aa96b2a3065a9061fc1b8608c811cff41
Reviewed-on: https://gerrit.chromium.org/gerrit/40706
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
21 months agoRe-factor "mosys eeprom map" command 08/41308/3
David Hendricks [Tue, 15 Jan 2013 20:11:54 +0000 (12:11 -0800)]
Re-factor "mosys eeprom map" command

This attempts to improve "mosys eeprom map":
- Fix return codes used in eeprom_map_cmd_* helper functions; make
  eeprom_map_cmd_eeprom() return ENODEV if specified device is not
  found.
- Make eeprom_map_cmd() more straightforward in its execution by
  handling the three possible cases (no arg, arg is a file, arg
  is a device name) more explicitly.
- Make error messages more useful using lperror() to print strerror().

BUG=none
BRANCH=none
TEST=Tested on Stout (see notes below)

The following was done with the follow-up patches applied to
propogate errno to the shell.

Example 1: Normal execution (with output suppressed):
localhost ~ # ./mosys eeprom map >/dev/null
localhost ~ # echo $?
0

Example 2: Bad is neither a file nor a EEPROM
localhost ~ # ./mosys eeprom map foo
Failed to read flashmap from device : No such device
localhost ~ # echo $?
19 <--- ENODEV

Example 3: File exists, but is bad
localhost ~ # touch foo
localhost ~ # ./mosys eeprom map foo
unable to mmap "foo"
Failed to read flashmap from file : Invalid argument
localhost ~ # echo $?
22 <--- EINVAL

Change-Id: I8a7ed61c7edc894c2b735b41f3914e4371843cd6
Reviewed-on: https://gerrit.chromium.org/gerrit/41308
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
21 months agouse a more sensible limit for line length when printing tree info 11/41311/3
David Hendricks [Tue, 15 Jan 2013 22:33:27 +0000 (14:33 -0800)]
use a more sensible limit for line length when printing tree info

This defines a maximum line length to use when recursively adding
command info which we can then use to calculate the maximum number
of bytes remaining on each iteration.

The line length must allow for leading tabs, the type of command,
the entire command, and a string terminator. The longest command
to date uses 43 characters in verbose mode.

BRANCH=none
BUG=none
TEST=run on stout

Change-Id: I0fd2210369301e5555a2c91678c15f50142a3547
Reviewed-on: https://gerrit.chromium.org/gerrit/41311
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
21 months agosimplify mosys -t -v output 31/40631/3
David Hendricks [Tue, 8 Jan 2013 04:00:50 +0000 (20:00 -0800)]
simplify mosys -t -v output

This makes it so that verbose output in the tree command will no
longer keep track of different root:branch:node numbers. The numbers
were never really used AFAIK, and also it turns out that the branch
cannot be accurately represented by a single number due to varying
complexity with different subcommand hierarchies.

This simplification should also make it somewhat easier to parse
for a desired subcommand type.

BRANCH=none
BUG=chromium-os:35257
TEST=tested on stout (see notes below)

Example for verbose output:
"mosys ec" (new format):
[root] mosys ec
        [leaf] mosys ec info

Change-Id: I0262e41e1e13c3df83e8efdfd4029cf27759f6a6
Reviewed-on: https://gerrit.chromium.org/gerrit/40631
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
21 months agoFix battery set_fud month parameter. 25/41425/2
Shawn Nematbakhsh [Mon, 14 Jan 2013 17:36:07 +0000 (09:36 -0800)]
Fix battery set_fud month parameter.

tm_mon is defined as months since January - [0, 11]. set_fud defines
month on [1, 12], and existing code expects such a value.

BUG=chrome-os-partner:13108.
TEST=manual. "mosys battery set fud" on Stout, confirm month set
correctly.
BRANCH=stout.

Change-Id: I9579bfa63dc88be495ee6c1e8c9359e8c0ed53ea
Original-Change-Id: Ib76455abd2b5c0dc373f2835cc5152336078a686
Reviewed-on: https://gerrit.chromium.org/gerrit/41207
Commit-Queue: Shawn Nematbakhsh <shawnn@chromium.org>
Tested-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41425

21 months agorename a local variable in tree_subcommand() 30/40630/3
David Hendricks [Tue, 8 Jan 2013 03:56:33 +0000 (19:56 -0800)]
rename a local variable in tree_subcommand()

This renames "leaf" to "index" to clarify its meaning as an index
number since it can be used for any endpoint (leaf/flur).

BRANCH=none
BUG=none
TEST=tested on stout

Change-Id: I86d401d02904df0971d084b71af1fd884406980b
Reviewed-on: https://gerrit.chromium.org/gerrit/40630
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
21 months agoFix verbosity of -t option 29/40629/2
David Hendricks [Tue, 8 Jan 2013 01:26:40 +0000 (17:26 -0800)]
Fix verbosity of -t option

Normal verbosity should only display a terse listing of commands,
not the depth level and other stuff.

This patch fixes a bug whereby the verbose tree printing was always
shown. This was likely introduced in the original porting effort but
went unnoticed.

BRANCH=none
BUG=none
TEST=tested on stout

Change-Id: I57e41d8954b716886104de116caa6184dbcca076
Reviewed-on: https://gerrit.chromium.org/gerrit/40629
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
21 months agoremove a stray comment (trivial) 34/40634/2
David Hendricks [Tue, 8 Jan 2013 21:51:32 +0000 (13:51 -0800)]
remove a stray comment (trivial)

BRANCH=none
BUG=none
TEST=none

Change-Id: I068c308be4e591a16e02b203c3dc322ef0e29cab
Reviewed-on: https://gerrit.chromium.org/gerrit/40634
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
21 months agoStout: Add battery firmware update command. 22/40422/6 factory-3536.B
Shawn Nematbakhsh [Fri, 4 Jan 2013 03:45:40 +0000 (19:45 -0800)]
Stout: Add battery firmware update command.

Add command for updating battery firmware.

TEST="mosys battery update" on stout platform.
BUG=chrome-os-partner:17046
BRANCH=stout

Change-Id: I9c84ef2c3e89c6091ef5cae9f822e5ea2b40463f
Reviewed-on: https://gerrit.chromium.org/gerrit/40422
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Commit-Queue: Shawn Nematbakhsh <shawnn@chromium.org>
Tested-by: Shawn Nematbakhsh <shawnn@chromium.org>
22 months agotrivial modifications to some wording in the usage message 20/39720/3
David Hendricks [Fri, 14 Dec 2012 19:12:36 +0000 (11:12 -0800)]
trivial modifications to some wording in the usage message

This makes minor changes to the descriptions of some options.

BRANCH=none
BUG=none
TEST=ran on stout to make sure I didn't break something...

Change-Id: Ibe80b58965ce10699aedd1ab5d0c061fd339b8d4
Reviewed-on: https://gerrit.chromium.org/gerrit/39720
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
22 months agotrivial re-formatting of usage menu in source code 19/39719/3
David Hendricks [Fri, 14 Dec 2012 19:02:14 +0000 (11:02 -0800)]
trivial re-formatting of usage menu in source code

This only re-formats the source code to replace leading spaces
with a tab and bring the options leftward.

BRANCH=none
BUG=none
TEST=tested on stout (run with -h and pipe to file, diff to ensure
no changes in output)

Change-Id: Ieda2fbdf3662753ce53ae60065c17b3951767688
Reviewed-on: https://gerrit.chromium.org/gerrit/39719
Commit-Queue: David Hendricks <dhendrix@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
22 months agofix a trailing newline at end of output in -l mode 51/39751/4
David Hendricks [Sun, 16 Dec 2012 01:13:51 +0000 (17:13 -0800)]
fix a trailing newline at end of output in -l mode

The long style formatting prints a newline unconditionally at the end
of each line. Since a newline is printed at the end of
kv_pair_print_to_file(), two newlines appear at the end of the output.

This makes long style formatting print a newline only if it's not
at the end of the list. The final newline is inserted at the end
of the function, like with other styles.

BRANCH=none
BUG=none
TEST=ran "mosys -l platform name" and no longer saw a newline at the
end of the output

Change-Id: Ia7781aed871754be04e14e63da432b3994d118c6
Reviewed-on: https://gerrit.chromium.org/gerrit/39751
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Commit-Ready: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
22 months agoRe-factor kv_pair_print_to_file() to reduce nesting 50/39750/5
David Hendricks [Sun, 16 Dec 2012 00:33:32 +0000 (16:33 -0800)]
Re-factor kv_pair_print_to_file() to reduce nesting

kv_pair_print_to_file() iterates over all kv_pairs in the provided
list for all styles, so each case has its own for-loop and
if-statement for sanity checking that a key and value exist.

This flips that around so that there is a single for-loop and
if-statement, reducing duplicate statements and reducing nesting by
1 level.

BRANCH=none
BUG=none
TEST=ran "mosys ec info" on stout with all formatting flags, saw
no change in output format.

Change-Id: I24724e8f6135042ed8ee4deb026bb50dff849316
Reviewed-on: https://gerrit.chromium.org/gerrit/39750
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Commit-Ready: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
22 months agoadd single key=value printing mode 48/39748/5
David Hendricks [Fri, 14 Dec 2012 20:04:39 +0000 (12:04 -0800)]
add single key=value printing mode

If -s [key] is specified, the key is matched against those in
the list of kv pairs. If a match is found, the raw value is
printed and 0 is returned.

BRANCH=none
BUG=chromium-os:36425
TEST=see notes below

Example of printing a valid single value:
localhost ~ # mosys ec info -s fw_version ; echo $?
0.92
0

Example of printing an invalid single value:
localhost ~ # mosys ec info -s foobar ; echo $?
1

Change-Id: I2fe9ba5bdc393be9f80a1a04d28ba80afeef7326
Reviewed-on: https://gerrit.chromium.org/gerrit/39748
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Commit-Ready: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
22 months agoadd a return code to kv_pair_print() 49/39749/3
David Hendricks [Sat, 15 Dec 2012 01:17:13 +0000 (17:17 -0800)]
add a return code to kv_pair_print()

This adds a return code to kv_pair_print(). This is in anticipation
of adding a single-value printing mode which can return a failure
code if the key specified by the user is not matched.

Call sites are also updated to take return code into account. This
meant updating some functions to return an int instead of void.

(this also fixes a trivial >80 cols error)

BRANCH=none
BUG=chromium-os:36425
TEST=tested in follow-up CL

Change-Id: Ic5a22c1db018c576d383d39938c76bd2163b6228
Reviewed-on: https://gerrit.chromium.org/gerrit/39749
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Commit-Ready: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
22 months agorename -s option to -S 47/39747/2
David Hendricks [Fri, 14 Dec 2012 19:23:17 +0000 (11:23 -0800)]
rename -s option to -S

-s is currently used to print supported platforms for a given binary.
It's rarely used AFAIK, so make it -S so that -s can be used by a
formatting flag.

BRANCH=none
BUG=chromium-os:36425
TEST=tested on Stout

Change-Id: I00766723c1c9e085169e3e28b6f39378a7024ae7
Reviewed-on: https://gerrit.chromium.org/gerrit/39747
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Commit-Ready: David Hendricks <dhendrix@chromium.org>
Tested-by: David Hendricks <dhendrix@chromium.org>
22 months agoStout: Add support for new battery first-use-date commands. 39/39639/5 toolchain-3428.65.B
Shawn Nematbakhsh [Thu, 13 Dec 2012 03:38:34 +0000 (19:38 -0800)]
Stout: Add support for new battery first-use-date commands.

Stout needs the ability to set battery first-use-date. Add
first_use_date print/set commands.

TEST=manual, mosys battery {print,set} fud on Stout.
BUG=chrome-os-partner:13108
BRANCH=none

Change-Id: I3af0c7612c632a937cf328d46e156bb430aff0b0
Reviewed-on: https://gerrit.chromium.org/gerrit/39639
Commit-Ready: Shawn Nematbakhsh_ <shawnn@chromium.org>
Reviewed-by: Shawn Nematbakhsh_ <shawnn@chromium.org>
Tested-by: Shawn Nematbakhsh_ <shawnn@chromium.org>
22 months agoAdd a battery command. 94/39694/5
David Hendricks [Tue, 13 Nov 2012 20:02:40 +0000 (12:02 -0800)]
Add a battery command.

This adds a "mosys battery" command along with subcommands to print
and set first use date information (to be implemented in platform
code).

BRANCH=none
BUG=chrome-os-partner:13108
TEST=manual, verify battery fud commands on Stout platform (future commit).

Change-Id: I41ff59291463d7bdb70a0f45e5b956f8b62d230a
Reviewed-on: https://gerrit.chromium.org/gerrit/39694
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Commit-Ready: Shawn Nematbakhsh_ <shawnn@chromium.org>
Reviewed-by: Shawn Nematbakhsh_ <shawnn@chromium.org>
Tested-by: Shawn Nematbakhsh_ <shawnn@chromium.org>