Commit Graph

52 Commits

Author SHA1 Message Date
Vic Yang
216bb93128 Fix flash tests
This merges flash_overwrite and flash_rw_erase to a single test binary.

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

Change-Id: I1da7577cb5dc196178930dda3a07bb942d959866
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48090
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-04-15 20:40:02 -07:00
Randall Spangler
97bf36c9d3 Add parse_bool() to centralize parsing boolean options
This way debug commands which previously took only yes/no or on/off or
enable/disable can take any of those options.

BUG=chrome-os-partner:18467
BRANCH=none
TEST=Try "on", "off", "yes", "no", "true", "false", "ena", "disable", for
each of the following commands:
  - ilim (spring)
  - pll (link)
  - power (spring/snow)
  - hcdebug (all)
  - kblog (link)
  - ksscan (all)
  - lp5562 (spring)

Change-Id: Ie8e0fae3775b1da711864bcba6682ba5e68a06f1
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/46900
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2013-03-29 15:39:34 -07:00
Randall Spangler
cbee62d01e Clean up host command module
Code cleanup only; no functional changes

BUG=chrome-os-partner:15579
BRANCH=none
TEST=ectool hello -> success

Change-Id: I40391b66efaeab873e99500d4f58a5a779eb2c71
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36557
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-10-25 11:23:59 -07:00
Randall Spangler
8febf5ba28 Host commands use correct console channel
Previously they reported on the system channel, not the hostcmd channel.

BUG=none
BRANCH=none (affects all platforms, but only affects use of 'chan' ec console command)
TEST=manual

  - chan 0x40
  - x86reset
  - should see HC debug output.

Change-Id: Ie9873db015c94a0198a94ebafad87d51b0f73620
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35953
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-10-18 14:24:54 -07:00
Simon Glass
d392ed7266 Move pending command logic into host_command
This logic doesn't really belong in drivers, since to enable another
driver (like SPI) we must repeat it all. This is tricky if we enable
both I2C and SPI.

Move the logic into host_command.

BUG=chrome-os-partner:10533
BRANCH=none
TEST=manual

Use U-Boot to test comms status functionality on snow:

SMDK5250 # mkbp write rw 40000000
SMDK5250 # mkbp erase rw
SMDK5250 # mkbp erase rw

Change-Id: I3f90aada80208cd0540be14525f73f980ad33292
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/32075
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-09-10 16:17:13 -07:00
Randall Spangler
e2de50ee76 Fix stack overflow in hostcmd command
It was putting the entire parameter buffer for a host command on the
stack.  Now it uses shared memory.

BUG=chrome-os-partner:13613
TEST='hostcmd 4' should not cause a crash several seconds later
BRANCH=link (snow is also affected, but doesn't have enough shared memory to put the command buffer there either)

Change-Id: I8405d88857ee92a5cee429e156df5e645d5d864d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/32181
Reviewed-by: Vic Yang <victoryang@chromium.org>
2012-09-04 16:34:51 -07:00
Simon Glass
0ecfe96c7e host_command: Add host_send_response() to send responses
Rather than have the send_response() handler called willy nilly from
around the EC code, provide an official function for doing this step.

BUG=chrome-os-partner:12685
BRANCH=snow,link
TEST=manual
build and boot to kernel on snow
Tried 'mkbp reset' command on snow but it did not seem to work properly
Unable to test on link at present

Change-Id: I8d9146639efb2af482d80563b403771cee961942
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/30468
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-08-16 12:44:02 -07:00
Randall Spangler
903dc92ec1 Add additional host command debug output
Prints when a host command returns an error code.

When 'hcdebug on', hex-dumps the host command params and response.

BUG=none
TEST=manual (> is ec console, $ is root shell)
  $ ectool gpioget foobar --> EC console shows error 2 returned
  > hcdebug on
  $ ectool hello --> EC console shows params and response as hex
  > hcdebug off
  $ ectool hello --> no extra output on EC debug console

Change-Id: I2dbc77be5b59125f394d970cf1c83c2a976e926e
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28948
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-08-01 11:58:24 -07:00
Randall Spangler
30b2bd27f6 Improve hostcmd command
Version and params fields are optional.
Output uses "%h" format code.

BUG=none
TEST=manual

    > hostcmd 0
    Response: 02000000
    > hostcmd 0 0
    Response: 02000000
    > hostcmd 0 1
    Command returned 6
    > hostcmd 1 0 10203040
    Response: 14233241

Change-Id: I8b3ff0f7d9a1131f942604724e04c59ff818396d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28705
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-30 14:15:03 -07:00
Randall Spangler
247fdaf13d Change host command params/response pointers to void *
This removes a bunch of unnecessary typecasts, since you can assign
to/from void * without them.  This also uncovered a few cases where
const was being cast away for the input params; now fixed.

BUG=none
TEST=mkbp hash from u-boot console, and/or system boots ok

Change-Id: Ic314b9d2ca06226ea8a09703ef5c1a912eb7146d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28500
2012-07-26 16:25:34 -07:00
Vic Yang
0653aa011a Add console command to inject host command
For easier testing.

BUG=chrome-os-partner:11350
TEST=Try host command 0x01=CMD_HELLO.
      > hostcmd 0x01 0 00000000
      04030201
      > hostcmd 0x01 0 01020304
      05050505

Change-Id: I18becbd7d26241fa673fd46d9ce23a984ac47026
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28059
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-07-23 18:13:58 -07:00
Simon Glass
6147b158d5 host_command: Add send_result() to the arg structure
It's a bit odd that the drivers package up a command to be processed
by host_command, but then host_command calls a global function to
pass the response back.

This adds ambiguity in the host_send_response() implementations as to
whether the command being responded to really is using the same
buffers that the driver set up.

Add a function pointer to the command, and have host_command call
that. Add status to the args structure also, which removes some of
the special case logic for error handling.

BUG=chrome-os-partner:11317
TEST=manual and a bit ad-hoc:
(note, this testing is not completed yet)
Check that snow and link still process commands correctly over I2C
from U-Boot. At this stage only the old interface is supported.
SMDK5250 # mkbp test
Old interface:

New interface:
Version 0: ec_command() returned error
Test failed with error -1
SMDK5250 #

Change-Id: I816738150bce3f8d78e7cd32abf361621aa12312
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/28154
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-07-23 13:23:06 -07:00
Randall Spangler
ee71c0ae1b Revert "host_command: Add send_result() to the arg structure"
This reverts commit 18db93b25b05c871826fd1853a33a560e64ed247

Breaks link checksums.

Change-Id: Ieeb278b7d4da0600bdc9ced1476b67f23abce1a1
Reviewed-on: https://gerrit.chromium.org/gerrit/28136
Commit-Ready: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Randall Spangler <rspangler@chromium.org>
2012-07-22 13:17:04 -07:00
Simon Glass
949d525e2a host_command: Add send_result() to the arg structure
It's a bit odd that the drivers package up a command to be processed
by host_command, but then host_command calls a global function to
pass the response back.

This adds ambiguity in the host_send_response() implementations as to
whether the command being responded to really is using the same
buffers that the driver set up.

Add a function pointer to the command, and have host_command call
that. Add status to the args structure also, which removes some of
the special case logic for error handling.

BUG=chrome-os-partner:11317
TEST=manual and a bit ad-hoc:
(note, this testing is not completed yet)
Check that snow and link still process commands correctly over I2C
from U-Boot. At this stage only the old interface is supported.
SMDK5250 # mkbp test
Old interface:

New interface:
Version 0: ec_command() returned error
Test failed with error -1
SMDK5250 #

Change-Id: Ic4afdcd7689666cc0f6af228abc6cffe41b0fcbf
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27468
2012-07-22 00:36:39 -07:00
Randall Spangler
7ee63359b8 Support preserving reset flags across a reset
This is needed for flash pre-init to be able to hard reset to clear
uncommitted write protect flags without losing the reset flags.

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

Use reboot and sysinfo commands...

1. reset with keyboard.  flags -> reset-pin
2. 'reboot soft preserve'  flags -> soft reset-pin power-on
3. 'reboot hard preserve'  flags -> hard soft reset-pin power-on
4. 'reboot soft'.  flags -> soft
5. 'reboot hard'.  flags -> hard power-on

Change-Id: I6164a78d99c5c10330f90f651148c5795e7afdda
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27418
2012-07-16 10:20:58 -07:00
Randall Spangler
c304ff7d81 Use response pointer and size from host command args struct
Saves 2 params being passed around needlessly.

BUG=chrome-os-partner:11275
TEST=mkbp hash from u-boot console should still work

Change-Id: I958e4a09f16413e4d051e278dc0384aa9b791aa4
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27312
2012-07-12 15:50:14 -07:00
Randall Spangler
02f0ad7ea8 Pass maximum size of response buffer in via host command handler args
BUG=chrome-os-partner:11275
TEST=from u-boot prompt, 'mkbp hash'

Change-Id: I4cf37acfdd8e4edfe2cb6259b0fc6d0860ef0f79
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27225
2012-07-12 11:32:06 -07:00
Randall Spangler
347b5062a4 Initialize memory mapped data and add data versions
BUG=chrome-os-partner:11275
TEST=manual

localhost ~ # io_read8 0x920
0x45 // 'E'
localhost ~ # io_read8 0x921
0x43 // 'C'
localhost ~ # io_read8 0x922
0x01 // version 1
localhost ~ # io_read8 0x9fe
0x00 // unused data initialized to 0

Change-Id: If8de85ddc0e5f99b7c4213214d4b2d30b1439da8
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27196
2012-07-12 11:32:06 -07:00
Randall Spangler
bdf3ba5ded Move host_cmd_handler_args farther up the call chain
This is necessary for an imminent change which passes version data
from the host bus (LPC/I2C/SPI) into the host command handler.

BUG=chrome-os-partner:11275
TEST=from u-boot prompt, 'mkbp hash'

Change-Id: If34d0d7c6dc320ad5632becf512c30900fd61aca
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27190
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-11 17:22:57 -07:00
Randall Spangler
fe5c01cb6e Add host command to check what command versions are supported
BUG=chrome-os-partner:11275
TEST=manual

ectool cmdversions 0x08 -> should print 0x00000001
ectool cmdversions 0xdd -> should print command not supported

Change-Id: I7801be51492eb6a5321accaa2b66f0dc8d5a2797
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27181
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-11 14:46:31 -07:00
Randall Spangler
07ca0977fe Refactor API for host commands, and handle variable length data better
Added version mask field to DECLARE_HOST_COMMAND() because it's
convenient to do so when I'm touching all host command
implementations, but all commands simply declare version 0 and nothing
checks it yet.  Will add version support in a followup CL.

This change is internal to the EC; it does not change the data sent
over the host interface.

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

ectool version && ectool echash; should get sane data from both

ectool flashread 0x80 0x40 /tmp/foo && od -tx1 /tmp/foo
should match data from offset 0x80 of ec.bin (od -j128 -n64 -tx1 ec.bin)

Change-Id: I5699f72b8d5e1ac23929353c9a34158d76c44206
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27172
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-11 14:46:30 -07:00
Randall Spangler
29332907d4 Host command interface has only one slot now
Now that ACPI events are handled directly in the LPC interrupt
handler, we can simplify the host event code.

BUG=chrome-os-partner:11240
TEST=boot system; should boot
close lid; should send SMI and suspend system

Change-Id: I8c73ea31a66e94310e4460a008635a103220413e
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27100
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-10 21:52:07 -07:00
Randall Spangler
f2400b869e Move ACPI query-event handling to LPC interrupt
And only support it for port 62/66.

Also remove 'ectool queryec', because it can't touch port 62/66 once
the kernel/ACPI owns it, and query-event isn't supported on the user
command port.

BUG=chrome-os-partner:11240
TEST=boot system and check EC console output; should see event clears between
host commands 0x23, 0x8e, but no hostcmd 0x84.

[0.396780 LPC RESET# deasserted]
[0.486953 Port 80: 0x29]
[0.487415 hostcmd1 0x23]
[0.764407 Port 80: 0x88]
[0.764579 event clear 0x00000008 -> 00002080]
[0.764928 event clear 0x00000080 -> 00002000]
[0.765224 event clear 0x00002000 -> 00000000]
[0.765578 hostcmd1 0x8e]
[0.765868 hostcmd1 0x06]

Change-Id: I8ed161dbccd396d685ddf6829a27dfef87d919fb
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27095
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-10 21:52:07 -07:00
Randall Spangler
2daf748e0e Get rid of double debug output for host commands
(in both command_process() and host_command_process())

BUG=none
TEST=none

Change-Id: I6eafe110b425afac9d94ace710efe5bbf7342073
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/27080
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-07-10 16:18:59 -07:00
Randall Spangler
1e8e8cd6aa Add new event for host interface ready
Also add new 'invalid' host event bit; if the host reads this, it
knows the memory-mapped data for current events is invalid.

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

On host, ectool eventget -> should print events = 0
On EC, hostevent set 0x80000000
On host, ectool eventget -> should print events = invalid

Reboot EC; should see debug output where event mask 0x2000 is set
during the boot process.

Signed-off-by: Randall Spangler <rspangler@chromium.org>
Change-Id: I8d3f161eec25db50ac06e3642a1a1fb8edb9590e
Reviewed-on: https://gerrit.chromium.org/gerrit/26876
2012-07-07 23:05:50 -07:00
Randall Spangler
7f5f7be3e5 Add memory-mapped data support for I2C and SPI protocols
And fix returning memory-mapped string length on LPC as well.

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

from EC, 'hostevent set 0x40000'
from host, 'ectool eventget' --> should print 0x40000

Signed-off-by: Randall Spangler <rspangler@chromium.org>
Change-Id: I9edbd0a1468b5d4160ce67c471332226e51fa868
Reviewed-on: https://gerrit.chromium.org/gerrit/26719
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-07-07 17:14:18 -07:00
Simon Glass
9a4205faf3 Add host_command_process() to process a command immediately
Rather than go through the task queue, host_command_process() processes
the command immediately, has all of its required state passed in,
allowing the caller complete control of the buffers.

BUG=chrome-os-partner:10533
TEST=manual:
build and boot on link, see that messages are stil processed
build and boot on snow, which uses this new command
See that the SPI keyboard works now

Change-Id: Ib7587de10c42caf01bc95bb4d515fd0afc3da7d8
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/25983
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2012-07-03 13:24:28 -07:00
Simon Glass
e723318ec1 Remove unnecessary host_send_result()
This seems to be a hangover from the LPC protocol. We can send a result
just by sending a response with no data.

Drop this function and remove all uses of it.

Also use 'enum ec_status' instead of int, since this is the correct
response type.

BUG=chrome-os-partner:10533
TEST=manual:
build for all boards
build and boot on daisy

Change-Id: I93a029bd6ba8cec567b61af3b410bcead015b5c0
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/25980
2012-07-02 20:36:57 -07:00
Randall Spangler
b2c4ee6cf8 Even more debug command cleanup to save space
BUG=none
TEST=(run the commands)

Change-Id: Ibc414ffd594e06dbdce64c51859b6f247bb10d36
Signed-off-by: Randall Spangler <rspangler@chromium.org>
2012-05-21 14:57:08 -07:00
Vincent Palatin
4c5f1365b5 Use common host command processing for Daisy I2C
This also updates the communication protocol between the EC and the AP in a
non backward compatible way.

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

BUG=chrome-os-partner:9614
TEST=on Daisy with updated kernel driver, use the keyboard in ChromeOS

Change-Id: I5a50e9a74b9891153a37ea79318c8a66a1b0c5ca
2012-05-18 17:57:51 +00:00
Vincent Palatin
b74cbd8a74 de-LPCify the EC host interface
Preparatory work to use common host command code between ARM and x86.

Just rename constants, do not change the binary API.

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

BUG=chrome-os-partner:9614
TEST=make BOARD=link

Change-Id: I534d427c9b50103273835a6f32a0ddb622c762b3
2012-05-15 18:34:50 -07:00
Vincent Palatin
87d3707f62 Slightly update the host commands API
Preparatory work to use common host command code between ARM and x86.

Every command sends back explicitly the size of the response payload.
The size of the response defaults to 0 ond can be updated.

Add a protocol version number returned as command 0x00 to help with
backward compatibility.

move a couple of function from lpc specific header to host commands to
be able to implement them for the I2C link.

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

BUG=chrome-os-partner:9614
TEST=make BOARD=link

Change-Id: I6a28edf02996ddf6b7f32a3831d07d5f0271848f
2012-05-14 23:33:21 +00:00
Randall Spangler
135f14bf49 Refactor async console output
This adds a 'ch' command which prints/sets which channels are active

This handles all the async output; the remaining debug commands will
be refactored to use ccprintf() / ccputs() in a followup CL.

Signed-off-by: Randall Spangler <rspangler@chromium.org>

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

ch --> all channels active
ch 0x100 -> just port80 active
powerbtn -> system boots; only port 80 codes shown on console

Change-Id: I9efc43acec919b62b78c2c82c61946d32380adfe
2012-04-24 17:46:54 -07:00
Randall Spangler
24dafefb3a Move externs from .lds file into a header file
Fewer magic externs = good.

Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=none
TEST=if it boots, it works

Change-Id: Ifadeb1701400c5492c40d2eaf8f68f2d70189648
2012-04-19 14:29:07 -07:00
Randall Spangler
a61d8db3d3 Change task messages to events
Signed-off-by: Randall Spangler <rspangler@chromium.org>

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

make BOARD={bds,link,daisy}
make tests
flash link system and make sure it boots

Change-Id: I1241a1895c083e387e38ddab01ac346ca4474eb9
2012-04-06 09:06:53 -07:00
Randall Spangler
e85cb93715 Add LPC command to get EC build info
Useful when debugging to determine if a user has an official build or
not, particularly early in the devel process where we're handing
builds to everyone.  Particularly useful for proto1, since not all
those systems will be case-open servo-attached.

Also move get-version LPC command into system.c, where it's closer to
the system functions it calls (matches what we do for other host
commands).

Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=none
TEST=none

Change-Id: Idb0f6edf31ca00e32f083be0b0d3f23ab79c5fba
2012-03-05 11:05:15 -08:00
Randall Spangler
2464e96469 Add SMI/SCI support
BUG=chrome-os-partner:8277
TEST=manual

On EC console:
   hostevent set 0x1e
From root shell:
   ectool eventget --> should return 0x1e
   ectool eventclear 0x02
   ectool eventget --> should return 0x1c
   ectool queryec  --> should return event 3
   ectool queryec  --> should return event 4
   ectool queryec  --> should return event 5
   ectool queryec  --> should return no event pending
   ectool eventsetsmimask 0x1200
   ectool eventsetscimask 0x0034
   ectool eventgetsmimask --> should return 0x1200
   ectool eventgetscimask --> should return 0x0034
On EC console:
   hostevent --> should show raw=0 SMI mask = 0x1200 SCI mask = 0x34

Change-Id: I33042fa80c0b148cd63209a94a184af493e25ed3
2012-03-05 09:23:51 -08:00
Randall Spangler
9a60f37c8d Refactor LPC status / result codes
This is necessary to support SCI/SMI events.

Note that this breaks compatibility with previous ectool builds - and
probably also breaks flashrom support.

Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8253
TEST='ectool hello' and 'ectool flashinfo' still work
and 'ectool usbchargemode 3 1' fails with error 2

Change-Id: If39e5b6e7cdcec1b5ec765594e8492925b430b10
2012-03-01 15:22:14 -08:00
Randall Spangler
b2b5455f32 Fix version command crashing if no image B
Signed-off-by: Randall Spangler <rspangler@chromium.org>

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

Change-Id: Ie14465283c09029c3d2fa9a32296f32ce7304760
2012-02-28 14:29:52 -08:00
Randall Spangler
4c89ccd89e Register host commands the same clever way we do console commands
BUG=none
TEST=run assorted ectool commands

Change-Id: I830d3cbf2d1557b3ab455ec8736d3de5e5d3e697
2012-02-28 13:58:34 -08:00
Randall Spangler
e84fc7b110 Add persistent host storage in EC EEPROM
Signed-off-by: Randall Spangler <rspangler@chromium.org>

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

from root shell on host:
  ectool pstoreinfo   --> should print PstoreSize 1024 AccessSize 4
  echo testing 1 2 3 4 > /tmp/infile
  ectool pstorewrite 8 /tmp/infile
  ectool pstoreread 8 /tmp/outfile
  diff /tmp/infile /tmp/outfile

Change-Id: I565e580307584f7def36c5e53d360c1a897d67d2
2012-02-28 13:02:17 -08:00
Vic Yang
b9999a2c6c Remove EC_LPC_COMMAND_TEMP_SENSOR_GET_READINGS
We now read temp sensor readings using the EC mapped space.
So we don't need this command.

Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:8239
TEST="ectool temps 0" works.

Change-Id: I47f425e45cea992b19734f39ac6d9f6db6433d39
2012-02-27 14:18:25 -08:00
Randall Spangler
12b12e5334 Add EC host commands for keyboard backlight
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8128
TEST='ectool setkblight X && ectool getkblight' for X=1, 20, 99, 100, 0

Change-Id: I540fd2d05f4caa110cd1dc45e9b5184fc8777a06
2012-02-21 12:59:44 -08:00
Vic Yang
6a60a7fbdc USB charging control LPC command.
Add a LPC command to control USB charging mode. Also add the command to
ectool.

BUG=chrome-os-partner:7476
TEST=Manually test on link proto-0.

Change-Id: Ica87d0a690bc86e28844bd695f31641398b21939
Signed-off-by: Vic Yang <victoryang@chromium.org>
2012-02-16 12:45:51 -08:00
Vincent Palatin
c21f07e58e register console commands at compile-time
Instead of using a runtime callback to register the console commands,
put them in a special linker section. So we can do a macro to "register"
them during the build.

It saves 684 bytes and a few microseconds at startup.

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

BUG=None
TEST=run a few commands from the BDS command line.

Change-Id: Id33ea210b9035bf76ed720373c74c5dd24ccd1b1
2012-01-24 00:50:08 +00:00
Vic Yang
e98b6befca Add EC host command to control fan speed.
Add LPC host command to get and set fan speed.

BUG=chrome-os-partner:7313
TEST=Connect a fan and manually test fan actual speed matches target
speed.

Change-Id: I4b6a711a1b8cca0dbd1c1936fe4f0f15240d3453
2011-12-27 10:14:29 +08:00
Vic Yang
b228bc14c0 Add host command to read temperature sensor value
Add a LPC host command to read temperature sensor value with given
sensor id.
Add ectool command to read temperature sensor value through LPC.

BUG=chrome-os-partner:7329
TEST=Manual check the reading received is the same as value printed by
console command.

Change-Id: Id3386774435be6c3ae010a143f4fa894568efdb8
2011-12-22 13:51:07 +08:00
Louis Yung-Chieh Lo
6995d4771f Support flash checksum command for re-transmit.
The LPC is not stable enough to test. Kodus Rong. He creates this idea
to checksum the partial content of flash for read/write/erase. This can
improve the robustness of flashrom.

BUG=none
TEST=Tested with flashrom.

Change-Id: I2a2f7b698a94674c03cbd8e3f15caf34f8986399
2011-12-12 21:24:48 +08:00
Rong Chang
1eb5417847 Add flash write protect range command
This CL add host command to enable, get/set flash write protect range.

BUG=None
TEST=Use flashrom utility to set write protect range, enable write
protect and get status.

Change-Id: I345f1eb65944d8cf8028e6fdb7e43c40cc742a6d
Signed-off-by: Rong Chang <rongchang@chromium.org>
2011-12-12 18:21:08 +08:00
Randall Spangler
20886cb9c0 Add user-mode LPC endpoint
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=none
TEST='ectool hello' on target system

Change-Id: I39845c2ea107ea6f85ef556d58e49343f5a0e9c0
2011-12-08 16:18:20 -08:00